@dsh-workbench/adapter-probe 1.5.5 → 1.5.6
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync, readdirSync } from 'node:fs';
|
|
2
2
|
import { basename, join } from 'node:path';
|
|
3
|
-
import { OPENCLI_PIN, PREFLIGHT_INSTALL_TIMEOUT_MS, PREFLIGHT_VERSION_TIMEOUT_MS, VERIFIED_DSH, dshHome, dshHostGapOf, dshTierOf, dshVersionFrom, hostOsOf, preflightHandler, quoteShellArgFor, workbenchRoot } from '@dsh-workbench/shared/host';
|
|
3
|
+
import { OPENCLI_PIN, PREFLIGHT_INSTALL_TIMEOUT_MS, PREFLIGHT_VERSION_TIMEOUT_MS, VERIFIED_DSH, dshHome, dshHostGapOf, dshTierOf, dshVersionFrom, hostOsOf, param, preflightHandler, quoteShellArgFor, workbenchRoot } from '@dsh-workbench/shared/host';
|
|
4
4
|
import { isOpencliAtPin, isOpencliAtPinAt, isOpencliReady, opencliBuiltAt, opencliPackageDir, opencliReadinessAt, storeDirFor, toolchainDir } from '@dsh-workbench/adapter-runtime';
|
|
5
5
|
import { WAKE_BROWSER_ROUTE } from '@dsh-workbench/shared/contract/protocol/preflight-wake';
|
|
6
6
|
import { runBootstrapCommand } from '../runtime/bootstrap-run.js';
|
|
@@ -177,8 +177,11 @@ export function registerPreflight(input) {
|
|
|
177
177
|
});
|
|
178
178
|
input.routes.preflight = preflightHandler(preflight);
|
|
179
179
|
if (desktopBrowser !== undefined) {
|
|
180
|
-
input.routes[WAKE_BROWSER_ROUTE] = async () => {
|
|
181
|
-
const
|
|
180
|
+
input.routes[WAKE_BROWSER_ROUTE] = async (search) => {
|
|
181
|
+
const pending = param(search, 'target') === 'extensions'
|
|
182
|
+
? desktopBrowser.openExtensions()
|
|
183
|
+
: desktopBrowser.wake();
|
|
184
|
+
const result = await pending.catch(() => ({ status: 'unknown' }));
|
|
182
185
|
return { ok: true, ...result };
|
|
183
186
|
};
|
|
184
187
|
}
|
|
@@ -3,6 +3,7 @@ import type { WakeBrowserReply } from '@dsh-workbench/shared/contract/protocol/p
|
|
|
3
3
|
export interface DesktopBrowser {
|
|
4
4
|
observe(): Promise<void>;
|
|
5
5
|
wake(): Promise<WakeBrowserReply>;
|
|
6
|
+
openExtensions(): Promise<WakeBrowserReply>;
|
|
6
7
|
}
|
|
7
8
|
export declare function createDesktopBrowser(options: {
|
|
8
9
|
seam: Seam;
|
|
@@ -11,6 +11,7 @@ function isBrowserId(value) {
|
|
|
11
11
|
function specOf(id) {
|
|
12
12
|
return BROWSER_SPECS.find((item) => item.id === id) ?? BROWSER_SPECS[0];
|
|
13
13
|
}
|
|
14
|
+
const EXTENSIONS_URL = 'chrome://extensions';
|
|
14
15
|
const WAKE_WAIT_MS = 12_000;
|
|
15
16
|
const SHORT_WAIT_MS = 3_000;
|
|
16
17
|
const POLL_MS = 500;
|
|
@@ -104,11 +105,12 @@ export function createDesktopBrowser(options) {
|
|
|
104
105
|
const local = `/Applications/${label}.app`;
|
|
105
106
|
return exists(local) ? local : join(home, 'Applications', `${label}.app`);
|
|
106
107
|
}
|
|
107
|
-
async function launch(id) {
|
|
108
|
+
async function launch(id, url) {
|
|
108
109
|
const spec = browserLaunchOf(id, hostOsOf(platform), {
|
|
109
110
|
appPath: appPath(id),
|
|
110
111
|
executable: executableOf(id),
|
|
111
112
|
linuxBinary: specOf(id).linuxBinary,
|
|
113
|
+
...(url === undefined ? {} : { url }),
|
|
112
114
|
});
|
|
113
115
|
if (spec === undefined)
|
|
114
116
|
return false;
|
|
@@ -159,7 +161,18 @@ export function createDesktopBrowser(options) {
|
|
|
159
161
|
}
|
|
160
162
|
return { status: 'not-connected', browser: target };
|
|
161
163
|
}
|
|
162
|
-
|
|
164
|
+
async function openExtensions() {
|
|
165
|
+
if (!browserWakeSupportedOf(platform))
|
|
166
|
+
return { status: 'unsupported' };
|
|
167
|
+
const target = pickTarget(await running());
|
|
168
|
+
if (target === undefined)
|
|
169
|
+
return { status: 'no-browser' };
|
|
170
|
+
if (!(await launch(target, EXTENSIONS_URL)))
|
|
171
|
+
return { status: 'launch-failed', browser: target };
|
|
172
|
+
save(target);
|
|
173
|
+
return { status: 'browser-open', browser: target };
|
|
174
|
+
}
|
|
175
|
+
return { observe, wake, openExtensions };
|
|
163
176
|
}
|
|
164
177
|
export function bridgeFixCommand(command, issues, platform) {
|
|
165
178
|
return bridgeFixOf(command, issues, hostOsOf(platform));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dsh-workbench/adapter-probe",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.6",
|
|
4
4
|
"description": "Workbench adapter-probe adapter.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"proper-lockfile": "^4.1.2",
|
|
17
|
-
"@dsh-workbench/adapter-
|
|
18
|
-
"@dsh-workbench/
|
|
19
|
-
"@dsh-workbench/
|
|
20
|
-
"@dsh-workbench/adapter-
|
|
17
|
+
"@dsh-workbench/adapter-profile": "1.5.6",
|
|
18
|
+
"@dsh-workbench/adapter-runtime": "1.5.6",
|
|
19
|
+
"@dsh-workbench/shared": "1.5.6",
|
|
20
|
+
"@dsh-workbench/adapter-supply": "1.5.6"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/node": "^24.19.0",
|