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,176 +0,0 @@
1
- import { getDomain } from 'tldts'
2
- import { isIP } from 'node:net'
3
- import { domainToASCII } from 'node:url'
4
-
5
- /** Guest cookies scoped by host/domain, path, expiry and Secure, separate from host cookies. */
6
- export interface StoredCookie {
7
- readonly origin: string
8
- readonly domain?: string
9
- readonly hostOnly?: boolean
10
- readonly name: string
11
- readonly value: string
12
- readonly path: string
13
- readonly secure: boolean
14
- readonly httpOnly?: boolean
15
- readonly sameSite?: 'strict' | 'lax' | 'none'
16
- readonly expiresAt?: number
17
- }
18
-
19
- type ScopedCookie = StoredCookie & { readonly domain: string; readonly hostOnly: boolean }
20
-
21
- function domainMatches(host: string, domain: string): boolean {
22
- return host === domain || (isIP(host.replace(/^\[|\]$/gu, '')) === 0 && host.endsWith('.' + domain))
23
- }
24
-
25
- function canonicalDomain(value: string): string | undefined {
26
- if (value === '' || value.endsWith('.') || /[\s/\\:?#@\[\]%]/u.test(value)) return undefined
27
- return domainToASCII(value).toLowerCase() || undefined
28
- }
29
-
30
- function trimCookieWhitespace(value: string): string {
31
- return value.replace(/^[ \t]+|[ \t]+$/gu, '')
32
- }
33
-
34
- function validCookiePair(name: string, value: string): boolean {
35
- return name.length + value.length > 0 && name.length + value.length <= 4096
36
- && !/[^\x20-\xff]|[\x7f;=]/u.test(name)
37
- && !/[^\x20-\xff]|[\x7f;]/u.test(value)
38
- }
39
-
40
- export function normalizeStoredCookie(input: unknown): ScopedCookie | undefined {
41
- if (input === null || typeof input !== 'object') return undefined
42
- const c = input as Record<string, unknown>
43
- if (typeof c.origin !== 'string' || typeof c.name !== 'string' || typeof c.value !== 'string'
44
- || typeof c.path !== 'string' || typeof c.secure !== 'boolean'
45
- || (c.httpOnly !== undefined && typeof c.httpOnly !== 'boolean')
46
- || (c.sameSite !== undefined && !['strict', 'lax', 'none'].includes(String(c.sameSite)))
47
- || (c.expiresAt !== undefined && (typeof c.expiresAt !== 'number' || !Number.isFinite(c.expiresAt)))
48
- || !c.path.startsWith('/') || /[\x00-\x1f\x7f]/u.test(c.path)) return undefined
49
- const name = trimCookieWhitespace(c.name), value = trimCookieWhitespace(c.value)
50
- if (!validCookiePair(name, value) || (name === '' && /^(?:__Secure-|__Host-|__Http-)/iu.test(value))) return undefined
51
- try {
52
- const url = new URL(c.origin)
53
- const legacy = c.domain === undefined && c.hostOnly === undefined
54
- if (!legacy && (typeof c.domain !== 'string' || typeof c.hostOnly !== 'boolean')) return undefined
55
- const domain = legacy || (c.hostOnly === true && c.domain === url.hostname) ? url.hostname : canonicalDomain(c.domain as string)
56
- if (domain === undefined || !domainMatches(url.hostname, domain)) return undefined
57
- const hostOnly = legacy || c.hostOnly === true || getDomain(domain, { allowPrivateDomains: true }) === null
58
- if (hostOnly && domain !== url.hostname) return undefined
59
- if (!['http:', 'https:'].includes(url.protocol) || url.username || url.password
60
- || url.pathname !== '/' || url.search || url.hash || (c.secure && url.protocol !== 'https:')
61
- || (/^__Secure-/iu.test(name) && !c.secure)
62
- || (/^__Host-/iu.test(name) && (!c.secure || c.path !== '/' || !hostOnly || c.hostOnly === false))
63
- || (/^__(?:Host-)?Http-/iu.test(name) && (!c.secure || !c.httpOnly))
64
- || (c.sameSite === 'none' && !c.secure)) return undefined
65
- return { origin: url.origin, domain, hostOnly, name, value, path: c.path, secure: c.secure,
66
- httpOnly: c.httpOnly !== false, sameSite: c.sameSite as StoredCookie['sameSite'],
67
- expiresAt: c.expiresAt as number | undefined }
68
- } catch { return undefined }
69
- }
70
-
71
- function defaultPath(pathname: string): string {
72
- const lastSlash = pathname.lastIndexOf('/')
73
- return lastSlash <= 0 ? '/' : pathname.slice(0, lastSlash)
74
- }
75
-
76
- function pathMatches(pathname: string, path: string): boolean {
77
- return pathname === path || (pathname.startsWith(path) && (path.endsWith('/') || pathname[path.length] === '/'))
78
- }
79
-
80
- export class GuestCookieJar {
81
- private readonly store = new Map<string, ScopedCookie>()
82
-
83
- constructor(private readonly changed?: (cookies: readonly StoredCookie[]) => void, saved: readonly StoredCookie[] = []) {
84
- for (const value of saved) {
85
- const cookie = normalizeStoredCookie(value)
86
- if (cookie !== undefined && (cookie.expiresAt === undefined || cookie.expiresAt > Date.now())) {
87
- this.store.set(String(this.store.size), cookie)
88
- }
89
- }
90
- }
91
-
92
- private save(): void {
93
- this.changed?.([...this.store.values()].filter(cookie => cookie.expiresAt === undefined || cookie.expiresAt > Date.now()))
94
- }
95
-
96
- setCookies(target: URL, values: readonly string[], script = false): void {
97
- const now = Date.now()
98
- for (const raw of values) {
99
- if (/[\x00-\x08\x0a-\x1f\x7f]/u.test(raw)) continue
100
- const [pair = '', ...attributes] = raw.split(';').map(trimCookieWhitespace)
101
- const index = pair.indexOf('=')
102
- const name = index === -1 ? '' : trimCookieWhitespace(pair.slice(0, index))
103
- const value = trimCookieWhitespace(index === -1 ? pair : pair.slice(index + 1))
104
- if (!validCookiePair(name, value)) continue
105
- let path = defaultPath(target.pathname), secure = false, httpOnly = false, domain: string | undefined
106
- let sameSite: StoredCookie['sameSite'], explicitRoot = false
107
- let expires: number | undefined, maxAge: number | undefined
108
- let validAttributes = true
109
- for (const attribute of attributes) {
110
- const equals = attribute.indexOf('=')
111
- const key = trimCookieWhitespace(equals === -1 ? attribute : attribute.slice(0, equals)).toLowerCase()
112
- const content = equals === -1 ? '' : trimCookieWhitespace(attribute.slice(equals + 1))
113
- if (/[\x00-\x1f\x7f]/u.test(key + content)) { validAttributes = false; break }
114
- if (key === 'domain' && content !== '') domain = content.replace(/^\./u, '').toLowerCase()
115
- else if (key === 'path') { path = content.startsWith('/') ? content : defaultPath(target.pathname); explicitRoot = content === '/' }
116
- else if (key === 'secure') secure = true
117
- else if (key === 'httponly') httpOnly = true
118
- else if (key === 'samesite') sameSite = ['strict', 'lax', 'none'].includes(content.toLowerCase()) ? content.toLowerCase() as StoredCookie['sameSite'] : undefined
119
- else if (key === 'max-age' && /^-?\d+$/u.test(content)) maxAge = Math.min(Number(content), 400 * 86400)
120
- else if (key === 'expires' && Number.isFinite(Date.parse(content))) expires = Date.parse(content)
121
- }
122
- const scopedDomain = domain === undefined ? target.hostname : canonicalDomain(domain)
123
- if (!validAttributes || scopedDomain === undefined || !domainMatches(target.hostname, scopedDomain)) continue
124
- const hostOnly = domain === undefined || getDomain(scopedDomain, { allowPrivateDomains: true }) === null
125
- if (hostOnly && scopedDomain !== target.hostname) continue
126
- if (script && httpOnly) continue
127
- if (secure && target.protocol !== 'https:') continue
128
- if (/^__Secure-/iu.test(name) && !secure) continue
129
- if (/^__Host-/iu.test(name) && (!secure || domain !== undefined || !explicitRoot)) continue
130
- if (/^__(?:Host-)?Http-/iu.test(name) && (!secure || !httpOnly)) continue
131
- const cookie = normalizeStoredCookie({ origin: target.origin, domain: scopedDomain, hostOnly, name, value, path, secure, httpOnly, sameSite,
132
- expiresAt: maxAge === undefined ? expires : maxAge <= 0 ? 0 : now + maxAge * 1000 })
133
- if (cookie === undefined) continue
134
- const matching = [...this.store].filter(([, entry]) => entry.domain === cookie.domain && entry.path === path && entry.name === name)
135
- if (script && matching.some(([, entry]) => entry.httpOnly && (entry.expiresAt === undefined || entry.expiresAt > now))) continue
136
- if (target.protocol !== 'https:' && [...this.store.values()].some(entry => entry.secure && entry.name === name
137
- && (entry.expiresAt === undefined || entry.expiresAt > now)
138
- && (domainMatches(cookie.domain, entry.domain) || domainMatches(entry.domain, cookie.domain))
139
- && pathMatches(path, entry.path))) continue
140
- const key = matching[0]?.[0] ?? cookie.domain + '\0' + path + '\0' + name
141
- for (const [other] of matching) if (other !== key) this.store.delete(other)
142
- if (cookie.expiresAt !== undefined && cookie.expiresAt <= now) this.store.delete(key)
143
- else this.store.set(key, cookie)
144
- }
145
- if (values.length > 0) this.save()
146
- }
147
-
148
- getDocumentCookie(target: URL): string { return this.getCookieHeader(target, true) ?? '' }
149
-
150
- setDocumentCookie(target: URL, value: string): void { this.setCookies(target, [value], true) }
151
-
152
- getCookieHeader(target: URL, script = false, context?: { readonly site: URL; readonly topLevel: boolean; readonly method: string }): string | undefined {
153
- const now = Date.now()
154
- const matched: StoredCookie[] = []
155
- for (const [key, value] of this.store) {
156
- const cookie = normalizeStoredCookie(value)
157
- if (cookie === undefined || (cookie.expiresAt !== undefined && cookie.expiresAt <= now)) {
158
- this.store.delete(key)
159
- continue
160
- }
161
- if ((cookie.hostOnly ? cookie.domain !== target.hostname : !domainMatches(target.hostname, cookie.domain))
162
- || (cookie.secure && target.protocol !== 'https:')
163
- || (script && cookie.httpOnly)
164
- || !pathMatches(target.pathname, cookie.path)) continue
165
- if (!script && context !== undefined) {
166
- const site = (url: URL): string => url.protocol + '//' + (getDomain(url.hostname, { allowPrivateDomains: true }) ?? url.hostname)
167
- const crossSite = site(context.site) !== site(target)
168
- if (crossSite && cookie.sameSite !== 'none'
169
- && (cookie.sameSite === 'strict' || !context.topLevel || !['GET', 'HEAD', 'OPTIONS', 'TRACE'].includes(context.method))) continue
170
- }
171
- matched.push(cookie)
172
- }
173
- matched.sort((a, b) => b.path.length - a.path.length)
174
- return matched.length === 0 ? undefined : matched.map(cookie => cookie.name === '' ? cookie.value : cookie.name + '=' + cookie.value).join('; ')
175
- }
176
- }
@@ -1,59 +0,0 @@
1
- import { BROWSER_PROFILE_DIR } from '../../assets/browser-policy.mjs'
2
- import { randomUUID } from 'node:crypto'
3
- import { closeSync, constants, fchmodSync, fstatSync, fsyncSync, mkdirSync, openSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs'
4
- import { join } from 'node:path'
5
- import { GuestCookieJar, normalizeStoredCookie, type StoredCookie } from './guest-cookie-jar.ts'
6
- import { dshHome } from './paths.ts'
7
-
8
- export function loadGuestCookies(directory: string): GuestCookieJar {
9
- const file = join(directory, 'cookies.json')
10
- let saved: StoredCookie[] = []
11
- try {
12
- let fd: number | undefined
13
- try {
14
- fd = openSync(file, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0))
15
- if (!fstatSync(fd).isFile()) throw new Error()
16
- fchmodSync(fd, 0o600)
17
- const data: unknown = JSON.parse(readFileSync(fd, 'utf8'))
18
- if (data === null || typeof data !== 'object') throw new Error()
19
- const record = data as Record<string, unknown>
20
- if (record.version !== 1 || !Array.isArray(record.cookies)) throw new Error()
21
- saved = record.cookies.flatMap(value => {
22
- const cookie = normalizeStoredCookie(value)
23
- return cookie !== undefined && (cookie.expiresAt === undefined || cookie.expiresAt > Date.now()) ? [cookie] : []
24
- })
25
- } finally { if (fd !== undefined) closeSync(fd) }
26
- } catch {}
27
- const persist = (cookies: readonly StoredCookie[]) => {
28
- const temporary = file + '.' + randomUUID() + '.tmp'
29
- let fd: number | undefined
30
- try {
31
- mkdirSync(directory, { recursive: true, mode: 0o700 })
32
- fd = openSync(temporary, 'wx', 0o600)
33
- fchmodSync(fd, 0o600)
34
- writeFileSync(fd, JSON.stringify({ version: 1, cookies }))
35
- fsyncSync(fd)
36
- closeSync(fd)
37
- fd = undefined
38
- renameSync(temporary, file)
39
- } catch {} finally {
40
- if (fd !== undefined) { try { closeSync(fd) } catch {} }
41
- try { rmSync(temporary, { force: true }) } catch { /* A failed write may leave an owner-only temporary file. */ }
42
- }
43
- }
44
- const jar = new GuestCookieJar(persist, saved)
45
- persist(saved)
46
- return jar
47
- }
48
-
49
- const stores = new Map<string, GuestCookieJar>()
50
-
51
- export function localGuestCookies(): GuestCookieJar {
52
- const directory = join(dshHome(), BROWSER_PROFILE_DIR, 'web-cookies')
53
- let store = stores.get(directory)
54
- if (store === undefined) {
55
- store = loadGuestCookies(directory)
56
- stores.set(directory, store)
57
- }
58
- return store
59
- }
@@ -1,76 +0,0 @@
1
- import { rewriteCss } from './guest-css.ts'
2
-
3
- export function guestCssRuntimeScript(): string {
4
- return `
5
- const cssBase = sheet => {
6
- for (let current = sheet; current; current = current.parentStyleSheet) {
7
- if (current.href) return realURL(current.href).href;
8
- }
9
- return document.baseURI ? realURL(document.baseURI).href : real;
10
- };
11
- const proxyCss = (value, base = cssBase()) => (${rewriteCss.toString()})(String(value), raw => {
12
- if (!raw.trim() || raw.trim().startsWith('#')) return undefined;
13
- try {
14
- const existing = new URL(raw, location.href);
15
- if (existing.origin === location.origin && existing.pathname === route) return undefined;
16
- const resolved = new URL(raw, base);
17
- return /^https?:$/.test(resolved.protocol) ? toProxy(resolved.href) : undefined;
18
- } catch { return undefined; }
19
- });
20
- const isStyle = node => node && node.nodeType === 1 && node.tagName === 'STYLE';
21
- const rewriteStyleText = node => {
22
- if (!isStyle(node)) return;
23
- const before = node.textContent, after = proxyCss(before);
24
- if (after !== before) node.textContent = after;
25
- };
26
- for (const [name, property] of [['Node', 'textContent'], ['Node', 'nodeValue'], ['CharacterData', 'data']]) attempt(() => {
27
- const proto = window[name].prototype;
28
- const descriptor = Object.getOwnPropertyDescriptor(proto, property);
29
- if (!descriptor || !descriptor.set) return;
30
- Object.defineProperty(proto, property, Object.assign({}, descriptor, {
31
- set(value) {
32
- const css = isStyle(this) || (this.nodeType === 3 && isStyle(this.parentNode));
33
- descriptor.set.call(this, css && value != null ? proxyCss(value) : value);
34
- }
35
- }));
36
- });
37
- for (const name of ['CSSStyleSheet', 'CSSGroupingRule', 'CSSKeyframesRule']) attempt(() => {
38
- const proto = window[name].prototype;
39
- for (const method of ['insertRule', 'replace', 'replaceSync', 'appendRule', 'addRule']) {
40
- const original = proto[method];
41
- if (typeof original !== 'function') continue;
42
- proto[method] = function(...args) {
43
- const index = method === 'addRule' ? 1 : 0;
44
- if (args.length > index) args[index] = proxyCss(args[index], cssBase(this.parentStyleSheet || this));
45
- return original.apply(this, args);
46
- };
47
- }
48
- });
49
- attempt(() => {
50
- const proto = CSSStyleDeclaration.prototype, original = proto.setProperty;
51
- proto.setProperty = function(name, value, priority) {
52
- return original.call(this, name, value == null ? value : proxyCss(value, cssBase(this.parentRule?.parentStyleSheet)), priority);
53
- };
54
- for (const property of Object.getOwnPropertyNames(proto)) {
55
- const descriptor = Object.getOwnPropertyDescriptor(proto, property);
56
- if (!descriptor?.set) continue;
57
- Object.defineProperty(proto, property, Object.assign({}, descriptor, {
58
- set(value) { descriptor.set.call(this, value == null ? value : proxyCss(value, cssBase(this.parentRule?.parentStyleSheet))); }
59
- }));
60
- }
61
- });
62
- for (const name of ['HTMLElement', 'SVGElement']) attempt(() => {
63
- const proto = window[name].prototype, descriptor = Object.getOwnPropertyDescriptor(proto, 'style');
64
- if (!descriptor?.set) return;
65
- Object.defineProperty(proto, 'style', Object.assign({}, descriptor, {
66
- set(value) { descriptor.set.call(this, value == null ? value : proxyCss(value)); }
67
- }));
68
- });
69
- attempt(() => {
70
- const original = Element.prototype.insertAdjacentText;
71
- Element.prototype.insertAdjacentText = function(position, value) {
72
- return original.call(this, position, isStyle(this) ? proxyCss(value) : value);
73
- };
74
- });
75
- `
76
- }
@@ -1,68 +0,0 @@
1
- export function rewriteCss(css: string, proxy: (url: string) => string | undefined): string {
2
- const scanner = {
3
- decode(value: string): string { return value.replace(/\\(?:([\da-f]{1,6})(?:\r\n|[ \t\r\n\f])?|(\r\n|[\r\n\f])|([\s\S]))/giu,
4
- (_match, hex: string | undefined, newline: string | undefined, literal: string) => {
5
- if (hex === undefined) return newline === undefined ? literal : ''
6
- const point = Number.parseInt(hex, 16)
7
- return point === 0 || point > 0x10ffff || (point >= 0xd800 && point <= 0xdfff) ? '\ufffd' : String.fromCodePoint(point)
8
- }) },
9
- stringEnd(start: number): number {
10
- const quote = css[start]
11
- let end = start + 1
12
- while (end < css.length) {
13
- if (css[end] === '\\') { end += 2; continue }
14
- if (css[end++] === quote) return end
15
- }
16
- return end
17
- },
18
- replacement(raw: string): string | undefined { return proxy(this.decode(raw)) },
19
- }
20
- const functions: string[] = []
21
- let result = '', position = 0, importing = false
22
- while (position < css.length) {
23
- if (css.startsWith('/*', position)) {
24
- const close = css.indexOf('*/', position + 2)
25
- const end = close === -1 ? css.length : close + 2
26
- result += css.slice(position, end); position = end; continue
27
- }
28
- const character = css[position]!
29
- if (/\s/u.test(character)) { result += character; position++; continue }
30
- if (character === '"' || character === "'") {
31
- const end = scanner.stringEnd(position)
32
- const next = css[end - 1] === character && (importing || /^(?:-webkit-)?image-set$/iu.test(functions.at(-1) ?? ''))
33
- ? scanner.replacement(css.slice(position + 1, end - 1)) : undefined
34
- result += next === undefined ? css.slice(position, end) : `"${next}"`
35
- importing = false; position = end; continue
36
- }
37
- const identifier = /^[-\w]+/u.exec(css.slice(position))?.[0]
38
- if (character === '@' && /^@import\b/iu.test(css.slice(position))) {
39
- result += css.slice(position, position + 7); position += 7; importing = true; continue
40
- }
41
- if (identifier !== undefined) {
42
- const start = position
43
- position += identifier.length
44
- if (css[position] !== '(') { result += identifier; importing = false; continue }
45
- position++
46
- if (identifier.toLowerCase() !== 'url') {
47
- functions.push(identifier); result += css.slice(start, position); importing = false; continue
48
- }
49
- while (/\s/u.test(css[position] ?? '') && position < css.length) position++
50
- const quoted = css[position] === '"' || css[position] === "'"
51
- const valueStart = position
52
- if (quoted) position = scanner.stringEnd(position)
53
- else while (position < css.length && css[position] !== ')') position += css[position] === '\\' ? 2 : 1
54
- const valueEnd = position
55
- while (/\s/u.test(css[position] ?? '') && position < css.length) position++
56
- if (css[position] !== ')') { result += css.slice(start, position); importing = false; continue }
57
- const raw = quoted ? css.slice(valueStart + 1, valueEnd - 1) : css.slice(valueStart, valueEnd).trim()
58
- const next = scanner.replacement(raw)
59
- position++
60
- result += next === undefined ? css.slice(start, position) : `url("${next}")`
61
- importing = false; continue
62
- }
63
- if (character === ')') functions.pop()
64
- else if (character === '(') functions.push('')
65
- result += character; position++; importing = false
66
- }
67
- return result
68
- }