@ai-ecoverse/slicc-browsers 1.33.0 → 1.35.0

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/README.md CHANGED
@@ -93,7 +93,7 @@ Everything except `./fixture` runs in a browser as well as in Node. `protected.m
93
93
 
94
94
  `catalog.json` holds everything a program needs to know about browsers:
95
95
 
96
- - **Browsers.** Chrome, Edge, Brave, Opera, Vivaldi, Arc, Atlas, Dia and their pre-release channels, Chrome for Testing and Chromium, **in priority order**. Each has its macOS bundle, Windows install roots and registry keys, Linux binaries, `.desktop` ids, flatpak and snap names, and its default user-data dir.
96
+ - **Browsers.** Chrome, Edge, Brave, Opera, Vivaldi, Arc, Atlas, Dia and their pre-release channels, Chrome for Testing and Chromium, **in priority order**.
97
97
  - **Electron apps**: known apps by bundle id, and the ones that block remote debugging.
98
98
  - **Ranking**: endpoints with a seven tab come first, then other running endpoints, then installed Chrome, other installed Chromium browsers, Electron apps, and SLICC six's profile last. Browsers older than Chromium 116 are left out.
99
99
  - **Discovery**: `DevToolsActivePort` files, the ports to probe, the process scan, and how endpoints are named, normalized and merged.
@@ -249,7 +249,7 @@ You supply:
249
249
  | `jsonList` | expose `/json/list` (`client.jsonList` / `devtoolsHttp`); missing → not-supported, or incomplete if declared |
250
250
  | `requestInterception`, `fetchInterception`, `legacyInterception` | response interception |
251
251
 
252
- `signInHold` may implement `client.signInHold.ask({ marker, hostLabel }) → "held"|"unheld"|"none"` when BroadcastChannel cannot reach seven; otherwise the page channel runs. The raw observer waits for a committed document, then reads the fixture mark.
252
+ `signInHold` may implement `client.signInHold.ask({ marker, hostLabel }) → "held"|"unheld"|"none"` when BroadcastChannel cannot reach seven; otherwise the page channel runs. With `ask`, an optional `prepare({ marker, hostLabel })` runs on the guarded leg before the popup opens, and `ask`, after the open, gets its result as `baseline`; if `prepare` throws or stalls, the row is incomplete. The raw observer waits for a committed document, then reads the fixture mark.
253
253
 
254
254
  ### Reading the result
255
255
 
package/guard-runner.mjs CHANGED
@@ -58,6 +58,7 @@ const discoveryMethods = [
58
58
  'Target.attachedToTarget',
59
59
  ];
60
60
  const controlPremises = ['discovered', 'listed', 'attachSession', 'reachable'];
61
+ const unguardedPremises = ['workerAttached', 'workerReachable'];
61
62
  const exclusive = ['stockSetup', 'syntheticAutoAttach'];
62
63
 
63
64
  const escapes = /(?:%[0-9a-f]{2})+/gi;
@@ -278,6 +279,7 @@ export function pickRawTarget(infos, { type, openerId, urlPrefix, known = new Se
278
279
  }
279
280
  const namedResultMs = 10000;
280
281
  const observeMs = 5000;
282
+ const reachRetryMs = 250;
281
283
  const premises = { chainStarted: 'first hop not observed' };
282
284
 
283
285
  function autoAttachSession(events, start, targetId) {
@@ -1734,8 +1736,41 @@ class Execution {
1734
1736
  return reachable;
1735
1737
  }
1736
1738
 
1739
+ async settleReach() {
1740
+ const step = expand(this.probeStep(), this.vars);
1741
+ const bound = this.bound(observeMs);
1742
+ const start = Date.now();
1743
+ let tries = this.calls.probe?.result ? 1 : 0;
1744
+ let reached = this.calls.probe?.result?.reachable === true;
1745
+ const retry = async () => {
1746
+ if (this.clients.flight?.abandoned) return true;
1747
+ tries++;
1748
+ const out = await probeWorkerSessions({
1749
+ client: this.client,
1750
+ sessions: this.probeSessionIds(step),
1751
+ path: expand(step.probeSessions.path, this.vars),
1752
+ tag: this.vars.tag,
1753
+ detached: (sessionId) => this.detached(sessionId),
1754
+ });
1755
+ if (out.reachable) reached = true;
1756
+ return reached;
1757
+ };
1758
+ if (!reached) await waitFor(retry, bound, this.bound(reachRetryMs), true);
1759
+ this.note(
1760
+ `workerReachable: control probe ${reached ? 'reached' : 'missed'}, ${tries} tries, ${Date.now() - start}ms (bound ${bound}ms)`
1761
+ );
1762
+ if (reached)
1763
+ this.calls.probe = {
1764
+ ok: true,
1765
+ result: { ...(this.calls.probe?.result ?? {}), reachable: true },
1766
+ };
1767
+ return reached;
1768
+ }
1769
+
1737
1770
  async observeProbeReachable(want, check) {
1738
1771
  if (want !== true && want !== false) return this.check(check);
1772
+ if (this.side === 'control' && want === true && this.unguardedPremise('workerReachable'))
1773
+ return this.settleReach();
1739
1774
  let seen = await this.probeFreshSessions();
1740
1775
  if (seen === 'incomplete') return this.side === 'control' ? false : 'incomplete';
1741
1776
  if (seen === true) return true;
@@ -2659,6 +2694,7 @@ class Execution {
2659
2694
  if (holds === 'incomplete') incomplete.push(name);
2660
2695
  }
2661
2696
  this.premises(observed);
2697
+ this.unguardedPremises(observed);
2662
2698
  this.explicitPremises(observed);
2663
2699
  if (this.side === 'control' && excused && !measured) this.incomplete.push('measured nothing');
2664
2700
  return { observed, incomplete };
@@ -2680,6 +2716,23 @@ class Execution {
2680
2716
  if (want?.[name] === true && observed[name] === false) observed[name] = 'incomplete';
2681
2717
  }
2682
2718
 
2719
+ unguardedPremise(name) {
2720
+ return (
2721
+ this.vector.control.via === 'unguarded' &&
2722
+ this.vector.control.expected?.[name] === true &&
2723
+ this.vector.expected?.[name] === false
2724
+ );
2725
+ }
2726
+
2727
+ unguardedPremises(observed) {
2728
+ if (this.side !== 'control') return;
2729
+ for (const name of unguardedPremises)
2730
+ if (this.unguardedPremise(name) && observed[name] === false) {
2731
+ observed[name] = 'incomplete';
2732
+ this.incomplete.push(`${name}: the unguarded control did not show it`);
2733
+ }
2734
+ }
2735
+
2683
2736
  async explicitLost() {
2684
2737
  if (!this.explicit || !this.vars.rawTarget) return false;
2685
2738
  const targetId = this.vars.rawTarget;
@@ -3341,6 +3394,8 @@ function settleIncomplete(row, vector, base, legs) {
3341
3394
  });
3342
3395
  for (const side of ['control', 'guarded'])
3343
3396
  if (legs[side].incomplete?.length && filled[side] === 'pass') row[side] = 'incomplete';
3397
+ if (legs.control.incomplete?.length && row.guarded === 'fail' && filled.guarded === 'pass')
3398
+ row.guarded = 'incomplete';
3344
3399
  if (legs.guarded.live === 'incomplete' && filled.live === 'pass') row.live = 'incomplete';
3345
3400
  row.why = [filled.why, `incomplete: ${incomplete.join('; ')}`].filter(Boolean).join('; ');
3346
3401
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "setVersion": "1.33.0",
3
+ "setVersion": "1.35.0",
4
4
  "sources": [
5
5
  {
6
6
  "repo": "ai-ecoverse/slicc-cli",
@@ -33060,7 +33060,7 @@
33060
33060
  "expected": {
33061
33061
  "admitted": true,
33062
33062
  "workerExists": true,
33063
- "workerAttached": "either",
33063
+ "workerAttached": true,
33064
33064
  "workerListed": true,
33065
33065
  "attachSession": true,
33066
33066
  "attachRefused": false,
@@ -33078,8 +33078,7 @@
33078
33078
  "workerReachable": false
33079
33079
  },
33080
33080
  "designDependent": [
33081
- "attachRefused",
33082
- "workerAttached"
33081
+ "attachRefused"
33083
33082
  ]
33084
33083
  },
33085
33084
  {
@@ -34439,7 +34438,7 @@
34439
34438
  "expected": {
34440
34439
  "admitted": true,
34441
34440
  "workerExists": true,
34442
- "workerAttached": "either",
34441
+ "workerAttached": true,
34443
34442
  "workerListed": true,
34444
34443
  "attachSession": true,
34445
34444
  "attachRefused": false,
@@ -34457,8 +34456,7 @@
34457
34456
  "workerReachable": false
34458
34457
  },
34459
34458
  "designDependent": [
34460
- "attachRefused",
34461
- "workerAttached"
34459
+ "attachRefused"
34462
34460
  ]
34463
34461
  },
34464
34462
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-browsers",
3
- "version": "1.33.0",
3
+ "version": "1.35.0",
4
4
  "description": "SLICC's shared browser catalog, JSON schemas and discovery conformance corpus",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -79,7 +79,7 @@
79
79
  "validate": "node scripts/validate.mjs",
80
80
  "lint": "slicc-lint && test -z \"$(gofmt -l .)\" && go mod tidy -diff && go vet ./... && GOOS=darwin go vet ./... && GOOS=windows go vet ./... && golangci-lint run && cargo fmt --check && cargo clippy --all-features --all-targets -- -D warnings && cargo check --target wasm32-wasip1 --no-default-features && cargo check --target wasm32-wasip1 --features serde && cargo check --target wasm32-wasip1 --all-features",
81
81
  "format": "biome check --write . && gofmt -w . && cargo fmt",
82
- "test": "export PATH=\"$HOME/.cargo/bin:$PATH\" && node --test --test-concurrency=1 test/integration/debugger-stage1-packaging.test.mjs test/integration/debugger-raw-control.test.mjs test/integration/debugger-cleanup.test.mjs test/integration/debugger-stage1-install-vectors.test.mjs test/integration/protected-premise.test.mjs test/integration/debugger-stage1-vectors.test.mjs test/integration/self-contained.test.mjs test/integration/seven-corpus.test.mjs test/integration/browser-runner.test.mjs test/integration/fixture-client.test.mjs test/integration/guard-redirect-carrier.test.mjs test/integration/guard-redirect-session-end.test.mjs test/integration/guard-redirect-history.test.mjs test/integration/guard-redirect-iframe.test.mjs test/integration/guard-redirect-through.test.mjs test/integration/guard-incomplete.test.mjs test/integration/guard-unparseable-wipe.test.mjs test/integration/guard-browser-ui.test.mjs test/integration/guard-snapshot-settle.test.mjs test/integration/guard-stall.test.mjs test/integration/guard-forged.test.mjs test/integration/guard-trusted-emulation.test.mjs test/integration/guard-exit-steps.test.mjs test/integration/guard-exit-refusal.test.mjs test/integration/guard-frame-read.test.mjs test/integration/guard-bfcache.test.mjs test/integration/guard-bfcache-marker.test.mjs test/integration/guard-bfcache-history.test.mjs test/integration/guard-bfcache-review.test.mjs test/integration/guard-bfcache-quarantine.test.mjs test/integration/guard-error-page-navigation.test.mjs test/integration/guard-error-page-events.test.mjs test/integration/guard-error-page-reload.test.mjs test/integration/guard-close-protected.test.mjs test/integration/guard-close-protected-shapes.test.mjs test/integration/guard-close-protected-shapes-chrome.test.mjs test/integration/guard-credential-export.test.mjs test/integration/guard-protected-parent-iframes.test.mjs test/integration/guard-protected-parent-iframes-chrome.test.mjs test/integration/guard-error-frame-class.test.mjs test/integration/guard-sign-in-hold.test.mjs test/integration/guard-cookie-plant-chrome.test.mjs test/integration/guard-cookie-plant.test.mjs test/integration/guard-protected-parent-page.test.mjs test/integration/guard-protected-parent-page-chrome.test.mjs test/integration/guard-world-paint.test.mjs test/integration/gates.test.mjs test/integration/validate.test.mjs test/integration/validate-guard-stock-setup.test.mjs test/integration/validate-guard-explicit.test.mjs test/integration/go.test.mjs test/integration/cargo.test.mjs test/integration/workflows.test.mjs test/integration/guard-refusable-nav.test.mjs test/integration/guard-protected-worker.test.mjs test/integration/guard-protected-worker-chrome-narrow.test.mjs test/integration/guard-protected-worker-chrome-hide.test.mjs test/integration/guard-protected-worker-chrome-hide-cut.test.mjs test/integration/guard-protected-worker-chrome-admit.test.mjs test/integration/guard-protected-worker-chrome-late.test.mjs test/integration/guard-protected-worker-chrome-rewrite.test.mjs test/integration/guard-protected-worker-chrome-rewrite-late.test.mjs test/integration/guard-sweep-union.test.mjs test/integration/guard-explicit-attach-chrome.test.mjs && node --test --test-concurrency=2 test/integration/guard-lifecycle.test.mjs test/integration/chromium-launch.test.mjs test/integration/guard-fit.test.mjs test/integration/guard-chain.test.mjs test/integration/guard-validation.test.mjs test/integration/guard-liveness.test.mjs test/integration/guard-observations.test.mjs test/integration/guard-child-latency.test.mjs test/integration/guard-child-latency-stress.test.mjs test/integration/guard-adoption.test.mjs test/integration/guard-scoping.test.mjs test/integration/guard-late-pause.test.mjs test/integration/guard-cookie-plant-raw-leg.test.mjs test/integration/guard-legs.test.mjs test/integration/guard-fetch-enable.test.mjs test/integration/guard-diagnostics.test.mjs test/integration/guard-chrome.test.mjs test/integration/guard-worlds.test.mjs test/integration/guard-world-discovery.test.mjs test/integration/guard-world-guesses.test.mjs test/integration/guard-unparseable.test.mjs test/integration/guard-redirect-secret.test.mjs test/integration/guard-error-page.test.mjs test/integration/guard-discovery.test.mjs test/integration/guard-bfcache-chrome.test.mjs test/integration/guard-browser-page.test.mjs test/integration/guard-scales.test.mjs test/integration/guard-shared-log.test.mjs test/integration/guard-pre-beacon.test.mjs test/integration/guard-world-pause.test.mjs test/integration/guard-reveal-overlap.test.mjs test/integration/guard-extension-frame-cast.test.mjs test/integration/guard-extension-frame-mouse.test.mjs test/integration/guard-extension-frame-click.test.mjs test/integration/guard-extension-frame-attach.test.mjs test/integration/guard-extension-frames.test.mjs test/integration/guard-stock-setup.test.mjs test/integration/guard-explicit-attach.test.mjs test/integration/guard-explicit-order.test.mjs test/integration/guard-stock-attack.test.mjs test/integration/guard-parallel.test.mjs test/integration/guard-client-exit.test.mjs test/integration/guard-runner-record.test.mjs test/integration/guard-runner.test.mjs test/integration/guard-sweep-ordinary.test.mjs test/integration/guard-sweep-seven.test.mjs test/integration/guard-sweep-vault.test.mjs test/integration/guard-sweep-vault-x.test.mjs test/integration/guard-sweep-apex.test.mjs test/integration/guard-sweep-idp.test.mjs test/integration/guard-sweep-others.test.mjs",
82
+ "test": "export PATH=\"$HOME/.cargo/bin:$PATH\" && node --test --test-concurrency=1 test/integration/debugger-stage1-packaging.test.mjs test/integration/debugger-raw-control.test.mjs test/integration/debugger-cleanup.test.mjs test/integration/debugger-stage1-install-vectors.test.mjs test/integration/protected-premise.test.mjs test/integration/debugger-stage1-vectors.test.mjs test/integration/self-contained.test.mjs test/integration/seven-corpus.test.mjs test/integration/browser-runner.test.mjs test/integration/fixture-client.test.mjs test/integration/guard-redirect-carrier.test.mjs test/integration/guard-redirect-session-end.test.mjs test/integration/guard-redirect-history.test.mjs test/integration/guard-redirect-iframe.test.mjs test/integration/guard-redirect-through.test.mjs test/integration/guard-incomplete.test.mjs test/integration/guard-unparseable-wipe.test.mjs test/integration/guard-browser-ui.test.mjs test/integration/guard-snapshot-settle.test.mjs test/integration/guard-stall.test.mjs test/integration/guard-forged.test.mjs test/integration/guard-trusted-emulation.test.mjs test/integration/guard-exit-steps.test.mjs test/integration/guard-exit-refusal.test.mjs test/integration/guard-frame-read.test.mjs test/integration/guard-bfcache.test.mjs test/integration/guard-bfcache-marker.test.mjs test/integration/guard-bfcache-history.test.mjs test/integration/guard-bfcache-review.test.mjs test/integration/guard-bfcache-quarantine.test.mjs test/integration/guard-error-page-navigation.test.mjs test/integration/guard-error-page-events.test.mjs test/integration/guard-error-page-reload.test.mjs test/integration/guard-close-protected.test.mjs test/integration/guard-close-protected-shapes.test.mjs test/integration/guard-close-protected-shapes-chrome.test.mjs test/integration/guard-credential-export.test.mjs test/integration/guard-protected-parent-iframes.test.mjs test/integration/guard-protected-parent-iframes-chrome.test.mjs test/integration/guard-error-frame-class.test.mjs test/integration/guard-sign-in-hold.test.mjs test/integration/guard-cookie-plant-chrome.test.mjs test/integration/guard-cookie-plant.test.mjs test/integration/guard-protected-parent-page.test.mjs test/integration/guard-protected-parent-page-chrome.test.mjs test/integration/guard-world-paint.test.mjs test/integration/gates.test.mjs test/integration/validate.test.mjs test/integration/validate-guard-stock-setup.test.mjs test/integration/validate-guard-explicit.test.mjs test/integration/go.test.mjs test/integration/cargo.test.mjs test/integration/workflows.test.mjs test/integration/guard-refusable-nav.test.mjs test/integration/guard-protected-worker.test.mjs test/integration/guard-protected-worker-chrome-narrow.test.mjs test/integration/guard-protected-worker-chrome-hide.test.mjs test/integration/guard-protected-worker-chrome-hide-cut.test.mjs test/integration/guard-protected-worker-chrome-admit.test.mjs test/integration/guard-protected-worker-chrome-late.test.mjs test/integration/guard-protected-worker-chrome-rewrite.test.mjs test/integration/guard-protected-worker-chrome-rewrite-late.test.mjs test/integration/guard-sweep-union.test.mjs test/integration/guard-explicit-attach-chrome.test.mjs && node --test --test-concurrency=2 test/integration/guard-lifecycle.test.mjs test/integration/chromium-launch.test.mjs test/integration/guard-fit.test.mjs test/integration/guard-chain.test.mjs test/integration/guard-validation.test.mjs test/integration/guard-liveness.test.mjs test/integration/guard-observations.test.mjs test/integration/guard-child-latency.test.mjs test/integration/guard-child-latency-stress.test.mjs test/integration/guard-adoption.test.mjs test/integration/guard-scoping.test.mjs test/integration/guard-late-pause.test.mjs test/integration/guard-cookie-plant-raw-leg.test.mjs test/integration/guard-legs.test.mjs test/integration/guard-fetch-enable.test.mjs test/integration/guard-diagnostics.test.mjs test/integration/guard-chrome.test.mjs test/integration/guard-worlds.test.mjs test/integration/guard-world-discovery.test.mjs test/integration/guard-world-guesses.test.mjs test/integration/guard-unparseable.test.mjs test/integration/guard-redirect-secret.test.mjs test/integration/guard-error-page.test.mjs test/integration/guard-discovery.test.mjs test/integration/guard-bfcache-chrome.test.mjs test/integration/guard-browser-page.test.mjs test/integration/guard-scales.test.mjs test/integration/guard-shared-log.test.mjs test/integration/guard-pre-beacon.test.mjs test/integration/guard-world-pause.test.mjs test/integration/guard-reveal-overlap.test.mjs test/integration/guard-extension-frame-cast.test.mjs test/integration/guard-extension-frame-mouse.test.mjs test/integration/guard-extension-frame-click.test.mjs test/integration/guard-extension-frame-attach.test.mjs test/integration/guard-extension-frames.test.mjs test/integration/guard-stock-setup.test.mjs test/integration/guard-explicit-attach.test.mjs test/integration/guard-explicit-order.test.mjs test/integration/guard-stock-attack.test.mjs test/integration/guard-parallel.test.mjs test/integration/guard-client-exit.test.mjs test/integration/guard-runner-record.test.mjs test/integration/guard-runner.test.mjs test/integration/guard-sweep-ordinary.test.mjs test/integration/guard-sweep-seven.test.mjs test/integration/guard-sweep-vault.test.mjs test/integration/guard-sweep-vault-x.test.mjs test/integration/guard-sweep-apex.test.mjs test/integration/guard-sweep-idp.test.mjs test/integration/guard-sweep-others.test.mjs test/integration/guard-control-premises.test.mjs",
83
83
  "test:unit": "mkdir -p coverage/unit && node --experimental-test-coverage --test --test-concurrency=1 --test-reporter=lcov --test-reporter-destination=coverage/unit/lcov.info test/unit/*.test.mjs && go test -race -cover ./...",
84
84
  "build": "go build ./... && cargo build --all-features && cargo build --target wasm32-wasip1 --all-features && npm pack --dry-run",
85
85
  "prepublishOnly": "node scripts/set-crate-version.mjs \"$npm_package_version\"",
@@ -90,7 +90,7 @@
90
90
  "test:unit:guard": "mkdir -p coverage/unit && node --experimental-vm-modules --no-warnings --experimental-test-coverage --test --test-concurrency=1 --test-coverage-include=guard-runner.mjs --test-coverage-include=guard-driver.mjs --test-coverage-include=extension-frame.mjs --test-coverage-include=fixture-server.mjs --test-coverage-include=fixture-client.mjs --test-coverage-include=observer-target.mjs --test-coverage-include=frame-read.mjs --test-coverage-include=bfcache-restore.mjs --test-coverage-include=protected-error-page.mjs --test-coverage-include=protected-parent-iframes.mjs --test-coverage-include=unparseable-url.mjs --test-coverage-include=scripts/browser-runner.mjs --test-coverage-include=scripts/validate.mjs --test-reporter=lcov --test-reporter-destination=coverage/unit/guard.lcov test/unit/guard-*.test.mjs && slicc-diff-cover coverage/unit/guard.lcov"
91
91
  },
92
92
  "devDependencies": {
93
- "@ai-ecoverse/slicc-cdp": "2.1.17",
93
+ "@ai-ecoverse/slicc-cdp": "2.1.18",
94
94
  "@ai-ecoverse/slicc-shared-web": "2.17.0",
95
95
  "@biomejs/biome": "2.6.8",
96
96
  "ajv": "8.20.0",
package/sign-in-hold.mjs CHANGED
@@ -477,14 +477,38 @@ function hostLabelOf(origin) {
477
477
  }
478
478
  }
479
479
 
480
- async function askHold(client, { marker, hostLabel, notes }) {
480
+ async function prepareHold(client, { useAsk, marker, hostLabel, notes, budget }) {
481
+ const hold = client?.signInHold;
482
+ if (!useAsk || typeof hold.prepare !== 'function') return undefined;
483
+ note(notes, 'sign-in-hold.prepare', { via: 'signInHold.prepare', marker, hostLabel });
484
+ const ms = Math.min(budget, 6000);
485
+ let timer;
486
+ try {
487
+ const baseline = await Promise.race([
488
+ Promise.resolve(hold.prepare({ marker, hostLabel })),
489
+ new Promise((_, reject) => {
490
+ timer = setTimeout(() => reject(new Error(`timed out after ${ms}ms`)), ms);
491
+ }),
492
+ ]);
493
+ return { baseline };
494
+ } catch (error) {
495
+ return { incomplete: `signInHold.prepare: ${error?.message ?? error}` };
496
+ } finally {
497
+ if (timer) clearTimeout(timer);
498
+ }
499
+ }
500
+
501
+ async function askHold(client, { marker, hostLabel, notes, prepared }) {
481
502
  const hold = client?.signInHold;
482
503
  if (typeof hold?.ask !== 'function') return { used: false };
483
504
  note(notes, 'sign-in-hold.ask', { via: 'signInHold.ask', marker, hostLabel });
505
+ const asked = prepared
506
+ ? { marker, hostLabel, baseline: prepared.baseline }
507
+ : { marker, hostLabel };
484
508
  let timer;
485
509
  try {
486
510
  const answer = await Promise.race([
487
- Promise.resolve(hold.ask({ marker, hostLabel })),
511
+ Promise.resolve(hold.ask(asked)),
488
512
  new Promise((_, reject) => {
489
513
  timer = setTimeout(() => {
490
514
  const error = new Error('signInHold.ask timed out');
@@ -602,6 +626,9 @@ async function heldPopup({
602
626
  const before = await outcome(reader.send('Target.getTargets', {}));
603
627
  const known = new Set((before.result?.targetInfos ?? []).map((info) => info.targetId));
604
628
  const useAsk = !control && typeof client?.signInHold?.ask === 'function';
629
+ const hostLabel = hostLabelOf(openerOrigin ?? ordinary);
630
+ const prepared = await prepareHold(client, { useAsk, marker, hostLabel, notes, budget });
631
+ if (prepared?.incomplete) return { incomplete: prepared.incomplete, openerId };
605
632
  const asked = await outcome(
606
633
  reader.send(
607
634
  'Runtime.evaluate',
@@ -623,11 +650,7 @@ async function heldPopup({
623
650
  let holdAnswer = asked.result?.result?.value?.answer ?? 'missing';
624
651
  const openedPopup = asked.result?.result?.value?.opened;
625
652
  if (useAsk) {
626
- const askedHold = await askHold(client, {
627
- marker,
628
- hostLabel: hostLabelOf(openerOrigin ?? ordinary),
629
- notes,
630
- });
653
+ const askedHold = await askHold(client, { marker, hostLabel, notes, prepared });
631
654
  if (askedHold.incomplete) {
632
655
  const found = await askedPopup(reader, {
633
656
  known,
@@ -652,6 +675,7 @@ async function heldPopup({
652
675
  control: Boolean(control),
653
676
  opened: openedPopup,
654
677
  askHook: useAsk,
678
+ ...(prepared ? { prepared: true } : {}),
655
679
  });
656
680
  if (openedPopup === false)
657
681
  return {