@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
|
@@ -28394,66 +28394,452 @@ var init_protocol = __esm(() => {
|
|
|
28394
28394
|
FILE_URI_SAFE_RE = /[^A-Za-z0-9\-._~!$&'()*+,;=:@]/g;
|
|
28395
28395
|
});
|
|
28396
28396
|
|
|
28397
|
-
//
|
|
28398
|
-
|
|
28399
|
-
|
|
28400
|
-
|
|
28401
|
-
|
|
28402
|
-
|
|
28403
|
-
|
|
28404
|
-
|
|
28405
|
-
|
|
28406
|
-
|
|
28397
|
+
// src/config/index.ts
|
|
28398
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "fs";
|
|
28399
|
+
import { join as join9 } from "path";
|
|
28400
|
+
function getConfigDir() {
|
|
28401
|
+
return configDir();
|
|
28402
|
+
}
|
|
28403
|
+
function getConfigFile() {
|
|
28404
|
+
return join9(getConfigDir(), "config.json");
|
|
28405
|
+
}
|
|
28406
|
+
function loadConfig() {
|
|
28407
|
+
const configDir2 = getConfigDir();
|
|
28408
|
+
const configFile = getConfigFile();
|
|
28409
|
+
if (!existsSync7(configDir2)) {
|
|
28410
|
+
mkdirSync2(configDir2, {
|
|
28411
|
+
recursive: true,
|
|
28412
|
+
mode: 448
|
|
28413
|
+
});
|
|
28414
|
+
}
|
|
28415
|
+
let userConfig = {};
|
|
28416
|
+
let fileExists = existsSync7(configFile);
|
|
28417
|
+
if (!fileExists) {
|
|
28418
|
+
writeFileSync3(configFile, JSON.stringify(DEFAULT_CONFIG, null, 2));
|
|
28419
|
+
fileExists = true;
|
|
28420
|
+
} else {
|
|
28421
|
+
try {
|
|
28422
|
+
userConfig = JSON.parse(readFileSync4(configFile, "utf-8"));
|
|
28423
|
+
} catch (err2) {
|
|
28424
|
+
const msg = err2 instanceof Error ? err2.message : String(err2);
|
|
28425
|
+
process.stderr.write(`
|
|
28426
|
+
Error: invalid config.json \u2014 ${msg}
|
|
28427
|
+
|
|
28428
|
+
` + ` Path: ${configFile}
|
|
28429
|
+
|
|
28430
|
+
` + ` Fix the JSON syntax error and try again.
|
|
28431
|
+
` + ` (Your config was NOT overwritten.)
|
|
28432
|
+
|
|
28433
|
+
`);
|
|
28434
|
+
process.exit(1);
|
|
28407
28435
|
}
|
|
28436
|
+
}
|
|
28437
|
+
let merged = {
|
|
28438
|
+
...DEFAULT_CONFIG
|
|
28408
28439
|
};
|
|
28409
|
-
|
|
28410
|
-
|
|
28411
|
-
const
|
|
28412
|
-
|
|
28413
|
-
|
|
28414
|
-
}
|
|
28415
|
-
|
|
28416
|
-
|
|
28417
|
-
|
|
28418
|
-
|
|
28419
|
-
|
|
28420
|
-
|
|
28421
|
-
|
|
28422
|
-
|
|
28423
|
-
|
|
28424
|
-
|
|
28425
|
-
|
|
28426
|
-
|
|
28427
|
-
|
|
28440
|
+
if (_presetOverlay)
|
|
28441
|
+
merged = applyConfigPatch(merged, _presetOverlay);
|
|
28442
|
+
const userPatch = diffAgainstDefaults(userConfig);
|
|
28443
|
+
if (Object.keys(userPatch).length > 0) {
|
|
28444
|
+
merged = applyConfigPatch(merged, userPatch);
|
|
28445
|
+
}
|
|
28446
|
+
return merged;
|
|
28447
|
+
}
|
|
28448
|
+
function diffAgainstDefaults(userConfig) {
|
|
28449
|
+
const out2 = {};
|
|
28450
|
+
const defaults = DEFAULT_CONFIG;
|
|
28451
|
+
const nested = new Set(NESTED_KEYS);
|
|
28452
|
+
for (const [key2, value] of Object.entries(userConfig)) {
|
|
28453
|
+
if (value === undefined)
|
|
28454
|
+
continue;
|
|
28455
|
+
const def = defaults[key2];
|
|
28456
|
+
if (nested.has(key2) && value && typeof value === "object" && !Array.isArray(value) && def && typeof def === "object" && !Array.isArray(def)) {
|
|
28457
|
+
const subPatch = {};
|
|
28458
|
+
const defRec = def;
|
|
28459
|
+
for (const [subKey, subValue] of Object.entries(value)) {
|
|
28460
|
+
if (subValue === undefined)
|
|
28461
|
+
continue;
|
|
28462
|
+
if (JSON.stringify(subValue) !== JSON.stringify(defRec[subKey])) {
|
|
28463
|
+
subPatch[subKey] = subValue;
|
|
28428
28464
|
}
|
|
28429
|
-
}
|
|
28465
|
+
}
|
|
28466
|
+
if (Object.keys(subPatch).length > 0)
|
|
28467
|
+
out2[key2] = subPatch;
|
|
28468
|
+
continue;
|
|
28430
28469
|
}
|
|
28431
|
-
|
|
28432
|
-
|
|
28433
|
-
return null;
|
|
28434
|
-
maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
|
|
28435
|
-
return typeof maybeIterable === "function" ? maybeIterable : null;
|
|
28470
|
+
if (JSON.stringify(value) !== JSON.stringify(def)) {
|
|
28471
|
+
out2[key2] = value;
|
|
28436
28472
|
}
|
|
28437
|
-
|
|
28438
|
-
|
|
28439
|
-
|
|
28440
|
-
|
|
28473
|
+
}
|
|
28474
|
+
return out2;
|
|
28475
|
+
}
|
|
28476
|
+
function loadProjectConfig(cwd) {
|
|
28477
|
+
const projectFile = join9(cwd, ".soulforge", "config.json");
|
|
28478
|
+
if (!existsSync7(projectFile))
|
|
28479
|
+
return null;
|
|
28480
|
+
try {
|
|
28481
|
+
const raw2 = readFileSync4(projectFile, "utf-8");
|
|
28482
|
+
return JSON.parse(raw2);
|
|
28483
|
+
} catch (err2) {
|
|
28484
|
+
const msg = err2 instanceof Error ? err2.message : String(err2);
|
|
28485
|
+
process.stderr.write(`
|
|
28486
|
+
Warning: invalid project config.json \u2014 ${msg}
|
|
28487
|
+
` + ` Path: ${projectFile}
|
|
28488
|
+
` + ` Fix the JSON syntax error. Ignoring project config for now.
|
|
28489
|
+
|
|
28490
|
+
`);
|
|
28491
|
+
return null;
|
|
28492
|
+
}
|
|
28493
|
+
}
|
|
28494
|
+
function applyConfigPatch(base, patch) {
|
|
28495
|
+
const result = {
|
|
28496
|
+
...base,
|
|
28497
|
+
...patch
|
|
28498
|
+
};
|
|
28499
|
+
for (const key2 of NESTED_KEYS) {
|
|
28500
|
+
const b3 = base[key2];
|
|
28501
|
+
const p2 = patch[key2];
|
|
28502
|
+
if (p2 && b3 && typeof b3 === "object" && typeof p2 === "object") {
|
|
28503
|
+
result[key2] = {
|
|
28504
|
+
...b3,
|
|
28505
|
+
...p2
|
|
28506
|
+
};
|
|
28441
28507
|
}
|
|
28442
|
-
|
|
28443
|
-
|
|
28444
|
-
|
|
28445
|
-
|
|
28446
|
-
|
|
28508
|
+
}
|
|
28509
|
+
return result;
|
|
28510
|
+
}
|
|
28511
|
+
var DEFAULT_CONFIG, _presetOverlay = null, NESTED_KEYS;
|
|
28512
|
+
var init_config = __esm(() => {
|
|
28513
|
+
init_platform();
|
|
28514
|
+
init_ensure_soulforge_dir();
|
|
28515
|
+
DEFAULT_CONFIG = {
|
|
28516
|
+
defaultModel: "none",
|
|
28517
|
+
routerRules: [],
|
|
28518
|
+
editor: {
|
|
28519
|
+
command: "nvim",
|
|
28520
|
+
args: []
|
|
28521
|
+
},
|
|
28522
|
+
theme: {
|
|
28523
|
+
name: "proxysoul-main",
|
|
28524
|
+
transparent: true
|
|
28525
|
+
},
|
|
28526
|
+
nvimConfig: "default",
|
|
28527
|
+
editorIntegration: {
|
|
28528
|
+
diagnostics: true,
|
|
28529
|
+
symbols: true,
|
|
28530
|
+
hover: true,
|
|
28531
|
+
references: true,
|
|
28532
|
+
definition: true,
|
|
28533
|
+
codeActions: true,
|
|
28534
|
+
editorContext: true,
|
|
28535
|
+
rename: true,
|
|
28536
|
+
lspStatus: true,
|
|
28537
|
+
format: true,
|
|
28538
|
+
syncEditorOnEdit: false
|
|
28539
|
+
},
|
|
28540
|
+
codeExecution: true,
|
|
28541
|
+
webSearch: true,
|
|
28542
|
+
compaction: {
|
|
28543
|
+
strategy: "v2",
|
|
28544
|
+
triggerThreshold: 0.7,
|
|
28545
|
+
resetThreshold: 0.4,
|
|
28546
|
+
keepRecent: 4,
|
|
28547
|
+
maxToolResults: 30,
|
|
28548
|
+
llmExtraction: true
|
|
28447
28549
|
}
|
|
28448
|
-
|
|
28449
|
-
|
|
28450
|
-
|
|
28451
|
-
|
|
28452
|
-
|
|
28453
|
-
|
|
28550
|
+
};
|
|
28551
|
+
NESTED_KEYS = ["editor", "theme", "editorIntegration", "codeIntelligence", "thinking", "performance", "contextManagement", "agentFeatures", "compaction", "retry", "addons"];
|
|
28552
|
+
});
|
|
28553
|
+
|
|
28554
|
+
// src/core/intelligence/backends/lsp/server-registry.ts
|
|
28555
|
+
import { existsSync as existsSync8 } from "fs";
|
|
28556
|
+
import { join as join10 } from "path";
|
|
28557
|
+
function firstExisting(dir, cmd) {
|
|
28558
|
+
for (const sfx of BIN_SUFFIXES) {
|
|
28559
|
+
const p2 = join10(dir, cmd + sfx);
|
|
28560
|
+
if (existsSync8(p2))
|
|
28561
|
+
return p2;
|
|
28562
|
+
}
|
|
28563
|
+
return null;
|
|
28564
|
+
}
|
|
28565
|
+
function commandExistsInMason(cmd) {
|
|
28566
|
+
return firstExisting(MASON_BIN_DIR, cmd);
|
|
28567
|
+
}
|
|
28568
|
+
function findInSoulforge(cmd) {
|
|
28569
|
+
const npmBin = firstExisting(join10(SOULFORGE_BIN_DIR, "node_modules", ".bin"), cmd);
|
|
28570
|
+
if (npmBin)
|
|
28571
|
+
return npmBin;
|
|
28572
|
+
const directBin = firstExisting(join10(SOULFORGE_BIN_DIR, "bin"), cmd);
|
|
28573
|
+
if (directBin)
|
|
28574
|
+
return directBin;
|
|
28575
|
+
return null;
|
|
28576
|
+
}
|
|
28577
|
+
function resolveCommand(cmd) {
|
|
28578
|
+
const cached = probeCache.get(cmd);
|
|
28579
|
+
if (cached !== undefined)
|
|
28580
|
+
return cached;
|
|
28581
|
+
if (commandExists(cmd)) {
|
|
28582
|
+
probeCache.set(cmd, cmd);
|
|
28583
|
+
return cmd;
|
|
28584
|
+
}
|
|
28585
|
+
const sfPath = findInSoulforge(cmd);
|
|
28586
|
+
if (sfPath) {
|
|
28587
|
+
probeCache.set(cmd, sfPath);
|
|
28588
|
+
return sfPath;
|
|
28589
|
+
}
|
|
28590
|
+
const masonPath = commandExistsInMason(cmd);
|
|
28591
|
+
if (masonPath) {
|
|
28592
|
+
probeCache.set(cmd, masonPath);
|
|
28593
|
+
return masonPath;
|
|
28594
|
+
}
|
|
28595
|
+
probeCache.set(cmd, null);
|
|
28596
|
+
return null;
|
|
28597
|
+
}
|
|
28598
|
+
function isServerDisabled(cmd) {
|
|
28599
|
+
const cwd = process.cwd();
|
|
28600
|
+
const global2 = loadConfig();
|
|
28601
|
+
const project = loadProjectConfig(cwd);
|
|
28602
|
+
const disabled = project?.disabledLspServers ?? global2.disabledLspServers ?? [];
|
|
28603
|
+
return disabled.includes(cmd);
|
|
28604
|
+
}
|
|
28605
|
+
function findServersForLanguage(language) {
|
|
28606
|
+
const candidates = SERVER_CANDIDATES[language];
|
|
28607
|
+
if (!candidates)
|
|
28608
|
+
return [];
|
|
28609
|
+
const results = [];
|
|
28610
|
+
for (const candidate of candidates) {
|
|
28611
|
+
if (isServerDisabled(candidate.command))
|
|
28612
|
+
continue;
|
|
28613
|
+
const resolved = resolveCommand(candidate.command);
|
|
28614
|
+
if (resolved) {
|
|
28615
|
+
results.push({
|
|
28616
|
+
command: resolved,
|
|
28617
|
+
args: candidate.args,
|
|
28618
|
+
language
|
|
28619
|
+
});
|
|
28454
28620
|
}
|
|
28455
|
-
|
|
28456
|
-
|
|
28621
|
+
}
|
|
28622
|
+
return results;
|
|
28623
|
+
}
|
|
28624
|
+
var SERVER_CANDIDATES, MASON_BIN_DIR, SOULFORGE_BIN_DIR, BIN_SUFFIXES, probeCache;
|
|
28625
|
+
var init_server_registry = __esm(() => {
|
|
28626
|
+
init_config();
|
|
28627
|
+
init_platform();
|
|
28628
|
+
SERVER_CANDIDATES = {
|
|
28629
|
+
typescript: [{
|
|
28630
|
+
command: "typescript-language-server",
|
|
28631
|
+
args: ["--stdio"]
|
|
28632
|
+
}, {
|
|
28633
|
+
command: "biome",
|
|
28634
|
+
args: ["lsp-proxy"]
|
|
28635
|
+
}, {
|
|
28636
|
+
command: "deno",
|
|
28637
|
+
args: ["lsp"]
|
|
28638
|
+
}, {
|
|
28639
|
+
command: "vscode-eslint-language-server",
|
|
28640
|
+
args: ["--stdio"]
|
|
28641
|
+
}],
|
|
28642
|
+
javascript: [{
|
|
28643
|
+
command: "typescript-language-server",
|
|
28644
|
+
args: ["--stdio"]
|
|
28645
|
+
}, {
|
|
28646
|
+
command: "biome",
|
|
28647
|
+
args: ["lsp-proxy"]
|
|
28648
|
+
}, {
|
|
28649
|
+
command: "deno",
|
|
28650
|
+
args: ["lsp"]
|
|
28651
|
+
}, {
|
|
28652
|
+
command: "vscode-eslint-language-server",
|
|
28653
|
+
args: ["--stdio"]
|
|
28654
|
+
}],
|
|
28655
|
+
python: [{
|
|
28656
|
+
command: "pyright-langserver",
|
|
28657
|
+
args: ["--stdio"]
|
|
28658
|
+
}, {
|
|
28659
|
+
command: "pylsp",
|
|
28660
|
+
args: []
|
|
28661
|
+
}],
|
|
28662
|
+
go: [{
|
|
28663
|
+
command: "gopls",
|
|
28664
|
+
args: ["serve"]
|
|
28665
|
+
}],
|
|
28666
|
+
rust: [{
|
|
28667
|
+
command: "rust-analyzer",
|
|
28668
|
+
args: []
|
|
28669
|
+
}],
|
|
28670
|
+
lua: [{
|
|
28671
|
+
command: "lua-language-server",
|
|
28672
|
+
args: []
|
|
28673
|
+
}],
|
|
28674
|
+
c: [{
|
|
28675
|
+
command: "clangd",
|
|
28676
|
+
args: []
|
|
28677
|
+
}],
|
|
28678
|
+
cpp: [{
|
|
28679
|
+
command: "clangd",
|
|
28680
|
+
args: []
|
|
28681
|
+
}],
|
|
28682
|
+
ruby: [{
|
|
28683
|
+
command: "solargraph",
|
|
28684
|
+
args: ["stdio"]
|
|
28685
|
+
}],
|
|
28686
|
+
php: [{
|
|
28687
|
+
command: "intelephense",
|
|
28688
|
+
args: ["--stdio"]
|
|
28689
|
+
}],
|
|
28690
|
+
zig: [{
|
|
28691
|
+
command: "zls",
|
|
28692
|
+
args: []
|
|
28693
|
+
}],
|
|
28694
|
+
bash: [{
|
|
28695
|
+
command: "bash-language-server",
|
|
28696
|
+
args: ["start"]
|
|
28697
|
+
}],
|
|
28698
|
+
css: [{
|
|
28699
|
+
command: "vscode-css-language-server",
|
|
28700
|
+
args: ["--stdio"]
|
|
28701
|
+
}, {
|
|
28702
|
+
command: "biome",
|
|
28703
|
+
args: ["lsp-proxy"]
|
|
28704
|
+
}, {
|
|
28705
|
+
command: "tailwindcss-language-server",
|
|
28706
|
+
args: ["--stdio"]
|
|
28707
|
+
}],
|
|
28708
|
+
html: [{
|
|
28709
|
+
command: "vscode-html-language-server",
|
|
28710
|
+
args: ["--stdio"]
|
|
28711
|
+
}, {
|
|
28712
|
+
command: "emmet-language-server",
|
|
28713
|
+
args: ["--stdio"]
|
|
28714
|
+
}],
|
|
28715
|
+
json: [{
|
|
28716
|
+
command: "vscode-json-language-server",
|
|
28717
|
+
args: ["--stdio"]
|
|
28718
|
+
}, {
|
|
28719
|
+
command: "biome",
|
|
28720
|
+
args: ["lsp-proxy"]
|
|
28721
|
+
}],
|
|
28722
|
+
yaml: [{
|
|
28723
|
+
command: "yaml-language-server",
|
|
28724
|
+
args: ["--stdio"]
|
|
28725
|
+
}],
|
|
28726
|
+
toml: [{
|
|
28727
|
+
command: "taplo",
|
|
28728
|
+
args: ["lsp", "stdio"]
|
|
28729
|
+
}],
|
|
28730
|
+
dockerfile: [{
|
|
28731
|
+
command: "docker-langserver",
|
|
28732
|
+
args: ["--stdio"]
|
|
28733
|
+
}],
|
|
28734
|
+
java: [{
|
|
28735
|
+
command: "jdtls",
|
|
28736
|
+
args: []
|
|
28737
|
+
}],
|
|
28738
|
+
kotlin: [{
|
|
28739
|
+
command: "kotlin-language-server",
|
|
28740
|
+
args: []
|
|
28741
|
+
}],
|
|
28742
|
+
scala: [{
|
|
28743
|
+
command: "metals",
|
|
28744
|
+
args: []
|
|
28745
|
+
}],
|
|
28746
|
+
csharp: [{
|
|
28747
|
+
command: "csharp-ls",
|
|
28748
|
+
args: []
|
|
28749
|
+
}, {
|
|
28750
|
+
command: "OmniSharp",
|
|
28751
|
+
args: ["--languageserver"]
|
|
28752
|
+
}],
|
|
28753
|
+
swift: [{
|
|
28754
|
+
command: "sourcekit-lsp",
|
|
28755
|
+
args: []
|
|
28756
|
+
}],
|
|
28757
|
+
dart: [{
|
|
28758
|
+
command: "dart",
|
|
28759
|
+
args: ["language-server", "--protocol=lsp"]
|
|
28760
|
+
}],
|
|
28761
|
+
elixir: [{
|
|
28762
|
+
command: "elixir-ls",
|
|
28763
|
+
args: []
|
|
28764
|
+
}, {
|
|
28765
|
+
command: "expert",
|
|
28766
|
+
args: []
|
|
28767
|
+
}],
|
|
28768
|
+
ocaml: [{
|
|
28769
|
+
command: "ocamllsp",
|
|
28770
|
+
args: []
|
|
28771
|
+
}],
|
|
28772
|
+
vue: [{
|
|
28773
|
+
command: "vue-language-server",
|
|
28774
|
+
args: ["--stdio"]
|
|
28775
|
+
}]
|
|
28776
|
+
};
|
|
28777
|
+
MASON_BIN_DIR = join10(userDataDir(), "mason", "bin");
|
|
28778
|
+
SOULFORGE_BIN_DIR = join10(configDir(), "lsp-servers");
|
|
28779
|
+
BIN_SUFFIXES = IS_WIN ? [".exe", ".cmd", ""] : [""];
|
|
28780
|
+
probeCache = new Map;
|
|
28781
|
+
});
|
|
28782
|
+
|
|
28783
|
+
// node_modules/zustand/esm/vanilla.mjs
|
|
28784
|
+
var createStoreImpl = (createState) => {
|
|
28785
|
+
let state;
|
|
28786
|
+
const listeners = /* @__PURE__ */ new Set;
|
|
28787
|
+
const setState = (partial, replace) => {
|
|
28788
|
+
const nextState = typeof partial === "function" ? partial(state) : partial;
|
|
28789
|
+
if (!Object.is(nextState, state)) {
|
|
28790
|
+
const previousState = state;
|
|
28791
|
+
state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
|
|
28792
|
+
listeners.forEach((listener) => listener(state, previousState));
|
|
28793
|
+
}
|
|
28794
|
+
};
|
|
28795
|
+
const getState = () => state;
|
|
28796
|
+
const getInitialState = () => initialState;
|
|
28797
|
+
const subscribe = (listener) => {
|
|
28798
|
+
listeners.add(listener);
|
|
28799
|
+
return () => listeners.delete(listener);
|
|
28800
|
+
};
|
|
28801
|
+
const api = { setState, getState, getInitialState, subscribe };
|
|
28802
|
+
const initialState = state = createState(setState, getState, api);
|
|
28803
|
+
return api;
|
|
28804
|
+
}, createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
|
|
28805
|
+
var init_vanilla = () => {};
|
|
28806
|
+
|
|
28807
|
+
// node_modules/react/cjs/react.development.js
|
|
28808
|
+
var require_react_development = __commonJS((exports, module2) => {
|
|
28809
|
+
(function() {
|
|
28810
|
+
function defineDeprecationWarning(methodName, info2) {
|
|
28811
|
+
Object.defineProperty(Component.prototype, methodName, {
|
|
28812
|
+
get: function() {
|
|
28813
|
+
console.warn("%s(...) is deprecated in plain JavaScript React classes. %s", info2[0], info2[1]);
|
|
28814
|
+
}
|
|
28815
|
+
});
|
|
28816
|
+
}
|
|
28817
|
+
function getIteratorFn(maybeIterable) {
|
|
28818
|
+
if (maybeIterable === null || typeof maybeIterable !== "object")
|
|
28819
|
+
return null;
|
|
28820
|
+
maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
|
|
28821
|
+
return typeof maybeIterable === "function" ? maybeIterable : null;
|
|
28822
|
+
}
|
|
28823
|
+
function warnNoop(publicInstance, callerName) {
|
|
28824
|
+
publicInstance = (publicInstance = publicInstance.constructor) && (publicInstance.displayName || publicInstance.name) || "ReactClass";
|
|
28825
|
+
var warningKey = publicInstance + "." + callerName;
|
|
28826
|
+
didWarnStateUpdateForUnmountedComponent[warningKey] || (console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.", callerName, publicInstance), didWarnStateUpdateForUnmountedComponent[warningKey] = true);
|
|
28827
|
+
}
|
|
28828
|
+
function Component(props, context, updater) {
|
|
28829
|
+
this.props = props;
|
|
28830
|
+
this.context = context;
|
|
28831
|
+
this.refs = emptyObject;
|
|
28832
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
|
28833
|
+
}
|
|
28834
|
+
function ComponentDummy() {}
|
|
28835
|
+
function PureComponent(props, context, updater) {
|
|
28836
|
+
this.props = props;
|
|
28837
|
+
this.context = context;
|
|
28838
|
+
this.refs = emptyObject;
|
|
28839
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
|
28840
|
+
}
|
|
28841
|
+
function noop() {}
|
|
28842
|
+
function testStringCoercion(value) {
|
|
28457
28843
|
return "" + value;
|
|
28458
28844
|
}
|
|
28459
28845
|
function checkKeyStringCoercion(value) {
|
|
@@ -29328,378 +29714,6 @@ var init_errors = __esm(() => {
|
|
|
29328
29714
|
})));
|
|
29329
29715
|
});
|
|
29330
29716
|
|
|
29331
|
-
// src/config/index.ts
|
|
29332
|
-
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "fs";
|
|
29333
|
-
import { join as join9 } from "path";
|
|
29334
|
-
function getConfigDir() {
|
|
29335
|
-
return configDir();
|
|
29336
|
-
}
|
|
29337
|
-
function getConfigFile() {
|
|
29338
|
-
return join9(getConfigDir(), "config.json");
|
|
29339
|
-
}
|
|
29340
|
-
function loadConfig() {
|
|
29341
|
-
const configDir2 = getConfigDir();
|
|
29342
|
-
const configFile = getConfigFile();
|
|
29343
|
-
if (!existsSync7(configDir2)) {
|
|
29344
|
-
mkdirSync2(configDir2, {
|
|
29345
|
-
recursive: true,
|
|
29346
|
-
mode: 448
|
|
29347
|
-
});
|
|
29348
|
-
}
|
|
29349
|
-
let userConfig = {};
|
|
29350
|
-
let fileExists = existsSync7(configFile);
|
|
29351
|
-
if (!fileExists) {
|
|
29352
|
-
writeFileSync3(configFile, JSON.stringify(DEFAULT_CONFIG, null, 2));
|
|
29353
|
-
fileExists = true;
|
|
29354
|
-
} else {
|
|
29355
|
-
try {
|
|
29356
|
-
userConfig = JSON.parse(readFileSync4(configFile, "utf-8"));
|
|
29357
|
-
} catch (err2) {
|
|
29358
|
-
logBackgroundError("config", `Failed to parse ${configFile}: ${err2 instanceof Error ? err2.message : String(err2)} \u2014 using defaults`);
|
|
29359
|
-
userConfig = {};
|
|
29360
|
-
}
|
|
29361
|
-
}
|
|
29362
|
-
let merged = {
|
|
29363
|
-
...DEFAULT_CONFIG
|
|
29364
|
-
};
|
|
29365
|
-
if (_presetOverlay)
|
|
29366
|
-
merged = applyConfigPatch(merged, _presetOverlay);
|
|
29367
|
-
const userPatch = diffAgainstDefaults(userConfig);
|
|
29368
|
-
if (Object.keys(userPatch).length > 0) {
|
|
29369
|
-
merged = applyConfigPatch(merged, userPatch);
|
|
29370
|
-
}
|
|
29371
|
-
return merged;
|
|
29372
|
-
}
|
|
29373
|
-
function diffAgainstDefaults(userConfig) {
|
|
29374
|
-
const out2 = {};
|
|
29375
|
-
const defaults = DEFAULT_CONFIG;
|
|
29376
|
-
const nested = new Set(NESTED_KEYS);
|
|
29377
|
-
for (const [key2, value] of Object.entries(userConfig)) {
|
|
29378
|
-
if (value === undefined)
|
|
29379
|
-
continue;
|
|
29380
|
-
const def = defaults[key2];
|
|
29381
|
-
if (nested.has(key2) && value && typeof value === "object" && !Array.isArray(value) && def && typeof def === "object" && !Array.isArray(def)) {
|
|
29382
|
-
const subPatch = {};
|
|
29383
|
-
const defRec = def;
|
|
29384
|
-
for (const [subKey, subValue] of Object.entries(value)) {
|
|
29385
|
-
if (subValue === undefined)
|
|
29386
|
-
continue;
|
|
29387
|
-
if (JSON.stringify(subValue) !== JSON.stringify(defRec[subKey])) {
|
|
29388
|
-
subPatch[subKey] = subValue;
|
|
29389
|
-
}
|
|
29390
|
-
}
|
|
29391
|
-
if (Object.keys(subPatch).length > 0)
|
|
29392
|
-
out2[key2] = subPatch;
|
|
29393
|
-
continue;
|
|
29394
|
-
}
|
|
29395
|
-
if (JSON.stringify(value) !== JSON.stringify(def)) {
|
|
29396
|
-
out2[key2] = value;
|
|
29397
|
-
}
|
|
29398
|
-
}
|
|
29399
|
-
return out2;
|
|
29400
|
-
}
|
|
29401
|
-
function loadProjectConfig(cwd) {
|
|
29402
|
-
const projectFile = join9(cwd, ".soulforge", "config.json");
|
|
29403
|
-
if (!existsSync7(projectFile))
|
|
29404
|
-
return null;
|
|
29405
|
-
try {
|
|
29406
|
-
const raw2 = readFileSync4(projectFile, "utf-8");
|
|
29407
|
-
return JSON.parse(raw2);
|
|
29408
|
-
} catch (err2) {
|
|
29409
|
-
logBackgroundError("config", `Failed to parse ${projectFile}: ${err2 instanceof Error ? err2.message : String(err2)} \u2014 ignoring project config`);
|
|
29410
|
-
return null;
|
|
29411
|
-
}
|
|
29412
|
-
}
|
|
29413
|
-
function applyConfigPatch(base, patch) {
|
|
29414
|
-
const result = {
|
|
29415
|
-
...base,
|
|
29416
|
-
...patch
|
|
29417
|
-
};
|
|
29418
|
-
for (const key2 of NESTED_KEYS) {
|
|
29419
|
-
const b3 = base[key2];
|
|
29420
|
-
const p2 = patch[key2];
|
|
29421
|
-
if (p2 && b3 && typeof b3 === "object" && typeof p2 === "object") {
|
|
29422
|
-
result[key2] = {
|
|
29423
|
-
...b3,
|
|
29424
|
-
...p2
|
|
29425
|
-
};
|
|
29426
|
-
}
|
|
29427
|
-
}
|
|
29428
|
-
return result;
|
|
29429
|
-
}
|
|
29430
|
-
var DEFAULT_CONFIG, _presetOverlay = null, NESTED_KEYS;
|
|
29431
|
-
var init_config = __esm(() => {
|
|
29432
|
-
init_platform();
|
|
29433
|
-
init_ensure_soulforge_dir();
|
|
29434
|
-
init_errors();
|
|
29435
|
-
DEFAULT_CONFIG = {
|
|
29436
|
-
defaultModel: "none",
|
|
29437
|
-
routerRules: [],
|
|
29438
|
-
editor: {
|
|
29439
|
-
command: "nvim",
|
|
29440
|
-
args: []
|
|
29441
|
-
},
|
|
29442
|
-
theme: {
|
|
29443
|
-
name: "proxysoul-main",
|
|
29444
|
-
transparent: true
|
|
29445
|
-
},
|
|
29446
|
-
nvimConfig: "default",
|
|
29447
|
-
editorIntegration: {
|
|
29448
|
-
diagnostics: true,
|
|
29449
|
-
symbols: true,
|
|
29450
|
-
hover: true,
|
|
29451
|
-
references: true,
|
|
29452
|
-
definition: true,
|
|
29453
|
-
codeActions: true,
|
|
29454
|
-
editorContext: true,
|
|
29455
|
-
rename: true,
|
|
29456
|
-
lspStatus: true,
|
|
29457
|
-
format: true,
|
|
29458
|
-
syncEditorOnEdit: false
|
|
29459
|
-
},
|
|
29460
|
-
codeExecution: true,
|
|
29461
|
-
webSearch: true,
|
|
29462
|
-
compaction: {
|
|
29463
|
-
strategy: "v2",
|
|
29464
|
-
triggerThreshold: 0.7,
|
|
29465
|
-
resetThreshold: 0.4,
|
|
29466
|
-
keepRecent: 4,
|
|
29467
|
-
maxToolResults: 30,
|
|
29468
|
-
llmExtraction: true
|
|
29469
|
-
}
|
|
29470
|
-
};
|
|
29471
|
-
NESTED_KEYS = ["editor", "theme", "editorIntegration", "codeIntelligence", "thinking", "performance", "contextManagement", "agentFeatures", "compaction", "retry", "addons"];
|
|
29472
|
-
});
|
|
29473
|
-
|
|
29474
|
-
// src/core/intelligence/backends/lsp/server-registry.ts
|
|
29475
|
-
import { existsSync as existsSync8 } from "fs";
|
|
29476
|
-
import { join as join10 } from "path";
|
|
29477
|
-
function firstExisting(dir, cmd) {
|
|
29478
|
-
for (const sfx of BIN_SUFFIXES) {
|
|
29479
|
-
const p2 = join10(dir, cmd + sfx);
|
|
29480
|
-
if (existsSync8(p2))
|
|
29481
|
-
return p2;
|
|
29482
|
-
}
|
|
29483
|
-
return null;
|
|
29484
|
-
}
|
|
29485
|
-
function commandExistsInMason(cmd) {
|
|
29486
|
-
return firstExisting(MASON_BIN_DIR, cmd);
|
|
29487
|
-
}
|
|
29488
|
-
function findInSoulforge(cmd) {
|
|
29489
|
-
const npmBin = firstExisting(join10(SOULFORGE_BIN_DIR, "node_modules", ".bin"), cmd);
|
|
29490
|
-
if (npmBin)
|
|
29491
|
-
return npmBin;
|
|
29492
|
-
const directBin = firstExisting(join10(SOULFORGE_BIN_DIR, "bin"), cmd);
|
|
29493
|
-
if (directBin)
|
|
29494
|
-
return directBin;
|
|
29495
|
-
return null;
|
|
29496
|
-
}
|
|
29497
|
-
function resolveCommand(cmd) {
|
|
29498
|
-
const cached = probeCache.get(cmd);
|
|
29499
|
-
if (cached !== undefined)
|
|
29500
|
-
return cached;
|
|
29501
|
-
if (commandExists(cmd)) {
|
|
29502
|
-
probeCache.set(cmd, cmd);
|
|
29503
|
-
return cmd;
|
|
29504
|
-
}
|
|
29505
|
-
const sfPath = findInSoulforge(cmd);
|
|
29506
|
-
if (sfPath) {
|
|
29507
|
-
probeCache.set(cmd, sfPath);
|
|
29508
|
-
return sfPath;
|
|
29509
|
-
}
|
|
29510
|
-
const masonPath = commandExistsInMason(cmd);
|
|
29511
|
-
if (masonPath) {
|
|
29512
|
-
probeCache.set(cmd, masonPath);
|
|
29513
|
-
return masonPath;
|
|
29514
|
-
}
|
|
29515
|
-
probeCache.set(cmd, null);
|
|
29516
|
-
return null;
|
|
29517
|
-
}
|
|
29518
|
-
function isServerDisabled(cmd) {
|
|
29519
|
-
const cwd = process.cwd();
|
|
29520
|
-
const global2 = loadConfig();
|
|
29521
|
-
const project = loadProjectConfig(cwd);
|
|
29522
|
-
const disabled = project?.disabledLspServers ?? global2.disabledLspServers ?? [];
|
|
29523
|
-
return disabled.includes(cmd);
|
|
29524
|
-
}
|
|
29525
|
-
function findServersForLanguage(language) {
|
|
29526
|
-
const candidates = SERVER_CANDIDATES[language];
|
|
29527
|
-
if (!candidates)
|
|
29528
|
-
return [];
|
|
29529
|
-
const results = [];
|
|
29530
|
-
for (const candidate of candidates) {
|
|
29531
|
-
if (isServerDisabled(candidate.command))
|
|
29532
|
-
continue;
|
|
29533
|
-
const resolved = resolveCommand(candidate.command);
|
|
29534
|
-
if (resolved) {
|
|
29535
|
-
results.push({
|
|
29536
|
-
command: resolved,
|
|
29537
|
-
args: candidate.args,
|
|
29538
|
-
language
|
|
29539
|
-
});
|
|
29540
|
-
}
|
|
29541
|
-
}
|
|
29542
|
-
return results;
|
|
29543
|
-
}
|
|
29544
|
-
var SERVER_CANDIDATES, MASON_BIN_DIR, SOULFORGE_BIN_DIR, BIN_SUFFIXES, probeCache;
|
|
29545
|
-
var init_server_registry = __esm(() => {
|
|
29546
|
-
init_config();
|
|
29547
|
-
init_platform();
|
|
29548
|
-
SERVER_CANDIDATES = {
|
|
29549
|
-
typescript: [{
|
|
29550
|
-
command: "typescript-language-server",
|
|
29551
|
-
args: ["--stdio"]
|
|
29552
|
-
}, {
|
|
29553
|
-
command: "biome",
|
|
29554
|
-
args: ["lsp-proxy"]
|
|
29555
|
-
}, {
|
|
29556
|
-
command: "deno",
|
|
29557
|
-
args: ["lsp"]
|
|
29558
|
-
}, {
|
|
29559
|
-
command: "vscode-eslint-language-server",
|
|
29560
|
-
args: ["--stdio"]
|
|
29561
|
-
}],
|
|
29562
|
-
javascript: [{
|
|
29563
|
-
command: "typescript-language-server",
|
|
29564
|
-
args: ["--stdio"]
|
|
29565
|
-
}, {
|
|
29566
|
-
command: "biome",
|
|
29567
|
-
args: ["lsp-proxy"]
|
|
29568
|
-
}, {
|
|
29569
|
-
command: "deno",
|
|
29570
|
-
args: ["lsp"]
|
|
29571
|
-
}, {
|
|
29572
|
-
command: "vscode-eslint-language-server",
|
|
29573
|
-
args: ["--stdio"]
|
|
29574
|
-
}],
|
|
29575
|
-
python: [{
|
|
29576
|
-
command: "pyright-langserver",
|
|
29577
|
-
args: ["--stdio"]
|
|
29578
|
-
}, {
|
|
29579
|
-
command: "pylsp",
|
|
29580
|
-
args: []
|
|
29581
|
-
}],
|
|
29582
|
-
go: [{
|
|
29583
|
-
command: "gopls",
|
|
29584
|
-
args: ["serve"]
|
|
29585
|
-
}],
|
|
29586
|
-
rust: [{
|
|
29587
|
-
command: "rust-analyzer",
|
|
29588
|
-
args: []
|
|
29589
|
-
}],
|
|
29590
|
-
lua: [{
|
|
29591
|
-
command: "lua-language-server",
|
|
29592
|
-
args: []
|
|
29593
|
-
}],
|
|
29594
|
-
c: [{
|
|
29595
|
-
command: "clangd",
|
|
29596
|
-
args: []
|
|
29597
|
-
}],
|
|
29598
|
-
cpp: [{
|
|
29599
|
-
command: "clangd",
|
|
29600
|
-
args: []
|
|
29601
|
-
}],
|
|
29602
|
-
ruby: [{
|
|
29603
|
-
command: "solargraph",
|
|
29604
|
-
args: ["stdio"]
|
|
29605
|
-
}],
|
|
29606
|
-
php: [{
|
|
29607
|
-
command: "intelephense",
|
|
29608
|
-
args: ["--stdio"]
|
|
29609
|
-
}],
|
|
29610
|
-
zig: [{
|
|
29611
|
-
command: "zls",
|
|
29612
|
-
args: []
|
|
29613
|
-
}],
|
|
29614
|
-
bash: [{
|
|
29615
|
-
command: "bash-language-server",
|
|
29616
|
-
args: ["start"]
|
|
29617
|
-
}],
|
|
29618
|
-
css: [{
|
|
29619
|
-
command: "vscode-css-language-server",
|
|
29620
|
-
args: ["--stdio"]
|
|
29621
|
-
}, {
|
|
29622
|
-
command: "biome",
|
|
29623
|
-
args: ["lsp-proxy"]
|
|
29624
|
-
}, {
|
|
29625
|
-
command: "tailwindcss-language-server",
|
|
29626
|
-
args: ["--stdio"]
|
|
29627
|
-
}],
|
|
29628
|
-
html: [{
|
|
29629
|
-
command: "vscode-html-language-server",
|
|
29630
|
-
args: ["--stdio"]
|
|
29631
|
-
}, {
|
|
29632
|
-
command: "emmet-language-server",
|
|
29633
|
-
args: ["--stdio"]
|
|
29634
|
-
}],
|
|
29635
|
-
json: [{
|
|
29636
|
-
command: "vscode-json-language-server",
|
|
29637
|
-
args: ["--stdio"]
|
|
29638
|
-
}, {
|
|
29639
|
-
command: "biome",
|
|
29640
|
-
args: ["lsp-proxy"]
|
|
29641
|
-
}],
|
|
29642
|
-
yaml: [{
|
|
29643
|
-
command: "yaml-language-server",
|
|
29644
|
-
args: ["--stdio"]
|
|
29645
|
-
}],
|
|
29646
|
-
toml: [{
|
|
29647
|
-
command: "taplo",
|
|
29648
|
-
args: ["lsp", "stdio"]
|
|
29649
|
-
}],
|
|
29650
|
-
dockerfile: [{
|
|
29651
|
-
command: "docker-langserver",
|
|
29652
|
-
args: ["--stdio"]
|
|
29653
|
-
}],
|
|
29654
|
-
java: [{
|
|
29655
|
-
command: "jdtls",
|
|
29656
|
-
args: []
|
|
29657
|
-
}],
|
|
29658
|
-
kotlin: [{
|
|
29659
|
-
command: "kotlin-language-server",
|
|
29660
|
-
args: []
|
|
29661
|
-
}],
|
|
29662
|
-
scala: [{
|
|
29663
|
-
command: "metals",
|
|
29664
|
-
args: []
|
|
29665
|
-
}],
|
|
29666
|
-
csharp: [{
|
|
29667
|
-
command: "csharp-ls",
|
|
29668
|
-
args: []
|
|
29669
|
-
}, {
|
|
29670
|
-
command: "OmniSharp",
|
|
29671
|
-
args: ["--languageserver"]
|
|
29672
|
-
}],
|
|
29673
|
-
swift: [{
|
|
29674
|
-
command: "sourcekit-lsp",
|
|
29675
|
-
args: []
|
|
29676
|
-
}],
|
|
29677
|
-
dart: [{
|
|
29678
|
-
command: "dart",
|
|
29679
|
-
args: ["language-server", "--protocol=lsp"]
|
|
29680
|
-
}],
|
|
29681
|
-
elixir: [{
|
|
29682
|
-
command: "elixir-ls",
|
|
29683
|
-
args: []
|
|
29684
|
-
}, {
|
|
29685
|
-
command: "expert",
|
|
29686
|
-
args: []
|
|
29687
|
-
}],
|
|
29688
|
-
ocaml: [{
|
|
29689
|
-
command: "ocamllsp",
|
|
29690
|
-
args: []
|
|
29691
|
-
}],
|
|
29692
|
-
vue: [{
|
|
29693
|
-
command: "vue-language-server",
|
|
29694
|
-
args: ["--stdio"]
|
|
29695
|
-
}]
|
|
29696
|
-
};
|
|
29697
|
-
MASON_BIN_DIR = join10(userDataDir(), "mason", "bin");
|
|
29698
|
-
SOULFORGE_BIN_DIR = join10(configDir(), "lsp-servers");
|
|
29699
|
-
BIN_SUFFIXES = IS_WIN ? [".exe", ".cmd", ""] : [""];
|
|
29700
|
-
probeCache = new Map;
|
|
29701
|
-
});
|
|
29702
|
-
|
|
29703
29717
|
// src/core/process-tracker.ts
|
|
29704
29718
|
function trackProcess(proc) {
|
|
29705
29719
|
tracked.add(proc);
|