@developerz.ai/ui-debugger-mcp 1.9.0 → 1.10.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 +56 -44
- package/dist/adapters/android/adb.d.ts +19 -7
- package/dist/adapters/android/adb.js +50 -13
- package/dist/adapters/android/adb.js.map +1 -1
- package/dist/adapters/android/android-adapter.d.ts +42 -2
- package/dist/adapters/android/android-adapter.js +366 -36
- package/dist/adapters/android/android-adapter.js.map +1 -1
- package/dist/adapters/android/commands.js.map +1 -1
- package/dist/adapters/android/ports.js.map +1 -1
- package/dist/adapters/android/sdk.d.ts +65 -0
- package/dist/adapters/android/sdk.js +107 -0
- package/dist/adapters/android/sdk.js.map +1 -0
- package/dist/adapters/android/uiautomator.d.ts +23 -7
- package/dist/adapters/android/uiautomator.js +31 -7
- package/dist/adapters/android/uiautomator.js.map +1 -1
- package/dist/adapters/availability.d.ts +39 -0
- package/dist/adapters/availability.js +62 -0
- package/dist/adapters/availability.js.map +1 -0
- package/dist/adapters/browser/browser-adapter.d.ts +11 -22
- package/dist/adapters/browser/browser-adapter.js +98 -67
- package/dist/adapters/browser/browser-adapter.js.map +1 -1
- package/dist/adapters/browser/cdp.d.ts +15 -7
- package/dist/adapters/browser/cdp.js +25 -3
- package/dist/adapters/browser/cdp.js.map +1 -1
- package/dist/adapters/browser/filters.d.ts +1 -1
- package/dist/adapters/browser/filters.js.map +1 -1
- package/dist/adapters/browser/geometry.js.map +1 -1
- package/dist/adapters/browser/launch.d.ts +14 -5
- package/dist/adapters/browser/launch.js +14 -5
- package/dist/adapters/browser/launch.js.map +1 -1
- package/dist/adapters/browser/lifecycle.d.ts +58 -0
- package/dist/adapters/browser/lifecycle.js +98 -0
- package/dist/adapters/browser/lifecycle.js.map +1 -0
- package/dist/adapters/browser/log-filters.d.ts +2 -2
- package/dist/adapters/browser/log-filters.js.map +1 -1
- package/dist/adapters/browser/log-format.d.ts +14 -23
- package/dist/adapters/browser/log-format.js +16 -55
- package/dist/adapters/browser/log-format.js.map +1 -1
- package/dist/adapters/browser/tab-context.d.ts +30 -0
- package/dist/adapters/browser/tab-context.js +41 -0
- package/dist/adapters/browser/tab-context.js.map +1 -0
- package/dist/adapters/contract.d.ts +91 -5
- package/dist/adapters/contract.js +7 -2
- package/dist/adapters/contract.js.map +1 -1
- package/dist/adapters/desktop/atspi-busctl.d.ts +26 -0
- package/dist/adapters/desktop/atspi-busctl.js +330 -0
- package/dist/adapters/desktop/atspi-busctl.js.map +1 -0
- package/dist/adapters/desktop/atspi-parse.d.ts +39 -0
- package/dist/adapters/desktop/atspi-parse.js +155 -0
- package/dist/adapters/desktop/atspi-parse.js.map +1 -0
- package/dist/adapters/desktop/atspi.d.ts +75 -50
- package/dist/adapters/desktop/atspi.js +64 -285
- package/dist/adapters/desktop/atspi.js.map +1 -1
- package/dist/adapters/desktop/capture.d.ts +11 -20
- package/dist/adapters/desktop/capture.js +68 -37
- package/dist/adapters/desktop/capture.js.map +1 -1
- package/dist/adapters/desktop/desktop-adapter.d.ts +20 -2
- package/dist/adapters/desktop/desktop-adapter.js +91 -9
- package/dist/adapters/desktop/desktop-adapter.js.map +1 -1
- package/dist/adapters/desktop/input.d.ts +18 -4
- package/dist/adapters/desktop/input.js +15 -10
- package/dist/adapters/desktop/input.js.map +1 -1
- package/dist/adapters/desktop/proc.d.ts +32 -4
- package/dist/adapters/desktop/proc.js +33 -6
- package/dist/adapters/desktop/proc.js.map +1 -1
- package/dist/adapters/factory.d.ts +12 -5
- package/dist/adapters/factory.js +29 -3
- package/dist/adapters/factory.js.map +1 -1
- package/dist/adapters/log-format.d.ts +32 -0
- package/dist/adapters/log-format.js +39 -0
- package/dist/adapters/log-format.js.map +1 -0
- package/dist/agent/belt/act.d.ts +421 -21
- package/dist/agent/belt/act.js +4 -4
- package/dist/agent/belt/act.js.map +1 -1
- package/dist/agent/belt/look.d.ts +471 -14
- package/dist/agent/belt/look.js +74 -12
- package/dist/agent/belt/look.js.map +1 -1
- package/dist/agent/belt/observe.d.ts +663 -42
- package/dist/agent/belt/observe.js +76 -12
- package/dist/agent/belt/observe.js.map +1 -1
- package/dist/agent/belt/report.d.ts +754 -48
- package/dist/agent/belt/report.js +121 -38
- package/dist/agent/belt/report.js.map +1 -1
- package/dist/agent/belt/trail.d.ts +44 -16
- package/dist/agent/belt/trail.js +46 -11
- package/dist/agent/belt/trail.js.map +1 -1
- package/dist/agent/capabilities.js.map +1 -1
- package/dist/agent/fallback.d.ts +33 -0
- package/dist/agent/fallback.js +84 -0
- package/dist/agent/fallback.js.map +1 -0
- package/dist/agent/loop.d.ts +54 -52
- package/dist/agent/loop.js +173 -176
- package/dist/agent/loop.js.map +1 -1
- package/dist/agent/models.d.ts +10 -6
- package/dist/agent/models.js +15 -9
- package/dist/agent/models.js.map +1 -1
- package/dist/agent/prompts/compose.d.ts +1 -1
- package/dist/agent/prompts/debug-agent.js +45 -8
- package/dist/agent/prompts/debug-agent.js.map +1 -1
- package/dist/agent/prompts/web-addendum.d.ts +1 -1
- package/dist/agent/prompts/web-addendum.js +15 -3
- package/dist/agent/prompts/web-addendum.js.map +1 -1
- package/dist/agent/provider.d.ts +38 -0
- package/dist/agent/provider.js +55 -3
- package/dist/agent/provider.js.map +1 -1
- package/dist/boot.d.ts +64 -0
- package/dist/boot.js +145 -0
- package/dist/boot.js.map +1 -0
- package/dist/cli/chromium-libs.d.ts +262 -0
- package/dist/cli/chromium-libs.js +522 -0
- package/dist/cli/chromium-libs.js.map +1 -0
- package/dist/cli/control.js +51 -9
- package/dist/cli/control.js.map +1 -1
- package/dist/cli/init.d.ts +52 -3
- package/dist/cli/init.js +62 -10
- package/dist/cli/init.js.map +1 -1
- package/dist/config/load.d.ts +25 -8
- package/dist/config/load.js +40 -13
- package/dist/config/load.js.map +1 -1
- package/dist/config/schema.d.ts +18 -6
- package/dist/config/schema.js +22 -7
- package/dist/config/schema.js.map +1 -1
- package/dist/errors.d.ts +14 -0
- package/dist/errors.js +18 -0
- package/dist/errors.js.map +1 -1
- package/dist/findings/schema.d.ts +44 -6
- package/dist/findings/schema.js +39 -3
- package/dist/findings/schema.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.js +4 -82
- package/dist/main.js.map +1 -1
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools/describe.d.ts +5 -4
- package/dist/mcp/tools/describe.js +14 -10
- package/dist/mcp/tools/describe.js.map +1 -1
- package/dist/mcp/tools/end-session.d.ts +3 -1
- package/dist/mcp/tools/end-session.js +7 -3
- package/dist/mcp/tools/end-session.js.map +1 -1
- package/dist/mcp/tools/output.d.ts +5 -4
- package/dist/mcp/tools/output.js +10 -2
- package/dist/mcp/tools/output.js.map +1 -1
- package/dist/mcp/tools/result.d.ts +10 -1
- package/dist/mcp/tools/result.js +8 -6
- package/dist/mcp/tools/result.js.map +1 -1
- package/dist/mcp/tools/start-debug.js +7 -5
- package/dist/mcp/tools/start-debug.js.map +1 -1
- package/dist/redact.d.ts +28 -0
- package/dist/redact.js +51 -0
- package/dist/redact.js.map +1 -0
- package/dist/services/catalog.d.ts +28 -0
- package/dist/services/catalog.js +65 -0
- package/dist/services/catalog.js.map +1 -0
- package/dist/services/debug-api.d.ts +172 -0
- package/dist/services/debug-api.js +9 -0
- package/dist/services/debug-api.js.map +1 -0
- package/dist/services/debug-service.d.ts +25 -173
- package/dist/services/debug-service.js +108 -175
- package/dist/services/debug-service.js.map +1 -1
- package/dist/services/login.d.ts +7 -2
- package/dist/services/login.js +203 -29
- package/dist/services/login.js.map +1 -1
- package/dist/services/retained-snapshot.d.ts +36 -0
- package/dist/services/retained-snapshot.js +63 -0
- package/dist/services/retained-snapshot.js.map +1 -0
- package/dist/services/session-builder.d.ts +26 -0
- package/dist/services/session-builder.js +46 -19
- package/dist/services/session-builder.js.map +1 -1
- package/dist/services/start-guards.d.ts +32 -0
- package/dist/services/start-guards.js +50 -0
- package/dist/services/start-guards.js.map +1 -0
- package/dist/services/summarize.d.ts +12 -3
- package/dist/services/summarize.js +13 -5
- package/dist/services/summarize.js.map +1 -1
- package/dist/session/cleanup.js.map +1 -1
- package/dist/session/findings-store.d.ts +2 -1
- package/dist/session/findings-store.js +30 -2
- package/dist/session/findings-store.js.map +1 -1
- package/dist/session/live-pointer.d.ts +19 -0
- package/dist/session/live-pointer.js +41 -0
- package/dist/session/live-pointer.js.map +1 -0
- package/dist/session/manager.d.ts +11 -1
- package/dist/session/manager.js +46 -2
- package/dist/session/manager.js.map +1 -1
- package/dist/session/owner-lock.d.ts +208 -0
- package/dist/session/owner-lock.js +499 -0
- package/dist/session/owner-lock.js.map +1 -0
- package/dist/session/process-identity.js.map +1 -1
- package/dist/session/session.js +61 -7
- package/dist/session/session.js.map +1 -1
- package/dist/session/state-file.d.ts +74 -14
- package/dist/session/state-file.js +203 -21
- package/dist/session/state-file.js.map +1 -1
- package/package.json +7 -7
- package/dist/adapters/android/android-adapter.test-helpers.d.ts +0 -52
- package/dist/adapters/android/android-adapter.test-helpers.js +0 -115
- package/dist/adapters/android/android-adapter.test-helpers.js.map +0 -1
- package/dist/mcp/server.test-helpers.d.ts +0 -23
- package/dist/mcp/server.test-helpers.js +0 -49
- package/dist/mcp/server.test-helpers.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/session/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAyF1C;;;;GAIG;AACH,MAAM,OAAO,OAAO;IACT,EAAE,CAAS;IACX,KAAK,CAAS;IACd,QAAQ,CAAU;IAElB,QAAQ,CAAI;IACZ,cAAc,CAAgB;IACvC,gGAAgG;IACvF,UAAU,CAA4B;IAC/C,8FAA8F;IACrF,OAAO,CAAyB;IAChC,MAAM,GAAa,EAAE,CAAC;IACtB,MAAM,GAAG,IAA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,EAAE,SAAS,CAAC,CAAC;gBACzC,CAAC,CAAC;aACH,CAAC,CAAC;QACL,CAAC;gBAAS,CAAC;YACT,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;IAED,yFAAyF;IACzF,KAAK,CAAC,gBAAgB;QACpB,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,EAAE,CAAC;QAC9D,OAAO,SAAS;YACd,CAAC,CAAC,EAAE,GAAG,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE;YACxC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IAChE,CAAC;CACF;AAED,+FAA+F;AAC/F,SAAS,YAAY,CAAC,KAAc;IAClC,IAAI,KAAK,YAAY,UAAU;QAAE,OAAO,KAAK,CAAC;IAC9C,OAAO,IAAI,UAAU,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AAChF,CAAC;AAED,0FAA0F;AAC1F,SAAS,OAAO,CAAC,KAAyB;IACxC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;AAC9D,CAAC;AAED,wGAAwG;AACxG,SAAS,MAAM,CAAC,CAAS,EAAE,IAAY;IACrC,OAAO,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;AAC7C,CAAC"}
|
|
@@ -9,10 +9,19 @@
|
|
|
9
9
|
* `status` can read the authoritative verdict + counts). Written on start, marked
|
|
10
10
|
* `ended` on a clean end.
|
|
11
11
|
*
|
|
12
|
+
* The breadcrumb alone is ADVISORY: two servers can both read it before either
|
|
13
|
+
* writes, and the second write hides the first owner's live run from
|
|
14
|
+
* `status`/`stop`. The authority is the workspace's exclusive ownership lock
|
|
15
|
+
* (`owner.lock`, see {@link ownerLockPath}) — a kernel-held `flock` that
|
|
16
|
+
* {@link FileStatePort} takes BEFORE it publishes a breadcrumb, so exactly one
|
|
17
|
+
* live server may own a workspace. A refused claim is a {@link SessionBusyError}
|
|
18
|
+
* naming the owner; a crashed server's lock dies with its process, so a dead
|
|
19
|
+
* run never wedges the project — there is nothing to reclaim.
|
|
20
|
+
*
|
|
12
21
|
* `record()` fails LOUD: a run nobody can see is a run nobody can stop — the
|
|
13
22
|
* profile would stay locked with no way to reach the owner short of killing the
|
|
14
|
-
* server by hand — so the service tears the start down instead. `clear()`
|
|
15
|
-
* best-effort: the run is already down, and the stale breadcrumb it leaves names
|
|
23
|
+
* server by hand — so the service tears the start down instead. `clear(sessionId)`
|
|
24
|
+
* stays best-effort: the run is already down, and the stale breadcrumb it leaves names
|
|
16
25
|
* a pid whose liveness the CLI checks anyway.
|
|
17
26
|
*
|
|
18
27
|
* The {@link StatePort} seam keeps {@link DebugService} fs-free in unit tests — a
|
|
@@ -27,8 +36,8 @@ export declare const StateFileSchema: z.ZodObject<{
|
|
|
27
36
|
target: z.ZodString;
|
|
28
37
|
goal: z.ZodString;
|
|
29
38
|
status: z.ZodEnum<{
|
|
30
|
-
running: "running";
|
|
31
39
|
ended: "ended";
|
|
40
|
+
running: "running";
|
|
32
41
|
stopped: "stopped";
|
|
33
42
|
}>;
|
|
34
43
|
startedAt: z.ZodString;
|
|
@@ -37,6 +46,7 @@ export declare const StateFileSchema: z.ZodObject<{
|
|
|
37
46
|
identity: z.ZodObject<{
|
|
38
47
|
startTicks: z.ZodNullable<z.ZodNumber>;
|
|
39
48
|
}, z.core.$strip>;
|
|
49
|
+
workspaceRoot: z.ZodOptional<z.ZodString>;
|
|
40
50
|
}, z.core.$strip>;
|
|
41
51
|
export type StateFile = z.infer<typeof StateFileSchema>;
|
|
42
52
|
/**
|
|
@@ -49,6 +59,18 @@ export type StateFile = z.infer<typeof StateFileSchema>;
|
|
|
49
59
|
export declare function writeState(path: string, state: StateFile): Promise<void>;
|
|
50
60
|
/** Read + validate `state.json`; `null` when absent or malformed (never throws). */
|
|
51
61
|
export declare function readState(path: string): Promise<StateFile | null>;
|
|
62
|
+
/**
|
|
63
|
+
* The two seams a breadcrumb lifecycle write flows through, as one injectable
|
|
64
|
+
* unit — the real fs by default, a controllable fake in tests (so the
|
|
65
|
+
* record-vs-clear write ordering can be pinned deterministically, without
|
|
66
|
+
* racing real-fs timings).
|
|
67
|
+
*/
|
|
68
|
+
export interface StateIo {
|
|
69
|
+
read(path: string): Promise<StateFile | null>;
|
|
70
|
+
write(path: string, state: StateFile): Promise<void>;
|
|
71
|
+
}
|
|
72
|
+
/** The real fs — {@link StateIo} as {@link writeState}/{@link readState} implement it. */
|
|
73
|
+
export declare const fsStateIo: StateIo;
|
|
52
74
|
/** What a run reports to the state file when it opens. */
|
|
53
75
|
export interface RunState {
|
|
54
76
|
sessionId: string;
|
|
@@ -64,12 +86,30 @@ export interface ForeignRun {
|
|
|
64
86
|
/** Where that run writes its `findings.json` — how we read a run we do not own. */
|
|
65
87
|
sessionDir: string;
|
|
66
88
|
}
|
|
67
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* The seam {@link DebugService} writes run lifecycle through (no-op in tests).
|
|
91
|
+
*
|
|
92
|
+
* `record` and `clear` must be serialized per workspace: `clear` is a
|
|
93
|
+
* read-modify-write whose id guard only holds when no `record` can publish
|
|
94
|
+
* between its read and its write ({@link FileStatePort} queues them) — an
|
|
95
|
+
* interleaved record would be overwritten with the ending run's stale
|
|
96
|
+
* breadcrumb, leaving `ui-debugger-mcp stop` nothing live to signal.
|
|
97
|
+
*/
|
|
68
98
|
export interface StatePort {
|
|
69
|
-
/**
|
|
99
|
+
/**
|
|
100
|
+
* Record the run as `running`. Throws when the breadcrumb cannot be written —
|
|
101
|
+
* and when the workspace is already owned by another live server
|
|
102
|
+
* ({@link SessionBusyError}).
|
|
103
|
+
*/
|
|
70
104
|
record(run: RunState): Promise<void>;
|
|
71
|
-
/**
|
|
72
|
-
|
|
105
|
+
/**
|
|
106
|
+
* Mark `ended` — ONLY the run whose session id this is, and ONLY by the
|
|
107
|
+
* workspace's owner. If the breadcrumb names a different session (a successor
|
|
108
|
+
* recorded itself while this teardown was in flight), leave it untouched:
|
|
109
|
+
* ending a live successor's breadcrumb makes `ui-debugger-mcp stop` refuse the
|
|
110
|
+
* run that is actually going.
|
|
111
|
+
*/
|
|
112
|
+
clear(sessionId: string): Promise<void>;
|
|
73
113
|
/**
|
|
74
114
|
* The run a *different, live* server holds on this workspace, if any — the
|
|
75
115
|
* cross-process half of the one-run gate. `null` when nobody else owns it.
|
|
@@ -93,19 +133,22 @@ export declare class FileStatePort implements StatePort {
|
|
|
93
133
|
constructor(workspace: WorkspacePaths, opts?: {
|
|
94
134
|
pid?: number;
|
|
95
135
|
now?: () => Date;
|
|
136
|
+
io?: StateIo;
|
|
137
|
+
cwd?: string;
|
|
96
138
|
});
|
|
97
139
|
record(run: RunState): Promise<void>;
|
|
98
|
-
clear(): Promise<void>;
|
|
140
|
+
clear(sessionId: string): Promise<void>;
|
|
99
141
|
/**
|
|
100
142
|
* Who else is debugging this workspace? Only a breadcrumb that is `running`,
|
|
101
143
|
* written by a pid that is *not* ours, and whose owner is provably still alive
|
|
102
144
|
* ({@link ownerAlive} — a recycled or dead pid does not count) reports a
|
|
103
145
|
* foreign run. Everything else is `null`: nobody to collide with.
|
|
104
146
|
*
|
|
105
|
-
* Advisory, not
|
|
106
|
-
* servers starting within the same launch window can
|
|
107
|
-
*
|
|
108
|
-
*
|
|
147
|
+
* Advisory, not the gate: the breadcrumb is written once a run is open, so two
|
|
148
|
+
* servers starting within the same launch window can both read "no foreign
|
|
149
|
+
* run". The AUTHORITATIVE admission is the workspace's ownership claim, taken
|
|
150
|
+
* atomically by {@link FileStatePort.record} — this read is the friendly
|
|
151
|
+
* early refusal that names the other server before any browser is launched.
|
|
109
152
|
*/
|
|
110
153
|
foreignRun(): Promise<ForeignRun | null>;
|
|
111
154
|
/** Read the foreign run's on-disk findings; `null` unless `sessionId` is that run. */
|
|
@@ -114,8 +157,15 @@ export declare class FileStatePort implements StatePort {
|
|
|
114
157
|
/**
|
|
115
158
|
* Flip the recorded status (`ended`/`stopped`) in place, if a state file exists.
|
|
116
159
|
*
|
|
160
|
+
* Pass `onlySessionId` to scope the flip to ONE run: the ending teardown does.
|
|
161
|
+
* A teardown can settle after the next run already recorded itself (a takeover,
|
|
162
|
+
* a successor start racing the close) — without the id, that late write would
|
|
163
|
+
* mark a LIVE successor `ended` and `ui-debugger-mcp stop` would refuse it.
|
|
164
|
+
* When the file names a different session, nothing is written at all.
|
|
165
|
+
*
|
|
117
166
|
* `stopped` is terminal and wins: a CLI `stop` records it *before* signaling, then
|
|
118
|
-
* the server's SIGTERM path calls `clear()` →
|
|
167
|
+
* the server's SIGTERM path calls `clear(sessionId)` →
|
|
168
|
+
* `markStatus(..., 'ended', sessionId)`. Preserve
|
|
119
169
|
* the existing `stopped` here so `status` keeps reporting the true terminal state
|
|
120
170
|
* after a stop.
|
|
121
171
|
*
|
|
@@ -123,8 +173,18 @@ export declare class FileStatePort implements StatePort {
|
|
|
123
173
|
* it deterministic. The server cannot begin its teardown until the signal lands,
|
|
124
174
|
* and the signal is only sent once `stopped` is durably on disk (see
|
|
125
175
|
* `runStop`), so the server's read always observes `stopped` and keeps it.
|
|
176
|
+
*
|
|
177
|
+
* In-process callers (the server's own `clear`) must not rely on that ordering:
|
|
178
|
+
* a `clear` racing a successor's `record` is exactly the interleaving the port's
|
|
179
|
+
* write queue closes, which is why `FileStatePort` routes this through its queue.
|
|
180
|
+
*
|
|
181
|
+
* `ownedBy` is an OPTIONAL trailing predicate: it receives the recorded run and
|
|
182
|
+
* decides whether THIS caller may flip it. It exists so ownership is enforced
|
|
183
|
+
* where the write happens — a caller that does not own the run must not end it,
|
|
184
|
+
* however well it knows its session id. Omitting it keeps the historical
|
|
185
|
+
* behaviour (the CLI's `stop` marks a run it does not own, on purpose).
|
|
126
186
|
*/
|
|
127
|
-
export declare function markStatus(path: string, status: 'ended' | 'stopped', now?: Date): Promise<void>;
|
|
187
|
+
export declare function markStatus(path: string, status: 'ended' | 'stopped', now?: Date, onlySessionId?: string, io?: StateIo, ownedBy?: (prior: StateFile) => boolean): Promise<void>;
|
|
128
188
|
/**
|
|
129
189
|
* Roll a `stopped` mark back to `running` — the CLI's undo when the signal that
|
|
130
190
|
* was supposed to follow it never landed (e.g. `EPERM`).
|
|
@@ -9,10 +9,19 @@
|
|
|
9
9
|
* `status` can read the authoritative verdict + counts). Written on start, marked
|
|
10
10
|
* `ended` on a clean end.
|
|
11
11
|
*
|
|
12
|
+
* The breadcrumb alone is ADVISORY: two servers can both read it before either
|
|
13
|
+
* writes, and the second write hides the first owner's live run from
|
|
14
|
+
* `status`/`stop`. The authority is the workspace's exclusive ownership lock
|
|
15
|
+
* (`owner.lock`, see {@link ownerLockPath}) — a kernel-held `flock` that
|
|
16
|
+
* {@link FileStatePort} takes BEFORE it publishes a breadcrumb, so exactly one
|
|
17
|
+
* live server may own a workspace. A refused claim is a {@link SessionBusyError}
|
|
18
|
+
* naming the owner; a crashed server's lock dies with its process, so a dead
|
|
19
|
+
* run never wedges the project — there is nothing to reclaim.
|
|
20
|
+
*
|
|
12
21
|
* `record()` fails LOUD: a run nobody can see is a run nobody can stop — the
|
|
13
22
|
* profile would stay locked with no way to reach the owner short of killing the
|
|
14
|
-
* server by hand — so the service tears the start down instead. `clear()`
|
|
15
|
-
* best-effort: the run is already down, and the stale breadcrumb it leaves names
|
|
23
|
+
* server by hand — so the service tears the start down instead. `clear(sessionId)`
|
|
24
|
+
* stays best-effort: the run is already down, and the stale breadcrumb it leaves names
|
|
16
25
|
* a pid whose liveness the CLI checks anyway.
|
|
17
26
|
*
|
|
18
27
|
* The {@link StatePort} seam keeps {@link DebugService} fs-free in unit tests — a
|
|
@@ -21,7 +30,10 @@
|
|
|
21
30
|
import { mkdir, readFile } from 'node:fs/promises';
|
|
22
31
|
import { dirname, join } from 'node:path';
|
|
23
32
|
import { z } from 'zod';
|
|
33
|
+
import { SessionBusyError } from '../errors.js';
|
|
24
34
|
import { writeFileAtomic } from './atomic-write.js';
|
|
35
|
+
import { writeLivePointer } from './live-pointer.js';
|
|
36
|
+
import { acquireOwnerLock, OwnerLockSchema, ownerLockPath, releaseOwnerLock, } from './owner-lock.js';
|
|
25
37
|
import { captureIdentity, ownerAlive, ProcessIdentitySchema } from './process-identity.js';
|
|
26
38
|
import { sessionPaths } from './workspace.js';
|
|
27
39
|
/** `state.json` shape — the breadcrumb a separate CLI process reads. */
|
|
@@ -44,6 +56,8 @@ export const StateFileSchema = z.object({
|
|
|
44
56
|
sessionDir: z.string(),
|
|
45
57
|
/** Process fingerprint — lets the CLI tell our live server from a recycled `pid`. */
|
|
46
58
|
identity: ProcessIdentitySchema,
|
|
59
|
+
/** Workspace root the server booted with. Optional: older servers' files lack it. */
|
|
60
|
+
workspaceRoot: z.string().optional(),
|
|
47
61
|
});
|
|
48
62
|
/**
|
|
49
63
|
* Write `state.json` (creates the parent dir), replacing it atomically.
|
|
@@ -67,6 +81,8 @@ export async function readState(path) {
|
|
|
67
81
|
return null;
|
|
68
82
|
}
|
|
69
83
|
}
|
|
84
|
+
/** The real fs — {@link StateIo} as {@link writeState}/{@link readState} implement it. */
|
|
85
|
+
export const fsStateIo = { read: readState, write: writeState };
|
|
70
86
|
/** Default port: writes nothing, sees nobody (keeps the service fs-free under unit test). */
|
|
71
87
|
export const noopStatePort = {
|
|
72
88
|
async record() { },
|
|
@@ -83,27 +99,169 @@ export class FileStatePort {
|
|
|
83
99
|
#workspace;
|
|
84
100
|
#pid;
|
|
85
101
|
#now;
|
|
102
|
+
#io;
|
|
103
|
+
#cwd;
|
|
104
|
+
/**
|
|
105
|
+
* Tail of this workspace's breadcrumb-write queue.
|
|
106
|
+
*
|
|
107
|
+
* `clear()` is a read-modify-write: read the breadcrumb, check the session
|
|
108
|
+
* id, write it back. `record()` is an overwrite. Letting the two interleave
|
|
109
|
+
* breaks the id guard — a teardown's clear reads the OLD breadcrumb, a
|
|
110
|
+
* successor start records itself, the clear's write publishes last and
|
|
111
|
+
* overwrites the live successor with the old ended run, so `stop` skips it.
|
|
112
|
+
* Lifecycle writes therefore run one at a time per workspace: each finishes
|
|
113
|
+
* before the next begins, so a clear's read never goes stale.
|
|
114
|
+
*/
|
|
115
|
+
#writes = Promise.resolve();
|
|
86
116
|
constructor(workspace, opts = {}) {
|
|
117
|
+
this.#cwd = opts.cwd;
|
|
87
118
|
this.#workspace = workspace;
|
|
88
119
|
this.#pid = opts.pid ?? process.pid;
|
|
89
120
|
this.#now = opts.now ?? (() => new Date());
|
|
121
|
+
this.#io = opts.io ?? fsStateIo;
|
|
122
|
+
}
|
|
123
|
+
/** Run `task` only once every breadcrumb write issued before it has fully settled. */
|
|
124
|
+
#serialize(task) {
|
|
125
|
+
const run = this.#writes.then(task, task);
|
|
126
|
+
// The tail must advance on a failed write too — one lost breadcrumb must
|
|
127
|
+
// never jam every later lifecycle write behind it.
|
|
128
|
+
this.#writes = run.then(() => undefined, () => undefined);
|
|
129
|
+
return run;
|
|
90
130
|
}
|
|
91
131
|
async record(run) {
|
|
92
132
|
const iso = this.#now().toISOString();
|
|
93
|
-
await
|
|
133
|
+
await this.#serialize(async () => {
|
|
134
|
+
// The claim comes FIRST: it is the admission decision, and the breadcrumb
|
|
135
|
+
// must never be published by a server that does not own the workspace.
|
|
136
|
+
// A live foreign owner refuses here, before a single byte is written.
|
|
137
|
+
const createdClaim = await this.#acquireClaim(run.sessionId, iso);
|
|
138
|
+
try {
|
|
139
|
+
// Config-independent locator for `status`/`stop`: a run nobody can find
|
|
140
|
+
// is a run nobody can stop, so a failure here undoes the claim too. It
|
|
141
|
+
// goes BEFORE the breadcrumb: a pointer failure then leaves no `running`
|
|
142
|
+
// state.json naming this (healthy, idle) server for `stop` to SIGTERM.
|
|
143
|
+
if (this.#cwd !== undefined)
|
|
144
|
+
await writeLivePointer(this.#cwd, this.#workspace.root);
|
|
145
|
+
await this.#io.write(this.#workspace.stateJson, {
|
|
146
|
+
pid: this.#pid,
|
|
147
|
+
sessionId: run.sessionId,
|
|
148
|
+
target: run.target,
|
|
149
|
+
goal: run.goal,
|
|
150
|
+
status: 'running',
|
|
151
|
+
startedAt: iso,
|
|
152
|
+
updatedAt: iso,
|
|
153
|
+
sessionDir: sessionPaths(this.#workspace, run.sessionId).root,
|
|
154
|
+
identity: captureIdentity(this.#pid),
|
|
155
|
+
workspaceRoot: this.#workspace.root,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
catch (err) {
|
|
159
|
+
// The breadcrumb never landed. Give back ONLY a claim this call
|
|
160
|
+
// created: a re-entrant claim belongs to an earlier successful
|
|
161
|
+
// record, and releasing it would hand a live workspace away.
|
|
162
|
+
if (createdClaim)
|
|
163
|
+
await this.#releaseClaim();
|
|
164
|
+
throw err;
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Take the workspace's exclusive ownership lock, or fail loud.
|
|
170
|
+
*
|
|
171
|
+
* The lock is the AUTHORITATIVE one-run gate: the kernel grants it to one
|
|
172
|
+
* process at a time and holds it for the owner's lifetime, so two servers
|
|
173
|
+
* starting in the same window cannot both win, and no admission can be
|
|
174
|
+
* invalidated after the fact. A live foreign owner is named in the refusal
|
|
175
|
+
* (pid + session id) so the caller knows which server to stop; a crashed
|
|
176
|
+
* owner's lock died with its process — the workspace is simply free.
|
|
177
|
+
*
|
|
178
|
+
* Returns whether this call CREATED the claim. A re-entrant acquire did not
|
|
179
|
+
* create it, so a later failed breadcrumb write must not release the claim
|
|
180
|
+
* held by an earlier successful record.
|
|
181
|
+
*/
|
|
182
|
+
async #acquireClaim(sessionId, acquiredAt) {
|
|
183
|
+
const lockPath = ownerLockPath(this.#workspace);
|
|
184
|
+
await mkdir(dirname(lockPath), { recursive: true });
|
|
185
|
+
const owner = {
|
|
94
186
|
pid: this.#pid,
|
|
95
|
-
sessionId: run.sessionId,
|
|
96
|
-
target: run.target,
|
|
97
|
-
goal: run.goal,
|
|
98
|
-
status: 'running',
|
|
99
|
-
startedAt: iso,
|
|
100
|
-
updatedAt: iso,
|
|
101
|
-
sessionDir: sessionPaths(this.#workspace, run.sessionId).root,
|
|
102
187
|
identity: captureIdentity(this.#pid),
|
|
103
|
-
|
|
188
|
+
sessionId,
|
|
189
|
+
acquiredAt,
|
|
190
|
+
};
|
|
191
|
+
const result = await acquireOwnerLock(lockPath, owner);
|
|
192
|
+
if (result.acquired)
|
|
193
|
+
return result.created;
|
|
194
|
+
throw new SessionBusyError(`Another ui-debugger-mcp server (pid ${result.holder.pid}) already owns the debug ` +
|
|
195
|
+
`session ('${result.holder.sessionId}') for this project. One run per project at a ` +
|
|
196
|
+
"time. To take the project over, run 'ui-debugger-mcp stop' in this directory, then " +
|
|
197
|
+
'start again.');
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Release the lock — but ONLY when it still names us.
|
|
201
|
+
*
|
|
202
|
+
* Only the process holding the kernel lock can release it; the claim file is
|
|
203
|
+
* a notice board, not the lock, and is never unlinked (unlinking the path
|
|
204
|
+
* would put a fresh inode where a live owner's lock lives). The holder is
|
|
205
|
+
* read back from disk rather than remembered, so a claim whose session id
|
|
206
|
+
* moved on (a re-entrant acquire keeps the first id) is still recognised as
|
|
207
|
+
* ours.
|
|
208
|
+
*/
|
|
209
|
+
async #releaseClaim() {
|
|
210
|
+
const lockPath = ownerLockPath(this.#workspace);
|
|
211
|
+
const holder = await this.#readClaim();
|
|
212
|
+
if (holder === null)
|
|
213
|
+
return; // no claim to release
|
|
214
|
+
await releaseOwnerLock(lockPath, holder);
|
|
104
215
|
}
|
|
105
|
-
|
|
106
|
-
|
|
216
|
+
/** The claim currently on disk, or `null` when there is none (or it is malformed). */
|
|
217
|
+
async #readClaim() {
|
|
218
|
+
try {
|
|
219
|
+
const raw = await readFile(ownerLockPath(this.#workspace), 'utf8');
|
|
220
|
+
const parsed = OwnerLockSchema.safeParse(JSON.parse(raw));
|
|
221
|
+
return parsed.success ? parsed.data : null;
|
|
222
|
+
}
|
|
223
|
+
catch {
|
|
224
|
+
return null;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Does this claim name US — our pid, and our process (not a recycled one)?
|
|
229
|
+
*
|
|
230
|
+
* Identity is compared on the start ticks: a recycled pid has a different
|
|
231
|
+
* start time, so it never passes as us.
|
|
232
|
+
*/
|
|
233
|
+
#isUs(holder) {
|
|
234
|
+
if (holder.pid !== this.#pid)
|
|
235
|
+
return false;
|
|
236
|
+
const ours = captureIdentity(this.#pid);
|
|
237
|
+
return holder.identity.startTicks === ours.startTicks;
|
|
238
|
+
}
|
|
239
|
+
async clear(sessionId) {
|
|
240
|
+
// Best-effort stays: the run is already down, and a swallowed clear only
|
|
241
|
+
// leaves a breadcrumb naming a pid whose liveness the CLI checks anyway.
|
|
242
|
+
await this.#serialize(async () => {
|
|
243
|
+
// Only the OWNER may end a run here. A stranger that knows (or guesses)
|
|
244
|
+
// the session id must never mark somebody else's live run ended — that
|
|
245
|
+
// would hide the live run from `ui-debugger-mcp stop`.
|
|
246
|
+
const holder = await this.#readClaim();
|
|
247
|
+
if (holder === null || !this.#isUs(holder))
|
|
248
|
+
return;
|
|
249
|
+
const prior = await this.#io.read(this.#workspace.stateJson);
|
|
250
|
+
// Scoped to the run being ended: a successor that recorded itself while
|
|
251
|
+
// this teardown was in flight keeps its own breadcrumb AND its claim.
|
|
252
|
+
if (prior?.sessionId !== sessionId)
|
|
253
|
+
return;
|
|
254
|
+
try {
|
|
255
|
+
await markStatus(this.#workspace.stateJson, 'ended', this.#now(), sessionId, this.#io, (state) => state.pid === this.#pid);
|
|
256
|
+
}
|
|
257
|
+
finally {
|
|
258
|
+
// The run is over either way: a breadcrumb write that THREW must not
|
|
259
|
+
// leave a live-process claim behind — an ended run still holding the
|
|
260
|
+
// claim wedges the workspace for every other server until this one
|
|
261
|
+
// exits, with nothing left to end.
|
|
262
|
+
await this.#releaseClaim();
|
|
263
|
+
}
|
|
264
|
+
}).catch(() => undefined);
|
|
107
265
|
}
|
|
108
266
|
/**
|
|
109
267
|
* Who else is debugging this workspace? Only a breadcrumb that is `running`,
|
|
@@ -111,10 +269,11 @@ export class FileStatePort {
|
|
|
111
269
|
* ({@link ownerAlive} — a recycled or dead pid does not count) reports a
|
|
112
270
|
* foreign run. Everything else is `null`: nobody to collide with.
|
|
113
271
|
*
|
|
114
|
-
* Advisory, not
|
|
115
|
-
* servers starting within the same launch window can
|
|
116
|
-
*
|
|
117
|
-
*
|
|
272
|
+
* Advisory, not the gate: the breadcrumb is written once a run is open, so two
|
|
273
|
+
* servers starting within the same launch window can both read "no foreign
|
|
274
|
+
* run". The AUTHORITATIVE admission is the workspace's ownership claim, taken
|
|
275
|
+
* atomically by {@link FileStatePort.record} — this read is the friendly
|
|
276
|
+
* early refusal that names the other server before any browser is launched.
|
|
118
277
|
*/
|
|
119
278
|
async foreignRun() {
|
|
120
279
|
const state = await readState(this.#workspace.stateJson);
|
|
@@ -142,8 +301,15 @@ export class FileStatePort {
|
|
|
142
301
|
/**
|
|
143
302
|
* Flip the recorded status (`ended`/`stopped`) in place, if a state file exists.
|
|
144
303
|
*
|
|
304
|
+
* Pass `onlySessionId` to scope the flip to ONE run: the ending teardown does.
|
|
305
|
+
* A teardown can settle after the next run already recorded itself (a takeover,
|
|
306
|
+
* a successor start racing the close) — without the id, that late write would
|
|
307
|
+
* mark a LIVE successor `ended` and `ui-debugger-mcp stop` would refuse it.
|
|
308
|
+
* When the file names a different session, nothing is written at all.
|
|
309
|
+
*
|
|
145
310
|
* `stopped` is terminal and wins: a CLI `stop` records it *before* signaling, then
|
|
146
|
-
* the server's SIGTERM path calls `clear()` →
|
|
311
|
+
* the server's SIGTERM path calls `clear(sessionId)` →
|
|
312
|
+
* `markStatus(..., 'ended', sessionId)`. Preserve
|
|
147
313
|
* the existing `stopped` here so `status` keeps reporting the true terminal state
|
|
148
314
|
* after a stop.
|
|
149
315
|
*
|
|
@@ -151,13 +317,29 @@ export class FileStatePort {
|
|
|
151
317
|
* it deterministic. The server cannot begin its teardown until the signal lands,
|
|
152
318
|
* and the signal is only sent once `stopped` is durably on disk (see
|
|
153
319
|
* `runStop`), so the server's read always observes `stopped` and keeps it.
|
|
320
|
+
*
|
|
321
|
+
* In-process callers (the server's own `clear`) must not rely on that ordering:
|
|
322
|
+
* a `clear` racing a successor's `record` is exactly the interleaving the port's
|
|
323
|
+
* write queue closes, which is why `FileStatePort` routes this through its queue.
|
|
324
|
+
*
|
|
325
|
+
* `ownedBy` is an OPTIONAL trailing predicate: it receives the recorded run and
|
|
326
|
+
* decides whether THIS caller may flip it. It exists so ownership is enforced
|
|
327
|
+
* where the write happens — a caller that does not own the run must not end it,
|
|
328
|
+
* however well it knows its session id. Omitting it keeps the historical
|
|
329
|
+
* behaviour (the CLI's `stop` marks a run it does not own, on purpose).
|
|
154
330
|
*/
|
|
155
|
-
export async function markStatus(path, status, now = new Date()) {
|
|
156
|
-
const prior = await
|
|
331
|
+
export async function markStatus(path, status, now = new Date(), onlySessionId, io = fsStateIo, ownedBy) {
|
|
332
|
+
const prior = await io.read(path);
|
|
157
333
|
if (!prior)
|
|
158
334
|
return;
|
|
335
|
+
// Not our run anymore (a successor owns the breadcrumb) — never write over it.
|
|
336
|
+
if (onlySessionId !== undefined && prior.sessionId !== onlySessionId)
|
|
337
|
+
return;
|
|
338
|
+
// Not ours to end — never write over it.
|
|
339
|
+
if (ownedBy !== undefined && !ownedBy(prior))
|
|
340
|
+
return;
|
|
159
341
|
const nextStatus = prior.status === 'stopped' ? 'stopped' : status;
|
|
160
|
-
await
|
|
342
|
+
await io.write(path, { ...prior, status: nextStatus, updatedAt: now.toISOString() });
|
|
161
343
|
}
|
|
162
344
|
/**
|
|
163
345
|
* Roll a `stopped` mark back to `running` — the CLI's undo when the signal that
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state-file.js","sourceRoot":"","sources":["../../src/session/state-file.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"state-file.js","sourceRoot":"","sources":["../../src/session/state-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EACL,gBAAgB,EAEhB,eAAe,EACf,aAAa,EACb,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAuB,MAAM,gBAAgB,CAAC;AAEnE,wEAAwE;AACxE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,uEAAuE;IACvE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAChC,yCAAyC;IACzC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,6CAA6C;IAC7C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,kCAAkC;IAClC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,iGAAiG;IACjG,MAAM,EAAE,CAAC,CAAC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.10.0",
|
|
4
4
|
"description": "Autonomous UI debugging MCP server. Give a goal; a fast agent drives the browser/desktop, finds bugs + visual issues, and reports back.",
|
|
5
5
|
"mcpName": "io.github.developerz-ai/ui-debugger-mcp",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"LICENSE"
|
|
28
28
|
],
|
|
29
29
|
"engines": {
|
|
30
|
-
"node": ">=
|
|
30
|
+
"node": ">=22"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"dev": "bun --watch src/main.ts",
|
|
@@ -41,16 +41,16 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
44
|
-
"ai": "^
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
44
|
+
"@openrouter/ai-sdk-provider": "^3.1.0",
|
|
45
|
+
"ai": "^7.0.143",
|
|
46
|
+
"playwright-core": "^1.61.1",
|
|
47
|
+
"zod": "^4.4.3"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@biomejs/biome": "^2.4.15",
|
|
51
51
|
"@types/bun": "^1.2.0",
|
|
52
52
|
"ajv": "^8.17.1",
|
|
53
53
|
"ajv-formats": "^3.0.1",
|
|
54
|
-
"typescript": "^
|
|
54
|
+
"typescript": "^7.0.2"
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared fakes for android-adapter.*.test.ts — faked ADB/UiAutomator seams so tests
|
|
3
|
-
* never need a real device or emulator. Split out so each test file (lifecycle,
|
|
4
|
-
* behavior, parsers) stays under the file-size cap without duplicating fixtures.
|
|
5
|
-
*/
|
|
6
|
-
import type { ChildProcess } from 'node:child_process';
|
|
7
|
-
import type { Adb } from './adb.js';
|
|
8
|
-
import { AndroidAdapter, type AndroidAdapterInit } from './android-adapter.js';
|
|
9
|
-
import type { AndroidNode, UiAutomatorSource } from './uiautomator.js';
|
|
10
|
-
/** Build a minimal valid AndroidNode. */
|
|
11
|
-
export declare function makeNode(overrides?: Partial<AndroidNode>): AndroidNode;
|
|
12
|
-
/** Fake ADB seam — records calls (and the serial it was bound to) for assertions. */
|
|
13
|
-
export declare class FakeAdb implements Adb {
|
|
14
|
-
readonly serial: string;
|
|
15
|
-
calls: Array<{
|
|
16
|
-
method: string;
|
|
17
|
-
args: string[];
|
|
18
|
-
}>;
|
|
19
|
-
responses: Map<string, string | Uint8Array>;
|
|
20
|
-
constructor(serial?: string);
|
|
21
|
-
setResponse(key: string, value: string | Uint8Array): void;
|
|
22
|
-
private get;
|
|
23
|
-
shell(command: string[]): Promise<string>;
|
|
24
|
-
execOut(command: string[]): Promise<Uint8Array>;
|
|
25
|
-
adb(args: string[]): Promise<string>;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Minimal fake emulator child for the spawn seam — an EventEmitter with a pid.
|
|
29
|
-
* Pass `undefined` when the test calls `close`, so the real `process.kill` is skipped.
|
|
30
|
-
*/
|
|
31
|
-
export declare function makeFakeEmulator(pid?: number | undefined): ChildProcess;
|
|
32
|
-
/** Fake UiAutomatorSource seam. */
|
|
33
|
-
export declare class FakeUi implements UiAutomatorSource {
|
|
34
|
-
private nodes;
|
|
35
|
-
calls: number;
|
|
36
|
-
constructor(nodes?: AndroidNode[]);
|
|
37
|
-
setNodes(nodes: AndroidNode[]): void;
|
|
38
|
-
dump(): Promise<AndroidNode[]>;
|
|
39
|
-
}
|
|
40
|
-
/** Build a test AndroidAdapter with fake seams. */
|
|
41
|
-
export declare function makeAdapter(opts?: Partial<AndroidAdapterInit> & {
|
|
42
|
-
nodes?: AndroidNode[];
|
|
43
|
-
}): {
|
|
44
|
-
adapter: AndroidAdapter;
|
|
45
|
-
adb: FakeAdb;
|
|
46
|
-
ui: FakeUi;
|
|
47
|
-
};
|
|
48
|
-
export declare function makeAttachAdapter(serial?: string, nodes?: AndroidNode[]): {
|
|
49
|
-
adapter: AndroidAdapter;
|
|
50
|
-
adb: FakeAdb;
|
|
51
|
-
ui: FakeUi;
|
|
52
|
-
};
|