@adhisang/minecraft-modding-mcp 6.1.1 → 6.2.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 +30 -0
- package/README.md +4 -2
- package/dist/cache-registry.d.ts +1 -1
- package/dist/cache-registry.js +3 -0
- package/dist/entry-tools/analyze-mod-service.d.ts +12 -6
- package/dist/entry-tools/analyze-mod-service.js +37 -3
- package/dist/entry-tools/analyze-symbol-service.d.ts +2 -0
- package/dist/entry-tools/analyze-symbol-service.js +37 -2
- package/dist/entry-tools/inspect-minecraft/internal.d.ts +4 -0
- package/dist/entry-tools/inspect-minecraft/internal.js +28 -0
- package/dist/entry-tools/manage-cache-service.d.ts +4 -4
- package/dist/error-mapping.d.ts +13 -0
- package/dist/error-mapping.js +35 -2
- package/dist/errors.d.ts +2 -0
- package/dist/errors.js +2 -0
- package/dist/index.js +37 -17
- package/dist/mapping/internal-types.d.ts +7 -0
- package/dist/mapping/types.d.ts +18 -0
- package/dist/mapping-service.js +16 -3
- package/dist/minecraft-explorer-service.d.ts +4 -0
- package/dist/minecraft-explorer-service.js +156 -17
- package/dist/mod-analyzer.d.ts +7 -0
- package/dist/mod-analyzer.js +28 -7
- package/dist/source/artifact-resolver.d.ts +2 -0
- package/dist/source/artifact-resolver.js +24 -1
- package/dist/source/class-source/members-builder.d.ts +4 -0
- package/dist/source/class-source/members-builder.js +3 -1
- package/dist/source/class-source.d.ts +2 -1
- package/dist/source/class-source.js +154 -17
- package/dist/source/did-you-mean.d.ts +14 -0
- package/dist/source/did-you-mean.js +79 -0
- package/dist/source/file-access.js +159 -3
- package/dist/source/indexer.js +72 -2
- package/dist/source/lifecycle/runtime-check.js +9 -5
- package/dist/source/nested-jars.d.ts +59 -0
- package/dist/source/nested-jars.js +198 -0
- package/dist/source/workspace-target.js +5 -2
- package/dist/source-jar-reader.d.ts +16 -0
- package/dist/source-jar-reader.js +82 -0
- package/dist/source-service.d.ts +36 -0
- package/dist/source-service.js +49 -6
- package/dist/stage-emitter.js +24 -8
- package/dist/stdio-supervisor.d.ts +92 -9
- package/dist/stdio-supervisor.js +915 -103
- package/dist/tool-contract-manifest.js +1 -1
- package/dist/tool-guidance.js +3 -1
- package/dist/tool-schemas.d.ts +1337 -149
- package/dist/tool-schemas.js +38 -7
- package/dist/types.d.ts +23 -0
- package/dist/workspace-mapping-service.d.ts +1 -0
- package/dist/workspace-mapping-service.js +120 -8
- package/docs/tool-reference.md +19 -3
- package/package.json +1 -1
package/dist/stage-emitter.js
CHANGED
|
@@ -15,15 +15,31 @@ export function makeStageEmitter(extra, options = {}) {
|
|
|
15
15
|
if (requestId === undefined || typeof sendNotification !== "function") {
|
|
16
16
|
return NOOP_STAGE_EMITTER;
|
|
17
17
|
}
|
|
18
|
+
let deliveryPending = false;
|
|
18
19
|
return async (stage, meta) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
if (deliveryPending) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
let delivery;
|
|
24
|
+
try {
|
|
25
|
+
delivery = sendNotification({
|
|
26
|
+
method: "$/stageUpdate",
|
|
27
|
+
params: {
|
|
28
|
+
stage,
|
|
29
|
+
meta: meta ?? null,
|
|
30
|
+
t: performance.now(),
|
|
31
|
+
requestId
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
deliveryPending = true;
|
|
39
|
+
void Promise.resolve(delivery)
|
|
40
|
+
.catch(() => undefined)
|
|
41
|
+
.finally(() => {
|
|
42
|
+
deliveryPending = false;
|
|
27
43
|
});
|
|
28
44
|
};
|
|
29
45
|
}
|
|
@@ -1,6 +1,36 @@
|
|
|
1
|
-
import type
|
|
2
|
-
type
|
|
1
|
+
import { type ChildProcessWithoutNullStreams } from "node:child_process";
|
|
2
|
+
import type { JSONRPCMessage, JSONRPCResponse } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
export declare function loadValidateProjectTimeoutMs(value?: string | undefined): number;
|
|
4
|
+
export declare function computeWorkerStartupWatchdogMs(validateProjectTimeoutMs: number): number;
|
|
5
|
+
export declare function computeRestartBackoffMs(retryIndex: number): number;
|
|
6
|
+
export declare function terminatePosixProcessGroup(pid: number, kill?: (pid: number, signal: NodeJS.Signals) => void): boolean;
|
|
7
|
+
export declare function buildWindowsTreeKillArgs(pid: number): string[];
|
|
8
|
+
export declare function shouldRetainUnavailableNotification(method: string): boolean;
|
|
9
|
+
export type RestartReservation = {
|
|
10
|
+
epoch: number;
|
|
11
|
+
notBefore: number;
|
|
12
|
+
delayMs: number;
|
|
13
|
+
};
|
|
14
|
+
export declare class RestartBackoffState {
|
|
15
|
+
private retryIndex;
|
|
16
|
+
private epoch;
|
|
17
|
+
reserve(now: number): RestartReservation;
|
|
18
|
+
reset(): void;
|
|
19
|
+
}
|
|
20
|
+
export declare function retryPosixTreeToken(pid: number, kill?: (pid: number, signal: NodeJS.Signals) => void): boolean;
|
|
21
|
+
export declare function settleTreeCleanupWithin(operation: Promise<boolean>, timeoutMs: number, onTimeout?: () => void): Promise<boolean>;
|
|
22
|
+
export type SupervisorOptions = {
|
|
3
23
|
entryFile: string;
|
|
24
|
+
validateProjectTimeoutMs?: number;
|
|
25
|
+
clientWriter?: (message: JSONRPCMessage) => void;
|
|
26
|
+
treeTokenRetrier?: (pid: number) => boolean | Promise<boolean>;
|
|
27
|
+
treeCleanupTimeoutMs?: number;
|
|
28
|
+
eventWriter?: (level: "warn" | "error" | "info", event: string, details?: Record<string, unknown>) => void;
|
|
29
|
+
monotonicNow?: () => number;
|
|
30
|
+
timerScheduler?: (callback: () => void, delayMs: number) => NodeJS.Timeout;
|
|
31
|
+
timerClearer?: (timer: NodeJS.Timeout) => void;
|
|
32
|
+
workerSpawner?: () => ChildProcessWithoutNullStreams;
|
|
33
|
+
treeTerminator?: (pid: number) => boolean | Promise<boolean>;
|
|
4
34
|
};
|
|
5
35
|
type RequestId = string | number;
|
|
6
36
|
export type ExitInfo = {
|
|
@@ -39,6 +69,15 @@ export type RedactedToolArgs = {
|
|
|
39
69
|
modified: boolean;
|
|
40
70
|
};
|
|
41
71
|
export declare function redactToolArgs(args: unknown): RedactedToolArgs;
|
|
72
|
+
export declare function buildSupervisorQueueLimitReply(id: RequestId, method: string): JSONRPCResponse;
|
|
73
|
+
export type BuildValidateProjectTimeoutReplyInput = {
|
|
74
|
+
request: PendingRequestSnapshot;
|
|
75
|
+
phase: "queue" | "running";
|
|
76
|
+
deadlineMs: number;
|
|
77
|
+
now: number;
|
|
78
|
+
workerRestartInitiated: boolean;
|
|
79
|
+
};
|
|
80
|
+
export declare function buildValidateProjectTimeoutReply(input: BuildValidateProjectTimeoutReplyInput): JSONRPCResponse;
|
|
42
81
|
export declare function decideRetryRecommendation(ctx: Pick<RestartContext, "toolName" | "lastStage" | "lastStageMeta" | "exit">, recentRestartTimestamps: number[]): RetryRecommendation;
|
|
43
82
|
export declare function buildSyntheticCallToolResult(id: RequestId, ctx: RestartContext): JSONRPCResponse;
|
|
44
83
|
export declare function pruneRestartTimestamps(timestamps: number[], now: number, windowMs?: number): number[];
|
|
@@ -62,15 +101,40 @@ export declare function buildWorkerRestartReply(req: PendingRequestSnapshot, exi
|
|
|
62
101
|
};
|
|
63
102
|
export declare class StdioSupervisor {
|
|
64
103
|
private readonly entryFile;
|
|
104
|
+
private readonly validateProjectTimeoutMs;
|
|
105
|
+
private readonly workerStartupWatchdogMs;
|
|
106
|
+
private readonly clientWriter;
|
|
107
|
+
private readonly treeTokenRetrier;
|
|
108
|
+
private readonly treeCleanupTimeoutMs;
|
|
109
|
+
private readonly eventWriter;
|
|
110
|
+
private readonly monotonicNow;
|
|
111
|
+
private readonly timerScheduler;
|
|
112
|
+
private readonly timerClearer;
|
|
113
|
+
private readonly workerSpawner;
|
|
114
|
+
private readonly treeTerminator;
|
|
65
115
|
private readonly clientReader;
|
|
66
|
-
private readonly
|
|
67
|
-
private readonly
|
|
116
|
+
private readonly workerReaders;
|
|
117
|
+
private readonly queuedRequests;
|
|
118
|
+
private readonly queuedNotifications;
|
|
68
119
|
private readonly pendingRequests;
|
|
69
120
|
private readonly recentRestarts;
|
|
121
|
+
private readonly liveChildren;
|
|
122
|
+
private readonly staleChildren;
|
|
123
|
+
private readonly cleanupStates;
|
|
124
|
+
private readonly unresolvedTreeTokens;
|
|
125
|
+
private readonly restartBackoff;
|
|
126
|
+
private readonly terminalChildren;
|
|
70
127
|
private child;
|
|
71
128
|
private childReady;
|
|
72
129
|
private shuttingDown;
|
|
73
130
|
private restartTimer;
|
|
131
|
+
private startupWatchdog;
|
|
132
|
+
private validateBarrierKey;
|
|
133
|
+
private runningValidateKey;
|
|
134
|
+
private attemptToken;
|
|
135
|
+
private currentRetryEpoch;
|
|
136
|
+
private currentRetryReservation;
|
|
137
|
+
private retryPaused;
|
|
74
138
|
private workerStderrBuffer;
|
|
75
139
|
private clientMode;
|
|
76
140
|
private initializeRequest;
|
|
@@ -85,11 +149,17 @@ export declare class StdioSupervisor {
|
|
|
85
149
|
private readonly handleClientClosed;
|
|
86
150
|
private readonly handleTerminateSignal;
|
|
87
151
|
private handleClientMessage;
|
|
88
|
-
private
|
|
152
|
+
private createPendingRequest;
|
|
153
|
+
private canDispatchImmediately;
|
|
154
|
+
private forwardRequest;
|
|
155
|
+
private writeToWorker;
|
|
156
|
+
private handleCancellation;
|
|
157
|
+
private handleValidateProjectDeadline;
|
|
158
|
+
private drainQueue;
|
|
89
159
|
private spawnWorker;
|
|
90
|
-
private
|
|
91
|
-
private
|
|
92
|
-
private
|
|
160
|
+
private handleWorkerData;
|
|
161
|
+
private handleWorkerStdinError;
|
|
162
|
+
private handleWorkerStderr;
|
|
93
163
|
private handleWorkerProcessError;
|
|
94
164
|
private handleWorkerExit;
|
|
95
165
|
private handleWorkerMessage;
|
|
@@ -99,8 +169,21 @@ export declare class StdioSupervisor {
|
|
|
99
169
|
private flushQueue;
|
|
100
170
|
private failPendingRequestsOnWorkerExit;
|
|
101
171
|
private writeToClient;
|
|
172
|
+
private clearInitialInitializationState;
|
|
173
|
+
private liveCapOccupancy;
|
|
174
|
+
private clearStartupWatchdog;
|
|
175
|
+
private adoptActiveChild;
|
|
176
|
+
private invalidateCurrentChild;
|
|
177
|
+
private detachCurrentChild;
|
|
178
|
+
private recoverTimedOutWorker;
|
|
179
|
+
private beginTreeTermination;
|
|
180
|
+
private finishTreeTermination;
|
|
181
|
+
private retryUnresolvedTreeToken;
|
|
182
|
+
private handleStartupFailure;
|
|
183
|
+
private failQueuedRequestsOnStartupFailure;
|
|
102
184
|
private scheduleRestart;
|
|
103
|
-
private
|
|
185
|
+
private armRestartReservation;
|
|
186
|
+
private resumePausedRestart;
|
|
104
187
|
private shutdown;
|
|
105
188
|
}
|
|
106
189
|
export declare const STDIO_WORKER_MODE_ENV = "MCP_STDIO_WORKER_MODE";
|