dsh-builtin-browser 0.5.1 → 0.5.3

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 (44) hide show
  1. package/CHANGELOG.md +133 -0
  2. package/README.en.md +68 -67
  3. package/README.md +63 -91
  4. package/client.js +235 -11
  5. package/desktop-bridge/desktop-identity.json +9 -0
  6. package/desktop-bridge/install.mjs +220 -1
  7. package/docs/README.md +1 -1
  8. package/docs/architecture.md +1 -1
  9. package/docs/limitations.md +19 -1
  10. package/docs/tool-reference.md +2 -1
  11. package/lib/browser/runtime.d.ts +4 -2
  12. package/lib/browser/runtime.js +4 -0
  13. package/lib/browser/types.d.ts +37 -0
  14. package/lib/browser-electron/bridge-status.d.ts +5 -3
  15. package/lib/browser-electron/bridge-status.js +25 -8
  16. package/lib/browser-electron/desktop-bridge-host.d.ts +5 -3
  17. package/lib/browser-electron/desktop-bridge-host.js +47 -13
  18. package/lib/browser-electron/desktop-identity.d.ts +58 -0
  19. package/lib/browser-electron/desktop-identity.js +236 -0
  20. package/lib/browser-electron/electron-provision.d.ts +59 -0
  21. package/lib/browser-electron/electron-provision.js +164 -0
  22. package/lib/browser-electron/entry.js +61 -2
  23. package/lib/browser-electron/host-main.js +68 -14
  24. package/lib/browser-electron/provider.d.ts +51 -3
  25. package/lib/browser-electron/provider.js +77 -4
  26. package/lib/browser-electron/remote-host.d.ts +3 -3
  27. package/lib/browser-electron/remote-host.js +25 -11
  28. package/lib/browser-electron/settings-store.d.ts +19 -0
  29. package/lib/browser-electron/settings-store.js +5 -1
  30. package/lib/tool-browser/index.js +49 -0
  31. package/package.json +2 -3
  32. package/src/browser/runtime.ts +8 -0
  33. package/src/browser/types.ts +36 -0
  34. package/src/browser-electron/bridge-status.ts +28 -9
  35. package/src/browser-electron/desktop-bridge-host.ts +49 -13
  36. package/src/browser-electron/desktop-identity.ts +260 -0
  37. package/src/browser-electron/electron-provision.ts +195 -0
  38. package/src/browser-electron/entry.ts +49 -2
  39. package/src/browser-electron/host-main.ts +62 -12
  40. package/src/browser-electron/provider.ts +118 -6
  41. package/src/browser-electron/remote-host.ts +26 -12
  42. package/src/browser-electron/settings-store.ts +24 -1
  43. package/src/tool-browser/index.ts +49 -0
  44. package/src/types/electron-shim.d.ts +8 -0
