@adhisang/minecraft-modding-mcp 6.2.0 → 7.0.0-rc.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 (98) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/README.md +21 -5
  3. package/dist/cache-policy.d.ts +71 -0
  4. package/dist/cache-policy.js +83 -0
  5. package/dist/cache-registry.js +6 -6
  6. package/dist/cli.js +74 -3
  7. package/dist/compat-stdio-transport.d.ts +1 -1
  8. package/dist/compat-stdio-transport.js +13 -1
  9. package/dist/config.d.ts +3 -0
  10. package/dist/config.js +8 -2
  11. package/dist/decompiler/vineflower.d.ts +1 -0
  12. package/dist/decompiler/vineflower.js +8 -5
  13. package/dist/entry-tools/analyze-mod-service.d.ts +70 -136
  14. package/dist/entry-tools/analyze-symbol-service.d.ts +112 -150
  15. package/dist/entry-tools/compare-minecraft-service.d.ts +59 -145
  16. package/dist/entry-tools/entry-tool-schema.d.ts +38 -4
  17. package/dist/entry-tools/entry-tool-schema.js +4 -1
  18. package/dist/entry-tools/inspect-minecraft/internal.d.ts +235 -799
  19. package/dist/entry-tools/inspect-minecraft/internal.js +65 -28
  20. package/dist/entry-tools/inspect-minecraft-service.d.ts +372 -1736
  21. package/dist/entry-tools/inspect-minecraft-service.js +1 -1
  22. package/dist/entry-tools/manage-cache-service.d.ts +81 -91
  23. package/dist/entry-tools/validate-project/cases/project-summary.d.ts +7 -7
  24. package/dist/entry-tools/validate-project-service.d.ts +164 -592
  25. package/dist/entry-tools/verify-mixin-target-service.d.ts +3 -19
  26. package/dist/era-classifier.d.ts +161 -0
  27. package/dist/era-classifier.js +292 -0
  28. package/dist/error-mapping.js +9 -2
  29. package/dist/index.d.ts +42 -4
  30. package/dist/index.js +637 -475
  31. package/dist/java-process.d.ts +2 -0
  32. package/dist/java-process.js +22 -2
  33. package/dist/json-rpc-framing.d.ts +77 -1
  34. package/dist/json-rpc-framing.js +249 -13
  35. package/dist/mapping/loaders/tiny-loom-selection.d.ts +88 -0
  36. package/dist/mapping/loaders/tiny-loom-selection.js +223 -0
  37. package/dist/mapping/loaders/tiny-loom.js +45 -33
  38. package/dist/mapping/loaders/tiny-maven.js +6 -11
  39. package/dist/mapping/parsers/tiny.d.ts +57 -0
  40. package/dist/mapping/parsers/tiny.js +99 -22
  41. package/dist/mapping-service.d.ts +19 -0
  42. package/dist/mapping-service.js +93 -9
  43. package/dist/mcp-helpers.d.ts +19 -2
  44. package/dist/mcp-helpers.js +48 -6
  45. package/dist/minecraft-explorer-service.d.ts +1 -1
  46. package/dist/mixin/types.d.ts +8 -0
  47. package/dist/mod-analyzer.js +7 -7
  48. package/dist/mod-decompile-service.js +1 -0
  49. package/dist/nbt/java-nbt-codec.js +12 -2
  50. package/dist/nbt/json-patch.js +14 -3
  51. package/dist/nbt/pipeline.js +40 -3
  52. package/dist/nbt/typed-json.js +26 -1
  53. package/dist/registration-adapter.d.ts +32 -0
  54. package/dist/registration-adapter.js +52 -0
  55. package/dist/request-context.d.ts +7 -0
  56. package/dist/request-context.js +9 -0
  57. package/dist/resources.d.ts +1 -1
  58. package/dist/resources.js +25 -19
  59. package/dist/server-identity.d.ts +27 -0
  60. package/dist/server-identity.js +26 -0
  61. package/dist/source/access-validate.js +53 -0
  62. package/dist/source/artifact-resolver.d.ts +69 -1
  63. package/dist/source/artifact-resolver.js +215 -14
  64. package/dist/source/class-source.d.ts +22 -0
  65. package/dist/source/class-source.js +162 -29
  66. package/dist/source/did-you-mean.d.ts +12 -1
  67. package/dist/source/did-you-mean.js +6 -2
  68. package/dist/source/file-access.js +150 -46
  69. package/dist/source/indexer.js +1 -0
  70. package/dist/source/nested-jars.d.ts +19 -0
  71. package/dist/source/nested-jars.js +90 -21
  72. package/dist/source/shared-utils.d.ts +21 -0
  73. package/dist/source/shared-utils.js +23 -0
  74. package/dist/source-service.d.ts +12 -0
  75. package/dist/source-service.js +3 -0
  76. package/dist/stdio-supervisor.d.ts +357 -2
  77. package/dist/stdio-supervisor.js +1031 -80
  78. package/dist/storage/db.d.ts +2 -1
  79. package/dist/storage/db.js +15 -8
  80. package/dist/synthetic-decorator.d.ts +24 -0
  81. package/dist/synthetic-decorator.js +48 -0
  82. package/dist/tool-contract-manifest.js +1 -1
  83. package/dist/tool-guidance.d.ts +17 -1
  84. package/dist/tool-guidance.js +417 -13
  85. package/dist/tool-schema-registry.d.ts +2 -0
  86. package/dist/tool-schema-registry.js +4 -0
  87. package/dist/tool-schemas.d.ts +2214 -3915
  88. package/dist/tool-schemas.js +34 -7
  89. package/dist/types.d.ts +35 -0
  90. package/dist/v1-parity-schemas.d.ts +7 -0
  91. package/dist/v1-parity-schemas.js +5584 -0
  92. package/dist/version-diff-service.d.ts +33 -0
  93. package/dist/version-diff-service.js +148 -3
  94. package/dist/version-service.js +36 -14
  95. package/dist/warning-details.js +18 -1
  96. package/docs/README-ja.md +9 -3
  97. package/docs/tool-reference.md +267 -22
  98. package/package.json +12 -9
