@adhisang/minecraft-modding-mcp 1.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.
Files changed (106) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/LICENSE +21 -0
  3. package/README.md +765 -0
  4. package/dist/access-widener-parser.d.ts +24 -0
  5. package/dist/access-widener-parser.js +77 -0
  6. package/dist/cli.d.ts +2 -0
  7. package/dist/cli.js +4 -0
  8. package/dist/config.d.ts +27 -0
  9. package/dist/config.js +178 -0
  10. package/dist/decompiler/vineflower.d.ts +15 -0
  11. package/dist/decompiler/vineflower.js +185 -0
  12. package/dist/errors.d.ts +50 -0
  13. package/dist/errors.js +49 -0
  14. package/dist/hash.d.ts +1 -0
  15. package/dist/hash.js +12 -0
  16. package/dist/index.d.ts +7 -0
  17. package/dist/index.js +1447 -0
  18. package/dist/java-process.d.ts +16 -0
  19. package/dist/java-process.js +120 -0
  20. package/dist/logger.d.ts +3 -0
  21. package/dist/logger.js +21 -0
  22. package/dist/mapping-pipeline-service.d.ts +18 -0
  23. package/dist/mapping-pipeline-service.js +60 -0
  24. package/dist/mapping-service.d.ts +161 -0
  25. package/dist/mapping-service.js +1706 -0
  26. package/dist/maven-resolver.d.ts +22 -0
  27. package/dist/maven-resolver.js +122 -0
  28. package/dist/minecraft-explorer-service.d.ts +43 -0
  29. package/dist/minecraft-explorer-service.js +562 -0
  30. package/dist/mixin-parser.d.ts +34 -0
  31. package/dist/mixin-parser.js +194 -0
  32. package/dist/mixin-validator.d.ts +59 -0
  33. package/dist/mixin-validator.js +274 -0
  34. package/dist/mod-analyzer.d.ts +23 -0
  35. package/dist/mod-analyzer.js +346 -0
  36. package/dist/mod-decompile-service.d.ts +39 -0
  37. package/dist/mod-decompile-service.js +136 -0
  38. package/dist/mod-remap-service.d.ts +17 -0
  39. package/dist/mod-remap-service.js +186 -0
  40. package/dist/mod-search-service.d.ts +28 -0
  41. package/dist/mod-search-service.js +174 -0
  42. package/dist/mojang-tiny-mapping-service.d.ts +13 -0
  43. package/dist/mojang-tiny-mapping-service.js +351 -0
  44. package/dist/nbt/java-nbt-codec.d.ts +3 -0
  45. package/dist/nbt/java-nbt-codec.js +385 -0
  46. package/dist/nbt/json-patch.d.ts +3 -0
  47. package/dist/nbt/json-patch.js +352 -0
  48. package/dist/nbt/pipeline.d.ts +39 -0
  49. package/dist/nbt/pipeline.js +173 -0
  50. package/dist/nbt/typed-json.d.ts +10 -0
  51. package/dist/nbt/typed-json.js +205 -0
  52. package/dist/nbt/types.d.ts +66 -0
  53. package/dist/nbt/types.js +2 -0
  54. package/dist/observability.d.ts +88 -0
  55. package/dist/observability.js +165 -0
  56. package/dist/path-converter.d.ts +12 -0
  57. package/dist/path-converter.js +161 -0
  58. package/dist/path-resolver.d.ts +19 -0
  59. package/dist/path-resolver.js +78 -0
  60. package/dist/registry-service.d.ts +29 -0
  61. package/dist/registry-service.js +214 -0
  62. package/dist/repo-downloader.d.ts +15 -0
  63. package/dist/repo-downloader.js +111 -0
  64. package/dist/resources.d.ts +3 -0
  65. package/dist/resources.js +154 -0
  66. package/dist/search-hit-accumulator.d.ts +38 -0
  67. package/dist/search-hit-accumulator.js +153 -0
  68. package/dist/source-jar-reader.d.ts +13 -0
  69. package/dist/source-jar-reader.js +216 -0
  70. package/dist/source-resolver.d.ts +14 -0
  71. package/dist/source-resolver.js +274 -0
  72. package/dist/source-service.d.ts +404 -0
  73. package/dist/source-service.js +2881 -0
  74. package/dist/storage/artifacts-repo.d.ts +45 -0
  75. package/dist/storage/artifacts-repo.js +209 -0
  76. package/dist/storage/db.d.ts +14 -0
  77. package/dist/storage/db.js +132 -0
  78. package/dist/storage/files-repo.d.ts +78 -0
  79. package/dist/storage/files-repo.js +437 -0
  80. package/dist/storage/index-meta-repo.d.ts +35 -0
  81. package/dist/storage/index-meta-repo.js +97 -0
  82. package/dist/storage/migrations.d.ts +11 -0
  83. package/dist/storage/migrations.js +71 -0
  84. package/dist/storage/schema.d.ts +1 -0
  85. package/dist/storage/schema.js +160 -0
  86. package/dist/storage/sqlite.d.ts +20 -0
  87. package/dist/storage/sqlite.js +111 -0
  88. package/dist/storage/symbols-repo.d.ts +63 -0
  89. package/dist/storage/symbols-repo.js +401 -0
  90. package/dist/symbols/symbol-extractor.d.ts +7 -0
  91. package/dist/symbols/symbol-extractor.js +64 -0
  92. package/dist/tiny-remapper-resolver.d.ts +1 -0
  93. package/dist/tiny-remapper-resolver.js +62 -0
  94. package/dist/tiny-remapper-service.d.ts +16 -0
  95. package/dist/tiny-remapper-service.js +73 -0
  96. package/dist/types.d.ts +120 -0
  97. package/dist/types.js +2 -0
  98. package/dist/version-diff-service.d.ts +41 -0
  99. package/dist/version-diff-service.js +222 -0
  100. package/dist/version-service.d.ts +70 -0
  101. package/dist/version-service.js +411 -0
  102. package/dist/vineflower-resolver.d.ts +1 -0
  103. package/dist/vineflower-resolver.js +62 -0
  104. package/dist/workspace-mapping-service.d.ts +18 -0
  105. package/dist/workspace-mapping-service.js +89 -0
  106. package/package.json +61 -0