@@ -22,6 +22,8 @@ import type {
22
22
  BrowserCheckRequest,
23
23
  BrowserClearRequest,
24
24
  BrowserClickRequest,
25
+ BrowserClickSequenceRequest,
26
+ BrowserClickSequenceResult,
25
27
  BrowserContentRequest,
26
28
  BrowserContentResult,
27
29
  BrowserElementTarget,
@@ -142,8 +144,10 @@ export interface ElectronBrowserViewHost {
142
144
  * @param label - human-readable session/task label, when the provider knows
143
145
  * one; the host may surface it (e.g. in the window title) so a human can
144
146
  * tell which task's page is currently visible.
147
+ * @param options - presentation policy; `quiet` asks for a surface without taking
148
+ * over the screen (see {@link PresentOptions}).
145
149
  */
146
- showView?(handle: ElectronViewHandle, label?: string): void
150
+ showView?(handle: ElectronViewHandle, label?: string, options?: PresentOptions): void
147
151
  /**
148
152
  * Optional: (re)present a view and WAIT until the host confirms it. Chromium
149
153
  * silently drops CDP-synthesized input (`Input.*`) for a view that has no
@@ -156,8 +160,9 @@ export interface ElectronBrowserViewHost {
156
160
  * assumed to present every view (headless/probe hosts).
157
161
  * @param handle - the handle to present.
158
162
  * @param label - human-readable session/task label, as in {@link showView}.
163
+ * @param options - presentation policy, as in {@link showView}.
159
164
  */
160
- presentView?(handle: ElectronViewHandle, label?: string): Promise<void>
165
+ presentView?(handle: ElectronViewHandle, label?: string, options?: PresentOptions): Promise<void>
161
166
  /**
162
167
  * Optional: pages this carrier holds that the provider never created.
163
168
  *
@@ -608,12 +613,35 @@ export function toCdpCookie(cookie: ExportedCookie): Record<string, unknown> | u
608
613
  }
609
614
  }
610
615
 
616
+ /**
617
+ * How the carrier should present a view before it is used.
618
+ *
619
+ * `quiet` is the resolved `ui.quiet` switch. It does not mean "invisible": Chromium drops
620
+ * synthesized `Input.*` for a view without a display surface, so input still needs one. It means
621
+ * the carrier must get that surface without taking the screen over — no application activation
622
+ * and no keyboard focus. Navigation and tab switching only reveal the view inside its window; the
623
+ * pre-input barrier may restore a minimized window (it needs the surface), but even then it shows
624
+ * it inactive instead of focusing or raising it. A host that cannot honour this (a headless probe,
625
+ * the desktop sidebar) simply ignores it.
626
+ */
627
+ export interface PresentOptions {
628
+ readonly quiet?: boolean
629
+ }
630
+
611
631
  /** Native capture options the self-hosted view handle understands. */
612
632
  export interface ScreenshotOptions {
613
633
  readonly format?: 'png' | 'jpeg'
614
634
  readonly quality?: number
615
635
  readonly maxWidth?: number
616
636
  readonly maxHeight?: number
637
+ /**
638
+ * Capture without presenting the window first (`ui.quiet`).
639
+ *
640
+ * The self-hosted host answers this by skipping its restore/show/focus step: a visible window
641
+ * still captures through `capturePage()`, and a minimized or hidden one falls through to the
642
+ * CDP path, which needs no display surface.
643
+ */
644
+ readonly quiet?: boolean
617
645
  }
618
646
  /** CDP method for runtime evaluation (the execute path). */
619
647
  export const CDP_RUNTIME_EVALUATE = 'Runtime.evaluate'
@@ -1196,7 +1224,7 @@ export class ElectronBrowserProvider implements BrowserProvider {
1196
1224
  const timeoutMs = 10_000
1197
1225
  try {
1198
1226
  await withTimeout(
1199
- present(handle, s.label),
1227
+ present(handle, s.label, { quiet: this.isQuiet() }),
1200
1228
  timeoutMs,
1201
1229
  signal,
1202
1230
  `browser: presenting the page view timed out after ${timeoutMs}ms`,
@@ -2040,6 +2068,75 @@ export class ElectronBrowserProvider implements BrowserProvider {
2040
2068
  this.record(s, 'click', 'target' in request ? { target: request.target } : { x, y }, true)
2041
2069
  }
2042
2070
 
2071
+ /**
2072
+ * Click many points in order, once.
2073
+ *
2074
+ * The same wire sequence as {@link click}, looped — only the round-trip count changes. Presenting
2075
+ * happens ONCE: the display-surface barrier is per view, not per press, and paying it for every
2076
+ * point is what made an 86-cell board expensive.
2077
+ *
2078
+ * Stops at the first point that fails and reports where: a run that pressed through a page which
2079
+ * had navigated or lost its surface would fill the wrong cells and still answer success.
2080
+ * @param session - the session to click in.
2081
+ * @param request - the points and the interval between them.
2082
+ * @param signal - cancellation between points.
2083
+ * @returns how many points landed, and where it stopped if it did not finish.
2084
+ */
2085
+ async clickSequence(
2086
+ session: BrowserSessionId,
2087
+ request: BrowserClickSequenceRequest,
2088
+ signal?: AbortSignal,
2089
+ ): Promise<BrowserClickSequenceResult> {
2090
+ const s = this.session(session)
2091
+ const points = Array.isArray(request.points) ? request.points : []
2092
+ if (points.length === 0) return { clicked: 0 }
2093
+ if (this.settingsSource !== undefined && this.settingsSource().vision.strategy === 'nonVisual') {
2094
+ throw new BrowserError(
2095
+ 'browser: the configured non-visual strategy refuses coordinate clicks — pass a semantic target instead.',
2096
+ 'BROWSER_NON_VISUAL_COORDINATES',
2097
+ )
2098
+ }
2099
+ // One barrier for the whole run: cheap, and it is the view that needs a surface, not each press.
2100
+ const handle = await this.present(s, signal)
2101
+ const timeoutMs = 30_000
2102
+ // 40 ms is above one frame at 30 fps, which is what keeps the page from reading two presses as a
2103
+ // double click. Faster runs were measured dropping presses outright.
2104
+ const gap = typeof request.intervalMs === 'number' && request.intervalMs >= 0 ? request.intervalMs : 40
2105
+ const send = (params: Record<string, unknown>, label: string): Promise<unknown> =>
2106
+ withTimeout(
2107
+ handle.sendCommand('Input.dispatchMouseEvent', params),
2108
+ timeoutMs,
2109
+ signal,
2110
+ `browser: click sequence ${label} timed out after ${timeoutMs}ms`,
2111
+ )
2112
+ let clicked = 0
2113
+ for (const [index, point] of points.entries()) {
2114
+ signal?.throwIfAborted()
2115
+ const x = Number(point?.x)
2116
+ const y = Number(point?.y)
2117
+ if (!Number.isFinite(x) || !Number.isFinite(y)) {
2118
+ return { clicked, failedAt: index, error: `point ${index} has no finite x/y` }
2119
+ }
2120
+ try {
2121
+ // The move is load-bearing: Chromium routes a synthesized press to the CURRENT hover target,
2122
+ // and a view that has never received a mouse event has none — the first press would go nowhere
2123
+ // while CDP still answered success.
2124
+ await send({ type: 'mouseMoved', x, y, buttons: 0 } satisfies CdpMouseParams, 'move')
2125
+ await send({ type: 'mousePressed', x, y, button: 'left', buttons: 1, clickCount: 1 } satisfies CdpMouseParams, 'press')
2126
+ await send({ type: 'mouseReleased', x, y, button: 'left', buttons: 0, clickCount: 1 } satisfies CdpMouseParams, 'release')
2127
+ clicked += 1
2128
+ } catch (error) {
2129
+ // Best-effort release so a failed press cannot leave the button stuck down.
2130
+ void handle
2131
+ .sendCommand('Input.dispatchMouseEvent', { type: 'mouseReleased', x, y, button: 'left', buttons: 0, clickCount: 1 })
2132
+ .catch(() => {})
2133
+ return { clicked, failedAt: index, error: String(error instanceof Error ? error.message : error) }
2134
+ }
2135
+ if (index < points.length - 1 && gap > 0) await new Promise(resolve => setTimeout(resolve, gap))
2136
+ }
2137
+ return { clicked }
2138
+ }
2139
+
2043
2140
  /**
2044
2141
  * Type into the focused element, or focus a located element (css/text/xpath)
2045
2142
  * first and then insert the text.
@@ -3192,14 +3289,18 @@ export class ElectronBrowserProvider implements BrowserProvider {
3192
3289
  // can produce JPEG (CDP JPEG hangs on Electron 43).
3193
3290
  const capturable = handle
3194
3291
  if (request?.fullPage !== true && typeof capturable.capture === 'function') {
3195
- // Ensure the target view is the visible one before capturing.
3196
- this.showActive(s)
3292
+ // Ensure the target view is the visible one before capturing — unless quiet mode is on.
3293
+ // There, presenting the view is exactly what the user asked to avoid (it restores and
3294
+ // raises the window); the host switches the visible tab inside the window and, if the
3295
+ // window has no surface to capture, falls through to CDP.
3296
+ if (!this.isQuiet()) this.showActive(s)
3197
3297
  const timeoutMs = 30_000
3198
3298
  const shot = await withTimeout(
3199
3299
  capturable.capture({
3200
3300
  ...format === 'jpeg' ? { format, quality: request?.quality } : {},
3201
3301
  ...request?.maxWidth !== undefined ? { maxWidth: request.maxWidth } : {},
3202
3302
  ...request?.maxHeight !== undefined ? { maxHeight: request.maxHeight } : {},
3303
+ quiet: this.isQuiet(),
3203
3304
  }),
3204
3305
  timeoutMs,
3205
3306
  signal,
@@ -3673,6 +3774,17 @@ export class ElectronBrowserProvider implements BrowserProvider {
3673
3774
  if (!reported) process.stderr.write(`[dsh-browser] user action failed: ${message}\n`)
3674
3775
  }
3675
3776
 
3777
+ /**
3778
+ * Whether the operator asked for quiet mode (`ui.quiet`).
3779
+ *
3780
+ * Read live on every call rather than captured at construction: the panel writes the document
3781
+ * and the next operation is expected to honour it, without a restart.
3782
+ * @returns true when the carrier must present views without taking the screen over.
3783
+ */
3784
+ private isQuiet(): boolean {
3785
+ return this.settingsSource?.().ui.quiet === true
3786
+ }
3787
+
3676
3788
  /**
3677
3789
  * Ask the host to show the active tab's view, carrying the session label.
3678
3790
  *
@@ -3685,7 +3797,7 @@ export class ElectronBrowserProvider implements BrowserProvider {
3685
3797
  * silently desynchronising the two and failing every screenshot.
3686
3798
  */
3687
3799
  private showActive(s: Session): void {
3688
- this.host.showView?.(this.activeTab(s).handle, s.label)
3800
+ this.host.showView?.(this.activeTab(s).handle, s.label, { quiet: this.isQuiet() })
3689
3801
  const autoExpand = this.settingsSource === undefined || this.settingsSource().ui.autoExpandOnce
3690
3802
  if (autoExpand) return
3691
3803
  // Best effort: a carrier that owns no presentation (self-hosted) simply has none.
@@ -35,7 +35,7 @@ import { existsSync, readFileSync, readdirSync, readlinkSync } from 'node:fs'
35
35
  import { basename, dirname, isAbsolute, join } from 'node:path'
36
36
  import { createServer, type Server, type Socket } from 'node:net'
37
37
  import { fileURLToPath } from 'node:url'
38
- import type { BrowserUserAction, ElectronBrowserViewHost, ElectronViewHandle, ScreenshotOptions } from './provider.js'
38
+ import type { BrowserUserAction, ElectronBrowserViewHost, ElectronViewHandle, PresentOptions, ScreenshotOptions } from './provider.js'
39
39
  import type { ExportedCookie } from '../browser/types.js'
40
40
 
41
41
  /** How long to wait for the child to signal readiness before failing. */
@@ -139,13 +139,13 @@ function resolveElectronPathImpl(inputs: ElectronPathInputs): string {
139
139
  if (hostExe !== undefined) return hostExe
140
140
  throw new Error(
141
141
  'dsh-builtin-browser: cannot locate a spawnable Electron binary. ' +
142
- 'The electron package ships with the plugin (0.1.18+); Electron 44+ downloads its binary on first use, ' +
143
- 'so if the package is installed but the binary is missing, run `npx install-electron` once (needs network) ' +
144
- 'in the profile that installed the plugin, then retry. Alternatively set ELECTRON_PATH to an electron ' +
145
- 'executable. On installs from before electron became a dependency, add it to the active profile ' +
146
- '(`dsh plugin --profile <your-profile> add electron`; on DSH Desktop the profile is `desktop`). ' +
147
- 'Note: the host\'s own executable cannot be reused when it is a packaged Electron app (e.g. DSH Desktop.exe) ' +
148
- '— only a real electron binary can be spawned.',
142
+ 'The electron package ships with the plugin and its binary is downloaded on first use, not at install time ' +
143
+ '(issue #41: an install-time download made default profiles refuse the plugin). The plugin prepares it ' +
144
+ 'automatically when the bundled carrier is selected; to do it by hand, run ' +
145
+ '`npx --no dsh-browser-install-electron` in the profile that installed the plugin, then retry. ' +
146
+ 'Alternatively set ELECTRON_PATH to an electron executable. Note: the host\'s own executable cannot be ' +
147
+ 'reused when it is a packaged Electron app (e.g. DSH Desktop.exe) — only a real electron binary can be ' +
148
+ 'spawned.',
149
149
  )
150
150
  }
151
151
 
@@ -1196,13 +1196,19 @@ export class RemoteElectronViewHost implements ElectronBrowserViewHost {
1196
1196
  return view
1197
1197
  }
1198
1198
 
1199
- showView(handle: ElectronViewHandle, label?: string): void {
1199
+ showView(handle: ElectronViewHandle, label?: string, options?: PresentOptions): void {
1200
1200
  // Fire-and-forget by design (visibility is best-effort), but a rejected
1201
1201
  // promise must not become an unhandled rejection (crash on Node >= 15).
1202
1202
  // The label (session/task id) rides along so the child can show it in the
1203
1203
  // window title — a human can then tell which task's page is visible.
1204
+ // `quiet` is only sent when it is on: the child's default is the documented
1205
+ // "present and raise" behaviour, so an old child keeps working either way.
1204
1206
  void this.ready()
1205
- .then(() => this.client?.call('showView', { viewId: handle.id, ...label !== undefined ? { label } : {} }))
1207
+ .then(() => this.client?.call('showView', {
1208
+ viewId: handle.id,
1209
+ ...label !== undefined ? { label } : {},
1210
+ ...options?.quiet === true ? { quiet: true } : {},
1211
+ }))
1206
1212
  .catch(() => { /* host unavailable */ })
1207
1213
  }
1208
1214
 
@@ -1221,7 +1227,7 @@ export class RemoteElectronViewHost implements ElectronBrowserViewHost {
1221
1227
  * in order: its reply is queued behind the showView and so only arrives once
1222
1228
  * the visibility change has been applied.
1223
1229
  */
1224
- async presentView(handle: ElectronViewHandle, label?: string): Promise<void> {
1230
+ async presentView(handle: ElectronViewHandle, label?: string, options?: PresentOptions): Promise<void> {
1225
1231
  await this.ready()
1226
1232
  const client = this.client
1227
1233
  if (client === undefined) throw new HostGoneError('browser host unavailable')
@@ -1232,7 +1238,15 @@ export class RemoteElectronViewHost implements ElectronBrowserViewHost {
1232
1238
  await withTimeout(handle.ensureMaterialized(), PRESENT_TIMEOUT_MS, 'browser host did not materialize the view')
1233
1239
  }
1234
1240
  await withTimeout(
1235
- client.call('showView', { viewId: handle.id, ...label !== undefined ? { label } : {} }),
1241
+ client.call('showView', {
1242
+ viewId: handle.id,
1243
+ ...label !== undefined ? { label } : {},
1244
+ // `needSurface` tells the child this is the pre-input barrier: under quiet mode this
1245
+ // is the only presentation allowed to un-minimize a window, because Chromium drops
1246
+ // `Input.*` without a display surface. One line below in the child, and only read
1247
+ // there when `quiet` is set.
1248
+ ...options?.quiet === true ? { quiet: true, needSurface: true } : {},
1249
+ }),
1236
1250
  PRESENT_TIMEOUT_MS,
1237
1251
  'browser host did not confirm the view presentation',
1238
1252
  )
@@ -48,6 +48,25 @@ export interface BrowserSettings {
48
48
  readonly closeWithSession: boolean
49
49
  /** Show the synthetic cursor/click feedback while the agent operates. */
50
50
  readonly virtualCursor: boolean
51
+ /**
52
+ * Quiet mode: drive the page without taking over the screen.
53
+ *
54
+ * Off (the default) keeps the contract this plugin is built on — human and agent share one
55
+ * window, so an operation raises it and the user can see what is being driven. On, the
56
+ * carrier never activates the application and never steals keyboard focus:
57
+ * - screenshots of a minimized or hidden window go through CDP `Page.captureScreenshot`
58
+ * instead of `capturePage()`, so grabbing an image stops being a reason to show a window;
59
+ * - navigation and tab switching only change which view is visible INSIDE the window; a
60
+ * minimized window stays minimized;
61
+ * - synthesized input still needs a display surface (Chromium drops `Input.*` for a view
62
+ * without one), so that one barrier may restore a minimized window — with
63
+ * `showInactive()`, which shows it without becoming the key window, and without
64
+ * `moveTop()`.
65
+ *
66
+ * Reported as issue #35: a minimized browser window was restored and focused by the next
67
+ * screenshot or click, pulling the user out of whatever they were typing in.
68
+ */
69
+ readonly quiet: boolean
51
70
  }
52
71
  /** Visual vs non-visual operation strategy. */
53
72
  readonly vision: {
@@ -111,7 +130,7 @@ export interface BrowserSettings {
111
130
  export const DEFAULT_SETTINGS: BrowserSettings = {
112
131
  history: { enabled: true, maxEntries: 5_000, maxAgeDays: 90 },
113
132
  cookies: { persist: true },
114
- ui: { autoExpandOnce: true, closeWithSession: false, virtualCursor: true },
133
+ ui: { autoExpandOnce: true, closeWithSession: false, virtualCursor: true, quiet: false },
115
134
  vision: { strategy: 'auto' },
116
135
  // Bundled by default: it needs nothing installed, and on the desktop the carrier
117
136
  // is the sidebar anyway. Choosing a system browser is an explicit opt-in because
@@ -296,6 +315,10 @@ export function resolveSettings(raw: unknown, warn?: (message: string) => void):
296
315
  autoExpandOnce: bool(ui?.autoExpandOnce, DEFAULT_SETTINGS.ui.autoExpandOnce),
297
316
  closeWithSession: bool(ui?.closeWithSession, DEFAULT_SETTINGS.ui.closeWithSession),
298
317
  virtualCursor: bool(ui?.virtualCursor, DEFAULT_SETTINGS.ui.virtualCursor),
318
+ // Presentation preference, not a capability gate: a mistyped value keeps the documented
319
+ // default (off) instead of being read as "on", because quiet mode changes how every
320
+ // operation presents itself and should never be the accidental result of a bad edit.
321
+ quiet: bool(ui?.quiet, DEFAULT_SETTINGS.ui.quiet),
299
322
  },
300
323
  vision: { strategy: vision?.strategy === 'nonVisual' ? 'nonVisual' : DEFAULT_SETTINGS.vision.strategy },
301
324
  browser: {
@@ -863,6 +863,55 @@ export function apply(ctx: Context, config: Config = {}): void {
863
863
  },
864
864
  }))
865
865
 
866
+ registerSafely(defineTool({
867
+ name: 'dsh_browser_click_sequence',
868
+ description: 'Click many points in order, in one call. Use this instead of repeated dsh_browser_click when a page needs a run of coordinate clicks — a canvas board, a map, a drawing surface. Each point is clicked with the same real input sequence the single click uses; between points the call waits intervalMs (default 40 ms), which is what stops a page from reading two presses as a double click. Stops at the first point that fails and says where, so a run that half-landed is reported rather than looking complete.',
869
+ parameters: {
870
+ points: {
871
+ type: 'array',
872
+ required: true,
873
+ description: 'Points to click, in order, in viewport CSS pixels — the same space dsh_browser_screenshot reports.',
874
+ items: {
875
+ type: 'object',
876
+ additionalProperties: false,
877
+ properties: {
878
+ x: { type: 'number', required: true, description: 'Viewport x in CSS px.' },
879
+ y: { type: 'number', required: true, description: 'Viewport y in CSS px.' },
880
+ },
881
+ },
882
+ },
883
+ intervalMs: { type: 'number', description: 'Milliseconds between points (default 40).' },
884
+ },
885
+ output: {
886
+ schema: {
887
+ type: 'object',
888
+ additionalProperties: false,
889
+ properties: {
890
+ clicked: { type: 'number', required: true, description: 'How many points landed.' },
891
+ failedAt: { type: 'number', description: 'Index of the point that failed, when one did.' },
892
+ error: { type: 'string', description: 'Why that point failed.' },
893
+ },
894
+ },
895
+ render: (_args, value) => [{
896
+ type: 'text',
897
+ text: value.failedAt === undefined
898
+ ? `Clicked ${String(value.clicked)} point(s).`
899
+ : `Clicked ${String(value.clicked)} point(s), then stopped at index ${String(value.failedAt)}: ${String(value.error ?? 'unknown')}`,
900
+ }],
901
+ },
902
+ timeoutMs,
903
+ isConcurrencySafe: () => false,
904
+ async execute(args, exec) {
905
+ assertAllowed(state, 'dsh_browser_click_sequence', taskKey(exec))
906
+ const browser = ctx.get('browser')
907
+ if (browser === undefined) throw new Error('tool-browser: browser service unavailable')
908
+ const session = await ensureSession(browser, state, taskKey(exec), agentOf(exec))
909
+ const points = Array.isArray(args.points) ? args.points : []
910
+ const intervalMs = typeof args.intervalMs === 'number' ? args.intervalMs : undefined
911
+ return browser.clickSequence(session, { points, ...intervalMs === undefined ? {} : { intervalMs } })
912
+ },
913
+ }))
914
+
866
915
  registerSafely(defineTool({
867
916
  name: 'dsh_browser_type',
868
917
  description: 'Type text into the focused element of the shared browser, or into a located element (pass target {by: css|text|xpath, value, index?} to focus it first). Text is inserted at the focus via CDP Input.insertText. For setting whole field values (and React-controlled inputs) prefer dsh_browser_set_value; use dsh_browser_key for Enter/Tab/arrows.',
@@ -87,6 +87,14 @@ declare module 'electron' {
87
87
  isMinimized(): boolean
88
88
  isFocused(): boolean
89
89
  show(): void
90
+ /**
91
+ * Show the window without activating the application or taking keyboard focus.
92
+ *
93
+ * Not in the type definitions of older Electron releases, but present since Electron 2 —
94
+ * quiet mode (`ui.quiet`) depends on it to give a view a display surface without stealing
95
+ * the foreground.
96
+ */
97
+ showInactive(): void
90
98
  restore(): void
91
99
  focus(): void
92
100
  moveTop(): void