dsh-builtin-browser 1.0.0 → 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 (364) hide show
  1. package/CHANGELOG.md +61 -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/pr64-maintenance.md +1 -1
  19. package/docs/tool-reference.md +1 -1
  20. package/docs/user-guide.md +1 -1
  21. package/docs/v1.1.0-bu-data-batching-task.md +66 -0
  22. package/docs/v1.1.0-compat-hardcoding-task.md +85 -0
  23. package/dsh-builtin-browser-1.0.3-publish.tgz +0 -0
  24. package/dsh-builtin-browser-1.0.3.tgz +0 -0
  25. package/dsh-host-patch/README.md +4 -0
  26. package/dsh-host-patch/apply.mjs +61 -13
  27. package/dsh-host-patch/rc3-revision9.json.gz +0 -0
  28. package/dsh-host-patch/rc5-revision9.json.gz +0 -0
  29. package/dsh-host-patch/sources/main/0001-feat-sidebar-right-add-session-rendering-holds.patch.gz +0 -0
  30. package/dsh-host-patch/sources/main/0002-feat-desktop-load-trusted-profile-main-extensions.patch.gz +0 -0
  31. package/dsh-host-patch/sources/main/0003-feat-desktop-report-resolved-and-running-main-extens.patch.gz +0 -0
  32. package/dsh-host-patch/sources/main/0004-feat-desktop-compose-admitted-native-sidebar-views.patch.gz +0 -0
  33. package/dsh-host-patch/sources/main/0005-fix-client-admit-coded-browser-errors-in-native-comp.patch.gz +0 -0
  34. package/dsh-host-patch/sources/main/0006-fix-desktop-acknowledge-native-same-document-navigat.patch.gz +0 -0
  35. package/dsh-host-patch/sources/main/0007-fix-desktop-restore-auth-in-the-native-lease-partiti.patch.gz +0 -0
  36. package/dsh-host-patch/sources/main/0008-feat-desktop-adopt-native-children-in-admitted-sideb.patch.gz +0 -0
  37. package/dsh-host-patch/sources/main/0009-fix-desktop-publish-complete-native-child-close-reco.patch.gz +0 -0
  38. package/dsh-host-patch/sources/main/0010-fix-desktop-bundle-structured-errors-in-sandboxed-pr.patch.gz +0 -0
  39. package/dsh-host-patch/sources/main/0011-feat-desktop-offer-persistent-Sidebar-sessions-per-D.patch.gz +0 -0
  40. package/dsh-host-patch/sources/main/0012-feat-desktop-retain-sidebar-session-cookies-across-r.patch.gz +0 -0
  41. package/dsh-host-patch/sources/main/0013-fix-desktop-honor-sidebar-session-cookie-sidecar-con.patch.gz +0 -0
  42. package/dsh-host-patch/sources/main/0014-fix-desktop-retry-cookie-protection-without-failing-.patch.gz +0 -0
  43. package/dsh-host-patch/sources/main/0015-fix-desktop-preserve-host-only-cookie-identity-in-se.patch.gz +0 -0
  44. package/dsh-host-patch/sources/main/0016-fix-desktop-restore-session-cookies-before-checkpoin.patch.gz +0 -0
  45. package/dsh-host-patch/sources/main/0017-fix-desktop-restore-sidebar-cookies-once-before-gues.patch.gz +0 -0
  46. package/dsh-host-patch/sources/main/0018-fix-sidebar-right-follow-animated-native-slot-placem.patch.gz +0 -0
  47. package/dsh-host-patch/sources/manifest.json +218 -0
  48. package/dsh-host-patch/sources/rc3/0001-feat-sidebar-right-add-session-rendering-holds.patch.gz +0 -0
  49. package/dsh-host-patch/sources/rc3/0002-feat-desktop-load-trusted-profile-main-extensions.patch.gz +0 -0
  50. package/dsh-host-patch/sources/rc3/0003-feat-desktop-report-resolved-and-running-main-extens.patch.gz +0 -0
  51. package/dsh-host-patch/sources/rc3/0004-feat-desktop-compose-admitted-native-sidebar-views.patch.gz +0 -0
  52. package/dsh-host-patch/sources/rc3/0005-fix-client-admit-coded-browser-errors-in-native-comp.patch.gz +0 -0
  53. package/dsh-host-patch/sources/rc3/0006-fix-desktop-acknowledge-native-same-document-navigat.patch.gz +0 -0
  54. package/dsh-host-patch/sources/rc3/0007-fix-desktop-restore-auth-in-the-native-lease-partiti.patch.gz +0 -0
  55. package/dsh-host-patch/sources/rc3/0008-feat-desktop-adopt-native-children-in-admitted-sideb.patch.gz +0 -0
  56. package/dsh-host-patch/sources/rc3/0009-fix-desktop-publish-complete-native-child-close-reco.patch.gz +0 -0
  57. package/dsh-host-patch/sources/rc3/0010-fix-desktop-bundle-structured-errors-in-sandboxed-pr.patch.gz +0 -0
  58. package/dsh-host-patch/sources/rc3/0011-feat-desktop-offer-persistent-Sidebar-sessions-per-D.patch.gz +0 -0
  59. package/dsh-host-patch/sources/rc3/0012-feat-desktop-retain-sidebar-session-cookies-across-r.patch.gz +0 -0
  60. package/dsh-host-patch/sources/rc3/0013-fix-desktop-honor-sidebar-session-cookie-sidecar-con.patch.gz +0 -0
  61. package/dsh-host-patch/sources/rc3/0014-fix-desktop-retry-cookie-protection-without-failing-.patch.gz +0 -0
  62. package/dsh-host-patch/sources/rc3/0015-fix-desktop-preserve-host-only-cookie-identity-in-se.patch.gz +0 -0
  63. package/dsh-host-patch/sources/rc3/0016-fix-desktop-restore-session-cookies-before-checkpoin.patch.gz +0 -0
  64. package/dsh-host-patch/sources/rc3/0017-fix-desktop-restore-sidebar-cookies-once-before-gues.patch.gz +0 -0
  65. package/dsh-host-patch/sources/rc3/0018-fix-sidebar-right-follow-animated-native-slot-placem.patch.gz +0 -0
  66. package/dsh-host-patch/sources/rc5/0001-feat-sidebar-right-add-session-rendering-holds.patch.gz +0 -0
  67. package/dsh-host-patch/sources/rc5/0002-feat-desktop-load-trusted-profile-main-extensions.patch.gz +0 -0
  68. package/dsh-host-patch/sources/rc5/0003-feat-desktop-report-resolved-and-running-main-extens.patch.gz +0 -0
  69. package/dsh-host-patch/sources/rc5/0004-feat-desktop-compose-admitted-native-sidebar-views.patch.gz +0 -0
  70. package/dsh-host-patch/sources/rc5/0005-fix-client-admit-coded-browser-errors-in-native-comp.patch.gz +0 -0
  71. package/dsh-host-patch/sources/rc5/0006-fix-desktop-acknowledge-native-same-document-navigat.patch.gz +0 -0
  72. package/dsh-host-patch/sources/rc5/0007-fix-desktop-restore-auth-in-the-native-lease-partiti.patch.gz +0 -0
  73. package/dsh-host-patch/sources/rc5/0008-feat-desktop-adopt-native-children-in-admitted-sideb.patch.gz +0 -0
  74. package/dsh-host-patch/sources/rc5/0009-fix-desktop-publish-complete-native-child-close-reco.patch.gz +0 -0
  75. package/dsh-host-patch/sources/rc5/0010-fix-desktop-bundle-structured-errors-in-sandboxed-pr.patch.gz +0 -0
  76. package/dsh-host-patch/sources/rc5/0011-feat-desktop-offer-persistent-Sidebar-sessions-per-D.patch.gz +0 -0
  77. package/dsh-host-patch/sources/rc5/0012-feat-desktop-retain-sidebar-session-cookies-across-r.patch.gz +0 -0
  78. package/dsh-host-patch/sources/rc5/0013-fix-desktop-honor-sidebar-session-cookie-sidecar-con.patch.gz +0 -0
  79. package/dsh-host-patch/sources/rc5/0014-fix-desktop-retry-cookie-protection-without-failing-.patch.gz +0 -0
  80. package/dsh-host-patch/sources/rc5/0015-fix-desktop-preserve-host-only-cookie-identity-in-se.patch.gz +0 -0
  81. package/dsh-host-patch/sources/rc5/0016-fix-desktop-restore-session-cookies-before-checkpoin.patch.gz +0 -0
  82. package/dsh-host-patch/sources/rc5/0017-fix-desktop-restore-sidebar-cookies-once-before-gues.patch.gz +0 -0
  83. package/dsh-host-patch/sources/rc5/0018-fix-sidebar-right-follow-animated-native-slot-placem.patch.gz +0 -0
  84. package/dsh-host-patch/sources/series.json +260 -0
  85. package/dsh-host-patch/tauri/desktop-main.cjs +62 -0
  86. package/dsh-host-patch/tauri/sidebar-session.cjs +104 -0
  87. package/dsh-host-patch/tauri-revision1.json +39 -0
  88. package/dsh-host-patch/tauri.json +43 -0
  89. package/dsh-host-patch/v023-alpha2.json +153 -0
  90. package/lib/browser/anti-bot.js +215 -0
  91. package/lib/browser/deep-dom.js +39 -0
  92. package/lib/browser/runtime.js +15 -0
  93. package/lib/browser/takeover-target.js +13 -6
  94. package/lib/browser/types.js +30 -1
  95. package/lib/browser-electron/authenticated-route.js +16 -2
  96. package/lib/browser-electron/automatic-maintenance.js +16 -10
  97. package/lib/browser-electron/bridge-connection.js +3 -8
  98. package/lib/browser-electron/bridge-install.js +2 -1
  99. package/lib/browser-electron/bridge-status.js +55 -26
  100. package/lib/browser-electron/desktop-bridge-host.js +7 -6
  101. package/lib/browser-electron/desktop-identity.js +28 -5
  102. package/lib/browser-electron/desktop-shell.js +64 -0
  103. package/lib/browser-electron/electron-provision.js +105 -18
  104. package/lib/browser-electron/entry.js +129 -46
  105. package/lib/browser-electron/extension-browser.js +4 -4
  106. package/lib/browser-electron/foreground-watch.js +134 -0
  107. package/lib/browser-electron/guest-cookie-jar.js +13 -13
  108. package/lib/browser-electron/guest-route.js +181 -32
  109. package/lib/browser-electron/guest-runtime.js +61 -10
  110. package/lib/browser-electron/guest-storage.js +2 -2
  111. package/lib/browser-electron/history-store.js +1 -5
  112. package/lib/browser-electron/host-main.js +8 -4
  113. package/lib/browser-electron/host-patch-maintenance.js +14 -8
  114. package/lib/browser-electron/maintenance-route.js +2 -1
  115. package/lib/browser-electron/missing-system-browser.js +5 -9
  116. package/lib/browser-electron/preferred-browser.js +7 -3
  117. package/lib/browser-electron/preview-route.js +9 -13
  118. package/lib/browser-electron/process-ownership.js +1 -1
  119. package/lib/browser-electron/profile-command.js +2 -1
  120. package/lib/browser-electron/profile-extension.js +5 -0
  121. package/lib/browser-electron/profile-lease.js +152 -47
  122. package/lib/browser-electron/provider-core.js +527 -0
  123. package/lib/browser-electron/provider-interaction.js +963 -0
  124. package/lib/browser-electron/provider-media.js +518 -0
  125. package/lib/browser-electron/provider-navigation.js +301 -0
  126. package/lib/browser-electron/provider-observation.js +623 -0
  127. package/lib/browser-electron/provider-tabs.js +372 -0
  128. package/lib/browser-electron/provider.js +150 -3301
  129. package/lib/browser-electron/reference-route.js +9 -18
  130. package/lib/browser-electron/remote-host.js +79 -34
  131. package/lib/browser-electron/runtime-status.js +56 -6
  132. package/lib/browser-electron/settings-store.js +3 -6
  133. package/lib/browser-electron/sidebar-only-host.js +1 -1
  134. package/lib/browser-electron/system-browser.js +539 -172
  135. package/lib/browser-electron/tauri-host.js +208 -0
  136. package/lib/browser-electron/virtual-cursor.js +23 -13
  137. package/lib/browser-reference/service.js +22 -4
  138. package/lib/browser-reference/web-sources.js +1 -1
  139. package/lib/client.js +43409 -0
  140. package/lib/compat/host-features.js +75 -0
  141. package/lib/reference-source.js +1 -1
  142. package/lib/reference-text.js +23 -1
  143. package/lib/takeover-protocol.js +1 -1
  144. package/lib/tool-browser/block-recovery.js +69 -0
  145. package/lib/tool-browser/code-tool.js +170 -19
  146. package/lib/tool-browser/code-worker.js +115 -20
  147. package/lib/tool-browser/errors.js +34 -0
  148. package/lib/tool-browser/index.js +66 -3593
  149. package/lib/tool-browser/page-probe.js +227 -28
  150. package/lib/tool-browser/panel-page.js +2 -1
  151. package/lib/tool-browser/probe-client.js +157 -0
  152. package/lib/tool-browser/screenshot-annotations.js +108 -0
  153. package/lib/tool-browser/state.js +337 -0
  154. package/lib/tool-browser/takeover.js +1 -1
  155. package/lib/tool-browser/tools-debug.js +862 -0
  156. package/lib/tool-browser/tools-interaction.js +993 -0
  157. package/lib/tool-browser/tools-navigation.js +807 -0
  158. package/lib/tool-browser/tools-observation.js +461 -0
  159. package/lib/tool-browser/tools-reference.js +293 -0
  160. package/lib/web-guest.js +1 -0
  161. package/package.json +16 -54
  162. package/README.en.md +0 -89
  163. package/browser-extension/constants.mjs +0 -20
  164. package/browser-extension/controller.mjs +0 -293
  165. package/browser-extension/locales.mjs +0 -15
  166. package/browser-extension/manifest.json +0 -12
  167. package/browser-extension/options.html +0 -14
  168. package/browser-extension/options.mjs +0 -9
  169. package/browser-extension/permission-guard.mjs +0 -13
  170. package/browser-extension/worker.mjs +0 -74
  171. package/dist/client.cjs +0 -43167
  172. package/lib/browser-electron/package-removal.js +0 -5
  173. package/lib/browser-reference/submission-receipts.js +0 -139
  174. package/scripts/build.mjs +0 -66
  175. package/scripts/bundle-host.mjs +0 -28
  176. package/scripts/fix-exports.mjs +0 -50
  177. package/scripts/install-electron.mjs +0 -51
  178. package/scripts/verify-exports.mjs +0 -47
  179. package/scripts/verify-preview-sdk.mjs +0 -93
  180. package/skills/dsh-builtin-browser/SKILL.md +0 -73
  181. package/skills/dsh-builtin-browser/references/batch.md +0 -53
  182. package/skills/dsh-builtin-browser/references/deliver.md +0 -31
  183. package/skills/dsh-builtin-browser/references/locate.md +0 -11
  184. package/skills/dsh-builtin-browser/references/recover.md +0 -11
  185. package/skills/dsh-builtin-browser/references/verify.md +0 -13
  186. package/skills/dsh-debug-host/SKILL.md +0 -56
  187. package/skills/dsh-debug-self/SKILL.md +0 -50
  188. package/src/bridge-compatibility.ts +0 -39
  189. package/src/browser/handles.ts +0 -89
  190. package/src/browser/runtime.ts +0 -560
  191. package/src/browser/takeover-target.ts +0 -36
  192. package/src/browser/types.ts +0 -817
  193. package/src/browser-electron/authenticated-route.ts +0 -84
  194. package/src/browser-electron/automatic-maintenance.ts +0 -726
  195. package/src/browser-electron/bridge-auto.ts +0 -159
  196. package/src/browser-electron/bridge-connection.ts +0 -385
  197. package/src/browser-electron/bridge-endpoint.ts +0 -129
  198. package/src/browser-electron/bridge-install.ts +0 -289
  199. package/src/browser-electron/bridge-maintenance.ts +0 -189
  200. package/src/browser-electron/bridge-status.ts +0 -347
  201. package/src/browser-electron/desktop-bridge-host.ts +0 -251
  202. package/src/browser-electron/desktop-identity.ts +0 -320
  203. package/src/browser-electron/document-readiness.ts +0 -45
  204. package/src/browser-electron/electron-provision.ts +0 -261
  205. package/src/browser-electron/entry.ts +0 -1301
  206. package/src/browser-electron/ephemeral-profile.ts +0 -189
  207. package/src/browser-electron/extension-browser.ts +0 -223
  208. package/src/browser-electron/extension-setup.ts +0 -67
  209. package/src/browser-electron/file-write.ts +0 -31
  210. package/src/browser-electron/guest-cookie-jar.ts +0 -176
  211. package/src/browser-electron/guest-cookie-store.ts +0 -59
  212. package/src/browser-electron/guest-css-runtime.ts +0 -76
  213. package/src/browser-electron/guest-css.ts +0 -68
  214. package/src/browser-electron/guest-route.ts +0 -568
  215. package/src/browser-electron/guest-runtime.ts +0 -357
  216. package/src/browser-electron/guest-storage-runtime.ts +0 -54
  217. package/src/browser-electron/guest-storage.ts +0 -117
  218. package/src/browser-electron/history-store.ts +0 -227
  219. package/src/browser-electron/host-main.ts +0 -1381
  220. package/src/browser-electron/host-patch-maintenance.ts +0 -112
  221. package/src/browser-electron/http-body.ts +0 -65
  222. package/src/browser-electron/json-reply.ts +0 -47
  223. package/src/browser-electron/maintenance-broker.ts +0 -166
  224. package/src/browser-electron/maintenance-lifecycle.ts +0 -91
  225. package/src/browser-electron/maintenance-route.ts +0 -67
  226. package/src/browser-electron/missing-system-browser.ts +0 -113
  227. package/src/browser-electron/open-slot.ts +0 -49
  228. package/src/browser-electron/package-removal.ts +0 -4
  229. package/src/browser-electron/paths.ts +0 -25
  230. package/src/browser-electron/preferred-browser.ts +0 -120
  231. package/src/browser-electron/preview-route.ts +0 -218
  232. package/src/browser-electron/process-ownership.ts +0 -168
  233. package/src/browser-electron/process.ts +0 -23
  234. package/src/browser-electron/profile-checkpoint.ts +0 -187
  235. package/src/browser-electron/profile-command.ts +0 -46
  236. package/src/browser-electron/profile-extension.ts +0 -124
  237. package/src/browser-electron/profile-lease.ts +0 -115
  238. package/src/browser-electron/profile-residue.ts +0 -49
  239. package/src/browser-electron/provider.ts +0 -4571
  240. package/src/browser-electron/reference-route.ts +0 -608
  241. package/src/browser-electron/remote-host.ts +0 -1462
  242. package/src/browser-electron/rpc-input.ts +0 -13
  243. package/src/browser-electron/rpc-ops.ts +0 -41
  244. package/src/browser-electron/runtime-diagnostics.ts +0 -38
  245. package/src/browser-electron/runtime-route.ts +0 -105
  246. package/src/browser-electron/runtime-status.ts +0 -242
  247. package/src/browser-electron/settings-route.ts +0 -64
  248. package/src/browser-electron/settings-store.ts +0 -589
  249. package/src/browser-electron/shortcuts-route.ts +0 -112
  250. package/src/browser-electron/sidebar-only-host.ts +0 -298
  251. package/src/browser-electron/startpage-shortcuts.ts +0 -213
  252. package/src/browser-electron/system-browser.ts +0 -1497
  253. package/src/browser-electron/timing.ts +0 -16
  254. package/src/browser-electron/virtual-cursor.ts +0 -152
  255. package/src/browser-electron/windows-system.ts +0 -24
  256. package/src/browser-reference/delivery.ts +0 -384
  257. package/src/browser-reference/entry.ts +0 -631
  258. package/src/browser-reference/export.ts +0 -339
  259. package/src/browser-reference/import.ts +0 -303
  260. package/src/browser-reference/page-script.ts +0 -1537
  261. package/src/browser-reference/service.ts +0 -1315
  262. package/src/browser-reference/store.ts +0 -172
  263. package/src/browser-reference/submission-receipts.ts +0 -122
  264. package/src/browser-reference/text-quote.ts +0 -219
  265. package/src/browser-reference/types.ts +0 -195
  266. package/src/browser-reference/visible.ts +0 -367
  267. package/src/browser-reference/web-sources.ts +0 -103
  268. package/src/client/browser/BrowserController.ts +0 -693
  269. package/src/client/browser/BrowserFrame.ts +0 -78
  270. package/src/client/browser/BrowserNavigation.ts +0 -169
  271. package/src/client/browser/BrowserPage.ts +0 -23
  272. package/src/client/browser/BrowserPersistence.ts +0 -44
  273. package/src/client/browser/IframeImpl.ts +0 -176
  274. package/src/client/browser/child-tabs.ts +0 -14
  275. package/src/client/browser/iframe-reference.ts +0 -67
  276. package/src/client/browser/initialization.ts +0 -262
  277. package/src/client/browser/omnibox.ts +0 -243
  278. package/src/client/browser/store.ts +0 -38
  279. package/src/client/browser/takeover-channel.ts +0 -72
  280. package/src/client/browser/url.ts +0 -46
  281. package/src/client/browser/web-reference-source.ts +0 -52
  282. package/src/client/css-modules.d.ts +0 -4
  283. package/src/client/definition.tsx +0 -30
  284. package/src/client/electron/ElectronWebViewImpl.ts +0 -364
  285. package/src/client/electron/ElectronWebviewPresentation.ts +0 -138
  286. package/src/client/electron/NativeChildPresentation.ts +0 -45
  287. package/src/client/electron/NativeViewPage.ts +0 -251
  288. package/src/client/electron/pages.ts +0 -23
  289. package/src/client/electron/reference-overlay.ts +0 -53
  290. package/src/client/electron/workspace.ts +0 -33
  291. package/src/client/index.ts +0 -293
  292. package/src/client/locales.ts +0 -857
  293. package/src/client/pages.ts +0 -28
  294. package/src/client/reference/client/BrowserRefLink.tsx +0 -142
  295. package/src/client/reference/client/draft-reference.ts +0 -167
  296. package/src/client/reference/client/index.ts +0 -7
  297. package/src/client/reference/client/ordered-submission.ts +0 -108
  298. package/src/client/reference/client/pending-delivery.ts +0 -216
  299. package/src/client/reference/client/plugin.ts +0 -189
  300. package/src/client/reference/client/production/ReferenceCapsules.tsx +0 -345
  301. package/src/client/reference/client/production/ReferenceDock.module.css +0 -193
  302. package/src/client/reference/client/production/ReferenceDock.tsx +0 -6
  303. package/src/client/reference/client/production/ReferenceFeedback.tsx +0 -15
  304. package/src/client/reference/client/production/ReferenceMath.tsx +0 -44
  305. package/src/client/reference/client/production/ReferenceText.tsx +0 -36
  306. package/src/client/reference/client/production/assembly.ts +0 -471
  307. package/src/client/reference/client/production/asset-store.ts +0 -144
  308. package/src/client/reference/client/production/availability.ts +0 -74
  309. package/src/client/reference/client/production/bytes.ts +0 -36
  310. package/src/client/reference/client/production/delivery-client.ts +0 -211
  311. package/src/client/reference/client/production/draft-adapter.ts +0 -508
  312. package/src/client/reference/client/production/http-transport.ts +0 -217
  313. package/src/client/reference/client/production/production-submission.ts +0 -310
  314. package/src/client/reference/client/production/protocol.ts +0 -231
  315. package/src/client/reference/client/production/reference-card.ts +0 -240
  316. package/src/client/reference/client/production/reference-labels.ts +0 -29
  317. package/src/client/reference/client/production/reply-link-bridge.ts +0 -222
  318. package/src/client/reference/client/production/reveal.ts +0 -215
  319. package/src/client/reference/client/production/runtime.ts +0 -1101
  320. package/src/client/reference/client/production/snapshot-adapter.ts +0 -154
  321. package/src/client/reference/client/production/source-marker.ts +0 -63
  322. package/src/client/reference/client/production/source-opener.ts +0 -55
  323. package/src/client/reference/client/production/styles.ts +0 -104
  324. package/src/client/reference/client/production/user-text-rule.ts +0 -58
  325. package/src/client/reference/client/reveal.ts +0 -107
  326. package/src/client/reference/client/scheme.ts +0 -114
  327. package/src/client/reference/client/types.ts +0 -168
  328. package/src/client/reference/css-modules.d.ts +0 -4
  329. package/src/client/reference/index.ts +0 -11
  330. package/src/client/reference-capture-owner.ts +0 -162
  331. package/src/client/reference-intents.ts +0 -36
  332. package/src/client/settings/index.ts +0 -34
  333. package/src/client/settings/panel.ts +0 -2657
  334. package/src/client/shortcut-open.ts +0 -30
  335. package/src/client/startpage/binding.ts +0 -99
  336. package/src/client/startpage/controller.ts +0 -303
  337. package/src/client/startpage/model.ts +0 -279
  338. package/src/client/view/Browser.module.css +0 -751
  339. package/src/client/view/BrowserBody.tsx +0 -314
  340. package/src/client/view/BrowserPresentation.ts +0 -9
  341. package/src/client/view/BrowserTitle.tsx +0 -17
  342. package/src/client/view/IframePresentation.ts +0 -344
  343. package/src/client/view/StartPage.tsx +0 -597
  344. package/src/client/view/TakeoverBanner.tsx +0 -21
  345. package/src/index.ts +0 -110
  346. package/src/reference-owner.ts +0 -5
  347. package/src/reference-page.ts +0 -9
  348. package/src/reference-source.ts +0 -3
  349. package/src/reference-text.ts +0 -197
  350. package/src/startpage-settings.ts +0 -103
  351. package/src/startpage.ts +0 -71
  352. package/src/takeover-protocol.ts +0 -19
  353. package/src/tool-browser/code-tool.ts +0 -401
  354. package/src/tool-browser/code-worker.ts +0 -639
  355. package/src/tool-browser/element-fields.ts +0 -167
  356. package/src/tool-browser/index.ts +0 -3733
  357. package/src/tool-browser/page-probe.ts +0 -474
  358. package/src/tool-browser/panel-page.ts +0 -124
  359. package/src/tool-browser/screenshot-image.ts +0 -49
  360. package/src/tool-browser/takeover.ts +0 -198
  361. package/src/types/electron-shim.d.ts +0 -144
  362. package/src/types.ts +0 -85
  363. package/src/web-guest.ts +0 -34
  364. package/tools/accept-desktop.mjs +0 -148
