@adhisang/minecraft-modding-mcp 2.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +62 -0
- package/README.md +139 -30
- package/dist/cache-registry.d.ts +95 -0
- package/dist/cache-registry.js +541 -0
- package/dist/cli.js +31 -4
- package/dist/compat-stdio-transport.d.ts +2 -7
- package/dist/compat-stdio-transport.js +12 -154
- package/dist/entry-tools/analyze-mod-service.d.ts +207 -0
- package/dist/entry-tools/analyze-mod-service.js +253 -0
- package/dist/entry-tools/analyze-symbol-service.d.ts +209 -0
- package/dist/entry-tools/analyze-symbol-service.js +304 -0
- package/dist/entry-tools/compare-minecraft-service.d.ts +210 -0
- package/dist/entry-tools/compare-minecraft-service.js +397 -0
- package/dist/entry-tools/entry-tool-schema.d.ts +6 -0
- package/dist/entry-tools/entry-tool-schema.js +10 -0
- package/dist/entry-tools/inspect-minecraft-service.d.ts +1953 -0
- package/dist/entry-tools/inspect-minecraft-service.js +876 -0
- package/dist/entry-tools/manage-cache-service.d.ts +130 -0
- package/dist/entry-tools/manage-cache-service.js +229 -0
- package/dist/entry-tools/request-normalizers.d.ts +10 -0
- package/dist/entry-tools/request-normalizers.js +36 -0
- package/dist/entry-tools/response-contract.d.ts +44 -0
- package/dist/entry-tools/response-contract.js +96 -0
- package/dist/entry-tools/validate-project-service.d.ts +543 -0
- package/dist/entry-tools/validate-project-service.js +381 -0
- package/dist/index.js +495 -42
- package/dist/json-rpc-framing.d.ts +22 -0
- package/dist/json-rpc-framing.js +168 -0
- package/dist/mapping-pipeline-service.js +9 -1
- package/dist/mapping-service.d.ts +9 -0
- package/dist/mapping-service.js +183 -60
- package/dist/minecraft-explorer-service.d.ts +0 -1
- package/dist/minecraft-explorer-service.js +119 -23
- package/dist/mixin-validator.d.ts +24 -2
- package/dist/mixin-validator.js +223 -98
- package/dist/mod-decompile-service.d.ts +5 -0
- package/dist/mod-decompile-service.js +40 -5
- package/dist/mod-remap-service.js +142 -30
- package/dist/path-resolver.js +41 -4
- package/dist/registry-service.d.ts +10 -1
- package/dist/registry-service.js +154 -22
- package/dist/search-hit-accumulator.js +23 -2
- package/dist/source-jar-reader.js +16 -2
- package/dist/source-resolver.js +6 -7
- package/dist/source-service.d.ts +42 -4
- package/dist/source-service.js +781 -127
- package/dist/stdio-supervisor.d.ts +46 -0
- package/dist/stdio-supervisor.js +349 -0
- package/dist/storage/files-repo.d.ts +3 -9
- package/dist/storage/files-repo.js +66 -43
- package/dist/symbols/symbol-extractor.js +6 -4
- package/dist/tool-execution-gate.d.ts +15 -0
- package/dist/tool-execution-gate.js +58 -0
- package/dist/version-diff-service.js +10 -5
- package/dist/version-service.js +7 -2
- package/dist/workspace-mapping-service.js +12 -0
- package/package.json +1 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { createError, ERROR_CODES } from "./errors.js";
|
|
2
|
+
const DEFAULT_OPTIONS = {
|
|
3
|
+
maxConcurrent: 1,
|
|
4
|
+
maxQueue: 2
|
|
5
|
+
};
|
|
6
|
+
export class ToolExecutionGate {
|
|
7
|
+
maxConcurrent;
|
|
8
|
+
maxQueue;
|
|
9
|
+
activeCount = 0;
|
|
10
|
+
queue = [];
|
|
11
|
+
constructor(options = {}) {
|
|
12
|
+
this.maxConcurrent = Math.max(1, Math.trunc(options.maxConcurrent ?? DEFAULT_OPTIONS.maxConcurrent));
|
|
13
|
+
this.maxQueue = Math.max(0, Math.trunc(options.maxQueue ?? DEFAULT_OPTIONS.maxQueue));
|
|
14
|
+
}
|
|
15
|
+
run(tool, task) {
|
|
16
|
+
if (this.activeCount < this.maxConcurrent) {
|
|
17
|
+
return this.execute({ tool, task: task });
|
|
18
|
+
}
|
|
19
|
+
if (this.queue.length >= this.maxQueue) {
|
|
20
|
+
return Promise.reject(createError({
|
|
21
|
+
code: ERROR_CODES.LIMIT_EXCEEDED,
|
|
22
|
+
message: `Heavy tool queue is full; "${tool}" was not started.`,
|
|
23
|
+
details: {
|
|
24
|
+
tool,
|
|
25
|
+
activeCount: this.activeCount,
|
|
26
|
+
queuedCount: this.queue.length,
|
|
27
|
+
maxConcurrent: this.maxConcurrent,
|
|
28
|
+
maxQueue: this.maxQueue,
|
|
29
|
+
nextAction: "Retry after the current heavy analysis request completes. Avoid sending multiple heavy mapping/version analysis tools in parallel."
|
|
30
|
+
}
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
this.queue.push({
|
|
35
|
+
tool,
|
|
36
|
+
task: task,
|
|
37
|
+
resolve: resolve,
|
|
38
|
+
reject
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
execute(entry) {
|
|
43
|
+
this.activeCount += 1;
|
|
44
|
+
return Promise.resolve()
|
|
45
|
+
.then(entry.task)
|
|
46
|
+
.finally(() => {
|
|
47
|
+
this.activeCount = Math.max(0, this.activeCount - 1);
|
|
48
|
+
this.drain();
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
drain() {
|
|
52
|
+
while (this.activeCount < this.maxConcurrent && this.queue.length > 0) {
|
|
53
|
+
const next = this.queue.shift();
|
|
54
|
+
this.execute(next).then(next.resolve, next.reject);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=tool-execution-gate.js.map
|
|
@@ -22,6 +22,9 @@ function filterByPackage(classes, prefix) {
|
|
|
22
22
|
const normalized = prefix.endsWith(".") ? prefix : `${prefix}.`;
|
|
23
23
|
return classes.filter((fqn) => fqn.startsWith(normalized));
|
|
24
24
|
}
|
|
25
|
+
function filterSetByPackage(classes, prefix) {
|
|
26
|
+
return new Set(filterByPackage([...classes], prefix));
|
|
27
|
+
}
|
|
25
28
|
function diffSets(from, to) {
|
|
26
29
|
const added = [];
|
|
27
30
|
const removed = [];
|
|
@@ -162,11 +165,13 @@ export class VersionDiffService {
|
|
|
162
165
|
]);
|
|
163
166
|
const fromClasses = extractClassEntries(fromEntries);
|
|
164
167
|
const toClasses = extractClassEntries(toEntries);
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
168
|
+
const filteredFromClasses = input.packageFilter
|
|
169
|
+
? filterSetByPackage(fromClasses, input.packageFilter)
|
|
170
|
+
: fromClasses;
|
|
171
|
+
const filteredToClasses = input.packageFilter
|
|
172
|
+
? filterSetByPackage(toClasses, input.packageFilter)
|
|
173
|
+
: toClasses;
|
|
174
|
+
const { added, removed, unchanged } = diffSets(filteredFromClasses, filteredToClasses);
|
|
170
175
|
const truncatedAdded = added.slice(0, maxClassResults);
|
|
171
176
|
const truncatedRemoved = removed.slice(0, maxClassResults);
|
|
172
177
|
if (added.length > maxClassResults) {
|
package/dist/version-service.js
CHANGED
|
@@ -401,8 +401,13 @@ export class VersionService {
|
|
|
401
401
|
}
|
|
402
402
|
trimVersionDetailCache() {
|
|
403
403
|
const maxEntries = Math.max(1, this.config.maxVersionDetailCache ?? 256);
|
|
404
|
-
|
|
405
|
-
|
|
404
|
+
const overflow = this.versionDetailCache.size - maxEntries;
|
|
405
|
+
if (overflow <= 0) {
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
const keyIterator = this.versionDetailCache.keys();
|
|
409
|
+
for (let index = 0; index < overflow; index += 1) {
|
|
410
|
+
const oldest = keyIterator.next().value;
|
|
406
411
|
if (!oldest) {
|
|
407
412
|
return;
|
|
408
413
|
}
|
|
@@ -22,6 +22,18 @@ function detectMappingsFromContent(content) {
|
|
|
22
22
|
reason: "mappings net.fabricmc:intermediary"
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
+
if (/\bid\s*(?:\(\s*)?["']net\.neoforged\.moddev["']\s*\)?/i.test(content)) {
|
|
26
|
+
detections.push({
|
|
27
|
+
mapping: "mojang",
|
|
28
|
+
reason: "net.neoforged.moddev plugin"
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
if (/\bneoForge\s*\{[\s\S]*?\bparchment\s*\{/i.test(content)) {
|
|
32
|
+
detections.push({
|
|
33
|
+
mapping: "mojang",
|
|
34
|
+
reason: "neoForge parchment block"
|
|
35
|
+
});
|
|
36
|
+
}
|
|
25
37
|
return detections;
|
|
26
38
|
}
|
|
27
39
|
export class WorkspaceMappingService {
|