@adhisang/minecraft-modding-mcp 4.0.0 → 4.1.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/CHANGELOG.md +61 -0
- package/README.md +40 -23
- package/dist/build-suggested-call.d.ts +29 -0
- package/dist/build-suggested-call.js +58 -0
- package/dist/cache-registry.d.ts +3 -1
- package/dist/cache-registry.js +50 -6
- package/dist/entry-tools/analyze-symbol-service.d.ts +16 -16
- package/dist/entry-tools/batch-class-members-service.d.ts +34 -0
- package/dist/entry-tools/batch-class-members-service.js +97 -0
- package/dist/entry-tools/batch-class-source-service.d.ts +37 -0
- package/dist/entry-tools/batch-class-source-service.js +100 -0
- package/dist/entry-tools/batch-mappings-service.d.ts +36 -0
- package/dist/entry-tools/batch-mappings-service.js +66 -0
- package/dist/entry-tools/batch-runner.d.ts +72 -0
- package/dist/entry-tools/batch-runner.js +90 -0
- package/dist/entry-tools/batch-symbol-exists-service.d.ts +46 -0
- package/dist/entry-tools/batch-symbol-exists-service.js +113 -0
- package/dist/entry-tools/compare-minecraft-service.d.ts +6 -6
- package/dist/entry-tools/inspect-minecraft/handlers/artifact.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/artifact.js +83 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-members.d.ts +6 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-members.js +80 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-overview.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-overview.js +248 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-source.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-source.js +60 -0
- package/dist/entry-tools/inspect-minecraft/handlers/file.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/file.js +54 -0
- package/dist/entry-tools/inspect-minecraft/handlers/list-files.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/list-files.js +100 -0
- package/dist/entry-tools/inspect-minecraft/handlers/search.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/search.js +155 -0
- package/dist/entry-tools/inspect-minecraft/handlers/versions.d.ts +6 -0
- package/dist/entry-tools/inspect-minecraft/handlers/versions.js +49 -0
- package/dist/entry-tools/inspect-minecraft/internal.d.ts +1042 -0
- package/dist/entry-tools/inspect-minecraft/internal.js +448 -0
- package/dist/entry-tools/inspect-minecraft-service.d.ts +193 -308
- package/dist/entry-tools/inspect-minecraft-service.js +20 -1244
- package/dist/entry-tools/manage-cache-service.d.ts +16 -16
- package/dist/entry-tools/validate-project/cases/access-transformer.d.ts +6 -0
- package/dist/entry-tools/validate-project/cases/access-transformer.js +106 -0
- package/dist/entry-tools/validate-project/cases/access-widener.d.ts +6 -0
- package/dist/entry-tools/validate-project/cases/access-widener.js +86 -0
- package/dist/entry-tools/validate-project/cases/mixin.d.ts +6 -0
- package/dist/entry-tools/validate-project/cases/mixin.js +90 -0
- package/dist/entry-tools/validate-project/cases/project-summary.d.ts +102 -0
- package/dist/entry-tools/validate-project/cases/project-summary.js +415 -0
- package/dist/entry-tools/validate-project/internal.d.ts +142 -0
- package/dist/entry-tools/validate-project/internal.js +303 -0
- package/dist/entry-tools/validate-project-service.d.ts +67 -47
- package/dist/entry-tools/validate-project-service.js +13 -563
- package/dist/entry-tools/verify-mixin-target-service.d.ts +133 -0
- package/dist/entry-tools/verify-mixin-target-service.js +323 -0
- package/dist/error-mapping.d.ts +40 -0
- package/dist/error-mapping.js +139 -0
- package/dist/errors.d.ts +6 -0
- package/dist/errors.js +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +147 -1354
- package/dist/mapping/internal-types.d.ts +54 -0
- package/dist/mapping/internal-types.js +14 -0
- package/dist/mapping/loaders/mojang.d.ts +2 -0
- package/dist/mapping/loaders/mojang.js +64 -0
- package/dist/mapping/loaders/tiny-loom.d.ts +2 -0
- package/dist/mapping/loaders/tiny-loom.js +73 -0
- package/dist/mapping/loaders/tiny-maven.d.ts +2 -0
- package/dist/mapping/loaders/tiny-maven.js +104 -0
- package/dist/mapping/loaders/types.d.ts +14 -0
- package/dist/mapping/loaders/types.js +2 -0
- package/dist/mapping/lookup.d.ts +52 -0
- package/dist/mapping/lookup.js +496 -0
- package/dist/mapping/parsers/normalize.d.ts +10 -0
- package/dist/mapping/parsers/normalize.js +52 -0
- package/dist/mapping/parsers/proguard.d.ts +20 -0
- package/dist/mapping/parsers/proguard.js +138 -0
- package/dist/mapping/parsers/symbol-records.d.ts +27 -0
- package/dist/mapping/parsers/symbol-records.js +216 -0
- package/dist/mapping/parsers/tiny.d.ts +9 -0
- package/dist/mapping/parsers/tiny.js +96 -0
- package/dist/mapping/types.d.ts +147 -0
- package/dist/mapping/types.js +2 -0
- package/dist/mapping-pipeline-service.js +3 -2
- package/dist/mapping-service.d.ts +8 -145
- package/dist/mapping-service.js +30 -1207
- package/dist/mixin/access-validators.d.ts +9 -0
- package/dist/mixin/access-validators.js +257 -0
- package/dist/mixin/annotation-validators.d.ts +5 -0
- package/dist/mixin/annotation-validators.js +162 -0
- package/dist/mixin/helpers.d.ts +28 -0
- package/dist/mixin/helpers.js +315 -0
- package/dist/mixin/parsed-validator.d.ts +8 -0
- package/dist/mixin/parsed-validator.js +337 -0
- package/dist/mixin/types.d.ts +208 -0
- package/dist/mixin/types.js +28 -0
- package/dist/mixin-validator.d.ts +9 -201
- package/dist/mixin-validator.js +8 -1020
- package/dist/source/access-validate.d.ts +4 -0
- package/dist/source/access-validate.js +254 -0
- package/dist/source/artifact-resolver.d.ts +111 -0
- package/dist/source/artifact-resolver.js +1271 -0
- package/dist/source/cache-metrics.d.ts +26 -0
- package/dist/source/cache-metrics.js +172 -0
- package/dist/source/class-source/members-builder.d.ts +34 -0
- package/dist/source/class-source/members-builder.js +46 -0
- package/dist/source/class-source/snippet-builder.d.ts +19 -0
- package/dist/source/class-source/snippet-builder.js +46 -0
- package/dist/source/class-source-helpers.d.ts +34 -0
- package/dist/source/class-source-helpers.js +140 -0
- package/dist/source/class-source.d.ts +42 -0
- package/dist/source/class-source.js +883 -0
- package/dist/source/descriptor-utils.d.ts +6 -0
- package/dist/source/descriptor-utils.js +37 -0
- package/dist/source/file-access.d.ts +4 -0
- package/dist/source/file-access.js +102 -0
- package/dist/source/indexer.d.ts +82 -0
- package/dist/source/indexer.js +522 -0
- package/dist/source/lifecycle/diff-utils.d.ts +9 -0
- package/dist/source/lifecycle/diff-utils.js +107 -0
- package/dist/source/lifecycle/diff.d.ts +2 -0
- package/dist/source/lifecycle/diff.js +265 -0
- package/dist/source/lifecycle/mapping-helpers.d.ts +22 -0
- package/dist/source/lifecycle/mapping-helpers.js +327 -0
- package/dist/source/lifecycle/runtime-check.d.ts +2 -0
- package/dist/source/lifecycle/runtime-check.js +142 -0
- package/dist/source/lifecycle/trace.d.ts +2 -0
- package/dist/source/lifecycle/trace.js +231 -0
- package/dist/source/lifecycle.d.ts +4 -0
- package/dist/source/lifecycle.js +5 -0
- package/dist/source/search.d.ts +51 -0
- package/dist/source/search.js +676 -0
- package/dist/source/shared-utils.d.ts +6 -0
- package/dist/source/shared-utils.js +55 -0
- package/dist/source/state.d.ts +26 -0
- package/dist/source/state.js +24 -0
- package/dist/source/symbol-resolver.d.ts +3 -0
- package/dist/source/symbol-resolver.js +212 -0
- package/dist/source/validate-mixin/pipeline/mapping-health.d.ts +3 -0
- package/dist/source/validate-mixin/pipeline/mapping-health.js +41 -0
- package/dist/source/validate-mixin/pipeline/parse.d.ts +2 -0
- package/dist/source/validate-mixin/pipeline/parse.js +10 -0
- package/dist/source/validate-mixin/pipeline/resolve.d.ts +3 -0
- package/dist/source/validate-mixin/pipeline/resolve.js +78 -0
- package/dist/source/validate-mixin/pipeline/target-lookup.d.ts +6 -0
- package/dist/source/validate-mixin/pipeline/target-lookup.js +260 -0
- package/dist/source/validate-mixin/pipeline-context.d.ts +72 -0
- package/dist/source/validate-mixin/pipeline-context.js +93 -0
- package/dist/source/validate-mixin.d.ts +22 -0
- package/dist/source/validate-mixin.js +799 -0
- package/dist/source/workspace-target.d.ts +18 -0
- package/dist/source/workspace-target.js +305 -0
- package/dist/source-resolver.d.ts +1 -0
- package/dist/source-resolver.js +1 -1
- package/dist/source-service.d.ts +164 -170
- package/dist/source-service.js +70 -6116
- package/dist/stage-emitter.d.ts +13 -0
- package/dist/stage-emitter.js +30 -0
- package/dist/stdio-supervisor.d.ts +61 -0
- package/dist/stdio-supervisor.js +326 -9
- package/dist/tool-contract-manifest.d.ts +1 -1
- package/dist/tool-contract-manifest.js +23 -6
- package/dist/tool-guidance.d.ts +82 -0
- package/dist/tool-guidance.js +734 -0
- package/dist/tool-schema-registry.d.ts +16 -0
- package/dist/tool-schema-registry.js +37 -0
- package/dist/tool-schemas.d.ts +3518 -0
- package/dist/tool-schemas.js +813 -0
- package/dist/types.d.ts +36 -0
- package/dist/version-service.js +7 -6
- package/dist/workspace-context-cache.d.ts +32 -0
- package/dist/workspace-context-cache.js +66 -0
- package/dist/workspace-mapping-service.d.ts +16 -0
- package/dist/workspace-mapping-service.js +173 -1
- package/docs/README-ja.md +416 -0
- package/docs/examples.md +483 -0
- package/docs/tool-reference.md +462 -0
- package/package.json +17 -4
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
export async function checkSymbolExistsInUnobfuscatedRuntime(svc, input, fallbackBase) {
|
|
2
|
+
const version = input.version.trim();
|
|
3
|
+
const name = input.name.trim();
|
|
4
|
+
const owner = input.owner?.trim();
|
|
5
|
+
if (!version || !name) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
if (input.kind === "class" && input.nameMode !== "fqcn" && !name.includes(".")) {
|
|
9
|
+
return {
|
|
10
|
+
...fallbackBase,
|
|
11
|
+
warnings: [
|
|
12
|
+
...fallbackBase.warnings,
|
|
13
|
+
`Version ${version} is unobfuscated, but short class name "${name}" could not be checked against runtime bytecode without a fully-qualified name.`
|
|
14
|
+
]
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const querySymbol = input.kind === "class"
|
|
18
|
+
? {
|
|
19
|
+
kind: "class",
|
|
20
|
+
name,
|
|
21
|
+
symbol: name
|
|
22
|
+
}
|
|
23
|
+
: input.kind === "field"
|
|
24
|
+
? {
|
|
25
|
+
kind: "field",
|
|
26
|
+
owner,
|
|
27
|
+
name,
|
|
28
|
+
symbol: `${owner}.${name}`
|
|
29
|
+
}
|
|
30
|
+
: {
|
|
31
|
+
kind: "method",
|
|
32
|
+
owner,
|
|
33
|
+
name,
|
|
34
|
+
descriptor: input.descriptor?.trim(),
|
|
35
|
+
symbol: `${owner}.${name}${input.descriptor?.trim() ?? ""}`
|
|
36
|
+
};
|
|
37
|
+
const targetClass = input.kind === "class" ? name : owner;
|
|
38
|
+
if (!targetClass) {
|
|
39
|
+
return fallbackBase;
|
|
40
|
+
}
|
|
41
|
+
let jarPath;
|
|
42
|
+
try {
|
|
43
|
+
({ jarPath } = await svc.versionService.resolveVersionJar(version));
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
let signature;
|
|
49
|
+
try {
|
|
50
|
+
signature = await svc.explorerService.getSignature({
|
|
51
|
+
fqn: targetClass,
|
|
52
|
+
jarPath,
|
|
53
|
+
access: "all"
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return {
|
|
58
|
+
...fallbackBase,
|
|
59
|
+
querySymbol,
|
|
60
|
+
warnings: [
|
|
61
|
+
...fallbackBase.warnings,
|
|
62
|
+
`Version ${version} is unobfuscated; runtime bytecode lookup could not load class "${targetClass}".`
|
|
63
|
+
]
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
const warnings = [
|
|
67
|
+
...fallbackBase.warnings,
|
|
68
|
+
...signature.warnings,
|
|
69
|
+
`Version ${version} is unobfuscated; validated symbol existence against runtime bytecode.`
|
|
70
|
+
];
|
|
71
|
+
const buildResolved = (resolvedSymbol) => ({
|
|
72
|
+
...fallbackBase,
|
|
73
|
+
querySymbol,
|
|
74
|
+
resolved: true,
|
|
75
|
+
status: "resolved",
|
|
76
|
+
resolvedSymbol,
|
|
77
|
+
candidates: resolvedSymbol
|
|
78
|
+
? [{
|
|
79
|
+
...resolvedSymbol,
|
|
80
|
+
matchKind: "exact",
|
|
81
|
+
confidence: 1
|
|
82
|
+
}]
|
|
83
|
+
: [],
|
|
84
|
+
candidateCount: resolvedSymbol ? 1 : 0,
|
|
85
|
+
warnings
|
|
86
|
+
});
|
|
87
|
+
const buildUnresolved = (status) => ({
|
|
88
|
+
...fallbackBase,
|
|
89
|
+
querySymbol,
|
|
90
|
+
resolved: false,
|
|
91
|
+
status,
|
|
92
|
+
resolvedSymbol: undefined,
|
|
93
|
+
candidates: [],
|
|
94
|
+
candidateCount: 0,
|
|
95
|
+
warnings
|
|
96
|
+
});
|
|
97
|
+
if (input.kind === "class") {
|
|
98
|
+
return buildResolved({
|
|
99
|
+
kind: "class",
|
|
100
|
+
name,
|
|
101
|
+
symbol: name
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
if (input.kind === "field") {
|
|
105
|
+
const matched = signature.fields.filter((field) => field.name === name);
|
|
106
|
+
if (matched.length !== 1) {
|
|
107
|
+
return buildUnresolved(matched.length > 1 ? "ambiguous" : "not_found");
|
|
108
|
+
}
|
|
109
|
+
return buildResolved({
|
|
110
|
+
kind: "field",
|
|
111
|
+
owner,
|
|
112
|
+
name,
|
|
113
|
+
symbol: `${owner}.${name}`
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
const methodCandidates = signature.methods.filter((method) => method.name === name);
|
|
117
|
+
if (input.signatureMode === "name-only") {
|
|
118
|
+
if (methodCandidates.length !== 1) {
|
|
119
|
+
return buildUnresolved(methodCandidates.length > 1 ? "ambiguous" : "not_found");
|
|
120
|
+
}
|
|
121
|
+
return buildResolved({
|
|
122
|
+
kind: "method",
|
|
123
|
+
owner,
|
|
124
|
+
name,
|
|
125
|
+
descriptor: methodCandidates[0]?.jvmDescriptor,
|
|
126
|
+
symbol: `${owner}.${name}${methodCandidates[0]?.jvmDescriptor ?? ""}`
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
const descriptor = input.descriptor?.trim();
|
|
130
|
+
const matched = methodCandidates.filter((method) => method.jvmDescriptor === descriptor);
|
|
131
|
+
if (matched.length !== 1) {
|
|
132
|
+
return buildUnresolved(matched.length > 1 ? "ambiguous" : "not_found");
|
|
133
|
+
}
|
|
134
|
+
return buildResolved({
|
|
135
|
+
kind: "method",
|
|
136
|
+
owner,
|
|
137
|
+
name,
|
|
138
|
+
descriptor,
|
|
139
|
+
symbol: `${owner}.${name}${descriptor ?? ""}`
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=runtime-check.js.map
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { buildSuggestedCall } from "../../build-suggested-call.js";
|
|
2
|
+
import { mapWithConcurrencyLimit } from "../../concurrency.js";
|
|
3
|
+
import { ERROR_CODES, createError, isAppError } from "../../errors.js";
|
|
4
|
+
import { normalizeOptionalString } from "../shared-utils.js";
|
|
5
|
+
import { normalizeMapping, rejectLifecycleClassLikeInput, releaseLifecycleMappingGraph, resolveToObfuscatedClassName, resolveToObfuscatedMemberName } from "./mapping-helpers.js";
|
|
6
|
+
const TRACE_LIFECYCLE_MAX_CONCURRENCY = 3;
|
|
7
|
+
function clampLimit(limit, fallback, max) {
|
|
8
|
+
if (!Number.isFinite(limit) || limit == null) {
|
|
9
|
+
return fallback;
|
|
10
|
+
}
|
|
11
|
+
return Math.max(1, Math.min(max, Math.trunc(limit)));
|
|
12
|
+
}
|
|
13
|
+
function looksLikeJvmMethodDescriptor(descriptor) {
|
|
14
|
+
const trimmed = descriptor?.trim();
|
|
15
|
+
if (!trimmed || !trimmed.startsWith("(")) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
const closing = trimmed.indexOf(")");
|
|
19
|
+
return closing > 0 && closing < trimmed.length - 1;
|
|
20
|
+
}
|
|
21
|
+
function parseQualifiedMethodSymbol(symbol) {
|
|
22
|
+
const trimmed = symbol.trim();
|
|
23
|
+
const descriptorStart = trimmed.indexOf("(");
|
|
24
|
+
const qualifiedSymbol = descriptorStart >= 0 ? trimmed.slice(0, descriptorStart) : trimmed;
|
|
25
|
+
const inlineDescriptor = descriptorStart >= 0 ? trimmed.slice(descriptorStart).trim() : undefined;
|
|
26
|
+
const separator = qualifiedSymbol.lastIndexOf(".");
|
|
27
|
+
if (separator <= 0 || separator >= qualifiedSymbol.length - 1) {
|
|
28
|
+
throw createError({
|
|
29
|
+
code: ERROR_CODES.INVALID_INPUT,
|
|
30
|
+
message: `symbol must be in the form "fully.qualified.Class.method".`,
|
|
31
|
+
details: { symbol }
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const className = qualifiedSymbol.slice(0, separator);
|
|
35
|
+
const methodName = qualifiedSymbol.slice(separator + 1);
|
|
36
|
+
if (!className ||
|
|
37
|
+
!methodName ||
|
|
38
|
+
className.includes("/") ||
|
|
39
|
+
methodName.includes(".") ||
|
|
40
|
+
/\s/.test(methodName)) {
|
|
41
|
+
throw createError({
|
|
42
|
+
code: ERROR_CODES.INVALID_INPUT,
|
|
43
|
+
message: `symbol must be in the form "fully.qualified.Class.method".`,
|
|
44
|
+
details: { symbol }
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
className,
|
|
49
|
+
methodName,
|
|
50
|
+
...(inlineDescriptor ? { inlineDescriptor } : {})
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export async function traceSymbolLifecycle(svc, input) {
|
|
54
|
+
const mapping = normalizeMapping(input.mapping);
|
|
55
|
+
const { className: userClassName, methodName: userMethodName, inlineDescriptor } = parseQualifiedMethodSymbol(input.symbol);
|
|
56
|
+
const descriptor = normalizeOptionalString(input.descriptor)
|
|
57
|
+
?? (looksLikeJvmMethodDescriptor(inlineDescriptor) ? normalizeOptionalString(inlineDescriptor) : undefined);
|
|
58
|
+
const includeTimeline = input.includeTimeline ?? false;
|
|
59
|
+
const includeSnapshots = input.includeSnapshots ?? false;
|
|
60
|
+
const maxVersions = clampLimit(input.maxVersions, 120, 400);
|
|
61
|
+
const manifestOrder = await svc.versionService.listVersionIds({ includeSnapshots });
|
|
62
|
+
if (manifestOrder.length === 0) {
|
|
63
|
+
throw createError({
|
|
64
|
+
code: ERROR_CODES.VERSION_NOT_FOUND,
|
|
65
|
+
message: "No Minecraft versions were returned by manifest.",
|
|
66
|
+
details: {
|
|
67
|
+
includeSnapshots,
|
|
68
|
+
nextAction: "Use list-versions to see available Minecraft versions.",
|
|
69
|
+
...buildSuggestedCall({ tool: "list-versions", params: {} })
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
const chronological = [...manifestOrder].reverse();
|
|
74
|
+
const requestedFrom = normalizeOptionalString(input.fromVersion) ?? chronological[0];
|
|
75
|
+
const requestedTo = normalizeOptionalString(input.toVersion) ?? chronological[chronological.length - 1];
|
|
76
|
+
const fromIndex = chronological.indexOf(requestedFrom);
|
|
77
|
+
const toIndex = chronological.indexOf(requestedTo);
|
|
78
|
+
if (fromIndex < 0) {
|
|
79
|
+
throw createError({
|
|
80
|
+
code: ERROR_CODES.VERSION_NOT_FOUND,
|
|
81
|
+
message: `fromVersion "${requestedFrom}" was not found in manifest.`,
|
|
82
|
+
details: {
|
|
83
|
+
fromVersion: requestedFrom,
|
|
84
|
+
nextAction: "Use list-versions to see available Minecraft versions.",
|
|
85
|
+
...buildSuggestedCall({ tool: "list-versions", params: {} })
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if (toIndex < 0) {
|
|
90
|
+
throw createError({
|
|
91
|
+
code: ERROR_CODES.VERSION_NOT_FOUND,
|
|
92
|
+
message: `toVersion "${requestedTo}" was not found in manifest.`,
|
|
93
|
+
details: {
|
|
94
|
+
toVersion: requestedTo,
|
|
95
|
+
nextAction: "Use list-versions to see available Minecraft versions.",
|
|
96
|
+
...buildSuggestedCall({ tool: "list-versions", params: {} })
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
if (fromIndex > toIndex) {
|
|
101
|
+
throw createError({
|
|
102
|
+
code: ERROR_CODES.INVALID_INPUT,
|
|
103
|
+
message: "fromVersion must be older than or equal to toVersion.",
|
|
104
|
+
details: { fromVersion: requestedFrom, toVersion: requestedTo }
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
let selectedVersions = chronological.slice(fromIndex, toIndex + 1);
|
|
108
|
+
const warnings = [];
|
|
109
|
+
if (selectedVersions.length > maxVersions) {
|
|
110
|
+
selectedVersions = selectedVersions.slice(selectedVersions.length - maxVersions);
|
|
111
|
+
warnings.push(`Version scan truncated to ${maxVersions} entries. Effective fromVersion is now "${selectedVersions[0]}".`);
|
|
112
|
+
}
|
|
113
|
+
const referenceVersion = selectedVersions[selectedVersions.length - 1];
|
|
114
|
+
rejectLifecycleClassLikeInput(svc, {
|
|
115
|
+
symbol: input.symbol,
|
|
116
|
+
className: userClassName,
|
|
117
|
+
methodName: userMethodName,
|
|
118
|
+
mapping,
|
|
119
|
+
version: referenceVersion,
|
|
120
|
+
sourcePriority: input.sourcePriority
|
|
121
|
+
});
|
|
122
|
+
const scannedResults = await mapWithConcurrencyLimit(selectedVersions, TRACE_LIFECYCLE_MAX_CONCURRENCY, async (version) => {
|
|
123
|
+
const versionWarnings = [];
|
|
124
|
+
try {
|
|
125
|
+
const [obfuscatedClassName, obfuscatedMethod, resolvedJar] = await Promise.all([
|
|
126
|
+
resolveToObfuscatedClassName(svc, userClassName, version, mapping, input.sourcePriority, versionWarnings),
|
|
127
|
+
resolveToObfuscatedMemberName(svc, userMethodName, userClassName, descriptor, "method", version, mapping, input.sourcePriority, versionWarnings),
|
|
128
|
+
svc.versionService.resolveVersionJar(version)
|
|
129
|
+
]);
|
|
130
|
+
const signature = await svc.explorerService.getSignature({
|
|
131
|
+
fqn: obfuscatedClassName,
|
|
132
|
+
jarPath: resolvedJar.jarPath,
|
|
133
|
+
access: "all",
|
|
134
|
+
includeSynthetic: true
|
|
135
|
+
});
|
|
136
|
+
const sameNameMethods = signature.methods.filter((method) => method.name === obfuscatedMethod.name);
|
|
137
|
+
const effectiveDescriptor = obfuscatedMethod.descriptor ?? descriptor;
|
|
138
|
+
const matchesDescriptor = effectiveDescriptor
|
|
139
|
+
? sameNameMethods.some((method) => method.jvmDescriptor === effectiveDescriptor)
|
|
140
|
+
: sameNameMethods.length > 0;
|
|
141
|
+
const reason = !matchesDescriptor && descriptor && sameNameMethods.length > 0 ? "descriptor-mismatch" : undefined;
|
|
142
|
+
return {
|
|
143
|
+
entry: {
|
|
144
|
+
version,
|
|
145
|
+
exists: matchesDescriptor,
|
|
146
|
+
reason,
|
|
147
|
+
determinate: true
|
|
148
|
+
},
|
|
149
|
+
warnings: versionWarnings
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
catch (caughtError) {
|
|
153
|
+
if (isAppError(caughtError) && caughtError.code === ERROR_CODES.CLASS_NOT_FOUND) {
|
|
154
|
+
return {
|
|
155
|
+
entry: {
|
|
156
|
+
version,
|
|
157
|
+
exists: false,
|
|
158
|
+
reason: "class-not-found",
|
|
159
|
+
determinate: true
|
|
160
|
+
},
|
|
161
|
+
warnings: versionWarnings
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
versionWarnings.push(`Failed to evaluate ${version}: ${caughtError instanceof Error ? caughtError.message : String(caughtError)}`);
|
|
165
|
+
return {
|
|
166
|
+
entry: {
|
|
167
|
+
version,
|
|
168
|
+
exists: false,
|
|
169
|
+
reason: "unresolved",
|
|
170
|
+
determinate: false
|
|
171
|
+
},
|
|
172
|
+
warnings: versionWarnings
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
finally {
|
|
176
|
+
releaseLifecycleMappingGraph(svc, version, input.sourcePriority);
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
const scanned = scannedResults.map((result) => result.entry);
|
|
180
|
+
for (const result of scannedResults) {
|
|
181
|
+
warnings.push(...result.warnings);
|
|
182
|
+
}
|
|
183
|
+
const determinate = scanned.filter((entry) => entry.determinate);
|
|
184
|
+
const present = determinate.filter((entry) => entry.exists);
|
|
185
|
+
const firstSeen = present[0]?.version;
|
|
186
|
+
const lastSeen = present[present.length - 1]?.version;
|
|
187
|
+
const missingBetween = [];
|
|
188
|
+
if (firstSeen && lastSeen) {
|
|
189
|
+
const firstSeenIndex = determinate.findIndex((entry) => entry.version === firstSeen);
|
|
190
|
+
const lastSeenIndex = determinate.findIndex((entry) => entry.version === lastSeen);
|
|
191
|
+
for (let index = firstSeenIndex; index <= lastSeenIndex; index += 1) {
|
|
192
|
+
const entry = determinate[index];
|
|
193
|
+
if (entry && !entry.exists) {
|
|
194
|
+
missingBetween.push(entry.version);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
const toVersionEntry = scanned.find((entry) => entry.version === selectedVersions[selectedVersions.length - 1]);
|
|
199
|
+
const existsNow = toVersionEntry?.determinate ? toVersionEntry.exists : false;
|
|
200
|
+
if (toVersionEntry && !toVersionEntry.determinate) {
|
|
201
|
+
warnings.push(`Latest requested version "${toVersionEntry.version}" could not be evaluated.`);
|
|
202
|
+
}
|
|
203
|
+
return {
|
|
204
|
+
query: {
|
|
205
|
+
className: userClassName,
|
|
206
|
+
methodName: userMethodName,
|
|
207
|
+
descriptor,
|
|
208
|
+
mapping
|
|
209
|
+
},
|
|
210
|
+
range: {
|
|
211
|
+
fromVersion: selectedVersions[0],
|
|
212
|
+
toVersion: selectedVersions[selectedVersions.length - 1],
|
|
213
|
+
scannedCount: selectedVersions.length
|
|
214
|
+
},
|
|
215
|
+
presence: {
|
|
216
|
+
firstSeen,
|
|
217
|
+
lastSeen,
|
|
218
|
+
missingBetween,
|
|
219
|
+
existsNow
|
|
220
|
+
},
|
|
221
|
+
timeline: includeTimeline
|
|
222
|
+
? scanned.map((entry) => ({
|
|
223
|
+
version: entry.version,
|
|
224
|
+
exists: entry.exists,
|
|
225
|
+
reason: entry.reason
|
|
226
|
+
}))
|
|
227
|
+
: undefined,
|
|
228
|
+
warnings
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
//# sourceMappingURL=trace.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { checkSymbolExistsInUnobfuscatedRuntime } from "./lifecycle/runtime-check.js";
|
|
2
|
+
export { traceSymbolLifecycle } from "./lifecycle/trace.js";
|
|
3
|
+
export { diffClassSignatures } from "./lifecycle/diff.js";
|
|
4
|
+
export { rejectLifecycleClassLikeInput, releaseLifecycleMappingGraph, resolveToObfuscatedClassName, resolveToObfuscatedMemberName, remapSignatureMembers } from "./lifecycle/mapping-helpers.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { checkSymbolExistsInUnobfuscatedRuntime } from "./lifecycle/runtime-check.js";
|
|
2
|
+
export { traceSymbolLifecycle } from "./lifecycle/trace.js";
|
|
3
|
+
export { diffClassSignatures } from "./lifecycle/diff.js";
|
|
4
|
+
export { rejectLifecycleClassLikeInput, releaseLifecycleMappingGraph, resolveToObfuscatedClassName, resolveToObfuscatedMemberName, remapSignatureMembers } from "./lifecycle/mapping-helpers.js";
|
|
5
|
+
//# sourceMappingURL=lifecycle.js.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { SourceService } from "../source-service.js";
|
|
2
|
+
import type { QueryMode, SearchClassSourceInput, SearchClassSourceOutput, SearchScope, SearchSourceHit, SymbolKind } from "../source-service.js";
|
|
3
|
+
type SearchIntent = "symbol" | "text" | "path";
|
|
4
|
+
type SearchMatch = "exact" | "prefix" | "contains" | "regex";
|
|
5
|
+
interface IndexedSymbolHit {
|
|
6
|
+
symbol: {
|
|
7
|
+
filePath: string;
|
|
8
|
+
symbolKind: string;
|
|
9
|
+
symbolName: string;
|
|
10
|
+
qualifiedName: string | undefined;
|
|
11
|
+
line: number;
|
|
12
|
+
};
|
|
13
|
+
score: number;
|
|
14
|
+
matchIndex: number;
|
|
15
|
+
}
|
|
16
|
+
declare const MAX_REGEX_QUERY_LENGTH = 200;
|
|
17
|
+
declare const MAX_REGEX_RESULT_LIMIT = 100;
|
|
18
|
+
export { MAX_REGEX_QUERY_LENGTH, MAX_REGEX_RESULT_LIMIT };
|
|
19
|
+
export declare function normalizeIntent(intent: SearchIntent | undefined): SearchIntent;
|
|
20
|
+
export declare function normalizeMatch(match: SearchMatch | undefined): SearchMatch;
|
|
21
|
+
export declare function canUseIndexedSearchPath(indexedSearchEnabled: boolean, intent: SearchIntent, match: SearchMatch, _scope: SearchScope | undefined): boolean;
|
|
22
|
+
export declare function buildGlobRegex(pattern: string): RegExp;
|
|
23
|
+
export declare function globToSqlLike(pattern: string): string;
|
|
24
|
+
export declare function checkPackagePrefix(filePath: string, packagePrefix?: string): boolean;
|
|
25
|
+
export declare function buildSearchCursorContext(input: {
|
|
26
|
+
artifactId: string;
|
|
27
|
+
query: string;
|
|
28
|
+
intent: SearchIntent;
|
|
29
|
+
match: SearchMatch;
|
|
30
|
+
queryMode: QueryMode;
|
|
31
|
+
scope: SearchScope | undefined;
|
|
32
|
+
}): string;
|
|
33
|
+
export declare function compileRegex(query: string): RegExp;
|
|
34
|
+
export declare function findMatchIndex(target: string, query: string, match: SearchMatch, pattern?: RegExp): number;
|
|
35
|
+
/**
|
|
36
|
+
* Content-aware variant of findMatchIndex for searching within file text.
|
|
37
|
+
*/
|
|
38
|
+
export declare function findContentMatchIndex(content: string, query: string, match: SearchMatch, pattern?: RegExp): number;
|
|
39
|
+
export declare function scoreSymbolMatch(match: SearchMatch, index: number, symbolKind: SymbolKind): number;
|
|
40
|
+
export declare function scoreTextMatch(match: SearchMatch, index: number): number;
|
|
41
|
+
export declare function scorePathMatch(match: SearchMatch, index: number): number;
|
|
42
|
+
export declare function matchRegexIndex(target: string, regex: RegExp): number;
|
|
43
|
+
export declare function searchClassSource(svc: SourceService, input: SearchClassSourceInput): Promise<SearchClassSourceOutput>;
|
|
44
|
+
export declare function searchSymbolIntent(svc: SourceService, artifactId: string, query: string, match: SearchMatch, scope: SearchScope | undefined, regexPattern: RegExp | undefined, onHit: (hit: SearchSourceHit) => void): void;
|
|
45
|
+
export declare function searchTextIntentIndexed(svc: SourceService, artifactId: string, query: string, match: SearchMatch, scope: SearchScope | undefined, onHit: (hit: SearchSourceHit) => void): void;
|
|
46
|
+
export declare function searchPathIntentIndexed(svc: SourceService, artifactId: string, query: string, match: SearchMatch, scope: SearchScope | undefined, onHit: (hit: SearchSourceHit) => void): void;
|
|
47
|
+
export declare function searchTextIntent(svc: SourceService, artifactId: string, query: string, match: SearchMatch, scope: SearchScope | undefined, regexPattern: RegExp | undefined, onHit: (hit: SearchSourceHit) => void): void;
|
|
48
|
+
export declare function searchPathIntent(svc: SourceService, artifactId: string, query: string, match: SearchMatch, scope: SearchScope | undefined, regexPattern: RegExp | undefined, onHit: (hit: SearchSourceHit) => void): void;
|
|
49
|
+
export declare function findSymbolHits(svc: SourceService, artifactId: string, query: string, match: SearchMatch, scope: SearchScope | undefined, regexPattern: RegExp | undefined): IndexedSymbolHit[];
|
|
50
|
+
export declare function indexedCandidateLimit(svc: SourceService): number;
|
|
51
|
+
export declare function indexedCandidateLimitForMatch(svc: SourceService, match: SearchMatch): number;
|