@decentnetwork/lan 0.1.210 → 0.1.212

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.
@@ -144,8 +144,10 @@ export declare class PeerManager extends EventEmitter {
144
144
  */
145
145
  getDhtHealth(): ReturnType<Peer["dhtHealth"]> | null;
146
146
  /**
147
- * Check if a specific friend is currently online (direct UDP path established).
148
- * Returns false for unknown pubkeys.
147
+ * Check whether a friend has a usable encrypted session, not merely relay/DHT
148
+ * presence. Presence can say "online" while net_crypto is still handshaking;
149
+ * treating that as send-ready creates file chips stuck forever at 0%.
150
+ * Returns false for unknown pubkeys or a half-open session.
149
151
  *
150
152
  * Matches on BOTH `pubkey` and `userid` because the SDK's FriendRecord
151
153
  * is inconsistent across code paths: outbound friend requests set
@@ -343,8 +343,10 @@ export class PeerManager extends EventEmitter {
343
343
  return this.peer.dhtHealth();
344
344
  }
345
345
  /**
346
- * Check if a specific friend is currently online (direct UDP path established).
347
- * Returns false for unknown pubkeys.
346
+ * Check whether a friend has a usable encrypted session, not merely relay/DHT
347
+ * presence. Presence can say "online" while net_crypto is still handshaking;
348
+ * treating that as send-ready creates file chips stuck forever at 0%.
349
+ * Returns false for unknown pubkeys or a half-open session.
348
350
  *
349
351
  * Matches on BOTH `pubkey` and `userid` because the SDK's FriendRecord
350
352
  * is inconsistent across code paths: outbound friend requests set
@@ -359,7 +361,9 @@ export class PeerManager extends EventEmitter {
359
361
  const friend = this.peer
360
362
  .friends()
361
363
  .find((f) => f.pubkey === pubkey || f.userid === pubkey);
362
- return friend?.status === "online";
364
+ if (friend?.status !== "online")
365
+ return false;
366
+ return this.peer.sessionStatus(pubkey)?.established === true;
363
367
  }
364
368
  /**
365
369
  * Actively wait for a friend to come online. The SDK uses this signal to
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decentnetwork/lan",
3
- "version": "0.1.210",
3
+ "version": "0.1.212",
4
4
  "description": "Private virtual LAN for self-hosted services and AI agents, built on Elastos Carrier. NAT-traversal, name service, ACL, all over a peer-to-peer mesh — no public IP required.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -84,7 +84,7 @@
84
84
  },
85
85
  "dependencies": {
86
86
  "@decentnetwork/dora": "^0.1.14",
87
- "@decentnetwork/peer": "^0.1.104",
87
+ "@decentnetwork/peer": "^0.1.105",
88
88
  "@decentnetwork/peer-webrtc": "^0.2.10",
89
89
  "ink": "^5.2.1",
90
90
  "js-yaml": "^4.1.0",