@adhisang/minecraft-modding-mcp 4.2.1 → 5.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 (114) hide show
  1. package/CHANGELOG.md +33 -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/build-suggested-call.js +31 -10
  6. package/dist/cache-registry.d.ts +8 -0
  7. package/dist/cache-registry.js +15 -1
  8. package/dist/config.d.ts +1 -0
  9. package/dist/config.js +4 -0
  10. package/dist/entry-tools/analyze-mod-service.d.ts +24 -24
  11. package/dist/entry-tools/analyze-symbol-service.d.ts +57 -22
  12. package/dist/entry-tools/analyze-symbol-service.js +124 -28
  13. package/dist/entry-tools/batch-class-members-service.d.ts +3 -1
  14. package/dist/entry-tools/batch-class-members-service.js +6 -6
  15. package/dist/entry-tools/batch-class-source-service.d.ts +3 -1
  16. package/dist/entry-tools/batch-class-source-service.js +5 -6
  17. package/dist/entry-tools/batch-mappings-service.d.ts +3 -1
  18. package/dist/entry-tools/batch-mappings-service.js +4 -5
  19. package/dist/entry-tools/batch-symbol-exists-service.d.ts +3 -1
  20. package/dist/entry-tools/batch-symbol-exists-service.js +4 -5
  21. package/dist/entry-tools/compare-minecraft-service.d.ts +10 -10
  22. package/dist/entry-tools/entry-tool-schema.d.ts +1 -1
  23. package/dist/entry-tools/inspect-minecraft/handlers/artifact.js +1 -3
  24. package/dist/entry-tools/inspect-minecraft/handlers/class-members.js +2 -2
  25. package/dist/entry-tools/inspect-minecraft/handlers/class-overview.js +0 -5
  26. package/dist/entry-tools/inspect-minecraft/handlers/class-source.js +0 -1
  27. package/dist/entry-tools/inspect-minecraft/handlers/file.js +0 -1
  28. package/dist/entry-tools/inspect-minecraft/handlers/list-files.js +0 -1
  29. package/dist/entry-tools/inspect-minecraft/handlers/search.d.ts +8 -0
  30. package/dist/entry-tools/inspect-minecraft/handlers/search.js +13 -2
  31. package/dist/entry-tools/inspect-minecraft/handlers/versions.d.ts +1 -1
  32. package/dist/entry-tools/inspect-minecraft/handlers/versions.js +1 -1
  33. package/dist/entry-tools/inspect-minecraft/internal.d.ts +90 -89
  34. package/dist/entry-tools/inspect-minecraft/internal.js +30 -14
  35. package/dist/entry-tools/inspect-minecraft-service.d.ts +218 -218
  36. package/dist/entry-tools/inspect-minecraft-service.js +1 -1
  37. package/dist/entry-tools/manage-cache-service.d.ts +4 -4
  38. package/dist/entry-tools/response-contract.d.ts +1 -1
  39. package/dist/entry-tools/response-contract.js +1 -0
  40. package/dist/entry-tools/validate-project/cases/mixin.js +2 -1
  41. package/dist/entry-tools/validate-project/cases/project-summary.js +5 -3
  42. package/dist/entry-tools/validate-project-service.d.ts +42 -36
  43. package/dist/entry-tools/validate-project-service.js +3 -1
  44. package/dist/entry-tools/verify-mixin-target-service.d.ts +30 -0
  45. package/dist/entry-tools/verify-mixin-target-service.js +113 -22
  46. package/dist/error-mapping.d.ts +51 -0
  47. package/dist/error-mapping.js +157 -2
  48. package/dist/index.js +138 -71
  49. package/dist/mapping/internal-types.d.ts +7 -0
  50. package/dist/mapping/lookup.d.ts +1 -1
  51. package/dist/mapping/lookup.js +7 -1
  52. package/dist/mapping/types.d.ts +6 -0
  53. package/dist/mapping-service.d.ts +26 -2
  54. package/dist/mapping-service.js +178 -36
  55. package/dist/mcp-helpers.d.ts +1 -0
  56. package/dist/mcp-helpers.js +25 -3
  57. package/dist/minecraft-explorer-service.js +24 -11
  58. package/dist/mixin/access-validators.js +33 -1
  59. package/dist/mixin/annotation-validators.js +53 -7
  60. package/dist/mixin/parsed-validator.js +2 -2
  61. package/dist/mixin-parser.js +48 -4
  62. package/dist/mod-decompile-service.js +2 -1
  63. package/dist/mod-remap-service.d.ts +20 -1
  64. package/dist/mod-remap-service.js +95 -40
  65. package/dist/nbt/java-nbt-codec.js +6 -0
  66. package/dist/observability.d.ts +6 -0
  67. package/dist/observability.js +10 -0
  68. package/dist/page-cursor.d.ts +17 -0
  69. package/dist/page-cursor.js +0 -0
  70. package/dist/registry-service.js +25 -1
  71. package/dist/resources.js +45 -9
  72. package/dist/response-utils.d.ts +29 -4
  73. package/dist/response-utils.js +95 -5
  74. package/dist/source/access-validate.js +12 -2
  75. package/dist/source/artifact-resolver.js +1 -1
  76. package/dist/source/class-source/members-builder.d.ts +44 -1
  77. package/dist/source/class-source/members-builder.js +51 -4
  78. package/dist/source/class-source/snippet-builder.d.ts +13 -0
  79. package/dist/source/class-source/snippet-builder.js +48 -4
  80. package/dist/source/class-source-helpers.js +67 -11
  81. package/dist/source/class-source.js +97 -20
  82. package/dist/source/indexer.js +5 -2
  83. package/dist/source/search.d.ts +1 -1
  84. package/dist/source/search.js +94 -22
  85. package/dist/source/validate-mixin.d.ts +2 -1
  86. package/dist/source/validate-mixin.js +45 -4
  87. package/dist/source/workspace-target.js +15 -9
  88. package/dist/source-jar-reader.d.ts +54 -1
  89. package/dist/source-jar-reader.js +121 -10
  90. package/dist/source-service.d.ts +28 -7
  91. package/dist/storage/files-repo.d.ts +12 -0
  92. package/dist/storage/files-repo.js +24 -0
  93. package/dist/storage/symbols-repo.d.ts +6 -0
  94. package/dist/storage/symbols-repo.js +6 -0
  95. package/dist/symbols/symbol-extractor.js +35 -6
  96. package/dist/text-truncate.d.ts +7 -0
  97. package/dist/text-truncate.js +21 -0
  98. package/dist/tiny-remapper-resolver.js +10 -0
  99. package/dist/tool-contract-manifest.js +2 -2
  100. package/dist/tool-execution-gate.js +12 -1
  101. package/dist/tool-guidance.d.ts +4 -1
  102. package/dist/tool-guidance.js +37 -12
  103. package/dist/tool-schemas.d.ts +559 -494
  104. package/dist/tool-schemas.js +99 -63
  105. package/dist/types.d.ts +1 -0
  106. package/dist/version-diff-service.js +5 -0
  107. package/dist/version-service.d.ts +3 -0
  108. package/dist/version-service.js +18 -2
  109. package/dist/warning-details.d.ts +18 -0
  110. package/dist/warning-details.js +63 -0
  111. package/docs/README-ja.md +2 -2
  112. package/docs/examples.md +26 -2
  113. package/docs/tool-reference.md +22 -17
  114. 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
  }
