@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.
- package/CHANGELOG.md +69 -0
- package/README.md +5 -4
- package/dist/access-transformer-parser.d.ts +2 -1
- package/dist/access-transformer-parser.js +10 -1
- package/dist/access-widener-parser.d.ts +1 -0
- package/dist/access-widener-parser.js +6 -3
- package/dist/build-suggested-call.js +31 -10
- package/dist/cache-registry.d.ts +8 -0
- package/dist/cache-registry.js +50 -32
- package/dist/config.d.ts +1 -0
- package/dist/config.js +4 -0
- package/dist/decompiler/vineflower.js +8 -2
- package/dist/entry-tools/analyze-mod-service.d.ts +24 -24
- package/dist/entry-tools/analyze-mod-service.js +2 -1
- package/dist/entry-tools/analyze-symbol-service.d.ts +57 -22
- package/dist/entry-tools/analyze-symbol-service.js +139 -34
- package/dist/entry-tools/batch-class-members-service.d.ts +3 -1
- package/dist/entry-tools/batch-class-members-service.js +6 -6
- package/dist/entry-tools/batch-class-source-service.d.ts +3 -1
- package/dist/entry-tools/batch-class-source-service.js +5 -6
- package/dist/entry-tools/batch-mappings-service.d.ts +3 -1
- package/dist/entry-tools/batch-mappings-service.js +4 -5
- package/dist/entry-tools/batch-symbol-exists-service.d.ts +3 -1
- package/dist/entry-tools/batch-symbol-exists-service.js +4 -5
- package/dist/entry-tools/compare-minecraft-service.d.ts +10 -10
- package/dist/entry-tools/compare-minecraft-service.js +1 -1
- package/dist/entry-tools/entry-tool-schema.d.ts +1 -1
- package/dist/entry-tools/inspect-minecraft/handlers/artifact.js +1 -3
- package/dist/entry-tools/inspect-minecraft/handlers/class-members.js +4 -3
- package/dist/entry-tools/inspect-minecraft/handlers/class-overview.js +0 -5
- package/dist/entry-tools/inspect-minecraft/handlers/class-source.js +0 -1
- package/dist/entry-tools/inspect-minecraft/handlers/file.js +26 -2
- package/dist/entry-tools/inspect-minecraft/handlers/list-files.js +0 -1
- package/dist/entry-tools/inspect-minecraft/handlers/search.d.ts +8 -0
- package/dist/entry-tools/inspect-minecraft/handlers/search.js +13 -2
- package/dist/entry-tools/inspect-minecraft/handlers/versions.d.ts +1 -1
- package/dist/entry-tools/inspect-minecraft/handlers/versions.js +3 -2
- package/dist/entry-tools/inspect-minecraft/internal.d.ts +90 -89
- package/dist/entry-tools/inspect-minecraft/internal.js +32 -14
- package/dist/entry-tools/inspect-minecraft-service.d.ts +218 -218
- package/dist/entry-tools/inspect-minecraft-service.js +1 -1
- package/dist/entry-tools/manage-cache-service.d.ts +4 -4
- package/dist/entry-tools/response-contract.d.ts +3 -1
- package/dist/entry-tools/response-contract.js +3 -2
- package/dist/entry-tools/validate-project/cases/mixin.js +2 -1
- package/dist/entry-tools/validate-project/cases/project-summary.js +5 -3
- package/dist/entry-tools/validate-project-service.d.ts +42 -36
- package/dist/entry-tools/validate-project-service.js +3 -1
- package/dist/entry-tools/verify-mixin-target-service.d.ts +30 -0
- package/dist/entry-tools/verify-mixin-target-service.js +120 -29
- package/dist/error-mapping.d.ts +51 -0
- package/dist/error-mapping.js +157 -2
- package/dist/index.js +147 -76
- package/dist/java-process.js +1 -1
- package/dist/json-rpc-framing.d.ts +4 -0
- package/dist/json-rpc-framing.js +23 -1
- package/dist/mapping/internal-types.d.ts +24 -0
- package/dist/mapping/loaders/tiny-maven.js +46 -20
- package/dist/mapping/lookup.d.ts +13 -2
- package/dist/mapping/lookup.js +60 -2
- package/dist/mapping/types.d.ts +6 -0
- package/dist/mapping-service.d.ts +26 -2
- package/dist/mapping-service.js +212 -55
- package/dist/mcp-helpers.d.ts +1 -0
- package/dist/mcp-helpers.js +25 -3
- package/dist/minecraft-explorer-service.js +24 -11
- package/dist/mixin/access-validators.js +33 -1
- package/dist/mixin/annotation-validators.js +73 -9
- package/dist/mixin/parsed-validator.js +3 -2
- package/dist/mixin-parser.js +119 -7
- package/dist/mod-decompile-service.d.ts +2 -0
- package/dist/mod-decompile-service.js +21 -3
- package/dist/mod-remap-service.d.ts +20 -1
- package/dist/mod-remap-service.js +101 -45
- package/dist/mojang-tiny-mapping-service.js +5 -2
- package/dist/nbt/java-nbt-codec.js +46 -16
- package/dist/nbt/json-patch.js +51 -12
- package/dist/nbt/typed-json.d.ts +1 -0
- package/dist/nbt/typed-json.js +12 -2
- package/dist/nbt/types.d.ts +2 -2
- package/dist/observability.d.ts +6 -0
- package/dist/observability.js +10 -0
- package/dist/page-cursor.d.ts +17 -0
- package/dist/page-cursor.js +0 -0
- package/dist/path-converter.js +10 -3
- package/dist/registry-service.d.ts +2 -0
- package/dist/registry-service.js +41 -2
- package/dist/repo-downloader.js +4 -3
- package/dist/resources.js +45 -9
- package/dist/response-utils.d.ts +29 -4
- package/dist/response-utils.js +95 -5
- package/dist/source/access-validate.js +12 -2
- package/dist/source/artifact-resolver.js +2 -2
- package/dist/source/class-source/members-builder.d.ts +44 -1
- package/dist/source/class-source/members-builder.js +51 -4
- package/dist/source/class-source/snippet-builder.d.ts +13 -0
- package/dist/source/class-source/snippet-builder.js +54 -4
- package/dist/source/class-source-helpers.d.ts +4 -4
- package/dist/source/class-source-helpers.js +77 -20
- package/dist/source/class-source.d.ts +19 -0
- package/dist/source/class-source.js +144 -40
- package/dist/source/file-access.js +3 -2
- package/dist/source/indexer.js +29 -9
- package/dist/source/lifecycle/mapping-helpers.js +28 -3
- package/dist/source/lifecycle/runtime-check.js +20 -6
- package/dist/source/search.d.ts +1 -1
- package/dist/source/search.js +117 -30
- package/dist/source/validate-mixin/pipeline/resolve.js +23 -3
- package/dist/source/validate-mixin.d.ts +2 -1
- package/dist/source/validate-mixin.js +45 -4
- package/dist/source/workspace-target.js +17 -10
- package/dist/source-jar-reader.d.ts +54 -1
- package/dist/source-jar-reader.js +121 -10
- package/dist/source-resolver.js +2 -2
- package/dist/source-service.d.ts +28 -7
- package/dist/source-service.js +9 -1
- package/dist/stdio-supervisor.d.ts +2 -2
- package/dist/stdio-supervisor.js +29 -9
- package/dist/storage/db.js +24 -1
- package/dist/storage/files-repo.d.ts +15 -0
- package/dist/storage/files-repo.js +67 -37
- package/dist/storage/symbols-repo.d.ts +15 -0
- package/dist/storage/symbols-repo.js +53 -19
- package/dist/symbols/symbol-extractor.js +35 -6
- package/dist/text-truncate.d.ts +7 -0
- package/dist/text-truncate.js +21 -0
- package/dist/tiny-remapper-resolver.js +10 -0
- package/dist/tool-contract-manifest.js +2 -2
- package/dist/tool-execution-gate.js +12 -1
- package/dist/tool-guidance.d.ts +6 -2
- package/dist/tool-guidance.js +63 -13
- package/dist/tool-schemas.d.ts +561 -496
- package/dist/tool-schemas.js +175 -139
- package/dist/types.d.ts +1 -0
- package/dist/version-diff-service.js +5 -0
- package/dist/version-service.d.ts +3 -0
- package/dist/version-service.js +18 -2
- package/dist/warning-details.d.ts +30 -0
- package/dist/warning-details.js +80 -0
- package/dist/workspace-mapping-service.js +9 -0
- package/docs/README-ja.md +2 -2
- package/docs/examples.md +26 -2
- package/docs/tool-reference.md +22 -17
- package/package.json +1 -1
package/dist/tool-guidance.js
CHANGED
|
@@ -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: "
|
|
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:
|
|
106
|
+
params: undefined,
|
|
107
|
+
examples: [{ params: ex.params, reason: ex.reason }]
|
|
104
108
|
});
|
|
105
|
-
|
|
109
|
+
const validatedExample = result.exampleCalls?.[0];
|
|
110
|
+
if (validatedExample) {
|
|
106
111
|
validated.push({
|
|
107
112
|
tool: ex.tool,
|
|
108
|
-
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
|
-
|
|
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
|
-
|
|
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: {"
|
|
634
|
-
"Bare string targets are not accepted; wrap the value under target.
|
|
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
|
/**
|