@gvnrdao/dh-mcp 0.5.20 → 0.5.21

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/dist/index.js CHANGED
@@ -13422,6 +13422,12 @@ var require_follow_redirects = __commonJS({
13422
13422
  RedirectableRequest.prototype._sanitizeOptions = function(options) {
13423
13423
  if (!options.headers) {
13424
13424
  options.headers = {};
13425
+ } else if (Array.isArray(options.headers)) {
13426
+ var headerList = options.headers;
13427
+ options.headers = {};
13428
+ for (var i = 0; i < headerList.length; i += 2) {
13429
+ options.headers[headerList[i]] = headerList[i + 1];
13430
+ }
13425
13431
  }
13426
13432
  if (!isArray2(options.sensitiveHeaders)) {
13427
13433
  options.sensitiveHeaders = [];
@@ -13696,7 +13702,7 @@ var require_follow_redirects = __commonJS({
13696
13702
  return URL3 && value instanceof URL3;
13697
13703
  }
13698
13704
  function escapeRegex(regex) {
13699
- return regex.replace(/[\]\\/()*+?.$]/g, "\\$&");
13705
+ return regex.replace(/[[\]\\/()*+?.^$|]/g, "\\$&");
13700
13706
  }
13701
13707
  module2.exports = wrap({ http: http4, https: https2 });
13702
13708
  module2.exports.wrap = wrap;
@@ -14688,6 +14694,32 @@ var require_pkg_src = __commonJS({
14688
14694
  deployedAt: 1790246264563,
14689
14695
  size: 69219,
14690
14696
  hash: "bda048d8cd6b5a39c2774bcf1320e82d1eea935c2a521006fb8b887e13b6dd8d"
14697
+ },
14698
+ carryCollateralAttestation: {
14699
+ cid: "QmYWULmXD9S5AmTdQqWqoZ28ctsZQNcXkAgre9G2Xo9dh8",
14700
+ authorizedCidHex: cidToHex(
14701
+ "QmYWULmXD9S5AmTdQqWqoZ28ctsZQNcXkAgre9G2Xo9dh8"
14702
+ ),
14703
+ name: "Carry Collateral Attestation",
14704
+ description: "LoanCarryVault collateral attestation (borrower, BTC vault, confirmed BTC)",
14705
+ version: "1.0.0",
14706
+ deployed: true,
14707
+ deployedAt: 1790927734070,
14708
+ size: 21156,
14709
+ hash: "05b177e0bb36b0483db4a42d33c1bbbf47eb9ef34ae278459397d51a7f8957ff"
14710
+ },
14711
+ carryFundingAttestation: {
14712
+ cid: "QmWhox3xUZMNR5NpPZ9WLSPC5GoW4ms88GanVRKr8uuS3W",
14713
+ authorizedCidHex: cidToHex(
14714
+ "QmWhox3xUZMNR5NpPZ9WLSPC5GoW4ms88GanVRKr8uuS3W"
14715
+ ),
14716
+ name: "Carry Funding Attestation",
14717
+ description: "LoanCarryVault funding attestation (Hyperliquid BTC windowed hourly average)",
14718
+ version: "1.0.0",
14719
+ deployed: true,
14720
+ deployedAt: 1790925699980,
14721
+ size: 7193,
14722
+ hash: "4944ada61610cf64b32e33b5be62087088dcf5e821040c69e67942e643ce74c9"
14691
14723
  }
14692
14724
  };
14693
14725
  function getDeploymentsForNetwork(network) {
@@ -15431,7 +15463,7 @@ ${errorReport}`);
15431
15463
  }
15432
15464
  init_debug_logger();
15433
15465
  init_session_signature_cache();
15434
- var import_ethers53 = require("ethers");
15466
+ var import_ethers55 = require("ethers");
15435
15467
  var EXPIRED_LOAN_MIN_LIQUIDATION_THRESHOLD_BPS = 11e3;
15436
15468
  var GRACE_PERIOD_DAYS = 30;
15437
15469
  var SATOSHIS_PER_BITCOIN = 100000000n;
@@ -18427,12 +18459,12 @@ ${auth.clientId}`;
18427
18459
  }
18428
18460
  async function executeVaultSnapshot(params) {
18429
18461
  global.ethers = {
18430
- ...import_ethers53.ethers,
18462
+ ...import_ethers55.ethers,
18431
18463
  providers: {
18432
- StaticJsonRpcProvider: import_ethers53.ethers.JsonRpcProvider
18464
+ StaticJsonRpcProvider: import_ethers55.ethers.JsonRpcProvider
18433
18465
  },
18434
- Contract: import_ethers53.ethers.Contract,
18435
- utils: import_ethers53.ethers
18466
+ Contract: import_ethers55.ethers.Contract,
18467
+ utils: import_ethers55.ethers
18436
18468
  // v6 moved utils to top level
18437
18469
  };
18438
18470
  global.Lit = {
@@ -27312,7 +27344,7 @@ var require_lit_ops_module = __commonJS({
27312
27344
  break;
27313
27345
  case 11155111:
27314
27346
  chain = "sepolia";
27315
- bitcoinProviderUrl = process.env.BITCOIN_PROVIDER_URL || "https://dh-btc-faucet-jw-bb7756976029.herokuapp.com/api/esplora";
27347
+ bitcoinProviderUrl = process.env.BITCOIN_PROVIDER_URL || "https://regtest.diamondhands.credit/api/esplora";
27316
27348
  break;
27317
27349
  case 1337:
27318
27350
  // Hardhat local testnet (actual deployment chainId)
@@ -27501,7 +27533,7 @@ var require_lit_ops_module = __commonJS({
27501
27533
  break;
27502
27534
  case 11155111:
27503
27535
  chain = "sepolia";
27504
- bitcoinProviderUrl = process.env.BITCOIN_PROVIDER_URL || "https://dh-btc-faucet-jw-bb7756976029.herokuapp.com/api/esplora";
27536
+ bitcoinProviderUrl = process.env.BITCOIN_PROVIDER_URL || "https://regtest.diamondhands.credit/api/esplora";
27505
27537
  break;
27506
27538
  case 1337:
27507
27539
  // Hardhat local testnet (actual deployment chainId)
@@ -27692,7 +27724,7 @@ var require_lit_ops_module = __commonJS({
27692
27724
  break;
27693
27725
  case 11155111:
27694
27726
  chain = "sepolia";
27695
- bitcoinProviderUrl = process.env.BITCOIN_PROVIDER_URL || "https://dh-btc-faucet-jw-bb7756976029.herokuapp.com/api/esplora";
27727
+ bitcoinProviderUrl = process.env.BITCOIN_PROVIDER_URL || "https://regtest.diamondhands.credit/api/esplora";
27696
27728
  break;
27697
27729
  case 1337:
27698
27730
  case 31337:
@@ -27840,7 +27872,7 @@ var require_lit_ops_module = __commonJS({
27840
27872
  break;
27841
27873
  case 11155111:
27842
27874
  chain = "sepolia";
27843
- bitcoinProviderUrl = process.env.BITCOIN_PROVIDER_URL || "https://dh-btc-faucet-jw-bb7756976029.herokuapp.com/api/esplora";
27875
+ bitcoinProviderUrl = process.env.BITCOIN_PROVIDER_URL || "https://regtest.diamondhands.credit/api/esplora";
27844
27876
  break;
27845
27877
  case 1337:
27846
27878
  // Hardhat local testnet (actual deployment chainId)
@@ -28060,7 +28092,7 @@ var require_lit_ops_module = __commonJS({
28060
28092
  bitcoinProviderUrl = process.env.BITCOIN_PROVIDER_URL || "https://mempool.space/api";
28061
28093
  break;
28062
28094
  case 11155111:
28063
- bitcoinProviderUrl = process.env.BITCOIN_PROVIDER_URL || "https://dh-btc-faucet-jw-bb7756976029.herokuapp.com/api/esplora";
28095
+ bitcoinProviderUrl = process.env.BITCOIN_PROVIDER_URL || "https://regtest.diamondhands.credit/api/esplora";
28064
28096
  break;
28065
28097
  case 1337:
28066
28098
  // Hardhat local testnet (actual deployment chainId)
@@ -40751,7 +40783,8 @@ var init_wc_transport = __esm({
40751
40783
  this.client = client;
40752
40784
  this.cfg = cfg;
40753
40785
  this.scratch = scratch;
40754
- client.on("session_delete", () => {
40786
+ client.on("session_delete", ({ topic }) => {
40787
+ if (this.session === null || this.session.topic !== topic) return;
40755
40788
  this.session = null;
40756
40789
  this.sessionListener?.(null);
40757
40790
  });
@@ -40763,7 +40796,7 @@ var init_wc_transport = __esm({
40763
40796
  const client = await import_sign_client.default.init({
40764
40797
  core,
40765
40798
  projectId: cfg.projectId,
40766
- metadata: WC_DAPP_METADATA
40799
+ metadata: cfg.metadata ?? WC_DAPP_METADATA
40767
40800
  });
40768
40801
  return new _WcTransport(client, cfg, scratch);
40769
40802
  }
@@ -40781,14 +40814,21 @@ var init_wc_transport = __esm({
40781
40814
  optionalNamespaces: wcSessionNamespaces(this.cfg.chainId)
40782
40815
  });
40783
40816
  if (!uri) throw new Error("WalletConnect returned no pairing URI");
40817
+ const pairingId = /^wc:([0-9a-f]+)@/i.exec(uri)?.[1];
40818
+ if (!pairingId) throw new Error(`WalletConnect pairing URI has no recognisable topic: ${uri.slice(0, 12)}\u2026`);
40784
40819
  void approval().then((session) => {
40785
40820
  const first = session.namespaces["eip155"]?.accounts[0];
40786
40821
  if (!first) throw new Error("WalletConnect session carries no eip155 account");
40787
40822
  const [, chainIdStr, account] = first.split(":");
40823
+ const previous = this.session;
40788
40824
  this.session = { topic: session.topic, account, chainId: Number(chainIdStr) };
40789
- this.sessionListener?.(this.active());
40825
+ const verdict = this.sessionListener?.({ ...this.active(), pairingId });
40826
+ if (verdict === false) {
40827
+ this.session = previous;
40828
+ void this.client.disconnect({ topic: session.topic, reason: { code: 6e3, message: "session refused by the bridge" } }).catch(() => void 0);
40829
+ }
40790
40830
  }).catch((e) => console.error(`[dh-mcp] WalletConnect pairing failed: ${e.message}`));
40791
- return { uri };
40831
+ return { uri, pairingId };
40792
40832
  }
40793
40833
  /** Route one wallet request over the active session. Throws on user rejection. */
40794
40834
  async request(method, params) {
@@ -41044,13 +41084,14 @@ function resolveRealConfig(env) {
41044
41084
 
41045
41085
  // src/boot.ts
41046
41086
  var fs6 = __toESM(require("fs"));
41047
- var import_ethers50 = require("ethers");
41087
+ var import_ethers52 = require("ethers");
41048
41088
 
41049
41089
  // src/boundary/index.ts
41050
41090
  var import_node_crypto8 = require("crypto");
41051
41091
  var fs5 = __toESM(require("fs"));
41052
41092
  var os2 = __toESM(require("os"));
41053
41093
  var path4 = __toESM(require("path"));
41094
+ var import_ethers51 = require("ethers");
41054
41095
 
41055
41096
  // src/boundary/envelope.ts
41056
41097
  function okEnvelope(data, source, warnings = []) {
@@ -43544,8 +43585,13 @@ var SignerManager = class {
43544
43585
  mode: deps.initialMode,
43545
43586
  borrower: deps.configuredBorrower ?? null
43546
43587
  };
43588
+ if (deps.authenticatedBorrower) this.state = { ...this.state, borrower: deps.authenticatedBorrower };
43547
43589
  }
43548
43590
  state;
43591
+ /** True when the borrower is the signed-in identity and cannot be swapped. */
43592
+ identityPinned() {
43593
+ return this.deps.authenticatedBorrower !== void 0;
43594
+ }
43549
43595
  mode() {
43550
43596
  return this.state.mode;
43551
43597
  }
@@ -43585,7 +43631,7 @@ var SignerManager = class {
43585
43631
  this.deps.persistence.save(this.state);
43586
43632
  }
43587
43633
  resetBorrower() {
43588
- this.state = { ...this.state, borrower: null };
43634
+ this.state = { ...this.state, borrower: this.deps.authenticatedBorrower ?? null };
43589
43635
  this.deps.persistence.save(this.state);
43590
43636
  }
43591
43637
  async use(mode, opts) {
@@ -51965,11 +52011,11 @@ var init_deployment_addresses = __esm2({
51965
52011
  reason: "Shared upgrade script: AdminModule implementation update"
51966
52012
  },
51967
52013
  PositionManagerViews: {
51968
- previousImplementation: "0x1EB2B1d058006ACd9033E01e846D73eDE686b620",
51969
- newImplementation: "0xA455B542cFb36AF8451fc420dB89e590E5c87cef",
51970
- upgradedAt: "2026-07-03T20:11:25.817Z",
51971
- upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
51972
- reason: "Shared upgrade script: PositionManagerViews implementation update"
52014
+ previousImplementation: "0xA455B542cFb36AF8451fc420dB89e590E5c87cef",
52015
+ newImplementation: "0x8cEB3F1c07fDB3301f55b96a5B9aDb33C8d36Da3",
52016
+ upgradedAt: "2026-10-02T17:04:25.853Z",
52017
+ upgradedBy: "0x0f8f23674cc90Ef7107930a4437341fD8B460362",
52018
+ reason: "1.1.2: getBackingVaults (PoR backing set) + implementation lock (constructor)"
51973
52019
  },
51974
52020
  TestPositionManager: {
51975
52021
  previousImplementation: "0x0B46Ee1a9C6b42559758B7FF78294Cd867BB08f8",
@@ -53429,6 +53475,32 @@ var require_pkg_src2 = __commonJS2({
53429
53475
  deployedAt: 1790246264563,
53430
53476
  size: 69219,
53431
53477
  hash: "bda048d8cd6b5a39c2774bcf1320e82d1eea935c2a521006fb8b887e13b6dd8d"
53478
+ },
53479
+ carryCollateralAttestation: {
53480
+ cid: "QmYWULmXD9S5AmTdQqWqoZ28ctsZQNcXkAgre9G2Xo9dh8",
53481
+ authorizedCidHex: cidToHex(
53482
+ "QmYWULmXD9S5AmTdQqWqoZ28ctsZQNcXkAgre9G2Xo9dh8"
53483
+ ),
53484
+ name: "Carry Collateral Attestation",
53485
+ description: "LoanCarryVault collateral attestation (borrower, BTC vault, confirmed BTC)",
53486
+ version: "1.0.0",
53487
+ deployed: true,
53488
+ deployedAt: 1790927734070,
53489
+ size: 21156,
53490
+ hash: "05b177e0bb36b0483db4a42d33c1bbbf47eb9ef34ae278459397d51a7f8957ff"
53491
+ },
53492
+ carryFundingAttestation: {
53493
+ cid: "QmWhox3xUZMNR5NpPZ9WLSPC5GoW4ms88GanVRKr8uuS3W",
53494
+ authorizedCidHex: cidToHex(
53495
+ "QmWhox3xUZMNR5NpPZ9WLSPC5GoW4ms88GanVRKr8uuS3W"
53496
+ ),
53497
+ name: "Carry Funding Attestation",
53498
+ description: "LoanCarryVault funding attestation (Hyperliquid BTC windowed hourly average)",
53499
+ version: "1.0.0",
53500
+ deployed: true,
53501
+ deployedAt: 1790925699980,
53502
+ size: 7193,
53503
+ hash: "4944ada61610cf64b32e33b5be62087088dcf5e821040c69e67942e643ce74c9"
53432
53504
  }
53433
53505
  };
53434
53506
  function getDeploymentsForNetwork(network) {
@@ -82839,7 +82911,7 @@ var RealUpstreamPlugin = class {
82839
82911
  }
82840
82912
  if (mode === "external") {
82841
82913
  const borrower = await rt.manager.resolveBorrowerForWrite();
82842
- if (!borrower) {
82914
+ if (!borrower || this.pinnedWalletUnreachable(borrower, { allowCachedLogin: false })) {
82843
82915
  return {
82844
82916
  ok: false,
82845
82917
  failure: {
@@ -82889,6 +82961,20 @@ var RealUpstreamPlugin = class {
82889
82961
  }
82890
82962
  };
82891
82963
  }
82964
+ /** Hosted tier: the SIWE borrower is bound from boot, so "bound" no longer implies a
82965
+ * wallet can sign. Refuse as "no wallet is connected" instead of starting a ceremony
82966
+ * nobody can answer.
82967
+ *
82968
+ * `allowCachedLogin` is for `connectExternal` ONLY: a still-valid lit-ops login lets it
82969
+ * succeed without a wallet (it signs nothing). A WRITE always needs a fresh wallet
82970
+ * signature (ExternalEoaDHSigner), so a cached JWT must not admit it — that would queue
82971
+ * an approval with no wallet attached to sign it. */
82972
+ pinnedWalletUnreachable(borrower, opts) {
82973
+ if (!this.runtime?.manager.identityPinned()) return false;
82974
+ if (this.runtime.bridge.walletState() !== null) return false;
82975
+ if (!opts.allowCachedLogin) return true;
82976
+ return !this.sessionCache.get(`external:${borrower.toLowerCase()}`)?.hasValidToken();
82977
+ }
82892
82978
  /** The EXPLICIT login action (plan 10 OV-10 / A0.7): the ONLY path that may summon the
82893
82979
  * wallet for a lit-ops login outside a write ceremony. Binds the borrower on success —
82894
82980
  * the first verified ceremony fixes the identity. */
@@ -82899,7 +82985,7 @@ var RealUpstreamPlugin = class {
82899
82985
  return { ok: false, reason: `the active mode is '${manager.mode()}' \u2014 run signer_setup action 'use' mode 'external' first` };
82900
82986
  }
82901
82987
  const borrower = manager.borrowerForWrite();
82902
- if (!borrower) {
82988
+ if (!borrower || this.pinnedWalletUnreachable(borrower, { allowCachedLogin: true })) {
82903
82989
  return { ok: false, reason: "no wallet is connected \u2014 open the approval page (signer_setup action 'status') and connect your wallet first" };
82904
82990
  }
82905
82991
  const key = `external:${borrower.toLowerCase()}`;
@@ -83436,6 +83522,81 @@ var RealUpstreamPlugin = class {
83436
83522
  var fs4 = __toESM(require("fs"));
83437
83523
  var http3 = __toESM(require("http"));
83438
83524
  var import_node_crypto7 = require("crypto");
83525
+ var import_ethers50 = require("ethers");
83526
+
83527
+ // src/util/brand-assets.ts
83528
+ var FAVICON_SVG = `<svg width="512" height="512" viewBox="-6 -11 88 88" fill="none" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Diamond Hands"><path d="M1.08325 20.7041L37.9038 64.4967L74.2886 20.7041L61.8699 0.877686H13.502L1.08325 20.7041Z" fill="#C9F284" stroke="#34440E" stroke-width="1.75559"/><path d="M13.9385 0.877441L37.9045 64.2785" stroke="#34440E" stroke-width="1.75559"/><path d="M61.6553 0.877441L37.9071 64.4964" stroke="#34440E" stroke-width="1.75559"/><path d="M1.08276 20.7029H74.2882" stroke="#34440E" stroke-width="1.75559"/></svg>`;
83529
+ var FAVICON_DATA_URI = `data:image/svg+xml,${encodeURIComponent(FAVICON_SVG).replace(/'/g, "%27")}`;
83530
+ var GVNR_PILL_LOGO_DATA_URI = "data:image/png;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ym0sXlTryN/tRDz525WQvCIIgcEGzGzIHtN/3e5qo7Xbmw+LH/U0PwNis4z8snQD4c/+0TX8+U5cUcmrArZYjJz+4lrPUpteOioLWH59S33282MT9Sb5bfATs5pD7zz+dySYvCIIgVEExrVP1HbsW7K/0MaPTqH+oMBv4zWrpBnVcxWDDloY6giAIQq1xCJvDgp3hnBilrLrY4Kj1IgiCIAiCkBR+f78oi7fKHtBH1S9ruOiL3lzmshxBEARBSI3R7o2jZc39MsCRvujLXpYjCIIgCCnhT/xbF1+MjDQvBMClvuhLO6hDEARBEFLicsMufW4uZhoUAoDaUo4Op/BRgEpGEwqCIAiCEI7Rhl0002S0v8RFJ0CjVqipx9ALsHFidkUECIIgCEJN+ad5+ni0e+Po6Z+4EAAUBbAjc6oR8UHZowkFQRAEQVick/ynTYtuZ/i1debJ5e6SX8zxujTukHU0oSAIgiAIYaFW3S4DCv0PG9cdrant9uXnfTEMKMdsdDhKMZrwJN+V/gCCIAiCEDlk4h/d/Gk/zz6ZsVMnvxAAlArQaO6NigBU+Ip7KpEgCIIgCNfn2Ow+yLT+bPOnaaaTBkvhpB9EA3KM029HJ+U5cF1j7P12Q2ajC4IgCEIM0Kl/0MOnM3xs2uY/eM5kSATkLns54gkYcpAb80SEgCAIgiBUw7iNn/AH93eNT2Zr2kjpKwXAEJoDDYhfpAAoIgAOD8CZd8baI2j0ZKytIAiCIASGptNCr9HSqrHh0G4oVFSld2lkPZ6hs09W9aPns/zMmQQAQdGAnlU7ONJRSBAEQRCEKHidfTIPp536R5lZAAwZCgGFeHfUHyAIgiAIQpngmXXml5Vz93yejf/iv4YFOHVPO9bCBiJ5BLDlf9g3PjHQBEEQBEEQAoI+ve5+8wfvI+dT70rB0RoW03wFQRAEQRBm5/8BP0+mvgFrTN4AAAAASUVORK5CYII=";
83531
+
83532
+ // src/util/house-style.ts
83533
+ var APP_BACKGROUND_ORIGIN = "https://images.diamondhands.credit";
83534
+ var APP_BACKGROUND_URL = `${APP_BACKGROUND_ORIGIN}/bg-diamond-hands.png`;
83535
+ var FONT_ORIGIN = "https://images.gvnr.xyz";
83536
+ var MANROPE_BASE = `${FONT_ORIGIN}/fonts/manrope`;
83537
+ var HOUSE_CSP_EXTRA = {
83538
+ "img-src": [APP_BACKGROUND_ORIGIN, "data:"],
83539
+ "font-src": [FONT_ORIGIN]
83540
+ };
83541
+ var HOUSE_HEAD_LINKS = `<link rel="icon" type="image/svg+xml" href="${FAVICON_DATA_URI}">
83542
+ <link rel="apple-touch-icon" href="${FAVICON_DATA_URI}">`;
83543
+ var MANROPE_WEIGHTS = [
83544
+ [300, "Light"],
83545
+ [400, "Regular"],
83546
+ [500, "Medium"],
83547
+ [600, "SemiBold"],
83548
+ [700, "Bold"]
83549
+ ];
83550
+ var HOUSE_BASE_CSS = `
83551
+ ${MANROPE_WEIGHTS.map(([w, n]) => `@font-face { font-family: "Manrope"; font-weight: ${w}; font-display: swap; src: url("${MANROPE_BASE}/Manrope-${n}.ttf") format("truetype"); }`).join("\n")}
83552
+ * { box-sizing: border-box; }
83553
+ html { min-height: 100%; background: #000006; }
83554
+ body { margin: 0; min-height: 100vh; color: #fff; font: 14px/1.5 "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
83555
+ background: #000006 url("${APP_BACKGROUND_URL}") center / cover no-repeat fixed; }
83556
+ .house-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem; }
83557
+ @media (min-width: 768px) { .house-header { padding: 1rem 2.5rem; } }
83558
+ .house-header > img { height: 1.92rem; width: auto; display: block; flex: none; }
83559
+ /* Narrow viewports: the chip may shrink (its label ellipsises), and below 400px the label
83560
+ is dropped so logo + chip icon always fit a 320px phone with no horizontal page scroll. */
83561
+ .house-header .chip { min-width: 0; }
83562
+ .chip-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
83563
+ /* ".house-header .chip", not ".chip": the base .chip rule below declares padding too, and at
83564
+ equal specificity the LATER rule wins regardless of the media query; this selector outranks it. */
83565
+ @media (max-width: 400px) { .chip-label { display: none; } .house-header .chip { padding: 0.4rem 0.6rem; } }
83566
+ .chip { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.4rem 0.85rem; border-radius: 999px;
83567
+ background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(255, 255, 255, 0.1); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
83568
+ font-size: 0.8rem; font-weight: 600; color: #dbff91; white-space: nowrap; }
83569
+ .chip img { height: 1rem; }
83570
+ main { max-width: 34rem; margin: 2.5rem auto 3rem; padding: 0 1rem; }
83571
+ .panel { background: #121212; border: 1px solid rgba(255, 255, 255, 0.06); border-radius: 12px; padding: 1rem;
83572
+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05); }
83573
+ @media (min-width: 768px) { .panel { padding: 1.25rem; } }
83574
+ h1 { font-size: 1.25rem; font-weight: 600; line-height: 1.375; color: #fafafa; margin: 0 0 1rem; }
83575
+ @media (min-width: 768px) { h1 { font-size: 1.5rem; margin-bottom: 1.25rem; } }
83576
+ h2 { font-size: 1rem; font-weight: 600; line-height: 1.375; color: #fafafa; margin: 0 0 0.75rem; }
83577
+ p { margin: 0 0 1rem; color: #e5e5e5; font-size: 0.875rem; font-weight: 300; line-height: 1.5; }
83578
+ button { font: inherit; font-size: 0.875rem; cursor: pointer; border: 0; display: inline-flex; align-items: center; justify-content: center;
83579
+ min-height: 2.75rem; padding: 0.65rem 1.25rem; transition: opacity 0.2s, background-color 0.2s; }
83580
+ button:focus-visible { outline: 2px solid #84cc16; outline-offset: 2px; }
83581
+ button:disabled { opacity: 0.5; cursor: not-allowed; }
83582
+ /* Primary = lime-700 (#4d7c0f): white 14px text on it is 4.99:1 (WCAG AA needs 4.5:1; the
83583
+ brighter #65a30d was 3.09:1). Hover = lime-800 (#3f6212), 7.08:1. A test recomputes both. */
83584
+ .btn-primary { background: #4d7c0f; color: #fff; font-weight: 700; letter-spacing: 0.025em; border-radius: 12px; box-shadow: 0 4px 18px rgba(74, 222, 128, 0.2); }
83585
+ .btn-primary:hover:not(:disabled) { background: #3f6212; }
83586
+ .btn-secondary { background: #34440e; color: #dbff91; font-weight: 500; border-radius: 20px; }
83587
+ .btn-secondary:hover:not(:disabled) { background: #3d5210; }
83588
+ .btn-danger { background: transparent; color: #fca5a5; font-weight: 600; border-radius: 12px; border: 1px solid rgba(248, 113, 113, 0.45); }
83589
+ .btn-danger:hover:not(:disabled) { background: rgba(220, 38, 38, 0.15); }
83590
+ /* A QR needs dark-on-light to scan: it keeps a white plate on the dark page. */
83591
+ .qr-plate { max-width: 16rem; margin-top: 1rem; background: #fff; border-radius: 12px; padding: 0.5rem; }
83592
+ .qr-plate svg { width: 100%; height: auto; display: block; }
83593
+ `;
83594
+ function houseHeader(label) {
83595
+ return `<header class="house-header">
83596
+ <img src="${GVNR_PILL_LOGO_DATA_URI}" alt="GVNR">
83597
+ <span class="chip"><img src="${FAVICON_DATA_URI}" alt=""><span class="chip-label">${label}</span></span>
83598
+ </header>`;
83599
+ }
83439
83600
 
83440
83601
  // src/boundary/upstream/shared/external-bridge/approval-page.ts
83441
83602
  function renderApprovalPage(sessionId, nonce) {
@@ -83445,46 +83606,47 @@ function renderApprovalPage(sessionId, nonce) {
83445
83606
  <meta charset="utf-8">
83446
83607
  <meta name="viewport" content="width=device-width, initial-scale=1">
83447
83608
  <title>Diamond Hands \u2014 signature approval</title>
83609
+ ${HOUSE_HEAD_LINKS}
83448
83610
  <style>
83449
- :root { --bg:#0d1117; --panel:#161b22; --line:#30363d; --text:#e6edf3; --dim:#8b949e;
83450
- --accent:#58a6ff; --approve:#238636; --reject:#da3633; }
83451
- * { box-sizing:border-box; }
83452
- body { margin:0; font:15px/1.5 system-ui,sans-serif; background:var(--bg); color:var(--text);
83453
- display:flex; min-height:100vh; align-items:center; justify-content:center; }
83454
- main { width:min(560px,94vw); }
83455
- h1 { font-size:18px; font-weight:600; letter-spacing:.02em; }
83456
- h1 span { color:var(--accent); }
83457
- .panel { background:var(--panel); border:1px solid var(--line); border-radius:10px; padding:20px; margin-top:12px; }
83458
- .status { color:var(--dim); font-size:13px; }
83459
- .card { white-space:pre-wrap; font-family:ui-monospace,monospace; font-size:14px;
83460
- background:var(--bg); border:1px solid var(--line); border-radius:8px; padding:14px; margin:14px 0; }
83461
- .action { text-transform:uppercase; letter-spacing:.08em; font-size:12px; color:var(--accent); }
83462
- button { border:0; border-radius:8px; padding:10px 22px; font-size:15px; color:#fff; cursor:pointer; }
83463
- #approve { background:var(--approve); margin-right:10px; }
83464
- #reject { background:var(--reject); }
83465
- #wallet { font-family:ui-monospace,monospace; font-size:12px; color:var(--dim); margin-top:10px; }
83611
+ ${HOUSE_BASE_CSS}
83612
+ /* \u2500\u2500 approval page only \u2500\u2500 */
83613
+ main { max-width: 36rem; }
83614
+ .status { color:#a1a1a1; font-size:0.875rem; }
83615
+ .action { text-transform:uppercase; letter-spacing:.08em; font-size:0.75rem; font-weight:600; color:#dbff91; margin-top:0.25rem; }
83616
+ /* The decoded card IS the operation (decode-equivalence): kept monospace and pre-wrapped
83617
+ exactly as the server rendered it, on an inset well darker than the panel. */
83618
+ .card { white-space:pre-wrap; font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:0.875rem; color:#fafafa;
83619
+ background:#0a0a0a; border:1px solid rgba(255,255,255,0.1); border-radius:10px; padding:14px; margin:0.75rem 0 1rem; }
83620
+ .actions { display:flex; flex-wrap:wrap; gap:0.75rem; }
83621
+ #deadline { margin-bottom:1rem; }
83622
+ #wallet { font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:0.75rem; color:#a1a1a1; margin-top:1rem; }
83623
+ #wallet:empty { display:none; }
83624
+ #wc { margin-top:1.25rem; border-top:1px solid rgba(255,255,255,0.06); padding-top:1rem; }
83625
+ #wc-uri { user-select:all; word-break:break-all; font-size:0.75rem; }
83626
+ #wc-hint { margin-top:0.75rem; }
83466
83627
  .hidden { display:none; }
83467
83628
  </style>
83468
83629
  </head>
83469
83630
  <body>
83631
+ ${houseHeader("Diamond Hands \xB7 signature approval")}
83470
83632
  <main>
83471
- <h1><span>\u25C6</span> Diamond Hands \u2014 signature approval</h1>
83633
+ <h1>Signature approval</h1>
83472
83634
  <div class="panel">
83473
83635
  <div id="status" class="status">Connecting to your wallet\u2026</div>
83474
83636
  <div id="request" class="hidden">
83475
83637
  <div id="action" class="action"></div>
83476
83638
  <div id="card" class="card"></div>
83477
83639
  <div id="deadline" class="status hidden"></div>
83478
- <button id="approve">Approve in wallet</button>
83479
- <button id="reject">Reject</button>
83640
+ <div class="actions">
83641
+ <button id="approve" class="btn-primary">Approve in wallet</button>
83642
+ <button id="reject" class="btn-danger">Reject</button>
83643
+ </div>
83480
83644
  </div>
83481
83645
  <div id="wallet"></div>
83482
- <div id="wc" style="margin-top:14px; border-top:1px solid var(--line); padding-top:12px;">
83483
- <button id="wc-connect" style="background:var(--panel); border:1px solid var(--line); color:var(--text);">
83484
- Use a mobile wallet instead (WalletConnect)
83485
- </button>
83486
- <div id="wc-qr" class="hidden" style="background:#fff; border-radius:8px; padding:8px; margin-top:10px; max-width:280px;"></div>
83487
- <div id="wc-uri" class="card hidden" style="user-select:all; word-break:break-all; font-size:12px;"></div>
83646
+ <div id="wc">
83647
+ <button id="wc-connect" class="btn-secondary">Use a mobile wallet instead (WalletConnect)</button>
83648
+ <div id="wc-qr" class="qr-plate hidden"></div>
83649
+ <div id="wc-uri" class="card hidden"></div>
83488
83650
  <div id="wc-hint" class="status hidden">Scan the QR with your wallet app (or open the app \u2192 WalletConnect \u2192 paste the pairing code). Approvals then happen on your phone.</div>
83489
83651
  </div>
83490
83652
  </div>
@@ -83559,21 +83721,63 @@ async function healChain() {
83559
83721
  }).catch(() => undefined);
83560
83722
  }
83561
83723
  await readWallet();
83562
- await post(BASE + "hello", { account: account, chainId: chainId });
83724
+ await sayHello();
83563
83725
  showWallet();
83564
83726
  }
83565
83727
 
83728
+ function utf8Hex(text) {
83729
+ return "0x" + Array.from(new TextEncoder().encode(text)).map((b) => b.toString(16).padStart(2, "0")).join("");
83730
+ }
83731
+
83732
+ // Presence proof: the bridge only believes a wallet is at this page once the wallet has
83733
+ // SIGNED a short statement naming this page's origin, the chain and a per-page nonce. Saying
83734
+ // an address proves nothing (it is public); signing proves the key is here. One prompt per
83735
+ // page session: once this account has proven itself the bridge accepts later hellos for it
83736
+ // (a chain switch) without asking the wallet again.
83737
+ let provenFor = null;
83738
+ async function sayHello() {
83739
+ let signature;
83740
+ if (provenFor === null || provenFor.toLowerCase() !== String(account).toLowerCase()) {
83741
+ const ch = await fetch(BASE + "challenge?s=" + SESSION + "&chainId=" + chainId).then((r) => r.json());
83742
+ showIdleStatus("Sign the short statement in your wallet to prove it is yours \u2014 it moves no funds.");
83743
+ signature = await window.ethereum.request({ method: "personal_sign", params: [utf8Hex(ch.statement), account] });
83744
+ }
83745
+ const r = await post(BASE + "hello", { account: account, chainId: chainId, signature: signature });
83746
+ if (!r.ok) {
83747
+ const b = await r.json().catch(() => ({}));
83748
+ showStatus("This wallet was not accepted: " + (b.error || "HTTP " + r.status));
83749
+ return false;
83750
+ }
83751
+ provenFor = account;
83752
+ return true;
83753
+ }
83754
+
83755
+ // The stream opens at load, so a card can be on screen BEFORE connect() finishes. The status
83756
+ // line then belongs to that card (its review / mobile-wallet guidance), and connection
83757
+ // progress must not overwrite it. Connection progress lines (idle / "sign the statement", whose
83758
+ // wallet popup is self-explanatory) go through here; failures (a refused hello, a lost
83759
+ // stream, a wrong network) still show unconditionally.
83760
+ function showIdleStatus(text) {
83761
+ if (current !== null) return;
83762
+ showStatus(text);
83763
+ }
83764
+
83566
83765
  async function connect() {
83567
- if (!window.ethereum) { showStatus("No wallet detected \u2014 install MetaMask (or open this page in a wallet browser)."); return; }
83766
+ if (!window.ethereum) {
83767
+ // The event stream is already open (see the bottom of this script) \u2014 a phone paired
83768
+ // below still mirrors its cards here.
83769
+ showIdleStatus("No browser wallet detected \u2014 use the mobile wallet option below, or install MetaMask (or open this page in a wallet browser).");
83770
+ return;
83771
+ }
83568
83772
  await window.ethereum.request({ method: "eth_requestAccounts" });
83569
83773
  await readWallet();
83570
- await post(BASE + "hello", { account: account, chainId: chainId });
83774
+ const accepted = await sayHello();
83571
83775
  showWallet();
83572
83776
  window.ethereum.on("accountsChanged", onAccountsChanged);
83573
83777
  window.ethereum.on("chainChanged", onChainChanged);
83778
+ if (!accepted) return;
83574
83779
  await healChain();
83575
- showStatus("Connected. Waiting for a signature request\u2026");
83576
- listen();
83780
+ showIdleStatus("Connected. Waiting for a signature request\u2026");
83577
83781
  }
83578
83782
 
83579
83783
  // Handlers trust the EVENT payloads \u2014 re-reading eth_accounts/eth_chainId here races the
@@ -83583,6 +83787,8 @@ async function onAccountsChanged(accounts) {
83583
83787
  await post(BASE + "wallet-event", { account: account, chainId: chainId });
83584
83788
  showWallet();
83585
83789
  invalidatePageRequests("Wallet changed \u2014 pending request invalidated.");
83790
+ // The bridge adopts no account from an event alone \u2014 a different account proves itself.
83791
+ if (account) await sayHello();
83586
83792
  }
83587
83793
 
83588
83794
  async function onChainChanged(cid) {
@@ -83592,8 +83798,14 @@ async function onChainChanged(cid) {
83592
83798
  invalidatePageRequests("Network changed \u2014 pending request invalidated.");
83593
83799
  }
83594
83800
 
83801
+ // ONE stream per page, opened at load whatever wallet this browser has: a phone paired
83802
+ // through WalletConnect needs no injected wallet, and its read-only mirror arrives on this
83803
+ // stream. Opening it proves nothing \u2014 the bridge sends this page NOTHING until a person is
83804
+ // proven (a signed hello, or a pairing a phone answered).
83805
+ let es = null;
83595
83806
  function listen() {
83596
- const es = new EventSource(BASE + "events?s=" + SESSION);
83807
+ if (es !== null) return;
83808
+ es = new EventSource(BASE + "events?s=" + SESSION);
83597
83809
  es.onmessage = (ev) => {
83598
83810
  const next = JSON.parse(ev.data);
83599
83811
  // A later frame for an id REPLACES the earlier one: driveWc re-stamps a personal-sign
@@ -83785,6 +83997,7 @@ document.getElementById("wc-connect").onclick = async () => {
83785
83997
  showStatus("Scan the QR (or paste the code) in your mobile wallet \u2014 it becomes the signing wallet.");
83786
83998
  };
83787
83999
 
84000
+ listen();
83788
84001
  connect();
83789
84002
  </script>
83790
84003
  </body>
@@ -83893,6 +84106,16 @@ function htmlPageSecurityHeaders(extra) {
83893
84106
 
83894
84107
  // src/boundary/upstream/shared/external-bridge/bridge.ts
83895
84108
  var MAX_SESSIONS = 16;
84109
+ var MAX_PENDING_PAIRINGS = 64;
84110
+ function presenceStatement(origin2, chainId, nonce) {
84111
+ return [
84112
+ "Diamond Hands approval page",
84113
+ "Sign to prove this wallet is yours. This moves no funds and approves no operation.",
84114
+ `Origin: ${origin2}`,
84115
+ `Chain ID: ${chainId}`,
84116
+ `Session nonce: ${nonce}`
84117
+ ].join("\n");
84118
+ }
83896
84119
  var DEFAULT_EXPIRY_MS = 5 * 60 * 1e3;
83897
84120
  var DEFAULT_ATTACH_GRACE_MS = 60 * 1e3;
83898
84121
  var DEFAULT_HOSTED_ATTACH_GRACE_MS = 180 * 1e3;
@@ -83906,6 +84129,7 @@ function wcDeclineOrFault(e) {
83906
84129
  }
83907
84130
  var SignatureBridge = class {
83908
84131
  clock;
84132
+ sweepIntervalMs;
83909
84133
  /** Lowercased at construction so every comparison is case-flat — EIP-55 checksum casing
83910
84134
  * differs between what SIWE signs and what a wallet reports for the SAME address. */
83911
84135
  boundAccount;
@@ -83936,13 +84160,20 @@ var SignatureBridge = class {
83936
84160
  wcTransport = null;
83937
84161
  /** True while a WalletConnect session is THE wallet — ceremonies route over WC. */
83938
84162
  wcActive = false;
83939
- /** Page session that most recently asked for a pairing QR — see `serveWcPairing`. */
83940
- pairingSessionId = null;
84163
+ /** Which page session asked for which pairing (pairing id → session id). The transport's
84164
+ * `onSession` says WHICH PAIRING a phone answered; this says whose it was. The previous
84165
+ * "most recent asker" guess let a second session claim the credit for a QR the user's
84166
+ * phone scanned (Sentinel 2 PoC-B). */
84167
+ pairingOwners = /* @__PURE__ */ new Map();
83941
84168
  keystoreUnlock;
83942
84169
  unlockToken = null;
83943
84170
  unlockSession = null;
83944
84171
  constructor(opts) {
83945
84172
  this.clock = opts?.clock ?? Date.now;
84173
+ this.sweepIntervalMs = opts?.sweepIntervalMs ?? 1e3;
84174
+ if (!Number.isInteger(this.sweepIntervalMs) || this.sweepIntervalMs < 0) {
84175
+ throw new Error(`bridge sweepIntervalMs must be a non-negative integer (got ${String(opts?.sweepIntervalMs)})`);
84176
+ }
83946
84177
  this.boundAccount = opts?.boundAccount?.toLowerCase();
83947
84178
  this.expiryMs = opts?.expiryMs ?? DEFAULT_EXPIRY_MS;
83948
84179
  this.maxPending = opts?.maxPending ?? null;
@@ -83978,8 +84209,10 @@ var SignatureBridge = class {
83978
84209
  this.server = server;
83979
84210
  }
83980
84211
  this.started = true;
83981
- this.sweepTimer = setInterval(() => this.sweep(), 1e3);
83982
- this.sweepTimer.unref();
84212
+ if (this.sweepIntervalMs > 0) {
84213
+ this.sweepTimer = setInterval(() => this.sweep(), this.sweepIntervalMs);
84214
+ this.sweepTimer.unref();
84215
+ }
83983
84216
  if (this.urlFile) fs4.writeFileSync(this.urlFile, this.url());
83984
84217
  }
83985
84218
  /** Plan 12 C1: the outer server's dispatch entry for a MOUNTED bridge — `req.url`
@@ -84039,6 +84272,16 @@ var SignatureBridge = class {
84039
84272
  pendingCount() {
84040
84273
  return this.pending.size;
84041
84274
  }
84275
+ /** A request lives for the bridge's expiry OR until its payload dies, whichever is first.
84276
+ * The BTC-withdraw execute leg's payload dies inside a sub-minute quantum window; holding
84277
+ * the ceremony open for the full five minutes kept a dead card on screen and let the phone
84278
+ * be asked to sign something the protocol would refuse. */
84279
+ deadlineFor(request, nowMs) {
84280
+ const bridgeDeadline = nowMs + this.expiryMs;
84281
+ if (request.expiresAtSec === void 0) return bridgeDeadline;
84282
+ if (!Number.isFinite(request.expiresAtSec)) throw new Error(`request ${request.id} carries a non-finite expiresAtSec`);
84283
+ return Math.min(bridgeDeadline, request.expiresAtSec * 1e3);
84284
+ }
84042
84285
  /**
84043
84286
  * Enqueue a request and resolve on the human's decision (or expiry/invalidation).
84044
84287
  * Chain-id mismatch with an already-connected wallet refuses BEFORE the wallet is asked.
@@ -84061,7 +84304,7 @@ var SignatureBridge = class {
84061
84304
  const now = this.clock();
84062
84305
  const entry = {
84063
84306
  request,
84064
- deadlineMs: now + this.expiryMs,
84307
+ deadlineMs: this.deadlineFor(request, now),
84065
84308
  enqueuedMs: now,
84066
84309
  resolve,
84067
84310
  settled: false,
@@ -84092,7 +84335,7 @@ var SignatureBridge = class {
84092
84335
  const now = this.clock();
84093
84336
  const entry = {
84094
84337
  request,
84095
- deadlineMs: now + this.expiryMs,
84338
+ deadlineMs: this.deadlineFor(request, now),
84096
84339
  enqueuedMs: now,
84097
84340
  resolve,
84098
84341
  settled: false,
@@ -84144,6 +84387,7 @@ var SignatureBridge = class {
84144
84387
  return;
84145
84388
  }
84146
84389
  try {
84390
+ if (this.expireIfOverdue(entry)) return;
84147
84391
  if (req.kind === "transaction") {
84148
84392
  this.pushEntry(entry);
84149
84393
  const tx2 = req.tx;
@@ -84155,15 +84399,23 @@ var SignatureBridge = class {
84155
84399
  } else if (req.kind === "personal-sign") {
84156
84400
  if (entry.finalize) {
84157
84401
  const fresh = await entry.finalize();
84402
+ if (entry.settled) return;
84403
+ if (entry.owner !== "wc") return;
84404
+ const live = transport.active();
84405
+ if (!this.wcActive || !live || live.account.toLowerCase() !== account.toLowerCase()) {
84406
+ this.settle(entry, {
84407
+ status: "invalidated",
84408
+ reason: "the WalletConnect wallet changed while this payload was being prepared \u2014 the phone was not asked. Reconnect your wallet and retry the operation."
84409
+ });
84410
+ return;
84411
+ }
84158
84412
  req.personalSign = fresh.personalSign;
84159
84413
  req.card = fresh.card;
84160
84414
  }
84415
+ if (this.expireIfOverdue(entry)) return;
84161
84416
  const ps = req.personalSign;
84162
- if (ps.layout === RAW_HASH_LAYOUT && !this.pageAttached()) {
84163
- this.settle(entry, {
84164
- status: "invalidated",
84165
- reason: `this step signs a 32-byte hash your wallet cannot decode, and no approval page is open to show you what it authorizes \u2014 open ${this.url()} and re-run the withdrawal with loan_withdraw_retry (it re-signs with a fresh stamp; your coins stay in the vault meanwhile)`
84166
- });
84417
+ if (!this.pageAttached()) {
84418
+ this.settle(entry, { status: "invalidated", reason: this.noPageReason(ps.layout === RAW_HASH_LAYOUT) });
84167
84419
  return;
84168
84420
  }
84169
84421
  this.pushEntry(entry);
@@ -84188,6 +84440,16 @@ var SignatureBridge = class {
84188
84440
  }
84189
84441
  }
84190
84442
  }
84443
+ /** Refusal for a WalletConnect personal_sign with no proven approval page attached.
84444
+ *
84445
+ * The remedy names BOTH halves, because opening the link alone does not fix it: a freshly
84446
+ * opened page is a stranger until a phone answers a pairing it showed (or its wallet signs
84447
+ * the presence statement), so it receives no card. Following "just reopen the URL" looped
84448
+ * (Sentinel 2 PoC-C). */
84449
+ noPageReason(blindHash) {
84450
+ const what = blindHash ? "this step signs a 32-byte hash your wallet cannot decode" : "this step asks your wallet to sign a message your phone shows only as a hash";
84451
+ return `${what}, and no approval page linked to your wallet is open to show you what it authorizes \u2014 open ${this.url()} in a browser AND, on that page, re-scan the WalletConnect QR with your phone (or reconnect your wallet there) so the page is tied to your wallet, then retry with loan_withdraw_retry for a withdrawal or re-run the operation (it re-signs with a fresh stamp; your coins stay in the vault meanwhile)`;
84452
+ }
84191
84453
  /** A live attachment that could still decide a request: an open approval-page SSE
84192
84454
  * stream (real page or headless driver) or an active WalletConnect session. PUBLIC
84193
84455
  * (plan 17 E1): the connector's idle-eviction predicate reads it — a tenant world
@@ -84271,6 +84533,7 @@ var SignatureBridge = class {
84271
84533
  void this.wcTransport?.close().catch(() => void 0);
84272
84534
  this.wcTransport = null;
84273
84535
  this.wcActive = false;
84536
+ this.pairingOwners.clear();
84274
84537
  }
84275
84538
  // ---- HTTP plumbing ----
84276
84539
  route(req, res) {
@@ -84278,6 +84541,7 @@ var SignatureBridge = class {
84278
84541
  const url2 = new URL(req.url ?? "/", this.mount ? this.mount.origin : `http://127.0.0.1:${this.port}`);
84279
84542
  if (req.method === "GET" && url2.pathname === "/") return this.servePage(url2, res);
84280
84543
  if (req.method === "GET" && url2.pathname === "/config") return this.serveConfig(url2, res);
84544
+ if (req.method === "GET" && url2.pathname === "/challenge") return this.serveChallenge(url2, res);
84281
84545
  if (req.method === "GET" && url2.pathname === "/wc-pairing") return void this.serveWcPairing(url2, res);
84282
84546
  if (req.method === "GET" && url2.pathname === "/unlock") return this.serveUnlockPage(url2, res);
84283
84547
  if (req.method === "POST" && url2.pathname === "/unlock-submit")
@@ -84337,8 +84601,16 @@ var SignatureBridge = class {
84337
84601
  return;
84338
84602
  }
84339
84603
  const sessionId = (0, import_node_crypto7.randomBytes)(24).toString("hex");
84340
- this.sessions.set(sessionId, { wallet: null, sse: null, refused: null, lastSeenMs: this.clock(), wcPaired: false });
84341
- const page = htmlPageSecurityHeaders();
84604
+ this.sessions.set(sessionId, {
84605
+ wallet: null,
84606
+ sse: null,
84607
+ refused: null,
84608
+ lastSeenMs: this.clock(),
84609
+ wcPaired: false,
84610
+ presenceNonce: (0, import_node_crypto7.randomBytes)(16).toString("hex"),
84611
+ provenAccount: null
84612
+ });
84613
+ const page = htmlPageSecurityHeaders(HOUSE_CSP_EXTRA);
84342
84614
  res.writeHead(200, { "Content-Type": "text/html; charset=utf-8", "Cache-Control": "no-store", ...page.headers });
84343
84615
  res.end(renderApprovalPage(sessionId, page.nonce));
84344
84616
  }
@@ -84348,11 +84620,29 @@ var SignatureBridge = class {
84348
84620
  res.writeHead(200, { "Content-Type": "application/json", "Cache-Control": "no-store" });
84349
84621
  res.end(JSON.stringify({ network: this.network ?? null }));
84350
84622
  }
84623
+ /** The origin this bridge is served from — what a presence statement names. */
84624
+ publicOrigin() {
84625
+ return this.mount ? this.mount.origin : `http://127.0.0.1:${this.port}`;
84626
+ }
84627
+ /** The presence statement for this session + chain (session-gated). The page signs exactly
84628
+ * this text in its wallet; the bridge rebuilds it on `hello` rather than trusting any text
84629
+ * the client sends back. */
84630
+ serveChallenge(url2, res) {
84631
+ const session = this.sessionOf(url2.searchParams.get("s"), res);
84632
+ if (!session) return;
84633
+ const chainId = Number(url2.searchParams.get("chainId"));
84634
+ if (!Number.isInteger(chainId)) {
84635
+ this.deny(res, 400, "challenge requires an integer chainId");
84636
+ return;
84637
+ }
84638
+ res.writeHead(200, { "Content-Type": "application/json", "Cache-Control": "no-store" });
84639
+ res.end(JSON.stringify({ statement: presenceStatement(this.publicOrigin(), chainId, session.presenceNonce) }));
84640
+ }
84351
84641
  /** WalletConnect pairing (D2, session-gated): lazily boots the WC transport and serves a
84352
84642
  * fresh pairing URI. A wallet approving the pairing becomes THE wallet. */
84353
84643
  async serveWcPairing(url2, res) {
84354
84644
  if (!this.checkSession(url2.searchParams.get("s"), res)) return;
84355
- this.pairingSessionId = url2.searchParams.get("s");
84645
+ const askingSession = url2.searchParams.get("s");
84356
84646
  if (!this.wcConfig) {
84357
84647
  this.deny(res, 404, "WalletConnect is not configured (set DH_WC_PROJECT_ID)");
84358
84648
  return;
@@ -84367,17 +84657,20 @@ var SignatureBridge = class {
84367
84657
  this.wcTransport.onSession((info) => {
84368
84658
  const refusal = info ? this.accountRefusal(info.account) : null;
84369
84659
  if (info && refusal) {
84370
- this.wcActive = false;
84371
- this.rebuildSharedWallet();
84372
- this.demoteWcEntries();
84660
+ if (!this.wcActive) {
84661
+ this.rebuildSharedWallet();
84662
+ this.demoteWcEntries();
84663
+ }
84373
84664
  process.stderr.write(`[bridge] WalletConnect session refused \u2014 ${refusal}
84374
84665
  `);
84375
- return;
84666
+ return false;
84376
84667
  }
84377
84668
  this.wcActive = info !== null;
84378
84669
  this.wallet = info ? { account: info.account, chainId: info.chainId } : null;
84379
- if (info && this.pairingSessionId) {
84380
- const paired = this.sessions.get(this.pairingSessionId);
84670
+ if (info?.pairingId) {
84671
+ const owner = this.pairingOwners.get(info.pairingId);
84672
+ this.pairingOwners.delete(info.pairingId);
84673
+ const paired = owner ? this.sessions.get(owner) : void 0;
84381
84674
  if (paired) paired.wcPaired = true;
84382
84675
  }
84383
84676
  if (info === null) {
@@ -84392,7 +84685,15 @@ var SignatureBridge = class {
84392
84685
  }
84393
84686
  });
84394
84687
  }
84395
- const { uri } = await this.wcTransport.createPairing();
84688
+ const { uri, pairingId } = await this.wcTransport.createPairing();
84689
+ if (pairingId) {
84690
+ this.pairingOwners.set(pairingId, askingSession);
84691
+ while (this.pairingOwners.size > MAX_PENDING_PAIRINGS) {
84692
+ const oldest = this.pairingOwners.keys().next();
84693
+ if (oldest.done) break;
84694
+ this.pairingOwners.delete(oldest.value);
84695
+ }
84696
+ }
84396
84697
  const { default: qrcode } = await import("qrcode-generator");
84397
84698
  const qr = qrcode(0, "M");
84398
84699
  qr.addData(uri);
@@ -84480,6 +84781,34 @@ var SignatureBridge = class {
84480
84781
  this.deny(res, 403, refusal);
84481
84782
  return;
84482
84783
  }
84784
+ const alreadyProven = session.provenAccount !== null && session.provenAccount.toLowerCase() === account.toLowerCase();
84785
+ if (!alreadyProven) {
84786
+ const signature = body["signature"];
84787
+ if (typeof signature !== "string" || signature === "") {
84788
+ this.deny(
84789
+ res,
84790
+ 403,
84791
+ `hello requires a signature proving this page controls ${account} \u2014 an address alone proves nothing. Approve the short signing prompt in your wallet (the approval page asks for it on connect); reload the page if it did not appear.`
84792
+ );
84793
+ return;
84794
+ }
84795
+ const statement = presenceStatement(this.publicOrigin(), chainId, session.presenceNonce);
84796
+ let recovered = null;
84797
+ try {
84798
+ recovered = import_ethers50.ethers.verifyMessage(statement, signature);
84799
+ } catch {
84800
+ recovered = null;
84801
+ }
84802
+ if (recovered === null || recovered.toLowerCase() !== account.toLowerCase()) {
84803
+ this.deny(
84804
+ res,
84805
+ 403,
84806
+ `the presence signature was not made by ${account} for this page's statement \u2014 sign the statement the approval page shows with that account (EOA wallets only; contract wallets cannot prove presence here).`
84807
+ );
84808
+ return;
84809
+ }
84810
+ session.provenAccount = account;
84811
+ }
84483
84812
  session.wallet = { account, chainId };
84484
84813
  this.wallet = { account, chainId };
84485
84814
  this.replayPending(session);
@@ -84521,17 +84850,21 @@ var SignatureBridge = class {
84521
84850
  if (refusedSwitch) {
84522
84851
  this.quarantine(session, switchRefusal);
84523
84852
  } else {
84524
- session.wallet = offered;
84853
+ const sameProven = offered !== null && session.provenAccount !== null && offered.account.toLowerCase() === session.provenAccount.toLowerCase();
84854
+ session.wallet = sameProven ? offered : null;
84525
84855
  if (this.wallet !== null && prev !== null && this.wallet.account.toLowerCase() === prev.account.toLowerCase()) {
84526
84856
  this.wallet = session.wallet;
84857
+ } else if (this.wallet === null && prev === null && session.wallet !== null) {
84858
+ this.wallet = session.wallet;
84527
84859
  }
84528
84860
  }
84529
- const unchanged = prev !== null && session.wallet !== null && prev.account.toLowerCase() === session.wallet.account.toLowerCase() && prev.chainId === session.wallet.chainId;
84530
- if (unchanged) {
84861
+ const reported = refusedSwitch ? null : offered;
84862
+ const unchanged = prev !== null && reported !== null && prev.account.toLowerCase() === reported.account.toLowerCase() && prev.chainId === reported.chainId;
84863
+ if (unchanged || prev === null) {
84531
84864
  this.ok(res);
84532
84865
  return;
84533
84866
  }
84534
- const reason = refusedSwitch ? "the wallet switched to an account this session is not signed in as" : prev && session.wallet && prev.account.toLowerCase() !== session.wallet.account.toLowerCase() ? "the wallet account changed while approval was pending" : prev && session.wallet && prev.chainId !== session.wallet.chainId ? "the wallet network changed while approval was pending" : "the wallet disconnected while approval was pending";
84867
+ const reason = refusedSwitch ? "the wallet switched to an account this session is not signed in as" : prev && reported && prev.account.toLowerCase() !== reported.account.toLowerCase() ? "the wallet account changed while approval was pending" : prev && reported && prev.chainId !== reported.chainId ? "the wallet network changed while approval was pending" : "the wallet disconnected while approval was pending";
84535
84868
  for (const entry of this.pending.values()) {
84536
84869
  if (entry.settled || entry.collect) continue;
84537
84870
  if (this.ownedByWc(entry)) continue;
@@ -84574,6 +84907,10 @@ var SignatureBridge = class {
84574
84907
  this.deny(res, 404, "unknown or already-settled requestId");
84575
84908
  return;
84576
84909
  }
84910
+ if (this.expireIfOverdue(entry)) {
84911
+ this.deny(res, 410, "this request has expired \u2014 retry the operation");
84912
+ return;
84913
+ }
84577
84914
  if (entry.request.kind !== "personal-sign") {
84578
84915
  this.deny(res, 400, "finalize applies only to personal-sign requests");
84579
84916
  return;
@@ -84600,6 +84937,10 @@ var SignatureBridge = class {
84600
84937
  this.deny(res, 404, "request settled while finalizing");
84601
84938
  return;
84602
84939
  }
84940
+ if (this.expireIfOverdue(entry)) {
84941
+ this.deny(res, 410, "this request expired while its payload was being prepared \u2014 retry the operation");
84942
+ return;
84943
+ }
84603
84944
  entry.request.personalSign = fresh.personalSign;
84604
84945
  entry.request.card = fresh.card;
84605
84946
  }
@@ -84613,6 +84954,10 @@ var SignatureBridge = class {
84613
84954
  this.deny(res, 404, "unknown or already-settled requestId");
84614
84955
  return;
84615
84956
  }
84957
+ if (this.expireIfOverdue(entry)) {
84958
+ this.deny(res, 410, "this request has expired \u2014 retry the operation");
84959
+ return;
84960
+ }
84616
84961
  if (body["approved"] !== true) {
84617
84962
  if (this.ownedByWc(entry) && entry.request.kind === "transaction") {
84618
84963
  this.settle(entry, {
@@ -84661,6 +85006,16 @@ var SignatureBridge = class {
84661
85006
  this.ok(res);
84662
85007
  }
84663
85008
  // ---- helpers ----
85009
+ /** Accept-time deadline check. The 1 s sweep is only the backstop: between the deadline and
85010
+ * the next tick a late click on /finalize or /result — or a WalletConnect dispatch — would
85011
+ * otherwise still ask for or accept a signature over a payload the protocol will refuse.
85012
+ * Settles the entry `expired` (the same outcome the sweep gives) and reports it. */
85013
+ expireIfOverdue(entry) {
85014
+ if (entry.settled) return true;
85015
+ if (this.clock() < entry.deadlineMs) return false;
85016
+ this.settle(entry, { status: "expired" });
85017
+ return true;
85018
+ }
84664
85019
  settle(entry, outcome) {
84665
85020
  entry.settled = true;
84666
85021
  this.pending.delete(entry.request.id);
@@ -85042,6 +85397,7 @@ async function createRealBoundary(config, wallet, overrides) {
85042
85397
  const manager = new SignerManager({
85043
85398
  persistence: overrides?.signerPersistence?.(config.network) ?? fileSignerPersistence(stateFile),
85044
85399
  initialMode,
85400
+ ...overrides?.boundBorrower ? { authenticatedBorrower: import_ethers51.ethers.getAddress(overrides.boundBorrower) } : {},
85045
85401
  candidate: () => bridge.walletState()?.account ?? null,
85046
85402
  pendingCeremonies: () => bridge.pendingCount(),
85047
85403
  keystore
@@ -85137,8 +85493,8 @@ async function buildBoundary(configResult, overrides) {
85137
85493
  );
85138
85494
  }
85139
85495
  try {
85140
- const decrypted = await import_ethers50.ethers.Wallet.fromEncryptedJson(keystoreJson, config.keystorePassword);
85141
- if (!(decrypted instanceof import_ethers50.ethers.Wallet)) {
85496
+ const decrypted = await import_ethers52.ethers.Wallet.fromEncryptedJson(keystoreJson, config.keystorePassword);
85497
+ if (!(decrypted instanceof import_ethers52.ethers.Wallet)) {
85142
85498
  return bootError("DH_KEYSTORE_PATH did not decrypt to an EOA wallet keystore.", ["DH_KEYSTORE_PATH"]);
85143
85499
  }
85144
85500
  wallet = decrypted;
@@ -85618,7 +85974,7 @@ on the real adapter and the mock.
85618
85974
  **The walkthrough:**
85619
85975
  1. \`signer_setup\` action \`use\`, mode \`external\`. The approval page auto-opens in the
85620
85976
  desktop browser; ${approvalPageLocation(d)}
85621
- 2. On the page: connect the browser extension${d.walletConnect ? ", or \u2014 for a mobile wallet \u2014 scan the\n WalletConnect QR code or paste the pairing code. KEEP THE APPROVAL PAGE OPEN: while a\n phone wallet is connected the page becomes the READ-ONLY reader for every ceremony \u2014\n it shows the full card, the phone shows only what a wallet can render, and you approve\n or decline in the phone. (Cancel still works from the page.)" : ". " + phoneWalletOffer(d) + "."}
85977
+ 2. On the page: connect the browser extension${d.walletConnect ? ", or \u2014 for a mobile wallet \u2014 scan the\n WalletConnect QR code or paste the pairing code. KEEP THAT APPROVAL PAGE OPEN \u2014 the one\n whose QR you scanned: while a phone wallet is connected it is the READ-ONLY reader for\n every ceremony \u2014 it shows the full card, the phone shows only what a wallet can render,\n and you approve or decline in the phone. (Cancel still works from the page.) With no\n such page open, the phone is NOT asked to sign the opaque 32-byte hashes (loan and withdrawal\n envelopes) \u2014 those refuse, because a wallet shows them as a bare hash. Plain transactions and\n typed-data are not gated: the wallet decodes those itself." : ". " + phoneWalletOffer(d) + "."}
85622
85978
  3. For authenticated reads before any write: \`signer_setup\` action \`connect\` runs the
85623
85979
  login ceremony explicitly (one typed-data signature in the wallet).
85624
85980
  4. The FIRST verified signature binds that wallet address as the borrower \u2014 it persists
@@ -86006,7 +86362,9 @@ plus one lit-ops login signature (read access). After that, every operation that
86006
86362
  funds asks for its OWN approval in the user's wallet, every time \u2014 and reads never pop
86007
86363
  the wallet. The login session lives ONLY in the server's memory: a server restart, or
86008
86364
  an idle spell long enough that the tenant's world is evicted, means signing in again.
86009
- That is the flip side of "nothing stored at rest" \u2014 a re-login is normal, not a fault.
86365
+ That is the flip side of never storing a login session at rest \u2014 a re-login is normal,
86366
+ not a fault. (The connector's own sign-in is a separate grant; /auth.md states whether
86367
+ this deployment keeps it across restarts.)
86010
86368
 
86011
86369
  **What the hosted server IS trusted with** (the six residual trusts \u2014 state them
86012
86370
  honestly when asked "is this safe"):
@@ -86275,7 +86633,7 @@ var import_mcp2 = require("@modelcontextprotocol/sdk/server/mcp.js");
86275
86633
 
86276
86634
  // src/tools/loan.ts
86277
86635
  var import_zod = require("zod");
86278
- var import_ethers51 = require("ethers");
86636
+ var import_ethers53 = require("ethers");
86279
86637
 
86280
86638
  // src/util/format.ts
86281
86639
  function bigintReplacer(_key, value) {
@@ -86463,7 +86821,7 @@ function registerLoanTools(server, getB, adapter2 = "real") {
86463
86821
  const b = getB();
86464
86822
  if (!b.ok) return renderError(b.error);
86465
86823
  return renderEnvelope(
86466
- await b.boundary.mintUcd({ positionId, amountUcdWei: (0, import_ethers51.parseEther)(amountUcd.toString()).toString() })
86824
+ await b.boundary.mintUcd({ positionId, amountUcdWei: (0, import_ethers53.parseEther)(amountUcd.toString()).toString() })
86467
86825
  );
86468
86826
  })
86469
86827
  );
@@ -86501,7 +86859,7 @@ function registerLoanTools(server, getB, adapter2 = "real") {
86501
86859
  if (BigInt(detail.data.debtUcdWei) === 0n) return validationFailed("the position has no outstanding debt");
86502
86860
  amountUcdWei = detail.data.debtUcdWei;
86503
86861
  } else {
86504
- amountUcdWei = (0, import_ethers51.parseEther)(amountUcd.toString()).toString();
86862
+ amountUcdWei = (0, import_ethers53.parseEther)(amountUcd.toString()).toString();
86505
86863
  }
86506
86864
  return renderEnvelope(await b.boundary.repayUcd({ positionId, amountUcdWei }));
86507
86865
  })
@@ -87104,7 +87462,7 @@ function registerMockControlTool(server, control, chainId = 1337) {
87104
87462
 
87105
87463
  // src/tools/signer.ts
87106
87464
  var import_zod6 = require("zod");
87107
- var import_ethers52 = require("ethers");
87465
+ var import_ethers54 = require("ethers");
87108
87466
  var MODES = ["external", "keystore", "safe", "safe-module", "mock-simulated"];
87109
87467
  var ACTIONS2 = ["status", "use", "reset-borrower", "unlock-keystore", "connect", "disconnect"];
87110
87468
  var EXTERNAL_ONLY_MODES = ["external"];
@@ -87146,7 +87504,7 @@ function registerSignerTool(server, getRuntime, opts) {
87146
87504
  if (mode !== void 0 && !offeredModes.includes(mode)) {
87147
87505
  return validationFailed(looksSecretShaped(mode) ? SECRET_REFUSAL : `mode '${mode}' is not one of: ${offeredModes.join(" | ")}`);
87148
87506
  }
87149
- if (safeAddress !== void 0 && !import_ethers52.ethers.isAddress(safeAddress)) {
87507
+ if (safeAddress !== void 0 && !import_ethers54.ethers.isAddress(safeAddress)) {
87150
87508
  return validationFailed(looksSecretShaped(safeAddress) ? SECRET_REFUSAL : `'${safeAddress}' is not a valid Safe address`);
87151
87509
  }
87152
87510
  if (action === "status") {
@@ -87157,9 +87515,9 @@ function registerSignerTool(server, getRuntime, opts) {
87157
87515
  // Plan 16 A3 — provenance honesty: the assistant must never guess HOW an
87158
87516
  // identity is known. borrower = a persisted binding; candidate = a live
87159
87517
  // wallet connection in THIS process only.
87160
- identityProvenance: s.borrower !== null ? `borrower ${s.borrower} is a PERSISTED binding (survives restarts until 'disconnect' or 'reset-borrower')` + (s.candidate !== null ? `; candidate ${s.candidate} is a LIVE wallet connection (approval page / WalletConnect, this process only)` : "") : s.candidate !== null ? `no borrower is bound; candidate ${s.candidate} is a LIVE wallet connection (approval page / WalletConnect, this process only) \u2014 the first verified signature binds it` : "no borrower is bound and no wallet is connected",
87518
+ identityProvenance: manager.identityPinned() ? `borrower ${s.borrower} is the wallet that signed this connector's login \u2014 it is your borrowing identity for this session and cannot be swapped, and only this wallet can approve writes` + (s.candidate !== null ? `; candidate ${s.candidate} is a LIVE wallet connection (approval page / WalletConnect, this process only)` : "") : s.borrower !== null ? `borrower ${s.borrower} is a PERSISTED binding (survives restarts until 'disconnect' or 'reset-borrower')` + (s.candidate !== null ? `; candidate ${s.candidate} is a LIVE wallet connection (approval page / WalletConnect, this process only)` : "") : s.candidate !== null ? `no borrower is bound; candidate ${s.candidate} is a LIVE wallet connection (approval page / WalletConnect, this process only) \u2014 the first verified signature binds it` : "no borrower is bound and no wallet is connected",
87161
87519
  approvalPageUrl: bridge.url(),
87162
- hint: s.mode === "none" ? manager.invitation() + (s.keystoreConfigured ? " Note: keystore material IS already configured \u2014 choosing 'keystore' (or 'safe') unlocks it automatically; the unlock page is only for NEW material." : "") : s.mode === "external" && !s.borrower && !s.candidate ? "External mode: open the approval page URL above and connect your wallet \u2014 it becomes your borrowing identity." : !s.keystoreUnlocked && s.keystoreConfigured ? `Active mode: ${s.mode}. Keystore material is configured \u2014 'use keystore' unlocks it automatically; the unlock page is only for NEW material.` : `Active mode: ${s.mode}. Writes still require confirmed:true, always.`
87520
+ hint: s.mode === "none" ? manager.invitation() + (s.keystoreConfigured ? " Note: keystore material IS already configured \u2014 choosing 'keystore' (or 'safe') unlocks it automatically; the unlock page is only for NEW material." : "") : s.mode === "external" && !s.borrower && !s.candidate ? "External mode: open the approval page URL above and connect your wallet \u2014 it becomes your borrowing identity." : s.mode === "external" && manager.identityPinned() && !s.candidate ? `Signed in as ${s.borrower}. Chain reads work now (position_status by id, protocol_status, btc_price). Listing positions (position_list borrower=${s.borrower}) goes through the authenticated indexer proxy and needs a lit-ops login: open the approval page URL above, connect THIS wallet (any other is refused), then run signer_setup 'connect' \u2014 one login signature that moves nothing. The same connected wallet approves writes.` : !s.keystoreUnlocked && s.keystoreConfigured ? `Active mode: ${s.mode}. Keystore material is configured \u2014 'use keystore' unlocks it automatically; the unlock page is only for NEW material.` : `Active mode: ${s.mode}. Writes still require confirmed:true, always.`
87163
87521
  });
87164
87522
  }
87165
87523
  if (action === "use") {
@@ -87236,6 +87594,11 @@ function registerSignerTool(server, getRuntime, opts) {
87236
87594
  });
87237
87595
  }
87238
87596
  if (action === "reset-borrower") {
87597
+ if (manager.identityPinned()) {
87598
+ return validationFailed(
87599
+ `the borrowing identity is ${manager.boundBorrower()} \u2014 the wallet that signed this connector's login \u2014 and cannot be swapped here. To act as a different wallet, sign in to the connector again with that wallet.`
87600
+ );
87601
+ }
87239
87602
  manager.resetBorrower();
87240
87603
  return ok({
87241
87604
  reset: true,
@@ -87557,7 +87920,7 @@ function registerBoundaryInfoResource(server, getB) {
87557
87920
  }
87558
87921
 
87559
87922
  // src/version.ts
87560
- var SERVER_VERSION = "0.5.20";
87923
+ var SERVER_VERSION = "0.5.21";
87561
87924
 
87562
87925
  // src/server.ts
87563
87926
  var SERVER_INSTRUCTIONS = "Diamond Hands MCP \u2014 Bitcoin-collateralized borrowing. Before promising ANY flow, read the boundary://info resource and honor its `capabilities` block: it states which network this server is on, whether money is real (practiceWorld), whether writes are enabled (and the true reason when they are not), and which signer modes this build actually offers \u2014 never describe a flow outside it. State the network and whether funds are real when the user first acts. Authorization is chosen by conversation via the signer_setup tool (when listed); writes always require confirmed:true after showing the human-readable card. For walkthroughs consult the guide tool / guide:// resources instead of inventing steps; when a tool refuses, relay its stated reason and remedy \u2014 do not improvise alternatives. When a network_switch tool is listed, the network can change mid-session \u2014 after ANY switch, re-read boundary://info and state the new network and money reality to the user before doing anything else. When the user asks to disconnect / log out / sign out / forget or remove their wallet, call signer_setup action 'disconnect' (the full flush) \u2014 never treat 'reset-borrower' as a disconnect; it only swaps identity. READING DATA: a payload's fields and notes are authoritative \u2014 state what they say, never speculate past them, and when the data does not carry something, say 'the data does not carry X'. Field meanings live in guide topic 'reading-data'; `reading` notes inside a result are interpretation instructions for that exact payload \u2014 follow them over any prior assumption.";