@proxysoul/soulforge 2.18.4 → 2.18.6
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/dist/index.js +294 -64
- package/dist/workers/intelligence.worker.js +438 -424
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3851,7 +3851,10 @@ function readJsonFile(path) {
|
|
|
3851
3851
|
return null;
|
|
3852
3852
|
}
|
|
3853
3853
|
return JSON.parse(readFileSync5(path, "utf-8"));
|
|
3854
|
-
} catch {
|
|
3854
|
+
} catch (err2) {
|
|
3855
|
+
const msg = err2 instanceof Error ? err2.message : String(err2);
|
|
3856
|
+
process.stderr.write(` Warning: invalid ${path} \u2014 ${msg}. Ignoring.
|
|
3857
|
+
`);
|
|
3855
3858
|
return null;
|
|
3856
3859
|
}
|
|
3857
3860
|
}
|
|
@@ -5211,8 +5214,17 @@ function loadConfig() {
|
|
|
5211
5214
|
try {
|
|
5212
5215
|
userConfig = JSON.parse(readFileSync8(configFile, "utf-8"));
|
|
5213
5216
|
} catch (err2) {
|
|
5214
|
-
|
|
5215
|
-
|
|
5217
|
+
const msg = err2 instanceof Error ? err2.message : String(err2);
|
|
5218
|
+
process.stderr.write(`
|
|
5219
|
+
Error: invalid config.json \u2014 ${msg}
|
|
5220
|
+
|
|
5221
|
+
` + ` Path: ${configFile}
|
|
5222
|
+
|
|
5223
|
+
` + ` Fix the JSON syntax error and try again.
|
|
5224
|
+
` + ` (Your config was NOT overwritten.)
|
|
5225
|
+
|
|
5226
|
+
`);
|
|
5227
|
+
process.exit(1);
|
|
5216
5228
|
}
|
|
5217
5229
|
}
|
|
5218
5230
|
let merged = { ...DEFAULT_CONFIG };
|
|
@@ -5260,7 +5272,13 @@ function loadProjectConfig(cwd) {
|
|
|
5260
5272
|
const raw = readFileSync8(projectFile, "utf-8");
|
|
5261
5273
|
return JSON.parse(raw);
|
|
5262
5274
|
} catch (err2) {
|
|
5263
|
-
|
|
5275
|
+
const msg = err2 instanceof Error ? err2.message : String(err2);
|
|
5276
|
+
process.stderr.write(`
|
|
5277
|
+
Warning: invalid project config.json \u2014 ${msg}
|
|
5278
|
+
` + ` Path: ${projectFile}
|
|
5279
|
+
` + ` Fix the JSON syntax error. Ignoring project config for now.
|
|
5280
|
+
|
|
5281
|
+
`);
|
|
5264
5282
|
return null;
|
|
5265
5283
|
}
|
|
5266
5284
|
}
|
|
@@ -5391,7 +5409,6 @@ var DEFAULT_CONFIG, _presetOverlay = null, NESTED_KEYS;
|
|
|
5391
5409
|
var init_config2 = __esm(() => {
|
|
5392
5410
|
init_platform();
|
|
5393
5411
|
init_ensure_soulforge_dir();
|
|
5394
|
-
init_errors();
|
|
5395
5412
|
DEFAULT_CONFIG = {
|
|
5396
5413
|
defaultModel: "none",
|
|
5397
5414
|
routerRules: [],
|
|
@@ -46827,6 +46844,13 @@ function supportsTemperature(modelId) {
|
|
|
46827
46844
|
return true;
|
|
46828
46845
|
return v.major < 5 && (v.major < 4 || v.minor < 7);
|
|
46829
46846
|
}
|
|
46847
|
+
function isAdaptiveOnly(modelId) {
|
|
46848
|
+
const base = extractBaseModel(modelId);
|
|
46849
|
+
const v = parseOpusVersion(base);
|
|
46850
|
+
if (!v)
|
|
46851
|
+
return false;
|
|
46852
|
+
return v.major >= 5 || v.major === 4 && v.minor >= 7;
|
|
46853
|
+
}
|
|
46830
46854
|
|
|
46831
46855
|
// src/utils/errors.ts
|
|
46832
46856
|
function toErrorMessage(err2) {
|
|
@@ -51853,6 +51877,7 @@ var init_anthropic = __esm(() => {
|
|
|
51853
51877
|
return result;
|
|
51854
51878
|
},
|
|
51855
51879
|
fallbackModels: [
|
|
51880
|
+
{ id: "claude-opus-4-8", name: "Claude Opus 4.8" },
|
|
51856
51881
|
{ id: "claude-opus-4-7", name: "Claude Opus 4.7" },
|
|
51857
51882
|
{ id: "claude-opus-4-6", name: "Claude Opus 4.6" },
|
|
51858
51883
|
{ id: "claude-sonnet-4-6", name: "Claude Sonnet 4.6" },
|
|
@@ -51863,6 +51888,7 @@ var init_anthropic = __esm(() => {
|
|
|
51863
51888
|
{ id: "claude-haiku-4", name: "Claude Haiku 4" }
|
|
51864
51889
|
],
|
|
51865
51890
|
contextWindows: [
|
|
51891
|
+
["claude-opus-4-8", 1e6],
|
|
51866
51892
|
["claude-opus-4-7", 1e6],
|
|
51867
51893
|
["claude-opus-4-6", 1e6],
|
|
51868
51894
|
["claude-sonnet-4-6", 1e6],
|
|
@@ -64231,6 +64257,7 @@ var init_bedrock = __esm(() => {
|
|
|
64231
64257
|
return null;
|
|
64232
64258
|
},
|
|
64233
64259
|
fallbackModels: [
|
|
64260
|
+
{ id: "anthropic.claude-opus-4-8", name: "Claude Opus 4.8" },
|
|
64234
64261
|
{ id: "anthropic.claude-sonnet-4-20250514-v1:0", name: "Claude Sonnet 4" },
|
|
64235
64262
|
{ id: "anthropic.claude-haiku-4-5-20251001-v1:0", name: "Claude Haiku 4.5" },
|
|
64236
64263
|
{ id: "us.amazon.nova-pro-v1:0", name: "Amazon Nova Pro" },
|
|
@@ -64238,6 +64265,10 @@ var init_bedrock = __esm(() => {
|
|
|
64238
64265
|
{ id: "meta.llama3-1-70b-instruct-v1:0", name: "Llama 3.1 70B" }
|
|
64239
64266
|
],
|
|
64240
64267
|
contextWindows: [
|
|
64268
|
+
["claude-opus-4-8", 1e6],
|
|
64269
|
+
["claude-opus-4-7", 1e6],
|
|
64270
|
+
["claude-opus-4-6", 1e6],
|
|
64271
|
+
["claude-sonnet-4-6", 1e6],
|
|
64241
64272
|
["claude-sonnet-4", 200000],
|
|
64242
64273
|
["claude-opus-4", 200000],
|
|
64243
64274
|
["claude-haiku-4", 200000],
|
|
@@ -65753,18 +65784,23 @@ var init_auth = __esm(() => {
|
|
|
65753
65784
|
});
|
|
65754
65785
|
|
|
65755
65786
|
// src/core/llm/providers/codex/index.ts
|
|
65756
|
-
var CODEX_FALLBACK_MODELS, CODEX_CONTEXT_WINDOWS, codex;
|
|
65787
|
+
var GPT_55_INPUT_CONTEXT = 272000, CODEX_FALLBACK_MODELS, CODEX_CONTEXT_WINDOWS, CODEX_CONTEXT_WINDOW_OVERRIDES, codex;
|
|
65757
65788
|
var init_codex = __esm(() => {
|
|
65758
65789
|
init_client();
|
|
65759
65790
|
init_runner();
|
|
65760
65791
|
CODEX_FALLBACK_MODELS = [
|
|
65792
|
+
{ id: "gpt-5.5", name: "GPT-5.5", contextWindow: GPT_55_INPUT_CONTEXT },
|
|
65761
65793
|
{ id: "gpt-5.4", name: "GPT-5.4", contextWindow: 1050000 },
|
|
65762
65794
|
{ id: "gpt-5.2-codex", name: "GPT-5.2-Codex", contextWindow: 400000 }
|
|
65763
65795
|
];
|
|
65764
65796
|
CODEX_CONTEXT_WINDOWS = [
|
|
65797
|
+
["gpt-5.5", GPT_55_INPUT_CONTEXT],
|
|
65765
65798
|
["gpt-5.4", 1050000],
|
|
65766
65799
|
["gpt-5.2-codex", 400000]
|
|
65767
65800
|
];
|
|
65801
|
+
CODEX_CONTEXT_WINDOW_OVERRIDES = [
|
|
65802
|
+
["gpt-5.5", GPT_55_INPUT_CONTEXT]
|
|
65803
|
+
];
|
|
65768
65804
|
codex = {
|
|
65769
65805
|
id: "codex",
|
|
65770
65806
|
name: "Codex",
|
|
@@ -65791,6 +65827,7 @@ var init_codex = __esm(() => {
|
|
|
65791
65827
|
},
|
|
65792
65828
|
fallbackModels: CODEX_FALLBACK_MODELS,
|
|
65793
65829
|
contextWindows: CODEX_CONTEXT_WINDOWS,
|
|
65830
|
+
contextWindowOverrides: CODEX_CONTEXT_WINDOW_OVERRIDES,
|
|
65794
65831
|
checkAvailability: async () => {
|
|
65795
65832
|
const status = getCodexLoginStatus();
|
|
65796
65833
|
return status.installed && status.loggedIn;
|
|
@@ -71745,7 +71782,7 @@ var package_default;
|
|
|
71745
71782
|
var init_package = __esm(() => {
|
|
71746
71783
|
package_default = {
|
|
71747
71784
|
name: "@proxysoul/soulforge",
|
|
71748
|
-
version: "2.18.
|
|
71785
|
+
version: "2.18.6",
|
|
71749
71786
|
description: "Graph-powered code intelligence \u2014 multi-agent coding with codebase-aware AI",
|
|
71750
71787
|
repository: {
|
|
71751
71788
|
type: "git",
|
|
@@ -72261,6 +72298,9 @@ function getCompatReasoningBody(modelId, config2) {
|
|
|
72261
72298
|
return {};
|
|
72262
72299
|
const isClaude = base.startsWith("claude");
|
|
72263
72300
|
if (isClaude && provider === "opencode-zen") {
|
|
72301
|
+
if (isAdaptiveOnly(base)) {
|
|
72302
|
+
return { thinking: { type: "adaptive" } };
|
|
72303
|
+
}
|
|
72264
72304
|
const explicitBudget = config2.thinking?.budgetTokens;
|
|
72265
72305
|
const budget = explicitBudget ?? { low: 2048, medium: 5000, high: 1e4, xhigh: 20000 }[effort] ?? 5000;
|
|
72266
72306
|
return { thinking: { type: "enabled", budget_tokens: budget } };
|
|
@@ -72467,8 +72507,10 @@ var init_copilot = __esm(() => {
|
|
|
72467
72507
|
}
|
|
72468
72508
|
},
|
|
72469
72509
|
fallbackModels: [
|
|
72470
|
-
{ id: "claude-opus-4.
|
|
72471
|
-
{ id: "claude-
|
|
72510
|
+
{ id: "claude-opus-4.8", name: "Claude Opus 4.8", contextWindow: 1e6 },
|
|
72511
|
+
{ id: "claude-opus-4.7", name: "Claude Opus 4.7", contextWindow: 1e6 },
|
|
72512
|
+
{ id: "claude-opus-4.6", name: "Claude Opus 4.6", contextWindow: 1e6 },
|
|
72513
|
+
{ id: "claude-sonnet-4.6", name: "Claude Sonnet 4.6", contextWindow: 1e6 },
|
|
72472
72514
|
{ id: "claude-sonnet-4", name: "Claude Sonnet 4", contextWindow: 128000 },
|
|
72473
72515
|
{ id: "claude-opus-4.5", name: "Claude Opus 4.5", contextWindow: 200000 },
|
|
72474
72516
|
{ id: "claude-sonnet-4.5", name: "Claude Sonnet 4.5", contextWindow: 200000 },
|
|
@@ -72483,8 +72525,10 @@ var init_copilot = __esm(() => {
|
|
|
72483
72525
|
{ id: "gemini-3.1-pro-preview", name: "Gemini 3.1 Pro", contextWindow: 1e6 }
|
|
72484
72526
|
],
|
|
72485
72527
|
contextWindows: [
|
|
72486
|
-
["claude-opus-4.
|
|
72487
|
-
["claude-
|
|
72528
|
+
["claude-opus-4.8", 1e6],
|
|
72529
|
+
["claude-opus-4.7", 1e6],
|
|
72530
|
+
["claude-opus-4.6", 1e6],
|
|
72531
|
+
["claude-sonnet-4.6", 1e6],
|
|
72488
72532
|
["claude-opus-4.5", 200000],
|
|
72489
72533
|
["claude-sonnet-4.5", 200000],
|
|
72490
72534
|
["claude-sonnet-4", 128000],
|
|
@@ -84716,6 +84760,7 @@ var init_llmgateway = __esm(() => {
|
|
|
84716
84760
|
return null;
|
|
84717
84761
|
},
|
|
84718
84762
|
fallbackModels: [
|
|
84763
|
+
{ id: "claude-opus-4-8", name: "Claude Opus 4.8" },
|
|
84719
84764
|
{ id: "claude-opus-4-7", name: "Claude Opus 4.7" },
|
|
84720
84765
|
{ id: "claude-opus-4-6", name: "Claude Opus 4.6" },
|
|
84721
84766
|
{ id: "claude-sonnet-4-6", name: "Claude Sonnet 4.6" },
|
|
@@ -84741,6 +84786,7 @@ var init_llmgateway = __esm(() => {
|
|
|
84741
84786
|
["glm-4", 128000]
|
|
84742
84787
|
],
|
|
84743
84788
|
contextWindows: [
|
|
84789
|
+
["claude-opus-4-8", 1e6],
|
|
84744
84790
|
["claude-opus-4-7", 1e6],
|
|
84745
84791
|
["claude-opus-4-6", 1e6],
|
|
84746
84792
|
["claude-sonnet-4-6", 200000],
|
|
@@ -93981,6 +94027,73 @@ var init_mistral = __esm(() => {
|
|
|
93981
94027
|
};
|
|
93982
94028
|
});
|
|
93983
94029
|
|
|
94030
|
+
// src/core/llm/providers/nim.ts
|
|
94031
|
+
var BASE_URL2 = "https://integrate.api.nvidia.com/v1", nim;
|
|
94032
|
+
var init_nim = __esm(() => {
|
|
94033
|
+
init_dist9();
|
|
94034
|
+
init_config2();
|
|
94035
|
+
init_secrets();
|
|
94036
|
+
init_compat_reasoning();
|
|
94037
|
+
nim = {
|
|
94038
|
+
id: "nim",
|
|
94039
|
+
name: "NVIDIA NIM",
|
|
94040
|
+
envVar: "NVIDIA_API_KEY",
|
|
94041
|
+
icon: "\uF0E7",
|
|
94042
|
+
secretKey: "nvidia-api-key",
|
|
94043
|
+
keyUrl: "build.nvidia.com",
|
|
94044
|
+
asciiIcon: "N",
|
|
94045
|
+
description: "NVIDIA-hosted open models",
|
|
94046
|
+
createModel(modelId) {
|
|
94047
|
+
const apiKey = getProviderApiKey("NVIDIA_API_KEY");
|
|
94048
|
+
if (!apiKey) {
|
|
94049
|
+
throw new Error("NVIDIA_API_KEY is not set");
|
|
94050
|
+
}
|
|
94051
|
+
const reasoningBody = getCompatReasoningBody(`nim/${modelId}`, loadConfig());
|
|
94052
|
+
const reasoningFetch = createReasoningFetchWrapper(reasoningBody);
|
|
94053
|
+
return createOpenAICompatible({
|
|
94054
|
+
name: "nim",
|
|
94055
|
+
baseURL: BASE_URL2,
|
|
94056
|
+
apiKey,
|
|
94057
|
+
...reasoningFetch ? { fetch: reasoningFetch } : {}
|
|
94058
|
+
})(modelId);
|
|
94059
|
+
},
|
|
94060
|
+
async fetchModels() {
|
|
94061
|
+
const apiKey = getProviderApiKey("NVIDIA_API_KEY");
|
|
94062
|
+
if (!apiKey)
|
|
94063
|
+
return null;
|
|
94064
|
+
const res = await fetch(`${BASE_URL2}/models`, {
|
|
94065
|
+
headers: { Authorization: `Bearer ${apiKey}` }
|
|
94066
|
+
});
|
|
94067
|
+
if (!res.ok)
|
|
94068
|
+
throw new Error(`NVIDIA NIM API ${String(res.status)}`);
|
|
94069
|
+
const data = await res.json();
|
|
94070
|
+
return data.data.map((m) => ({ id: m.id, name: m.id }));
|
|
94071
|
+
},
|
|
94072
|
+
fallbackModels: [
|
|
94073
|
+
{ id: "moonshotai/kimi-k2.6", name: "Kimi K2.6" },
|
|
94074
|
+
{ id: "deepseek-ai/deepseek-v4-flash", name: "DeepSeek V4 Flash" },
|
|
94075
|
+
{ id: "deepseek-ai/deepseek-v4-pro", name: "DeepSeek V4 Pro" },
|
|
94076
|
+
{ id: "zai/glm-5.1", name: "GLM-5.1" },
|
|
94077
|
+
{ id: "mistralai/mistral-medium-3.5", name: "Mistral Medium 3.5" },
|
|
94078
|
+
{ id: "mistralai/mistral-small-4", name: "Mistral Small 4" },
|
|
94079
|
+
{ id: "google/gemma-4-31b", name: "Gemma 4 31B" },
|
|
94080
|
+
{ id: "nvidia/nemotron-3-super-120b", name: "Nemotron 3 Super 120B" },
|
|
94081
|
+
{ id: "minimaxai/minimax-m2.7", name: "MiniMax M2.7" }
|
|
94082
|
+
],
|
|
94083
|
+
contextWindows: [
|
|
94084
|
+
["kimi-k2.6", 256000],
|
|
94085
|
+
["deepseek-v4-flash", 1e6],
|
|
94086
|
+
["deepseek-v4-pro", 1e6],
|
|
94087
|
+
["glm-5.1", 200000],
|
|
94088
|
+
["mistral-medium-3.5", 131072],
|
|
94089
|
+
["mistral-small-4", 256000],
|
|
94090
|
+
["gemma-4-31b", 131072],
|
|
94091
|
+
["nemotron-3-super-120b", 1e6],
|
|
94092
|
+
["minimax-m2.7", 200000]
|
|
94093
|
+
]
|
|
94094
|
+
};
|
|
94095
|
+
});
|
|
94096
|
+
|
|
93984
94097
|
// src/core/llm/providers/ollama.ts
|
|
93985
94098
|
function getOllamaHost() {
|
|
93986
94099
|
return (process.env.OLLAMA_HOST ?? "http://localhost:11434").replace(/\/+$/, "");
|
|
@@ -94150,7 +94263,7 @@ var init_openai = __esm(() => {
|
|
|
94150
94263
|
});
|
|
94151
94264
|
|
|
94152
94265
|
// src/core/llm/providers/opencode-go.ts
|
|
94153
|
-
var
|
|
94266
|
+
var BASE_URL3 = "https://opencode.ai/zen/go/v1", opencodeGo;
|
|
94154
94267
|
var init_opencode_go = __esm(() => {
|
|
94155
94268
|
init_dist9();
|
|
94156
94269
|
init_config2();
|
|
@@ -94174,7 +94287,7 @@ var init_opencode_go = __esm(() => {
|
|
|
94174
94287
|
const reasoningFetch = createReasoningFetchWrapper(reasoningBody);
|
|
94175
94288
|
const provider = createOpenAICompatible({
|
|
94176
94289
|
name: "opencode-go",
|
|
94177
|
-
baseURL:
|
|
94290
|
+
baseURL: BASE_URL3,
|
|
94178
94291
|
apiKey,
|
|
94179
94292
|
...reasoningFetch ? { fetch: reasoningFetch } : {}
|
|
94180
94293
|
});
|
|
@@ -94228,7 +94341,7 @@ var init_opencode_go = __esm(() => {
|
|
|
94228
94341
|
});
|
|
94229
94342
|
|
|
94230
94343
|
// src/core/llm/providers/opencode-zen.ts
|
|
94231
|
-
var
|
|
94344
|
+
var BASE_URL4 = "https://opencode.ai/zen/v1", opencodeZen;
|
|
94232
94345
|
var init_opencode_zen = __esm(() => {
|
|
94233
94346
|
init_dist9();
|
|
94234
94347
|
init_config2();
|
|
@@ -94254,7 +94367,7 @@ var init_opencode_zen = __esm(() => {
|
|
|
94254
94367
|
const reasoningFetch = createReasoningFetchWrapper(reasoningBody);
|
|
94255
94368
|
const provider = createOpenAICompatible({
|
|
94256
94369
|
name: "opencode-zen",
|
|
94257
|
-
baseURL:
|
|
94370
|
+
baseURL: BASE_URL4,
|
|
94258
94371
|
apiKey,
|
|
94259
94372
|
...reasoningFetch ? { fetch: reasoningFetch } : {}
|
|
94260
94373
|
});
|
|
@@ -94294,6 +94407,7 @@ var init_opencode_zen = __esm(() => {
|
|
|
94294
94407
|
{ id: "gpt-5", name: "GPT 5" },
|
|
94295
94408
|
{ id: "gpt-5-codex", name: "GPT 5 Codex" },
|
|
94296
94409
|
{ id: "gpt-5-nano", name: "GPT 5 Nano" },
|
|
94410
|
+
{ id: "claude-opus-4-8", name: "Claude Opus 4.8" },
|
|
94297
94411
|
{ id: "claude-opus-4-7", name: "Claude Opus 4.7" },
|
|
94298
94412
|
{ id: "claude-opus-4-6", name: "Claude Opus 4.6" },
|
|
94299
94413
|
{ id: "claude-opus-4-5", name: "Claude Opus 4.5" },
|
|
@@ -94352,6 +94466,7 @@ var init_opencode_zen = __esm(() => {
|
|
|
94352
94466
|
["gpt-5", 400000],
|
|
94353
94467
|
["gpt-5-codex", 400000],
|
|
94354
94468
|
["gpt-5-nano", 400000],
|
|
94469
|
+
["claude-opus-4-8", 1e6],
|
|
94355
94470
|
["claude-opus-4-7", 1e6],
|
|
94356
94471
|
["claude-opus-4-6", 1e6],
|
|
94357
94472
|
["claude-opus-4-5", 200000],
|
|
@@ -94360,6 +94475,7 @@ var init_opencode_zen = __esm(() => {
|
|
|
94360
94475
|
["claude-sonnet-4-5", 1e6],
|
|
94361
94476
|
["claude-sonnet-4", 200000],
|
|
94362
94477
|
["claude-haiku-4-5", 200000],
|
|
94478
|
+
["claude-opus-4.8", 1e6],
|
|
94363
94479
|
["claude-opus-4.6", 1e6],
|
|
94364
94480
|
["claude-sonnet-4.6", 1e6],
|
|
94365
94481
|
["claude-sonnet-4.5", 1e6],
|
|
@@ -99195,6 +99311,7 @@ var init_openrouter = __esm(() => {
|
|
|
99195
99311
|
return null;
|
|
99196
99312
|
},
|
|
99197
99313
|
fallbackModels: [
|
|
99314
|
+
{ id: "anthropic/claude-opus-4.8", name: "Claude Opus 4.8" },
|
|
99198
99315
|
{ id: "anthropic/claude-opus-4.7", name: "Claude Opus 4.7" },
|
|
99199
99316
|
{ id: "anthropic/claude-opus-4.6", name: "Claude Opus 4.6" },
|
|
99200
99317
|
{ id: "anthropic/claude-sonnet-4.6", name: "Claude Sonnet 4.6" },
|
|
@@ -99228,6 +99345,8 @@ var init_openrouter = __esm(() => {
|
|
|
99228
99345
|
["glm-4", 128000]
|
|
99229
99346
|
],
|
|
99230
99347
|
contextWindows: [
|
|
99348
|
+
["claude-opus-4.8", 1e6],
|
|
99349
|
+
["claude-opus-4.7", 1e6],
|
|
99231
99350
|
["claude-opus-4.6", 1e6],
|
|
99232
99351
|
["claude-sonnet-4.6", 1e6],
|
|
99233
99352
|
["claude-sonnet-4.5", 1e6],
|
|
@@ -401650,7 +401769,7 @@ function matchPricing(modelId) {
|
|
|
401650
401769
|
return pricing;
|
|
401651
401770
|
}
|
|
401652
401771
|
if (id.includes("opus"))
|
|
401653
|
-
return MODEL_PRICING["claude-opus-4-
|
|
401772
|
+
return MODEL_PRICING["claude-opus-4-8"] ?? DEFAULT_PRICING;
|
|
401654
401773
|
if (id.includes("sonnet"))
|
|
401655
401774
|
return DEFAULT_PRICING;
|
|
401656
401775
|
if (id.includes("haiku"))
|
|
@@ -401851,6 +401970,7 @@ var init_statusbar = __esm(() => {
|
|
|
401851
401970
|
init_platform();
|
|
401852
401971
|
init_lifecycle();
|
|
401853
401972
|
MODEL_PRICING = {
|
|
401973
|
+
"claude-opus-4-8": { input: 5, cacheWrite: 6.25, cacheRead: 0.5, output: 25 },
|
|
401854
401974
|
"claude-opus-4-7": { input: 5, cacheWrite: 6.25, cacheRead: 0.5, output: 25 },
|
|
401855
401975
|
"claude-opus-4-6": { input: 5, cacheWrite: 6.25, cacheRead: 0.5, output: 25 },
|
|
401856
401976
|
"claude-opus-4-5": { input: 5, cacheWrite: 6.25, cacheRead: 0.5, output: 25 },
|
|
@@ -401947,8 +402067,11 @@ var init_statusbar = __esm(() => {
|
|
|
401947
402067
|
"claude-opus-4.5": M3,
|
|
401948
402068
|
"claude-opus-4.6": M3,
|
|
401949
402069
|
"claude-opus-4.7": M75,
|
|
402070
|
+
"claude-opus-4.8": M75,
|
|
401950
402071
|
"gpt-5.5": M75,
|
|
401951
|
-
"claude-opus-4.
|
|
402072
|
+
"claude-opus-4.8-fast": { input: 20, cacheWrite: 20, cacheRead: 2, output: 100 },
|
|
402073
|
+
"claude-opus-4.6-fast": M30,
|
|
402074
|
+
"claude-opus-4.7-fast": M30
|
|
401952
402075
|
};
|
|
401953
402076
|
LOCAL_PROVIDERS = new Set(["ollama", "lmstudio"]);
|
|
401954
402077
|
ZERO_USAGE = {
|
|
@@ -404358,7 +404481,37 @@ function sanitizeMessages(messages) {
|
|
|
404358
404481
|
dirty = true;
|
|
404359
404482
|
return { ...msg, content };
|
|
404360
404483
|
});
|
|
404361
|
-
|
|
404484
|
+
const result = dirty ? cleaned : [...messages];
|
|
404485
|
+
const allValidCallIds = new Set;
|
|
404486
|
+
for (const msg of result) {
|
|
404487
|
+
if (msg?.role !== "assistant" || !Array.isArray(msg.content))
|
|
404488
|
+
continue;
|
|
404489
|
+
for (const p of msg.content) {
|
|
404490
|
+
const part = p;
|
|
404491
|
+
if (part?.type === "tool-call" && typeof part.toolCallId === "string" && !part.providerExecuted) {
|
|
404492
|
+
allValidCallIds.add(part.toolCallId);
|
|
404493
|
+
}
|
|
404494
|
+
}
|
|
404495
|
+
}
|
|
404496
|
+
for (let i2 = result.length - 1;i2 >= 0; i2--) {
|
|
404497
|
+
const msg = result[i2];
|
|
404498
|
+
if (!msg || msg.role !== "tool" || !Array.isArray(msg.content))
|
|
404499
|
+
continue;
|
|
404500
|
+
const filtered = msg.content.filter((p) => {
|
|
404501
|
+
const part = p;
|
|
404502
|
+
if (part?.type !== "tool-result")
|
|
404503
|
+
return true;
|
|
404504
|
+
return allValidCallIds.has(part.toolCallId);
|
|
404505
|
+
});
|
|
404506
|
+
if (filtered.length === 0) {
|
|
404507
|
+
result.splice(i2, 1);
|
|
404508
|
+
dirty = true;
|
|
404509
|
+
} else if (filtered.length !== msg.content.length) {
|
|
404510
|
+
result[i2] = { ...msg, content: filtered };
|
|
404511
|
+
dirty = true;
|
|
404512
|
+
}
|
|
404513
|
+
}
|
|
404514
|
+
return dirty ? result : messages;
|
|
404362
404515
|
}
|
|
404363
404516
|
function sanitizeToolInputsStep({
|
|
404364
404517
|
messages,
|
|
@@ -407177,7 +407330,7 @@ var init_addons = __esm(() => {
|
|
|
407177
407330
|
function isAnthropicModel(modelId) {
|
|
407178
407331
|
return modelId.toLowerCase().startsWith("claude");
|
|
407179
407332
|
}
|
|
407180
|
-
var baseURL, proxy2;
|
|
407333
|
+
var baseURL, GPT_55_INPUT_CONTEXT2 = 272000, proxy2;
|
|
407181
407334
|
var init_proxy2 = __esm(() => {
|
|
407182
407335
|
init_dist6();
|
|
407183
407336
|
init_dist8();
|
|
@@ -407221,6 +407374,7 @@ var init_proxy2 = __esm(() => {
|
|
|
407221
407374
|
stopProxy();
|
|
407222
407375
|
},
|
|
407223
407376
|
fallbackModels: [
|
|
407377
|
+
{ id: "claude-opus-4-8", name: "Claude Opus 4.8" },
|
|
407224
407378
|
{ id: "claude-opus-4-7", name: "Claude Opus 4.7" },
|
|
407225
407379
|
{ id: "claude-opus-4-6", name: "Claude Opus 4.6" },
|
|
407226
407380
|
{ id: "claude-sonnet-4-6", name: "Claude Sonnet 4.6" },
|
|
@@ -407228,9 +407382,13 @@ var init_proxy2 = __esm(() => {
|
|
|
407228
407382
|
{ id: "claude-sonnet-4-5", name: "Claude Sonnet 4.5" },
|
|
407229
407383
|
{ id: "claude-sonnet-4-20250514", name: "Claude Sonnet 4" },
|
|
407230
407384
|
{ id: "claude-opus-4-20250514", name: "Claude Opus 4" },
|
|
407231
|
-
{ id: "claude-haiku-3-5-20241022", name: "Claude Haiku 3.5" }
|
|
407385
|
+
{ id: "claude-haiku-3-5-20241022", name: "Claude Haiku 3.5" },
|
|
407386
|
+
{ id: "gpt-5.5", name: "GPT-5.5", contextWindow: GPT_55_INPUT_CONTEXT2 }
|
|
407232
407387
|
],
|
|
407388
|
+
contextWindowOverrides: [["gpt-5.5", GPT_55_INPUT_CONTEXT2]],
|
|
407233
407389
|
contextWindows: [
|
|
407390
|
+
["claude-opus-4-8", 1e6],
|
|
407391
|
+
["claude-opus-4.8", 1e6],
|
|
407234
407392
|
["claude-opus-4-7", 1e6],
|
|
407235
407393
|
["claude-opus-4.7", 1e6],
|
|
407236
407394
|
["claude-opus-4-6", 1e6],
|
|
@@ -407250,6 +407408,7 @@ var init_proxy2 = __esm(() => {
|
|
|
407250
407408
|
["claude-3-5-sonnet", 200000],
|
|
407251
407409
|
["claude-3.5-haiku", 200000],
|
|
407252
407410
|
["claude-3-5-haiku", 200000],
|
|
407411
|
+
["gpt-5.5", GPT_55_INPUT_CONTEXT2],
|
|
407253
407412
|
["gpt-5-chat", 128000],
|
|
407254
407413
|
["gpt-4.1", 1048576],
|
|
407255
407414
|
["grok-4.1", 2000000],
|
|
@@ -410360,6 +410519,7 @@ __export(exports_providers, {
|
|
|
410360
410519
|
openai: () => openai2,
|
|
410361
410520
|
onProvidersChanged: () => onProvidersChanged,
|
|
410362
410521
|
ollama: () => ollama,
|
|
410522
|
+
nim: () => nim,
|
|
410363
410523
|
mistral: () => mistral2,
|
|
410364
410524
|
minimax: () => minimax2,
|
|
410365
410525
|
lmstudio: () => lmstudio,
|
|
@@ -410433,6 +410593,7 @@ var init_providers = __esm(() => {
|
|
|
410433
410593
|
init_lmstudio();
|
|
410434
410594
|
init_minimax();
|
|
410435
410595
|
init_mistral();
|
|
410596
|
+
init_nim();
|
|
410436
410597
|
init_ollama();
|
|
410437
410598
|
init_openai();
|
|
410438
410599
|
init_opencode_go();
|
|
@@ -410455,6 +410616,7 @@ var init_providers = __esm(() => {
|
|
|
410455
410616
|
init_lmstudio();
|
|
410456
410617
|
init_minimax();
|
|
410457
410618
|
init_mistral();
|
|
410619
|
+
init_nim();
|
|
410458
410620
|
init_ollama();
|
|
410459
410621
|
init_openai();
|
|
410460
410622
|
init_opencode_go();
|
|
@@ -410477,6 +410639,7 @@ var init_providers = __esm(() => {
|
|
|
410477
410639
|
bedrock2,
|
|
410478
410640
|
fireworks2,
|
|
410479
410641
|
minimax2,
|
|
410642
|
+
nim,
|
|
410480
410643
|
codex,
|
|
410481
410644
|
copilot,
|
|
410482
410645
|
githubModels,
|
|
@@ -410495,6 +410658,7 @@ var init_providers = __esm(() => {
|
|
|
410495
410658
|
var exports_models = {};
|
|
410496
410659
|
__export(exports_models, {
|
|
410497
410660
|
prewarmAllModels: () => prewarmAllModels,
|
|
410661
|
+
matchesContextOverride: () => matchesContextOverride,
|
|
410498
410662
|
invalidateProviderModelCache: () => invalidateProviderModelCache,
|
|
410499
410663
|
getShortModelLabel: () => getShortModelLabel,
|
|
410500
410664
|
getOpenRouterModelPricing: () => getOpenRouterModelPricing,
|
|
@@ -410509,6 +410673,7 @@ __export(exports_models, {
|
|
|
410509
410673
|
fetchOpenRouterMetadata: () => fetchOpenRouterMetadata,
|
|
410510
410674
|
fetchGroupedModels: () => fetchGroupedModels,
|
|
410511
410675
|
ensureModelMetadata: () => ensureModelMetadata,
|
|
410676
|
+
applyProviderContextOverride: () => applyProviderContextOverride,
|
|
410512
410677
|
PROVIDER_CONFIGS: () => PROVIDER_CONFIGS
|
|
410513
410678
|
});
|
|
410514
410679
|
function buildProviderConfigs() {
|
|
@@ -410523,6 +410688,26 @@ function buildProviderConfigs() {
|
|
|
410523
410688
|
fallbackModels: p.fallbackModels
|
|
410524
410689
|
}));
|
|
410525
410690
|
}
|
|
410691
|
+
function matchesContextOverride(model, pattern) {
|
|
410692
|
+
const lowerModel = model.toLowerCase();
|
|
410693
|
+
const lowerPattern = pattern.toLowerCase();
|
|
410694
|
+
const bareModel = lowerModel.split("/").pop() ?? lowerModel;
|
|
410695
|
+
const barePattern = lowerPattern.split("/").pop() ?? lowerPattern;
|
|
410696
|
+
return bareModel === barePattern || lowerModel === lowerPattern || lowerModel.endsWith(`/${lowerPattern}`);
|
|
410697
|
+
}
|
|
410698
|
+
function findContextOverride(provider, model) {
|
|
410699
|
+
if (!provider?.contextWindowOverrides)
|
|
410700
|
+
return;
|
|
410701
|
+
for (const [pattern, tokens] of provider.contextWindowOverrides) {
|
|
410702
|
+
if (matchesContextOverride(model, pattern))
|
|
410703
|
+
return tokens;
|
|
410704
|
+
}
|
|
410705
|
+
return;
|
|
410706
|
+
}
|
|
410707
|
+
function applyProviderContextOverride(providerId, model) {
|
|
410708
|
+
const tokens = findContextOverride(getProvider(providerId), model.id);
|
|
410709
|
+
return tokens ? { ...model, contextWindow: tokens } : model;
|
|
410710
|
+
}
|
|
410526
410711
|
function getModelContextInfoSync(modelId) {
|
|
410527
410712
|
const slashIdx = modelId.indexOf("/");
|
|
410528
410713
|
const providerId = slashIdx >= 0 ? modelId.slice(0, slashIdx) : "";
|
|
@@ -410535,12 +410720,9 @@ function getModelContextInfoSync(modelId) {
|
|
|
410535
410720
|
}
|
|
410536
410721
|
} catch {}
|
|
410537
410722
|
const ownProvider = providerId ? getProvider(providerId) : null;
|
|
410538
|
-
|
|
410539
|
-
|
|
410540
|
-
|
|
410541
|
-
return { tokens, source: "fallback" };
|
|
410542
|
-
}
|
|
410543
|
-
}
|
|
410723
|
+
const overrideTokens = providerId ? findContextOverride(ownProvider ?? undefined, model) : getAllProviders().map((provider) => findContextOverride(provider, model)).find((tokens) => tokens !== undefined);
|
|
410724
|
+
if (overrideTokens)
|
|
410725
|
+
return { tokens: overrideTokens, source: "override" };
|
|
410544
410726
|
if (providerId && !ownProvider?.grouped) {
|
|
410545
410727
|
const entry = modelCache.get(providerId);
|
|
410546
410728
|
if (entry && Date.now() - entry.ts <= MODEL_CACHE_TTL) {
|
|
@@ -410750,10 +410932,13 @@ async function fetchProviderModels(providerId, { bypassCache = false } = {}) {
|
|
|
410750
410932
|
try {
|
|
410751
410933
|
const models = await provider.fetchModels();
|
|
410752
410934
|
if (models) {
|
|
410753
|
-
|
|
410754
|
-
|
|
410935
|
+
const normalized = models.map((m2) => applyProviderContextOverride(providerId, m2));
|
|
410936
|
+
modelCache.set(providerId, { models: normalized, ts: Date.now() });
|
|
410937
|
+
return { models: normalized };
|
|
410755
410938
|
}
|
|
410756
|
-
return {
|
|
410939
|
+
return {
|
|
410940
|
+
models: provider.fallbackModels.map((m2) => applyProviderContextOverride(providerId, m2))
|
|
410941
|
+
};
|
|
410757
410942
|
} catch (err2) {
|
|
410758
410943
|
const msg = toErrorMessage(err2);
|
|
410759
410944
|
return { models: [], error: `API error: ${msg}` };
|
|
@@ -410938,11 +411123,11 @@ async function fetchProxyGrouped() {
|
|
|
410938
411123
|
if (!grouped[group])
|
|
410939
411124
|
grouped[group] = [];
|
|
410940
411125
|
const ctxWindow = m2.context_length ?? anthropicCtx.get(m2.id) ?? findOpenRouterModel(m2.id)?.context_length;
|
|
410941
|
-
grouped[group].push({
|
|
411126
|
+
grouped[group].push(applyProviderContextOverride("proxy", {
|
|
410942
411127
|
id: m2.id,
|
|
410943
411128
|
name: m2.id,
|
|
410944
411129
|
contextWindow: ctxWindow
|
|
410945
|
-
});
|
|
411130
|
+
}));
|
|
410946
411131
|
}
|
|
410947
411132
|
const subProviders = Object.keys(grouped).sort().map((id) => ({ id, name: GROUP_DISPLAY_NAMES[id] ?? titleCase(id) }));
|
|
410948
411133
|
const result = {
|
|
@@ -411295,7 +411480,8 @@ async function buildAnthropicOptions(modelId, caps, config2) {
|
|
|
411295
411480
|
let thinkingEnabled = false;
|
|
411296
411481
|
if (caps.thinking) {
|
|
411297
411482
|
const mode = config2.thinking?.mode ?? "off";
|
|
411298
|
-
|
|
411483
|
+
const adaptiveOnly = isAdaptiveOnly2(modelId);
|
|
411484
|
+
if (mode === "auto" || mode === "adaptive" || mode === "enabled" && adaptiveOnly) {
|
|
411299
411485
|
if (caps.adaptiveThinking) {
|
|
411300
411486
|
opts.thinking = { type: "adaptive" };
|
|
411301
411487
|
thinkingEnabled = true;
|
|
@@ -411332,7 +411518,7 @@ async function buildAnthropicOptions(modelId, caps, config2) {
|
|
|
411332
411518
|
opts.contextManagement = { edits };
|
|
411333
411519
|
}
|
|
411334
411520
|
}
|
|
411335
|
-
if (thinkingEnabled && caps.interleavedThinking) {
|
|
411521
|
+
if (thinkingEnabled && caps.interleavedThinking && opts.thinking?.type !== "adaptive") {
|
|
411336
411522
|
headers["anthropic-beta"] = "interleaved-thinking-2025-05-14";
|
|
411337
411523
|
}
|
|
411338
411524
|
return { opts, headers, thinkingEnabled };
|
|
@@ -411452,7 +411638,7 @@ function degradeProviderOptions(modelId, level) {
|
|
|
411452
411638
|
const caps = getEffectiveCaps(modelId);
|
|
411453
411639
|
const providerOptions = {};
|
|
411454
411640
|
if (caps.anthropicOptions && caps.thinking) {
|
|
411455
|
-
const opts = { thinking: { type: "enabled", budgetTokens: 5000 } };
|
|
411641
|
+
const opts = isAdaptiveOnly2(modelId) ? { thinking: { type: "adaptive" }, effort: "low" } : { thinking: { type: "enabled", budgetTokens: 5000 } };
|
|
411456
411642
|
providerOptions.anthropic = opts;
|
|
411457
411643
|
}
|
|
411458
411644
|
if (caps.openaiOptions && caps.openaiReasoning) {
|
|
@@ -411471,9 +411657,7 @@ function degradeProviderOptions(modelId, level) {
|
|
|
411471
411657
|
providerOptions.openrouter = { reasoning: { effort: "low" } };
|
|
411472
411658
|
}
|
|
411473
411659
|
if (caps.bedrockOptions && caps.thinking) {
|
|
411474
|
-
providerOptions.bedrock = {
|
|
411475
|
-
reasoningConfig: { type: "enabled", budgetTokens: 5000 }
|
|
411476
|
-
};
|
|
411660
|
+
providerOptions.bedrock = isAdaptiveOnly2(modelId) ? { reasoningConfig: { type: "adaptive", maxReasoningEffort: "low" } } : { reasoningConfig: { type: "enabled", budgetTokens: 5000 } };
|
|
411477
411661
|
}
|
|
411478
411662
|
return {
|
|
411479
411663
|
providerOptions,
|
|
@@ -411628,11 +411812,12 @@ function buildGroqOptions(config2) {
|
|
|
411628
411812
|
function isDeepSeekReasoner(base) {
|
|
411629
411813
|
return base === "deepseek-reasoner" || base.includes("reasoner") || base.endsWith("-think");
|
|
411630
411814
|
}
|
|
411631
|
-
var parseOpusVersion2, extractBaseModel2, getModelId2, supportsTemperature2, NO_SUPPORT, ANTHROPIC_FULL, OPENAI_FULL, GOOGLE_FULL, XAI_FULL, DEEPSEEK_FULL, OPENROUTER_FULL, GATEWAY_FULL, COMPAT_ONLY, PROVIDER_CONSTRAINTS, LEGACY_PREFIXES, CACHE_EPHEMERAL_5M, CACHE_EPHEMERAL_1H, EPHEMERAL_CACHE_5M, EPHEMERAL_CACHE_1H, EPHEMERAL_CACHE;
|
|
411815
|
+
var parseOpusVersion2, isAdaptiveOnly2, extractBaseModel2, getModelId2, supportsTemperature2, NO_SUPPORT, ANTHROPIC_FULL, OPENAI_FULL, GOOGLE_FULL, XAI_FULL, DEEPSEEK_FULL, OPENROUTER_FULL, GATEWAY_FULL, COMPAT_ONLY, PROVIDER_CONSTRAINTS, LEGACY_PREFIXES, CACHE_EPHEMERAL_5M, CACHE_EPHEMERAL_1H, EPHEMERAL_CACHE_5M, EPHEMERAL_CACHE_1H, EPHEMERAL_CACHE;
|
|
411632
411816
|
var init_provider_options = __esm(() => {
|
|
411633
411817
|
init_models();
|
|
411634
411818
|
init_providers();
|
|
411635
411819
|
parseOpusVersion2 = parseOpusVersion;
|
|
411820
|
+
isAdaptiveOnly2 = isAdaptiveOnly;
|
|
411636
411821
|
extractBaseModel2 = extractBaseModel;
|
|
411637
411822
|
getModelId2 = getModelId;
|
|
411638
411823
|
supportsTemperature2 = supportsTemperature;
|
|
@@ -444011,7 +444196,11 @@ Avoid these files. If you must edit one, your edit will still apply but may conf
|
|
|
444011
444196
|
const task = tasks[0];
|
|
444012
444197
|
const { doneResult, resultText } = await runAgentTask(task, models, bus, toolCallId, 1, abortSignal);
|
|
444013
444198
|
if (!doneResult && !bus.getResult(task.agentId)?.success) {
|
|
444014
|
-
|
|
444199
|
+
return {
|
|
444200
|
+
reads: bus.getFileReadRecords(task.agentId),
|
|
444201
|
+
filesEdited: [...bus.getEditedFiles(task.agentId).keys()],
|
|
444202
|
+
output: `[Dispatch failed] ${resultText}`
|
|
444203
|
+
};
|
|
444015
444204
|
}
|
|
444016
444205
|
const editedMap = bus.getEditedFiles(task.agentId);
|
|
444017
444206
|
const desloppifyResult2 = await runDesloppify(bus, [task], models, toolCallId, abortSignal);
|
|
@@ -444634,6 +444823,7 @@ function buildInstructions(cm, modelId) {
|
|
|
444634
444823
|
const text2 = parts2.join(`
|
|
444635
444824
|
|
|
444636
444825
|
`);
|
|
444826
|
+
cm.setInstructionsSize(text2.length);
|
|
444637
444827
|
if (snapshot)
|
|
444638
444828
|
instructionsCache.set(cm, { text: text2, key: key2 });
|
|
444639
444829
|
return text2;
|
|
@@ -446335,6 +446525,7 @@ var init_manager6 = __esm(() => {
|
|
|
446335
446525
|
mentionedFiles = new Set;
|
|
446336
446526
|
conversationTokens = 0;
|
|
446337
446527
|
contextWindowTokens = DEFAULT_CONTEXT_WINDOW2;
|
|
446528
|
+
lastInstructionsSize;
|
|
446338
446529
|
repoMapCache = null;
|
|
446339
446530
|
soulMapDiffChangedFiles = new Map;
|
|
446340
446531
|
soulMapDiffSeq = 0;
|
|
@@ -446860,6 +447051,12 @@ var init_manager6 = __esm(() => {
|
|
|
446860
447051
|
this.startRepoMapScan();
|
|
446861
447052
|
}
|
|
446862
447053
|
}
|
|
447054
|
+
setInstructionsSize(size) {
|
|
447055
|
+
this.lastInstructionsSize = size;
|
|
447056
|
+
}
|
|
447057
|
+
getInstructionsSize() {
|
|
447058
|
+
return this.lastInstructionsSize;
|
|
447059
|
+
}
|
|
446863
447060
|
async setSemanticSummaries(modeOrBool) {
|
|
446864
447061
|
const mode = modeOrBool === true ? "synthetic" : modeOrBool === false ? "off" : modeOrBool === "on" ? "full" : modeOrBool;
|
|
446865
447062
|
this.repoMap.setSemanticMode(mode);
|
|
@@ -447221,9 +447418,10 @@ ${s.signature ? `${s.signature}
|
|
|
447221
447418
|
}
|
|
447222
447419
|
getContextBreakdown() {
|
|
447223
447420
|
const sections = [];
|
|
447421
|
+
const cachedSize = this.getInstructionsSize();
|
|
447224
447422
|
sections.push({
|
|
447225
|
-
section: "
|
|
447226
|
-
chars: 1800,
|
|
447423
|
+
section: "System prompt + tools",
|
|
447424
|
+
chars: cachedSize ?? 1800,
|
|
447227
447425
|
active: true
|
|
447228
447426
|
});
|
|
447229
447427
|
const projectInfo = this.projectInfoCache?.info ?? null;
|
|
@@ -450125,7 +450323,7 @@ __export(exports_nim, {
|
|
|
450125
450323
|
default: () => nim_default
|
|
450126
450324
|
});
|
|
450127
450325
|
var lang159, nim_default;
|
|
450128
|
-
var
|
|
450326
|
+
var init_nim2 = __esm(() => {
|
|
450129
450327
|
init_c();
|
|
450130
450328
|
init_html();
|
|
450131
450329
|
init_xml();
|
|
@@ -452221,7 +452419,7 @@ var init_langs_bundle_full_YTHnHqaM = __esm(() => {
|
|
|
452221
452419
|
{
|
|
452222
452420
|
id: "nim",
|
|
452223
452421
|
name: "Nim",
|
|
452224
|
-
import: () => Promise.resolve().then(() => (
|
|
452422
|
+
import: () => Promise.resolve().then(() => (init_nim2(), exports_nim))
|
|
452225
452423
|
},
|
|
452226
452424
|
{
|
|
452227
452425
|
id: "nix",
|
|
@@ -474592,12 +474790,13 @@ function useChat({
|
|
|
474592
474790
|
const prevSyncedModel = import_react46.useRef("");
|
|
474593
474791
|
if (activeModel !== prevSyncedModel.current && activeModel !== "none") {
|
|
474594
474792
|
prevSyncedModel.current = activeModel;
|
|
474793
|
+
const { tokens: sync, source } = getModelContextInfoSync(activeModel);
|
|
474595
474794
|
const cached3 = pinnedContextWindow.current.get(activeModel);
|
|
474596
|
-
const
|
|
474597
|
-
pinnedContextWindow.current.set(activeModel,
|
|
474598
|
-
contextManagerRef.current.setContextWindow(
|
|
474795
|
+
const next = source === "fallback" ? cached3 ?? sync : sync;
|
|
474796
|
+
pinnedContextWindow.current.set(activeModel, next);
|
|
474797
|
+
contextManagerRef.current.setContextWindow(next);
|
|
474599
474798
|
if (visible)
|
|
474600
|
-
useStatusBarStore.getState().setContextWindow(
|
|
474799
|
+
useStatusBarStore.getState().setContextWindow(next);
|
|
474601
474800
|
}
|
|
474602
474801
|
const activeModelForEffect = activeModel;
|
|
474603
474802
|
import_react46.useEffect(() => {
|
|
@@ -475162,7 +475361,7 @@ INCLUDE the plan progress above VERBATIM in ## Current State so the agent knows
|
|
|
475162
475361
|
const afterChars = systemChars + newCoreChars;
|
|
475163
475362
|
const afterPct = Math.round(afterChars / charsPerToken / contextWindow * 100);
|
|
475164
475363
|
const estimatedTokens = Math.ceil(afterChars / charsPerToken);
|
|
475165
|
-
setContextTokens(
|
|
475364
|
+
setContextTokens(estimatedTokens);
|
|
475166
475365
|
setStreamingChars(0);
|
|
475167
475366
|
setTokenUsage((prev) => {
|
|
475168
475367
|
let bd = prev.modelBreakdown;
|
|
@@ -475597,7 +475796,7 @@ ${description}`,
|
|
|
475597
475796
|
sanitized.push(m5);
|
|
475598
475797
|
if (m5.role !== "assistant" || !Array.isArray(m5.content))
|
|
475599
475798
|
continue;
|
|
475600
|
-
const callParts = m5.content.filter((p3) => typeof p3 === "object" && ("type" in p3) && p3.type === "tool-call");
|
|
475799
|
+
const callParts = m5.content.filter((p3) => typeof p3 === "object" && ("type" in p3) && p3.type === "tool-call" && !p3.providerExecuted);
|
|
475601
475800
|
if (callParts.length === 0)
|
|
475602
475801
|
continue;
|
|
475603
475802
|
const next = sanitizedPre[i4 + 1];
|
|
@@ -475624,6 +475823,30 @@ ${description}`,
|
|
|
475624
475823
|
sanitized.push({ role: "tool", content: synthetic });
|
|
475625
475824
|
}
|
|
475626
475825
|
}
|
|
475826
|
+
for (let i4 = sanitized.length - 1;i4 >= 0; i4--) {
|
|
475827
|
+
const msg = sanitized[i4];
|
|
475828
|
+
if (!msg || msg.role !== "tool" || !Array.isArray(msg.content))
|
|
475829
|
+
continue;
|
|
475830
|
+
const prev = sanitized[i4 - 1];
|
|
475831
|
+
const validCallIds = new Set;
|
|
475832
|
+
if (prev?.role === "assistant" && Array.isArray(prev.content)) {
|
|
475833
|
+
for (const p3 of prev.content) {
|
|
475834
|
+
if (typeof p3 === "object" && "type" in p3 && p3.type === "tool-call" && !p3.providerExecuted) {
|
|
475835
|
+
validCallIds.add(p3.toolCallId);
|
|
475836
|
+
}
|
|
475837
|
+
}
|
|
475838
|
+
}
|
|
475839
|
+
const filtered = msg.content.filter((p3) => {
|
|
475840
|
+
if (typeof p3 !== "object" || !("type" in p3) || p3.type !== "tool-result")
|
|
475841
|
+
return true;
|
|
475842
|
+
return validCallIds.has(p3.toolCallId);
|
|
475843
|
+
});
|
|
475844
|
+
if (filtered.length === 0) {
|
|
475845
|
+
sanitized.splice(i4, 1);
|
|
475846
|
+
} else if (filtered.length !== msg.content.length) {
|
|
475847
|
+
sanitized[i4] = { ...msg, content: filtered };
|
|
475848
|
+
}
|
|
475849
|
+
}
|
|
475627
475850
|
const newCoreMessages = [...sanitized, userCoreMsg];
|
|
475628
475851
|
setCoreMessages(newCoreMessages);
|
|
475629
475852
|
if (workingStateRef.current) {
|
|
@@ -475824,6 +476047,9 @@ ${description}`,
|
|
|
475824
476047
|
finalSegments.length = 0;
|
|
475825
476048
|
subagentCumulative.clear();
|
|
475826
476049
|
completedResultChars.clear();
|
|
476050
|
+
stallTriggered = false;
|
|
476051
|
+
stallAborted = false;
|
|
476052
|
+
stallRetryPendingRef.current = false;
|
|
475827
476053
|
try {
|
|
475828
476054
|
setIsLoading(true);
|
|
475829
476055
|
const modelId = activeModelRef.current;
|
|
@@ -477045,8 +477271,8 @@ ${errStack}` : `Error: ${displayErr}`);
|
|
|
477045
477271
|
setLiveToolCalls([]);
|
|
477046
477272
|
stallRetryPendingRef.current = true;
|
|
477047
477273
|
const backoffMs = stallRetryCountRef.current === 1 ? 2000 : 5000;
|
|
477048
|
-
|
|
477049
|
-
|
|
477274
|
+
await new Promise((resolve40) => setTimeout(resolve40, backoffMs));
|
|
477275
|
+
continue;
|
|
477050
477276
|
}
|
|
477051
477277
|
const rawMsg = err2 instanceof Error ? err2.message : String(err2);
|
|
477052
477278
|
const rawStack = err2 instanceof Error ? err2.stack : undefined;
|
|
@@ -485443,14 +485669,23 @@ var init_FinalResponseView = __esm(() => {
|
|
|
485443
485669
|
|
|
485444
485670
|
`) : null;
|
|
485445
485671
|
}, [segments, finalResponseCalled]);
|
|
485446
|
-
const toolsRef = import_react62.useRef([]);
|
|
485447
485672
|
const tools = import_react62.useMemo(() => {
|
|
485448
|
-
const
|
|
485449
|
-
for (const
|
|
485450
|
-
if (
|
|
485673
|
+
const ids = [];
|
|
485674
|
+
for (const seg of segments) {
|
|
485675
|
+
if (seg?.type === "tools")
|
|
485676
|
+
ids.push(...seg.callIds);
|
|
485677
|
+
}
|
|
485678
|
+
const seen = new Set;
|
|
485679
|
+
const out2 = [];
|
|
485680
|
+
for (const id of ids) {
|
|
485681
|
+
if (seen.has(id))
|
|
485682
|
+
continue;
|
|
485683
|
+
seen.add(id);
|
|
485684
|
+
const tc = liveToolCalls.find((c) => c.id === id);
|
|
485685
|
+
if (!tc || !filterQuietTools(tc.toolName))
|
|
485451
485686
|
continue;
|
|
485452
485687
|
const isDispatch = SUBAGENT_NAMES.has(tc.toolName);
|
|
485453
|
-
|
|
485688
|
+
out2.push({
|
|
485454
485689
|
id: tc.id,
|
|
485455
485690
|
name: tc.toolName,
|
|
485456
485691
|
done: tc.state !== "running",
|
|
@@ -485462,17 +485697,12 @@ var init_FinalResponseView = __esm(() => {
|
|
|
485462
485697
|
imageArt: tc.imageArt
|
|
485463
485698
|
});
|
|
485464
485699
|
}
|
|
485465
|
-
|
|
485466
|
-
|
|
485467
|
-
return prev;
|
|
485468
|
-
}
|
|
485469
|
-
toolsRef.current = next;
|
|
485470
|
-
return next;
|
|
485471
|
-
}, [liveToolCalls]);
|
|
485700
|
+
return out2;
|
|
485701
|
+
}, [segments, liveToolCalls]);
|
|
485472
485702
|
const hasDispatch = import_react62.useMemo(() => liveToolCalls.some((tc) => SUBAGENT_NAMES.has(tc.toolName)), [liveToolCalls]);
|
|
485473
485703
|
const hasEdits = import_react62.useMemo(() => liveToolCalls.some((tc) => FINAL_RESPONSE_EDIT_TOOLS.has(tc.toolName)), [liveToolCalls]);
|
|
485474
|
-
const allToolsDone = tools.length > 0 && tools.every((t) => t.done);
|
|
485475
485704
|
const dispatchActive = liveToolCalls.some((tc) => SUBAGENT_NAMES.has(tc.toolName) && tc.state === "running");
|
|
485705
|
+
const allToolsDone = tools.length > 0 && tools.every((t) => t.done);
|
|
485476
485706
|
const pendingNarration = allToolsDone && !dispatchActive && !trailingText;
|
|
485477
485707
|
if (chatOnlyText) {
|
|
485478
485708
|
return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
|