@@ -29,7 +29,30 @@ export const DECODE_COMPRESSIONS = ["none", "gzip", "auto"];
29
29
  export const ENCODE_COMPRESSIONS = ["none", "gzip"];
30
30
  export const nonEmptyString = z.string().trim().min(1);
31
31
  export const optionalNonEmptyString = z.string().trim().min(1).optional();
32
- export const optionalPositiveInt = z.number().int().positive().optional();
32
+ /**
33
+ * zod3-parity integer check. zod3's `.int()` accepted every `Number.isInteger`
34
+ * value — including unsafe integers beyond 2^53, which downstream code clamps
35
+ * (e.g. src/version-service.ts) — while zod4's `.int()` rejects unsafe
36
+ * integers with a `too_big` issue, silently narrowing the frozen public
37
+ * acceptance contract. This check restores the exact zod3 acceptance domain
38
+ * and pushes a stock-zod4-shaped `invalid_type` issue for non-integer numbers
39
+ * so the ProblemDetails parity layer (src/tool-guidance.ts) maps it to zod3's
40
+ * exact "Expected integer, received float" bytes. `continue: true` mirrors
41
+ * zod3's non-aborting number checks (later min/max checks still report).
42
+ * Public zod API only: no zod internals, no z.config globals.
43
+ */
44
+ export const zod3ParityIntCheck = (payload) => {
45
+ if (!Number.isInteger(payload.value)) {
46
+ payload.issues.push({
47
+ code: "invalid_type",
48
+ expected: "int",
49
+ input: payload.value,
50
+ message: "Invalid input: expected int, received number",
51
+ continue: true
52
+ });
53
+ }
54
+ };
55
+ export const optionalPositiveInt = z.number().check(zod3ParityIntCheck).positive().optional();
33
56
  export const gradleUserHomeSchema = optionalNonEmptyString.describe("Gradle user home for Loom cache lookups (overrides GRADLE_USER_HOME).");
