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.
- package/CHANGELOG.md +61 -0
- package/README.md +1 -1
- package/assets/browser-panel-locales.mjs +37 -5
- package/assets/browser-policy.d.mts +29 -0
- package/assets/browser-policy.mjs +40 -0
- package/desktop-bridge/desktop-discovery.d.mts +1 -1
- package/desktop-bridge/desktop-discovery.mjs +59 -9
- package/desktop-bridge/desktop-identity.json +12 -0
- package/desktop-bridge/install.mjs +14 -7
- package/desktop-bridge/plugin-browser-bridge.js +19 -7
- package/docs/acceptance-2026-11-27.md +67 -0
- package/docs/architecture.md +1 -1
- package/docs/development.md +33 -4
- package/docs/dsh-0.2.3-host-patch-task.md +34 -0
- package/docs/hardcoding-audit.md +28 -8
- package/docs/known-issues.md +26 -0
- package/docs/limitations.md +6 -2
- package/docs/pr64-maintenance.md +1 -1
- package/docs/tool-reference.md +1 -1
- package/docs/user-guide.md +1 -1
- package/docs/v1.1.0-bu-data-batching-task.md +66 -0
- package/docs/v1.1.0-compat-hardcoding-task.md +85 -0
- package/dsh-builtin-browser-1.0.3-publish.tgz +0 -0
- package/dsh-builtin-browser-1.0.3.tgz +0 -0
- package/dsh-host-patch/README.md +4 -0
- package/dsh-host-patch/apply.mjs +61 -13
- package/dsh-host-patch/rc3-revision9.json.gz +0 -0
- package/dsh-host-patch/rc5-revision9.json.gz +0 -0
- package/dsh-host-patch/sources/main/0001-feat-sidebar-right-add-session-rendering-holds.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0002-feat-desktop-load-trusted-profile-main-extensions.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0003-feat-desktop-report-resolved-and-running-main-extens.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0004-feat-desktop-compose-admitted-native-sidebar-views.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0005-fix-client-admit-coded-browser-errors-in-native-comp.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0006-fix-desktop-acknowledge-native-same-document-navigat.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0007-fix-desktop-restore-auth-in-the-native-lease-partiti.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0008-feat-desktop-adopt-native-children-in-admitted-sideb.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0009-fix-desktop-publish-complete-native-child-close-reco.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0010-fix-desktop-bundle-structured-errors-in-sandboxed-pr.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0011-feat-desktop-offer-persistent-Sidebar-sessions-per-D.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0012-feat-desktop-retain-sidebar-session-cookies-across-r.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0013-fix-desktop-honor-sidebar-session-cookie-sidecar-con.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0014-fix-desktop-retry-cookie-protection-without-failing-.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0015-fix-desktop-preserve-host-only-cookie-identity-in-se.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0016-fix-desktop-restore-session-cookies-before-checkpoin.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0017-fix-desktop-restore-sidebar-cookies-once-before-gues.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0018-fix-sidebar-right-follow-animated-native-slot-placem.patch.gz +0 -0
- package/dsh-host-patch/sources/manifest.json +218 -0
- package/dsh-host-patch/sources/rc3/0001-feat-sidebar-right-add-session-rendering-holds.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0002-feat-desktop-load-trusted-profile-main-extensions.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0003-feat-desktop-report-resolved-and-running-main-extens.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0004-feat-desktop-compose-admitted-native-sidebar-views.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0005-fix-client-admit-coded-browser-errors-in-native-comp.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0006-fix-desktop-acknowledge-native-same-document-navigat.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0007-fix-desktop-restore-auth-in-the-native-lease-partiti.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0008-feat-desktop-adopt-native-children-in-admitted-sideb.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0009-fix-desktop-publish-complete-native-child-close-reco.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0010-fix-desktop-bundle-structured-errors-in-sandboxed-pr.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0011-feat-desktop-offer-persistent-Sidebar-sessions-per-D.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0012-feat-desktop-retain-sidebar-session-cookies-across-r.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0013-fix-desktop-honor-sidebar-session-cookie-sidecar-con.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0014-fix-desktop-retry-cookie-protection-without-failing-.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0015-fix-desktop-preserve-host-only-cookie-identity-in-se.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0016-fix-desktop-restore-session-cookies-before-checkpoin.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0017-fix-desktop-restore-sidebar-cookies-once-before-gues.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0018-fix-sidebar-right-follow-animated-native-slot-placem.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0001-feat-sidebar-right-add-session-rendering-holds.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0002-feat-desktop-load-trusted-profile-main-extensions.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0003-feat-desktop-report-resolved-and-running-main-extens.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0004-feat-desktop-compose-admitted-native-sidebar-views.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0005-fix-client-admit-coded-browser-errors-in-native-comp.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0006-fix-desktop-acknowledge-native-same-document-navigat.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0007-fix-desktop-restore-auth-in-the-native-lease-partiti.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0008-feat-desktop-adopt-native-children-in-admitted-sideb.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0009-fix-desktop-publish-complete-native-child-close-reco.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0010-fix-desktop-bundle-structured-errors-in-sandboxed-pr.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0011-feat-desktop-offer-persistent-Sidebar-sessions-per-D.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0012-feat-desktop-retain-sidebar-session-cookies-across-r.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0013-fix-desktop-honor-sidebar-session-cookie-sidecar-con.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0014-fix-desktop-retry-cookie-protection-without-failing-.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0015-fix-desktop-preserve-host-only-cookie-identity-in-se.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0016-fix-desktop-restore-session-cookies-before-checkpoin.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0017-fix-desktop-restore-sidebar-cookies-once-before-gues.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0018-fix-sidebar-right-follow-animated-native-slot-placem.patch.gz +0 -0
- package/dsh-host-patch/sources/series.json +260 -0
- package/dsh-host-patch/tauri/desktop-main.cjs +62 -0
- package/dsh-host-patch/tauri/sidebar-session.cjs +104 -0
- package/dsh-host-patch/tauri-revision1.json +39 -0
- package/dsh-host-patch/tauri.json +43 -0
- package/dsh-host-patch/v023-alpha2.json +153 -0
- package/lib/browser/anti-bot.js +215 -0
- package/lib/browser/deep-dom.js +39 -0
- package/lib/browser/runtime.js +15 -0
- package/lib/browser/takeover-target.js +13 -6
- package/lib/browser/types.js +30 -1
- package/lib/browser-electron/authenticated-route.js +16 -2
- package/lib/browser-electron/automatic-maintenance.js +16 -10
- package/lib/browser-electron/bridge-connection.js +3 -8
- package/lib/browser-electron/bridge-install.js +2 -1
- package/lib/browser-electron/bridge-status.js +55 -26
- package/lib/browser-electron/desktop-bridge-host.js +7 -6
- package/lib/browser-electron/desktop-identity.js +28 -5
- package/lib/browser-electron/desktop-shell.js +64 -0
- package/lib/browser-electron/electron-provision.js +105 -18
- package/lib/browser-electron/entry.js +129 -46
- package/lib/browser-electron/extension-browser.js +4 -4
- package/lib/browser-electron/foreground-watch.js +134 -0
- package/lib/browser-electron/guest-cookie-jar.js +13 -13
- package/lib/browser-electron/guest-route.js +181 -32
- package/lib/browser-electron/guest-runtime.js +61 -10
- package/lib/browser-electron/guest-storage.js +2 -2
- package/lib/browser-electron/history-store.js +1 -5
- package/lib/browser-electron/host-main.js +8 -4
- package/lib/browser-electron/host-patch-maintenance.js +14 -8
- package/lib/browser-electron/maintenance-route.js +2 -1
- package/lib/browser-electron/missing-system-browser.js +5 -9
- package/lib/browser-electron/preferred-browser.js +7 -3
- package/lib/browser-electron/preview-route.js +9 -13
- package/lib/browser-electron/process-ownership.js +1 -1
- package/lib/browser-electron/profile-command.js +2 -1
- package/lib/browser-electron/profile-extension.js +5 -0
- package/lib/browser-electron/profile-lease.js +152 -47
- package/lib/browser-electron/provider-core.js +527 -0
- package/lib/browser-electron/provider-interaction.js +963 -0
- package/lib/browser-electron/provider-media.js +518 -0
- package/lib/browser-electron/provider-navigation.js +301 -0
- package/lib/browser-electron/provider-observation.js +623 -0
- package/lib/browser-electron/provider-tabs.js +372 -0
- package/lib/browser-electron/provider.js +150 -3301
- package/lib/browser-electron/reference-route.js +9 -18
- package/lib/browser-electron/remote-host.js +79 -34
- package/lib/browser-electron/runtime-status.js +56 -6
- package/lib/browser-electron/settings-store.js +3 -6
- package/lib/browser-electron/sidebar-only-host.js +1 -1
- package/lib/browser-electron/system-browser.js +539 -172
- package/lib/browser-electron/tauri-host.js +208 -0
- package/lib/browser-electron/virtual-cursor.js +23 -13
- package/lib/browser-reference/service.js +22 -4
- package/lib/browser-reference/web-sources.js +1 -1
- package/lib/client.js +43409 -0
- package/lib/compat/host-features.js +75 -0
- package/lib/reference-source.js +1 -1
- package/lib/reference-text.js +23 -1
- package/lib/takeover-protocol.js +1 -1
- package/lib/tool-browser/block-recovery.js +69 -0
- package/lib/tool-browser/code-tool.js +170 -19
- package/lib/tool-browser/code-worker.js +115 -20
- package/lib/tool-browser/errors.js +34 -0
- package/lib/tool-browser/index.js +66 -3593
- package/lib/tool-browser/page-probe.js +227 -28
- package/lib/tool-browser/panel-page.js +2 -1
- package/lib/tool-browser/probe-client.js +157 -0
- package/lib/tool-browser/screenshot-annotations.js +108 -0
- package/lib/tool-browser/state.js +337 -0
- package/lib/tool-browser/takeover.js +1 -1
- package/lib/tool-browser/tools-debug.js +862 -0
- package/lib/tool-browser/tools-interaction.js +993 -0
- package/lib/tool-browser/tools-navigation.js +807 -0
- package/lib/tool-browser/tools-observation.js +461 -0
- package/lib/tool-browser/tools-reference.js +293 -0
- package/lib/web-guest.js +1 -0
- package/package.json +16 -54
- package/README.en.md +0 -89
- package/browser-extension/constants.mjs +0 -20
- package/browser-extension/controller.mjs +0 -293
- package/browser-extension/locales.mjs +0 -15
- package/browser-extension/manifest.json +0 -12
- package/browser-extension/options.html +0 -14
- package/browser-extension/options.mjs +0 -9
- package/browser-extension/permission-guard.mjs +0 -13
- package/browser-extension/worker.mjs +0 -74
- package/dist/client.cjs +0 -43167
- package/lib/browser-electron/package-removal.js +0 -5
- package/lib/browser-reference/submission-receipts.js +0 -139
- package/scripts/build.mjs +0 -66
- package/scripts/bundle-host.mjs +0 -28
- package/scripts/fix-exports.mjs +0 -50
- package/scripts/install-electron.mjs +0 -51
- package/scripts/verify-exports.mjs +0 -47
- package/scripts/verify-preview-sdk.mjs +0 -93
- package/skills/dsh-builtin-browser/SKILL.md +0 -73
- package/skills/dsh-builtin-browser/references/batch.md +0 -53
- package/skills/dsh-builtin-browser/references/deliver.md +0 -31
- package/skills/dsh-builtin-browser/references/locate.md +0 -11
- package/skills/dsh-builtin-browser/references/recover.md +0 -11
- package/skills/dsh-builtin-browser/references/verify.md +0 -13
- package/skills/dsh-debug-host/SKILL.md +0 -56
- package/skills/dsh-debug-self/SKILL.md +0 -50
- package/src/bridge-compatibility.ts +0 -39
- package/src/browser/handles.ts +0 -89
- package/src/browser/runtime.ts +0 -560
- package/src/browser/takeover-target.ts +0 -36
- package/src/browser/types.ts +0 -817
- package/src/browser-electron/authenticated-route.ts +0 -84
- package/src/browser-electron/automatic-maintenance.ts +0 -726
- package/src/browser-electron/bridge-auto.ts +0 -159
- package/src/browser-electron/bridge-connection.ts +0 -385
- package/src/browser-electron/bridge-endpoint.ts +0 -129
- package/src/browser-electron/bridge-install.ts +0 -289
- package/src/browser-electron/bridge-maintenance.ts +0 -189
- package/src/browser-electron/bridge-status.ts +0 -347
- package/src/browser-electron/desktop-bridge-host.ts +0 -251
- package/src/browser-electron/desktop-identity.ts +0 -320
- package/src/browser-electron/document-readiness.ts +0 -45
- package/src/browser-electron/electron-provision.ts +0 -261
- package/src/browser-electron/entry.ts +0 -1301
- package/src/browser-electron/ephemeral-profile.ts +0 -189
- package/src/browser-electron/extension-browser.ts +0 -223
- package/src/browser-electron/extension-setup.ts +0 -67
- package/src/browser-electron/file-write.ts +0 -31
- package/src/browser-electron/guest-cookie-jar.ts +0 -176
- package/src/browser-electron/guest-cookie-store.ts +0 -59
- package/src/browser-electron/guest-css-runtime.ts +0 -76
- package/src/browser-electron/guest-css.ts +0 -68
- package/src/browser-electron/guest-route.ts +0 -568
- package/src/browser-electron/guest-runtime.ts +0 -357
- package/src/browser-electron/guest-storage-runtime.ts +0 -54
- package/src/browser-electron/guest-storage.ts +0 -117
- package/src/browser-electron/history-store.ts +0 -227
- package/src/browser-electron/host-main.ts +0 -1381
- package/src/browser-electron/host-patch-maintenance.ts +0 -112
- package/src/browser-electron/http-body.ts +0 -65
- package/src/browser-electron/json-reply.ts +0 -47
- package/src/browser-electron/maintenance-broker.ts +0 -166
- package/src/browser-electron/maintenance-lifecycle.ts +0 -91
- package/src/browser-electron/maintenance-route.ts +0 -67
- package/src/browser-electron/missing-system-browser.ts +0 -113
- package/src/browser-electron/open-slot.ts +0 -49
- package/src/browser-electron/package-removal.ts +0 -4
- package/src/browser-electron/paths.ts +0 -25
- package/src/browser-electron/preferred-browser.ts +0 -120
- package/src/browser-electron/preview-route.ts +0 -218
- package/src/browser-electron/process-ownership.ts +0 -168
- package/src/browser-electron/process.ts +0 -23
- package/src/browser-electron/profile-checkpoint.ts +0 -187
- package/src/browser-electron/profile-command.ts +0 -46
- package/src/browser-electron/profile-extension.ts +0 -124
- package/src/browser-electron/profile-lease.ts +0 -115
- package/src/browser-electron/profile-residue.ts +0 -49
- package/src/browser-electron/provider.ts +0 -4571
- package/src/browser-electron/reference-route.ts +0 -608
- package/src/browser-electron/remote-host.ts +0 -1462
- package/src/browser-electron/rpc-input.ts +0 -13
- package/src/browser-electron/rpc-ops.ts +0 -41
- package/src/browser-electron/runtime-diagnostics.ts +0 -38
- package/src/browser-electron/runtime-route.ts +0 -105
- package/src/browser-electron/runtime-status.ts +0 -242
- package/src/browser-electron/settings-route.ts +0 -64
- package/src/browser-electron/settings-store.ts +0 -589
- package/src/browser-electron/shortcuts-route.ts +0 -112
- package/src/browser-electron/sidebar-only-host.ts +0 -298
- package/src/browser-electron/startpage-shortcuts.ts +0 -213
- package/src/browser-electron/system-browser.ts +0 -1497
- package/src/browser-electron/timing.ts +0 -16
- package/src/browser-electron/virtual-cursor.ts +0 -152
- package/src/browser-electron/windows-system.ts +0 -24
- package/src/browser-reference/delivery.ts +0 -384
- package/src/browser-reference/entry.ts +0 -631
- package/src/browser-reference/export.ts +0 -339
- package/src/browser-reference/import.ts +0 -303
- package/src/browser-reference/page-script.ts +0 -1537
- package/src/browser-reference/service.ts +0 -1315
- package/src/browser-reference/store.ts +0 -172
- package/src/browser-reference/submission-receipts.ts +0 -122
- package/src/browser-reference/text-quote.ts +0 -219
- package/src/browser-reference/types.ts +0 -195
- package/src/browser-reference/visible.ts +0 -367
- package/src/browser-reference/web-sources.ts +0 -103
- package/src/client/browser/BrowserController.ts +0 -693
- package/src/client/browser/BrowserFrame.ts +0 -78
- package/src/client/browser/BrowserNavigation.ts +0 -169
- package/src/client/browser/BrowserPage.ts +0 -23
- package/src/client/browser/BrowserPersistence.ts +0 -44
- package/src/client/browser/IframeImpl.ts +0 -176
- package/src/client/browser/child-tabs.ts +0 -14
- package/src/client/browser/iframe-reference.ts +0 -67
- package/src/client/browser/initialization.ts +0 -262
- package/src/client/browser/omnibox.ts +0 -243
- package/src/client/browser/store.ts +0 -38
- package/src/client/browser/takeover-channel.ts +0 -72
- package/src/client/browser/url.ts +0 -46
- package/src/client/browser/web-reference-source.ts +0 -52
- package/src/client/css-modules.d.ts +0 -4
- package/src/client/definition.tsx +0 -30
- package/src/client/electron/ElectronWebViewImpl.ts +0 -364
- package/src/client/electron/ElectronWebviewPresentation.ts +0 -138
- package/src/client/electron/NativeChildPresentation.ts +0 -45
- package/src/client/electron/NativeViewPage.ts +0 -251
- package/src/client/electron/pages.ts +0 -23
- package/src/client/electron/reference-overlay.ts +0 -53
- package/src/client/electron/workspace.ts +0 -33
- package/src/client/index.ts +0 -293
- package/src/client/locales.ts +0 -857
- package/src/client/pages.ts +0 -28
- package/src/client/reference/client/BrowserRefLink.tsx +0 -142
- package/src/client/reference/client/draft-reference.ts +0 -167
- package/src/client/reference/client/index.ts +0 -7
- package/src/client/reference/client/ordered-submission.ts +0 -108
- package/src/client/reference/client/pending-delivery.ts +0 -216
- package/src/client/reference/client/plugin.ts +0 -189
- package/src/client/reference/client/production/ReferenceCapsules.tsx +0 -345
- package/src/client/reference/client/production/ReferenceDock.module.css +0 -193
- package/src/client/reference/client/production/ReferenceDock.tsx +0 -6
- package/src/client/reference/client/production/ReferenceFeedback.tsx +0 -15
- package/src/client/reference/client/production/ReferenceMath.tsx +0 -44
- package/src/client/reference/client/production/ReferenceText.tsx +0 -36
- package/src/client/reference/client/production/assembly.ts +0 -471
- package/src/client/reference/client/production/asset-store.ts +0 -144
- package/src/client/reference/client/production/availability.ts +0 -74
- package/src/client/reference/client/production/bytes.ts +0 -36
- package/src/client/reference/client/production/delivery-client.ts +0 -211
- package/src/client/reference/client/production/draft-adapter.ts +0 -508
- package/src/client/reference/client/production/http-transport.ts +0 -217
- package/src/client/reference/client/production/production-submission.ts +0 -310
- package/src/client/reference/client/production/protocol.ts +0 -231
- package/src/client/reference/client/production/reference-card.ts +0 -240
- package/src/client/reference/client/production/reference-labels.ts +0 -29
- package/src/client/reference/client/production/reply-link-bridge.ts +0 -222
- package/src/client/reference/client/production/reveal.ts +0 -215
- package/src/client/reference/client/production/runtime.ts +0 -1101
- package/src/client/reference/client/production/snapshot-adapter.ts +0 -154
- package/src/client/reference/client/production/source-marker.ts +0 -63
- package/src/client/reference/client/production/source-opener.ts +0 -55
- package/src/client/reference/client/production/styles.ts +0 -104
- package/src/client/reference/client/production/user-text-rule.ts +0 -58
- package/src/client/reference/client/reveal.ts +0 -107
- package/src/client/reference/client/scheme.ts +0 -114
- package/src/client/reference/client/types.ts +0 -168
- package/src/client/reference/css-modules.d.ts +0 -4
- package/src/client/reference/index.ts +0 -11
- package/src/client/reference-capture-owner.ts +0 -162
- package/src/client/reference-intents.ts +0 -36
- package/src/client/settings/index.ts +0 -34
- package/src/client/settings/panel.ts +0 -2657
- package/src/client/shortcut-open.ts +0 -30
- package/src/client/startpage/binding.ts +0 -99
- package/src/client/startpage/controller.ts +0 -303
- package/src/client/startpage/model.ts +0 -279
- package/src/client/view/Browser.module.css +0 -751
- package/src/client/view/BrowserBody.tsx +0 -314
- package/src/client/view/BrowserPresentation.ts +0 -9
- package/src/client/view/BrowserTitle.tsx +0 -17
- package/src/client/view/IframePresentation.ts +0 -344
- package/src/client/view/StartPage.tsx +0 -597
- package/src/client/view/TakeoverBanner.tsx +0 -21
- package/src/index.ts +0 -110
- package/src/reference-owner.ts +0 -5
- package/src/reference-page.ts +0 -9
- package/src/reference-source.ts +0 -3
- package/src/reference-text.ts +0 -197
- package/src/startpage-settings.ts +0 -103
- package/src/startpage.ts +0 -71
- package/src/takeover-protocol.ts +0 -19
- package/src/tool-browser/code-tool.ts +0 -401
- package/src/tool-browser/code-worker.ts +0 -639
- package/src/tool-browser/element-fields.ts +0 -167
- package/src/tool-browser/index.ts +0 -3733
- package/src/tool-browser/page-probe.ts +0 -474
- package/src/tool-browser/panel-page.ts +0 -124
- package/src/tool-browser/screenshot-image.ts +0 -49
- package/src/tool-browser/takeover.ts +0 -198
- package/src/types/electron-shim.d.ts +0 -144
- package/src/types.ts +0 -85
- package/src/web-guest.ts +0 -34
- package/tools/accept-desktop.mjs +0 -148
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Page-side DOM traversal shared by every page script that looks elements up.
|
|
3
|
+
*
|
|
4
|
+
* Browser Use reads into same-origin iframes and open shadow roots; a lookup that only asks
|
|
5
|
+
* `document` misses what the snapshot just listed. Inject {@link DEEP_DOM_SOURCE} at the top of a
|
|
6
|
+
* page script, then use `__dshRoots()`, `__dshQuery(selector)` and `__dshQueryAll(selector)`.
|
|
7
|
+
* Cross-origin frames and closed shadow roots stay opaque, as the browser requires.
|
|
8
|
+
* @module dsh-browser/browser/deep-dom
|
|
9
|
+
*/
|
|
10
|
+
export const DEEP_DOM_SOURCE = `
|
|
11
|
+
const __dshRoots = (start) => {
|
|
12
|
+
const roots = []
|
|
13
|
+
const seen = new Set()
|
|
14
|
+
const visit = (root) => {
|
|
15
|
+
if (!root || seen.has(root)) return
|
|
16
|
+
seen.add(root)
|
|
17
|
+
roots.push(root)
|
|
18
|
+
for (const el of root.querySelectorAll('*')) {
|
|
19
|
+
if (el.shadowRoot) visit(el.shadowRoot)
|
|
20
|
+
if (el.tagName === 'IFRAME' || el.tagName === 'FRAME') {
|
|
21
|
+
try { const d = el.contentDocument; if (d) visit(d) } catch (error) { /* cross-origin */ }
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
visit(start || document)
|
|
26
|
+
return roots
|
|
27
|
+
}
|
|
28
|
+
const __dshQuery = (selector) => {
|
|
29
|
+
const top = document.querySelector(selector)
|
|
30
|
+
if (top) return top
|
|
31
|
+
for (const root of __dshRoots()) { const found = root.querySelector(selector); if (found) return found }
|
|
32
|
+
return null
|
|
33
|
+
}
|
|
34
|
+
const __dshQueryAll = (selector) => {
|
|
35
|
+
const all = Array.from(document.querySelectorAll(selector))
|
|
36
|
+
for (const root of __dshRoots().slice(1)) all.push(...root.querySelectorAll(selector))
|
|
37
|
+
return all
|
|
38
|
+
}
|
|
39
|
+
`;
|
package/lib/browser/runtime.js
CHANGED
|
@@ -39,6 +39,21 @@ export class BrowserRuntime extends Service {
|
|
|
39
39
|
constructor(ctx, config = {}) {
|
|
40
40
|
super(ctx, 'browser');
|
|
41
41
|
this.providerId = config.browserProvider;
|
|
42
|
+
// Optionally claim the DSH >= 0.2.3 exclusive `ctx.browserUse` registry when present
|
|
43
|
+
// so co-installed browser-use plugins cannot silently collide.
|
|
44
|
+
const surface = ctx;
|
|
45
|
+
if (typeof surface.inject === 'function') {
|
|
46
|
+
try {
|
|
47
|
+
surface.inject(['browserUse'], (scope) => {
|
|
48
|
+
if (typeof scope.browserUse?.register !== 'function')
|
|
49
|
+
return;
|
|
50
|
+
scope.effect(() => scope.browserUse.register('dsh-builtin-browser'), 'dsh-builtin-browser: browserUse registration');
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
// Optional host service: ignore when unavailable in minimal or legacy contexts.
|
|
55
|
+
}
|
|
56
|
+
}
|
|
42
57
|
}
|
|
43
58
|
/**
|
|
44
59
|
* Register a browser provider. Throws {@link BrowserError}
|
|
@@ -5,10 +5,11 @@ function browserIdentity(browser) {
|
|
|
5
5
|
return Service.prototype.isPrototypeOf(browser) ? browser[symbols.original] ?? browser : browser;
|
|
6
6
|
}
|
|
7
7
|
export function hasCarrierTakeover(browser) {
|
|
8
|
-
return browser !== undefined && sources.
|
|
8
|
+
return browser !== undefined && sources.get(browserIdentity(browser))?.exclusive === true;
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
/** `exclusive: false` lets a carrier with no tab for the owner fall back to the sidebar. */
|
|
11
|
+
export function registerCarrierTakeover(browser, list, { exclusive = true } = {}) {
|
|
12
|
+
const key = browserIdentity(browser), source = { list, exclusive };
|
|
12
13
|
sources.set(key, source);
|
|
13
14
|
return () => { if (sources.get(key) === source)
|
|
14
15
|
sources.delete(key); };
|
|
@@ -16,9 +17,15 @@ export function registerCarrierTakeover(browser, source) {
|
|
|
16
17
|
export function carrierTakeoverTarget(browser, owner, pageId) {
|
|
17
18
|
if (!browser)
|
|
18
19
|
return undefined;
|
|
19
|
-
const
|
|
20
|
-
&&
|
|
20
|
+
const owned = sources.get(browserIdentity(browser))?.list(referenceOwnerKey(owner)).filter(target => referenceOwnerKey(target.owner) === referenceOwnerKey(owner)
|
|
21
|
+
&& (pageId === undefined || target.pageId === pageId)) ?? [];
|
|
22
|
+
const candidates = owned.filter(target => target.connected());
|
|
21
23
|
if (candidates.length > 1)
|
|
22
24
|
throw new Error('Select one browser session in this conversation before requesting takeover.');
|
|
23
|
-
|
|
25
|
+
if (candidates[0] !== undefined)
|
|
26
|
+
return candidates[0];
|
|
27
|
+
const blocked = owned.map(target => target.unavailableReason?.()).find(reason => typeof reason === 'string' && reason !== '');
|
|
28
|
+
if (blocked !== undefined)
|
|
29
|
+
throw new Error(blocked);
|
|
30
|
+
return undefined;
|
|
24
31
|
}
|
package/lib/browser/types.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* remote deployments, and so on).
|
|
7
7
|
* @module dsh-browser/browser/types
|
|
8
8
|
*/
|
|
9
|
-
import { HarnessError } from '@deepseek-ai/dsh-
|
|
9
|
+
import { HarnessError } from '@deepseek-ai/dsh-error';
|
|
10
10
|
/**
|
|
11
11
|
* Typed browser error with a machine-routable, open-string `code` and chained
|
|
12
12
|
* `cause`. Consumers must tolerate provider-specific codes. Shared codes cover
|
|
@@ -16,3 +16,32 @@ import { HarnessError } from '@deepseek-ai/dsh-llm';
|
|
|
16
16
|
*/
|
|
17
17
|
export class BrowserError extends HarnessError {
|
|
18
18
|
}
|
|
19
|
+
/** A CDP-backed page: the plugin browser, an attached system browser or the desktop sidebar. */
|
|
20
|
+
export const CDP_CARRIER_CAPABILITIES = Object.freeze({
|
|
21
|
+
cdp: true, liveSnapshot: true, interaction: true, screenshot: true,
|
|
22
|
+
nativeTabs: true, backgroundRender: true, takeover: true, referenceCapture: true,
|
|
23
|
+
});
|
|
24
|
+
/** The Web sidebar's iframe: it can be navigated, nothing else. */
|
|
25
|
+
export const WEB_PANEL_CAPABILITIES = Object.freeze({
|
|
26
|
+
cdp: false, liveSnapshot: false, interaction: false, screenshot: false,
|
|
27
|
+
nativeTabs: false, backgroundRender: false, takeover: false, referenceCapture: false,
|
|
28
|
+
});
|
|
29
|
+
/** A tool needed a capability the current carrier lacks. */
|
|
30
|
+
export class CarrierCapabilityError extends BrowserError {
|
|
31
|
+
capability;
|
|
32
|
+
constructor(capability, message) {
|
|
33
|
+
super(message, 'BROWSER_CARRIER_CAPABILITY_UNAVAILABLE');
|
|
34
|
+
this.name = 'CarrierCapabilityError';
|
|
35
|
+
this.capability = capability;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Refuse an operation the carrier cannot perform.
|
|
40
|
+
* @param capabilities - the current carrier's capabilities.
|
|
41
|
+
* @param required - the one capability the operation needs.
|
|
42
|
+
* @param guidance - the refusal the model sees: what is missing and which carrier to switch to.
|
|
43
|
+
*/
|
|
44
|
+
export function assertCapability(capabilities, required, guidance) {
|
|
45
|
+
if (!capabilities[required])
|
|
46
|
+
throw new CarrierCapabilityError(required, guidance);
|
|
47
|
+
}
|
|
@@ -7,7 +7,14 @@ import { replyJson } from './json-reply.js';
|
|
|
7
7
|
* @returns an authenticated route handler.
|
|
8
8
|
*/
|
|
9
9
|
export function authenticatedRoute(connection, handler) {
|
|
10
|
-
return (request, response) => {
|
|
10
|
+
return (request, response, peer) => {
|
|
11
|
+
if (peer !== undefined) {
|
|
12
|
+
if (peer.signal?.aborted) {
|
|
13
|
+
replyJson(response, 401, { error: 'unauthorized' });
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
return handler(request, response, peer);
|
|
17
|
+
}
|
|
11
18
|
let host;
|
|
12
19
|
try {
|
|
13
20
|
host = connection();
|
|
@@ -27,7 +34,14 @@ export function authenticatedRoute(connection, handler) {
|
|
|
27
34
|
}
|
|
28
35
|
/** Admit passive previews through the same live-Peer and Host fence as DSH's API. */
|
|
29
36
|
export function pairedRoute(connection, handler) {
|
|
30
|
-
return (request, response) => {
|
|
37
|
+
return (request, response, peer) => {
|
|
38
|
+
if (peer !== undefined) {
|
|
39
|
+
if (peer.signal?.aborted) {
|
|
40
|
+
replyJson(response, 401, { error: 'unauthorized' });
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
return handler(request, response, peer);
|
|
44
|
+
}
|
|
31
45
|
let rejection;
|
|
32
46
|
try {
|
|
33
47
|
const host = connection();
|
|
@@ -15,7 +15,7 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
|
|
|
15
15
|
}
|
|
16
16
|
return path;
|
|
17
17
|
};
|
|
18
|
-
import { BROWSER_PROFILE_DIR } from '../../assets/browser-policy.mjs';
|
|
18
|
+
import { BROWSER_PROFILE_DIR, MAINTENANCE_PLAN_MAX_AGE_MS, MAINTENANCE_QUIT_WAIT_MS, MAINTENANCE_RESULT_CACHE_MS } from '../../assets/browser-policy.mjs';
|
|
19
19
|
/** User-requested Desktop maintenance (Windows and macOS), coordinated outside the Desktop process tree. */
|
|
20
20
|
import { execFile, spawn } from 'node:child_process';
|
|
21
21
|
import * as fs from 'node:fs';
|
|
@@ -203,7 +203,7 @@ export async function stageReinstallRuntime(directory, source = fileURLToPath(ne
|
|
|
203
203
|
return join(destination, 'lib', 'browser-electron', 'automatic-maintenance.js');
|
|
204
204
|
}
|
|
205
205
|
/** Called under the automatic job lock, only after the closed-process barrier. */
|
|
206
|
-
export async function runReinstallTransaction(steps) {
|
|
206
|
+
export async function runReinstallTransaction(steps, action = 'reinstall') {
|
|
207
207
|
const removed = await steps.absent() ? undefined : await steps.remove();
|
|
208
208
|
if (removed && !removed.ok)
|
|
209
209
|
throw new Error(`REINSTALL_REMOVE_FAILED: ${removed.output}`);
|
|
@@ -216,6 +216,11 @@ export async function runReinstallTransaction(steps) {
|
|
|
216
216
|
throw new Error(`REINSTALL_REVERT_FAILED: ${reverted.output}`);
|
|
217
217
|
if (!steps.hostAbsent())
|
|
218
218
|
throw new Error('REINSTALL_REVERT_FAILED: host patch is still present');
|
|
219
|
+
// uninstall stops here on purpose: the machine is now free of the bridge and of the host patch,
|
|
220
|
+
// which is the only exit a user has when the desktop integration itself is the problem (#126).
|
|
221
|
+
if (action === 'uninstall') {
|
|
222
|
+
return { ...reverted, output: [removed?.output, reverted.output].filter(Boolean).join('\n').slice(-20_000) };
|
|
223
|
+
}
|
|
219
224
|
const applied = await steps.apply();
|
|
220
225
|
if (!applied.ok || applied.hostPatch?.status !== 'applied')
|
|
221
226
|
throw new Error(`REINSTALL_APPLY_FAILED: ${applied.output}`);
|
|
@@ -340,7 +345,7 @@ export function identifyDesktopProcesses(root, value) {
|
|
|
340
345
|
/** Wait through incomplete shutdown snapshots, but require a complete empty snapshot before writing. */
|
|
341
346
|
export async function waitForDesktopExit(deps) {
|
|
342
347
|
const now = deps.now ?? Date.now;
|
|
343
|
-
const deadline = now() +
|
|
348
|
+
const deadline = now() + MAINTENANCE_QUIT_WAIT_MS;
|
|
344
349
|
let incomplete = false;
|
|
345
350
|
while (now() < deadline) {
|
|
346
351
|
deps.checkCancelled();
|
|
@@ -450,7 +455,7 @@ async function clearStaleLock(lockPath, home) {
|
|
|
450
455
|
try {
|
|
451
456
|
const info = await statAsync(lockPath);
|
|
452
457
|
// Never touch a lock another request may still be preparing (concurrent start window).
|
|
453
|
-
if (Date.now() - info.mtimeMs <
|
|
458
|
+
if (Date.now() - info.mtimeMs < MAINTENANCE_RESULT_CACHE_MS)
|
|
454
459
|
return false;
|
|
455
460
|
const id = (await readFile(lockPath, 'utf8')).trim();
|
|
456
461
|
if (!/^(?:install|uninstall|reinstall)-[A-Za-z0-9]+$/.test(id))
|
|
@@ -491,11 +496,11 @@ function validatePlan(value, path, now = Date.now()) {
|
|
|
491
496
|
throw new Error('invalid automatic maintenance plan');
|
|
492
497
|
const plan = value;
|
|
493
498
|
const created = typeof plan.createdAt === 'string' ? Date.parse(plan.createdAt) : NaN;
|
|
494
|
-
if (plan.version !== 1 || plan.action !== 'reinstall'
|
|
499
|
+
if (plan.version !== 1 || (plan.action !== 'reinstall' && plan.action !== 'uninstall')
|
|
495
500
|
|| typeof plan.dependency !== 'string' || plan.dependency.trim() === ''
|
|
496
|
-
|| typeof plan.id !== 'string' || !/^reinstall-[A-Za-z0-9]+$/.test(plan.id)
|
|
501
|
+
|| typeof plan.id !== 'string' || !/^(?:reinstall|uninstall)-[A-Za-z0-9]+$/.test(plan.id)
|
|
497
502
|
|| ![plan.root, plan.home, plan.nodePath, plan.directory].every(p => typeof p === 'string' && isAbsolute(p))
|
|
498
|
-
|| typeof plan.electronNode !== 'boolean' || !Number.isFinite(created) || created > now || now - created >
|
|
503
|
+
|| typeof plan.electronNode !== 'boolean' || !Number.isFinite(created) || created > now || now - created > MAINTENANCE_PLAN_MAX_AGE_MS
|
|
499
504
|
|| (plan.locale !== undefined && !['zh', 'en'].includes(plan.locale))) {
|
|
500
505
|
throw new Error('invalid or expired automatic maintenance plan');
|
|
501
506
|
}
|
|
@@ -544,7 +549,7 @@ export async function commitAutomaticMaintenance(jobId, home = homePath()) {
|
|
|
544
549
|
/** Only the new, authenticated explicit-click endpoint calls this function. */
|
|
545
550
|
export async function startAutomaticMaintenance(action, root, options = {}) {
|
|
546
551
|
requireLiveDesktop();
|
|
547
|
-
if (action !== 'reinstall')
|
|
552
|
+
if (action !== 'reinstall' && action !== 'uninstall')
|
|
548
553
|
throw new Error('invalid bridge maintenance action');
|
|
549
554
|
if (options.locale !== undefined && !['zh', 'en'].includes(options.locale))
|
|
550
555
|
throw new Error('invalid bridge maintenance locale');
|
|
@@ -575,7 +580,7 @@ export async function startAutomaticMaintenance(action, root, options = {}) {
|
|
|
575
580
|
try {
|
|
576
581
|
const prepared = await prepareBridgeMaintenance('install', root, { directory: base });
|
|
577
582
|
const original = JSON.parse(await readFile(prepared.planPath, 'utf8'));
|
|
578
|
-
const id = basename(prepared.directory).replace(/^install-/, 'reinstall-');
|
|
583
|
+
const id = basename(prepared.directory).replace(/^install-/, action === 'uninstall' ? 'uninstall-' : 'reinstall-');
|
|
579
584
|
const directory = join(base, id);
|
|
580
585
|
await renameMaintenanceFile(prepared.directory, directory);
|
|
581
586
|
const stagedWorker = await stageReinstallRuntime(directory);
|
|
@@ -709,6 +714,7 @@ async function runWorker(path) {
|
|
|
709
714
|
return await withProfileCheckpoint(plan.home, plan.directory, async () => {
|
|
710
715
|
const residue = await cleanProfileResidue(plan.home);
|
|
711
716
|
const result = await runReinstallTransaction({
|
|
717
|
+
// The action rides on the plan; the worker only executes what it was committed to.
|
|
712
718
|
remove: () => profile('uninstall'),
|
|
713
719
|
absent: async () => {
|
|
714
720
|
const manifest = JSON.parse(await readFile(join(plan.home, 'profiles', 'desktop', 'package.json'), 'utf8'));
|
|
@@ -717,7 +723,7 @@ async function runWorker(path) {
|
|
|
717
723
|
revert: () => bridge('uninstall'),
|
|
718
724
|
hostAbsent: () => inspectReinstallHost(plan.root).status === 'absent',
|
|
719
725
|
apply: () => bridge('install'), add: () => profile('install'),
|
|
720
|
-
});
|
|
726
|
+
}, plan.action);
|
|
721
727
|
extension = await installedProfileExtension(plan.home);
|
|
722
728
|
return { ...result, output: [residue, result.output].filter(Boolean).join('\n') };
|
|
723
729
|
}, { reconcile: () => reconcileProfile(plan.root, plan.home) });
|
|
@@ -68,9 +68,6 @@ export const ENDPOINT_STALE_AFTER_MS = ENDPOINT_TTL_MS;
|
|
|
68
68
|
* become a dead plugin.
|
|
69
69
|
*/
|
|
70
70
|
export class BridgeConnection {
|
|
71
|
-
endpoint;
|
|
72
|
-
endpointPath;
|
|
73
|
-
onLost;
|
|
74
71
|
socket;
|
|
75
72
|
buffer = '';
|
|
76
73
|
/** Outstanding requests by id. */
|
|
@@ -82,11 +79,9 @@ export class BridgeConnection {
|
|
|
82
79
|
serialisable = false;
|
|
83
80
|
/** True once the shell behind this connection has been reported gone. */
|
|
84
81
|
lostNotified = false;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
* @param onLost - called once when this connection concludes the shell behind it is gone.
|
|
89
|
-
*/
|
|
82
|
+
endpoint;
|
|
83
|
+
endpointPath;
|
|
84
|
+
onLost;
|
|
90
85
|
constructor(endpoint, endpointPath, onLost) {
|
|
91
86
|
this.endpoint = endpoint;
|
|
92
87
|
this.endpointPath = endpointPath;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MAINTENANCE_PROCESS_TIMEOUT_MS } from '../../assets/browser-policy.mjs';
|
|
1
2
|
/**
|
|
2
3
|
* Install, repair or remove the desktop bridge from the settings panel.
|
|
3
4
|
*
|
|
@@ -31,7 +32,7 @@ export async function runBridgeReinstall(deps) {
|
|
|
31
32
|
*/
|
|
32
33
|
export async function waitForRestartedBridge(pid, options = {}) {
|
|
33
34
|
const path = options.endpointPath ?? bridgeEndpointPath();
|
|
34
|
-
const timeoutMs = options.timeoutMs ??
|
|
35
|
+
const timeoutMs = options.timeoutMs ?? MAINTENANCE_PROCESS_TIMEOUT_MS;
|
|
35
36
|
const deadline = Date.now() + timeoutMs;
|
|
36
37
|
while (Date.now() < deadline) {
|
|
37
38
|
try {
|
|
@@ -20,6 +20,8 @@ import { isAbsolute, join, relative } from 'node:path';
|
|
|
20
20
|
import { fileURLToPath } from 'node:url';
|
|
21
21
|
import { createRequire } from 'node:module';
|
|
22
22
|
import { desktopPaths, readDesktopIdentity } from './desktop-identity.js';
|
|
23
|
+
import { classifyDesktopShell, noDesktopShell, tauriShell } from './desktop-shell.js';
|
|
24
|
+
import { findTauriRuntime, runningTauriRuntime, tauriHostPatchStatus } from './tauri-host.js';
|
|
23
25
|
import { MAIN_EXTENSION_UNSUPPORTED } from './profile-extension.js';
|
|
24
26
|
import { BRIDGE_VERSION_MESSAGE } from '../bridge-compatibility.js';
|
|
25
27
|
import { conventionalInstallRoots, registeredInstallLocations } from '../../desktop-bridge/desktop-discovery.mjs';
|
|
@@ -45,21 +47,56 @@ const rawExistsSync = (() => {
|
|
|
45
47
|
* @returns the install directory, or undefined when nothing matches.
|
|
46
48
|
*/
|
|
47
49
|
export function findDesktopInstall(localAppData, registry = registeredInstallLocations, conventions = conventionalInstallRoots) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
for (const candidate of desktopInstallCandidates(localAppData, registry, conventions)) {
|
|
51
|
+
if (readDesktopIdentity(candidate).ok)
|
|
52
|
+
return candidate;
|
|
53
|
+
}
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Classify the desktop shell on this machine.
|
|
58
|
+
*
|
|
59
|
+
* The DSH Tauri hosting this process wins; then a verified official install found by the same walk as
|
|
60
|
+
* {@link findDesktopInstall}; then an installed DSH Tauri; else the first recognised DSH-named shell
|
|
61
|
+
* (third-party or unsupported) is reported, so the settings page can say what it found instead of
|
|
62
|
+
* "no install" — and never offer to patch it.
|
|
63
|
+
* @param options - discovery overrides and the browser to recommend when the sidebar is unavailable.
|
|
64
|
+
* @returns the structured report.
|
|
65
|
+
*/
|
|
66
|
+
export function detectDesktopShell(options = {}) {
|
|
67
|
+
const running = runningTauriRuntime(options.execPath);
|
|
68
|
+
if (running !== undefined)
|
|
69
|
+
return tauriShell(running, tauriHostPatchStatus(running.runtime));
|
|
70
|
+
let recognised;
|
|
71
|
+
for (const candidate of desktopInstallCandidates(options.localAppData, options.registry, options.conventions)) {
|
|
72
|
+
const report = classifyDesktopShell(candidate, readDesktopIdentity(candidate), options);
|
|
73
|
+
if (report.kind === 'official-supported')
|
|
74
|
+
return report;
|
|
75
|
+
if (report.kind !== 'none' && recognised === undefined)
|
|
76
|
+
recognised = report;
|
|
77
|
+
}
|
|
78
|
+
const tauri = findTauriRuntime({ execPath: options.execPath, localAppData: options.localAppData, registry: options.tauriRegistry ?? options.registry });
|
|
79
|
+
if (tauri !== undefined)
|
|
80
|
+
return tauriShell(tauri, tauriHostPatchStatus(tauri.runtime));
|
|
81
|
+
return recognised ?? noDesktopShell(options);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Every directory that might hold a desktop install, most specific first.
|
|
85
|
+
*
|
|
86
|
+
* Not every install lives in %LOCALAPPDATA%\\Programs: people put the app on another drive, under
|
|
87
|
+
* Program Files, or in their own folder. DSH_DESKTOP_PATH names one explicitly, and the usual roots
|
|
88
|
+
* are all probed. A test or a caller that passes a base directory gets exactly that base, so the
|
|
89
|
+
* behaviour stays pinnable. Candidates are unverified; callers check identity.
|
|
90
|
+
*/
|
|
91
|
+
function* desktopInstallCandidates(localAppData, registry = registeredInstallLocations, conventions = conventionalInstallRoots) {
|
|
53
92
|
for (const explicit of [process.env.DSH_DESKTOP_PATH, process.env.DSH_DESKTOP_APP]) {
|
|
54
93
|
if (explicit !== undefined && explicit !== '') {
|
|
55
|
-
|
|
56
|
-
if (isDesktop(named))
|
|
57
|
-
return named;
|
|
94
|
+
yield explicit;
|
|
58
95
|
// A parent directory is a reasonable thing to point at too: look one level down.
|
|
59
96
|
try {
|
|
60
|
-
for (const entry of readdirSync(
|
|
61
|
-
if (entry.isDirectory()
|
|
62
|
-
|
|
97
|
+
for (const entry of readdirSync(explicit, { withFileTypes: true })) {
|
|
98
|
+
if (entry.isDirectory())
|
|
99
|
+
yield join(explicit, entry.name);
|
|
63
100
|
}
|
|
64
101
|
}
|
|
65
102
|
catch {
|
|
@@ -69,18 +106,12 @@ export function findDesktopInstall(localAppData, registry = registeredInstallLoc
|
|
|
69
106
|
}
|
|
70
107
|
const roots = localAppData === undefined ? desktopInstallRoots() : [join(localAppData, 'Programs')];
|
|
71
108
|
for (const base of roots) {
|
|
72
|
-
for (const named of DESKTOP_INSTALL_NAMES)
|
|
73
|
-
|
|
74
|
-
if (isDesktop(candidate))
|
|
75
|
-
return candidate;
|
|
76
|
-
}
|
|
109
|
+
for (const named of DESKTOP_INSTALL_NAMES)
|
|
110
|
+
yield join(base, named);
|
|
77
111
|
try {
|
|
78
112
|
for (const entry of readdirSync(base, { withFileTypes: true })) {
|
|
79
|
-
if (
|
|
80
|
-
|
|
81
|
-
const candidate = join(base, entry.name);
|
|
82
|
-
if (isDesktop(candidate))
|
|
83
|
-
return candidate;
|
|
113
|
+
if (entry.isDirectory())
|
|
114
|
+
yield join(base, entry.name);
|
|
84
115
|
}
|
|
85
116
|
}
|
|
86
117
|
catch {
|
|
@@ -88,15 +119,13 @@ export function findDesktopInstall(localAppData, registry = registeredInstallLoc
|
|
|
88
119
|
}
|
|
89
120
|
}
|
|
90
121
|
for (const source of [registry, conventions]) {
|
|
122
|
+
let found = [];
|
|
91
123
|
try {
|
|
92
|
-
|
|
93
|
-
if (isDesktop(candidate))
|
|
94
|
-
return candidate;
|
|
95
|
-
}
|
|
124
|
+
found = source();
|
|
96
125
|
}
|
|
97
126
|
catch { }
|
|
127
|
+
yield* found;
|
|
98
128
|
}
|
|
99
|
-
return undefined;
|
|
100
129
|
}
|
|
101
130
|
/** Directory names an install is given: a plain directory on Windows, an `.app` bundle on macOS. */
|
|
102
131
|
const DESKTOP_INSTALL_NAMES = ['DSH Desktop', 'DeepSeek Harness', 'DSH Desktop.app', 'DeepSeek Harness.app'];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CARRIER_CALL_TIMEOUT_MS, CARRIER_DOWNLOAD_TIMEOUT_MS, CARRIER_PROBE_TIMEOUT_MS } from '../../assets/browser-policy.mjs';
|
|
1
2
|
/** Drive the visible sidebar guest through canonical, bridge-bound handles. */
|
|
2
3
|
import { BridgeConnection } from './bridge-connection.js';
|
|
3
4
|
import { readFileSync } from 'node:fs';
|
|
@@ -17,7 +18,6 @@ export class BrowserPanelNotDisplayedError extends Error {
|
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
export class DesktopBridgeViewHost {
|
|
20
|
-
isQuiet;
|
|
21
21
|
referenceOverlayOwner = 'client';
|
|
22
22
|
connection;
|
|
23
23
|
views = new Map();
|
|
@@ -27,6 +27,7 @@ export class DesktopBridgeViewHost {
|
|
|
27
27
|
lostListener;
|
|
28
28
|
static refuseIframe = false;
|
|
29
29
|
static versionError;
|
|
30
|
+
isQuiet;
|
|
30
31
|
constructor(endpoint, isQuiet = () => false) {
|
|
31
32
|
this.isQuiet = isQuiet;
|
|
32
33
|
this.connection = new BridgeConnection(endpoint, bridgeEndpointPath(), () => this.lostListener?.('shell-exited'));
|
|
@@ -50,7 +51,7 @@ export class DesktopBridgeViewHost {
|
|
|
50
51
|
}
|
|
51
52
|
const probe = new BridgeConnection(endpoint, bridgeEndpointPath());
|
|
52
53
|
try {
|
|
53
|
-
const answer = await probe.call({ op: 'list' },
|
|
54
|
+
const answer = await probe.call({ op: 'list' }, CARRIER_PROBE_TIMEOUT_MS);
|
|
54
55
|
if (isBridgeVersionMismatch(answer))
|
|
55
56
|
throw new BridgeVersionError();
|
|
56
57
|
if (answer.ok !== true)
|
|
@@ -77,7 +78,7 @@ export class DesktopBridgeViewHost {
|
|
|
77
78
|
}
|
|
78
79
|
async listPages(scope, _options = {}) {
|
|
79
80
|
resolveSessionHandle(scope);
|
|
80
|
-
const answer = await this.connection.call({ op: 'list', handle: scope },
|
|
81
|
+
const answer = await this.connection.call({ op: 'list', handle: scope }, CARRIER_PROBE_TIMEOUT_MS);
|
|
81
82
|
if (answer.ok !== true)
|
|
82
83
|
throw new Error(String(answer.error ?? 'sidebar page listing failed'));
|
|
83
84
|
if (!Array.isArray(answer.sidebar))
|
|
@@ -130,7 +131,7 @@ export class DesktopBridgeViewHost {
|
|
|
130
131
|
}
|
|
131
132
|
if (entry.adopted)
|
|
132
133
|
throw new Error('dsh-builtin-browser: the sidebar page this view was adopted from is gone');
|
|
133
|
-
const deadline = options?.deadline ?? Date.now() +
|
|
134
|
+
const deadline = options?.deadline ?? Date.now() + CARRIER_CALL_TIMEOUT_MS;
|
|
134
135
|
const transactionId = randomUUID();
|
|
135
136
|
const cancel = () => { void this.connection.call({ op: 'cancelSidebar', handle: id, transactionId }, 2_000).catch(() => { }); };
|
|
136
137
|
options?.signal?.addEventListener('abort', cancel, { once: true });
|
|
@@ -171,7 +172,7 @@ export class DesktopBridgeViewHost {
|
|
|
171
172
|
id,
|
|
172
173
|
download: async (url, savePath) => {
|
|
173
174
|
await this.guestFor(id);
|
|
174
|
-
const answer = await this.connection.call({ op: 'download', handle: id, url, savePath },
|
|
175
|
+
const answer = await this.connection.call({ op: 'download', handle: id, url, savePath }, CARRIER_DOWNLOAD_TIMEOUT_MS);
|
|
175
176
|
if (answer.ok !== true)
|
|
176
177
|
throw new Error(`dsh-builtin-browser: sidebar download failed: ${String(answer.error)}`);
|
|
177
178
|
},
|
|
@@ -204,7 +205,7 @@ export class DesktopBridgeViewHost {
|
|
|
204
205
|
return;
|
|
205
206
|
if (!this.views.get(handle.id)?.bound)
|
|
206
207
|
return;
|
|
207
|
-
void this.connection.call({ op: 'showTab', handle: tabWireId(readTabHandle(handle.id)) },
|
|
208
|
+
void this.connection.call({ op: 'showTab', handle: tabWireId(readTabHandle(handle.id)) }, CARRIER_PROBE_TIMEOUT_MS).catch(() => { });
|
|
208
209
|
}
|
|
209
210
|
onUserAction(_handler) { }
|
|
210
211
|
async presentView(handle, _label, options) {
|
|
@@ -44,11 +44,17 @@ const archiveFs = (() => {
|
|
|
44
44
|
export const FALLBACK_RULE = {
|
|
45
45
|
packageNames: ['@deepseek-ai/dsh-desktop', 'dsh-desktop'],
|
|
46
46
|
mainEntry: 'lib/main.js',
|
|
47
|
+
unsupportedMainEntries: {
|
|
48
|
+
'out/main/index.js': 'the electron-vite layout of a third-party DSH Desktop (dataelement/dsh-desktop, issue #62), which shares the package name but not the DeepSeek Harness Desktop shell the bridge patches',
|
|
49
|
+
},
|
|
47
50
|
layouts: [
|
|
48
51
|
{ name: 'macos-bundle', marker: 'Contents/Info.plist', resources: 'Contents/Resources', executable: 'Contents/MacOS/DeepSeek Harness', cliLauncher: 'runtime/cli/bin/dsh' },
|
|
49
52
|
{ name: 'directory', resources: 'resources', executable: 'DeepSeek Harness.exe', cliLauncher: 'runtime/cli/bin/dsh.cmd' },
|
|
50
53
|
],
|
|
51
54
|
};
|
|
55
|
+
function versionOf(manifest) {
|
|
56
|
+
return typeof manifest.version === 'string' ? { version: manifest.version } : {};
|
|
57
|
+
}
|
|
52
58
|
/**
|
|
53
59
|
* Read the identity rule.
|
|
54
60
|
*
|
|
@@ -78,7 +84,14 @@ export function readIdentityRule() {
|
|
|
78
84
|
|| layouts[layouts.length - 1]?.marker !== undefined) {
|
|
79
85
|
return { error: 'desktop-identity.json: layouts must be a non-empty array whose last entry has no marker' };
|
|
80
86
|
}
|
|
81
|
-
|
|
87
|
+
const unsupported = raw.unsupportedMainEntries;
|
|
88
|
+
if (unsupported !== undefined && (unsupported === null || typeof unsupported !== 'object' || Array.isArray(unsupported)
|
|
89
|
+
|| Object.entries(unsupported).some(([entry, reason]) => entry === '' || !field(reason)))) {
|
|
90
|
+
return { error: 'desktop-identity.json: unsupportedMainEntries must map entry paths to reasons' };
|
|
91
|
+
}
|
|
92
|
+
return unsupported === undefined
|
|
93
|
+
? { packageNames: names, mainEntry: main, layouts }
|
|
94
|
+
: { packageNames: names, mainEntry: main, unsupportedMainEntries: unsupported, layouts };
|
|
82
95
|
}
|
|
83
96
|
catch (error) {
|
|
84
97
|
if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {
|
|
@@ -230,6 +243,7 @@ export function readDesktopIdentity(installRoot) {
|
|
|
230
243
|
const layout = archivePresent ? 'packed' : 'unpacked';
|
|
231
244
|
let manifestText;
|
|
232
245
|
let mainPresent;
|
|
246
|
+
let hasEntry;
|
|
233
247
|
if (archivePresent) {
|
|
234
248
|
const parsed = readAsarHeader(archive);
|
|
235
249
|
if ('error' in parsed) {
|
|
@@ -243,7 +257,8 @@ export function readDesktopIdentity(installRoot) {
|
|
|
243
257
|
if (manifestText === undefined) {
|
|
244
258
|
return { ok: false, reason: `${archive}: package.json is listed but its bytes cannot be read` };
|
|
245
259
|
}
|
|
246
|
-
|
|
260
|
+
hasEntry = entry => entryAt(parsed.header.files, entry) !== undefined;
|
|
261
|
+
mainPresent = hasEntry(rule.mainEntry);
|
|
247
262
|
}
|
|
248
263
|
else {
|
|
249
264
|
const manifestPath = join(appDir, 'package.json');
|
|
@@ -251,10 +266,14 @@ export function readDesktopIdentity(installRoot) {
|
|
|
251
266
|
manifestText = readFileSync(manifestPath, 'utf8');
|
|
252
267
|
}
|
|
253
268
|
catch (error) {
|
|
254
|
-
|
|
269
|
+
// Candidate probe directories routinely do not contain resources/app/package.json (issue #106).
|
|
270
|
+
if (error.code !== 'ENOENT') {
|
|
271
|
+
console.error(`[dsh-browser] cannot read the package manifest at ${manifestPath}: ${String(error)}`);
|
|
272
|
+
}
|
|
255
273
|
return { ok: false, reason: `${manifestPath} is missing; a directory without a package manifest is not a DSH Desktop install` };
|
|
256
274
|
}
|
|
257
|
-
|
|
275
|
+
hasEntry = entry => existsSync(join(appDir, ...entry.split('/')));
|
|
276
|
+
mainPresent = hasEntry(rule.mainEntry);
|
|
258
277
|
}
|
|
259
278
|
let manifest;
|
|
260
279
|
try {
|
|
@@ -274,7 +293,11 @@ export function readDesktopIdentity(installRoot) {
|
|
|
274
293
|
// The main entry is the file the installer patches and the shell runs; if it is not there, this
|
|
275
294
|
// is not an install this plugin can reason about even though the manifest looks right.
|
|
276
295
|
if (!mainPresent) {
|
|
277
|
-
|
|
296
|
+
const foreign = Object.entries(rule.unsupportedMainEntries ?? {}).find(([entry]) => hasEntry(entry));
|
|
297
|
+
if (foreign !== undefined) {
|
|
298
|
+
return { ok: false, shell: 'third-party-shell', ...versionOf(manifest), reason: `${foreign[0]} instead of ${rule.mainEntry}: ${foreign[1]}; use DSH Web or DeepSeek Harness Desktop` };
|
|
299
|
+
}
|
|
300
|
+
return { ok: false, shell: 'official-unsupported', ...versionOf(manifest), reason: `${rule.mainEntry} is not present under ${archivePresent ? archive : appDir}` };
|
|
278
301
|
}
|
|
279
302
|
return {
|
|
280
303
|
ok: true,
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The system browser to recommend when the sidebar cannot carry the browser.
|
|
3
|
+
* @param hints - the user's current channel and platform.
|
|
4
|
+
* @returns `chrome` or `edge`.
|
|
5
|
+
*/
|
|
6
|
+
export function systemCarrier(hints = {}) {
|
|
7
|
+
if (hints.preferredBrowser === 'chrome' || hints.preferredBrowser === 'edge')
|
|
8
|
+
return hints.preferredBrowser;
|
|
9
|
+
return (hints.platform ?? process.platform) === 'win32' ? 'edge' : 'chrome';
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Classify one candidate install from its identity reading.
|
|
13
|
+
* @param root - the install directory.
|
|
14
|
+
* @param identity - `readDesktopIdentity(root)`.
|
|
15
|
+
* @param hints - used for the recommended carrier of an unpatchable shell.
|
|
16
|
+
* @returns the report; `none` when the directory is not a DSH-named shell at all.
|
|
17
|
+
*/
|
|
18
|
+
export function classifyDesktopShell(root, identity, hints = {}) {
|
|
19
|
+
if (identity.ok) {
|
|
20
|
+
return { kind: 'official-supported', patchable: true, reason: `DeepSeek Harness Desktop ${identity.version} at ${root}`, recommendedCarrier: 'sidebar', root, version: identity.version };
|
|
21
|
+
}
|
|
22
|
+
if (identity.shell === undefined)
|
|
23
|
+
return { ...noDesktopShell(hints), reason: identity.reason };
|
|
24
|
+
return {
|
|
25
|
+
kind: identity.shell,
|
|
26
|
+
patchable: false,
|
|
27
|
+
reason: identity.reason,
|
|
28
|
+
recommendedCarrier: systemCarrier(hints),
|
|
29
|
+
root,
|
|
30
|
+
...identity.version === undefined ? {} : { version: identity.version },
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The report when no DSH desktop shell was found.
|
|
35
|
+
* @param hints - used for the recommended carrier.
|
|
36
|
+
* @returns a `none` report.
|
|
37
|
+
*/
|
|
38
|
+
export function noDesktopShell(hints = {}) {
|
|
39
|
+
return {
|
|
40
|
+
kind: 'none',
|
|
41
|
+
patchable: false,
|
|
42
|
+
reason: 'no DSH Desktop install found in the usual roots, at DSH_DESKTOP_PATH or DSH_DESKTOP_APP, in the uninstall registry, or at this platform\'s conventional locations',
|
|
43
|
+
recommendedCarrier: systemCarrier(hints),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The report for DSH Tauri. Its sidebar is driven through its own `dshDesktop.browser`; what the
|
|
48
|
+
* plugin patches is only the sidebar partition (`dsh-host-patch/tauri.json`), never the bridge.
|
|
49
|
+
* @param runtime - the Tauri runtime.
|
|
50
|
+
* @param hostPatch - the runtime's host patch state.
|
|
51
|
+
* @returns a `tauri` report, patchable when the patch can be applied or is applied.
|
|
52
|
+
*/
|
|
53
|
+
export function tauriShell(runtime, hostPatch) {
|
|
54
|
+
return {
|
|
55
|
+
kind: 'tauri',
|
|
56
|
+
patchable: hostPatch.status === 'absent' || hostPatch.status === 'applied',
|
|
57
|
+
reason: `DSH Tauri at ${runtime.root ?? runtime.runtime}; sidebar host patch ${hostPatch.status}${hostPatch.reason === undefined ? '' : `: ${hostPatch.reason}`}`,
|
|
58
|
+
recommendedCarrier: 'sidebar',
|
|
59
|
+
...runtime.root === undefined ? {} : { root: runtime.root },
|
|
60
|
+
runtime: runtime.runtime,
|
|
61
|
+
running: runtime.running,
|
|
62
|
+
hostPatch,
|
|
63
|
+
};
|
|
64
|
+
}
|