dsh-builtin-browser 1.0.3 → 1.1.0
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 +16 -1
- package/README.en.md +89 -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/desktop-bridge/desktop-identity.json +10 -2
- package/desktop-bridge/install.mjs +28 -2
- package/docs/issue-replies-2026-11-28.md +141 -0
- package/dsh-host-patch/apply.mjs +1 -1
- package/dsh-host-patch/rc3.json +4 -4
- package/dsh-host-patch/rc5.json +4 -4
- package/dsh-host-patch/v023-alpha2.json +2 -2
- package/lib/browser-electron/bridge-status.js +24 -1
- package/lib/browser-electron/desktop-identity.js +47 -8
- package/lib/client.js +2 -1
- package/native-host/install.mjs +5 -0
- package/package.json +20 -2
- package/scripts/build-client.mjs +305 -0
- package/scripts/build.mjs +69 -0
- package/scripts/bundle-host.mjs +28 -0
- package/scripts/fix-exports.mjs +40 -0
- package/scripts/install-electron.mjs +101 -0
- package/scripts/pack.mjs +99 -0
- package/scripts/publish-manifest.mjs +56 -0
- package/scripts/verify-exports.mjs +58 -0
- package/scripts/verify-preview-sdk.mjs +93 -0
- package/skills/dsh-builtin-browser/SKILL.md +98 -0
- package/skills/dsh-builtin-browser/references/batch.md +68 -0
- package/skills/dsh-builtin-browser/references/deliver.md +31 -0
- package/skills/dsh-builtin-browser/references/locate.md +11 -0
- package/skills/dsh-builtin-browser/references/recover.md +11 -0
- package/skills/dsh-builtin-browser/references/verify.md +13 -0
- 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/anti-bot.ts +251 -0
- package/src/browser/deep-dom.ts +40 -0
- package/src/browser/handles.ts +89 -0
- package/src/browser/runtime.ts +578 -0
- package/src/browser/takeover-target.ts +45 -0
- package/src/browser/types.ts +870 -0
- package/src/browser-electron/authenticated-route.ts +109 -0
- package/src/browser-electron/automatic-maintenance.ts +736 -0
- package/src/browser-electron/bridge-auto.ts +159 -0
- package/src/browser-electron/bridge-connection.ts +386 -0
- package/src/browser-electron/bridge-endpoint.ts +129 -0
- package/src/browser-electron/bridge-install.ts +290 -0
- package/src/browser-electron/bridge-maintenance.ts +189 -0
- package/src/browser-electron/bridge-status.ts +412 -0
- package/src/browser-electron/desktop-bridge-host.ts +253 -0
- package/src/browser-electron/desktop-identity.ts +400 -0
- package/src/browser-electron/desktop-shell.ts +100 -0
- package/src/browser-electron/document-readiness.ts +45 -0
- package/src/browser-electron/electron-provision.ts +347 -0
- package/src/browser-electron/entry.ts +1378 -0
- package/src/browser-electron/ephemeral-profile.ts +189 -0
- package/src/browser-electron/extension-browser.ts +230 -0
- package/src/browser-electron/extension-setup.ts +67 -0
- package/src/browser-electron/file-write.ts +31 -0
- package/src/browser-electron/foreground-watch.ts +142 -0
- package/src/browser-electron/guest-cookie-jar.ts +177 -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 +716 -0
- package/src/browser-electron/guest-runtime.ts +408 -0
- package/src/browser-electron/guest-storage-runtime.ts +54 -0
- package/src/browser-electron/guest-storage.ts +120 -0
- package/src/browser-electron/history-store.ts +224 -0
- package/src/browser-electron/host-main.ts +1385 -0
- package/src/browser-electron/host-patch-maintenance.ts +121 -0
- package/src/browser-electron/http-body.ts +65 -0
- package/src/browser-electron/json-reply.ts +47 -0
- package/src/browser-electron/maintenance-broker.ts +166 -0
- package/src/browser-electron/maintenance-lifecycle.ts +91 -0
- package/src/browser-electron/maintenance-route.ts +68 -0
- package/src/browser-electron/missing-system-browser.ts +114 -0
- package/src/browser-electron/open-slot.ts +49 -0
- package/src/browser-electron/paths.ts +25 -0
- package/src/browser-electron/preferred-browser.ts +130 -0
- package/src/browser-electron/preview-route.ts +215 -0
- package/src/browser-electron/process-ownership.ts +174 -0
- package/src/browser-electron/process.ts +23 -0
- package/src/browser-electron/profile-checkpoint.ts +187 -0
- package/src/browser-electron/profile-command.ts +47 -0
- package/src/browser-electron/profile-extension.ts +129 -0
- package/src/browser-electron/profile-lease.ts +211 -0
- package/src/browser-electron/profile-residue.ts +49 -0
- package/src/browser-electron/provider-core.ts +1107 -0
- package/src/browser-electron/provider-interaction.ts +1034 -0
- package/src/browser-electron/provider-media.ts +589 -0
- package/src/browser-electron/provider-navigation.ts +323 -0
- package/src/browser-electron/provider-observation.ts +664 -0
- package/src/browser-electron/provider-tabs.ts +372 -0
- package/src/browser-electron/provider.ts +666 -0
- package/src/browser-electron/reference-route.ts +598 -0
- package/src/browser-electron/remote-host.ts +1538 -0
- package/src/browser-electron/rpc-input.ts +13 -0
- package/src/browser-electron/rpc-ops.ts +41 -0
- package/src/browser-electron/runtime-diagnostics.ts +38 -0
- package/src/browser-electron/runtime-route.ts +105 -0
- package/src/browser-electron/runtime-status.ts +309 -0
- package/src/browser-electron/settings-route.ts +64 -0
- package/src/browser-electron/settings-store.ts +593 -0
- package/src/browser-electron/shortcuts-route.ts +112 -0
- package/src/browser-electron/sidebar-only-host.ts +300 -0
- package/src/browser-electron/startpage-shortcuts.ts +213 -0
- package/src/browser-electron/system-browser.ts +1850 -0
- package/src/browser-electron/tauri-host.ts +194 -0
- package/src/browser-electron/timing.ts +16 -0
- package/src/browser-electron/virtual-cursor.ts +162 -0
- package/src/browser-electron/windows-system.ts +24 -0
- 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 +1346 -0
- package/src/browser-reference/store.ts +172 -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 +106 -0
- package/src/client/apply-guard.ts +22 -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 +182 -0
- package/src/client/browser/child-tabs.ts +14 -0
- package/src/client/browser/frame-history.ts +125 -0
- package/src/client/browser/frame-state.ts +27 -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 +56 -0
- package/src/client/css-modules.d.ts +4 -0
- package/src/client/definition.tsx +36 -0
- package/src/client/electron/ElectronWebViewImpl.ts +371 -0
- package/src/client/electron/ElectronWebviewPresentation.ts +140 -0
- package/src/client/electron/NativeChildPresentation.ts +53 -0
- package/src/client/electron/NativeViewPage.ts +265 -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 +333 -0
- package/src/client/locales.ts +860 -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 +208 -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 +447 -0
- package/src/client/reference/client/production/asset-store.ts +144 -0
- package/src/client/reference/client/production/availability.ts +72 -0
- package/src/client/reference/client/production/bytes.ts +36 -0
- package/src/client/reference/client/production/composer-attachments.ts +44 -0
- package/src/client/reference/client/production/delivery-client.ts +211 -0
- package/src/client/reference/client/production/draft-adapter.ts +512 -0
- package/src/client/reference/client/production/http-transport.ts +212 -0
- package/src/client/reference/client/production/production-submission.ts +70 -0
- package/src/client/reference/client/production/protocol.ts +234 -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 +1056 -0
- package/src/client/reference/client/production/snapshot-adapter.ts +154 -0
- package/src/client/reference/client/production/source-marker.ts +99 -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 +67 -0
- package/src/client/reference/client/reveal.ts +109 -0
- package/src/client/reference/client/scheme.ts +114 -0
- package/src/client/reference/client/session-schedule.ts +36 -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 +42 -0
- package/src/client/settings/mount-guard.ts +31 -0
- package/src/client/settings/panel.ts +2773 -0
- package/src/client/shortcut-open.ts +30 -0
- package/src/client/startpage/binding.ts +99 -0
- package/src/client/startpage/controller.ts +300 -0
- package/src/client/startpage/model.ts +279 -0
- package/src/client/view/Browser.module.css +751 -0
- package/src/client/view/BrowserBody.tsx +315 -0
- package/src/client/view/BrowserPresentation.ts +9 -0
- package/src/client/view/BrowserTitle.tsx +17 -0
- package/src/client/view/IframePresentation.ts +365 -0
- package/src/client/view/StartPage.tsx +598 -0
- package/src/client/view/TakeoverBanner.tsx +21 -0
- package/src/compat/host-features.ts +92 -0
- package/src/index.ts +110 -0
- 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 +219 -0
- package/src/startpage-settings.ts +103 -0
- package/src/startpage.ts +71 -0
- package/src/takeover-protocol.ts +28 -0
- package/src/tool-browser/block-recovery.ts +85 -0
- package/src/tool-browser/code-tool.ts +555 -0
- package/src/tool-browser/code-worker.ts +725 -0
- package/src/tool-browser/element-fields.ts +167 -0
- package/src/tool-browser/errors.ts +40 -0
- package/src/tool-browser/index.ts +265 -0
- package/src/tool-browser/page-probe.ts +675 -0
- package/src/tool-browser/panel-page.ts +126 -0
- package/src/tool-browser/probe-client.ts +183 -0
- package/src/tool-browser/screenshot-annotations.ts +131 -0
- package/src/tool-browser/screenshot-image.ts +49 -0
- package/src/tool-browser/state.ts +375 -0
- package/src/tool-browser/takeover.ts +199 -0
- package/src/tool-browser/tools-debug.ts +806 -0
- package/src/tool-browser/tools-interaction.ts +956 -0
- package/src/tool-browser/tools-navigation.ts +786 -0
- package/src/tool-browser/tools-observation.ts +474 -0
- package/src/tool-browser/tools-reference.ts +294 -0
- package/src/types/electron-shim.d.ts +144 -0
- package/src/types.ts +85 -0
- package/src/web-guest.ts +35 -0
- package/tools/accept-desktop.mjs +148 -0
- package/dist/client.d.cts +0 -516
- package/dist/client.d.mts +0 -516
- package/dist/index.cjs +0 -92
- package/dist/index.d.mts +0 -2960
- package/dist/index.mjs +0 -24
- 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/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 +0 -218
- 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 +0 -260
|
@@ -688,7 +688,14 @@ function readIdentityRule() {
|
|
|
688
688
|
const mainEntry = raw.mainEntry
|
|
689
689
|
const layouts = raw.layouts
|
|
690
690
|
const unsupportedMainEntries = raw.unsupportedMainEntries ?? {}
|
|
691
|
+
const mainEntryCandidates = raw.mainEntryCandidates
|
|
691
692
|
const field = value => typeof value === 'string' && value !== ''
|
|
693
|
+
if (mainEntryCandidates !== undefined && (!Array.isArray(mainEntryCandidates)
|
|
694
|
+
|| mainEntryCandidates.some(c => c === null || typeof c !== 'object' || !field(c.entry)
|
|
695
|
+
|| (c.requiresDependency !== undefined && !field(c.requiresDependency))))) {
|
|
696
|
+
console.error('desktop-identity.json is malformed: mainEntryCandidates must list entries with an optional requiresDependency')
|
|
697
|
+
return undefined
|
|
698
|
+
}
|
|
692
699
|
if (!Array.isArray(names) || names.length === 0 || names.some(name => typeof name !== 'string')
|
|
693
700
|
|| typeof mainEntry !== 'string' || mainEntry === ''
|
|
694
701
|
|| !Array.isArray(layouts) || layouts.length === 0 || layouts.at(-1)?.marker !== undefined
|
|
@@ -699,7 +706,7 @@ function readIdentityRule() {
|
|
|
699
706
|
console.error('desktop-identity.json is malformed: expected packageNames[], mainEntry, layouts[] and an optional unsupportedMainEntries map')
|
|
700
707
|
return undefined
|
|
701
708
|
}
|
|
702
|
-
return { packageNames: names, mainEntry, unsupportedMainEntries, layouts }
|
|
709
|
+
return { packageNames: names, mainEntry, unsupportedMainEntries, mainEntryCandidates, layouts }
|
|
703
710
|
} catch (error) {
|
|
704
711
|
console.error(`desktop-identity.json could not be read: ${String(error)}`)
|
|
705
712
|
return undefined
|
|
@@ -885,16 +892,35 @@ function verifyDesktopIdentity(root) {
|
|
|
885
892
|
const hasEntry = entry => archivePresent
|
|
886
893
|
? readAsarEntry(archive, entry) !== undefined
|
|
887
894
|
: existsSync(join(appDir, ...entry.split('/')))
|
|
888
|
-
|
|
895
|
+
let entry = rule.mainEntry
|
|
896
|
+
let mainPresent = hasEntry(entry)
|
|
897
|
+
if (!mainPresent) {
|
|
898
|
+
const dependencies = manifest.dependencies
|
|
899
|
+
for (const candidate of rule.mainEntryCandidates ?? []) {
|
|
900
|
+
if (!hasEntry(candidate.entry)) continue
|
|
901
|
+
if (candidate.requiresDependency !== undefined && (dependencies === null || typeof dependencies !== 'object'
|
|
902
|
+
|| dependencies[candidate.requiresDependency] === undefined)) continue
|
|
903
|
+
entry = candidate.entry
|
|
904
|
+
mainPresent = true
|
|
905
|
+
break
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
if (!mainPresent) {
|
|
889
909
|
const foreign = Object.entries(rule.unsupportedMainEntries).find(([entry]) => hasEntry(entry))
|
|
890
910
|
if (foreign !== undefined) {
|
|
891
911
|
return { ok: false, reason: `${foreign[0]} instead of ${rule.mainEntry}: ${foreign[1]}; use DSH Web or DeepSeek Harness Desktop` }
|
|
892
912
|
}
|
|
913
|
+
const lookAlike = (rule.mainEntryCandidates ?? []).find(candidate => hasEntry(candidate.entry))
|
|
914
|
+
if (lookAlike !== undefined) {
|
|
915
|
+
const gate = lookAlike.requiresDependency === undefined ? 'its identity gate' : lookAlike.requiresDependency
|
|
916
|
+
return { ok: false, reason: `${lookAlike.entry} instead of ${rule.mainEntry}, but ${gate} is absent, so this is not the DSH Desktop bundle (issue #62); use DSH Web or DeepSeek Harness Desktop` }
|
|
917
|
+
}
|
|
893
918
|
return { ok: false, reason: `${rule.mainEntry} is not present under ${archivePresent ? archive : appDir}` }
|
|
894
919
|
}
|
|
895
920
|
return {
|
|
896
921
|
ok: true,
|
|
897
922
|
layout,
|
|
923
|
+
mainEntry: entry,
|
|
898
924
|
packageName: name,
|
|
899
925
|
version: typeof manifest.version === 'string' ? manifest.version : undefined,
|
|
900
926
|
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# Issue 回复文案(2026-11-28)
|
|
2
|
+
|
|
3
|
+
每条都可直接粘贴到对应 issue。末尾「建议」是我对处置方式的建议,不要贴进去。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## #142 桥接已恢复但设置页常驻「桥接维护失败」
|
|
8
|
+
|
|
9
|
+
已修复,随 **1.0.4** 发布。
|
|
10
|
+
|
|
11
|
+
原因如报告所述:上一次维护的终态 `failed` 记录只在「下一次维护开始」时被覆盖,桥接恢复后没有任何失效路径。现在的行为:
|
|
12
|
+
|
|
13
|
+
- 桥接处于 `installed` 且 `running` 时,不再渲染这条终态失败;
|
|
14
|
+
- 原始记录仍保留在「诊断」折叠区,排查时还能看到;
|
|
15
|
+
- 桥接确实不健康时,提示照旧。
|
|
16
|
+
|
|
17
|
+
回归测试:`tests/client-panel.test.mjs`(138 项,含该场景)。提交见 PR #143。
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## #126 提供「只移除桥接(不重装)」的单向入口
|
|
22
|
+
|
|
23
|
+
已实现,随 **1.0.4** 发布。
|
|
24
|
+
|
|
25
|
+
- 宿主维护任务现在接受 `uninstall` 动作:还原宿主补丁与拆包布局后**立即停止**,不再顺手重装;
|
|
26
|
+
- 设置 → 浏览器 → 侧栏浏览器桥接 里新增「仅移除桥接」按钮,与「卸载并重装」并列;
|
|
27
|
+
- 文案与入口都只在侧栏载体、且真的检测到 Desktop 安装时出现。
|
|
28
|
+
|
|
29
|
+
测试:`tests/automatic-maintenance.test.mjs`、`tests/client-panel.test.mjs`。
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## #131 0.5.8 → 1.0.1 更新失败
|
|
34
|
+
|
|
35
|
+
针对更新/替换这条路径做了两处改动,随 **1.0.4** 发布。
|
|
36
|
+
|
|
37
|
+
1. `tools/deploy-local.mjs --replace`:替换前把旧安装目录改名为 `<target>.backup-<时间戳>`,再写新版本,避免覆盖后新旧文件混杂;目录链接(Junction)安装会被拒绝并提示先移除链接。
|
|
38
|
+
2. `docs/development.md` 增加「升级 / 替换已有安装」:目录安装用 `--replace`;npm 安装走 DSH 自己的「先移除再安装」。
|
|
39
|
+
|
|
40
|
+
如果你那次失败的原始报错还在,贴出来我可以确认属于哪一类(目录残留还是 npm 解析)。
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## #140 截图视口几何错误(channel=edge + surface=builtin)
|
|
45
|
+
|
|
46
|
+
已定位并修复,随 **1.0.4** 发布。
|
|
47
|
+
|
|
48
|
+
按报告步骤在本机复现:
|
|
49
|
+
|
|
50
|
+
| 读数 | 值 |
|
|
51
|
+
|---|---|
|
|
52
|
+
| 页面自报 | `clientWidth` 1239、`innerWidth` 1254、窗口 1280×800 |
|
|
53
|
+
| 修复前截图 | **231×960**(同一文档:把 `body` 背景改成洋红后截图里可见,说明不是截错页面) |
|
|
54
|
+
| 修复后截图 | **1239×768**,与页面自身宽度一致 |
|
|
55
|
+
|
|
56
|
+
根因:默认截图走原生 `capture()`,它描述的是「视图」,而那个视图不一定是页面的布局面(离屏停放的窗口会给出一个很小的 backing surface),于是页面被按 231 宽重排后截下来。现在的规则:
|
|
57
|
+
|
|
58
|
+
- 原生截图的长宽比与 `Page.getLayoutMetrics` 的视口不符(>5%)时,改用 CDP + 视口 `clip` 重截;
|
|
59
|
+
- 形状一致(包括 DPR 2 的 2508×1414 对应 1254×707)时保留原生快照,不重复截。
|
|
60
|
+
|
|
61
|
+
测试:`tests/screenshot-geometry.test.mjs`(3 项)、`tests/layout-metrics.test.mjs`(3 项)。另外 `dsh_browser_state` 现在会输出 `viewport 1254×707 @1 (window 1280×800)`,便于以后直接对照。
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## #127 多会话交替渲染 dock 触发 React #185
|
|
66
|
+
|
|
67
|
+
已修复渲染期的根因,随 **1.0.4** 发布;想请你确认一下是否还复现。
|
|
68
|
+
|
|
69
|
+
定位过程:`src/client/reference/client/plugin.ts` 的 `onDockProps` 在**每次 dock 渲染时同步调用** `runtime.setSession(自己的会话)`。两个 dock 同时存活(各自被保活的会话)时,A 渲染 → 切到 A → 通知订阅者 → B 重渲染 → 切到 B → 通知 → A 重渲染……形成同步无界循环,正是 `Maximum update depth exceeded`。
|
|
70
|
+
|
|
71
|
+
修复:
|
|
72
|
+
|
|
73
|
+
- 会话切换移到微任务里(`queueMicrotask`),渲染期间不再改动它读取的 store;
|
|
74
|
+
- 同一 tick 内多次上报只保留最后一次(`src/client/reference/client/session-schedule.ts`),并且「已经生效的会话」不再重复排任务。
|
|
75
|
+
|
|
76
|
+
测试:`tests/session-schedule.test.mjs`(3 项:一次 tick 只生效一次、重复上报不排任务、跨 tick 仍能切新会话)。运行时 `setSession` 本身对「同一会话」早有短路,两层合起来才把循环切断。
|
|
77
|
+
|
|
78
|
+
如果 1.0.4 上仍出现 #185,请贴出 `Runtime.exceptionThrown` 的栈(issue 里那份新旧都行),我继续按栈定位。
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## #132 双注册把客户端注册整批带走 / 关 Edge 窗口后弹回 about:blank
|
|
83
|
+
|
|
84
|
+
已做两步防护,随 **1.0.4** 发布;根因(第二份注册从哪来)仍需要一份栈。
|
|
85
|
+
|
|
86
|
+
已改:
|
|
87
|
+
|
|
88
|
+
1. **设置分节每页只挂载一次**(`src/client/settings/mount-guard.ts`):成功后置位,重复 `apply` 直接跳过;挂载真失败时不置位,下次仍会重试。此前重复注册同一个 `settings.section` id 会被宿主拒绝,而拒绝发生在本次 `apply` 中途,于是同一批里的其它注册一起丢失(就是「设置页没有浏览器分节」)。
|
|
89
|
+
2. **两步注册各自隔离**:`watchClientVersion` 与 `applySettingsSection` 各自 try/catch,一个失败只丢自己。
|
|
90
|
+
|
|
91
|
+
需要你提供:控制台里两次 `__ModuleLoader__.load` 的调用栈与两次注册的 id。有了它我能判断第二份是「同一个包被装了两遍」还是「宿主把同一行解析了两次」,这两种的修法不同。
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## #106 1.0.x 在 Web 端不启动独立浏览器窗口(channel=本机 Chrome 仍走侧栏)
|
|
96
|
+
|
|
97
|
+
在你本机的诊断里**没有复现**,需要一次现场读数。
|
|
98
|
+
|
|
99
|
+
我核对了 `chooseCarrier()`:`channel === 'chrome' | 'edge'` 会走 `detectBrowser` + `SystemBrowserViewHost`,显式选择优先于 `config.viewHost`,逻辑本身是对的。
|
|
100
|
+
|
|
101
|
+
你机器上的诊断显示的是:
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
will drive the installed edge (C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe)
|
|
105
|
+
will drive the installed chrome (C:\Program Files\Google\Chrome\Application\chrome.exe)
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
没有出现 `using only the selected DSH sidebar` —— 也就是说这台机器上采纳是生效的。「配置的载体=浏览器扩展、当前载体=DSH 独立浏览器(CDP)」是既定降级(扩展未连接时走 CDP),不是走错载体。
|
|
109
|
+
|
|
110
|
+
**现在加了诊断**:`adopt()` 每次决策都会记录 reason(保留最近 8 条),随 runtime status 返回,并显示在设置页「诊断」区。下次复现时请把最后 2–3 条 reason 贴出来:末条是 `the selected chrome is not installed` 说明检测失败;末条是 `using only the selected DSH sidebar` 说明采纳被侧栏覆盖。两种情况我分别修。
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## #59 Desktop 上 `@deepseek-ai/*` 解析不到,四个入口不激活
|
|
115
|
+
|
|
116
|
+
已证伪一个假设,并加了诊断;还需要一条现场读数。
|
|
117
|
+
|
|
118
|
+
- **不是发布清单问题**:`npm view dsh-builtin-browser@1.0.1 peerDependencies` 返回的是真实版本范围(`^4.1.0` / `^0.2.2-rc.3` 等),pnpm 打包已经改写 `workspace:`;
|
|
119
|
+
- **本机(0.2.3-alpha.2 + 桌面端 profile)也不复现**:从安装目录用 `createRequire` 逐个解析 6 个 peer,全部 OK;
|
|
120
|
+
- 另外顺带修了一个真实的分发缺陷:手工 `npm pack` 出来的 tarball 会保留 `workspace:^`,现在 `scripts/publish-manifest.mjs` 会改写为 `>=0.2.2-rc.3 <0.3.0`,并由 `scripts/pack.mjs` 在出包前校验(1.0.4 起生效)。
|
|
121
|
+
|
|
122
|
+
**诊断已加**:runtime status 现在逐个解析 6 个 host peer,未解析的会在设置页「诊断」区列出(包名 + 解析器原文)。请在能复现的机器上贴出那一行——有了它就能确定是应用侧 node_modules 布局问题,还是插件解析路径问题。
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## #119 「绝不自动解验证码」这个前提本身是错的
|
|
127
|
+
|
|
128
|
+
(如果要回)这条我们**不改**,说明立场:
|
|
129
|
+
|
|
130
|
+
这个插件把「人工验证必须由人完成」当作产品红线:遇到 CAPTCHA / 滑块 / 人机校验时,工具会停下来、交还给人,并提供公开回退路径(站点 API、搜索结果、存档),但不会尝试自动求解。理由是这属于平台规则与账号安全的边界,不是可以靠工程手段绕过的东西。相关行为在 1.0.x 保持不变。
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## 发布说明(可贴在 release 或置顶评论)
|
|
135
|
+
|
|
136
|
+
`dsh-builtin-browser@1.0.4` 已发布(`latest` 指向它):
|
|
137
|
+
|
|
138
|
+
- 修复 1.0.3 的 tarball 缺 `browser-extension/` 导致 `native-host` 注册失败(`ERR_MODULE_NOT_FOUND: browser-extension/constants.mjs`);1.0.3 已标记为废弃并建议使用 1.0.1 或 1.0.4;
|
|
139
|
+
- 出包前校验 10 个运行时关键路径,缺一即拒绝出包;
|
|
140
|
+
- tarball 的 `peerDependencies` 不再出现 `workspace:^`;
|
|
141
|
+
- 含 #140 截图几何、#127 dock 会话切换、#132 幂等注册、#142 终态失败失效、#126 仅移除桥接等修复。
|
package/dsh-host-patch/apply.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { gunzipSync } from 'node:zlib'
|
|
|
6
6
|
import { stripLegacyBridge } from './legacy-bridge.mjs'
|
|
7
7
|
|
|
8
8
|
const specs = ['rc3', 'rc5', 'tauri', 'v023-alpha2'].map(name => JSON.parse(fs.readFileSync(new URL(`./${name}.json`, import.meta.url), 'utf8')))
|
|
9
|
-
const previousSpecs = ['rc3', 'rc5'].flatMap(name => [8, 7, 6, 5, 4, 3, 2, 1].map(revision =>
|
|
9
|
+
const previousSpecs = ['rc3', 'rc5'].flatMap(name => [9, 8, 7, 6, 5, 4, 3, 2, 1].map(revision =>
|
|
10
10
|
JSON.parse(revision >= 3
|
|
11
11
|
? gunzipSync(fs.readFileSync(new URL(`./${name}-revision${revision}.json.gz`, import.meta.url))).toString('utf8')
|
|
12
12
|
: fs.readFileSync(new URL(`./${name}-revision${revision}.json`, import.meta.url), 'utf8'))))
|
package/dsh-host-patch/rc3.json
CHANGED
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"id": "main",
|
|
66
66
|
"packageName": "@deepseek-ai/dsh-desktop",
|
|
67
67
|
"file": "lib/main.js",
|
|
68
|
-
"marker": "
|
|
68
|
+
"marker": "clearTimeout(force)",
|
|
69
69
|
"sha256": "f808749c7a1a907e1acb354e774d1cebf1d1c2561fd789d8fbee1e9c412caa00",
|
|
70
70
|
"edits": [
|
|
71
71
|
{
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
},
|
|
79
79
|
{
|
|
80
80
|
"before": "\n}\n//#endregion\n//#region lib/types/core-package-set.js\n/** Private package installed beside dsh to boot the Desktop Host process. */\nconst DESKTOP_HOST_PACKAGE = \"@deepseek-ai/dsh-desktop-host\";",
|
|
81
|
-
"after": "\n}\n//#endregion\n//#region lib/types/main-extensions.js\n/** Explicitly installed, trusted profile extensions running in Electron main. */\nvar __rewriteRelativeImportExtension$2 = function(path, preserveJsx) {\n\tif (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) {\n\t\treturn tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : d + ext + \".\" + cm.toLowerCase() + \"js\";\n\t});\n\treturn path;\n};\nasync function fingerprint(profile, name, entry) {\n\tconst directory = await realpath(join(profile, \"node_modules\", name));\n\tconst text = await readFile$1(join(directory, \"package.json\"), \"utf8\");\n\tconst pkg = JSON.parse(text);\n\tconst hash = createHash(\"sha256\").update(entry).update(text);\n\tconst visit = async (path) => {\n\t\tfor (const item of (await readdir(path, { withFileTypes: true })).sort((a, b) => a.name.localeCompare(b.name))) {\n\t\t\tif (item.name === \"node_modules\" || item.name === \".git\") continue;\n\t\t\tconst child = join(path, item.name);\n\t\t\tif (item.isSymbolicLink()) throw new Error(\"extension package contains a symbolic link\");\n\t\t\tif (item.isDirectory()) await visit(child);\n\t\t\telse if (item.isFile()) {\n\t\t\t\tconst content = await readFile$1(child);\n\t\t\t\thash.update(JSON.stringify([relative(directory, child), content.length])).update(content);\n\t\t\t}\n\t\t}\n\t};\n\tawait visit(directory);\n\treturn {\n\t\tfingerprint: hash.digest(\"hex\"),\n\t\t...record$6(pkg) && typeof pkg.version === \"string\" ? { version: pkg.version } : {}\n\t};\n}\nfunction record$6(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction inside(root, path) {\n\tconst child = relative(root, path);\n\treturn child !== \"\" && !isAbsolute(child) && child !== \"..\" && !child.startsWith(\"../\") && !child.startsWith(\"..\\\\\");\n}\n/**\n* Discover opt-in entries from direct installed profile dependencies; reject escaping paths, including symlinks.\n* Invalid dependencies are reported individually and do not suppress other entries.\n* @param profile - desktop profile directory.\n* @param report - diagnostic sink receiving the failing package name and error.\n* @returns validated main entry paths; an absent profile manifest yields no entries.\n*/\nasync function discoverDesktopMainExtensions(profile, report) {\n\tlet manifest;\n\ttry {\n\t\tmanifest = JSON.parse(await readFile$1(join(profile, \"package.json\"), \"utf8\"));\n\t} catch (error) {\n\t\tif (!record$6(error) || error.code !== \"ENOENT\") report(\"profile\", error);\n\t\treturn [];\n\t}\n\tif (!record$6(manifest) || !record$6(manifest.dependencies)) return [];\n\tconst entries = [];\n\tfor (const name of Object.keys(manifest.dependencies)) try {\n\t\tif (!/^(?:@[a-z0-9][a-z0-9._-]*\\/)?[a-z0-9][a-z0-9._-]*$/u.test(name)) throw new Error(\"invalid dependency name\");\n\t\tconst directory = await realpath(join(profile, \"node_modules\", name));\n\t\tconst pkg = JSON.parse(await readFile$1(join(directory, \"package.json\"), \"utf8\"));\n\t\tif (!record$6(pkg) || !record$6(pkg.dsh) || !record$6(pkg.dsh.desktop) || pkg.dsh.desktop.main === void 0) continue;\n\t\tconst main = pkg.dsh.desktop.main;\n\t\tif (typeof main !== \"string\" || !main.startsWith(\"./\") || !inside(directory, resolve(directory, main))) throw new Error(\"dsh.desktop.main must be a relative entry inside its package\");\n\t\tconst entry = await realpath(resolve(directory, main));\n\t\tif (!inside(directory, entry)) throw new Error(\"dsh.desktop.main resolves outside its package\");\n\t\tentries.push({\n\t\t\tname,\n\t\t\tentry\n\t\t});\n\t} catch (error) {\n\t\treport(name, error);\n\t}\n\treturn entries;\n}\n/**\n* Start trusted extensions independently and register synchronous cleanup on will-quit.\n* @param profile - desktop profile containing installed dependencies.\n* @param api - Electron capabilities and shared Harness home.\n* @returns idempotent disposer that also removes the quit listener.\n*/\nasync function startDesktopMainExtensions(profile, api) {\n\tconst report = (name, error) => {\n\t\tconsole.error(`desktop main extension ${name}:`, error);\n\t};\n\tconst disposers = [];\n\tconst running = /* @__PURE__ */ new Map();\n\tlet stopped = false;\n\tconst dispose = () => {\n\t\tstopped = true;\n\t\tapi.app.off(\"will-quit\", dispose);\n\t\tfor (const extension of disposers.splice(0).reverse()) try {\n\t\t\textension.dispose();\n\t\t} catch (error) {\n\t\t\treport(extension.name, error);\n\t\t}\n\t};\n\tapi.app.on(\"will-quit\", dispose);\n\tconst entries = await discoverDesktopMainExtensions(profile, report);\n\tfor (const { name, entry } of entries) {\n\t\tif (stopped) break;\n\t\tlet installed;\n\t\ttry {\n\t\t\tinstalled = await fingerprint(profile, name, entry);\n\t\t} catch (error) {\n\t\t\treport(name, error);\n\t\t\tcontinue;\n\t\t}\n\t\ttry {\n\t\t\tconst extension = await import(__rewriteRelativeImportExtension$2(pathToFileURL(entry).href));\n\t\t\tif (stopped) break;\n\t\t\tif (!record$6(extension) || typeof extension.start !== \"function\") throw new Error(\"entry must export start(api)\");\n\t\t\tconst result = await extension.start(api);\n\t\t\tif (typeof result === \"function\") disposers.push({\n\t\t\t\tname,\n\t\t\t\tdispose: () => {\n\t\t\t\t\tresult();\n\t\t\t\t}\n\t\t\t});\n\t\t\telse if (record$6(result) && typeof result.dispose === \"function\") {\n\t\t\t\tconst dispose = result.dispose.bind(result);\n\t\t\t\tdisposers.push({\n\t\t\t\t\tname,\n\t\t\t\t\tdispose: () => {\n\t\t\t\t\t\tdispose();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (stopped) dispose();\n\t\t\trunning.set(name, {\n\t\t\t\tfingerprint: installed.fingerprint,\n\t\t\t\tstatus: {\n\t\t\t\t\tstate: \"loaded\",\n\t\t\t\t\t...installed.version === void 0 ? {} : { version: installed.version },\n\t\t\t\t\tloadedAt: (/* @__PURE__ */ new Date()).toISOString()\n\t\t\t\t}\n\t\t\t});\n\t\t} catch (error) {\n\t\t\treport(name, error);\n\t\t\trunning.set(name, {\n\t\t\t\tfingerprint: installed.fingerprint,\n\t\t\t\tstatus: {\n\t\t\t\t\tstate: \"failed\",\n\t\t\t\t\tcode: \"EXTENSION_START_FAILED\",\n\t\t\t\t\t...installed.version === void 0 ? {} : { version: installed.version }\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\treturn Object.assign(dispose, { status: async (name) => {\n\t\tif (!/^(?:@[a-z0-9][a-z0-9._-]*\\/)?[a-z0-9][a-z0-9._-]*$/u.test(name)) return {\n\t\t\tstate: \"failed\",\n\t\t\tcode: \"EXTENSION_ENTRY_INVALID\"\n\t\t};\n\t\tconst errors = /* @__PURE__ */ new Set();\n\t\tconst current = (await discoverDesktopMainExtensions(profile, (failed) => {\n\t\t\terrors.add(failed);\n\t\t})).find((item) => item.name === name);\n\t\tif (errors.has(name) || errors.has(\"profile\")) return {\n\t\t\tstate: \"failed\",\n\t\t\tcode: \"EXTENSION_ENTRY_INVALID\"\n\t\t};\n\t\tconst loaded = running.get(name);\n\t\tif (current === void 0) return loaded === void 0 ? {\n\t\t\tstate: \"not-installed\",\n\t\t\tcode: \"EXTENSION_NOT_INSTALLED\"\n\t\t} : {\n\t\t\tstate: \"pending-restart\",\n\t\t\tcode: \"EXTENSION_RESTART_REQUIRED\"\n\t\t};\n\t\ttry {\n\t\t\tconst installed = await fingerprint(profile, name, current.entry);\n\t\t\tif (loaded?.fingerprint === installed.fingerprint) return loaded.status;\n\t\t\treturn {\n\t\t\t\tstate: \"pending-restart\",\n\t\t\t\tcode: \"EXTENSION_RESTART_REQUIRED\",\n\t\t\t\t...installed.version === void 0 ? {} : { version: installed.version }\n\t\t\t};\n\t\t} catch (error) {\n\t\t\treport(name, error);\n\t\t\treturn {\n\t\t\t\tstate: \"failed\",\n\t\t\t\tcode: \"EXTENSION_ENTRY_INVALID\"\n\t\t\t};\n\t\t}\n\t} });\n}\n//#endregion\n//#region ../../packages/util/error/lib/index.js\n/**\n* Harness error base with a stable machine-routable code and chained cause.\n* Package errors extend it so tool results and replay can retain failure class.\n* @module @deepseek-ai/dsh-error\n*/\n/**\n* Base class for all harness errors. Carries a `code` (stable, programmatic \u2014\n* e.g. `NO_ADAPTER`, `INVALID_ARGS`) distinct from the\n* human-readable `message`, and supports `cause` chaining via the standard\n* `ErrorOptions`. `name` defaults to the subclass constructor name.\n*/\nvar HarnessError = class extends Error {\n\t/** Stable machine-routable failure class (e.g. `RATE_LIMIT`); route on this, never by parsing `message`. */\n\tcode;\n\tconstructor(message, code, options) {\n\t\tsuper(message, options);\n\t\tthis.code = code;\n\t\tthis.name = new.target.name;\n\t}\n};\n//#endregion\n//#region lib/types/native-views.js\n/** Primary-renderer slot admission and main-owned native Sidebar presentation. */\nvar DesktopNativeViewError = class extends HarnessError {\n\tconstructor(code) {\n\t\tsuper(code, code);\n\t}\n};\nfunction refuse(code) {\n\tthrow new DesktopNativeViewError(code);\n}\nfunction record$5(value) {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) return refuse(\"BROWSER_COMMAND_DENIED\");\n\treturn value;\n}\n/** Parse the plugin's canonical address without treating its owner field as authorization. */\nfunction tab(value) {\n\tif (typeof value !== \"string\" || !value.startsWith(\"dsh-tab:v1:\") || value.length > 16384) return refuse(\"BROWSER_HANDLE_STALE\");\n\tlet parts;\n\ttry {\n\t\tparts = JSON.parse(decodeURIComponent(value.slice(11)));\n\t} catch (_error) {\n\t\treturn refuse(\"BROWSER_HANDLE_STALE\");\n\t}\n\tif (!Array.isArray(parts) || parts.length !== 3 || parts.some((part) => typeof part !== \"string\" || part.length === 0) || `dsh-tab:v1:${encodeURIComponent(JSON.stringify(parts))}` !== value) return refuse(\"BROWSER_HANDLE_STALE\");\n\tconst [owner, session, id] = parts;\n\treturn {\n\t\towner,\n\t\tsession,\n\t\ttab: id,\n\t\twire: value\n\t};\n}\nconst methods = new Set([\n\t\"Page.navigate\",\n\t\"Page.reload\",\n\t\"Page.stopLoading\",\n\t\"Page.getFrameTree\",\n\t\"Page.createIsolatedWorld\",\n\t\"Page.getNavigationHistory\",\n\t\"Page.navigateToHistoryEntry\",\n\t\"Page.getLayoutMetrics\",\n\t\"Page.captureScreenshot\",\n\t\"Runtime.evaluate\",\n\t\"Runtime.terminateExecution\",\n\t\"Input.dispatchMouseEvent\",\n\t\"Input.dispatchKeyEvent\",\n\t\"Input.insertText\",\n\t\"Network.getCookies\",\n\t\"Storage.setCookies\"\n]);\n/** Owns slots, leases, native objects and document generations for one product window. */\nvar DesktopNativeViews = class {\n\twindow;\n\tpolicy;\n\tadmissions = /* @__PURE__ */ new Map();\n\tslots = /* @__PURE__ */ new Map();\n\tviews = /* @__PURE__ */ new Map();\n\treleasing = /* @__PURE__ */ new Map();\n\tchildOwners = /* @__PURE__ */ new Map();\n\tchildren = /* @__PURE__ */ new Map();\n\tendedChildren = /* @__PURE__ */ new Map();\n\tconstructor(window, policy) {\n\t\tthis.window = window;\n\t\tthis.policy = policy;\n\t}\n\t/** Authenticate in main.ts before dispatch; errors are serialized without private exceptions. */\n\tasync request(renderer, input) {\n\t\ttry {\n\t\t\tconst request = record$5(input);\n\t\t\tlet result;\n\t\t\tswitch (request.op) {\n\t\t\t\tcase \"enter\":\n\t\t\t\t\tresult = this.enter(renderer, request.owner);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"leave\":\n\t\t\t\t\tresult = await this.leave(renderer, request.admission);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"register\":\n\t\t\t\t\tresult = this.register(renderer, request.admission, request.scope);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"update\":\n\t\t\t\t\tresult = this.update(renderer, request.slot, request.placement);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"revoke\":\n\t\t\t\t\tresult = await this.revoke(renderer, request.slot);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"acquire\":\n\t\t\t\t\tif (request.persistent === true) await this.policy.preparePersistent();\n\t\t\t\t\tresult = this.acquire(renderer, request.scope, request.workspace, request.persistent === true);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"attach\":\n\t\t\t\t\tresult = this.attach(renderer, request.lease, request.slot);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"command\":\n\t\t\t\t\tresult = await this.command(renderer, request.lease, request.method, request.params);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"release\":\n\t\t\t\t\tresult = await this.release(renderer, request.lease);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"child-register\":\n\t\t\t\t\tresult = this.registerChildOwner(renderer, request.parent, request.slot);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"child-unregister\":\n\t\t\t\t\tresult = await this.unregisterChildOwner(renderer, request.parent, request.token);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"child-adopt\":\n\t\t\t\t\tresult = this.adoptChild(renderer, request.request, request.slot);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault: return refuse(\"BROWSER_COMMAND_DENIED\");\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\tresult\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tif (error instanceof HarnessError && error.code === \"BROWSER_PERSISTENT_SESSION_UNAVAILABLE\") return {\n\t\t\t\tok: false,\n\t\t\t\tcode: error.code,\n\t\t\t\tmessage: \"Persistent Sidebar storage is unavailable\"\n\t\t\t};\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\tcode: error instanceof DesktopNativeViewError ? error.code : \"BROWSER_NATIVE_SURFACE_UNAVAILABLE\",\n\t\t\t\tmessage: error instanceof DesktopNativeViewError ? error.message : \"Native Sidebar operation failed\"\n\t\t\t};\n\t\t}\n\t}\n\tenter(renderer, owner) {\n\t\tif (typeof owner !== \"string\" || owner.length === 0 || owner.length > 4096) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\tconst id = randomUUID();\n\t\tthis.admissions.set(id, {\n\t\t\trenderer,\n\t\t\towner\n\t\t});\n\t\treturn id;\n\t}\n\tasync leave(renderer, id) {\n\t\tif (typeof id !== \"string\") return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\tconst admission = this.admissions.get(id);\n\t\tif (admission === void 0) return;\n\t\tif (admission.renderer !== renderer) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\tthis.admissions.delete(id);\n\t\tfor (const [key, slot] of this.slots) if (slot.admission === id) await this.revoke(renderer, key);\n\t}\n\tregister(renderer, admission, scope) {\n\t\tconst address = tab(scope);\n\t\tconst admitted = typeof admission === \"string\" ? this.admissions.get(admission) : void 0;\n\t\tif (admitted === void 0 || admitted.renderer !== renderer || admitted.owner !== address.owner) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\tif ([...this.slots.values()].some((slot) => slot.renderer === renderer && slot.scope === address.wire)) return refuse(\"BROWSER_SLOT_UNAVAILABLE\");\n\t\tconst id = randomUUID();\n\t\tthis.slots.set(id, {\n\t\t\trenderer,\n\t\t\tscope: address.wire,\n\t\t\tadmission: String(admission)\n\t\t});\n\t\treturn id;\n\t}\n\tslot(renderer, id) {\n\t\tconst slot = typeof id === \"string\" ? this.slots.get(id) : void 0;\n\t\tif (slot === void 0) return refuse(\"BROWSER_SLOT_UNAVAILABLE\");\n\t\tif (slot.renderer !== renderer) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\treturn slot;\n\t}\n\tnative(renderer, id) {\n\t\tconst native = typeof id === \"string\" ? this.views.get(id) : void 0;\n\t\tif (native === void 0 || native.view.webContents.isDestroyed()) return refuse(\"BROWSER_GUEST_CLOSED\");\n\t\tif (native.renderer !== renderer) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\treturn native;\n\t}\n\tupdate(renderer, id, value) {\n\t\tconst slot = this.slot(renderer, id);\n\t\tconst { x, y, width, height, visible, background } = record$5(value);\n\t\tif ([\n\t\t\tx,\n\t\t\ty,\n\t\t\twidth,\n\t\t\theight\n\t\t].some((part) => typeof part !== \"number\" || !Number.isFinite(part)) || Number(width) < 0 || Number(height) < 0 || Number(width) > 1e5 || Number(height) > 1e5 || typeof visible !== \"boolean\" || typeof background !== \"boolean\" || visible && background) return refuse(\"BROWSER_SLOT_UNAVAILABLE\");\n\t\tslot.placement = {\n\t\t\tx: Number(x),\n\t\t\ty: Number(y),\n\t\t\twidth: Number(width),\n\t\t\theight: Number(height),\n\t\t\tvisible,\n\t\t\tbackground\n\t\t};\n\t\tif (slot.lease !== void 0) this.compose(this.native(renderer, slot.lease), slot);\n\t}\n\tacquire(renderer, scope, workspace, persistent) {\n\t\tconst address = tab(scope);\n\t\tif ([...this.slots.values()].find((item) => item.scope === address.wire && item.renderer === renderer) === void 0) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\tif ([...this.views.values()].some((view) => view.scope === address.wire)) return refuse(\"BROWSER_HANDLE_STALE\");\n\t\tconst window = this.window();\n\t\tif (window === void 0 || window.isDestroyed() || window.webContents !== renderer) return refuse(\"BROWSER_NATIVE_SURFACE_UNAVAILABLE\");\n\t\tconst reservation = this.policy.acquire(renderer, workspace, persistent);\n\t\tlet view;\n\t\ttry {\n\t\t\tview = new WebContentsView({ webPreferences: {\n\t\t\t\tpartition: reservation.partition,\n\t\t\t\tsandbox: true,\n\t\t\t\tcontextIsolation: true,\n\t\t\t\tnodeIntegration: false,\n\t\t\t\tnodeIntegrationInWorker: false,\n\t\t\t\tnodeIntegrationInSubFrames: false,\n\t\t\t\twebSecurity: true,\n\t\t\t\tallowRunningInsecureContent: false,\n\t\t\t\twebviewTag: false,\n\t\t\t\tplugins: false,\n\t\t\t\tnavigateOnDragDrop: false,\n\t\t\t\tdisableDialogs: true,\n\t\t\t\tbackgroundThrottling: false\n\t\t\t} });\n\t\t\tthis.policy.bindNative(renderer, reservation.lease, view.webContents);\n\t\t} catch (_error) {\n\t\t\tthis.policy.release(renderer, reservation.lease).catch((error) => console.error(error));\n\t\t\treturn refuse(\"BROWSER_NATIVE_SURFACE_UNAVAILABLE\");\n\t\t}\n\t\treturn this.install(renderer, address.wire, workspace, reservation.lease, view);\n\t}\n\tinstall(renderer, scope, workspace, reservation, view) {\n\t\tconst lease = randomUUID();\n\t\tconst generation = randomUUID();\n\t\tconst native = {\n\t\t\trenderer,\n\t\t\tscope,\n\t\t\tworkspace,\n\t\t\treservation,\n\t\t\tview,\n\t\t\tcontainer: new View(),\n\t\t\tgeneration,\n\t\t\tstate: {\n\t\t\t\tstage: \"attached\",\n\t\t\t\tgeneration\n\t\t\t},\n\t\t\tqueue: Promise.resolve()\n\t\t};\n\t\tnative.container.addChildView(view);\n\t\tthis.views.set(lease, native);\n\t\tnative.documentTimer = setTimeout(() => {\n\t\t\tthis.fail(lease, native, \"BROWSER_SLOT_UNAVAILABLE\");\n\t\t}, 15e3);\n\t\tview.webContents.on(\"did-start-navigation\", (_event, _url, inPlace, mainFrame) => {\n\t\t\tif (mainFrame && !inPlace && this.views.get(lease) === native) {\n\t\t\t\tnative.generation = randomUUID();\n\t\t\t\tclearTimeout(native.documentTimer);\n\t\t\t\tnative.documentTimer = setTimeout(() => {\n\t\t\t\t\tthis.fail(lease, native, \"BROWSER_DOCUMENT_TIMEOUT\");\n\t\t\t\t}, 15e3);\n\t\t\t\tthis.publish(lease, native, {\n\t\t\t\t\tstage: \"attached\",\n\t\t\t\t\tgeneration: native.generation\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t\tconst committed = () => {\n\t\t\tconst generation = native.generation;\n\t\t\tthis.send(native, \"Page.getFrameTree\").then(async (value) => {\n\t\t\t\tawait this.policy.reconcilePersistent().catch(() => {\n\t\t\t\t\tconsole.error(\"Sidebar cookie reconciliation failed\");\n\t\t\t\t});\n\t\t\t\tconst frame = record$5(record$5(record$5(value).frameTree).frame);\n\t\t\t\tif (this.views.get(lease) === native && generation === native.generation && typeof frame.id === \"string\" && typeof frame.loaderId === \"string\") {\n\t\t\t\t\tclearTimeout(native.documentTimer);\n\t\t\t\t\tthis.publish(lease, native, {\n\t\t\t\t\t\tstage: \"document\",\n\t\t\t\t\t\tgeneration,\n\t\t\t\t\t\tframeId: frame.id,\n\t\t\t\t\t\tloaderId: frame.loaderId\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}).catch((_error) => {\n\t\t\t\tif (this.views.get(lease) === native) this.fail(lease, native, \"BROWSER_DOCUMENT_UNACKNOWLEDGED\");\n\t\t\t});\n\t\t};\n\t\tnative.acknowledge = committed;\n\t\tview.webContents.on(\"did-navigate\", committed);\n\t\tview.webContents.on(\"did-navigate-in-page\", (_event, _url, mainFrame) => {\n\t\t\tif (mainFrame) committed();\n\t\t});\n\t\tview.webContents.on(\"did-fail-load\", (_event, code, _description, _url, mainFrame) => {\n\t\t\tif (mainFrame && code !== -3) this.fail(lease, native, \"BROWSER_DOCUMENT_UNACKNOWLEDGED\");\n\t\t});\n\t\tview.webContents.on(\"render-process-gone\", () => {\n\t\t\tthis.fail(lease, native, \"BROWSER_GUEST_CLOSED\");\n\t\t});\n\t\tview.webContents.once(\"destroyed\", () => {\n\t\t\tthis.endChild(lease, \"BROWSER_GUEST_CLOSED\");\n\t\t\tthis.closeChildren(renderer, lease).catch((error) => console.error(error));\n\t\t\tclearTimeout(native.documentTimer);\n\t\t\tif (this.views.get(lease) === native) {\n\t\t\t\tthis.publish(lease, native, {\n\t\t\t\t\tstage: \"closed\",\n\t\t\t\t\tgeneration: native.generation\n\t\t\t\t});\n\t\t\t\tthis.views.delete(lease);\n\t\t\t\tif (native.slot !== void 0) this.slots.delete(native.slot);\n\t\t\t}\n\t\t\tthis.detach(native);\n\t\t});\n\t\treturn { lease };\n\t}\n\tregisterChildOwner(renderer, parent, slotId) {\n\t\tconst scope = tab(parent).wire;\n\t\tconst slot = this.slot(renderer, slotId);\n\t\tif (slot.scope !== scope || slot.lease === void 0) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\tconst lease = slot.lease, native = this.native(renderer, lease);\n\t\tif (native.scope !== scope || native.slot !== slotId) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\tif (this.childOwners.has(lease)) return refuse(\"BROWSER_HANDLE_STALE\");\n\t\tconst registration = {\n\t\t\ttoken: randomUUID(),\n\t\t\tslot: slotId\n\t\t};\n\t\tthis.childOwners.set(lease, registration);\n\t\tnative.view.webContents.setWindowOpenHandler((details) => {\n\t\t\tif (this.childOwners.get(lease) !== registration || this.views.get(lease) !== native || this.slots.get(registration.slot) !== slot || renderer.isDestroyed() || [...this.children.values()].filter((child) => child.parent === lease && child.slot === void 0).length >= 32 || details.url !== \"about:blank\" && !this.policy.allowedNavigation(details.url)) return { action: \"deny\" };\n\t\t\treturn {\n\t\t\t\taction: \"allow\",\n\t\t\t\toutlivesOpener: false,\n\t\t\t\toverrideBrowserWindowOptions: { webPreferences: {\n\t\t\t\t\tsession: native.view.webContents.session,\n\t\t\t\t\tsandbox: true,\n\t\t\t\t\tcontextIsolation: true,\n\t\t\t\t\tnodeIntegration: false,\n\t\t\t\t\tnodeIntegrationInWorker: false,\n\t\t\t\t\tnodeIntegrationInSubFrames: false,\n\t\t\t\t\twebSecurity: true,\n\t\t\t\t\tallowRunningInsecureContent: false,\n\t\t\t\t\twebviewTag: false,\n\t\t\t\t\tplugins: false,\n\t\t\t\t\tnavigateOnDragDrop: false,\n\t\t\t\t\tdisableDialogs: true,\n\t\t\t\t\tbackgroundThrottling: false\n\t\t\t\t} },\n\t\t\t\tcreateWindow: (options) => {\n\t\t\t\t\tif (this.childOwners.get(lease) !== registration || this.views.get(lease) !== native) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\t\t\t\tconst address = tab(scope);\n\t\t\t\t\tconst child = `dsh-tab:v1:${encodeURIComponent(JSON.stringify([\n\t\t\t\t\t\taddress.owner,\n\t\t\t\t\t\taddress.session,\n\t\t\t\t\t\trandomUUID()\n\t\t\t\t\t]))}`;\n\t\t\t\t\tconst reservation = this.policy.acquire(renderer, native.workspace);\n\t\t\t\t\tlet view;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tview = new WebContentsView(options);\n\t\t\t\t\t\tthis.policy.bindNative(renderer, reservation.lease, view.webContents);\n\t\t\t\t\t\tconst created = this.install(renderer, child, native.workspace, reservation.lease, view);\n\t\t\t\t\t\tconst event = {\n\t\t\t\t\t\t\trequest: randomUUID(),\n\t\t\t\t\t\t\topener: scope,\n\t\t\t\t\t\t\tchild,\n\t\t\t\t\t\t\tlease: created.lease,\n\t\t\t\t\t\t\ttarget: details.frameName,\n\t\t\t\t\t\t\turl: details.url,\n\t\t\t\t\t\t\tdisposition: details.disposition\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst timer = setTimeout(() => {\n\t\t\t\t\t\t\tthis.endChild(created.lease, \"BROWSER_CHILD_ADOPTION_TIMEOUT\");\n\t\t\t\t\t\t\tthis.release(renderer, created.lease).catch((error) => console.error(error));\n\t\t\t\t\t\t}, 1e4);\n\t\t\t\t\t\tthis.children.set(event.request, {\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\trenderer,\n\t\t\t\t\t\t\tparent: lease,\n\t\t\t\t\t\t\ttimer\n\t\t\t\t\t\t});\n\t\t\t\t\t\trenderer.send(DESKTOP_IPC.nativeChildEvent, {\n\t\t\t\t\t\t\ttype: \"created\",\n\t\t\t\t\t\t\tparent: scope,\n\t\t\t\t\t\t\tchild: event\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn view.webContents;\n\t\t\t\t\t} catch (_error) {\n\t\t\t\t\t\tconst guest = view?.webContents ?? options.webContents;\n\t\t\t\t\t\tif (guest !== void 0 && !guest.isDestroyed()) guest.close({ waitForBeforeUnload: false });\n\t\t\t\t\t\tthis.policy.release(renderer, reservation.lease).catch((error) => console.error(error));\n\t\t\t\t\t\treturn refuse(\"BROWSER_NATIVE_CHILD_UNAVAILABLE\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t});\n\t\treturn registration.token;\n\t}\n\tadoptChild(renderer, request, slotId) {\n\t\tif (typeof request !== \"string\") return refuse(\"BROWSER_HANDLE_STALE\");\n\t\tconst child = this.children.get(request);\n\t\tif (child === void 0) {\n\t\t\tconst ended = this.endedChildren.get(request);\n\t\t\tif (ended !== void 0 && ended.renderer !== renderer) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\t\treturn refuse(ended?.code ?? \"BROWSER_HANDLE_STALE\");\n\t\t}\n\t\tif (child.renderer !== renderer) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\tconst slot = this.slot(renderer, slotId);\n\t\tif (child.slot !== void 0 && child.slot !== slotId) return refuse(\"BROWSER_CHILD_ALREADY_ADOPTED\");\n\t\tconst parent = this.native(renderer, child.parent);\n\t\tconst owner = this.childOwners.get(child.parent);\n\t\tif (owner === void 0 || parent.slot !== owner.slot || !this.slots.has(owner.slot)) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\tif (slot.scope !== child.event.child || this.slots.get(owner.slot)?.admission !== slot.admission) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\tthis.attach(renderer, child.event.lease, slotId);\n\t\tchild.slot = slotId;\n\t\tclearTimeout(child.timer);\n\t\treturn {\n\t\t\tchild: child.event.child,\n\t\t\tlease: child.event.lease\n\t\t};\n\t}\n\tendChild(lease, code) {\n\t\tfor (const [request, child] of this.children) {\n\t\t\tif (child.event.lease !== lease) continue;\n\t\t\tclearTimeout(child.timer);\n\t\t\tthis.children.delete(request);\n\t\t\tthis.endedChildren.set(request, {\n\t\t\t\trenderer: child.renderer,\n\t\t\t\tcode\n\t\t\t});\n\t\t\tif (this.endedChildren.size > 256) {\n\t\t\t\tconst oldest = this.endedChildren.keys().next().value;\n\t\t\t\tif (oldest !== void 0) this.endedChildren.delete(oldest);\n\t\t\t}\n\t\t\tif (!child.renderer.isDestroyed()) child.renderer.send(DESKTOP_IPC.nativeChildEvent, {\n\t\t\t\ttype: \"closed\",\n\t\t\t\tparent: child.event.opener,\n\t\t\t\tchild: child.event\n\t\t\t});\n\t\t}\n\t}\n\tasync closeChildren(renderer, lease) {\n\t\tthis.childOwners.delete(lease);\n\t\tconst children = [...this.children.values()].filter((child) => child.parent === lease);\n\t\tfor (const child of children) await this.release(renderer, child.event.lease);\n\t}\n\tasync unregisterChildOwner(renderer, parent, token) {\n\t\tconst scope = tab(parent).wire;\n\t\tconst entry = [...this.views].find(([, native]) => native.scope === scope);\n\t\tif (entry === void 0) return;\n\t\tconst [lease, native] = entry;\n\t\tif (native.renderer !== renderer) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\tif (this.childOwners.get(lease)?.token !== token) return refuse(\"BROWSER_HANDLE_STALE\");\n\t\tnative.view.webContents.setWindowOpenHandler(() => ({ action: \"deny\" }));\n\t\tawait this.closeChildren(renderer, lease);\n\t}\n\tpublish(lease, native, state) {\n\t\tnative.state = state;\n\t\tif (!native.renderer.isDestroyed()) native.renderer.send(DESKTOP_IPC.nativeViewState, {\n\t\t\tlease,\n\t\t\tstate\n\t\t});\n\t}\n\tfail(lease, native, code) {\n\t\tif (this.views.get(lease) !== native) return;\n\t\tthis.publish(lease, native, {\n\t\t\tstage: \"failed\",\n\t\t\tgeneration: native.generation,\n\t\t\tcode\n\t\t});\n\t\tthis.release(native.renderer, lease).catch((error) => console.error(error));\n\t}\n\tattach(renderer, id, slotId) {\n\t\tconst native = this.native(renderer, id);\n\t\tconst slot = this.slot(renderer, slotId);\n\t\tif (slot.scope !== native.scope || slot.lease !== void 0 && slot.lease !== id || native.slot !== void 0 && native.slot !== slotId || slot.placement === void 0) return refuse(\"BROWSER_SLOT_UNAVAILABLE\");\n\t\tnative.slot = slotId;\n\t\tslot.lease = id;\n\t\tthis.compose(native, slot);\n\t\tclearTimeout(native.documentTimer);\n\t\tthis.publish(id, native, native.state);\n\t\tif (native.state.stage === \"attached\" && native.view.webContents.getURL() === \"about:blank\" && [...this.children.values()].some((child) => child.event.lease === id)) native.acknowledge?.();\n\t}\n\tcompose(native, slot) {\n\t\tconst window = this.window(), placement = slot.placement;\n\t\tif (window === void 0 || window.isDestroyed() || placement === void 0 || native.renderer !== window.webContents) return refuse(\"BROWSER_NATIVE_SURFACE_UNAVAILABLE\");\n\t\tconst zoom = window.webContents.getZoomFactor();\n\t\tconst bounds = window.getContentBounds();\n\t\tconst x = Math.max(0, Math.min(bounds.width, Math.round(placement.x * zoom)));\n\t\tconst y = Math.max(0, Math.min(bounds.height, Math.round(placement.y * zoom)));\n\t\tconst width = Math.max(0, Math.min(bounds.width - x, Math.round(placement.width * zoom)));\n\t\tconst height = Math.max(0, Math.min(bounds.height - y, Math.round(placement.height * zoom)));\n\t\tnative.container.setBounds({\n\t\t\tx,\n\t\t\ty,\n\t\t\twidth,\n\t\t\theight\n\t\t});\n\t\tnative.view.setBounds({\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\twidth,\n\t\t\theight\n\t\t});\n\t\twindow.contentView.addChildView(native.container, placement.background ? 0 : void 0);\n\t\tnative.container.setVisible(width > 0 && height > 0 && (placement.visible || placement.background));\n\t}\n\tasync command(renderer, id, method, params) {\n\t\tconst native = this.native(renderer, id);\n\t\tif (native.slot === void 0) return refuse(\"BROWSER_SLOT_UNAVAILABLE\");\n\t\tthis.slot(renderer, native.slot);\n\t\tif (typeof method !== \"string\" || !methods.has(method)) return refuse(\"BROWSER_COMMAND_DENIED\");\n\t\tconst input = params === void 0 ? {} : record$5(params);\n\t\tif (method === \"Storage.setCookies\" && (!Array.isArray(input.cookies) || Object.keys(input).some((key) => key !== \"cookies\"))) return refuse(\"BROWSER_COMMAND_DENIED\");\n\t\tif (method === \"Page.createIsolatedWorld\" && input.grantUniveralAccess === true) return refuse(\"BROWSER_COMMAND_DENIED\");\n\t\tif (method === \"Page.navigate\" && (typeof input.url !== \"string\" || !this.policy.allowedNavigation(input.url))) return refuse(\"BROWSER_URL_DENIED\");\n\t\tif (native.state.stage !== \"document\" && ![\n\t\t\t\"Page.navigate\",\n\t\t\t\"Page.stopLoading\",\n\t\t\t\"Page.getFrameTree\"\n\t\t].includes(method)) return refuse(\"BROWSER_DOCUMENT_UNACKNOWLEDGED\");\n\t\tconst expectedGeneration = [\n\t\t\t\"Page.navigate\",\n\t\t\t\"Page.stopLoading\",\n\t\t\t\"Page.getFrameTree\"\n\t\t].includes(method) ? void 0 : native.generation;\n\t\ttry {\n\t\t\tconst result = await this.send(native, method === \"Storage.setCookies\" ? \"Network.setCookies\" : method, input, expectedGeneration);\n\t\t\tif (method === \"Storage.setCookies\" || method === \"Runtime.evaluate\") await this.policy.reconcilePersistent();\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tif (error instanceof DesktopNativeViewError && error.code === \"BROWSER_DOCUMENT_TIMEOUT\") this.fail(id, native, \"BROWSER_DOCUMENT_TIMEOUT\");\n\t\t\tthrow error;\n\t\t}\n\t}\n\tsend(native, method, params = {}, expectedGeneration) {\n\t\tconst pending = native.queue.then(async () => {\n\t\t\tif (![...this.views.values()].includes(native) || native.view.webContents.isDestroyed()) return refuse(\"BROWSER_GUEST_CLOSED\");\n\t\t\tif (expectedGeneration !== void 0 && (native.generation !== expectedGeneration || native.state.stage !== \"document\")) return refuse(\"BROWSER_DOCUMENT_UNACKNOWLEDGED\");\n\t\t\tconst debugger_ = native.view.webContents.debugger;\n\t\t\tif (!debugger_.isAttached()) debugger_.attach(\"1.3\");\n\t\t\tlet timer;\n\t\t\ttry {\n\t\t\t\treturn await Promise.race([debugger_.sendCommand(method, params), new Promise((_resolve, reject) => {\n\t\t\t\t\ttimer = setTimeout(() => {\n\t\t\t\t\t\treject(new DesktopNativeViewError(\"BROWSER_DOCUMENT_TIMEOUT\"));\n\t\t\t\t\t}, 15e3);\n\t\t\t\t})]);\n\t\t\t} finally {\n\t\t\t\tclearTimeout(timer);\n\t\t\t}\n\t\t});\n\t\tnative.queue = pending.catch((_error) => {});\n\t\treturn pending;\n\t}\n\tasync release(renderer, id) {\n\t\tif (typeof id !== \"string\") return refuse(\"BROWSER_GUEST_CLOSED\");\n\t\tconst native = this.views.get(id);\n\t\tif (native === void 0) {\n\t\t\tconst pending = this.releasing.get(id);\n\t\t\tif (pending !== void 0 && pending.renderer !== renderer) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\t\treturn pending?.completion;\n\t\t}\n\t\tif (native.renderer !== renderer) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\tthis.views.delete(id);\n\t\tthis.endChild(id, \"BROWSER_GUEST_CLOSED\");\n\t\tconst children = this.closeChildren(renderer, id);\n\t\tclearTimeout(native.documentTimer);\n\t\tthis.detach(native);\n\t\tif (native.slot !== void 0) this.slots.delete(native.slot);\n\t\tconst completion = Promise.resolve().then(async () => {\n\t\t\tawait children;\n\t\t\tawait this.policy.release(renderer, native.reservation);\n\t\t\tthis.publish(id, native, {\n\t\t\t\tstage: \"closed\",\n\t\t\t\tgeneration: native.generation\n\t\t\t});\n\t\t}).finally(() => {\n\t\t\tthis.releasing.delete(id);\n\t\t});\n\t\tthis.releasing.set(id, {\n\t\t\trenderer,\n\t\t\tcompletion\n\t\t});\n\t\treturn completion;\n\t}\n\t/** Trusted main extensions can enumerate only admitted native surfaces of the primary window. */\n\tsnapshot() {\n\t\tconst renderer = this.window()?.webContents;\n\t\treturn [...this.views].filter(([, native]) => native.renderer === renderer && native.slot !== void 0).map(([lease, native]) => ({\n\t\t\tscope: native.scope,\n\t\t\tlease,\n\t\t\tstate: { ...native.state },\n\t\t\turl: native.view.webContents.getURL(),\n\t\t\ttitle: native.view.webContents.getTitle()\n\t\t}));\n\t}\n\t/** Release only the lease bound to this canonical scope. */\n\tasync scopedRelease(scope, lease) {\n\t\tconst renderer = this.window()?.webContents;\n\t\tif (renderer === void 0) return refuse(\"BROWSER_NATIVE_SURFACE_UNAVAILABLE\");\n\t\tconst native = this.views.get(lease);\n\t\tif (native === void 0) return;\n\t\tif (native.scope !== tab(scope).wire || native.renderer !== renderer) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\tawait this.release(renderer, lease);\n\t}\n\t/** Download through the same scoped guest session and its network policy. */\n\tasync scopedFetch(scope, lease, url, signal) {\n\t\tconst renderer = this.window()?.webContents;\n\t\tif (renderer === void 0) return refuse(\"BROWSER_NATIVE_SURFACE_UNAVAILABLE\");\n\t\tconst native = this.native(renderer, lease);\n\t\tif (native.scope !== tab(scope).wire) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\tif (!this.policy.allowedNavigation(url)) return refuse(\"BROWSER_URL_DENIED\");\n\t\tconst response = await native.view.webContents.session.fetch(url, {\n\t\t\tcredentials: \"include\",\n\t\t\tsignal\n\t\t});\n\t\tawait this.policy.reconcilePersistent();\n\t\treturn response;\n\t}\n\t/** Resolve the scoped binding again at dispatch, rather than exposing Electron guests. */\n\tasync scopedCommand(scope, lease, method, params) {\n\t\tconst renderer = this.window()?.webContents;\n\t\tif (renderer === void 0) return refuse(\"BROWSER_NATIVE_SURFACE_UNAVAILABLE\");\n\t\tif (this.native(renderer, lease).scope !== tab(scope).wire) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\treturn this.command(renderer, lease, method, params);\n\t}\n\tdetach(native) {\n\t\tconst window = this.window();\n\t\tif (window !== void 0 && !window.isDestroyed()) window.contentView.removeChildView(native.container);\n\t}\n\tasync revoke(renderer, id) {\n\t\tif (typeof id !== \"string\" || !this.slots.has(id)) return;\n\t\tconst slot = this.slot(renderer, id);\n\t\tthis.slots.delete(id);\n\t\tfor (const [lease, native] of this.views) if (native.renderer === renderer && native.scope === slot.scope) await this.release(renderer, lease);\n\t}\n\t/** Revoke admissions before releasing native objects on owner navigation or death. */\n\tbind(window) {\n\t\tconst renderer = window.webContents;\n\t\tconst revoke = () => {\n\t\t\tfor (const [id, admission] of this.admissions) if (admission.renderer === renderer) this.admissions.delete(id);\n\t\t\tfor (const [id, slot] of this.slots) if (slot.renderer === renderer) this.slots.delete(id);\n\t\t\tfor (const [id, native] of this.views) if (native.renderer === renderer) this.release(renderer, id).catch((error) => console.error(error));\n\t\t};\n\t\trenderer.on(\"did-start-navigation\", (_event, _url, inPlace, mainFrame) => {\n\t\t\tif (mainFrame && !inPlace) revoke();\n\t\t});\n\t\trenderer.on(\"render-process-gone\", revoke);\n\t\trenderer.once(\"destroyed\", revoke);\n\t}\n};\n//#endregion\n//#region lib/types/core-package-set.js\n/** Private package installed beside dsh to boot the Desktop Host process. */\nconst DESKTOP_HOST_PACKAGE = \"@deepseek-ai/dsh-desktop-host\";"
|
|
81
|
+
"after": "\n}\n//#endregion\n//#region lib/types/main-extensions.js\n/** Explicitly installed, trusted profile extensions running in Electron main. */\nvar __rewriteRelativeImportExtension$2 = function(path, preserveJsx) {\n\tif (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) {\n\t\treturn tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : d + ext + \".\" + cm.toLowerCase() + \"js\";\n\t});\n\treturn path;\n};\nasync function fingerprint(profile, name, entry) {\n\tconst directory = await realpath(join(profile, \"node_modules\", name));\n\tconst text = await readFile$1(join(directory, \"package.json\"), \"utf8\");\n\tconst pkg = JSON.parse(text);\n\tconst hash = createHash(\"sha256\").update(entry).update(text);\n\tconst visit = async (path) => {\n\t\tfor (const item of (await readdir(path, { withFileTypes: true })).sort((a, b) => a.name.localeCompare(b.name))) {\n\t\t\tif (item.name === \"node_modules\" || item.name === \".git\") continue;\n\t\t\tconst child = join(path, item.name);\n\t\t\tif (item.isSymbolicLink()) throw new Error(\"extension package contains a symbolic link\");\n\t\t\tif (item.isDirectory()) await visit(child);\n\t\t\telse if (item.isFile()) {\n\t\t\t\tconst content = await readFile$1(child);\n\t\t\t\thash.update(JSON.stringify([relative(directory, child), content.length])).update(content);\n\t\t\t}\n\t\t}\n\t};\n\tawait visit(directory);\n\treturn {\n\t\tfingerprint: hash.digest(\"hex\"),\n\t\t...record$6(pkg) && typeof pkg.version === \"string\" ? { version: pkg.version } : {}\n\t};\n}\nfunction record$6(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction inside(root, path) {\n\tconst child = relative(root, path);\n\treturn child !== \"\" && !isAbsolute(child) && child !== \"..\" && !child.startsWith(\"../\") && !child.startsWith(\"..\\\\\");\n}\n/**\n* Discover opt-in entries from direct installed profile dependencies; reject escaping paths, including symlinks.\n* Invalid dependencies are reported individually and do not suppress other entries.\n* @param profile - desktop profile directory.\n* @param report - diagnostic sink receiving the failing package name and error.\n* @returns validated main entry paths; an absent profile manifest yields no entries.\n*/\nasync function discoverDesktopMainExtensions(profile, report) {\n\tlet manifest;\n\ttry {\n\t\tmanifest = JSON.parse(await readFile$1(join(profile, \"package.json\"), \"utf8\"));\n\t} catch (error) {\n\t\tif (!record$6(error) || error.code !== \"ENOENT\") report(\"profile\", error);\n\t\treturn [];\n\t}\n\tif (!record$6(manifest) || !record$6(manifest.dependencies)) return [];\n\tconst entries = [];\n\tfor (const name of Object.keys(manifest.dependencies)) try {\n\t\tif (!/^(?:@[a-z0-9][a-z0-9._-]*\\/)?[a-z0-9][a-z0-9._-]*$/u.test(name)) throw new Error(\"invalid dependency name\");\n\t\tconst directory = await realpath(join(profile, \"node_modules\", name));\n\t\tconst pkg = JSON.parse(await readFile$1(join(directory, \"package.json\"), \"utf8\"));\n\t\tif (!record$6(pkg) || !record$6(pkg.dsh) || !record$6(pkg.dsh.desktop) || pkg.dsh.desktop.main === void 0) continue;\n\t\tconst main = pkg.dsh.desktop.main;\n\t\tif (typeof main !== \"string\" || !main.startsWith(\"./\") || !inside(directory, resolve(directory, main))) throw new Error(\"dsh.desktop.main must be a relative entry inside its package\");\n\t\tconst entry = await realpath(resolve(directory, main));\n\t\tif (!inside(directory, entry)) throw new Error(\"dsh.desktop.main resolves outside its package\");\n\t\tentries.push({\n\t\t\tname,\n\t\t\tentry\n\t\t});\n\t} catch (error) {\n\t\treport(name, error);\n\t}\n\treturn entries;\n}\n/**\n* Start trusted extensions independently and register synchronous cleanup on will-quit.\n* @param profile - desktop profile containing installed dependencies.\n* @param api - Electron capabilities and shared Harness home.\n* @returns idempotent disposer that also removes the quit listener.\n*/\nasync function startDesktopMainExtensions(profile, api) {\n\tconst report = (name, error) => {\n\t\tconsole.error(`desktop main extension ${name}:`, error);\n\t};\n\tconst disposers = [];\n\tconst running = /* @__PURE__ */ new Map();\n\tlet stopped = false;\n\tconst dispose = () => {\n\t\tstopped = true;\n\t\tapi.app.off(\"will-quit\", dispose);\n\t\tfor (const extension of disposers.splice(0).reverse()) try {\n\t\t\textension.dispose();\n\t\t} catch (error) {\n\t\t\treport(extension.name, error);\n\t\t}\n\t};\n\tapi.app.on(\"will-quit\", dispose);\n\tconst entries = await discoverDesktopMainExtensions(profile, report);\n\tfor (const { name, entry } of entries) {\n\t\tif (stopped) break;\n\t\tlet installed;\n\t\ttry {\n\t\t\tinstalled = await fingerprint(profile, name, entry);\n\t\t} catch (error) {\n\t\t\treport(name, error);\n\t\t\tcontinue;\n\t\t}\n\t\ttry {\n\t\t\tconst extension = await import(__rewriteRelativeImportExtension$2(pathToFileURL(entry).href));\n\t\t\tif (stopped) break;\n\t\t\tif (!record$6(extension) || typeof extension.start !== \"function\") throw new Error(\"entry must export start(api)\");\n\t\t\tconst result = await extension.start(api);\n\t\t\tif (typeof result === \"function\") disposers.push({\n\t\t\t\tname,\n\t\t\t\tdispose: () => {\n\t\t\t\t\tresult();\n\t\t\t\t}\n\t\t\t});\n\t\t\telse if (record$6(result) && typeof result.dispose === \"function\") {\n\t\t\t\tconst dispose = result.dispose.bind(result);\n\t\t\t\tdisposers.push({\n\t\t\t\t\tname,\n\t\t\t\t\tdispose: () => {\n\t\t\t\t\t\tdispose();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (stopped) dispose();\n\t\t\trunning.set(name, {\n\t\t\t\tfingerprint: installed.fingerprint,\n\t\t\t\tstatus: {\n\t\t\t\t\tstate: \"loaded\",\n\t\t\t\t\t...installed.version === void 0 ? {} : { version: installed.version },\n\t\t\t\t\tloadedAt: (/* @__PURE__ */ new Date()).toISOString()\n\t\t\t\t}\n\t\t\t});\n\t\t} catch (error) {\n\t\t\treport(name, error);\n\t\t\trunning.set(name, {\n\t\t\t\tfingerprint: installed.fingerprint,\n\t\t\t\tstatus: {\n\t\t\t\t\tstate: \"failed\",\n\t\t\t\t\tcode: \"EXTENSION_START_FAILED\",\n\t\t\t\t\t...installed.version === void 0 ? {} : { version: installed.version }\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\treturn Object.assign(dispose, { status: async (name) => {\n\t\tif (!/^(?:@[a-z0-9][a-z0-9._-]*\\/)?[a-z0-9][a-z0-9._-]*$/u.test(name)) return {\n\t\t\tstate: \"failed\",\n\t\t\tcode: \"EXTENSION_ENTRY_INVALID\"\n\t\t};\n\t\tconst errors = /* @__PURE__ */ new Set();\n\t\tconst current = (await discoverDesktopMainExtensions(profile, (failed) => {\n\t\t\terrors.add(failed);\n\t\t})).find((item) => item.name === name);\n\t\tif (errors.has(name) || errors.has(\"profile\")) return {\n\t\t\tstate: \"failed\",\n\t\t\tcode: \"EXTENSION_ENTRY_INVALID\"\n\t\t};\n\t\tconst loaded = running.get(name);\n\t\tif (current === void 0) return loaded === void 0 ? {\n\t\t\tstate: \"not-installed\",\n\t\t\tcode: \"EXTENSION_NOT_INSTALLED\"\n\t\t} : {\n\t\t\tstate: \"pending-restart\",\n\t\t\tcode: \"EXTENSION_RESTART_REQUIRED\"\n\t\t};\n\t\ttry {\n\t\t\tconst installed = await fingerprint(profile, name, current.entry);\n\t\t\tif (loaded?.fingerprint === installed.fingerprint) return loaded.status;\n\t\t\treturn {\n\t\t\t\tstate: \"pending-restart\",\n\t\t\t\tcode: \"EXTENSION_RESTART_REQUIRED\",\n\t\t\t\t...installed.version === void 0 ? {} : { version: installed.version }\n\t\t\t};\n\t\t} catch (error) {\n\t\t\treport(name, error);\n\t\t\treturn {\n\t\t\t\tstate: \"failed\",\n\t\t\t\tcode: \"EXTENSION_ENTRY_INVALID\"\n\t\t\t};\n\t\t}\n\t} });\n}\n//#endregion\n//#region ../../packages/util/error/lib/index.js\n/**\n* Harness error base with a stable machine-routable code and chained cause.\n* Package errors extend it so tool results and replay can retain failure class.\n* @module @deepseek-ai/dsh-error\n*/\n/**\n* Base class for all harness errors. Carries a `code` (stable, programmatic —\n* e.g. `NO_ADAPTER`, `INVALID_ARGS`) distinct from the\n* human-readable `message`, and supports `cause` chaining via the standard\n* `ErrorOptions`. `name` defaults to the subclass constructor name.\n*/\nvar HarnessError = class extends Error {\n\t/** Stable machine-routable failure class (e.g. `RATE_LIMIT`); route on this, never by parsing `message`. */\n\tcode;\n\tconstructor(message, code, options) {\n\t\tsuper(message, options);\n\t\tthis.code = code;\n\t\tthis.name = new.target.name;\n\t}\n};\n//#endregion\n//#region lib/types/native-views.js\n/** Primary-renderer slot admission and main-owned native Sidebar presentation. */\nvar DesktopNativeViewError = class extends HarnessError {\n\tconstructor(code) {\n\t\tsuper(code, code);\n\t}\n};\nfunction refuse(code) {\n\tthrow new DesktopNativeViewError(code);\n}\nfunction record$5(value) {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) return refuse(\"BROWSER_COMMAND_DENIED\");\n\treturn value;\n}\n/** Parse the plugin's canonical address without treating its owner field as authorization. */\nfunction tab(value) {\n\tif (typeof value !== \"string\" || !value.startsWith(\"dsh-tab:v1:\") || value.length > 16384) return refuse(\"BROWSER_HANDLE_STALE\");\n\tlet parts;\n\ttry {\n\t\tparts = JSON.parse(decodeURIComponent(value.slice(11)));\n\t} catch (_error) {\n\t\treturn refuse(\"BROWSER_HANDLE_STALE\");\n\t}\n\tif (!Array.isArray(parts) || parts.length !== 3 || parts.some((part) => typeof part !== \"string\" || part.length === 0) || `dsh-tab:v1:${encodeURIComponent(JSON.stringify(parts))}` !== value) return refuse(\"BROWSER_HANDLE_STALE\");\n\tconst [owner, session, id] = parts;\n\treturn {\n\t\towner,\n\t\tsession,\n\t\ttab: id,\n\t\twire: value\n\t};\n}\nconst methods = new Set([\n\t\"Page.navigate\",\n\t\"Page.reload\",\n\t\"Page.stopLoading\",\n\t\"Page.getFrameTree\",\n\t\"Page.createIsolatedWorld\",\n\t\"Page.getNavigationHistory\",\n\t\"Page.navigateToHistoryEntry\",\n\t\"Page.getLayoutMetrics\",\n\t\"Page.captureScreenshot\",\n\t\"Runtime.evaluate\",\n\t\"Runtime.terminateExecution\",\n\t\"Input.dispatchMouseEvent\",\n\t\"Input.dispatchKeyEvent\",\n\t\"Input.insertText\",\n\t\"Network.getCookies\",\n\t\"Storage.setCookies\"\n]);\n/** Owns slots, leases, native objects and document generations for one product window. */\nvar DesktopNativeViews = class {\n\twindow;\n\tpolicy;\n\tadmissions = /* @__PURE__ */ new Map();\n\tslots = /* @__PURE__ */ new Map();\n\tviews = /* @__PURE__ */ new Map();\n\treleasing = /* @__PURE__ */ new Map();\n\tchildOwners = /* @__PURE__ */ new Map();\n\tchildren = /* @__PURE__ */ new Map();\n\tendedChildren = /* @__PURE__ */ new Map();\n\tconstructor(window, policy) {\n\t\tthis.window = window;\n\t\tthis.policy = policy;\n\t}\n\t/** Authenticate in main.ts before dispatch; errors are serialized without private exceptions. */\n\tasync request(renderer, input) {\n\t\ttry {\n\t\t\tconst request = record$5(input);\n\t\t\tlet result;\n\t\t\tswitch (request.op) {\n\t\t\t\tcase \"enter\":\n\t\t\t\t\tresult = this.enter(renderer, request.owner);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"leave\":\n\t\t\t\t\tresult = await this.leave(renderer, request.admission);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"register\":\n\t\t\t\t\tresult = this.register(renderer, request.admission, request.scope);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"update\":\n\t\t\t\t\tresult = this.update(renderer, request.slot, request.placement);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"revoke\":\n\t\t\t\t\tresult = await this.revoke(renderer, request.slot);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"acquire\":\n\t\t\t\t\tif (request.persistent === true) await this.policy.preparePersistent();\n\t\t\t\t\tresult = this.acquire(renderer, request.scope, request.workspace, request.persistent === true);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"attach\":\n\t\t\t\t\tresult = this.attach(renderer, request.lease, request.slot);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"command\":\n\t\t\t\t\tresult = await this.command(renderer, request.lease, request.method, request.params);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"release\":\n\t\t\t\t\tresult = await this.release(renderer, request.lease);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"child-register\":\n\t\t\t\t\tresult = this.registerChildOwner(renderer, request.parent, request.slot);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"child-unregister\":\n\t\t\t\t\tresult = await this.unregisterChildOwner(renderer, request.parent, request.token);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"child-adopt\":\n\t\t\t\t\tresult = this.adoptChild(renderer, request.request, request.slot);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault: return refuse(\"BROWSER_COMMAND_DENIED\");\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\tresult\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tif (error instanceof HarnessError && error.code === \"BROWSER_PERSISTENT_SESSION_UNAVAILABLE\") return {\n\t\t\t\tok: false,\n\t\t\t\tcode: error.code,\n\t\t\t\tmessage: \"Persistent Sidebar storage is unavailable\"\n\t\t\t};\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\tcode: error instanceof DesktopNativeViewError ? error.code : \"BROWSER_NATIVE_SURFACE_UNAVAILABLE\",\n\t\t\t\tmessage: error instanceof DesktopNativeViewError ? error.message : \"Native Sidebar operation failed\"\n\t\t\t};\n\t\t}\n\t}\n\tenter(renderer, owner) {\n\t\tif (typeof owner !== \"string\" || owner.length === 0 || owner.length > 4096) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\tconst id = randomUUID();\n\t\tthis.admissions.set(id, {\n\t\t\trenderer,\n\t\t\towner\n\t\t});\n\t\treturn id;\n\t}\n\tasync leave(renderer, id) {\n\t\tif (typeof id !== \"string\") return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\tconst admission = this.admissions.get(id);\n\t\tif (admission === void 0) return;\n\t\tif (admission.renderer !== renderer) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\tthis.admissions.delete(id);\n\t\tfor (const [key, slot] of this.slots) if (slot.admission === id) await this.revoke(renderer, key);\n\t}\n\tregister(renderer, admission, scope) {\n\t\tconst address = tab(scope);\n\t\tconst admitted = typeof admission === \"string\" ? this.admissions.get(admission) : void 0;\n\t\tif (admitted === void 0 || admitted.renderer !== renderer || admitted.owner !== address.owner) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\tif ([...this.slots.values()].some((slot) => slot.renderer === renderer && slot.scope === address.wire)) return refuse(\"BROWSER_SLOT_UNAVAILABLE\");\n\t\tconst id = randomUUID();\n\t\tthis.slots.set(id, {\n\t\t\trenderer,\n\t\t\tscope: address.wire,\n\t\t\tadmission: String(admission)\n\t\t});\n\t\treturn id;\n\t}\n\tslot(renderer, id) {\n\t\tconst slot = typeof id === \"string\" ? this.slots.get(id) : void 0;\n\t\tif (slot === void 0) return refuse(\"BROWSER_SLOT_UNAVAILABLE\");\n\t\tif (slot.renderer !== renderer) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\treturn slot;\n\t}\n\tnative(renderer, id) {\n\t\tconst native = typeof id === \"string\" ? this.views.get(id) : void 0;\n\t\tif (native === void 0 || native.view.webContents.isDestroyed()) return refuse(\"BROWSER_GUEST_CLOSED\");\n\t\tif (native.renderer !== renderer) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\treturn native;\n\t}\n\tupdate(renderer, id, value) {\n\t\tconst slot = this.slot(renderer, id);\n\t\tconst { x, y, width, height, visible, background } = record$5(value);\n\t\tif ([\n\t\t\tx,\n\t\t\ty,\n\t\t\twidth,\n\t\t\theight\n\t\t].some((part) => typeof part !== \"number\" || !Number.isFinite(part)) || Number(width) < 0 || Number(height) < 0 || Number(width) > 1e5 || Number(height) > 1e5 || typeof visible !== \"boolean\" || typeof background !== \"boolean\" || visible && background) return refuse(\"BROWSER_SLOT_UNAVAILABLE\");\n\t\tslot.placement = {\n\t\t\tx: Number(x),\n\t\t\ty: Number(y),\n\t\t\twidth: Number(width),\n\t\t\theight: Number(height),\n\t\t\tvisible,\n\t\t\tbackground\n\t\t};\n\t\tif (slot.lease !== void 0) this.compose(this.native(renderer, slot.lease), slot);\n\t}\n\tacquire(renderer, scope, workspace, persistent) {\n\t\tconst address = tab(scope);\n\t\tif ([...this.slots.values()].find((item) => item.scope === address.wire && item.renderer === renderer) === void 0) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\tif ([...this.views.values()].some((view) => view.scope === address.wire)) return refuse(\"BROWSER_HANDLE_STALE\");\n\t\tconst window = this.window();\n\t\tif (window === void 0 || window.isDestroyed() || window.webContents !== renderer) return refuse(\"BROWSER_NATIVE_SURFACE_UNAVAILABLE\");\n\t\tconst reservation = this.policy.acquire(renderer, workspace, persistent);\n\t\tlet view;\n\t\ttry {\n\t\t\tview = new WebContentsView({ webPreferences: {\n\t\t\t\tpartition: reservation.partition,\n\t\t\t\tsandbox: true,\n\t\t\t\tcontextIsolation: true,\n\t\t\t\tnodeIntegration: false,\n\t\t\t\tnodeIntegrationInWorker: false,\n\t\t\t\tnodeIntegrationInSubFrames: false,\n\t\t\t\twebSecurity: true,\n\t\t\t\tallowRunningInsecureContent: false,\n\t\t\t\twebviewTag: false,\n\t\t\t\tplugins: false,\n\t\t\t\tnavigateOnDragDrop: false,\n\t\t\t\tdisableDialogs: true,\n\t\t\t\tbackgroundThrottling: false\n\t\t\t} });\n\t\t\tthis.policy.bindNative(renderer, reservation.lease, view.webContents);\n\t\t} catch (_error) {\n\t\t\tthis.policy.release(renderer, reservation.lease).catch((error) => console.error(error));\n\t\t\treturn refuse(\"BROWSER_NATIVE_SURFACE_UNAVAILABLE\");\n\t\t}\n\t\treturn this.install(renderer, address.wire, workspace, reservation.lease, view);\n\t}\n\tinstall(renderer, scope, workspace, reservation, view) {\n\t\tconst lease = randomUUID();\n\t\tconst generation = randomUUID();\n\t\tconst native = {\n\t\t\trenderer,\n\t\t\tscope,\n\t\t\tworkspace,\n\t\t\treservation,\n\t\t\tview,\n\t\t\tcontainer: new View(),\n\t\t\tgeneration,\n\t\t\tstate: {\n\t\t\t\tstage: \"attached\",\n\t\t\t\tgeneration\n\t\t\t},\n\t\t\tqueue: Promise.resolve()\n\t\t};\n\t\tnative.container.addChildView(view);\n\t\tthis.views.set(lease, native);\n\t\tnative.documentTimer = setTimeout(() => {\n\t\t\tthis.fail(lease, native, \"BROWSER_SLOT_UNAVAILABLE\");\n\t\t}, 15e3);\n\t\tview.webContents.on(\"did-start-navigation\", (_event, _url, inPlace, mainFrame) => {\n\t\t\tif (mainFrame && !inPlace && this.views.get(lease) === native) {\n\t\t\t\tnative.generation = randomUUID();\n\t\t\t\tclearTimeout(native.documentTimer);\n\t\t\t\tnative.documentTimer = setTimeout(() => {\n\t\t\t\t\tthis.fail(lease, native, \"BROWSER_DOCUMENT_TIMEOUT\");\n\t\t\t\t}, 15e3);\n\t\t\t\tthis.publish(lease, native, {\n\t\t\t\t\tstage: \"attached\",\n\t\t\t\t\tgeneration: native.generation\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t\tconst committed = () => {\n\t\t\tconst generation = native.generation;\n\t\t\tthis.send(native, \"Page.getFrameTree\").then(async (value) => {\n\t\t\t\tawait this.policy.reconcilePersistent().catch(() => {\n\t\t\t\t\tconsole.error(\"Sidebar cookie reconciliation failed\");\n\t\t\t\t});\n\t\t\t\tconst frame = record$5(record$5(record$5(value).frameTree).frame);\n\t\t\t\tif (this.views.get(lease) === native && generation === native.generation && typeof frame.id === \"string\" && typeof frame.loaderId === \"string\") {\n\t\t\t\t\tclearTimeout(native.documentTimer);\n\t\t\t\t\tthis.publish(lease, native, {\n\t\t\t\t\t\tstage: \"document\",\n\t\t\t\t\t\tgeneration,\n\t\t\t\t\t\tframeId: frame.id,\n\t\t\t\t\t\tloaderId: frame.loaderId\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}).catch((_error) => {\n\t\t\t\tif (this.views.get(lease) === native) this.fail(lease, native, \"BROWSER_DOCUMENT_UNACKNOWLEDGED\");\n\t\t\t});\n\t\t};\n\t\tnative.acknowledge = committed;\n\t\tview.webContents.on(\"did-navigate\", committed);\n\t\tview.webContents.on(\"did-navigate-in-page\", (_event, _url, mainFrame) => {\n\t\t\tif (mainFrame) committed();\n\t\t});\n\t\tview.webContents.on(\"did-fail-load\", (_event, code, _description, _url, mainFrame) => {\n\t\t\tif (mainFrame && code !== -3) this.fail(lease, native, \"BROWSER_DOCUMENT_UNACKNOWLEDGED\");\n\t\t});\n\t\tview.webContents.on(\"render-process-gone\", () => {\n\t\t\tthis.fail(lease, native, \"BROWSER_GUEST_CLOSED\");\n\t\t});\n\t\tview.webContents.once(\"destroyed\", () => {\n\t\t\tthis.endChild(lease, \"BROWSER_GUEST_CLOSED\");\n\t\t\tthis.closeChildren(renderer, lease).catch((error) => console.error(error));\n\t\t\tclearTimeout(native.documentTimer);\n\t\t\tif (this.views.get(lease) === native) {\n\t\t\t\tthis.publish(lease, native, {\n\t\t\t\t\tstage: \"closed\",\n\t\t\t\t\tgeneration: native.generation\n\t\t\t\t});\n\t\t\t\tthis.views.delete(lease);\n\t\t\t\tif (native.slot !== void 0) this.slots.delete(native.slot);\n\t\t\t}\n\t\t\tthis.detach(native);\n\t\t});\n\t\treturn { lease };\n\t}\n\tregisterChildOwner(renderer, parent, slotId) {\n\t\tconst scope = tab(parent).wire;\n\t\tconst slot = this.slot(renderer, slotId);\n\t\tif (slot.scope !== scope || slot.lease === void 0) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\tconst lease = slot.lease, native = this.native(renderer, lease);\n\t\tif (native.scope !== scope || native.slot !== slotId) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\tif (this.childOwners.has(lease)) return refuse(\"BROWSER_HANDLE_STALE\");\n\t\tconst registration = {\n\t\t\ttoken: randomUUID(),\n\t\t\tslot: slotId\n\t\t};\n\t\tthis.childOwners.set(lease, registration);\n\t\tnative.view.webContents.setWindowOpenHandler((details) => {\n\t\t\tif (this.childOwners.get(lease) !== registration || this.views.get(lease) !== native || this.slots.get(registration.slot) !== slot || renderer.isDestroyed() || [...this.children.values()].filter((child) => child.parent === lease && child.slot === void 0).length >= 32 || details.url !== \"about:blank\" && !this.policy.allowedNavigation(details.url)) return { action: \"deny\" };\n\t\t\treturn {\n\t\t\t\taction: \"allow\",\n\t\t\t\toutlivesOpener: false,\n\t\t\t\toverrideBrowserWindowOptions: { webPreferences: {\n\t\t\t\t\tsession: native.view.webContents.session,\n\t\t\t\t\tsandbox: true,\n\t\t\t\t\tcontextIsolation: true,\n\t\t\t\t\tnodeIntegration: false,\n\t\t\t\t\tnodeIntegrationInWorker: false,\n\t\t\t\t\tnodeIntegrationInSubFrames: false,\n\t\t\t\t\twebSecurity: true,\n\t\t\t\t\tallowRunningInsecureContent: false,\n\t\t\t\t\twebviewTag: false,\n\t\t\t\t\tplugins: false,\n\t\t\t\t\tnavigateOnDragDrop: false,\n\t\t\t\t\tdisableDialogs: true,\n\t\t\t\t\tbackgroundThrottling: false\n\t\t\t\t} },\n\t\t\t\tcreateWindow: (options) => {\n\t\t\t\t\tif (this.childOwners.get(lease) !== registration || this.views.get(lease) !== native) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\t\t\t\tconst address = tab(scope);\n\t\t\t\t\tconst child = `dsh-tab:v1:${encodeURIComponent(JSON.stringify([\n\t\t\t\t\t\taddress.owner,\n\t\t\t\t\t\taddress.session,\n\t\t\t\t\t\trandomUUID()\n\t\t\t\t\t]))}`;\n\t\t\t\t\tconst reservation = this.policy.acquire(renderer, native.workspace);\n\t\t\t\t\tlet view;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tview = new WebContentsView(options);\n\t\t\t\t\t\tthis.policy.bindNative(renderer, reservation.lease, view.webContents);\n\t\t\t\t\t\tconst created = this.install(renderer, child, native.workspace, reservation.lease, view);\n\t\t\t\t\t\tconst event = {\n\t\t\t\t\t\t\trequest: randomUUID(),\n\t\t\t\t\t\t\topener: scope,\n\t\t\t\t\t\t\tchild,\n\t\t\t\t\t\t\tlease: created.lease,\n\t\t\t\t\t\t\ttarget: details.frameName,\n\t\t\t\t\t\t\turl: details.url,\n\t\t\t\t\t\t\tdisposition: details.disposition\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst timer = setTimeout(() => {\n\t\t\t\t\t\t\tthis.endChild(created.lease, \"BROWSER_CHILD_ADOPTION_TIMEOUT\");\n\t\t\t\t\t\t\tthis.release(renderer, created.lease).catch((error) => console.error(error));\n\t\t\t\t\t\t}, 1e4);\n\t\t\t\t\t\tthis.children.set(event.request, {\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\trenderer,\n\t\t\t\t\t\t\tparent: lease,\n\t\t\t\t\t\t\ttimer\n\t\t\t\t\t\t});\n\t\t\t\t\t\trenderer.send(DESKTOP_IPC.nativeChildEvent, {\n\t\t\t\t\t\t\ttype: \"created\",\n\t\t\t\t\t\t\tparent: scope,\n\t\t\t\t\t\t\tchild: event\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn view.webContents;\n\t\t\t\t\t} catch (_error) {\n\t\t\t\t\t\tconst guest = view?.webContents ?? options.webContents;\n\t\t\t\t\t\tif (guest !== void 0 && !guest.isDestroyed()) guest.close({ waitForBeforeUnload: false });\n\t\t\t\t\t\tthis.policy.release(renderer, reservation.lease).catch((error) => console.error(error));\n\t\t\t\t\t\treturn refuse(\"BROWSER_NATIVE_CHILD_UNAVAILABLE\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t});\n\t\treturn registration.token;\n\t}\n\tadoptChild(renderer, request, slotId) {\n\t\tif (typeof request !== \"string\") return refuse(\"BROWSER_HANDLE_STALE\");\n\t\tconst child = this.children.get(request);\n\t\tif (child === void 0) {\n\t\t\tconst ended = this.endedChildren.get(request);\n\t\t\tif (ended !== void 0 && ended.renderer !== renderer) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\t\treturn refuse(ended?.code ?? \"BROWSER_HANDLE_STALE\");\n\t\t}\n\t\tif (child.renderer !== renderer) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\tconst slot = this.slot(renderer, slotId);\n\t\tif (child.slot !== void 0 && child.slot !== slotId) return refuse(\"BROWSER_CHILD_ALREADY_ADOPTED\");\n\t\tconst parent = this.native(renderer, child.parent);\n\t\tconst owner = this.childOwners.get(child.parent);\n\t\tif (owner === void 0 || parent.slot !== owner.slot || !this.slots.has(owner.slot)) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\tif (slot.scope !== child.event.child || this.slots.get(owner.slot)?.admission !== slot.admission) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\tthis.attach(renderer, child.event.lease, slotId);\n\t\tchild.slot = slotId;\n\t\tclearTimeout(child.timer);\n\t\treturn {\n\t\t\tchild: child.event.child,\n\t\t\tlease: child.event.lease\n\t\t};\n\t}\n\tendChild(lease, code) {\n\t\tfor (const [request, child] of this.children) {\n\t\t\tif (child.event.lease !== lease) continue;\n\t\t\tclearTimeout(child.timer);\n\t\t\tthis.children.delete(request);\n\t\t\tthis.endedChildren.set(request, {\n\t\t\t\trenderer: child.renderer,\n\t\t\t\tcode\n\t\t\t});\n\t\t\tif (this.endedChildren.size > 256) {\n\t\t\t\tconst oldest = this.endedChildren.keys().next().value;\n\t\t\t\tif (oldest !== void 0) this.endedChildren.delete(oldest);\n\t\t\t}\n\t\t\tif (!child.renderer.isDestroyed()) child.renderer.send(DESKTOP_IPC.nativeChildEvent, {\n\t\t\t\ttype: \"closed\",\n\t\t\t\tparent: child.event.opener,\n\t\t\t\tchild: child.event\n\t\t\t});\n\t\t}\n\t}\n\tasync closeChildren(renderer, lease) {\n\t\tthis.childOwners.delete(lease);\n\t\tconst children = [...this.children.values()].filter((child) => child.parent === lease);\n\t\tfor (const child of children) await this.release(renderer, child.event.lease);\n\t}\n\tasync unregisterChildOwner(renderer, parent, token) {\n\t\tconst scope = tab(parent).wire;\n\t\tconst entry = [...this.views].find(([, native]) => native.scope === scope);\n\t\tif (entry === void 0) return;\n\t\tconst [lease, native] = entry;\n\t\tif (native.renderer !== renderer) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\tif (this.childOwners.get(lease)?.token !== token) return refuse(\"BROWSER_HANDLE_STALE\");\n\t\tnative.view.webContents.setWindowOpenHandler(() => ({ action: \"deny\" }));\n\t\tawait this.closeChildren(renderer, lease);\n\t}\n\tpublish(lease, native, state) {\n\t\tnative.state = state;\n\t\tif (!native.renderer.isDestroyed()) native.renderer.send(DESKTOP_IPC.nativeViewState, {\n\t\t\tlease,\n\t\t\tstate\n\t\t});\n\t}\n\tfail(lease, native, code) {\n\t\tif (this.views.get(lease) !== native) return;\n\t\tthis.publish(lease, native, {\n\t\t\tstage: \"failed\",\n\t\t\tgeneration: native.generation,\n\t\t\tcode\n\t\t});\n\t\tthis.release(native.renderer, lease).catch((error) => console.error(error));\n\t}\n\tattach(renderer, id, slotId) {\n\t\tconst native = this.native(renderer, id);\n\t\tconst slot = this.slot(renderer, slotId);\n\t\tif (slot.scope !== native.scope || slot.lease !== void 0 && slot.lease !== id || native.slot !== void 0 && native.slot !== slotId || slot.placement === void 0) return refuse(\"BROWSER_SLOT_UNAVAILABLE\");\n\t\tnative.slot = slotId;\n\t\tslot.lease = id;\n\t\tthis.compose(native, slot);\n\t\tclearTimeout(native.documentTimer);\n\t\tthis.publish(id, native, native.state);\n\t\tif (native.state.stage === \"attached\" && native.view.webContents.getURL() === \"about:blank\" && [...this.children.values()].some((child) => child.event.lease === id)) native.acknowledge?.();\n\t}\n\tcompose(native, slot) {\n\t\tconst window = this.window(), placement = slot.placement;\n\t\tif (window === void 0 || window.isDestroyed() || placement === void 0 || native.renderer !== window.webContents) return refuse(\"BROWSER_NATIVE_SURFACE_UNAVAILABLE\");\n\t\tconst zoom = window.webContents.getZoomFactor();\n\t\tconst bounds = window.getContentBounds();\n\t\tconst x = Math.max(0, Math.min(bounds.width, Math.round(placement.x * zoom)));\n\t\tconst y = Math.max(0, Math.min(bounds.height, Math.round(placement.y * zoom)));\n\t\tconst width = Math.max(0, Math.min(bounds.width - x, Math.round(placement.width * zoom)));\n\t\tconst height = Math.max(0, Math.min(bounds.height - y, Math.round(placement.height * zoom)));\n\t\tnative.container.setBounds({\n\t\t\tx,\n\t\t\ty,\n\t\t\twidth,\n\t\t\theight\n\t\t});\n\t\tnative.view.setBounds({\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\twidth,\n\t\t\theight\n\t\t});\n\t\twindow.contentView.addChildView(native.container, placement.background ? 0 : void 0);\n\t\tnative.container.setVisible(width > 0 && height > 0 && (placement.visible || placement.background));\n\t}\n\tasync command(renderer, id, method, params) {\n\t\tconst native = this.native(renderer, id);\n\t\tif (native.slot === void 0) return refuse(\"BROWSER_SLOT_UNAVAILABLE\");\n\t\tthis.slot(renderer, native.slot);\n\t\tif (typeof method !== \"string\" || !methods.has(method)) return refuse(\"BROWSER_COMMAND_DENIED\");\n\t\tconst input = params === void 0 ? {} : record$5(params);\n\t\tif (method === \"Storage.setCookies\" && (!Array.isArray(input.cookies) || Object.keys(input).some((key) => key !== \"cookies\"))) return refuse(\"BROWSER_COMMAND_DENIED\");\n\t\tif (method === \"Page.createIsolatedWorld\" && input.grantUniveralAccess === true) return refuse(\"BROWSER_COMMAND_DENIED\");\n\t\tif (method === \"Page.navigate\" && (typeof input.url !== \"string\" || !this.policy.allowedNavigation(input.url))) return refuse(\"BROWSER_URL_DENIED\");\n\t\tif (native.state.stage !== \"document\" && ![\n\t\t\t\"Page.navigate\",\n\t\t\t\"Page.stopLoading\",\n\t\t\t\"Page.getFrameTree\"\n\t\t].includes(method)) return refuse(\"BROWSER_DOCUMENT_UNACKNOWLEDGED\");\n\t\tconst expectedGeneration = [\n\t\t\t\"Page.navigate\",\n\t\t\t\"Page.stopLoading\",\n\t\t\t\"Page.getFrameTree\"\n\t\t].includes(method) ? void 0 : native.generation;\n\t\ttry {\n\t\t\tconst result = await this.send(native, method === \"Storage.setCookies\" ? \"Network.setCookies\" : method, input, expectedGeneration);\n\t\t\tif (method === \"Storage.setCookies\" || method === \"Runtime.evaluate\") await this.policy.reconcilePersistent();\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tif (error instanceof DesktopNativeViewError && error.code === \"BROWSER_DOCUMENT_TIMEOUT\") this.fail(id, native, \"BROWSER_DOCUMENT_TIMEOUT\");\n\t\t\tthrow error;\n\t\t}\n\t}\n\tsend(native, method, params = {}, expectedGeneration) {\n\t\tconst pending = native.queue.then(async () => {\n\t\t\tif (![...this.views.values()].includes(native) || native.view.webContents.isDestroyed()) return refuse(\"BROWSER_GUEST_CLOSED\");\n\t\t\tif (expectedGeneration !== void 0 && (native.generation !== expectedGeneration || native.state.stage !== \"document\")) return refuse(\"BROWSER_DOCUMENT_UNACKNOWLEDGED\");\n\t\t\tconst debugger_ = native.view.webContents.debugger;\n\t\t\tif (!debugger_.isAttached()) debugger_.attach(\"1.3\");\n\t\t\tlet timer;\n\t\t\ttry {\n\t\t\t\treturn await Promise.race([debugger_.sendCommand(method, params), new Promise((_resolve, reject) => {\n\t\t\t\t\ttimer = setTimeout(() => {\n\t\t\t\t\t\treject(new DesktopNativeViewError(\"BROWSER_DOCUMENT_TIMEOUT\"));\n\t\t\t\t\t}, 15e3);\n\t\t\t\t})]);\n\t\t\t} finally {\n\t\t\t\tclearTimeout(timer);\n\t\t\t}\n\t\t});\n\t\tnative.queue = pending.catch((_error) => {});\n\t\treturn pending;\n\t}\n\tasync release(renderer, id) {\n\t\tif (typeof id !== \"string\") return refuse(\"BROWSER_GUEST_CLOSED\");\n\t\tconst native = this.views.get(id);\n\t\tif (native === void 0) {\n\t\t\tconst pending = this.releasing.get(id);\n\t\t\tif (pending !== void 0 && pending.renderer !== renderer) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\t\treturn pending?.completion;\n\t\t}\n\t\tif (native.renderer !== renderer) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\tthis.views.delete(id);\n\t\tthis.endChild(id, \"BROWSER_GUEST_CLOSED\");\n\t\tconst children = this.closeChildren(renderer, id);\n\t\tclearTimeout(native.documentTimer);\n\t\tthis.detach(native);\n\t\tif (native.slot !== void 0) this.slots.delete(native.slot);\n\t\tconst completion = Promise.resolve().then(async () => {\n\t\t\tawait children;\n\t\t\tawait this.policy.release(renderer, native.reservation);\n\t\t\tthis.publish(id, native, {\n\t\t\t\tstage: \"closed\",\n\t\t\t\tgeneration: native.generation\n\t\t\t});\n\t\t}).finally(() => {\n\t\t\tthis.releasing.delete(id);\n\t\t});\n\t\tthis.releasing.set(id, {\n\t\t\trenderer,\n\t\t\tcompletion\n\t\t});\n\t\treturn completion;\n\t}\n\t/** Trusted main extensions can enumerate only admitted native surfaces of the primary window. */\n\tsnapshot() {\n\t\tconst renderer = this.window()?.webContents;\n\t\treturn [...this.views].filter(([, native]) => native.renderer === renderer && native.slot !== void 0).map(([lease, native]) => ({\n\t\t\tscope: native.scope,\n\t\t\tlease,\n\t\t\tstate: { ...native.state },\n\t\t\turl: native.view.webContents.getURL(),\n\t\t\ttitle: native.view.webContents.getTitle()\n\t\t}));\n\t}\n\t/** Release only the lease bound to this canonical scope. */\n\tasync scopedRelease(scope, lease) {\n\t\tconst renderer = this.window()?.webContents;\n\t\tif (renderer === void 0) return refuse(\"BROWSER_NATIVE_SURFACE_UNAVAILABLE\");\n\t\tconst native = this.views.get(lease);\n\t\tif (native === void 0) return;\n\t\tif (native.scope !== tab(scope).wire || native.renderer !== renderer) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\tawait this.release(renderer, lease);\n\t}\n\t/** Download through the same scoped guest session and its network policy. */\n\tasync scopedFetch(scope, lease, url, signal) {\n\t\tconst renderer = this.window()?.webContents;\n\t\tif (renderer === void 0) return refuse(\"BROWSER_NATIVE_SURFACE_UNAVAILABLE\");\n\t\tconst native = this.native(renderer, lease);\n\t\tif (native.scope !== tab(scope).wire) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\tif (!this.policy.allowedNavigation(url)) return refuse(\"BROWSER_URL_DENIED\");\n\t\tconst response = await native.view.webContents.session.fetch(url, {\n\t\t\tcredentials: \"include\",\n\t\t\tsignal\n\t\t});\n\t\tawait this.policy.reconcilePersistent();\n\t\treturn response;\n\t}\n\t/** Resolve the scoped binding again at dispatch, rather than exposing Electron guests. */\n\tasync scopedCommand(scope, lease, method, params) {\n\t\tconst renderer = this.window()?.webContents;\n\t\tif (renderer === void 0) return refuse(\"BROWSER_NATIVE_SURFACE_UNAVAILABLE\");\n\t\tif (this.native(renderer, lease).scope !== tab(scope).wire) return refuse(\"BROWSER_OWNER_UNKNOWN\");\n\t\treturn this.command(renderer, lease, method, params);\n\t}\n\tdetach(native) {\n\t\tconst window = this.window();\n\t\tif (window !== void 0 && !window.isDestroyed()) window.contentView.removeChildView(native.container);\n\t}\n\tasync revoke(renderer, id) {\n\t\tif (typeof id !== \"string\" || !this.slots.has(id)) return;\n\t\tconst slot = this.slot(renderer, id);\n\t\tthis.slots.delete(id);\n\t\tfor (const [lease, native] of this.views) if (native.renderer === renderer && native.scope === slot.scope) await this.release(renderer, lease);\n\t}\n\t/** Revoke admissions before releasing native objects on owner navigation or death. */\n\tbind(window) {\n\t\tconst renderer = window.webContents;\n\t\tconst revoke = () => {\n\t\t\tfor (const [id, admission] of this.admissions) if (admission.renderer === renderer) this.admissions.delete(id);\n\t\t\tfor (const [id, slot] of this.slots) if (slot.renderer === renderer) this.slots.delete(id);\n\t\t\tfor (const [id, native] of this.views) if (native.renderer === renderer) this.release(renderer, id).catch((error) => console.error(error));\n\t\t};\n\t\trenderer.on(\"did-start-navigation\", (_event, _url, inPlace, mainFrame) => {\n\t\t\tif (mainFrame && !inPlace) revoke();\n\t\t});\n\t\trenderer.on(\"render-process-gone\", revoke);\n\t\trenderer.once(\"destroyed\", revoke);\n\t}\n};\n//#endregion\n//#region lib/types/core-package-set.js\n/** Private package installed beside dsh to boot the Desktop Host process. */\nconst DESKTOP_HOST_PACKAGE = \"@deepseek-ai/dsh-desktop-host\";"
|
|
82
82
|
},
|
|
83
83
|
{
|
|
84
84
|
"before": "\t\t\t...this.packageManager === void 0 ? [] : [this.packageManager.pnpm, this.packageManager.nodeBin]\n\t\t], {\n\t\t\tcwd: this.projectDir,\n\t\t\tenv: desktopNodeEnvironment(this.node, void 0, this.environment),\n\t\t\tstdio: [\n\t\t\t\t\"ignore\",\n\t\t\t\t\"pipe\",\n",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
108
|
"before": "\n\t});\n\tipcMain.handle(DESKTOP_IPC.browserAcquire, (event, workspace) => {\n\t\tassertProductSender(event);\n\t\treturn browserGuests.acquire(event.sender, workspace);\n\t});\n",
|
|
109
|
-
"after": "\n\t});\n\tipcMain.handle(DESKTOP_IPC.browserAcquire, async (event, workspace, persistent) => {\n\t\tassertProductSender(event);\n\t\tif (persistent === true) await browserGuests.preparePersistent();\n\t\treturn browserGuests.acquire(event.sender, workspace, persistent === true);\n\t});\n\tlet sidebarStorageClosed = false;\n\tlet sidebarStorageClosing = false;\n\tapp.on(\"will-quit\", (event) => {\n\t\tif (sidebarStorageClosed) return;\n\t\tevent.preventDefault();\n\t\tif (sidebarStorageClosing) return;\n\t\tsidebarStorageClosing = true;\n\t\tbrowserGuests.shutdown().catch((error) => {\n\t\t\tconsole.error(error);\n\t\t}).finally(() => {\n\t\t\tsidebarStorageClosed = true;\n\t\t\tapp.quit();\n\t\t});\n\t});\n\tipcMain.handle(DESKTOP_IPC.nativeViewsRequest, (event, request) => {\n\t\tassertProductSender(event);\n\t\treturn nativeViews.request(event.sender, request);\n\t});\n\tipcMain.handle(DESKTOP_IPC.mainExtensionStatus, async (event, name) => {\n\t\tassertProductSender(event);\n\t\tif (typeof name !== \"string\") throw new Error(\"desktop main extension status requires a package name\");\n\t\tawait startup;\n\t\treturn mainExtensionStatus(name);\n\t});\n"
|
|
109
|
+
"after": "\n\t});\n\tipcMain.handle(DESKTOP_IPC.browserAcquire, async (event, workspace, persistent) => {\n\t\tassertProductSender(event);\n\t\tif (persistent === true) await browserGuests.preparePersistent();\n\t\treturn browserGuests.acquire(event.sender, workspace, persistent === true);\n\t});\n\tlet sidebarStorageClosed = false;\n\tlet sidebarStorageClosing = false;\n\tapp.on(\"will-quit\", (event) => {\n\t\tif (sidebarStorageClosed) return;\n\t\tevent.preventDefault();\n\t\tif (sidebarStorageClosing) return;\n\t\tsidebarStorageClosing = true;\n\t\t/* The quit is already prevented, so only this handler can start it again. A shutdown that\n\t\tnever settles would therefore cancel the quit permanently: the window and tray are gone but the\n\t\tmain process stays alive holding the single-instance lock. The watchdog makes the exit\n\t\tindependent of that promise. */\n\t\tconst force = setTimeout(() => {\n\t\t\tsidebarStorageClosed = true;\n\t\t\tapp.exit(0);\n\t\t}, 5e3);\n\t\tforce.unref?.();\n\t\tbrowserGuests.shutdown().catch((error) => {\n\t\t\tconsole.error(error);\n\t\t}).finally(() => {\n\t\t\tclearTimeout(force);\n\t\t\tsidebarStorageClosed = true;\n\t\t\tapp.quit();\n\t\t});\n\t});\n\tipcMain.handle(DESKTOP_IPC.nativeViewsRequest, (event, request) => {\n\t\tassertProductSender(event);\n\t\treturn nativeViews.request(event.sender, request);\n\t});\n\tipcMain.handle(DESKTOP_IPC.mainExtensionStatus, async (event, name) => {\n\t\tassertProductSender(event);\n\t\tif (typeof name !== \"string\") throw new Error(\"desktop main extension status requires a package name\");\n\t\tawait startup;\n\t\treturn mainExtensionStatus(name);\n\t});\n"
|
|
110
110
|
},
|
|
111
111
|
{
|
|
112
112
|
"before": "\n\t\tbrowserGuests.bind(window, (guest, name) => shortcuts.attachGuest(window, guest, name));\n\t\tshortcuts.attach(window);\n\t\twindow.on(\"focus\", automaticCheck);",
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
},
|
|
132
132
|
{
|
|
133
133
|
"before": "\n}\n//#endregion\n//#region lib/types/preload-browser.js\n/** Lease-scoped browser operations and one main-process event subscription per window. */\n/** @returns browser operations that expose neither IPC nor Electron objects. */\nfunction createDesktopBrowserBridge() {\n\tconst listeners = /* @__PURE__ */ new Map();\n\telectron.ipcRenderer.on(DESKTOP_IPC.browserOpenRequested, (_event, request) => {\n",
|
|
134
|
-
"after": "\n}\n//#endregion\n//#region ../../packages/util/error/lib/index.js\n/**\n* Harness error base with a stable machine-routable code and chained cause.\n* Package errors extend it so tool results and replay can retain failure class.\n* @module @deepseek-ai/dsh-error\n*/\n/**\n* Base class for all harness errors. Carries a `code` (stable, programmatic
|
|
134
|
+
"after": "\n}\n//#endregion\n//#region ../../packages/util/error/lib/index.js\n/**\n* Harness error base with a stable machine-routable code and chained cause.\n* Package errors extend it so tool results and replay can retain failure class.\n* @module @deepseek-ai/dsh-error\n*/\n/**\n* Base class for all harness errors. Carries a `code` (stable, programmatic —\n* e.g. `NO_ADAPTER`, `INVALID_ARGS`) distinct from the\n* human-readable `message`, and supports `cause` chaining via the standard\n* `ErrorOptions`. `name` defaults to the subclass constructor name.\n*/\nvar HarnessError = class extends Error {\n\t/** Stable machine-routable failure class (e.g. `RATE_LIMIT`); route on this, never by parsing `message`. */\n\tcode;\n\tconstructor(message, code, options) {\n\t\tsuper(message, options);\n\t\tthis.code = code;\n\t\tthis.name = new.target.name;\n\t}\n};\n//#endregion\n//#region lib/types/preload-browser.js\n/** Lease-scoped browser operations and one main-process event subscription per window. */\n/** @returns browser operations that expose neither IPC nor Electron objects. */\nfunction createDesktopBrowserBridge() {\n\tconst nativeListeners = /* @__PURE__ */ new Map();\n\telectron.ipcRenderer.on(DESKTOP_IPC.nativeViewState, (_event, input) => {\n\t\tif (typeof input !== \"object\" || input === null || !(\"lease\" in input) || typeof input.lease !== \"string\" || !(\"state\" in input) || typeof input.state !== \"object\" || input.state === null) return;\n\t\tconst state = input.state;\n\t\tif (!(\"stage\" in state) || ![\n\t\t\t\"attached\",\n\t\t\t\"document\",\n\t\t\t\"closed\",\n\t\t\t\"failed\"\n\t\t].includes(String(state.stage)) || !(\"generation\" in state) || typeof state.generation !== \"string\" || state.generation.length === 0 || state.stage === \"document\" && (!(\"frameId\" in state) || typeof state.frameId !== \"string\" || !(\"loaderId\" in state) || typeof state.loaderId !== \"string\") || state.stage === \"failed\" && (!(\"code\" in state) || typeof state.code !== \"string\")) return;\n\t\tconst lease = input.lease;\n\t\tfor (const listener of [...nativeListeners.get(lease) ?? []]) try {\n\t\t\tlistener(state);\n\t\t} catch (error) {\n\t\t\tconsole.error(\"Desktop native view listener failed\", error);\n\t\t}\n\t\tif (state.stage === \"closed\") nativeListeners.delete(lease);\n\t});\n\tconst invoke = async (request) => {\n\t\tconst answer = await electron.ipcRenderer.invoke(DESKTOP_IPC.nativeViewsRequest, request);\n\t\tif (!answer.ok) throw new HarnessError(answer.message, answer.code);\n\t\treturn answer.result;\n\t};\n\tconst created = /* @__PURE__ */ new Map();\n\tconst closed = /* @__PURE__ */ new Map();\n\telectron.ipcRenderer.on(DESKTOP_IPC.nativeChildEvent, (_event, input) => {\n\t\tif (typeof input !== \"object\" || input === null || !(\"parent\" in input) || typeof input.parent !== \"string\" || !(\"type\" in input) || !(\"child\" in input)) return;\n\t\tif (input.type === \"created\" || input.type === \"closed\") {\n\t\t\tconst child = input.child;\n\t\t\tif (typeof child !== \"object\" || child === null || ![\n\t\t\t\t\"request\",\n\t\t\t\t\"opener\",\n\t\t\t\t\"child\",\n\t\t\t\t\"lease\",\n\t\t\t\t\"target\",\n\t\t\t\t\"url\",\n\t\t\t\t\"disposition\"\n\t\t\t].every((key) => key in child && typeof Reflect.get(child, key) === \"string\")) return;\n\t\t\tif (child.opener !== input.parent) return;\n\t\t\tconst registry = input.type === \"created\" ? created : closed;\n\t\t\tfor (const listener of [...registry.get(input.parent) ?? []]) try {\n\t\t\t\tlistener(child);\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error(\"Native child listener failed\", error);\n\t\t\t}\n\t\t}\n\t});\n\tconst subscribe = (registry, parent, listener) => {\n\t\tlet listeners = registry.get(parent);\n\t\tif (listeners === void 0) {\n\t\t\tlisteners = /* @__PURE__ */ new Set();\n\t\t\tregistry.set(parent, listeners);\n\t\t}\n\t\tlisteners.add(listener);\n\t\treturn () => {\n\t\t\tlisteners.delete(listener);\n\t\t\tif (listeners.size === 0 && registry.get(parent) === listeners) registry.delete(parent);\n\t\t};\n\t};\n\tconst nativeViews = {\n\t\tprotocolVersion: 1,\n\t\tpersistentSession: true,\n\t\tslots: {\n\t\t\tenter: (owner) => invoke({\n\t\t\t\top: \"enter\",\n\t\t\t\towner\n\t\t\t}),\n\t\t\tleave: (admission) => invoke({\n\t\t\t\top: \"leave\",\n\t\t\t\tadmission\n\t\t\t}),\n\t\t\tregister: (admission, scope) => invoke({\n\t\t\t\top: \"register\",\n\t\t\t\tadmission,\n\t\t\t\tscope\n\t\t\t}),\n\t\t\tupdate: (slot, placement) => invoke({\n\t\t\t\top: \"update\",\n\t\t\t\tslot,\n\t\t\t\tplacement\n\t\t\t}),\n\t\t\trevoke: (slot) => invoke({\n\t\t\t\top: \"revoke\",\n\t\t\t\tslot\n\t\t\t})\n\t\t},\n\t\tacquire: (scope, workspace, persistent) => invoke({\n\t\t\top: \"acquire\",\n\t\t\tscope,\n\t\t\tworkspace,\n\t\t\tpersistent\n\t\t}),\n\t\tattach: (lease, slot) => invoke({\n\t\t\top: \"attach\",\n\t\t\tlease,\n\t\t\tslot\n\t\t}),\n\t\tcommand: (lease, method, params) => invoke({\n\t\t\top: \"command\",\n\t\t\tlease,\n\t\t\tmethod,\n\t\t\tparams\n\t\t}),\n\t\trelease: (lease) => invoke({\n\t\t\top: \"release\",\n\t\t\tlease\n\t\t}),\n\t\tonState(lease, listener) {\n\t\t\tlet callbacks = nativeListeners.get(lease);\n\t\t\tif (callbacks === void 0) {\n\t\t\t\tcallbacks = /* @__PURE__ */ new Set();\n\t\t\t\tnativeListeners.set(lease, callbacks);\n\t\t\t}\n\t\t\tcallbacks.add(listener);\n\t\t\treturn () => {\n\t\t\t\tcallbacks.delete(listener);\n\t\t\t\tif (callbacks.size === 0 && nativeListeners.get(lease) === callbacks) nativeListeners.delete(lease);\n\t\t\t};\n\t\t}\n\t};\n\tconst listeners = /* @__PURE__ */ new Map();\n\telectron.ipcRenderer.on(DESKTOP_IPC.browserOpenRequested, (_event, request) => {\n"
|
|
135
135
|
},
|
|
136
136
|
{
|
|
137
137
|
"before": "\t});\n\treturn {\n\t\tacquire: (workspace) => electron.ipcRenderer.invoke(DESKTOP_IPC.browserAcquire, workspace),\n\t\trelease: (lease) => electron.ipcRenderer.invoke(DESKTOP_IPC.browserRelease, lease),\n\t\tonOpenRequested(lease, listener) {\n\t\t\tlet callbacks = listeners.get(lease);",
|