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,13 +1,14 @@
1
1
  import { guestReferenceHandlerScript } from '../browser-reference/page-script.js';
2
2
  import { guestStorageScript } from './guest-storage-runtime.js';
3
3
  import { guestCssRuntimeScript } from './guest-css-runtime.js';
4
+ import { GUEST_ROUTE } from '../../assets/browser-policy.mjs';
4
5
  /** Early, self-contained interception for documents served from the guest proxy. */
5
- export function guestRuntimeScript(pageUrl, storage) {
6
+ export function guestRuntimeScript(pageUrl, storage, referrerPolicy = '') {
6
7
  return `(() => {
7
8
  if (window.__dshGuestRuntime) return;
8
9
  window.__dshGuestRuntime = true;
9
10
  let real = ${JSON.stringify(pageUrl).replace(/</gu, '\\u003c')};
10
- const route = '/dsh-builtin-browser/browser-view/isolated-guest';
11
+ const route = ${JSON.stringify(GUEST_ROUTE)};
11
12
  const attempt = fn => { try { return fn(); } catch {} };
12
13
  attempt(() => {
13
14
  const cache = { match: async () => undefined, matchAll: async () => [], keys: async () => [],
@@ -31,6 +32,13 @@ export function guestRuntimeScript(pageUrl, storage) {
31
32
  const inner = proxyURL.searchParams.get('u');
32
33
  if (inner) return new URL(inner);
33
34
  }
35
+ const own = raw === '' || /^[?#]/.test(raw) ? undefined : new URL(raw, location.href);
36
+ if (own && own.origin === location.origin && own.pathname === route && !own.searchParams.has('u')) {
37
+ const url = new URL(real);
38
+ url.search = own.search;
39
+ url.hash = own.hash;
40
+ return url;
41
+ }
34
42
  let url = new URL(raw, real);
35
43
  if (url.origin === location.origin) {
36
44
  url = new URL(url.pathname + url.search + url.hash, new URL(real).origin);
@@ -47,6 +55,23 @@ export function guestRuntimeScript(pageUrl, storage) {
47
55
  } catch { return value; }
48
56
  };
49
57
  window.__dshGuestToProxy = toProxy;
58
+ const policies = ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'same-origin', 'strict-origin', 'strict-origin-when-cross-origin', 'unsafe-url'];
59
+ const referrerPolicy = override => {
60
+ if (policies.includes(override)) return override;
61
+ const metas = attempt(() => [...document.querySelectorAll('meta[name="referrer" i]')]) || [];
62
+ const last = value => String(value || '').split(',').map(item => item.trim().toLowerCase()).reverse().find(item => policies.includes(item));
63
+ for (const meta of metas.reverse()) {
64
+ const token = last(meta.content);
65
+ if (token) return token;
66
+ }
67
+ return last(${JSON.stringify(referrerPolicy).replace(/</gu, '\\u003c')}) || '';
68
+ };
69
+ const requestInit = ['body', 'cache', 'credentials', 'duplex', 'headers', 'integrity', 'keepalive', 'method', 'mode', 'priority', 'redirect', 'referrer', 'referrerPolicy', 'signal', 'window'];
70
+ const refererHeaders = (set, override) => {
71
+ set('x-dsh-guest-referer', real);
72
+ const policy = referrerPolicy(override);
73
+ if (policy) set('x-dsh-guest-referrer-policy', policy);
74
+ };
50
75
  const nativeFetch = window.fetch && window.fetch.bind(window);
51
76
  window.__dshGuestFetch = nativeFetch;
52
77
  attempt(() => {
@@ -58,6 +83,8 @@ export function guestRuntimeScript(pageUrl, storage) {
58
83
  const headers = new Headers(init && init.headers || (isRequest ? input.headers : undefined));
59
84
  headers.set('x-dsh-guest-headers', [...headers.keys()].filter(name => !name.startsWith('x-dsh-')).join(','));
60
85
  headers.set('x-dsh-guest-sub', '1');
86
+ const source = init && requestInit.some(name => init[name] !== undefined) ? init : isRequest ? input : {};
87
+ refererHeaders((name, value) => headers.set(name, value), source.referrer === '' ? 'no-referrer' : source.referrerPolicy || '');
61
88
  const options = Object.assign({}, init, { headers, mode: 'cors', credentials: 'omit' });
62
89
  return nativeFetch(isRequest ? new Request(new URL(url, location.href), input) : url, options);
63
90
  } catch (error) { return Promise.reject(error); }
@@ -72,6 +99,7 @@ export function guestRuntimeScript(pageUrl, storage) {
72
99
  const result = open.call(this, method, toProxy(url), ...args);
73
100
  names.set(this, new Set());
74
101
  attempt(() => this.setRequestHeader('x-dsh-guest-sub', '1'));
102
+ attempt(() => refererHeaders((name, value) => this.setRequestHeader(name, value)));
75
103
  return result;
76
104
  };
77
105
  XMLHttpRequest.prototype.setRequestHeader = function(name, value) {
@@ -89,8 +117,9 @@ export function guestRuntimeScript(pageUrl, storage) {
89
117
  attempt(() => {
90
118
  navigator.sendBeacon = (url, data) => {
91
119
  try {
92
- nativeFetch(toProxy(url), { method: 'POST', body: data, keepalive: true,
93
- headers: { 'x-dsh-guest-sub': '1' } }).catch(() => {});
120
+ const headers = { 'x-dsh-guest-sub': '1' };
121
+ refererHeaders((name, value) => { headers[name] = value; });
122
+ nativeFetch(toProxy(url), { method: 'POST', body: data, keepalive: true, headers }).catch(() => {});
94
123
  return true;
95
124
  } catch { return false; }
96
125
  };
@@ -124,12 +153,17 @@ export function guestRuntimeScript(pageUrl, storage) {
124
153
  }; });
125
154
  for (const name of ['pushState', 'replaceState']) attempt(() => {
126
155
  const original = history[name];
156
+ const reason = name === 'pushState' ? 'push' : 'replace';
127
157
  history[name] = function(state, title, url) {
128
- if (url == null) return original.call(this, state, title, url);
158
+ if (url == null) {
159
+ const result = original.call(this, state, title, url);
160
+ if (name === 'pushState') report(reason);
161
+ return result;
162
+ }
129
163
  const next = attempt(() => realURL(url));
130
164
  const result = original.call(this, state, title, toProxy(url));
131
165
  if (next && /^https?:$/.test(next.protocol)) real = next.href;
132
- report();
166
+ report(reason);
133
167
  return result;
134
168
  };
135
169
  });
@@ -137,13 +171,29 @@ export function guestRuntimeScript(pageUrl, storage) {
137
171
  const documentId = String(Date.now()) + ':' + String(Math.random());
138
172
  let referenceRequestId = 0;
139
173
  const reference = ${guestReferenceHandlerScript()};
140
- const report = () => attempt(() => parent.postMessage({ type: 'dsh.browser.guest.navigation', url: real, depth: history.length, loadId, documentId, ready: document.readyState !== 'loading' }, '*'));
174
+ const navType = () => {
175
+ const entry = attempt(() => performance.getEntriesByType && performance.getEntriesByType('navigation')[0]);
176
+ return entry && typeof entry.type === 'string' ? entry.type : undefined;
177
+ };
178
+ const report = (reason) => attempt(() => {
179
+ const navigationType = navType();
180
+ parent.postMessage({
181
+ type: 'dsh.browser.guest.navigation',
182
+ url: real,
183
+ depth: history.length,
184
+ loadId,
185
+ documentId,
186
+ ready: document.readyState !== 'loading',
187
+ ...(typeof reason === 'string' && reason ? { reason } : {}),
188
+ ...(navigationType ? { navigationType } : {}),
189
+ }, '*');
190
+ });
141
191
  attempt(() => window.addEventListener('message', event => {
142
192
  if (event.source !== parent || !event.data) return;
143
193
  if (event.data.type === 'dsh.browser.guest.navigation.request') {
144
194
  if (!Number.isSafeInteger(event.data.loadId) || event.data.loadId <= 0) return;
145
195
  loadId = event.data.loadId;
146
- report();
196
+ report('sync');
147
197
  } else if (event.data.type === 'dsh.browser.guest.reference.request') {
148
198
  const data = event.data;
149
199
  if (event.origin !== location.origin || data.loadId !== loadId || loadId === undefined || data.documentId !== documentId
@@ -171,11 +221,12 @@ export function guestRuntimeScript(pageUrl, storage) {
171
221
  else if (event.data.delta === 1) history.forward();
172
222
  }
173
223
  }));
174
- attempt(() => window.addEventListener('DOMContentLoaded', report));
224
+ attempt(() => window.addEventListener('DOMContentLoaded', () => report('ready')));
225
+ attempt(() => window.addEventListener('pageshow', event => { if (event && event.persisted) report('pageshow'); }));
175
226
  attempt(() => window.addEventListener('popstate', () => {
176
227
  const next = attempt(() => realURL(location.href));
177
228
  if (next) real = next.href;
178
- report();
229
+ report('pop');
179
230
  }));
180
231
  attempt(() => {
181
232
  const proxyResource = value => {
@@ -8,11 +8,11 @@ const serialized = (partitions) => JSON.stringify([...partitions].map(([origin,
8
8
  function fail(name) { throw Object.assign(new Error(name), { name }); }
9
9
  /** Storage capabilities are issued only in browser navigation responses, never fetchable HTML. */
10
10
  export class GuestStorage {
11
- directory;
12
- quota;
13
11
  secret = randomBytes(32);
14
12
  local = new Map();
15
13
  session = new Map();
14
+ directory;
15
+ quota = 5 * 1024 * 1024;
16
16
  constructor(directory, quota = 5 * 1024 * 1024) {
17
17
  this.directory = directory;
18
18
  this.quota = quota;
@@ -38,7 +38,6 @@ export function visitedHistoryPath() {
38
38
  * a corrupted line must never hide the rest of the history.
39
39
  */
40
40
  export class HistoryStore {
41
- file;
42
41
  /** Entry count at which another batched rewrite is due. */
43
42
  pruneThreshold;
44
43
  /** Number of entries at the last full read, unknown until the first prune. */
@@ -51,10 +50,7 @@ export class HistoryStore {
51
50
  limitsChanged = false;
52
51
  maxEntries;
53
52
  maxAgeMs;
54
- /**
55
- * @param file - absolute path of the JSONL history file.
56
- * @param limits - retention overrides (entry count and age).
57
- */
53
+ file;
58
54
  constructor(file = visitedHistoryPath(), limits = {}) {
59
55
  this.file = file;
60
56
  this.maxEntries = limits.maxEntries ?? DEFAULT_MAX_ENTRIES;
@@ -35,7 +35,7 @@ import { writeFileNoReplace } from './file-write.js';
35
35
  import { electronRuntimeDiagnosticLines } from './runtime-diagnostics.js';
36
36
  import { createRpcLineReader } from './rpc-input.js';
37
37
  import { tmpdir } from 'node:os';
38
- import { join } from 'node:path';
38
+ import { isAbsolute, join } from 'node:path';
39
39
  import { withTimeoutShared } from './timing.js';
40
40
  import { dshHome } from './paths.js';
41
41
  // Report the binary actually running this child, even when ELECTRON_PATH
@@ -53,10 +53,14 @@ for (const line of electronRuntimeDiagnosticLines(process.versions)) {
53
53
  // several Electron instances sharing Roaming\Electron fight over the GPU
54
54
  // cache/session locks, which can leave the window without a display surface
55
55
  // (capturePage then fails). A dedicated userData also persists cookies across
56
- // host restarts (on top of dsh_browser_auth). Must run before app is ready.
56
+ // host restarts (on top of dsh_browser_auth) unless an ephemeral userData dir
57
+ // is passed via DSH_BROWSER_USER_DATA_DIR. Must run before app is ready.
57
58
  try {
58
- const base = dshHome();
59
- app.setPath('userData', join(base, BROWSER_PROFILE_DIR));
59
+ const overrideUserData = process.env.DSH_BROWSER_USER_DATA_DIR;
60
+ const userDataDir = typeof overrideUserData === 'string' && overrideUserData !== '' && isAbsolute(overrideUserData)
61
+ ? overrideUserData
62
+ : join(dshHome(), BROWSER_PROFILE_DIR);
63
+ app.setPath('userData', userDataDir);
60
64
  }
61
65
  catch (error) {
62
66
  process.stderr.write(`[dsh-browser host] userData setup failed: ${String(error)}\n`);
@@ -22,7 +22,8 @@ import { sameOrigin } from './settings-route.js';
22
22
  import { isDirectLoopback } from './authenticated-route.js';
23
23
  import { readJsonBody } from './http-body.js';
24
24
  import { replyJson } from './json-reply.js';
25
- export const HOST_PATCH_ROUTE = '/dsh-builtin-browser/host-patch-maintenance';
25
+ import { HOST_PATCH_ROUTE } from '../../assets/browser-policy.mjs';
26
+ export { HOST_PATCH_ROUTE };
26
27
  const sidebar = '@deepseek-ai/dsh-client-ui-sidebar-right';
27
28
  /** Bind to the live optional service, never resolve a second copy relative to the plugin. */
28
29
  export function servedClientModules(value) {
@@ -56,15 +57,18 @@ export function createHostPatchMaintenance(deps) {
56
57
  replyJson(response, 403, { ok: false, error: 'same-origin-local-request-required' });
57
58
  return;
58
59
  }
59
- if (deps.desktop()) {
60
+ const tauri = deps.tauri?.();
61
+ if (tauri === undefined && deps.desktop()) {
60
62
  replyJson(response, request.method === 'GET' ? 200 : 409, { ok: request.method === 'GET', hostPatch: { surface: 'desktop', status: 'absent', canInstall: false, canRestore: false,
61
63
  restartRequired: false, reason: 'Use Desktop bridge maintenance to change host files after Desktop exits.' } });
62
64
  return;
63
65
  }
64
66
  let directory;
65
67
  const modules = deps.modules();
68
+ const surface = tauri === undefined ? 'web' : 'tauri';
69
+ const target = tauri === undefined ? 'lib/client.js' : 'runtime/browser.cjs';
66
70
  try {
67
- directory = servedSidebarPackage(modules);
71
+ directory = tauri ?? servedSidebarPackage(modules);
68
72
  }
69
73
  catch (error) {
70
74
  replyJson(response, request.method === 'GET' ? 200 : 409, { ok: request.method === 'GET', hostPatch: {
@@ -78,7 +82,7 @@ export function createHostPatchMaintenance(deps) {
78
82
  let writable = true;
79
83
  let reason = result.reason;
80
84
  try {
81
- for (const path of [join(directory, 'lib'), join(directory, 'lib/client.js')]) {
85
+ for (const path of [dirname(join(directory, target)), join(directory, target)]) {
82
86
  if ((statSync(path).mode & 0o222) === 0)
83
87
  throw new Error('read-only permissions');
84
88
  accessSync(path, constants.W_OK);
@@ -86,11 +90,13 @@ export function createHostPatchMaintenance(deps) {
86
90
  }
87
91
  catch (error) {
88
92
  writable = false;
89
- reason = 'The served sidebar package is not writable: ' + String(error);
93
+ reason = `The ${surface === 'web' ? 'served sidebar package' : 'DSH Tauri runtime'} is not writable: ` + String(error);
90
94
  }
91
- return { ...result, ...(reason === undefined ? {} : { reason }), surface: 'web',
95
+ const needed = typeof patcher.hostPatchNeeded === 'function' ? patcher.hostPatchNeeded(directory) : undefined;
96
+ return { ...result, ...(reason === undefined ? {} : { reason }), surface,
97
+ ...(needed === undefined ? {} : { needed }),
92
98
  canInstall: writable && result.status === 'absent',
93
- canRestore: writable && result.status === 'applied' && existsSync(join(directory, 'lib/client.js.before-dsh-host-patch')),
99
+ canRestore: writable && result.status === 'applied' && existsSync(join(directory, `${target}.before-dsh-host-patch`)),
94
100
  restartRequired: false };
95
101
  };
96
102
  if (request.method === 'GET') {
@@ -123,7 +129,7 @@ export function createHostPatchMaintenance(deps) {
123
129
  const ok = result.status === (action === 'install' ? 'applied' : 'absent');
124
130
  let restartRequired = ok && result.changed === true;
125
131
  let reason = result.reason;
126
- if (restartRequired && typeof modules?.rebuilt === 'function') {
132
+ if (restartRequired && surface === 'web' && typeof modules?.rebuilt === 'function') {
127
133
  try {
128
134
  modules.rebuilt(sidebar);
129
135
  restartRequired = false;
@@ -2,7 +2,8 @@ import { sameOrigin } from './settings-route.js';
2
2
  import { isDirectLoopback } from './authenticated-route.js';
3
3
  import { replyJson } from './json-reply.js';
4
4
  import { readJsonBody } from './http-body.js';
5
- export const AUTOMATIC_MAINTENANCE_ROUTE = '/dsh-builtin-browser/bridge-maintenance';
5
+ import { AUTOMATIC_MAINTENANCE_ROUTE } from '../../assets/browser-policy.mjs';
6
+ export { AUTOMATIC_MAINTENANCE_ROUTE };
6
7
  /** Register behind the host's signed-session authentication, as with settings writes. */
7
8
  export function createAutomaticMaintenanceHandler(deps) {
8
9
  let starting = false;
@@ -18,10 +18,10 @@ const PRODUCT = {
18
18
  };
19
19
  /** How the setting is named to the user. */
20
20
  const SETTING_LABEL = {
21
- chrome: '本机 Chrome / installed Chrome',
22
- edge: '本机 Edge / installed Edge',
23
- auto: '自动 / automatic',
24
- bundled: '内置 / bundled',
21
+ chrome: 'installed Chrome',
22
+ edge: 'installed Edge',
23
+ auto: 'automatic',
24
+ bundled: 'bundled',
25
25
  };
26
26
  /**
27
27
  * A carrier that cannot carry anything: every command explains the real problem.
@@ -32,10 +32,6 @@ const SETTING_LABEL = {
32
32
  export class MissingSystemBrowserHost {
33
33
  kind;
34
34
  searched;
35
- /**
36
- * @param kind - the browser the user asked for.
37
- * @param searched - the names and locations that were checked, for the report.
38
- */
39
35
  constructor(kind, searched) {
40
36
  this.kind = kind;
41
37
  this.searched = searched;
@@ -64,7 +60,7 @@ export class MissingSystemBrowserHost {
64
60
  `To fix it, any ONE of these is enough:`,
65
61
  ` 1. ${product.install}, then restart DSH;`,
66
62
  ` 2. point ${product.variable} at its executable;`,
67
- ` 3. set the browser carrier back to "内置 / bundled" (or "自动 / automatic" to let it`,
63
+ ` 3. set the browser carrier back to "bundled" (or "automatic" to let it`,
68
64
  ` fall back on its own next time).`,
69
65
  ].join('\n');
70
66
  }
@@ -23,9 +23,6 @@ export async function extensionReady(connect, milliseconds = EXTENSION_READY_TIM
23
23
  }
24
24
  }
25
25
  export class PreferredBrowserViewHost {
26
- browser;
27
- fallback;
28
- bound;
29
26
  routes = new Map();
30
27
  decisions = new Map();
31
28
  mapped = new Map();
@@ -33,6 +30,9 @@ export class PreferredBrowserViewHost {
33
30
  selected;
34
31
  fallbackReason;
35
32
  extension;
33
+ browser;
34
+ fallback;
35
+ bound = EXTENSION_READY_TIMEOUT_MS;
36
36
  constructor(browser, fallback, client, bound = EXTENSION_READY_TIMEOUT_MS) {
37
37
  this.browser = browser;
38
38
  this.fallback = fallback;
@@ -54,6 +54,10 @@ export class PreferredBrowserViewHost {
54
54
  return !!view && !view.dead && (this.decisions.get(sessionWireId(readTabHandle(id))) === this.fallback
55
55
  ? this.fallback.connectionStatus?.().connected === true : this.extension.connectedView(id));
56
56
  }
57
+ async revealQuietWindow(handle, options) {
58
+ const real = await this.mapped.get(handle.id)?.real?.catch(() => undefined);
59
+ return await real?.host.revealQuietWindow?.(real.handle, options) === true;
60
+ }
57
61
  route(scope) {
58
62
  if (this.released)
59
63
  return Promise.reject(new Error('browser carrier was released'));
@@ -2,7 +2,7 @@ import { PREVIEW_ROUTE, PREVIEW_SESSIONS_ROUTE, BRIDGE_STATUS_ROUTE } from '../.
2
2
  import { URL_PARSE_BASE } from '../../assets/browser-policy.mjs';
3
3
  import { replyJson } from './json-reply.js';
4
4
  import { sameOrigin } from './settings-route.js';
5
- import { findDesktopInstall, readBridgeStatus } from './bridge-status.js';
5
+ import { detectDesktopShell, readBridgeStatus } from './bridge-status.js';
6
6
  /** Where the frame endpoint lives. The viewer must use exactly this path, same origin. */
7
7
  export { PREVIEW_ROUTE };
8
8
  /**
@@ -141,7 +141,7 @@ export async function handlePreviewFrame(request, response, settings, browser) {
141
141
  * @param response - the response to write.
142
142
  * @param localAppData - the base directory to probe; injected so a test can point at a fixture.
143
143
  */
144
- export async function handleBridgeStatus(request, response, localAppData, mainExtension, registry, conventions) {
144
+ export async function handleBridgeStatus(request, response, localAppData, mainExtension, registry, conventions, preferredBrowser) {
145
145
  if (request.method !== 'GET') {
146
146
  replyJson(response, 405, { error: 'method-not-allowed' });
147
147
  return;
@@ -150,15 +150,11 @@ export async function handleBridgeStatus(request, response, localAppData, mainEx
150
150
  replyJson(response, 403, { error: 'not-same-origin' });
151
151
  return;
152
152
  }
153
- const installRoot = findDesktopInstall(localAppData, registry, conventions);
154
- const status = installRoot === undefined
155
- ? {
156
- state: 'missing',
157
- present: false,
158
- archivePresent: false,
159
- detail: 'no DSH Desktop install found in the usual roots, at DSH_DESKTOP_PATH or DSH_DESKTOP_APP, '
160
- + 'in the uninstall registry, or at this platform\'s conventional locations',
161
- }
162
- : readBridgeStatus(installRoot, mainExtension);
163
- replyJson(response, 200, { ok: true, bridge: status });
153
+ const shell = detectDesktopShell({ localAppData, registry, conventions, preferredBrowser });
154
+ // Only a verified official install is read for a bridge; any other shell is reported as missing
155
+ // without a repair command, and `shell` says why.
156
+ const status = shell.kind === 'official-supported' && shell.root !== undefined
157
+ ? readBridgeStatus(shell.root, mainExtension)
158
+ : { state: 'missing', present: false, archivePresent: false, detail: shell.reason };
159
+ replyJson(response, 200, { ok: true, bridge: status, shell });
164
160
  }
@@ -131,10 +131,10 @@ function dataDirectory(argv) {
131
131
  return values.length === 1 && values[0] !== '' ? values[0] : undefined;
132
132
  }
133
133
  export class BrowserProcessOwnership {
134
+ records = new WeakMap();
134
135
  executable;
135
136
  directory;
136
137
  options;
137
- records = new WeakMap();
138
138
  constructor(executable, directory, options) {
139
139
  this.executable = executable;
140
140
  this.directory = directory;
@@ -1,9 +1,10 @@
1
+ import { PROFILE_COMMAND_TIMEOUT_MS } from '../../assets/browser-policy.mjs';
1
2
  import { execFile, spawn } from 'node:child_process';
2
3
  import { dirname, join } from 'node:path';
3
4
  import { windowsPowerShellPath } from './windows-system.js';
4
5
  import { MaintenanceRecoveryError } from './maintenance-lifecycle.js';
5
6
  /** Terminate the complete package-manager tree before allowing a profile rollback. */
6
- export async function runProfileCommand(command, args, environment, timeoutMs = 60_000) {
7
+ export async function runProfileCommand(command, args, environment, timeoutMs = PROFILE_COMMAND_TIMEOUT_MS) {
7
8
  const taskkill = process.platform === 'win32' ? join(dirname(dirname(dirname(windowsPowerShellPath(environment)))), 'taskkill.exe') : undefined;
8
9
  return await new Promise((resolve, reject) => {
9
10
  const child = spawn(command, [...args], { env: environment, windowsHide: true, shell: false, detached: process.platform !== 'win32', stdio: ['ignore', 'pipe', 'pipe'] });
@@ -112,7 +112,12 @@ function profileEnvironment(home, packedCli = false) {
112
112
  if (key.toUpperCase() === 'ELECTRON_NO_ASAR')
113
113
  delete env[key];
114
114
  }
115
+ // `CI` makes pnpm non-interactive. Without it a reconcile answered a supply-chain prompt with
116
+ // "?" and exited non-zero, the maintenance transaction rolled back, and the bridge stayed
117
+ // "已失效" — a repair path that could not repair. The reporter is pinned for the same reason:
118
+ // an unattended command must produce a log, not a question.
115
119
  return { ...env, DSH_HOME: home, ELECTRON_RUN_AS_NODE: '1', ...(packedCli ? {} : { ELECTRON_NO_ASAR: '1' }),
120
+ CI: 'true', npm_config_reporter: 'append-only', PNPM_CONFIG_REPORTER: 'append-only',
116
121
  npm_config_ignore_scripts: 'true', npm_config_auto_install_peers: 'false',
117
122
  PNPM_CONFIG_IGNORE_SCRIPTS: 'true', PNPM_CONFIG_AUTO_INSTALL_PEERS: 'false' };
118
123
  }