dsh-builtin-browser 0.5.8 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +410 -1
- package/README.en.md +16 -64
- package/README.md +33 -64
- package/assets/browser-carriers.svg +20 -0
- package/assets/browser-extension-identity.d.mts +2 -0
- package/assets/browser-extension-identity.mjs +2 -0
- package/assets/browser-messages.d.mts +5 -0
- package/assets/browser-messages.mjs +64 -0
- package/assets/browser-panel-locales.d.mts +2 -0
- package/assets/browser-panel-locales.mjs +380 -0
- package/assets/browser-policy.d.mts +37 -0
- package/assets/browser-policy.mjs +37 -0
- package/assets/browser-products.d.mts +6 -0
- package/assets/browser-products.mjs +76 -0
- package/assets/screenshots/1-main.png +0 -0
- package/assets/screenshots/2-form-fill.png +0 -0
- package/assets/screenshots/3-challenge.png +0 -0
- package/browser-extension/constants.mjs +20 -0
- package/browser-extension/controller.mjs +293 -0
- package/browser-extension/locales.mjs +15 -0
- package/browser-extension/manifest.json +12 -0
- package/browser-extension/options.html +14 -0
- package/browser-extension/options.mjs +9 -0
- package/browser-extension/permission-guard.mjs +13 -0
- package/browser-extension/worker.mjs +74 -0
- package/cordis.patch.yml +23 -48
- package/desktop-bridge/desktop-discovery.d.mts +2 -0
- package/desktop-bridge/desktop-discovery.mjs +36 -0
- package/desktop-bridge/desktop-identity.json +17 -1
- package/desktop-bridge/desktop-processes.d.mts +1 -0
- package/desktop-bridge/desktop-processes.mjs +15 -0
- package/desktop-bridge/guest-proxy.mjs +109 -0
- package/desktop-bridge/install.mjs +197 -74
- package/desktop-bridge/main.mjs +11 -0
- package/desktop-bridge/maintenance-files.d.mts +8 -0
- package/desktop-bridge/maintenance-files.mjs +28 -0
- package/desktop-bridge/maintenance-progress.ps1 +2 -2
- package/desktop-bridge/native-guests.mjs +41 -0
- package/desktop-bridge/plugin-browser-bridge.js +618 -370
- package/desktop-bridge/profile-loader.mjs +26 -0
- package/dist/client.cjs +43167 -0
- package/dist/client.d.cts +516 -0
- package/dist/client.d.mts +516 -0
- package/dist/index.cjs +92 -0
- package/dist/index.d.mts +2960 -0
- package/dist/index.mjs +24 -0
- package/docs/HANDOVER-2026-11-15.md +178 -0
- package/docs/README.md +10 -19
- package/docs/architecture.md +17 -145
- package/docs/child-tabs.md +13 -0
- package/docs/desktop-acceptance.md +9 -0
- package/docs/development.md +88 -18
- package/docs/extension-browser.md +44 -0
- package/docs/hardcoding-audit.md +64 -0
- package/docs/limitations.md +23 -73
- package/docs/pr64-extension-status.md +46 -0
- package/docs/pr64-maintenance.md +25 -0
- package/docs/pr64-native-children.md +52 -0
- package/docs/pr64-native-views.md +60 -0
- package/docs/tool-reference.md +87 -11
- package/docs/user-guide.md +47 -255
- package/docs/why-browser.md +6 -39
- package/dsh-host-patch/README.md +60 -0
- package/dsh-host-patch/apply.mjs +194 -0
- package/dsh-host-patch/legacy-bridge.mjs +53 -0
- package/dsh-host-patch/rc3-revision1.json +90 -0
- package/dsh-host-patch/rc3-revision2.json +112 -0
- package/dsh-host-patch/rc3-revision3.json.gz +0 -0
- package/dsh-host-patch/rc3-revision4.json.gz +0 -0
- package/dsh-host-patch/rc3-revision5.json.gz +0 -0
- package/dsh-host-patch/rc3-revision6.json.gz +0 -0
- package/dsh-host-patch/rc3-revision7.json.gz +0 -0
- package/dsh-host-patch/rc3-revision8.json.gz +0 -0
- package/dsh-host-patch/rc3.json +148 -0
- package/dsh-host-patch/rc5-revision1.json +90 -0
- package/dsh-host-patch/rc5-revision2.json +112 -0
- package/dsh-host-patch/rc5-revision3.json.gz +0 -0
- package/dsh-host-patch/rc5-revision4.json.gz +0 -0
- package/dsh-host-patch/rc5-revision5.json.gz +0 -0
- package/dsh-host-patch/rc5-revision6.json.gz +0 -0
- package/dsh-host-patch/rc5-revision7.json.gz +0 -0
- package/dsh-host-patch/rc5-revision8.json.gz +0 -0
- package/dsh-host-patch/rc5.json +148 -0
- package/lib/bridge-compatibility.js +38 -0
- package/lib/browser/handles.js +78 -0
- package/lib/browser/runtime.js +155 -43
- package/lib/browser/takeover-target.js +24 -0
- package/lib/browser-electron/authenticated-route.js +23 -0
- package/lib/browser-electron/automatic-maintenance.js +394 -51
- package/lib/browser-electron/bridge-auto.js +2 -1
- package/lib/browser-electron/bridge-connection.js +8 -1
- package/lib/browser-electron/bridge-install.js +27 -2
- package/lib/browser-electron/bridge-maintenance.js +35 -10
- package/lib/browser-electron/bridge-status.js +98 -27
- package/lib/browser-electron/desktop-bridge-host.js +193 -560
- package/lib/browser-electron/desktop-identity.js +40 -2
- package/lib/browser-electron/document-readiness.js +34 -0
- package/lib/browser-electron/electron-provision.js +14 -44
- package/lib/browser-electron/entry.js +659 -252
- package/lib/browser-electron/extension-browser.js +234 -0
- package/lib/browser-electron/extension-setup.js +69 -0
- package/lib/browser-electron/guest-cookie-jar.LICENSE.txt +32 -0
- package/lib/browser-electron/guest-cookie-jar.js +10559 -0
- package/lib/browser-electron/guest-cookie-store.js +74 -0
- package/lib/browser-electron/guest-css-runtime.js +75 -0
- package/lib/browser-electron/guest-css.js +106 -0
- package/lib/browser-electron/guest-route.js +603 -0
- package/lib/browser-electron/guest-runtime.js +356 -0
- package/lib/browser-electron/guest-storage-runtime.js +52 -0
- package/lib/browser-electron/guest-storage.js +163 -0
- package/lib/browser-electron/history-store.js +2 -1
- package/lib/browser-electron/host-main.js +162 -7
- package/lib/browser-electron/host-patch-maintenance.js +141 -0
- package/lib/browser-electron/http-body.js +22 -0
- package/lib/browser-electron/maintenance-broker.js +35 -5
- package/lib/browser-electron/maintenance-lifecycle.js +7 -5
- package/lib/browser-electron/maintenance-route.js +9 -6
- package/lib/browser-electron/open-slot.js +47 -0
- package/lib/browser-electron/paths.js +4 -1
- package/lib/browser-electron/preferred-browser.js +144 -0
- package/lib/browser-electron/preview-route.js +11 -8
- package/lib/browser-electron/process-ownership.js +198 -0
- package/lib/browser-electron/profile-checkpoint.js +222 -0
- package/lib/browser-electron/profile-command.js +60 -0
- package/lib/browser-electron/profile-extension.js +126 -0
- package/lib/browser-electron/profile-lease.js +157 -0
- package/lib/browser-electron/profile-residue.js +61 -0
- package/lib/browser-electron/provider.js +719 -262
- package/lib/browser-electron/reference-route.js +635 -0
- package/lib/browser-electron/remote-host.js +12 -13
- package/lib/browser-electron/runtime-route.js +6 -5
- package/lib/browser-electron/runtime-status.js +30 -29
- package/lib/browser-electron/settings-store.js +10 -5
- package/lib/browser-electron/shortcuts-route.js +108 -0
- package/lib/browser-electron/sidebar-only-host.js +119 -18
- package/lib/browser-electron/startpage-shortcuts.js +172 -0
- package/lib/browser-electron/system-browser.js +352 -371
- package/lib/browser-electron/windows-system.js +2 -1
- package/lib/browser-reference/delivery.js +326 -0
- package/lib/browser-reference/entry.js +597 -0
- package/lib/browser-reference/export.js +298 -0
- package/lib/browser-reference/import.js +295 -0
- package/lib/browser-reference/page-script.js +1406 -0
- package/lib/browser-reference/service.js +1062 -0
- package/lib/browser-reference/store.js +177 -0
- package/lib/browser-reference/submission-receipts.js +139 -0
- package/lib/browser-reference/text-quote.js +167 -0
- package/lib/browser-reference/types.js +11 -0
- package/lib/browser-reference/visible.js +311 -0
- package/lib/browser-reference/web-sources.js +97 -0
- package/lib/index.js +10 -3
- package/lib/reference-owner.js +5 -0
- package/lib/reference-page.js +12 -0
- package/lib/reference-source.js +2 -0
- package/lib/reference-text.js +188 -0
- package/lib/startpage-settings.js +63 -0
- package/lib/startpage.js +44 -0
- package/lib/takeover-protocol.js +2 -0
- package/lib/tool-browser/code-tool.js +416 -0
- package/lib/tool-browser/code-worker.js +872 -0
- package/lib/tool-browser/index.js +940 -76
- package/lib/tool-browser/page-probe.js +3 -3
- package/lib/tool-browser/panel-page.js +95 -0
- package/lib/tool-browser/screenshot-image.js +51 -0
- package/lib/tool-browser/takeover.js +205 -0
- package/lib/types.js +1 -0
- package/lib/web-guest.js +26 -0
- package/native-host/client.d.mts +17 -0
- package/native-host/client.mjs +100 -0
- package/native-host/host.mjs +150 -0
- package/native-host/identity.d.mts +2 -0
- package/native-host/identity.mjs +1 -0
- package/native-host/install.mjs +168 -0
- package/native-host/protocol.mjs +75 -0
- package/package.json +80 -92
- package/scripts/build.mjs +66 -0
- package/scripts/bundle-host.mjs +28 -0
- package/scripts/fix-exports.mjs +50 -0
- package/scripts/install-electron.mjs +11 -26
- package/scripts/verify-exports.mjs +47 -0
- package/scripts/verify-preview-sdk.mjs +93 -0
- package/skills/dsh-builtin-browser/SKILL.md +56 -47
- package/skills/dsh-builtin-browser/references/batch.md +31 -1
- package/skills/dsh-debug-host/SKILL.md +56 -0
- package/skills/dsh-debug-self/SKILL.md +50 -0
- package/src/bridge-compatibility.ts +39 -0
- package/src/browser/handles.ts +89 -0
- package/src/browser/runtime.ts +146 -50
- package/src/browser/takeover-target.ts +36 -0
- package/src/browser/types.ts +19 -7
- package/src/browser-electron/authenticated-route.ts +29 -1
- package/src/browser-electron/automatic-maintenance.ts +368 -56
- package/src/browser-electron/bridge-auto.ts +5 -4
- package/src/browser-electron/bridge-connection.ts +20 -2
- package/src/browser-electron/bridge-endpoint.ts +3 -3
- package/src/browser-electron/bridge-install.ts +40 -4
- package/src/browser-electron/bridge-maintenance.ts +42 -14
- package/src/browser-electron/bridge-status.ts +94 -23
- package/src/browser-electron/desktop-bridge-host.ts +185 -585
- package/src/browser-electron/desktop-identity.ts +53 -2
- package/src/browser-electron/document-readiness.ts +45 -0
- package/src/browser-electron/electron-provision.ts +12 -45
- package/src/browser-electron/entry.ts +1299 -882
- package/src/browser-electron/ephemeral-profile.ts +1 -1
- package/src/browser-electron/extension-browser.ts +223 -0
- package/src/browser-electron/extension-setup.ts +67 -0
- package/src/browser-electron/guest-cookie-jar.ts +176 -0
- package/src/browser-electron/guest-cookie-store.ts +59 -0
- package/src/browser-electron/guest-css-runtime.ts +76 -0
- package/src/browser-electron/guest-css.ts +68 -0
- package/src/browser-electron/guest-route.ts +568 -0
- package/src/browser-electron/guest-runtime.ts +357 -0
- package/src/browser-electron/guest-storage-runtime.ts +54 -0
- package/src/browser-electron/guest-storage.ts +117 -0
- package/src/browser-electron/history-store.ts +5 -4
- package/src/browser-electron/host-main.ts +156 -11
- package/src/browser-electron/host-patch-maintenance.ts +112 -0
- package/src/browser-electron/http-body.ts +23 -0
- package/src/browser-electron/maintenance-broker.ts +29 -5
- package/src/browser-electron/maintenance-lifecycle.ts +14 -9
- package/src/browser-electron/maintenance-route.ts +17 -14
- package/src/browser-electron/missing-system-browser.ts +2 -2
- package/src/browser-electron/open-slot.ts +49 -0
- package/src/browser-electron/paths.ts +5 -1
- package/src/browser-electron/preferred-browser.ts +120 -0
- package/src/browser-electron/preview-route.ts +18 -11
- package/src/browser-electron/process-ownership.ts +168 -0
- package/src/browser-electron/profile-checkpoint.ts +187 -0
- package/src/browser-electron/profile-command.ts +46 -0
- package/src/browser-electron/profile-extension.ts +124 -0
- package/src/browser-electron/profile-lease.ts +115 -0
- package/src/browser-electron/profile-residue.ts +49 -0
- package/src/browser-electron/provider.ts +771 -289
- package/src/browser-electron/reference-route.ts +608 -0
- package/src/browser-electron/remote-host.ts +15 -15
- package/src/browser-electron/runtime-route.ts +11 -10
- package/src/browser-electron/runtime-status.ts +51 -32
- package/src/browser-electron/settings-store.ts +27 -7
- package/src/browser-electron/shortcuts-route.ts +112 -0
- package/src/browser-electron/sidebar-only-host.ts +118 -19
- package/src/browser-electron/startpage-shortcuts.ts +213 -0
- package/src/browser-electron/system-browser.ts +309 -338
- package/src/browser-electron/windows-system.ts +2 -1
- package/src/browser-reference/delivery.ts +384 -0
- package/src/browser-reference/entry.ts +631 -0
- package/src/browser-reference/export.ts +339 -0
- package/src/browser-reference/import.ts +303 -0
- package/src/browser-reference/page-script.ts +1537 -0
- package/src/browser-reference/service.ts +1315 -0
- package/src/browser-reference/store.ts +172 -0
- package/src/browser-reference/submission-receipts.ts +122 -0
- package/src/browser-reference/text-quote.ts +219 -0
- package/src/browser-reference/types.ts +195 -0
- package/src/browser-reference/visible.ts +367 -0
- package/src/browser-reference/web-sources.ts +103 -0
- package/src/client/browser/BrowserController.ts +693 -0
- package/src/client/browser/BrowserFrame.ts +78 -0
- package/src/client/browser/BrowserNavigation.ts +169 -0
- package/src/client/browser/BrowserPage.ts +23 -0
- package/src/client/browser/BrowserPersistence.ts +44 -0
- package/src/client/browser/IframeImpl.ts +176 -0
- package/src/client/browser/child-tabs.ts +14 -0
- package/src/client/browser/iframe-reference.ts +67 -0
- package/src/client/browser/initialization.ts +262 -0
- package/src/client/browser/omnibox.ts +243 -0
- package/src/client/browser/store.ts +38 -0
- package/src/client/browser/takeover-channel.ts +72 -0
- package/src/client/browser/url.ts +46 -0
- package/src/client/browser/web-reference-source.ts +52 -0
- package/src/client/css-modules.d.ts +4 -0
- package/src/client/definition.tsx +30 -0
- package/src/client/electron/ElectronWebViewImpl.ts +364 -0
- package/src/client/electron/ElectronWebviewPresentation.ts +138 -0
- package/src/client/electron/NativeChildPresentation.ts +45 -0
- package/src/client/electron/NativeViewPage.ts +251 -0
- package/src/client/electron/pages.ts +23 -0
- package/src/client/electron/reference-overlay.ts +53 -0
- package/src/client/electron/workspace.ts +33 -0
- package/src/client/index.ts +293 -0
- package/src/client/locales.ts +857 -0
- package/src/client/pages.ts +28 -0
- package/src/client/reference/client/BrowserRefLink.tsx +142 -0
- package/src/client/reference/client/draft-reference.ts +167 -0
- package/src/client/reference/client/index.ts +7 -0
- package/src/client/reference/client/ordered-submission.ts +108 -0
- package/src/client/reference/client/pending-delivery.ts +216 -0
- package/src/client/reference/client/plugin.ts +189 -0
- package/src/client/reference/client/production/ReferenceCapsules.tsx +345 -0
- package/src/client/reference/client/production/ReferenceDock.module.css +193 -0
- package/src/client/reference/client/production/ReferenceDock.tsx +6 -0
- package/src/client/reference/client/production/ReferenceFeedback.tsx +15 -0
- package/src/client/reference/client/production/ReferenceMath.tsx +44 -0
- package/src/client/reference/client/production/ReferenceText.tsx +36 -0
- package/src/client/reference/client/production/assembly.ts +471 -0
- package/src/client/reference/client/production/asset-store.ts +144 -0
- package/src/client/reference/client/production/availability.ts +74 -0
- package/src/client/reference/client/production/bytes.ts +36 -0
- package/src/client/reference/client/production/delivery-client.ts +211 -0
- package/src/client/reference/client/production/draft-adapter.ts +508 -0
- package/src/client/reference/client/production/http-transport.ts +217 -0
- package/src/client/reference/client/production/production-submission.ts +310 -0
- package/src/client/reference/client/production/protocol.ts +231 -0
- package/src/client/reference/client/production/reference-card.ts +240 -0
- package/src/client/reference/client/production/reference-labels.ts +29 -0
- package/src/client/reference/client/production/reply-link-bridge.ts +222 -0
- package/src/client/reference/client/production/reveal.ts +215 -0
- package/src/client/reference/client/production/runtime.ts +1101 -0
- package/src/client/reference/client/production/snapshot-adapter.ts +154 -0
- package/src/client/reference/client/production/source-marker.ts +63 -0
- package/src/client/reference/client/production/source-opener.ts +55 -0
- package/src/client/reference/client/production/styles.ts +104 -0
- package/src/client/reference/client/production/user-text-rule.ts +58 -0
- package/src/client/reference/client/reveal.ts +107 -0
- package/src/client/reference/client/scheme.ts +114 -0
- package/src/client/reference/client/types.ts +168 -0
- package/src/client/reference/css-modules.d.ts +4 -0
- package/src/client/reference/index.ts +11 -0
- package/src/client/reference-capture-owner.ts +162 -0
- package/src/client/reference-intents.ts +36 -0
- package/src/client/settings/index.ts +34 -0
- package/{client.js → src/client/settings/panel.ts} +2657 -2231
- package/src/client/shortcut-open.ts +30 -0
- package/src/client/startpage/binding.ts +99 -0
- package/src/client/startpage/controller.ts +303 -0
- package/src/client/startpage/model.ts +279 -0
- package/src/client/view/Browser.module.css +751 -0
- package/src/client/view/BrowserBody.tsx +314 -0
- package/src/client/view/BrowserPresentation.ts +9 -0
- package/src/client/view/BrowserTitle.tsx +17 -0
- package/src/client/view/IframePresentation.ts +344 -0
- package/src/client/view/StartPage.tsx +597 -0
- package/src/client/view/TakeoverBanner.tsx +21 -0
- package/src/index.ts +110 -73
- package/src/reference-owner.ts +5 -0
- package/src/reference-page.ts +9 -0
- package/src/reference-source.ts +3 -0
- package/src/reference-text.ts +197 -0
- package/src/startpage-settings.ts +103 -0
- package/src/startpage.ts +71 -0
- package/src/takeover-protocol.ts +19 -0
- package/src/tool-browser/code-tool.ts +401 -0
- package/src/tool-browser/code-worker.ts +639 -0
- package/src/tool-browser/index.ts +908 -77
- package/src/tool-browser/page-probe.ts +4 -4
- package/src/tool-browser/panel-page.ts +124 -0
- package/src/tool-browser/screenshot-image.ts +49 -0
- package/src/tool-browser/takeover.ts +198 -0
- package/src/types/electron-shim.d.ts +20 -0
- package/src/types.ts +85 -0
- package/src/web-guest.ts +34 -0
- package/tools/accept-desktop.mjs +148 -0
- package/lib/browser/runtime.d.ts +0 -175
- package/lib/browser/types.d.ts +0 -797
- package/lib/browser-electron/authenticated-route.d.ts +0 -27
- package/lib/browser-electron/automatic-maintenance.d.ts +0 -41
- package/lib/browser-electron/bridge-auto.d.ts +0 -93
- package/lib/browser-electron/bridge-connection.d.ts +0 -93
- package/lib/browser-electron/bridge-endpoint.d.ts +0 -30
- package/lib/browser-electron/bridge-install.d.ts +0 -85
- package/lib/browser-electron/bridge-maintenance.d.ts +0 -24
- package/lib/browser-electron/bridge-status.d.ts +0 -50
- package/lib/browser-electron/desktop-bridge-host.d.ts +0 -248
- package/lib/browser-electron/desktop-identity.d.ts +0 -58
- package/lib/browser-electron/electron-provision.d.ts +0 -92
- package/lib/browser-electron/entry.d.ts +0 -64
- package/lib/browser-electron/ephemeral-profile.d.ts +0 -37
- package/lib/browser-electron/file-write.d.ts +0 -2
- package/lib/browser-electron/history-store.d.ts +0 -98
- package/lib/browser-electron/host-main.d.ts +0 -26
- package/lib/browser-electron/http-body.d.ts +0 -24
- package/lib/browser-electron/json-reply.d.ts +0 -33
- package/lib/browser-electron/maintenance-broker.d.ts +0 -35
- package/lib/browser-electron/maintenance-lifecycle.d.ts +0 -32
- package/lib/browser-electron/maintenance-route.d.ts +0 -18
- package/lib/browser-electron/missing-system-browser.d.ts +0 -54
- package/lib/browser-electron/paths.d.ts +0 -4
- package/lib/browser-electron/preview-route.d.ts +0 -89
- package/lib/browser-electron/process.d.ts +0 -14
- package/lib/browser-electron/provider.d.ts +0 -959
- package/lib/browser-electron/remote-host.d.ts +0 -256
- package/lib/browser-electron/rpc-input.d.ts +0 -4
- package/lib/browser-electron/rpc-ops.d.ts +0 -18
- package/lib/browser-electron/runtime-diagnostics.d.ts +0 -12
- package/lib/browser-electron/runtime-route.d.ts +0 -55
- package/lib/browser-electron/runtime-status.d.ts +0 -116
- package/lib/browser-electron/settings-route.d.ts +0 -15
- package/lib/browser-electron/settings-store.d.ts +0 -224
- package/lib/browser-electron/sidebar-only-host.d.ts +0 -36
- package/lib/browser-electron/system-browser.d.ts +0 -367
- package/lib/browser-electron/timing.d.ts +0 -8
- package/lib/browser-electron/virtual-cursor.d.ts +0 -67
- package/lib/browser-electron/windows-system.d.ts +0 -3
- package/lib/index.d.ts +0 -30
- package/lib/tool-browser/element-fields.d.ts +0 -145
- package/lib/tool-browser/index.d.ts +0 -53
- package/lib/tool-browser/page-probe.d.ts +0 -86
- package/scripts/consumer-install-check.mjs +0 -72
- package/scripts/run-tests.mjs +0 -32
- package/scripts/verify-host-compat.mjs +0 -195
- package/scripts/verify-preview-route.mjs +0 -168
- package/scripts/verify-runtime-status.mjs +0 -179
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Synthetic pointer feedback for a human watching the tab: an overlay drawn
|
|
3
|
-
* INSIDE the page, never the real system pointer. Its presence is the "the agent
|
|
4
|
-
* has taken over this tab" signal, so it also covers DOM-level operations that
|
|
5
|
-
* move no pointer at all.
|
|
6
|
-
*
|
|
7
|
-
* Implementation notes that matter:
|
|
8
|
-
* - The overlay is `position: fixed` and positioned from viewport coordinates,
|
|
9
|
-
* which is exactly what the element locator already computes and what
|
|
10
|
-
* `Input.dispatchMouseEvent` consumes.
|
|
11
|
-
* - All styling is inline and the ripple uses the Web Animations API: a
|
|
12
|
-
* `<style>` element would be subject to the page's `style-src` CSP, an
|
|
13
|
-
* injected script is not. Injected page feedback must never be silently
|
|
14
|
-
* dropped by a strict CSP.
|
|
15
|
-
* - Every call is best-effort: feedback is never allowed to fail an operation.
|
|
16
|
-
* @module dsh-browser/browser-electron/virtual-cursor
|
|
17
|
-
*/
|
|
18
|
-
/** What the pointer is doing at the reported point. */
|
|
19
|
-
export type CursorAction = 'move' | 'click';
|
|
20
|
-
/**
|
|
21
|
-
* Whether a paint at this position would change anything on screen.
|
|
22
|
-
* @param handle - the view the overlay belongs to.
|
|
23
|
-
* @param x - viewport x in CSS pixels.
|
|
24
|
-
* @param y - viewport y in CSS pixels.
|
|
25
|
-
* @param action - the action being reported.
|
|
26
|
-
* @param force - paint even when unchanged (a click ripple must always fire).
|
|
27
|
-
* @returns true when the overlay should be painted.
|
|
28
|
-
*/
|
|
29
|
-
export declare function cursorNeedsPaint<TView>(handle: TView, x: number, y: number, action: CursorAction, force?: boolean): boolean;
|
|
30
|
-
/**
|
|
31
|
-
* The in-page expression that materializes or moves the overlay. Idempotent: the
|
|
32
|
-
* first call creates the nodes, later calls only move them (and pulse).
|
|
33
|
-
* @param x - viewport x in CSS pixels.
|
|
34
|
-
* @param y - viewport y in CSS pixels.
|
|
35
|
-
* @param action - whether to pulse a click ripple at the point.
|
|
36
|
-
* @param label - optional short description of the operation, shown beside the
|
|
37
|
-
* pointer. The overlay is the only "the agent has taken over this tab" signal, so
|
|
38
|
-
* saying *what* it is doing is what turns it from a decoration into an account of
|
|
39
|
-
* the agent's actions that a human can follow without reading the tool log.
|
|
40
|
-
* @returns a self-contained expression that evaluates to `true`.
|
|
41
|
-
*/
|
|
42
|
-
export declare function cursorScript(x: number, y: number, action: CursorAction, label?: string): string;
|
|
43
|
-
/**
|
|
44
|
-
* Forget the remembered position for a view.
|
|
45
|
-
*
|
|
46
|
-
* Called when the document is replaced: the overlay lived in the old document and
|
|
47
|
-
* went with it, so the cache would otherwise claim the pointer is already where it
|
|
48
|
-
* needs to be and skip every later paint — the pointer would simply never return
|
|
49
|
-
* after a navigation.
|
|
50
|
-
* @param handle - the view whose cache should be dropped.
|
|
51
|
-
*/
|
|
52
|
-
export declare function forgetCursor<TView>(handle: TView): void;
|
|
53
|
-
/**
|
|
54
|
-
* Draw (or move) the pointer overlay on one view's page.
|
|
55
|
-
*
|
|
56
|
-
* Fire-and-forget: a page that is mid-navigation, cross-origin-blocked, or
|
|
57
|
-
* otherwise unable to answer must not turn a successful operation into a
|
|
58
|
-
* failure, and the navigation that just committed may still be replacing the
|
|
59
|
-
* document this call would have painted into.
|
|
60
|
-
* @param handle - the view to paint into.
|
|
61
|
-
* @param x - viewport x in CSS pixels.
|
|
62
|
-
* @param y - viewport y in CSS pixels.
|
|
63
|
-
* @param action - whether to pulse a click ripple.
|
|
64
|
-
* @param evaluate - the provider's evaluate bridge (keeps the CDP coupling in one place).
|
|
65
|
-
* @param label - optional short description of the operation, shown beside the pointer.
|
|
66
|
-
*/
|
|
67
|
-
export declare function paintCursor<TView>(handle: TView, x: number, y: number, action: CursorAction, evaluate: (handle: TView, expression: string) => Promise<unknown>, label?: string, force?: boolean): void;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
/** PowerShell's `-EncodedCommand` expects a UTF-16LE script encoded as base64. */
|
|
2
|
-
export declare function encodePowerShellScript(script: string): string;
|
|
3
|
-
export declare function windowsPowerShellPath(environment?: NodeJS.ProcessEnv, exists?: (path: string) => boolean): string;
|
package/lib/index.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* dsh-builtin-browser plugin entry: aggregates the shared-browser capability
|
|
3
|
-
* pieces. The cordis.patch.yml rows reference subpath exports:
|
|
4
|
-
* - `dsh-builtin-browser/browser` -> the ctx.browser seam (Service)
|
|
5
|
-
* - `dsh-builtin-browser/browser-electron` -> the Electron CDP provider
|
|
6
|
-
* - `dsh-builtin-browser/tool-browser` -> the model-facing dsh_browser_* tools
|
|
7
|
-
* The capability itself is composed by those rows; this root entry exists for
|
|
8
|
-
* programmatic imports AND because the host's client-module scan identifies a
|
|
9
|
-
* package's browser half through a loader row whose specifier resolves to the
|
|
10
|
-
* PACKAGE ROOT. A row named after a subpath (`dsh-builtin-browser/browser`) is
|
|
11
|
-
* not a package specifier and is skipped by design, which is why the patch also
|
|
12
|
-
* registers a row under the bare package name — see cordis.patch.yml.
|
|
13
|
-
* @module dsh-builtin-browser
|
|
14
|
-
*/
|
|
15
|
-
/** Plugin identity for the root row (the composition surface is the subpath rows). */
|
|
16
|
-
export declare const name = "dsh-builtin-browser";
|
|
17
|
-
/**
|
|
18
|
-
* Inert application for the root row: the browser seam, the Electron provider and
|
|
19
|
-
* the tools are mounted by the subpath rows, so this one only exists to give the
|
|
20
|
-
* package a loader row named after the package itself. Without it the host's
|
|
21
|
-
* client scan finds no row to resolve `dsh.client` from, and the settings panel
|
|
22
|
-
* never reaches the browser (the plugin works, its client half is invisible).
|
|
23
|
-
*/
|
|
24
|
-
export declare function apply(): void;
|
|
25
|
-
export { BrowserError } from './browser/types.js';
|
|
26
|
-
export type { BrowserA11yNode, BrowserA11yRequest, BrowserA11yResult, BrowserChallenge, BrowserCheckRequest, BrowserClearRequest, BrowserClickRequest, BrowserContentFormat, BrowserContentRequest, BrowserContentResult, BrowserElementTarget, BrowserExecuteRequest, BrowserExecuteResult, BrowserFillField, BrowserFillRequest, BrowserFillResult, BrowserGetValueRequest, BrowserGetValueResult, BrowserNavigateRequest, BrowserOpenRequest, BrowserProvider, BrowserScrapeField, BrowserScrapeRequest, BrowserScrapeResult, BrowserScreenshotRequest, BrowserScreenshotResult, BrowserSelectRequest, BrowserSelectResult, BrowserSessionId, BrowserSetValueRequest, BrowserSetValueResult, BrowserSnapshotElement, BrowserSnapshotResult, BrowserTab, BrowserTypeRequest, ExportedCookie, } from './browser/types.js';
|
|
27
|
-
export { BrowserRuntime } from './browser/runtime.js';
|
|
28
|
-
export { ElectronBrowserProvider } from './browser-electron/provider.js';
|
|
29
|
-
export type { ElectronBrowserViewHost, ElectronViewHandle } from './browser-electron/provider.js';
|
|
30
|
-
export { RemoteElectronViewHost, defaultHostMainPath } from './browser-electron/remote-host.js';
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The element and node field sets, declared once.
|
|
3
|
-
*
|
|
4
|
-
* WHY THIS FILE EXISTS
|
|
5
|
-
*
|
|
6
|
-
* The same field set used to be written out in four places: the page script produced an
|
|
7
|
-
* object, `types.ts` declared its shape, a tool's `execute` rebuilt it as an explicit list,
|
|
8
|
-
* and the tool's `output.schema` declared the properties. Nothing connected them, and the
|
|
9
|
-
* result is this project's most repeatable bug:
|
|
10
|
-
*
|
|
11
|
-
* - `dsh_browser_a11y`'s `selector` — computed by the provider, declared by the schema,
|
|
12
|
-
* printed by the renderer, and dropped by the projection. 134 tests stayed green.
|
|
13
|
-
* - `dsh_browser_screenshot`'s `width`/`height` — measured by the provider, declared by the
|
|
14
|
-
* schema, and dropped by the projection. 172 tests stayed green. It was found a round
|
|
15
|
-
* later, by reading the three places that agree and noticing the fourth did not.
|
|
16
|
-
*
|
|
17
|
-
* A hand-written allow-list is invisible to the type checker (it is an object literal) and to
|
|
18
|
-
* the tests (nothing ran a tool). The fix is not a careful list; it is one list. Both the
|
|
19
|
-
* schema fragment and the projection are derived from the tables below, so a field cannot be
|
|
20
|
-
* present in one and absent from the other.
|
|
21
|
-
*
|
|
22
|
-
* The schema is the dangerous half: `additionalProperties: false` means a field the schema
|
|
23
|
-
* does NOT declare causes the ENTIRE result to be rejected at run time, while a field the
|
|
24
|
-
* projection forgets is silently dropped. One table cannot get either wrong on its own.
|
|
25
|
-
*/
|
|
26
|
-
/**
|
|
27
|
-
* The `elements` item schema for dsh_browser_snapshot and dsh_browser_open.
|
|
28
|
-
*
|
|
29
|
-
* Written as a literal rather than generated, because `defineTool` validates the output schema
|
|
30
|
-
* against its own `ValueSchemaSpec` and a generated `Record<string, …>` is too wide to satisfy
|
|
31
|
-
* it. The field table above remains the single source of truth: `tests/element-fields.test.mjs`
|
|
32
|
-
* asserts that these properties and `projectElement`'s output are exactly the table's keys, so
|
|
33
|
-
* the two cannot drift even though one is typed by hand.
|
|
34
|
-
*/
|
|
35
|
-
export declare const ELEMENT_ITEM_SCHEMA: {
|
|
36
|
-
readonly type: "object";
|
|
37
|
-
readonly additionalProperties: false;
|
|
38
|
-
readonly properties: {
|
|
39
|
-
readonly ref: {
|
|
40
|
-
readonly type: "number";
|
|
41
|
-
readonly required: true;
|
|
42
|
-
};
|
|
43
|
-
readonly kind: {
|
|
44
|
-
readonly type: "string";
|
|
45
|
-
readonly required: true;
|
|
46
|
-
};
|
|
47
|
-
readonly label: {
|
|
48
|
-
readonly type: "string";
|
|
49
|
-
readonly required: true;
|
|
50
|
-
};
|
|
51
|
-
readonly selector: {
|
|
52
|
-
readonly type: "string";
|
|
53
|
-
};
|
|
54
|
-
readonly x: {
|
|
55
|
-
readonly type: "number";
|
|
56
|
-
readonly required: true;
|
|
57
|
-
};
|
|
58
|
-
readonly y: {
|
|
59
|
-
readonly type: "number";
|
|
60
|
-
readonly required: true;
|
|
61
|
-
};
|
|
62
|
-
readonly frame: {
|
|
63
|
-
readonly type: "boolean";
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* The `nodes` item schema for dsh_browser_a11y.
|
|
69
|
-
*
|
|
70
|
-
* Same reasoning as {@link ELEMENT_ITEM_SCHEMA}: literal for the type checker, table-backed by
|
|
71
|
-
* test.
|
|
72
|
-
*/
|
|
73
|
-
export declare const NODE_ITEM_SCHEMA: {
|
|
74
|
-
readonly type: "object";
|
|
75
|
-
readonly additionalProperties: false;
|
|
76
|
-
readonly properties: {
|
|
77
|
-
readonly ref: {
|
|
78
|
-
readonly type: "number";
|
|
79
|
-
readonly required: true;
|
|
80
|
-
};
|
|
81
|
-
readonly role: {
|
|
82
|
-
readonly type: "string";
|
|
83
|
-
readonly required: true;
|
|
84
|
-
};
|
|
85
|
-
readonly name: {
|
|
86
|
-
readonly type: "string";
|
|
87
|
-
readonly required: true;
|
|
88
|
-
};
|
|
89
|
-
readonly value: {
|
|
90
|
-
readonly type: "string";
|
|
91
|
-
};
|
|
92
|
-
readonly states: {
|
|
93
|
-
readonly type: "array";
|
|
94
|
-
readonly required: true;
|
|
95
|
-
readonly items: {
|
|
96
|
-
readonly type: "string";
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
readonly depth: {
|
|
100
|
-
readonly type: "number";
|
|
101
|
-
readonly required: true;
|
|
102
|
-
};
|
|
103
|
-
readonly tag: {
|
|
104
|
-
readonly type: "string";
|
|
105
|
-
readonly required: true;
|
|
106
|
-
};
|
|
107
|
-
readonly selector: {
|
|
108
|
-
readonly type: "string";
|
|
109
|
-
readonly required: true;
|
|
110
|
-
};
|
|
111
|
-
readonly x: {
|
|
112
|
-
readonly type: "number";
|
|
113
|
-
readonly required: true;
|
|
114
|
-
};
|
|
115
|
-
readonly y: {
|
|
116
|
-
readonly type: "number";
|
|
117
|
-
readonly required: true;
|
|
118
|
-
};
|
|
119
|
-
readonly frame: {
|
|
120
|
-
readonly type: "boolean";
|
|
121
|
-
};
|
|
122
|
-
};
|
|
123
|
-
};
|
|
124
|
-
/**
|
|
125
|
-
* Project one snapshot element into the shape the schema declares.
|
|
126
|
-
*
|
|
127
|
-
* Generic in the source type so the caller keeps the precise shape `defineTool` inferred from
|
|
128
|
-
* the schema: the projection decides which fields survive at run time, and the field table is
|
|
129
|
-
* what guarantees that set matches the schema. Widening the return type here would only move
|
|
130
|
-
* the mismatch to the call site.
|
|
131
|
-
* @param element - the element as the provider produced it.
|
|
132
|
-
* @returns exactly the declared fields.
|
|
133
|
-
*/
|
|
134
|
-
export declare function projectElement<T extends object>(element: T): T;
|
|
135
|
-
/**
|
|
136
|
-
* Project one accessibility node into the shape the schema declares.
|
|
137
|
-
* @param node - the node as the provider produced it.
|
|
138
|
-
* @returns exactly the declared fields.
|
|
139
|
-
*/
|
|
140
|
-
export declare function projectNode<T extends object>(node: T): T;
|
|
141
|
-
/** The field names each table declares, for tests that check the two stay in step. */
|
|
142
|
-
export declare const DECLARED_FIELDS: {
|
|
143
|
-
readonly element: string[];
|
|
144
|
-
readonly node: string[];
|
|
145
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Model-facing browser tools over `ctx.browser`: `dsh_browser_open`,
|
|
3
|
-
* `dsh_browser_snapshot`, `dsh_browser_execute`, `dsh_browser_content`,
|
|
4
|
-
* `dsh_browser_screenshot`, and tab management (`dsh_browser_list_tabs`,
|
|
5
|
-
* `dsh_browser_switch_tab`, `dsh_browser_close_tab`, `dsh_browser_reset`).
|
|
6
|
-
*
|
|
7
|
-
* The tool layer owns only the model-facing schema, argument validation, and
|
|
8
|
-
* result formatting — never provider selection or page driving, which belong
|
|
9
|
-
* to the seam. Session lifecycle is owned here at the plugin level: each
|
|
10
|
-
* calling task (a DSH session) gets its own browser session — the first
|
|
11
|
-
* `dsh_browser_open` (or any tool when no session exists) opens it, and later
|
|
12
|
-
* tools in the same task reuse it. Concurrent tasks therefore never fight
|
|
13
|
-
* over tabs, history, or navigation state.
|
|
14
|
-
* @module dsh-browser/tool-browser
|
|
15
|
-
*/
|
|
16
|
-
import type { Context } from '@deepseek-ai/cordis';
|
|
17
|
-
import type { BrowserSessionId } from '../browser/types.js';
|
|
18
|
-
/** Plugin name used by loader diagnostics. */
|
|
19
|
-
export declare const name = "tool-browser";
|
|
20
|
-
/** The tool registry, browser seam, and system-prompt registry this tool layer consumes. */
|
|
21
|
-
export declare const inject: string[];
|
|
22
|
-
/** Plugin config: tool timeouts and session defaults. */
|
|
23
|
-
export interface Config {
|
|
24
|
-
/** Cooperative tool-call budget in ms. Default 60000. */
|
|
25
|
-
readonly timeoutMs?: number;
|
|
26
|
-
/** Whether to offer tab-management tools. Default true. */
|
|
27
|
-
readonly tabTools?: boolean;
|
|
28
|
-
/** Optional initial allow-list of browser tool names; other tools are refused. */
|
|
29
|
-
readonly allowedActions?: readonly string[];
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Guard one browser tool call against the active restriction. Refuses calls
|
|
33
|
-
* not on the allow-list when a restriction is in effect.
|
|
34
|
-
* @param state - the calling context's tool state.
|
|
35
|
-
* @param toolName - the browser tool about to run.
|
|
36
|
-
*/
|
|
37
|
-
/**
|
|
38
|
-
* Tools that only observe, plus the ones that undo a restriction.
|
|
39
|
-
*
|
|
40
|
-
* Never subject to an allow-list: restricting what the agent may *do* must not also
|
|
41
|
-
* blind it or trap it, and the tool descriptions promise as much. dsh_browser_restrict
|
|
42
|
-
* is in here so a task that restricted everything can still lift it.
|
|
43
|
-
*/
|
|
44
|
-
export declare const READ_ONLY_TOOLS: ReadonlySet<string>;
|
|
45
|
-
/** Register all browser tools with `ctx.tools`. */
|
|
46
|
-
export declare function apply(ctx: Context, config?: Config): void;
|
|
47
|
-
/** Test hook: inspect and reset session mappings across every live plugin apply. */
|
|
48
|
-
export declare const internals: {
|
|
49
|
-
/** A copy of every live apply's per-task session map (task key -> provider session id). */
|
|
50
|
-
readonly sessions: ReadonlyMap<string, BrowserSessionId>;
|
|
51
|
-
/** Drop one task's mapping (across live applies) without closing the provider session. */
|
|
52
|
-
clearSession(key?: string): void;
|
|
53
|
-
};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The page-side probe: one script that makes a page observable without touching the host.
|
|
3
|
-
*
|
|
4
|
-
* WHY THIS EXISTS
|
|
5
|
-
* Three capabilities the model needs are not tools here yet: what the console said, which network
|
|
6
|
-
* responses arrived, and what happened to a JavaScript dialog. All three live *inside* the page, and
|
|
7
|
-
* a dialog blocks the page until someone answers it — which is why a `confirm()` used to hang a whole
|
|
8
|
-
* tool call with no explanation.
|
|
9
|
-
*
|
|
10
|
-
* The obvious implementation is CDP event capture (`Runtime.consoleAPICalled`, `Network.*`,
|
|
11
|
-
* `Page.javascriptDialogOpening`) inside the host. That would mean a new capability in all three
|
|
12
|
-
* carriers — the self-hosted child, the driven Chrome and the sidebar bridge — plus a protocol
|
|
13
|
-
* version for the bridge. This probe instead installs itself with the `execute` path every carrier
|
|
14
|
-
* already has, so it works everywhere on day one and cannot drift per carrier.
|
|
15
|
-
*
|
|
16
|
-
* What it costs, stated plainly:
|
|
17
|
-
* - `console` and `network` see what the PAGE can see. A response that never reached `fetch`/`XHR`
|
|
18
|
-
* (a document navigation, an `<img>` failure the browser handled internally) appears only as a
|
|
19
|
-
* resource-timing entry, with no status code. CDP would know more.
|
|
20
|
-
* - Dialog capture works by replacing `window.alert/confirm/prompt` BEFORE they are called. A dialog
|
|
21
|
-
* produced by the browser itself (`beforeunload`, HTTP auth, permission prompts) is not covered.
|
|
22
|
-
* - It is an override, so a page that captured `window.fetch` earlier keeps its own copy. Installed
|
|
23
|
-
* at first use, which is early enough for every ordinary page and honest about the rest.
|
|
24
|
-
*
|
|
25
|
-
* Idempotent by version: installing twice keeps the buffers that already exist.
|
|
26
|
-
* @module dsh-browser/tool-browser/page-probe
|
|
27
|
-
*/
|
|
28
|
-
import type { BrowserPageOperationRequest } from '../browser/types.js';
|
|
29
|
-
/** Bumped when the probe's shape changes; an older probe is replaced rather than trusted. */
|
|
30
|
-
export declare const PROBE_VERSION = 4;
|
|
31
|
-
/**
|
|
32
|
-
* The installer, as one expression that returns the installed version.
|
|
33
|
-
*
|
|
34
|
-
* Written as a string because it runs in the page, not here. Keep it dependency-free and ES5-safe:
|
|
35
|
-
* a page may be older than the harness.
|
|
36
|
-
*/
|
|
37
|
-
export declare const PROBE_INSTALL_SCRIPT: string;
|
|
38
|
-
/**
|
|
39
|
-
* One probe call, evaluated in the page, with its result serialised as JSON.
|
|
40
|
-
*
|
|
41
|
-
* JSON in, JSON out, because that is the only shape every carrier's `execute` can carry reliably.
|
|
42
|
-
* @param method - the probe function to call (`read`, `settle`, `find`, `overlayAt`, `clear`, …).
|
|
43
|
-
* @param args - arguments, already JSON-serialisable.
|
|
44
|
-
* @returns a script whose value is the JSON text of the result (or an error object).
|
|
45
|
-
*/
|
|
46
|
-
export declare function probeCallScript(method: string, args?: readonly unknown[]): string;
|
|
47
|
-
/**
|
|
48
|
-
* Dispatch a pointer drag in the page, for elements that accept synthetic pointer events.
|
|
49
|
-
*
|
|
50
|
-
* Uses `PointerEvent` when the page has it and `MouseEvent` otherwise, because a canvas app that
|
|
51
|
-
* listens for `mousedown` never sees a pointer event. This is a page-level gesture: a page that
|
|
52
|
-
* demands trusted input (some canvas editors) ignores it, exactly like `click_sequence`'s
|
|
53
|
-
* coordinate clicks are the trusted counterpart.
|
|
54
|
-
* @param from - start point in viewport CSS pixels.
|
|
55
|
-
* @param to - end point.
|
|
56
|
-
* @param steps - intermediate moves; more steps make a slider or a canvas app follow the path.
|
|
57
|
-
* @returns a script value: `{ ok: true, moved, at }` or `{ ok: false, reason }`.
|
|
58
|
-
*/
|
|
59
|
-
export declare function dragScript(from: {
|
|
60
|
-
readonly x: number;
|
|
61
|
-
readonly y: number;
|
|
62
|
-
}, to: {
|
|
63
|
-
readonly x: number;
|
|
64
|
-
readonly y: number;
|
|
65
|
-
}, steps?: number): string;
|
|
66
|
-
/**
|
|
67
|
-
* Put a local file into an `<input type=file>`, without CDP.
|
|
68
|
-
*
|
|
69
|
-
* The page cannot read a disk path, so the bytes travel in as base64 and are rebuilt as a `File`
|
|
70
|
-
* in page context, then attached through a `DataTransfer`. That is what a drag-and-drop handler
|
|
71
|
-
* sees, so frameworks that read `input.files` or a drop event both work. The admission decision
|
|
72
|
-
* (which path may be read at all) belongs to the caller; this only carries the bytes.
|
|
73
|
-
* @param target - how to find the input: a CSS selector or visible text near it.
|
|
74
|
-
* @param file - name, MIME type and base64 of the bytes.
|
|
75
|
-
* @returns a script value: `{ ok: true, name, size }` or `{ ok: false, reason }`.
|
|
76
|
-
*/
|
|
77
|
-
export declare function uploadScript(target: {
|
|
78
|
-
readonly by: 'css' | 'text' | 'xpath';
|
|
79
|
-
readonly value: string;
|
|
80
|
-
}, file: {
|
|
81
|
-
readonly name: string;
|
|
82
|
-
readonly mime: string;
|
|
83
|
-
readonly base64: string;
|
|
84
|
-
}): string;
|
|
85
|
-
/** Build a fixed page operation, rejecting unknown operations before any code runs. */
|
|
86
|
-
export declare function pageOperationScript(request: BrowserPageOperationRequest): string;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
// Consumer-layout install check for the packaged artifact.
|
|
2
|
-
//
|
|
3
|
-
// The promise this version is about ("it works once you install it") starts at INSTALL time: the
|
|
4
|
-
// tarball must install cleanly on a default pnpm profile, with no build-script approval and no
|
|
5
|
-
// network, and it must carry the files the readiness endpoints live in.
|
|
6
|
-
//
|
|
7
|
-
// Run: node scripts/consumer-install-check.mjs <tarball> <workdir>
|
|
8
|
-
import { execFileSync } from 'node:child_process'
|
|
9
|
-
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
|
|
10
|
-
import { join } from 'node:path'
|
|
11
|
-
|
|
12
|
-
const [tarball, workdir] = process.argv.slice(2)
|
|
13
|
-
if (!tarball || !workdir) {
|
|
14
|
-
console.error('usage: consumer-install-check.mjs <tarball> <workdir>')
|
|
15
|
-
process.exit(2)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const pnpm = process.env.DSH_PNPM ?? 'pnpm'
|
|
19
|
-
const node = process.execPath
|
|
20
|
-
|
|
21
|
-
rmSync(workdir, { recursive: true, force: true })
|
|
22
|
-
mkdirSync(workdir, { recursive: true })
|
|
23
|
-
writeFileSync(join(workdir, 'package.json'), JSON.stringify({ name: 'consumer', private: true, version: '1.0.0' }, null, 2))
|
|
24
|
-
|
|
25
|
-
const problems = []
|
|
26
|
-
let installOutput = ''
|
|
27
|
-
try {
|
|
28
|
-
installOutput = execFileSync(node, [pnpm, 'add', tarball], {
|
|
29
|
-
cwd: workdir,
|
|
30
|
-
encoding: 'utf8',
|
|
31
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
32
|
-
env: { ...process.env, npm_config_loglevel: 'info' },
|
|
33
|
-
})
|
|
34
|
-
} catch (error) {
|
|
35
|
-
installOutput = `${error.stdout ?? ''}${error.stderr ?? ''}`
|
|
36
|
-
problems.push(`install failed: ${String(error.message).split('\n')[0]}`)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// pnpm blocks dependency build scripts by default, and the whole point of moving the Electron
|
|
40
|
-
// download out of `postinstall` (issue #41) is that this never comes up again.
|
|
41
|
-
if (/Ignored build scripts/i.test(installOutput) || /ERR_PNPM_IGNORED_BUILDS/.test(installOutput)) {
|
|
42
|
-
problems.push('install reported ignored build scripts, which is issue #41 again')
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const installed = join(workdir, 'node_modules', 'dsh-builtin-browser')
|
|
46
|
-
const manifestPath = join(installed, 'package.json')
|
|
47
|
-
if (!existsSync(manifestPath)) {
|
|
48
|
-
problems.push('the package was not installed')
|
|
49
|
-
} else {
|
|
50
|
-
const manifest = JSON.parse(readFileSync(manifestPath, 'utf8'))
|
|
51
|
-
const scripts = Object.keys(manifest.scripts ?? {}).sort().join(',')
|
|
52
|
-
if (scripts !== 'build,prepack,test') problems.push(`unexpected scripts: ${scripts}`)
|
|
53
|
-
for (const lifecycle of ['preinstall', 'install', 'postinstall', 'prepare']) {
|
|
54
|
-
if (manifest.scripts?.[lifecycle] !== undefined) problems.push(`install-time hook "${lifecycle}" is back`)
|
|
55
|
-
}
|
|
56
|
-
if (manifest.bin?.['dsh-browser-install-electron'] !== 'scripts/install-electron.mjs') {
|
|
57
|
-
problems.push('the explicit provisioning command is missing from bin')
|
|
58
|
-
}
|
|
59
|
-
// The files the readiness endpoints are served from. A tarball that shipped an entry without them
|
|
60
|
-
// would fail at request time with a module-resolution error instead of a panel.
|
|
61
|
-
for (const file of [
|
|
62
|
-
'lib/browser-electron/runtime-status.js',
|
|
63
|
-
'lib/browser-electron/runtime-route.js',
|
|
64
|
-
'desktop-bridge/install.mjs',
|
|
65
|
-
'client.js',
|
|
66
|
-
]) {
|
|
67
|
-
if (!existsSync(join(installed, file))) problems.push(`missing from the installed tree: ${file}`)
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
console.log(JSON.stringify({ tarball, workdir, problems }, null, 2))
|
|
72
|
-
process.exit(problems.length === 0 ? 0 : 1)
|
package/scripts/run-tests.mjs
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/** Build and run tests inside an explicit, marked bridge-installer boundary. */
|
|
3
|
-
import { spawn } from 'node:child_process'
|
|
4
|
-
import { readdirSync } from 'node:fs'
|
|
5
|
-
import { createRequire } from 'node:module'
|
|
6
|
-
import { join } from 'node:path'
|
|
7
|
-
import { fileURLToPath } from 'node:url'
|
|
8
|
-
import { createInstallerSandbox } from '../tests/helpers/installer-sandbox.mjs'
|
|
9
|
-
|
|
10
|
-
const repo = fileURLToPath(new URL('..', import.meta.url))
|
|
11
|
-
const require = createRequire(new URL('../package.json', import.meta.url))
|
|
12
|
-
const sandbox = createInstallerSandbox()
|
|
13
|
-
const environment = sandbox.env()
|
|
14
|
-
function run(argv) {
|
|
15
|
-
return new Promise(resolve => {
|
|
16
|
-
const child = spawn(process.execPath, argv, { cwd: repo, env: environment, stdio: 'inherit', windowsHide: true })
|
|
17
|
-
child.once('error', error => { console.error(error); resolve(1) })
|
|
18
|
-
child.once('close', code => resolve(code ?? 1))
|
|
19
|
-
})
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
let code = await run([require.resolve('typescript/bin/tsc'), '-p', join(repo, 'tsconfig.json')])
|
|
23
|
-
if (code === 0) {
|
|
24
|
-
const requested = process.argv.slice(2)
|
|
25
|
-
const files = requested.length === 0
|
|
26
|
-
? readdirSync(join(repo, 'tests')).filter(name => name.endsWith('.test.mjs')).sort().map(name => join(repo, 'tests', name))
|
|
27
|
-
: requested
|
|
28
|
-
code = await run(['--test', ...files])
|
|
29
|
-
}
|
|
30
|
-
if (code === 0) sandbox.close()
|
|
31
|
-
else console.error(`Failed-test sandbox retained for diagnosis: ${sandbox.root}`)
|
|
32
|
-
process.exitCode = code
|