dsh-builtin-browser 1.0.1 → 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 +55 -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/tool-reference.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 -44
- 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 +15 -53
- 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-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 -1299
- 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/paths.ts +0 -25
- package/src/browser-electron/preferred-browser.ts +0 -120
- package/src/browser-electron/preview-route.ts +0 -218
- package/src/browser-electron/process-ownership.ts +0 -168
- package/src/browser-electron/process.ts +0 -23
- package/src/browser-electron/profile-checkpoint.ts +0 -187
- package/src/browser-electron/profile-command.ts +0 -46
- package/src/browser-electron/profile-extension.ts +0 -124
- package/src/browser-electron/profile-lease.ts +0 -115
- package/src/browser-electron/profile-residue.ts +0 -49
- package/src/browser-electron/provider.ts +0 -4571
- package/src/browser-electron/reference-route.ts +0 -608
- package/src/browser-electron/remote-host.ts +0 -1462
- package/src/browser-electron/rpc-input.ts +0 -13
- package/src/browser-electron/rpc-ops.ts +0 -41
- package/src/browser-electron/runtime-diagnostics.ts +0 -38
- package/src/browser-electron/runtime-route.ts +0 -105
- package/src/browser-electron/runtime-status.ts +0 -242
- package/src/browser-electron/settings-route.ts +0 -64
- package/src/browser-electron/settings-store.ts +0 -589
- package/src/browser-electron/shortcuts-route.ts +0 -112
- package/src/browser-electron/sidebar-only-host.ts +0 -298
- package/src/browser-electron/startpage-shortcuts.ts +0 -213
- package/src/browser-electron/system-browser.ts +0 -1497
- package/src/browser-electron/timing.ts +0 -16
- package/src/browser-electron/virtual-cursor.ts +0 -152
- package/src/browser-electron/windows-system.ts +0 -24
- package/src/browser-reference/delivery.ts +0 -384
- package/src/browser-reference/entry.ts +0 -631
- package/src/browser-reference/export.ts +0 -339
- package/src/browser-reference/import.ts +0 -303
- package/src/browser-reference/page-script.ts +0 -1537
- package/src/browser-reference/service.ts +0 -1315
- package/src/browser-reference/store.ts +0 -172
- package/src/browser-reference/submission-receipts.ts +0 -122
- package/src/browser-reference/text-quote.ts +0 -219
- package/src/browser-reference/types.ts +0 -195
- package/src/browser-reference/visible.ts +0 -367
- package/src/browser-reference/web-sources.ts +0 -103
- package/src/client/browser/BrowserController.ts +0 -693
- package/src/client/browser/BrowserFrame.ts +0 -78
- package/src/client/browser/BrowserNavigation.ts +0 -169
- package/src/client/browser/BrowserPage.ts +0 -23
- package/src/client/browser/BrowserPersistence.ts +0 -44
- package/src/client/browser/IframeImpl.ts +0 -176
- package/src/client/browser/child-tabs.ts +0 -14
- package/src/client/browser/iframe-reference.ts +0 -67
- package/src/client/browser/initialization.ts +0 -262
- package/src/client/browser/omnibox.ts +0 -243
- package/src/client/browser/store.ts +0 -38
- package/src/client/browser/takeover-channel.ts +0 -72
- package/src/client/browser/url.ts +0 -46
- package/src/client/browser/web-reference-source.ts +0 -52
- package/src/client/css-modules.d.ts +0 -4
- package/src/client/definition.tsx +0 -30
- package/src/client/electron/ElectronWebViewImpl.ts +0 -364
- package/src/client/electron/ElectronWebviewPresentation.ts +0 -138
- package/src/client/electron/NativeChildPresentation.ts +0 -45
- package/src/client/electron/NativeViewPage.ts +0 -251
- package/src/client/electron/pages.ts +0 -23
- package/src/client/electron/reference-overlay.ts +0 -53
- package/src/client/electron/workspace.ts +0 -33
- package/src/client/index.ts +0 -293
- package/src/client/locales.ts +0 -857
- package/src/client/pages.ts +0 -28
- package/src/client/reference/client/BrowserRefLink.tsx +0 -142
- package/src/client/reference/client/draft-reference.ts +0 -167
- package/src/client/reference/client/index.ts +0 -7
- package/src/client/reference/client/ordered-submission.ts +0 -108
- package/src/client/reference/client/pending-delivery.ts +0 -216
- package/src/client/reference/client/plugin.ts +0 -189
- package/src/client/reference/client/production/ReferenceCapsules.tsx +0 -345
- package/src/client/reference/client/production/ReferenceDock.module.css +0 -193
- package/src/client/reference/client/production/ReferenceDock.tsx +0 -6
- package/src/client/reference/client/production/ReferenceFeedback.tsx +0 -15
- package/src/client/reference/client/production/ReferenceMath.tsx +0 -44
- package/src/client/reference/client/production/ReferenceText.tsx +0 -36
- package/src/client/reference/client/production/assembly.ts +0 -471
- package/src/client/reference/client/production/asset-store.ts +0 -144
- package/src/client/reference/client/production/availability.ts +0 -74
- package/src/client/reference/client/production/bytes.ts +0 -36
- package/src/client/reference/client/production/delivery-client.ts +0 -211
- package/src/client/reference/client/production/draft-adapter.ts +0 -508
- package/src/client/reference/client/production/http-transport.ts +0 -217
- package/src/client/reference/client/production/production-submission.ts +0 -310
- package/src/client/reference/client/production/protocol.ts +0 -231
- package/src/client/reference/client/production/reference-card.ts +0 -240
- package/src/client/reference/client/production/reference-labels.ts +0 -29
- package/src/client/reference/client/production/reply-link-bridge.ts +0 -222
- package/src/client/reference/client/production/reveal.ts +0 -215
- package/src/client/reference/client/production/runtime.ts +0 -1101
- package/src/client/reference/client/production/snapshot-adapter.ts +0 -154
- package/src/client/reference/client/production/source-marker.ts +0 -63
- package/src/client/reference/client/production/source-opener.ts +0 -55
- package/src/client/reference/client/production/styles.ts +0 -104
- package/src/client/reference/client/production/user-text-rule.ts +0 -58
- package/src/client/reference/client/reveal.ts +0 -107
- package/src/client/reference/client/scheme.ts +0 -114
- package/src/client/reference/client/types.ts +0 -168
- package/src/client/reference/css-modules.d.ts +0 -4
- package/src/client/reference/index.ts +0 -11
- package/src/client/reference-capture-owner.ts +0 -162
- package/src/client/reference-intents.ts +0 -36
- package/src/client/settings/index.ts +0 -34
- package/src/client/settings/panel.ts +0 -2657
- package/src/client/shortcut-open.ts +0 -30
- package/src/client/startpage/binding.ts +0 -99
- package/src/client/startpage/controller.ts +0 -303
- package/src/client/startpage/model.ts +0 -279
- package/src/client/view/Browser.module.css +0 -751
- package/src/client/view/BrowserBody.tsx +0 -314
- package/src/client/view/BrowserPresentation.ts +0 -9
- package/src/client/view/BrowserTitle.tsx +0 -17
- package/src/client/view/IframePresentation.ts +0 -344
- package/src/client/view/StartPage.tsx +0 -597
- package/src/client/view/TakeoverBanner.tsx +0 -21
- package/src/index.ts +0 -110
- package/src/reference-owner.ts +0 -5
- package/src/reference-page.ts +0 -9
- package/src/reference-source.ts +0 -3
- package/src/reference-text.ts +0 -197
- package/src/startpage-settings.ts +0 -103
- package/src/startpage.ts +0 -71
- package/src/takeover-protocol.ts +0 -19
- package/src/tool-browser/code-tool.ts +0 -401
- package/src/tool-browser/code-worker.ts +0 -639
- package/src/tool-browser/element-fields.ts +0 -167
- package/src/tool-browser/index.ts +0 -3733
- package/src/tool-browser/page-probe.ts +0 -474
- package/src/tool-browser/panel-page.ts +0 -124
- package/src/tool-browser/screenshot-image.ts +0 -49
- package/src/tool-browser/takeover.ts +0 -198
- package/src/types/electron-shim.d.ts +0 -144
- package/src/types.ts +0 -85
- package/src/web-guest.ts +0 -34
- package/tools/accept-desktop.mjs +0 -148
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { BrowserError } from '../browser/types.js';
|
|
3
|
+
import { browserSessionHandle, resolveSessionHandle, resolveTabHandle, sessionWireId, tabWireId } from '../browser/handles.js';
|
|
4
|
+
import { ProviderCore } from './provider-core.js';
|
|
5
|
+
export class ProviderTabs extends ProviderCore {
|
|
6
|
+
/**
|
|
7
|
+
* Bind the page the human has open in this conversation's sidebar into a session.
|
|
8
|
+
*
|
|
9
|
+
* Why this is the whole entry: the sidebar page is the shell's, opened by a person
|
|
10
|
+
* through the address bar, so no session of ours names it and nothing injects the
|
|
11
|
+
* selection bar into it. The shell DOES expose the panel's pages by conversation id
|
|
12
|
+
* (`listPages`), and can hand one over (`adoptPage`) — the same pair the tools use
|
|
13
|
+
* for `dsh_browser_list_tabs`. Doing it on a timer means the bar appears on a page
|
|
14
|
+
* the human opened themselves, which is the only entry they actually take.
|
|
15
|
+
*
|
|
16
|
+
* Rescans are spaced by one idle tick, not five: the listing crosses the
|
|
17
|
+
* bridge, and a page the human just opened must get its entry within a
|
|
18
|
+
* couple of seconds rather than five.
|
|
19
|
+
*/
|
|
20
|
+
async adoptSidebarPageForReference() {
|
|
21
|
+
const configured = this.config.referenceLabel;
|
|
22
|
+
const label = typeof configured === 'function' ? configured() : configured;
|
|
23
|
+
this.referenceScan.label = label;
|
|
24
|
+
if (label === undefined || label === '')
|
|
25
|
+
return;
|
|
26
|
+
if (this.host.listPages === undefined || this.host.adoptPage === undefined) {
|
|
27
|
+
this.referenceScan.lastError = 'this carrier cannot list or adopt a page it did not open';
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (this.referenceScanCountdown > 0) {
|
|
31
|
+
this.referenceScanCountdown -= 1;
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
// One idle tick between scans: a page the human opens must get its entry
|
|
35
|
+
// within a couple of seconds (measured: the shell creates the guest, then
|
|
36
|
+
// the next scan adopts it). The listing is a local bridge call, not a
|
|
37
|
+
// network request, so this is cheap.
|
|
38
|
+
this.referenceScanCountdown = 1;
|
|
39
|
+
let session = this.referenceSession === undefined ? undefined : this.sessions.get(this.referenceSession);
|
|
40
|
+
if (session?.label !== label)
|
|
41
|
+
session = undefined;
|
|
42
|
+
const candidate = session ?? {
|
|
43
|
+
id: sessionWireId(browserSessionHandle(label, randomUUID())), label,
|
|
44
|
+
tabs: [], activeIndex: 0, history: [], nextSeq: 1,
|
|
45
|
+
};
|
|
46
|
+
let pages;
|
|
47
|
+
try {
|
|
48
|
+
// `requireRunning` is what keeps a scan from launching the human's
|
|
49
|
+
// installed browser: only a carrier that is already up can have pages.
|
|
50
|
+
pages = await this.host.listPages(this.carrierScope(candidate), { requireRunning: true });
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
this.referenceScan.lastError = error instanceof Error ? error.message : String(error);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
this.referenceScan.pages = pages.length;
|
|
57
|
+
const live = pages.filter(candidate => /^https?:\/\//iu.test(candidate.url));
|
|
58
|
+
// NOT pruned. The host's listing already EXCLUDES the pages this process
|
|
59
|
+
// adopted (that exclusion is what keeps `listTabs` from reporting one page
|
|
60
|
+
// twice), so "absent from the listing" means "already adopted" as often as
|
|
61
|
+
// it means "closed". Dropping those tabs would lose the bar on every page
|
|
62
|
+
// the human switches away from and re-adopt it under a new handle on the
|
|
63
|
+
// way back. A closed page's handle simply stops answering, and the pump
|
|
64
|
+
// already skips a tab it cannot evaluate.
|
|
65
|
+
if (live.length === 0) {
|
|
66
|
+
this.referenceScan.lastError = 'no http page is open in this conversation\'s sidebar';
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
let refused;
|
|
70
|
+
for (const page of live) {
|
|
71
|
+
const tabId = this.carrierTab(candidate, page.id);
|
|
72
|
+
const existing = session?.tabs.find(tab => tab.id === tabId);
|
|
73
|
+
if (existing !== undefined) {
|
|
74
|
+
// A navigation changes the URL of a page we already hold.
|
|
75
|
+
if (existing.url !== page.url)
|
|
76
|
+
existing.url = page.url;
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
try {
|
|
80
|
+
// The owner is passed so the adopted view is released with THIS
|
|
81
|
+
// conversation and not swept up by, or lost to, another one.
|
|
82
|
+
const handle = await this.host.adoptPage(this.carrierTab(candidate, page.id), this.carrierScope(candidate));
|
|
83
|
+
if (session === undefined) {
|
|
84
|
+
session = candidate;
|
|
85
|
+
this.sessions.set(session.id, session);
|
|
86
|
+
this.referenceSession = session.id;
|
|
87
|
+
}
|
|
88
|
+
// Append only: discovery must never switch the page the human is
|
|
89
|
+
// looking at, nor open a tab they did not ask for.
|
|
90
|
+
session.tabs.push({ id: tabId, handle, url: page.url });
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
refused = error instanceof Error ? error.message : String(error);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (session !== undefined) {
|
|
97
|
+
session.activeIndex = Math.min(session.activeIndex, Math.max(0, session.tabs.length - 1));
|
|
98
|
+
}
|
|
99
|
+
this.referenceScan.lastError = session === undefined
|
|
100
|
+
? refused ?? 'no page could be adopted'
|
|
101
|
+
: refused;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Bind the carrier page that already shows this URL, if there is one.
|
|
105
|
+
*
|
|
106
|
+
* Compare the part of a URL that says WHICH page it is: scheme, host, path and query. A hash is a
|
|
107
|
+
* position inside a document, and a trailing slash is spelling, so neither makes a different page.
|
|
108
|
+
* @param s - the session to bind the page into.
|
|
109
|
+
* @param url - the URL being opened.
|
|
110
|
+
* @returns whether an existing page was taken over.
|
|
111
|
+
*/
|
|
112
|
+
async adoptMatchingPage(s, url, target, navigation, signal) {
|
|
113
|
+
if (this.host.adoptPage === undefined || this.host.listPages === undefined)
|
|
114
|
+
return false;
|
|
115
|
+
const wanted = this.comparableUrl(url);
|
|
116
|
+
if (wanted === undefined)
|
|
117
|
+
return false;
|
|
118
|
+
let pages;
|
|
119
|
+
try {
|
|
120
|
+
pages = await this.host.listPages(this.carrierScope(s));
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
// A listing must not turn "nothing to reuse" into "open failed".
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
this.checkNavigation(target, navigation);
|
|
127
|
+
const match = pages.find(page => this.comparableUrl(page.url) === wanted);
|
|
128
|
+
if (match === undefined)
|
|
129
|
+
return false;
|
|
130
|
+
let handle;
|
|
131
|
+
try {
|
|
132
|
+
handle = await this.host.adoptPage(this.carrierTab(s, match.id), this.carrierScope(s));
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
// The page went away between listing and adopting: fall through to an ordinary navigation.
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
if (target.navigation !== navigation) {
|
|
139
|
+
this.host.destroyView(handle, { keepPage: true });
|
|
140
|
+
this.checkNavigation(target, navigation);
|
|
141
|
+
}
|
|
142
|
+
const tab = { id: this.carrierTab(s, match.id), handle, url: match.url, navigation, navigationAbort: target.navigationAbort };
|
|
143
|
+
delete target.navigationAbort;
|
|
144
|
+
s.tabs.push(tab);
|
|
145
|
+
s.activeIndex = s.tabs.length - 1;
|
|
146
|
+
const document = await this.documentIdentity(handle, signal, () => { this.checkNavigation(tab, navigation); });
|
|
147
|
+
await this.settleDocument(handle, document, signal, { frameId: document.id, loaderId: document.loaderId }, () => { this.checkNavigation(tab, navigation); });
|
|
148
|
+
this.showActive(s, true);
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
/** The parts of a URL that decide identity, or undefined when it cannot be parsed. */
|
|
152
|
+
comparableUrl(url) {
|
|
153
|
+
if (url === '' || url === 'about:blank')
|
|
154
|
+
return undefined;
|
|
155
|
+
try {
|
|
156
|
+
const parsed = new URL(url);
|
|
157
|
+
return `${parsed.protocol}//${parsed.host}${parsed.pathname.replace(/\/+$/, '')}${parsed.search}`;
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
return undefined;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/** List the session's tabs with their titles. */
|
|
164
|
+
async listTabs(session) {
|
|
165
|
+
const s = this.session(session);
|
|
166
|
+
const result = [];
|
|
167
|
+
for (let i = 0; i < s.tabs.length; i++) {
|
|
168
|
+
const tab = s.tabs[i];
|
|
169
|
+
if (tab === undefined)
|
|
170
|
+
continue; // defensive: array can shift under concurrency
|
|
171
|
+
// A tab we know has never navigated is NOT probed: its view has committed no document, so
|
|
172
|
+
// the round trip can only answer nothing — and it is the round trip that costs. A tab that
|
|
173
|
+
// HAS navigated is re-read, because the page may have moved itself since; a read that fails
|
|
174
|
+
// keeps the last accepted URL rather than reporting the tab as blank.
|
|
175
|
+
const liveUrl = tab.failure !== undefined ? tab.url : tab.url === '' ? '' : await this.currentUrl(tab.handle).catch(() => tab.url);
|
|
176
|
+
if (liveUrl !== '')
|
|
177
|
+
tab.url = liveUrl;
|
|
178
|
+
result.push({
|
|
179
|
+
id: tab.id,
|
|
180
|
+
url: liveUrl,
|
|
181
|
+
active: i === s.activeIndex,
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
// Pages the CARRIER holds that this provider never created.
|
|
185
|
+
//
|
|
186
|
+
// A sidebar panel and an installed browser both open pages on their own: a click on a link
|
|
187
|
+
// that targets a new page, or any `window.open`, produces a page nothing tells us about.
|
|
188
|
+
// Reporting only our own tabs made those invisible to this tool and unclosable through
|
|
189
|
+
// `dsh_browser_close_tab`, so they accumulated for the life of the browser. Measured on the
|
|
190
|
+
// sidebar carrier: three clicks produced three webview guests while this listed one tab.
|
|
191
|
+
//
|
|
192
|
+
// Hosts exclude pages already attached to provider views.
|
|
193
|
+
const pages = await this.host.listPages?.(this.carrierScope(s)) ?? [];
|
|
194
|
+
for (const page of pages) {
|
|
195
|
+
// A page with no URL is a blank one the carrier opened for itself. Listing it would invite a
|
|
196
|
+
// caller to act on nothing, and the blank normalisation already closes those.
|
|
197
|
+
if (page.url === '' || page.url === 'about:blank')
|
|
198
|
+
continue;
|
|
199
|
+
result.push({ id: this.carrierTab(s, page.id), url: page.url, active: false });
|
|
200
|
+
}
|
|
201
|
+
return result;
|
|
202
|
+
}
|
|
203
|
+
/** Switch to a tab by id, making its view visible. */
|
|
204
|
+
async switchTab(session, tabId, options) {
|
|
205
|
+
const user = options?.user === true;
|
|
206
|
+
const s = this.session(session);
|
|
207
|
+
// A page the carrier owns. Before this, switching to one threw "not open in this session" —
|
|
208
|
+
// while `dsh_browser_list_tabs` was happily listing it, so the two tools disagreed and the
|
|
209
|
+
// page the human was looking at could not be reached (reported as a defect).
|
|
210
|
+
const carrierId = this.carrierId(s, tabId);
|
|
211
|
+
if (carrierId !== undefined) {
|
|
212
|
+
const existing = s.tabs.findIndex(tab => tab.id === tabId);
|
|
213
|
+
if (existing !== -1) {
|
|
214
|
+
await this.host.presentView?.(s.tabs[existing].handle, s.label, { quiet: this.isQuiet(), select: true, ...user ? { user } : {} });
|
|
215
|
+
s.activeIndex = existing;
|
|
216
|
+
this.showActive(s, true, user);
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
const id = carrierId;
|
|
220
|
+
if (this.host.adoptPage === undefined) {
|
|
221
|
+
throw new BrowserError('browser: this carrier cannot hand over a page it opened itself, so that page cannot be driven. '
|
|
222
|
+
+ 'Open the URL through dsh_browser_open instead — that creates a page this plugin owns.', 'BROWSER_TAB_NOT_FOUND');
|
|
223
|
+
}
|
|
224
|
+
const pages = await this.host.listPages?.(this.carrierScope(s)).catch(() => []) ?? [];
|
|
225
|
+
const page = pages.find(candidate => candidate.id === id);
|
|
226
|
+
const handle = await this.host.adoptPage(id, this.carrierScope(s));
|
|
227
|
+
try {
|
|
228
|
+
// An adopted guest already has a document. Marking it as our never-opened
|
|
229
|
+
// blank view makes the first snapshot/a11y return without reading it.
|
|
230
|
+
const url = page?.url || await this.currentUrl(handle);
|
|
231
|
+
if (url === '')
|
|
232
|
+
throw new BrowserError('browser: the adopted page did not report its document URL', 'BROWSER_TAB_NOT_FOUND');
|
|
233
|
+
const tab = { id: tabId, handle, url };
|
|
234
|
+
await this.host.presentView?.(handle, s.label, { quiet: this.isQuiet(), select: true, ...user ? { user } : {} });
|
|
235
|
+
s.tabs.push(tab);
|
|
236
|
+
s.activeIndex = s.tabs.length - 1;
|
|
237
|
+
this.showActive(s, true, user);
|
|
238
|
+
}
|
|
239
|
+
catch (error) {
|
|
240
|
+
this.host.destroyView(handle, { keepPage: true });
|
|
241
|
+
throw error;
|
|
242
|
+
}
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
const found = this.locateTab(session, tabId);
|
|
246
|
+
found.s.activeIndex = found.index;
|
|
247
|
+
this.showActive(found.s, true, user);
|
|
248
|
+
}
|
|
249
|
+
/** Close one tab; closing the active tab activates the next. */
|
|
250
|
+
async closeTab(session, tabId) {
|
|
251
|
+
const current = this.session(session);
|
|
252
|
+
const carrierId = this.carrierId(current, tabId);
|
|
253
|
+
// A page the carrier owns rather than a view we created. It was reported by `listTabs` under
|
|
254
|
+
// this prefix, so closing it here is what keeps the two tools consistent — a page that can be
|
|
255
|
+
// listed must be closable, or the listing reads as a contradiction.
|
|
256
|
+
if (carrierId !== undefined) {
|
|
257
|
+
const id = carrierId;
|
|
258
|
+
if (this.host.closePage === undefined) {
|
|
259
|
+
return Promise.reject(new BrowserError('browser: this carrier does not expose the pages it opens on its own, so that page cannot be closed', 'BROWSER_TAB_NOT_FOUND'));
|
|
260
|
+
}
|
|
261
|
+
await this.host.closePage(id, this.carrierScope(current));
|
|
262
|
+
if (!this.session(session).tabs.some(tab => tab.id === tabId))
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
const found = this.locateTab(session, tabId);
|
|
266
|
+
const s = found.s;
|
|
267
|
+
const index = found.index;
|
|
268
|
+
const removed = s.tabs[index];
|
|
269
|
+
if (removed !== undefined) {
|
|
270
|
+
s.tabs.splice(index, 1);
|
|
271
|
+
this.destroyTab(removed, { keepPage: carrierId !== undefined });
|
|
272
|
+
}
|
|
273
|
+
if (s.tabs.length === 0) {
|
|
274
|
+
// Session keeps one blank tab so it stays usable.
|
|
275
|
+
this.newTab(s);
|
|
276
|
+
}
|
|
277
|
+
else if (index < s.activeIndex) {
|
|
278
|
+
// Closing a tab before the active one shifts the array left; keep the
|
|
279
|
+
// same tab active by decrementing the index.
|
|
280
|
+
s.activeIndex -= 1;
|
|
281
|
+
}
|
|
282
|
+
else if (index === s.activeIndex) {
|
|
283
|
+
// The active tab itself was closed; activate the next tab (the one that
|
|
284
|
+
// shifted into its place), or the last one when the closed tab was the
|
|
285
|
+
// last.
|
|
286
|
+
s.activeIndex = Math.min(index, s.tabs.length - 1);
|
|
287
|
+
}
|
|
288
|
+
this.showActive(s);
|
|
289
|
+
return Promise.resolve();
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Find a canonical tab within the calling session.
|
|
293
|
+
*/
|
|
294
|
+
locateTab(session, tabId) {
|
|
295
|
+
const s = this.session(session);
|
|
296
|
+
resolveTabHandle(resolveSessionHandle(session), tabId);
|
|
297
|
+
const own = s.tabs.findIndex(tab => tab.id === tabId);
|
|
298
|
+
if (own >= 0)
|
|
299
|
+
return { s, index: own };
|
|
300
|
+
const ownIds = s.tabs.map(t => t.id).join(', ') || '(none)';
|
|
301
|
+
throw new BrowserError(`browser: tab "${tabId}" is not open in this session (session tabs: ${ownIds})`, 'BROWSER_TAB_UNKNOWN');
|
|
302
|
+
}
|
|
303
|
+
/** Close every tab and reset to one blank tab. */
|
|
304
|
+
reset(session) {
|
|
305
|
+
const s = this.session(session);
|
|
306
|
+
for (const tab of s.tabs)
|
|
307
|
+
this.destroyTab(tab);
|
|
308
|
+
s.tabs.length = 0;
|
|
309
|
+
this.newTab(s);
|
|
310
|
+
s.activeIndex = 0;
|
|
311
|
+
this.showActive(s);
|
|
312
|
+
return Promise.resolve();
|
|
313
|
+
}
|
|
314
|
+
/** Look up a session or throw the unknown-session error. */
|
|
315
|
+
session(session) {
|
|
316
|
+
const existing = this.sessions.get(session);
|
|
317
|
+
if (existing === undefined) {
|
|
318
|
+
throw new BrowserError(`browser: session "${session}" is not open`, 'BROWSER_SESSION_UNKNOWN');
|
|
319
|
+
}
|
|
320
|
+
return existing;
|
|
321
|
+
}
|
|
322
|
+
/** The active tab of a session. */
|
|
323
|
+
activeTab(s) {
|
|
324
|
+
if (this.carrierLaunchError !== undefined)
|
|
325
|
+
throw this.carrierLaunchError;
|
|
326
|
+
const tab = s.tabs[s.activeIndex];
|
|
327
|
+
if (tab === undefined)
|
|
328
|
+
throw new BrowserError('browser: session has no active tab', 'BROWSER_TAB_UNKNOWN');
|
|
329
|
+
if (tab.failure !== undefined)
|
|
330
|
+
throw tab.failure;
|
|
331
|
+
return tab;
|
|
332
|
+
}
|
|
333
|
+
/** Append a fresh tab and make it active. */
|
|
334
|
+
newTab(s) {
|
|
335
|
+
const id = tabWireId({ ...resolveSessionHandle(s.id), tab: randomUUID() });
|
|
336
|
+
const handle = this.host.createView(id);
|
|
337
|
+
// Same window as the session's other tabs.
|
|
338
|
+
this.host.groupView?.(handle, s.id, s.label);
|
|
339
|
+
s.tabs.push({ id, handle, url: '' });
|
|
340
|
+
s.activeIndex = s.tabs.length - 1;
|
|
341
|
+
this.showActive(s);
|
|
342
|
+
}
|
|
343
|
+
carrierScope(s) {
|
|
344
|
+
return s.id;
|
|
345
|
+
}
|
|
346
|
+
carrierTab(s, id) {
|
|
347
|
+
const scope = resolveSessionHandle(s.id);
|
|
348
|
+
return tabWireId(resolveTabHandle(scope, id));
|
|
349
|
+
}
|
|
350
|
+
carrierId(s, id) {
|
|
351
|
+
const tab = resolveTabHandle(resolveSessionHandle(s.id), id).tab;
|
|
352
|
+
if (!tab.startsWith('page:') && this.host.closePage === undefined)
|
|
353
|
+
return undefined;
|
|
354
|
+
return id;
|
|
355
|
+
}
|
|
356
|
+
destroyTab(tab, options) {
|
|
357
|
+
tab.navigationAbort?.abort(new BrowserError('browser: the navigation guest was closed', 'BROWSER_GUEST_CLOSED'));
|
|
358
|
+
this.host.destroyView(tab.handle, options);
|
|
359
|
+
}
|
|
360
|
+
/** Find a session's tab by its backing view id (toolbar actions carry view ids). */
|
|
361
|
+
tabByViewId(s, viewId) {
|
|
362
|
+
return s.tabs.find(tab => tab.handle.id === viewId);
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Whether a session is still live. The human closing a window ends its session
|
|
366
|
+
* (see {@link handleViewClosed}), so callers that cache ids must ask first.
|
|
367
|
+
* @param session - the session id to test.
|
|
368
|
+
*/
|
|
369
|
+
exists(session) {
|
|
370
|
+
return this.sessions.has(session);
|
|
371
|
+
}
|
|
372
|
+
}
|