@@ -0,0 +1,301 @@
1
+ import { DEFAULT_OPERATION_TIMEOUT_MS } from '../../assets/browser-policy.mjs';
2
+ import { setLastOpen } from './open-slot.js';
3
+ import { forgetCursor } from './virtual-cursor.js';
4
+ import { documentReady, mainDocument } from './document-readiness.js';
5
+ import { BrowserError } from '../browser/types.js';
6
+ import { PROVIDER_TIMEOUTS, CDP_PAGE_NAVIGATE, delay, withTimeout, handleSendEvaluate } from './provider-core.js';
7
+ import { ProviderTabs } from './provider-tabs.js';
8
+ /** Poll interval for the document-settle loop. */
9
+ const SETTLE_POLL_MS = 25;
10
+ export class ProviderNavigation extends ProviderTabs {
11
+ async openUrl(session, request, signal) {
12
+ try {
13
+ setLastOpen(request.url, Date.now());
14
+ }
15
+ catch { /* best effort */ }
16
+ const s = this.session(session);
17
+ await this.prepareCarrier(signal, s.id);
18
+ if (request.newTab === true) {
19
+ this.newTab(s);
20
+ }
21
+ // A page the human already has, at the URL being asked for, is the page they mean.
22
+ //
23
+ // Reported as a defect: they opened a page by hand, then a tool call drove the plugin's own
24
+ // blank tab instead and reported nothing about the page on screen — so the obvious conclusion
25
+ // was "the page is broken", and opening the same URL again produced a SECOND tab. Reusing the
26
+ // existing page is both what the request says and what a person expects.
27
+ //
28
+ // Only an exact match after normalisation: a deliberate navigation to a different URL must not
29
+ // be redirected to whatever page happens to be open.
30
+ const tab = this.activeTab(s);
31
+ const transaction = this.beginNavigation(tab, signal);
32
+ const { navigation } = transaction;
33
+ signal = transaction.signal;
34
+ if (request.newTab !== true && await this.adoptMatchingPage(s, request.url, tab, navigation, signal))
35
+ return;
36
+ await this.navigateTab(s, tab, request.url, navigation, signal);
37
+ }
38
+ /** Navigate the active tab's view to a URL, honoring HTTP(S)-only admission. */
39
+ async navigate(session, request, signal) {
40
+ const s = this.session(session);
41
+ await this.prepareCarrier(signal, s.id);
42
+ const tab = this.activeTab(s);
43
+ const transaction = this.beginNavigation(tab, signal);
44
+ const { navigation } = transaction;
45
+ signal = transaction.signal;
46
+ await this.navigateTab(s, tab, request.url, navigation, signal);
47
+ }
48
+ beginNavigation(tab, signal) {
49
+ signal?.throwIfAborted();
50
+ const previous = tab.navigationAbort;
51
+ tab.navigation = Symbol();
52
+ tab.navigationAbort = new AbortController();
53
+ previous?.abort(Object.assign(new Error('a newer navigation was requested for this browser tab'), { code: 'panel-navigation-superseded' }));
54
+ return { navigation: tab.navigation, signal: signal === undefined ? tab.navigationAbort.signal : AbortSignal.any([signal, tab.navigationAbort.signal]) };
55
+ }
56
+ checkNavigation(tab, navigation) {
57
+ if (tab.failure !== undefined)
58
+ throw tab.failure;
59
+ if (![...this.sessions.values()].some(session => session.tabs.includes(tab))) {
60
+ throw new BrowserError('browser: the navigation guest was closed', 'BROWSER_GUEST_CLOSED');
61
+ }
62
+ if (tab.navigation !== navigation) {
63
+ throw Object.assign(new Error('a newer navigation was requested for this browser tab'), { code: 'panel-navigation-superseded' });
64
+ }
65
+ }
66
+ async navigateTab(s, tab, url, navigation, signal) {
67
+ const { handle } = tab;
68
+ this.checkNavigation(tab, navigation);
69
+ try {
70
+ if (this.httpOnly) {
71
+ let parsed;
72
+ try {
73
+ parsed = new URL(url);
74
+ }
75
+ catch {
76
+ throw new BrowserError(`browser: refusing navigation to unparseable URL "${url}"`, 'BROWSER_NAVIGATION_BLOCKED');
77
+ }
78
+ if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {
79
+ throw new BrowserError(`browser: refusing navigation to non-HTTP(S) URL "${url}"`, 'BROWSER_NAVIGATION_BLOCKED');
80
+ }
81
+ }
82
+ signal?.throwIfAborted();
83
+ // Page.navigate can hang on an unreachable/slow host; bound it like the
84
+ // evaluate paths so a wedged navigation surfaces as an error instead of
85
+ // blocking the tool call forever.
86
+ const timeoutMs = DEFAULT_OPERATION_TIMEOUT_MS;
87
+ const deadline = Date.now() + timeoutMs;
88
+ // Document identity of the page we are leaving (see settleDocument).
89
+ const before = await this.documentIdentity(handle, signal, () => { this.checkNavigation(tab, navigation); }, deadline).catch(() => undefined);
90
+ this.checkNavigation(tab, navigation);
91
+ signal?.throwIfAborted();
92
+ const result = await withTimeout(handle.sendCommand(CDP_PAGE_NAVIGATE, { url }, { deadline, signal }), Math.max(1, deadline - Date.now()), signal, `browser: navigation timed out after ${timeoutMs}ms`,
93
+ // A wedged navigation quarantines the guest. A cancelled one only stops loading:
94
+ // terminating script execution here, with no script running, would kill the next
95
+ // evaluation instead, so the tab's next operation stalls into quarantine.
96
+ timedOut => {
97
+ if (tab.navigation !== navigation)
98
+ return;
99
+ if (timedOut)
100
+ this.interrupt(handle, timedOut);
101
+ // Never initialize a guest just to stop it: a cancelled first sidebar load must not reopen the sidebar.
102
+ else
103
+ void handle.sendCommand('Page.stopLoading', undefined, { present: false, initialize: false }).catch(() => { });
104
+ });
105
+ // Page.navigate resolves even when the navigation fails; surface the
106
+ // failure instead of leaving a silent white screen.
107
+ this.checkNavigation(tab, navigation);
108
+ const errorText = result?.errorText;
109
+ if (typeof errorText === 'string' && errorText !== '') {
110
+ throw new BrowserError(`browser: navigation to "${url}" failed: ${errorText}`, 'BROWSER_NAVIGATION_FAILED');
111
+ }
112
+ signal?.throwIfAborted();
113
+ const acknowledgement = result;
114
+ if (typeof acknowledgement?.frameId !== 'string' || acknowledgement.frameId === '') {
115
+ throw new BrowserError('browser: navigation returned no frame acknowledgement', 'BROWSER_DOCUMENT_UNACKNOWLEDGED');
116
+ }
117
+ if (acknowledgement.loaderId === undefined ? before === undefined
118
+ : typeof acknowledgement.loaderId !== 'string' || acknowledgement.loaderId === '') {
119
+ throw new BrowserError('browser: navigation returned no document acknowledgement', 'BROWSER_DOCUMENT_UNACKNOWLEDGED');
120
+ }
121
+ tab.url = url;
122
+ await this.settleDocument(handle, before, signal, acknowledgement, () => { this.checkNavigation(tab, navigation); }, undefined, deadline);
123
+ this.checkNavigation(tab, navigation);
124
+ this.record(s, 'navigate', { url }, true);
125
+ this.recordVisit(s, handle);
126
+ this.showActive(s, true);
127
+ }
128
+ catch (error) {
129
+ const code = error?.code;
130
+ if (tab.navigation === navigation && (code === 'BROWSER_DOCUMENT_TIMEOUT' || code === 'BROWSER_DOCUMENT_UNACKNOWLEDGED')) {
131
+ this.quarantine(handle);
132
+ }
133
+ if (!(error instanceof BrowserError && error.code === 'BROWSER_NAVIGATION_BLOCKED')) {
134
+ this.record(s, 'navigate', { url }, false, { error: String(error) });
135
+ }
136
+ throw error;
137
+ }
138
+ }
139
+ async documentIdentity(handle, signal, checkCurrent, deadline = Date.now() + PROVIDER_TIMEOUTS.evaluation, allowErrorDocument = false) {
140
+ signal?.throwIfAborted();
141
+ checkCurrent?.();
142
+ return mainDocument(await withTimeout(handle.sendCommand('Page.getFrameTree', undefined, { present: false, initialize: false }), Math.max(1, Math.min(PROVIDER_TIMEOUTS.evaluation, deadline - Date.now())), signal, 'browser: document identity timed out', timedOut => {
143
+ try {
144
+ checkCurrent?.();
145
+ }
146
+ catch {
147
+ return;
148
+ }
149
+ this.interrupt(handle, timedOut);
150
+ }), { allowErrorDocument });
151
+ }
152
+ /**
153
+ * Page.navigate resolves at navigation COMMIT, not at load: the new document
154
+ * is already current (so location.href and document.title are the new page's)
155
+ * while its DOM is still being parsed. dsh_browser_open snapshots immediately
156
+ * after navigating, which is why it could report the right title with zero
157
+ * interactive elements — and why a separate dsh_browser_snapshot right after
158
+ * always found them.
159
+ *
160
+ * The CDP frame/loader acknowledgement, not elapsed time or URL equality,
161
+ * identifies the document whose parse readiness can complete the transaction.
162
+ */
163
+ async settleDocument(handle, before, signal, acknowledgement, checkCurrent, historyEntry, deadline = Date.now() + DEFAULT_OPERATION_TIMEOUT_MS, allowErrorDocument = false) {
164
+ // The document is being replaced, so the synthetic pointer drawn into the old one
165
+ // is gone. Dropping the remembered position is what lets it be painted again:
166
+ // without this, a paint at coincidentally identical coordinates would be skipped
167
+ // and the pointer would never come back after a navigation.
168
+ forgetCursor(handle);
169
+ for (;;) {
170
+ signal?.throwIfAborted();
171
+ checkCurrent?.();
172
+ const remaining = deadline - Date.now();
173
+ if (remaining <= 0) {
174
+ this.quarantine(handle);
175
+ throw new BrowserError('browser: the navigation document was not ready within its deadline', 'BROWSER_DOCUMENT_TIMEOUT');
176
+ }
177
+ const ready = await withTimeout((async () => {
178
+ if (historyEntry !== undefined) {
179
+ const history = await handle.sendCommand('Page.getNavigationHistory');
180
+ if (history.entries?.[history.currentIndex ?? -1]?.id !== historyEntry)
181
+ return false;
182
+ }
183
+ const current = await this.documentIdentity(handle, signal, checkCurrent, deadline, allowErrorDocument);
184
+ if (acknowledgement?.frameId !== undefined && current.id !== acknowledgement.frameId) {
185
+ throw new BrowserError('browser: navigation frame was superseded', 'BROWSER_NAVIGATION_SUPERSEDED');
186
+ }
187
+ const loader = acknowledgement?.loaderId ?? (acknowledgement === undefined ? undefined : before?.loaderId);
188
+ if (loader !== undefined && current.loaderId !== loader) {
189
+ if (current.loaderId === before?.loaderId)
190
+ return false;
191
+ throw new BrowserError('browser: navigation document was superseded', 'BROWSER_NAVIGATION_SUPERSEDED');
192
+ }
193
+ if (acknowledgement === undefined && current.loaderId === before?.loaderId)
194
+ return false;
195
+ return documentReady(handle, current, () => {
196
+ signal?.throwIfAborted();
197
+ checkCurrent?.();
198
+ if (Date.now() >= deadline) {
199
+ this.quarantine(handle);
200
+ throw new BrowserError('browser: document readiness deadline expired', 'BROWSER_DOCUMENT_TIMEOUT');
201
+ }
202
+ });
203
+ })(), remaining, signal, 'browser: document readiness timed out', timedOut => {
204
+ try {
205
+ checkCurrent?.();
206
+ }
207
+ catch {
208
+ return;
209
+ }
210
+ this.interrupt(handle, timedOut);
211
+ });
212
+ signal?.throwIfAborted();
213
+ checkCurrent?.();
214
+ if (ready)
215
+ return;
216
+ await delay(Math.min(SETTLE_POLL_MS, Math.max(0, deadline - Date.now())), signal);
217
+ }
218
+ }
219
+ /** Go back (-1) or forward (+1) in the active tab's navigation history. */
220
+ async historyStep(session, direction, signal) {
221
+ const s = this.session(session);
222
+ const tab = this.activeTab(s);
223
+ const { handle } = tab;
224
+ const transaction = this.beginNavigation(tab, signal);
225
+ const { navigation } = transaction;
226
+ signal = transaction.signal;
227
+ signal?.throwIfAborted();
228
+ const timeoutMs = DEFAULT_OPERATION_TIMEOUT_MS;
229
+ const deadline = Date.now() + timeoutMs;
230
+ const hist = await withTimeout(handle.sendCommand('Page.getNavigationHistory'), timeoutMs, signal, `browser: history read timed out after ${timeoutMs}ms`);
231
+ this.checkNavigation(tab, navigation);
232
+ const entries = hist.entries ?? [];
233
+ const currentIndex = hist.currentIndex ?? -1;
234
+ const target = currentIndex + direction;
235
+ if (target < 0 || target >= entries.length) {
236
+ // Nothing to step to; treat it as a successful no-op so the agent can
237
+ // proceed without an error dance.
238
+ this.record(s, direction === -1 ? 'back' : 'forward', {}, true);
239
+ return;
240
+ }
241
+ const entry = entries[target];
242
+ if (entry?.id === undefined)
243
+ throw new BrowserError('browser: history entry missing id', 'BROWSER_HISTORY_INVALID');
244
+ // A history step is a navigation too: the classic A→B→A redirect would
245
+ // otherwise read the outgoing document's identity (see settleDocument).
246
+ const before = await this.documentIdentity(handle, signal, () => { this.checkNavigation(tab, navigation); }, deadline, true);
247
+ const inPage = await withTimeout(handleSendEvaluate(handle, `(() => {
248
+ if (typeof navigation === 'undefined') return false;
249
+ const entry = navigation.entries().find(entry => entry.index === navigation.currentEntry.index + ${direction});
250
+ return entry?.url === ${JSON.stringify(entry.url)} && entry.sameDocument === true;
251
+ })()`), Math.max(1, deadline - Date.now()), signal, 'browser: history document identity timed out', timedOut => { this.interrupt(handle, timedOut); });
252
+ this.checkNavigation(tab, navigation);
253
+ signal?.throwIfAborted();
254
+ await withTimeout(handle.sendCommand('Page.navigateToHistoryEntry', { entryId: entry.id }), Math.max(1, deadline - Date.now()), signal, `browser: history navigation timed out after ${timeoutMs}ms`, () => { if (tab.navigation === navigation)
255
+ void handle.sendCommand('Page.stopLoading').catch(() => { }); });
256
+ await this.settleDocument(handle, before, signal, inPage.ok && inPage.value === true ? { frameId: before.id, loaderId: before.loaderId } : undefined, () => { this.checkNavigation(tab, navigation); }, entry.id, deadline, true);
257
+ this.record(s, direction === -1 ? 'back' : 'forward', {}, true);
258
+ this.recordVisit(s, handle);
259
+ this.showActive(s);
260
+ }
261
+ /** Go back in the active tab's history. */
262
+ async back(session, signal) {
263
+ return this.historyStep(session, -1, signal);
264
+ }
265
+ /** Go forward in the active tab's history. */
266
+ async forward(session, signal) {
267
+ return this.historyStep(session, 1, signal);
268
+ }
269
+ /** Reload the active tab. */
270
+ async reload(session, signal) {
271
+ const s = this.session(session);
272
+ const tab = this.activeTab(s);
273
+ const { handle } = tab;
274
+ const transaction = this.beginNavigation(tab, signal);
275
+ const { navigation } = transaction;
276
+ signal = transaction.signal;
277
+ signal?.throwIfAborted();
278
+ const timeoutMs = DEFAULT_OPERATION_TIMEOUT_MS;
279
+ const deadline = Date.now() + timeoutMs;
280
+ // Same-URL reload: only the per-load document identity can tell the new
281
+ // document from the old one, so capture it before reloading.
282
+ const before = await this.documentIdentity(handle, signal, () => { this.checkNavigation(tab, navigation); }, deadline, true);
283
+ this.checkNavigation(tab, navigation);
284
+ signal?.throwIfAborted();
285
+ await withTimeout(handle.sendCommand('Page.reload', { ignoreCache: false }), Math.max(1, deadline - Date.now()), signal, `browser: reload timed out after ${timeoutMs}ms`,
286
+ // Best-effort: cancel the reload if it wedges the debugger queue.
287
+ () => { if (tab.navigation === navigation)
288
+ void handle.sendCommand('Page.stopLoading').catch(() => { }); });
289
+ await this.settleDocument(handle, before, signal, undefined, () => { this.checkNavigation(tab, navigation); }, undefined, deadline, true);
290
+ this.record(s, 'reload', {}, true);
291
+ this.recordVisit(s, handle);
292
+ this.showActive(s);
293
+ }
294
+ /** Read the current URL of a view through CDP. */
295
+ async currentUrl(handle) {
296
+ // Bound the read: a wedged renderer would otherwise hang listTabs.
297
+ const timeoutMs = PROVIDER_TIMEOUTS.lookup;
298
+ const result = await withTimeout(handleSendEvaluate(handle, 'location.href'), timeoutMs, undefined, `browser: url read timed out after ${timeoutMs}ms`, timedOut => { this.interrupt(handle, timedOut); });
299
+ return result.ok && typeof result.value === 'string' ? result.value : '';
300
+ }
301
+ }