@mgcrea/mcp-ios-simulator 0.2.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -24
- package/dist/cli.js +2 -3
- package/dist/{config-qc0zwYZr.js → config-HmqayUrt.js} +618 -111
- package/dist/config-HmqayUrt.js.map +1 -0
- package/dist/index.d.ts +158 -52
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/package.json +13 -13
- package/dist/config-qc0zwYZr.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,53 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/server";
|
|
2
2
|
import { CommandError, CommandTimeoutError, DisplayInfo, ExecImpl, IosError, IosError as IosError$1, Logger, ScreenHost, ToolchainError, WdaClient, WdaError, WdaUnavailableError } from "@mgcrea/mcp-ios-core";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The log captures this server has started, newest per simulator and app.
|
|
6
|
+
*
|
|
7
|
+
* Much less machinery than the device server's `ConsoleCaptures`, because on a
|
|
8
|
+
* simulator nothing has to stay attached. `simctl launch --stdout/--stderr`
|
|
9
|
+
* hands the redirect to the simulator's launchd and returns as soon as the app
|
|
10
|
+
* is spawned; the app then writes its own file for as long as it runs. So there
|
|
11
|
+
* is no child process to watch, to keep out of this server's signal group, or
|
|
12
|
+
* to kill on exit — a capture is a path and a pid, and it outlives this server
|
|
13
|
+
* without leaking anything.
|
|
14
|
+
*
|
|
15
|
+
* Whether it is still running is a question about the app's process, which on a
|
|
16
|
+
* simulator is an ordinary process on this Mac: measured on an iOS 27.0
|
|
17
|
+
* runtime, the pid `simctl launch` prints is a host pid owned by the user, and
|
|
18
|
+
* `kill(pid, 0)` answers for it like for any other.
|
|
19
|
+
*/
|
|
20
|
+
type Capture = {
|
|
21
|
+
udid: string;
|
|
22
|
+
simulatorName: string;
|
|
23
|
+
bundleId: string;
|
|
24
|
+
/** Where the file actually is on this Mac, which is not always where it was asked for. */
|
|
25
|
+
path: string;
|
|
26
|
+
pid: number | undefined;
|
|
27
|
+
startedAt: string;
|
|
28
|
+
};
|
|
29
|
+
/** The liveness probe, as a seam: tests cannot rely on whichever pid is free on the machine. */
|
|
30
|
+
type ProcessAlive = (pid: number) => boolean;
|
|
31
|
+
declare class LaunchCaptures {
|
|
32
|
+
private readonly alive;
|
|
33
|
+
private readonly captures;
|
|
34
|
+
private latest;
|
|
35
|
+
constructor(alive?: ProcessAlive);
|
|
36
|
+
private key;
|
|
37
|
+
/**
|
|
38
|
+
* One capture per simulator and app. A relaunch replaces the record rather
|
|
39
|
+
* than adding a second, so a read never has to choose between two files of
|
|
40
|
+
* the same app — the older file stays on disk, it is just no longer "the" log.
|
|
41
|
+
*/
|
|
42
|
+
record(capture: Capture): void;
|
|
43
|
+
find(udid: string | undefined, bundleId: string | undefined): Capture | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Whether the app is still writing. A pid can be reused once the app exits,
|
|
46
|
+
* and that is accepted: the cost of a false "running" is only that a final
|
|
47
|
+
* half-written line waits for the next read.
|
|
48
|
+
*/
|
|
49
|
+
running(capture: Capture): boolean;
|
|
50
|
+
}
|
|
5
51
|
/**
|
|
6
52
|
* `xcrun simctl` — Apple's own simulator tool, and the half of this server that
|
|
7
53
|
* needs nothing installed and nothing signed.
|
|
@@ -23,6 +69,8 @@ import { z } from "zod";
|
|
|
23
69
|
type SimctlOptions = {
|
|
24
70
|
xcrunPath: string;
|
|
25
71
|
plutilPath: string;
|
|
72
|
+
/** Only `launch` with environment variables goes through it; see there. */
|
|
73
|
+
envPath: string;
|
|
26
74
|
timeoutMs: number;
|
|
27
75
|
exec?: ExecImpl | undefined;
|
|
28
76
|
logger?: Logger | undefined;
|
|
@@ -35,6 +83,8 @@ type RawSim = {
|
|
|
35
83
|
availabilityError?: string;
|
|
36
84
|
deviceTypeIdentifier?: string;
|
|
37
85
|
lastBootedAt?: string;
|
|
86
|
+
/** The simulator's own filesystem root on this Mac; see `locateRedirect`. */
|
|
87
|
+
dataPath?: string;
|
|
38
88
|
};
|
|
39
89
|
type RawRuntime = {
|
|
40
90
|
identifier: string;
|
|
@@ -69,7 +119,7 @@ type RawSimApp = {
|
|
|
69
119
|
* Without this the message a caller sees is the first line, which names a
|
|
70
120
|
* numeric code and says nothing about what to do.
|
|
71
121
|
*/
|
|
72
|
-
declare const parseSimctlError: (stderr: string) => {
|
|
122
|
+
export declare const parseSimctlError: (stderr: string) => {
|
|
73
123
|
domain?: string;
|
|
74
124
|
code?: number;
|
|
75
125
|
message: string;
|
|
@@ -83,12 +133,18 @@ declare const parseSimctlError: (stderr: string) => {
|
|
|
83
133
|
* forward, so it is refused here as well as in the resolver — the resolver is
|
|
84
134
|
* where it should be caught, and this is where it cannot be missed.
|
|
85
135
|
*/
|
|
86
|
-
declare const assertNotBulkTarget: (udid: string) => void;
|
|
87
|
-
declare class Simctl {
|
|
136
|
+
export declare const assertNotBulkTarget: (udid: string) => void;
|
|
137
|
+
export declare class Simctl {
|
|
88
138
|
private readonly opts;
|
|
89
139
|
private readonly exec;
|
|
90
140
|
/** Device types change only when Xcode is updated; re-reading is pure cost. */
|
|
91
141
|
private deviceTypes;
|
|
142
|
+
/**
|
|
143
|
+
* Read once, like device types: both change only when Xcode or a runtime is
|
|
144
|
+
* installed, and every tool call resolves a simulator. The cost is that a
|
|
145
|
+
* runtime added or deleted while this server runs is seen after a restart.
|
|
146
|
+
*/
|
|
147
|
+
private runtimes;
|
|
92
148
|
constructor(opts: SimctlOptions);
|
|
93
149
|
/** Raw stdout, for the subcommands that answer in prose. */
|
|
94
150
|
private run;
|
|
@@ -112,6 +168,13 @@ declare class Simctl {
|
|
|
112
168
|
listRuntimes(): Promise<RawRuntime[]>;
|
|
113
169
|
listDeviceTypes(): Promise<RawDeviceType[]>;
|
|
114
170
|
boot(udid: string): Promise<void>;
|
|
171
|
+
/**
|
|
172
|
+
* Wait until a booting simulator has finished, or `timeoutMs` passes (a
|
|
173
|
+
* `CommandTimeoutError`). Not the state in `list`: measured on an iOS 27.0
|
|
174
|
+
* runtime, that reads "Booted" 0.4s after `boot` returns, while this returns
|
|
175
|
+
* 17s later, once the system is up.
|
|
176
|
+
*/
|
|
177
|
+
bootstatus(udid: string, timeoutMs: number): Promise<void>;
|
|
115
178
|
shutdown(udid: string): Promise<void>;
|
|
116
179
|
erase(udid: string): Promise<void>;
|
|
117
180
|
/**
|
|
@@ -145,16 +208,32 @@ declare class Simctl {
|
|
|
145
208
|
* Launch, optionally replacing a running copy.
|
|
146
209
|
*
|
|
147
210
|
* Environment variables do not go on the command line: simctl reads them from
|
|
148
|
-
* its **own** environment under a `SIMCTL_CHILD_` prefix. `ExecImpl`
|
|
149
|
-
* minimal environment on purpose, so
|
|
150
|
-
*
|
|
211
|
+
* its **own** environment under a `SIMCTL_CHILD_` prefix. `ExecImpl` takes
|
|
212
|
+
* argv and pins a minimal environment on purpose, so the variables reach
|
|
213
|
+
* simctl through `/usr/bin/env` as `SIMCTL_CHILD_NAME=value` argv entries in
|
|
214
|
+
* front of xcrun — still no shell, and still one argv entry per value. Names
|
|
215
|
+
* are checked here because `env` reads everything up to the first entry with
|
|
216
|
+
* no `=` as an assignment, so a name holding one would shift the command.
|
|
217
|
+
*
|
|
218
|
+
* `stdout` and `stderr` may be the same path, and that is how a log capture
|
|
219
|
+
* uses them: measured on Xcode 27.0 with an iOS 27.0 runtime, a probe app
|
|
220
|
+
* writing to `print`, to stderr and to `Logger` in turn left one file with all
|
|
221
|
+
* three interleaved in order, nothing overwritten. The redirect *appends* — a
|
|
222
|
+
* second launch into the same file kept the first one's lines — and where it
|
|
223
|
+
* lands is not always the path given; see `SimulatorClient.locateRedirect`.
|
|
151
224
|
*/
|
|
152
225
|
launch(udid: string, bundleId: string, opts?: {
|
|
153
226
|
args?: string[];
|
|
154
227
|
terminateExisting?: boolean;
|
|
155
228
|
stdout?: string;
|
|
156
229
|
stderr?: string;
|
|
230
|
+
env?: Record<string, string>;
|
|
157
231
|
}): Promise<string>;
|
|
232
|
+
/**
|
|
233
|
+
* Remove an app and its data container. Irreversible, which is why the tool
|
|
234
|
+
* in front of this takes `confirm`.
|
|
235
|
+
*/
|
|
236
|
+
uninstall(udid: string, bundleId: string): Promise<void>;
|
|
158
237
|
terminate(udid: string, bundleId: string): Promise<void>;
|
|
159
238
|
openUrl(udid: string, url: string): Promise<void>;
|
|
160
239
|
/**
|
|
@@ -192,8 +271,6 @@ declare class Simctl {
|
|
|
192
271
|
*/
|
|
193
272
|
push(udid: string, bundleId: string, payload: unknown): Promise<void>;
|
|
194
273
|
}
|
|
195
|
-
//#endregion
|
|
196
|
-
//#region src/client/shape.d.ts
|
|
197
274
|
type SimulatorSummary = {
|
|
198
275
|
/**
|
|
199
276
|
* The UDID. Called `id` because that is the name the shared `ScreenHost`
|
|
@@ -216,6 +293,12 @@ type SimulatorSummary = {
|
|
|
216
293
|
available: boolean;
|
|
217
294
|
unavailableReason?: string;
|
|
218
295
|
lastBootedAt?: string;
|
|
296
|
+
/**
|
|
297
|
+
* The simulator's own filesystem root on this Mac. Never shown in a list row;
|
|
298
|
+
* it is how a launch log that the simulator wrote under its own `/tmp` is
|
|
299
|
+
* found again — see `SimulatorClient.locateRedirect`.
|
|
300
|
+
*/
|
|
301
|
+
dataPath?: string;
|
|
219
302
|
};
|
|
220
303
|
/**
|
|
221
304
|
* Flatten the runtime-keyed map `list devices` returns.
|
|
@@ -226,7 +309,7 @@ type SimulatorSummary = {
|
|
|
226
309
|
* primary key: it is joined against `list runtimes` for a display name, 0..n
|
|
227
310
|
* matches tolerated, and carried through verbatim besides.
|
|
228
311
|
*/
|
|
229
|
-
declare const summarizeDevices: (devices: Record<string, RawSim[]>, runtimes: RawRuntime[], deviceTypes: RawDeviceType[]) => SimulatorSummary[];
|
|
312
|
+
export declare const summarizeDevices: (devices: Record<string, RawSim[]>, runtimes: RawRuntime[], deviceTypes: RawDeviceType[]) => SimulatorSummary[];
|
|
230
313
|
type SimAppSummary = {
|
|
231
314
|
bundleId: string;
|
|
232
315
|
name: string | undefined;
|
|
@@ -241,18 +324,18 @@ type SimAppSummary = {
|
|
|
241
324
|
bundlePath: string | undefined;
|
|
242
325
|
dataContainer: string | undefined;
|
|
243
326
|
};
|
|
244
|
-
declare const summarizeApps: (apps: Record<string, RawSimApp>, opts?: {
|
|
327
|
+
export declare const summarizeApps: (apps: Record<string, RawSimApp>, opts?: {
|
|
245
328
|
includeAll?: boolean;
|
|
246
329
|
}) => SimAppSummary[];
|
|
247
330
|
/** The public shape of one row of `ios_simulator_list`. */
|
|
248
|
-
declare const toListRow: (sim: SimulatorSummary) => Record<string, unknown>;
|
|
249
|
-
//#endregion
|
|
250
|
-
//#region src/client/simulator.d.ts
|
|
331
|
+
export declare const toListRow: (sim: SimulatorSummary) => Record<string, unknown>;
|
|
251
332
|
type SimulatorClientOptions = {
|
|
252
333
|
xcrunPath: string;
|
|
253
334
|
sipsPath: string;
|
|
254
335
|
plutilPath: string;
|
|
255
336
|
openPath: string;
|
|
337
|
+
/** How launch environment variables reach simctl; see `Simctl.launch`. */
|
|
338
|
+
envPath?: string | undefined;
|
|
256
339
|
execTimeoutMs: number;
|
|
257
340
|
wdaTimeoutMs: number;
|
|
258
341
|
wdaPort: number;
|
|
@@ -262,15 +345,18 @@ type SimulatorClientOptions = {
|
|
|
262
345
|
defaultSimulatorId?: string | undefined;
|
|
263
346
|
exec?: ExecImpl | undefined;
|
|
264
347
|
fetch?: typeof fetch | undefined;
|
|
348
|
+
/** Override the launched app's liveness probe (tests). */
|
|
349
|
+
processAlive?: ProcessAlive | undefined;
|
|
265
350
|
logger?: Logger | undefined;
|
|
266
351
|
};
|
|
267
|
-
declare class SimulatorClient implements ScreenHost<SimulatorSummary> {
|
|
352
|
+
export declare class SimulatorClient implements ScreenHost<SimulatorSummary> {
|
|
268
353
|
readonly simctl: Simctl;
|
|
269
354
|
readonly exec: ExecImpl;
|
|
270
355
|
readonly sipsPath: string;
|
|
271
356
|
readonly plutilPath: string;
|
|
272
357
|
readonly openPath: string;
|
|
273
358
|
readonly execTimeoutMs: number;
|
|
359
|
+
readonly captures: LaunchCaptures;
|
|
274
360
|
private readonly opts;
|
|
275
361
|
private readonly wdaClients;
|
|
276
362
|
/** `simctl list` is ~80ms and most tools want it twice; 2s collapses that. */
|
|
@@ -280,6 +366,11 @@ declare class SimulatorClient implements ScreenHost<SimulatorSummary> {
|
|
|
280
366
|
listSimulators(opts?: {
|
|
281
367
|
fresh?: boolean;
|
|
282
368
|
}): Promise<SimulatorSummary[]>;
|
|
369
|
+
/**
|
|
370
|
+
* Drop the cached list. Called after a tool changes a simulator's state, so
|
|
371
|
+
* the next call within the cache window does not act on the state before it.
|
|
372
|
+
*/
|
|
373
|
+
forgetSimulators(): void;
|
|
283
374
|
/**
|
|
284
375
|
* Resolve a hint to exactly one simulator, or refuse.
|
|
285
376
|
*
|
|
@@ -313,6 +404,28 @@ declare class SimulatorClient implements ScreenHost<SimulatorSummary> {
|
|
|
313
404
|
* what the profile describes and it changes only when Xcode does.
|
|
314
405
|
*/
|
|
315
406
|
display(target: SimulatorSummary, capturePng?: string): Promise<DisplayInfo>;
|
|
407
|
+
/**
|
|
408
|
+
* Where a `simctl launch --stdout/--stderr` file actually landed.
|
|
409
|
+
*
|
|
410
|
+
* Not necessarily where it was asked to. The redirect is opened by the
|
|
411
|
+
* simulator's own launchd, which sees the simulator's filesystem, and that
|
|
412
|
+
* has its own `/tmp` and `/var/folders`. Measured on an iOS 27.0 runtime:
|
|
413
|
+
* `--stdout=/tmp/x/a.out` created `<dataPath>/tmp/x/a.out`, and a path under
|
|
414
|
+
* `/var/folders/…/T` — which is where `os.tmpdir()`, and so this server's
|
|
415
|
+
* default output directory, points — landed under `<dataPath>/var/folders/…`,
|
|
416
|
+
* the `/private` prefix of either making no difference. A path under `/Users`
|
|
417
|
+
* was written exactly where it said, missing directories created.
|
|
418
|
+
*
|
|
419
|
+
* Rather than encode which prefixes are remapped, which is a property of a
|
|
420
|
+
* runtime and can change with the next one, this looks: the path as given
|
|
421
|
+
* first, then the same path under the simulator's data root. Neither existing
|
|
422
|
+
* means the redirect went somewhere unforeseen, and the path as given is
|
|
423
|
+
* returned with `found: false` so the caller can say so.
|
|
424
|
+
*/
|
|
425
|
+
locateRedirect(target: SimulatorSummary, path: string): Promise<{
|
|
426
|
+
path: string;
|
|
427
|
+
found: boolean;
|
|
428
|
+
}>;
|
|
316
429
|
/** The capture lane that needs no runner — the whole reason this server is cheap to start. */
|
|
317
430
|
screenshotPng(target: SimulatorSummary): Promise<string>;
|
|
318
431
|
/**
|
|
@@ -327,11 +440,11 @@ declare class SimulatorClient implements ScreenHost<SimulatorSummary> {
|
|
|
327
440
|
* reports which simulator actually owns the port.
|
|
328
441
|
*/
|
|
329
442
|
wdaUrl(): string;
|
|
443
|
+
/** The simulator `resolveTarget` falls back to when no hint is given. */
|
|
444
|
+
get defaultSimulatorId(): string | undefined;
|
|
330
445
|
get wdaPort(): number;
|
|
331
446
|
wda(_target: SimulatorSummary): WdaClient;
|
|
332
447
|
}
|
|
333
|
-
//#endregion
|
|
334
|
-
//#region src/config.d.ts
|
|
335
448
|
/**
|
|
336
449
|
* There are no credentials here, and unlike the device server there is barely
|
|
337
450
|
* any setup either. Two lanes reach a simulator and both are local:
|
|
@@ -352,6 +465,7 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
352
465
|
allowWrites: z.ZodDefault<z.ZodBoolean>;
|
|
353
466
|
launchArgs: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
354
467
|
outputDir: z.ZodDefault<z.ZodString>;
|
|
468
|
+
crashReportsDir: z.ZodDefault<z.ZodString>;
|
|
355
469
|
maxTreeBytes: z.ZodDefault<z.ZodNumber>;
|
|
356
470
|
xcrunPath: z.ZodDefault<z.ZodString>;
|
|
357
471
|
sipsPath: z.ZodDefault<z.ZodString>;
|
|
@@ -359,25 +473,21 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
359
473
|
openPath: z.ZodDefault<z.ZodString>;
|
|
360
474
|
}, z.core.$strict>;
|
|
361
475
|
type Config = z.infer<typeof ConfigSchema>;
|
|
362
|
-
declare const defaultConfigPath: (env?: NodeJS.ProcessEnv) => string;
|
|
476
|
+
export declare const defaultConfigPath: (env?: NodeJS.ProcessEnv) => string;
|
|
363
477
|
/**
|
|
364
478
|
* Environment first, config file second, **per field** — not whole-source.
|
|
365
479
|
* A one-off `IOS_SIMULATOR_ALLOW_WRITES=0` has to beat a file that says `true`,
|
|
366
480
|
* while a file that sets `simulatorId` keeps working when the environment says
|
|
367
481
|
* nothing about it. Merging field by field is the only rule that gives both.
|
|
368
482
|
*/
|
|
369
|
-
declare const loadConfig: (env?: NodeJS.ProcessEnv, configPath?: string) => Config;
|
|
370
|
-
//#endregion
|
|
371
|
-
//#region src/tools/runner.d.ts
|
|
483
|
+
export declare const loadConfig: (env?: NodeJS.ProcessEnv, configPath?: string) => Config;
|
|
372
484
|
/** Injected in tests so no xcodebuild is ever started by the suite. */
|
|
373
485
|
type SpawnRunner = (command: string, args: string[], opts: {
|
|
374
486
|
env: Record<string, string>;
|
|
375
487
|
logPath: string;
|
|
376
488
|
}) => Promise<number | undefined>;
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
declare const SERVER_NAME: string;
|
|
380
|
-
declare const SERVER_VERSION: string;
|
|
489
|
+
export declare const SERVER_NAME: string;
|
|
490
|
+
export declare const SERVER_VERSION: string;
|
|
381
491
|
type CreateServerOptions = {
|
|
382
492
|
config: Config;
|
|
383
493
|
/** Override the process boundary (tests): `xcrun`, `plutil` and `sips` never run. */
|
|
@@ -386,6 +496,8 @@ type CreateServerOptions = {
|
|
|
386
496
|
fetch?: typeof fetch;
|
|
387
497
|
/** Override starting the runner (tests): no process is spawned. */
|
|
388
498
|
spawnRunner?: SpawnRunner;
|
|
499
|
+
/** Override the launched-app liveness probe (tests): no real pid is signalled. */
|
|
500
|
+
processAlive?: ProcessAlive;
|
|
389
501
|
logger?: Logger;
|
|
390
502
|
};
|
|
391
503
|
type CreatedServer = {
|
|
@@ -393,14 +505,13 @@ type CreatedServer = {
|
|
|
393
505
|
client: SimulatorClient;
|
|
394
506
|
};
|
|
395
507
|
/**
|
|
396
|
-
* A pure factory. The injectable seams — `exec`, `fetch
|
|
397
|
-
*
|
|
398
|
-
*
|
|
508
|
+
* A pure factory. The injectable seams — `exec`, `fetch`, `spawnRunner` and
|
|
509
|
+
* `processAlive`, plus `crashReportsDir` in the config — are the whole reason
|
|
510
|
+
* the test suite can drive real tools through the real SDK with no simulator,
|
|
511
|
+
* no Xcode, no WebDriverAgent and no process left running.
|
|
399
512
|
* Nothing below `config.ts` reads `process.env`.
|
|
400
513
|
*/
|
|
401
|
-
declare const createServer: (opts: CreateServerOptions) => CreatedServer;
|
|
402
|
-
//#endregion
|
|
403
|
-
//#region src/client/display.d.ts
|
|
514
|
+
export declare const createServer: (opts: CreateServerOptions) => CreatedServer;
|
|
404
515
|
type ScreenProfile = {
|
|
405
516
|
mainScreenWidth?: number;
|
|
406
517
|
mainScreenHeight?: number;
|
|
@@ -411,7 +522,7 @@ type PlistOpts = {
|
|
|
411
522
|
exec: ExecImpl;
|
|
412
523
|
timeoutMs: number;
|
|
413
524
|
};
|
|
414
|
-
declare const readScreenProfile: (deviceType: RawDeviceType, opts: PlistOpts) => Promise<ScreenProfile>;
|
|
525
|
+
export declare const readScreenProfile: (deviceType: RawDeviceType, opts: PlistOpts) => Promise<ScreenProfile>;
|
|
415
526
|
/**
|
|
416
527
|
* Width and height straight out of a PNG's IHDR.
|
|
417
528
|
*
|
|
@@ -419,7 +530,7 @@ declare const readScreenProfile: (deviceType: RawDeviceType, opts: PlistOpts) =>
|
|
|
419
530
|
* and the bytes are already in hand: the signature is fixed, `IHDR` is always
|
|
420
531
|
* the first chunk, and the two dimensions are big-endian at offsets 16 and 20.
|
|
421
532
|
*/
|
|
422
|
-
declare const pngDimensions: (png: Buffer) => {
|
|
533
|
+
export declare const pngDimensions: (png: Buffer) => {
|
|
423
534
|
width: number;
|
|
424
535
|
height: number;
|
|
425
536
|
} | undefined;
|
|
@@ -435,15 +546,13 @@ declare const pngDimensions: (png: Buffer) => {
|
|
|
435
546
|
* `io enumerate`'s `Power state` is about the framebuffer port rather than the
|
|
436
547
|
* screen, so mapping it would be a lie.
|
|
437
548
|
*/
|
|
438
|
-
declare const toDisplayInfo: (profile: ScreenProfile, capture?: {
|
|
549
|
+
export declare const toDisplayInfo: (profile: ScreenProfile, capture?: {
|
|
439
550
|
width: number;
|
|
440
551
|
height: number;
|
|
441
552
|
}) => DisplayInfo;
|
|
442
|
-
//#endregion
|
|
443
|
-
//#region src/client/errors.d.ts
|
|
444
553
|
/** Raising the budget, or noticing the simulator died mid-call. */
|
|
445
|
-
declare const TIMEOUT_REMEDY: string;
|
|
446
|
-
declare const TOOLCHAIN_REMEDY: string;
|
|
554
|
+
export declare const TIMEOUT_REMEDY: string;
|
|
555
|
+
export declare const TOOLCHAIN_REMEDY: string;
|
|
447
556
|
/**
|
|
448
557
|
* How to get the runner up, from a shell.
|
|
449
558
|
*
|
|
@@ -456,9 +565,9 @@ declare const TOOLCHAIN_REMEDY: string;
|
|
|
456
565
|
* needs — but a remedy that sends a caller holding ios_simulator_restart_wda out
|
|
457
566
|
* to a terminal is a remedy that wastes the tool it already has.
|
|
458
567
|
*/
|
|
459
|
-
declare const START_RUNNER_SCRIPT_REMEDY: string;
|
|
568
|
+
export declare const START_RUNNER_SCRIPT_REMEDY: string;
|
|
460
569
|
/** The same thing, done with this server's own tool. */
|
|
461
|
-
declare const START_RUNNER_TOOL_REMEDY: string;
|
|
570
|
+
export declare const START_RUNNER_TOOL_REMEDY: string;
|
|
462
571
|
/**
|
|
463
572
|
* How to get the runner up, in whichever way the caller can actually reach.
|
|
464
573
|
*
|
|
@@ -466,11 +575,11 @@ declare const START_RUNNER_TOOL_REMEDY: string;
|
|
|
466
575
|
* it unconditionally would be the same mistake this fixes, pointed the other
|
|
467
576
|
* way: a remedy naming a tool that is not in the list.
|
|
468
577
|
*/
|
|
469
|
-
declare const startRunnerRemedy: (allowWrites: boolean) => string;
|
|
578
|
+
export declare const startRunnerRemedy: (allowWrites: boolean) => string;
|
|
470
579
|
/** What to do when WebDriverAgent does not answer at all. */
|
|
471
|
-
declare const wdaUnavailableRemedy: (allowWrites: boolean) => string;
|
|
580
|
+
export declare const wdaUnavailableRemedy: (allowWrites: boolean) => string;
|
|
472
581
|
/** No simulator matched, or several did and none was named. */
|
|
473
|
-
declare class SimulatorNotFoundError extends IosError$1 {
|
|
582
|
+
export declare class SimulatorNotFoundError extends IosError$1 {
|
|
474
583
|
readonly name = "SimulatorNotFoundError";
|
|
475
584
|
constructor(message: string, remedy: string);
|
|
476
585
|
}
|
|
@@ -482,7 +591,7 @@ declare class SimulatorNotFoundError extends IosError$1 {
|
|
|
482
591
|
* "it is shut down" would otherwise be buried in a CoreSimulator envelope that
|
|
483
592
|
* reads like a lookup bug.
|
|
484
593
|
*/
|
|
485
|
-
declare class SimulatorNotBootedError extends IosError$1 {
|
|
594
|
+
export declare class SimulatorNotBootedError extends IosError$1 {
|
|
486
595
|
readonly name = "SimulatorNotBootedError";
|
|
487
596
|
constructor(name: string, udid: string);
|
|
488
597
|
}
|
|
@@ -493,26 +602,23 @@ declare class SimulatorNotBootedError extends IosError$1 {
|
|
|
493
602
|
* at all: `simctl io` against one of these aborts with an uncaught
|
|
494
603
|
* NSInternalInconsistencyException and a thirty-line stack trace.
|
|
495
604
|
*/
|
|
496
|
-
declare class RuntimeUnavailableError extends IosError$1 {
|
|
605
|
+
export declare class RuntimeUnavailableError extends IosError$1 {
|
|
497
606
|
readonly name = "RuntimeUnavailableError";
|
|
498
607
|
constructor(name: string, reason: string | undefined);
|
|
499
608
|
}
|
|
500
609
|
/** Thrown when a write path is reached while IOS_SIMULATOR_ALLOW_WRITES is off. */
|
|
501
|
-
declare class WritesDisabledError extends IosError$1 {
|
|
610
|
+
export declare class WritesDisabledError extends IosError$1 {
|
|
502
611
|
readonly name = "WritesDisabledError";
|
|
503
612
|
constructor(what: string);
|
|
504
613
|
}
|
|
505
614
|
/** A shut-down simulator captures nothing, and that is the usual cause here. */
|
|
506
|
-
declare const EMPTY_SCREENSHOT_REMEDY: string;
|
|
507
|
-
//#endregion
|
|
508
|
-
//#region src/build-info.d.ts
|
|
615
|
+
export declare const EMPTY_SCREENSHOT_REMEDY: string;
|
|
509
616
|
type BuildInfo = {
|
|
510
617
|
name: string;
|
|
511
618
|
version: string;
|
|
512
619
|
gitCommit: string;
|
|
513
620
|
gitCommitDate: string;
|
|
514
621
|
};
|
|
515
|
-
declare const BUILD_INFO: BuildInfo;
|
|
516
|
-
|
|
517
|
-
export { BUILD_INFO, CommandError, CommandTimeoutError, type Config, type CreateServerOptions, type CreatedServer, EMPTY_SCREENSHOT_REMEDY, IosError, type RawDeviceType, type RawRuntime, type RawSim, type RawSimApp, RuntimeUnavailableError, SERVER_NAME, SERVER_VERSION, START_RUNNER_SCRIPT_REMEDY, START_RUNNER_TOOL_REMEDY, type SimAppSummary, Simctl, SimulatorClient, SimulatorNotBootedError, SimulatorNotFoundError, type SimulatorSummary, TIMEOUT_REMEDY, TOOLCHAIN_REMEDY, ToolchainError, WdaError, WdaUnavailableError, WritesDisabledError, assertNotBulkTarget, createServer, defaultConfigPath, loadConfig, parseSimctlError, pngDimensions, readScreenProfile, startRunnerRemedy, summarizeApps, summarizeDevices, toDisplayInfo, toListRow, wdaUnavailableRemedy };
|
|
622
|
+
export declare const BUILD_INFO: BuildInfo;
|
|
623
|
+
export { CommandError, CommandTimeoutError, type Config, type CreateServerOptions, type CreatedServer, IosError, type RawDeviceType, type RawRuntime, type RawSim, type RawSimApp, type SimAppSummary, type SimulatorSummary, ToolchainError, WdaError, WdaUnavailableError };
|
|
518
624
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/client/simctl.ts","../src/client/shape.ts","../src/client/simulator.ts","../src/config.ts","../src/tools/runner.ts","../src/server.ts","../src/client/display.ts","../src/client/errors.ts","../src/build-info.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["IosError"],"sources":["../src/client/logs.ts","../src/client/simctl.ts","../src/client/shape.ts","../src/client/simulator.ts","../src/config.ts","../src/tools/runner.ts","../src/server.ts","../src/client/display.ts","../src/client/errors.ts","../src/build-info.ts"],"mappings":";;;;;;;;;;;;;;;;;;;KAkBY;EACV;EACA;EACA;;EAEA;EACA;EACA;;;KAIU,gBAAgB;cAcf;mBAIkB;mBAHZ;UACT;EAER,YAA6B,QAAO;UAE5B;;;;;;EASR,OAAO,SAAS;EAKhB,KAAK,0BAA0B,+BAA+B;;;;;;EAgB9D,QAAQ,SAAS;;;;;;;;;;;;;;;;;;;;KChDP;EACV;EACA;;EAEA;EACA;EACA,OAAO;EACP,SAAS;;KAGC;EACV;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;;KAGU;EACV;EACA;EACA;EACA;;KAGU;EACV;EACA;EACA;EACA;;;KAIU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;;;;;;qBAqBW,mBAAgB;EAExB;EAAiB;EAAe;;;;;;;;;;;qBA4DxB,sBAAmB;qBAUnB;mBACM;mBACA;;UAET;;;;;;UAMA;EAER,YAAY,MAAM;;UAOJ;;;;;UAUA;;;;;;;;;;;UAqBA;EAwBR,eAAe,QAAQ,eAAe;EAKtC,gBAAgB,QAAQ;EAMxB,mBAAmB,QAAQ;EAS3B,KAAK,eAAe;;;;;;;EAWpB,WAAW,cAAc,oBAAoB;EAK7C,SAAS,eAAe;EAKxB,MAAM,eAAe;;;;;;;;;;;;;;;;EAoBrB,QAAQ,mBAAmB;EAY3B,SAAS,eAAe,QAAQ,eAAe;EAK/C,QAAQ,cAAc,kBAAkB;;;;;;;;;EAcxC,SAAS,cAAc,kBAAkB;;;;;;;;;;;;;;;;;;;EAwBzC,OACJ,cACA,kBACA;IACE;IACA;IACA;IACA;IACA,MAAM;MAEP;;;;;EAuCG,UAAU,cAAc,mBAAmB;EAK3C,UAAU,cAAc,mBAAmB;EAK3C,QAAQ,cAAc,cAAc;;;;;;;;;;;;;EAmBpC,cAAc,eAAe;;;;;;;;EAqB7B,MAAM,cAAc,iBAAiB;EAKrC,MAAM,cAAc,gBAAgB,gBAAgB;EAKpD,kBAAkB,cAAc,kBAAkB;EAKlD,eAAe,eAAe;EAK9B,cAAc,eAAe;EAK7B,YAAY,cAAc,kBAAkB,oBAAoB;EAKhE,cAAc,eAAe;;EAM7B,QAAQ,cAAc,gBAAgB,iBAAiB,oBAAoB;;;;;EAS3E,KAAK,cAAc,kBAAkB,mBAAmB;;KC7epD;;;;;;;EAOV;EACA;;EAEA;EACA;EACA;EACA;;;;;;EAMA;EACA;EACA;;;;;;EAMA;;;;;;;;;;;qBAYW,mBAAgB,SAClB,eAAe,WAAS,UACvB,cAAY,aACT,oBACZ;KAsBS;EACV;EACA;EACA;EACA;EACA;;;;;;EAMA;EACA;;qBAcW,gBAAa,MAClB,eAAe,YAAU;EACvB;MACP;;qBAgBU,YAAS,KAAS,qBAAmB;KC1EtC;EACV;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA,OAAO;EACP,eAAe;;EAEf,eAAe;EACf,SAAS;;qBAGE,2BAA2B,WAAW;WACxC,QAAQ;WACR,MAAM;WACN;WACA;WACA;WACA;WACA,UAAU;mBACF;mBACA;;UAET;UACA;EAER,YAAY,MAAM;EAkBZ,eAAe;IAAQ;MAAyB,QAAQ;;;;;EAiB9D;;;;;;;;;;;;;;;;;;;;;;;;;EA4BM,cAAc,gBAAgB,QAAQ;UA+DpC;;EAMR,cAAc,KAAK,mBAAmB;;;;;EAShC,QAAQ,QAAQ,kBAAkB,sBAAsB,QAAQ;;;;;;;;;;;;;;;;;;;EAuChE,eACJ,QAAQ,kBACR,eACC;IAAU;IAAc;;;EAUrB,cAAc,QAAQ,mBAAmB;;;;;;;;;;;;EAgB/C;;MAKI;MAIA;EAIJ,IAAI,SAAS,mBAAmB;;;;;;;;;;;;;cC/R5B,cAAY,EAAA;;;;;;;;;;;;;;;GA0Dd,EAAA,KAAA;KAEQ,SAAS,EAAE,aAAa;qBA0BvB,oBAAiB,MAAS,OAAO;;;;;;;qBA0BjC,aAAU,MAChB,OAAO,YAAU,wBAErB;;KCrHS,eACV,iBACA,gBACA;EAAQ,KAAK;EAAwB;MAClC;qBCTQ;qBACA;KAED;EACV,QAAQ;;EAER,OAAO;;EAEP,eAAe;;EAEf,cAAc;;EAEd,eAAe;EACf,SAAS;;KAGC;EACV,QAAQ;EACR,QAAQ;;;;;;;;;qBAUG,eAAY,MAAU,wBAAsB;KCT7C;EACV;EACA;EACA;;KAqBG;EAAc;EAAoB,MAAM;EAAU;;qBAe1C,oBAAiB,YAChB,eAAa,MACnB,cACL,QAAQ;;;;;;;;qBAwBE,gBAAa,KAAS;EAAW;EAAe;;;;;;;;;;;;;;qBAmBhD,gBAAa,SACf,eAAa;EACV;EAAe;MAC1B;;qBCzGU;qBAIA;;;;;;;;;;;;;qBAgBA;;qBAOA;;;;;;;;qBAYA,oBAAiB;;qBAIjB,uBAAoB;;qBAMpB,+BAA+BA;WACxB;EAElB,YAAY,iBAAiB;;;;;;;;;;qBAalB,gCAAgCA;WACzB;EAElB,YAAY,cAAc;;;;;;;;;qBAiBf,gCAAgCA;WACzB;EAElB,YAAY,cAAc;;;qBAUf,4BAA4BA;WACrB;EAElB,YAAY;;;qBASD;KClGD;EACV;EACA;EACA;EACA;;qBAGW,YAAY"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { BUILD_INFO, CommandError, CommandTimeoutError, EMPTY_SCREENSHOT_REMEDY, IosError, RuntimeUnavailableError, SERVER_NAME, SERVER_VERSION, START_RUNNER_SCRIPT_REMEDY, START_RUNNER_TOOL_REMEDY, Simctl, SimulatorClient, SimulatorNotBootedError, SimulatorNotFoundError, TIMEOUT_REMEDY, TOOLCHAIN_REMEDY, ToolchainError, WdaError, WdaUnavailableError, WritesDisabledError, assertNotBulkTarget, createServer, defaultConfigPath, loadConfig, parseSimctlError, pngDimensions, readScreenProfile, startRunnerRemedy, summarizeApps, summarizeDevices, toDisplayInfo, toListRow, wdaUnavailableRemedy };
|
|
1
|
+
export { N as BUILD_INFO, g as CommandError, _ as CommandTimeoutError, v as EMPTY_SCREENSHOT_REMEDY, y as IosError, b as RuntimeUnavailableError, r as SERVER_NAME, i as SERVER_VERSION, x as START_RUNNER_SCRIPT_REMEDY, S as START_RUNNER_TOOL_REMEDY, s as Simctl, o as SimulatorClient, C as SimulatorNotBootedError, w as SimulatorNotFoundError, T as TIMEOUT_REMEDY, E as TOOLCHAIN_REMEDY, D as ToolchainError, O as WdaError, k as WdaUnavailableError, A as WritesDisabledError, c as assertNotBulkTarget, a as createServer, t as defaultConfigPath, n as loadConfig, l as parseSimctlError, p as pngDimensions, m as readScreenProfile, j as startRunnerRemedy, u as summarizeApps, d as summarizeDevices, h as toDisplayInfo, f as toListRow, M as wdaUnavailableRemedy } from "./config-HmqayUrt.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mgcrea/mcp-ios-simulator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Model Context Protocol server for driving iOS Simulators: screenshots, UI tree, taps, app lifecycle and device staging",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ios",
|
|
@@ -60,23 +60,23 @@
|
|
|
60
60
|
"prepublishOnly": "pnpm build"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@mgcrea/mcp-ios-core": "^0.
|
|
64
|
-
"@modelcontextprotocol/server": "^2.
|
|
65
|
-
"zod": "^4.
|
|
63
|
+
"@mgcrea/mcp-ios-core": "^0.4.0",
|
|
64
|
+
"@modelcontextprotocol/server": "^2.4.0",
|
|
65
|
+
"zod": "^4.6.7"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@modelcontextprotocol/client": "^2.
|
|
69
|
-
"@types/node": "^26.
|
|
70
|
-
"oxfmt": "^0.
|
|
71
|
-
"oxlint": "^1.
|
|
72
|
-
"tsdown": "^0.
|
|
73
|
-
"tsx": "^4.23.
|
|
68
|
+
"@modelcontextprotocol/client": "^2.4.0",
|
|
69
|
+
"@types/node": "^26.6.5",
|
|
70
|
+
"oxfmt": "^0.75.0",
|
|
71
|
+
"oxlint": "^1.90.0",
|
|
72
|
+
"tsdown": "^0.23.3",
|
|
73
|
+
"tsx": "^4.23.15",
|
|
74
74
|
"typescript": "^7.0.2",
|
|
75
|
-
"vite": "^8.
|
|
76
|
-
"vitest": "^
|
|
75
|
+
"vite": "^8.3.5",
|
|
76
|
+
"vitest": "^5.0.5"
|
|
77
77
|
},
|
|
78
78
|
"engines": {
|
|
79
79
|
"node": ">=22"
|
|
80
80
|
},
|
|
81
|
-
"packageManager": "pnpm@
|
|
81
|
+
"packageManager": "pnpm@12.10.1"
|
|
82
82
|
}
|