@loontail/minecraft-kit 0.5.0 → 0.6.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/dist/index.d.ts CHANGED
@@ -1,15 +1,91 @@
1
- /** Pluggable in-memory cache for HTTP metadata responses. */
2
- interface MetadataCache {
3
- get<T>(key: string): T | undefined;
4
- set<T>(key: string, value: T, ttlMs?: number): void;
5
- delete(key: string): void;
6
- clear(): void;
7
- }
1
+ /** Authentication modes accepted by the launch composer. */
2
+ declare const AuthModes: {
3
+ /** Offline-mode play with a chosen username and synthetic UUID. */
4
+ readonly OFFLINE: "offline";
5
+ /** Pre-authenticated session — caller provides the access token and identity. */
6
+ readonly ONLINE: "online";
7
+ };
8
+ /** Auth mode literal. */
9
+ type AuthMode = (typeof AuthModes)[keyof typeof AuthModes];
10
+ /** Offline authentication. */
11
+ type OfflineAuth = {
12
+ readonly mode: typeof AuthModes.OFFLINE;
13
+ readonly username: string;
14
+ /** Optional explicit UUID. When omitted, a deterministic UUID is derived from the username. */
15
+ readonly uuid?: string;
16
+ };
17
+ /** Online (token-based) authentication. */
18
+ type OnlineAuth = {
19
+ readonly mode: typeof AuthModes.ONLINE;
20
+ readonly username: string;
21
+ readonly uuid: string;
22
+ readonly accessToken: string;
23
+ readonly userType?: string;
24
+ readonly clientId?: string;
25
+ readonly xuid?: string;
26
+ };
27
+ /** Auth shape consumed by `kit.launch.compose`. */
28
+ type LaunchAuth = OfflineAuth | OnlineAuth;
29
+ /**
30
+ * Device-code prompt presented to the user. The caller renders these to the user, who then
31
+ * visits {@link verificationUri} in a browser and enters {@link userCode}.
32
+ */
33
+ type DeviceCodePrompt = {
34
+ /** Short alphanumeric code the user types on the verification page. */
35
+ readonly userCode: string;
36
+ /** URI the user opens to complete sign-in (typically `https://microsoft.com/link`). */
37
+ readonly verificationUri: string;
38
+ /** Human-readable instruction string suggested by Microsoft. */
39
+ readonly message: string;
40
+ /** Seconds before the device/user code pair becomes invalid. */
41
+ readonly expiresIn: number;
42
+ /** Recommended seconds between polling requests. */
43
+ readonly interval: number;
44
+ };
45
+ /** Opaque state returned by `start()` and consumed by `poll()`. */
46
+ type DeviceCodeState = {
47
+ readonly deviceCode: string;
48
+ readonly userCode: string;
49
+ readonly verificationUri: string;
50
+ readonly message: string;
51
+ readonly expiresIn: number;
52
+ readonly interval: number;
53
+ readonly clientId: string;
54
+ /** Wall-clock ms timestamp after which polling should stop. */
55
+ readonly expiresAt: number;
56
+ };
57
+ /**
58
+ * Combined Microsoft + Minecraft session returned by `kit.auth.login` and `kit.auth.refresh`.
59
+ *
60
+ * The fields under {@link minecraft} are everything {@link OnlineAuth} needs. The fields under
61
+ * {@link microsoft} are needed only by the launcher to refresh the session later — persist them
62
+ * to durable storage (encrypted) alongside the user's profile.
63
+ */
64
+ type MojangSession = {
65
+ readonly minecraft: {
66
+ /** Player display name. */
67
+ readonly username: string;
68
+ /** Player UUID, dashed (e.g. `f81d4fae-7dec-11d0-a765-00a0c91e6bf6`). */
69
+ readonly uuid: string;
70
+ /** Bearer token for `api.minecraftservices.com` and the game itself. */
71
+ readonly accessToken: string;
72
+ /** Wall-clock ms timestamp when {@link accessToken} expires. */
73
+ readonly expiresAt: number;
74
+ /** Xbox User ID (XUID) as a numeric string. */
75
+ readonly xuid: string;
76
+ };
77
+ readonly microsoft: {
78
+ /** Microsoft refresh token; used to obtain a fresh session without re-prompting. */
79
+ readonly refreshToken: string;
80
+ /** Azure AD application id used to mint the session. */
81
+ readonly clientId: string;
82
+ };
83
+ };
8
84
 
9
85
  /** Subset of fetch headers the library actually uses. */
10
86
  type HttpHeaders = Readonly<Record<string, string>>;
11
87
  /** Response delivered by the {@link HttpClient} interface. */
