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
@@ -1,222 +0,0 @@
1
- /**
2
- * Intercepts canonical browser-reference anchors emitted by markdown renderers.
3
- * It updates only link attributes, leaving React-owned text nodes intact.
4
- * User-message markers are parsed separately by the registered user-text rule.
5
- * Primary activation invokes the runtime revealer; modified and auxiliary
6
- * clicks suppress custom-scheme navigation. Ordinary HTTP(S) links retain
7
- * their host behavior.
8
- */
9
- import { parseBrowserRefUri } from '../scheme.ts'
10
-
11
- /** Only canonical browser-reference destinations are intercepted. */
12
- export const REPLY_LINK_SELECTOR = 'a[href^="dsh-browser-ref:"]'
13
- /** Attribute used for styling / diagnostic queries in the live DOM. */
14
- export const REPLY_LINK_STATE_ATTR = 'data-dsh-browser-ref'
15
- export const REPLY_LINK_TITLE_AVAILABLE = '回到网页原文'
16
- export const REPLY_LINK_TITLE_UNAVAILABLE = '这条引用已不在当前会话中,无法回到原文'
17
-
18
- export type ReplyLinkDecoration = 'available' | 'unavailable' | 'invalid'
19
-
20
- export interface ReplyLinkBridgeOptions {
21
- /** Host document; omit in a non-DOM host (unit tests / SSR). */
22
- readonly doc?: Document
23
- /** Whether this reference can be revealed in the current conversation. */
24
- readonly isAvailable: (uri: string) => boolean
25
- /** Primary activation; the runtime decides the outcome and shows feedback. */
26
- readonly activate: (uri: string) => void
27
- readonly mountCard?: (uri: string, anchor: HTMLElement) => (() => void) | undefined
28
- }
29
-
30
- export interface ReplyLinkBridge {
31
- readonly installed: boolean
32
- /** Decorate every matching anchor in a subtree; returns the number decorated. */
33
- scan(root?: ParentNode): number
34
- dispose(): void
35
- }
36
-
37
- interface ClosestElement {
38
- closest?: (selector: string) => Element | null
39
- matches?: (selector: string) => boolean
40
- getAttribute(name: string): string | null
41
- setAttribute(name: string, value: string): void
42
- }
43
-
44
- /** Compute the decoration for one href WITHOUT touching the DOM. */
45
- function decorationFor(uri: string, isAvailable: (uri: string) => boolean): ReplyLinkDecoration {
46
- if (parseBrowserRefUri(uri) === undefined) return 'invalid'
47
- return isAvailable(uri) ? 'available' : 'unavailable'
48
- }
49
-
50
- /** Write only OUR attributes; a host-provided tooltip is never overwritten. */
51
- function writeDecoration(anchor: ClosestElement, decoration: Exclude<ReplyLinkDecoration, 'invalid'>): void {
52
- anchor.setAttribute(REPLY_LINK_STATE_ATTR, decoration)
53
- anchor.setAttribute('aria-disabled', decoration === 'available' ? 'false' : 'true')
54
- if ((anchor.getAttribute('title') ?? '') === '') {
55
- anchor.setAttribute('title', decoration === 'available' ? REPLY_LINK_TITLE_AVAILABLE : REPLY_LINK_TITLE_UNAVAILABLE)
56
- }
57
- }
58
-
59
- function queryAll(root: ParentNode): readonly Element[] {
60
- return Array.from(root.querySelectorAll(REPLY_LINK_SELECTOR))
61
- }
62
-
63
- /**
64
- * Install the bridge. Returns a no-op handle when there is no DOM, so the
65
- * assembly can call it unconditionally.
66
- */
67
- export function installReplyLinkBridge(options: ReplyLinkBridgeOptions): ReplyLinkBridge {
68
- const doc = options.doc ?? (typeof document === 'undefined' ? undefined : document)
69
- if (doc === undefined) {
70
- return { installed: false, scan: () => 0, dispose: () => {} }
71
- }
72
- // A WeakSet plus a per-node fingerprint avoids re-writing the same
73
- // attributes for an anchor that was already decorated (an O(N^2) storm when
74
- // a streamed batch is scanned repeatedly). The fingerprint includes the href
75
- // and availability, so a CHANGED href (or a session switch) is decorated again.
76
- const decorated = new WeakSet<Element>()
77
- const decoratedKey = new WeakMap<Element, string>()
78
-
79
- const decorateOne = (anchor: Element): ReplyLinkDecoration => {
80
- const typed = anchor as unknown as ClosestElement
81
- const uri = typed.getAttribute('href') ?? ''
82
- const decoration = decorationFor(uri, options.isAvailable)
83
- if (decoration === 'invalid') {
84
- decorated.delete(anchor)
85
- decoratedKey.delete(anchor)
86
- return decoration
87
- }
88
- const key = `${uri}\u0000${decoration}`
89
- if (decorated.has(anchor) && decoratedKey.get(anchor) === key) return decoration
90
- writeDecoration(typed, decoration)
91
- decorated.add(anchor)
92
- decoratedKey.set(anchor, key)
93
- return decoration
94
- }
95
-
96
- const scan = (root: ParentNode = doc): number => {
97
- let count = 0
98
- const self = root as ParentNode & ClosestElement
99
- if (typeof self.matches === 'function' && typeof self.getAttribute === 'function'
100
- && self.matches(REPLY_LINK_SELECTOR) && decorateOne(root as Element) !== 'invalid') count += 1
101
- for (const anchor of queryAll(root)) {
102
- if (decorateOne(anchor) !== 'invalid') count += 1
103
- }
104
- return count
105
- }
106
-
107
- const onClick = (event: Event): void => {
108
- if (event.defaultPrevented) return
109
- const typed = event as MouseEvent
110
- const target = typed.target as (Element & ClosestElement) | null
111
- const anchor = target?.closest(REPLY_LINK_SELECTOR) ?? null
112
- if (anchor === null) return
113
- const uri = anchor.getAttribute('href') ?? ''
114
- // A custom scheme must never reach the browser's navigation/protocol layer,
115
- // even for a malformed destination we cannot activate.
116
- typed.preventDefault()
117
- if (parseBrowserRefUri(uri) === undefined) return
118
- if (typed.button !== 0 || typed.ctrlKey || typed.metaKey || typed.shiftKey || typed.altKey) return
119
- typed.stopPropagation()
120
- options.activate(uri)
121
- }
122
-
123
- let activeAnchor: Element | undefined
124
- let unmountCard: (() => void) | undefined
125
- const clearCard = (): void => {
126
- const unmount = unmountCard
127
- activeAnchor = undefined
128
- unmountCard = undefined
129
- unmount?.()
130
- }
131
- const onOver = (event: Event): void => {
132
- const target = event.target as Element | null
133
- const anchor = target && typeof (target as ClosestElement).closest === 'function'
134
- ? (target as ClosestElement).closest?.(REPLY_LINK_SELECTOR) ?? null
135
- : null
136
- if (anchor === null || anchor === activeAnchor) return
137
- clearCard()
138
- activeAnchor = anchor
139
- unmountCard = options.mountCard?.(anchor.getAttribute('href') ?? '', anchor as HTMLElement)
140
- }
141
- const onKeyDown = (event: Event): void => {
142
- const typed = event as KeyboardEvent
143
- if (typed.defaultPrevented || (typed.key !== 'Enter' && typed.key !== ' ')) return
144
- const anchor = (typed.target as Element | null)?.closest?.(REPLY_LINK_SELECTOR)
145
- if (anchor == null) return
146
- typed.preventDefault()
147
- const uri = anchor.getAttribute('href') ?? ''
148
- if (typed.ctrlKey || typed.metaKey || typed.shiftKey || typed.altKey || parseBrowserRefUri(uri) === undefined) return
149
- typed.stopPropagation()
150
- options.activate(uri)
151
- }
152
- doc.addEventListener('pointerover', onOver, true)
153
- doc.addEventListener('focusin', onOver, true)
154
- doc.addEventListener('keydown', onKeyDown, true)
155
-
156
- doc.addEventListener('click', onClick, true)
157
- doc.addEventListener('auxclick', onClick, true)
158
- scan()
159
-
160
- const observer = typeof MutationObserver === 'undefined'
161
- ? undefined
162
- : new MutationObserver((records) => {
163
- if (activeAnchor !== undefined && !activeAnchor.isConnected) clearCard()
164
- for (const record of records) {
165
- // Streamed rendering assigns `href` AFTER the anchor already exists in
166
- // the DOM. An attribute record (filtered to href) is the only way to
167
- // see that; childList alone never fires for a late attribute write.
168
- if (record.type === 'attributes') {
169
- const target = record.target
170
- if (target === activeAnchor) clearCard()
171
- if (target.nodeType === 1) {
172
- const element = target as Element & ClosestElement
173
- if (typeof element.matches === 'function' && element.matches(REPLY_LINK_SELECTOR)) {
174
- decorateOne(target as Element)
175
- }
176
- }
177
- continue
178
- }
179
- // React reuses a text node and writes a new value into it (streaming /
180
- // state update): re-decorate only that node, never its parent.
181
- for (const node of record.addedNodes) {
182
- // A plain-text host may insert the marker as a bare text node.
183
- if (node.nodeType !== 1) continue
184
- const element = node as Element
185
- const self = element as Element & ClosestElement
186
- if (typeof self.matches === 'function' && self.matches(REPLY_LINK_SELECTOR)) {
187
- decorateOne(element)
188
- }
189
- scan(element)
190
- }
191
- }
192
- })
193
- const observeRoot = doc.documentElement
194
- try {
195
- observer?.observe(observeRoot, {
196
- childList: true,
197
- subtree: true,
198
- attributes: true,
199
- // Writing our own state/title/aria attributes must NOT retrigger this
200
- // observer; only a late `href` assignment should.
201
- attributeFilter: ['href'],
202
- // Plain-text user messages (and streamed updates) change text in place.
203
- })
204
- } catch { /* non-DOM host */ }
205
-
206
- let disposed = false
207
- return {
208
- installed: true,
209
- scan,
210
- dispose() {
211
- if (disposed) return
212
- disposed = true
213
- doc.removeEventListener('click', onClick, true)
214
- doc.removeEventListener('auxclick', onClick, true)
215
- doc.removeEventListener('pointerover', onOver, true)
216
- doc.removeEventListener('focusin', onOver, true)
217
- doc.removeEventListener('keydown', onKeyDown, true)
218
- clearCard()
219
- observer?.disconnect()
220
- },
221
- }
222
- }
@@ -1,215 +0,0 @@
1
- /**
2
- * Production source-reveal wiring.
3
- *
4
- * Reuses the additive `createRevealer` + `parseBrowserRefUri` +
5
- * `buildBrowserRefLinkProps` contracts. The reply-side `BrowserRefLink` (mounted
6
- * into `conversation.user.text.node` by the assembly) calls `onActivate(uri)`;
7
- * we decode the `dsh-browser-ref:` URI, resolve the frozen owner (sessionId,
8
- * browserSessionId, label/frame), validate against the CURRENT session and then
9
- * call `POST /reference/reveal`. Session-mismatch / unknown / unavailable are
10
- * surfaced as understandable statuses instead of a dead link.
11
- *
12
- * The plugin's reveal route resolves the page from the stored reference's
13
- * browserSessionId/frame itself, so the client sends `referenceId`/`partId` and
14
- * validates the identity facts locally; `apply` is a documented no-op because
15
- * the tab switch/highlight happens on the plugin (never `openUrl`/Page.navigate).
16
- *
17
- * @module dsh-browser-reference/production/reveal
18
- */
19
- import type { RevealRequest, RevealResult, RevealStatus } from '../types.ts'
20
- import { createRevealer, RevealFailed, type RevealAdapter, type RevealLocation } from '../reveal.ts'
21
- import { parseBrowserRefUri } from '../scheme.ts'
22
- import type { BrowserRefLinkSpec } from '../BrowserRefLink.tsx'
23
- import type { ReferenceHttpClient } from './http-transport.ts'
24
- import { bridgePackageError } from '../../../../bridge-compatibility.ts'
25
-
26
- /** Frozen identity of a captured reference, resolved from the stored snapshot. */
27
- export interface RevealOwner {
28
- readonly sessionId: string
29
- readonly browserSessionId: string
30
- readonly label: string
31
- readonly frameRoute?: 'main' | 'frame'
32
- readonly frameSelector?: string
33
- }
34
-
35
- export interface ProductionRevealerOptions {
36
- readonly http: ReferenceHttpClient
37
- /** Resolve a reference id to its frozen owner, or undefined when unknown. */
38
- readonly resolveOwner: (referenceId: string) => RevealOwner | undefined
39
- /** Current DSH session id (for session-mismatch validation). */
40
- readonly currentSessionId: () => string
41
- readonly onActivate?: (uri: string) => Promise<RevealStatus>
42
- /**
43
- * Report the outcome of EVERY activation (including the reply-side link's
44
- * `onActivate`, which used to call `run` directly and stay silent). The
45
- * runtime injects `showReveal` so a failed source link gets the same hint as
46
- * the document-level bridge.
47
- */
48
- readonly report?: (status: string) => void
49
- }
50
-
51
- export interface ProductionRevealer {
52
- readonly revealer: ReturnType<typeof createRevealer>
53
- /**
54
- * Decode a `dsh-browser-ref:` URI and reveal it.
55
- * @param uri - the frozen `dsh-browser-ref:` link.
56
- * @param options - `navigate` asks the plugin to move its page to the source.
57
- * @returns an understandable status.
58
- */
59
- activate(uri: string, options?: { readonly navigate?: boolean; readonly sourcePageId?: string }): Promise<RevealStatus>
60
- /** Build the dedicated button props for a reply-side link. */
61
- linkSpec(uri: string, label?: string): BrowserRefLinkSpec
62
- /** Last activation status, for the UI to render a hint. */
63
- lastStatus(): RevealStatus | undefined
64
- lastReason(): string | undefined
65
- dispose(): void
66
- }
67
-
68
- class RevealUnavailableError extends Error {}
69
-
70
- /**
71
- * Translate the plugin's answer into a client status.
72
- *
73
- * `partial` means the page WAS located and at least one part was highlighted,
74
- * so it is a success; every other non-`revealed` answer is a distinct failure
75
- * the person can act on, and is therefore named instead of being flattened.
76
- */
77
- function wireStatus(status: string | undefined): RevealStatus {
78
- switch (status) {
79
- case 'revealed':
80
- case 'ok':
81
- case 'partial':
82
- return 'revealed'
83
- case 'ambiguous':
84
- return 'ambiguous'
85
- case 'missing':
86
- return 'missing'
87
- case 'not-found':
88
- return 'not-found'
89
- case 'page-mismatch':
90
- return 'page-mismatch'
91
- case 'session-unavailable':
92
- return 'session-unavailable'
93
- default:
94
- return 'unavailable'
95
- }
96
- }
97
-
98
- /** Build a `RevealAdapter` over the plugin's reveal endpoint. */
99
- export function createRevealAdapter(options: ProductionRevealerOptions): RevealAdapter {
100
- const { http, resolveOwner, currentSessionId } = options
101
- return {
102
- validate(request: RevealRequest) {
103
- const owner = resolveOwner(request.referenceId)
104
- if (owner === undefined) return 'unknown-reference'
105
- if (owner.sessionId !== request.sessionId || request.sessionId !== currentSessionId()) {
106
- return 'session-mismatch'
107
- }
108
- return 'ok'
109
- },
110
- async locate(request: RevealRequest, _signal: AbortSignal): Promise<RevealLocation> {
111
- const owner = resolveOwner(request.referenceId)
112
- if (owner === undefined) throw new RevealUnavailableError('unknown reference')
113
- const wire = await http.reveal(request.referenceId, request.partId, request.navigate === true, request.sourcePageId)
114
- .catch((error: unknown) => { throw bridgePackageError(error) ?? error })
115
- const packageError = bridgePackageError(wire)
116
- if (packageError !== undefined) throw packageError
117
- // A transport-level refusal (ok !== true) has no cause to report; a
118
- // decoded answer always does, so it travels with the status.
119
- if (wire.ok !== true) throw new RevealUnavailableError(wire.reason ?? 'reveal was refused')
120
- const status = wireStatus(wire.status)
121
- if (status !== 'revealed') throw new RevealFailed(status, wire.reason ?? wire.note ?? wire.status)
122
- // Identity facts (owner.sessionId + browserSessionId + label/frame) are
123
- // carried for audit; the plugin resolves the actual tab from the frozen
124
- // reference server-side.
125
- return {
126
- ...(wire.tabId === undefined ? {} : { tabId: wire.tabId }),
127
- ...(wire.frameId === undefined ? {} : { frameId: wire.frameId }),
128
- detail: JSON.stringify({
129
- sessionId: owner.sessionId,
130
- browserSessionId: owner.browserSessionId,
131
- label: owner.label,
132
- ...(owner.frameRoute === undefined ? {} : { frameRoute: owner.frameRoute }),
133
- ...(owner.frameSelector === undefined ? {} : { frameSelector: owner.frameSelector }),
134
- }),
135
- }
136
- },
137
- apply(): void {
138
- // The plugin's reveal route already selects/highlights the existing tab;
139
- // this client never reloads the page and never calls openUrl.
140
- },
141
- }
142
- }
143
-
144
- /** Build the production revealer that drives `createRevealer`. */
145
- export function createProductionRevealer(options: ProductionRevealerOptions): ProductionRevealer {
146
- const revealer = createRevealer({ adapter: createRevealAdapter(options) })
147
- let last: RevealStatus | undefined
148
- let reason: string | undefined
149
-
150
- const run = async (parsed: ReturnType<typeof parseBrowserRefUri>, navigate = false, sourcePageId?: string): Promise<RevealStatus> => {
151
- reason = undefined
152
- let status: RevealStatus
153
- if (parsed === undefined) {
154
- status = 'unknown-reference'
155
- } else {
156
- const request: RevealRequest = {
157
- referenceId: parsed.referenceId,
158
- ...(parsed.partId === undefined ? {} : { partId: parsed.partId }),
159
- sessionId: options.currentSessionId(),
160
- ...sourcePageId === undefined ? {} : { sourcePageId },
161
- ...navigate ? { navigate: true } : {},
162
- }
163
- try {
164
- const result: RevealResult = await revealer.reveal(request)
165
- status = result.status
166
- reason = result.reason
167
- } catch {
168
- status = 'unavailable'
169
- }
170
- }
171
- last = status
172
- // ONE reporting channel for BOTH the bridge path and the reply-side link's
173
- // onActivate, so a failed React-rendered source link is never silent.
174
- options.report?.(status)
175
- return status
176
- }
177
-
178
- return {
179
- revealer,
180
- lastReason: () => reason,
181
- async activate(uri, activateOptions) {
182
- return run(parseBrowserRefUri(uri), activateOptions?.navigate === true, activateOptions?.sourcePageId)
183
- },
184
- linkSpec(uri, label) {
185
- const owner = (() => {
186
- const parsed = parseBrowserRefUri(uri)
187
- return parsed === undefined ? undefined : options.resolveOwner(parsed.referenceId)
188
- })()
189
- // Clickable whenever the URI is canonical. Before this, a reference whose owner was not yet loaded
190
- // in this process (a page reload, a message restored from history) rendered a DISABLED pill that
191
- // looked like a chip but did nothing — reported as "胶囊是虚假的". Resolution happens on activation,
192
- // where a genuinely missing reference can report itself.
193
- const available = parseBrowserRefUri(uri) !== undefined
194
- const spec: BrowserRefLinkSpec = {
195
- uri,
196
- available,
197
- // The sent message must keep the pill the composer showed. Without a class the reply-side
198
- // control inherits the host's default button chrome, so the reference visually degrades the
199
- // moment it is submitted. `.dsh-browser-ref-link` carries the same metrics as the composer
200
- // chip (26px tall, 999px radius, the same two theme tokens).
201
- className: 'dsh-browser-ref-link',
202
- onActivate: (activated) => {
203
- void (options.onActivate === undefined ? run(parseBrowserRefUri(activated)) : options.onActivate(activated))
204
- },
205
- ...(label === undefined ? {} : { children: label }),
206
- // Always carry a tooltip: a chip with no title reads as decoration. When the reference is not
207
- // loaded in this process yet, the tooltip still explains what the control does.
208
- title: owner === undefined ? '回到网页原文' : owner.label,
209
- }
210
- return spec
211
- },
212
- lastStatus: () => last,
213
- dispose() { revealer.dispose() },
214
- }
215
- }