@massa-ai/mcp-client 1.65.0 → 1.66.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/config-cli.js +159 -46
- package/dist/index.js +159 -46
- package/package.json +3 -3
package/dist/config-cli.js
CHANGED
|
@@ -134878,14 +134878,80 @@ function indexDefinitions(definitions) {
|
|
|
134878
134878
|
});
|
|
134879
134879
|
return { registry: registry3, definitions: Object.freeze(indexed) };
|
|
134880
134880
|
}
|
|
134881
|
-
function
|
|
134882
|
-
|
|
134883
|
-
|
|
134884
|
-
|
|
134885
|
-
|
|
134886
|
-
|
|
134887
|
-
|
|
134888
|
-
|
|
134881
|
+
function buildPartition(list) {
|
|
134882
|
+
const byFqn = new Map;
|
|
134883
|
+
const byFile = new Map;
|
|
134884
|
+
const byFileQualifiedName = new Map;
|
|
134885
|
+
const byQualifiedName = new Map;
|
|
134886
|
+
for (const definition of list) {
|
|
134887
|
+
const identity = definition.identity;
|
|
134888
|
+
if (!byFqn.has(identity.fqn))
|
|
134889
|
+
byFqn.set(identity.fqn, definition);
|
|
134890
|
+
const fileBucket = byFile.get(identity.file);
|
|
134891
|
+
if (fileBucket)
|
|
134892
|
+
fileBucket.push(definition);
|
|
134893
|
+
else
|
|
134894
|
+
byFile.set(identity.file, [definition]);
|
|
134895
|
+
const fileQualifiedNameKey = `${identity.file}\x00${identity.qualifiedName}`;
|
|
134896
|
+
const fileQualifiedNameBucket = byFileQualifiedName.get(fileQualifiedNameKey);
|
|
134897
|
+
if (fileQualifiedNameBucket)
|
|
134898
|
+
fileQualifiedNameBucket.push(definition);
|
|
134899
|
+
else
|
|
134900
|
+
byFileQualifiedName.set(fileQualifiedNameKey, [definition]);
|
|
134901
|
+
const qualifiedNameBucket = byQualifiedName.get(identity.qualifiedName);
|
|
134902
|
+
if (qualifiedNameBucket)
|
|
134903
|
+
qualifiedNameBucket.push(definition);
|
|
134904
|
+
else
|
|
134905
|
+
byQualifiedName.set(identity.qualifiedName, [definition]);
|
|
134906
|
+
}
|
|
134907
|
+
return { list, byFqn, byFile, byFileQualifiedName, byQualifiedName };
|
|
134908
|
+
}
|
|
134909
|
+
function buildScopedIndex(rawDefinitions, familyOnly) {
|
|
134910
|
+
const scoped = familyOnly ? rawDefinitions.filter((definition) => FAMILY_DIALECTS.has(definition.identity.dialect)) : rawDefinitions;
|
|
134911
|
+
const { registry: registry3, definitions: all } = indexDefinitions(scoped);
|
|
134912
|
+
const typeRefs = [];
|
|
134913
|
+
const calls = [];
|
|
134914
|
+
for (const definition of all) {
|
|
134915
|
+
if (TYPE_REF_KINDS.has(definition.identity.kind))
|
|
134916
|
+
typeRefs.push(definition);
|
|
134917
|
+
if (CALL_KINDS.has(definition.identity.kind))
|
|
134918
|
+
calls.push(definition);
|
|
134919
|
+
}
|
|
134920
|
+
return { registry: registry3, typeRefs: buildPartition(typeRefs), calls: buildPartition(calls), all: buildPartition(all) };
|
|
134921
|
+
}
|
|
134922
|
+
function definitionIndex(rawDefinitions, familyOnly) {
|
|
134923
|
+
let byScope = RESOLVE_INDEX_CACHE.get(rawDefinitions);
|
|
134924
|
+
if (!byScope) {
|
|
134925
|
+
byScope = new Map;
|
|
134926
|
+
RESOLVE_INDEX_CACHE.set(rawDefinitions, byScope);
|
|
134927
|
+
}
|
|
134928
|
+
const existing = byScope.get(familyOnly);
|
|
134929
|
+
if (existing)
|
|
134930
|
+
return existing;
|
|
134931
|
+
const built = buildScopedIndex(rawDefinitions, familyOnly);
|
|
134932
|
+
byScope.set(familyOnly, built);
|
|
134933
|
+
return built;
|
|
134934
|
+
}
|
|
134935
|
+
function cachedDialectScope(definitions, dialectKey, predicate) {
|
|
134936
|
+
let byKey = DIALECT_SCOPE_CACHE.get(definitions);
|
|
134937
|
+
if (!byKey) {
|
|
134938
|
+
byKey = new Map;
|
|
134939
|
+
DIALECT_SCOPE_CACHE.set(definitions, byKey);
|
|
134940
|
+
}
|
|
134941
|
+
const existing = byKey.get(dialectKey);
|
|
134942
|
+
if (existing)
|
|
134943
|
+
return existing;
|
|
134944
|
+
const scoped = definitions.filter((definition) => predicate(definition));
|
|
134945
|
+
byKey.set(dialectKey, scoped);
|
|
134946
|
+
return scoped;
|
|
134947
|
+
}
|
|
134948
|
+
function normalizedKnownFiles(knownFiles) {
|
|
134949
|
+
const existing = KNOWN_FILES_CACHE.get(knownFiles);
|
|
134950
|
+
if (existing)
|
|
134951
|
+
return existing;
|
|
134952
|
+
const built = new Set(knownFiles.map(normalizeStructuralFile));
|
|
134953
|
+
KNOWN_FILES_CACHE.set(knownFiles, built);
|
|
134954
|
+
return built;
|
|
134889
134955
|
}
|
|
134890
134956
|
function probe(base, known, dialect = "typescript") {
|
|
134891
134957
|
const bases = /\.[cm]?jsx?$/u.test(base) ? [base.replace(/\.[cm]?jsx?$/u, ".ts"), base.replace(/\.[cm]?jsx?$/u, ".tsx"), base] : [base];
|
|
@@ -134898,7 +134964,7 @@ function probe(base, known, dialect = "typescript") {
|
|
|
134898
134964
|
return;
|
|
134899
134965
|
}
|
|
134900
134966
|
function resolveStructuralSpecifier(specifier, fromFile, build, dialect = "typescript") {
|
|
134901
|
-
const known =
|
|
134967
|
+
const known = normalizedKnownFiles(build.knownFiles);
|
|
134902
134968
|
if (specifier.startsWith("./") || specifier.startsWith("../")) {
|
|
134903
134969
|
return probe(path28.posix.join(path28.posix.dirname(fromFile), specifier), known, dialect);
|
|
134904
134970
|
}
|
|
@@ -134935,12 +135001,12 @@ function matchesStructuralPathAlias(specifier, aliases) {
|
|
|
134935
135001
|
return specifier.startsWith(prefix) && specifier.endsWith(suffix) && specifier.length >= prefix.length + suffix.length;
|
|
134936
135002
|
});
|
|
134937
135003
|
}
|
|
134938
|
-
function exportedMatches(file2, sought, defaultOnly,
|
|
135004
|
+
function exportedMatches(file2, sought, defaultOnly, partition, build, visited = new Set) {
|
|
134939
135005
|
const key = `${file2}\x00${sought}\x00${defaultOnly}`;
|
|
134940
135006
|
if (visited.has(key))
|
|
134941
135007
|
return [];
|
|
134942
135008
|
visited.add(key);
|
|
134943
|
-
const direct =
|
|
135009
|
+
const direct = (partition.byFile.get(file2) ?? []).filter((definition) => definition.exported && (defaultOnly ? definition.defaultExport : definition.identity.qualifiedName === sought));
|
|
134944
135010
|
const concrete = direct.filter((definition) => definition.identity.kind !== "export");
|
|
134945
135011
|
if (concrete.length > 0) {
|
|
134946
135012
|
if (!defaultOnly)
|
|
@@ -134958,7 +135024,7 @@ function exportedMatches(file2, sought, defaultOnly, definitions, build, visited
|
|
|
134958
135024
|
for (const binding of reexport.bindings) {
|
|
134959
135025
|
if (binding.local !== sought && binding.imported !== "*")
|
|
134960
135026
|
continue;
|
|
134961
|
-
forwarded.push(...exportedMatches(targetFile, binding.imported === "*" ? sought : binding.imported, defaultOnly || binding.imported === "default",
|
|
135027
|
+
forwarded.push(...exportedMatches(targetFile, binding.imported === "*" ? sought : binding.imported, defaultOnly || binding.imported === "default", partition, build, visited));
|
|
134962
135028
|
}
|
|
134963
135029
|
}
|
|
134964
135030
|
if (forwarded.length > 0)
|
|
@@ -134968,7 +135034,7 @@ function exportedMatches(file2, sought, defaultOnly, definitions, build, visited
|
|
|
134968
135034
|
const namedDefault = direct.filter((definition) => definition.identity.name !== "default");
|
|
134969
135035
|
return namedDefault.length > 0 ? namedDefault : direct;
|
|
134970
135036
|
}
|
|
134971
|
-
function importedMatches(file2, reference,
|
|
135037
|
+
function importedMatches(file2, reference, partition, build) {
|
|
134972
135038
|
const matches = [];
|
|
134973
135039
|
let claimed = false;
|
|
134974
135040
|
for (const imported of file2.imports) {
|
|
@@ -135010,31 +135076,30 @@ function importedMatches(file2, reference, definitions, build) {
|
|
|
135010
135076
|
}
|
|
135011
135077
|
if ((imported.typeOnly || binding.typeOnly) && !typeEdge)
|
|
135012
135078
|
continue;
|
|
135013
|
-
const importedFile = resolveStructuralSpecifier(imported.specifier, file2.file, build, file2.dialect) ?? (["python_import", "ruby_require", "php_use", "lua_require", "c_include", "cpp_include", "go_import", "rust_use", "zig_import", "java_import", "java_static_import", "kotlin_import", "scala_import", "dart_import", "elixir_alias", "elixir_import", "elixir_require", "elixir_use", "erlang_import", "clojure_require", "clojure_import", "ocaml_open", "ocaml_include", "ocaml_module_alias", "haskell_import"].includes(imported.form) ? probe(imported.specifier.replace(/^\.\//u, ""),
|
|
135079
|
+
const importedFile = resolveStructuralSpecifier(imported.specifier, file2.file, build, file2.dialect) ?? (["python_import", "ruby_require", "php_use", "lua_require", "c_include", "cpp_include", "go_import", "rust_use", "zig_import", "java_import", "java_static_import", "kotlin_import", "scala_import", "dart_import", "elixir_alias", "elixir_import", "elixir_require", "elixir_use", "erlang_import", "clojure_require", "clojure_import", "ocaml_open", "ocaml_include", "ocaml_module_alias", "haskell_import"].includes(imported.form) ? probe(imported.specifier.replace(/^\.\//u, ""), normalizedKnownFiles(build.knownFiles), file2.dialect) : undefined);
|
|
135014
135080
|
if (!importedFile)
|
|
135015
135081
|
continue;
|
|
135016
135082
|
const esmDefaultMember = imported.form === "esm_import" && binding.imported === "default" && qualifier[0] === binding.local;
|
|
135017
135083
|
if (esmDefaultMember && sought !== undefined) {
|
|
135018
|
-
const owners = exportedMatches(importedFile, "default", true,
|
|
135084
|
+
const owners = exportedMatches(importedFile, "default", true, partition, build);
|
|
135019
135085
|
for (const owner of owners) {
|
|
135020
135086
|
const ownerMember = `${owner.identity.qualifiedName}.${sought}`;
|
|
135021
|
-
matches.push(...
|
|
135087
|
+
matches.push(...(partition.byFileQualifiedName.get(`${owner.identity.file}\x00${ownerMember}`) ?? []).filter((definition) => definition.exported));
|
|
135022
135088
|
}
|
|
135023
135089
|
continue;
|
|
135024
135090
|
}
|
|
135025
135091
|
if (defaultOnly)
|
|
135026
|
-
matches.push(...exportedMatches(importedFile, "default", true,
|
|
135092
|
+
matches.push(...exportedMatches(importedFile, "default", true, partition, build));
|
|
135027
135093
|
else if (sought !== undefined)
|
|
135028
|
-
matches.push(...exportedMatches(importedFile, sought, false,
|
|
135094
|
+
matches.push(...exportedMatches(importedFile, sought, false, partition, build).filter((definition) => binding.arity === undefined || definition.arity === binding.arity));
|
|
135029
135095
|
}
|
|
135030
135096
|
}
|
|
135031
135097
|
return { matches, claimed };
|
|
135032
135098
|
}
|
|
135033
|
-
function sameFileMatches(file2, reference,
|
|
135034
|
-
const local = definitions.filter((definition) => definition.identity.file === file2);
|
|
135099
|
+
function sameFileMatches(file2, reference, partition) {
|
|
135035
135100
|
if (reference.qualifier && reference.qualifier !== "this") {
|
|
135036
135101
|
const exact = `${reference.qualifier}.${reference.name}`;
|
|
135037
|
-
return
|
|
135102
|
+
return partition.byFileQualifiedName.get(`${file2}\x00${exact}`) ?? [];
|
|
135038
135103
|
}
|
|
135039
135104
|
const lexical = reference.lexicalScope?.split(".").filter(Boolean) ?? [];
|
|
135040
135105
|
if (lexical.length > 0)
|
|
@@ -135042,7 +135107,7 @@ function sameFileMatches(file2, reference, definitions) {
|
|
|
135042
135107
|
for (let length = lexical.length;length >= 0; length -= 1) {
|
|
135043
135108
|
const prefix = lexical.slice(0, length).join(".");
|
|
135044
135109
|
const exact = prefix ? `${prefix}.${reference.name}` : reference.name;
|
|
135045
|
-
const matches =
|
|
135110
|
+
const matches = partition.byFileQualifiedName.get(`${file2}\x00${exact}`) ?? [];
|
|
135046
135111
|
if (matches.length > 0)
|
|
135047
135112
|
return matches;
|
|
135048
135113
|
if (reference.qualifier === "this")
|
|
@@ -135050,7 +135115,7 @@ function sameFileMatches(file2, reference, definitions) {
|
|
|
135050
135115
|
}
|
|
135051
135116
|
return [];
|
|
135052
135117
|
}
|
|
135053
|
-
var TYPESCRIPT_RESOLVER_VERSION = "1.0.0", DIALECT_PROBES, REQUIRE_IMPORT_FORMS, TYPESCRIPT_LANGUAGE_RESOLVER;
|
|
135118
|
+
var TYPESCRIPT_RESOLVER_VERSION = "1.0.0", DIALECT_PROBES, TYPE_REF_KINDS, CALL_KINDS, FAMILY_DIALECTS, REFERENCE_PARTITION, EMPTY_PARTITION, RESOLVE_INDEX_CACHE, DIALECT_SCOPE_CACHE, KNOWN_FILES_CACHE, REQUIRE_IMPORT_FORMS, TYPESCRIPT_LANGUAGE_RESOLVER;
|
|
135054
135119
|
var init_typescript2 = __esm(() => {
|
|
135055
135120
|
init_fqn_codec();
|
|
135056
135121
|
DIALECT_PROBES = Object.freeze({
|
|
@@ -135085,6 +135150,27 @@ var init_typescript2 = __esm(() => {
|
|
|
135085
135150
|
ocaml: ["", ".ml"],
|
|
135086
135151
|
haskell: ["", ".hs"]
|
|
135087
135152
|
});
|
|
135153
|
+
TYPE_REF_KINDS = new Set(["class", "interface", "trait", "enum", "type", "type_parameter"]);
|
|
135154
|
+
CALL_KINDS = new Set(["function", "method", "constructor", "class", "field", "variable", "constant", "export"]);
|
|
135155
|
+
FAMILY_DIALECTS = new Set(["typescript", "tsx", "javascript", "jsx", "sfc"]);
|
|
135156
|
+
REFERENCE_PARTITION = Object.freeze({
|
|
135157
|
+
type_ref: "typeRefs",
|
|
135158
|
+
extend: "typeRefs",
|
|
135159
|
+
implement: "typeRefs",
|
|
135160
|
+
call: "calls",
|
|
135161
|
+
data_flow: "calls",
|
|
135162
|
+
http_call: "calls"
|
|
135163
|
+
});
|
|
135164
|
+
EMPTY_PARTITION = Object.freeze({
|
|
135165
|
+
list: Object.freeze([]),
|
|
135166
|
+
byFqn: new Map,
|
|
135167
|
+
byFile: new Map,
|
|
135168
|
+
byFileQualifiedName: new Map,
|
|
135169
|
+
byQualifiedName: new Map
|
|
135170
|
+
});
|
|
135171
|
+
RESOLVE_INDEX_CACHE = new WeakMap;
|
|
135172
|
+
DIALECT_SCOPE_CACHE = new WeakMap;
|
|
135173
|
+
KNOWN_FILES_CACHE = new WeakMap;
|
|
135088
135174
|
REQUIRE_IMPORT_FORMS = new Set(["commonjs_require", "dynamic_import", "ruby_require", "lua_require"]);
|
|
135089
135175
|
TYPESCRIPT_LANGUAGE_RESOLVER = Object.freeze({
|
|
135090
135176
|
version: TYPESCRIPT_RESOLVER_VERSION,
|
|
@@ -135092,21 +135178,19 @@ var init_typescript2 = __esm(() => {
|
|
|
135092
135178
|
resolve(file2, rawReference, rawDefinitions, build) {
|
|
135093
135179
|
const normalizedFile = normalizeStructuralFile(file2.file);
|
|
135094
135180
|
const reference = normalizedReference(rawReference);
|
|
135095
|
-
const
|
|
135096
|
-
const
|
|
135097
|
-
const { registry: registry3, definitions: allDefinitions } = indexDefinitions(scopedDefinitions);
|
|
135098
|
-
const definitions = allDefinitions.filter((definition) => candidateKind(reference, definition));
|
|
135181
|
+
const index = definitionIndex(rawDefinitions, FAMILY_DIALECTS.has(file2.dialect));
|
|
135182
|
+
const partition = reference.kind && REFERENCE_PARTITION[reference.kind] ? index[REFERENCE_PARTITION[reference.kind]] : EMPTY_PARTITION;
|
|
135099
135183
|
if (reference.existingFqn) {
|
|
135100
|
-
const prepared =
|
|
135101
|
-
const exact = prepared ? { found: true, identity: prepared } :
|
|
135184
|
+
const prepared = partition.byFqn.get(reference.existingFqn)?.identity;
|
|
135185
|
+
const exact = prepared ? { found: true, identity: prepared } : index.registry.resolveModern(reference.existingFqn);
|
|
135102
135186
|
return exact.found ? Object.freeze({ status: "resolved", fqn: exact.identity.fqn, identity: exact.identity, source: "exact" }) : Object.freeze({ status: "unresolved", name: reference.existingFqn });
|
|
135103
135187
|
}
|
|
135104
135188
|
const soughtQualified = reference.qualifier ? `${reference.qualifier}.${reference.name}` : reference.name;
|
|
135105
|
-
const local = sameFileMatches(normalizedFile, reference,
|
|
135189
|
+
const local = sameFileMatches(normalizedFile, reference, partition);
|
|
135106
135190
|
const localOutcome = outcome(reference, local, "same_file");
|
|
135107
135191
|
if (localOutcome)
|
|
135108
135192
|
return localOutcome;
|
|
135109
|
-
const imported = importedMatches({ ...file2, file: normalizedFile }, reference,
|
|
135193
|
+
const imported = importedMatches({ ...file2, file: normalizedFile }, reference, partition, build);
|
|
135110
135194
|
const importOutcome = outcome(reference, imported.matches, "import");
|
|
135111
135195
|
if (importOutcome)
|
|
135112
135196
|
return importOutcome;
|
|
@@ -135116,16 +135200,16 @@ var init_typescript2 = __esm(() => {
|
|
|
135116
135200
|
name: reference.name,
|
|
135117
135201
|
...reference.qualifier ? { qualifier: reference.qualifier } : {}
|
|
135118
135202
|
});
|
|
135119
|
-
const
|
|
135120
|
-
return outcome(reference,
|
|
135203
|
+
const globalBucket = reference.qualifier ? (partition.byQualifiedName.get(soughtQualified) ?? []).filter((definition) => definition.exported) : (partition.byQualifiedName.get(reference.name) ?? []).filter((definition) => definition.exported && definition.identity.qualifiedName === definition.identity.name);
|
|
135204
|
+
return outcome(reference, globalBucket, "global") ?? Object.freeze({
|
|
135121
135205
|
status: "unresolved",
|
|
135122
135206
|
name: reference.name,
|
|
135123
135207
|
...reference.qualifier ? { qualifier: reference.qualifier } : {}
|
|
135124
135208
|
});
|
|
135125
135209
|
},
|
|
135126
135210
|
resolveLegacy(legacyFqn, rawDefinitions) {
|
|
135127
|
-
const { registry: registry3,
|
|
135128
|
-
const materialized =
|
|
135211
|
+
const { registry: registry3, all } = definitionIndex(rawDefinitions, false);
|
|
135212
|
+
const materialized = all.list.filter((definition) => definition.identity.legacyFqn === legacyFqn);
|
|
135129
135213
|
const materializedOutcome = outcome({ kind: "call", span: { startByte: 0, endByte: 0, start: { row: 0, column: 0 }, end: { row: 0, column: 0 } }, name: legacyFqn }, materialized, "legacy");
|
|
135130
135214
|
if (materializedOutcome)
|
|
135131
135215
|
return materializedOutcome;
|
|
@@ -135158,7 +135242,7 @@ var init_scripting2 = __esm(() => {
|
|
|
135158
135242
|
...TYPESCRIPT_LANGUAGE_RESOLVER,
|
|
135159
135243
|
dialects: Object.freeze(["python", "ruby", "php", "lua-luajit"]),
|
|
135160
135244
|
resolve(file2, reference, definitions, build) {
|
|
135161
|
-
return TYPESCRIPT_LANGUAGE_RESOLVER.resolve(file2, reference, definitions.
|
|
135245
|
+
return TYPESCRIPT_LANGUAGE_RESOLVER.resolve(file2, reference, cachedDialectScope(definitions, file2.dialect, (definition) => definition.identity.dialect === file2.dialect), build);
|
|
135162
135246
|
}
|
|
135163
135247
|
});
|
|
135164
135248
|
});
|
|
@@ -135174,6 +135258,7 @@ var init_systems2 = __esm(() => {
|
|
|
135174
135258
|
dialects: DIALECTS,
|
|
135175
135259
|
resolve(file2, reference, definitions, build) {
|
|
135176
135260
|
const compatible = file2.dialect === "header-default-c" ? ["c", "header-default-c"] : file2.dialect === "header-cpp" || file2.dialect === "header" ? ["cpp", "header", "header-cpp"] : [file2.dialect];
|
|
135261
|
+
const compatibleKey = compatible.join(",");
|
|
135177
135262
|
const unresolvedTarget = reference.target.status === "unresolved" ? reference.target : undefined;
|
|
135178
135263
|
const resolverFile = file2.dialect === "rust" ? {
|
|
135179
135264
|
...file2,
|
|
@@ -135192,7 +135277,7 @@ var init_systems2 = __esm(() => {
|
|
|
135192
135277
|
return { ...item, bindings };
|
|
135193
135278
|
})
|
|
135194
135279
|
} : file2;
|
|
135195
|
-
return TYPESCRIPT_LANGUAGE_RESOLVER.resolve(resolverFile, reference, definitions
|
|
135280
|
+
return TYPESCRIPT_LANGUAGE_RESOLVER.resolve(resolverFile, reference, cachedDialectScope(definitions, compatibleKey, (item) => compatible.includes(item.identity.dialect)), build);
|
|
135196
135281
|
}
|
|
135197
135282
|
});
|
|
135198
135283
|
});
|
|
@@ -135237,7 +135322,7 @@ var init_managed2 = __esm(() => {
|
|
|
135237
135322
|
return imported;
|
|
135238
135323
|
return { ...imported, bindings: imported.bindings.map((binding) => binding.imported === "*" && binding.local === "*" ? { ...binding, imported: unresolved2.name, local: unresolved2.name } : binding) };
|
|
135239
135324
|
}) } : file2;
|
|
135240
|
-
return TYPESCRIPT_LANGUAGE_RESOLVER.resolve(resolverFile, reference, definitions.
|
|
135325
|
+
return TYPESCRIPT_LANGUAGE_RESOLVER.resolve(resolverFile, reference, cachedDialectScope(definitions, file2.dialect === "kotlin" || file2.dialect === "kotlin-script" ? "kotlin" : file2.dialect, (item) => file2.dialect === "kotlin" || file2.dialect === "kotlin-script" ? item.identity.dialect === "kotlin" || item.identity.dialect === "kotlin-script" : item.identity.dialect === file2.dialect), build);
|
|
135241
135326
|
}
|
|
135242
135327
|
});
|
|
135243
135328
|
});
|
|
@@ -135265,7 +135350,7 @@ var init_functional2 = __esm(() => {
|
|
|
135265
135350
|
return imported;
|
|
135266
135351
|
return { ...imported, bindings: imported.bindings.length === 0 ? [{ imported: `${owner}.${unresolved2.name}`, local: unresolved2.name, typeOnly: false }] : imported.bindings.map((binding) => binding.imported === "*" && (binding.local === "*" || imported.form === "elixir_import") ? { ...binding, imported: `${owner}.${unresolved2.name}`, local: unresolved2.name } : binding.imported.startsWith("!") ? binding : { ...binding, imported: `${owner}.${binding.imported}` }) };
|
|
135267
135352
|
}) } : file2;
|
|
135268
|
-
return TYPESCRIPT_LANGUAGE_RESOLVER.resolve(resolverFile, reference, definitions.
|
|
135353
|
+
return TYPESCRIPT_LANGUAGE_RESOLVER.resolve(resolverFile, reference, cachedDialectScope(definitions, file2.dialect === "elixir" || file2.dialect === "elixir-script" ? "elixir" : file2.dialect, (item) => file2.dialect === "elixir" || file2.dialect === "elixir-script" ? item.identity.dialect === "elixir" || item.identity.dialect === "elixir-script" : item.identity.dialect === file2.dialect), build);
|
|
135269
135354
|
}
|
|
135270
135355
|
});
|
|
135271
135356
|
});
|
|
@@ -135283,6 +135368,14 @@ var init_data_document2 = __esm(() => {
|
|
|
135283
135368
|
// ../../packages/core/dist/services/etl/stages/resolve.js
|
|
135284
135369
|
import path30 from "path";
|
|
135285
135370
|
import fs21 from "fs";
|
|
135371
|
+
function knownRelPathsList(knownRelPaths) {
|
|
135372
|
+
const existing = KNOWN_REL_PATHS_LISTS.get(knownRelPaths);
|
|
135373
|
+
if (existing)
|
|
135374
|
+
return existing;
|
|
135375
|
+
const built = Object.freeze([...knownRelPaths]);
|
|
135376
|
+
KNOWN_REL_PATHS_LISTS.set(knownRelPaths, built);
|
|
135377
|
+
return built;
|
|
135378
|
+
}
|
|
135286
135379
|
|
|
135287
135380
|
class ResolveStage {
|
|
135288
135381
|
symbolRepository;
|
|
@@ -135366,7 +135459,7 @@ class ResolveStage {
|
|
|
135366
135459
|
resolveStructuralFile(parsed, session2, knownRelPaths, rootAliases, monorepoPackages) {
|
|
135367
135460
|
const filePath = parsed.file.relativePath;
|
|
135368
135461
|
const structuralAliases = this.structuralAliasesFor(filePath, rootAliases, monorepoPackages);
|
|
135369
|
-
const build = { knownFiles:
|
|
135462
|
+
const build = { knownFiles: knownRelPathsList(knownRelPaths), pathAliasesByFile: { [filePath]: structuralAliases } };
|
|
135370
135463
|
const resolvedImports = parsed.rawImports.map((raw2) => {
|
|
135371
135464
|
const resolvedPath = resolveStructuralSpecifier(raw2.specifier, filePath, build) ?? null;
|
|
135372
135465
|
return {
|
|
@@ -135666,7 +135759,7 @@ class ResolveStage {
|
|
|
135666
135759
|
}));
|
|
135667
135760
|
}
|
|
135668
135761
|
}
|
|
135669
|
-
var TS_EXTENSIONS, STRUCTURAL_SEED_EXTENSIONS;
|
|
135762
|
+
var KNOWN_REL_PATHS_LISTS, TS_EXTENSIONS, STRUCTURAL_SEED_EXTENSIONS;
|
|
135670
135763
|
var init_resolve = __esm(() => {
|
|
135671
135764
|
init_dist();
|
|
135672
135765
|
init_symbol_repository_factory();
|
|
@@ -135680,14 +135773,28 @@ var init_resolve = __esm(() => {
|
|
|
135680
135773
|
init_fqn_codec();
|
|
135681
135774
|
init_language_manifest();
|
|
135682
135775
|
init_types3();
|
|
135776
|
+
KNOWN_REL_PATHS_LISTS = new WeakMap;
|
|
135683
135777
|
TS_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx", "/index.ts", "/index.js"];
|
|
135684
135778
|
STRUCTURAL_SEED_EXTENSIONS = new Set([".ts", ".tsx", ".js", ".jsx", ".py", ".rb", ".php", ".lua", ".c", ".h", ".cpp", ".hpp", ".go", ".rs", ".zig", ".java", ".kt", ".kts", ".scala", ".cs", ".swift", ".dart", ".ex", ".exs", ".erl", ".clj", ".ml", ".hs", ".vue", ".md", ".json", ".yaml", ".yml"]);
|
|
135685
135779
|
});
|
|
135686
135780
|
|
|
135687
135781
|
// ../../packages/core/dist/data/with-deadlock-retry.js
|
|
135782
|
+
function isConnectionPoolAcquisitionError(error51) {
|
|
135783
|
+
if (!error51 || typeof error51 !== "object")
|
|
135784
|
+
return false;
|
|
135785
|
+
const code = error51.code;
|
|
135786
|
+
if (code === "P2024")
|
|
135787
|
+
return true;
|
|
135788
|
+
const message = error51.message;
|
|
135789
|
+
if (typeof message !== "string")
|
|
135790
|
+
return false;
|
|
135791
|
+
return message.includes("Unable to start a transaction in the given time") || message.includes("Timed out fetching a new connection from the connection pool");
|
|
135792
|
+
}
|
|
135688
135793
|
function isRetriableTransactionError(error51) {
|
|
135689
135794
|
if (!error51 || typeof error51 !== "object")
|
|
135690
135795
|
return false;
|
|
135796
|
+
if (isConnectionPoolAcquisitionError(error51))
|
|
135797
|
+
return true;
|
|
135691
135798
|
const code = error51.code;
|
|
135692
135799
|
if (typeof code === "string" && RETRIABLE_SQLSTATES.has(code))
|
|
135693
135800
|
return true;
|
|
@@ -135700,17 +135807,23 @@ function isRetriableTransactionError(error51) {
|
|
|
135700
135807
|
async function withDeadlockRetry(operation, options = {}) {
|
|
135701
135808
|
const maxAttempts = options.maxAttempts ?? 5;
|
|
135702
135809
|
const baseDelayMs = options.baseDelayMs ?? 75;
|
|
135703
|
-
|
|
135810
|
+
const connectionDelayMs = options.connectionDelayMs ?? 30000;
|
|
135811
|
+
const loopBound = Math.max(maxAttempts, 10);
|
|
135812
|
+
for (let attempt = 1;attempt <= loopBound; attempt++) {
|
|
135704
135813
|
try {
|
|
135705
135814
|
return await operation();
|
|
135706
135815
|
} catch (error51) {
|
|
135707
|
-
if (!isRetriableTransactionError(error51)
|
|
135816
|
+
if (!isRetriableTransactionError(error51))
|
|
135817
|
+
throw error51;
|
|
135818
|
+
const isConn = isConnectionPoolAcquisitionError(error51);
|
|
135819
|
+
const effectiveMax = isConn ? Math.max(maxAttempts, 10) : maxAttempts;
|
|
135820
|
+
if (attempt >= effectiveMax)
|
|
135708
135821
|
throw error51;
|
|
135709
|
-
const delayMs = baseDelayMs * 2 ** (attempt - 1);
|
|
135710
|
-
logger.warn("Retriable DB
|
|
135822
|
+
const delayMs = isConn ? connectionDelayMs * attempt : baseDelayMs * 2 ** (attempt - 1);
|
|
135823
|
+
logger.warn("Retriable DB failure; retrying operation", {
|
|
135711
135824
|
operation: options.operation ?? "unknown",
|
|
135712
135825
|
attempt,
|
|
135713
|
-
maxAttempts,
|
|
135826
|
+
maxAttempts: effectiveMax,
|
|
135714
135827
|
delayMs,
|
|
135715
135828
|
error: error51
|
|
135716
135829
|
});
|
package/dist/index.js
CHANGED
|
@@ -130028,14 +130028,80 @@ function indexDefinitions(definitions) {
|
|
|
130028
130028
|
});
|
|
130029
130029
|
return { registry: registry3, definitions: Object.freeze(indexed) };
|
|
130030
130030
|
}
|
|
130031
|
-
function
|
|
130032
|
-
|
|
130033
|
-
|
|
130034
|
-
|
|
130035
|
-
|
|
130036
|
-
|
|
130037
|
-
|
|
130038
|
-
|
|
130031
|
+
function buildPartition(list) {
|
|
130032
|
+
const byFqn = new Map;
|
|
130033
|
+
const byFile = new Map;
|
|
130034
|
+
const byFileQualifiedName = new Map;
|
|
130035
|
+
const byQualifiedName = new Map;
|
|
130036
|
+
for (const definition of list) {
|
|
130037
|
+
const identity = definition.identity;
|
|
130038
|
+
if (!byFqn.has(identity.fqn))
|
|
130039
|
+
byFqn.set(identity.fqn, definition);
|
|
130040
|
+
const fileBucket = byFile.get(identity.file);
|
|
130041
|
+
if (fileBucket)
|
|
130042
|
+
fileBucket.push(definition);
|
|
130043
|
+
else
|
|
130044
|
+
byFile.set(identity.file, [definition]);
|
|
130045
|
+
const fileQualifiedNameKey = `${identity.file}\x00${identity.qualifiedName}`;
|
|
130046
|
+
const fileQualifiedNameBucket = byFileQualifiedName.get(fileQualifiedNameKey);
|
|
130047
|
+
if (fileQualifiedNameBucket)
|
|
130048
|
+
fileQualifiedNameBucket.push(definition);
|
|
130049
|
+
else
|
|
130050
|
+
byFileQualifiedName.set(fileQualifiedNameKey, [definition]);
|
|
130051
|
+
const qualifiedNameBucket = byQualifiedName.get(identity.qualifiedName);
|
|
130052
|
+
if (qualifiedNameBucket)
|
|
130053
|
+
qualifiedNameBucket.push(definition);
|
|
130054
|
+
else
|
|
130055
|
+
byQualifiedName.set(identity.qualifiedName, [definition]);
|
|
130056
|
+
}
|
|
130057
|
+
return { list, byFqn, byFile, byFileQualifiedName, byQualifiedName };
|
|
130058
|
+
}
|
|
130059
|
+
function buildScopedIndex(rawDefinitions, familyOnly) {
|
|
130060
|
+
const scoped = familyOnly ? rawDefinitions.filter((definition) => FAMILY_DIALECTS.has(definition.identity.dialect)) : rawDefinitions;
|
|
130061
|
+
const { registry: registry3, definitions: all } = indexDefinitions(scoped);
|
|
130062
|
+
const typeRefs = [];
|
|
130063
|
+
const calls = [];
|
|
130064
|
+
for (const definition of all) {
|
|
130065
|
+
if (TYPE_REF_KINDS.has(definition.identity.kind))
|
|
130066
|
+
typeRefs.push(definition);
|
|
130067
|
+
if (CALL_KINDS.has(definition.identity.kind))
|
|
130068
|
+
calls.push(definition);
|
|
130069
|
+
}
|
|
130070
|
+
return { registry: registry3, typeRefs: buildPartition(typeRefs), calls: buildPartition(calls), all: buildPartition(all) };
|
|
130071
|
+
}
|
|
130072
|
+
function definitionIndex(rawDefinitions, familyOnly) {
|
|
130073
|
+
let byScope = RESOLVE_INDEX_CACHE.get(rawDefinitions);
|
|
130074
|
+
if (!byScope) {
|
|
130075
|
+
byScope = new Map;
|
|
130076
|
+
RESOLVE_INDEX_CACHE.set(rawDefinitions, byScope);
|
|
130077
|
+
}
|
|
130078
|
+
const existing = byScope.get(familyOnly);
|
|
130079
|
+
if (existing)
|
|
130080
|
+
return existing;
|
|
130081
|
+
const built = buildScopedIndex(rawDefinitions, familyOnly);
|
|
130082
|
+
byScope.set(familyOnly, built);
|
|
130083
|
+
return built;
|
|
130084
|
+
}
|
|
130085
|
+
function cachedDialectScope(definitions, dialectKey, predicate) {
|
|
130086
|
+
let byKey = DIALECT_SCOPE_CACHE.get(definitions);
|
|
130087
|
+
if (!byKey) {
|
|
130088
|
+
byKey = new Map;
|
|
130089
|
+
DIALECT_SCOPE_CACHE.set(definitions, byKey);
|
|
130090
|
+
}
|
|
130091
|
+
const existing = byKey.get(dialectKey);
|
|
130092
|
+
if (existing)
|
|
130093
|
+
return existing;
|
|
130094
|
+
const scoped = definitions.filter((definition) => predicate(definition));
|
|
130095
|
+
byKey.set(dialectKey, scoped);
|
|
130096
|
+
return scoped;
|
|
130097
|
+
}
|
|
130098
|
+
function normalizedKnownFiles(knownFiles) {
|
|
130099
|
+
const existing = KNOWN_FILES_CACHE.get(knownFiles);
|
|
130100
|
+
if (existing)
|
|
130101
|
+
return existing;
|
|
130102
|
+
const built = new Set(knownFiles.map(normalizeStructuralFile));
|
|
130103
|
+
KNOWN_FILES_CACHE.set(knownFiles, built);
|
|
130104
|
+
return built;
|
|
130039
130105
|
}
|
|
130040
130106
|
function probe(base, known, dialect = "typescript") {
|
|
130041
130107
|
const bases = /\.[cm]?jsx?$/u.test(base) ? [base.replace(/\.[cm]?jsx?$/u, ".ts"), base.replace(/\.[cm]?jsx?$/u, ".tsx"), base] : [base];
|
|
@@ -130048,7 +130114,7 @@ function probe(base, known, dialect = "typescript") {
|
|
|
130048
130114
|
return;
|
|
130049
130115
|
}
|
|
130050
130116
|
function resolveStructuralSpecifier(specifier, fromFile, build, dialect = "typescript") {
|
|
130051
|
-
const known =
|
|
130117
|
+
const known = normalizedKnownFiles(build.knownFiles);
|
|
130052
130118
|
if (specifier.startsWith("./") || specifier.startsWith("../")) {
|
|
130053
130119
|
return probe(path25.posix.join(path25.posix.dirname(fromFile), specifier), known, dialect);
|
|
130054
130120
|
}
|
|
@@ -130085,12 +130151,12 @@ function matchesStructuralPathAlias(specifier, aliases) {
|
|
|
130085
130151
|
return specifier.startsWith(prefix) && specifier.endsWith(suffix) && specifier.length >= prefix.length + suffix.length;
|
|
130086
130152
|
});
|
|
130087
130153
|
}
|
|
130088
|
-
function exportedMatches(file2, sought, defaultOnly,
|
|
130154
|
+
function exportedMatches(file2, sought, defaultOnly, partition, build, visited = new Set) {
|
|
130089
130155
|
const key = `${file2}\x00${sought}\x00${defaultOnly}`;
|
|
130090
130156
|
if (visited.has(key))
|
|
130091
130157
|
return [];
|
|
130092
130158
|
visited.add(key);
|
|
130093
|
-
const direct =
|
|
130159
|
+
const direct = (partition.byFile.get(file2) ?? []).filter((definition) => definition.exported && (defaultOnly ? definition.defaultExport : definition.identity.qualifiedName === sought));
|
|
130094
130160
|
const concrete = direct.filter((definition) => definition.identity.kind !== "export");
|
|
130095
130161
|
if (concrete.length > 0) {
|
|
130096
130162
|
if (!defaultOnly)
|
|
@@ -130108,7 +130174,7 @@ function exportedMatches(file2, sought, defaultOnly, definitions, build, visited
|
|
|
130108
130174
|
for (const binding of reexport.bindings) {
|
|
130109
130175
|
if (binding.local !== sought && binding.imported !== "*")
|
|
130110
130176
|
continue;
|
|
130111
|
-
forwarded.push(...exportedMatches(targetFile, binding.imported === "*" ? sought : binding.imported, defaultOnly || binding.imported === "default",
|
|
130177
|
+
forwarded.push(...exportedMatches(targetFile, binding.imported === "*" ? sought : binding.imported, defaultOnly || binding.imported === "default", partition, build, visited));
|
|
130112
130178
|
}
|
|
130113
130179
|
}
|
|
130114
130180
|
if (forwarded.length > 0)
|
|
@@ -130118,7 +130184,7 @@ function exportedMatches(file2, sought, defaultOnly, definitions, build, visited
|
|
|
130118
130184
|
const namedDefault = direct.filter((definition) => definition.identity.name !== "default");
|
|
130119
130185
|
return namedDefault.length > 0 ? namedDefault : direct;
|
|
130120
130186
|
}
|
|
130121
|
-
function importedMatches(file2, reference,
|
|
130187
|
+
function importedMatches(file2, reference, partition, build) {
|
|
130122
130188
|
const matches = [];
|
|
130123
130189
|
let claimed = false;
|
|
130124
130190
|
for (const imported of file2.imports) {
|
|
@@ -130160,31 +130226,30 @@ function importedMatches(file2, reference, definitions, build) {
|
|
|
130160
130226
|
}
|
|
130161
130227
|
if ((imported.typeOnly || binding.typeOnly) && !typeEdge)
|
|
130162
130228
|
continue;
|
|
130163
|
-
const importedFile = resolveStructuralSpecifier(imported.specifier, file2.file, build, file2.dialect) ?? (["python_import", "ruby_require", "php_use", "lua_require", "c_include", "cpp_include", "go_import", "rust_use", "zig_import", "java_import", "java_static_import", "kotlin_import", "scala_import", "dart_import", "elixir_alias", "elixir_import", "elixir_require", "elixir_use", "erlang_import", "clojure_require", "clojure_import", "ocaml_open", "ocaml_include", "ocaml_module_alias", "haskell_import"].includes(imported.form) ? probe(imported.specifier.replace(/^\.\//u, ""),
|
|
130229
|
+
const importedFile = resolveStructuralSpecifier(imported.specifier, file2.file, build, file2.dialect) ?? (["python_import", "ruby_require", "php_use", "lua_require", "c_include", "cpp_include", "go_import", "rust_use", "zig_import", "java_import", "java_static_import", "kotlin_import", "scala_import", "dart_import", "elixir_alias", "elixir_import", "elixir_require", "elixir_use", "erlang_import", "clojure_require", "clojure_import", "ocaml_open", "ocaml_include", "ocaml_module_alias", "haskell_import"].includes(imported.form) ? probe(imported.specifier.replace(/^\.\//u, ""), normalizedKnownFiles(build.knownFiles), file2.dialect) : undefined);
|
|
130164
130230
|
if (!importedFile)
|
|
130165
130231
|
continue;
|
|
130166
130232
|
const esmDefaultMember = imported.form === "esm_import" && binding.imported === "default" && qualifier[0] === binding.local;
|
|
130167
130233
|
if (esmDefaultMember && sought !== undefined) {
|
|
130168
|
-
const owners = exportedMatches(importedFile, "default", true,
|
|
130234
|
+
const owners = exportedMatches(importedFile, "default", true, partition, build);
|
|
130169
130235
|
for (const owner of owners) {
|
|
130170
130236
|
const ownerMember = `${owner.identity.qualifiedName}.${sought}`;
|
|
130171
|
-
matches.push(...
|
|
130237
|
+
matches.push(...(partition.byFileQualifiedName.get(`${owner.identity.file}\x00${ownerMember}`) ?? []).filter((definition) => definition.exported));
|
|
130172
130238
|
}
|
|
130173
130239
|
continue;
|
|
130174
130240
|
}
|
|
130175
130241
|
if (defaultOnly)
|
|
130176
|
-
matches.push(...exportedMatches(importedFile, "default", true,
|
|
130242
|
+
matches.push(...exportedMatches(importedFile, "default", true, partition, build));
|
|
130177
130243
|
else if (sought !== undefined)
|
|
130178
|
-
matches.push(...exportedMatches(importedFile, sought, false,
|
|
130244
|
+
matches.push(...exportedMatches(importedFile, sought, false, partition, build).filter((definition) => binding.arity === undefined || definition.arity === binding.arity));
|
|
130179
130245
|
}
|
|
130180
130246
|
}
|
|
130181
130247
|
return { matches, claimed };
|
|
130182
130248
|
}
|
|
130183
|
-
function sameFileMatches(file2, reference,
|
|
130184
|
-
const local = definitions.filter((definition) => definition.identity.file === file2);
|
|
130249
|
+
function sameFileMatches(file2, reference, partition) {
|
|
130185
130250
|
if (reference.qualifier && reference.qualifier !== "this") {
|
|
130186
130251
|
const exact = `${reference.qualifier}.${reference.name}`;
|
|
130187
|
-
return
|
|
130252
|
+
return partition.byFileQualifiedName.get(`${file2}\x00${exact}`) ?? [];
|
|
130188
130253
|
}
|
|
130189
130254
|
const lexical = reference.lexicalScope?.split(".").filter(Boolean) ?? [];
|
|
130190
130255
|
if (lexical.length > 0)
|
|
@@ -130192,7 +130257,7 @@ function sameFileMatches(file2, reference, definitions) {
|
|
|
130192
130257
|
for (let length = lexical.length;length >= 0; length -= 1) {
|
|
130193
130258
|
const prefix = lexical.slice(0, length).join(".");
|
|
130194
130259
|
const exact = prefix ? `${prefix}.${reference.name}` : reference.name;
|
|
130195
|
-
const matches =
|
|
130260
|
+
const matches = partition.byFileQualifiedName.get(`${file2}\x00${exact}`) ?? [];
|
|
130196
130261
|
if (matches.length > 0)
|
|
130197
130262
|
return matches;
|
|
130198
130263
|
if (reference.qualifier === "this")
|
|
@@ -130200,7 +130265,7 @@ function sameFileMatches(file2, reference, definitions) {
|
|
|
130200
130265
|
}
|
|
130201
130266
|
return [];
|
|
130202
130267
|
}
|
|
130203
|
-
var TYPESCRIPT_RESOLVER_VERSION = "1.0.0", DIALECT_PROBES, REQUIRE_IMPORT_FORMS, TYPESCRIPT_LANGUAGE_RESOLVER;
|
|
130268
|
+
var TYPESCRIPT_RESOLVER_VERSION = "1.0.0", DIALECT_PROBES, TYPE_REF_KINDS, CALL_KINDS, FAMILY_DIALECTS, REFERENCE_PARTITION, EMPTY_PARTITION, RESOLVE_INDEX_CACHE, DIALECT_SCOPE_CACHE, KNOWN_FILES_CACHE, REQUIRE_IMPORT_FORMS, TYPESCRIPT_LANGUAGE_RESOLVER;
|
|
130204
130269
|
var init_typescript2 = __esm(() => {
|
|
130205
130270
|
init_fqn_codec();
|
|
130206
130271
|
DIALECT_PROBES = Object.freeze({
|
|
@@ -130235,6 +130300,27 @@ var init_typescript2 = __esm(() => {
|
|
|
130235
130300
|
ocaml: ["", ".ml"],
|
|
130236
130301
|
haskell: ["", ".hs"]
|
|
130237
130302
|
});
|
|
130303
|
+
TYPE_REF_KINDS = new Set(["class", "interface", "trait", "enum", "type", "type_parameter"]);
|
|
130304
|
+
CALL_KINDS = new Set(["function", "method", "constructor", "class", "field", "variable", "constant", "export"]);
|
|
130305
|
+
FAMILY_DIALECTS = new Set(["typescript", "tsx", "javascript", "jsx", "sfc"]);
|
|
130306
|
+
REFERENCE_PARTITION = Object.freeze({
|
|
130307
|
+
type_ref: "typeRefs",
|
|
130308
|
+
extend: "typeRefs",
|
|
130309
|
+
implement: "typeRefs",
|
|
130310
|
+
call: "calls",
|
|
130311
|
+
data_flow: "calls",
|
|
130312
|
+
http_call: "calls"
|
|
130313
|
+
});
|
|
130314
|
+
EMPTY_PARTITION = Object.freeze({
|
|
130315
|
+
list: Object.freeze([]),
|
|
130316
|
+
byFqn: new Map,
|
|
130317
|
+
byFile: new Map,
|
|
130318
|
+
byFileQualifiedName: new Map,
|
|
130319
|
+
byQualifiedName: new Map
|
|
130320
|
+
});
|
|
130321
|
+
RESOLVE_INDEX_CACHE = new WeakMap;
|
|
130322
|
+
DIALECT_SCOPE_CACHE = new WeakMap;
|
|
130323
|
+
KNOWN_FILES_CACHE = new WeakMap;
|
|
130238
130324
|
REQUIRE_IMPORT_FORMS = new Set(["commonjs_require", "dynamic_import", "ruby_require", "lua_require"]);
|
|
130239
130325
|
TYPESCRIPT_LANGUAGE_RESOLVER = Object.freeze({
|
|
130240
130326
|
version: TYPESCRIPT_RESOLVER_VERSION,
|
|
@@ -130242,21 +130328,19 @@ var init_typescript2 = __esm(() => {
|
|
|
130242
130328
|
resolve(file2, rawReference, rawDefinitions, build) {
|
|
130243
130329
|
const normalizedFile = normalizeStructuralFile(file2.file);
|
|
130244
130330
|
const reference = normalizedReference(rawReference);
|
|
130245
|
-
const
|
|
130246
|
-
const
|
|
130247
|
-
const { registry: registry3, definitions: allDefinitions } = indexDefinitions(scopedDefinitions);
|
|
130248
|
-
const definitions = allDefinitions.filter((definition) => candidateKind(reference, definition));
|
|
130331
|
+
const index = definitionIndex(rawDefinitions, FAMILY_DIALECTS.has(file2.dialect));
|
|
130332
|
+
const partition = reference.kind && REFERENCE_PARTITION[reference.kind] ? index[REFERENCE_PARTITION[reference.kind]] : EMPTY_PARTITION;
|
|
130249
130333
|
if (reference.existingFqn) {
|
|
130250
|
-
const prepared =
|
|
130251
|
-
const exact = prepared ? { found: true, identity: prepared } :
|
|
130334
|
+
const prepared = partition.byFqn.get(reference.existingFqn)?.identity;
|
|
130335
|
+
const exact = prepared ? { found: true, identity: prepared } : index.registry.resolveModern(reference.existingFqn);
|
|
130252
130336
|
return exact.found ? Object.freeze({ status: "resolved", fqn: exact.identity.fqn, identity: exact.identity, source: "exact" }) : Object.freeze({ status: "unresolved", name: reference.existingFqn });
|
|
130253
130337
|
}
|
|
130254
130338
|
const soughtQualified = reference.qualifier ? `${reference.qualifier}.${reference.name}` : reference.name;
|
|
130255
|
-
const local = sameFileMatches(normalizedFile, reference,
|
|
130339
|
+
const local = sameFileMatches(normalizedFile, reference, partition);
|
|
130256
130340
|
const localOutcome = outcome(reference, local, "same_file");
|
|
130257
130341
|
if (localOutcome)
|
|
130258
130342
|
return localOutcome;
|
|
130259
|
-
const imported = importedMatches({ ...file2, file: normalizedFile }, reference,
|
|
130343
|
+
const imported = importedMatches({ ...file2, file: normalizedFile }, reference, partition, build);
|
|
130260
130344
|
const importOutcome = outcome(reference, imported.matches, "import");
|
|
130261
130345
|
if (importOutcome)
|
|
130262
130346
|
return importOutcome;
|
|
@@ -130266,16 +130350,16 @@ var init_typescript2 = __esm(() => {
|
|
|
130266
130350
|
name: reference.name,
|
|
130267
130351
|
...reference.qualifier ? { qualifier: reference.qualifier } : {}
|
|
130268
130352
|
});
|
|
130269
|
-
const
|
|
130270
|
-
return outcome(reference,
|
|
130353
|
+
const globalBucket = reference.qualifier ? (partition.byQualifiedName.get(soughtQualified) ?? []).filter((definition) => definition.exported) : (partition.byQualifiedName.get(reference.name) ?? []).filter((definition) => definition.exported && definition.identity.qualifiedName === definition.identity.name);
|
|
130354
|
+
return outcome(reference, globalBucket, "global") ?? Object.freeze({
|
|
130271
130355
|
status: "unresolved",
|
|
130272
130356
|
name: reference.name,
|
|
130273
130357
|
...reference.qualifier ? { qualifier: reference.qualifier } : {}
|
|
130274
130358
|
});
|
|
130275
130359
|
},
|
|
130276
130360
|
resolveLegacy(legacyFqn, rawDefinitions) {
|
|
130277
|
-
const { registry: registry3,
|
|
130278
|
-
const materialized =
|
|
130361
|
+
const { registry: registry3, all } = definitionIndex(rawDefinitions, false);
|
|
130362
|
+
const materialized = all.list.filter((definition) => definition.identity.legacyFqn === legacyFqn);
|
|
130279
130363
|
const materializedOutcome = outcome({ kind: "call", span: { startByte: 0, endByte: 0, start: { row: 0, column: 0 }, end: { row: 0, column: 0 } }, name: legacyFqn }, materialized, "legacy");
|
|
130280
130364
|
if (materializedOutcome)
|
|
130281
130365
|
return materializedOutcome;
|
|
@@ -130308,7 +130392,7 @@ var init_scripting2 = __esm(() => {
|
|
|
130308
130392
|
...TYPESCRIPT_LANGUAGE_RESOLVER,
|
|
130309
130393
|
dialects: Object.freeze(["python", "ruby", "php", "lua-luajit"]),
|
|
130310
130394
|
resolve(file2, reference, definitions, build) {
|
|
130311
|
-
return TYPESCRIPT_LANGUAGE_RESOLVER.resolve(file2, reference, definitions.
|
|
130395
|
+
return TYPESCRIPT_LANGUAGE_RESOLVER.resolve(file2, reference, cachedDialectScope(definitions, file2.dialect, (definition) => definition.identity.dialect === file2.dialect), build);
|
|
130312
130396
|
}
|
|
130313
130397
|
});
|
|
130314
130398
|
});
|
|
@@ -130324,6 +130408,7 @@ var init_systems2 = __esm(() => {
|
|
|
130324
130408
|
dialects: DIALECTS,
|
|
130325
130409
|
resolve(file2, reference, definitions, build) {
|
|
130326
130410
|
const compatible = file2.dialect === "header-default-c" ? ["c", "header-default-c"] : file2.dialect === "header-cpp" || file2.dialect === "header" ? ["cpp", "header", "header-cpp"] : [file2.dialect];
|
|
130411
|
+
const compatibleKey = compatible.join(",");
|
|
130327
130412
|
const unresolvedTarget = reference.target.status === "unresolved" ? reference.target : undefined;
|
|
130328
130413
|
const resolverFile = file2.dialect === "rust" ? {
|
|
130329
130414
|
...file2,
|
|
@@ -130342,7 +130427,7 @@ var init_systems2 = __esm(() => {
|
|
|
130342
130427
|
return { ...item, bindings };
|
|
130343
130428
|
})
|
|
130344
130429
|
} : file2;
|
|
130345
|
-
return TYPESCRIPT_LANGUAGE_RESOLVER.resolve(resolverFile, reference, definitions
|
|
130430
|
+
return TYPESCRIPT_LANGUAGE_RESOLVER.resolve(resolverFile, reference, cachedDialectScope(definitions, compatibleKey, (item) => compatible.includes(item.identity.dialect)), build);
|
|
130346
130431
|
}
|
|
130347
130432
|
});
|
|
130348
130433
|
});
|
|
@@ -130387,7 +130472,7 @@ var init_managed2 = __esm(() => {
|
|
|
130387
130472
|
return imported;
|
|
130388
130473
|
return { ...imported, bindings: imported.bindings.map((binding) => binding.imported === "*" && binding.local === "*" ? { ...binding, imported: unresolved2.name, local: unresolved2.name } : binding) };
|
|
130389
130474
|
}) } : file2;
|
|
130390
|
-
return TYPESCRIPT_LANGUAGE_RESOLVER.resolve(resolverFile, reference, definitions.
|
|
130475
|
+
return TYPESCRIPT_LANGUAGE_RESOLVER.resolve(resolverFile, reference, cachedDialectScope(definitions, file2.dialect === "kotlin" || file2.dialect === "kotlin-script" ? "kotlin" : file2.dialect, (item) => file2.dialect === "kotlin" || file2.dialect === "kotlin-script" ? item.identity.dialect === "kotlin" || item.identity.dialect === "kotlin-script" : item.identity.dialect === file2.dialect), build);
|
|
130391
130476
|
}
|
|
130392
130477
|
});
|
|
130393
130478
|
});
|
|
@@ -130415,7 +130500,7 @@ var init_functional2 = __esm(() => {
|
|
|
130415
130500
|
return imported;
|
|
130416
130501
|
return { ...imported, bindings: imported.bindings.length === 0 ? [{ imported: `${owner}.${unresolved2.name}`, local: unresolved2.name, typeOnly: false }] : imported.bindings.map((binding) => binding.imported === "*" && (binding.local === "*" || imported.form === "elixir_import") ? { ...binding, imported: `${owner}.${unresolved2.name}`, local: unresolved2.name } : binding.imported.startsWith("!") ? binding : { ...binding, imported: `${owner}.${binding.imported}` }) };
|
|
130417
130502
|
}) } : file2;
|
|
130418
|
-
return TYPESCRIPT_LANGUAGE_RESOLVER.resolve(resolverFile, reference, definitions.
|
|
130503
|
+
return TYPESCRIPT_LANGUAGE_RESOLVER.resolve(resolverFile, reference, cachedDialectScope(definitions, file2.dialect === "elixir" || file2.dialect === "elixir-script" ? "elixir" : file2.dialect, (item) => file2.dialect === "elixir" || file2.dialect === "elixir-script" ? item.identity.dialect === "elixir" || item.identity.dialect === "elixir-script" : item.identity.dialect === file2.dialect), build);
|
|
130419
130504
|
}
|
|
130420
130505
|
});
|
|
130421
130506
|
});
|
|
@@ -130433,6 +130518,14 @@ var init_data_document2 = __esm(() => {
|
|
|
130433
130518
|
// ../../packages/core/dist/services/etl/stages/resolve.js
|
|
130434
130519
|
import path27 from "path";
|
|
130435
130520
|
import fs18 from "fs";
|
|
130521
|
+
function knownRelPathsList(knownRelPaths) {
|
|
130522
|
+
const existing = KNOWN_REL_PATHS_LISTS.get(knownRelPaths);
|
|
130523
|
+
if (existing)
|
|
130524
|
+
return existing;
|
|
130525
|
+
const built = Object.freeze([...knownRelPaths]);
|
|
130526
|
+
KNOWN_REL_PATHS_LISTS.set(knownRelPaths, built);
|
|
130527
|
+
return built;
|
|
130528
|
+
}
|
|
130436
130529
|
|
|
130437
130530
|
class ResolveStage {
|
|
130438
130531
|
symbolRepository;
|
|
@@ -130516,7 +130609,7 @@ class ResolveStage {
|
|
|
130516
130609
|
resolveStructuralFile(parsed, session2, knownRelPaths, rootAliases, monorepoPackages) {
|
|
130517
130610
|
const filePath = parsed.file.relativePath;
|
|
130518
130611
|
const structuralAliases = this.structuralAliasesFor(filePath, rootAliases, monorepoPackages);
|
|
130519
|
-
const build = { knownFiles:
|
|
130612
|
+
const build = { knownFiles: knownRelPathsList(knownRelPaths), pathAliasesByFile: { [filePath]: structuralAliases } };
|
|
130520
130613
|
const resolvedImports = parsed.rawImports.map((raw2) => {
|
|
130521
130614
|
const resolvedPath = resolveStructuralSpecifier(raw2.specifier, filePath, build) ?? null;
|
|
130522
130615
|
return {
|
|
@@ -130816,7 +130909,7 @@ class ResolveStage {
|
|
|
130816
130909
|
}));
|
|
130817
130910
|
}
|
|
130818
130911
|
}
|
|
130819
|
-
var TS_EXTENSIONS, STRUCTURAL_SEED_EXTENSIONS;
|
|
130912
|
+
var KNOWN_REL_PATHS_LISTS, TS_EXTENSIONS, STRUCTURAL_SEED_EXTENSIONS;
|
|
130820
130913
|
var init_resolve = __esm(() => {
|
|
130821
130914
|
init_dist();
|
|
130822
130915
|
init_symbol_repository_factory();
|
|
@@ -130830,14 +130923,28 @@ var init_resolve = __esm(() => {
|
|
|
130830
130923
|
init_fqn_codec();
|
|
130831
130924
|
init_language_manifest();
|
|
130832
130925
|
init_types3();
|
|
130926
|
+
KNOWN_REL_PATHS_LISTS = new WeakMap;
|
|
130833
130927
|
TS_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx", "/index.ts", "/index.js"];
|
|
130834
130928
|
STRUCTURAL_SEED_EXTENSIONS = new Set([".ts", ".tsx", ".js", ".jsx", ".py", ".rb", ".php", ".lua", ".c", ".h", ".cpp", ".hpp", ".go", ".rs", ".zig", ".java", ".kt", ".kts", ".scala", ".cs", ".swift", ".dart", ".ex", ".exs", ".erl", ".clj", ".ml", ".hs", ".vue", ".md", ".json", ".yaml", ".yml"]);
|
|
130835
130929
|
});
|
|
130836
130930
|
|
|
130837
130931
|
// ../../packages/core/dist/data/with-deadlock-retry.js
|
|
130932
|
+
function isConnectionPoolAcquisitionError(error51) {
|
|
130933
|
+
if (!error51 || typeof error51 !== "object")
|
|
130934
|
+
return false;
|
|
130935
|
+
const code = error51.code;
|
|
130936
|
+
if (code === "P2024")
|
|
130937
|
+
return true;
|
|
130938
|
+
const message = error51.message;
|
|
130939
|
+
if (typeof message !== "string")
|
|
130940
|
+
return false;
|
|
130941
|
+
return message.includes("Unable to start a transaction in the given time") || message.includes("Timed out fetching a new connection from the connection pool");
|
|
130942
|
+
}
|
|
130838
130943
|
function isRetriableTransactionError(error51) {
|
|
130839
130944
|
if (!error51 || typeof error51 !== "object")
|
|
130840
130945
|
return false;
|
|
130946
|
+
if (isConnectionPoolAcquisitionError(error51))
|
|
130947
|
+
return true;
|
|
130841
130948
|
const code = error51.code;
|
|
130842
130949
|
if (typeof code === "string" && RETRIABLE_SQLSTATES.has(code))
|
|
130843
130950
|
return true;
|
|
@@ -130850,17 +130957,23 @@ function isRetriableTransactionError(error51) {
|
|
|
130850
130957
|
async function withDeadlockRetry(operation, options = {}) {
|
|
130851
130958
|
const maxAttempts = options.maxAttempts ?? 5;
|
|
130852
130959
|
const baseDelayMs = options.baseDelayMs ?? 75;
|
|
130853
|
-
|
|
130960
|
+
const connectionDelayMs = options.connectionDelayMs ?? 30000;
|
|
130961
|
+
const loopBound = Math.max(maxAttempts, 10);
|
|
130962
|
+
for (let attempt = 1;attempt <= loopBound; attempt++) {
|
|
130854
130963
|
try {
|
|
130855
130964
|
return await operation();
|
|
130856
130965
|
} catch (error51) {
|
|
130857
|
-
if (!isRetriableTransactionError(error51)
|
|
130966
|
+
if (!isRetriableTransactionError(error51))
|
|
130967
|
+
throw error51;
|
|
130968
|
+
const isConn = isConnectionPoolAcquisitionError(error51);
|
|
130969
|
+
const effectiveMax = isConn ? Math.max(maxAttempts, 10) : maxAttempts;
|
|
130970
|
+
if (attempt >= effectiveMax)
|
|
130858
130971
|
throw error51;
|
|
130859
|
-
const delayMs = baseDelayMs * 2 ** (attempt - 1);
|
|
130860
|
-
logger.warn("Retriable DB
|
|
130972
|
+
const delayMs = isConn ? connectionDelayMs * attempt : baseDelayMs * 2 ** (attempt - 1);
|
|
130973
|
+
logger.warn("Retriable DB failure; retrying operation", {
|
|
130861
130974
|
operation: options.operation ?? "unknown",
|
|
130862
130975
|
attempt,
|
|
130863
|
-
maxAttempts,
|
|
130976
|
+
maxAttempts: effectiveMax,
|
|
130864
130977
|
delayMs,
|
|
130865
130978
|
error: error51
|
|
130866
130979
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@massa-ai/mcp-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.66.1",
|
|
4
4
|
"description": "massa-ai MCP server - Semantic code search, memory, and context compression via Model Context Protocol",
|
|
5
5
|
"author": "luizgmassa",
|
|
6
6
|
"type": "module",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"type-check": "tsc --noEmit"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@massa-ai/core": "^1.
|
|
24
|
-
"@massa-ai/shared": "^1.
|
|
23
|
+
"@massa-ai/core": "^1.66.1",
|
|
24
|
+
"@massa-ai/shared": "^1.66.1",
|
|
25
25
|
"@modelcontextprotocol/sdk": "^1.0.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|