12
- interface HttpResponse {
88
+ type HttpResponse = {
13
89
  readonly status: number;
14
90
  readonly headers: HttpHeaders;
15
91
  readonly url: string;
@@ -18,24 +94,161 @@ interface HttpResponse {
18
94
  bytes(): Promise<Uint8Array>;
19
95
  /** Stream the body. The stream may be consumed at most once. */
20
96
  stream(): AsyncIterable<Uint8Array>;
21
- }
97
+ };
98
+ /** HTTP method supported by {@link HttpClient}. */
99
+ type HttpMethod = "GET" | "POST";
100
+ /** Body payload accepted on POST requests. */
101
+ type HttpRequestBody = string | Uint8Array;
22
102
  /** Options for an HTTP request. */
23
- interface HttpRequestOptions {
103
+ type HttpRequestOptions = {
24
104
  readonly headers?: HttpHeaders;
25
105
  readonly signal?: AbortSignal;
26
106
  readonly timeoutMs?: number;
27
107
  /** When true, do not consult the in-memory cache. */
28
108
  readonly noCache?: boolean;
29
- }
109
+ /** HTTP method. Defaults to `GET`. */
110
+ readonly method?: HttpMethod;
111
+ /** Request body. Ignored for GET. */
112
+ readonly body?: HttpRequestBody;
113
+ /**
114
+ * When `true`, the client returns the response even for non-2xx statuses
115
+ * instead of throwing. Useful for callers that must inspect the body of
116
+ * error responses (e.g. OAuth polling endpoints that return 400 with
117
+ * structured JSON like `{"error":"authorization_pending"}`).
118
+ */
119
+ readonly acceptNonOk?: boolean;
120
+ };
30
121
  /**
31
122
  * Pluggable HTTP client. The default implementation uses Node's built-in fetch; consumers
32
123
  * can inject a fake (e.g. for tests) by passing an `httpClient` to the {@link MinecraftKit}
33
124
  * constructor.
34
125
  */
35
- interface HttpClient {
126
+ type HttpClient = {
36
127
  request(url: string, options?: HttpRequestOptions): Promise<HttpResponse>;
128
+ };
129
+
130
+ /** Log levels accepted by the pluggable logger. */
131
+ declare const LogLevels: {
132
+ readonly DEBUG: "debug";
133
+ readonly INFO: "info";
134
+ readonly WARN: "warn";
135
+ readonly ERROR: "error";
136
+ };
137
+ /** Log-level literal. */
138
+ type LogLevel = (typeof LogLevels)[keyof typeof LogLevels];
139
+ /** Pluggable logger. Default implementation is a silent logger; pass your own to surface logs. */
140
+ type Logger = {
141
+ log(level: LogLevel, message: string, fields?: Readonly<Record<string, unknown>>): void;
142
+ };
143
+
144
+ /** Env var consulted when no explicit `clientId` is supplied. */
145
+ declare const CLIENT_ID_ENV_VAR = "MINECRAFT_KIT_MSA_CLIENT_ID";
146
+
147
+ /** Options accepted by {@link MojangAuthApi.login}. */
148
+ type LoginOptions = {
149
+ /**
150
+ * Azure AD application id. When omitted, the value of
151
+ * `process.env.MINECRAFT_KIT_MSA_CLIENT_ID` is used. Throws `AUTH_MISSING_CLIENT_ID` if
152
+ * neither is set — the library cannot ship a default client id.
153
+ */
154
+ readonly clientId?: string;
155
+ /**
156
+ * Called once with the URL + user code the user must enter in a browser. The promise
157
+ * returned by `login` resolves only after the user finishes signing in (or rejects on
158
+ * abort / decline / timeout).
159
+ */
160
+ readonly onPrompt: (prompt: DeviceCodePrompt) => void | Promise<void>;
161
+ /** Called once per polling tick — useful for UI "still waiting" feedback. */
162
+ readonly onPoll?: (info: {
163
+ readonly nextDelayMs: number;
164
+ readonly expiresAt: number;
165
+ }) => void;
166
+ readonly signal?: AbortSignal;
167
+ };
168
+ /** Options accepted by {@link MojangAuthApi.refresh}. */
169
+ type RefreshOptions = {
170
+ /** As in {@link LoginOptions.clientId}. */
171
+ readonly clientId?: string;
172
+ readonly signal?: AbortSignal;
173
+ };
174
+ /** Options accepted by {@link MojangAuthApi.deviceCode.start}. */
175
+ type StartDeviceCodeOptions = {
176
+ readonly clientId?: string;
177
+ readonly signal?: AbortSignal;
178
+ };
179
+ /** Options accepted by {@link MojangAuthApi.deviceCode.poll}. */
180
+ type PollDeviceCodeOptions = {
181
+ readonly signal?: AbortSignal;
182
+ readonly onTick?: (info: {
183
+ readonly nextDelayMs: number;
184
+ readonly expiresAt: number;
185
+ }) => void;
186
+ };
187
+ /**
188
+ * High-level Microsoft / Mojang auth surface attached to {@link import("../kit").MinecraftKit}
189
+ * as `kit.auth`. Implements the standard 5-step flow:
190
+ *
191
+ * 1. Microsoft OAuth2 device-code grant against the `consumers` tenant.
192
+ * 2. Xbox Live RPS exchange.
193
+ * 3. XSTS token bound to `rp://api.minecraftservices.com/`.
194
+ * 4. `login_with_xbox` to get a Minecraft bearer token.
195
+ * 5. `minecraft/profile` to resolve the player UUID + display name.
196
+ *
197
+ * Returns a {@link MojangSession} carrying everything launch composition needs plus the
198
+ * Microsoft refresh token. The library does NOT persist tokens — that's the launcher's job.
199
+ */
200
+ declare class MojangAuthApi {
201
+ private readonly http;
202
+ constructor(http: HttpClient);
203
+ /**
204
+ * Run the full device-code flow end-to-end. The caller supplies an `onPrompt` callback to
205
+ * render the URL + code to the user; this method polls until they finish.
206
+ */
207
+ login(options: LoginOptions): Promise<MojangSession>;
208
+ /** Refresh a previously obtained session. The Microsoft refresh token may be rotated. */
209
+ refresh(refreshToken: string, options?: RefreshOptions): Promise<MojangSession>;
210
+ /**
211
+ * Lower-level device-code surface — exposed so callers can decouple "show prompt" from
212
+ * "block on poll" (e.g. a GUI that lets the user dismiss the modal). Most callers should
213
+ * use {@link login} instead.
214
+ */
215
+ readonly deviceCode: {
216
+ start: (options?: StartDeviceCodeOptions) => Promise<{
217
+ readonly prompt: DeviceCodePrompt;
218
+ readonly state: DeviceCodeState;
219
+ }>;
220
+ poll: (state: DeviceCodeState, options?: PollDeviceCodeOptions) => Promise<MojangSession>;
221
+ };
222
+ /** Steps 2 → 5: given a Microsoft access token, finish the flow. */
223
+ private completeMicrosoftToken;
224
+ }
225
+ /**
226
+ * Project a {@link MojangSession} into the {@link OnlineAuth} shape that `kit.launch.compose`
227
+ * accepts.
228
+ */
229
+ declare const toOnlineAuth: (session: MojangSession) => OnlineAuth;
230
+
231
+ /**
232
+ * Cooperative pause primitive. Consumers call {@link waitWhilePaused} at safe
233
+ * checkpoints. Independent from `AbortSignal` — abort wins at the next signal
234
+ * check.
235
+ */
236
+ declare class PauseController {
237
+ #private;
238
+ get paused(): boolean;
239
+ pause(): void;
240
+ resume(): void;
241
+ waitWhilePaused(): Promise<void>;
37
242
  }
38
243
 
244
+ /** Pluggable in-memory cache for HTTP metadata responses. */
245
+ type MetadataCache = {
246
+ get<T>(key: string): T | undefined;
247
+ set<T>(key: string, value: T, ttlMs?: number): void;
248
+ delete(key: string): void;
249
+ clear(): void;
250
+ };
251
+
39
252
  /**
40
253
  * Minecraft release channels matching the `type` field of Mojang version manifest entries.
41
254
  */
@@ -53,7 +266,7 @@ type MinecraftChannel = (typeof MinecraftChannels)[keyof typeof MinecraftChannel
53
266
  * Note: this is a summary entry, not the full per-version manifest. Use
54
267
  * {@link ResolvedMinecraft} for the resolved/parsed full manifest.
55
268
  */
56
- interface MinecraftVersionSummary {
269
+ type MinecraftVersionSummary = {
57
270
  /** Version id (e.g. `"1.20.1"`). */
58
271
  readonly id: string;
59
272
  /** Release channel. */
@@ -68,9 +281,9 @@ interface MinecraftVersionSummary {
68
281
  readonly sha1: string;
69
282
  /** Compliance level: 0 = legacy, 1 = secure-chat / safety features. */
70
283
  readonly complianceLevel: number;
71
- }
284
+ };
72
285
  /** Subset of the per-version manifest used by resolvers and consumers. */
73
- interface MinecraftVersionManifest {
286
+ type MinecraftVersionManifest = {
74
287
  readonly id: string;
75
288
  readonly type: MinecraftChannel | string;
76
289
  readonly mainClass: string;
@@ -91,30 +304,30 @@ interface MinecraftVersionManifest {
91
304
  readonly time?: string;
92
305
  readonly minimumLauncherVersion?: number;
93
306
  readonly complianceLevel?: number;
94
- }
307
+ };
95
308
  /** Reference to the asset-index JSON file. */
96
- interface AssetIndexReference {
309
+ type AssetIndexReference = {
97
310
  readonly id: string;
98
311
  readonly sha1: string;
99
312
  readonly size: number;
100
313
  readonly totalSize: number;
101
314
  readonly url: string;
102
- }
315
+ };
103
316
  /** Per-platform downloads block of the Minecraft per-version manifest. */
104
- interface MinecraftDownloads {
317
+ type MinecraftDownloads = {
105
318
  readonly client: ArtifactDownload;
106
319
  readonly server?: ArtifactDownload;
107
320
  readonly client_mappings?: ArtifactDownload;
108
321
  readonly server_mappings?: ArtifactDownload;
109
- }
322
+ };
110
323
  /** A single hash-verified download. */
111
- interface ArtifactDownload {
324
+ type ArtifactDownload = {
112
325
  readonly sha1: string;
113
326
  readonly size: number;
114
327
  readonly url: string;
115
- }
328
+ };
116
329
  /** Library entry. Combines vanilla, modern-natives, and legacy-classifier shapes. */
117
- interface MinecraftLibrary {
330
+ type MinecraftLibrary = {
118
331
  readonly name: string;
119
332
  readonly downloads?: MinecraftLibraryDownloads;
120
333
  readonly natives?: Readonly<Record<string, string>>;
@@ -124,18 +337,18 @@ interface MinecraftLibrary {
124
337
  readonly rules?: readonly LibraryRule[];
125
338
  /** Some Fabric/Forge libraries carry only a Maven base URL plus a coordinate. */
126
339
  readonly url?: string;
127
- }
340
+ };
128
341
  /** Library downloads block. */
129
- interface MinecraftLibraryDownloads {
342
+ type MinecraftLibraryDownloads = {
130
343
  readonly artifact?: LibraryArtifact;
131
344
  readonly classifiers?: Readonly<Record<string, LibraryArtifact>>;
132
- }
345
+ };
133
346
  /** An individual library artifact (jar/zip). */
134
347
  interface LibraryArtifact extends ArtifactDownload {
135
348
  readonly path: string;
136
349
  }
137
350
  /** Rule entry used by libraries and modern arguments. */
138
- interface LibraryRule {
351
+ type LibraryRule = {
139
352
  readonly action: "allow" | "disallow";
140
353
  readonly os?: {
141
354
  readonly name?: string;
@@ -143,25 +356,25 @@ interface LibraryRule {
143
356
  readonly version?: string;
144
357
  };
145
358
  readonly features?: Readonly<Record<string, boolean>>;
146
- }
359
+ };
147
360
  /** Modern (1.13+) arguments structure. */
148
- interface MinecraftArguments {
361
+ type MinecraftArguments = {
149
362
  readonly game: readonly ArgumentEntry[];
150
363
  readonly jvm: readonly ArgumentEntry[];
151
- }
364
+ };
152
365
  /** A single argument entry: bare string or rule-gated value. */
153
366
  type ArgumentEntry = string | {
154
367
  readonly rules: readonly LibraryRule[];
155
368
  readonly value: string | readonly string[];
156
369
  };
157
370
  /** Required Java runtime descriptor from the version manifest. */
158
- interface MinecraftJavaVersion {
371
+ type MinecraftJavaVersion = {
159
372
  /** Mojang java-runtime component name (e.g. `java-runtime-gamma`). */
160
373
  readonly component: string;
161
374
  readonly majorVersion: number;
162
- }
375
+ };
163
376
  /** Logging-config entry from the version manifest. */
164
- interface MinecraftLogging {
377
+ type MinecraftLogging = {
165
378
  readonly client?: {
166
379
  readonly argument: string;
167
380
  readonly file: ArtifactDownload & {
@@ -169,49 +382,49 @@ interface MinecraftLogging {
169
382
  };
170
383
  readonly type: string;
171
384
  };
172
- }
385
+ };
173
386
  /**
174
387
  * Fully resolved Minecraft version: summary + parsed manifest, ready to feed into
175
388
  * `kit.targets.create` or `kit.install.plan`.
176
389
  */
177
- interface ResolvedMinecraft {
390
+ type ResolvedMinecraft = {
178
391
  /** Version id (e.g. `"1.20.1"`). */
179
392
  readonly version: string;
180
393
  readonly channel: MinecraftChannel;
181
394
  readonly manifest: MinecraftVersionManifest;
182
395
  readonly summary: MinecraftVersionSummary;
183
- }
396
+ };
184
397
  /** Asset index document body. */
185
- interface AssetIndexDocument {
398
+ type AssetIndexDocument = {
186
399
  readonly objects: Readonly<Record<string, AssetObject>>;
187
400
  readonly virtual?: boolean;
188
401
  readonly map_to_resources?: boolean;
189
- }
402
+ };
190
403
  /** A single asset object hash + size. */
191
- interface AssetObject {
404
+ type AssetObject = {
192
405
  readonly hash: string;
193
406
  readonly size: number;
194
- }
407
+ };
195
408
 
196
409
  /** Summary entry from `/v2/versions/loader`. */
197
- interface FabricLoaderSummary {
410
+ type FabricLoaderSummary = {
198
411
  readonly version: string;
199
412
  readonly stable: boolean;
200
413
  readonly maven: string;
201
414
  readonly build: number;
202
415
  readonly separator: string;
203
- }
416
+ };
204
417
  /** Compatibility entry from `/v2/versions/loader/{minecraftVersion}`. */
205
- interface FabricCompatibilityEntry {
418
+ type FabricCompatibilityEntry = {
206
419
  readonly loader: FabricLoaderSummary;
207
420
  readonly intermediary: {
208
421
  readonly version: string;
209
422
  readonly maven: string;
210
423
  readonly stable: boolean;
211
424
  };
212
- }
425
+ };
213
426
  /** Fabric profile JSON returned by `/v2/versions/loader/{mc}/{loader}/profile/json`. */
214
- interface FabricProfile {
427
+ type FabricProfile = {
215
428
  readonly id: string;
216
429
  readonly inheritsFrom: string;
217
430
  readonly type: string;
@@ -221,17 +434,17 @@ interface FabricProfile {
221
434
  readonly game?: readonly string[];
222
435
  readonly jvm?: readonly string[];
223
436
  };
224
- }
437
+ };
225
438
  /** Resolved Fabric loader for a specific Minecraft version. */
226
- interface ResolvedFabricLoader {
439
+ type ResolvedFabricLoader = {
227
440
  readonly type: typeof Loaders.FABRIC;
228
441
  readonly minecraftVersion: string;
229
442
  readonly loaderVersion: string;
230
443
  readonly profile: FabricProfile;
231
- }
444
+ };
232
445
 
233
446
  /** A Forge build entry derived from the Maven metadata XML. */
234
- interface ForgeBuildSummary {
447
+ type ForgeBuildSummary = {
235
448
  /** Full Maven version string e.g. `"1.20.1-47.2.0"`. */
236
449
  readonly fullVersion: string;
237
450
  /** Minecraft version e.g. `"1.20.1"`. */
@@ -242,9 +455,9 @@ interface ForgeBuildSummary {
242
455
  readonly isRecommended: boolean;
243
456
  /** True when this build is the latest one per `promotions_slim.json`. */
244
457
  readonly isLatest: boolean;
245
- }
458
+ };
246
459
  /** Modern Forge `install_profile.json` (spec 1) shape — only fields we actually consume. */
247
- interface ForgeInstallProfile {
460
+ type ForgeInstallProfile = {
248
461
  readonly spec: number;
249
462
  readonly profile: string;
250
463
  readonly version: string;
@@ -257,22 +470,22 @@ interface ForgeInstallProfile {
257
470
  readonly libraries: readonly MinecraftLibrary[];
258
471
  readonly processors: readonly ForgeProcessor[];
259
472
  readonly serverJarPath?: string;
260
- }
473
+ };
261
474
  /** Side-keyed data value pair. */
262
- interface ForgeProfileData {
475
+ type ForgeProfileData = {
263
476
  readonly client: string;
264
477
  readonly server: string;
265
- }
478
+ };
266
479
  /** A single processor invocation. */
267
- interface ForgeProcessor {
480
+ type ForgeProcessor = {
268
481
  readonly sides?: readonly ("client" | "server" | "extract")[];
269
482
  readonly jar: string;
270
483
  readonly classpath: readonly string[];
271
484
  readonly args: readonly string[];
272
485
  readonly outputs?: Readonly<Record<string, string>>;
273
- }
486
+ };
274
487
  /** The version.json stored inside the Forge installer JAR. */
275
- interface ForgeVersionJson {
488
+ type ForgeVersionJson = {
276
489
  readonly id: string;
277
490
  readonly inheritsFrom: string;
278
491
  readonly type: string;
@@ -282,27 +495,27 @@ interface ForgeVersionJson {
282
495
  readonly game?: readonly string[];
283
496
  readonly jvm?: readonly string[];
284
497
  };
285
- }
498
+ };
286
499
  /** Resolved Forge loader. */
287
- interface ResolvedForgeLoader {
500
+ type ResolvedForgeLoader = {
288
501
  readonly type: typeof Loaders.FORGE;
289
502
  readonly minecraftVersion: string;
290
503
  readonly forgeVersion: string;
291
504
  readonly fullVersion: string;
292
505
  readonly installerUrl: string;
293
- }
506
+ };
294
507
 
295
508
  /**
296
509
  * Trivial loader used when no mod loader is in play. Carries the resolved Minecraft so the
297
510
  * launch composer has a uniform view across vanilla / Fabric / Forge.
298
511
  */
299
- interface ResolvedVanillaLoader {
512
+ type ResolvedVanillaLoader = {
300
513
  readonly type: typeof Loaders.VANILLA;
301
514
  /** Minecraft version this loader is pinned to. */
302
515
  readonly minecraftVersion: string;
303
516
  /** The Minecraft manifest used for launch — same as the target's `minecraft.manifest`. */
304
517
  readonly minecraft: ResolvedMinecraft;
305
- }
518
+ };
306
519
 
307
520
  /**
308
521
  * Discriminator literal identifying which mod loader is active for a target.
@@ -364,14 +577,14 @@ type Architecture = (typeof Architectures)[keyof typeof Architectures];
364
577
  * Identifies the host system for the launcher. All resolvers consume this object to
365
578
  * pick the right artifacts (libraries, natives, runtime).
366
579
  */
367
- interface RuntimeSystem {
580
+ type RuntimeSystem = {
368
581
  /** OS identifier (mojang naming). */
369
582
  readonly os: OperatingSystem;
370
583
  /** CPU architecture (mojang naming). */
371
584
  readonly arch: Architecture;
372
585
  /** OS version string from `os.release()`. Used to evaluate library `os.version` regex rules. */
373
586
  readonly osVersion: string;
374
- }
587
+ };
375
588
 
376
589
  /**
377
590
  * Mojang Java-runtime component identifiers. New components appear over time
@@ -407,7 +620,7 @@ type RuntimeIndex = Readonly<Record<string, RuntimeIndexPlatform>>;
407
620
  /** Per-platform component map inside the runtime index. */
408
621
  type RuntimeIndexPlatform = Readonly<Record<string, readonly RuntimeIndexEntry[]>>;
409
622
  /** A single available runtime release. */
410
- interface RuntimeIndexEntry {
623
+ type RuntimeIndexEntry = {
411
624
  readonly availability: {
412
625
  readonly group: number;
413
626
  readonly progress: number;
@@ -421,15 +634,15 @@ interface RuntimeIndexEntry {
421
634
  readonly name: string;
422
635
  readonly released: string;
423
636
  };
424
- }
637
+ };
425
638
  /** Inner per-component file manifest. */
426
- interface RuntimeFilesManifest {
639
+ type RuntimeFilesManifest = {
427
640
  readonly files: Readonly<Record<string, RuntimeFileEntry>>;
428
- }
641
+ };
429
642
  /** A single file in the runtime manifest. */
430
643
  type RuntimeFileEntry = RuntimeFileFile | RuntimeFileDirectory | RuntimeFileLink;
431
644
  /** A file entry: real bytes to download, may have lzma sidecar. */
432
- interface RuntimeFileFile {
645
+ type RuntimeFileFile = {
433
646
  readonly type: "file";
434
647
  readonly executable: boolean;
435
648
  readonly downloads: {
@@ -444,18 +657,18 @@ interface RuntimeFileFile {
444
657
  readonly url: string;
445
658
  };
446
659
  };
447
- }
660
+ };
448
661
  /** A directory placeholder. */
449
- interface RuntimeFileDirectory {
662
+ type RuntimeFileDirectory = {
450
663
  readonly type: "directory";
451
- }
664
+ };
452
665
  /** A relative symlink. */
453
- interface RuntimeFileLink {
666
+ type RuntimeFileLink = {
454
667
  readonly type: "link";
455
668
  readonly target: string;
456
- }
669
+ };
457
670
  /** Resolved runtime ready to install or launch with. */
458
- interface ResolvedRuntime {
671
+ type ResolvedRuntime = {
459
672
  /** Mojang component name (e.g. `java-runtime-gamma`). */
460
673
  readonly component: string;
461
674
  /** Platform key inside the runtime index (e.g. `windows-x64`). */
@@ -474,7 +687,7 @@ interface ResolvedRuntime {
474
687
  * live at `<installRoot>/<component>/...`. When unset, defaults to `<target.directory>/runtime`.
475
688
  */
476
689
  readonly installRoot?: string;
477
- }
690
+ };
478
691
 
479
692
  /**
480
693
  * Fully resolved target: a concrete Minecraft + loader + runtime + directory.
@@ -483,7 +696,7 @@ interface ResolvedRuntime {
483
696
  * it. `kit.targets.create` produces a Target from already-resolved components;
484
697
  * `kit.targets.resolve` resolves them in one go.
485
698
  */
486
- interface Target {
699
+ type Target = {
487
700
  /** Stable identifier chosen by the consumer. Used for diagnostics, not persistence. */
488
701
  readonly id: string;
489
702
  /** Absolute or relative path to the per-target Minecraft directory. */
@@ -491,20 +704,20 @@ interface Target {
491
704
  readonly minecraft: ResolvedMinecraft;
492
705
  readonly loader: Loader;
493
706
  readonly runtime: ResolvedRuntime;
494
- }
707
+ };
495
708
  /** Inputs accepted by `kit.targets.create`. */
496
- interface TargetCreateInput {
709
+ type TargetCreateInput = {
497
710
  readonly id: string;
498
711
  readonly directory: string;
499
712
  readonly minecraft: ResolvedMinecraft;
500
713
  readonly loader: Loader;
501
714
  readonly runtime: ResolvedRuntime;
502
- }
715
+ };
503
716
  /**
504
717
  * Discovered installation found by scanning a root directory. Contains only what was
505
718
  * actually read from disk — no assumptions about correctness, completeness, or repair state.
506
719
  */
507
- interface DiscoveredTarget {
720
+ type DiscoveredTarget = {
508
721
  /** Subdirectory name under the scanned root. */
509
722
  readonly id: string;
510
723
  /** Absolute or normalized directory path. */
@@ -515,19 +728,19 @@ interface DiscoveredTarget {
515
728
  readonly loaders: readonly DiscoveredLoaderHint[];
516
729
  /** Detected Java executable, when one is present in the per-target `runtime/` folder. */
517
730
  readonly runtime?: DiscoveredRuntimeHint;
518
- }
731
+ };
519
732
  /** Inferred loader hint (does not assert correctness). */
520
- interface DiscoveredLoaderHint {
733
+ type DiscoveredLoaderHint = {
521
734
  readonly type: LoaderKind;
522
735
  readonly minecraftVersion?: string;
523
736
  readonly version?: string;
524
- }
737
+ };
525
738
  /** Detected runtime files. */
526
- interface DiscoveredRuntimeHint {
739
+ type DiscoveredRuntimeHint = {
527
740
  readonly component?: string;
528
741
  readonly javaPath?: string;
529
742
  readonly javaVersion?: string;
530
- }
743
+ };
531
744
 
532
745
  /**
533
746
  * Coarse-grained install phases. Used in `install:phase-changed` events so consumers can
@@ -560,50 +773,84 @@ declare const InstallActionKinds: {
560
773
  };
561
774
  /** Discriminator for an install action. */
562
775
  type InstallActionKind = (typeof InstallActionKinds)[keyof typeof InstallActionKinds];
776
+ /**
777
+ * Categorisation tag on every {@link DownloadAction}. Drives the install-phase mapping
778
+ * and lets consumers filter the plan to a subset (e.g. "runtime only").
779
+ */
780
+ declare const DownloadCategories: {
781
+ readonly CLIENT_JAR: "client-jar";
782
+ readonly LIBRARY: "library";
783
+ readonly ASSET_INDEX: "asset-index";
784
+ readonly ASSET: "asset";
785
+ readonly LOGGING_CONFIG: "logging-config";
786
+ readonly FABRIC_LIBRARY: "fabric-library";
787
+ readonly FORGE_LIBRARY: "forge-library";
788
+ readonly RUNTIME_FILE: "runtime-file";
789
+ readonly FORGE_INSTALLER: "forge-installer";
790
+ };
791
+ /** Download category literal — drives `runInstall` phase boundaries. */
792
+ type DownloadCategory = (typeof DownloadCategories)[keyof typeof DownloadCategories];
563
793
  /** A single download step. */
564
- interface DownloadAction {
794
+ type DownloadAction = {
565
795
  readonly kind: typeof InstallActionKinds.DOWNLOAD_FILE;
566
796
  readonly url: string;
567
797
  readonly target: string;
568
798
  readonly expectedSha1?: string;
569
799
  readonly expectedSize?: number;
570
- readonly category: "client-jar" | "library" | "asset-index" | "asset" | "logging-config" | "fabric-library" | "forge-library" | "runtime-file" | "forge-installer";
571
- }
800
+ readonly category: DownloadCategory;
801
+ };
572
802
  /** A native extraction step. Source jar must already exist on disk. */
573
- interface ExtractNativeAction {
803
+ type ExtractNativeAction = {
574
804
  readonly kind: typeof InstallActionKinds.EXTRACT_NATIVE;
575
805
  readonly source: string;
576
806
  readonly destination: string;
577
807
  readonly exclude: readonly string[];
578
- }
808
+ };
579
809
  /**
580
810
  * A Forge processor invocation. `Main-Class` is intentionally NOT carried here — the
581
811
  * runner reads it from `classpath[0]`'s manifest at execution time, because the JAR is
582
812
  * not guaranteed to exist on disk during planning (newer Forge versions ship some
583
813
  * processor JARs as regular Maven libraries instead of bundling them in the installer).
584
814
  */
585
- interface RunForgeProcessorAction {
815
+ type RunForgeProcessorAction = {
586
816
  readonly kind: typeof InstallActionKinds.RUN_FORGE_PROCESSOR;
587
817
  readonly index: number;
588
818
  /** First entry is the processor JAR; remaining entries are its declared classpath. */
589
819
  readonly classpath: readonly string[];
590
820
  readonly args: readonly string[];
591
821
  readonly outputs: Readonly<Record<string, string>>;
592
- }
822
+ };
593
823
  /** Write a version JSON to disk (Fabric / Forge). */
594
- interface WriteVersionJsonAction {
824
+ type WriteVersionJsonAction = {
595
825
  readonly kind: typeof InstallActionKinds.WRITE_VERSION_JSON;
596
826
  readonly path: string;
597
827
  readonly content: string;
598
- }
828
+ };
599
829
  /** Write a logging config (log4j XML) to disk. */
600
- interface WriteLoggingConfigAction {
830
+ type WriteLoggingConfigAction = {
601
831
  readonly kind: typeof InstallActionKinds.WRITE_LOGGING_CONFIG;
602
832
  readonly path: string;
603
833
  readonly content: string;
604
- }
834
+ };
605
835
  /** Discriminated union of install actions. */
606
836
  type InstallAction = DownloadAction | ExtractNativeAction | RunForgeProcessorAction | WriteVersionJsonAction | WriteLoggingConfigAction;
837
+ /**
838
+ * A "runtime-only" install plan target. Used by `planStandaloneRuntimeInstall` to plan a
839
+ * JRE-only install without a Minecraft version/loader pinned to the plan.
840
+ */
841
+ type RuntimeOnlyInstallTarget = {
842
+ readonly id: string;
843
+ readonly directory: string;
844
+ readonly runtime: ResolvedRuntime;
845
+ readonly minecraft?: undefined;
846
+ readonly loader?: undefined;
847
+ };
848
+ /**
849
+ * Shape of `InstallPlan.target`. Either a fully-resolved {@link import("./target").Target} or a
850
+ * runtime-only stand-in. The install runner only reads `target.minecraft`/`target.loader` when
851
+ * the plan actually contains those steps, so runtime-only plans are safe.
852
+ */
853
+ type InstallPlanTarget = Target | RuntimeOnlyInstallTarget;
607
854
  /**
608
855
  * Pre-computed install plan: a flat ordered list of actions plus computed totals.
609
856
  *
@@ -611,30 +858,30 @@ type InstallAction = DownloadAction | ExtractNativeAction | RunForgeProcessorAct
611
858
  * carries a reference to the resolved target so the runner does not need a second target
612
859
  * argument.
613
860
  */
614
- interface InstallPlan {
861
+ type InstallPlan = {
615
862
  readonly targetId: string;
616
863
  readonly directory: string;
617
- readonly target: Target;
864
+ readonly target: InstallPlanTarget;
618
865
  readonly actions: readonly InstallAction[];
619
866
  readonly totalBytes: number;
620
867
  readonly totalActions: number;
621
- }
868
+ };
622
869
  /** Outcome summary returned by `install.run`. */
623
- interface InstallReport {
870
+ type InstallReport = {
624
871
  readonly targetId: string;
625
872
  readonly bytesDownloaded: number;
626
873
  readonly actionsCompleted: number;
627
874
  readonly actionsSkipped: number;
628
875
  readonly durationMs: number;
629
- }
876
+ };
630
877
 
631
878
  /** Inputs to {@link planRuntimeInstall}. */
632
- interface PlanRuntimeInstallInput {
879
+ type PlanRuntimeInstallInput = {
633
880
  readonly target: Target;
634
881
  readonly http: HttpClient;
635
882
  readonly cache: MetadataCache;
636
883
  readonly signal?: AbortSignal;
637
- }
884
+ };
638
885
  /**
639
886
  * Build an install plan that downloads ONLY the Java runtime declared by `target.runtime`.
640
887
  *
@@ -646,9 +893,9 @@ interface PlanRuntimeInstallInput {
646
893
  * install runner — directory placeholders and symlinks declared by the runtime manifest are
647
894
  * still materialized after downloads complete.
648
895
  */
649
- declare function planRuntimeInstall(input: PlanRuntimeInstallInput): Promise<InstallPlan>;
896
+ declare const planRuntimeInstall: (input: PlanRuntimeInstallInput) => Promise<InstallPlan>;
650
897
  /** Inputs to {@link planStandaloneRuntimeInstall}. */
651
- interface PlanStandaloneRuntimeInstallInput {
898
+ type PlanStandaloneRuntimeInstallInput = {
652
899
  readonly id: string;
653
900
  /** Where the runtime files live. Used as `directory` if `runtime.installRoot` is unset. */
654
901
  readonly directory: string;
@@ -656,210 +903,22 @@ interface PlanStandaloneRuntimeInstallInput {
656
903
  readonly http: HttpClient;
657
904
  readonly cache: MetadataCache;
658
905
  readonly signal?: AbortSignal;
659
- }
906
+ };
660
907
  /**
661
908
  * Plan a runtime-only install **without a Minecraft target**. Useful for "Install Java/runtime"
662
909
  * flows where the user just wants a JRE on disk and never had a Minecraft version to choose
663
- * from. The returned plan is shaped exactly like a normal {@link InstallPlan} and runs through
664
- * the standard install runner but its `target.minecraft` and `target.loader` fields are
665
- * intentional placeholders. The runner only reads `target.runtime` for runtime-only plans, so
666
- * the placeholders are never accessed at runtime.
910
+ * from. The returned plan is shaped exactly like a normal {@link InstallPlan} but uses a
911
+ * {@link RuntimeOnlyInstallTarget} that carries only the runtime + directory the runner skips
912
+ * Minecraft/loader-specific stages because they have no actions in this plan.
667
913
  */
668
- declare function planStandaloneRuntimeInstall(input: PlanStandaloneRuntimeInstallInput): Promise<InstallPlan>;
914
+ declare const planStandaloneRuntimeInstall: (input: PlanStandaloneRuntimeInstallInput) => Promise<InstallPlan>;
669
915
 
670
- /** Log levels accepted by the pluggable logger. */
671
- declare const LogLevels: {
672
- readonly DEBUG: "debug";
673
- readonly INFO: "info";
674
- readonly WARN: "warn";
675
- readonly ERROR: "error";
676
- };
677
- /** Log-level literal. */
678
- type LogLevel = (typeof LogLevels)[keyof typeof LogLevels];
679
- /** Pluggable logger. Default implementation is a silent logger; pass your own to surface logs. */
680
- interface Logger {
681
- log(level: LogLevel, message: string, fields?: Readonly<Record<string, unknown>>): void;
682
- }
683
-
684
- /** Shared context passed to every resolver. */
685
- interface ResolverContext {
686
- readonly http: HttpClient;
687
- readonly cache: MetadataCache;
688
- readonly logger: Logger;
689
- }
690
-
691
- /** Inputs to {@link FabricVersionsApi.list}. */
692
- interface FabricListInput {
693
- readonly minecraftVersion?: string;
694
- readonly signal?: AbortSignal;
695
- }
696
- /** Inputs to {@link FabricVersionsApi.resolve}. */
697
- interface FabricResolveInput {
698
- readonly minecraftVersion: string;
699
- readonly preference?: VersionPreferenceKind;
700
- readonly loaderVersion?: string;
701
- readonly signal?: AbortSignal;
702
- }
703
- /** Public Fabric versions API surface. */
704
- declare class FabricVersionsApi {
705
- private readonly ctx;
706
- constructor(ctx: ResolverContext);
707
- /** List Fabric loader versions, optionally constrained to a Minecraft version. */
708
- list(input?: FabricListInput): Promise<readonly FabricLoaderSummary[]>;
709
- /** Resolve a Fabric loader version against a Minecraft version. */
710
- resolve(input: FabricResolveInput): Promise<ResolvedFabricLoader>;
711
- }
712
-
713
- /** Inputs to {@link ForgeVersionsApi.list}. */
714
- interface ForgeListInput {
715
- readonly minecraftVersion?: string;
716
- readonly signal?: AbortSignal;
717
- }
718
- /** Inputs to {@link ForgeVersionsApi.resolve}. */
719
- interface ForgeResolveInput {
720
- readonly minecraftVersion: string;
721
- readonly preference?: VersionPreferenceKind;
722
- readonly forgeVersion?: string;
723
- readonly signal?: AbortSignal;
724
- }
725
- /** Public Forge versions API surface. */
726
- declare class ForgeVersionsApi {
727
- private readonly ctx;
728
- constructor(ctx: ResolverContext);
729
- /** List Forge builds (across all Minecraft versions, or filtered to one). */
730
- list(input?: ForgeListInput): Promise<readonly ForgeBuildSummary[]>;
731
- /** Resolve a Forge build for a Minecraft version. */
732
- resolve(input: ForgeResolveInput): Promise<ResolvedForgeLoader>;
733
- }
734
-
735
- /** Inputs to {@link MinecraftVersionsApi.list}. */
736
- interface MinecraftListInput {
737
- readonly channel?: MinecraftChannel;
738
- readonly signal?: AbortSignal;
739
- }
740
- /** Inputs to {@link MinecraftVersionsApi.latest}. */
741
- interface MinecraftLatestInput {
742
- readonly channel?: MinecraftChannel;
743
- readonly signal?: AbortSignal;
744
- }
745
- /** Inputs to {@link MinecraftVersionsApi.get} / `.resolve`. */
746
- interface MinecraftGetInput {
747
- readonly version: string;
748
- readonly signal?: AbortSignal;
749
- }
750
- /** Public Minecraft versions API surface. */
751
- declare class MinecraftVersionsApi {
752
- private readonly ctx;
753
- constructor(ctx: ResolverContext);
754
- /** List all Minecraft versions, optionally filtered by channel. */
755
- list(input?: MinecraftListInput): Promise<readonly MinecraftVersionSummary[]>;
756
- /** Return the latest version on the given channel (defaults to RELEASE). */
757
- latest(input?: MinecraftLatestInput): Promise<MinecraftVersionSummary>;
758
- /** Return a single version summary or throw `MANIFEST_NOT_FOUND`. */
759
- get(input: MinecraftGetInput): Promise<MinecraftVersionSummary>;
760
- /** Fetch and parse the per-version manifest in addition to the summary. */
761
- resolve(input: MinecraftGetInput): Promise<ResolvedMinecraft>;
762
- private fetchManifestRoot;
763
- }
764
-
765
- /** Inputs to {@link RuntimeVersionsApi.list}. */
766
- interface RuntimeListInput {
767
- readonly system: RuntimeSystem;
768
- readonly minecraftVersion?: string;
769
- readonly signal?: AbortSignal;
770
- }
771
- /** A summary entry for the list API. */
772
- interface RuntimeListEntry {
773
- readonly component: string;
774
- readonly platformKey: string;
775
- readonly versionName: string;
776
- readonly released: string;
777
- readonly manifestUrl: string;
778
- }
779
- /** Inputs to {@link RuntimeVersionsApi.resolve}. */
780
- interface RuntimeResolveInput {
781
- readonly system: RuntimeSystem;
782
- readonly minecraftVersion?: string;
783
- readonly component?: string;
784
- readonly preference?: RuntimePreferenceKind;
785
- readonly signal?: AbortSignal;
786
- }
787
- /** Public runtime versions API surface. */
788
- declare class RuntimeVersionsApi {
789
- private readonly ctx;
790
- constructor(ctx: ResolverContext);
791
- /** List available runtime entries for the host platform. */
792
- list(input: RuntimeListInput): Promise<readonly RuntimeListEntry[]>;
793
- /** Resolve a single runtime for the host platform and Minecraft version. */
794
- resolve(input: RuntimeResolveInput): Promise<ResolvedRuntime>;
795
- private fetchIndex;
796
- }
797
-
798
- /** Inputs to {@link TargetsApi.resolve}. */
799
- interface TargetResolveInput {
800
- readonly id: string;
801
- readonly directory: string;
802
- readonly minecraft: {
803
- readonly version: string;
804
- };
805
- readonly loader: TargetLoaderInput;
806
- readonly runtime?: {
807
- readonly preference?: RuntimePreferenceKind;
808
- /** Override the runtime component. Defaults to the Minecraft manifest's `javaVersion.component`. */
809
- readonly component?: string;
810
- /**
811
- * Custom install root (absolute path) holding the component directories.
812
- * When unset, runtime files live under `<directory>/runtime/`.
813
- */
814
- readonly installRoot?: string;
815
- };
816
- readonly system?: RuntimeSystem;
817
- readonly signal?: AbortSignal;
818
- }
819
- /** Loader input variants. */
820
- type TargetLoaderInput = {
821
- readonly type: typeof Loaders.VANILLA;
822
- } | {
823
- readonly type: typeof Loaders.FABRIC;
824
- readonly preference?: VersionPreferenceKind;
825
- readonly version?: string;
826
- } | {
827
- readonly type: typeof Loaders.FORGE;
828
- readonly preference?: VersionPreferenceKind;
829
- readonly version?: string;
830
- };
831
- /** Inputs to {@link TargetsApi.list}. */
832
- interface TargetListInput {
833
- readonly rootDir: string;
834
- }
835
- /** Constructor inputs for {@link TargetsApi}. */
836
- interface TargetsApiContext {
837
- readonly minecraft: MinecraftVersionsApi;
838
- readonly fabric: FabricVersionsApi;
839
- readonly forge: ForgeVersionsApi;
840
- readonly runtime: RuntimeVersionsApi;
841
- readonly system: RuntimeSystem;
842
- }
843
- /** Public Targets API surface. */
844
- declare class TargetsApi {
845
- private readonly ctx;
846
- constructor(ctx: TargetsApiContext);
847
- /** The detected host system used by `resolve()` when no `system` is supplied. */
848
- get system(): RuntimeSystem;
849
- /** Build a {@link Target} from already-resolved components. */
850
- create(input: TargetCreateInput): Target;
851
- /** Sugar API: resolve every component then assemble a target. */
852
- resolve(input: TargetResolveInput): Promise<Target>;
853
- /** Scan a root directory for Minecraft installations. Returns only what is on disk. */
854
- list(input: TargetListInput): Promise<readonly DiscoveredTarget[]>;
855
- }
856
-
857
- /** Aspect of an installation a verification result describes. */
858
- declare const VerificationKinds: {
859
- readonly MINECRAFT: "minecraft";
860
- readonly FABRIC: "fabric";
861
- readonly FORGE: "forge";
862
- readonly RUNTIME: "runtime";
916
+ /** Aspect of an installation a verification result describes. */
917
+ declare const VerificationKinds: {
918
+ readonly MINECRAFT: "minecraft";
919
+ readonly FABRIC: "fabric";
920
+ readonly FORGE: "forge";
921
+ readonly RUNTIME: "runtime";
863
922
  };
864
923
  /** Verification kind literal. */
865
924
  type VerificationKind = (typeof VerificationKinds)[keyof typeof VerificationKinds];
@@ -886,7 +945,7 @@ declare const VerifyFileCategories: {
886
945
  /** Verification file category literal. */
887
946
  type VerifyFileCategory = (typeof VerifyFileCategories)[keyof typeof VerifyFileCategories];
888
947
  /** A single verified file. */
889
- interface VerificationFileResult {
948
+ type VerificationFileResult = {
890
949
  readonly path: string;
891
950
  readonly category: VerifyFileCategory;
892
951
  readonly status: VerifyFileStatus;
@@ -896,16 +955,16 @@ interface VerificationFileResult {
896
955
  readonly actualSize?: number;
897
956
  /** Optional URL where the file can be re-downloaded if it's broken. */
898
957
  readonly url?: string;
899
- }
958
+ };
900
959
  /** Aggregate verification result returned by each `verify.<kind>.run` API. */
901
- interface VerificationResult {
960
+ type VerificationResult = {
902
961
  readonly targetId: string;
903
962
  readonly kind: VerificationKind;
904
963
  readonly isValid: boolean;
905
964
  readonly issues: readonly VerificationFileResult[];
906
965
  readonly checkedFiles: number;
907
966
  readonly durationMs: number;
908
- }
967
+ };
909
968
 
910
969
  /** Coarse-grained repair phases used for `repair:phase-changed` events. */
911
970
  declare const RepairPhases: {
@@ -924,33 +983,33 @@ type RepairPhase = (typeof RepairPhases)[keyof typeof RepairPhases];
924
983
  * A repair plan is, structurally, an install plan limited to actions needed to fix the
925
984
  * issues reported by a previous {@link VerificationResult}. The runner is the same.
926
985
  */
927
- interface RepairPlan {
986
+ type RepairPlan = {
928
987
  readonly targetId: string;
929
988
  readonly directory: string;
930
989
  readonly target: Target;
931
990
  readonly actions: readonly InstallAction[];
932
991
  readonly totalBytes: number;
933
992
  readonly totalActions: number;
934
- }
993
+ };
935
994
  /** Repair report — same shape as install report. */
936
- interface RepairReport {
995
+ type RepairReport = {
937
996
  readonly targetId: string;
938
997
  readonly bytesDownloaded: number;
939
998
  readonly actionsCompleted: number;
940
999
  readonly durationMs: number;
941
- }
1000
+ };
942
1001
  /**
943
1002
  * Inputs accepted by every aspect-specific `planXxxRepair` (`planMinecraftRepair`,
944
1003
  * `planFabricRepair`, `planForgeRepair`, `planRuntimeRepair`). The per-aspect input types
945
1004
  * are aliases over this shape.
946
1005
  */
947
- interface AspectRepairInput {
1006
+ type AspectRepairInput = {
948
1007
  readonly target: Target;
949
1008
  readonly from: VerificationResult | readonly VerificationResult[];
950
1009
  readonly http: HttpClient;
951
1010
  readonly cache: MetadataCache;
952
1011
  readonly signal?: AbortSignal;
953
- }
1012
+ };
954
1013
 
955
1014
  /**
956
1015
  * Stable string constants for the `type` discriminator of every {@link ProgressEvent}.
@@ -982,16 +1041,16 @@ declare const EventTypes: {
982
1041
  /** Literal type of the `type` discriminator of a {@link ProgressEvent}. */
983
1042
  type EventType = (typeof EventTypes)[keyof typeof EventTypes];
984
1043
  /** Reference to a single file used in download events. */
985
- interface FileRef {
1044
+ type FileRef = {
986
1045
  readonly url: string;
987
1046
  readonly target: string;
988
1047
  readonly category?: string;
989
- }
1048
+ };
990
1049
  /** A single processor description used in Forge events. */
991
- interface ProcessorRef {
1050
+ type ProcessorRef = {
992
1051
  readonly index: number;
993
1052
  readonly mainClass: string;
994
- }
1053
+ };
995
1054
  /**
996
1055
  * Discriminated union of all runtime progress events. Pass an `onEvent` callback to
997
1056
  * `install.run`, `update.run`, `verify.run`, `repair.run`, or `launch.run` to receive these.
@@ -1086,52 +1145,246 @@ type ProgressEvent = {
1086
1145
  /** Listener signature accepted by every long-running operation. */
1087
1146
  type ProgressListener = (event: ProgressEvent) => void;
1088
1147
  /** Common options accepted by long-running operations. */
1089
- interface OperationOptions {
1148
+ type OperationOptions = {
1090
1149
  readonly signal?: AbortSignal;
1091
1150
  readonly onEvent?: ProgressListener;
1151
+ };
1152
+
1153
+ /** Stream-of-text channel exposed by spawned processes. */
1154
+ type ProcessStream = {
1155
+ on(event: "data", listener: (chunk: string) => void): void;
1156
+ };
1157
+ /** Live handle for a child process. */
1158
+ type SpawnedProcess = {
1159
+ readonly pid: number;
1160
+ readonly stdout: ProcessStream;
1161
+ readonly stderr: ProcessStream;
1162
+ /** Resolves when the process exits with its exit info. */
1163
+ readonly exited: Promise<{
1164
+ readonly code: number | null;
1165
+ readonly signal: NodeJS.Signals | null;
1166
+ }>;
1167
+ /** Send a termination signal. Returns true on success. */
1168
+ kill(signal?: NodeJS.Signals): boolean;
1169
+ };
1170
+ /** Options accepted by the spawner. */
1171
+ type SpawnOptions = {
1172
+ readonly cwd: string;
1173
+ readonly env?: Readonly<Record<string, string>>;
1174
+ };
1175
+ /**
1176
+ * Pluggable process spawner. The default implementation uses `node:child_process`; tests
1177
+ * inject a fake to avoid spawning real processes.
1178
+ */
1179
+ type Spawner = {
1180
+ spawn(command: string, args: readonly string[], options: SpawnOptions): SpawnedProcess;
1181
+ };
1182
+
1183
+ type RepairAllInput = {
1184
+ readonly target: Target;
1185
+ readonly http: HttpClient;
1186
+ readonly cache: MetadataCache;
1187
+ readonly spawner: Spawner;
1188
+ readonly signal?: AbortSignal;
1189
+ readonly onEvent?: ProgressListener;
1190
+ };
1191
+ type RepairAllReport = {
1192
+ readonly verifications: readonly VerificationResult[];
1193
+ /** Present only for aspects that actually needed work. */
1194
+ readonly repairs: ReadonlyMap<VerificationKind, RepairReport>;
1195
+ readonly bytesDownloaded: number;
1196
+ readonly durationMs: number;
1197
+ };
1198
+ /** Verify every applicable aspect and repair each broken one. */
1199
+ declare const repairAll: (input: RepairAllInput) => Promise<RepairAllReport>;
1200
+
1201
+ /** Shared context passed to every resolver. */
1202
+ type ResolverContext = {
1203
+ readonly http: HttpClient;
1204
+ readonly cache: MetadataCache;
1205
+ readonly logger: Logger;
1206
+ };
1207
+
1208
+ /** Inputs to {@link FabricVersionsApi.list}. */
1209
+ type FabricListInput = {
1210
+ readonly minecraftVersion?: string;
1211
+ readonly signal?: AbortSignal;
1212
+ };
1213
+ /** Inputs to {@link FabricVersionsApi.resolve}. */
1214
+ type FabricResolveInput = {
1215
+ readonly minecraftVersion: string;
1216
+ readonly preference?: VersionPreferenceKind;
1217
+ readonly loaderVersion?: string;
1218
+ readonly signal?: AbortSignal;
1219
+ };
1220
+ /** Public Fabric versions API surface. */
1221
+ declare class FabricVersionsApi {
1222
+ private readonly ctx;
1223
+ constructor(ctx: ResolverContext);
1224
+ /** List Fabric loader versions, optionally constrained to a Minecraft version. */
1225
+ list(input?: FabricListInput): Promise<readonly FabricLoaderSummary[]>;
1226
+ /** Resolve a Fabric loader version against a Minecraft version. */
1227
+ resolve(input: FabricResolveInput): Promise<ResolvedFabricLoader>;
1092
1228
  }
1093
1229
 
1094
- /** Authentication modes accepted by the launch composer. */
1095
- declare const AuthModes: {
1096
- /** Offline-mode play with a chosen username and synthetic UUID. */
1097
- readonly OFFLINE: "offline";
1098
- /** Pre-authenticated session — caller provides the access token and identity. */
1099
- readonly ONLINE: "online";
1230
+ /** Inputs to {@link ForgeVersionsApi.list}. */
1231
+ type ForgeListInput = {
1232
+ readonly minecraftVersion?: string;
1233
+ readonly signal?: AbortSignal;
1234
+ };
1235
+ /** Inputs to {@link ForgeVersionsApi.resolve}. */
1236
+ type ForgeResolveInput = {
1237
+ readonly minecraftVersion: string;
1238
+ readonly preference?: VersionPreferenceKind;
1239
+ readonly forgeVersion?: string;
1240
+ readonly signal?: AbortSignal;
1241
+ };
1242
+ /** Public Forge versions API surface. */
1243
+ declare class ForgeVersionsApi {
1244
+ private readonly ctx;
1245
+ constructor(ctx: ResolverContext);
1246
+ /** List Forge builds (across all Minecraft versions, or filtered to one). */
1247
+ list(input?: ForgeListInput): Promise<readonly ForgeBuildSummary[]>;
1248
+ /** Resolve a Forge build for a Minecraft version. */
1249
+ resolve(input: ForgeResolveInput): Promise<ResolvedForgeLoader>;
1250
+ }
1251
+
1252
+ /** Inputs to {@link MinecraftVersionsApi.list}. */
1253
+ type MinecraftListInput = {
1254
+ readonly channel?: MinecraftChannel;
1255
+ readonly signal?: AbortSignal;
1256
+ };
1257
+ /** Inputs to {@link MinecraftVersionsApi.latest}. */
1258
+ type MinecraftLatestInput = {
1259
+ readonly channel?: MinecraftChannel;
1260
+ readonly signal?: AbortSignal;
1261
+ };
1262
+ /** Inputs to {@link MinecraftVersionsApi.get} / `.resolve`. */
1263
+ type MinecraftGetInput = {
1264
+ readonly version: string;
1265
+ readonly signal?: AbortSignal;
1266
+ };
1267
+ /** Public Minecraft versions API surface. */
1268
+ declare class MinecraftVersionsApi {
1269
+ private readonly ctx;
1270
+ constructor(ctx: ResolverContext);
1271
+ /** List all Minecraft versions, optionally filtered by channel. */
1272
+ list(input?: MinecraftListInput): Promise<readonly MinecraftVersionSummary[]>;
1273
+ /** Return the latest version on the given channel (defaults to RELEASE). */
1274
+ latest(input?: MinecraftLatestInput): Promise<MinecraftVersionSummary>;
1275
+ /** Return a single version summary or throw `MANIFEST_NOT_FOUND`. */
1276
+ get(input: MinecraftGetInput): Promise<MinecraftVersionSummary>;
1277
+ /** Fetch and parse the per-version manifest in addition to the summary. */
1278
+ resolve(input: MinecraftGetInput): Promise<ResolvedMinecraft>;
1279
+ private fetchManifestRoot;
1280
+ }
1281
+
1282
+ /** Inputs to {@link RuntimeVersionsApi.list}. */
1283
+ type RuntimeListInput = {
1284
+ readonly system: RuntimeSystem;
1285
+ readonly minecraftVersion?: string;
1286
+ readonly signal?: AbortSignal;
1287
+ };
1288
+ /** A summary entry for the list API. */
1289
+ type RuntimeListEntry = {
1290
+ readonly component: string;
1291
+ readonly platformKey: string;
1292
+ readonly versionName: string;
1293
+ readonly released: string;
1294
+ readonly manifestUrl: string;
1295
+ };
1296
+ /** Inputs to {@link RuntimeVersionsApi.resolve}. */
1297
+ type RuntimeResolveInput = {
1298
+ readonly system: RuntimeSystem;
1299
+ readonly minecraftVersion?: string;
1300
+ readonly component?: string;
1301
+ readonly preference?: RuntimePreferenceKind;
1302
+ readonly signal?: AbortSignal;
1303
+ };
1304
+ /** Public runtime versions API surface. */
1305
+ declare class RuntimeVersionsApi {
1306
+ private readonly ctx;
1307
+ constructor(ctx: ResolverContext);
1308
+ /** List available runtime entries for the host platform. */
1309
+ list(input: RuntimeListInput): Promise<readonly RuntimeListEntry[]>;
1310
+ /** Resolve a single runtime for the host platform and Minecraft version. */
1311
+ resolve(input: RuntimeResolveInput): Promise<ResolvedRuntime>;
1312
+ private fetchIndex;
1313
+ }
1314
+ /** Parse the leading integer from a runtime versionName (`"21.0.8"` → 21). */
1315
+ declare const parseMajorVersion: (versionName: string) => number | undefined;
1316
+
1317
+ /** Inputs to {@link TargetsApi.resolve}. */
1318
+ type TargetResolveInput = {
1319
+ readonly id: string;
1320
+ readonly directory: string;
1321
+ readonly minecraft: {
1322
+ readonly version: string;
1323
+ };
1324
+ readonly loader: TargetLoaderInput;
1325
+ readonly runtime?: {
1326
+ readonly preference?: RuntimePreferenceKind;
1327
+ /** Override the runtime component. Defaults to the Minecraft manifest's `javaVersion.component`. */
1328
+ readonly component?: string;
1329
+ /**
1330
+ * Custom install root (absolute path) holding the component directories.
1331
+ * When unset, runtime files live under `<directory>/runtime/`.
1332
+ */
1333
+ readonly installRoot?: string;
1334
+ };
1335
+ readonly system?: RuntimeSystem;
1336
+ readonly signal?: AbortSignal;
1337
+ };
1338
+ /** Loader input variants. */
1339
+ type TargetLoaderInput = {
1340
+ readonly type: typeof Loaders.VANILLA;
1341
+ } | {
1342
+ readonly type: typeof Loaders.FABRIC;
1343
+ readonly preference?: VersionPreferenceKind;
1344
+ readonly version?: string;
1345
+ } | {
1346
+ readonly type: typeof Loaders.FORGE;
1347
+ readonly preference?: VersionPreferenceKind;
1348
+ readonly version?: string;
1100
1349
  };
1101
- /** Auth mode literal. */
1102
- type AuthMode = (typeof AuthModes)[keyof typeof AuthModes];
1103
- /** Offline authentication. */
1104
- interface OfflineAuth {
1105
- readonly mode: typeof AuthModes.OFFLINE;
1106
- readonly username: string;
1107
- /** Optional explicit UUID. When omitted, a deterministic UUID is derived from the username. */
1108
- readonly uuid?: string;
1109
- }
1110
- /** Online (token-based) authentication. */
1111
- interface OnlineAuth {
1112
- readonly mode: typeof AuthModes.ONLINE;
1113
- readonly username: string;
1114
- readonly uuid: string;
1115
- readonly accessToken: string;
1116
- readonly userType?: string;
1117
- readonly clientId?: string;
1118
- readonly xuid?: string;
1350
+ /** Inputs to {@link TargetsApi.list}. */
1351
+ type TargetListInput = {
1352
+ readonly rootDir: string;
1353
+ };
1354
+ /** Constructor inputs for {@link TargetsApi}. */
1355
+ type TargetsApiContext = {
1356
+ readonly minecraft: MinecraftVersionsApi;
1357
+ readonly fabric: FabricVersionsApi;
1358
+ readonly forge: ForgeVersionsApi;
1359
+ readonly runtime: RuntimeVersionsApi;
1360
+ readonly system: RuntimeSystem;
1361
+ };
1362
+ /** Public Targets API surface. */
1363
+ declare class TargetsApi {
1364
+ private readonly ctx;
1365
+ constructor(ctx: TargetsApiContext);
1366
+ /** The detected host system used by `resolve()` when no `system` is supplied. */
1367
+ get system(): RuntimeSystem;
1368
+ /** Build a {@link Target} from already-resolved components. */
1369
+ create(input: TargetCreateInput): Target;
1370
+ /** Sugar API: resolve every component then assemble a target. */
1371
+ resolve(input: TargetResolveInput): Promise<Target>;
1372
+ /** Scan a root directory for Minecraft installations. Returns only what is on disk. */
1373
+ list(input: TargetListInput): Promise<readonly DiscoveredTarget[]>;
1119
1374
  }
1120
- /** Auth shape consumed by `kit.launch.compose`. */
1121
- type LaunchAuth = OfflineAuth | OnlineAuth;
1122
1375
 
1123
1376
  /** Optional memory configuration. */
1124
- interface LaunchMemoryOptions {
1377
+ type LaunchMemoryOptions = {
1125
1378
  readonly minMb?: number;
1126
1379
  readonly maxMb?: number;
1127
- }
1380
+ };
1128
1381
  /** Optional resolution / window configuration. */
1129
- interface LaunchResolutionOptions {
1382
+ type LaunchResolutionOptions = {
1130
1383
  readonly width: number;
1131
1384
  readonly height: number;
1132
- }
1385
+ };
1133
1386
  /** Inputs for `kit.launch.compose` (and the lower-level `composeLaunch` helper). */
1134
- interface LaunchOptions {
1387
+ type LaunchOptions = {
1135
1388
  readonly auth: LaunchAuth;
1136
1389
  readonly memory?: LaunchMemoryOptions;
1137
1390
  readonly resolution?: LaunchResolutionOptions;
@@ -1146,9 +1399,9 @@ interface LaunchOptions {
1146
1399
  readonly extraGameArgs?: readonly string[];
1147
1400
  /** Set of feature flags evaluated by argument rules (e.g. `is_demo_user`). */
1148
1401
  readonly features?: Readonly<Record<string, boolean>>;
1149
- }
1402
+ };
1150
1403
  /** Fully composed launch command, ready to be passed to `kit.launch.run`. */
1151
- interface LaunchComposition {
1404
+ type LaunchComposition = {
1152
1405
  readonly targetId: string;
1153
1406
  readonly directory: string;
1154
1407
  readonly javaPath: string;
@@ -1162,87 +1415,57 @@ interface LaunchComposition {
1162
1415
  readonly workingDirectory: string;
1163
1416
  /** Environment variables to set on the spawned process. */
1164
1417
  readonly env?: Readonly<Record<string, string>>;
1165
- }
1418
+ };
1166
1419
  /** Live handle for a running game process. */
1167
- interface LaunchSession {
1420
+ type LaunchSession = {
1168
1421
  /** Operating-system process id. */
1169
1422
  readonly pid: number;
1170
1423
  /** Resolves with the exit code/signal when the process terminates. */
1171
1424
  readonly exited: Promise<LaunchExit>;
1172
1425
  /** Best-effort cancel — sends SIGTERM, then SIGKILL after the grace period. */
1173
1426
  abort(reason?: string): void;
1174
- }
1427
+ };
1175
1428
  /** Outcome of a finished launch. */
1176
- interface LaunchExit {
1429
+ type LaunchExit = {
1177
1430
  readonly code: number | null;
1178
1431
  readonly signal: NodeJS.Signals | null;
1179
1432
  readonly aborted: boolean;
1180
- }
1433
+ };
1181
1434
  /** Options for `kit.launch.run` (and the lower-level `runLaunch` helper). */
1182
- interface LaunchRunOptions {
1435
+ type LaunchRunOptions = {
1183
1436
  readonly signal?: AbortSignal;
1184
1437
  readonly onEvent?: (event: ProgressEvent) => void;
1185
1438
  /** Milliseconds to wait between SIGTERM and SIGKILL when aborting. */
1186
1439
  readonly killGracePeriodMs?: number;
1187
- }
1188
-
1189
- /** Stream-of-text channel exposed by spawned processes. */
1190
- interface ProcessStream {
1191
- on(event: "data", listener: (chunk: string) => void): void;
1192
- }
1193
- /** Live handle for a child process. */
1194
- interface SpawnedProcess {
1195
- readonly pid: number;
1196
- readonly stdout: ProcessStream;
1197
- readonly stderr: ProcessStream;
1198
- /** Resolves when the process exits with its exit info. */
1199
- readonly exited: Promise<{
1200
- readonly code: number | null;
1201
- readonly signal: NodeJS.Signals | null;
1202
- }>;
1203
- /** Send a termination signal. Returns true on success. */
1204
- kill(signal?: NodeJS.Signals): boolean;
1205
- }
1206
- /** Options accepted by the spawner. */
1207
- interface SpawnOptions {
1208
- readonly cwd: string;
1209
- readonly env?: Readonly<Record<string, string>>;
1210
- }
1211
- /**
1212
- * Pluggable process spawner. The default implementation uses `node:child_process`; tests
1213
- * inject a fake to avoid spawning real processes.
1214
- */
1215
- interface Spawner {
1216
- spawn(command: string, args: readonly string[], options: SpawnOptions): SpawnedProcess;
1217
- }
1440
+ };
1218
1441
 
1219
1442
  /** Update plan — additive list of actions to bring an installation up to date. */
1220
- interface UpdatePlan {
1443
+ type UpdatePlan = {
1221
1444
  readonly targetId: string;
1222
1445
  readonly directory: string;
1223
- readonly target: Target;
1446
+ readonly target: InstallPlanTarget;
1224
1447
  readonly actions: readonly InstallAction[];
1225
1448
  readonly totalBytes: number;
1226
1449
  readonly totalActions: number;
1227
- }
1450
+ };
1228
1451
  /** Update report. */
1229
- interface UpdateReport {
1452
+ type UpdateReport = {
1230
1453
  readonly targetId: string;
1231
1454
  readonly bytesDownloaded: number;
1232
1455
  readonly actionsCompleted: number;
1233
1456
  /** Actions that found their target already correct on disk and were skipped. */
1234
1457
  readonly actionsSkipped: number;
1235
1458
  readonly durationMs: number;
1236
- }
1459
+ };
1237
1460
 
1238
1461
  /** Constructor options for {@link MinecraftKit}. */
1239
- interface MinecraftKitOptions {
1462
+ type MinecraftKitOptions = {
1240
1463
  readonly httpClient?: HttpClient;
1241
1464
  readonly cache?: MetadataCache;
1242
1465
  readonly logger?: Logger;
1243
1466
  readonly system?: RuntimeSystem;
1244
1467
  readonly spawner?: Spawner;
1245
- }
1468
+ };
1246
1469
  /**
1247
1470
  * Single facade for the entire library.
1248
1471
  *
@@ -1264,11 +1487,11 @@ declare class MinecraftKit {
1264
1487
  readonly targets: TargetsApi;
1265
1488
  readonly install: {
1266
1489
  plan(target: Target, options?: OperationOptions): Promise<InstallPlan>;
1267
- run(plan: InstallPlan, options?: OperationOptions): Promise<InstallReport>;
1490
+ run(plan: InstallPlan, options?: InstallRunOptions): Promise<InstallReport>;
1268
1491
  /** Install only the Java runtime declared by `target.runtime` (honours `installRoot`). */
1269
1492
  readonly runtime: {
1270
1493
  plan(target: Target, options?: OperationOptions): Promise<InstallPlan>;
1271
- run(plan: InstallPlan, options?: OperationOptions): Promise<InstallReport>;
1494
+ run(plan: InstallPlan, options?: InstallRunOptions): Promise<InstallReport>;
1272
1495
  /**
1273
1496
  * Plan a runtime-only install without an existing Minecraft Target. The caller
1274
1497
  * supplies a {@link ResolvedRuntime} (typically from `kit.versions.runtime.resolve`)
@@ -1308,120 +1531,246 @@ declare class MinecraftKit {
1308
1531
  readonly forge: RepairAspect;
1309
1532
  /** Repair the Java runtime files. Honours `target.runtime.installRoot`. */
1310
1533
  readonly runtime: RepairAspect;
1534
+ /** Verify every applicable aspect (Minecraft + Runtime + active loader) and repair each broken one. */
1535
+ all(target: Target, options?: OperationOptions): Promise<RepairAllReport>;
1311
1536
  };
1312
1537
  readonly launch: {
1313
1538
  compose(target: Target, options: LaunchOptions): Promise<LaunchComposition>;
1314
1539
  run(composition: LaunchComposition, options?: LaunchRunOptions): LaunchSession;
1315
1540
  };
1541
+ /**
1542
+ * Microsoft / Mojang authentication. Implements the device-code flow against Microsoft
1543
+ * Entra, exchanges the resulting tokens for an XSTS + Minecraft session, and returns
1544
+ * everything needed to compose an `OnlineAuth` for `launch.compose`.
1545
+ */
1546
+ readonly auth: MojangAuthApi;
1316
1547
  /** Cache surface useful for advanced consumers (e.g. clearing between operations). */
1317
1548
  readonly cache: MetadataCache;
1318
1549
  constructor(options?: MinecraftKitOptions);
1319
1550
  }
1551
+ /** Options accepted by `install.run` (and `install.runtime.run`). */
1552
+ interface InstallRunOptions extends OperationOptions {
1553
+ readonly pauseController?: PauseController;
1554
+ readonly actionCategories?: ReadonlySet<DownloadAction["category"]>;
1555
+ }
1320
1556
  /** Options accepted by every `verify.<kind>.run`. */
1321
- interface VerifyOperationOptions {
1557
+ type VerifyOperationOptions = {
1322
1558
  readonly signal?: AbortSignal;
1323
1559
  readonly onEvent?: ProgressListener;
1324
- }
1560
+ };
1325
1561
  /** Options for any `repair.<aspect>.plan` call. Accepts one or many verification results. */
1326
- interface RepairPlanOptions {
1562
+ type RepairPlanOptions = {
1327
1563
  readonly from: VerificationResult | readonly VerificationResult[];
1328
1564
  readonly signal?: AbortSignal;
1329
- }
1565
+ };
1330
1566
  /** Shared shape of every aspect-specific repair surface (`repair.minecraft`, `.fabric`, …). */
1331
- interface RepairAspect {
1567
+ type RepairAspect = {
1332
1568
  plan(target: Target, options: RepairPlanOptions): Promise<RepairPlan>;
1333
1569
  run(plan: RepairPlan, options?: OperationOptions): Promise<RepairReport>;
1334
- }
1570
+ };
1335
1571
 
1336
- /** Inputs to {@link createMemoryCache}. */
1337
- interface MemoryCacheOptions {
1338
- readonly maxEntries?: number;
1339
- readonly ttlMs?: number;
1340
- }
1341
- /** In-memory metadata cache backed by `lru-cache`. */
1342
- declare function createMemoryCache(options?: MemoryCacheOptions): MetadataCache;
1572
+ /**
1573
+ * Stable error code registry. `MinecraftKitError` carries one of these as `code`; consumers
1574
+ * can switch on it exhaustively via the derived {@link MinecraftKitErrorCode} union.
1575
+ *
1576
+ * Codes are stable across releases — adding new codes is non-breaking; removing or renaming
1577
+ * a code is a breaking change.
1578
+ */
1579
+ declare const MinecraftKitErrorCodes: {
1580
+ readonly NETWORK_TIMEOUT: "NETWORK_TIMEOUT";
1581
+ readonly NETWORK_HTTP_ERROR: "NETWORK_HTTP_ERROR";
1582
+ readonly NETWORK_ABORTED: "NETWORK_ABORTED";
1583
+ readonly INTEGRITY_HASH_MISMATCH: "INTEGRITY_HASH_MISMATCH";
1584
+ readonly INTEGRITY_SIZE_MISMATCH: "INTEGRITY_SIZE_MISMATCH";
1585
+ readonly MANIFEST_INVALID: "MANIFEST_INVALID";
1586
+ readonly MANIFEST_NOT_FOUND: "MANIFEST_NOT_FOUND";
1587
+ readonly METADATA_PARSE_ERROR: "METADATA_PARSE_ERROR";
1588
+ readonly FILESYSTEM_PATH_TRAVERSAL: "FILESYSTEM_PATH_TRAVERSAL";
1589
+ readonly FILESYSTEM_WRITE_ERROR: "FILESYSTEM_WRITE_ERROR";
1590
+ readonly FILESYSTEM_READ_ERROR: "FILESYSTEM_READ_ERROR";
1591
+ readonly ARCHIVE_INVALID: "ARCHIVE_INVALID";
1592
+ readonly ARCHIVE_TOO_LARGE: "ARCHIVE_TOO_LARGE";
1593
+ readonly ARCHIVE_ENTRY_REJECTED: "ARCHIVE_ENTRY_REJECTED";
1594
+ readonly RUNTIME_NOT_FOUND: "RUNTIME_NOT_FOUND";
1595
+ readonly RUNTIME_UNSUPPORTED_PLATFORM: "RUNTIME_UNSUPPORTED_PLATFORM";
1596
+ readonly FORGE_PROCESSOR_FAILED: "FORGE_PROCESSOR_FAILED";
1597
+ readonly FORGE_INSTALLER_INVALID: "FORGE_INSTALLER_INVALID";
1598
+ readonly LAUNCH_JAVA_NOT_FOUND: "LAUNCH_JAVA_NOT_FOUND";
1599
+ readonly LAUNCH_PROCESS_FAILED: "LAUNCH_PROCESS_FAILED";
1600
+ readonly LAUNCH_ABORTED: "LAUNCH_ABORTED";
1601
+ readonly VERIFICATION_FAILED: "VERIFICATION_FAILED";
1602
+ readonly INVALID_INPUT: "INVALID_INPUT";
1603
+ readonly NOT_IMPLEMENTED: "NOT_IMPLEMENTED";
1604
+ readonly UNSUPPORTED_VERSION: "UNSUPPORTED_VERSION";
1605
+ readonly LZMA_DECODE_ERROR: "LZMA_DECODE_ERROR";
1606
+ readonly AUTH_DEVICE_CODE_EXPIRED: "AUTH_DEVICE_CODE_EXPIRED";
1607
+ readonly AUTH_DEVICE_CODE_DECLINED: "AUTH_DEVICE_CODE_DECLINED";
1608
+ readonly AUTH_DEVICE_CODE_FAILED: "AUTH_DEVICE_CODE_FAILED";
1609
+ readonly AUTH_REFRESH_FAILED: "AUTH_REFRESH_FAILED";
1610
+ readonly AUTH_XBOX_FAILED: "AUTH_XBOX_FAILED";
1611
+ readonly AUTH_XSTS_FAILED: "AUTH_XSTS_FAILED";
1612
+ readonly AUTH_MINECRAFT_FAILED: "AUTH_MINECRAFT_FAILED";
1613
+ readonly AUTH_NO_GAME_OWNERSHIP: "AUTH_NO_GAME_OWNERSHIP";
1614
+ readonly AUTH_MISSING_CLIENT_ID: "AUTH_MISSING_CLIENT_ID";
1615
+ readonly AUTH_CANCELLED: "AUTH_CANCELLED";
1616
+ };
1617
+ /** Union of all kit error codes. */
1618
+ type MinecraftKitErrorCode = (typeof MinecraftKitErrorCodes)[keyof typeof MinecraftKitErrorCodes];
1619
+ /** Structured context attached to errors. */
1620
+ type MinecraftKitErrorContext = {
1621
+ readonly url?: string;
1622
+ readonly filePath?: string;
1623
+ readonly expectedHash?: string;
1624
+ readonly actualHash?: string;
1625
+ readonly expectedSize?: number;
1626
+ readonly actualSize?: number;
1627
+ readonly httpStatus?: number;
1628
+ readonly exitCode?: number;
1629
+ readonly platform?: string;
1630
+ readonly version?: string;
1631
+ readonly [key: string]: unknown;
1632
+ };
1343
1633
 
1344
- /** Inputs allowing the host system to be derived from current Node values or overrides. */
1345
- interface DetectSystemInput {
1346
- readonly platform?: NodeJS.Platform;
1347
- readonly arch?: NodeJS.Architecture;
1348
- readonly osVersion?: string;
1634
+ /**
1635
+ * The single error class thrown by every public API in `@loontail/minecraft-kit`.
1636
+ *
1637
+ * Use {@link isMinecraftKitError} or {@link isErrorCode} for type-narrowing in `catch` blocks.
1638
+ */
1639
+ declare class MinecraftKitError extends Error {
1640
+ readonly name = "MinecraftKitError";
1641
+ /** Stable discriminator. */
1642
+ readonly code: MinecraftKitErrorCode;
1643
+ /** Structured context; safe to serialize. */
1644
+ readonly context: Readonly<MinecraftKitErrorContext>;
1645
+ constructor(code: MinecraftKitErrorCode, message: string, options?: {
1646
+ cause?: unknown;
1647
+ context?: MinecraftKitErrorContext;
1648
+ });
1649
+ /** JSON-friendly representation. */
1650
+ toJSON(): Record<string, unknown>;
1349
1651
  }
1652
+ /** True when `e` is an {@link MinecraftKitError}. */
1653
+ declare const isMinecraftKitError: (e: unknown) => e is MinecraftKitError;
1654
+ /** True when `e` is an {@link MinecraftKitError} carrying the given code. */
1655
+ declare const isErrorCode: <C extends MinecraftKitErrorCode>(e: unknown, code: C) => e is MinecraftKitError & {
1656
+ code: C;
1657
+ };
1658
+
1350
1659
  /**
1351
- * Resolve the current host system identifiers.
1660
+ * Exhaustiveness sentinel for discriminated unions. Drop into the `default` of a switch on
1661
+ * `kind` / `type` / `status` so the compiler errors when a new variant is added but the
1662
+ * switch is not updated.
1352
1663
  *
1353
- * @throws {@link MinecraftKitError} with code `RUNTIME_UNSUPPORTED_PLATFORM` when the
1354
- * platform/arch combination is not understood.
1664
+ * ```ts
1665
+ * switch (action.kind) {
1666
+ * case "download-file": return ...;
1667
+ * case "write-version-json": return ...;
1668
+ * default: return assertNever(action);
1669
+ * }
1670
+ * ```
1355
1671
  */
1356
- declare function detectSystem(input?: DetectSystemInput): RuntimeSystem;
1672
+ declare const assertNever: (value: never) => never;
1673
+
1674
+ /** UI-oriented coarse progress stages, identical across install and repair flows. */
1675
+ declare const InstallStages: {
1676
+ readonly PREPARE: "prepare";
1677
+ readonly RUNTIME: "runtime";
1678
+ readonly MINECRAFT: "minecraft";
1679
+ readonly LOADER: "loader";
1680
+ readonly FINALIZE: "finalize";
1681
+ };
1682
+ type InstallStage = (typeof InstallStages)[keyof typeof InstallStages];
1683
+ type ProgressSnapshot = {
1684
+ readonly stage: InstallStage;
1685
+ readonly stagePercent: number;
1686
+ readonly overallPercent: number;
1687
+ readonly bytesDownloaded: number;
1688
+ readonly totalBytes: number;
1689
+ readonly currentFile?: string;
1690
+ };
1691
+ type ProgressTrackerOptions = {
1692
+ /** Milliseconds between snapshot pushes. Defaults to 100ms. */
1693
+ readonly throttleMs?: number;
1694
+ };
1695
+ type InstallProgressTracker = {
1696
+ /** Pass directly as the `onEvent` callback to `install.run` / `repair.run`. */
1697
+ readonly onEvent: ProgressListener;
1698
+ snapshot(): ProgressSnapshot;
1699
+ /** First push fires immediately with the initial snapshot. */
1700
+ subscribe(listener: (snapshot: ProgressSnapshot) => void): () => void;
1701
+ /** Force-emit a final 100% snapshot and stop the throttle timer. */
1702
+ finish(): void;
1703
+ };
1704
+ /** Aggregate `ProgressEvent`s from one install/repair run into throttled UI snapshots. */
1705
+ declare const createInstallProgressTracker: (plan: Pick<InstallPlan, "actions">, options?: ProgressTrackerOptions) => InstallProgressTracker;
1357
1706
 
1358
1707
  /** Inputs to {@link verifyMinecraft}. */
1359
- interface VerifyMinecraftInput {
1708
+ type VerifyMinecraftInput = {
1360
1709
  readonly target: Target;
1361
1710
  readonly http: HttpClient;
1362
1711
  readonly cache: MetadataCache;
1363
1712
  readonly signal?: AbortSignal;
1364
1713
  readonly onEvent?: ProgressListener;
1365
- }
1714
+ };
1366
1715
  /**
1367
1716
  * Verify the vanilla Minecraft slice of an installation: the client jar, version JSON,
1368
1717
  * libraries (incl. native jars), assets (index + objects), logging config, and the
1369
1718
  * extracted natives directory.
1370
1719
  */
1371
- declare function verifyMinecraft(input: VerifyMinecraftInput): Promise<VerificationResult>;
1720
+ declare const verifyMinecraft: (input: VerifyMinecraftInput) => Promise<VerificationResult>;
1372
1721
 
1373
1722
  /** Inputs to {@link verifyFabric}. */
1374
- interface VerifyFabricInput {
1723
+ type VerifyFabricInput = {
1375
1724
  readonly target: Target;
1376
1725
  readonly http: HttpClient;
1377
1726
  readonly cache: MetadataCache;
1378
1727
  readonly signal?: AbortSignal;
1379
1728
  readonly onEvent?: ProgressListener;
1380
- }
1729
+ };
1381
1730
  /** Verify the Fabric loader slice: profile JSON + every library it pulls in. */
1382
- declare function verifyFabric(input: VerifyFabricInput): Promise<VerificationResult>;
1731
+ declare const verifyFabric: (input: VerifyFabricInput) => Promise<VerificationResult>;
1383
1732
 
1384
1733
  /** Inputs to {@link verifyForge}. */
1385
- interface VerifyForgeInput {
1734
+ type VerifyForgeInput = {
1386
1735
  readonly target: Target;
1387
1736
  readonly http: HttpClient;
1388
1737
  readonly cache: MetadataCache;
1389
1738
  readonly signal?: AbortSignal;
1390
1739
  readonly onEvent?: ProgressListener;
1391
- }
1740
+ };
1392
1741
  /**
1393
1742
  * Verify the Forge loader slice: the on-disk Forge version JSON and every library it
1394
1743
  * declares. Libraries can only be enumerated once the JSON is present *and parsable*; a
1395
1744
  * malformed JSON is surfaced as a CORRUPT issue so repair rewrites it before re-running.
1396
1745
  */
1397
- declare function verifyForge(input: VerifyForgeInput): Promise<VerificationResult>;
1746
+ declare const verifyForge: (input: VerifyForgeInput) => Promise<VerificationResult>;
1398
1747
 
1399
1748
  /** Inputs to {@link verifyRuntime}. */
1400
- interface VerifyRuntimeInput {
1749
+ type VerifyRuntimeInput = {
1401
1750
  readonly target: Target;
1402
1751
  readonly http: HttpClient;
1403
1752
  readonly cache: MetadataCache;
1404
1753
  readonly signal?: AbortSignal;
1405
1754
  readonly onEvent?: ProgressListener;
1406
- }
1755
+ };
1407
1756
  /**
1408
1757
  * Verify the Java runtime files. Honours `target.runtime.installRoot` when set so a
1409
1758
  * shared/global runtime install is checked at its real location instead of the per-target
1410
1759
  * `runtime/` subfolder.
1411
1760
  */
1412
- declare function verifyRuntime(input: VerifyRuntimeInput): Promise<VerificationResult>;
1761
+ declare const verifyRuntime: (input: VerifyRuntimeInput) => Promise<VerificationResult>;
1413
1762
 
1414
1763
  /** Inputs to {@link runRepair}. Shared across all aspect-specific repair flows. */
1415
- interface RunRepairInput {
1764
+ type RunRepairInput = {
1416
1765
  readonly plan: RepairPlan;
1417
1766
  readonly http: HttpClient;
1418
1767
  readonly cache: MetadataCache;
1419
1768
  readonly spawner: Spawner;
1420
1769
  readonly signal?: AbortSignal;
1421
1770
  readonly onEvent?: ProgressListener;
1422
- }
1771
+ };
1423
1772
  /** Execute any repair plan. Reuses the install runner. */
1424
- declare function runRepair(input: RunRepairInput): Promise<RepairReport>;
1773
+ declare const runRepair: (input: RunRepairInput) => Promise<RepairReport>;
1425
1774
 
1426
1775
  /** Inputs to {@link planMinecraftRepair}. */
1427
1776
  type PlanMinecraftRepairInput = AspectRepairInput;
@@ -1429,12 +1778,12 @@ type PlanMinecraftRepairInput = AspectRepairInput;
1429
1778
  * Build a repair plan covering only the vanilla Minecraft slice: client jar, version JSON,
1430
1779
  * libraries (incl. native jars), assets, logging config, and native extractions.
1431
1780
  */
1432
- declare function planMinecraftRepair(input: PlanMinecraftRepairInput): Promise<RepairPlan>;
1781
+ declare const planMinecraftRepair: (input: PlanMinecraftRepairInput) => Promise<RepairPlan>;
1433
1782
 
1434
1783
  /** Inputs to {@link planFabricRepair}. */
1435
1784
  type PlanFabricRepairInput = AspectRepairInput;
1436
1785
  /** Build a repair plan covering the Fabric loader slice: profile JSON + libraries. */
1437
- declare function planFabricRepair(input: PlanFabricRepairInput): Promise<RepairPlan>;
1786
+ declare const planFabricRepair: (input: PlanFabricRepairInput) => Promise<RepairPlan>;
1438
1787
 
1439
1788
  /** Inputs to {@link planForgeRepair}. */
1440
1789
  type PlanForgeRepairInput = AspectRepairInput;
@@ -1444,7 +1793,7 @@ type PlanForgeRepairInput = AspectRepairInput;
1444
1793
  * version JSON was missing during verify (so libraries couldn't be enumerated), every
1445
1794
  * forge-library download is added defensively — `downloadFile` skips files already on disk.
1446
1795
  */
1447
- declare function planForgeRepair(input: PlanForgeRepairInput): Promise<RepairPlan>;
1796
+ declare const planForgeRepair: (input: PlanForgeRepairInput) => Promise<RepairPlan>;
1448
1797
 
1449
1798
  /** Inputs to {@link planRuntimeRepair}. */
1450
1799
  type PlanRuntimeRepairInput = AspectRepairInput;
@@ -1453,64 +1802,44 @@ type PlanRuntimeRepairInput = AspectRepairInput;
1453
1802
  * honoured automatically because both `planInstall` and the verify side resolve runtime
1454
1803
  * paths through the same `targetPaths.runtimeRoot(..., installRoot)` helper.
1455
1804
  */
1456
- declare function planRuntimeRepair(input: PlanRuntimeRepairInput): Promise<RepairPlan>;
1805
+ declare const planRuntimeRepair: (input: PlanRuntimeRepairInput) => Promise<RepairPlan>;
1457
1806
 
1807
+ /** Result of resolving the on-disk version JSON for a target. */
1808
+ type ResolvedLaunchVersion = {
1809
+ /** Topmost version id (the one used as `${version_name}` and for the natives directory). */
1810
+ readonly versionId: string;
1811
+ /** Merged manifest with `inheritsFrom` chain folded together. */
1812
+ readonly merged: MinecraftVersionManifest;
1813
+ /** Inherits-from chain from top (`versionId`) down to the root vanilla version. */
1814
+ readonly chain: readonly string[];
1815
+ };
1816
+ /** Read the installed version JSON appropriate for a target's loader and merge inheritsFrom. */
1817
+ declare const resolveLaunchVersion: (target: Target) => Promise<ResolvedLaunchVersion>;
1458
1818
  /**
1459
- * Stable error code discriminator. Consumers can `switch (e.code)` exhaustively.
1819
+ * Pick the version id whose `versions/<id>/<id>.jar` should land on the launch classpath.
1820
+ * Walks the inherits-from chain from top to root and returns the first id whose jar exists
1821
+ * on disk. Falls back to the root id when nothing is materialised yet.
1460
1822
  *
1461
- * Codes are stable across releases adding new codes is non-breaking; removing or renaming
1462
- * a code is a breaking change.
1823
+ * Why: Fabric's profile id is `fabric-loader-0.14.21-1.20.1`, but Fabric does not produce a
1824
+ * matching `.jar`; the loader expects the **vanilla** client jar on the classpath and hooks
1825
+ * it via `KnotClient`. Modern Forge similarly leaves `versions/<forge-id>/<forge-id>.jar`
1826
+ * absent and routes the patched client jar through `libraries/`. Walking the chain picks
1827
+ * the right id for both shapes without special-casing.
1463
1828
  */
1464
- type MinecraftKitErrorCode = "NETWORK_TIMEOUT" | "NETWORK_HTTP_ERROR" | "NETWORK_ABORTED" | "INTEGRITY_HASH_MISMATCH" | "INTEGRITY_SIZE_MISMATCH" | "MANIFEST_INVALID" | "MANIFEST_NOT_FOUND" | "METADATA_PARSE_ERROR" | "FILESYSTEM_PATH_TRAVERSAL" | "FILESYSTEM_WRITE_ERROR" | "FILESYSTEM_READ_ERROR" | "ARCHIVE_INVALID" | "ARCHIVE_TOO_LARGE" | "ARCHIVE_ENTRY_REJECTED" | "RUNTIME_NOT_FOUND" | "RUNTIME_UNSUPPORTED_PLATFORM" | "FORGE_PROCESSOR_FAILED" | "FORGE_INSTALLER_INVALID" | "LAUNCH_JAVA_NOT_FOUND" | "LAUNCH_PROCESS_FAILED" | "LAUNCH_ABORTED" | "VERIFICATION_FAILED" | "INVALID_INPUT" | "NOT_IMPLEMENTED" | "UNSUPPORTED_VERSION" | "LZMA_DECODE_ERROR";
1465
- /** Structured context attached to errors. */
1466
- interface MinecraftKitErrorContext {
1467
- readonly url?: string;
1468
- readonly filePath?: string;
1469
- readonly expectedHash?: string;
1470
- readonly actualHash?: string;
1471
- readonly expectedSize?: number;
1472
- readonly actualSize?: number;
1473
- readonly httpStatus?: number;
1474
- readonly exitCode?: number;
1475
- readonly platform?: string;
1476
- readonly version?: string;
1477
- readonly [key: string]: unknown;
1478
- }
1829
+ declare const pickClientJarVersionId: (directory: string, chain: readonly string[]) => Promise<string>;
1479
1830
 
1480
- /**
1481
- * The single error class thrown by every public API in `@loontail/minecraft-kit`.
1482
- *
1483
- * Use {@link isMinecraftKitError} or {@link isErrorCode} for type-narrowing in `catch` blocks.
1484
- */
1485
- declare class MinecraftKitError extends Error {
1486
- readonly name = "MinecraftKitError";
1487
- /** Stable discriminator. */
1488
- readonly code: MinecraftKitErrorCode;
1489
- /** Structured context; safe to serialize. */
1490
- readonly context: Readonly<MinecraftKitErrorContext>;
1491
- constructor(code: MinecraftKitErrorCode, message: string, options?: {
1492
- cause?: unknown;
1493
- context?: MinecraftKitErrorContext;
1494
- });
1495
- /** JSON-friendly representation. */
1496
- toJSON(): Record<string, unknown>;
1831
+ /** Default spawner backed by `node:child_process.spawn`. */
1832
+ declare class ChildProcessSpawner implements Spawner {
1833
+ spawn(command: string, args: readonly string[], options: SpawnOptions): SpawnedProcess;
1497
1834
  }
1498
- /** True when `e` is an {@link MinecraftKitError}. */
1499
- declare function isMinecraftKitError(e: unknown): e is MinecraftKitError;
1500
- /** True when `e` is an {@link MinecraftKitError} carrying the given code. */
1501
- declare function isErrorCode<C extends MinecraftKitErrorCode>(e: unknown, code: C): e is MinecraftKitError & {
1502
- code: C;
1503
- };
1504
1835
 
1505
- /**
1506
- * Derive a stable v3-style UUID for an offline player username.
1507
- *
1508
- * Mojang's offline-mode formula: `MD5("OfflinePlayer:" + name)` with the version/variant
1509
- * bits patched to UUID v3.
1510
- */
1511
- declare function offlineUuidFor(username: string): string;
1512
- /** Strip the dashes from a UUID. Used by `${auth_uuid}`. */
1513
- declare function stripUuidDashes(uuid: string): string;
1836
+ /** Inputs to {@link createMemoryCache}. */
1837
+ type MemoryCacheOptions = {
1838
+ readonly maxEntries?: number;
1839
+ readonly ttlMs?: number;
1840
+ };
1841
+ /** In-memory metadata cache backed by `lru-cache`. */
1842
+ declare const createMemoryCache: (options?: MemoryCacheOptions) => MetadataCache;
1514
1843
 
1515
1844
  /**
1516
1845
  * Default {@link HttpClient} implementation backed by Node's built-in `fetch` (undici under
@@ -1520,15 +1849,68 @@ declare class FetchHttpClient implements HttpClient {
1520
1849
  request(url: string, options?: HttpRequestOptions): Promise<HttpResponse>;
1521
1850
  }
1522
1851
 
1523
- /** Default spawner backed by `node:child_process.spawn`. */
1524
- declare class ChildProcessSpawner implements Spawner {
1525
- spawn(command: string, args: readonly string[], options: SpawnOptions): SpawnedProcess;
1526
- }
1527
-
1528
1852
  /** Logger that drops every message. Default when no logger is supplied. */
1529
1853
  declare const silentLogger: Logger;
1530
1854
  /** Logger that mirrors messages to `console.<level>` with structured fields. */
1531
1855
  declare const consoleLogger: Logger;
1856
+ /**
1857
+ * Wrap a {@link Logger} so every message is prefixed with `[scope]`. Mirrors the
1858
+ * `scopedLogger(scope)` convention used by the launcher: each module reaches for one named
1859
+ * logger at the top of the file (e.g. `const log = scopedLogger(input.logger, "http")`)
1860
+ * instead of threading the scope through every callsite.
1861
+ *
1862
+ * The merged `fields` argument lets a scope attach default context (e.g. a request id) without
1863
+ * the call site repeating it on every message.
1864
+ */
1865
+ declare const scopedLogger: (base: Logger, scope: string, baseFields?: Readonly<Record<string, unknown>>) => Logger;
1866
+
1867
+ /** Inputs allowing the host system to be derived from current Node values or overrides. */
1868
+ type DetectSystemInput = {
1869
+ readonly platform?: NodeJS.Platform;
1870
+ readonly arch?: NodeJS.Architecture;
1871
+ readonly osVersion?: string;
1872
+ };
1873
+ /**
1874
+ * Resolve the current host system identifiers.
1875
+ *
1876
+ * @throws {@link MinecraftKitError} with code `RUNTIME_UNSUPPORTED_PLATFORM` when the
1877
+ * platform/arch combination is not understood.
1878
+ */
1879
+ declare const detectSystem: (input?: DetectSystemInput) => RuntimeSystem;
1880
+
1881
+ /**
1882
+ * Derive a stable v3-style UUID for an offline player username.
1883
+ *
1884
+ * Mojang's offline-mode formula: `MD5("OfflinePlayer:" + name)` with the version/variant
1885
+ * bits patched to UUID v3.
1886
+ */
1887
+ declare const offlineUuidFor: (username: string) => string;
1888
+ /** Strip the dashes from a UUID. Used by `${auth_uuid}`. */
1889
+ declare const stripUuidDashes: (uuid: string) => string;
1890
+
1891
+ /** Helpers for the per-target directory layout. */
1892
+ declare const targetPaths: {
1893
+ readonly versionsDir: (root: string) => string;
1894
+ readonly versionDir: (root: string, versionId: string) => string;
1895
+ readonly versionJar: (root: string, versionId: string) => string;
1896
+ readonly versionJson: (root: string, versionId: string) => string;
1897
+ readonly librariesDir: (root: string) => string;
1898
+ readonly libraryFile: (root: string, libraryPath: string) => string;
1899
+ readonly assetIndex: (root: string, indexId: string) => string;
1900
+ readonly assetObject: (root: string, hash: string) => string;
1901
+ readonly assetVirtual: (root: string, virtualPath: string) => string;
1902
+ readonly assetLegacy: (root: string, virtualPath: string) => string;
1903
+ readonly assetResource: (root: string, virtualPath: string) => string;
1904
+ readonly loggingConfig: (root: string, id: string) => string;
1905
+ readonly nativesDir: (root: string, versionId: string) => string;
1906
+ /**
1907
+ * Path to a runtime component's root directory. Honours `installRoot` (custom global
1908
+ * runtime location) when present; otherwise falls back to `<directory>/runtime/<component>`.
1909
+ */
1910
+ readonly runtimeRoot: (directory: string, component: string, installRoot?: string) => string;
1911
+ readonly runtimeJavaExecutable: (directory: string, component: string, os: OperatingSystem, installRoot?: string) => string;
1912
+ readonly forgeInstaller: (root: string, mavenVersion: string) => string;
1913
+ };
1532
1914
 
1533
1915
  /**
1534
1916
  * Endpoint builders for every external HTTP request the library makes. Code MUST go through
@@ -1711,4 +2093,4 @@ declare const RUNTIME_PLATFORM_KEYS: Readonly<Record<OperatingSystem, Readonly<R
1711
2093
  */
1712
2094
  declare const FALLBACK_COMPONENT: string;
1713
2095
 
1714
- export { ASSETS_DIR, ASSETS_INDEXES_DIR, ASSETS_LEGACY_DIR, ASSETS_LOG_CONFIGS_DIR, ASSETS_OBJECTS_DIR, ASSETS_RESOURCES_DIR, ASSETS_VIRTUAL_DIR, ApiEndpoints, type ApiEndpointsShape, type Architecture, Architectures, type ArgumentEntry, type ArtifactDownload, type AspectRepairInput, type AssetIndexDocument, type AssetIndexReference, type AssetObject, type AuthMode, AuthModes, BASE_JVM_ARGS, CACHE_MAX_ENTRIES, CACHE_TTL_MS, ChildProcessSpawner, DEFAULT_KILL_GRACE_MS, DEFAULT_LAUNCHER_NAME, DEFAULT_LAUNCHER_VERSION, DEFAULT_LIBRARY_REPOSITORY, DEFAULT_MAX_MB, DEFAULT_MIN_MB, DOWNLOAD_CONCURRENCY, type DetectSystemInput, type DiscoveredLoaderHint, type DiscoveredRuntimeHint, type DiscoveredTarget, type DownloadAction, EXTRACTION_MAX_COMPRESSION_RATIO, EXTRACTION_MAX_ENTRY_COUNT, EXTRACTION_MAX_FILE_SIZE, EXTRACTION_MAX_TOTAL_SIZE, type EventType, EventTypes, type ExtractNativeAction, FABRIC_MAVEN_BASE, FALLBACK_COMPONENT, FORGE_INSTALLERS_DIR, FORGE_INSTALLER_MAX_SIZE, FORGE_MAVEN_BASE, type FabricCompatibilityEntry, type FabricListInput, type FabricLoaderSummary, type FabricProfile, type FabricResolveInput, FabricVersionsApi, FetchHttpClient, type FileRef, type ForgeBuildSummary, type ForgeInstallProfile, type ForgeListInput, type ForgeProcessor, type ForgeProfileData, type ForgeResolveInput, type ForgeVersionJson, ForgeVersionsApi, HTTP_RETRY_BACKOFF_BASE_MS, HTTP_RETRY_BACKOFF_CAP_MS, HTTP_RETRY_MAX, HTTP_TIMEOUT_MS, type HttpClient, type HttpHeaders, type HttpRequestOptions, type HttpResponse, type InstallAction, type InstallActionKind, InstallActionKinds, type InstallPhase, InstallPhases, type InstallPlan, type InstallReport, JAVA_EXECUTABLE, LAUNCH_PLACEHOLDERS, LEGACY_JVM_ARGS, LIBRARIES_DIR, type LaunchAuth, type LaunchComposition, type LaunchExit, type LaunchMemoryOptions, type LaunchOptions, type LaunchPlaceholder, type LaunchResolutionOptions, type LaunchRunOptions, type LaunchSession, type LibraryArtifact, type LibraryRule, type Loader, type LoaderKind, Loaders, type LogLevel, LogLevels, type Logger, MACOS_JVM_ARGS, MAC_RUNTIME_PREFIX, MAX_PROCESSOR_STDERR_LINES, type MemoryCacheOptions, type MetadataCache, type MinecraftArguments, type MinecraftChannel, MinecraftChannels, type MinecraftDownloads, type MinecraftGetInput, type MinecraftJavaVersion, MinecraftKit, MinecraftKitError, type MinecraftKitErrorCode, type MinecraftKitErrorContext, type MinecraftKitOptions, type MinecraftLatestInput, type MinecraftLibrary, type MinecraftLibraryDownloads, type MinecraftListInput, type MinecraftLogging, type MinecraftVersionManifest, type MinecraftVersionSummary, MinecraftVersionsApi, NATIVES_DIR_NAME, NODE_ARCH_TO_MOJANG_ARCH, NODE_PLATFORM_TO_MOJANG_OS, type OfflineAuth, type OnlineAuth, type OperatingSystem, OperatingSystems, type OperationOptions, PROGRESS_EVENT_INTERVAL_MS, type PlanFabricRepairInput, type PlanForgeRepairInput, type PlanMinecraftRepairInput, type PlanRuntimeInstallInput, type PlanRuntimeRepairInput, type PlanStandaloneRuntimeInstallInput, type ProcessStream, type ProcessorRef, type ProgressEvent, type ProgressListener, RUNTIMES_DIR, RUNTIME_PLATFORM_KEYS, type RepairAspect, type RepairPhase, RepairPhases, type RepairPlan, type RepairPlanOptions, type RepairReport, type ResolvedFabricLoader, type ResolvedForgeLoader, type ResolvedMinecraft, type ResolvedRuntime, type ResolvedVanillaLoader, type ResolverContext, type RunForgeProcessorAction, type RunRepairInput, type RuntimeComponent, RuntimeComponents, type RuntimeFileDirectory, type RuntimeFileEntry, type RuntimeFileFile, type RuntimeFileLink, type RuntimeFilesManifest, type RuntimeIndex, type RuntimeIndexEntry, type RuntimeIndexPlatform, type RuntimeListEntry, type RuntimeListInput, RuntimePreference, type RuntimePreferenceKind, type RuntimeResolveInput, type RuntimeSystem, RuntimeVersionsApi, SPAWNER_MAX_LINE_BYTES, type SpawnOptions, type SpawnedProcess, type Spawner, type Target, type TargetCreateInput, type TargetListInput, type TargetLoaderInput, type TargetResolveInput, TargetsApi, type TargetsApiContext, USER_AGENT, type UpdatePlan, type UpdateReport, VERSIONS_DIR, type VerificationFileResult, type VerificationKind, VerificationKinds, type VerificationResult, type VerifyFabricInput, VerifyFileCategories, type VerifyFileCategory, type VerifyFileStatus, VerifyFileStatuses, type VerifyForgeInput, type VerifyMinecraftInput, type VerifyOperationOptions, type VerifyRuntimeInput, VersionPreference, type VersionPreferenceKind, type WriteLoggingConfigAction, type WriteVersionJsonAction, consoleLogger, createMemoryCache, detectSystem, isErrorCode, isMinecraftKitError, offlineUuidFor, planFabricRepair, planForgeRepair, planMinecraftRepair, planRuntimeInstall, planRuntimeRepair, planStandaloneRuntimeInstall, runRepair, silentLogger, stripUuidDashes, verifyFabric, verifyForge, verifyMinecraft, verifyRuntime };
2096
+ export { ASSETS_DIR, ASSETS_INDEXES_DIR, ASSETS_LEGACY_DIR, ASSETS_LOG_CONFIGS_DIR, ASSETS_OBJECTS_DIR, ASSETS_RESOURCES_DIR, ASSETS_VIRTUAL_DIR, ApiEndpoints, type ApiEndpointsShape, type Architecture, Architectures, type ArgumentEntry, type ArtifactDownload, type AspectRepairInput, type AssetIndexDocument, type AssetIndexReference, type AssetObject, type AuthMode, AuthModes, BASE_JVM_ARGS, CACHE_MAX_ENTRIES, CACHE_TTL_MS, CLIENT_ID_ENV_VAR, ChildProcessSpawner, DEFAULT_KILL_GRACE_MS, DEFAULT_LAUNCHER_NAME, DEFAULT_LAUNCHER_VERSION, DEFAULT_LIBRARY_REPOSITORY, DEFAULT_MAX_MB, DEFAULT_MIN_MB, DOWNLOAD_CONCURRENCY, type DetectSystemInput, type DeviceCodePrompt, type DeviceCodeState, type DiscoveredLoaderHint, type DiscoveredRuntimeHint, type DiscoveredTarget, type DownloadAction, DownloadCategories, type DownloadCategory, EXTRACTION_MAX_COMPRESSION_RATIO, EXTRACTION_MAX_ENTRY_COUNT, EXTRACTION_MAX_FILE_SIZE, EXTRACTION_MAX_TOTAL_SIZE, type EventType, EventTypes, type ExtractNativeAction, FABRIC_MAVEN_BASE, FALLBACK_COMPONENT, FORGE_INSTALLERS_DIR, FORGE_INSTALLER_MAX_SIZE, FORGE_MAVEN_BASE, type FabricCompatibilityEntry, type FabricListInput, type FabricLoaderSummary, type FabricProfile, type FabricResolveInput, FabricVersionsApi, FetchHttpClient, type FileRef, type ForgeBuildSummary, type ForgeInstallProfile, type ForgeListInput, type ForgeProcessor, type ForgeProfileData, type ForgeResolveInput, type ForgeVersionJson, ForgeVersionsApi, HTTP_RETRY_BACKOFF_BASE_MS, HTTP_RETRY_BACKOFF_CAP_MS, HTTP_RETRY_MAX, HTTP_TIMEOUT_MS, type HttpClient, type HttpHeaders, type HttpMethod, type HttpRequestBody, type HttpRequestOptions, type HttpResponse, type InstallAction, type InstallActionKind, InstallActionKinds, type InstallPhase, InstallPhases, type InstallPlan, type InstallPlanTarget, type InstallProgressTracker, type InstallReport, type InstallRunOptions, type InstallStage, InstallStages, JAVA_EXECUTABLE, LAUNCH_PLACEHOLDERS, LEGACY_JVM_ARGS, LIBRARIES_DIR, type LaunchAuth, type LaunchComposition, type LaunchExit, type LaunchMemoryOptions, type LaunchOptions, type LaunchPlaceholder, type LaunchResolutionOptions, type LaunchRunOptions, type LaunchSession, type LibraryArtifact, type LibraryRule, type Loader, type LoaderKind, Loaders, type LogLevel, LogLevels, type Logger, type LoginOptions, MACOS_JVM_ARGS, MAC_RUNTIME_PREFIX, MAX_PROCESSOR_STDERR_LINES, type MemoryCacheOptions, type MetadataCache, type MinecraftArguments, type MinecraftChannel, MinecraftChannels, type MinecraftDownloads, type MinecraftGetInput, type MinecraftJavaVersion, MinecraftKit, MinecraftKitError, type MinecraftKitErrorCode, MinecraftKitErrorCodes, type MinecraftKitErrorContext, type MinecraftKitOptions, type MinecraftLatestInput, type MinecraftLibrary, type MinecraftLibraryDownloads, type MinecraftListInput, type MinecraftLogging, type MinecraftVersionManifest, type MinecraftVersionSummary, MinecraftVersionsApi, MojangAuthApi, type MojangSession, NATIVES_DIR_NAME, NODE_ARCH_TO_MOJANG_ARCH, NODE_PLATFORM_TO_MOJANG_OS, type OfflineAuth, type OnlineAuth, type OperatingSystem, OperatingSystems, type OperationOptions, PROGRESS_EVENT_INTERVAL_MS, PauseController, type PlanFabricRepairInput, type PlanForgeRepairInput, type PlanMinecraftRepairInput, type PlanRuntimeInstallInput, type PlanRuntimeRepairInput, type PlanStandaloneRuntimeInstallInput, type PollDeviceCodeOptions, type ProcessStream, type ProcessorRef, type ProgressEvent, type ProgressListener, type ProgressSnapshot, type ProgressTrackerOptions, RUNTIMES_DIR, RUNTIME_PLATFORM_KEYS, type RefreshOptions, type RepairAllInput, type RepairAllReport, type RepairAspect, type RepairPhase, RepairPhases, type RepairPlan, type RepairPlanOptions, type RepairReport, type ResolvedFabricLoader, type ResolvedForgeLoader, type ResolvedLaunchVersion, type ResolvedMinecraft, type ResolvedRuntime, type ResolvedVanillaLoader, type ResolverContext, type RunForgeProcessorAction, type RunRepairInput, type RuntimeComponent, RuntimeComponents, type RuntimeFileDirectory, type RuntimeFileEntry, type RuntimeFileFile, type RuntimeFileLink, type RuntimeFilesManifest, type RuntimeIndex, type RuntimeIndexEntry, type RuntimeIndexPlatform, type RuntimeListEntry, type RuntimeListInput, type RuntimeOnlyInstallTarget, RuntimePreference, type RuntimePreferenceKind, type RuntimeResolveInput, type RuntimeSystem, RuntimeVersionsApi, SPAWNER_MAX_LINE_BYTES, type SpawnOptions, type SpawnedProcess, type Spawner, type StartDeviceCodeOptions, type Target, type TargetCreateInput, type TargetListInput, type TargetLoaderInput, type TargetResolveInput, TargetsApi, type TargetsApiContext, USER_AGENT, type UpdatePlan, type UpdateReport, VERSIONS_DIR, type VerificationFileResult, type VerificationKind, VerificationKinds, type VerificationResult, type VerifyFabricInput, VerifyFileCategories, type VerifyFileCategory, type VerifyFileStatus, VerifyFileStatuses, type VerifyForgeInput, type VerifyMinecraftInput, type VerifyOperationOptions, type VerifyRuntimeInput, VersionPreference, type VersionPreferenceKind, type WriteLoggingConfigAction, type WriteVersionJsonAction, assertNever, consoleLogger, createInstallProgressTracker, createMemoryCache, detectSystem, isErrorCode, isMinecraftKitError, offlineUuidFor, parseMajorVersion, pickClientJarVersionId, planFabricRepair, planForgeRepair, planMinecraftRepair, planRuntimeInstall, planRuntimeRepair, planStandaloneRuntimeInstall, repairAll, resolveLaunchVersion, runRepair, scopedLogger, silentLogger, stripUuidDashes, targetPaths, toOnlineAuth, verifyFabric, verifyForge, verifyMinecraft, verifyRuntime };