@@ -0,0 +1,274 @@
1
+ import { readdirSync } from "node:fs";
2
+ import { basename, dirname, join, resolve as resolvePath } from "node:path";
3
+ import { createError, ERROR_CODES } from "./errors.js";
4
+ import { buildRemoteBinaryUrls, buildRemoteSourceUrls, hasExistingJar, parseCoordinate, normalizedCoordinateValue } from "./maven-resolver.js";
5
+ import { defaultDownloadPath, downloadToCache } from "./repo-downloader.js";
6
+ import { artifactSignatureFromFile, normalizeJarPath } from "./path-resolver.js";
7
+ import { stableArtifactId } from "./config.js";
8
+ import { listJavaEntries } from "./source-jar-reader.js";
9
+ function readStatsSignature(filePath) {
10
+ const stats = artifactSignatureFromFile(filePath);
11
+ return stats.signature;
12
+ }
13
+ async function hasJavaSources(jarPath) {
14
+ if (!hasExistingJar(jarPath)) {
15
+ return false;
16
+ }
17
+ const entries = await listJavaEntries(jarPath);
18
+ return entries.length > 0;
19
+ }
20
+ function resolveExactJarSourceCandidate(inputJarPath) {
21
+ const directory = dirname(inputJarPath);
22
+ const jarName = basename(inputJarPath);
23
+ const base = jarName.endsWith(".jar") ? jarName.slice(0, -4) : jarName;
24
+ return join(directory, `${base}-sources.jar`);
25
+ }
26
+ function listAdjacentJarSourceCandidates(inputJarPath) {
27
+ const directory = dirname(inputJarPath);
28
+ const exact = resolveExactJarSourceCandidate(inputJarPath);
29
+ const candidates = new Set();
30
+ try {
31
+ for (const file of readdirSync(directory)) {
32
+ if (file.toLowerCase().endsWith("-sources.jar")) {
33
+ const candidate = join(directory, file);
34
+ if (candidate !== inputJarPath && candidate !== exact) {
35
+ candidates.add(candidate);
36
+ }
37
+ }
38
+ }
39
+ }
40
+ catch {
41
+ // ignore
42
+ }
43
+ return [...candidates];
44
+ }
45
+ function resolveLocalCoordinateCandidates(localM2Path, coordinate) {
46
+ const parsed = parseCoordinate(coordinate);
47
+ const groupPath = parsed.groupId.replace(/\./g, "/");
48
+ const baseDir = resolvePath(localM2Path, groupPath, parsed.artifactId, parsed.version);
49
+ const base = `${parsed.artifactId}-${parsed.version}`;
50
+ const classifierSuffix = parsed.classifier ? `-${parsed.classifier}` : "";
51
+ const direct = resolvePath(baseDir, `${base}${classifierSuffix}-sources.jar`);
52
+ const fallback = resolvePath(baseDir, `${base}-sources.jar`);
53
+ const candidates = [direct, fallback];
54
+ if (parsed.classifier) {
55
+ const prefix = `${parsed.artifactId}-${parsed.version}-${parsed.classifier}`;
56
+ candidates.push(resolvePath(baseDir, `${base}-${prefix}-sources.jar`));
57
+ }
58
+ const existing = new Set();
59
+ for (const candidate of candidates) {
60
+ if (hasExistingJar(candidate)) {
61
+ existing.add(candidate);
62
+ }
63
+ }
64
+ return [...existing];
65
+ }
66
+ function resolveRemoteBinaryCandidate(coordinate, repos) {
67
+ return buildRemoteBinaryUrls(repos, coordinate);
68
+ }
69
+ function artifactIdForJar(inputKind, artifactPath, signature, suffix) {
70
+ return stableArtifactId([inputKind, artifactPath, signature, suffix ?? "source"]);
71
+ }
72
+ function artifactIdForCoordinate(coordinate, source, signature) {
73
+ return stableArtifactId(["coord", coordinate, source, signature]);
74
+ }
75
+ function resolvedAtNow() {
76
+ return new Date().toISOString();
77
+ }
78
+ export async function resolveSourceTarget(input, options, explicitConfig) {
79
+ const repos = options.preferredRepos?.length ? options.preferredRepos : explicitConfig.sourceRepos;
80
+ let sawRemoteRepoFailure = false;
81
+ if (input.kind === "jar") {
82
+ const resolvedJarPath = normalizeJarPath(input.value);
83
+ const binarySignature = readStatsSignature(resolvedJarPath);
84
+ const exactSourceJarPath = resolveExactJarSourceCandidate(resolvedJarPath);
85
+ const adjacentSourceCandidates = listAdjacentJarSourceCandidates(resolvedJarPath);
86
+ const maybeAdjacentSourceCandidates = adjacentSourceCandidates.length > 0 ? adjacentSourceCandidates : undefined;
87
+ if (await hasJavaSources(resolvedJarPath)) {
88
+ return {
89
+ artifactId: artifactIdForJar("jar", resolvedJarPath, binarySignature),
90
+ artifactSignature: binarySignature,
91
+ origin: "local-jar",
92
+ binaryJarPath: resolvedJarPath,
93
+ sourceJarPath: resolvedJarPath,
94
+ adjacentSourceCandidates: maybeAdjacentSourceCandidates,
95
+ isDecompiled: false,
96
+ resolvedAt: resolvedAtNow()
97
+ };
98
+ }
99
+ if (await hasJavaSources(exactSourceJarPath)) {
100
+ const sourceSignature = readStatsSignature(exactSourceJarPath);
101
+ return {
102
+ artifactId: artifactIdForJar("jar", exactSourceJarPath, sourceSignature),
103
+ artifactSignature: sourceSignature,
104
+ origin: "local-jar",
105
+ binaryJarPath: resolvedJarPath,
106
+ sourceJarPath: exactSourceJarPath,
107
+ adjacentSourceCandidates: maybeAdjacentSourceCandidates,
108
+ isDecompiled: false,
109
+ resolvedAt: resolvedAtNow()
110
+ };
111
+ }
112
+ if (!options.allowDecompile) {
113
+ throw createError({
114
+ code: ERROR_CODES.SOURCE_NOT_FOUND,
115
+ message: `No source jar was found for "${input.value}" and decompile is disabled.`,
116
+ details: {
117
+ jarPath: resolvedJarPath,
118
+ adjacentSourceCandidates: maybeAdjacentSourceCandidates
119
+ }
120
+ });
121
+ }
122
+ return {
123
+ artifactId: artifactIdForJar("jar", resolvedJarPath, `${binarySignature}:decompile`),
124
+ artifactSignature: `${binarySignature}:decompile`,
125
+ origin: "decompiled",
126
+ binaryJarPath: resolvedJarPath,
127
+ adjacentSourceCandidates: maybeAdjacentSourceCandidates,
128
+ isDecompiled: true,
129
+ resolvedAt: resolvedAtNow()
130
+ };
131
+ }
132
+ if (input.kind !== "coordinate") {
133
+ throw createError({
134
+ code: ERROR_CODES.INVALID_INPUT,
135
+ message: `Unsupported input kind "${input.kind}".`,
136
+ details: { input }
137
+ });
138
+ }
139
+ const coordinate = normalizedCoordinateValue(input.value);
140
+ const isTransientFailure = (statusCode) => statusCode === undefined || statusCode >= 500 || statusCode === 429;
141
+ for (const candidate of resolveLocalCoordinateCandidates(explicitConfig.localM2Path, coordinate)) {
142
+ if (await hasJavaSources(candidate)) {
143
+ const signature = readStatsSignature(candidate);
144
+ return {
145
+ artifactId: artifactIdForCoordinate(coordinate, "local-m2", signature),
146
+ artifactSignature: signature,
147
+ origin: "local-m2",
148
+ sourceJarPath: candidate,
149
+ coordinate,
150
+ isDecompiled: false,
151
+ resolvedAt: resolvedAtNow()
152
+ };
153
+ }
154
+ }
155
+ const remoteSourceUrls = buildRemoteSourceUrls(repos, coordinate);
156
+ for (let index = 0; index < remoteSourceUrls.length; index++) {
157
+ const sourceUrl = remoteSourceUrls[index];
158
+ const hasNextAttempt = index < remoteSourceUrls.length - 1;
159
+ try {
160
+ const download = await downloadToCache(sourceUrl, defaultDownloadPath(explicitConfig.cacheDir, sourceUrl), {
161
+ retries: explicitConfig.fetchRetries,
162
+ timeoutMs: explicitConfig.fetchTimeoutMs
163
+ });
164
+ if (!download.ok || !download.path || !(await hasJavaSources(download.path))) {
165
+ const transient = download.ok
166
+ ? false
167
+ : download.statusCode !== 404 && isTransientFailure(download.statusCode);
168
+ sawRemoteRepoFailure = sawRemoteRepoFailure || transient;
169
+ if (hasNextAttempt && transient) {
170
+ options.onRepoFailover?.({
171
+ stage: "source",
172
+ repoUrl: sourceUrl,
173
+ statusCode: download.statusCode,
174
+ reason: download.ok ? "downloaded-no-sources" : "download-failed",
175
+ attempt: index + 1,
176
+ totalAttempts: remoteSourceUrls.length
177
+ });
178
+ }
179
+ continue;
180
+ }
181
+ const signature = `${download.contentLength ?? 0}:${download.etag ?? ""}:${download.lastModified ?? ""}`;
182
+ return {
183
+ artifactId: artifactIdForCoordinate(coordinate, "remote-repo", signature),
184
+ artifactSignature: signature,
185
+ origin: "remote-repo",
186
+ sourceJarPath: download.path,
187
+ coordinate,
188
+ repoUrl: sourceUrl,
189
+ isDecompiled: false,
190
+ resolvedAt: resolvedAtNow()
191
+ };
192
+ }
193
+ catch (caughtError) {
194
+ sawRemoteRepoFailure = true;
195
+ if (hasNextAttempt) {
196
+ options.onRepoFailover?.({
197
+ stage: "source",
198
+ repoUrl: sourceUrl,
199
+ reason: caughtError instanceof Error ? caughtError.message : "download-error",
200
+ attempt: index + 1,
201
+ totalAttempts: remoteSourceUrls.length
202
+ });
203
+ }
204
+ }
205
+ }
206
+ if (!options.allowDecompile) {
207
+ throw createError({
208
+ code: sawRemoteRepoFailure ? ERROR_CODES.REPO_FETCH_FAILED : ERROR_CODES.SOURCE_NOT_FOUND,
209
+ message: sawRemoteRepoFailure
210
+ ? `No source jar was found for "${coordinate}" and repository fetches were unstable.`
211
+ : `No source jar was found for "${coordinate}" and decompile is disabled.`,
212
+ details: { coordinate }
213
+ });
214
+ }
215
+ const binaryCandidates = resolveRemoteBinaryCandidate(coordinate, repos);
216
+ for (let index = 0; index < binaryCandidates.length; index++) {
217
+ const binaryUrl = binaryCandidates[index];
218
+ const hasNextAttempt = index < binaryCandidates.length - 1;
219
+ try {
220
+ const downloaded = await downloadToCache(binaryUrl, defaultDownloadPath(explicitConfig.cacheDir, binaryUrl), {
221
+ retries: explicitConfig.fetchRetries,
222
+ timeoutMs: explicitConfig.fetchTimeoutMs
223
+ });
224
+ if (!downloaded.ok || !downloaded.path) {
225
+ const transient = downloaded.ok
226
+ ? false
227
+ : downloaded.statusCode !== 404 && isTransientFailure(downloaded.statusCode);
228
+ sawRemoteRepoFailure = sawRemoteRepoFailure || transient;
229
+ if (hasNextAttempt && transient) {
230
+ options.onRepoFailover?.({
231
+ stage: "binary",
232
+ repoUrl: binaryUrl,
233
+ statusCode: downloaded.statusCode,
234
+ reason: downloaded.ok ? "downloaded-no-binary" : "download-failed",
235
+ attempt: index + 1,
236
+ totalAttempts: binaryCandidates.length
237
+ });
238
+ }
239
+ continue;
240
+ }
241
+ const signature = readStatsSignature(downloaded.path);
242
+ return {
243
+ artifactId: artifactIdForCoordinate(coordinate, "decompiled", signature),
244
+ artifactSignature: signature,
245
+ origin: "decompiled",
246
+ binaryJarPath: downloaded.path,
247
+ coordinate,
248
+ repoUrl: binaryUrl,
249
+ isDecompiled: true,
250
+ resolvedAt: resolvedAtNow()
251
+ };
252
+ }
253
+ catch (caughtError) {
254
+ sawRemoteRepoFailure = true;
255
+ if (hasNextAttempt) {
256
+ options.onRepoFailover?.({
257
+ stage: "binary",
258
+ repoUrl: binaryUrl,
259
+ reason: caughtError instanceof Error ? caughtError.message : "download-error",
260
+ attempt: index + 1,
261
+ totalAttempts: binaryCandidates.length
262
+ });
263
+ }
264
+ }
265
+ }
266
+ throw createError({
267
+ code: sawRemoteRepoFailure ? ERROR_CODES.REPO_FETCH_FAILED : ERROR_CODES.SOURCE_NOT_FOUND,
268
+ message: sawRemoteRepoFailure
269
+ ? `No source or binary artifact was found for "${coordinate}" due to unstable repository responses.`
270
+ : `No source or binary artifact was found for "${coordinate}".`,
271
+ details: { coordinate }
272
+ });
273
+ }
274
+ //# sourceMappingURL=source-resolver.js.map
@@ -0,0 +1,404 @@
1
+ import { type ResponseContext as ExplorerResponseContext, type SignatureMember } from "./minecraft-explorer-service.js";
2
+ import { type MixinValidationResult, type AccessWidenerValidationResult } from "./mixin-validator.js";
3
+ import { type ClassApiMatrixInput as MappingClassApiMatrixInput, type ClassApiMatrixOutput as MappingClassApiMatrixOutput, type FindMappingInput as MappingFindMappingInput, type FindMappingOutput as MappingFindMappingOutput, type ResolveMethodMappingExactInput as MappingResolveMethodMappingExactInput, type ResolveMethodMappingExactOutput as MappingResolveMethodMappingExactOutput, type SymbolResolutionOutput as MappingSymbolResolutionOutput, type SymbolExistenceInput as MappingSymbolExistenceInput, type SymbolExistenceOutput as MappingSymbolExistenceOutput } from "./mapping-service.js";
4
+ import { RuntimeMetrics, type RuntimeMetricSnapshot } from "./observability.js";
5
+ import { type WorkspaceCompileMappingOutput } from "./workspace-mapping-service.js";
6
+ import type { ArtifactProvenance, ArtifactRow, Config, MappingSourcePriority, ResolvedSourceArtifact, SourceMapping, SourceTargetInput } from "./types.js";
7
+ import { type ListVersionsInput, type ListVersionsOutput } from "./version-service.js";
8
+ import { type GetRegistryDataInput, type GetRegistryDataOutput } from "./registry-service.js";
9
+ import { type CompareVersionsInput, type CompareVersionsOutput } from "./version-diff-service.js";
10
+ import { type DecompileModJarInput, type DecompileModJarOutput, type GetModClassSourceInput, type GetModClassSourceOutput } from "./mod-decompile-service.js";
11
+ import { type SearchModSourceInput, type SearchModSourceOutput } from "./mod-search-service.js";
12
+ export type ResolveArtifactInput = {
13
+ target: SourceTargetInput;
14
+ mapping?: SourceMapping;
15
+ sourcePriority?: MappingSourcePriority;
16
+ allowDecompile?: boolean;
17
+ };
18
+ export type ResolveArtifactOutput = {
19
+ artifactId: string;
20
+ origin: "local-jar" | "local-m2" | "remote-repo" | "decompiled";
21
+ isDecompiled: boolean;
22
+ resolvedSourceJarPath?: string;
23
+ adjacentSourceCandidates?: string[];
24
+ binaryJarPath?: string;
25
+ coordinate?: string;
26
+ version?: string;
27
+ requestedMapping: SourceMapping;
28
+ mappingApplied: SourceMapping;
29
+ provenance: ArtifactProvenance;
30
+ qualityFlags: string[];
31
+ repoUrl?: string;
32
+ warnings: string[];
33
+ };
34
+ type SymbolKind = "class" | "interface" | "enum" | "record" | "method" | "field";
35
+ type SearchIntent = "symbol" | "text" | "path";
36
+ type SearchMatch = "exact" | "prefix" | "contains" | "regex";
37
+ export type SearchScope = {
38
+ packagePrefix?: string;
39
+ fileGlob?: string;
40
+ symbolKind?: SymbolKind;
41
+ };
42
+ export type SearchInclude = {
43
+ snippetLines?: number;
44
+ includeDefinition?: boolean;
45
+ includeOneHop?: boolean;
46
+ };
47
+ export type SearchResultSymbol = {
48
+ symbolKind: SymbolKind;
49
+ symbolName: string;
50
+ qualifiedName?: string;
51
+ line: number;
52
+ };
53
+ export type SearchSourceHit = {
54
+ filePath: string;
55
+ score: number;
56
+ matchedIn: "symbol" | "path" | "content";
57
+ startLine: number;
58
+ endLine: number;
59
+ snippet: string;
60
+ reasonCodes: string[];
61
+ symbol?: SearchResultSymbol;
62
+ };
63
+ export type SearchRelation = {
64
+ fromSymbol: {
65
+ symbolKind: SymbolKind;
66
+ symbolName: string;
67
+ filePath: string;
68
+ line: number;
69
+ };
70
+ toSymbol: {
71
+ symbolKind: SymbolKind;
72
+ symbolName: string;
73
+ filePath: string;
74
+ line: number;
75
+ };
76
+ relation: "calls" | "uses-type" | "imports";
77
+ };
78
+ export type SearchClassSourceInput = {
79
+ artifactId: string;
80
+ query: string;
81
+ intent?: SearchIntent;
82
+ match?: SearchMatch;
83
+ scope?: SearchScope;
84
+ include?: SearchInclude;
85
+ limit?: number;
86
+ cursor?: string;
87
+ };
88
+ export type SearchClassSourceOutput = {
89
+ hits: SearchSourceHit[];
90
+ relations?: SearchRelation[];
91
+ nextCursor?: string;
92
+ totalApprox: number;
93
+ mappingApplied: SourceMapping;
94
+ };
95
+ export type GetArtifactFileInput = {
96
+ artifactId: string;
97
+ filePath: string;
98
+ maxBytes?: number;
99
+ };
100
+ export type GetArtifactFileOutput = {
101
+ filePath: string;
102
+ content: string;
103
+ contentBytes: number;
104
+ truncated: boolean;
105
+ mappingApplied: SourceMapping;
106
+ };
107
+ export type ListArtifactFilesInput = {
108
+ artifactId: string;
109
+ prefix?: string;
110
+ limit?: number;
111
+ cursor?: string;
112
+ };
113
+ export type ListArtifactFilesOutput = {
114
+ items: string[];
115
+ nextCursor?: string;
116
+ mappingApplied: SourceMapping;
117
+ };
118
+ export type FindMappingInput = MappingFindMappingInput;
119
+ export type FindMappingOutput = MappingFindMappingOutput;
120
+ export type ResolveMethodMappingExactInput = MappingResolveMethodMappingExactInput;
121
+ export type ResolveMethodMappingExactOutput = MappingResolveMethodMappingExactOutput;
122
+ export type GetClassApiMatrixInput = MappingClassApiMatrixInput;
123
+ export type GetClassApiMatrixOutput = MappingClassApiMatrixOutput;
124
+ export type CheckSymbolExistsInput = MappingSymbolExistenceInput;
125
+ export type CheckSymbolExistsOutput = MappingSymbolExistenceOutput;
126
+ export type WorkspaceSymbolKind = "class" | "field" | "method";
127
+ export type ResolveWorkspaceSymbolInput = {
128
+ projectPath: string;
129
+ version: string;
130
+ kind: WorkspaceSymbolKind;
131
+ name: string;
132
+ owner?: string;
133
+ descriptor?: string;
134
+ sourceMapping: SourceMapping;
135
+ sourcePriority?: MappingSourcePriority;
136
+ };
137
+ export type ResolveWorkspaceSymbolOutput = MappingSymbolResolutionOutput & {
138
+ workspaceDetection: WorkspaceCompileMappingOutput;
139
+ };
140
+ export type GetClassSourceInput = {
141
+ artifactId?: string;
142
+ target?: SourceTargetInput;
143
+ className: string;
144
+ mapping?: SourceMapping;
145
+ sourcePriority?: MappingSourcePriority;
146
+ allowDecompile?: boolean;
147
+ startLine?: number;
148
+ endLine?: number;
149
+ maxLines?: number;
150
+ };
151
+ export type GetClassSourceOutput = {
152
+ className: string;
153
+ sourceText: string;
154
+ totalLines: number;
155
+ returnedRange: {
156
+ start: number;
157
+ end: number;
158
+ };
159
+ truncated: boolean;
160
+ origin: ResolvedSourceArtifact["origin"];
161
+ artifactId: string;
162
+ requestedMapping: SourceMapping;
163
+ mappingApplied: SourceMapping;
164
+ provenance: ArtifactProvenance;
165
+ qualityFlags: string[];
166
+ warnings: string[];
167
+ };
168
+ type MemberAccess = "public" | "all";
169
+ export type GetClassMembersInput = {
170
+ artifactId?: string;
171
+ target?: SourceTargetInput;
172
+ className: string;
173
+ mapping?: SourceMapping;
174
+ sourcePriority?: MappingSourcePriority;
175
+ allowDecompile?: boolean;
176
+ access?: MemberAccess;
177
+ includeSynthetic?: boolean;
178
+ includeInherited?: boolean;
179
+ memberPattern?: string;
180
+ maxMembers?: number;
181
+ };
182
+ export type GetClassMembersOutput = {
183
+ className: string;
184
+ members: {
185
+ constructors: SignatureMember[];
186
+ fields: SignatureMember[];
187
+ methods: SignatureMember[];
188
+ };
189
+ counts: {
190
+ constructors: number;
191
+ fields: number;
192
+ methods: number;
193
+ total: number;
194
+ };
195
+ truncated: boolean;
196
+ context: ExplorerResponseContext;
197
+ origin: ResolvedSourceArtifact["origin"];
198
+ artifactId: string;
199
+ requestedMapping: SourceMapping;
200
+ mappingApplied: SourceMapping;
201
+ provenance: ArtifactProvenance;
202
+ qualityFlags: string[];
203
+ warnings: string[];
204
+ };
205
+ export type TraceSymbolLifecycleInput = {
206
+ symbol: string;
207
+ descriptor?: string;
208
+ fromVersion?: string;
209
+ toVersion?: string;
210
+ mapping?: SourceMapping;
211
+ sourcePriority?: MappingSourcePriority;
212
+ includeSnapshots?: boolean;
213
+ maxVersions?: number;
214
+ includeTimeline?: boolean;
215
+ };
216
+ export type TraceSymbolLifecycleTimelineEntry = {
217
+ version: string;
218
+ exists: boolean;
219
+ reason?: "class-not-found" | "descriptor-mismatch" | "unresolved";
220
+ };
221
+ export type TraceSymbolLifecycleOutput = {
222
+ query: {
223
+ className: string;
224
+ methodName: string;
225
+ descriptor?: string;
226
+ mapping: SourceMapping;
227
+ };
228
+ range: {
229
+ fromVersion: string;
230
+ toVersion: string;
231
+ scannedCount: number;
232
+ };
233
+ presence: {
234
+ firstSeen?: string;
235
+ lastSeen?: string;
236
+ missingBetween: string[];
237
+ existsNow: boolean;
238
+ };
239
+ timeline?: TraceSymbolLifecycleTimelineEntry[];
240
+ warnings: string[];
241
+ };
242
+ type DiffClassChange = "added" | "removed" | "present_in_both" | "absent_in_both";
243
+ type DiffMemberChangedField = "accessFlags" | "isSynthetic" | "javaSignature" | "jvmDescriptor";
244
+ export type DiffMember = SignatureMember;
245
+ export type DiffMemberChange = {
246
+ key: string;
247
+ from: DiffMember;
248
+ to: DiffMember;
249
+ changed: DiffMemberChangedField[];
250
+ };
251
+ export type DiffClassMemberDelta = {
252
+ added: DiffMember[];
253
+ removed: DiffMember[];
254
+ modified: DiffMemberChange[];
255
+ };
256
+ export type DiffClassSignaturesInput = {
257
+ className: string;
258
+ fromVersion: string;
259
+ toVersion: string;
260
+ mapping?: SourceMapping;
261
+ sourcePriority?: MappingSourcePriority;
262
+ };
263
+ export type DiffClassSignaturesOutput = {
264
+ query: {
265
+ className: string;
266
+ fromVersion: string;
267
+ toVersion: string;
268
+ mapping: SourceMapping;
269
+ };
270
+ range: {
271
+ fromVersion: string;
272
+ toVersion: string;
273
+ };
274
+ classChange: DiffClassChange;
275
+ constructors: DiffClassMemberDelta;
276
+ methods: DiffClassMemberDelta;
277
+ fields: DiffClassMemberDelta;
278
+ summary: {
279
+ constructors: {
280
+ added: number;
281
+ removed: number;
282
+ modified: number;
283
+ };
284
+ methods: {
285
+ added: number;
286
+ removed: number;
287
+ modified: number;
288
+ };
289
+ fields: {
290
+ added: number;
291
+ removed: number;
292
+ modified: number;
293
+ };
294
+ total: {
295
+ added: number;
296
+ removed: number;
297
+ modified: number;
298
+ };
299
+ };
300
+ warnings: string[];
301
+ };
302
+ export type IndexArtifactInput = {
303
+ artifactId: string;
304
+ force?: boolean;
305
+ };
306
+ type IndexRebuildReason = "force" | "missing_meta" | "schema_mismatch" | "signature_mismatch" | "already_current";
307
+ export type IndexArtifactOutput = {
308
+ artifactId: string;
309
+ reindexed: boolean;
310
+ reason: IndexRebuildReason;
311
+ counts: {
312
+ files: number;
313
+ symbols: number;
314
+ ftsRows: number;
315
+ };
316
+ indexedAt: string;
317
+ durationMs: number;
318
+ mappingApplied: SourceMapping;
319
+ };
320
+ export type ValidateMixinInput = {
321
+ source: string;
322
+ version: string;
323
+ mapping?: SourceMapping;
324
+ sourcePriority?: MappingSourcePriority;
325
+ };
326
+ export type ValidateMixinOutput = MixinValidationResult;
327
+ export type ValidateAccessWidenerInput = {
328
+ content: string;
329
+ version: string;
330
+ mapping?: SourceMapping;
331
+ sourcePriority?: MappingSourcePriority;
332
+ };
333
+ export type ValidateAccessWidenerOutput = AccessWidenerValidationResult;
334
+ export declare class SourceService {
335
+ private readonly config;
336
+ private readonly db;
337
+ private readonly artifactsRepo;
338
+ private readonly filesRepo;
339
+ private readonly indexMetaRepo;
340
+ private readonly symbolsRepo;
341
+ private readonly metrics;
342
+ private readonly versionService;
343
+ private readonly mappingService;
344
+ private readonly workspaceMappingService;
345
+ private readonly explorerService;
346
+ private readonly registryService;
347
+ private readonly versionDiffService;
348
+ private readonly modDecompileService;
349
+ private readonly modSearchService;
350
+ constructor(explicitConfig?: Config, metrics?: RuntimeMetrics);
351
+ resolveArtifact(input: ResolveArtifactInput): Promise<ResolveArtifactOutput>;
352
+ searchClassSource(input: SearchClassSourceInput): Promise<SearchClassSourceOutput>;
353
+ getArtifactFile(input: GetArtifactFileInput): Promise<GetArtifactFileOutput>;
354
+ listArtifactFiles(input: ListArtifactFilesInput): Promise<ListArtifactFilesOutput>;
355
+ listVersions(input?: ListVersionsInput): Promise<ListVersionsOutput>;
356
+ getRegistryData(input: GetRegistryDataInput): Promise<GetRegistryDataOutput>;
357
+ compareVersions(input: CompareVersionsInput): Promise<CompareVersionsOutput>;
358
+ decompileModJar(input: DecompileModJarInput): Promise<DecompileModJarOutput>;
359
+ getModClassSource(input: GetModClassSourceInput): Promise<GetModClassSourceOutput>;
360
+ searchModSource(input: SearchModSourceInput): Promise<SearchModSourceOutput>;
361
+ findMapping(input: FindMappingInput): Promise<FindMappingOutput>;
362
+ resolveMethodMappingExact(input: ResolveMethodMappingExactInput): Promise<ResolveMethodMappingExactOutput>;
363
+ getClassApiMatrix(input: GetClassApiMatrixInput): Promise<GetClassApiMatrixOutput>;
364
+ checkSymbolExists(input: CheckSymbolExistsInput): Promise<CheckSymbolExistsOutput>;
365
+ resolveWorkspaceSymbol(input: ResolveWorkspaceSymbolInput): Promise<ResolveWorkspaceSymbolOutput>;
366
+ traceSymbolLifecycle(input: TraceSymbolLifecycleInput): Promise<TraceSymbolLifecycleOutput>;
367
+ diffClassSignatures(input: DiffClassSignaturesInput): Promise<DiffClassSignaturesOutput>;
368
+ getClassSource(input: GetClassSourceInput): Promise<GetClassSourceOutput>;
369
+ getClassMembers(input: GetClassMembersInput): Promise<GetClassMembersOutput>;
370
+ validateMixin(input: ValidateMixinInput): Promise<ValidateMixinOutput>;
371
+ validateAccessWidener(input: ValidateAccessWidenerInput): Promise<ValidateAccessWidenerOutput>;
372
+ getRuntimeMetrics(): RuntimeMetricSnapshot;
373
+ indexArtifact(input: IndexArtifactInput): Promise<IndexArtifactOutput>;
374
+ private searchSymbolIntent;
375
+ private searchTextIntentIndexed;
376
+ private searchPathIntentIndexed;
377
+ private searchTextIntent;
378
+ private searchPathIntent;
379
+ private findSymbolHits;
380
+ private loadScopedFilePaths;
381
+ private indexedCandidateLimit;
382
+ private indexedCandidateLimitForMatch;
383
+ private resolveClassFilePath;
384
+ private findNearestSymbolForLine;
385
+ private findNearestSymbolFromList;
386
+ private buildOneHopRelations;
387
+ private buildProvenance;
388
+ private buildFallbackProvenance;
389
+ private resolveToOfficialClassName;
390
+ private resolveToOfficialMemberName;
391
+ private remapSignatureMembers;
392
+ private fallbackArtifactSignature;
393
+ private resolveIndexRebuildReason;
394
+ private toResolvedArtifact;
395
+ private rebuildAndPersistArtifactIndex;
396
+ private buildRebuiltArtifactData;
397
+ getArtifact(artifactId: string): ArtifactRow;
398
+ private ingestIfNeeded;
399
+ private loadFromSourceJar;
400
+ private hasAnyFiles;
401
+ private enforceCacheLimits;
402
+ private refreshCacheMetrics;
403
+ }
404
+ export {};