@farmslot/adapter-web 0.19.10 → 0.19.11
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
CHANGED
|
@@ -6,6 +6,10 @@ All notable changes to `@farmslot/adapter-web` are tracked here.
|
|
|
6
6
|
|
|
7
7
|
- Active-development baseline; add user-facing changes here before release or package publication.
|
|
8
8
|
|
|
9
|
+
## 0.19.11 - 2026-11-13
|
|
10
|
+
|
|
11
|
+
- Resolve a python3 shim (asdf, pyenv) to its real interpreter once, ignoring executable overrides and keeping the install-stub guard, and give python probes a 15 s budget, so a loaded host no longer fails launch or readiness with `ETIMEDOUT`; a failed rollback or focus-check probe no longer replaces the launch error.
|
|
12
|
+
|
|
9
13
|
## 0.19.10 - 2026-11-13
|
|
10
14
|
|
|
11
15
|
- Republish against protocol 0.83.2, recipe-runner 0.46.15 and adapter-sdk 0.27.5 so consumers load one copy of each.
|
|
@@ -3,4 +3,12 @@ export function pythonFor({ found, platform, developerDir }: {
|
|
|
3
3
|
platform?: NodeJS.Platform | undefined;
|
|
4
4
|
developerDir: any;
|
|
5
5
|
}): any;
|
|
6
|
+
export function resolvePython({ run, platform, env, }?: {
|
|
7
|
+
run?: typeof output | undefined;
|
|
8
|
+
platform?: NodeJS.Platform | undefined;
|
|
9
|
+
env?: NodeJS.ProcessEnv | undefined;
|
|
10
|
+
}): any;
|
|
6
11
|
export function usablePython(): any;
|
|
12
|
+
export const PYTHON_TIMEOUT_MS: 15000;
|
|
13
|
+
declare function output(command: any, args: any, env?: NodeJS.ProcessEnv): string;
|
|
14
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farmslot/adapter-web",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.11",
|
|
4
4
|
"description": "Web platform adapter for Farmslot recipes: resolve and launch an isolated Chromium, own its CDP port, load unpacked extensions, and keep macOS focus.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"exports": {
|
package/src/web-dapp/launch.mjs
CHANGED
|
@@ -799,16 +799,27 @@ export async function launchWebDappBrowser(
|
|
|
799
799
|
log(
|
|
800
800
|
`launch failed, stopping what it started: ${String(error?.message ?? error).split('\n')[0]}`,
|
|
801
801
|
);
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
802
|
+
const incomplete = (stopError) => log(`rollback incomplete: ${stopError.message}`);
|
|
803
|
+
await stopWebDappBrowser(target, { cdpPort, log }).catch(incomplete);
|
|
804
|
+
// A failed ownership probe here must not replace the launch's own error.
|
|
805
|
+
try {
|
|
806
|
+
for (const pid of ownedBrowserPids(runtime))
|
|
807
|
+
await terminate(pid, 3000, ownedProcessIdentity('browser', pid, runtime));
|
|
808
|
+
} catch (stopError) {
|
|
809
|
+
incomplete(stopError);
|
|
810
|
+
}
|
|
807
811
|
}
|
|
808
812
|
throw error;
|
|
809
813
|
} finally {
|
|
810
814
|
for (const file of secrets) rmSync(file, { force: true });
|
|
811
|
-
if (guardFocus)
|
|
815
|
+
if (guardFocus) {
|
|
816
|
+
try {
|
|
817
|
+
checkFocusAfterLaunch(runtime, previousFrontmost);
|
|
818
|
+
} catch (focusError) {
|
|
819
|
+
// Advisory, like the rollback sweep: a failed probe must not replace the launch error.
|
|
820
|
+
focusLog(runtime, `check failed: ${focusError.message}`);
|
|
821
|
+
}
|
|
822
|
+
}
|
|
812
823
|
}
|
|
813
824
|
}
|
|
814
825
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { execFileSync } from 'node:child_process';
|
|
2
2
|
|
|
3
|
-
import { usablePython } from './python.mjs';
|
|
3
|
+
import { PYTHON_TIMEOUT_MS, usablePython } from './python.mjs';
|
|
4
4
|
|
|
5
5
|
// This opt-in is supplied by the blind worker boundary, never a general Chrome
|
|
6
6
|
// flag. LaunchServices would delegate to an unsandboxed service, so spawn directly.
|
|
@@ -18,7 +18,7 @@ lib = ctypes.CDLL('/usr/lib/libsandbox.dylib')
|
|
|
18
18
|
print(lib.sandbox_check(os.getpid(), None, 0))
|
|
19
19
|
`,
|
|
20
20
|
],
|
|
21
|
-
{ encoding: 'utf8', timeout:
|
|
21
|
+
{ encoding: 'utf8', timeout: PYTHON_TIMEOUT_MS },
|
|
22
22
|
).trim() === '1'
|
|
23
23
|
);
|
|
24
24
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// inspection never returns or decodes a process's environment.
|
|
3
3
|
import { execFileSync } from 'node:child_process';
|
|
4
4
|
|
|
5
|
-
import { usablePython } from './python.mjs';
|
|
5
|
+
import { PYTHON_TIMEOUT_MS, usablePython } from './python.mjs';
|
|
6
6
|
|
|
7
7
|
export const NATIVE_PROC_ARGS = String.raw`
|
|
8
8
|
import ctypes, json, struct, sys
|
|
@@ -43,7 +43,7 @@ export function runNativeProcessProbe(source, pid, { python = usablePython } = {
|
|
|
43
43
|
execFileSync(interpreter, ['-c', source, String(pid)], {
|
|
44
44
|
encoding: 'utf8',
|
|
45
45
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
46
|
-
timeout:
|
|
46
|
+
timeout: PYTHON_TIMEOUT_MS,
|
|
47
47
|
}),
|
|
48
48
|
);
|
|
49
49
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import { accessSync, constants, statSync } from 'node:fs';
|
|
2
3
|
|
|
3
4
|
// /usr/bin/python3 opens an install dialog until Command Line Tools exist.
|
|
4
5
|
// Resolve a real interpreter before any native probe can steal keyboard focus.
|
|
@@ -8,12 +9,17 @@ export function pythonFor({ found, platform = process.platform, developerDir })
|
|
|
8
9
|
return found;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
// A version-manager shim (asdf, pyenv) is a shell script that can take seconds
|
|
13
|
+
// to start on a loaded host. Every python spawn gets this budget.
|
|
14
|
+
export const PYTHON_TIMEOUT_MS = 15000;
|
|
15
|
+
|
|
16
|
+
function output(command, args, env = process.env) {
|
|
12
17
|
try {
|
|
13
18
|
return execFileSync(command, args, {
|
|
14
19
|
encoding: 'utf8',
|
|
20
|
+
env,
|
|
15
21
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
16
|
-
timeout:
|
|
22
|
+
timeout: PYTHON_TIMEOUT_MS,
|
|
17
23
|
}).trim();
|
|
18
24
|
} catch (error) {
|
|
19
25
|
// which exits 1 when absent; xcode-select exits 2 before CLT is installed.
|
|
@@ -22,13 +28,39 @@ function output(command, args) {
|
|
|
22
28
|
}
|
|
23
29
|
}
|
|
24
30
|
|
|
31
|
+
// These make sys.executable report another binary, which could be the stub.
|
|
32
|
+
const EXECUTABLE_OVERRIDES = ['PYTHONEXECUTABLE', '__PYVENV_LAUNCHER__'];
|
|
33
|
+
|
|
34
|
+
function executableFile(file) {
|
|
35
|
+
try {
|
|
36
|
+
accessSync(file, constants.X_OK);
|
|
37
|
+
return statSync(file).isFile();
|
|
38
|
+
} catch {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// The found python3 may be a shim: ask it once for the interpreter it runs, and
|
|
44
|
+
// spawn that binary for every probe, so the shim's startup is paid once. null:
|
|
45
|
+
// no usable python3. undefined: the shim failed to answer; try again later.
|
|
46
|
+
export function resolvePython({
|
|
47
|
+
run = output,
|
|
48
|
+
platform = process.platform,
|
|
49
|
+
env = process.env,
|
|
50
|
+
} = {}) {
|
|
51
|
+
const developerDir = () => run('/usr/bin/xcode-select', ['-p']);
|
|
52
|
+
const found = pythonFor({ found: run('/usr/bin/which', ['python3']), platform, developerDir });
|
|
53
|
+
if (!found) return null;
|
|
54
|
+
const clean = Object.fromEntries(
|
|
55
|
+
Object.entries(env).filter(([name]) => !EXECUTABLE_OVERRIDES.includes(name)),
|
|
56
|
+
);
|
|
57
|
+
const real = run(found, ['-c', 'import sys; print(sys.executable)'], clean);
|
|
58
|
+
if (!real || !executableFile(real)) return undefined;
|
|
59
|
+
return pythonFor({ found: real, platform, developerDir });
|
|
60
|
+
}
|
|
61
|
+
|
|
25
62
|
let pythonChoice;
|
|
26
63
|
export function usablePython() {
|
|
27
|
-
if (pythonChoice === undefined)
|
|
28
|
-
|
|
29
|
-
found: output('/usr/bin/which', ['python3']),
|
|
30
|
-
developerDir: () => output('/usr/bin/xcode-select', ['-p']),
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
return pythonChoice;
|
|
64
|
+
if (pythonChoice === undefined) pythonChoice = resolvePython();
|
|
65
|
+
return pythonChoice ?? null;
|
|
34
66
|
}
|