@adhisang/minecraft-modding-mcp 4.2.1 → 6.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 (144) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/README.md +5 -4
  3. package/dist/access-transformer-parser.d.ts +2 -1
  4. package/dist/access-transformer-parser.js +10 -1
  5. package/dist/access-widener-parser.d.ts +1 -0
  6. package/dist/access-widener-parser.js +6 -3
  7. package/dist/build-suggested-call.js +31 -10
  8. package/dist/cache-registry.d.ts +8 -0
  9. package/dist/cache-registry.js +50 -32
  10. package/dist/config.d.ts +1 -0
  11. package/dist/config.js +4 -0
  12. package/dist/decompiler/vineflower.js +8 -2
  13. package/dist/entry-tools/analyze-mod-service.d.ts +24 -24
  14. package/dist/entry-tools/analyze-mod-service.js +2 -1
  15. package/dist/entry-tools/analyze-symbol-service.d.ts +57 -22
  16. package/dist/entry-tools/analyze-symbol-service.js +139 -34
  17. package/dist/entry-tools/batch-class-members-service.d.ts +3 -1
  18. package/dist/entry-tools/batch-class-members-service.js +6 -6
  19. package/dist/entry-tools/batch-class-source-service.d.ts +3 -1
  20. package/dist/entry-tools/batch-class-source-service.js +5 -6
  21. package/dist/entry-tools/batch-mappings-service.d.ts +3 -1
  22. package/dist/entry-tools/batch-mappings-service.js +4 -5
  23. package/dist/entry-tools/batch-symbol-exists-service.d.ts +3 -1
  24. package/dist/entry-tools/batch-symbol-exists-service.js +4 -5
  25. package/dist/entry-tools/compare-minecraft-service.d.ts +10 -10
  26. package/dist/entry-tools/compare-minecraft-service.js +1 -1
  27. package/dist/entry-tools/entry-tool-schema.d.ts +1 -1
  28. package/dist/entry-tools/inspect-minecraft/handlers/artifact.js +1 -3
  29. package/dist/entry-tools/inspect-minecraft/handlers/class-members.js +4 -3
  30. package/dist/entry-tools/inspect-minecraft/handlers/class-overview.js +0 -5
  31. package/dist/entry-tools/inspect-minecraft/handlers/class-source.js +0 -1
  32. package/dist/entry-tools/inspect-minecraft/handlers/file.js +26 -2
  33. package/dist/entry-tools/inspect-minecraft/handlers/list-files.js +0 -1
  34. package/dist/entry-tools/inspect-minecraft/handlers/search.d.ts +8 -0
  35. package/dist/entry-tools/inspect-minecraft/handlers/search.js +13 -2
  36. package/dist/entry-tools/inspect-minecraft/handlers/versions.d.ts +1 -1
  37. package/dist/entry-tools/inspect-minecraft/handlers/versions.js +3 -2
  38. package/dist/entry-tools/inspect-minecraft/internal.d.ts +90 -89
  39. package/dist/entry-tools/inspect-minecraft/internal.js +32 -14
  40. package/dist/entry-tools/inspect-minecraft-service.d.ts +218 -218
  41. package/dist/entry-tools/inspect-minecraft-service.js +1 -1
  42. package/dist/entry-tools/manage-cache-service.d.ts +4 -4
  43. package/dist/entry-tools/response-contract.d.ts +3 -1
  44. package/dist/entry-tools/response-contract.js +3 -2
  45. package/dist/entry-tools/validate-project/cases/mixin.js +2 -1
  46. package/dist/entry-tools/validate-project/cases/project-summary.js +5 -3
  47. package/dist/entry-tools/validate-project-service.d.ts +42 -36
  48. package/dist/entry-tools/validate-project-service.js +3 -1
  49. package/dist/entry-tools/verify-mixin-target-service.d.ts +30 -0
  50. package/dist/entry-tools/verify-mixin-target-service.js +120 -29
  51. package/dist/error-mapping.d.ts +51 -0
  52. package/dist/error-mapping.js +157 -2
  53. package/dist/index.js +147 -76
  54. package/dist/java-process.js +1 -1
  55. package/dist/json-rpc-framing.d.ts +4 -0
  56. package/dist/json-rpc-framing.js +23 -1
  57. package/dist/mapping/internal-types.d.ts +24 -0
  58. package/dist/mapping/loaders/tiny-maven.js +46 -20
  59. package/dist/mapping/lookup.d.ts +13 -2
  60. package/dist/mapping/lookup.js +60 -2
  61. package/dist/mapping/types.d.ts +6 -0
  62. package/dist/mapping-service.d.ts +26 -2
  63. package/dist/mapping-service.js +212 -55
  64. package/dist/mcp-helpers.d.ts +1 -0
  65. package/dist/mcp-helpers.js +25 -3
  66. package/dist/minecraft-explorer-service.js +24 -11
  67. package/dist/mixin/access-validators.js +33 -1
  68. package/dist/mixin/annotation-validators.js +73 -9
  69. package/dist/mixin/parsed-validator.js +3 -2
  70. package/dist/mixin-parser.js +119 -7
  71. package/dist/mod-decompile-service.d.ts +2 -0
  72. package/dist/mod-decompile-service.js +21 -3
  73. package/dist/mod-remap-service.d.ts +20 -1
  74. package/dist/mod-remap-service.js +101 -45
  75. package/dist/mojang-tiny-mapping-service.js +5 -2
  76. package/dist/nbt/java-nbt-codec.js +46 -16
  77. package/dist/nbt/json-patch.js +51 -12
  78. package/dist/nbt/typed-json.d.ts +1 -0
  79. package/dist/nbt/typed-json.js +12 -2
  80. package/dist/nbt/types.d.ts +2 -2
  81. package/dist/observability.d.ts +6 -0
  82. package/dist/observability.js +10 -0
  83. package/dist/page-cursor.d.ts +17 -0
  84. package/dist/page-cursor.js +0 -0
  85. package/dist/path-converter.js +10 -3
  86. package/dist/registry-service.d.ts +2 -0
  87. package/dist/registry-service.js +41 -2
  88. package/dist/repo-downloader.js +4 -3
  89. package/dist/resources.js +45 -9
  90. package/dist/response-utils.d.ts +29 -4
  91. package/dist/response-utils.js +95 -5
  92. package/dist/source/access-validate.js +12 -2
  93. package/dist/source/artifact-resolver.js +2 -2
  94. package/dist/source/class-source/members-builder.d.ts +44 -1
  95. package/dist/source/class-source/members-builder.js +51 -4
  96. package/dist/source/class-source/snippet-builder.d.ts +13 -0
  97. package/dist/source/class-source/snippet-builder.js +54 -4
  98. package/dist/source/class-source-helpers.d.ts +4 -4
  99. package/dist/source/class-source-helpers.js +77 -20
  100. package/dist/source/class-source.d.ts +19 -0
  101. package/dist/source/class-source.js +144 -40
  102. package/dist/source/file-access.js +3 -2
  103. package/dist/source/indexer.js +29 -9
  104. package/dist/source/lifecycle/mapping-helpers.js +28 -3
  105. package/dist/source/lifecycle/runtime-check.js +20 -6
  106. package/dist/source/search.d.ts +1 -1
  107. package/dist/source/search.js +117 -30
  108. package/dist/source/validate-mixin/pipeline/resolve.js +23 -3
  109. package/dist/source/validate-mixin.d.ts +2 -1
  110. package/dist/source/validate-mixin.js +45 -4
  111. package/dist/source/workspace-target.js +17 -10
  112. package/dist/source-jar-reader.d.ts +54 -1
  113. package/dist/source-jar-reader.js +121 -10
  114. package/dist/source-resolver.js +2 -2
  115. package/dist/source-service.d.ts +28 -7
  116. package/dist/source-service.js +9 -1
  117. package/dist/stdio-supervisor.d.ts +2 -2
  118. package/dist/stdio-supervisor.js +29 -9
  119. package/dist/storage/db.js +24 -1
  120. package/dist/storage/files-repo.d.ts +15 -0
  121. package/dist/storage/files-repo.js +67 -37
  122. package/dist/storage/symbols-repo.d.ts +15 -0
  123. package/dist/storage/symbols-repo.js +53 -19
  124. package/dist/symbols/symbol-extractor.js +35 -6
  125. package/dist/text-truncate.d.ts +7 -0
  126. package/dist/text-truncate.js +21 -0
  127. package/dist/tiny-remapper-resolver.js +10 -0
  128. package/dist/tool-contract-manifest.js +2 -2
  129. package/dist/tool-execution-gate.js +12 -1
  130. package/dist/tool-guidance.d.ts +6 -2
  131. package/dist/tool-guidance.js +63 -13
  132. package/dist/tool-schemas.d.ts +561 -496
  133. package/dist/tool-schemas.js +175 -139
  134. package/dist/types.d.ts +1 -0
  135. package/dist/version-diff-service.js +5 -0
  136. package/dist/version-service.d.ts +3 -0
  137. package/dist/version-service.js +18 -2
  138. package/dist/warning-details.d.ts +30 -0
  139. package/dist/warning-details.js +80 -0
  140. package/dist/workspace-mapping-service.js +9 -0
  141. package/docs/README-ja.md +2 -2
  142. package/docs/examples.md +26 -2
  143. package/docs/tool-reference.md +22 -17
  144. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import { ZodError } from "zod";
