@developerz.ai/ui-debugger-mcp 1.8.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.
Files changed (205) hide show
  1. package/README.md +70 -52
  2. package/dist/adapters/android/adb.d.ts +19 -7
  3. package/dist/adapters/android/adb.js +50 -13
  4. package/dist/adapters/android/adb.js.map +1 -1
  5. package/dist/adapters/android/android-adapter.d.ts +42 -2
  6. package/dist/adapters/android/android-adapter.js +366 -36
  7. package/dist/adapters/android/android-adapter.js.map +1 -1
  8. package/dist/adapters/android/commands.js.map +1 -1
  9. package/dist/adapters/android/ports.js.map +1 -1
  10. package/dist/adapters/android/sdk.d.ts +65 -0
  11. package/dist/adapters/android/sdk.js +107 -0
  12. package/dist/adapters/android/sdk.js.map +1 -0
  13. package/dist/adapters/android/uiautomator.d.ts +23 -7
  14. package/dist/adapters/android/uiautomator.js +31 -7
  15. package/dist/adapters/android/uiautomator.js.map +1 -1
  16. package/dist/adapters/availability.d.ts +39 -0
  17. package/dist/adapters/availability.js +62 -0
  18. package/dist/adapters/availability.js.map +1 -0
  19. package/dist/adapters/browser/browser-adapter.d.ts +12 -22
  20. package/dist/adapters/browser/browser-adapter.js +133 -67
  21. package/dist/adapters/browser/browser-adapter.js.map +1 -1
  22. package/dist/adapters/browser/cdp.d.ts +15 -7
  23. package/dist/adapters/browser/cdp.js +25 -3
  24. package/dist/adapters/browser/cdp.js.map +1 -1
  25. package/dist/adapters/browser/filters.d.ts +1 -1
  26. package/dist/adapters/browser/filters.js.map +1 -1
  27. package/dist/adapters/browser/geometry.js.map +1 -1
  28. package/dist/adapters/browser/launch.d.ts +14 -5
  29. package/dist/adapters/browser/launch.js +14 -5
  30. package/dist/adapters/browser/launch.js.map +1 -1
  31. package/dist/adapters/browser/lifecycle.d.ts +58 -0
  32. package/dist/adapters/browser/lifecycle.js +98 -0
  33. package/dist/adapters/browser/lifecycle.js.map +1 -0
  34. package/dist/adapters/browser/log-filters.d.ts +2 -2
  35. package/dist/adapters/browser/log-filters.js.map +1 -1
  36. package/dist/adapters/browser/log-format.d.ts +14 -23
  37. package/dist/adapters/browser/log-format.js +16 -55
  38. package/dist/adapters/browser/log-format.js.map +1 -1
  39. package/dist/adapters/browser/tab-context.d.ts +30 -0
  40. package/dist/adapters/browser/tab-context.js +41 -0
  41. package/dist/adapters/browser/tab-context.js.map +1 -0
  42. package/dist/adapters/contract.d.ts +111 -5
  43. package/dist/adapters/contract.js +7 -2
  44. package/dist/adapters/contract.js.map +1 -1
  45. package/dist/adapters/desktop/atspi-busctl.d.ts +26 -0
  46. package/dist/adapters/desktop/atspi-busctl.js +330 -0
  47. package/dist/adapters/desktop/atspi-busctl.js.map +1 -0
  48. package/dist/adapters/desktop/atspi-parse.d.ts +39 -0
  49. package/dist/adapters/desktop/atspi-parse.js +155 -0
  50. package/dist/adapters/desktop/atspi-parse.js.map +1 -0
  51. package/dist/adapters/desktop/atspi.d.ts +75 -50
  52. package/dist/adapters/desktop/atspi.js +64 -285
  53. package/dist/adapters/desktop/atspi.js.map +1 -1
  54. package/dist/adapters/desktop/capture.d.ts +11 -20
  55. package/dist/adapters/desktop/capture.js +68 -37
  56. package/dist/adapters/desktop/capture.js.map +1 -1
  57. package/dist/adapters/desktop/desktop-adapter.d.ts +20 -2
  58. package/dist/adapters/desktop/desktop-adapter.js +91 -9
  59. package/dist/adapters/desktop/desktop-adapter.js.map +1 -1
  60. package/dist/adapters/desktop/input.d.ts +18 -4
  61. package/dist/adapters/desktop/input.js +15 -10
  62. package/dist/adapters/desktop/input.js.map +1 -1
  63. package/dist/adapters/desktop/proc.d.ts +32 -4
  64. package/dist/adapters/desktop/proc.js +33 -6
  65. package/dist/adapters/desktop/proc.js.map +1 -1
  66. package/dist/adapters/factory.d.ts +12 -5
  67. package/dist/adapters/factory.js +29 -3
  68. package/dist/adapters/factory.js.map +1 -1
  69. package/dist/adapters/log-format.d.ts +32 -0
  70. package/dist/adapters/log-format.js +39 -0
  71. package/dist/adapters/log-format.js.map +1 -0
  72. package/dist/agent/belt/act.d.ts +440 -21
  73. package/dist/agent/belt/act.js +43 -6
  74. package/dist/agent/belt/act.js.map +1 -1
  75. package/dist/agent/belt/look.d.ts +471 -14
  76. package/dist/agent/belt/look.js +74 -12
  77. package/dist/agent/belt/look.js.map +1 -1
  78. package/dist/agent/belt/observe.d.ts +663 -42
  79. package/dist/agent/belt/observe.js +76 -12
  80. package/dist/agent/belt/observe.js.map +1 -1
  81. package/dist/agent/belt/report.d.ts +754 -48
  82. package/dist/agent/belt/report.js +121 -38
  83. package/dist/agent/belt/report.js.map +1 -1
  84. package/dist/agent/belt/trail.d.ts +44 -16
  85. package/dist/agent/belt/trail.js +46 -11
  86. package/dist/agent/belt/trail.js.map +1 -1
  87. package/dist/agent/capabilities.js.map +1 -1
  88. package/dist/agent/fallback.d.ts +33 -0
  89. package/dist/agent/fallback.js +84 -0
  90. package/dist/agent/fallback.js.map +1 -0
  91. package/dist/agent/loop.d.ts +54 -52
  92. package/dist/agent/loop.js +173 -176
  93. package/dist/agent/loop.js.map +1 -1
  94. package/dist/agent/models.d.ts +10 -6
  95. package/dist/agent/models.js +15 -9
  96. package/dist/agent/models.js.map +1 -1
  97. package/dist/agent/prompts/compose.d.ts +1 -1
  98. package/dist/agent/prompts/debug-agent.js +45 -8
  99. package/dist/agent/prompts/debug-agent.js.map +1 -1
  100. package/dist/agent/prompts/web-addendum.d.ts +1 -1
  101. package/dist/agent/prompts/web-addendum.js +15 -3
  102. package/dist/agent/prompts/web-addendum.js.map +1 -1
  103. package/dist/agent/provider.d.ts +38 -0
  104. package/dist/agent/provider.js +55 -3
  105. package/dist/agent/provider.js.map +1 -1
  106. package/dist/boot.d.ts +64 -0
  107. package/dist/boot.js +145 -0
  108. package/dist/boot.js.map +1 -0
  109. package/dist/cli/chromium-libs.d.ts +262 -0
  110. package/dist/cli/chromium-libs.js +522 -0
  111. package/dist/cli/chromium-libs.js.map +1 -0
  112. package/dist/cli/control.js +51 -9
  113. package/dist/cli/control.js.map +1 -1
  114. package/dist/cli/help.js +1 -1
  115. package/dist/cli/init.d.ts +54 -3
  116. package/dist/cli/init.js +89 -24
  117. package/dist/cli/init.js.map +1 -1
  118. package/dist/config/fingerprint.d.ts +6 -1
  119. package/dist/config/fingerprint.js +8 -4
  120. package/dist/config/fingerprint.js.map +1 -1
  121. package/dist/config/load.d.ts +50 -10
  122. package/dist/config/load.js +93 -27
  123. package/dist/config/load.js.map +1 -1
  124. package/dist/config/schema.d.ts +18 -6
  125. package/dist/config/schema.js +22 -7
  126. package/dist/config/schema.js.map +1 -1
  127. package/dist/errors.d.ts +14 -0
  128. package/dist/errors.js +18 -0
  129. package/dist/errors.js.map +1 -1
  130. package/dist/findings/schema.d.ts +44 -6
  131. package/dist/findings/schema.js +39 -3
  132. package/dist/findings/schema.js.map +1 -1
  133. package/dist/index.d.ts +1 -1
  134. package/dist/index.js +1 -1
  135. package/dist/index.js.map +1 -1
  136. package/dist/main.js +4 -76
  137. package/dist/main.js.map +1 -1
  138. package/dist/mcp/server.js.map +1 -1
  139. package/dist/mcp/tools/describe.d.ts +5 -4
  140. package/dist/mcp/tools/describe.js +14 -10
  141. package/dist/mcp/tools/describe.js.map +1 -1
  142. package/dist/mcp/tools/end-session.d.ts +3 -1
  143. package/dist/mcp/tools/end-session.js +7 -3
  144. package/dist/mcp/tools/end-session.js.map +1 -1
  145. package/dist/mcp/tools/output.d.ts +5 -4
  146. package/dist/mcp/tools/output.js +10 -2
  147. package/dist/mcp/tools/output.js.map +1 -1
  148. package/dist/mcp/tools/result.d.ts +10 -1
  149. package/dist/mcp/tools/result.js +8 -6
  150. package/dist/mcp/tools/result.js.map +1 -1
  151. package/dist/mcp/tools/start-debug.js +7 -5
  152. package/dist/mcp/tools/start-debug.js.map +1 -1
  153. package/dist/redact.d.ts +28 -0
  154. package/dist/redact.js +51 -0
  155. package/dist/redact.js.map +1 -0
  156. package/dist/services/catalog.d.ts +28 -0
  157. package/dist/services/catalog.js +65 -0
  158. package/dist/services/catalog.js.map +1 -0
  159. package/dist/services/debug-api.d.ts +172 -0
  160. package/dist/services/debug-api.js +9 -0
  161. package/dist/services/debug-api.js.map +1 -0
  162. package/dist/services/debug-service.d.ts +25 -173
  163. package/dist/services/debug-service.js +108 -175
  164. package/dist/services/debug-service.js.map +1 -1
  165. package/dist/services/login.d.ts +7 -2
  166. package/dist/services/login.js +210 -10
  167. package/dist/services/login.js.map +1 -1
  168. package/dist/services/retained-snapshot.d.ts +36 -0
  169. package/dist/services/retained-snapshot.js +63 -0
  170. package/dist/services/retained-snapshot.js.map +1 -0
  171. package/dist/services/session-builder.d.ts +26 -0
  172. package/dist/services/session-builder.js +46 -19
  173. package/dist/services/session-builder.js.map +1 -1
  174. package/dist/services/start-guards.d.ts +32 -0
  175. package/dist/services/start-guards.js +50 -0
  176. package/dist/services/start-guards.js.map +1 -0
  177. package/dist/services/summarize.d.ts +12 -3
  178. package/dist/services/summarize.js +13 -5
  179. package/dist/services/summarize.js.map +1 -1
  180. package/dist/session/cleanup.js.map +1 -1
  181. package/dist/session/findings-store.d.ts +2 -1
  182. package/dist/session/findings-store.js +30 -2
  183. package/dist/session/findings-store.js.map +1 -1
  184. package/dist/session/live-pointer.d.ts +19 -0
  185. package/dist/session/live-pointer.js +41 -0
  186. package/dist/session/live-pointer.js.map +1 -0
  187. package/dist/session/manager.d.ts +11 -1
  188. package/dist/session/manager.js +46 -2
  189. package/dist/session/manager.js.map +1 -1
  190. package/dist/session/owner-lock.d.ts +208 -0
  191. package/dist/session/owner-lock.js +499 -0
  192. package/dist/session/owner-lock.js.map +1 -0
  193. package/dist/session/process-identity.js.map +1 -1
  194. package/dist/session/session.js +61 -7
  195. package/dist/session/session.js.map +1 -1
  196. package/dist/session/state-file.d.ts +74 -14
  197. package/dist/session/state-file.js +203 -21
  198. package/dist/session/state-file.js.map +1 -1
  199. package/package.json +7 -7
  200. package/dist/adapters/android/android-adapter.test-helpers.d.ts +0 -52
  201. package/dist/adapters/android/android-adapter.test-helpers.js +0 -115
  202. package/dist/adapters/android/android-adapter.test-helpers.js.map +0 -1
  203. package/dist/mcp/server.test-helpers.d.ts +0 -23
  204. package/dist/mcp/server.test-helpers.js +0 -49
  205. package/dist/mcp/server.test-helpers.js.map +0 -1
