dsh-builtin-browser 1.0.1 → 1.0.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 (360) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/README.md +1 -1
  3. package/assets/browser-panel-locales.mjs +37 -5
  4. package/assets/browser-policy.d.mts +29 -0
  5. package/assets/browser-policy.mjs +40 -0
  6. package/desktop-bridge/desktop-discovery.d.mts +1 -1
  7. package/desktop-bridge/desktop-discovery.mjs +59 -9
  8. package/desktop-bridge/desktop-identity.json +12 -0
  9. package/desktop-bridge/install.mjs +14 -7
  10. package/desktop-bridge/plugin-browser-bridge.js +19 -7
  11. package/docs/acceptance-2026-11-27.md +67 -0
  12. package/docs/architecture.md +1 -1
  13. package/docs/development.md +33 -4
  14. package/docs/dsh-0.2.3-host-patch-task.md +34 -0
  15. package/docs/hardcoding-audit.md +28 -8
  16. package/docs/known-issues.md +26 -0
  17. package/docs/limitations.md +6 -2
  18. package/docs/tool-reference.md +1 -1
  19. package/docs/v1.1.0-bu-data-batching-task.md +66 -0
  20. package/docs/v1.1.0-compat-hardcoding-task.md +85 -0
  21. package/dsh-builtin-browser-1.0.3-publish.tgz +0 -0
  22. package/dsh-builtin-browser-1.0.3.tgz +0 -0
  23. package/dsh-host-patch/README.md +4 -0
  24. package/dsh-host-patch/apply.mjs +61 -13
  25. package/dsh-host-patch/rc3-revision9.json.gz +0 -0
  26. package/dsh-host-patch/rc5-revision9.json.gz +0 -0
  27. package/dsh-host-patch/sources/main/0001-feat-sidebar-right-add-session-rendering-holds.patch.gz +0 -0
  28. package/dsh-host-patch/sources/main/0002-feat-desktop-load-trusted-profile-main-extensions.patch.gz +0 -0
  29. package/dsh-host-patch/sources/main/0003-feat-desktop-report-resolved-and-running-main-extens.patch.gz +0 -0
  30. package/dsh-host-patch/sources/main/0004-feat-desktop-compose-admitted-native-sidebar-views.patch.gz +0 -0
  31. package/dsh-host-patch/sources/main/0005-fix-client-admit-coded-browser-errors-in-native-comp.patch.gz +0 -0
  32. package/dsh-host-patch/sources/main/0006-fix-desktop-acknowledge-native-same-document-navigat.patch.gz +0 -0
  33. package/dsh-host-patch/sources/main/0007-fix-desktop-restore-auth-in-the-native-lease-partiti.patch.gz +0 -0
  34. package/dsh-host-patch/sources/main/0008-feat-desktop-adopt-native-children-in-admitted-sideb.patch.gz +0 -0
  35. package/dsh-host-patch/sources/main/0009-fix-desktop-publish-complete-native-child-close-reco.patch.gz +0 -0
  36. package/dsh-host-patch/sources/main/0010-fix-desktop-bundle-structured-errors-in-sandboxed-pr.patch.gz +0 -0
  37. package/dsh-host-patch/sources/main/0011-feat-desktop-offer-persistent-Sidebar-sessions-per-D.patch.gz +0 -0
  38. package/dsh-host-patch/sources/main/0012-feat-desktop-retain-sidebar-session-cookies-across-r.patch.gz +0 -0
  39. package/dsh-host-patch/sources/main/0013-fix-desktop-honor-sidebar-session-cookie-sidecar-con.patch.gz +0 -0
  40. package/dsh-host-patch/sources/main/0014-fix-desktop-retry-cookie-protection-without-failing-.patch.gz +0 -0
  41. package/dsh-host-patch/sources/main/0015-fix-desktop-preserve-host-only-cookie-identity-in-se.patch.gz +0 -0
  42. package/dsh-host-patch/sources/main/0016-fix-desktop-restore-session-cookies-before-checkpoin.patch.gz +0 -0
  43. package/dsh-host-patch/sources/main/0017-fix-desktop-restore-sidebar-cookies-once-before-gues.patch.gz +0 -0
  44. package/dsh-host-patch/sources/main/0018-fix-sidebar-right-follow-animated-native-slot-placem.patch.gz +0 -0
  45. package/dsh-host-patch/sources/manifest.json +218 -0
  46. package/dsh-host-patch/sources/rc3/0001-feat-sidebar-right-add-session-rendering-holds.patch.gz +0 -0
  47. package/dsh-host-patch/sources/rc3/0002-feat-desktop-load-trusted-profile-main-extensions.patch.gz +0 -0
  48. package/dsh-host-patch/sources/rc3/0003-feat-desktop-report-resolved-and-running-main-extens.patch.gz +0 -0
  49. package/dsh-host-patch/sources/rc3/0004-feat-desktop-compose-admitted-native-sidebar-views.patch.gz +0 -0
  50. package/dsh-host-patch/sources/rc3/0005-fix-client-admit-coded-browser-errors-in-native-comp.patch.gz +0 -0
  51. package/dsh-host-patch/sources/rc3/0006-fix-desktop-acknowledge-native-same-document-navigat.patch.gz +0 -0
  52. package/dsh-host-patch/sources/rc3/0007-fix-desktop-restore-auth-in-the-native-lease-partiti.patch.gz +0 -0
  53. package/dsh-host-patch/sources/rc3/0008-feat-desktop-adopt-native-children-in-admitted-sideb.patch.gz +0 -0
  54. package/dsh-host-patch/sources/rc3/0009-fix-desktop-publish-complete-native-child-close-reco.patch.gz +0 -0
  55. package/dsh-host-patch/sources/rc3/0010-fix-desktop-bundle-structured-errors-in-sandboxed-pr.patch.gz +0 -0
  56. package/dsh-host-patch/sources/rc3/0011-feat-desktop-offer-persistent-Sidebar-sessions-per-D.patch.gz +0 -0
  57. package/dsh-host-patch/sources/rc3/0012-feat-desktop-retain-sidebar-session-cookies-across-r.patch.gz +0 -0
  58. package/dsh-host-patch/sources/rc3/0013-fix-desktop-honor-sidebar-session-cookie-sidecar-con.patch.gz +0 -0
  59. package/dsh-host-patch/sources/rc3/0014-fix-desktop-retry-cookie-protection-without-failing-.patch.gz +0 -0
  60. package/dsh-host-patch/sources/rc3/0015-fix-desktop-preserve-host-only-cookie-identity-in-se.patch.gz +0 -0
  61. package/dsh-host-patch/sources/rc3/0016-fix-desktop-restore-session-cookies-before-checkpoin.patch.gz +0 -0
  62. package/dsh-host-patch/sources/rc3/0017-fix-desktop-restore-sidebar-cookies-once-before-gues.patch.gz +0 -0
  63. package/dsh-host-patch/sources/rc3/0018-fix-sidebar-right-follow-animated-native-slot-placem.patch.gz +0 -0
  64. package/dsh-host-patch/sources/rc5/0001-feat-sidebar-right-add-session-rendering-holds.patch.gz +0 -0
  65. package/dsh-host-patch/sources/rc5/0002-feat-desktop-load-trusted-profile-main-extensions.patch.gz +0 -0
  66. package/dsh-host-patch/sources/rc5/0003-feat-desktop-report-resolved-and-running-main-extens.patch.gz +0 -0
  67. package/dsh-host-patch/sources/rc5/0004-feat-desktop-compose-admitted-native-sidebar-views.patch.gz +0 -0
  68. package/dsh-host-patch/sources/rc5/0005-fix-client-admit-coded-browser-errors-in-native-comp.patch.gz +0 -0
  69. package/dsh-host-patch/sources/rc5/0006-fix-desktop-acknowledge-native-same-document-navigat.patch.gz +0 -0
  70. package/dsh-host-patch/sources/rc5/0007-fix-desktop-restore-auth-in-the-native-lease-partiti.patch.gz +0 -0
  71. package/dsh-host-patch/sources/rc5/0008-feat-desktop-adopt-native-children-in-admitted-sideb.patch.gz +0 -0
  72. package/dsh-host-patch/sources/rc5/0009-fix-desktop-publish-complete-native-child-close-reco.patch.gz +0 -0
  73. package/dsh-host-patch/sources/rc5/0010-fix-desktop-bundle-structured-errors-in-sandboxed-pr.patch.gz +0 -0
  74. package/dsh-host-patch/sources/rc5/0011-feat-desktop-offer-persistent-Sidebar-sessions-per-D.patch.gz +0 -0
  75. package/dsh-host-patch/sources/rc5/0012-feat-desktop-retain-sidebar-session-cookies-across-r.patch.gz +0 -0
  76. package/dsh-host-patch/sources/rc5/0013-fix-desktop-honor-sidebar-session-cookie-sidecar-con.patch.gz +0 -0
  77. package/dsh-host-patch/sources/rc5/0014-fix-desktop-retry-cookie-protection-without-failing-.patch.gz +0 -0
  78. package/dsh-host-patch/sources/rc5/0015-fix-desktop-preserve-host-only-cookie-identity-in-se.patch.gz +0 -0
  79. package/dsh-host-patch/sources/rc5/0016-fix-desktop-restore-session-cookies-before-checkpoin.patch.gz +0 -0
  80. package/dsh-host-patch/sources/rc5/0017-fix-desktop-restore-sidebar-cookies-once-before-gues.patch.gz +0 -0
  81. package/dsh-host-patch/sources/rc5/0018-fix-sidebar-right-follow-animated-native-slot-placem.patch.gz +0 -0
  82. package/dsh-host-patch/sources/series.json +260 -0
  83. package/dsh-host-patch/tauri/desktop-main.cjs +62 -0
  84. package/dsh-host-patch/tauri/sidebar-session.cjs +104 -0
  85. package/dsh-host-patch/tauri-revision1.json +39 -0
  86. package/dsh-host-patch/tauri.json +43 -0
  87. package/dsh-host-patch/v023-alpha2.json +153 -0
  88. package/lib/browser/anti-bot.js +215 -0
  89. package/lib/browser/deep-dom.js +39 -0
  90. package/lib/browser/runtime.js +15 -0
  91. package/lib/browser/takeover-target.js +13 -6
  92. package/lib/browser/types.js +30 -1
  93. package/lib/browser-electron/authenticated-route.js +16 -2
  94. package/lib/browser-electron/automatic-maintenance.js +16 -10
  95. package/lib/browser-electron/bridge-connection.js +3 -8
  96. package/lib/browser-electron/bridge-install.js +2 -1
  97. package/lib/browser-electron/bridge-status.js +55 -26
  98. package/lib/browser-electron/desktop-bridge-host.js +7 -6
  99. package/lib/browser-electron/desktop-identity.js +28 -5
  100. package/lib/browser-electron/desktop-shell.js +64 -0
  101. package/lib/browser-electron/electron-provision.js +105 -18
  102. package/lib/browser-electron/entry.js +129 -44
  103. package/lib/browser-electron/extension-browser.js +4 -4
  104. package/lib/browser-electron/foreground-watch.js +134 -0
  105. package/lib/browser-electron/guest-cookie-jar.js +13 -13
  106. package/lib/browser-electron/guest-route.js +181 -32
  107. package/lib/browser-electron/guest-runtime.js +61 -10
  108. package/lib/browser-electron/guest-storage.js +2 -2
  109. package/lib/browser-electron/history-store.js +1 -5
  110. package/lib/browser-electron/host-main.js +8 -4
  111. package/lib/browser-electron/host-patch-maintenance.js +14 -8
  112. package/lib/browser-electron/maintenance-route.js +2 -1
  113. package/lib/browser-electron/missing-system-browser.js +5 -9
  114. package/lib/browser-electron/preferred-browser.js +7 -3
  115. package/lib/browser-electron/preview-route.js +9 -13
  116. package/lib/browser-electron/process-ownership.js +1 -1
  117. package/lib/browser-electron/profile-command.js +2 -1
  118. package/lib/browser-electron/profile-extension.js +5 -0
  119. package/lib/browser-electron/profile-lease.js +152 -47
  120. package/lib/browser-electron/provider-core.js +527 -0
  121. package/lib/browser-electron/provider-interaction.js +963 -0
  122. package/lib/browser-electron/provider-media.js +518 -0
  123. package/lib/browser-electron/provider-navigation.js +301 -0
  124. package/lib/browser-electron/provider-observation.js +623 -0
  125. package/lib/browser-electron/provider-tabs.js +372 -0
  126. package/lib/browser-electron/provider.js +150 -3301
  127. package/lib/browser-electron/reference-route.js +9 -18
  128. package/lib/browser-electron/remote-host.js +79 -34
  129. package/lib/browser-electron/runtime-status.js +56 -6
  130. package/lib/browser-electron/settings-store.js +3 -6
  131. package/lib/browser-electron/sidebar-only-host.js +1 -1
  132. package/lib/browser-electron/system-browser.js +539 -172
  133. package/lib/browser-electron/tauri-host.js +208 -0
  134. package/lib/browser-electron/virtual-cursor.js +23 -13
  135. package/lib/browser-reference/service.js +22 -4
  136. package/lib/browser-reference/web-sources.js +1 -1
  137. package/lib/client.js +43409 -0
  138. package/lib/compat/host-features.js +75 -0
  139. package/lib/reference-source.js +1 -1
  140. package/lib/reference-text.js +23 -1
  141. package/lib/takeover-protocol.js +1 -1
  142. package/lib/tool-browser/block-recovery.js +69 -0
  143. package/lib/tool-browser/code-tool.js +170 -19
  144. package/lib/tool-browser/code-worker.js +115 -20
  145. package/lib/tool-browser/errors.js +34 -0
  146. package/lib/tool-browser/index.js +66 -3593
  147. package/lib/tool-browser/page-probe.js +227 -28
  148. package/lib/tool-browser/panel-page.js +2 -1
  149. package/lib/tool-browser/probe-client.js +157 -0
  150. package/lib/tool-browser/screenshot-annotations.js +108 -0
  151. package/lib/tool-browser/state.js +337 -0
  152. package/lib/tool-browser/takeover.js +1 -1
  153. package/lib/tool-browser/tools-debug.js +862 -0
  154. package/lib/tool-browser/tools-interaction.js +993 -0
  155. package/lib/tool-browser/tools-navigation.js +807 -0
  156. package/lib/tool-browser/tools-observation.js +461 -0
  157. package/lib/tool-browser/tools-reference.js +293 -0
  158. package/lib/web-guest.js +1 -0
  159. package/package.json +15 -53
  160. package/README.en.md +0 -89
  161. package/browser-extension/constants.mjs +0 -20
  162. package/browser-extension/controller.mjs +0 -293
  163. package/browser-extension/locales.mjs +0 -15
  164. package/browser-extension/manifest.json +0 -12
  165. package/browser-extension/options.html +0 -14
  166. package/browser-extension/options.mjs +0 -9
  167. package/browser-extension/permission-guard.mjs +0 -13
  168. package/browser-extension/worker.mjs +0 -74
  169. package/dist/client.cjs +0 -43167
  170. package/lib/browser-reference/submission-receipts.js +0 -139
  171. package/scripts/build.mjs +0 -66
  172. package/scripts/bundle-host.mjs +0 -28
  173. package/scripts/fix-exports.mjs +0 -50
  174. package/scripts/install-electron.mjs +0 -51
  175. package/scripts/verify-exports.mjs +0 -47
  176. package/scripts/verify-preview-sdk.mjs +0 -93
  177. package/skills/dsh-builtin-browser/SKILL.md +0 -73
  178. package/skills/dsh-builtin-browser/references/batch.md +0 -53
  179. package/skills/dsh-builtin-browser/references/deliver.md +0 -31
  180. package/skills/dsh-builtin-browser/references/locate.md +0 -11
  181. package/skills/dsh-builtin-browser/references/recover.md +0 -11
  182. package/skills/dsh-builtin-browser/references/verify.md +0 -13
  183. package/skills/dsh-debug-host/SKILL.md +0 -56
  184. package/skills/dsh-debug-self/SKILL.md +0 -50
  185. package/src/bridge-compatibility.ts +0 -39
  186. package/src/browser/handles.ts +0 -89
  187. package/src/browser/runtime.ts +0 -560
  188. package/src/browser/takeover-target.ts +0 -36
  189. package/src/browser/types.ts +0 -817
  190. package/src/browser-electron/authenticated-route.ts +0 -84
  191. package/src/browser-electron/automatic-maintenance.ts +0 -726
  192. package/src/browser-electron/bridge-auto.ts +0 -159
  193. package/src/browser-electron/bridge-connection.ts +0 -385
  194. package/src/browser-electron/bridge-endpoint.ts +0 -129
  195. package/src/browser-electron/bridge-install.ts +0 -289
  196. package/src/browser-electron/bridge-maintenance.ts +0 -189
  197. package/src/browser-electron/bridge-status.ts +0 -347
  198. package/src/browser-electron/desktop-bridge-host.ts +0 -251
  199. package/src/browser-electron/desktop-identity.ts +0 -320
  200. package/src/browser-electron/document-readiness.ts +0 -45
  201. package/src/browser-electron/electron-provision.ts +0 -261
  202. package/src/browser-electron/entry.ts +0 -1299
  203. package/src/browser-electron/ephemeral-profile.ts +0 -189
  204. package/src/browser-electron/extension-browser.ts +0 -223
  205. package/src/browser-electron/extension-setup.ts +0 -67
  206. package/src/browser-electron/file-write.ts +0 -31
  207. package/src/browser-electron/guest-cookie-jar.ts +0 -176
  208. package/src/browser-electron/guest-cookie-store.ts +0 -59
  209. package/src/browser-electron/guest-css-runtime.ts +0 -76
  210. package/src/browser-electron/guest-css.ts +0 -68
  211. package/src/browser-electron/guest-route.ts +0 -568
  212. package/src/browser-electron/guest-runtime.ts +0 -357
  213. package/src/browser-electron/guest-storage-runtime.ts +0 -54
  214. package/src/browser-electron/guest-storage.ts +0 -117
  215. package/src/browser-electron/history-store.ts +0 -227
  216. package/src/browser-electron/host-main.ts +0 -1381
  217. package/src/browser-electron/host-patch-maintenance.ts +0 -112
  218. package/src/browser-electron/http-body.ts +0 -65
  219. package/src/browser-electron/json-reply.ts +0 -47
  220. package/src/browser-electron/maintenance-broker.ts +0 -166
  221. package/src/browser-electron/maintenance-lifecycle.ts +0 -91
  222. package/src/browser-electron/maintenance-route.ts +0 -67
  223. package/src/browser-electron/missing-system-browser.ts +0 -113
  224. package/src/browser-electron/open-slot.ts +0 -49
  225. package/src/browser-electron/paths.ts +0 -25
  226. package/src/browser-electron/preferred-browser.ts +0 -120
  227. package/src/browser-electron/preview-route.ts +0 -218
  228. package/src/browser-electron/process-ownership.ts +0 -168
  229. package/src/browser-electron/process.ts +0 -23
  230. package/src/browser-electron/profile-checkpoint.ts +0 -187
  231. package/src/browser-electron/profile-command.ts +0 -46
  232. package/src/browser-electron/profile-extension.ts +0 -124
  233. package/src/browser-electron/profile-lease.ts +0 -115
  234. package/src/browser-electron/profile-residue.ts +0 -49
  235. package/src/browser-electron/provider.ts +0 -4571
  236. package/src/browser-electron/reference-route.ts +0 -608
  237. package/src/browser-electron/remote-host.ts +0 -1462
  238. package/src/browser-electron/rpc-input.ts +0 -13
  239. package/src/browser-electron/rpc-ops.ts +0 -41
  240. package/src/browser-electron/runtime-diagnostics.ts +0 -38
  241. package/src/browser-electron/runtime-route.ts +0 -105
  242. package/src/browser-electron/runtime-status.ts +0 -242
  243. package/src/browser-electron/settings-route.ts +0 -64
  244. package/src/browser-electron/settings-store.ts +0 -589
  245. package/src/browser-electron/shortcuts-route.ts +0 -112
  246. package/src/browser-electron/sidebar-only-host.ts +0 -298
  247. package/src/browser-electron/startpage-shortcuts.ts +0 -213
  248. package/src/browser-electron/system-browser.ts +0 -1497
  249. package/src/browser-electron/timing.ts +0 -16
  250. package/src/browser-electron/virtual-cursor.ts +0 -152
  251. package/src/browser-electron/windows-system.ts +0 -24
  252. package/src/browser-reference/delivery.ts +0 -384
  253. package/src/browser-reference/entry.ts +0 -631
  254. package/src/browser-reference/export.ts +0 -339
  255. package/src/browser-reference/import.ts +0 -303
  256. package/src/browser-reference/page-script.ts +0 -1537
  257. package/src/browser-reference/service.ts +0 -1315
  258. package/src/browser-reference/store.ts +0 -172
  259. package/src/browser-reference/submission-receipts.ts +0 -122
  260. package/src/browser-reference/text-quote.ts +0 -219
  261. package/src/browser-reference/types.ts +0 -195
  262. package/src/browser-reference/visible.ts +0 -367
  263. package/src/browser-reference/web-sources.ts +0 -103
  264. package/src/client/browser/BrowserController.ts +0 -693
  265. package/src/client/browser/BrowserFrame.ts +0 -78
  266. package/src/client/browser/BrowserNavigation.ts +0 -169
  267. package/src/client/browser/BrowserPage.ts +0 -23
  268. package/src/client/browser/BrowserPersistence.ts +0 -44
  269. package/src/client/browser/IframeImpl.ts +0 -176
  270. package/src/client/browser/child-tabs.ts +0 -14
  271. package/src/client/browser/iframe-reference.ts +0 -67
  272. package/src/client/browser/initialization.ts +0 -262
  273. package/src/client/browser/omnibox.ts +0 -243
  274. package/src/client/browser/store.ts +0 -38
  275. package/src/client/browser/takeover-channel.ts +0 -72
  276. package/src/client/browser/url.ts +0 -46
  277. package/src/client/browser/web-reference-source.ts +0 -52
  278. package/src/client/css-modules.d.ts +0 -4
  279. package/src/client/definition.tsx +0 -30
  280. package/src/client/electron/ElectronWebViewImpl.ts +0 -364
  281. package/src/client/electron/ElectronWebviewPresentation.ts +0 -138
  282. package/src/client/electron/NativeChildPresentation.ts +0 -45
  283. package/src/client/electron/NativeViewPage.ts +0 -251
  284. package/src/client/electron/pages.ts +0 -23
  285. package/src/client/electron/reference-overlay.ts +0 -53
  286. package/src/client/electron/workspace.ts +0 -33
  287. package/src/client/index.ts +0 -293
  288. package/src/client/locales.ts +0 -857
  289. package/src/client/pages.ts +0 -28
  290. package/src/client/reference/client/BrowserRefLink.tsx +0 -142
  291. package/src/client/reference/client/draft-reference.ts +0 -167
  292. package/src/client/reference/client/index.ts +0 -7
  293. package/src/client/reference/client/ordered-submission.ts +0 -108
  294. package/src/client/reference/client/pending-delivery.ts +0 -216
  295. package/src/client/reference/client/plugin.ts +0 -189
  296. package/src/client/reference/client/production/ReferenceCapsules.tsx +0 -345
  297. package/src/client/reference/client/production/ReferenceDock.module.css +0 -193
  298. package/src/client/reference/client/production/ReferenceDock.tsx +0 -6
  299. package/src/client/reference/client/production/ReferenceFeedback.tsx +0 -15
  300. package/src/client/reference/client/production/ReferenceMath.tsx +0 -44
  301. package/src/client/reference/client/production/ReferenceText.tsx +0 -36
  302. package/src/client/reference/client/production/assembly.ts +0 -471
  303. package/src/client/reference/client/production/asset-store.ts +0 -144
  304. package/src/client/reference/client/production/availability.ts +0 -74
  305. package/src/client/reference/client/production/bytes.ts +0 -36
  306. package/src/client/reference/client/production/delivery-client.ts +0 -211
  307. package/src/client/reference/client/production/draft-adapter.ts +0 -508
  308. package/src/client/reference/client/production/http-transport.ts +0 -217
  309. package/src/client/reference/client/production/production-submission.ts +0 -310
  310. package/src/client/reference/client/production/protocol.ts +0 -231
  311. package/src/client/reference/client/production/reference-card.ts +0 -240
  312. package/src/client/reference/client/production/reference-labels.ts +0 -29
  313. package/src/client/reference/client/production/reply-link-bridge.ts +0 -222
  314. package/src/client/reference/client/production/reveal.ts +0 -215
  315. package/src/client/reference/client/production/runtime.ts +0 -1101
  316. package/src/client/reference/client/production/snapshot-adapter.ts +0 -154
  317. package/src/client/reference/client/production/source-marker.ts +0 -63
  318. package/src/client/reference/client/production/source-opener.ts +0 -55
  319. package/src/client/reference/client/production/styles.ts +0 -104
  320. package/src/client/reference/client/production/user-text-rule.ts +0 -58
  321. package/src/client/reference/client/reveal.ts +0 -107
  322. package/src/client/reference/client/scheme.ts +0 -114
  323. package/src/client/reference/client/types.ts +0 -168
  324. package/src/client/reference/css-modules.d.ts +0 -4
  325. package/src/client/reference/index.ts +0 -11
  326. package/src/client/reference-capture-owner.ts +0 -162
  327. package/src/client/reference-intents.ts +0 -36
  328. package/src/client/settings/index.ts +0 -34
  329. package/src/client/settings/panel.ts +0 -2657
  330. package/src/client/shortcut-open.ts +0 -30
  331. package/src/client/startpage/binding.ts +0 -99
  332. package/src/client/startpage/controller.ts +0 -303
  333. package/src/client/startpage/model.ts +0 -279
  334. package/src/client/view/Browser.module.css +0 -751
  335. package/src/client/view/BrowserBody.tsx +0 -314
  336. package/src/client/view/BrowserPresentation.ts +0 -9
  337. package/src/client/view/BrowserTitle.tsx +0 -17
  338. package/src/client/view/IframePresentation.ts +0 -344
  339. package/src/client/view/StartPage.tsx +0 -597
  340. package/src/client/view/TakeoverBanner.tsx +0 -21
  341. package/src/index.ts +0 -110
  342. package/src/reference-owner.ts +0 -5
  343. package/src/reference-page.ts +0 -9
  344. package/src/reference-source.ts +0 -3
  345. package/src/reference-text.ts +0 -197
  346. package/src/startpage-settings.ts +0 -103
  347. package/src/startpage.ts +0 -71
  348. package/src/takeover-protocol.ts +0 -19
  349. package/src/tool-browser/code-tool.ts +0 -401
  350. package/src/tool-browser/code-worker.ts +0 -639
  351. package/src/tool-browser/element-fields.ts +0 -167
  352. package/src/tool-browser/index.ts +0 -3733
  353. package/src/tool-browser/page-probe.ts +0 -474
  354. package/src/tool-browser/panel-page.ts +0 -124
  355. package/src/tool-browser/screenshot-image.ts +0 -49
  356. package/src/tool-browser/takeover.ts +0 -198
  357. package/src/types/electron-shim.d.ts +0 -144
  358. package/src/types.ts +0 -85
  359. package/src/web-guest.ts +0 -34
  360. package/tools/accept-desktop.mjs +0 -148