@@ -414,12 +419,10 @@ export function buildSourceLookupSuggestedParams(tool, normalizedInput) {
414
419
  const targetValue = asNonEmptyString(record?.target);
415
420
  result.target = targetValue
416
421
  ? {
417
- type: "resolve",
418
422
  kind: inferTargetKindFromString(targetValue),
419
423
  value: targetValue
420
424
  }
421
425
  : {
422
- type: "resolve",
423
426
  kind: "version",
424
427
  value: "<minecraft-version>"
425
428
  };
@@ -607,7 +610,21 @@ export function buildValidateProjectSuggestedParams(normalizedInput) {
607
610
  return result;
608
611
  }
609
612
  function gatedGuidance(tool, hints, params) {
610
- const validated = buildSuggestedCall({ tool, params });
613
+ // Pass the reconstructed params as both the primary and a fallback example.
614
+ // When they are fully executable they become `suggestedCall`; when they still
615
+ // carry `<…>` placeholders (e.g. a missing version) the gate drops the
616
+ // primary and surfaces the same shape as an `exampleCalls` template instead
617
+ // of emitting a non-callable suggestedCall.
618
+ const validated = buildSuggestedCall({
619
+ tool,
620
+ params,
621
+ examples: [
622
+ {
623
+ params,
624
+ reason: `Example ${tool} call shape — replace any <…> placeholder values before sending.`
625
+ }
626
+ ]
627
+ });
611
628
  return {
612
629
  hints,
613
630
  ...validated,
@@ -630,8 +647,8 @@ export function buildInvalidInputGuidance(tool, normalizedInput) {
630
647
  }
631
648
  if (tool === "get-class-source" || tool === "get-class-members") {
632
649
  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."
650
+ `${tool}.target must be an object: {"kind":"version|jar|coordinate","value":"..."} or {"kind":"artifact","artifactId":"..."} (same shape as resolve-artifact).`,
651
+ "Bare string targets are not accepted; wrap the value under target.kind/target.value."
635
652
  ], buildSourceLookupSuggestedParams(tool, normalizedInput));
636
653
  }
637
654
  if (tool === "validate-project") {
@@ -666,6 +683,8 @@ export function mapErrorToProblem(caughtError, requestId, context) {
666
683
  status: 400,
667
684
  code: ERROR_CODES.INVALID_INPUT,
668
685
  instance: requestId,
686
+ retryClass: retryClassForErrorCode(ERROR_CODES.INVALID_INPUT),
687
+ issueOrigin: issueOriginForErrorCode(ERROR_CODES.INVALID_INPUT),
669
688
  fieldErrors: toFieldErrorsFromZod(caughtError),
670
689
  hints: hintsWithFallback,
671
690
  ...(guidance?.suggestedCall ? { suggestedCall: guidance.suggestedCall } : {}),
@@ -675,6 +694,7 @@ export function mapErrorToProblem(caughtError, requestId, context) {
675
694
  }
676
695
  if (isAppError(caughtError)) {
677
696
  const { suggestedCall, exampleCalls, primaryDropped } = extractValidatedSuggestionAndExamples(caughtError.details);
697
+ const sanitizedContext = extractAllowlistedContext(caughtError.details);
678
698
  let failedStage = extractFailedStageFromDetails(caughtError.details);
679
699
  if (!failedStage
680
700
  && context?.tool === "validate-mixin"
@@ -692,11 +712,14 @@ export function mapErrorToProblem(caughtError, requestId, context) {
692
712
  status: statusForErrorCode(caughtError.code),
693
713
  code: caughtError.code,
694
714
  instance: requestId,
715
+ retryClass: retryClassForErrorCode(caughtError.code),
716
+ issueOrigin: issueOriginForErrorCode(caughtError.code),
695
717
  fieldErrors: extractFieldErrorsFromDetails(caughtError.details),
696
718
  hints: hintsWithFallback,
697
719
  ...(suggestedCall ? { suggestedCall } : {}),
698
720
  ...(exampleCalls ? { exampleCalls } : {}),
699
- ...(failedStage ? { failedStage } : {})
721
+ ...(failedStage ? { failedStage } : {}),
722
+ ...(sanitizedContext ? { context: sanitizedContext } : {})
700
723
  };
701
724
  }
702
725
  return {
@@ -705,7 +728,9 @@ export function mapErrorToProblem(caughtError, requestId, context) {
705
728
  detail: "Unexpected server error.",
706
729
  status: 500,
707
730
  code: ERROR_CODES.INTERNAL,
708
- instance: requestId
731
+ instance: requestId,
732
+ retryClass: retryClassForErrorCode(ERROR_CODES.INTERNAL),
733
+ issueOrigin: issueOriginForErrorCode(ERROR_CODES.INTERNAL)
709
734
  };
710
735
  }
711
736
  /**