@farmslot/adapter-web 0.19.32 → 0.19.34

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,14 @@ 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.34 - 2026-11-25
10
+
11
+ - Republished in the 25 Nov cohort release with the other @farmslot packages, so an install resolves one copy of each.
12
+
13
+ ## 0.19.33 - 2026-11-24
14
+
15
+ - A Terminal (web-dapp) launch with no display choice runs headless when the macOS session is locked, instead of refusing with SESSION_LOCKED. Headful stays the default when the screen can paint; an explicit `--headful` or `TERMINAL_HEADLESS=0` on a locked session still refuses.
16
+
9
17
  ## 0.19.32 - 2026-11-24
10
18
 
11
19
  - The injected wallet presented as MetaMask also answers the extension's window streams (`metamask-provider` and the `metamask-multichain-provider` session API), so apps that log in through `@metamask/connect-multichain`, such as the Web Terminal's Web3Auth login, finish starting and can connect.
@@ -1,5 +1,6 @@
1
- export function resolveHeadless({ headless, headful, nodeHeadless, nodeHeadful, env, }?: {
1
+ export function resolveHeadless({ headless, headful, nodeHeadless, nodeHeadful, env, sessionLocked, }?: {
2
2
  env?: NodeJS.ProcessEnv | undefined;
3
+ sessionLocked?: (() => boolean) | undefined;
3
4
  }): boolean;
4
5
  export function resolveSlowMo({ flag, node, env }?: {
5
6
  env?: NodeJS.ProcessEnv | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farmslot/adapter-web",
3
- "version": "0.19.32",
3
+ "version": "0.19.34",
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": {
@@ -87,9 +87,9 @@
87
87
  "prepublishOnly": "node ../../scripts/quality/check-farmslot-package-readiness.mjs --publish --packages @farmslot/adapter-web"
88
88
  },
89
89
  "dependencies": {
90
- "@farmslot/adapter-sdk": "0.31.2",
91
- "@farmslot/protocol": "0.92.0",
92
- "@farmslot/recipe-runner": "0.52.2",
90
+ "@farmslot/adapter-sdk": "0.31.3",
91
+ "@farmslot/protocol": "0.92.1",
92
+ "@farmslot/recipe-runner": "0.52.4",
93
93
  "ws": "^8.18.0"
94
94
  },
95
95
  "devDependencies": {
@@ -485,11 +485,28 @@ export async function launchWebDappBrowser(
485
485
  chmodSync(runtime, 0o700);
486
486
  const stateFile = path.join(runtime, 'browser.json');
487
487
  const appOrigin = `http://localhost:${appPort}`;
488
- const headless = resolveHeadless({ headless: args.headless, headful: args.headful, env });
488
+ // The session is probed at most once: by the default display choice, or by
489
+ // the refusal below.
490
+ let probed = false;
491
+ let locked;
492
+ const probeLock = () => {
493
+ if (!probed) {
494
+ probed = true;
495
+ locked = sessionLocked();
496
+ }
497
+ return locked;
498
+ };
499
+ const headless = resolveHeadless({
500
+ headless: args.headless,
501
+ headful: args.headful,
502
+ env,
503
+ sessionLocked: () => probeLock() === true,
504
+ });
489
505
  const slowMoMs = resolveSlowMo({ flag: args['slow-mo'], env });
490
- // A headful browser can't paint while the macOS session is locked: refuse
491
- // before starting, reusing or stopping one.
492
- if (!headless && sessionLocked() === true) {
506
+ if (headless && locked === true) log('the macOS session is locked: launching headless');
507
+ // A headful browser that was asked for can't paint while the macOS session
508
+ // is locked: refuse before starting, reusing or stopping one.
509
+ if (!headless && probeLock() === true) {
493
510
  throw new Error(
494
511
  `SESSION_LOCKED: ${SESSION_LOCKED_MESSAGE}\nNext: ${SESSION_LOCKED_USER_ACTION}`,
495
512
  );
@@ -19,13 +19,15 @@ function envFlag(raw, label) {
19
19
 
20
20
  // Headless precedence: an explicit flag (--headless, or --headful as its
21
21
  // opposite) → the launch node (headless, or headful as its opposite) → env
22
- // TERMINAL_HEADLESS → headful.
22
+ // TERMINAL_HEADLESS → headful, or headless when `sessionLocked` says the macOS
23
+ // session is locked (a headful browser can't paint there).
23
24
  export function resolveHeadless({
24
25
  headless,
25
26
  headful,
26
27
  nodeHeadless,
27
28
  nodeHeadful,
28
29
  env = process.env,
30
+ sessionLocked = () => false,
29
31
  } = {}) {
30
32
  if (headless === true && headful === true)
31
33
  throw new Error('--headless and --headful are mutually exclusive.');
@@ -33,7 +35,12 @@ export function resolveHeadless({
33
35
  if (headful === true) return false;
34
36
  if (typeof nodeHeadless === 'boolean') return nodeHeadless;
35
37
  if (nodeHeadful === true) return false;
36
- return envFlag(env.TERMINAL_HEADLESS, 'TERMINAL_HEADLESS') ?? false;
38
+ // An empty TERMINAL_HEADLESS chooses nothing, like an unset one.
39
+ const raw = env.TERMINAL_HEADLESS;
40
+ const fromEnv =
41
+ raw == null || String(raw).trim() === '' ? undefined : envFlag(raw, 'TERMINAL_HEADLESS');
42
+ if (fromEnv !== undefined) return fromEnv;
43
+ return sessionLocked() === true;
37
44
  }
38
45
 
39
46
  function slowMoValue(raw, label) {