@decentnetwork/lan 0.1.280 → 0.1.281

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.
@@ -587,26 +587,30 @@ export class DaemonServer {
587
587
  const chip = this.messageStore?.appendFile(userid, "out", { name: safeName, size: data.length, status: "sending", sent: 0 });
588
588
  this.friendMeta?.ensure(userid);
589
589
  this.ipcEvents.emit("event", { type: "chat", userid, dir: "out" });
590
- let delivery;
591
- try {
592
- delivery = await this.peerManager.sendInlineFile(userid, new Uint8Array(data), name);
593
- }
594
- catch (e) {
590
+ // Sends are NON-BLOCKING (the 2026-08-05 rule): the delivery wait
591
+ // scales with size (up to 180s), and holding the HTTP request open
592
+ // that long froze the UI on an 8MB inline send. Return now; the
593
+ // verdict patches the chip and the event stream repaints it.
594
+ const bytes = new Uint8Array(data);
595
+ void (async () => {
596
+ let delivery;
597
+ try {
598
+ delivery = await this.peerManager.sendInlineFile(userid, bytes, name);
599
+ }
600
+ catch (e) {
601
+ if (chip)
602
+ this.messageStore?.patchFile(userid, chip.id, { status: "failed" });
603
+ this.ipcEvents.emit("event", { type: "chat", userid, dir: "out" });
604
+ this.logger.warn(`Inline file "${name}" to native ${userid.slice(0, 8)} failed: ${e.message}`);
605
+ return;
606
+ }
607
+ const status = delivery === "acked" ? "sent" : delivery === "offline" ? "queued" : "failed";
595
608
  if (chip)
596
- this.messageStore?.patchFile(userid, chip.id, { status: "failed" });
609
+ this.messageStore?.patchFile(userid, chip.id, { status, sent: delivery === "acked" ? data.length : 0 });
597
610
  this.ipcEvents.emit("event", { type: "chat", userid, dir: "out" });
598
- throw e;
599
- }
600
- const status = delivery === "acked" ? "sent" : delivery === "offline" ? "queued" : "failed";
601
- if (chip)
602
- this.messageStore?.patchFile(userid, chip.id, { status, sent: delivery === "acked" ? data.length : 0 });
603
- this.ipcEvents.emit("event", { type: "chat", userid, dir: "out" });
604
- this.logger.info(`Inline file "${name}" (${data.length}B) to native ${userid.slice(0, 8)}: delivery=${delivery} → ${status}`);
605
- if (delivery === "accepted") {
606
- throw new Error(`The peer never confirmed receiving "${name}" — it likely did not arrive. ` +
607
- `Check that their app is in the foreground and try again.`);
608
- }
609
- return { inline: true, name, size: data.length, delivery };
611
+ this.logger.info(`Inline file "${name}" (${data.length}B) to native ${userid.slice(0, 8)}: delivery=${delivery} → ${status}`);
612
+ })();
613
+ return { inline: true, name, size: data.length, pending: true };
610
614
  }
611
615
  // Add the "out" chip immediately as STATUS=sending (not "sent" — the
612
616
  // transfer is reliable+acked, so it only flips to "sent" once the
@@ -1,4 +1,4 @@
1
- window.__DK_UI_VERSION="0.1.280";
1
+ window.__DK_UI_VERSION="0.1.281";
2
2
  const ICON_PATHS = {
3
3
  // ---- tab bar (the four must feel like one set) ----
4
4
  users: '<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/>',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decentnetwork/lan",
3
- "version": "0.1.280",
3
+ "version": "0.1.281",
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",