dsh-builtin-browser 1.0.0 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +61 -0
- package/README.md +1 -1
- package/assets/browser-panel-locales.mjs +37 -5
- package/assets/browser-policy.d.mts +29 -0
- package/assets/browser-policy.mjs +40 -0
- package/desktop-bridge/desktop-discovery.d.mts +1 -1
- package/desktop-bridge/desktop-discovery.mjs +59 -9
- package/desktop-bridge/desktop-identity.json +12 -0
- package/desktop-bridge/install.mjs +14 -7
- package/desktop-bridge/plugin-browser-bridge.js +19 -7
- package/docs/acceptance-2026-11-27.md +67 -0
- package/docs/architecture.md +1 -1
- package/docs/development.md +33 -4
- package/docs/dsh-0.2.3-host-patch-task.md +34 -0
- package/docs/hardcoding-audit.md +28 -8
- package/docs/known-issues.md +26 -0
- package/docs/limitations.md +6 -2
- package/docs/pr64-maintenance.md +1 -1
- package/docs/tool-reference.md +1 -1
- package/docs/user-guide.md +1 -1
- package/docs/v1.1.0-bu-data-batching-task.md +66 -0
- package/docs/v1.1.0-compat-hardcoding-task.md +85 -0
- package/dsh-builtin-browser-1.0.3-publish.tgz +0 -0
- package/dsh-builtin-browser-1.0.3.tgz +0 -0
- package/dsh-host-patch/README.md +4 -0
- package/dsh-host-patch/apply.mjs +61 -13
- package/dsh-host-patch/rc3-revision9.json.gz +0 -0
- package/dsh-host-patch/rc5-revision9.json.gz +0 -0
- package/dsh-host-patch/sources/main/0001-feat-sidebar-right-add-session-rendering-holds.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0002-feat-desktop-load-trusted-profile-main-extensions.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0003-feat-desktop-report-resolved-and-running-main-extens.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0004-feat-desktop-compose-admitted-native-sidebar-views.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0005-fix-client-admit-coded-browser-errors-in-native-comp.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0006-fix-desktop-acknowledge-native-same-document-navigat.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0007-fix-desktop-restore-auth-in-the-native-lease-partiti.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0008-feat-desktop-adopt-native-children-in-admitted-sideb.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0009-fix-desktop-publish-complete-native-child-close-reco.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0010-fix-desktop-bundle-structured-errors-in-sandboxed-pr.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0011-feat-desktop-offer-persistent-Sidebar-sessions-per-D.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0012-feat-desktop-retain-sidebar-session-cookies-across-r.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0013-fix-desktop-honor-sidebar-session-cookie-sidecar-con.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0014-fix-desktop-retry-cookie-protection-without-failing-.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0015-fix-desktop-preserve-host-only-cookie-identity-in-se.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0016-fix-desktop-restore-session-cookies-before-checkpoin.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0017-fix-desktop-restore-sidebar-cookies-once-before-gues.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0018-fix-sidebar-right-follow-animated-native-slot-placem.patch.gz +0 -0
- package/dsh-host-patch/sources/manifest.json +218 -0
- package/dsh-host-patch/sources/rc3/0001-feat-sidebar-right-add-session-rendering-holds.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0002-feat-desktop-load-trusted-profile-main-extensions.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0003-feat-desktop-report-resolved-and-running-main-extens.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0004-feat-desktop-compose-admitted-native-sidebar-views.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0005-fix-client-admit-coded-browser-errors-in-native-comp.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0006-fix-desktop-acknowledge-native-same-document-navigat.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0007-fix-desktop-restore-auth-in-the-native-lease-partiti.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0008-feat-desktop-adopt-native-children-in-admitted-sideb.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0009-fix-desktop-publish-complete-native-child-close-reco.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0010-fix-desktop-bundle-structured-errors-in-sandboxed-pr.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0011-feat-desktop-offer-persistent-Sidebar-sessions-per-D.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0012-feat-desktop-retain-sidebar-session-cookies-across-r.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0013-fix-desktop-honor-sidebar-session-cookie-sidecar-con.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0014-fix-desktop-retry-cookie-protection-without-failing-.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0015-fix-desktop-preserve-host-only-cookie-identity-in-se.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0016-fix-desktop-restore-session-cookies-before-checkpoin.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0017-fix-desktop-restore-sidebar-cookies-once-before-gues.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0018-fix-sidebar-right-follow-animated-native-slot-placem.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0001-feat-sidebar-right-add-session-rendering-holds.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0002-feat-desktop-load-trusted-profile-main-extensions.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0003-feat-desktop-report-resolved-and-running-main-extens.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0004-feat-desktop-compose-admitted-native-sidebar-views.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0005-fix-client-admit-coded-browser-errors-in-native-comp.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0006-fix-desktop-acknowledge-native-same-document-navigat.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0007-fix-desktop-restore-auth-in-the-native-lease-partiti.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0008-feat-desktop-adopt-native-children-in-admitted-sideb.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0009-fix-desktop-publish-complete-native-child-close-reco.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0010-fix-desktop-bundle-structured-errors-in-sandboxed-pr.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0011-feat-desktop-offer-persistent-Sidebar-sessions-per-D.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0012-feat-desktop-retain-sidebar-session-cookies-across-r.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0013-fix-desktop-honor-sidebar-session-cookie-sidecar-con.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0014-fix-desktop-retry-cookie-protection-without-failing-.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0015-fix-desktop-preserve-host-only-cookie-identity-in-se.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0016-fix-desktop-restore-session-cookies-before-checkpoin.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0017-fix-desktop-restore-sidebar-cookies-once-before-gues.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0018-fix-sidebar-right-follow-animated-native-slot-placem.patch.gz +0 -0
- package/dsh-host-patch/sources/series.json +260 -0
- package/dsh-host-patch/tauri/desktop-main.cjs +62 -0
- package/dsh-host-patch/tauri/sidebar-session.cjs +104 -0
- package/dsh-host-patch/tauri-revision1.json +39 -0
- package/dsh-host-patch/tauri.json +43 -0
- package/dsh-host-patch/v023-alpha2.json +153 -0
- package/lib/browser/anti-bot.js +215 -0
- package/lib/browser/deep-dom.js +39 -0
- package/lib/browser/runtime.js +15 -0
- package/lib/browser/takeover-target.js +13 -6
- package/lib/browser/types.js +30 -1
- package/lib/browser-electron/authenticated-route.js +16 -2
- package/lib/browser-electron/automatic-maintenance.js +16 -10
- package/lib/browser-electron/bridge-connection.js +3 -8
- package/lib/browser-electron/bridge-install.js +2 -1
- package/lib/browser-electron/bridge-status.js +55 -26
- package/lib/browser-electron/desktop-bridge-host.js +7 -6
- package/lib/browser-electron/desktop-identity.js +28 -5
- package/lib/browser-electron/desktop-shell.js +64 -0
- package/lib/browser-electron/electron-provision.js +105 -18
- package/lib/browser-electron/entry.js +129 -46
- package/lib/browser-electron/extension-browser.js +4 -4
- package/lib/browser-electron/foreground-watch.js +134 -0
- package/lib/browser-electron/guest-cookie-jar.js +13 -13
- package/lib/browser-electron/guest-route.js +181 -32
- package/lib/browser-electron/guest-runtime.js +61 -10
- package/lib/browser-electron/guest-storage.js +2 -2
- package/lib/browser-electron/history-store.js +1 -5
- package/lib/browser-electron/host-main.js +8 -4
- package/lib/browser-electron/host-patch-maintenance.js +14 -8
- package/lib/browser-electron/maintenance-route.js +2 -1
- package/lib/browser-electron/missing-system-browser.js +5 -9
- package/lib/browser-electron/preferred-browser.js +7 -3
- package/lib/browser-electron/preview-route.js +9 -13
- package/lib/browser-electron/process-ownership.js +1 -1
- package/lib/browser-electron/profile-command.js +2 -1
- package/lib/browser-electron/profile-extension.js +5 -0
- package/lib/browser-electron/profile-lease.js +152 -47
- package/lib/browser-electron/provider-core.js +527 -0
- package/lib/browser-electron/provider-interaction.js +963 -0
- package/lib/browser-electron/provider-media.js +518 -0
- package/lib/browser-electron/provider-navigation.js +301 -0
- package/lib/browser-electron/provider-observation.js +623 -0
- package/lib/browser-electron/provider-tabs.js +372 -0
- package/lib/browser-electron/provider.js +150 -3301
- package/lib/browser-electron/reference-route.js +9 -18
- package/lib/browser-electron/remote-host.js +79 -34
- package/lib/browser-electron/runtime-status.js +56 -6
- package/lib/browser-electron/settings-store.js +3 -6
- package/lib/browser-electron/sidebar-only-host.js +1 -1
- package/lib/browser-electron/system-browser.js +539 -172
- package/lib/browser-electron/tauri-host.js +208 -0
- package/lib/browser-electron/virtual-cursor.js +23 -13
- package/lib/browser-reference/service.js +22 -4
- package/lib/browser-reference/web-sources.js +1 -1
- package/lib/client.js +43409 -0
- package/lib/compat/host-features.js +75 -0
- package/lib/reference-source.js +1 -1
- package/lib/reference-text.js +23 -1
- package/lib/takeover-protocol.js +1 -1
- package/lib/tool-browser/block-recovery.js +69 -0
- package/lib/tool-browser/code-tool.js +170 -19
- package/lib/tool-browser/code-worker.js +115 -20
- package/lib/tool-browser/errors.js +34 -0
- package/lib/tool-browser/index.js +66 -3593
- package/lib/tool-browser/page-probe.js +227 -28
- package/lib/tool-browser/panel-page.js +2 -1
- package/lib/tool-browser/probe-client.js +157 -0
- package/lib/tool-browser/screenshot-annotations.js +108 -0
- package/lib/tool-browser/state.js +337 -0
- package/lib/tool-browser/takeover.js +1 -1
- package/lib/tool-browser/tools-debug.js +862 -0
- package/lib/tool-browser/tools-interaction.js +993 -0
- package/lib/tool-browser/tools-navigation.js +807 -0
- package/lib/tool-browser/tools-observation.js +461 -0
- package/lib/tool-browser/tools-reference.js +293 -0
- package/lib/web-guest.js +1 -0
- package/package.json +16 -54
- package/README.en.md +0 -89
- package/browser-extension/constants.mjs +0 -20
- package/browser-extension/controller.mjs +0 -293
- package/browser-extension/locales.mjs +0 -15
- package/browser-extension/manifest.json +0 -12
- package/browser-extension/options.html +0 -14
- package/browser-extension/options.mjs +0 -9
- package/browser-extension/permission-guard.mjs +0 -13
- package/browser-extension/worker.mjs +0 -74
- package/dist/client.cjs +0 -43167
- package/lib/browser-electron/package-removal.js +0 -5
- package/lib/browser-reference/submission-receipts.js +0 -139
- package/scripts/build.mjs +0 -66
- package/scripts/bundle-host.mjs +0 -28
- package/scripts/fix-exports.mjs +0 -50
- package/scripts/install-electron.mjs +0 -51
- package/scripts/verify-exports.mjs +0 -47
- package/scripts/verify-preview-sdk.mjs +0 -93
- package/skills/dsh-builtin-browser/SKILL.md +0 -73
- package/skills/dsh-builtin-browser/references/batch.md +0 -53
- package/skills/dsh-builtin-browser/references/deliver.md +0 -31
- package/skills/dsh-builtin-browser/references/locate.md +0 -11
- package/skills/dsh-builtin-browser/references/recover.md +0 -11
- package/skills/dsh-builtin-browser/references/verify.md +0 -13
- package/skills/dsh-debug-host/SKILL.md +0 -56
- package/skills/dsh-debug-self/SKILL.md +0 -50
- package/src/bridge-compatibility.ts +0 -39
- package/src/browser/handles.ts +0 -89
- package/src/browser/runtime.ts +0 -560
- package/src/browser/takeover-target.ts +0 -36
- package/src/browser/types.ts +0 -817
- package/src/browser-electron/authenticated-route.ts +0 -84
- package/src/browser-electron/automatic-maintenance.ts +0 -726
- package/src/browser-electron/bridge-auto.ts +0 -159
- package/src/browser-electron/bridge-connection.ts +0 -385
- package/src/browser-electron/bridge-endpoint.ts +0 -129
- package/src/browser-electron/bridge-install.ts +0 -289
- package/src/browser-electron/bridge-maintenance.ts +0 -189
- package/src/browser-electron/bridge-status.ts +0 -347
- package/src/browser-electron/desktop-bridge-host.ts +0 -251
- package/src/browser-electron/desktop-identity.ts +0 -320
- package/src/browser-electron/document-readiness.ts +0 -45
- package/src/browser-electron/electron-provision.ts +0 -261
- package/src/browser-electron/entry.ts +0 -1301
- package/src/browser-electron/ephemeral-profile.ts +0 -189
- package/src/browser-electron/extension-browser.ts +0 -223
- package/src/browser-electron/extension-setup.ts +0 -67
- package/src/browser-electron/file-write.ts +0 -31
- package/src/browser-electron/guest-cookie-jar.ts +0 -176
- package/src/browser-electron/guest-cookie-store.ts +0 -59
- package/src/browser-electron/guest-css-runtime.ts +0 -76
- package/src/browser-electron/guest-css.ts +0 -68
- package/src/browser-electron/guest-route.ts +0 -568
- package/src/browser-electron/guest-runtime.ts +0 -357
- package/src/browser-electron/guest-storage-runtime.ts +0 -54
- package/src/browser-electron/guest-storage.ts +0 -117
- package/src/browser-electron/history-store.ts +0 -227
- package/src/browser-electron/host-main.ts +0 -1381
- package/src/browser-electron/host-patch-maintenance.ts +0 -112
- package/src/browser-electron/http-body.ts +0 -65
- package/src/browser-electron/json-reply.ts +0 -47
- package/src/browser-electron/maintenance-broker.ts +0 -166
- package/src/browser-electron/maintenance-lifecycle.ts +0 -91
- package/src/browser-electron/maintenance-route.ts +0 -67
- package/src/browser-electron/missing-system-browser.ts +0 -113
- package/src/browser-electron/open-slot.ts +0 -49
- package/src/browser-electron/package-removal.ts +0 -4
- package/src/browser-electron/paths.ts +0 -25
- package/src/browser-electron/preferred-browser.ts +0 -120
- package/src/browser-electron/preview-route.ts +0 -218
- package/src/browser-electron/process-ownership.ts +0 -168
- package/src/browser-electron/process.ts +0 -23
- package/src/browser-electron/profile-checkpoint.ts +0 -187
- package/src/browser-electron/profile-command.ts +0 -46
- package/src/browser-electron/profile-extension.ts +0 -124
- package/src/browser-electron/profile-lease.ts +0 -115
- package/src/browser-electron/profile-residue.ts +0 -49
- package/src/browser-electron/provider.ts +0 -4571
- package/src/browser-electron/reference-route.ts +0 -608
- package/src/browser-electron/remote-host.ts +0 -1462
- package/src/browser-electron/rpc-input.ts +0 -13
- package/src/browser-electron/rpc-ops.ts +0 -41
- package/src/browser-electron/runtime-diagnostics.ts +0 -38
- package/src/browser-electron/runtime-route.ts +0 -105
- package/src/browser-electron/runtime-status.ts +0 -242
- package/src/browser-electron/settings-route.ts +0 -64
- package/src/browser-electron/settings-store.ts +0 -589
- package/src/browser-electron/shortcuts-route.ts +0 -112
- package/src/browser-electron/sidebar-only-host.ts +0 -298
- package/src/browser-electron/startpage-shortcuts.ts +0 -213
- package/src/browser-electron/system-browser.ts +0 -1497
- package/src/browser-electron/timing.ts +0 -16
- package/src/browser-electron/virtual-cursor.ts +0 -152
- package/src/browser-electron/windows-system.ts +0 -24
- package/src/browser-reference/delivery.ts +0 -384
- package/src/browser-reference/entry.ts +0 -631
- package/src/browser-reference/export.ts +0 -339
- package/src/browser-reference/import.ts +0 -303
- package/src/browser-reference/page-script.ts +0 -1537
- package/src/browser-reference/service.ts +0 -1315
- package/src/browser-reference/store.ts +0 -172
- package/src/browser-reference/submission-receipts.ts +0 -122
- package/src/browser-reference/text-quote.ts +0 -219
- package/src/browser-reference/types.ts +0 -195
- package/src/browser-reference/visible.ts +0 -367
- package/src/browser-reference/web-sources.ts +0 -103
- package/src/client/browser/BrowserController.ts +0 -693
- package/src/client/browser/BrowserFrame.ts +0 -78
- package/src/client/browser/BrowserNavigation.ts +0 -169
- package/src/client/browser/BrowserPage.ts +0 -23
- package/src/client/browser/BrowserPersistence.ts +0 -44
- package/src/client/browser/IframeImpl.ts +0 -176
- package/src/client/browser/child-tabs.ts +0 -14
- package/src/client/browser/iframe-reference.ts +0 -67
- package/src/client/browser/initialization.ts +0 -262
- package/src/client/browser/omnibox.ts +0 -243
- package/src/client/browser/store.ts +0 -38
- package/src/client/browser/takeover-channel.ts +0 -72
- package/src/client/browser/url.ts +0 -46
- package/src/client/browser/web-reference-source.ts +0 -52
- package/src/client/css-modules.d.ts +0 -4
- package/src/client/definition.tsx +0 -30
- package/src/client/electron/ElectronWebViewImpl.ts +0 -364
- package/src/client/electron/ElectronWebviewPresentation.ts +0 -138
- package/src/client/electron/NativeChildPresentation.ts +0 -45
- package/src/client/electron/NativeViewPage.ts +0 -251
- package/src/client/electron/pages.ts +0 -23
- package/src/client/electron/reference-overlay.ts +0 -53
- package/src/client/electron/workspace.ts +0 -33
- package/src/client/index.ts +0 -293
- package/src/client/locales.ts +0 -857
- package/src/client/pages.ts +0 -28
- package/src/client/reference/client/BrowserRefLink.tsx +0 -142
- package/src/client/reference/client/draft-reference.ts +0 -167
- package/src/client/reference/client/index.ts +0 -7
- package/src/client/reference/client/ordered-submission.ts +0 -108
- package/src/client/reference/client/pending-delivery.ts +0 -216
- package/src/client/reference/client/plugin.ts +0 -189
- package/src/client/reference/client/production/ReferenceCapsules.tsx +0 -345
- package/src/client/reference/client/production/ReferenceDock.module.css +0 -193
- package/src/client/reference/client/production/ReferenceDock.tsx +0 -6
- package/src/client/reference/client/production/ReferenceFeedback.tsx +0 -15
- package/src/client/reference/client/production/ReferenceMath.tsx +0 -44
- package/src/client/reference/client/production/ReferenceText.tsx +0 -36
- package/src/client/reference/client/production/assembly.ts +0 -471
- package/src/client/reference/client/production/asset-store.ts +0 -144
- package/src/client/reference/client/production/availability.ts +0 -74
- package/src/client/reference/client/production/bytes.ts +0 -36
- package/src/client/reference/client/production/delivery-client.ts +0 -211
- package/src/client/reference/client/production/draft-adapter.ts +0 -508
- package/src/client/reference/client/production/http-transport.ts +0 -217
- package/src/client/reference/client/production/production-submission.ts +0 -310
- package/src/client/reference/client/production/protocol.ts +0 -231
- package/src/client/reference/client/production/reference-card.ts +0 -240
- package/src/client/reference/client/production/reference-labels.ts +0 -29
- package/src/client/reference/client/production/reply-link-bridge.ts +0 -222
- package/src/client/reference/client/production/reveal.ts +0 -215
- package/src/client/reference/client/production/runtime.ts +0 -1101
- package/src/client/reference/client/production/snapshot-adapter.ts +0 -154
- package/src/client/reference/client/production/source-marker.ts +0 -63
- package/src/client/reference/client/production/source-opener.ts +0 -55
- package/src/client/reference/client/production/styles.ts +0 -104
- package/src/client/reference/client/production/user-text-rule.ts +0 -58
- package/src/client/reference/client/reveal.ts +0 -107
- package/src/client/reference/client/scheme.ts +0 -114
- package/src/client/reference/client/types.ts +0 -168
- package/src/client/reference/css-modules.d.ts +0 -4
- package/src/client/reference/index.ts +0 -11
- package/src/client/reference-capture-owner.ts +0 -162
- package/src/client/reference-intents.ts +0 -36
- package/src/client/settings/index.ts +0 -34
- package/src/client/settings/panel.ts +0 -2657
- package/src/client/shortcut-open.ts +0 -30
- package/src/client/startpage/binding.ts +0 -99
- package/src/client/startpage/controller.ts +0 -303
- package/src/client/startpage/model.ts +0 -279
- package/src/client/view/Browser.module.css +0 -751
- package/src/client/view/BrowserBody.tsx +0 -314
- package/src/client/view/BrowserPresentation.ts +0 -9
- package/src/client/view/BrowserTitle.tsx +0 -17
- package/src/client/view/IframePresentation.ts +0 -344
- package/src/client/view/StartPage.tsx +0 -597
- package/src/client/view/TakeoverBanner.tsx +0 -21
- package/src/index.ts +0 -110
- package/src/reference-owner.ts +0 -5
- package/src/reference-page.ts +0 -9
- package/src/reference-source.ts +0 -3
- package/src/reference-text.ts +0 -197
- package/src/startpage-settings.ts +0 -103
- package/src/startpage.ts +0 -71
- package/src/takeover-protocol.ts +0 -19
- package/src/tool-browser/code-tool.ts +0 -401
- package/src/tool-browser/code-worker.ts +0 -639
- package/src/tool-browser/element-fields.ts +0 -167
- package/src/tool-browser/index.ts +0 -3733
- package/src/tool-browser/page-probe.ts +0 -474
- package/src/tool-browser/panel-page.ts +0 -124
- package/src/tool-browser/screenshot-image.ts +0 -49
- package/src/tool-browser/takeover.ts +0 -198
- package/src/types/electron-shim.d.ts +0 -144
- package/src/types.ts +0 -85
- package/src/web-guest.ts +0 -34
- package/tools/accept-desktop.mjs +0 -148
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# 验收清单(2026-11-27,DSH 0.2.3-alpha.2 适配版)
|
|
2
|
+
|
|
3
|
+
这一版解决的是「装得上、跑得对、说真话」三件事,不含 Web 侧栏的存储兼容(见文末“明确未做”)。
|
|
4
|
+
安装位置:`%DSH_HOME%\profiles\web\plugins\dsh-builtin-browser`(本机为 `D:\dsh-home`)。
|
|
5
|
+
备份位置:同目录旁的 `dsh-builtin-browser.bak-20261127`。
|
|
6
|
+
|
|
7
|
+
## 零、部署方式(不要手工拷贝目录)
|
|
8
|
+
|
|
9
|
+
目录链接安装(profile 里的 `link:./plugins/...`)**不会应用 `publishConfig`**:手工拷贝后包里仍是开发态
|
|
10
|
+
`exports`(`./client` → `./src/client/index.ts`),宿主会把 TypeScript 源码当客户端包发给浏览器,浏览器执行不了,
|
|
11
|
+
插件永远不会调用 `__ModuleLoader__.load`,设置页停在骨架屏并报 `loaded without registering`。
|
|
12
|
+
|
|
13
|
+
正确的部署命令(构建 + 写入发布态 manifest + 逐项校验 exports):
|
|
14
|
+
|
|
15
|
+
```powershell
|
|
16
|
+
node tools/deploy-local.mjs # 默认装到 $env:DSH_HOME\profiles\web\plugins\dsh-builtin-browser
|
|
17
|
+
node tools/deploy-local.mjs --target <目录> --no-build # 指定目录 / 复用已有构建
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
脚本会输出 `./client = ./lib/client.js (… KB, __ModuleLoader__ envelope)`,并断言每个导出的目标文件都存在。
|
|
21
|
+
|
|
22
|
+
## 一、重启后才生效
|
|
23
|
+
|
|
24
|
+
插件代码在 DSH 启动时加载,重启 `dsh web` 那一个进程即可。**不要删 `DSH_HOME`**。
|
|
25
|
+
重启后先看设置页能不能正常打开(这一步同时验证 HTTP 路由鉴权)。
|
|
26
|
+
|
|
27
|
+
## 二、逐项验收(预计 10 分钟)
|
|
28
|
+
|
|
29
|
+
| # | 操作 | 预期 | 失败时说明什么 |
|
|
30
|
+
|---|---|---|---|
|
|
31
|
+
| 1 | 打开 **设置 → 浏览器** | 面板正常显示:载体、桥接状态、门控开关 | 仍报 `browser-auth-unavailable` → 鉴权路径不对,回滚 |
|
|
32
|
+
| 2 | 侧栏打开一个普通站点(如 example.com) | 页面正常渲染,地址栏、前进后退可用 | 白屏 → 载体或代理问题 |
|
|
33
|
+
| 3 | 在页面里**划选一段文字** → 浮条点“引用选中的文字” | 输入框出现引用的引文与胶囊 | 没反应 → 消息通道仍未接通(本次修的就是它) |
|
|
34
|
+
| 4 | 发送消息后,点胶囊上的“回到原页面” | 打开来源页并定位/高亮选区 | 打不开 → 引用回流链路问题 |
|
|
35
|
+
| 5 | 让 agent `dsh_browser_open` 打开一个地址再 `dsh_browser_snapshot` | 快照里有带编号的可交互元素 | 报载体能力不足 → 看设置页载体选择 |
|
|
36
|
+
| 6 | 侧栏打开一个**需要登录态**的站点(如网盘) | 大概率白屏或功能残缺 | **这是已知限制,不是本版回归**,见文末 |
|
|
37
|
+
|
|
38
|
+
第 3、4 项是本次修复的核心:上一版把网页放进了 DSH 同源,但客户端只认隔离来源的消息,导致引用通道全断;现在两种来源都接受,且仍用 `event.source` 确认是同一个帧。
|
|
39
|
+
|
|
40
|
+
## 三、隔离状态(本版有意保留的行为)
|
|
41
|
+
|
|
42
|
+
- 网页仍运行在**隔离来源**(opaque origin)里,读不到 DSH 的本地数据与接口。
|
|
43
|
+
- 代价:需要 `localStorage`/`IndexedDB`/`worker` 的站点跑不起来。这是 1.0.1 就有的限制,文档里一直写着。
|
|
44
|
+
- 上一版为了让这些站点能跑而放开同源,会让**任意被浏览的网页**获得与 DSH 同等的同源权限(可读同源存储、可带登录态调同源接口)。本版撤回了这一改动。
|
|
45
|
+
|
|
46
|
+
## 四、明确未做
|
|
47
|
+
|
|
48
|
+
1. “需要存储的站点也能跑”——正解是给网页**独立来源**(另端口/子域),属于独立设计,未在本版实施。
|
|
49
|
+
2. Web 侧栏的其它体验优化(下载交付、远程观看)不在本版范围。
|
|
50
|
+
|
|
51
|
+
## 五、回滚(30 秒)
|
|
52
|
+
|
|
53
|
+
```powershell
|
|
54
|
+
$p = "$env:DSH_HOME\profiles\web\plugins"
|
|
55
|
+
Remove-Item "$p\dsh-builtin-browser" -Recurse -Force
|
|
56
|
+
Rename-Item "$p\dsh-builtin-browser.bak-20261127" 'dsh-builtin-browser'
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
然后重启 `dsh web`。回滚后恢复的是上一版(网页可跑、引用断、同源隔离已放开)。
|
|
60
|
+
|
|
61
|
+
## 六、本版改动摘要(可对照代码审阅)
|
|
62
|
+
|
|
63
|
+
- `src/client/view/IframePresentation.ts`:消息来源改为「隔离来源或本应用来源」;等不到文档身份回执时按已加载处理,不再把整个载体标记为不可用。
|
|
64
|
+
- `assets/browser-policy.mjs`:新增 7 条共用路由常量;`WEB_BROWSER_SANDBOX` 保持隔离(撤回 `allow-same-origin`)。
|
|
65
|
+
- `package.json` / `.github/workflows/ci.yml`:`engines.dsh` 回到 `>=0.2.2-rc.3 <0.3.0`,CI 增加 `0.2.2-rc.5` 一条腿。
|
|
66
|
+
- `tests/routes-single-source.test.mjs`:路由字面量只允许出现在策略文件里。
|
|
67
|
+
- `tests/docs-version-claims.test.mjs`:文档里的版本区间必须等于 manifest,CHANGELOG 除外。
|
package/docs/architecture.md
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
## Web:隔离 guest 与引用通道
|
|
18
18
|
|
|
19
|
-
手动 Web
|
|
19
|
+
手动 Web 浏览使用代理承载的 iframe,站点 Cookie 由代理负责,不与 DSH 应用认证共享。**在 DSH 0.2.3 上该 iframe 与应用同源**:宿主拒绝 `Origin: null`,隔离来源取不到任何子资源(图片/样式全部 403),所以沙箱放开 `allow-same-origin`——这也意味着侧栏里的网页要按可信站点对待,边界说明见[兼容性与边界](limitations.md)。选区与回到原文指令通过校验的消息通道与所属对话交互(两种来源都接受,仍以 `event.source` 证明同一个帧);跨导航时必须匹配当前页面身份。引用先冻结结构化内容,再经同一个预览与定位流程供草稿、已发送消息和原文回跳使用。已发胶囊不需要重新抓取页面来还原预览。
|
|
20
20
|
|
|
21
21
|
Web 不提供原生子页或 CDP 工具。不能提供的能力显式报错,无独立 Electron 进程回退。
|
|
22
22
|
|
package/docs/development.md
CHANGED
|
@@ -98,6 +98,35 @@ node tests/run.mjs tests/code-tool.test.mjs
|
|
|
98
98
|
|
|
99
99
|
单元测试并不等于安装包验收。需要原生组合、系统焦点或安装退出流程的场景,要用实际运行的对应宿主复验。
|
|
100
100
|
|
|
101
|
+
## 部署到 profile(目录链接)
|
|
102
|
+
|
|
103
|
+
profile 里若用 `link:./plugins/dsh-builtin-browser` 安装,pnpm 不会应用 `publishConfig`,包内 `exports` 仍是开发态
|
|
104
|
+
(`./client` → `./src/client/index.ts`)。宿主的客户端模块服务只读 `exports`,于是会把 TypeScript 源码发给浏览器,
|
|
105
|
+
浏览器执行不了,插件不注册(症状:设置页停在骨架屏、宿主日志 `loaded without registering`)。
|
|
106
|
+
|
|
107
|
+
因此本地部署一律用脚本,不要手工复制目录:
|
|
108
|
+
|
|
109
|
+
```sh
|
|
110
|
+
node tools/deploy-local.mjs # 构建 + 写入发布态 exports + 校验每个导出目标存在
|
|
111
|
+
node tools/deploy-local.mjs --no-build # 复用现有 lib/
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
脚本把 `publishConfig.exports`(与 npm 发布时应用的是同一份映射)写进安装目录的 `package.json`,并断言
|
|
115
|
+
`./client` 解析到 `./lib/client.js`、该文件带 `__ModuleLoader__` 信封。回归测试:`tests/deploy-manifest.test.mjs`。
|
|
116
|
+
|
|
117
|
+
### 升级 / 替换已有安装(#131)
|
|
118
|
+
|
|
119
|
+
直接往已有目录里覆盖会留下"新旧文件混在一起"的安装。替换时先备份旧目录:
|
|
120
|
+
|
|
121
|
+
```sh
|
|
122
|
+
node tools/deploy-local.mjs --replace # 旧目录改名为 <target>.backup-<时间戳>,再装新的
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
备份名里的时间戳精确到秒;确认新版可用后可以删除备份。目录链接安装(`node_modules/dsh-builtin-browser`
|
|
126
|
+
是指向该目录的 Junction)会**拒绝** `--replace`:改名字会让链接悬空,脚本会直接报错并提示先移除链接。
|
|
127
|
+
|
|
128
|
+
npm 安装的 profile 走 DSH 自己的插件管理:先移除旧版本,再安装新版本(`dsh plugin remove` → `dsh plugin add`)。
|
|
129
|
+
|
|
101
130
|
## 代码结构
|
|
102
131
|
|
|
103
132
|
| 目录 | 职责 |
|
|
@@ -132,14 +161,14 @@ node scripts/verify-runtime-status.mjs # 与上面同一个 profile 解
|
|
|
132
161
|
|
|
133
162
|
## 关于 DSH 版本范围
|
|
134
163
|
|
|
135
|
-
插件在 **`engines.dsh`** 里声明 `>=0.
|
|
164
|
+
插件在 **`engines.dsh`** 里声明 `>=0.2.2-rc.3 <0.3.0`。
|
|
136
165
|
|
|
137
166
|
位置不是随便选的。DSH 从 0.2.1-alpha.3 之后改成:**有 `engines.dsh` 就只看它,`@deepseek-ai/dsh*` 的 `peerDependencies` 被忽略;没有 `engines.dsh` 才回退到 peer 规则**(`packages/boot/app-boot/src/plugin-compatibility.ts`;官方迁移指南在 `docs/upgrade-guide/v0.2.1-alpha.3/plugin-engines-dsh/`)。
|
|
138
167
|
|
|
139
|
-
本插件 0.
|
|
168
|
+
本插件 1.0.x 依赖 `@deepseek-ai/dsh-error` 及 `0.2.2-rc.3+` 宿主契约,迁入 monorepo 后 peers 使用 `workspace:^`(发布时解析为 `^0.2.2-rc.3`),CI 持续验证 `0.2.2-rc.3` 与 `0.2.3-alpha.2` 两条基线。`engines.dsh` 与实际下限对齐后,仍停留在 `0.2.2-rc.1` 等更早版本的宿主会在安装检查阶段得到明确拒绝,而不是放行后再因缺少 peer 包而回滚。
|
|
140
169
|
|
|
141
|
-
这个范围在 **semver 默认语义**下**不匹配**任何带预发布标签的版本(如 `0.2.
|
|
170
|
+
这个范围在 **semver 默认语义**下**不匹配**任何带预发布标签的版本(如 `0.2.3-alpha.2`)—— 规范如此:预发布只被"同一 major.minor.patch 元组"的比较器允许。
|
|
142
171
|
|
|
143
|
-
DSH 判定时用的是 `includePrerelease: true
|
|
172
|
+
DSH 判定时用的是 `includePrerelease: true`,因此 `0.2.2-rc.3+` 与 `0.2.3-alpha.2` 等预发布宿主**实际都在范围内**。若某个外部工具用默认语义得出"不兼容",那是它的语义与 DSH 不同,不是这里的声明写错了。
|
|
144
173
|
|
|
145
174
|
`engines.dsh` 里不接受 `workspace:` 值(只有 peers 接受);写成那样等于声明不兼容。
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Devin 任务规范:PR-4 `dsh-host-patch` 适配 `dsh-v0.2.3-alpha.2`
|
|
2
|
+
|
|
3
|
+
> **说明**:本分支已完成 PR-4 中的 `ctx.browserUse` 可选独占注册及单测(`src/browser/runtime.ts`、`tests/browser-use-registration.test.mjs`)。
|
|
4
|
+
> `dsh-host-patch` 依赖从 npm registry 拉取真实构建的 `0.2.3-alpha.2` 产物计算 SHA-256 与唯一锚点,请 Devin 在具备 npm 联网能力的环境中直接在本分支(或从 `master` 切新分支)补齐以下改动并确保 CI 全绿。
|
|
5
|
+
|
|
6
|
+
## 1. 提取真实 `0.2.3-alpha.2` 宿主产物
|
|
7
|
+
在临时目录通过 `npm pack` 提取以下两个包的真实发布产物(严禁手工猜测哈希或锚点):
|
|
8
|
+
1. `@deepseek-ai/dsh-client-ui-sidebar-right@0.2.3-alpha.2`
|
|
9
|
+
- 目标文件:`lib/client.js`
|
|
10
|
+
2. `@deepseek-ai/dsh-desktop@0.2.3-alpha.2`
|
|
11
|
+
- 目标文件:`lib/main.js`、`lib/preload-app.cjs`
|
|
12
|
+
|
|
13
|
+
## 2. 核对上游变化并生成 `dsh-host-patch/v023-alpha2.json`
|
|
14
|
+
对照 `dsh-host-patch/rc5.json` 逐项核对 3 个目标文件:
|
|
15
|
+
1. **`@deepseek-ai/dsh-client-ui-sidebar-right/lib/client.js`**
|
|
16
|
+
- 核对 `openReservedTab`、`holdRendering`、`SidebarNativeComposition`、背景渲染样式等是否已被 0.2.3 上游原生吸收(已原生支持的片段直接跳过,避免重复注入)。
|
|
17
|
+
- 0.2.3 将 CSS Modules 迁入 `meta().stylesheets`,不再存在旧版 `const css="..."` 变量:
|
|
18
|
+
- 重新定位背景渲染样式锚点;
|
|
19
|
+
- 核验 `dsh-host-patch/apply.mjs` 中 `substitutions()` 的正则 `/\.([A-Za-z0-9_-]+)_session\{display:contents\}/g` 在 0.2.3 的 `meta().stylesheets` 字符串内是否依然**唯一命中**(如因转义或压缩变化需同步调整)。
|
|
20
|
+
2. **`@deepseek-ai/dsh-desktop/lib/main.js`** & **`lib/preload-app.cjs`**
|
|
21
|
+
- 计算真实 pristine 文件的 `sha256` 写入 `v023-alpha2.json`;
|
|
22
|
+
- 校准 `startDesktopMainExtensions`、`DesktopNativeViews`、`SidebarSessionCookies`、`DESKTOP_IPC`、`nativeViews`、`childTabs`、`mainExtensions`、`persistentSession` 等唯一锚点。
|
|
23
|
+
3. **注册进 `dsh-host-patch/apply.mjs`**
|
|
24
|
+
- 将 `'v023-alpha2'` 加入 `specs` 数组(`version: "0.2.3-alpha.2"`)。
|
|
25
|
+
4. **核对 `src/browser-electron/host-patch-maintenance.ts`**
|
|
26
|
+
- 确认 `clientModules.clientPath(sidebar)` 与 `modules.rebuilt(sidebar)` 在 0.2.3 宿主上的调用签名无破坏性变化(如有变更同步适配)。
|
|
27
|
+
|
|
28
|
+
## 3. 验收标准
|
|
29
|
+
- 对真实提取出的 `0.2.3-alpha.2` 包目录执行:
|
|
30
|
+
- `node dsh-host-patch/apply.mjs status <pkgDir>` → `status: "absent"`
|
|
31
|
+
- `node dsh-host-patch/apply.mjs apply <pkgDir>` → `status: "applied", changed: true`
|
|
32
|
+
- `node dsh-host-patch/apply.mjs status <pkgDir>` → `status: "applied"`
|
|
33
|
+
- `node dsh-host-patch/apply.mjs restore <pkgDir>` → `status: "absent", changed: true` 且文件与原始字节 100% 一致
|
|
34
|
+
- 全量单测(含 `tests/host-patch-installer.test.mjs`、`tests/web-host-patch.test.mjs`、`tests/browser-use-registration.test.mjs`)与 `node tools/check-pack.mjs` 通过。
|
package/docs/hardcoding-audit.md
CHANGED
|
@@ -45,15 +45,35 @@ intervals, and guest/host UI timing and size thresholds. Some embedded toolbar a
|
|
|
45
45
|
page-script labels and technical error strings still live with their generators;
|
|
46
46
|
moving those safely requires preserving serialized-script scope and locale input.
|
|
47
47
|
|
|
48
|
-
### `src/tool-browser
|
|
48
|
+
### `src/tool-browser`
|
|
49
49
|
|
|
50
|
-
-
|
|
51
|
-
|
|
52
|
-
- Tool
|
|
53
|
-
|
|
54
|
-
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
- Tool timeout default, wait-budget reserve/minimum, fill-field cap and the
|
|
51
|
+
`dsh_browser_code` cell deadlines live in `assets/browser-policy.mjs`.
|
|
52
|
+
- Tool help names the DSH host as `http://127.0.0.1:<port>/`; the port is the one
|
|
53
|
+
`dsh web` prints, never a fixed example.
|
|
54
|
+
- Carrier limits are a capability check: `CarrierCapabilities` and
|
|
55
|
+
`assertCapability` in `src/browser/types.ts`, resolved per task by
|
|
56
|
+
`carrierCapabilities()` in `src/tool-browser/state.ts`. A refusal is a
|
|
57
|
+
`BROWSER_CARRIER_CAPABILITY_UNAVAILABLE` `BrowserError` that names the carrier to
|
|
58
|
+
switch to.
|
|
59
|
+
- Still open: tool descriptions and result annotations are English literals, and
|
|
60
|
+
settings/open-request/reference endpoint strings should import their canonical
|
|
61
|
+
contract rather than duplicate paths.
|
|
62
|
+
|
|
63
|
+
### Client bundle
|
|
64
|
+
|
|
65
|
+
The root `client.js` snapshot is gone. Client tests read the built
|
|
66
|
+
`dist/client.cjs` through `tests/helpers/client-build.mjs`, so they exercise what
|
|
67
|
+
DSH loads; run `node scripts/build.mjs` first.
|
|
68
|
+
|
|
69
|
+
### Static guard
|
|
70
|
+
|
|
71
|
+
`tests/no-hardcoding-guard.test.mjs` rejects drive-letter paths, CSS Modules class
|
|
72
|
+
names and DSH version branches in shipped code. Its allowlist holds exact lines
|
|
73
|
+
only: the DSH 0.2.2-rc.3 tab-strip fallback (`LEGACY_TAB_STRIP_SELECTOR` in the
|
|
74
|
+
settings panel, and the same lookup in the deployed desktop bridge). Every shell
|
|
75
|
+
with `data-sidebar-right-session` markers takes the marker path first. Host-patch
|
|
76
|
+
specs match exact versions as data, which the guard does not flag.
|
|
57
77
|
|
|
58
78
|
## Windows launcher regression
|
|
59
79
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# 开放 issue 验收清单(2026-11-28)
|
|
2
|
+
|
|
3
|
+
状态分三类:**已修**(有测试且 CI 绿)、**已防护/已埋诊断**(改动已进主分支,但根因仍要一份读数才能收口)、**未动**。
|
|
4
|
+
|
|
5
|
+
| # | 症状 | 已改什么 | 证据 | 还差什么 | 读到之后改哪里 |
|
|
6
|
+
|---|---|---|---|---|---|
|
|
7
|
+
| #142 | 桥接恢复后设置页仍常驻「桥接维护失败」 | 桥接 `installed` 且 `running` 时不再渲染终态失败(诊断折叠里保留) | `client-panel` 138/138;`70f294f` | — | — |
|
|
8
|
+
| #126 | 唯一还原入口是「卸载并重装」(revert 完又装) | 宿主维护任务接受 `uninstall`(revert 即停)+ 设置页「仅移除桥接」按钮 | `automatic-maintenance`、`client-panel` 154/154;`2f164b7` | — | — |
|
|
9
|
+
| #131 | 0.5.8 → 1.0.1 更新失败 | `deploy-local --replace`:旧目录改名为 `<target>.backup-<时间戳>`;Junction 安装拒绝替换并提示 | `deploy-manifest` 5/5;`f2510c6`;`docs/development.md`「升级 / 替换已有安装」 | 真实失败现场的原始报错(判断是目录残留还是 npm 解析) | 若是 npm 解析失败,补迁移段与错误提示 |
|
|
10
|
+
| #127 | 多会话交替渲染 dock 触发 React #185 | 发布去重:快照未变化不再 `store.set`(`sameFrameState`) | `frame-state` 3/3;`fix(dock)` 提交 | 复现确认:两会话交替渲染后是否仍出现 `Maximum update depth exceeded` | 若仍复现,按 issue 里的 `publish` 栈改 store 订阅 |
|
|
11
|
+
| #132 | 双注册带走客户端注册;关 Edge 弹 about:blank | ① 重复注册按上下文拒绝(`apply-guard`);② `watchClientVersion` / `applySettingsSection` 各自隔离 | `apply-guard` 2/2、`frame-state` 3/3;`fix(client)` 提交 | 两次 `__ModuleLoader__.load` 的栈与注册 id(第二份来自哪) | 若是同包装两遍 → 安装期去重;若是宿主解析两次 → 宿主侧 |
|
|
12
|
+
| #59 | Desktop 上 `@deepseek-ai/*` 解析不到,四入口不激活 | 用户机器的诊断区**没有**「未解析 peer」行 → 该安装 peer 解析正常,问题不在这个环境 | runtime status 逐条解析 6 个 host peer,诊断区列出未解析项与错误原文;已证伪"发布清单带 `workspace:^`"(npm 上是真实范围) | `runtime-status` 165/165;`feat(diagnostics)` 提交 | 诊断区里那行未解析 peer 文本 | 若是应用 node_modules 布局问题 → 插件侧改用宿主注入的依赖解析 |
|
|
13
|
+
| #140 | Edge builtin 截图 189×960,页面实际 1029×768 | **本次复现并修复**:本机 channel=edge 下截图 231×960 而页面 1254×707(同一文档,洋红背景可见)。原生 capture 描述的是"视图"而非页面布局;现在长宽比与 `Page.getLayoutMetrics` 视口不符时改用 CDP 视口 clip 重截 | `screenshot-geometry` 3/3、`layout-metrics` 3/3、`preview-read-only` 通过 | 宿主半需重启才生效 | 重启后若仍有偏差,看 `Page.getLayoutMetrics` 的 css 值 |
|
|
14
|
+
| #106 | Web 端选本机 Chrome 仍走侧栏 | 用户机器诊断显示 `will drive the installed edge` / `will drive the installed chrome`,且未出现「using only the selected DSH sidebar」→ 该环境采纳正常;配置「浏览器扩展」时显示当前载体 CDP 属既定降级 | `adopt()` 记录最近 8 条决策 reason,随状态返回并在诊断区列出 | `runtime-status` 165/165;`feat(diagnostics)` 提交 | 诊断区最后一条 reason 序列 | 末条是「not installed」→ 修检测;末条是「using only the selected DSH sidebar」→ 修 adopt 覆盖顺序 |
|
|
15
|
+
| #119 | 「绝不自动解验证码」的前提 | 不改:产品红线 | — | — | — |
|
|
16
|
+
|
|
17
|
+
## 已修(可直接关闭)
|
|
18
|
+
|
|
19
|
+
- **#142**、**#126**、**#131**。
|
|
20
|
+
- 建议在 PR 合并后关闭,并在关闭评论里附上对应提交与测试名。
|
|
21
|
+
|
|
22
|
+
## 已防护/已埋诊断(需要一份现场读数才能关闭)
|
|
23
|
+
|
|
24
|
+
- **#127**(去重已上)、**#132**(拒绝重复注册 + 隔离已上)、**#59**(诊断已上)、**#140**(读数入口已上)、**#106**(采纳历史已上)。
|
|
25
|
+
|
|
26
|
+
这五条的共同点:修复动作取决于"现场到底发生了什么",而插件现在能自己报告这件事。用户复现后把对应那一行发出来,就能直接定位到要改的函数。
|
package/docs/limitations.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## 宿主与安装
|
|
4
4
|
|
|
5
|
+
- **DSH 版本要求:** `1.0.x` 要求 DSH **`>=0.2.2-rc.3 <0.3.0`**(CI 持续验证 `0.2.2-rc.3`、`0.2.2-rc.5` 与 `0.2.3-alpha.2`)。仍内置 `0.2.2-rc.1` 的桌面端(如 `dataelement/dsh-desktop` 0.14.0)请待桌面端升级底座,或暂留在 `0.5.8`。
|
|
5
6
|
- **Desktop:** Windows 和 macOS 提供设置内桥接维护。可用功能取决于宿主公开的接口及桥接状态。宿主补丁按 DSH **0.2.2-rc.3 / rc.5** 的受支持构建校验,不承诺同版本号的任意产物都能应用;rc.5 Desktop 的补丁基线来自源码构建,不代表已验证所有分发包。遇到无法识别的文件、备份或冲突修改时会拒绝,而不是强行安装。
|
|
6
7
|
- **Web:** 有手动浏览和引用,没有 Desktop CDP、原生视图及 opener 语义。Web 宿主补丁不把 iframe 升级成原生浏览器。
|
|
7
8
|
- **无独立回退:** 默认和旧的 `bundled` / `auto` 值都只使用侧栏。不存在自动下载 Electron 或自动选择外部浏览器的路径。
|
|
@@ -10,9 +11,11 @@
|
|
|
10
11
|
|
|
11
12
|
## Web 隔离与站点兼容性
|
|
12
13
|
|
|
13
|
-
网页和嵌套 iframe
|
|
14
|
+
网页和嵌套 iframe 由代理承载,站点 Cookie 由插件保管,不读取 DSH 应用自己的凭据。**但在 DSH 0.2.3 上网页与 DSH 同源**:宿主的 Host 围栏拒绝一切带 `Origin: null` 的请求,而沙箱化的隔离来源(opaque origin)取图片、样式、脚本时正是发这个值——实测整页图片与样式全部 403,页面因此丢格式、丢图。给 guest 同源权限是当前唯一能让页面正常渲染的方式,所以**放进侧栏的网页要当作可信站点**:它和应用同源,能触达同源存储与接口。要恢复真正隔离,需要宿主侧对这条 guest 路由放行 `Origin: null`,插件才能退回隔离来源。
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
依赖跨窗口登录、worker 或其它受限能力的页面仍可能需要 Desktop 原生侧栏或本机浏览器。
|
|
17
|
+
|
|
18
|
+
嵌套文档仍受响应沙箱约束。由于同源祖先无法与 `frame-ancestors` 的语义区分,guest 路由不使用 `frame-ancestors` 来禁止所有外部嵌入;隔离边界不是防点击劫持保证。
|
|
16
19
|
|
|
17
20
|
## 登录态与接管
|
|
18
21
|
|
|
@@ -20,6 +23,7 @@
|
|
|
20
23
|
- 本机 Chrome / Edge 的独立配置不等于用户的个人配置。只有可用的个人浏览器扩展可以复用后者;回退的 CDP 会话没有个人浏览器的登录态。
|
|
21
24
|
- 持久会话不是 `dsh_browser_auth` 的导入/导出;该工具还受独立的读写权限和当前站点范围限制。URL 不明时拒绝导出,不扩大范围。
|
|
22
25
|
- CAPTCHA、滑块、登录和其它敏感确认由人工接管。插件不会绕过站点验证或重新提交敏感动作。
|
|
26
|
+
- 拦截识别基于页面特征,尽力而为:未识别不代表没有拦截。`dsh_browser_open` 只对拒绝访问类(403/429、「Access denied」)暂停后在新会话中重试一次;人工验证交给人工接管,IP/网络封锁(如数据中心 IP 被拒)是运行环境的限制,不重试也不绕过,改用结果里列出的备用公开来源(站点 API、搜索结果、存档)。新会话不清除浏览器配置中的 Cookie。
|
|
23
27
|
|
|
24
28
|
## 截图
|
|
25
29
|
|
package/docs/pr64-maintenance.md
CHANGED
|
@@ -8,7 +8,7 @@ Preflight records undeclared nested dependencies in `automatic.json`. After Desk
|
|
|
8
8
|
|
|
9
9
|
Package operations and optional rollback reconciliation inherit DSH's network settings: they do not force offline mode or override fetch timeouts/retries. Both legacy `npm_config_*` and pnpm 11 `PNPM_CONFIG_*` prefixes disable scripts and automatic peer installation. Each CLI call has a five-minute bound and attempts to terminate its process tree on timeout. Unrelated top-level entry removals or retargeting fail the transaction rather than silently accepting pruning. Recovery restart is attempted even when process termination cannot be fully verified, with that uncertainty retained in the failure report.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Only the package-manager children this plugin starts get `ELECTRON_NO_ASAR=1`, in their own environment. The plugin never writes it into the host's `process.env`: every later child of an ASAR-packaged host (DSH Tauri's subprocess Job runner, for one) would inherit it and fail to load its own entry from the archive (issue #71). A packed cold CLI must first import from `app.asar` with archive support enabled, then passes no-ASAR mode to its pnpm child. Maintenance itself discovers the packed CLI through raw archive reads.
|
|
12
12
|
|
|
13
13
|
## Sidebar tool readiness
|
|
14
14
|
|
package/docs/tool-reference.md
CHANGED
|
@@ -38,7 +38,7 @@ const [content, match] = await Promise.all([
|
|
|
38
38
|
print({ content, match })
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
`tools.dsh_browser_<name>(args)` 返回该工具的 JSON
|
|
41
|
+
`tools.dsh_browser_<name>(args)` 返回该工具的 JSON 结果。它和 `click`、`goto_url` 等快捷函数失败时都抛出 `ToolCallError`,带 `toolName` 与错误代码 `code`。互不依赖的只读调用最多 10 个并行;改变页面状态的调用按发出顺序逐个执行,之后的调用等它完成。单元超时或被取消时,已打印的输出照常返回,并附上本单元已发出的调用及其结果(`ok`、`error` 或 `interrupted`);被中断的动作可能已经生效,重试前先核对页面。也可用 `await help()` 查看 `goto_url`、`js`、`scroll(dy)` / `scroll(x, y, dy)` 等快捷函数。同一权限、接管阻断和会话约束适用;代码工具不会替你取得 Web guest 的 CDP 能力。
|
|
42
42
|
|
|
43
43
|
## 请求人工接管
|
|
44
44
|
|
package/docs/user-guide.md
CHANGED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# v1.1.0 任务单:Browser Use 增强(隐藏数据源发现 + 真批处理与条件等待)
|
|
2
|
+
|
|
3
|
+
目标:放大 `dsh_browser_code` REPL 在数据发现和批量执行上的优势,减少“一步一个 cell”和盲目 `sleep()`,并与已完成的 `checkpoint()` 形成闭环。
|
|
4
|
+
|
|
5
|
+
> **命名约定**:下文出现的方法名与参数名仅作语义示意,**最终命名与签名请由实施者结合现有 `code-worker.ts` / `page-probe.ts` 的命名风格统一决定**,保持全仓一致即可。
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 一、隐藏数据源发现(Page Probe + REPL Helper)
|
|
10
|
+
|
|
11
|
+
### 1. 探针侧改造(`src/tool-browser/page-probe.ts`,同步递增 `PROBE_VERSION`)
|
|
12
|
+
|
|
13
|
+
- **轻量 JSON 响应采样**:在现有 `fetch` / `XHR` 钩子中,仅对 `2xx/3xx` 且 `content-type` 含 `json`(或 URL 含 `.json`)的响应做采样。
|
|
14
|
+
- **硬保护**:严格跳过 `text/event-stream` 及声明超过 `2MB` 的响应;对无 `content-length` 或分块传输的响应,读取流时做硬字节截断(例如读取上限后立即 `reader.cancel()`)并加短超时保护,防止长连接或超大响应阻塞/撑爆内存。
|
|
15
|
+
- **只存紧凑 schema 摘要**(不存全文),例如:`array(24) [{city, country, address, phone}]` 或 `object {total: 241, items: array(24)}`。
|
|
16
|
+
- **新增数据源扫描方法**(总输出控制在约 1–2KB 以内),一次返回 4 类线索:
|
|
17
|
+
1. **内嵌状态脚本**:扫描 `#__NEXT_DATA__`、`#__NUXT_DATA__`、`window.__INITIAL_STATE__`、`window.__APOLLO_STATE__` 及 `<script type="application/json">` / `application/ld+json`,返回节点 id / 变量名、字节数、顶层 keys 及主要数组路径。
|
|
18
|
+
2. **已拦截的 JSON API**:列出 `method`、`url`、`status` 及 schema 摘要。
|
|
19
|
+
3. **Resource Timing 静态/首屏数据资源**:扫描 `performance.getEntriesByType('resource')`,筛出 `.json`、`/api/`、`graphql`、`locations`、`stores`、`search` 等高价值 URL(补齐探针注入前首屏已发完请求的盲区)。
|
|
20
|
+
4. **页面声明端点**:扫描 `<link rel="preload" as="fetch">` 及常见 `data-api` / `data-endpoint` 属性。
|
|
21
|
+
|
|
22
|
+
### 2. REPL 侧暴露两个 Helper(`src/tool-browser/code-worker.ts`)
|
|
23
|
+
|
|
24
|
+
- **数据源巡检 Helper**(如 `inspect_data_sources()`):调用上述探针方法并返回紧凑可读的列表/表格。
|
|
25
|
+
- **同源 JSON 拉取 Helper**(如 `fetch_json(url, init?)`):在页面上下文带同源 Cookie 发 `fetch`,自动校验 `res.ok`、解析 JSON,非 2xx 时抛出带状态码和前 200 字符响应体的清晰错误。
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 二、真批处理与条件等待(替换盲目 `sleep()`)
|
|
30
|
+
|
|
31
|
+
### 1. 补齐确定性条件等待 Helper(`code-worker.ts`)
|
|
32
|
+
|
|
33
|
+
- **表达式轮询等待**(如 `wait_until(jsExpr, opts)`):页面内轮询表达式直到 truthy,默认 ~200ms 间隔,超时返回最后一次求值结果便于排错。
|
|
34
|
+
- **文本出现 / 消失等待**(如 `wait_for_text` / `wait_for_gone`):复用探针文本检测能力,暴露为 REPL 一等函数。
|
|
35
|
+
- **网络响应等待**(如 `wait_for_response`):支持“先记 cursor → 执行触发动作 → 等匹配响应”的无竞态模式,复用现有 `networkCursor` 机制。
|
|
36
|
+
- **新标签页等待**(如 `wait_for_new_tab(triggerFn?, opts)`):记录当前 tab 集合 → 执行触发动作 → 轮询并返回新出现的 tab handle。
|
|
37
|
+
|
|
38
|
+
### 2. 对固定 `sleep()` 做温和纠偏(不禁用)
|
|
39
|
+
|
|
40
|
+
- 保留 `sleep(ms)`,单次上限卡在 10s。
|
|
41
|
+
- 若同一任务中连续 2 次及以上调用 `sleep()`,在返回值中附带一句轻量提示,引导改用条件等待原语。
|
|
42
|
+
|
|
43
|
+
### 3. 动作后附带轻量状态回执
|
|
44
|
+
|
|
45
|
+
- 为 `click` / `type` / `fill` / `key` / `select` 返回值附加极简结构化变更摘要(如 `{ urlChanged, url, title, activeTag, newAlerts }`),让模型在同一个 cell 内就能判断动作是否生效并继续后续步骤,不必被迫结束 cell 再调 `snapshot()`。
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 三、提示词与使用范例更新(`CORE_PROMPT` / `SKILL.md`)
|
|
50
|
+
|
|
51
|
+
1. **数据源优先起手式**:明确引导——抓取多条列表、门店目录、多页数据或懒加载内容前,先调用数据源巡检 Helper,有现成 JSON/API 优先批量拉取,没有再翻 DOM。
|
|
52
|
+
2. **补充 2 个极短(<10 行)的真批处理范例**:
|
|
53
|
+
- 范例 A(单页表单/筛选闭环):单 cell 内串行 `fill → click → 条件等待 → js() 提取 → print()`。
|
|
54
|
+
- 范例 B(多页/批量拉取闭环):单 cell 内循环翻页或限流批量拉取 JSON → 分批调用 `checkpoint()` 落盘 → 打印汇总。
|
|
55
|
+
3. **写清批处理边界**:确定性高的步骤合并进一个 cell;首次进入陌生站点或可能遇到登录墙/弹窗的探索步骤保持短 cell,避免盲猜多步点击。
|
|
56
|
+
4. **交付前完整性自检**:引导在收尾 cell 中用 JS 统计并 `print()` 总条数、去重数、各必填字段缺失数与来源 URL,在交卷前暴露漏项并留下轨迹证据。
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## 四、验收与测试要求
|
|
61
|
+
|
|
62
|
+
- 补齐单测/集成测试:
|
|
63
|
+
1. 探针 JSON 采样(含跳过 SSE、超大响应及分块流字节截断、不阻塞原请求)与 Resource Timing 首屏 JSON 发现;
|
|
64
|
+
2. 新增条件等待原语(含超时信息返回)、新标签页等待及连续 `sleep()` 提示;
|
|
65
|
+
3. 动作后轻量状态回执(URL 变化、新 alert 捕获)。
|
|
66
|
+
- 全量测试、`tsc --noEmit`、`pnpm build` 及 CI 双版本矩阵全部通过。
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# v1.1.0 任务单:硬编码清零 + 兼容性架构与 DSH `v0.2.3-alpha.2` 适配
|
|
2
|
+
|
|
3
|
+
基于当前 `master`(已完成 `#74` `tool-browser` 与 `#76` `provider` 拆分),请按顺序拆分为 **2 个独立 PR** 完成以下改造。每个 PR 均需通过全量测试、`tsc --noEmit`、`pnpm build` 及 `npm pack --dry-run`。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 硬性红线(两个 PR 均须遵守)
|
|
8
|
+
|
|
9
|
+
1. **禁止硬编码个人路径、盘符或端口**:严禁保留类似 `D:/dsh-home/...`、`C:\Users\...` 或写死的 `3080` / `9222` 端口兜底。
|
|
10
|
+
2. **禁止用 DSH 版本号字符串做 `>=` 分支判断**:官方为 `0.2.3-alpha.2`,社区壳为 `0.14.0`,版本号不可比;一律改用运行时特性探测。
|
|
11
|
+
3. **禁止对第三方桌面壳(如 `dataelement/dsh-desktop`)写 `app.asar` 字节补丁**:第三方壳只做识别与友好降级引导,绝不强改其宿主文件。
|
|
12
|
+
4. **保持抽象轻量**:能力契约与特性探测模块总代码量保持精简直观,不要过度套工厂或重型多层适配器。
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## PR 1:硬编码清零 + 静态守卫 + 载体能力契约
|
|
17
|
+
|
|
18
|
+
### 1. 清零 `docs/hardcoding-audit.md` 遗留硬编码
|
|
19
|
+
|
|
20
|
+
- **`src/tool-browser/state.ts`**:删除 `readSurface()` 中硬编码的 `'D:/dsh-home/dsh-builtin-browser-host/settings.json'`,统一只通过 `settingsPath()` / `SettingsStore` 读取(并视情况接入 Cordis 配置同步)。
|
|
21
|
+
- **`src/tool-browser/*`**:
|
|
22
|
+
- 将内联的默认超时、wait 预留/下限、`MAX_FILL_FIELDS` 以及 settings / open-request / reference 路由路径统一收口到 `assets/browser-policy.mjs` 导入,避免多处重复定义。
|
|
23
|
+
- 检查工具描述中的固定示例端口(`127.0.0.1:3080`),改为泛化占位表述(如 `127.0.0.1:<port>`)并与 `DSH_WEB_URL` 守卫逻辑对齐。
|
|
24
|
+
- **根目录 `client.js` 核查**:确认该文件是否为历史遗留产物;若不再被打包或外部引用则移除,避免残留旧版 `[class*=_tabStrip]` 代码。
|
|
25
|
+
- 同步更新 `docs/hardcoding-audit.md`,标记上述项已清零。
|
|
26
|
+
|
|
27
|
+
### 2. 引入轻量载体能力契约:`src/browser/capabilities.ts`
|
|
28
|
+
|
|
29
|
+
- 定义 `CarrierCapabilities`:
|
|
30
|
+
```ts
|
|
31
|
+
export interface CarrierCapabilities {
|
|
32
|
+
readonly cdp: boolean
|
|
33
|
+
readonly liveSnapshot: boolean
|
|
34
|
+
readonly interaction: boolean
|
|
35
|
+
readonly screenshot: boolean
|
|
36
|
+
readonly nativeTabs: boolean
|
|
37
|
+
readonly backgroundRender: boolean
|
|
38
|
+
readonly takeover: boolean
|
|
39
|
+
readonly referenceCapture: boolean
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
- 提供统一门禁 `assertCapability(capabilities, required, context)`,替代散落在 `tool-browser/*` 各处的 `panelUrlByTask` 零散判断与重复报错文案。
|
|
43
|
+
- 缺失能力时抛出带结构化错误码(对齐 DSH `0.2.3-alpha.2` 工具错误规范)与可执行切换建议的错误。
|
|
44
|
+
|
|
45
|
+
### 3. 新增源码静态守卫测试:`tests/no-hardcoding-guard.test.mjs`
|
|
46
|
+
|
|
47
|
+
- 扫描 `src/` 与 `desktop-bridge/`(排除测试夹具与显式白名单注释):
|
|
48
|
+
- 拦截个人盘符绝对路径(如 `[A-Za-z]:/dsh-home`、`[A-Za-z]:\\Users\\`);
|
|
49
|
+
- 拦截 CSS Modules 类名子串硬编码(如 `_tabStrip`、`_tabHost`、`acoR2W_`);
|
|
50
|
+
- 拦截对 `dshVersion` / 宿主版本号做字符串比较的分支。
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## PR 2:桌面壳结构化识别 + DSH `v0.2.3-alpha.2` 适配
|
|
55
|
+
|
|
56
|
+
### 1. 宿主与外壳结构化识别(解决 #62 困惑,但不硬 patch 第三方壳)
|
|
57
|
+
|
|
58
|
+
- 改造 `desktop-bridge/desktop-identity.json`、`desktop-bridge/install.mjs` 与 `src/browser-electron/bridge-status.ts`(可收口至 `src/browser-electron/host-identity.ts`),输出结构化 `DesktopShellReport`:
|
|
59
|
+
- `kind`: `'official-supported' | 'official-unsupported' | 'third-party-shell' | 'none'`
|
|
60
|
+
- `patchable: boolean`、`reason: string`、`recommendedCarrier: 'sidebar' | 'chrome' | 'edge'`
|
|
61
|
+
- **明确区分第三方壳**:当探测到 `name: "dsh-desktop"` 且入口为 `out/main/index.js`(如 `dataelement/dsh-desktop` 0.13.2+ / 0.14.0)时,判定为 `third-party-shell` 且 `patchable: false`,**禁止报 `missing lib/main.js`**;在设置页隐藏“安装/修复桥接”按钮,明确提示“检测到第三方 DSH Desktop 壳,不支持宿主补丁,请切换至本机 Chrome / Edge 载体”。
|
|
62
|
+
- 保留并验证多级路径探测顺序:`DSH_DESKTOP_PATH` / `DSH_DESKTOP_APP` → 运行中进程路径 → Windows 卸载注册表 → 平台约定目录。
|
|
63
|
+
|
|
64
|
+
### 2. 彻底移除 CSS Modules 类名依赖
|
|
65
|
+
|
|
66
|
+
- 清理 `src/client/settings/panel.ts`、`desktop-bridge/plugin-browser-bridge.js` 及对应测试中对 `[class*=_tabStrip]`、`[class*=_tabHost]` 的依赖。
|
|
67
|
+
- 全面改用稳定的 `data-*` 属性(如 `[data-sidebar-right-session]`)和官方注入的 UI 服务 / 宿主协议,确保在 `v0.2.3-alpha.2` 新 CSS Modules 类名格式下正常工作。
|
|
68
|
+
|
|
69
|
+
### 3. 运行时特性探测与 DSH `v0.2.3-alpha.2` 对齐
|
|
70
|
+
|
|
71
|
+
- 新增 `src/compat/host-features.ts`,集中探测运行时能力(不查版本号):
|
|
72
|
+
- `ctx.tools.register` 是否支持 `{ when }` 条件注册;
|
|
73
|
+
- `ctx.get('ptcRuntime')` 存在性(验证 `v0.2.3-alpha.2` 新版 Node PTC `run_code` 下调用 `dsh_browser_*` 核心工具与截图附件的兼容性);
|
|
74
|
+
- Cordis `4.0.0-rc.12` 前后端配置同步能力与 `cordis.patch.yml` / `inject` 校验;
|
|
75
|
+
- 渲染端 `window.dshDesktop?.protocolVersion >= 1` 窄桥探测。
|
|
76
|
+
- 核对 `@deepseek-ai/*` 导入路径(对齐 `0.2.3-alpha.2` 规范化导出:仅从包根或 `/types` 导入;按需核对 `dsh-client-ui-session-status` 与客户端样式挂载结构)。
|
|
77
|
+
- 核对 `dsh-host-patch` 在 `dsh-v0.2.3-alpha.2` 构建下的锚点匹配:如不匹配则标记为 `official-unsupported`(不强行改写),并在 PR 说明中列出需要补录的新锚点清单。
|
|
78
|
+
- 同步核对 `package.json` 的 Node 引擎说明(`alpha.2` 要求 Node `>=24.22.3` / `>=26.13.1`)与 CI 运行环境。
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 验收要求
|
|
83
|
+
|
|
84
|
+
- 每个 PR 单独提交并附带回归测试(覆盖:静态硬编码守卫、第三方壳 `0.14.0` 模拟布局识别、无 `_tabStrip` 类名下的侧栏定位、`CarrierCapabilities` 缺失报错)。
|
|
85
|
+
- 如发现 `v0.2.3-alpha.2` 存在无法单靠静态类型确认的运行时差异(尤其是客户端样式挂载与侧栏 UI),请在 PR 描述中明确列出需真机冒烟的检查项。
|
|
Binary file
|
|
Binary file
|
package/dsh-host-patch/README.md
CHANGED
|
@@ -10,6 +10,10 @@ All source patches are losslessly compressed. `sources/series.json` pins each re
|
|
|
10
10
|
|
|
11
11
|
Regenerate directly from the pinned DSH Git histories with `DSH_SOURCE_ROOT=<git-checkout> node tools/generate-host-patch-sources.mjs`. Run `node tests/run.mjs tests/host-patch-source-series.test.mjs` to check every complete series using `git apply --cached --check` and compare its final tree to the source-build tree. Compressed test fixtures retain each complete base index plus the original blobs touched by the patches; untouched blobs need not be duplicated to reproduce their exact Git tree identities. These fixtures require no network or external DSH checkout.
|
|
12
12
|
|
|
13
|
+
## DSH Tauri
|
|
14
|
+
|
|
15
|
+
DSH Tauri (`dsh-tauri/deepseek-harness-desktop`) runs its own electron-rs main process, not DeepSeek Harness Desktop's `lib/main.js`, so none of the rc.3/rc.5 targets exist there. Its sidebar guests used an in-memory `electron-browser-<uuid>` partition and lost every login at restart. `tauri.json` patches `runtime/<platform>-<arch>/runtime/browser.cjs`, a runtime directory identified by its `electron-rs.json` identifier `dsh-tauri`; each target is selected by the sha256 of the pristine file (v0.33.0), since the runtime carries no version. The patch gives every sidebar guest one `persist:dsh-sidebar-browser-<hash>` partition per DSH home (`DSH_HOME`, else Electron's user-data directory), as rc.5 does, and checkpoints the unpartitioned session cookies Chromium drops at exit (`dsh-sidebar-session-cookies.json` in that partition), restoring them before the next guest is leased. The embedded code is `tauri/sidebar-session.cjs`; regenerate the spec with `node tools/generate-tauri-host-patch.mjs` (a test fails when it is stale). Apply and restore it from the plugin settings while DSH Tauri runs, then restart DSH Tauri; a Tauri update replaces the runtime and needs the patch again.
|
|
16
|
+
|
|
13
17
|
## Standalone CLI (including Web)
|
|
14
18
|
|
|
15
19
|
Run the dependency-free applier using a package's real directory, not the profile directory:
|
package/dsh-host-patch/apply.mjs
CHANGED
|
@@ -5,11 +5,12 @@ import { fileURLToPath } from 'node:url'
|
|
|
5
5
|
import { gunzipSync } from 'node:zlib'
|
|
6
6
|
import { stripLegacyBridge } from './legacy-bridge.mjs'
|
|
7
7
|
|
|
8
|
-
const specs = ['rc3', 'rc5'].map(name => JSON.parse(fs.readFileSync(new URL(`./${name}.json`, import.meta.url), 'utf8')))
|
|
8
|
+
const specs = ['rc3', 'rc5', 'tauri', 'v023-alpha2'].map(name => JSON.parse(fs.readFileSync(new URL(`./${name}.json`, import.meta.url), 'utf8')))
|
|
9
9
|
const previousSpecs = ['rc3', 'rc5'].flatMap(name => [8, 7, 6, 5, 4, 3, 2, 1].map(revision =>
|
|
10
10
|
JSON.parse(revision >= 3
|
|
11
11
|
? gunzipSync(fs.readFileSync(new URL(`./${name}-revision${revision}.json.gz`, import.meta.url))).toString('utf8')
|
|
12
12
|
: fs.readFileSync(new URL(`./${name}-revision${revision}.json`, import.meta.url), 'utf8'))))
|
|
13
|
+
.concat(JSON.parse(fs.readFileSync(new URL('./tauri-revision1.json', import.meta.url), 'utf8')))
|
|
13
14
|
const suffix = '.before-dsh-host-patch'
|
|
14
15
|
const digest = value => createHash('sha256').update(value).digest('hex')
|
|
15
16
|
|
|
@@ -54,20 +55,53 @@ function patchSource(text, target, path, io) {
|
|
|
54
55
|
return pristine
|
|
55
56
|
}
|
|
56
57
|
|
|
58
|
+
function unsupported(message) {
|
|
59
|
+
const error = new Error(message)
|
|
60
|
+
error.status = 'unsupported version'
|
|
61
|
+
return error
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* An electron-rs runtime directory (DSH Tauri) is identified by its electron-rs.json identifier and
|
|
66
|
+
* each target by the sha256 of its pristine bytes, since the runtime files carry no version.
|
|
67
|
+
*/
|
|
68
|
+
function electronRsTargets(root, io) {
|
|
69
|
+
const metadata = JSON.parse(io.readFileSync(join(root, 'electron-rs.json'), 'utf8'))
|
|
70
|
+
const spec = specs.find(item => item.host === 'electron-rs' && item.identifiers.includes(metadata.identifier))
|
|
71
|
+
if (!spec) throw new Error(`unsupported electron-rs runtime: ${String(metadata.identifier)}`)
|
|
72
|
+
const files = [...new Set(spec.targets.map(item => item.file))]
|
|
73
|
+
const targets = files.map(file => {
|
|
74
|
+
const path = join(root, file)
|
|
75
|
+
const backup = path + suffix
|
|
76
|
+
const pristine = io.existsSync(backup) ? io.readFileSync(backup, 'utf8') : io.existsSync(path) ? io.readFileSync(path, 'utf8') : undefined
|
|
77
|
+
const candidates = spec.targets.filter(item => item.file === file)
|
|
78
|
+
const target = pristine === undefined ? undefined
|
|
79
|
+
: candidates.find(item => item.sha256 === digest(pristine)) ?? candidates.find(item => pristine.includes(item.marker))
|
|
80
|
+
if (target === undefined) {
|
|
81
|
+
throw unsupported(`unsupported DSH Tauri runtime: ${file} ${pristine === undefined ? 'is missing' : `sha256 ${digest(pristine)}`} (supported releases: ${candidates.map(item => item.release).join(', ')})`)
|
|
82
|
+
}
|
|
83
|
+
return target
|
|
84
|
+
})
|
|
85
|
+
return { version: spec.version, targets, native: spec.native === true }
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function packageTargets(root, io) {
|
|
89
|
+
if (!io.existsSync(join(root, 'package.json')) && io.existsSync(join(root, 'electron-rs.json'))) return electronRsTargets(root, io)
|
|
90
|
+
const manifest = JSON.parse(io.readFileSync(join(root, 'package.json'), 'utf8'))
|
|
91
|
+
const packageSpecs = specs.filter(item => item.host === undefined)
|
|
92
|
+
const spec = packageSpecs.find(item => item.version === manifest.version)
|
|
93
|
+
if (!spec) throw unsupported(`unsupported DSH version: ${String(manifest.version)} (supported: ${packageSpecs.map(item => item.version).join(', ')})`)
|
|
94
|
+
const targets = spec.targets.filter(item => item.packageName === manifest.name)
|
|
95
|
+
if (targets.length === 0) throw new Error(`unsupported package: ${String(manifest.name)}`)
|
|
96
|
+
return { version: spec.version, targets, native: spec.native === true }
|
|
97
|
+
}
|
|
98
|
+
|
|
57
99
|
function plan(packages, restoring, io) {
|
|
58
100
|
const directories = typeof packages === 'string' ? [packages] : packages
|
|
59
101
|
if (!Array.isArray(directories) || directories.length === 0) throw new Error('at least one package directory is required')
|
|
60
102
|
const entries = directories.flatMap(directory => {
|
|
61
103
|
const root = io.realpathSync(directory)
|
|
62
|
-
const
|
|
63
|
-
const spec = specs.find(item => item.version === manifest.version)
|
|
64
|
-
if (!spec) {
|
|
65
|
-
const error = new Error(`unsupported DSH version: ${String(manifest.version)} (supported: ${specs.map(item => item.version).join(', ')})`)
|
|
66
|
-
error.status = 'unsupported version'
|
|
67
|
-
throw error
|
|
68
|
-
}
|
|
69
|
-
const targets = spec.targets.filter(item => item.packageName === manifest.name)
|
|
70
|
-
if (targets.length === 0) throw new Error(`unsupported package: ${String(manifest.name)}`)
|
|
104
|
+
const { version, targets } = packageTargets(root, io)
|
|
71
105
|
return targets.map(target => {
|
|
72
106
|
const path = join(root, target.file)
|
|
73
107
|
const real = io.realpathSync(path)
|
|
@@ -87,14 +121,14 @@ function plan(packages, restoring, io) {
|
|
|
87
121
|
if (restoring && original === undefined) throw new Error('no backup for this already patched host')
|
|
88
122
|
return { path, backup, text, output: restoring ? original : text, applied, held, mode: io.statSync(path).mode }
|
|
89
123
|
}
|
|
90
|
-
const previousTarget = previousSpecs.filter(item => item.version ===
|
|
124
|
+
const previousTarget = previousSpecs.filter(item => item.version === version).flatMap(item => item.targets)
|
|
91
125
|
.find(item => item.id === target.id && item.marker !== target.marker && text.includes(item.marker))
|
|
92
126
|
const previous = previousTarget !== undefined && text.includes(previousTarget.marker)
|
|
93
127
|
if (previous) {
|
|
94
128
|
if (original === undefined) throw new Error('no backup for the previous host patch revision')
|
|
95
129
|
if (patchText(patchSource(original, previousTarget, path, io), previousTarget) !== text) throw new Error('previous patch revision differs from its recorded backup; refusing to overwrite other edits')
|
|
96
130
|
return { path, backup, text, output: restoring ? original : patchText(patchSource(original, target, path, io), target),
|
|
97
|
-
applied: false, previous:
|
|
131
|
+
applied: false, previous: version === 'tauri' ? 'tauri' : 'electron', held, mode: io.statSync(path).mode }
|
|
98
132
|
}
|
|
99
133
|
if (restoring) {
|
|
100
134
|
if (original !== undefined && original !== text) throw new Error('file changed after restore or Desktop update')
|
|
@@ -115,12 +149,26 @@ function inspect(packages, restoring, io) {
|
|
|
115
149
|
try {
|
|
116
150
|
const entries = plan(packages, restoring, io)
|
|
117
151
|
return { status: entries.every(entry => entry.applied) ? 'applied' : 'absent',
|
|
118
|
-
...(entries.some(entry => entry.previous) ? { reason:
|
|
152
|
+
...(entries.some(entry => entry.previous) ? { reason: entries.some(entry => entry.previous === 'tauri')
|
|
153
|
+
? 'host patch revision 1; explicit bootstrap upgrade to revision 2 required'
|
|
154
|
+
: 'host patch revision 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8; explicit bootstrap upgrade to revision 9 required' } : {}), entries }
|
|
119
155
|
} catch (error) {
|
|
120
156
|
return { status: error.status ?? 'anchors mismatch', reason: String(error.message ?? error) }
|
|
121
157
|
}
|
|
122
158
|
}
|
|
123
159
|
|
|
160
|
+
/**
|
|
161
|
+
* The DSH line this install matched, when a spec matched. `0.2.3` already ships the native sidebar
|
|
162
|
+
* support the patch adds, so callers use this to decide whether the patch is worth offering at all.
|
|
163
|
+
* @param packages - the installed DSH directory.
|
|
164
|
+
* @param options - optional fs injection.
|
|
165
|
+
* @returns the matched spec version, or undefined when nothing matched.
|
|
166
|
+
*/
|
|
167
|
+
/** Whether this line still needs the patch: 0.2.3 ships the native support, so its spec says so. */
|
|
168
|
+
export function hostPatchNeeded(packages, options = {}) {
|
|
169
|
+
try { return packageTargets(packages, options.fs ?? fs).native !== true } catch { return true }
|
|
170
|
+
}
|
|
171
|
+
|
|
124
172
|
/** Read-only validation. A valid absent patch is ready to apply; a mismatch never writes. */
|
|
125
173
|
export function hostPatchStatus(packages, options = {}) {
|
|
126
174
|
const { entries, ...status } = inspect(packages, false, options.fs ?? fs)
|
|
Binary file
|
|
Binary file
|