@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.
- package/CHANGELOG.md +33 -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/build-suggested-call.js +31 -10
- package/dist/cache-registry.d.ts +8 -0
- package/dist/cache-registry.js +15 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.js +4 -0
- package/dist/entry-tools/analyze-mod-service.d.ts +24 -24
- package/dist/entry-tools/analyze-symbol-service.d.ts +57 -22
- package/dist/entry-tools/analyze-symbol-service.js +124 -28
- 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/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 +2 -2
- 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 +0 -1
- 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 +1 -1
- package/dist/entry-tools/inspect-minecraft/internal.d.ts +90 -89
- package/dist/entry-tools/inspect-minecraft/internal.js +30 -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 +1 -1
- package/dist/entry-tools/response-contract.js +1 -0
- 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 +113 -22
- package/dist/error-mapping.d.ts +51 -0
- package/dist/error-mapping.js +157 -2
- package/dist/index.js +138 -71
- package/dist/mapping/internal-types.d.ts +7 -0
- package/dist/mapping/lookup.d.ts +1 -1
- package/dist/mapping/lookup.js +7 -1
- package/dist/mapping/types.d.ts +6 -0
- package/dist/mapping-service.d.ts +26 -2
- package/dist/mapping-service.js +178 -36
- 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 +53 -7
- package/dist/mixin/parsed-validator.js +2 -2
- package/dist/mixin-parser.js +48 -4
- package/dist/mod-decompile-service.js +2 -1
- package/dist/mod-remap-service.d.ts +20 -1
- package/dist/mod-remap-service.js +95 -40
- package/dist/nbt/java-nbt-codec.js +6 -0
- 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/registry-service.js +25 -1
- 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 +1 -1
- 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 +48 -4
- package/dist/source/class-source-helpers.js +67 -11
- package/dist/source/class-source.js +97 -20
- package/dist/source/indexer.js +5 -2
- package/dist/source/search.d.ts +1 -1
- package/dist/source/search.js +94 -22
- package/dist/source/validate-mixin.d.ts +2 -1
- package/dist/source/validate-mixin.js +45 -4
- package/dist/source/workspace-target.js +15 -9
- package/dist/source-jar-reader.d.ts +54 -1
- package/dist/source-jar-reader.js +121 -10
- package/dist/source-service.d.ts +28 -7
- package/dist/storage/files-repo.d.ts +12 -0
- package/dist/storage/files-repo.js +24 -0
- package/dist/storage/symbols-repo.d.ts +6 -0
- package/dist/storage/symbols-repo.js +6 -0
- 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 +4 -1
- package/dist/tool-guidance.js +37 -12
- package/dist/tool-schemas.d.ts +559 -494
- package/dist/tool-schemas.js +99 -63
- 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 +18 -0
- package/dist/warning-details.js +63 -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/error-mapping.js
CHANGED
|
@@ -56,6 +56,153 @@ export function statusForErrorCode(code) {
|
|
|
56
56
|
}
|
|
57
57
|
return 500;
|
|
58
58
|
}
|
|
59
|
+
const RETRY_CLASS_INPUT = new Set([
|
|
60
|
+
ERROR_CODES.INVALID_INPUT,
|
|
61
|
+
ERROR_CODES.COORDINATE_PARSE_FAILED,
|
|
62
|
+
ERROR_CODES.INVALID_LINE_RANGE,
|
|
63
|
+
ERROR_CODES.NBT_PARSE_FAILED,
|
|
64
|
+
ERROR_CODES.NBT_INVALID_TYPED_JSON,
|
|
65
|
+
ERROR_CODES.JSON_PATCH_INVALID,
|
|
66
|
+
ERROR_CODES.JSON_PATCH_CONFLICT,
|
|
67
|
+
ERROR_CODES.NBT_ENCODE_FAILED,
|
|
68
|
+
ERROR_CODES.NBT_UNSUPPORTED_FEATURE,
|
|
69
|
+
ERROR_CODES.NAMESPACE_MISMATCH,
|
|
70
|
+
ERROR_CODES.CONTEXT_UNRESOLVED,
|
|
71
|
+
ERROR_CODES.MIXIN_PARSE_FAILED
|
|
72
|
+
]);
|
|
73
|
+
const RETRY_CLASS_PERMANENT = new Set([
|
|
74
|
+
ERROR_CODES.SOURCE_NOT_FOUND,
|
|
75
|
+
ERROR_CODES.FILE_NOT_FOUND,
|
|
76
|
+
ERROR_CODES.JAR_NOT_FOUND,
|
|
77
|
+
ERROR_CODES.VERSION_NOT_FOUND,
|
|
78
|
+
ERROR_CODES.CLASS_NOT_FOUND,
|
|
79
|
+
ERROR_CODES.MAPPING_NOT_APPLIED,
|
|
80
|
+
ERROR_CODES.MAPPING_UNAVAILABLE,
|
|
81
|
+
ERROR_CODES.DECOMPILE_DISABLED,
|
|
82
|
+
ERROR_CODES.REMAP_FAILED,
|
|
83
|
+
ERROR_CODES.WORKSPACE_VERSION_UNRESOLVED,
|
|
84
|
+
ERROR_CODES.DEPENDENCY_VERSION_UNRESOLVED,
|
|
85
|
+
ERROR_CODES.PROVENANCE_INCOMPLETE,
|
|
86
|
+
ERROR_CODES.BATCH_ABORTED
|
|
87
|
+
]);
|
|
88
|
+
const RETRY_CLASS_ENVIRONMENT = new Set([
|
|
89
|
+
ERROR_CODES.JAVA_UNAVAILABLE,
|
|
90
|
+
ERROR_CODES.DECOMPILER_UNAVAILABLE,
|
|
91
|
+
ERROR_CODES.DECOMPILER_FAILED,
|
|
92
|
+
ERROR_CODES.REMAPPER_UNAVAILABLE,
|
|
93
|
+
ERROR_CODES.REGISTRY_GENERATION_FAILED
|
|
94
|
+
]);
|
|
95
|
+
// Non-recoverable internal server faults: a deterministic defect where retrying
|
|
96
|
+
// the identical call cannot help. ERR_INTERNAL covers sanitized programming
|
|
97
|
+
// bugs / unexpected throws; ERR_DB_FAILURE covers SQLite integrity/migration
|
|
98
|
+
// failures (the open-failure path can be a transient file lock, but corruption
|
|
99
|
+
// and migration failures dominate, so it is classified server by default).
|
|
100
|
+
const RETRY_CLASS_SERVER = new Set([
|
|
101
|
+
ERROR_CODES.INTERNAL,
|
|
102
|
+
ERROR_CODES.DB_FAILURE
|
|
103
|
+
]);
|
|
104
|
+
/**
|
|
105
|
+
* Single source of truth mapping an error code to its {@link RetryClass}. Used
|
|
106
|
+
* by every public problem builder so callers can branch on recovery strategy
|
|
107
|
+
* without parsing prose. Non-recoverable server faults (`ERR_INTERNAL`,
|
|
108
|
+
* `ERR_DB_FAILURE`) classify as `server`. Codes not explicitly classified
|
|
109
|
+
* (genuinely-transient failures such as `ERR_REPO_FETCH_FAILED` and unknown
|
|
110
|
+
* codes) default to `transient`: a temporary failure where one retry is
|
|
111
|
+
* reasonable.
|
|
112
|
+
*/
|
|
113
|
+
export function retryClassForErrorCode(code) {
|
|
114
|
+
if (RETRY_CLASS_INPUT.has(code)) {
|
|
115
|
+
return "input";
|
|
116
|
+
}
|
|
117
|
+
if (RETRY_CLASS_PERMANENT.has(code)) {
|
|
118
|
+
return "permanent";
|
|
119
|
+
}
|
|
120
|
+
if (RETRY_CLASS_SERVER.has(code)) {
|
|
121
|
+
return "server";
|
|
122
|
+
}
|
|
123
|
+
if (RETRY_CLASS_ENVIRONMENT.has(code)) {
|
|
124
|
+
return "environment";
|
|
125
|
+
}
|
|
126
|
+
return "transient";
|
|
127
|
+
}
|
|
128
|
+
// "Your request is wrong or names something absent" — the caller can fix it.
|
|
129
|
+
const ISSUE_ORIGIN_CODE = new Set([
|
|
130
|
+
ERROR_CODES.INVALID_INPUT,
|
|
131
|
+
ERROR_CODES.COORDINATE_PARSE_FAILED,
|
|
132
|
+
ERROR_CODES.INVALID_LINE_RANGE,
|
|
133
|
+
ERROR_CODES.NBT_PARSE_FAILED,
|
|
134
|
+
ERROR_CODES.NBT_INVALID_TYPED_JSON,
|
|
135
|
+
ERROR_CODES.JSON_PATCH_INVALID,
|
|
136
|
+
ERROR_CODES.JSON_PATCH_CONFLICT,
|
|
137
|
+
ERROR_CODES.NBT_ENCODE_FAILED,
|
|
138
|
+
ERROR_CODES.NBT_UNSUPPORTED_FEATURE,
|
|
139
|
+
ERROR_CODES.NAMESPACE_MISMATCH,
|
|
140
|
+
ERROR_CODES.CONTEXT_UNRESOLVED,
|
|
141
|
+
ERROR_CODES.MIXIN_PARSE_FAILED,
|
|
142
|
+
ERROR_CODES.CLASS_NOT_FOUND,
|
|
143
|
+
ERROR_CODES.SOURCE_NOT_FOUND,
|
|
144
|
+
ERROR_CODES.FILE_NOT_FOUND,
|
|
145
|
+
ERROR_CODES.JAR_NOT_FOUND,
|
|
146
|
+
ERROR_CODES.VERSION_NOT_FOUND,
|
|
147
|
+
ERROR_CODES.WORKSPACE_VERSION_UNRESOLVED,
|
|
148
|
+
ERROR_CODES.DEPENDENCY_VERSION_UNRESOLVED
|
|
149
|
+
]);
|
|
150
|
+
/**
|
|
151
|
+
* Single source of truth mapping an error code to its {@link IssueOrigin}.
|
|
152
|
+
* Environment failures reuse the retry classifier; the input-family above is
|
|
153
|
+
* `code_issue`; everything else is a `tool_issue` (valid input the tool could
|
|
154
|
+
* not satisfy).
|
|
155
|
+
*/
|
|
156
|
+
export function issueOriginForErrorCode(code) {
|
|
157
|
+
if (RETRY_CLASS_ENVIRONMENT.has(code)) {
|
|
158
|
+
return "environment";
|
|
159
|
+
}
|
|
160
|
+
if (ISSUE_ORIGIN_CODE.has(code)) {
|
|
161
|
+
return "code_issue";
|
|
162
|
+
}
|
|
163
|
+
return "tool_issue";
|
|
164
|
+
}
|
|
165
|
+
// Non-sensitive AppError.details fields that are safe to echo to callers as
|
|
166
|
+
// machine-readable repair context. Filesystem paths and free-form text are
|
|
167
|
+
// intentionally excluded.
|
|
168
|
+
const CONTEXT_ALLOWLIST = new Set([
|
|
169
|
+
"queryLength",
|
|
170
|
+
"maxLength",
|
|
171
|
+
"artifactId",
|
|
172
|
+
"registry",
|
|
173
|
+
"registryName",
|
|
174
|
+
"stage",
|
|
175
|
+
"version",
|
|
176
|
+
"mapping",
|
|
177
|
+
"namespace",
|
|
178
|
+
"kind",
|
|
179
|
+
"owner",
|
|
180
|
+
"limit",
|
|
181
|
+
"count",
|
|
182
|
+
"maxMembers",
|
|
183
|
+
"candidateCount",
|
|
184
|
+
"candidatesSeen",
|
|
185
|
+
"ambiguous"
|
|
186
|
+
]);
|
|
187
|
+
/**
|
|
188
|
+
* Pick the allowlisted, primitive-valued fields out of an AppError's `details`
|
|
189
|
+
* so the public envelope can carry structured repair context without leaking
|
|
190
|
+
* paths, parser internals, or other sensitive data.
|
|
191
|
+
*/
|
|
192
|
+
export function extractAllowlistedContext(details) {
|
|
193
|
+
if (typeof details !== "object" || details == null) {
|
|
194
|
+
return undefined;
|
|
195
|
+
}
|
|
196
|
+
const record = details;
|
|
197
|
+
const out = {};
|
|
198
|
+
for (const key of CONTEXT_ALLOWLIST) {
|
|
199
|
+
const value = record[key];
|
|
200
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
201
|
+
out[key] = value;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return Object.keys(out).length > 0 ? out : undefined;
|
|
205
|
+
}
|
|
59
206
|
function extractFieldErrors(details) {
|
|
60
207
|
if (typeof details !== "object" || details == null)
|
|
61
208
|
return undefined;
|
|
@@ -95,6 +242,7 @@ export function errorToBatchEntryProblem(caughtError, instance, options) {
|
|
|
95
242
|
if (isAppError(caughtError)) {
|
|
96
243
|
const baseHints = extractHints(caughtError.details);
|
|
97
244
|
const fieldErrors = extractFieldErrors(caughtError.details);
|
|
245
|
+
const context = extractAllowlistedContext(caughtError.details);
|
|
98
246
|
return {
|
|
99
247
|
type: `https://minecraft-modding-mcp.dev/problems/${caughtError.code.toLowerCase()}`,
|
|
100
248
|
title: "Tool execution error",
|
|
@@ -102,9 +250,12 @@ export function errorToBatchEntryProblem(caughtError, instance, options) {
|
|
|
102
250
|
status: statusForErrorCode(caughtError.code),
|
|
103
251
|
code: caughtError.code,
|
|
104
252
|
instance,
|
|
253
|
+
retryClass: retryClassForErrorCode(caughtError.code),
|
|
254
|
+
issueOrigin: issueOriginForErrorCode(caughtError.code),
|
|
105
255
|
...(fieldErrors ? { fieldErrors } : {}),
|
|
106
256
|
...(baseHints ? { hints: baseHints } : {}),
|
|
107
|
-
...(options?.suggestedCall ? { suggestedCall: options.suggestedCall } : {})
|
|
257
|
+
...(options?.suggestedCall ? { suggestedCall: options.suggestedCall } : {}),
|
|
258
|
+
...(context ? { context } : {})
|
|
108
259
|
};
|
|
109
260
|
}
|
|
110
261
|
// Generic-error sanitization: fixed public detail, raw message logged
|
|
@@ -123,6 +274,8 @@ export function errorToBatchEntryProblem(caughtError, instance, options) {
|
|
|
123
274
|
status: 500,
|
|
124
275
|
code: ERROR_CODES.INTERNAL,
|
|
125
276
|
instance,
|
|
277
|
+
retryClass: retryClassForErrorCode(ERROR_CODES.INTERNAL),
|
|
278
|
+
issueOrigin: issueOriginForErrorCode(ERROR_CODES.INTERNAL),
|
|
126
279
|
...(options?.suggestedCall ? { suggestedCall: options.suggestedCall } : {})
|
|
127
280
|
};
|
|
128
281
|
}
|
|
@@ -133,7 +286,9 @@ export function buildBatchAbortedProblem(instance) {
|
|
|
133
286
|
detail: "Earlier entry failed and failFast=true.",
|
|
134
287
|
status: 412,
|
|
135
288
|
code: ERROR_CODES.BATCH_ABORTED,
|
|
136
|
-
instance
|
|
289
|
+
instance,
|
|
290
|
+
retryClass: retryClassForErrorCode(ERROR_CODES.BATCH_ABORTED),
|
|
291
|
+
issueOrigin: issueOriginForErrorCode(ERROR_CODES.BATCH_ABORTED)
|
|
137
292
|
};
|
|
138
293
|
}
|
|
139
294
|
//# sourceMappingURL=error-mapping.js.map
|