@adhisang/minecraft-modding-mcp 4.0.0 → 4.1.1
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 +61 -0
- package/README.md +40 -23
- package/dist/build-suggested-call.d.ts +29 -0
- package/dist/build-suggested-call.js +58 -0
- package/dist/cache-registry.d.ts +3 -1
- package/dist/cache-registry.js +50 -6
- package/dist/entry-tools/analyze-symbol-service.d.ts +16 -16
- package/dist/entry-tools/batch-class-members-service.d.ts +34 -0
- package/dist/entry-tools/batch-class-members-service.js +97 -0
- package/dist/entry-tools/batch-class-source-service.d.ts +37 -0
- package/dist/entry-tools/batch-class-source-service.js +100 -0
- package/dist/entry-tools/batch-mappings-service.d.ts +36 -0
- package/dist/entry-tools/batch-mappings-service.js +66 -0
- package/dist/entry-tools/batch-runner.d.ts +72 -0
- package/dist/entry-tools/batch-runner.js +90 -0
- package/dist/entry-tools/batch-symbol-exists-service.d.ts +46 -0
- package/dist/entry-tools/batch-symbol-exists-service.js +113 -0
- package/dist/entry-tools/compare-minecraft-service.d.ts +6 -6
- package/dist/entry-tools/inspect-minecraft/handlers/artifact.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/artifact.js +83 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-members.d.ts +6 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-members.js +80 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-overview.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-overview.js +248 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-source.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-source.js +60 -0
- package/dist/entry-tools/inspect-minecraft/handlers/file.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/file.js +54 -0
- package/dist/entry-tools/inspect-minecraft/handlers/list-files.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/list-files.js +100 -0
- package/dist/entry-tools/inspect-minecraft/handlers/search.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/search.js +155 -0
- package/dist/entry-tools/inspect-minecraft/handlers/versions.d.ts +6 -0
- package/dist/entry-tools/inspect-minecraft/handlers/versions.js +49 -0
- package/dist/entry-tools/inspect-minecraft/internal.d.ts +1042 -0
- package/dist/entry-tools/inspect-minecraft/internal.js +448 -0
- package/dist/entry-tools/inspect-minecraft-service.d.ts +193 -308
- package/dist/entry-tools/inspect-minecraft-service.js +20 -1244
- package/dist/entry-tools/manage-cache-service.d.ts +16 -16
- package/dist/entry-tools/validate-project/cases/access-transformer.d.ts +6 -0
- package/dist/entry-tools/validate-project/cases/access-transformer.js +106 -0
- package/dist/entry-tools/validate-project/cases/access-widener.d.ts +6 -0
- package/dist/entry-tools/validate-project/cases/access-widener.js +86 -0
- package/dist/entry-tools/validate-project/cases/mixin.d.ts +6 -0
- package/dist/entry-tools/validate-project/cases/mixin.js +90 -0
- package/dist/entry-tools/validate-project/cases/project-summary.d.ts +102 -0
- package/dist/entry-tools/validate-project/cases/project-summary.js +415 -0
- package/dist/entry-tools/validate-project/internal.d.ts +142 -0
- package/dist/entry-tools/validate-project/internal.js +303 -0
- package/dist/entry-tools/validate-project-service.d.ts +67 -47
- package/dist/entry-tools/validate-project-service.js +13 -563
- package/dist/entry-tools/verify-mixin-target-service.d.ts +133 -0
- package/dist/entry-tools/verify-mixin-target-service.js +323 -0
- package/dist/error-mapping.d.ts +40 -0
- package/dist/error-mapping.js +139 -0
- package/dist/errors.d.ts +6 -0
- package/dist/errors.js +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +147 -1354
- package/dist/mapping/internal-types.d.ts +54 -0
- package/dist/mapping/internal-types.js +14 -0
- package/dist/mapping/loaders/mojang.d.ts +2 -0
- package/dist/mapping/loaders/mojang.js +64 -0
- package/dist/mapping/loaders/tiny-loom.d.ts +2 -0
- package/dist/mapping/loaders/tiny-loom.js +73 -0
- package/dist/mapping/loaders/tiny-maven.d.ts +2 -0
- package/dist/mapping/loaders/tiny-maven.js +104 -0
- package/dist/mapping/loaders/types.d.ts +14 -0
- package/dist/mapping/loaders/types.js +2 -0
- package/dist/mapping/lookup.d.ts +52 -0
- package/dist/mapping/lookup.js +496 -0
- package/dist/mapping/parsers/normalize.d.ts +10 -0
- package/dist/mapping/parsers/normalize.js +52 -0
- package/dist/mapping/parsers/proguard.d.ts +20 -0
- package/dist/mapping/parsers/proguard.js +138 -0
- package/dist/mapping/parsers/symbol-records.d.ts +27 -0
- package/dist/mapping/parsers/symbol-records.js +216 -0
- package/dist/mapping/parsers/tiny.d.ts +9 -0
- package/dist/mapping/parsers/tiny.js +96 -0
- package/dist/mapping/types.d.ts +147 -0
- package/dist/mapping/types.js +2 -0
- package/dist/mapping-pipeline-service.js +3 -2
- package/dist/mapping-service.d.ts +8 -145
- package/dist/mapping-service.js +30 -1207
- package/dist/mixin/access-validators.d.ts +9 -0
- package/dist/mixin/access-validators.js +257 -0
- package/dist/mixin/annotation-validators.d.ts +5 -0
- package/dist/mixin/annotation-validators.js +162 -0
- package/dist/mixin/helpers.d.ts +28 -0
- package/dist/mixin/helpers.js +315 -0
- package/dist/mixin/parsed-validator.d.ts +8 -0
- package/dist/mixin/parsed-validator.js +337 -0
- package/dist/mixin/types.d.ts +208 -0
- package/dist/mixin/types.js +28 -0
- package/dist/mixin-validator.d.ts +9 -201
- package/dist/mixin-validator.js +8 -1020
- package/dist/source/access-validate.d.ts +4 -0
- package/dist/source/access-validate.js +254 -0
- package/dist/source/artifact-resolver.d.ts +111 -0
- package/dist/source/artifact-resolver.js +1271 -0
- package/dist/source/cache-metrics.d.ts +26 -0
- package/dist/source/cache-metrics.js +172 -0
- package/dist/source/class-source/members-builder.d.ts +34 -0
- package/dist/source/class-source/members-builder.js +46 -0
- package/dist/source/class-source/snippet-builder.d.ts +19 -0
- package/dist/source/class-source/snippet-builder.js +46 -0
- package/dist/source/class-source-helpers.d.ts +34 -0
- package/dist/source/class-source-helpers.js +140 -0
- package/dist/source/class-source.d.ts +42 -0
- package/dist/source/class-source.js +883 -0
- package/dist/source/descriptor-utils.d.ts +6 -0
- package/dist/source/descriptor-utils.js +37 -0
- package/dist/source/file-access.d.ts +4 -0
- package/dist/source/file-access.js +102 -0
- package/dist/source/indexer.d.ts +82 -0
- package/dist/source/indexer.js +522 -0
- package/dist/source/lifecycle/diff-utils.d.ts +9 -0
- package/dist/source/lifecycle/diff-utils.js +107 -0
- package/dist/source/lifecycle/diff.d.ts +2 -0
- package/dist/source/lifecycle/diff.js +265 -0
- package/dist/source/lifecycle/mapping-helpers.d.ts +22 -0
- package/dist/source/lifecycle/mapping-helpers.js +327 -0
- package/dist/source/lifecycle/runtime-check.d.ts +2 -0
- package/dist/source/lifecycle/runtime-check.js +142 -0
- package/dist/source/lifecycle/trace.d.ts +2 -0
- package/dist/source/lifecycle/trace.js +231 -0
- package/dist/source/lifecycle.d.ts +4 -0
- package/dist/source/lifecycle.js +5 -0
- package/dist/source/search.d.ts +51 -0
- package/dist/source/search.js +676 -0
- package/dist/source/shared-utils.d.ts +6 -0
- package/dist/source/shared-utils.js +55 -0
- package/dist/source/state.d.ts +26 -0
- package/dist/source/state.js +24 -0
- package/dist/source/symbol-resolver.d.ts +3 -0
- package/dist/source/symbol-resolver.js +212 -0
- package/dist/source/validate-mixin/pipeline/mapping-health.d.ts +3 -0
- package/dist/source/validate-mixin/pipeline/mapping-health.js +41 -0
- package/dist/source/validate-mixin/pipeline/parse.d.ts +2 -0
- package/dist/source/validate-mixin/pipeline/parse.js +10 -0
- package/dist/source/validate-mixin/pipeline/resolve.d.ts +3 -0
- package/dist/source/validate-mixin/pipeline/resolve.js +78 -0
- package/dist/source/validate-mixin/pipeline/target-lookup.d.ts +6 -0
- package/dist/source/validate-mixin/pipeline/target-lookup.js +260 -0
- package/dist/source/validate-mixin/pipeline-context.d.ts +72 -0
- package/dist/source/validate-mixin/pipeline-context.js +93 -0
- package/dist/source/validate-mixin.d.ts +22 -0
- package/dist/source/validate-mixin.js +799 -0
- package/dist/source/workspace-target.d.ts +18 -0
- package/dist/source/workspace-target.js +305 -0
- package/dist/source-resolver.d.ts +1 -0
- package/dist/source-resolver.js +1 -1
- package/dist/source-service.d.ts +164 -170
- package/dist/source-service.js +70 -6116
- package/dist/stage-emitter.d.ts +13 -0
- package/dist/stage-emitter.js +30 -0
- package/dist/stdio-supervisor.d.ts +61 -0
- package/dist/stdio-supervisor.js +326 -9
- package/dist/tool-contract-manifest.d.ts +1 -1
- package/dist/tool-contract-manifest.js +23 -6
- package/dist/tool-guidance.d.ts +82 -0
- package/dist/tool-guidance.js +734 -0
- package/dist/tool-schema-registry.d.ts +16 -0
- package/dist/tool-schema-registry.js +37 -0
- package/dist/tool-schemas.d.ts +3518 -0
- package/dist/tool-schemas.js +813 -0
- package/dist/types.d.ts +36 -0
- package/dist/version-service.js +7 -6
- package/dist/workspace-context-cache.d.ts +32 -0
- package/dist/workspace-context-cache.js +66 -0
- package/dist/workspace-mapping-service.d.ts +16 -0
- package/dist/workspace-mapping-service.js +173 -1
- package/docs/README-ja.md +416 -0
- package/docs/examples.md +483 -0
- package/docs/tool-reference.md +462 -0
- package/package.json +17 -4
|
@@ -31,14 +31,14 @@ export declare const compareMinecraftShape: {
|
|
|
31
31
|
className: string;
|
|
32
32
|
fromVersion: string;
|
|
33
33
|
toVersion: string;
|
|
34
|
-
mapping?: "
|
|
34
|
+
mapping?: "obfuscated" | "mojang" | "intermediary" | "yarn" | undefined;
|
|
35
35
|
sourcePriority?: "loom-first" | "maven-first" | undefined;
|
|
36
36
|
}, {
|
|
37
37
|
kind: "class";
|
|
38
38
|
className: string;
|
|
39
39
|
fromVersion: string;
|
|
40
40
|
toVersion: string;
|
|
41
|
-
mapping?: "
|
|
41
|
+
mapping?: "obfuscated" | "mojang" | "intermediary" | "yarn" | undefined;
|
|
42
42
|
sourcePriority?: "loom-first" | "maven-first" | undefined;
|
|
43
43
|
}>, z.ZodObject<{
|
|
44
44
|
kind: z.ZodLiteral<"registry">;
|
|
@@ -92,14 +92,14 @@ export declare const compareMinecraftSchema: z.ZodObject<{
|
|
|
92
92
|
className: string;
|
|
93
93
|
fromVersion: string;
|
|
94
94
|
toVersion: string;
|
|
95
|
-
mapping?: "
|
|
95
|
+
mapping?: "obfuscated" | "mojang" | "intermediary" | "yarn" | undefined;
|
|
96
96
|
sourcePriority?: "loom-first" | "maven-first" | undefined;
|
|
97
97
|
}, {
|
|
98
98
|
kind: "class";
|
|
99
99
|
className: string;
|
|
100
100
|
fromVersion: string;
|
|
101
101
|
toVersion: string;
|
|
102
|
-
mapping?: "
|
|
102
|
+
mapping?: "obfuscated" | "mojang" | "intermediary" | "yarn" | undefined;
|
|
103
103
|
sourcePriority?: "loom-first" | "maven-first" | undefined;
|
|
104
104
|
}>, z.ZodObject<{
|
|
105
105
|
kind: z.ZodLiteral<"registry">;
|
|
@@ -135,7 +135,7 @@ export declare const compareMinecraftSchema: z.ZodObject<{
|
|
|
135
135
|
className: string;
|
|
136
136
|
fromVersion: string;
|
|
137
137
|
toVersion: string;
|
|
138
|
-
mapping?: "
|
|
138
|
+
mapping?: "obfuscated" | "mojang" | "intermediary" | "yarn" | undefined;
|
|
139
139
|
sourcePriority?: "loom-first" | "maven-first" | undefined;
|
|
140
140
|
} | {
|
|
141
141
|
kind: "registry";
|
|
@@ -160,7 +160,7 @@ export declare const compareMinecraftSchema: z.ZodObject<{
|
|
|
160
160
|
className: string;
|
|
161
161
|
fromVersion: string;
|
|
162
162
|
toVersion: string;
|
|
163
|
-
mapping?: "
|
|
163
|
+
mapping?: "obfuscated" | "mojang" | "intermediary" | "yarn" | undefined;
|
|
164
164
|
sourcePriority?: "loom-first" | "maven-first" | undefined;
|
|
165
165
|
} | {
|
|
166
166
|
kind: "registry";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type DetailLevel } from "../../response-contract.js";
|
|
2
|
+
import { type Subject, type InspectMinecraftDeps } from "../internal.js";
|
|
3
|
+
export declare function handleArtifact(deps: InspectMinecraftDeps, subject: Subject, detail: DetailLevel, include: string[]): Promise<{
|
|
4
|
+
warnings: string[];
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { buildEntryToolResult, createNextAction, createSummarySubject } from "../../response-contract.js";
|
|
2
|
+
import { nextActionsOrUndefined } from "../../request-normalizers.js";
|
|
3
|
+
import { resolveArtifactReference } from "../internal.js";
|
|
4
|
+
export async function handleArtifact(deps, subject, detail, include) {
|
|
5
|
+
const resolved = await resolveArtifactReference(deps, subject);
|
|
6
|
+
if (!resolved.artifactId) {
|
|
7
|
+
const summary = {
|
|
8
|
+
status: "blocked",
|
|
9
|
+
headline: "Could not resolve an artifact without a Minecraft version.",
|
|
10
|
+
subject: createSummarySubject({
|
|
11
|
+
task: "artifact",
|
|
12
|
+
requested: subject
|
|
13
|
+
}),
|
|
14
|
+
nextActions: nextActionsOrUndefined([
|
|
15
|
+
createNextAction("inspect-minecraft", {
|
|
16
|
+
task: "artifact",
|
|
17
|
+
subject: {
|
|
18
|
+
kind: "version",
|
|
19
|
+
version: "1.21.10"
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
])
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
...buildEntryToolResult({
|
|
26
|
+
task: "artifact",
|
|
27
|
+
summary,
|
|
28
|
+
detail,
|
|
29
|
+
include,
|
|
30
|
+
blocks: {
|
|
31
|
+
subject: {
|
|
32
|
+
requested: subject
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
alwaysBlocks: ["subject"]
|
|
36
|
+
}),
|
|
37
|
+
warnings: resolved.warnings
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
const summary = {
|
|
41
|
+
status: "ok",
|
|
42
|
+
headline: `Resolved artifact ${resolved.artifactId}.`,
|
|
43
|
+
subject: createSummarySubject({
|
|
44
|
+
task: "artifact",
|
|
45
|
+
requested: subject,
|
|
46
|
+
artifactId: resolved.artifactId,
|
|
47
|
+
version: resolved.version
|
|
48
|
+
}),
|
|
49
|
+
counts: {
|
|
50
|
+
warnings: resolved.warnings.length
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
return {
|
|
54
|
+
...buildEntryToolResult({
|
|
55
|
+
task: "artifact",
|
|
56
|
+
summary,
|
|
57
|
+
detail,
|
|
58
|
+
include,
|
|
59
|
+
blocks: {
|
|
60
|
+
subject: {
|
|
61
|
+
requested: subject,
|
|
62
|
+
resolved: {
|
|
63
|
+
artifactId: resolved.artifactId,
|
|
64
|
+
version: resolved.version
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
artifact: resolved.artifact
|
|
68
|
+
? {
|
|
69
|
+
artifactId: resolved.artifact.artifactId,
|
|
70
|
+
artifactAlias: resolved.artifact.artifactAlias,
|
|
71
|
+
origin: resolved.artifact.origin,
|
|
72
|
+
mappingApplied: resolved.artifact.mappingApplied,
|
|
73
|
+
version: resolved.artifact.version,
|
|
74
|
+
artifactContents: resolved.artifact.artifactContents
|
|
75
|
+
}
|
|
76
|
+
: { artifactId: resolved.artifactId }
|
|
77
|
+
},
|
|
78
|
+
alwaysBlocks: ["subject"]
|
|
79
|
+
}),
|
|
80
|
+
warnings: resolved.warnings
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=artifact.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type DetailLevel } from "../../response-contract.js";
|
|
2
|
+
import { type Subject, type InspectMinecraftDeps } from "../internal.js";
|
|
3
|
+
export declare function handleClassMembers(deps: InspectMinecraftDeps, subject: Subject, detail: DetailLevel, include: string[], limit: number | undefined): Promise<{
|
|
4
|
+
meta?: Record<string, unknown> | undefined;
|
|
5
|
+
warnings: string[];
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { buildEntryToolResult, buildEntryToolMeta, createNextAction, createSummarySubject, createTruncationMeta } from "../../response-contract.js";
|
|
2
|
+
import { buildClassSubject, resolveClassArtifactReference, invalidTaskSubjectError } from "../internal.js";
|
|
3
|
+
export async function handleClassMembers(deps, subject, detail, include, limit) {
|
|
4
|
+
if (subject.kind !== "class" && !(subject.kind === "workspace" && subject.focus?.kind === "class")) {
|
|
5
|
+
invalidTaskSubjectError("class-members", subject);
|
|
6
|
+
}
|
|
7
|
+
const classSubject = buildClassSubject(subject);
|
|
8
|
+
const artifact = await resolveClassArtifactReference(deps, subject, classSubject, "class-members");
|
|
9
|
+
const members = await deps.getClassMembers({
|
|
10
|
+
className: classSubject.className,
|
|
11
|
+
artifactId: artifact.artifactId || undefined,
|
|
12
|
+
mapping: classSubject.mapping,
|
|
13
|
+
scope: classSubject.scope,
|
|
14
|
+
projectPath: classSubject.projectPath,
|
|
15
|
+
preferProjectVersion: classSubject.preferProjectVersion,
|
|
16
|
+
strictVersion: classSubject.strictVersion,
|
|
17
|
+
maxMembers: limit
|
|
18
|
+
});
|
|
19
|
+
const summary = {
|
|
20
|
+
status: members.truncated ? "partial" : "ok",
|
|
21
|
+
headline: `Collected ${members.counts.total} members for ${members.className}.`,
|
|
22
|
+
subject: createSummarySubject({
|
|
23
|
+
task: "class-members",
|
|
24
|
+
requested: subject,
|
|
25
|
+
className: members.className,
|
|
26
|
+
artifactId: members.artifactId
|
|
27
|
+
}),
|
|
28
|
+
counts: members.counts
|
|
29
|
+
};
|
|
30
|
+
return {
|
|
31
|
+
...buildEntryToolResult({
|
|
32
|
+
task: "class-members",
|
|
33
|
+
summary,
|
|
34
|
+
detail,
|
|
35
|
+
include,
|
|
36
|
+
blocks: {
|
|
37
|
+
subject: {
|
|
38
|
+
requested: subject,
|
|
39
|
+
resolved: {
|
|
40
|
+
artifactId: members.artifactId,
|
|
41
|
+
className: members.className
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
members: include.includes("members") || detail !== "summary"
|
|
45
|
+
? {
|
|
46
|
+
...members.members,
|
|
47
|
+
...(members.decompiledFallback ? { decompiledFallback: members.decompiledFallback } : {}),
|
|
48
|
+
...(members.decompiledMemberCounts ? { decompiledMemberCounts: members.decompiledMemberCounts } : {})
|
|
49
|
+
}
|
|
50
|
+
: {
|
|
51
|
+
counts: members.counts,
|
|
52
|
+
...(members.decompiledMemberCounts ? { decompiledMemberCounts: members.decompiledMemberCounts } : {})
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
alwaysBlocks: ["subject"]
|
|
56
|
+
}),
|
|
57
|
+
warnings: [...artifact.warnings, ...members.warnings],
|
|
58
|
+
...(members.truncated
|
|
59
|
+
? {
|
|
60
|
+
meta: buildEntryToolMeta({
|
|
61
|
+
detail,
|
|
62
|
+
include,
|
|
63
|
+
warnings: [...artifact.warnings, ...members.warnings],
|
|
64
|
+
truncated: createTruncationMeta({
|
|
65
|
+
omittedGroups: ["members"],
|
|
66
|
+
nextActions: [
|
|
67
|
+
createNextAction("inspect-minecraft", {
|
|
68
|
+
task: "class-members",
|
|
69
|
+
detail: "full",
|
|
70
|
+
include: ["members"],
|
|
71
|
+
subject
|
|
72
|
+
})
|
|
73
|
+
]
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
: {})
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=class-members.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type DetailLevel } from "../../response-contract.js";
|
|
2
|
+
import { type Subject, type InspectMinecraftDeps } from "../internal.js";
|
|
3
|
+
export declare function handleClassOverview(deps: InspectMinecraftDeps, subject: Subject, detail: DetailLevel, include: string[]): Promise<{
|
|
4
|
+
warnings: string[];
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { buildEntryToolResult, createNextAction, createSummarySubject } from "../../response-contract.js";
|
|
2
|
+
import { nextActionsOrUndefined } from "../../request-normalizers.js";
|
|
3
|
+
import { hasPartialVanillaCoverage, buildClassSubject, resolveClassArtifactReference, invalidTaskSubjectError, resolveBinaryBackedClass } from "../internal.js";
|
|
4
|
+
export async function handleClassOverview(deps, subject, detail, include) {
|
|
5
|
+
if (subject.kind !== "class" && !(subject.kind === "workspace" && subject.focus?.kind === "class")) {
|
|
6
|
+
invalidTaskSubjectError("class-overview", subject);
|
|
7
|
+
}
|
|
8
|
+
const classSubject = buildClassSubject(subject);
|
|
9
|
+
const className = classSubject.className;
|
|
10
|
+
const artifact = await resolveClassArtifactReference(deps, subject, classSubject, "class-overview");
|
|
11
|
+
if (!artifact.artifactId) {
|
|
12
|
+
const summary = {
|
|
13
|
+
status: "blocked",
|
|
14
|
+
headline: `Could not resolve artifact context for ${className}.`,
|
|
15
|
+
subject: createSummarySubject({
|
|
16
|
+
task: "class-overview",
|
|
17
|
+
requested: subject,
|
|
18
|
+
className
|
|
19
|
+
})
|
|
20
|
+
};
|
|
21
|
+
return {
|
|
22
|
+
...buildEntryToolResult({
|
|
23
|
+
task: "class-overview",
|
|
24
|
+
summary,
|
|
25
|
+
detail,
|
|
26
|
+
include,
|
|
27
|
+
blocks: {
|
|
28
|
+
subject: {
|
|
29
|
+
requested: subject
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
alwaysBlocks: ["subject"]
|
|
33
|
+
}),
|
|
34
|
+
warnings: artifact.warnings
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const matches = await deps.findClass({
|
|
38
|
+
artifactId: artifact.artifactId,
|
|
39
|
+
className,
|
|
40
|
+
limit: 10
|
|
41
|
+
});
|
|
42
|
+
if (matches.total === 0) {
|
|
43
|
+
const partialSourceFallback = subject.kind === "workspace" && hasPartialVanillaCoverage(artifact.artifact)
|
|
44
|
+
? await resolveBinaryBackedClass(deps, className, {
|
|
45
|
+
version: artifact.version,
|
|
46
|
+
mapping: classSubject.mapping
|
|
47
|
+
})
|
|
48
|
+
: undefined;
|
|
49
|
+
if (partialSourceFallback) {
|
|
50
|
+
const metadata = await deps.getClassSource({
|
|
51
|
+
className: partialSourceFallback.className,
|
|
52
|
+
artifactId: artifact.artifactId,
|
|
53
|
+
mapping: classSubject.mapping,
|
|
54
|
+
scope: classSubject.scope,
|
|
55
|
+
projectPath: classSubject.projectPath,
|
|
56
|
+
preferProjectVersion: classSubject.preferProjectVersion,
|
|
57
|
+
strictVersion: classSubject.strictVersion,
|
|
58
|
+
mode: "metadata"
|
|
59
|
+
});
|
|
60
|
+
const summary = {
|
|
61
|
+
status: "ok",
|
|
62
|
+
headline: `Resolved class overview for ${partialSourceFallback.className}.`,
|
|
63
|
+
subject: createSummarySubject({
|
|
64
|
+
task: "class-overview",
|
|
65
|
+
requested: subject,
|
|
66
|
+
className: partialSourceFallback.className,
|
|
67
|
+
artifactId: metadata.artifactId
|
|
68
|
+
}),
|
|
69
|
+
counts: {
|
|
70
|
+
totalLines: metadata.totalLines
|
|
71
|
+
},
|
|
72
|
+
notes: [
|
|
73
|
+
"Source coverage was partial, so inspect-minecraft confirmed the vanilla class through binary-backed symbol lookup."
|
|
74
|
+
]
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
...buildEntryToolResult({
|
|
78
|
+
task: "class-overview",
|
|
79
|
+
summary,
|
|
80
|
+
detail,
|
|
81
|
+
include,
|
|
82
|
+
blocks: {
|
|
83
|
+
subject: {
|
|
84
|
+
requested: subject,
|
|
85
|
+
resolved: {
|
|
86
|
+
artifactId: metadata.artifactId,
|
|
87
|
+
className: partialSourceFallback.className
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
class: {
|
|
91
|
+
className: partialSourceFallback.className,
|
|
92
|
+
totalLines: metadata.totalLines,
|
|
93
|
+
returnedNamespace: metadata.returnedNamespace
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
alwaysBlocks: ["subject"]
|
|
97
|
+
}),
|
|
98
|
+
warnings: [
|
|
99
|
+
...artifact.warnings,
|
|
100
|
+
...matches.warnings,
|
|
101
|
+
...partialSourceFallback.warnings,
|
|
102
|
+
...metadata.warnings
|
|
103
|
+
]
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
const summary = {
|
|
107
|
+
status: "not_found",
|
|
108
|
+
headline: `No class match was found for ${className}.`,
|
|
109
|
+
subject: createSummarySubject({
|
|
110
|
+
task: "class-overview",
|
|
111
|
+
requested: subject,
|
|
112
|
+
className,
|
|
113
|
+
artifactId: artifact.artifactId
|
|
114
|
+
})
|
|
115
|
+
};
|
|
116
|
+
return {
|
|
117
|
+
...buildEntryToolResult({
|
|
118
|
+
task: "class-overview",
|
|
119
|
+
summary,
|
|
120
|
+
detail,
|
|
121
|
+
include,
|
|
122
|
+
blocks: {
|
|
123
|
+
subject: {
|
|
124
|
+
requested: subject,
|
|
125
|
+
resolved: {
|
|
126
|
+
artifactId: artifact.artifactId
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
alwaysBlocks: ["subject"]
|
|
131
|
+
}),
|
|
132
|
+
warnings: [...artifact.warnings, ...matches.warnings]
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
if (matches.total > 1) {
|
|
136
|
+
const candidateActions = matches.matches.slice(0, 3).map((match) => createNextAction("inspect-minecraft", {
|
|
137
|
+
task: "class-source",
|
|
138
|
+
subject: {
|
|
139
|
+
kind: "class",
|
|
140
|
+
className: match.qualifiedName,
|
|
141
|
+
artifact: {
|
|
142
|
+
type: "resolved-id",
|
|
143
|
+
artifactId: artifact.artifactId
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
include: ["source"]
|
|
147
|
+
}));
|
|
148
|
+
const summary = {
|
|
149
|
+
status: "ambiguous",
|
|
150
|
+
headline: `Found ${matches.total} class matches for ${className}.`,
|
|
151
|
+
subject: createSummarySubject({
|
|
152
|
+
task: "class-overview",
|
|
153
|
+
requested: subject,
|
|
154
|
+
className,
|
|
155
|
+
artifactId: artifact.artifactId
|
|
156
|
+
}),
|
|
157
|
+
counts: {
|
|
158
|
+
matches: matches.total
|
|
159
|
+
},
|
|
160
|
+
nextActions: nextActionsOrUndefined(candidateActions)
|
|
161
|
+
};
|
|
162
|
+
return {
|
|
163
|
+
...buildEntryToolResult({
|
|
164
|
+
task: "class-overview",
|
|
165
|
+
summary,
|
|
166
|
+
detail,
|
|
167
|
+
include,
|
|
168
|
+
blocks: {
|
|
169
|
+
subject: {
|
|
170
|
+
requested: subject,
|
|
171
|
+
resolved: {
|
|
172
|
+
artifactId: artifact.artifactId
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
candidates: matches.matches
|
|
176
|
+
},
|
|
177
|
+
alwaysBlocks: ["subject"]
|
|
178
|
+
}),
|
|
179
|
+
warnings: [...artifact.warnings, ...matches.warnings]
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
const match = matches.matches[0];
|
|
183
|
+
const metadata = await deps.getClassSource({
|
|
184
|
+
className: match.qualifiedName,
|
|
185
|
+
artifactId: artifact.artifactId,
|
|
186
|
+
mode: "metadata"
|
|
187
|
+
});
|
|
188
|
+
const summary = {
|
|
189
|
+
status: "ok",
|
|
190
|
+
headline: `Resolved class overview for ${match.qualifiedName}.`,
|
|
191
|
+
subject: createSummarySubject({
|
|
192
|
+
task: "class-overview",
|
|
193
|
+
requested: subject,
|
|
194
|
+
className: match.qualifiedName,
|
|
195
|
+
artifactId: artifact.artifactId
|
|
196
|
+
}),
|
|
197
|
+
counts: {
|
|
198
|
+
totalLines: metadata.totalLines
|
|
199
|
+
},
|
|
200
|
+
nextActions: nextActionsOrUndefined([
|
|
201
|
+
createNextAction("inspect-minecraft", {
|
|
202
|
+
task: "class-source",
|
|
203
|
+
subject: {
|
|
204
|
+
kind: "class",
|
|
205
|
+
className: match.qualifiedName,
|
|
206
|
+
artifact: {
|
|
207
|
+
type: "resolved-id",
|
|
208
|
+
artifactId: artifact.artifactId
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
include: ["source"]
|
|
212
|
+
})
|
|
213
|
+
])
|
|
214
|
+
};
|
|
215
|
+
return {
|
|
216
|
+
...buildEntryToolResult({
|
|
217
|
+
task: "class-overview",
|
|
218
|
+
summary,
|
|
219
|
+
detail,
|
|
220
|
+
include,
|
|
221
|
+
blocks: {
|
|
222
|
+
subject: {
|
|
223
|
+
requested: subject,
|
|
224
|
+
resolved: {
|
|
225
|
+
artifactId: artifact.artifactId,
|
|
226
|
+
className: match.qualifiedName
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
artifact: artifact.artifact
|
|
230
|
+
? {
|
|
231
|
+
artifactId: artifact.artifact.artifactId,
|
|
232
|
+
version: artifact.artifact.version,
|
|
233
|
+
origin: artifact.artifact.origin
|
|
234
|
+
}
|
|
235
|
+
: { artifactId: artifact.artifactId },
|
|
236
|
+
class: {
|
|
237
|
+
className: match.qualifiedName,
|
|
238
|
+
filePath: match.filePath,
|
|
239
|
+
totalLines: metadata.totalLines,
|
|
240
|
+
returnedNamespace: metadata.returnedNamespace
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
alwaysBlocks: ["subject"]
|
|
244
|
+
}),
|
|
245
|
+
warnings: [...artifact.warnings, ...matches.warnings, ...metadata.warnings]
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
//# sourceMappingURL=class-overview.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type DetailLevel } from "../../response-contract.js";
|
|
2
|
+
import { type Subject, type InspectMinecraftDeps } from "../internal.js";
|
|
3
|
+
export declare function handleClassSource(deps: InspectMinecraftDeps, subject: Subject, detail: DetailLevel, include: string[]): Promise<{
|
|
4
|
+
warnings: string[];
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { buildEntryToolResult, createSummarySubject } from "../../response-contract.js";
|
|
2
|
+
import { buildClassSubject, resolveClassArtifactReference, invalidTaskSubjectError } from "../internal.js";
|
|
3
|
+
export async function handleClassSource(deps, subject, detail, include) {
|
|
4
|
+
if (subject.kind !== "class" && !(subject.kind === "workspace" && subject.focus?.kind === "class")) {
|
|
5
|
+
invalidTaskSubjectError("class-source", subject);
|
|
6
|
+
}
|
|
7
|
+
const classSubject = buildClassSubject(subject);
|
|
8
|
+
const className = classSubject.className;
|
|
9
|
+
const artifactContext = await resolveClassArtifactReference(deps, subject, classSubject, "class-source");
|
|
10
|
+
const source = await deps.getClassSource({
|
|
11
|
+
className,
|
|
12
|
+
artifactId: artifactContext.artifactId || undefined,
|
|
13
|
+
mapping: classSubject.mapping,
|
|
14
|
+
scope: classSubject.scope,
|
|
15
|
+
projectPath: classSubject.projectPath,
|
|
16
|
+
preferProjectVersion: classSubject.preferProjectVersion,
|
|
17
|
+
strictVersion: classSubject.strictVersion,
|
|
18
|
+
mode: include.includes("source") || detail === "full" ? "snippet" : "metadata"
|
|
19
|
+
});
|
|
20
|
+
const summary = {
|
|
21
|
+
status: "ok",
|
|
22
|
+
headline: `Resolved source for ${source.className}.`,
|
|
23
|
+
subject: createSummarySubject({
|
|
24
|
+
task: "class-source",
|
|
25
|
+
requested: subject,
|
|
26
|
+
className: source.className,
|
|
27
|
+
artifactId: source.artifactId
|
|
28
|
+
}),
|
|
29
|
+
counts: {
|
|
30
|
+
totalLines: source.totalLines
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
return {
|
|
34
|
+
...buildEntryToolResult({
|
|
35
|
+
task: "class-source",
|
|
36
|
+
summary,
|
|
37
|
+
detail,
|
|
38
|
+
include,
|
|
39
|
+
blocks: {
|
|
40
|
+
subject: {
|
|
41
|
+
requested: subject,
|
|
42
|
+
resolved: {
|
|
43
|
+
artifactId: source.artifactId,
|
|
44
|
+
className: source.className
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
source: {
|
|
48
|
+
className: source.className,
|
|
49
|
+
mode: source.mode,
|
|
50
|
+
returnedRange: source.returnedRange,
|
|
51
|
+
totalLines: source.totalLines,
|
|
52
|
+
sourceText: source.sourceText
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
alwaysBlocks: ["subject"]
|
|
56
|
+
}),
|
|
57
|
+
warnings: [...artifactContext.warnings, ...source.warnings]
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=class-source.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type DetailLevel } from "../../response-contract.js";
|
|
2
|
+
import { type Subject, type InspectMinecraftDeps } from "../internal.js";
|
|
3
|
+
export declare function handleFile(deps: InspectMinecraftDeps, subject: Subject, detail: DetailLevel, include: string[]): Promise<{
|
|
4
|
+
warnings: string[];
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { buildEntryToolResult, createSummarySubject } from "../../response-contract.js";
|
|
2
|
+
import { requireWorkspaceFileFocus, resolveWorkspaceArtifactReference, invalidTaskSubjectError, resolveArtifactReference } from "../internal.js";
|
|
3
|
+
export async function handleFile(deps, subject, detail, include) {
|
|
4
|
+
if (subject.kind !== "file" && !(subject.kind === "workspace" && subject.focus?.kind === "file")) {
|
|
5
|
+
invalidTaskSubjectError("file", subject);
|
|
6
|
+
}
|
|
7
|
+
const fileSubject = subject.kind === "file" ? subject : requireWorkspaceFileFocus(subject);
|
|
8
|
+
const artifact = subject.kind === "file"
|
|
9
|
+
? await resolveArtifactReference(deps, subject, "file")
|
|
10
|
+
: await resolveWorkspaceArtifactReference(deps, subject, fileSubject.artifact);
|
|
11
|
+
const file = await deps.getArtifactFile({
|
|
12
|
+
artifactId: artifact.artifactId,
|
|
13
|
+
filePath: fileSubject.filePath
|
|
14
|
+
});
|
|
15
|
+
const summary = {
|
|
16
|
+
status: "ok",
|
|
17
|
+
headline: `Read ${file.filePath}.`,
|
|
18
|
+
subject: createSummarySubject({
|
|
19
|
+
task: "file",
|
|
20
|
+
requested: subject,
|
|
21
|
+
filePath: file.filePath,
|
|
22
|
+
artifactId: artifact.artifactId
|
|
23
|
+
}),
|
|
24
|
+
counts: {
|
|
25
|
+
bytes: file.contentBytes
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
return {
|
|
29
|
+
...buildEntryToolResult({
|
|
30
|
+
task: "file",
|
|
31
|
+
summary,
|
|
32
|
+
detail,
|
|
33
|
+
include,
|
|
34
|
+
blocks: {
|
|
35
|
+
subject: {
|
|
36
|
+
requested: subject,
|
|
37
|
+
resolved: {
|
|
38
|
+
artifactId: artifact.artifactId,
|
|
39
|
+
filePath: file.filePath
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
file: {
|
|
43
|
+
filePath: file.filePath,
|
|
44
|
+
contentBytes: file.contentBytes,
|
|
45
|
+
truncated: file.truncated,
|
|
46
|
+
content: include.includes("source") || detail !== "summary" ? file.content : undefined
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
alwaysBlocks: ["subject"]
|
|
50
|
+
}),
|
|
51
|
+
warnings: [...artifact.warnings]
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=file.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type DetailLevel } from "../../response-contract.js";
|
|
2
|
+
import { type Subject, type InspectMinecraftDeps } from "../internal.js";
|
|
3
|
+
export declare function handleListFiles(deps: InspectMinecraftDeps, subject: Subject, detail: DetailLevel, include: string[], limit: number | undefined, cursor: string | undefined): Promise<{
|
|
4
|
+
warnings: string[];
|
|
5
|
+
}>;
|