@proxysoul/soulforge 2.2.0 → 2.2.1
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 +131 -41
- package/dist/workers/intelligence.worker.js +111 -21
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -39260,7 +39260,7 @@ var package_default;
|
|
|
39260
39260
|
var init_package = __esm(() => {
|
|
39261
39261
|
package_default = {
|
|
39262
39262
|
name: "@proxysoul/soulforge",
|
|
39263
|
-
version: "2.2.
|
|
39263
|
+
version: "2.2.1",
|
|
39264
39264
|
description: "Graph-powered code intelligence \u2014 multi-agent coding with codebase-aware AI",
|
|
39265
39265
|
repository: {
|
|
39266
39266
|
type: "git",
|
|
@@ -81561,7 +81561,7 @@ class StandaloneLspClient {
|
|
|
81561
81561
|
}
|
|
81562
81562
|
return;
|
|
81563
81563
|
}
|
|
81564
|
-
const languageId = this.config.language
|
|
81564
|
+
const languageId = LANGUAGE_ID_MAP[this.config.language] ?? this.config.language;
|
|
81565
81565
|
this.notify("textDocument/didOpen", {
|
|
81566
81566
|
textDocument: {
|
|
81567
81567
|
uri,
|
|
@@ -81931,10 +81931,40 @@ function normalizeLocations(result) {
|
|
|
81931
81931
|
}
|
|
81932
81932
|
return [result];
|
|
81933
81933
|
}
|
|
81934
|
+
var LANGUAGE_ID_MAP;
|
|
81934
81935
|
var init_standalone_client = __esm(() => {
|
|
81935
81936
|
init_errors();
|
|
81936
81937
|
init_process_tracker();
|
|
81937
81938
|
init_protocol();
|
|
81939
|
+
LANGUAGE_ID_MAP = {
|
|
81940
|
+
typescript: "typescript",
|
|
81941
|
+
javascript: "javascript",
|
|
81942
|
+
python: "python",
|
|
81943
|
+
go: "go",
|
|
81944
|
+
rust: "rust",
|
|
81945
|
+
java: "java",
|
|
81946
|
+
kotlin: "kotlin",
|
|
81947
|
+
scala: "scala",
|
|
81948
|
+
csharp: "csharp",
|
|
81949
|
+
swift: "swift",
|
|
81950
|
+
dart: "dart",
|
|
81951
|
+
elixir: "elixir",
|
|
81952
|
+
ocaml: "ocaml",
|
|
81953
|
+
lua: "lua",
|
|
81954
|
+
c: "c",
|
|
81955
|
+
cpp: "cpp",
|
|
81956
|
+
ruby: "ruby",
|
|
81957
|
+
php: "php",
|
|
81958
|
+
zig: "zig",
|
|
81959
|
+
bash: "shellscript",
|
|
81960
|
+
css: "css",
|
|
81961
|
+
html: "html",
|
|
81962
|
+
json: "json",
|
|
81963
|
+
toml: "toml",
|
|
81964
|
+
yaml: "yaml",
|
|
81965
|
+
dockerfile: "dockerfile",
|
|
81966
|
+
vue: "vue"
|
|
81967
|
+
};
|
|
81938
81968
|
});
|
|
81939
81969
|
|
|
81940
81970
|
// src/core/editor/instance.ts
|
|
@@ -82478,7 +82508,7 @@ async function findImplementation(filePath, line, col) {
|
|
|
82478
82508
|
textDocument = { uri = vim.uri_from_fname(filepath) },
|
|
82479
82509
|
position = { line = ${String(line)}, character = ${String(col)} },
|
|
82480
82510
|
}
|
|
82481
|
-
local results = vim.lsp.buf_request_sync(bufnr, 'textDocument/implementation', params,
|
|
82511
|
+
local results = vim.lsp.buf_request_sync(bufnr, 'textDocument/implementation', params, 15000)
|
|
82482
82512
|
if not results then return '[]' end
|
|
82483
82513
|
local impls = {}
|
|
82484
82514
|
for _, res in pairs(results) do
|
|
@@ -82615,7 +82645,7 @@ var init_nvim_bridge = __esm(() => {
|
|
|
82615
82645
|
});
|
|
82616
82646
|
|
|
82617
82647
|
// src/core/intelligence/backends/lsp/index.ts
|
|
82618
|
-
import { existsSync as existsSync11 } from "fs";
|
|
82648
|
+
import { existsSync as existsSync11, readdirSync as readdirSync3 } from "fs";
|
|
82619
82649
|
import { readdir, readFile as readFile4 } from "fs/promises";
|
|
82620
82650
|
import { dirname as dirname3, join as join10, resolve as resolve5 } from "path";
|
|
82621
82651
|
function getNvimBridge() {
|
|
@@ -83367,6 +83397,9 @@ class LspBackend {
|
|
|
83367
83397
|
await new Promise((r) => setTimeout(r, 500));
|
|
83368
83398
|
}
|
|
83369
83399
|
}
|
|
83400
|
+
isNvimAvailable() {
|
|
83401
|
+
return nvimBridge.isNvimAvailable();
|
|
83402
|
+
}
|
|
83370
83403
|
async warmupNvim(file2) {
|
|
83371
83404
|
if (!nvimBridge.isNvimAvailable())
|
|
83372
83405
|
return false;
|
|
@@ -83773,8 +83806,22 @@ function findProjectRootForLanguage(file2, language) {
|
|
|
83773
83806
|
return null;
|
|
83774
83807
|
let dir = dirname3(resolve5(file2));
|
|
83775
83808
|
const root = resolve5("/");
|
|
83776
|
-
|
|
83777
|
-
|
|
83809
|
+
const MAX_DIRS = 100;
|
|
83810
|
+
let dirCount = 0;
|
|
83811
|
+
while (dir !== root && dirCount < MAX_DIRS) {
|
|
83812
|
+
dirCount++;
|
|
83813
|
+
const extMarkers = markers.filter((m) => m.startsWith(".") && !m.includes("/"));
|
|
83814
|
+
const nameMarkers = markers.filter((m) => !m.startsWith(".") || m.includes("/"));
|
|
83815
|
+
if (extMarkers.length > 0) {
|
|
83816
|
+
try {
|
|
83817
|
+
const entries = readdirSync3(dir);
|
|
83818
|
+
for (const marker30 of extMarkers) {
|
|
83819
|
+
if (entries.some((e) => e.endsWith(marker30)))
|
|
83820
|
+
return dir;
|
|
83821
|
+
}
|
|
83822
|
+
} catch {}
|
|
83823
|
+
}
|
|
83824
|
+
for (const marker30 of nameMarkers) {
|
|
83778
83825
|
if (existsSync11(join10(dir, marker30)))
|
|
83779
83826
|
return dir;
|
|
83780
83827
|
}
|
|
@@ -83806,15 +83853,24 @@ var init_lsp = __esm(() => {
|
|
|
83806
83853
|
return mod[prop];
|
|
83807
83854
|
}
|
|
83808
83855
|
});
|
|
83809
|
-
SUPPORTED_LANGUAGES = new Set(["typescript", "javascript", "python", "go", "rust", "lua", "c", "cpp", "ruby", "php", "zig", "bash", "css", "html", "json", "yaml", "dockerfile"]);
|
|
83856
|
+
SUPPORTED_LANGUAGES = new Set(["typescript", "javascript", "python", "go", "rust", "java", "kotlin", "scala", "csharp", "swift", "dart", "elixir", "ocaml", "lua", "c", "cpp", "ruby", "php", "zig", "bash", "css", "html", "json", "toml", "yaml", "dockerfile", "vue"]);
|
|
83810
83857
|
PROJECT_FILES = {
|
|
83811
83858
|
typescript: ["tsconfig.json"],
|
|
83812
83859
|
javascript: ["jsconfig.json", "tsconfig.json"],
|
|
83813
83860
|
python: ["pyproject.toml", "setup.py"],
|
|
83814
83861
|
go: ["go.mod"],
|
|
83815
|
-
rust: ["Cargo.toml"]
|
|
83862
|
+
rust: ["Cargo.toml"],
|
|
83863
|
+
java: ["pom.xml", "build.gradle", "build.gradle.kts", "settings.gradle", "settings.gradle.kts"],
|
|
83864
|
+
kotlin: ["build.gradle.kts", "build.gradle", "settings.gradle.kts", "settings.gradle"],
|
|
83865
|
+
scala: ["build.sbt"],
|
|
83866
|
+
csharp: [".csproj", ".sln"],
|
|
83867
|
+
dart: ["pubspec.yaml"],
|
|
83868
|
+
elixir: ["mix.exs"],
|
|
83869
|
+
ruby: ["Gemfile"],
|
|
83870
|
+
php: ["composer.json"],
|
|
83871
|
+
swift: ["Package.swift"]
|
|
83816
83872
|
};
|
|
83817
|
-
DEFINITION_KEYWORDS = /\b(function|class|const|let|var|type|interface|enum|struct|trait|fn|def|func|impl|mod|pub)\b/;
|
|
83873
|
+
DEFINITION_KEYWORDS = /\b(function|class|const|let|var|type|interface|enum|struct|trait|fn|def|func|impl|mod|pub|public|private|protected|static|void|abstract|override|sealed|record|annotation|object|fun|suspend|data|inline|operator|infix|external|companion|lateinit|val)\b/;
|
|
83818
83874
|
});
|
|
83819
83875
|
|
|
83820
83876
|
// src/core/intelligence/backends/regex.ts
|
|
@@ -330073,7 +330129,7 @@ var tsMorphModule = null;
|
|
|
330073
330129
|
var init_ts_morph = () => {};
|
|
330074
330130
|
|
|
330075
330131
|
// src/core/intelligence/router.ts
|
|
330076
|
-
import { existsSync as existsSync13, readdirSync as
|
|
330132
|
+
import { existsSync as existsSync13, readdirSync as readdirSync4 } from "fs";
|
|
330077
330133
|
import { extname, join as join12 } from "path";
|
|
330078
330134
|
|
|
330079
330135
|
class CodeIntelligenceRouter {
|
|
@@ -330236,8 +330292,9 @@ class CodeIntelligenceRouter {
|
|
|
330236
330292
|
add(lang);
|
|
330237
330293
|
}
|
|
330238
330294
|
const SKIP = new Set(["node_modules", ".git", "dist", "build", "out", "vendor", "__pycache__", ".venv", "venv", "target", ".next", ".nuxt", ".output", "coverage", ".turbo", ".cache"]);
|
|
330239
|
-
const
|
|
330240
|
-
const
|
|
330295
|
+
const hasJvm = found.some((l) => l === "java" || l === "kotlin" || l === "scala");
|
|
330296
|
+
const MAX_DEPTH = hasJvm ? 8 : 3;
|
|
330297
|
+
const MAX_DIRS = hasJvm ? 500 : 100;
|
|
330241
330298
|
const queue = [{
|
|
330242
330299
|
dir: this.cwd,
|
|
330243
330300
|
depth: 0
|
|
@@ -330249,7 +330306,7 @@ class CodeIntelligenceRouter {
|
|
|
330249
330306
|
break;
|
|
330250
330307
|
visited++;
|
|
330251
330308
|
try {
|
|
330252
|
-
const entries =
|
|
330309
|
+
const entries = readdirSync4(item.dir, {
|
|
330253
330310
|
withFileTypes: true
|
|
330254
330311
|
});
|
|
330255
330312
|
for (const entry of entries) {
|
|
@@ -330285,8 +330342,9 @@ class CodeIntelligenceRouter {
|
|
|
330285
330342
|
if (exts.length === 0)
|
|
330286
330343
|
return null;
|
|
330287
330344
|
const SKIP = new Set(["node_modules", ".git", "dist", "build", "out", "vendor", "__pycache__", ".venv", "venv", "target", ".next", ".nuxt", ".output", "coverage", ".turbo", ".cache"]);
|
|
330288
|
-
const
|
|
330289
|
-
const
|
|
330345
|
+
const isJvmLanguage = language === "java" || language === "kotlin" || language === "scala";
|
|
330346
|
+
const MAX_DEPTH = isJvmLanguage ? 10 : 4;
|
|
330347
|
+
const MAX_DIRS = isJvmLanguage ? 500 : 200;
|
|
330290
330348
|
const queue = [{
|
|
330291
330349
|
dir: this.cwd,
|
|
330292
330350
|
depth: 0
|
|
@@ -330298,7 +330356,7 @@ class CodeIntelligenceRouter {
|
|
|
330298
330356
|
break;
|
|
330299
330357
|
visited++;
|
|
330300
330358
|
try {
|
|
330301
|
-
const entries =
|
|
330359
|
+
const entries = readdirSync4(item.dir, {
|
|
330302
330360
|
withFileTypes: true
|
|
330303
330361
|
});
|
|
330304
330362
|
for (const entry of entries) {
|
|
@@ -330389,16 +330447,16 @@ class CodeIntelligenceRouter {
|
|
|
330389
330447
|
label: `findImplementation(${probeSymbolName})`,
|
|
330390
330448
|
fn: (b, f) => b.findImplementation?.(f, probeSymbolName) ?? Promise.resolve(null)
|
|
330391
330449
|
}];
|
|
330392
|
-
const probeOp = async (fn, label, probes) => {
|
|
330450
|
+
const probeOp = async (fn, label, probes, timeout = OP_TIMEOUT) => {
|
|
330393
330451
|
const start2 = performance.now();
|
|
330394
330452
|
try {
|
|
330395
|
-
const result = await Promise.race([fn(), new Promise((r) => setTimeout(() => r("timeout"),
|
|
330453
|
+
const result = await Promise.race([fn(), new Promise((r) => setTimeout(() => r("timeout"), timeout))]);
|
|
330396
330454
|
const ms = Math.round(performance.now() - start2);
|
|
330397
330455
|
if (result === "timeout") {
|
|
330398
330456
|
probes.push({
|
|
330399
330457
|
operation: label,
|
|
330400
330458
|
status: "timeout",
|
|
330401
|
-
ms:
|
|
330459
|
+
ms: timeout
|
|
330402
330460
|
});
|
|
330403
330461
|
} else if (result === null || result === undefined) {
|
|
330404
330462
|
probes.push({
|
|
@@ -330490,13 +330548,43 @@ class CodeIntelligenceRouter {
|
|
|
330490
330548
|
}
|
|
330491
330549
|
}
|
|
330492
330550
|
const hasStandaloneProbe = backend.name === "lsp" && "probeStandalone" in backend && typeof backend.probeStandalone === "function";
|
|
330493
|
-
if (hasStandaloneProbe &&
|
|
330551
|
+
if (hasStandaloneProbe && !initError) {
|
|
330494
330552
|
const lsp = backend;
|
|
330553
|
+
if (!probeFile) {
|
|
330554
|
+
updateBackend("lsp:nvim", {
|
|
330555
|
+
initialized: this.initialized.has(backend.name),
|
|
330556
|
+
initMs,
|
|
330557
|
+
initError,
|
|
330558
|
+
probes: fileOps.map(({
|
|
330559
|
+
label
|
|
330560
|
+
}) => ({
|
|
330561
|
+
operation: label,
|
|
330562
|
+
status: "empty",
|
|
330563
|
+
error: "no source file found in project"
|
|
330564
|
+
}))
|
|
330565
|
+
});
|
|
330566
|
+
updateBackend("lsp:standalone", {
|
|
330567
|
+
initialized: this.initialized.has(backend.name),
|
|
330568
|
+
initError,
|
|
330569
|
+
probes: fileOps.map(({
|
|
330570
|
+
label
|
|
330571
|
+
}) => ({
|
|
330572
|
+
operation: label,
|
|
330573
|
+
status: "empty",
|
|
330574
|
+
error: "no source file found in project"
|
|
330575
|
+
}))
|
|
330576
|
+
});
|
|
330577
|
+
continue;
|
|
330578
|
+
}
|
|
330495
330579
|
if (lsp.warmupNvim) {
|
|
330496
|
-
|
|
330497
|
-
|
|
330498
|
-
|
|
330580
|
+
const nvimAvailable = lsp.isNvimAvailable?.() ?? false;
|
|
330581
|
+
if (nvimAvailable) {
|
|
330582
|
+
try {
|
|
330583
|
+
await Promise.race([lsp.warmupNvim(probeFile), new Promise((r) => setTimeout(() => r(false), 25000))]);
|
|
330584
|
+
} catch {}
|
|
330585
|
+
}
|
|
330499
330586
|
}
|
|
330587
|
+
const IMPL_TIMEOUT = 20000;
|
|
330500
330588
|
const nvimProbes = [];
|
|
330501
330589
|
for (const {
|
|
330502
330590
|
op,
|
|
@@ -330510,7 +330598,8 @@ class CodeIntelligenceRouter {
|
|
|
330510
330598
|
});
|
|
330511
330599
|
continue;
|
|
330512
330600
|
}
|
|
330513
|
-
|
|
330601
|
+
const t = op === "findImplementation" ? IMPL_TIMEOUT : OP_TIMEOUT;
|
|
330602
|
+
await probeOp(() => fn(backend, probeFile), label, nvimProbes, t);
|
|
330514
330603
|
}
|
|
330515
330604
|
updateBackend("lsp:nvim", {
|
|
330516
330605
|
initialized: this.initialized.has(backend.name),
|
|
@@ -330533,7 +330622,8 @@ class CodeIntelligenceRouter {
|
|
|
330533
330622
|
});
|
|
330534
330623
|
continue;
|
|
330535
330624
|
}
|
|
330536
|
-
|
|
330625
|
+
const t = op === "findImplementation" ? IMPL_TIMEOUT : OP_TIMEOUT;
|
|
330626
|
+
await probeOp(() => lsp.probeStandalone(probeFile, op), label, standaloneProbes, t);
|
|
330537
330627
|
}
|
|
330538
330628
|
updateBackend("lsp:standalone", {
|
|
330539
330629
|
initialized: true,
|
|
@@ -331782,13 +331872,13 @@ var init_repo_map_constants = __esm(() => {
|
|
|
331782
331872
|
});
|
|
331783
331873
|
|
|
331784
331874
|
// src/core/context/file-tree.ts
|
|
331785
|
-
import { readdirSync as
|
|
331875
|
+
import { readdirSync as readdirSync5 } from "fs";
|
|
331786
331876
|
import { join as join13 } from "path";
|
|
331787
331877
|
function walkDir(dir, prefix, depth, lines) {
|
|
331788
331878
|
if (depth <= 0)
|
|
331789
331879
|
return;
|
|
331790
331880
|
try {
|
|
331791
|
-
const entries =
|
|
331881
|
+
const entries = readdirSync5(dir, {
|
|
331792
331882
|
withFileTypes: true
|
|
331793
331883
|
}).filter((e) => !IGNORED_DIRS.has(e.name) && !e.name.startsWith(".")).sort((a, b) => {
|
|
331794
331884
|
if (a.isDirectory() && !b.isDirectory())
|
|
@@ -357917,7 +358007,7 @@ ${hint}` : stdout || stderr;
|
|
|
357917
358007
|
});
|
|
357918
358008
|
|
|
357919
358009
|
// src/core/skills/manager.ts
|
|
357920
|
-
import { existsSync as existsSync17, readdirSync as
|
|
358010
|
+
import { existsSync as existsSync17, readdirSync as readdirSync6, readFileSync as readFileSync10, realpathSync as realpathSync2, rmSync as rmSync2, statSync as statSync4 } from "fs";
|
|
357921
358011
|
import { homedir as homedir15 } from "os";
|
|
357922
358012
|
import { dirname as dirname10, join as join21 } from "path";
|
|
357923
358013
|
async function searchSkills(query2) {
|
|
@@ -358014,7 +358104,7 @@ function listInstalledSkills() {
|
|
|
358014
358104
|
return [...byName.values()];
|
|
358015
358105
|
}
|
|
358016
358106
|
function scanSkillDir(dir, scope, byName, seenPaths) {
|
|
358017
|
-
const entries2 =
|
|
358107
|
+
const entries2 = readdirSync6(dir, {
|
|
358018
358108
|
withFileTypes: true
|
|
358019
358109
|
});
|
|
358020
358110
|
for (const entry of entries2) {
|
|
@@ -382813,7 +382903,7 @@ function rebuildCoreMessages(messages) {
|
|
|
382813
382903
|
}
|
|
382814
382904
|
|
|
382815
382905
|
// src/core/sessions/manager.ts
|
|
382816
|
-
import { existsSync as existsSync21, mkdirSync as mkdirSync9, readdirSync as
|
|
382906
|
+
import { existsSync as existsSync21, mkdirSync as mkdirSync9, readdirSync as readdirSync7, readFileSync as readFileSync11, rmSync as rmSync4, statSync as statSync5 } from "fs";
|
|
382817
382907
|
import { rename as rename3, writeFile as writeFile13 } from "fs/promises";
|
|
382818
382908
|
import { join as join30 } from "path";
|
|
382819
382909
|
|
|
@@ -382970,7 +383060,7 @@ class SessionManager {
|
|
|
382970
383060
|
if (!existsSync21(this.dir))
|
|
382971
383061
|
return null;
|
|
382972
383062
|
const normalizedPrefix = prefix.toLowerCase();
|
|
382973
|
-
const entries2 =
|
|
383063
|
+
const entries2 = readdirSync7(this.dir);
|
|
382974
383064
|
for (const entry of entries2) {
|
|
382975
383065
|
if (entry.toLowerCase().startsWith(normalizedPrefix)) {
|
|
382976
383066
|
const metaPath = join30(this.dir, entry, "meta.json");
|
|
@@ -382984,7 +383074,7 @@ class SessionManager {
|
|
|
382984
383074
|
if (!existsSync21(this.dir))
|
|
382985
383075
|
return [];
|
|
382986
383076
|
try {
|
|
382987
|
-
const entries2 =
|
|
383077
|
+
const entries2 = readdirSync7(this.dir);
|
|
382988
383078
|
const metas = [];
|
|
382989
383079
|
for (const entry of entries2) {
|
|
382990
383080
|
try {
|
|
@@ -383025,7 +383115,7 @@ class SessionManager {
|
|
|
383025
383115
|
clearAllSessions() {
|
|
383026
383116
|
if (!existsSync21(this.dir))
|
|
383027
383117
|
return 0;
|
|
383028
|
-
const entries2 =
|
|
383118
|
+
const entries2 = readdirSync7(this.dir);
|
|
383029
383119
|
let count = 0;
|
|
383030
383120
|
for (const entry of entries2) {
|
|
383031
383121
|
try {
|
|
@@ -383047,7 +383137,7 @@ class SessionManager {
|
|
|
383047
383137
|
if (!existsSync21(this.dir))
|
|
383048
383138
|
return 0;
|
|
383049
383139
|
try {
|
|
383050
|
-
return
|
|
383140
|
+
return readdirSync7(this.dir).filter((e) => {
|
|
383051
383141
|
try {
|
|
383052
383142
|
return statSync5(join30(this.dir, e)).isDirectory();
|
|
383053
383143
|
} catch {
|
|
@@ -446442,7 +446532,7 @@ var init_shallow2 = __esm(() => {
|
|
|
446442
446532
|
});
|
|
446443
446533
|
|
|
446444
446534
|
// src/core/commands/utils.ts
|
|
446445
|
-
import { existsSync as existsSync26, readdirSync as
|
|
446535
|
+
import { existsSync as existsSync26, readdirSync as readdirSync8, statSync as statSync6 } from "fs";
|
|
446446
446536
|
import { homedir as homedir18 } from "os";
|
|
446447
446537
|
import { join as join35 } from "path";
|
|
446448
446538
|
function sysMsg(ctx, content) {
|
|
@@ -446464,7 +446554,7 @@ function dirSize(dirPath) {
|
|
|
446464
446554
|
if (!existsSync26(dirPath))
|
|
446465
446555
|
return 0;
|
|
446466
446556
|
let total = 0;
|
|
446467
|
-
for (const entry of
|
|
446557
|
+
for (const entry of readdirSync8(dirPath)) {
|
|
446468
446558
|
const fp = join35(dirPath, entry);
|
|
446469
446559
|
try {
|
|
446470
446560
|
const s2 = statSync6(fp);
|
|
@@ -462925,14 +463015,14 @@ var init_LockInStreamView = __esm(async () => {
|
|
|
462925
463015
|
});
|
|
462926
463016
|
|
|
462927
463017
|
// src/core/utils/syntax.ts
|
|
462928
|
-
import { existsSync as existsSync32, readdirSync as
|
|
463018
|
+
import { existsSync as existsSync32, readdirSync as readdirSync9 } from "fs";
|
|
462929
463019
|
import { homedir as homedir22 } from "os";
|
|
462930
463020
|
import { dirname as dirname17, join as join42, resolve as resolve35 } from "path";
|
|
462931
463021
|
function discoverParsers() {
|
|
462932
463022
|
const parsers = [];
|
|
462933
463023
|
let dirs;
|
|
462934
463024
|
try {
|
|
462935
|
-
dirs =
|
|
463025
|
+
dirs = readdirSync9(coreAssetsDir, {
|
|
462936
463026
|
withFileTypes: true
|
|
462937
463027
|
}).filter((d3) => d3.isDirectory()).map((d3) => d3.name);
|
|
462938
463028
|
} catch {
|
|
@@ -462940,7 +463030,7 @@ function discoverParsers() {
|
|
|
462940
463030
|
}
|
|
462941
463031
|
for (const dir of dirs) {
|
|
462942
463032
|
const langDir = resolve35(coreAssetsDir, dir);
|
|
462943
|
-
const wasmFiles =
|
|
463033
|
+
const wasmFiles = readdirSync9(langDir).filter((f3) => f3.endsWith(".wasm"));
|
|
462944
463034
|
const wasmFile = wasmFiles[0];
|
|
462945
463035
|
if (!wasmFile)
|
|
462946
463036
|
continue;
|
|
@@ -494643,11 +494733,11 @@ function getAllPackageStatus(category) {
|
|
|
494643
494733
|
function detectProjectLanguages(cwd2) {
|
|
494644
494734
|
const languages = [];
|
|
494645
494735
|
const {
|
|
494646
|
-
readdirSync:
|
|
494736
|
+
readdirSync: readdirSync10
|
|
494647
494737
|
} = __require("fs");
|
|
494648
494738
|
let files;
|
|
494649
494739
|
try {
|
|
494650
|
-
files =
|
|
494740
|
+
files = readdirSync10(cwd2);
|
|
494651
494741
|
} catch {
|
|
494652
494742
|
return [];
|
|
494653
494743
|
}
|
|
@@ -23992,7 +23992,7 @@ async function findImplementation(filePath, line, col) {
|
|
|
23992
23992
|
textDocument = { uri = vim.uri_from_fname(filepath) },
|
|
23993
23993
|
position = { line = ${String(line)}, character = ${String(col)} },
|
|
23994
23994
|
}
|
|
23995
|
-
local results = vim.lsp.buf_request_sync(bufnr, 'textDocument/implementation', params,
|
|
23995
|
+
local results = vim.lsp.buf_request_sync(bufnr, 'textDocument/implementation', params, 15000)
|
|
23996
23996
|
if not results then return '[]' end
|
|
23997
23997
|
local impls = {}
|
|
23998
23998
|
for _, res in pairs(results) do
|
|
@@ -27624,8 +27624,9 @@ class CodeIntelligenceRouter {
|
|
|
27624
27624
|
add(lang254);
|
|
27625
27625
|
}
|
|
27626
27626
|
const SKIP = new Set(["node_modules", ".git", "dist", "build", "out", "vendor", "__pycache__", ".venv", "venv", "target", ".next", ".nuxt", ".output", "coverage", ".turbo", ".cache"]);
|
|
27627
|
-
const
|
|
27628
|
-
const
|
|
27627
|
+
const hasJvm = found.some((l3) => l3 === "java" || l3 === "kotlin" || l3 === "scala");
|
|
27628
|
+
const MAX_DEPTH2 = hasJvm ? 8 : 3;
|
|
27629
|
+
const MAX_DIRS = hasJvm ? 500 : 100;
|
|
27629
27630
|
const queue = [{
|
|
27630
27631
|
dir: this.cwd,
|
|
27631
27632
|
depth: 0
|
|
@@ -27673,8 +27674,9 @@ class CodeIntelligenceRouter {
|
|
|
27673
27674
|
if (exts.length === 0)
|
|
27674
27675
|
return null;
|
|
27675
27676
|
const SKIP = new Set(["node_modules", ".git", "dist", "build", "out", "vendor", "__pycache__", ".venv", "venv", "target", ".next", ".nuxt", ".output", "coverage", ".turbo", ".cache"]);
|
|
27676
|
-
const
|
|
27677
|
-
const
|
|
27677
|
+
const isJvmLanguage = language === "java" || language === "kotlin" || language === "scala";
|
|
27678
|
+
const MAX_DEPTH2 = isJvmLanguage ? 10 : 4;
|
|
27679
|
+
const MAX_DIRS = isJvmLanguage ? 500 : 200;
|
|
27678
27680
|
const queue = [{
|
|
27679
27681
|
dir: this.cwd,
|
|
27680
27682
|
depth: 0
|
|
@@ -27777,16 +27779,16 @@ class CodeIntelligenceRouter {
|
|
|
27777
27779
|
label: `findImplementation(${probeSymbolName})`,
|
|
27778
27780
|
fn: (b3, f3) => b3.findImplementation?.(f3, probeSymbolName) ?? Promise.resolve(null)
|
|
27779
27781
|
}];
|
|
27780
|
-
const probeOp = async (fn, label, probes) => {
|
|
27782
|
+
const probeOp = async (fn, label, probes, timeout = OP_TIMEOUT) => {
|
|
27781
27783
|
const start2 = performance.now();
|
|
27782
27784
|
try {
|
|
27783
|
-
const result = await Promise.race([fn(), new Promise((r4) => setTimeout(() => r4("timeout"),
|
|
27785
|
+
const result = await Promise.race([fn(), new Promise((r4) => setTimeout(() => r4("timeout"), timeout))]);
|
|
27784
27786
|
const ms = Math.round(performance.now() - start2);
|
|
27785
27787
|
if (result === "timeout") {
|
|
27786
27788
|
probes.push({
|
|
27787
27789
|
operation: label,
|
|
27788
27790
|
status: "timeout",
|
|
27789
|
-
ms:
|
|
27791
|
+
ms: timeout
|
|
27790
27792
|
});
|
|
27791
27793
|
} else if (result === null || result === undefined) {
|
|
27792
27794
|
probes.push({
|
|
@@ -27878,13 +27880,43 @@ class CodeIntelligenceRouter {
|
|
|
27878
27880
|
}
|
|
27879
27881
|
}
|
|
27880
27882
|
const hasStandaloneProbe = backend.name === "lsp" && "probeStandalone" in backend && typeof backend.probeStandalone === "function";
|
|
27881
|
-
if (hasStandaloneProbe &&
|
|
27883
|
+
if (hasStandaloneProbe && !initError) {
|
|
27882
27884
|
const lsp = backend;
|
|
27885
|
+
if (!probeFile) {
|
|
27886
|
+
updateBackend("lsp:nvim", {
|
|
27887
|
+
initialized: this.initialized.has(backend.name),
|
|
27888
|
+
initMs,
|
|
27889
|
+
initError,
|
|
27890
|
+
probes: fileOps.map(({
|
|
27891
|
+
label
|
|
27892
|
+
}) => ({
|
|
27893
|
+
operation: label,
|
|
27894
|
+
status: "empty",
|
|
27895
|
+
error: "no source file found in project"
|
|
27896
|
+
}))
|
|
27897
|
+
});
|
|
27898
|
+
updateBackend("lsp:standalone", {
|
|
27899
|
+
initialized: this.initialized.has(backend.name),
|
|
27900
|
+
initError,
|
|
27901
|
+
probes: fileOps.map(({
|
|
27902
|
+
label
|
|
27903
|
+
}) => ({
|
|
27904
|
+
operation: label,
|
|
27905
|
+
status: "empty",
|
|
27906
|
+
error: "no source file found in project"
|
|
27907
|
+
}))
|
|
27908
|
+
});
|
|
27909
|
+
continue;
|
|
27910
|
+
}
|
|
27883
27911
|
if (lsp.warmupNvim) {
|
|
27884
|
-
|
|
27885
|
-
|
|
27886
|
-
|
|
27912
|
+
const nvimAvailable = lsp.isNvimAvailable?.() ?? false;
|
|
27913
|
+
if (nvimAvailable) {
|
|
27914
|
+
try {
|
|
27915
|
+
await Promise.race([lsp.warmupNvim(probeFile), new Promise((r4) => setTimeout(() => r4(false), 25000))]);
|
|
27916
|
+
} catch {}
|
|
27917
|
+
}
|
|
27887
27918
|
}
|
|
27919
|
+
const IMPL_TIMEOUT = 20000;
|
|
27888
27920
|
const nvimProbes = [];
|
|
27889
27921
|
for (const {
|
|
27890
27922
|
op,
|
|
@@ -27898,7 +27930,8 @@ class CodeIntelligenceRouter {
|
|
|
27898
27930
|
});
|
|
27899
27931
|
continue;
|
|
27900
27932
|
}
|
|
27901
|
-
|
|
27933
|
+
const t = op === "findImplementation" ? IMPL_TIMEOUT : OP_TIMEOUT;
|
|
27934
|
+
await probeOp(() => fn(backend, probeFile), label, nvimProbes, t);
|
|
27902
27935
|
}
|
|
27903
27936
|
updateBackend("lsp:nvim", {
|
|
27904
27937
|
initialized: this.initialized.has(backend.name),
|
|
@@ -27921,7 +27954,8 @@ class CodeIntelligenceRouter {
|
|
|
27921
27954
|
});
|
|
27922
27955
|
continue;
|
|
27923
27956
|
}
|
|
27924
|
-
|
|
27957
|
+
const t = op === "findImplementation" ? IMPL_TIMEOUT : OP_TIMEOUT;
|
|
27958
|
+
await probeOp(() => lsp.probeStandalone(probeFile, op), label, standaloneProbes, t);
|
|
27925
27959
|
}
|
|
27926
27960
|
updateBackend("lsp:standalone", {
|
|
27927
27961
|
initialized: true,
|
|
@@ -29567,7 +29601,7 @@ class StandaloneLspClient {
|
|
|
29567
29601
|
}
|
|
29568
29602
|
return;
|
|
29569
29603
|
}
|
|
29570
|
-
const languageId = this.config.language
|
|
29604
|
+
const languageId = LANGUAGE_ID_MAP[this.config.language] ?? this.config.language;
|
|
29571
29605
|
this.notify("textDocument/didOpen", {
|
|
29572
29606
|
textDocument: {
|
|
29573
29607
|
uri,
|
|
@@ -29937,10 +29971,40 @@ function normalizeLocations(result) {
|
|
|
29937
29971
|
}
|
|
29938
29972
|
return [result];
|
|
29939
29973
|
}
|
|
29974
|
+
var LANGUAGE_ID_MAP;
|
|
29940
29975
|
var init_standalone_client = __esm(() => {
|
|
29941
29976
|
init_errors();
|
|
29942
29977
|
init_process_tracker();
|
|
29943
29978
|
init_protocol();
|
|
29979
|
+
LANGUAGE_ID_MAP = {
|
|
29980
|
+
typescript: "typescript",
|
|
29981
|
+
javascript: "javascript",
|
|
29982
|
+
python: "python",
|
|
29983
|
+
go: "go",
|
|
29984
|
+
rust: "rust",
|
|
29985
|
+
java: "java",
|
|
29986
|
+
kotlin: "kotlin",
|
|
29987
|
+
scala: "scala",
|
|
29988
|
+
csharp: "csharp",
|
|
29989
|
+
swift: "swift",
|
|
29990
|
+
dart: "dart",
|
|
29991
|
+
elixir: "elixir",
|
|
29992
|
+
ocaml: "ocaml",
|
|
29993
|
+
lua: "lua",
|
|
29994
|
+
c: "c",
|
|
29995
|
+
cpp: "cpp",
|
|
29996
|
+
ruby: "ruby",
|
|
29997
|
+
php: "php",
|
|
29998
|
+
zig: "zig",
|
|
29999
|
+
bash: "shellscript",
|
|
30000
|
+
css: "css",
|
|
30001
|
+
html: "html",
|
|
30002
|
+
json: "json",
|
|
30003
|
+
toml: "toml",
|
|
30004
|
+
yaml: "yaml",
|
|
30005
|
+
dockerfile: "dockerfile",
|
|
30006
|
+
vue: "vue"
|
|
30007
|
+
};
|
|
29944
30008
|
});
|
|
29945
30009
|
|
|
29946
30010
|
// src/core/intelligence/backends/lsp/index.ts
|
|
@@ -29948,7 +30012,7 @@ var exports_lsp = {};
|
|
|
29948
30012
|
__export(exports_lsp, {
|
|
29949
30013
|
LspBackend: () => LspBackend
|
|
29950
30014
|
});
|
|
29951
|
-
import { existsSync as existsSync7 } from "fs";
|
|
30015
|
+
import { existsSync as existsSync7, readdirSync as readdirSync3 } from "fs";
|
|
29952
30016
|
import { readdir as readdir2, readFile as readFile4 } from "fs/promises";
|
|
29953
30017
|
import { dirname as dirname3, join as join9, resolve as resolve5 } from "path";
|
|
29954
30018
|
function getNvimBridge() {
|
|
@@ -30700,6 +30764,9 @@ class LspBackend {
|
|
|
30700
30764
|
await new Promise((r4) => setTimeout(r4, 500));
|
|
30701
30765
|
}
|
|
30702
30766
|
}
|
|
30767
|
+
isNvimAvailable() {
|
|
30768
|
+
return nvimBridge.isNvimAvailable();
|
|
30769
|
+
}
|
|
30703
30770
|
async warmupNvim(file) {
|
|
30704
30771
|
if (!nvimBridge.isNvimAvailable())
|
|
30705
30772
|
return false;
|
|
@@ -31106,8 +31173,22 @@ function findProjectRootForLanguage(file, language) {
|
|
|
31106
31173
|
return null;
|
|
31107
31174
|
let dir = dirname3(resolve5(file));
|
|
31108
31175
|
const root2 = resolve5("/");
|
|
31109
|
-
|
|
31110
|
-
|
|
31176
|
+
const MAX_DIRS = 100;
|
|
31177
|
+
let dirCount = 0;
|
|
31178
|
+
while (dir !== root2 && dirCount < MAX_DIRS) {
|
|
31179
|
+
dirCount++;
|
|
31180
|
+
const extMarkers = markers.filter((m3) => m3.startsWith(".") && !m3.includes("/"));
|
|
31181
|
+
const nameMarkers = markers.filter((m3) => !m3.startsWith(".") || m3.includes("/"));
|
|
31182
|
+
if (extMarkers.length > 0) {
|
|
31183
|
+
try {
|
|
31184
|
+
const entries = readdirSync3(dir);
|
|
31185
|
+
for (const marker of extMarkers) {
|
|
31186
|
+
if (entries.some((e) => e.endsWith(marker)))
|
|
31187
|
+
return dir;
|
|
31188
|
+
}
|
|
31189
|
+
} catch {}
|
|
31190
|
+
}
|
|
31191
|
+
for (const marker of nameMarkers) {
|
|
31111
31192
|
if (existsSync7(join9(dir, marker)))
|
|
31112
31193
|
return dir;
|
|
31113
31194
|
}
|
|
@@ -31139,15 +31220,24 @@ var init_lsp = __esm(() => {
|
|
|
31139
31220
|
return mod[prop];
|
|
31140
31221
|
}
|
|
31141
31222
|
});
|
|
31142
|
-
SUPPORTED_LANGUAGES = new Set(["typescript", "javascript", "python", "go", "rust", "lua", "c", "cpp", "ruby", "php", "zig", "bash", "css", "html", "json", "yaml", "dockerfile"]);
|
|
31223
|
+
SUPPORTED_LANGUAGES = new Set(["typescript", "javascript", "python", "go", "rust", "java", "kotlin", "scala", "csharp", "swift", "dart", "elixir", "ocaml", "lua", "c", "cpp", "ruby", "php", "zig", "bash", "css", "html", "json", "toml", "yaml", "dockerfile", "vue"]);
|
|
31143
31224
|
PROJECT_FILES = {
|
|
31144
31225
|
typescript: ["tsconfig.json"],
|
|
31145
31226
|
javascript: ["jsconfig.json", "tsconfig.json"],
|
|
31146
31227
|
python: ["pyproject.toml", "setup.py"],
|
|
31147
31228
|
go: ["go.mod"],
|
|
31148
|
-
rust: ["Cargo.toml"]
|
|
31229
|
+
rust: ["Cargo.toml"],
|
|
31230
|
+
java: ["pom.xml", "build.gradle", "build.gradle.kts", "settings.gradle", "settings.gradle.kts"],
|
|
31231
|
+
kotlin: ["build.gradle.kts", "build.gradle", "settings.gradle.kts", "settings.gradle"],
|
|
31232
|
+
scala: ["build.sbt"],
|
|
31233
|
+
csharp: [".csproj", ".sln"],
|
|
31234
|
+
dart: ["pubspec.yaml"],
|
|
31235
|
+
elixir: ["mix.exs"],
|
|
31236
|
+
ruby: ["Gemfile"],
|
|
31237
|
+
php: ["composer.json"],
|
|
31238
|
+
swift: ["Package.swift"]
|
|
31149
31239
|
};
|
|
31150
|
-
DEFINITION_KEYWORDS = /\b(function|class|const|let|var|type|interface|enum|struct|trait|fn|def|func|impl|mod|pub)\b/;
|
|
31240
|
+
DEFINITION_KEYWORDS = /\b(function|class|const|let|var|type|interface|enum|struct|trait|fn|def|func|impl|mod|pub|public|private|protected|static|void|abstract|override|sealed|record|annotation|object|fun|suspend|data|inline|operator|infix|external|companion|lateinit|val)\b/;
|
|
31151
31241
|
});
|
|
31152
31242
|
|
|
31153
31243
|
// node_modules/@ts-morph/common/dist/typescript.js
|