dsh-builtin-browser 0.5.8 → 1.0.1
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 +410 -1
- package/README.en.md +16 -64
- package/README.md +33 -64
- package/assets/browser-carriers.svg +20 -0
- package/assets/browser-extension-identity.d.mts +2 -0
- package/assets/browser-extension-identity.mjs +2 -0
- package/assets/browser-messages.d.mts +5 -0
- package/assets/browser-messages.mjs +64 -0
- package/assets/browser-panel-locales.d.mts +2 -0
- package/assets/browser-panel-locales.mjs +380 -0
- package/assets/browser-policy.d.mts +37 -0
- package/assets/browser-policy.mjs +37 -0
- package/assets/browser-products.d.mts +6 -0
- package/assets/browser-products.mjs +76 -0
- package/assets/screenshots/1-main.png +0 -0
- package/assets/screenshots/2-form-fill.png +0 -0
- package/assets/screenshots/3-challenge.png +0 -0
- package/browser-extension/constants.mjs +20 -0
- package/browser-extension/controller.mjs +293 -0
- package/browser-extension/locales.mjs +15 -0
- package/browser-extension/manifest.json +12 -0
- package/browser-extension/options.html +14 -0
- package/browser-extension/options.mjs +9 -0
- package/browser-extension/permission-guard.mjs +13 -0
- package/browser-extension/worker.mjs +74 -0
- package/cordis.patch.yml +23 -48
- package/desktop-bridge/desktop-discovery.d.mts +2 -0
- package/desktop-bridge/desktop-discovery.mjs +36 -0
- package/desktop-bridge/desktop-identity.json +17 -1
- package/desktop-bridge/desktop-processes.d.mts +1 -0
- package/desktop-bridge/desktop-processes.mjs +15 -0
- package/desktop-bridge/guest-proxy.mjs +109 -0
- package/desktop-bridge/install.mjs +197 -74
- package/desktop-bridge/main.mjs +11 -0
- package/desktop-bridge/maintenance-files.d.mts +8 -0
- package/desktop-bridge/maintenance-files.mjs +28 -0
- package/desktop-bridge/maintenance-progress.ps1 +2 -2
- package/desktop-bridge/native-guests.mjs +41 -0
- package/desktop-bridge/plugin-browser-bridge.js +618 -370
- package/desktop-bridge/profile-loader.mjs +26 -0
- package/dist/client.cjs +43167 -0
- package/dist/client.d.cts +516 -0
- package/dist/client.d.mts +516 -0
- package/dist/index.cjs +92 -0
- package/dist/index.d.mts +2960 -0
- package/dist/index.mjs +24 -0
- package/docs/HANDOVER-2026-11-15.md +178 -0
- package/docs/README.md +10 -19
- package/docs/architecture.md +17 -145
- package/docs/child-tabs.md +13 -0
- package/docs/desktop-acceptance.md +9 -0
- package/docs/development.md +88 -18
- package/docs/extension-browser.md +44 -0
- package/docs/hardcoding-audit.md +64 -0
- package/docs/limitations.md +23 -73
- package/docs/pr64-extension-status.md +46 -0
- package/docs/pr64-maintenance.md +25 -0
- package/docs/pr64-native-children.md +52 -0
- package/docs/pr64-native-views.md +60 -0
- package/docs/tool-reference.md +87 -11
- package/docs/user-guide.md +47 -255
- package/docs/why-browser.md +6 -39
- package/dsh-host-patch/README.md +60 -0
- package/dsh-host-patch/apply.mjs +194 -0
- package/dsh-host-patch/legacy-bridge.mjs +53 -0
- package/dsh-host-patch/rc3-revision1.json +90 -0
- package/dsh-host-patch/rc3-revision2.json +112 -0
- package/dsh-host-patch/rc3-revision3.json.gz +0 -0
- package/dsh-host-patch/rc3-revision4.json.gz +0 -0
- package/dsh-host-patch/rc3-revision5.json.gz +0 -0
- package/dsh-host-patch/rc3-revision6.json.gz +0 -0
- package/dsh-host-patch/rc3-revision7.json.gz +0 -0
- package/dsh-host-patch/rc3-revision8.json.gz +0 -0
- package/dsh-host-patch/rc3.json +148 -0
- package/dsh-host-patch/rc5-revision1.json +90 -0
- package/dsh-host-patch/rc5-revision2.json +112 -0
- package/dsh-host-patch/rc5-revision3.json.gz +0 -0
- package/dsh-host-patch/rc5-revision4.json.gz +0 -0
- package/dsh-host-patch/rc5-revision5.json.gz +0 -0
- package/dsh-host-patch/rc5-revision6.json.gz +0 -0
- package/dsh-host-patch/rc5-revision7.json.gz +0 -0
- package/dsh-host-patch/rc5-revision8.json.gz +0 -0
- package/dsh-host-patch/rc5.json +148 -0
- package/lib/bridge-compatibility.js +38 -0
- package/lib/browser/handles.js +78 -0
- package/lib/browser/runtime.js +155 -43
- package/lib/browser/takeover-target.js +24 -0
- package/lib/browser-electron/authenticated-route.js +23 -0
- package/lib/browser-electron/automatic-maintenance.js +394 -51
- package/lib/browser-electron/bridge-auto.js +2 -1
- package/lib/browser-electron/bridge-connection.js +8 -1
- package/lib/browser-electron/bridge-install.js +27 -2
- package/lib/browser-electron/bridge-maintenance.js +35 -10
- package/lib/browser-electron/bridge-status.js +98 -27
- package/lib/browser-electron/desktop-bridge-host.js +193 -560
- package/lib/browser-electron/desktop-identity.js +40 -2
- package/lib/browser-electron/document-readiness.js +34 -0
- package/lib/browser-electron/electron-provision.js +14 -44
- package/lib/browser-electron/entry.js +659 -252
- package/lib/browser-electron/extension-browser.js +234 -0
- package/lib/browser-electron/extension-setup.js +69 -0
- package/lib/browser-electron/guest-cookie-jar.LICENSE.txt +32 -0
- package/lib/browser-electron/guest-cookie-jar.js +10559 -0
- package/lib/browser-electron/guest-cookie-store.js +74 -0
- package/lib/browser-electron/guest-css-runtime.js +75 -0
- package/lib/browser-electron/guest-css.js +106 -0
- package/lib/browser-electron/guest-route.js +603 -0
- package/lib/browser-electron/guest-runtime.js +356 -0
- package/lib/browser-electron/guest-storage-runtime.js +52 -0
- package/lib/browser-electron/guest-storage.js +163 -0
- package/lib/browser-electron/history-store.js +2 -1
- package/lib/browser-electron/host-main.js +162 -7
- package/lib/browser-electron/host-patch-maintenance.js +141 -0
- package/lib/browser-electron/http-body.js +22 -0
- package/lib/browser-electron/maintenance-broker.js +35 -5
- package/lib/browser-electron/maintenance-lifecycle.js +7 -5
- package/lib/browser-electron/maintenance-route.js +9 -6
- package/lib/browser-electron/open-slot.js +47 -0
- package/lib/browser-electron/paths.js +4 -1
- package/lib/browser-electron/preferred-browser.js +144 -0
- package/lib/browser-electron/preview-route.js +11 -8
- package/lib/browser-electron/process-ownership.js +198 -0
- package/lib/browser-electron/profile-checkpoint.js +222 -0
- package/lib/browser-electron/profile-command.js +60 -0
- package/lib/browser-electron/profile-extension.js +126 -0
- package/lib/browser-electron/profile-lease.js +157 -0
- package/lib/browser-electron/profile-residue.js +61 -0
- package/lib/browser-electron/provider.js +719 -262
- package/lib/browser-electron/reference-route.js +635 -0
- package/lib/browser-electron/remote-host.js +12 -13
- package/lib/browser-electron/runtime-route.js +6 -5
- package/lib/browser-electron/runtime-status.js +30 -29
- package/lib/browser-electron/settings-store.js +10 -5
- package/lib/browser-electron/shortcuts-route.js +108 -0
- package/lib/browser-electron/sidebar-only-host.js +119 -18
- package/lib/browser-electron/startpage-shortcuts.js +172 -0
- package/lib/browser-electron/system-browser.js +352 -371
- package/lib/browser-electron/windows-system.js +2 -1
- package/lib/browser-reference/delivery.js +326 -0
- package/lib/browser-reference/entry.js +597 -0
- package/lib/browser-reference/export.js +298 -0
- package/lib/browser-reference/import.js +295 -0
- package/lib/browser-reference/page-script.js +1406 -0
- package/lib/browser-reference/service.js +1062 -0
- package/lib/browser-reference/store.js +177 -0
- package/lib/browser-reference/submission-receipts.js +139 -0
- package/lib/browser-reference/text-quote.js +167 -0
- package/lib/browser-reference/types.js +11 -0
- package/lib/browser-reference/visible.js +311 -0
- package/lib/browser-reference/web-sources.js +97 -0
- package/lib/index.js +10 -3
- package/lib/reference-owner.js +5 -0
- package/lib/reference-page.js +12 -0
- package/lib/reference-source.js +2 -0
- package/lib/reference-text.js +188 -0
- package/lib/startpage-settings.js +63 -0
- package/lib/startpage.js +44 -0
- package/lib/takeover-protocol.js +2 -0
- package/lib/tool-browser/code-tool.js +416 -0
- package/lib/tool-browser/code-worker.js +872 -0
- package/lib/tool-browser/index.js +940 -76
- package/lib/tool-browser/page-probe.js +3 -3
- package/lib/tool-browser/panel-page.js +95 -0
- package/lib/tool-browser/screenshot-image.js +51 -0
- package/lib/tool-browser/takeover.js +205 -0
- package/lib/types.js +1 -0
- package/lib/web-guest.js +26 -0
- package/native-host/client.d.mts +17 -0
- package/native-host/client.mjs +100 -0
- package/native-host/host.mjs +150 -0
- package/native-host/identity.d.mts +2 -0
- package/native-host/identity.mjs +1 -0
- package/native-host/install.mjs +168 -0
- package/native-host/protocol.mjs +75 -0
- package/package.json +80 -92
- package/scripts/build.mjs +66 -0
- package/scripts/bundle-host.mjs +28 -0
- package/scripts/fix-exports.mjs +50 -0
- package/scripts/install-electron.mjs +11 -26
- package/scripts/verify-exports.mjs +47 -0
- package/scripts/verify-preview-sdk.mjs +93 -0
- package/skills/dsh-builtin-browser/SKILL.md +56 -47
- package/skills/dsh-builtin-browser/references/batch.md +31 -1
- package/skills/dsh-debug-host/SKILL.md +56 -0
- package/skills/dsh-debug-self/SKILL.md +50 -0
- package/src/bridge-compatibility.ts +39 -0
- package/src/browser/handles.ts +89 -0
- package/src/browser/runtime.ts +146 -50
- package/src/browser/takeover-target.ts +36 -0
- package/src/browser/types.ts +19 -7
- package/src/browser-electron/authenticated-route.ts +29 -1
- package/src/browser-electron/automatic-maintenance.ts +368 -56
- package/src/browser-electron/bridge-auto.ts +5 -4
- package/src/browser-electron/bridge-connection.ts +20 -2
- package/src/browser-electron/bridge-endpoint.ts +3 -3
- package/src/browser-electron/bridge-install.ts +40 -4
- package/src/browser-electron/bridge-maintenance.ts +42 -14
- package/src/browser-electron/bridge-status.ts +94 -23
- package/src/browser-electron/desktop-bridge-host.ts +185 -585
- package/src/browser-electron/desktop-identity.ts +53 -2
- package/src/browser-electron/document-readiness.ts +45 -0
- package/src/browser-electron/electron-provision.ts +12 -45
- package/src/browser-electron/entry.ts +1299 -882
- package/src/browser-electron/ephemeral-profile.ts +1 -1
- package/src/browser-electron/extension-browser.ts +223 -0
- package/src/browser-electron/extension-setup.ts +67 -0
- package/src/browser-electron/guest-cookie-jar.ts +176 -0
- package/src/browser-electron/guest-cookie-store.ts +59 -0
- package/src/browser-electron/guest-css-runtime.ts +76 -0
- package/src/browser-electron/guest-css.ts +68 -0
- package/src/browser-electron/guest-route.ts +568 -0
- package/src/browser-electron/guest-runtime.ts +357 -0
- package/src/browser-electron/guest-storage-runtime.ts +54 -0
- package/src/browser-electron/guest-storage.ts +117 -0
- package/src/browser-electron/history-store.ts +5 -4
- package/src/browser-electron/host-main.ts +156 -11
- package/src/browser-electron/host-patch-maintenance.ts +112 -0
- package/src/browser-electron/http-body.ts +23 -0
- package/src/browser-electron/maintenance-broker.ts +29 -5
- package/src/browser-electron/maintenance-lifecycle.ts +14 -9
- package/src/browser-electron/maintenance-route.ts +17 -14
- package/src/browser-electron/missing-system-browser.ts +2 -2
- package/src/browser-electron/open-slot.ts +49 -0
- package/src/browser-electron/paths.ts +5 -1
- package/src/browser-electron/preferred-browser.ts +120 -0
- package/src/browser-electron/preview-route.ts +18 -11
- package/src/browser-electron/process-ownership.ts +168 -0
- package/src/browser-electron/profile-checkpoint.ts +187 -0
- package/src/browser-electron/profile-command.ts +46 -0
- package/src/browser-electron/profile-extension.ts +124 -0
- package/src/browser-electron/profile-lease.ts +115 -0
- package/src/browser-electron/profile-residue.ts +49 -0
- package/src/browser-electron/provider.ts +771 -289
- package/src/browser-electron/reference-route.ts +608 -0
- package/src/browser-electron/remote-host.ts +15 -15
- package/src/browser-electron/runtime-route.ts +11 -10
- package/src/browser-electron/runtime-status.ts +51 -32
- package/src/browser-electron/settings-store.ts +27 -7
- package/src/browser-electron/shortcuts-route.ts +112 -0
- package/src/browser-electron/sidebar-only-host.ts +118 -19
- package/src/browser-electron/startpage-shortcuts.ts +213 -0
- package/src/browser-electron/system-browser.ts +309 -338
- package/src/browser-electron/windows-system.ts +2 -1
- package/src/browser-reference/delivery.ts +384 -0
- package/src/browser-reference/entry.ts +631 -0
- package/src/browser-reference/export.ts +339 -0
- package/src/browser-reference/import.ts +303 -0
- package/src/browser-reference/page-script.ts +1537 -0
- package/src/browser-reference/service.ts +1315 -0
- package/src/browser-reference/store.ts +172 -0
- package/src/browser-reference/submission-receipts.ts +122 -0
- package/src/browser-reference/text-quote.ts +219 -0
- package/src/browser-reference/types.ts +195 -0
- package/src/browser-reference/visible.ts +367 -0
- package/src/browser-reference/web-sources.ts +103 -0
- package/src/client/browser/BrowserController.ts +693 -0
- package/src/client/browser/BrowserFrame.ts +78 -0
- package/src/client/browser/BrowserNavigation.ts +169 -0
- package/src/client/browser/BrowserPage.ts +23 -0
- package/src/client/browser/BrowserPersistence.ts +44 -0
- package/src/client/browser/IframeImpl.ts +176 -0
- package/src/client/browser/child-tabs.ts +14 -0
- package/src/client/browser/iframe-reference.ts +67 -0
- package/src/client/browser/initialization.ts +262 -0
- package/src/client/browser/omnibox.ts +243 -0
- package/src/client/browser/store.ts +38 -0
- package/src/client/browser/takeover-channel.ts +72 -0
- package/src/client/browser/url.ts +46 -0
- package/src/client/browser/web-reference-source.ts +52 -0
- package/src/client/css-modules.d.ts +4 -0
- package/src/client/definition.tsx +30 -0
- package/src/client/electron/ElectronWebViewImpl.ts +364 -0
- package/src/client/electron/ElectronWebviewPresentation.ts +138 -0
- package/src/client/electron/NativeChildPresentation.ts +45 -0
- package/src/client/electron/NativeViewPage.ts +251 -0
- package/src/client/electron/pages.ts +23 -0
- package/src/client/electron/reference-overlay.ts +53 -0
- package/src/client/electron/workspace.ts +33 -0
- package/src/client/index.ts +293 -0
- package/src/client/locales.ts +857 -0
- package/src/client/pages.ts +28 -0
- package/src/client/reference/client/BrowserRefLink.tsx +142 -0
- package/src/client/reference/client/draft-reference.ts +167 -0
- package/src/client/reference/client/index.ts +7 -0
- package/src/client/reference/client/ordered-submission.ts +108 -0
- package/src/client/reference/client/pending-delivery.ts +216 -0
- package/src/client/reference/client/plugin.ts +189 -0
- package/src/client/reference/client/production/ReferenceCapsules.tsx +345 -0
- package/src/client/reference/client/production/ReferenceDock.module.css +193 -0
- package/src/client/reference/client/production/ReferenceDock.tsx +6 -0
- package/src/client/reference/client/production/ReferenceFeedback.tsx +15 -0
- package/src/client/reference/client/production/ReferenceMath.tsx +44 -0
- package/src/client/reference/client/production/ReferenceText.tsx +36 -0
- package/src/client/reference/client/production/assembly.ts +471 -0
- package/src/client/reference/client/production/asset-store.ts +144 -0
- package/src/client/reference/client/production/availability.ts +74 -0
- package/src/client/reference/client/production/bytes.ts +36 -0
- package/src/client/reference/client/production/delivery-client.ts +211 -0
- package/src/client/reference/client/production/draft-adapter.ts +508 -0
- package/src/client/reference/client/production/http-transport.ts +217 -0
- package/src/client/reference/client/production/production-submission.ts +310 -0
- package/src/client/reference/client/production/protocol.ts +231 -0
- package/src/client/reference/client/production/reference-card.ts +240 -0
- package/src/client/reference/client/production/reference-labels.ts +29 -0
- package/src/client/reference/client/production/reply-link-bridge.ts +222 -0
- package/src/client/reference/client/production/reveal.ts +215 -0
- package/src/client/reference/client/production/runtime.ts +1101 -0
- package/src/client/reference/client/production/snapshot-adapter.ts +154 -0
- package/src/client/reference/client/production/source-marker.ts +63 -0
- package/src/client/reference/client/production/source-opener.ts +55 -0
- package/src/client/reference/client/production/styles.ts +104 -0
- package/src/client/reference/client/production/user-text-rule.ts +58 -0
- package/src/client/reference/client/reveal.ts +107 -0
- package/src/client/reference/client/scheme.ts +114 -0
- package/src/client/reference/client/types.ts +168 -0
- package/src/client/reference/css-modules.d.ts +4 -0
- package/src/client/reference/index.ts +11 -0
- package/src/client/reference-capture-owner.ts +162 -0
- package/src/client/reference-intents.ts +36 -0
- package/src/client/settings/index.ts +34 -0
- package/{client.js → src/client/settings/panel.ts} +2657 -2231
- package/src/client/shortcut-open.ts +30 -0
- package/src/client/startpage/binding.ts +99 -0
- package/src/client/startpage/controller.ts +303 -0
- package/src/client/startpage/model.ts +279 -0
- package/src/client/view/Browser.module.css +751 -0
- package/src/client/view/BrowserBody.tsx +314 -0
- package/src/client/view/BrowserPresentation.ts +9 -0
- package/src/client/view/BrowserTitle.tsx +17 -0
- package/src/client/view/IframePresentation.ts +344 -0
- package/src/client/view/StartPage.tsx +597 -0
- package/src/client/view/TakeoverBanner.tsx +21 -0
- package/src/index.ts +110 -73
- package/src/reference-owner.ts +5 -0
- package/src/reference-page.ts +9 -0
- package/src/reference-source.ts +3 -0
- package/src/reference-text.ts +197 -0
- package/src/startpage-settings.ts +103 -0
- package/src/startpage.ts +71 -0
- package/src/takeover-protocol.ts +19 -0
- package/src/tool-browser/code-tool.ts +401 -0
- package/src/tool-browser/code-worker.ts +639 -0
- package/src/tool-browser/index.ts +908 -77
- package/src/tool-browser/page-probe.ts +4 -4
- package/src/tool-browser/panel-page.ts +124 -0
- package/src/tool-browser/screenshot-image.ts +49 -0
- package/src/tool-browser/takeover.ts +198 -0
- package/src/types/electron-shim.d.ts +20 -0
- package/src/types.ts +85 -0
- package/src/web-guest.ts +34 -0
- package/tools/accept-desktop.mjs +148 -0
- package/lib/browser/runtime.d.ts +0 -175
- package/lib/browser/types.d.ts +0 -797
- package/lib/browser-electron/authenticated-route.d.ts +0 -27
- package/lib/browser-electron/automatic-maintenance.d.ts +0 -41
- package/lib/browser-electron/bridge-auto.d.ts +0 -93
- package/lib/browser-electron/bridge-connection.d.ts +0 -93
- package/lib/browser-electron/bridge-endpoint.d.ts +0 -30
- package/lib/browser-electron/bridge-install.d.ts +0 -85
- package/lib/browser-electron/bridge-maintenance.d.ts +0 -24
- package/lib/browser-electron/bridge-status.d.ts +0 -50
- package/lib/browser-electron/desktop-bridge-host.d.ts +0 -248
- package/lib/browser-electron/desktop-identity.d.ts +0 -58
- package/lib/browser-electron/electron-provision.d.ts +0 -92
- package/lib/browser-electron/entry.d.ts +0 -64
- package/lib/browser-electron/ephemeral-profile.d.ts +0 -37
- package/lib/browser-electron/file-write.d.ts +0 -2
- package/lib/browser-electron/history-store.d.ts +0 -98
- package/lib/browser-electron/host-main.d.ts +0 -26
- package/lib/browser-electron/http-body.d.ts +0 -24
- package/lib/browser-electron/json-reply.d.ts +0 -33
- package/lib/browser-electron/maintenance-broker.d.ts +0 -35
- package/lib/browser-electron/maintenance-lifecycle.d.ts +0 -32
- package/lib/browser-electron/maintenance-route.d.ts +0 -18
- package/lib/browser-electron/missing-system-browser.d.ts +0 -54
- package/lib/browser-electron/paths.d.ts +0 -4
- package/lib/browser-electron/preview-route.d.ts +0 -89
- package/lib/browser-electron/process.d.ts +0 -14
- package/lib/browser-electron/provider.d.ts +0 -959
- package/lib/browser-electron/remote-host.d.ts +0 -256
- package/lib/browser-electron/rpc-input.d.ts +0 -4
- package/lib/browser-electron/rpc-ops.d.ts +0 -18
- package/lib/browser-electron/runtime-diagnostics.d.ts +0 -12
- package/lib/browser-electron/runtime-route.d.ts +0 -55
- package/lib/browser-electron/runtime-status.d.ts +0 -116
- package/lib/browser-electron/settings-route.d.ts +0 -15
- package/lib/browser-electron/settings-store.d.ts +0 -224
- package/lib/browser-electron/sidebar-only-host.d.ts +0 -36
- package/lib/browser-electron/system-browser.d.ts +0 -367
- package/lib/browser-electron/timing.d.ts +0 -8
- package/lib/browser-electron/virtual-cursor.d.ts +0 -67
- package/lib/browser-electron/windows-system.d.ts +0 -3
- package/lib/index.d.ts +0 -30
- package/lib/tool-browser/element-fields.d.ts +0 -145
- package/lib/tool-browser/index.d.ts +0 -53
- package/lib/tool-browser/page-probe.d.ts +0 -86
- package/scripts/consumer-install-check.mjs +0 -72
- package/scripts/run-tests.mjs +0 -32
- package/scripts/verify-host-compat.mjs +0 -195
- package/scripts/verify-preview-route.mjs +0 -168
- package/scripts/verify-runtime-status.mjs +0 -179
|
@@ -34,9 +34,20 @@ const archiveFs: Pick<typeof import('node:fs'), 'openSync' | 'readSync' | 'close
|
|
|
34
34
|
})()
|
|
35
35
|
|
|
36
36
|
/** The identity rule, as data. */
|
|
37
|
+
/** Where one kind of install keeps its resources, executable and CLI launcher (all relative). */
|
|
38
|
+
export interface DesktopLayout {
|
|
39
|
+
readonly name: string
|
|
40
|
+
/** The layout applies when this path exists under the install root; the default has none. */
|
|
41
|
+
readonly marker?: string
|
|
42
|
+
readonly resources: string
|
|
43
|
+
readonly executable: string
|
|
44
|
+
readonly cliLauncher: string
|
|
45
|
+
}
|
|
46
|
+
|
|
37
47
|
interface IdentityRule {
|
|
38
48
|
readonly packageNames: readonly string[]
|
|
39
49
|
readonly mainEntry: string
|
|
50
|
+
readonly layouts: readonly DesktopLayout[]
|
|
40
51
|
}
|
|
41
52
|
|
|
42
53
|
/**
|
|
@@ -48,6 +59,10 @@ interface IdentityRule {
|
|
|
48
59
|
export const FALLBACK_RULE: IdentityRule = {
|
|
49
60
|
packageNames: ['@deepseek-ai/dsh-desktop', 'dsh-desktop'],
|
|
50
61
|
mainEntry: 'lib/main.js',
|
|
62
|
+
layouts: [
|
|
63
|
+
{ name: 'macos-bundle', marker: 'Contents/Info.plist', resources: 'Contents/Resources', executable: 'Contents/MacOS/DeepSeek Harness', cliLauncher: 'runtime/cli/bin/dsh' },
|
|
64
|
+
{ name: 'directory', resources: 'resources', executable: 'DeepSeek Harness.exe', cliLauncher: 'runtime/cli/bin/dsh.cmd' },
|
|
65
|
+
],
|
|
51
66
|
}
|
|
52
67
|
|
|
53
68
|
/** A verified install. */
|
|
@@ -90,7 +105,15 @@ export function readIdentityRule(): IdentityRule | { readonly error: string } {
|
|
|
90
105
|
if (typeof main !== 'string' || main === '') {
|
|
91
106
|
return { error: 'desktop-identity.json: mainEntry must be a non-empty string' }
|
|
92
107
|
}
|
|
93
|
-
|
|
108
|
+
const layouts = raw.layouts
|
|
109
|
+
const field = (value: unknown): boolean => typeof value === 'string' && value !== ''
|
|
110
|
+
if (!Array.isArray(layouts) || layouts.length === 0
|
|
111
|
+
|| layouts.some(l => l === null || typeof l !== 'object' || !field(l.name) || !field(l.resources) || !field(l.executable) || !field(l.cliLauncher)
|
|
112
|
+
|| (l.marker !== undefined && !field(l.marker)))
|
|
113
|
+
|| layouts[layouts.length - 1]?.marker !== undefined) {
|
|
114
|
+
return { error: 'desktop-identity.json: layouts must be a non-empty array whose last entry has no marker' }
|
|
115
|
+
}
|
|
116
|
+
return { packageNames: names, mainEntry: main, layouts }
|
|
94
117
|
} catch (error) {
|
|
95
118
|
if (error instanceof Error && 'code' in error && (error as NodeJS.ErrnoException).code === 'ENOENT') {
|
|
96
119
|
return FALLBACK_RULE
|
|
@@ -99,6 +122,34 @@ export function readIdentityRule(): IdentityRule | { readonly error: string } {
|
|
|
99
122
|
}
|
|
100
123
|
}
|
|
101
124
|
|
|
125
|
+
function layoutOf(rule: IdentityRule, installRoot: string): DesktopLayout {
|
|
126
|
+
return rule.layouts.find(layout => layout.marker === undefined || existsSync(join(installRoot, ...layout.marker.split('/'))))
|
|
127
|
+
?? rule.layouts[rule.layouts.length - 1] as DesktopLayout
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* The layout of an install root: a macOS `.app` bundle or a plain directory (Windows).
|
|
132
|
+
* Decided by the install's own shape rather than the host OS, so every platform reads it the same.
|
|
133
|
+
* @param installRoot - the install directory.
|
|
134
|
+
* @returns the layout, or an error when the identity rule cannot be read.
|
|
135
|
+
*/
|
|
136
|
+
export function desktopLayout(installRoot: string): DesktopLayout | { readonly error: string } {
|
|
137
|
+
const rule = readIdentityRule()
|
|
138
|
+
return 'error' in rule ? rule : layoutOf(rule, installRoot)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Absolute paths an install keeps, from its layout.
|
|
143
|
+
* @param installRoot - the install directory.
|
|
144
|
+
* @returns resources directory, GUI executable and CLI launcher.
|
|
145
|
+
*/
|
|
146
|
+
export function desktopPaths(installRoot: string): { readonly resources: string; readonly executable: string; readonly cliLauncher: string } {
|
|
147
|
+
const layout = desktopLayout(installRoot)
|
|
148
|
+
if ('error' in layout) throw new Error(layout.error)
|
|
149
|
+
const resources = join(installRoot, ...layout.resources.split('/'))
|
|
150
|
+
return { resources, executable: join(installRoot, ...layout.executable.split('/')), cliLauncher: join(resources, ...layout.cliLauncher.split('/')) }
|
|
151
|
+
}
|
|
152
|
+
|
|
102
153
|
/**
|
|
103
154
|
* One entry of a Chromium pickle header.
|
|
104
155
|
*
|
|
@@ -199,7 +250,7 @@ export function readAsarFile(archive: string, path: string): Buffer | undefined
|
|
|
199
250
|
export function readDesktopIdentity(installRoot: string): DesktopIdentity | IdentityRefusal {
|
|
200
251
|
const rule = readIdentityRule()
|
|
201
252
|
if ('error' in rule) return { ok: false, reason: rule.error }
|
|
202
|
-
const resources = join(installRoot,
|
|
253
|
+
const resources = join(installRoot, ...layoutOf(rule, installRoot).resources.split('/'))
|
|
203
254
|
const appDir = join(resources, 'app')
|
|
204
255
|
const archive = join(resources, 'app.asar')
|
|
205
256
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { BrowserError } from '../browser/types.ts'
|
|
2
|
+
import type { ElectronViewHandle } from './provider.ts'
|
|
3
|
+
|
|
4
|
+
export interface DocumentIdentity {
|
|
5
|
+
readonly id: string
|
|
6
|
+
readonly loaderId: string
|
|
7
|
+
readonly url: string
|
|
8
|
+
readonly unreachableUrl?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function mainDocument(value: unknown, options?: { readonly allowErrorDocument?: boolean }): DocumentIdentity {
|
|
12
|
+
const frame = (value as { frameTree?: { frame?: DocumentIdentity } } | undefined)?.frameTree?.frame
|
|
13
|
+
if (typeof frame?.id !== 'string' || frame.id === ''
|
|
14
|
+
|| typeof frame.loaderId !== 'string' || frame.loaderId === '' || typeof frame.url !== 'string') {
|
|
15
|
+
throw new BrowserError('browser: the guest did not acknowledge its main document identity', 'BROWSER_DOCUMENT_UNACKNOWLEDGED')
|
|
16
|
+
}
|
|
17
|
+
if (frame.unreachableUrl && options?.allowErrorDocument !== true) {
|
|
18
|
+
throw new BrowserError(`browser: failed to load ${frame.unreachableUrl}`, 'BROWSER_NAVIGATION_FAILED')
|
|
19
|
+
}
|
|
20
|
+
return frame
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Check parse readiness in an isolated world bound to the acknowledged main frame. */
|
|
24
|
+
export async function documentReady(handle: ElectronViewHandle, expected: DocumentIdentity, checkCurrent = (): void => {}): Promise<boolean> {
|
|
25
|
+
checkCurrent()
|
|
26
|
+
const world = await handle.sendCommand('Page.createIsolatedWorld', { frameId: expected.id, worldName: 'dsh-browser-readiness' }, { present: false, initialize: false }) as { executionContextId?: number }
|
|
27
|
+
checkCurrent()
|
|
28
|
+
if (!Number.isSafeInteger(world?.executionContextId) || world.executionContextId! <= 0) {
|
|
29
|
+
throw new BrowserError('browser: the guest did not acknowledge a document execution context', 'BROWSER_DOCUMENT_UNACKNOWLEDGED')
|
|
30
|
+
}
|
|
31
|
+
const result = await handle.sendCommand('Runtime.evaluate', {
|
|
32
|
+
expression: 'document.readyState', contextId: world.executionContextId, returnByValue: true,
|
|
33
|
+
}, { present: false, initialize: false }) as { result?: { value?: unknown }; exceptionDetails?: unknown }
|
|
34
|
+
checkCurrent()
|
|
35
|
+
const after = mainDocument(await handle.sendCommand('Page.getFrameTree', undefined, { present: false, initialize: false }),
|
|
36
|
+
{ allowErrorDocument: !!expected.unreachableUrl })
|
|
37
|
+
checkCurrent()
|
|
38
|
+
if (after.id !== expected.id || after.loaderId !== expected.loaderId) {
|
|
39
|
+
throw new BrowserError('browser: the acknowledged document was superseded', 'BROWSER_NAVIGATION_SUPERSEDED')
|
|
40
|
+
}
|
|
41
|
+
if (result.exceptionDetails !== undefined || !['loading', 'interactive', 'complete'].includes(String(result.result?.value))) {
|
|
42
|
+
throw new BrowserError('browser: the document did not acknowledge its parse state', 'BROWSER_DOCUMENT_UNACKNOWLEDGED')
|
|
43
|
+
}
|
|
44
|
+
return result.result?.value !== 'loading'
|
|
45
|
+
}
|
|
@@ -1,38 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Prepare the Electron runtime *when it is needed*, instead of making installation depend on it.
|
|
3
|
-
*
|
|
4
|
-
* Reported as issue #41, from a real plugin-market install of 0.5.2:
|
|
5
|
-
*
|
|
6
|
-
* [ERR_PNPM_IGNORED_BUILDS] Ignored build scripts: dsh-builtin-browser@0.5.2
|
|
7
|
-
*
|
|
8
|
-
* and, once the build script was allowed:
|
|
9
|
-
*
|
|
10
|
-
* postinstall: Preparing Electron 44.10.1 … TypeError: fetch failed
|
|
11
|
-
* postinstall: Electron installation failed (exit 1). … [ELIFECYCLE] Command failed with exit code 1
|
|
12
|
-
*
|
|
13
|
-
* Two defects in one design, and both are about WHERE the download lives:
|
|
14
|
-
*
|
|
15
|
-
* 1. A `postinstall` puts a ~100 MB network download inside package installation. pnpm blocks
|
|
16
|
-
* install scripts by default (`strict-dep-builds`), so the plugin could not be installed at all
|
|
17
|
-
* on a default pnpm 11 profile; and if the download fails for any reason the *whole install*
|
|
18
|
-
* fails, which is a network condition reported as "the plugin is broken".
|
|
19
|
-
* 2. Nothing forced the download to happen at install time. The carrier that needs Electron is one
|
|
20
|
-
* of four, and on the desktop the sidebar needs none.
|
|
21
|
-
*
|
|
22
|
-
* So installation is offline by construction now, and this module does the work later: on plugin
|
|
23
|
-
* start when the operator explicitly asked for the bundled carrier, and never fatally — a failure
|
|
24
|
-
* here is a log line plus the existing, actionable resolution error that names the command to run.
|
|
25
|
-
*
|
|
26
|
-
* Being non-fatal is the point, not a detail: this runs inside a request-serving process, and a
|
|
27
|
-
* download that hangs must not be able to hold a browser tool call open.
|
|
28
|
-
* @module dsh-browser/browser-electron/electron-provision
|
|
29
|
-
*/
|
|
1
|
+
/** Prepare an explicitly supplied external Electron runtime, never the plugin generation. */
|
|
30
2
|
import { spawn } from 'node:child_process'
|
|
31
3
|
import { existsSync, readFileSync } from 'node:fs'
|
|
32
|
-
import {
|
|
33
|
-
import { dirname, join } from 'node:path'
|
|
4
|
+
import { isAbsolute, join } from 'node:path'
|
|
34
5
|
|
|
35
|
-
import { internals } from './remote-host.
|
|
6
|
+
import { internals } from './remote-host.ts'
|
|
36
7
|
|
|
37
8
|
/** How long a background provision may run before it is abandoned. */
|
|
38
9
|
export const PROVISION_TIMEOUT_MS = 180_000
|
|
@@ -121,18 +92,15 @@ export function hasElectronRuntime(): boolean {
|
|
|
121
92
|
}
|
|
122
93
|
|
|
123
94
|
/**
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
* `require.resolve('electron/package.json')` is used rather than `require('electron')`: inside an
|
|
127
|
-
* Electron main process that module name is the built-in API, and requiring the package would
|
|
128
|
-
* download the binary as a side effect of asking about it.
|
|
129
|
-
* @returns the path to the dependency's own install script, or undefined.
|
|
95
|
+
* @returns the explicitly selected external package installer, or undefined.
|
|
130
96
|
*/
|
|
131
97
|
function electronInstallerScript(): string | undefined {
|
|
132
98
|
try {
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
const
|
|
99
|
+
const directory = process.env.DSH_BROWSER_ELECTRON_PACKAGE
|
|
100
|
+
if (!directory || !isAbsolute(directory)) return undefined
|
|
101
|
+
const metadata = JSON.parse(readFileSync(join(directory, 'package.json'), 'utf8')) as { name?: unknown }
|
|
102
|
+
if (metadata.name !== 'electron') return undefined
|
|
103
|
+
const script = join(directory, 'install.js')
|
|
136
104
|
return existsSync(script) ? script : undefined
|
|
137
105
|
} catch {
|
|
138
106
|
return undefined
|
|
@@ -142,8 +110,9 @@ function electronInstallerScript(): string | undefined {
|
|
|
142
110
|
/** The Electron version the installed package asks for, for a log line that names the download. */
|
|
143
111
|
function electronVersion(): string {
|
|
144
112
|
try {
|
|
145
|
-
const
|
|
146
|
-
|
|
113
|
+
const directory = process.env.DSH_BROWSER_ELECTRON_PACKAGE
|
|
114
|
+
if (!directory || !isAbsolute(directory)) return 'unknown'
|
|
115
|
+
const manifest = JSON.parse(readFileSync(join(directory, 'package.json'), 'utf8')) as { version?: unknown }
|
|
147
116
|
return typeof manifest.version === 'string' ? manifest.version : 'unknown'
|
|
148
117
|
} catch {
|
|
149
118
|
return 'unknown'
|
|
@@ -202,8 +171,6 @@ export async function ensureElectronRuntime(deps: ProvisionDeps = defaultDeps())
|
|
|
202
171
|
if (script === undefined) {
|
|
203
172
|
return record({ status: 'failed', detail: 'the installed electron package has no install.js; reinstall the plugin in this profile' })
|
|
204
173
|
}
|
|
205
|
-
// Resolve the installed Electron version once: each call re-runs createRequire,
|
|
206
|
-
// require.resolve and a synchronous package.json read + parse.
|
|
207
174
|
const version = electronVersion()
|
|
208
175
|
latest = {
|
|
209
176
|
state: 'preparing',
|