34
57
  // Optional descriptor: "" and whitespace-only strings are normalized to undefined so that
35
58
  // tools with signatureMode="name-only" can accept "caller omitted descriptor" inputs whether
@@ -224,7 +247,7 @@ export const batchClassSourceShape = {
224
247
  scope: artifactScopeSchema.optional(),
225
248
  preferProjectVersion: z.boolean().optional(),
226
249
  strictVersion: z.boolean().optional(),
227
- concurrency: z.number().int().min(1).max(8).optional().describe("1..8, default 4"),
250
+ concurrency: z.number().check(zod3ParityIntCheck).min(1).max(8).optional().describe("1..8, default 4"),
228
251
  failFast: z.boolean().optional().describe("default false"),
229
252
  detail: detailParam("summary"),
230
253
  include: responseIncludeParam,
@@ -280,7 +303,7 @@ export const batchClassMembersShape = {
280
303
  scope: artifactScopeSchema.optional(),
281
304
  preferProjectVersion: z.boolean().optional(),
282
305
  strictVersion: z.boolean().optional(),
283
- concurrency: z.number().int().min(1).max(8).optional(),
306
+ concurrency: z.number().check(zod3ParityIntCheck).min(1).max(8).optional(),
284
307
  failFast: z.boolean().optional(),
285
308
  detail: detailParam("summary"),
286
309
  projection: memberProjectionSchema.optional().describe(MEMBER_PROJECTION_DESCRIPTION),
@@ -311,7 +334,7 @@ export const batchSymbolExistsShape = {
311
334
  scope: artifactScopeSchema.optional(),
312
335
  preferProjectVersion: z.boolean().optional(),
313
336
  strictVersion: z.boolean().optional(),
314
- concurrency: z.number().int().min(1).max(8).optional(),
337
+ concurrency: z.number().check(zod3ParityIntCheck).min(1).max(8).optional(),
315
338
  failFast: z.boolean().optional(),
316
339
  detail: detailParam("summary"),
317
340
  include: responseIncludeParam,
@@ -342,7 +365,7 @@ export const batchMappingsShape = {
342
365
  sourcePriority: mappingSourcePrioritySchema.optional(),
343
366
  projectPath: optionalNonEmptyString,
344
367
  gradleUserHome: gradleUserHomeSchema,
345
- concurrency: z.number().int().min(1).max(8).optional(),
368
+ concurrency: z.number().check(zod3ParityIntCheck).min(1).max(8).optional(),
346
369
  failFast: z.boolean().optional(),
347
370
  detail: detailParam("summary"),
348
371
  include: responseIncludeParam,
@@ -371,6 +394,7 @@ export const findClassShape = {
371
394
  className: nonEmptyString.describe("Simple name (e.g. Blocks) or fully-qualified name (e.g. net.minecraft.world.level.block.Blocks)"),
372
395
  artifactId: optionalNonEmptyString,
373
396
  target: sourceLookupTargetSchema.optional().describe(SOURCE_LOOKUP_TARGET_DESCRIPTION),
397
+ projectPath: optionalNonEmptyString.describe("Workspace root for dependency or workspace target resolution."),
374
398
  limit: optionalPositiveInt.describe("default 20, max 200")
375
399
  };
376
400
  export const findClassSchema = z.object(findClassShape).superRefine(requireExactlyOneArtifactRef);
@@ -739,12 +763,15 @@ const nbtPatchOperationSchema = z
739
763
  })
740
764
  .passthrough();
741
765
  export const nbtApplyJsonPatchShape = {
742
- typedJson: z.unknown(),
766
+ // zod4 makes bare z.unknown() members presence-required; zod3 accepted a
767
+ // missing key (handler saw undefined). .optional() restores that contract.
768
+ typedJson: z.unknown().optional(),
743
769
  patch: z.array(nbtPatchOperationSchema).describe("RFC6902 operation array (add/remove/replace/test)")
744
770
  };
745
771
  export const nbtApplyJsonPatchSchema = z.object(nbtApplyJsonPatchShape);
746
772
  export const jsonToNbtShape = {
747
- typedJson: z.unknown(),
773
+ // Same zod4 presence-required restoration as nbtApplyJsonPatchShape above.
774
+ typedJson: z.unknown().optional(),
748
775
  compression: encodeCompressionSchema.default("none")
749
776
  };
750
777
  export const jsonToNbtSchema = z.object(jsonToNbtShape);
package/dist/types.d.ts CHANGED
@@ -99,10 +99,42 @@ export interface ArtifactProvenance {
99
99
  * lost to single-jar selection.
100
100
  */
101
101
  companionSourceJars?: string[];
102
+ /**
103
+ * Set when the resolver had to serve a jar built for a DIFFERENT Minecraft
104
+ * version than the caller asked for.
105
+ *
106
+ * Provenance used to echo the requested version here while the served jar was
107
+ * another version entirely, so nothing in the response could distinguish an
108
+ * exact hit from a fallback except a quality flag.
109
+ */
110
+ versionApproximation?: {
111
+ requestedVersion: string;
112
+ servedVersion?: string;
113
+ sourceJarPath: string;
114
+ };
102
115
  }
116
+ /** Mod loader a runtime jar belongs to, inferred from its cache path. */
117
+ export type RuntimeLoader = "fabric" | "forge" | "neoforge" | "unknown";
103
118
  export interface RuntimeValidationProvenance<TMapping extends RuntimeValidationNamespace = RuntimeValidationNamespace> {
119
+ /**
120
+ * The Minecraft version the served jar ACTUALLY carries.
121
+ *
122
+ * This used to echo the requested version even when a fallback served a
123
+ * different one, so a Fabric 1.21.11 access widener could be validated
124
+ * against a NeoForge 1.21.10 jar while provenance still claimed 1.21.11.
125
+ */
104
126
  version: string;
105
127
  jarPath: string;
128
+ /** Set only when the served jar is a DIFFERENT version than the caller asked for. */
129
+ requestedVersion?: string;
130
+ /** True whenever `requestedVersion` is present. */
131
+ versionApproximated?: boolean;
132
+ /** Loader the served jar belongs to, read from its path. */
133
+ servedLoader?: RuntimeLoader;
134
+ /** Loader the caller's workspace (or the file format) implies. */
135
+ expectedLoader?: RuntimeLoader;
136
+ /** True when `servedLoader` contradicts a KNOWN `expectedLoader`. */
137
+ loaderMismatch?: boolean;
106
138
  requestedScope?: ArtifactScope;
107
139
  appliedScope?: ArtifactScope;
108
140
  requestedMapping: TMapping;
@@ -143,9 +175,12 @@ export interface Config {
143
175
  maxNbtInputBytes: number;
144
176
  maxNbtInflatedBytes: number;
145
177
  maxNbtResponseBytes: number;
178
+ sqliteCacheKb: number;
179
+ sqliteMmapSize: number;
146
180
  tinyRemapperJarPath: string | undefined;
147
181
  remapTimeoutMs: number;
148
182
  remapMaxMemoryMb: number;
183
+ decompileMaxMemoryMb: number;
149
184
  }
150
185
  export interface ArtifactSignature {
151
186
  sourcePath: string;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Pre-migration (MCP SDK v1) advertised inputSchema per tool, keyed by tool
3
+ * name. Served verbatim through the registration adapter's jsonSchema
4
+ * Converter so tools/list advertisement stays byte-identical across the
5
+ * v1 -> v2 migration.
6
+ */
7
+ export declare const V1_PARITY_SCHEMAS: Readonly<Record<string, Record<string, unknown>>>;