2
2
  import { buildSuggestedCall } from "./build-suggested-call.js";
3
3
  import { ERROR_CODES, isAppError } from "./errors.js";
4
- import { statusForErrorCode } from "./error-mapping.js";
4
+ import { extractAllowlistedContext, issueOriginForErrorCode, retryClassForErrorCode, statusForErrorCode } from "./error-mapping.js";
5
5
  export const SUGGESTED_CALL_DEFAULTS = {
6
6
  allowDecompile: true,
7
7
  preferProjectVersion: false,
@@ -14,7 +14,7 @@ export const SUGGESTED_CALL_DEFAULTS = {
14
14
  explain: false,
15
15
  preferProjectMapping: false,
16
16
  minSeverity: "all",
17
- reportMode: "full",
17
+ reportMode: "summary-first",
18
18
  treatInfoAsWarning: true,
19
19
  includeIssues: true
20
20
  };
@@ -98,14 +98,19 @@ export function extractValidatedSuggestionAndExamples(details) {
98
98
  typeof ex.reason !== "string") {
99
99
  continue;
100
100
  }
101
+ // Re-validate through the example path, not the primary path: example
102
+ // calls are templates and MAY carry placeholder sentinels (e.g.
103
+ // "<version>"), which the primary gate intentionally rejects.
101
104
  const result = buildSuggestedCall({
102
105
  tool: ex.tool,
103
- params: ex.params
106
+ params: undefined,
107
+ examples: [{ params: ex.params, reason: ex.reason }]
104
108
  });
105
- if (result.suggestedCall) {
109
+ const validatedExample = result.exampleCalls?.[0];
110
+ if (validatedExample) {
106
111
  validated.push({
107
112
  tool: ex.tool,
108
- params: result.suggestedCall.params,
113
+ params: validatedExample.params,
109
114
  reason: ex.reason
110
115
  });
111
116
  }
@@ -312,7 +317,22 @@ export function buildValidateMixinSuggestedParams(normalizedInput) {
312
317
  version
313
318
  };
314
319
  }
315
- const path = asNonEmptyString(inputRecord?.path) ??
320
+ if (inputRecord?.mode === "project") {
321
+ const projectInputPath = asNonEmptyString(inputRecord.path);
322
+ if (projectInputPath) {
323
+ return {
324
+ ...shared,
325
+ input: {
326
+ mode: "project",
327
+ path: projectInputPath
328
+ },
329
+ version
330
+ };
331
+ }
332
+ }
333
+ const path = (inputRecord?.mode === "path" || inputRecord?.mode === undefined
334
+ ? asNonEmptyString(inputRecord?.path)
335
+ : undefined) ??
316
336
  asNonEmptyString(record.sourcePath);
317
337
  if (path) {
318
338
  return {
@@ -414,12 +434,10 @@ export function buildSourceLookupSuggestedParams(tool, normalizedInput) {
414
434
  const targetValue = asNonEmptyString(record?.target);
415
435
  result.target = targetValue
416
436
  ? {
417
- type: "resolve",
418
437
  kind: inferTargetKindFromString(targetValue),
419
438
  value: targetValue
420
439
  }
421
440
  : {
422
- type: "resolve",
423
441
  kind: "version",
424
442
  value: "<minecraft-version>"
425
443
  };
@@ -597,6 +615,16 @@ export function buildValidateProjectSuggestedParams(normalizedInput) {
597
615
  return result;
598
616
  }
599
617
  const inputRecord = asObjectRecord(subjectRecord?.input) ?? asObjectRecord(record.input);
618
+ if (task === "access-transformer") {
619
+ result.subject = {
620
+ kind: "access-transformer",
621
+ input: inputRecord ?? {
622
+ mode: "inline",
623
+ content: "<access transformer contents>"
624
+ }
625
+ };
626
+ return result;
627
+ }
600
628
  result.subject = {
601
629
  kind: "access-widener",
602
630
  input: inputRecord ?? {
@@ -607,7 +635,21 @@ export function buildValidateProjectSuggestedParams(normalizedInput) {
607
635
  return result;
608
636
  }
609
637
  function gatedGuidance(tool, hints, params) {
610
- const validated = buildSuggestedCall({ tool, params });
638
+ // Pass the reconstructed params as both the primary and a fallback example.
639
+ // When they are fully executable they become `suggestedCall`; when they still
640
+ // carry `<…>` placeholders (e.g. a missing version) the gate drops the
641
+ // primary and surfaces the same shape as an `exampleCalls` template instead
642
+ // of emitting a non-callable suggestedCall.
643
+ const validated = buildSuggestedCall({
644
+ tool,
645
+ params,
646
+ examples: [
647
+ {
648
+ params,
649
+ reason: `Example ${tool} call shape — replace any <…> placeholder values before sending.`
650
+ }
651
+ ]
652
+ });
611
653
  return {
612
654
  hints,
613
655
  ...validated,
@@ -630,8 +672,8 @@ export function buildInvalidInputGuidance(tool, normalizedInput) {
630
672
  }
631
673
  if (tool === "get-class-source" || tool === "get-class-members") {
632
674
  return gatedGuidance(tool, [
633
- `${tool}.target must be an object: {"type":"resolve","kind":"version|jar|coordinate","value":"..."} or {"type":"artifact","artifactId":"..."}.`,
634
- "Bare string targets are not accepted; wrap the value under target.type/target.kind/target.value."
675
+ `${tool}.target must be an object: {"kind":"version|jar|coordinate","value":"..."} or {"kind":"artifact","artifactId":"..."} (same shape as resolve-artifact).`,
676
+ "Bare string targets are not accepted; wrap the value under target.kind/target.value."
635
677
  ], buildSourceLookupSuggestedParams(tool, normalizedInput));
636
678
  }
637
679
  if (tool === "validate-project") {
@@ -666,6 +708,8 @@ export function mapErrorToProblem(caughtError, requestId, context) {
666
708
  status: 400,
667
709
  code: ERROR_CODES.INVALID_INPUT,
668
710
  instance: requestId,
711
+ retryClass: retryClassForErrorCode(ERROR_CODES.INVALID_INPUT),
712
+ issueOrigin: issueOriginForErrorCode(ERROR_CODES.INVALID_INPUT),
669
713
  fieldErrors: toFieldErrorsFromZod(caughtError),
670
714
  hints: hintsWithFallback,
671
715
  ...(guidance?.suggestedCall ? { suggestedCall: guidance.suggestedCall } : {}),
@@ -675,6 +719,7 @@ export function mapErrorToProblem(caughtError, requestId, context) {
675
719
  }
676
720
  if (isAppError(caughtError)) {
677
721
  const { suggestedCall, exampleCalls, primaryDropped } = extractValidatedSuggestionAndExamples(caughtError.details);
722
+ const sanitizedContext = extractAllowlistedContext(caughtError.details);
678
723
  let failedStage = extractFailedStageFromDetails(caughtError.details);
679
724
  if (!failedStage
680
725
  && context?.tool === "validate-mixin"
@@ -692,11 +737,14 @@ export function mapErrorToProblem(caughtError, requestId, context) {
692
737
  status: statusForErrorCode(caughtError.code),
693
738
  code: caughtError.code,
694
739
  instance: requestId,
740
+ retryClass: retryClassForErrorCode(caughtError.code),
741
+ issueOrigin: issueOriginForErrorCode(caughtError.code),
695
742
  fieldErrors: extractFieldErrorsFromDetails(caughtError.details),
696
743
  hints: hintsWithFallback,
697
744
  ...(suggestedCall ? { suggestedCall } : {}),
698
745
  ...(exampleCalls ? { exampleCalls } : {}),
699
- ...(failedStage ? { failedStage } : {})
746
+ ...(failedStage ? { failedStage } : {}),
747
+ ...(sanitizedContext ? { context: sanitizedContext } : {})
700
748
  };
701
749
  }
702
750
  return {
@@ -705,7 +753,9 @@ export function mapErrorToProblem(caughtError, requestId, context) {
705
753
  detail: "Unexpected server error.",
706
754
  status: 500,
707
755
  code: ERROR_CODES.INTERNAL,
708
- instance: requestId
756
+ instance: requestId,
757
+ retryClass: retryClassForErrorCode(ERROR_CODES.INTERNAL),
758
+ issueOrigin: issueOriginForErrorCode(ERROR_CODES.INTERNAL)
709
759
  };
710
760
  }
711
761
  /**