@@ -0,0 +1,208 @@
1
+ /**
2
+ * Exclusive workspace ownership — a kernel-held lock.
3
+ *
4
+ * Exclusion is `flock(2)` (`LOCK_EX | LOCK_NB`) on `<workspace>/owner.lock`,
5
+ * held on an open fd for as long as this process owns the workspace. A live
6
+ * owner's exclusion is NON-REVOCABLE: no contender, and no recovery logic, can
7
+ * take it or remove it — the kernel refuses every other `flock` on the file —
8
+ * and the kernel releases it when the owner dies. Both halves replace the
9
+ * previous claim-file protocol, which published a link(2)'d claim and reclaimed
10
+ * a stale one with a verified rename-aside into a `.reclaiming-*` quarantine.
11
+ * That protocol's recovery could restore one live owner's claim over another
12
+ * (two stranded quarantines, resolved in readdir order, left the wrong holder
13
+ * at the path and admitted a second owner — PR #104). With the kernel as the
14
+ * referee there is no judgment about a previous holder's liveness, no reclaim,
15
+ * no hole, no quarantine, and nothing to recover: a dead holder is simply a
16
+ * lock nobody holds.
17
+ *
18
+ * `owner.lock` is a NOTICE BOARD, not the lock: the owner writes its claim
19
+ * (pid + process identity + session) under the lock, and a refused contender
20
+ * reads it to name the holder in its error. Two invariants keep the flock
21
+ * sound, and both are absolute:
22
+ *
23
+ * 1. The file is NEVER unlinked. `flock` binds to the inode; unlinking the
24
+ * path and letting a rival create a fresh file hands that rival a lock on a
25
+ * different inode while the old one is still held — two owners. Release
26
+ * empties the file and unlocks; the empty file itself is litter.
27
+ * 2. Only the process holding the lock ever writes or unlocks. A refused
28
+ * contender only ever reads.
29
+ *
30
+ * Re-entrancy is per process identity (pid + start ticks): `flock` treats each
31
+ * open file description as an independent contender — even two fds in ONE
32
+ * process contend — so the acquiring fd is kept in a registry keyed by lock
33
+ * path and reused. A second claim from this process with a DIFFERENT identity
34
+ * is refused like a foreign process: it opens its own fd and the kernel
35
+ * refuses it.
36
+ *
37
+ * Litter from the previous protocol (`.reclaiming-*` quarantines, a stray
38
+ * `owner.lock.reclaim` mutex, an empty or stale claim file) is inert: nothing
39
+ * reads or removes it. It cannot resurrect an owner — exclusion lives in the
40
+ * kernel, not in file contents.
41
+ *
42
+ * `flock` comes from the kernel, and the RUNTIME decides how this process
43
+ * reaches it. Under Bun it is libc's, through Bun's FFI; under Node there is
44
+ * no FFI, so the very same kernel lock is taken by util-linux's `flock(1)`,
45
+ * applied to the descriptor this process already holds. Either way it is ONE
46
+ * lock on ONE file: the kernel refuses every other `flock` on it, and it dies
47
+ * with the descriptor. The server targets Linux (see CLAUDE.md); the glibc and
48
+ * musl sonames and the macOS libc are covered, and anything else fails loud —
49
+ * a silent fallback here would be two processes both believing they own the
50
+ * workspace.
51
+ *
52
+ * The FFI access is DYNAMIC: the published bin runs on Node (`package.json` →
53
+ * `dist/main.js` behind `#!/usr/bin/env node`), where `bun:ffi` does not
54
+ * exist — a static import would crash the module on LOAD, before any probe
55
+ * could report why. The boot gate ({@link assertOwnerLockBackend}) resolves
56
+ * the backend BEFORE the server comes up: a host that cannot provide one can
57
+ * never enforce the one-run rule.
58
+ */
59
+ import { z } from 'zod';
60
+ import { SessionBusyError } from '../errors.js';
61
+ import type { WorkspacePaths } from './workspace.js';
62
+ /** The owner recorded in `<workspace>/owner.lock`. */
63
+ export declare const OwnerLockSchema: z.ZodObject<{
64
+ pid: z.ZodNumber;
65
+ identity: z.ZodObject<{
66
+ startTicks: z.ZodNullable<z.ZodNumber>;
67
+ }, z.core.$strip>;
68
+ sessionId: z.ZodString;
69
+ acquiredAt: z.ZodString;
70
+ }, z.core.$strip>;
71
+ export type OwnerLock = z.infer<typeof OwnerLockSchema>;
72
+ /** A live owner holds the lock. */
73
+ export declare class OwnerLockBusyError extends SessionBusyError {
74
+ }
75
+ /** `<workspace.root>/owner.lock` */
76
+ export declare function ownerLockPath(workspace: WorkspacePaths): string;
77
+ /**
78
+ * Taking the kernel's `flock(2)` on a descriptor.
79
+ *
80
+ * Both backends lock the SAME open file description — the one this process
81
+ * holds on `owner.lock` — so every invariant above survives either one: a
82
+ * rival is refused by the kernel, the lock is not revocable, and it dies with
83
+ * the descriptor.
84
+ */
85
+ export interface FlockBackend {
86
+ /**
87
+ * Take the exclusive, non-blocking lock on `fd`.
88
+ *
89
+ * `false` means a rival holds it — a fact the kernel reported, not a
90
+ * judgment this process made. Anything else (no `flock(1)`, a platform
91
+ * without one) throws: a lock nobody took is not a busy workspace.
92
+ */
93
+ tryLock(fd: number): Promise<boolean>;
94
+ /**
95
+ * Give the lock back and dispose of the descriptor.
96
+ *
97
+ * The kernel drops a flock when the last descriptor referring to it is
98
+ * closed, so releasing means closing — the explicit unlock is only there
99
+ * for the runtime that can make one.
100
+ */
101
+ release(fd: number): void;
102
+ }
103
+ /** libc sonames carrying `flock`, in probe order (glibc, musl, macOS). */
104
+ export declare const LIBC_CANDIDATES: readonly ['libc.so.6', 'libc.musl-x86_64.so.1', 'libc.musl-aarch64.so.1', 'libc.dylib'];
105
+ /** `flock(2)` — the C function: (fd, operation) → 0 on success. */
106
+ export type FlockFn = (fd: number, operation: number) => number;
107
+ /**
108
+ * Opens ONE libc soname and hands back its `flock` symbol.
109
+ *
110
+ * Throws when that soname cannot be opened or carries no `flock`. This is the
111
+ * seam the boot gate AND the acquire path are injected through — never a
112
+ * module mock, which would leak into the suites running alongside.
113
+ */
114
+ export type FlockOpener = (soname: string) => Promise<FlockFn>;
115
+ /**
116
+ * The default opener: the platform's libc, through Bun's FFI.
117
+ *
118
+ * Exported so a test can compose a failing opener with the REAL backend: a
119
+ * stub symbol cannot prove that a kernel lock was actually taken.
120
+ */
121
+ export declare function openFlockInLibc(soname: string): Promise<FlockFn>;
122
+ /**
123
+ * `flock(2)` through util-linux's `flock(1)` — how Node reaches the syscall.
124
+ *
125
+ * Node has no FFI, so a short-lived child inherits our descriptor and locks
126
+ * it. The child exits at once; the lock stays ours because it lives on the
127
+ * open file description we still hold, and the kernel drops it when that
128
+ * descriptor closes or this process dies — a crashed owner never wedges the
129
+ * workspace.
130
+ *
131
+ * `bin` is a seam: the tests point it at a binary that does not exist to
132
+ * prove the failure is loud instead of a quiet "nobody holds this".
133
+ */
134
+ export declare function nodeFlockBackend(bin?: string): Promise<FlockBackend>;
135
+ /**
136
+ * The BOOT GATE: resolve this host's `flock(2)` WITHOUT taking a lock.
137
+ *
138
+ * The workspace's one-run rule rests on a kernel-held lock. A host that cannot
139
+ * provide that backend can never enforce it — two servers would each believe
140
+ * they own the workspace — so the server refuses to come up instead. This
141
+ * runs BEFORE the workspace exists, before a config is read and before the MCP
142
+ * server starts.
143
+ *
144
+ * It RESOLVES the backend and nothing more: no file is opened, no `flock` is
145
+ * called, `<workspace>/owner.lock` is never created, and the acquire path's
146
+ * module cache is never written — an injected opener must not leak into the
147
+ * real one. A failed resolution is not cached either: the next attempt
148
+ * retries. A backend that failed outright (no FFI on this runtime) is
149
+ * reported as it is — never as a hunt through sonames it never opened.
150
+ *
151
+ * @param opener the libc seam to resolve through — the real one by default,
152
+ * injectable so a failed resolution is testable. An injected opener probes
153
+ * the libc candidates; without one, THIS runtime's own backend is resolved.
154
+ */
155
+ export declare function assertOwnerLockBackend(opener?: FlockOpener): Promise<void>;
156
+ /**
157
+ * Acquire the exclusive workspace claim.
158
+ *
159
+ * The publish is one non-blocking `flock(2)`: the kernel either grants this
160
+ * process the workspace or refuses it — there is no read-then-act window, so
161
+ * no rival can slip between a judgment and the act, and no admission can be
162
+ * invalidated after the fact. A refused contender reports the holder named on
163
+ * the notice board.
164
+ *
165
+ * An existing claim held by this same process (same pid + start ticks) is
166
+ * re-entrant and reports `created: false`; any fresh take — an empty workspace
167
+ * or one whose previous holder died — reports `created: true`.
168
+ *
169
+ * @param opener the backend to resolve `flock(2)` through — the real one by
170
+ * default, injectable so a failed resolution is testable. An injected
171
+ * opener resolves fresh on every call and never enters the module cache.
172
+ */
173
+ export declare function acquireOwnerLock(lockPath: string, owner: OwnerLock, opener?: FlockOpener): Promise<{
174
+ acquired: true;
175
+ created: boolean;
176
+ } | {
177
+ acquired: false;
178
+ holder: OwnerLock;
179
+ }>;
180
+ /**
181
+ * The `flock(LOCK_UN)` on the held fd — injectable so a failing unlock is
182
+ * testable (the same seam doctrine as `emptyBoard`).
183
+ */
184
+ export type UnlockFn = (fd: number) => void | Promise<void>;
185
+ /**
186
+ * Release the claim only when this process still holds it.
187
+ *
188
+ * Returns `false` when this process holds nothing here (or a different owner
189
+ * does) — another owner's lock is never touched. The notice board is emptied,
190
+ * never unlinked: a stale claim file must never be mistaken for a held lock,
191
+ * and unlinking the path would put a fresh inode where the owner's lock lives.
192
+ *
193
+ * The lock ALWAYS comes home: the release runs in a `finally`, so a failed
194
+ * board write (a read-only remount, say) fails loud but cannot leave this
195
+ * process holding the kernel lock with no registry entry to reach it by —
196
+ * that would wedge every rival until the process exits (PR #104 review).
197
+ *
198
+ * @param emptyBoard the notice-board teardown, injectable for tests (defaults
199
+ * to truncating the file to nothing) — the same seam doctrine as `makeExec`'s
200
+ * `now`: a failure injected through the parameter never leaks into other
201
+ * test files the way a module mock does.
202
+ * @param unlock the `flock(LOCK_UN)` call, injectable for tests. Its failure
203
+ * must not keep the fd open: closing it alone releases the flock, and a fd
204
+ * left open would keep the kernel lock alive with no registry entry to
205
+ * reach it by. Without an injected unlock, the backend that took the lock
206
+ * gives it back — and disposes of the descriptor with it.
207
+ */
208
+ export declare function releaseOwnerLock(lockPath: string, owner: OwnerLock, emptyBoard?: (fd: number) => void, unlock?: UnlockFn): Promise<boolean>;