dsh-builtin-browser 1.0.0 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +61 -0
- package/README.md +1 -1
- package/assets/browser-panel-locales.mjs +37 -5
- package/assets/browser-policy.d.mts +29 -0
- package/assets/browser-policy.mjs +40 -0
- package/desktop-bridge/desktop-discovery.d.mts +1 -1
- package/desktop-bridge/desktop-discovery.mjs +59 -9
- package/desktop-bridge/desktop-identity.json +12 -0
- package/desktop-bridge/install.mjs +14 -7
- package/desktop-bridge/plugin-browser-bridge.js +19 -7
- package/docs/acceptance-2026-11-27.md +67 -0
- package/docs/architecture.md +1 -1
- package/docs/development.md +33 -4
- package/docs/dsh-0.2.3-host-patch-task.md +34 -0
- package/docs/hardcoding-audit.md +28 -8
- package/docs/known-issues.md +26 -0
- package/docs/limitations.md +6 -2
- package/docs/pr64-maintenance.md +1 -1
- package/docs/tool-reference.md +1 -1
- package/docs/user-guide.md +1 -1
- package/docs/v1.1.0-bu-data-batching-task.md +66 -0
- package/docs/v1.1.0-compat-hardcoding-task.md +85 -0
- package/dsh-builtin-browser-1.0.3-publish.tgz +0 -0
- package/dsh-builtin-browser-1.0.3.tgz +0 -0
- package/dsh-host-patch/README.md +4 -0
- package/dsh-host-patch/apply.mjs +61 -13
- package/dsh-host-patch/rc3-revision9.json.gz +0 -0
- package/dsh-host-patch/rc5-revision9.json.gz +0 -0
- package/dsh-host-patch/sources/main/0001-feat-sidebar-right-add-session-rendering-holds.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0002-feat-desktop-load-trusted-profile-main-extensions.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0003-feat-desktop-report-resolved-and-running-main-extens.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0004-feat-desktop-compose-admitted-native-sidebar-views.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0005-fix-client-admit-coded-browser-errors-in-native-comp.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0006-fix-desktop-acknowledge-native-same-document-navigat.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0007-fix-desktop-restore-auth-in-the-native-lease-partiti.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0008-feat-desktop-adopt-native-children-in-admitted-sideb.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0009-fix-desktop-publish-complete-native-child-close-reco.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0010-fix-desktop-bundle-structured-errors-in-sandboxed-pr.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0011-feat-desktop-offer-persistent-Sidebar-sessions-per-D.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0012-feat-desktop-retain-sidebar-session-cookies-across-r.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0013-fix-desktop-honor-sidebar-session-cookie-sidecar-con.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0014-fix-desktop-retry-cookie-protection-without-failing-.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0015-fix-desktop-preserve-host-only-cookie-identity-in-se.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0016-fix-desktop-restore-session-cookies-before-checkpoin.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0017-fix-desktop-restore-sidebar-cookies-once-before-gues.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0018-fix-sidebar-right-follow-animated-native-slot-placem.patch.gz +0 -0
- package/dsh-host-patch/sources/manifest.json +218 -0
- package/dsh-host-patch/sources/rc3/0001-feat-sidebar-right-add-session-rendering-holds.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0002-feat-desktop-load-trusted-profile-main-extensions.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0003-feat-desktop-report-resolved-and-running-main-extens.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0004-feat-desktop-compose-admitted-native-sidebar-views.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0005-fix-client-admit-coded-browser-errors-in-native-comp.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0006-fix-desktop-acknowledge-native-same-document-navigat.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0007-fix-desktop-restore-auth-in-the-native-lease-partiti.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0008-feat-desktop-adopt-native-children-in-admitted-sideb.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0009-fix-desktop-publish-complete-native-child-close-reco.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0010-fix-desktop-bundle-structured-errors-in-sandboxed-pr.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0011-feat-desktop-offer-persistent-Sidebar-sessions-per-D.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0012-feat-desktop-retain-sidebar-session-cookies-across-r.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0013-fix-desktop-honor-sidebar-session-cookie-sidecar-con.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0014-fix-desktop-retry-cookie-protection-without-failing-.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0015-fix-desktop-preserve-host-only-cookie-identity-in-se.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0016-fix-desktop-restore-session-cookies-before-checkpoin.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0017-fix-desktop-restore-sidebar-cookies-once-before-gues.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0018-fix-sidebar-right-follow-animated-native-slot-placem.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0001-feat-sidebar-right-add-session-rendering-holds.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0002-feat-desktop-load-trusted-profile-main-extensions.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0003-feat-desktop-report-resolved-and-running-main-extens.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0004-feat-desktop-compose-admitted-native-sidebar-views.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0005-fix-client-admit-coded-browser-errors-in-native-comp.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0006-fix-desktop-acknowledge-native-same-document-navigat.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0007-fix-desktop-restore-auth-in-the-native-lease-partiti.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0008-feat-desktop-adopt-native-children-in-admitted-sideb.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0009-fix-desktop-publish-complete-native-child-close-reco.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0010-fix-desktop-bundle-structured-errors-in-sandboxed-pr.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0011-feat-desktop-offer-persistent-Sidebar-sessions-per-D.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0012-feat-desktop-retain-sidebar-session-cookies-across-r.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0013-fix-desktop-honor-sidebar-session-cookie-sidecar-con.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0014-fix-desktop-retry-cookie-protection-without-failing-.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0015-fix-desktop-preserve-host-only-cookie-identity-in-se.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0016-fix-desktop-restore-session-cookies-before-checkpoin.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0017-fix-desktop-restore-sidebar-cookies-once-before-gues.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0018-fix-sidebar-right-follow-animated-native-slot-placem.patch.gz +0 -0
- package/dsh-host-patch/sources/series.json +260 -0
- package/dsh-host-patch/tauri/desktop-main.cjs +62 -0
- package/dsh-host-patch/tauri/sidebar-session.cjs +104 -0
- package/dsh-host-patch/tauri-revision1.json +39 -0
- package/dsh-host-patch/tauri.json +43 -0
- package/dsh-host-patch/v023-alpha2.json +153 -0
- package/lib/browser/anti-bot.js +215 -0
- package/lib/browser/deep-dom.js +39 -0
- package/lib/browser/runtime.js +15 -0
- package/lib/browser/takeover-target.js +13 -6
- package/lib/browser/types.js +30 -1
- package/lib/browser-electron/authenticated-route.js +16 -2
- package/lib/browser-electron/automatic-maintenance.js +16 -10
- package/lib/browser-electron/bridge-connection.js +3 -8
- package/lib/browser-electron/bridge-install.js +2 -1
- package/lib/browser-electron/bridge-status.js +55 -26
- package/lib/browser-electron/desktop-bridge-host.js +7 -6
- package/lib/browser-electron/desktop-identity.js +28 -5
- package/lib/browser-electron/desktop-shell.js +64 -0
- package/lib/browser-electron/electron-provision.js +105 -18
- package/lib/browser-electron/entry.js +129 -46
- package/lib/browser-electron/extension-browser.js +4 -4
- package/lib/browser-electron/foreground-watch.js +134 -0
- package/lib/browser-electron/guest-cookie-jar.js +13 -13
- package/lib/browser-electron/guest-route.js +181 -32
- package/lib/browser-electron/guest-runtime.js +61 -10
- package/lib/browser-electron/guest-storage.js +2 -2
- package/lib/browser-electron/history-store.js +1 -5
- package/lib/browser-electron/host-main.js +8 -4
- package/lib/browser-electron/host-patch-maintenance.js +14 -8
- package/lib/browser-electron/maintenance-route.js +2 -1
- package/lib/browser-electron/missing-system-browser.js +5 -9
- package/lib/browser-electron/preferred-browser.js +7 -3
- package/lib/browser-electron/preview-route.js +9 -13
- package/lib/browser-electron/process-ownership.js +1 -1
- package/lib/browser-electron/profile-command.js +2 -1
- package/lib/browser-electron/profile-extension.js +5 -0
- package/lib/browser-electron/profile-lease.js +152 -47
- package/lib/browser-electron/provider-core.js +527 -0
- package/lib/browser-electron/provider-interaction.js +963 -0
- package/lib/browser-electron/provider-media.js +518 -0
- package/lib/browser-electron/provider-navigation.js +301 -0
- package/lib/browser-electron/provider-observation.js +623 -0
- package/lib/browser-electron/provider-tabs.js +372 -0
- package/lib/browser-electron/provider.js +150 -3301
- package/lib/browser-electron/reference-route.js +9 -18
- package/lib/browser-electron/remote-host.js +79 -34
- package/lib/browser-electron/runtime-status.js +56 -6
- package/lib/browser-electron/settings-store.js +3 -6
- package/lib/browser-electron/sidebar-only-host.js +1 -1
- package/lib/browser-electron/system-browser.js +539 -172
- package/lib/browser-electron/tauri-host.js +208 -0
- package/lib/browser-electron/virtual-cursor.js +23 -13
- package/lib/browser-reference/service.js +22 -4
- package/lib/browser-reference/web-sources.js +1 -1
- package/lib/client.js +43409 -0
- package/lib/compat/host-features.js +75 -0
- package/lib/reference-source.js +1 -1
- package/lib/reference-text.js +23 -1
- package/lib/takeover-protocol.js +1 -1
- package/lib/tool-browser/block-recovery.js +69 -0
- package/lib/tool-browser/code-tool.js +170 -19
- package/lib/tool-browser/code-worker.js +115 -20
- package/lib/tool-browser/errors.js +34 -0
- package/lib/tool-browser/index.js +66 -3593
- package/lib/tool-browser/page-probe.js +227 -28
- package/lib/tool-browser/panel-page.js +2 -1
- package/lib/tool-browser/probe-client.js +157 -0
- package/lib/tool-browser/screenshot-annotations.js +108 -0
- package/lib/tool-browser/state.js +337 -0
- package/lib/tool-browser/takeover.js +1 -1
- package/lib/tool-browser/tools-debug.js +862 -0
- package/lib/tool-browser/tools-interaction.js +993 -0
- package/lib/tool-browser/tools-navigation.js +807 -0
- package/lib/tool-browser/tools-observation.js +461 -0
- package/lib/tool-browser/tools-reference.js +293 -0
- package/lib/web-guest.js +1 -0
- package/package.json +16 -54
- package/README.en.md +0 -89
- package/browser-extension/constants.mjs +0 -20
- package/browser-extension/controller.mjs +0 -293
- package/browser-extension/locales.mjs +0 -15
- package/browser-extension/manifest.json +0 -12
- package/browser-extension/options.html +0 -14
- package/browser-extension/options.mjs +0 -9
- package/browser-extension/permission-guard.mjs +0 -13
- package/browser-extension/worker.mjs +0 -74
- package/dist/client.cjs +0 -43167
- package/lib/browser-electron/package-removal.js +0 -5
- package/lib/browser-reference/submission-receipts.js +0 -139
- package/scripts/build.mjs +0 -66
- package/scripts/bundle-host.mjs +0 -28
- package/scripts/fix-exports.mjs +0 -50
- package/scripts/install-electron.mjs +0 -51
- package/scripts/verify-exports.mjs +0 -47
- package/scripts/verify-preview-sdk.mjs +0 -93
- package/skills/dsh-builtin-browser/SKILL.md +0 -73
- package/skills/dsh-builtin-browser/references/batch.md +0 -53
- package/skills/dsh-builtin-browser/references/deliver.md +0 -31
- package/skills/dsh-builtin-browser/references/locate.md +0 -11
- package/skills/dsh-builtin-browser/references/recover.md +0 -11
- package/skills/dsh-builtin-browser/references/verify.md +0 -13
- package/skills/dsh-debug-host/SKILL.md +0 -56
- package/skills/dsh-debug-self/SKILL.md +0 -50
- package/src/bridge-compatibility.ts +0 -39
- package/src/browser/handles.ts +0 -89
- package/src/browser/runtime.ts +0 -560
- package/src/browser/takeover-target.ts +0 -36
- package/src/browser/types.ts +0 -817
- package/src/browser-electron/authenticated-route.ts +0 -84
- package/src/browser-electron/automatic-maintenance.ts +0 -726
- package/src/browser-electron/bridge-auto.ts +0 -159
- package/src/browser-electron/bridge-connection.ts +0 -385
- package/src/browser-electron/bridge-endpoint.ts +0 -129
- package/src/browser-electron/bridge-install.ts +0 -289
- package/src/browser-electron/bridge-maintenance.ts +0 -189
- package/src/browser-electron/bridge-status.ts +0 -347
- package/src/browser-electron/desktop-bridge-host.ts +0 -251
- package/src/browser-electron/desktop-identity.ts +0 -320
- package/src/browser-electron/document-readiness.ts +0 -45
- package/src/browser-electron/electron-provision.ts +0 -261
- package/src/browser-electron/entry.ts +0 -1301
- package/src/browser-electron/ephemeral-profile.ts +0 -189
- package/src/browser-electron/extension-browser.ts +0 -223
- package/src/browser-electron/extension-setup.ts +0 -67
- package/src/browser-electron/file-write.ts +0 -31
- package/src/browser-electron/guest-cookie-jar.ts +0 -176
- package/src/browser-electron/guest-cookie-store.ts +0 -59
- package/src/browser-electron/guest-css-runtime.ts +0 -76
- package/src/browser-electron/guest-css.ts +0 -68
- package/src/browser-electron/guest-route.ts +0 -568
- package/src/browser-electron/guest-runtime.ts +0 -357
- package/src/browser-electron/guest-storage-runtime.ts +0 -54
- package/src/browser-electron/guest-storage.ts +0 -117
- package/src/browser-electron/history-store.ts +0 -227
- package/src/browser-electron/host-main.ts +0 -1381
- package/src/browser-electron/host-patch-maintenance.ts +0 -112
- package/src/browser-electron/http-body.ts +0 -65
- package/src/browser-electron/json-reply.ts +0 -47
- package/src/browser-electron/maintenance-broker.ts +0 -166
- package/src/browser-electron/maintenance-lifecycle.ts +0 -91
- package/src/browser-electron/maintenance-route.ts +0 -67
- package/src/browser-electron/missing-system-browser.ts +0 -113
- package/src/browser-electron/open-slot.ts +0 -49
- package/src/browser-electron/package-removal.ts +0 -4
- package/src/browser-electron/paths.ts +0 -25
- package/src/browser-electron/preferred-browser.ts +0 -120
- package/src/browser-electron/preview-route.ts +0 -218
- package/src/browser-electron/process-ownership.ts +0 -168
- package/src/browser-electron/process.ts +0 -23
- package/src/browser-electron/profile-checkpoint.ts +0 -187
- package/src/browser-electron/profile-command.ts +0 -46
- package/src/browser-electron/profile-extension.ts +0 -124
- package/src/browser-electron/profile-lease.ts +0 -115
- package/src/browser-electron/profile-residue.ts +0 -49
- package/src/browser-electron/provider.ts +0 -4571
- package/src/browser-electron/reference-route.ts +0 -608
- package/src/browser-electron/remote-host.ts +0 -1462
- package/src/browser-electron/rpc-input.ts +0 -13
- package/src/browser-electron/rpc-ops.ts +0 -41
- package/src/browser-electron/runtime-diagnostics.ts +0 -38
- package/src/browser-electron/runtime-route.ts +0 -105
- package/src/browser-electron/runtime-status.ts +0 -242
- package/src/browser-electron/settings-route.ts +0 -64
- package/src/browser-electron/settings-store.ts +0 -589
- package/src/browser-electron/shortcuts-route.ts +0 -112
- package/src/browser-electron/sidebar-only-host.ts +0 -298
- package/src/browser-electron/startpage-shortcuts.ts +0 -213
- package/src/browser-electron/system-browser.ts +0 -1497
- package/src/browser-electron/timing.ts +0 -16
- package/src/browser-electron/virtual-cursor.ts +0 -152
- package/src/browser-electron/windows-system.ts +0 -24
- package/src/browser-reference/delivery.ts +0 -384
- package/src/browser-reference/entry.ts +0 -631
- package/src/browser-reference/export.ts +0 -339
- package/src/browser-reference/import.ts +0 -303
- package/src/browser-reference/page-script.ts +0 -1537
- package/src/browser-reference/service.ts +0 -1315
- package/src/browser-reference/store.ts +0 -172
- package/src/browser-reference/submission-receipts.ts +0 -122
- package/src/browser-reference/text-quote.ts +0 -219
- package/src/browser-reference/types.ts +0 -195
- package/src/browser-reference/visible.ts +0 -367
- package/src/browser-reference/web-sources.ts +0 -103
- package/src/client/browser/BrowserController.ts +0 -693
- package/src/client/browser/BrowserFrame.ts +0 -78
- package/src/client/browser/BrowserNavigation.ts +0 -169
- package/src/client/browser/BrowserPage.ts +0 -23
- package/src/client/browser/BrowserPersistence.ts +0 -44
- package/src/client/browser/IframeImpl.ts +0 -176
- package/src/client/browser/child-tabs.ts +0 -14
- package/src/client/browser/iframe-reference.ts +0 -67
- package/src/client/browser/initialization.ts +0 -262
- package/src/client/browser/omnibox.ts +0 -243
- package/src/client/browser/store.ts +0 -38
- package/src/client/browser/takeover-channel.ts +0 -72
- package/src/client/browser/url.ts +0 -46
- package/src/client/browser/web-reference-source.ts +0 -52
- package/src/client/css-modules.d.ts +0 -4
- package/src/client/definition.tsx +0 -30
- package/src/client/electron/ElectronWebViewImpl.ts +0 -364
- package/src/client/electron/ElectronWebviewPresentation.ts +0 -138
- package/src/client/electron/NativeChildPresentation.ts +0 -45
- package/src/client/electron/NativeViewPage.ts +0 -251
- package/src/client/electron/pages.ts +0 -23
- package/src/client/electron/reference-overlay.ts +0 -53
- package/src/client/electron/workspace.ts +0 -33
- package/src/client/index.ts +0 -293
- package/src/client/locales.ts +0 -857
- package/src/client/pages.ts +0 -28
- package/src/client/reference/client/BrowserRefLink.tsx +0 -142
- package/src/client/reference/client/draft-reference.ts +0 -167
- package/src/client/reference/client/index.ts +0 -7
- package/src/client/reference/client/ordered-submission.ts +0 -108
- package/src/client/reference/client/pending-delivery.ts +0 -216
- package/src/client/reference/client/plugin.ts +0 -189
- package/src/client/reference/client/production/ReferenceCapsules.tsx +0 -345
- package/src/client/reference/client/production/ReferenceDock.module.css +0 -193
- package/src/client/reference/client/production/ReferenceDock.tsx +0 -6
- package/src/client/reference/client/production/ReferenceFeedback.tsx +0 -15
- package/src/client/reference/client/production/ReferenceMath.tsx +0 -44
- package/src/client/reference/client/production/ReferenceText.tsx +0 -36
- package/src/client/reference/client/production/assembly.ts +0 -471
- package/src/client/reference/client/production/asset-store.ts +0 -144
- package/src/client/reference/client/production/availability.ts +0 -74
- package/src/client/reference/client/production/bytes.ts +0 -36
- package/src/client/reference/client/production/delivery-client.ts +0 -211
- package/src/client/reference/client/production/draft-adapter.ts +0 -508
- package/src/client/reference/client/production/http-transport.ts +0 -217
- package/src/client/reference/client/production/production-submission.ts +0 -310
- package/src/client/reference/client/production/protocol.ts +0 -231
- package/src/client/reference/client/production/reference-card.ts +0 -240
- package/src/client/reference/client/production/reference-labels.ts +0 -29
- package/src/client/reference/client/production/reply-link-bridge.ts +0 -222
- package/src/client/reference/client/production/reveal.ts +0 -215
- package/src/client/reference/client/production/runtime.ts +0 -1101
- package/src/client/reference/client/production/snapshot-adapter.ts +0 -154
- package/src/client/reference/client/production/source-marker.ts +0 -63
- package/src/client/reference/client/production/source-opener.ts +0 -55
- package/src/client/reference/client/production/styles.ts +0 -104
- package/src/client/reference/client/production/user-text-rule.ts +0 -58
- package/src/client/reference/client/reveal.ts +0 -107
- package/src/client/reference/client/scheme.ts +0 -114
- package/src/client/reference/client/types.ts +0 -168
- package/src/client/reference/css-modules.d.ts +0 -4
- package/src/client/reference/index.ts +0 -11
- package/src/client/reference-capture-owner.ts +0 -162
- package/src/client/reference-intents.ts +0 -36
- package/src/client/settings/index.ts +0 -34
- package/src/client/settings/panel.ts +0 -2657
- package/src/client/shortcut-open.ts +0 -30
- package/src/client/startpage/binding.ts +0 -99
- package/src/client/startpage/controller.ts +0 -303
- package/src/client/startpage/model.ts +0 -279
- package/src/client/view/Browser.module.css +0 -751
- package/src/client/view/BrowserBody.tsx +0 -314
- package/src/client/view/BrowserPresentation.ts +0 -9
- package/src/client/view/BrowserTitle.tsx +0 -17
- package/src/client/view/IframePresentation.ts +0 -344
- package/src/client/view/StartPage.tsx +0 -597
- package/src/client/view/TakeoverBanner.tsx +0 -21
- package/src/index.ts +0 -110
- package/src/reference-owner.ts +0 -5
- package/src/reference-page.ts +0 -9
- package/src/reference-source.ts +0 -3
- package/src/reference-text.ts +0 -197
- package/src/startpage-settings.ts +0 -103
- package/src/startpage.ts +0 -71
- package/src/takeover-protocol.ts +0 -19
- package/src/tool-browser/code-tool.ts +0 -401
- package/src/tool-browser/code-worker.ts +0 -639
- package/src/tool-browser/element-fields.ts +0 -167
- package/src/tool-browser/index.ts +0 -3733
- package/src/tool-browser/page-probe.ts +0 -474
- package/src/tool-browser/panel-page.ts +0 -124
- package/src/tool-browser/screenshot-image.ts +0 -49
- package/src/tool-browser/takeover.ts +0 -198
- package/src/types/electron-shim.d.ts +0 -144
- package/src/types.ts +0 -85
- package/src/web-guest.ts +0 -34
- package/tools/accept-desktop.mjs +0 -148
|
@@ -1,293 +0,0 @@
|
|
|
1
|
-
import { EXTENSION_LIMITS, DEBUGGER_IDLE_TIMEOUT_MS, DEBUGGER_IDLE_ALARM, DEBUGGER_SESSION_KEY } from './constants.mjs'
|
|
2
|
-
import { permissionGuard } from './permission-guard.mjs'
|
|
3
|
-
|
|
4
|
-
const DOMAINS = new Set(['Accessibility', 'DOM', 'DOMSnapshot', 'CSS', 'Emulation', 'Input', 'Log', 'Network', 'Page', 'Runtime', 'Target'])
|
|
5
|
-
const DENIED = new Set(['Page.close', 'Page.bringToFront', 'Page.setDownloadBehavior', 'Page.setInterceptFileChooserDialog',
|
|
6
|
-
'Target.activateTarget', 'Target.createTarget', 'Target.closeTarget', 'Target.attachToTarget', 'Target.attachToBrowserTarget',
|
|
7
|
-
'Target.detachFromTarget', 'Target.sendMessageToTarget', 'Target.exposeDevToolsProtocol', 'DOM.setFileInputFiles', 'Page.printToPDF'])
|
|
8
|
-
const validScope = value => typeof value === 'string' && value.length > 0 && value.length <= EXTENSION_LIMITS.scopeLength
|
|
9
|
-
const allowedUrl = url => typeof url === 'string' && (url === 'about:blank' || /^https?:\/\//i.test(url))
|
|
10
|
-
|
|
11
|
-
export class ExtensionController {
|
|
12
|
-
constructor(api, emit) {
|
|
13
|
-
this.api = api; this.emit = emit; this.leases = new Map(); this.created = new Map(); this.tabLeases = new Map(); this.attaching = new Set(); this.generation = 0
|
|
14
|
-
this.related = new Map(); this.containing = new Set()
|
|
15
|
-
this.active = undefined; this.expectedDetach = new Set(); this.tail = Promise.resolve()
|
|
16
|
-
this.ready = this.restore()
|
|
17
|
-
this.ready.catch(() => {})
|
|
18
|
-
api.alarms?.onAlarm.addListener(alarm => {
|
|
19
|
-
if (alarm.name === DEBUGGER_IDLE_ALARM) return this.enqueue(async () => {
|
|
20
|
-
if (Date.now() >= this.idleAt) await this.suspend()
|
|
21
|
-
}).catch(() => {})
|
|
22
|
-
})
|
|
23
|
-
api.debugger.onEvent.addListener((source, method, params) => { void this.event(source, method, params) })
|
|
24
|
-
api.debugger.onDetach.addListener((source, reason) => {
|
|
25
|
-
if (reason !== 'canceled_by_user' && this.expectedDetach.delete(source.tabId)) return
|
|
26
|
-
if (this.active === source.tabId) this.active = undefined
|
|
27
|
-
const lease = this.tabLeases.get(source.tabId)
|
|
28
|
-
if (lease) { this.leases.delete(lease.id); this.tabLeases.delete(source.tabId); this.emit({ type: 'event', lease: lease.id, method: 'target.detached', params: { reason } }) }
|
|
29
|
-
void this.enqueue(() => this.persist()).catch(() => {})
|
|
30
|
-
})
|
|
31
|
-
api.tabs.onRemoved.addListener(tabId => { this.created.delete(tabId); this.related.delete(tabId) })
|
|
32
|
-
api.tabs.onCreated.addListener(tab => { void this.containPopup(tab) })
|
|
33
|
-
api.windows.onCreated.addListener(window => {
|
|
34
|
-
void api.tabs.query({ windowId: window.id }).then(tabs => Promise.all(tabs.map(tab => this.containPopup(tab)))).catch(() => {})
|
|
35
|
-
})
|
|
36
|
-
}
|
|
37
|
-
enqueue(work) {
|
|
38
|
-
const result = this.tail.then(() => this.ready).then(work)
|
|
39
|
-
this.tail = result.catch(() => {})
|
|
40
|
-
return result
|
|
41
|
-
}
|
|
42
|
-
async persist() {
|
|
43
|
-
await this.api.storage?.session?.set({ [DEBUGGER_SESSION_KEY]: {
|
|
44
|
-
leases: [...this.leases.values()], created: [...this.created], active: this.active, activeReady: this.activeReady, idleAt: this.idleAt,
|
|
45
|
-
} })
|
|
46
|
-
}
|
|
47
|
-
async restore() {
|
|
48
|
-
if (!this.api.storage?.session) return
|
|
49
|
-
const stored = (await this.api.storage.session.get(DEBUGGER_SESSION_KEY))[DEBUGGER_SESSION_KEY]
|
|
50
|
-
for (const lease of stored?.leases ?? []) {
|
|
51
|
-
if (validScope(lease.id) && validScope(lease.scope) && validScope(lease.view) && Number.isInteger(lease.tabId)) {
|
|
52
|
-
lease.notices = Array.isArray(lease.notices) ? lease.notices : []
|
|
53
|
-
lease.blockingNotices = Array.isArray(lease.blockingNotices) ? lease.blockingNotices : []
|
|
54
|
-
this.leases.set(lease.id, lease); this.tabLeases.set(lease.tabId, lease)
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
this.created = new Map(stored?.created ?? [])
|
|
58
|
-
const targets = await this.api.debugger.getTargets()
|
|
59
|
-
let retained
|
|
60
|
-
for (const target of targets.filter(target => target.attached && Number.isInteger(target.tabId))) {
|
|
61
|
-
// getTargets also includes other debuggers. Only our own sessions accept commands.
|
|
62
|
-
try { await this.api.debugger.sendCommand({ tabId: target.tabId }, 'Runtime.getIsolateId', {}) }
|
|
63
|
-
catch { continue }
|
|
64
|
-
if (target.tabId === stored?.active && stored.activeReady && this.tabLeases.has(target.tabId) && stored.idleAt > Date.now()) {
|
|
65
|
-
retained = target.tabId
|
|
66
|
-
} else { this.active = target.tabId; await this.suspend() }
|
|
67
|
-
}
|
|
68
|
-
this.active = retained
|
|
69
|
-
this.activeReady = retained !== undefined
|
|
70
|
-
this.idleAt = stored?.idleAt
|
|
71
|
-
if (this.active !== undefined) await this.api.alarms.create(DEBUGGER_IDLE_ALARM, { when: this.idleAt })
|
|
72
|
-
await this.persist()
|
|
73
|
-
}
|
|
74
|
-
suspend() {
|
|
75
|
-
return this.suspending ??= this.detachActive().finally(() => { this.suspending = undefined })
|
|
76
|
-
}
|
|
77
|
-
async detachActive() {
|
|
78
|
-
if (this.active === undefined) return
|
|
79
|
-
const tabId = this.active
|
|
80
|
-
this.expectedDetach.add(tabId)
|
|
81
|
-
try { await this.api.debugger.detach({ tabId }) }
|
|
82
|
-
finally { this.expectedDetach.delete(tabId) }
|
|
83
|
-
this.active = undefined
|
|
84
|
-
this.activeReady = false
|
|
85
|
-
await this.api.alarms?.clear(DEBUGGER_IDLE_ALARM)
|
|
86
|
-
await this.persist()
|
|
87
|
-
}
|
|
88
|
-
async activate(lease) {
|
|
89
|
-
if (this.active === lease.tabId) return
|
|
90
|
-
const generation = this.generation
|
|
91
|
-
await this.suspend()
|
|
92
|
-
const tab = await this.api.tabs.get(lease.tabId)
|
|
93
|
-
if (tab.incognito || !allowedUrl(tab.url || tab.pendingUrl) || !allowedUrl(tab.pendingUrl || tab.url)) throw Error('restricted/internal, extension and incognito pages are unavailable')
|
|
94
|
-
this.active = lease.tabId
|
|
95
|
-
this.activeReady = false
|
|
96
|
-
await this.persist()
|
|
97
|
-
if (generation !== this.generation) { this.active = undefined; throw Error('connection released') }
|
|
98
|
-
try { await this.api.debugger.attach({ tabId: lease.tabId }, '1.3') }
|
|
99
|
-
catch (error) { this.active = undefined; await this.persist(); throw error }
|
|
100
|
-
if (generation !== this.generation) { this.active = lease.tabId; await this.suspend(); throw Error('connection released') }
|
|
101
|
-
try {
|
|
102
|
-
for (const [method, params] of [
|
|
103
|
-
['Page.enable', {}], ['Page.setInterceptFileChooserDialog', { enabled: true }],
|
|
104
|
-
['Emulation.setFocusEmulationEnabled', { enabled: true }], ['Page.setWebLifecycleState', { state: 'active' }],
|
|
105
|
-
]) await this.api.debugger.sendCommand({ tabId: lease.tabId }, method, params)
|
|
106
|
-
if (this.created.get(lease.tabId) === lease.scope) {
|
|
107
|
-
await this.api.debugger.sendCommand({ tabId: lease.tabId }, 'Page.addScriptToEvaluateOnNewDocument', { source: permissionGuard })
|
|
108
|
-
await this.api.debugger.sendCommand({ tabId: lease.tabId }, 'Runtime.evaluate', { expression: permissionGuard })
|
|
109
|
-
}
|
|
110
|
-
if (generation !== this.generation || !this.leases.has(lease.id)) throw Error('connection released')
|
|
111
|
-
this.activeReady = true
|
|
112
|
-
} catch (error) {
|
|
113
|
-
await this.suspend()
|
|
114
|
-
throw error
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
async containPopup(tab) {
|
|
118
|
-
const root = this.created.has(tab.openerTabId) ? tab.openerTabId : this.related.get(tab.openerTabId)?.root
|
|
119
|
-
const scope = this.tabLeases.has(root) ? this.created.get(root) : undefined
|
|
120
|
-
if (!scope || !Number.isInteger(tab.id) || this.containing.has(tab.id) || this.related.has(tab.id)) return
|
|
121
|
-
this.containing.add(tab.id)
|
|
122
|
-
const generation = this.generation
|
|
123
|
-
try {
|
|
124
|
-
const opener = await this.api.tabs.get(tab.openerTabId)
|
|
125
|
-
if (generation !== this.generation) return
|
|
126
|
-
this.related.set(tab.id, { scope, opener: tab.openerTabId, root })
|
|
127
|
-
const window = await this.api.windows.get(tab.windowId)
|
|
128
|
-
if (generation !== this.generation || !this.tabLeases.has(root)) return
|
|
129
|
-
if (window.type === 'popup' && opener.windowId !== tab.windowId) {
|
|
130
|
-
await this.api.tabs.move(tab.id, { windowId: opener.windowId, index: -1 })
|
|
131
|
-
}
|
|
132
|
-
const lease = this.tabLeases.get(root)
|
|
133
|
-
if (lease) {
|
|
134
|
-
lease.notices.push(`Site-created tab ${tab.id} detected${window.type === 'popup' ? '; moved to opener window without activation' : ''}. Site activation may precede browser events.`)
|
|
135
|
-
lease.notices = lease.notices.slice(-EXTENSION_LIMITS.notices)
|
|
136
|
-
}
|
|
137
|
-
this.emit({ type: 'event', method: 'target.popup', lease: lease?.id, params: { tabId: tab.id, openerTabId: tab.openerTabId, containment: window.type === 'popup' ? 'moved' : 'observed', siteActivated: tab.active === true } })
|
|
138
|
-
} catch {
|
|
139
|
-
this.emit({ type: 'event', method: 'target.popup', params: { tabId: tab.id, containment: 'unavailable' } })
|
|
140
|
-
} finally { this.containing.delete(tab.id) }
|
|
141
|
-
}
|
|
142
|
-
async event(source, method, params = {}) {
|
|
143
|
-
const lease = this.tabLeases.get(source.tabId)
|
|
144
|
-
if (!lease) return
|
|
145
|
-
if (method === 'Page.javascriptDialogOpening') {
|
|
146
|
-
try {
|
|
147
|
-
await this.api.debugger.sendCommand(source, 'Page.handleJavaScriptDialog', { accept: false })
|
|
148
|
-
lease.notices.push(`Quiet mode dismissed JavaScript ${params.type ?? 'dialog'}: ${String(params.message ?? '').slice(0, EXTENSION_LIMITS.dialogPreview)}`)
|
|
149
|
-
} catch {
|
|
150
|
-
const msg = 'Quiet mode could not dismiss a JavaScript dialog; human action may be required.'
|
|
151
|
-
lease.notices.push(msg)
|
|
152
|
-
lease.blockingNotices.push(msg)
|
|
153
|
-
lease.blockingNotices = lease.blockingNotices.slice(-EXTENSION_LIMITS.notices)
|
|
154
|
-
}
|
|
155
|
-
lease.notices = lease.notices.slice(-EXTENSION_LIMITS.notices)
|
|
156
|
-
}
|
|
157
|
-
if (method === 'Page.fileChooserOpened') {
|
|
158
|
-
const msg = 'Quiet mode blocked a file chooser; file uploads are unavailable.'
|
|
159
|
-
lease.notices.push(msg)
|
|
160
|
-
lease.blockingNotices.push(msg)
|
|
161
|
-
lease.notices = lease.notices.slice(-EXTENSION_LIMITS.notices)
|
|
162
|
-
lease.blockingNotices = lease.blockingNotices.slice(-EXTENSION_LIMITS.notices)
|
|
163
|
-
}
|
|
164
|
-
if (method.startsWith('Network.')) {
|
|
165
|
-
params = JSON.parse(JSON.stringify(params))
|
|
166
|
-
for (const headers of [params.headers, params.request?.headers, params.response?.headers]) {
|
|
167
|
-
if (headers) for (const key of Object.keys(headers)) if (/^(authorization|proxy-authorization|cookie|set-cookie)$/i.test(key)) headers[key] = '[redacted]'
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
const event = { type: 'event', lease: lease.id, method, params, ...(source.sessionId ? { sessionId: source.sessionId } : {}) }
|
|
171
|
-
if (new TextEncoder().encode(JSON.stringify(event)).length <= EXTENSION_LIMITS.eventBytes) this.emit(event)
|
|
172
|
-
}
|
|
173
|
-
async attach(tabId, scope, view) {
|
|
174
|
-
if (!Number.isInteger(tabId) || tabId < 0 || !validScope(scope) || !validScope(view)) throw Error('invalid tab lease')
|
|
175
|
-
if (this.tabLeases.has(tabId) || this.attaching.has(tabId)) throw Error('tab is already leased; release it before adoption')
|
|
176
|
-
if (this.created.has(tabId) && this.created.get(tabId) !== scope) throw Error('tab belongs to another session')
|
|
177
|
-
this.attaching.add(tabId)
|
|
178
|
-
const generation = this.generation
|
|
179
|
-
try {
|
|
180
|
-
const tab = await this.api.tabs.get(tabId)
|
|
181
|
-
const url = tab.url || tab.pendingUrl || (this.created.get(tabId) === scope ? 'about:blank' : undefined)
|
|
182
|
-
if (tab.incognito || !allowedUrl(url) || !allowedUrl(tab.pendingUrl || url)) throw Error('restricted/internal, extension and incognito pages are unavailable')
|
|
183
|
-
const lease = { id: crypto.randomUUID(), tabId, scope, view, notices: [], blockingNotices: [] }
|
|
184
|
-
this.leases.set(lease.id, lease); this.tabLeases.set(tabId, lease)
|
|
185
|
-
try {
|
|
186
|
-
await this.activate(lease)
|
|
187
|
-
if (generation !== this.generation || !this.leases.has(lease.id)) throw Error('connection released')
|
|
188
|
-
return { lease: lease.id, tabId, url, title: tab.title ?? '', created: this.created.get(tabId) === scope }
|
|
189
|
-
} catch {
|
|
190
|
-
this.leases.delete(lease.id); this.tabLeases.delete(tabId)
|
|
191
|
-
if (this.active === tabId) await this.suspend()
|
|
192
|
-
throw Error('quiet-mode interception is unavailable on this browser/tab; no control lease was granted')
|
|
193
|
-
}
|
|
194
|
-
} finally { this.attaching.delete(tabId) }
|
|
195
|
-
}
|
|
196
|
-
request(operation) {
|
|
197
|
-
const generation = this.generation
|
|
198
|
-
return this.enqueue(async () => {
|
|
199
|
-
if (generation !== this.generation) throw Error('connection released')
|
|
200
|
-
try { return await this.perform(operation) }
|
|
201
|
-
finally {
|
|
202
|
-
if (this.active !== undefined) {
|
|
203
|
-
this.idleAt = Date.now() + DEBUGGER_IDLE_TIMEOUT_MS
|
|
204
|
-
await this.api.alarms?.create(DEBUGGER_IDLE_ALARM, { when: this.idleAt })
|
|
205
|
-
}
|
|
206
|
-
await this.persist()
|
|
207
|
-
}
|
|
208
|
-
})
|
|
209
|
-
}
|
|
210
|
-
async perform(operation) {
|
|
211
|
-
if (!operation || typeof operation !== 'object' || !validScope(operation.scope)) throw Error('a scoped operation is required')
|
|
212
|
-
const { kind, scope } = operation
|
|
213
|
-
if (kind === 'create') {
|
|
214
|
-
if (!validScope(operation.view)) throw Error('view identity is required')
|
|
215
|
-
const generation = this.generation
|
|
216
|
-
const windows = await this.api.windows.getAll({ windowTypes: ['normal'] })
|
|
217
|
-
const window = windows.find(value => !value.incognito && Number.isInteger(value.id))
|
|
218
|
-
if (!window) throw Error('open a normal browser window first; quiet mode never creates a window')
|
|
219
|
-
const tab = await this.api.tabs.create({ windowId: window.id, active: false, url: 'about:blank' })
|
|
220
|
-
this.created.set(tab.id, scope)
|
|
221
|
-
if (generation !== this.generation) throw Error('connection released during creation; inactive tab was left open')
|
|
222
|
-
try { return await this.attach(tab.id, scope, operation.view) }
|
|
223
|
-
catch (error) { throw Error(`${error.message}; the inactive agent tab was left open (id ${tab.id})`) }
|
|
224
|
-
}
|
|
225
|
-
if (kind === 'list') {
|
|
226
|
-
const tabs = await this.api.tabs.query({})
|
|
227
|
-
return tabs.filter(tab => !tab.incognito && allowedUrl(tab.url) && !this.tabLeases.has(tab.id) && (!this.created.has(tab.id) || this.created.get(tab.id) === scope))
|
|
228
|
-
.slice(0, 256).map(tab => ({ tabId: tab.id, title: tab.title ?? '', url: tab.url, created: this.created.get(tab.id) === scope }))
|
|
229
|
-
}
|
|
230
|
-
if (kind === 'attach') return this.attach(operation.tabId, scope, operation.view)
|
|
231
|
-
if (kind === 'close') {
|
|
232
|
-
if (!Number.isInteger(operation.tabId) || this.created.get(operation.tabId) !== scope) throw Error('personal, adopted or other-session tabs are detach-only')
|
|
233
|
-
if (this.active === operation.tabId) await this.suspend()
|
|
234
|
-
await this.api.tabs.remove(operation.tabId)
|
|
235
|
-
const lease = this.tabLeases.get(operation.tabId)
|
|
236
|
-
if (lease) this.leases.delete(lease.id)
|
|
237
|
-
this.tabLeases.delete(operation.tabId)
|
|
238
|
-
this.created.delete(operation.tabId)
|
|
239
|
-
return {}
|
|
240
|
-
}
|
|
241
|
-
const lease = this.leases.get(operation.lease)
|
|
242
|
-
if (kind === 'detach' && !lease) return {}
|
|
243
|
-
if (!lease || lease.scope !== scope || lease.view !== operation.view) throw Error('stale or foreign tab lease; explicitly reacquire the tab')
|
|
244
|
-
if (kind === 'detach') {
|
|
245
|
-
this.leases.delete(lease.id); this.tabLeases.delete(lease.tabId)
|
|
246
|
-
if (this.active === lease.tabId) await this.suspend()
|
|
247
|
-
return {}
|
|
248
|
-
}
|
|
249
|
-
if (kind === 'events') return lease.notices.splice(0)
|
|
250
|
-
if (kind !== 'cdp') throw Error('unsupported extension operation')
|
|
251
|
-
if (lease.blockingNotices?.length) throw Error(lease.blockingNotices.shift())
|
|
252
|
-
let { method, params = {}, sessionId } = operation
|
|
253
|
-
if (typeof method !== 'string' || !DOMAINS.has(method.split('.')[0]) || DENIED.has(method)
|
|
254
|
-
|| /Cookies|Cookie/.test(method) || method.startsWith('Input.') && !method.startsWith('Input.dispatch') && method !== 'Input.insertText'
|
|
255
|
-
|| sessionId !== undefined && (typeof sessionId !== 'string' || sessionId.length > 128)
|
|
256
|
-
|| !params || typeof params !== 'object' || Array.isArray(params)) throw Error('CDP capability is unavailable in personal-browser quiet mode')
|
|
257
|
-
if (method === 'Page.navigate' && !allowedUrl(params.url)) throw Error('navigation requires an http(s) URL')
|
|
258
|
-
await this.activate(lease)
|
|
259
|
-
if (!this.leases.has(lease.id)) throw Error('tab detached during request')
|
|
260
|
-
if (method === 'Input.insertText') {
|
|
261
|
-
for (const text of String(params.text ?? '')) {
|
|
262
|
-
await this.api.debugger.sendCommand({ tabId: lease.tabId, ...(sessionId ? { sessionId } : {}) }, 'Input.dispatchKeyEvent', { type: 'char', text })
|
|
263
|
-
}
|
|
264
|
-
return {}
|
|
265
|
-
}
|
|
266
|
-
if (method === 'Page.captureScreenshot') {
|
|
267
|
-
if (!params.clip) {
|
|
268
|
-
const metrics = await this.api.debugger.sendCommand({ tabId: lease.tabId, ...(sessionId ? { sessionId } : {}) }, 'Page.getLayoutMetrics', {})
|
|
269
|
-
const viewport = metrics.cssVisualViewport ?? metrics.visualViewport
|
|
270
|
-
const width = viewport?.clientWidth ?? EXTENSION_LIMITS.screenshotWidth, height = viewport?.clientHeight ?? EXTENSION_LIMITS.screenshotHeight
|
|
271
|
-
params = { ...params, clip: { x: viewport?.pageX ?? 0, y: viewport?.pageY ?? 0, width, height, scale: Math.min(1, EXTENSION_LIMITS.screenshotWidth / width, EXTENSION_LIMITS.screenshotHeight / height) } }
|
|
272
|
-
}
|
|
273
|
-
if (params.captureBeyondViewport === true || params.fromSurface === false || params.clip && (
|
|
274
|
-
!Number.isFinite(params.clip.width) || !Number.isFinite(params.clip.height) || !Number.isFinite(params.clip.scale)
|
|
275
|
-
|| params.clip.width <= 0 || params.clip.height <= 0 || !Number.isFinite(params.clip.x) || !Number.isFinite(params.clip.y)
|
|
276
|
-
|| params.clip.width * params.clip.scale > EXTENSION_LIMITS.screenshotWidth || params.clip.height * params.clip.scale > EXTENSION_LIMITS.screenshotHeight || params.clip.scale <= 0)) throw Error('screenshot exceeds quiet-mode dimensions')
|
|
277
|
-
params = { ...params, fromSurface: true, captureBeyondViewport: false }
|
|
278
|
-
}
|
|
279
|
-
return this.api.debugger.sendCommand({ tabId: lease.tabId, ...(sessionId ? { sessionId } : {}) }, method, params)
|
|
280
|
-
}
|
|
281
|
-
release() {
|
|
282
|
-
this.generation++
|
|
283
|
-
const interrupt = this.ready.then(() => this.suspend())
|
|
284
|
-
interrupt.catch(() => {})
|
|
285
|
-
return this.enqueue(async () => {
|
|
286
|
-
await interrupt.catch(() => {})
|
|
287
|
-
await this.suspend()
|
|
288
|
-
this.related.clear()
|
|
289
|
-
this.leases.clear(); this.tabLeases.clear()
|
|
290
|
-
await this.persist()
|
|
291
|
-
})
|
|
292
|
-
}
|
|
293
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export const en = {
|
|
2
|
-
title: 'DSH Browser Bridge status',
|
|
3
|
-
heading: 'DSH Browser Bridge',
|
|
4
|
-
consent: 'This explicitly grants DSH control of tabs in this browser profile. Browser debugging warnings remain visible. No extension popup or automatic window activation is used.',
|
|
5
|
-
automatic: 'DSH registers the native host automatically. This extension connects automatically; no token or configuration is needed.',
|
|
6
|
-
disconnect: 'Disconnect',
|
|
7
|
-
pause: 'Disconnect leaves all tabs open and pauses reconnects. Remove and add the extension again to resume. The native-host --revoke command disables access persistently, including across plugin restarts.',
|
|
8
|
-
quiet: 'Quiet-mode limits: the normal debugger infobar cannot be hidden; browser/OS permission prompts, website-initiated downloads and page-created windows cannot be guaranteed invisible. File choosers are intercepted on attached tabs. Never use this mode when absolutely no browser-owned UI is acceptable.',
|
|
9
|
-
identity: 'Extension ID: {id}',
|
|
10
|
-
accepted: 'Request accepted. Refreshing connection status…',
|
|
11
|
-
unavailable: 'Extension worker unavailable.',
|
|
12
|
-
disconnected: 'Native host is disconnected.',
|
|
13
|
-
reconnect: 'Native host disconnected or is not installed. Reconnect after installing.',
|
|
14
|
-
debuggerCanceled: 'Debugging was canceled. The detached tab requires an explicit new request to reacquire it.',
|
|
15
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"manifest_version": 3,
|
|
3
|
-
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1hDzFuWdQi+Tu5v9275Mqd8Ql6F/Kgl72RyLiX6hTh1/TU89i/0pX5DK9L6NFZAuTTrAXWaP86gKJO/XUvDr+cTI0fJ4lpKn6EGTK75/r1g2m23LGPgNQZRwVM6xnx4t5qaKvgrW7F+E7xUwtO6NkzDNsh3Lw6piDzVuN8MhWxAkwCKxQ3S4PFQA4U/yD+knEq6rQk/7MILe+rrZ1SgMOMuxm01I0Dgbkowvu/LHRkQnrNTMAhQW0VRjb8c1947HTwc5t4inN4fIFY3Vl8RMZSH4FbaSir7CwZZrpC8yjSlnRuGHDBXXnVSWe6Qw/ZhNGQqdgXH+vuiqrMYTyQFUEwIDAQAB",
|
|
4
|
-
"name": "DSH Browser Bridge",
|
|
5
|
-
"version": "0.1.0",
|
|
6
|
-
"description": "Explicitly pair DSH with this Edge or Chrome profile. Browser debugging warnings remain visible.",
|
|
7
|
-
"minimum_chrome_version": "125",
|
|
8
|
-
"permissions": ["debugger", "tabs", "storage", "nativeMessaging", "alarms"],
|
|
9
|
-
"background": { "service_worker": "worker.mjs", "type": "module" },
|
|
10
|
-
"options_page": "options.html",
|
|
11
|
-
"incognito": "not_allowed"
|
|
12
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title data-message="title"></title></head>
|
|
4
|
-
<body>
|
|
5
|
-
<h1 data-message="heading"></h1>
|
|
6
|
-
<p data-message="consent"></p>
|
|
7
|
-
<p data-message="automatic"></p>
|
|
8
|
-
<p id="identity"></p><pre id="status" role="status"></pre>
|
|
9
|
-
<p><button id="disconnect" type="button" data-message="disconnect"></button></p>
|
|
10
|
-
<p data-message="pause"></p>
|
|
11
|
-
<p data-message="quiet"></p>
|
|
12
|
-
<script type="module" src="options.mjs"></script>
|
|
13
|
-
</body>
|
|
14
|
-
</html>
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { en } from './locales.mjs'
|
|
2
|
-
|
|
3
|
-
for (const element of document.querySelectorAll('[data-message]')) element.textContent = en[element.dataset.message]
|
|
4
|
-
const status = document.getElementById('status')
|
|
5
|
-
document.getElementById('identity').textContent = en.identity.replace('{id}', chrome.runtime.id)
|
|
6
|
-
const show = value => { status.textContent = value.error ?? value.detail ?? (value.ok ? en.accepted : JSON.stringify(value)) }
|
|
7
|
-
async function request(message) { try { show(await chrome.runtime.sendMessage(message)) } catch { show({ error: en.unavailable }) } }
|
|
8
|
-
document.getElementById('disconnect').addEventListener('click', () => { void request({ type: 'disconnect' }) })
|
|
9
|
-
void request({ type: 'status' })
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export const permissionGuard = `(()=>{
|
|
2
|
-
const denied=()=>Promise.reject(new DOMException('Permission request denied in DSH agent tab','NotAllowedError'));
|
|
3
|
-
const replace=(object,key,value)=>{try{if(object&&typeof object[key]==='function')Object.defineProperty(object,key,{value,configurable:true,writable:true})}catch{}};
|
|
4
|
-
replace(globalThis.Notification,'requestPermission',callback=>{if(typeof callback==='function')queueMicrotask(()=>callback('denied'));return Promise.resolve('denied')});
|
|
5
|
-
for(const [object,keys] of [
|
|
6
|
-
[navigator.mediaDevices,['getUserMedia','getDisplayMedia']],
|
|
7
|
-
[navigator.clipboard,['read','readText','write','writeText']],
|
|
8
|
-
[navigator.bluetooth,['requestDevice']], [navigator.usb,['requestDevice']],
|
|
9
|
-
[navigator.hid,['requestDevice']], [navigator.serial,['requestPort']],
|
|
10
|
-
[globalThis,['showOpenFilePicker','showSaveFilePicker','showDirectoryPicker']]
|
|
11
|
-
])for(const key of keys)replace(object,key,denied);
|
|
12
|
-
for(const key of ['getCurrentPosition','watchPosition'])replace(navigator.geolocation,key,(_success,error)=>{if(typeof error==='function')queueMicrotask(()=>error({code:1,message:'Permission denied in DSH agent tab',PERMISSION_DENIED:1}));return -1});
|
|
13
|
-
})()`
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { nativeHostName, MAX_MESSAGE, CHUNK_BYTES, MAX_IN_FLIGHT, MAX_ERROR_LENGTH, RECONNECT_ALARM, RECONNECT_DELAY_MINUTES } from './constants.mjs'
|
|
2
|
-
import { ExtensionController } from './controller.mjs'
|
|
3
|
-
import { en } from './locales.mjs'
|
|
4
|
-
|
|
5
|
-
const browser = /Edg\//.test(navigator.userAgent) ? 'edge' : 'chrome'
|
|
6
|
-
let port, connecting, inFlight = 0, reconnectAllowed = true
|
|
7
|
-
let status = { state: 'extension-missing', detail: en.disconnected }
|
|
8
|
-
const controller = new ExtensionController(chrome, event => { try { port?.postMessage(event) } catch {} })
|
|
9
|
-
|
|
10
|
-
async function connect() {
|
|
11
|
-
if (port) return
|
|
12
|
-
connecting ??= (async () => {
|
|
13
|
-
await controller.ready
|
|
14
|
-
const stored = await chrome.storage.local.get('installId')
|
|
15
|
-
const installId = stored.installId ?? crypto.randomUUID()
|
|
16
|
-
if (!stored.installId) await chrome.storage.local.set({ installId })
|
|
17
|
-
const native = chrome.runtime.connectNative(nativeHostName(browser))
|
|
18
|
-
port = native
|
|
19
|
-
native.onMessage.addListener(message => {
|
|
20
|
-
if (native !== port) return
|
|
21
|
-
if (message.type === 'status') status = { state: message.state, detail: message.detail }
|
|
22
|
-
else if (message.type === 'release') void controller.release().catch(() => {})
|
|
23
|
-
else if (message.type === 'request') {
|
|
24
|
-
if (inFlight >= MAX_IN_FLIGHT) { native.postMessage({ type: 'result', id: message.id, error: 'extension concurrency limit' }); return }
|
|
25
|
-
inFlight++
|
|
26
|
-
void controller.request(message.operation).then(
|
|
27
|
-
value => respond(native, { type: 'result', id: message.id, value }),
|
|
28
|
-
error => respond(native, { type: 'result', id: message.id, error: String(error.message ?? error).slice(0, MAX_ERROR_LENGTH) }),
|
|
29
|
-
).catch(() => native.disconnect()).finally(() => { inFlight-- })
|
|
30
|
-
}
|
|
31
|
-
})
|
|
32
|
-
native.onDisconnect.addListener(() => {
|
|
33
|
-
void chrome.runtime.lastError
|
|
34
|
-
if (native !== port) return
|
|
35
|
-
port = undefined
|
|
36
|
-
status = { state: 'extension-missing', detail: en.reconnect }
|
|
37
|
-
void controller.release().catch(() => {})
|
|
38
|
-
if (reconnectAllowed) void chrome.alarms.create(RECONNECT_ALARM, { delayInMinutes: RECONNECT_DELAY_MINUTES })
|
|
39
|
-
})
|
|
40
|
-
native.postMessage({ type: 'hello', installId, browser })
|
|
41
|
-
})().finally(() => { connecting = undefined })
|
|
42
|
-
return connecting
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function respond(native, value) {
|
|
46
|
-
if (native !== port) return
|
|
47
|
-
let text = JSON.stringify(value)
|
|
48
|
-
if (new TextEncoder().encode(text).length > MAX_MESSAGE) text = JSON.stringify({ type: 'result', id: value.id, error: 'extension response exceeds 8 MiB limit' })
|
|
49
|
-
const total = Math.ceil(text.length / CHUNK_BYTES)
|
|
50
|
-
for (let index = 0; index < total; index++) native.postMessage({ type: 'chunk', id: value.id, index, total, data: text.slice(index * CHUNK_BYTES, (index + 1) * CHUNK_BYTES) })
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
chrome.runtime.onMessage.addListener((message, sender, reply) => {
|
|
54
|
-
if (sender.id !== chrome.runtime.id || sender.url !== chrome.runtime.getURL('options.html')) return false
|
|
55
|
-
void (async () => {
|
|
56
|
-
if (message.type === 'status') return { ...status, browser, extensionId: chrome.runtime.id }
|
|
57
|
-
if (message.type === 'disconnect') {
|
|
58
|
-
reconnectAllowed = false; await chrome.storage.local.set({ paused: true }); await chrome.alarms.clear(RECONNECT_ALARM)
|
|
59
|
-
port?.disconnect(); return { ok: true }
|
|
60
|
-
}
|
|
61
|
-
throw Error('unsupported options request')
|
|
62
|
-
})().then(reply, error => reply({ ok: false, error: String(error.message ?? error) }))
|
|
63
|
-
return true
|
|
64
|
-
})
|
|
65
|
-
chrome.debugger.onDetach.addListener((_source, reason) => {
|
|
66
|
-
if (reason === 'canceled_by_user') {
|
|
67
|
-
status = { ...status, detail: en.debuggerCanceled }
|
|
68
|
-
}
|
|
69
|
-
})
|
|
70
|
-
chrome.alarms.onAlarm.addListener(alarm => { if (alarm.name === RECONNECT_ALARM && reconnectAllowed) void connect().catch(() => {}) })
|
|
71
|
-
const autoConnect = () => chrome.storage.local.get('paused').then(({ paused }) => { reconnectAllowed = !paused; if (reconnectAllowed) return connect() }).catch(() => {})
|
|
72
|
-
chrome.runtime.onInstalled.addListener(() => { void autoConnect() })
|
|
73
|
-
chrome.runtime.onStartup.addListener(() => { void autoConnect() })
|
|
74
|
-
void autoConnect()
|