@@ -1,817 +0,0 @@
1
- /**
2
- * Vocabulary for the browser capability seam (`ctx.browser`). One seam owns
3
- * provider registration, session lifecycle, cancellation, errors, and product
4
- * configuration; providers differ only in what backs a session (an Electron
5
- * `WebContentsView` in the desktop shell, a headless Chromium relay for
6
- * remote deployments, and so on).
7
- * @module dsh-browser/browser/types
8
- */
9
-
10
- import { HarnessError } from '@deepseek-ai/dsh-llm'
11
-
12
- /**
13
- * Stable identity of one browser session, resolved by the Host through a
14
- * Typert `LookupMap` to the live session object (the same mechanism
15
- * `Agent → agentId` uses). The id is opaque to the wire; only the provider
16
- * and its host binding can interpret it.
17
- */
18
- export type BrowserSessionId = import('./handles.ts').BrowserSessionWireId
19
-
20
- /**
21
- * What one browser-capable backend is asked to do. Navigation is the minimal
22
- * operation every provider shares; the seam deliberately keeps the request
23
- * minimal so a provider swap never changes how the model asks.
24
- */
25
- export interface BrowserNavigateRequest {
26
- /**
27
- * The URL to open. Admission (HTTP(S) only) is provider-owned; the seam
28
- * itself does not police credentials or private/localhost targets — a
29
- * shared real browser legitimately reaches local dev servers.
30
- */
31
- readonly url: string
32
- }
33
-
34
- /**
35
- * Click at viewport coordinates. Coordinates are viewport-relative pixels in
36
- * the session's own coordinate space — the same space the human interacts
37
- * with, so a real view and a relay agree without scaling.
38
- */
39
- export interface BrowserClickRequest {
40
- /** Viewport-relative x in CSS pixels. */
41
- readonly x: number
42
- /** Viewport-relative y in CSS pixels. */
43
- readonly y: number
44
- }
45
-
46
- /**
47
- * A run of coordinate clicks in one call.
48
- *
49
- * Each point is clicked in order with the same real CDP sequence the single click uses. Between
50
- * points the call waits `intervalMs`, because a canvas that receives two presses inside one frame
51
- * treats them as a double click — or drops the second entirely, which looks like a silently wrong
52
- * board rather than an error.
53
- */
54
- export interface BrowserClickSequenceRequest {
55
- /** Points to click, in order, in viewport CSS pixels. */
56
- readonly points: readonly { readonly x: number; readonly y: number }[]
57
- /** Milliseconds to wait between points; defaults to 40. */
58
- readonly intervalMs?: number
59
- }
60
-
61
- /** Result of a click run: how many landed, and where it stopped if it did not finish. */
62
- export interface BrowserClickSequenceResult {
63
- /** Points that were clicked successfully. */
64
- readonly clicked: number
65
- /** Index of the point that failed, when one did. */
66
- readonly failedAt?: number
67
- /** Why that point failed. */
68
- readonly error?: string
69
- }
70
-
71
- /** Type text into the focused element. */
72
- export interface BrowserTypeRequest {
73
- /** The text to insert. */
74
- readonly text: string
75
- }
76
-
77
- /** Scroll the page: by pixel deltas, to an element, or to top/bottom. */
78
- export interface BrowserScrollRequest {
79
- /** Horizontal delta in CSS pixels. */
80
- readonly deltaX?: number
81
- /** Vertical delta in CSS pixels. */
82
- readonly deltaY?: number
83
- /** Scroll the given selector's element into view (top document; same-origin iframes reachable via execute). */
84
- readonly selector?: string
85
- /** Scroll to the top of the page. */
86
- readonly toTop?: boolean
87
- /** Scroll to the bottom of the page. */
88
- readonly toBottom?: boolean
89
- }
90
-
91
- /** Press one named key (Enter, Tab, arrows, …). */
92
- export interface BrowserKeyRequest {
93
- /** Key name from the supported set (see the dsh_browser_key tool). */
94
- readonly key: string
95
- }
96
-
97
- /**
98
- * How to find one element for a targeted interaction (form controls, clicks,
99
- * typing). `text` matches an element's own visible text — exact first, then
100
- * contains, deepest element preferred (so a button inside a card wins over
101
- * the card itself).
102
- */
103
- export interface BrowserElementTarget {
104
- /** Locator kind. */
105
- readonly by: 'css' | 'text' | 'xpath'
106
- /** The CSS selector / visible text / XPath expression. */
107
- readonly value: string
108
- /** 0-based index of the match to use. Default 0. */
109
- readonly index?: number
110
- }
111
-
112
- /** Set the value of one input/textarea/select/contenteditable. */
113
- export interface BrowserSetValueRequest {
114
- /** The element to set (css/text/xpath). */
115
- readonly target: BrowserElementTarget
116
- /** The value to set (string, number, or boolean). */
117
- readonly value: string | number | boolean
118
- /** Element-lookup budget in ms. Default 5000. */
119
- readonly timeoutMs?: number
120
- }
121
-
122
- /** Result of a single setValue. */
123
- export interface BrowserSetValueResult {
124
- /** How the value was applied: input | textarea | select | contenteditable. */
125
- readonly method: string
126
- /** The value as applied. */
127
- readonly value: string
128
- }
129
-
130
- /** Check/uncheck one checkbox or radio. */
131
- export interface BrowserCheckRequest {
132
- /** The element to toggle (css/text/xpath). */
133
- readonly target: BrowserElementTarget
134
- /** Desired state. Default true (check). */
135
- readonly checked?: boolean
136
- /** Element-lookup budget in ms. Default 5000. */
137
- readonly timeoutMs?: number
138
- }
139
-
140
- /** Select one option of a `<select>`, by value, visible text, or index. */
141
- export interface BrowserSelectRequest {
142
- /** The `<select>` element (css/text/xpath). */
143
- readonly target: BrowserElementTarget
144
- /** Match the option by its value attribute. */
145
- readonly optionValue?: string
146
- /** Match the option by its visible text. */
147
- readonly optionText?: string
148
- /** Match the option by its 0-based index. */
149
- readonly optionIndex?: number
150
- /** Element-lookup budget in ms. Default 5000. */
151
- readonly timeoutMs?: number
152
- }
153
-
154
- /** Result of a single select. */
155
- export interface BrowserSelectResult {
156
- /** The selected option's value attribute. */
157
- readonly value: string
158
- /** The selected option's visible text. */
159
- readonly text: string
160
- }
161
-
162
- /** Clear one input/textarea/contenteditable (or uncheck a checkbox/radio). */
163
- export interface BrowserClearRequest {
164
- /** The element to clear (css/text/xpath). */
165
- readonly target: BrowserElementTarget
166
- /** Element-lookup budget in ms. Default 5000. */
167
- readonly timeoutMs?: number
168
- }
169
-
170
- /** Read one element's current value (for verification). */
171
- export interface BrowserGetValueRequest {
172
- /** The element to read (css/text/xpath). */
173
- readonly target: BrowserElementTarget
174
- /** Element-lookup budget in ms. Default 5000. */
175
- readonly timeoutMs?: number
176
- }
177
-
178
- /** Result of a getValue. */
179
- export interface BrowserGetValueResult {
180
- /** The element's value; null when the element has none (e.g. a checkbox). */
181
- readonly value: string | null
182
- /** For checkbox/radio: the checked state. */
183
- readonly checked?: boolean
184
- /** For `<select>`: the selected option's visible text. */
185
- readonly selectedText?: string
186
- }
187
-
188
- /** One field of a scrape: a name plus a selector (optionally `selector@attr`). */
189
- export interface BrowserScrapeField {
190
- /** Output key. */
191
- readonly name: string
192
- /**
193
- * CSS selector relative to each item; append `@attr` to take an attribute
194
- * instead of text (`a@href` returns an absolute URL for links).
195
- */
196
- readonly selector: string
197
- }
198
-
199
- /** Extract structured data from repeated DOM items (static, CSP-safe). */
200
- export interface BrowserScrapeRequest {
201
- /** Required: CSS selector of each result container (e.g. `div.card`). */
202
- readonly item: string
203
- /** Field map: name -> selector[@attr]. */
204
- readonly fields: readonly BrowserScrapeField[]
205
- /** Wait budget for the item selector to appear. Default 5000. */
206
- readonly timeoutMs?: number
207
- }
208
-
209
- /** Structured extraction result. */
210
- export interface BrowserScrapeResult {
211
- /** Number of items extracted. */
212
- readonly count: number
213
- /** One object per item; missing fields are null. */
214
- readonly items: readonly Record<string, string | null>[]
215
- }
216
-
217
- /** One field of a batch form fill. Match by selector, or by name/label/placeholder. */
218
- export interface BrowserFillField {
219
- /** CSS selector; when present, candidates are scoped to it. */
220
- readonly selector?: string
221
- /** Match by the field's `name` attribute. */
222
- readonly name?: string
223
- /** Match by associated `<label>` text or `aria-label`. */
224
- readonly label?: string
225
- /** Match by `placeholder` text. */
226
- readonly placeholder?: string
227
- /** Field kind; defaults to text. */
228
- readonly kind?: 'text' | 'textarea' | 'checkbox' | 'radio' | 'select'
229
- /** Value to set: string, number, or boolean (checkbox/radio). For a
230
- * multi-select or radio group, the option value (or visible text). */
231
- readonly value: string | number | boolean
232
- }
233
-
234
- /** Batch form fill: set several fields, optionally submitting the form. */
235
- export interface BrowserFillRequest {
236
- /** The fields to fill, in order. */
237
- readonly fields: readonly BrowserFillField[]
238
- /** Submit the containing form after filling. Default false. */
239
- readonly submit?: boolean
240
- /** Per-field evaluation budget in ms. Default 30000. */
241
- readonly timeoutMs?: number
242
- }
243
-
244
- /** One field's outcome in a batch fill. */
245
- export interface BrowserFillFieldResult {
246
- readonly ok: boolean
247
- /** The field description matched (selector/name/label/placeholder). */
248
- readonly target: string
249
- /** How the value was applied: input | textarea | select | checkbox | radio | contenteditable. */
250
- readonly method?: string
251
- /** Error text when the field could not be filled. */
252
- readonly error?: string
253
- }
254
-
255
- /** Outcome of a batch form fill. */
256
- export interface BrowserFillResult {
257
- /** Per-field outcomes, in request order. */
258
- readonly fields: readonly BrowserFillFieldResult[]
259
- /** Whether the containing form was submitted. */
260
- readonly submitted: boolean
261
- }
262
-
263
- /** Wait request: poll until the page is ready (and optional URL/selector). */
264
- export interface BrowserWaitRequest {
265
- /** Maximum wait in ms. Default 30000. */
266
- readonly timeoutMs?: number
267
- /**
268
- * Optional URL the top document must show (exact or prefix match). Pass the
269
- * URL you navigated to — this distinguishes the NEW document from the old
270
- * one still on screen while navigation is in flight.
271
- */
272
- readonly url?: string
273
- /** Optional CSS selector that must exist (top document or same-origin frames). */
274
- readonly selector?: string
275
- /** Wait for the page load (readyState complete). Default true. */
276
- readonly loaded?: boolean
277
- }
278
-
279
- /** Outcome of a wait: whether the condition was met before the budget ran out. */
280
- export interface BrowserWaitResult {
281
- readonly ready: boolean
282
- /** Why the wait ended: 'condition met' or a short explanation of the miss. */
283
- readonly reason: string
284
- }
285
-
286
- /**
287
- * A screenshot of the current page state. `dataUrl` is a base64 data URL the
288
- * tool layer renders directly; the live view itself never crosses the wire
289
- * (the human watches the real view in the desktop shape).
290
- */
291
- export interface BrowserScreenshotResult {
292
- /** Base64 data URL of the capture (PNG or JPEG per the request). */
293
- readonly dataUrl: string
294
- /** Pixel size of the image in `dataUrl`, when the capture was measured and scaled.
295
- *
296
- * Present when the request carried `maxWidth`/`maxHeight` and the layout metrics were
297
- * readable: the scaling happens inside CDP through a clip, and without this the only way to
298
- * learn what came back was to decode the data URL. Undefined means "not measured", which is
299
- * also what an unscaled capture reports. */
300
- readonly width?: number
301
- readonly height?: number
302
- /** File path the capture was also saved to, when the request asked for it. */
303
- readonly path?: string
304
- }
305
-
306
- /** Screenshot capture options. */
307
- export interface BrowserScreenshotRequest {
308
- /** Capture the full scrollable page instead of the viewport. Default false. */
309
- readonly fullPage?: boolean
310
- /** Absolute file path to also save the image to (for vision-tool reads). */
311
- readonly savePath?: string
312
- /**
313
- * Image format. Default 'png'. JPEG is only available on the self-hosted
314
- * native capture path; the desktop-shell CDP fallback always returns PNG
315
- * (CDP JPEG hangs on Electron 43 — a documented platform defect).
316
- */
317
- readonly format?: 'png' | 'jpeg'
318
- /** JPEG quality 1-100 (default 80); ignored for PNG. */
319
- readonly quality?: number
320
- /** Downscale to fit within this width (aspect preserved). */
321
- readonly maxWidth?: number
322
- /** Downscale to fit within this height (aspect preserved). */
323
- readonly maxHeight?: number
324
- /**
325
- * Capture only this region, in document CSS pixels. Used by the reference
326
- * service for a masked visible-region snapshot; the tool layer does not
327
- * expose it, so ordinary screenshots keep their existing behaviour.
328
- */
329
- readonly clip?: {
330
- readonly x: number
331
- readonly y: number
332
- readonly width: number
333
- readonly height: number
334
- }
335
- }
336
-
337
- /** Download options: fetch a URL into a local file, keeping the session's cookies. */
338
- export interface BrowserDownloadRequest {
339
- /** The URL to download. */
340
- readonly url: string
341
- /** Absolute path of the file to write. */
342
- readonly savePath: string
343
- }
344
-
345
- /** A serializable cookie, exported from or imported into the browser session. */
346
- export interface ExportedCookie {
347
- /** Cookie URL (scheme + domain + path), as accepted by cookies.set. */
348
- readonly url: string
349
- readonly name: string
350
- readonly value: string
351
- readonly domain?: string
352
- readonly path?: string
353
- readonly secure?: boolean
354
- readonly httpOnly?: boolean
355
- readonly expirationDate?: number
356
- }
357
-
358
- /**
359
- * Execute arbitrary JavaScript in the session's page context. This is the
360
- * primary interaction path — DOM-referenced, not screen-coordinate-based:
361
- * focus/input/click go through the page's own JS (native setters for
362
- * framework-controlled inputs), matching how a human-driven agent operates.
363
- */
364
- export interface BrowserExecuteRequest {
365
- /** The JavaScript expression to evaluate in the page context. */
366
- readonly script: string
367
- /** Optional arguments injected into the script scope as `arguments[0..n]`. */
368
- readonly args?: readonly unknown[]
369
- /** Evaluation budget in ms; a wedged page rejects with a timeout. Default 30000. */
370
- readonly timeoutMs?: number
371
- }
372
-
373
- /**
374
- * Fixed page operations implemented by the provider. Strings are serialized as data.
375
- * Arbitrary JavaScript is handled only by BrowserExecuteRequest.
376
- */
377
- export type BrowserPageOperationRequest =
378
- | { readonly operation: 'install' }
379
- | { readonly operation: 'probe'; readonly method: BrowserProbeMethod; readonly args?: readonly unknown[] }
380
- | { readonly operation: 'text'; readonly text: string }
381
- | { readonly operation: 'url' }
382
- | { readonly operation: 'drag'; readonly from: { x: number; y: number }; readonly to: { x: number; y: number }; readonly steps: number }
383
- | { readonly operation: 'upload'; readonly target: { by: 'css' | 'text' | 'xpath'; value: string }; readonly file: { name: string; mime: string; base64: string } }
384
-
385
- /** Provider-owned probe operations; JavaScript properties such as constructor are excluded. */
386
- export type BrowserProbeMethod = 'read' | 'clear' | 'settle' | 'find' | 'overlayAt' | 'summary'
387
- | 'findText' | 'hoverAt' | 'setDialogPolicy' | 'dialogStatus' | 'networkCursor'
388
-
389
- /**
390
- * Result of an execute. Mirrors CDP `Runtime.evaluate` semantics: either a
391
- * value (by value, not by reference) or the exception thrown.
392
- */
393
- export type BrowserExecuteResult =
394
- | { readonly ok: true; readonly value: unknown }
395
- | { readonly ok: false; readonly exception: string }
396
-
397
- /**
398
- * One interactive element in a snapshot, with a stable reference number the
399
- * tool layer (and the model) can cite to target the element.
400
- */
401
- export interface BrowserSnapshotElement {
402
- /** 1-based reference number, stable for the lifetime of one snapshot. */
403
- readonly ref: number
404
- /** Element kind: 'input' | 'button' | 'link' | 'textarea' | 'select' | 'checkbox' | 'other'. */
405
- readonly kind: string
406
- /** Text content or placeholder/label, truncated for the snapshot. */
407
- readonly label: string
408
- /** Best-effort CSS selector; may be empty when none is derivable. */
409
- readonly selector: string
410
- /** Viewport-relative center, for coordinate fallbacks. */
411
- readonly x: number
412
- readonly y: number
413
- /**
414
- * True when the element lives inside an (same-origin) iframe: coordinates
415
- * are still top-document, but DOM selectors are frame-scoped — reach the
416
- * element via `iframe.contentDocument` in dsh_browser_execute.
417
- */
418
- readonly frame?: boolean
419
- }
420
-
421
- /**
422
- * AI-friendly page snapshot: a compact, numbered inventory of interactive
423
- * elements plus page facts. Not raw HTML — the model dialogues with this.
424
- */
425
- export interface BrowserSnapshotResult {
426
- /** Final page URL. */
427
- readonly url: string
428
- /** Page title, if any. */
429
- readonly title?: string
430
- /** Numbered interactive elements. */
431
- readonly elements: readonly BrowserSnapshotElement[]
432
- /** True when the snapshot was truncated (element cap reached). */
433
- readonly truncated: boolean
434
- /** Human-verification challenge blocking the page, when one is detected. */
435
- readonly challenge?: BrowserChallenge
436
- /**
437
- * True when this is a blank page — no document to read, nothing to drive.
438
- *
439
- * Zero elements means two very different things: a page that genuinely has nothing interactive,
440
- * and a browser that has not opened anything at all. Without this flag they look identical, so a
441
- * caller can act on a blank page and get a success value back — reported as issue #37, where every
442
- * tool after a carrier swap answered against `about:blank` while appearing to work.
443
- *
444
- * Set for `about:blank` and for a view that has never navigated. A caller seeing it should treat
445
- * the page as absent, not as empty.
446
- */
447
- readonly blank?: boolean
448
- /** A sentence a caller can show instead of reporting an empty page as a successful read. */
449
- readonly note?: string
450
- /**
451
- * True when the page draws its interface on a canvas, so no DOM element exists to collect.
452
- *
453
- * Distinct from `blank`: the page is fully rendered and interactive, just not as elements. A
454
- * caller must switch to a screenshot and coordinate input rather than conclude the page is empty.
455
- */
456
- readonly canvas?: boolean
457
- }
458
-
459
- /**
460
- * One node of the accessibility tree, with a stable reference number the
461
- * model can cite. Roles/names prefer Chrome's `computedRole`/`computedName`
462
- * with tag/attribute inference as fallback; coordinates are top-document
463
- * viewport-relative so the node can also be driven by click/type.
464
- */
465
- export interface BrowserA11yNode {
466
- /** 1-based reference number, stable for the lifetime of one a11y call. */
467
- readonly ref: number
468
- /** ARIA role: button | link | textbox | checkbox | radio | combobox | … */
469
- readonly role: string
470
- /** Accessible name (aria-label, label text, placeholder, own text, …). */
471
- readonly name: string
472
- /**
473
- * Current value of input-like nodes; absent when the node has none.
474
- *
475
- * The provider produces `null` for "not applicable" and the tool layer drops it, so absence
476
- * and null mean the same thing here — which is what the output schema declares (`string`,
477
- * not nullable). Saying `string | null` described the provider's internal shape rather than
478
- * the contract, and the two disagreed at every call.
479
- */
480
- readonly value?: string
481
- /** ARIA/DOM states: enabled/disabled/checked/unchecked/expanded/… */
482
- readonly states: readonly string[]
483
- /** DOM depth (within its document), for reconstructing the tree. */
484
- readonly depth: number
485
- /** Element tag name (lowercase). */
486
- readonly tag: string
487
- /**
488
- * A CSS selector for this node, when one can be derived from its id or name.
489
- *
490
- * Empty for the many elements that have neither. Present because a role and a name are not
491
- * always enough to target a node: `{by: 'text'}` matches an accessible name only loosely,
492
- * and this is what lets a caller point at the exact element it was shown.
493
- */
494
- readonly selector: string
495
- /** Viewport-relative center, for coordinate fallbacks. */
496
- readonly x: number
497
- readonly y: number
498
- /** True when the node lives inside a same-origin iframe. */
499
- readonly frame?: boolean
500
- }
501
-
502
- /** A11y tree request: what to include and how many nodes to return. */
503
- export interface BrowserA11yRequest {
504
- /** Include hidden elements (display:none, hidden, aria-hidden). Default false. */
505
- readonly includeHidden?: boolean
506
- /** Maximum nodes returned. Default 500; clamped to 10-5000. */
507
- readonly maxNodes?: number
508
- }
509
-
510
- /** The page's accessibility tree, flattened into a numbered node list. */
511
- export interface BrowserA11yResult {
512
- /** Final page URL. */
513
- readonly url: string
514
- /** Page title, if any. */
515
- readonly title?: string
516
- /** Number of nodes returned. */
517
- readonly count: number
518
- /** Flattened a11y nodes (depth restores the tree). */
519
- readonly nodes: readonly BrowserA11yNode[]
520
- /** True when the result was truncated (maxNodes reached). */
521
- readonly truncated: boolean
522
- }
523
-
524
- /**
525
- * A detected human-verification (bot-detection / CAPTCHA) challenge blocking
526
- * the page. Detection is best-effort and marker-based; a clean result is not a
527
- * guarantee that no challenge exists.
528
- */
529
- export interface BrowserChallenge {
530
- /** Whether a challenge currently blocks the page. */
531
- readonly blocked: boolean
532
- /** Machine-readable kind: cloudflare | hcaptcha | recaptcha | turnstile | generic. */
533
- readonly kind?: string
534
- /** Short human-readable description, e.g. 'Cloudflare "Just a moment" interstitial'. */
535
- readonly reason?: string
536
- }
537
-
538
- /**
539
- * Content fetch formats. `html` is the raw DOM; `markdown` is a structured
540
- * reading view; `txt` is plain text (smallest); `json` is structured data.
541
- */
542
- export type BrowserContentFormat = 'html' | 'markdown' | 'txt' | 'json'
543
-
544
- /** Content fetch request: format, optional selector scoping, and caps. */
545
- export interface BrowserContentRequest {
546
- /** Desired format. */
547
- readonly format: BrowserContentFormat
548
- /** Optional CSS selector limiting the fetch to one region (e.g. `#main`). */
549
- readonly selector?: string
550
- /** Maximum characters of the returned content. */
551
- readonly maxChars?: number
552
- /** Evaluation timeout in ms; the fetch aborts after this. Default 30000. */
553
- readonly timeoutMs?: number
554
- }
555
-
556
- /** A fetched page content in the requested format. */
557
- export interface BrowserContentResult {
558
- /** The content in the requested format, capped at `maxChars`. */
559
- readonly content: string
560
- /** True when the content was truncated. */
561
- readonly truncated: boolean
562
- }
563
-
564
- /**
565
- * A tab inside a browser session. Tabs share the session's profile/cookies
566
- * and are switchable without losing state.
567
- */
568
- export interface BrowserTab {
569
- /** Stable tab id within the session. */
570
- readonly id: import('./handles.ts').BrowserTabWireId
571
- /** Current URL, or empty for a blank tab. */
572
- readonly url: string
573
- /** Page title, if any. */
574
- readonly title?: string
575
- /** Whether this tab is the active one. */
576
- readonly active: boolean
577
- }
578
-
579
- /**
580
- * One passive preview frame: an encoded image plus its dimensions.
581
- *
582
- * The image is a data URL so it travels the existing JSON seam unchanged; the media type is part of
583
- * the URL rather than a separate field because every consumer needs them together.
584
- */
585
- export interface BrowserPreviewFrame {
586
- readonly dataUrl: string
587
- readonly width?: number
588
- readonly height?: number
589
- }
590
-
591
- /** One page a carrier holds, whether or not this plugin created it. */
592
- export interface CarrierPage {
593
- /** Canonical owner/session/tab identity used to address the page. */
594
- readonly id: import('./handles.ts').BrowserTabWireId
595
- readonly url: string
596
- readonly title?: string
597
- }
598
-
599
- /**
600
- * Why a carrier reported that it can no longer be used.
601
- *
602
- * Two different failures reach the same fallback, and saying which one is the difference between a
603
- * message a user can act on and one that misleads them:
604
- *
605
- * - `shell-exited`: the shell process behind the carrier is gone. Its published endpoint stops
606
- * being refreshed, which is the condition the fallback was originally written for.
607
- * - `panel-unusable`: the shell is alive and answering, but its sidebar panel cannot provide a page
608
- * — on a shell that renders that panel as an iframe there is no webContents and no CDP endpoint,
609
- * so the carrier is undrivable rather than merely unready.
610
- *
611
- * The fallback announced the first of these unconditionally, so a `panel-unusable` fallback told
612
- * the user their desktop shell had exited while it was running normally. Reported as such.
613
- */
614
- export type CarrierLossReason = 'shell-exited' | 'panel-unusable'
615
-
616
- /** Request to open a URL: into the active tab or a new tab. */export interface BrowserOpenRequest {
617
- /** The URL to open. */
618
- readonly url: string
619
- /** Open in a new tab (parallel). Default false (reuse the active tab). */
620
- readonly newTab?: boolean
621
- }
622
-
623
- /**
624
- * A browser-capable backend. Registered with `ctx.browser.registerBrowserProvider`.
625
- * `id` is a stable string, unique across the seam.
626
- */
627
- export interface BrowserProvider {
628
- readonly id: string
629
- /** Cheap local usability check; must not make network calls. */
630
- available(): boolean
631
- /**
632
- * Open a new session. The provider mints the session id and prepares its
633
- * backing surface (a view, a headless page, and so on). Sessions are isolated from
634
- * each other in what they OWN — tabs, the active tab, history, the view — so one
635
- * session must not be visible to any other session's caller.
636
- *
637
- * That isolation stops at the browser's own state, and is not meant to go further:
638
- * cookies, logins and site storage are deliberately shared by every session, because
639
- * every session drives the same browser and "sign in once, use it everywhere" is the
640
- * point of using a real one. Reads that hand that state to a caller (see
641
- * `flushAuth`) are scoped to the page in question, which is least exposure rather
642
- * than a claim that the jar is per-session.
643
- * @param label - optional human-readable label (e.g. the calling DSH task
644
- * id) the provider may surface on the visible surface (window title) so a
645
- * human can tell which task's page is currently shown.
646
- */
647
- open(label?: string): Promise<BrowserSessionId>
648
- /** Bind an existing carrier page to this session without navigating or creating a page. */
649
- bindPage?(session: BrowserSessionId, pageId: import('./handles.ts').BrowserTabWireId): Promise<void>
650
- /** Open a URL, optionally in a new tab. Honor `signal` for cancellation. */
651
- openUrl(session: BrowserSessionId, request: BrowserOpenRequest, signal?: AbortSignal): Promise<void>
652
- /** List the session's tabs. */
653
- listTabs(session: BrowserSessionId): Promise<readonly BrowserTab[]>
654
- /** Switch to a tab by id. Unknown id -> `BROWSER_TAB_UNKNOWN`. */
655
- switchTab(session: BrowserSessionId, tabId: import('./handles.ts').BrowserTabWireId): Promise<void>
656
- /** Close one tab. Closing the active tab activates the next. */
657
- closeTab(session: BrowserSessionId, tabId: import('./handles.ts').BrowserTabWireId): Promise<void>
658
- /** Close every tab and reset the session's state. */
659
- reset(session: BrowserSessionId): Promise<void>
660
- /** Navigate the active tab. Honor `signal` for cancellation. */
661
- navigate(session: BrowserSessionId, request: BrowserNavigateRequest, signal?: AbortSignal): Promise<void>
662
- /** Execute JS in the active tab's page context. */
663
- execute(session: BrowserSessionId, request: BrowserExecuteRequest, signal?: AbortSignal): Promise<BrowserExecuteResult>
664
-
665
- /** Execute one fixed browser operation without granting arbitrary page scripting. */
666
- pageOperation?(session: BrowserSessionId, request: BrowserPageOperationRequest, signal?: AbortSignal): Promise<BrowserExecuteResult>
667
- /** Wait until the page is ready (and optional URL/selector match). Honor `signal` for cancellation. */
668
- waitFor(session: BrowserSessionId, request: BrowserWaitRequest, signal?: AbortSignal): Promise<BrowserWaitResult>
669
- /** Produce an AI-friendly snapshot of the active tab. */
670
- snapshot(session: BrowserSessionId, signal?: AbortSignal): Promise<BrowserSnapshotResult>
671
- /** Read the active tab's accessibility tree (semantic, interactive nodes). */
672
- a11y(session: BrowserSessionId, request: BrowserA11yRequest, signal?: AbortSignal): Promise<BrowserA11yResult>
673
- /** Reload the active tab. Honor `signal` for cancellation. */
674
- reload(session: BrowserSessionId, signal?: AbortSignal): Promise<void>
675
- /** Check whether a human-verification challenge is blocking the active tab. */
676
- detectChallenge(session: BrowserSessionId, signal?: AbortSignal): Promise<BrowserChallenge>
677
- /** Fetch page content in a requested format. */
678
- content(session: BrowserSessionId, request: BrowserContentRequest, signal?: AbortSignal): Promise<BrowserContentResult>
679
- /**
680
- * Click at viewport coordinates, or at a located element's center when the
681
- * request carries a `target`. Honor `signal` for cancellation.
682
- */
683
- click(session: BrowserSessionId, request: BrowserClickRequest | { readonly target: BrowserElementTarget }, signal?: AbortSignal): Promise<void>
684
- /**
685
- * Click several points in order, in one round trip.
686
- *
687
- * Exists because a canvas page accepts only genuine input: one click per call meant two calls
688
- * per cell on a 9x9 board. Stops at the first point that fails rather than pressing through a
689
- * page that has moved under it, and reports how far it got.
690
- * @param session - the session to click in.
691
- * @param request - the points and the interval between them.
692
- * @param signal - cancellation between points.
693
- */
694
- clickSequence(session: BrowserSessionId, request: BrowserClickSequenceRequest, signal?: AbortSignal): Promise<BrowserClickSequenceResult>
695
- /**
696
- * Type into the focused element, or focus a located element first when the
697
- * request carries a `target`. Honor `signal` for cancellation.
698
- */
699
- type(session: BrowserSessionId, request: BrowserTypeRequest | { readonly target: BrowserElementTarget }, signal?: AbortSignal): Promise<void>
700
- /** Set one element's value (native setter + input/change events). */
701
- setValue(session: BrowserSessionId, request: BrowserSetValueRequest, signal?: AbortSignal): Promise<BrowserSetValueResult>
702
- /** Check or uncheck one checkbox/radio. */
703
- check(session: BrowserSessionId, request: BrowserCheckRequest, signal?: AbortSignal): Promise<{ readonly checked: boolean }>
704
- /** Select one option of a `<select>`. */
705
- selectOption(session: BrowserSessionId, request: BrowserSelectRequest, signal?: AbortSignal): Promise<BrowserSelectResult>
706
- /** Clear one input/textarea/contenteditable (or uncheck). */
707
- clearField(session: BrowserSessionId, request: BrowserClearRequest, signal?: AbortSignal): Promise<{ readonly cleared: boolean }>
708
- /** Read one element's current value (for verification). */
709
- getValue(session: BrowserSessionId, request: BrowserGetValueRequest, signal?: AbortSignal): Promise<BrowserGetValueResult>
710
- /** Extract structured data from repeated DOM items (static CSS, CSP-safe). */
711
- scrape(session: BrowserSessionId, request: BrowserScrapeRequest, signal?: AbortSignal): Promise<BrowserScrapeResult>
712
- /** Scroll the active tab. Honor `signal` for cancellation. */
713
- scroll(session: BrowserSessionId, request: BrowserScrollRequest, signal?: AbortSignal): Promise<void>
714
- /** Go back in the active tab's history. Honor `signal` for cancellation. */
715
- back(session: BrowserSessionId, signal?: AbortSignal): Promise<void>
716
- /** Go forward in the active tab's history. Honor `signal` for cancellation. */
717
- forward(session: BrowserSessionId, signal?: AbortSignal): Promise<void>
718
- /** Press one named key (Enter/Tab/arrows/…). Honor `signal` for cancellation. */
719
- key(session: BrowserSessionId, request: BrowserKeyRequest, signal?: AbortSignal): Promise<void>
720
- /** Fill a form's fields in one batch. Honor `signal` for cancellation. */
721
- fillForm(session: BrowserSessionId, request: BrowserFillRequest, signal?: AbortSignal): Promise<BrowserFillResult>
722
- /** Capture the current page. Honor `signal` for cancellation. */
723
- screenshot(session: BrowserSessionId, request?: BrowserScreenshotRequest, signal?: AbortSignal): Promise<BrowserScreenshotResult>
724
- /**
725
- * Capture the active page WITHOUT presenting it, for a remote live view (issue #34).
726
- *
727
- * Optional, and it must stay optional: a third-party provider that cannot do this simply does not
728
- * offer watching, while every existing tool keeps working. That is the design's requirement, not
729
- * a convenience — a mandatory member would make every provider implement a feature most never
730
- * need.
731
- *
732
- * The contract is narrower than {@link screenshot} in every direction: viewport only, no save
733
- * path, no full page, and no side effects on what the host displays. A provider that would have to
734
- * focus, restore, expand or recreate anything to produce a frame must throw
735
- * BROWSER_PREVIEW_UNAVAILABLE instead — the viewer shows a paused state, it does not rearrange the
736
- * host's screen.
737
- */
738
- capturePassive?(session: BrowserSessionId, signal?: AbortSignal): Promise<BrowserPreviewFrame>
739
- /**
740
- * The sessions a viewer may watch. Only meaningful alongside {@link capturePassive}.
741
- *
742
- * Exists because the provider names its sessions and the browser page cannot know one; served as
743
- * ids only, so the panel can address a session without being told what is in it.
744
- */
745
- watchableSessions?(): readonly BrowserSessionId[]
746
- /** Download a URL to a local file. Honor `signal` for cancellation. */
747
- download(session: BrowserSessionId, request: BrowserDownloadRequest, signal?: AbortSignal): Promise<{ readonly path: string }>
748
- /** Export the session's cookies (login state). */
749
- flushAuth(session: BrowserSessionId): Promise<readonly ExportedCookie[]>
750
- /** Import cookies into the session (restore login state). */
751
- restoreAuth(session: BrowserSessionId, cookies: readonly ExportedCookie[]): Promise<number>
752
- /** Return the session's chronological operation log. */
753
- history(session: BrowserSessionId): Promise<readonly BrowserHistoryEntry[]>
754
- /**
755
- * Persisted visits, newest first: what survives the browser process, so a
756
- * human or an Agent can find a page again after the interface was closed.
757
- * @param options - result cap and an optional hostname filter.
758
- * @returns the retained visits (empty when history is disabled).
759
- */
760
- visited(options?: { readonly limit?: number; readonly domain?: string }): readonly VisitedPage[]
761
- /**
762
- * Optional: whether a session is still live. A session can end outside the
763
- * tool layer — the human closed the browser window — so a cached id must be
764
- * checked before it is reused. Providers that never end a session on their own
765
- * can omit this, and callers treat absence as "still live".
766
- * @param session - the session id to test.
767
- */
768
- exists?(session: BrowserSessionId): boolean
769
- /** Replay one recorded operation by sequence number. */
770
- replay(session: BrowserSessionId, seq: number): Promise<void>
771
- /** Close the session and destroy its backing surface. Idempotent. */
772
- close(session: BrowserSessionId): Promise<void>
773
- }
774
-
775
- /**
776
- * One visited page in the persistent browsing history — the durable record that
777
- * outlives sessions, unlike {@link BrowserHistoryEntry}, which is a
778
- * session-scoped operation log (navigate/click/type/…).
779
- */
780
- export interface VisitedPage {
781
- /** Epoch milliseconds when the visit was recorded. */
782
- readonly at: number
783
- /** Absolute URL of the visited document. */
784
- readonly url: string
785
- /** Document title at visit time, when the page exposed one. */
786
- readonly title?: string
787
- /** Session/task label that drove the visit, when the provider knows it. */
788
- readonly session?: string
789
- }
790
-
791
- /** One recorded browser operation, in chronological order (seq 1, 2, 3…). */
792
- export interface BrowserHistoryEntry {
793
- /** Monotonic sequence number within the session. */
794
- readonly seq: number
795
- /** The operation name. Replayable: navigate | execute | click | type.
796
- * Also recorded (non-replayable): fill | download | flushAuth | restoreAuth. */
797
- readonly action: string
798
- /** The operation's arguments. */
799
- readonly params: Record<string, unknown>
800
- /** Whether the operation succeeded. */
801
- readonly ok: boolean
802
- /** Truncated result text, when the operation returned one. */
803
- readonly result?: string
804
- /** Error text, when the operation failed. */
805
- readonly error?: string
806
- /** Epoch millis of the operation. */
807
- readonly at: number
808
- }
809
-
810
- /**
811
- * Typed browser error with a machine-routable, open-string `code` and chained
812
- * `cause`. Consumers must tolerate provider-specific codes. Shared codes cover
813
- * unavailable, missing, unusable, ambiguous, or duplicate providers, unknown
814
- * or closed sessions, cancellation, and provider failure; a provider adds its
815
- * own (e.g. `BROWSER_CDP_ATTACH_FAILED`).
816
- */
817
- export class BrowserError extends HarnessError {}