@decentnetwork/beagle 0.1.151 → 0.1.153

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.
@@ -1,4 +1,4 @@
1
- window.__DK_UI_VERSION="0.1.151";
1
+ window.__DK_UI_VERSION="0.1.153";
2
2
  "use strict";
3
3
  (() => {
4
4
  // packages/beagle-ui/dist/beagle-ui.js
@@ -2109,6 +2109,10 @@ ${lines}`, { assistant: { kind: "adopt", rows: fresh } }));
2109
2109
  };
2110
2110
  try {
2111
2111
  const r = await it.sender(it.file, onProgress);
2112
+ if (r && r.rtcFailed) {
2113
+ it.rtcFailed = true;
2114
+ it.rtcError = r.rtcError ? String(r.rtcError) : null;
2115
+ }
2112
2116
  if (r && r.ok === false) {
2113
2117
  it.status = "failed";
2114
2118
  it.error = r.error && String(r.error) || "send failed";
@@ -2166,16 +2170,6 @@ ${lines}`, { assistant: { kind: "adopt", rows: fresh } }));
2166
2170
  }
2167
2171
  };
2168
2172
  }
2169
- function failureReport(done, lang) {
2170
- const failed = (done || []).filter((x) => x.status === "failed");
2171
- if (!failed.length)
2172
- return null;
2173
- const zh = lang === "zh";
2174
- if (done.length === 1)
2175
- return (zh ? "\u53D1\u9001\u5931\u8D25: " : "Send failed: ") + (failed[0].error || "");
2176
- const head = zh ? `${done.length} \u4E2A\u6587\u4EF6\u4E2D\u6709 ${failed.length} \u4E2A\u6CA1\u6709\u53D1\u9001:` : `${failed.length} of ${done.length} files did not send:`;
2177
- return head + "\n\n" + failed.map((x) => `\u2022 ${x.name} \u2014 ${x.error || (zh ? "\u53D1\u9001\u5931\u8D25" : "send failed")}`).join("\n");
2178
- }
2179
2173
  function successFlash(done, lang) {
2180
2174
  const n = (done || []).length;
2181
2175
  const zh = lang === "zh";
@@ -2184,6 +2178,31 @@ ${lines}`, { assistant: { kind: "adopt", rows: fresh } }));
2184
2178
  return rtc ? zh ? "WebRTC \u6587\u4EF6\u53D1\u9001\u5B8C\u6210" : "WebRTC file sent" : zh ? "\u6587\u4EF6\u5DF2\u63D0\u4EA4\u53D1\u9001" : "File send started";
2185
2179
  return rtc ? zh ? `\u5DF2\u901A\u8FC7 WebRTC \u53D1\u9001 ${n} \u4E2A\u6587\u4EF6` : `${n} files sent via WebRTC` : zh ? `\u5DF2\u63D0\u4EA4\u53D1\u9001 ${n} \u4E2A\u6587\u4EF6` : `${n} file sends started`;
2186
2180
  }
2181
+ function keptResults(done) {
2182
+ return (done || []).filter((x) => x.status === "failed" || x.rtcFailed);
2183
+ }
2184
+ function resultLabel(it, lang) {
2185
+ const zh = lang === "zh";
2186
+ const name = (it.via === "webrtc" ? "WebRTC \xB7 " : "") + (it.name || "file");
2187
+ if (it.status === "failed") {
2188
+ const why = it.error || (zh ? "\u53D1\u9001\u5931\u8D25" : "send failed");
2189
+ if (it.rtcFailed)
2190
+ return name + (zh ? " \xB7 \u5931\u8D25(WebRTC \u4E0E Carrier \u5747\u672A\u6210\u529F): " : " \xB7 failed (WebRTC, then Carrier): ") + why;
2191
+ return name + (zh ? " \xB7 \u5931\u8D25: " : " \xB7 failed: ") + why;
2192
+ }
2193
+ return name + (zh ? " \xB7 WebRTC \u5931\u8D25 \u2014 \u5DF2\u901A\u8FC7 Carrier \u53D1\u9001" : " \xB7 WebRTC failed \u2014 sent via Carrier");
2194
+ }
2195
+ function finishFlash(done, lang) {
2196
+ const zh = lang === "zh";
2197
+ const failed = (done || []).filter((x) => x.status === "failed").length;
2198
+ if (failed) {
2199
+ const n = (done || []).length;
2200
+ return ["err", n === 1 ? zh ? "\u53D1\u9001\u5931\u8D25,\u89C1\u4E0B\u65B9" : "Send failed \u2014 see below" : zh ? `${n} \u4E2A\u6587\u4EF6\u4E2D\u6709 ${failed} \u4E2A\u6CA1\u6709\u53D1\u9001,\u89C1\u4E0B\u65B9` : `${failed} of ${n} files did not send \u2014 see below`];
2201
+ }
2202
+ if ((done || []).some((x) => x.rtcFailed))
2203
+ return ["ok", zh ? "WebRTC \u5931\u8D25,\u5DF2\u901A\u8FC7 Carrier \u53D1\u9001" : "WebRTC failed \u2014 sent via Carrier"];
2204
+ return ["ok", successFlash(done, lang)];
2205
+ }
2187
2206
  var PROOF_KEY = { eth: "proof.eth", sol: "proof.sol" };
2188
2207
  var HEAD = "Beagle wallet binding";
2189
2208
  var LINE = "I bind this wallet to my Beagle identity.";
@@ -4539,6 +4558,7 @@ ${lines}`, { assistant: { kind: "adopt", rows: fresh } }));
4539
4558
  };
4540
4559
  const [dragOver, setDragOver] = React.useState(false);
4541
4560
  const [sending, setSending] = React.useState(null);
4561
+ const [sendResults, setSendResults] = React.useState([]);
4542
4562
  const [theater, setTheater] = React.useState(null);
4543
4563
  React.useEffect(() => {
4544
4564
  setDraft("");
@@ -4567,11 +4587,11 @@ ${lines}`, { assistant: { kind: "adopt", rows: fresh } }));
4567
4587
  };
4568
4588
  const finishRef = React.useRef(null);
4569
4589
  finishRef.current = (done) => {
4570
- const report = failureReport(done, lang);
4571
- if (report)
4572
- window.alert(report);
4573
- else
4574
- showFlash("ok", successFlash(done, lang));
4590
+ const kept = keptResults(done);
4591
+ if (kept.length)
4592
+ setSendResults((prev) => prev.concat(kept).slice(-20));
4593
+ const [kind, msg] = finishFlash(done, lang);
4594
+ showFlash(kind, msg);
4575
4595
  requestAnimationFrame(scrollToBottom);
4576
4596
  };
4577
4597
  const queueRef = React.useRef(null);
@@ -4589,6 +4609,8 @@ ${lines}`, { assistant: { kind: "adopt", rows: fresh } }));
4589
4609
  queueRef.current.add(files, sender, { via: mode, peerId: peer.id });
4590
4610
  };
4591
4611
  const mySending = sending ? sending.filter((s) => s.peerId === peer.id) : [];
4612
+ const myResults = sendResults.filter((s) => s.peerId === peer.id);
4613
+ const dismissResults = () => setSendResults((prev) => prev.filter((s) => s.peerId !== peer.id));
4592
4614
  const onDrop = (e) => {
4593
4615
  e.preventDefault();
4594
4616
  setDragOver(false);
@@ -4750,7 +4772,7 @@ ${peer.address}`
4750
4772
  stroke: 2.2,
4751
4773
  color: flash.kind === "err" ? "var(--danger)" : "var(--accent)"
4752
4774
  }
4753
- ), flash.msg), mySending.length > 0 && /* @__PURE__ */ React.createElement("div", { "data-testid": "file-send-queue", style: { maxWidth: 1200, margin: "0 auto 8px", display: "flex", flexDirection: "column", gap: 3, fontFamily: "var(--mono)", fontSize: 11.5, color: "var(--faint)", maxHeight: 132, overflowY: "auto" } }, mySending.length > 1 && /* @__PURE__ */ React.createElement("div", { style: { color: "var(--dim)" } }, (lang === "zh" ? "\u53D1\u9001 " : "Sending ") + mySending.filter((s) => s.status === "sent" || s.status === "failed").length + " / " + mySending.length + (lang === "zh" ? " \u4E2A\u6587\u4EF6" : " files")), mySending.map((s) => /* @__PURE__ */ React.createElement("div", { key: s.id, "data-status": s.status, style: { display: "flex", alignItems: "center", gap: 8, minWidth: 0, color: s.status === "failed" ? "var(--danger)" : void 0 } }, /* @__PURE__ */ React.createElement(
4775
+ ), flash.msg), (mySending.length > 0 || myResults.length > 0) && /* @__PURE__ */ React.createElement("div", { "data-testid": "file-send-queue", style: { maxWidth: 1200, margin: "0 auto 8px", display: "flex", flexDirection: "column", gap: 3, fontFamily: "var(--mono)", fontSize: 11.5, color: "var(--faint)", maxHeight: 132, overflowY: "auto" } }, mySending.length > 1 && /* @__PURE__ */ React.createElement("div", { style: { color: "var(--dim)" } }, (lang === "zh" ? "\u53D1\u9001 " : "Sending ") + mySending.filter((s) => s.status === "sent" || s.status === "failed").length + " / " + mySending.length + (lang === "zh" ? " \u4E2A\u6587\u4EF6" : " files")), mySending.map((s) => /* @__PURE__ */ React.createElement("div", { key: s.id, "data-status": s.status, style: { display: "flex", alignItems: "center", gap: 8, minWidth: 0, color: s.status === "failed" ? "var(--danger)" : void 0 } }, /* @__PURE__ */ React.createElement(
4754
4776
  Icon,
4755
4777
  {
4756
4778
  name: s.status === "sent" ? "check" : s.status === "failed" ? "x" : "paperclip",
@@ -4758,7 +4780,37 @@ ${peer.address}`
4758
4780
  stroke: 2,
4759
4781
  color: s.status === "failed" ? "var(--danger)" : s.status === "waiting" ? "var(--faint)" : "var(--accent)"
4760
4782
  }
4761
- ), /* @__PURE__ */ React.createElement("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", minWidth: 0 } }, (s.status === "sending" ? lang === "zh" ? "\u53D1\u9001\u4E2D: " : "Sending: " : "") + (s.via === "webrtc" ? "WebRTC \xB7 " : "") + s.name + (s.status === "sending" ? (s.size ? " \xB7 " + dkFileSize(s.sent || 0) + " / " + dkFileSize(s.size) : "") + (s.pct != null ? " \xB7 " + Math.min(100, Math.max(0, s.pct)).toFixed(1) + "%" : "") + (s.kbps != null ? " \xB7 " + dkSpeed(s.kbps) : "") : s.status === "waiting" ? " \xB7 " + (s.size ? dkFileSize(s.size) + " \xB7 " : "") + (lang === "zh" ? "\u7B49\u5F85\u4E2D" : "waiting") : s.status === "failed" ? " \xB7 " + (s.error || "") : " \xB7 " + (lang === "zh" ? "\u5DF2\u63D0\u4EA4" : "done")))))), /* @__PURE__ */ React.createElement("div", { style: { maxWidth: 1200, margin: "0 auto", display: "flex", alignItems: "center", gap: phone ? 6 : 10 } }, /* @__PURE__ */ React.createElement(
4783
+ ), /* @__PURE__ */ React.createElement("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", minWidth: 0 } }, (s.status === "sending" ? lang === "zh" ? "\u53D1\u9001\u4E2D: " : "Sending: " : "") + (s.via === "webrtc" ? "WebRTC \xB7 " : "") + s.name + (s.status === "sending" ? (s.size ? " \xB7 " + dkFileSize(s.sent || 0) + " / " + dkFileSize(s.size) : "") + (s.pct != null ? " \xB7 " + Math.min(100, Math.max(0, s.pct)).toFixed(1) + "%" : "") + (s.kbps != null ? " \xB7 " + dkSpeed(s.kbps) : "") : s.status === "waiting" ? " \xB7 " + (s.size ? dkFileSize(s.size) + " \xB7 " : "") + (lang === "zh" ? "\u7B49\u5F85\u4E2D" : "waiting") : s.status === "failed" ? " \xB7 " + (s.error || "") : " \xB7 " + (lang === "zh" ? "\u5DF2\u63D0\u4EA4" : "done"))))), myResults.map((s, i) => /* @__PURE__ */ React.createElement(
4784
+ "div",
4785
+ {
4786
+ key: "r" + s.id,
4787
+ "data-testid": "file-send-result",
4788
+ "data-status": s.status,
4789
+ "data-rtc-failed": s.rtcFailed ? "1" : void 0,
4790
+ title: s.rtcError ? "WebRTC: " + s.rtcError : void 0,
4791
+ style: { display: "flex", alignItems: "center", gap: 8, minWidth: 0, color: s.status === "failed" ? "var(--danger)" : "var(--dim)" }
4792
+ },
4793
+ /* @__PURE__ */ React.createElement(
4794
+ Icon,
4795
+ {
4796
+ name: s.status === "failed" ? "x" : "check",
4797
+ size: 13,
4798
+ stroke: 2,
4799
+ color: s.status === "failed" ? "var(--danger)" : "var(--faint)"
4800
+ }
4801
+ ),
4802
+ /* @__PURE__ */ React.createElement("span", { style: { flex: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", minWidth: 0 } }, resultLabel(s, lang)),
4803
+ i === myResults.length - 1 && /* @__PURE__ */ React.createElement(
4804
+ "button",
4805
+ {
4806
+ onClick: dismissResults,
4807
+ title: lang === "zh" ? "\u5173\u95ED" : "Dismiss",
4808
+ "aria-label": lang === "zh" ? "\u5173\u95ED" : "Dismiss",
4809
+ style: { flexShrink: 0, border: "none", background: "transparent", color: "var(--faint)", cursor: "pointer", padding: "0 2px", fontFamily: "var(--mono)", fontSize: 11.5 }
4810
+ },
4811
+ lang === "zh" ? "\u5173\u95ED" : "dismiss"
4812
+ )
4813
+ ))), /* @__PURE__ */ React.createElement("div", { style: { maxWidth: 1200, margin: "0 auto", display: "flex", alignItems: "center", gap: phone ? 6 : 10 } }, /* @__PURE__ */ React.createElement(
4762
4814
  "input",
4763
4815
  {
4764
4816
  ref: fileRef,
@@ -4909,7 +4961,7 @@ ${peer.address}`
4909
4961
  style: { maxWidth: "100%", maxHeight: "100%", objectFit: "contain", borderRadius: 6 }
4910
4962
  }
4911
4963
  ))),
4912
- pubProfile && /* @__PURE__ */ React.createElement(DkPublicProfile, { T, userid: peer.userId, fallbackName: verifiedLabel(peer.userId, peer.alias), isFriend: true, onClose: () => setPubProfile(false) }),
4964
+ pubProfile && /* @__PURE__ */ React.createElement(DkPublicProfile, { T, userid: peer.userId, fallbackName: verifiedLabel(peer.userId, peer.alias), isFriend: true, friend: peer, onClose: () => setPubProfile(false) }),
4913
4965
  nameCardProf && (() => {
4914
4966
  const cardFriend2 = cardFriend(nameCardProf, peers);
4915
4967
  return /* @__PURE__ */ React.createElement(
@@ -4960,6 +5012,75 @@ ${peer.address}`
4960
5012
  return /* @__PURE__ */ React.createElement("div", { style: { flex: 1, display: "flex", minWidth: 0, minHeight: 0 } }, /* @__PURE__ */ React.createElement(PeerSidebar, { T, peers, requests, activeId, onSelect, onAct, onAdd, prefillAddr, onPrefillConsumed, muted, isProtocol, protocolFix }), peer ? /* @__PURE__ */ React.createElement(Conversation, { T, peer, lang, peers, onOpenChat: onSelect, thread, isProtocol, onSend, onSendFile, onSendRtcFile, onAlias, onRemove, onOpenNet, onCall, onReloadThread, hasEarlier, onLoadEarlier, onAssistantRemove, onAssistantAdopt, muted: !!muted && muted.includes(peer.id), onToggleMute }) : /* @__PURE__ */ React.createElement(ChatEmpty, { T }));
4961
5013
  }
4962
5014
  Object.assign(window, { ChatTab });
5015
+ var PLATFORM = { ios: "iOS", android: "Android", darwin: "macOS", macos: "macOS", linux: "Linux", win32: "Windows", windows: "Windows", js: "Browser", browser: "Browser", web: "Browser", agent: "Agent" };
5016
+ var clean2 = (v) => typeof v === "string" && v.trim() ? v.trim() : "";
5017
+ function platformLabel(p) {
5018
+ const v = clean2(p);
5019
+ if (!v)
5020
+ return "";
5021
+ return Object.prototype.hasOwnProperty.call(PLATFORM, v.toLowerCase()) ? PLATFORM[v.toLowerCase()] : v;
5022
+ }
5023
+ function osVersionLabel(v) {
5024
+ const s = clean2(v);
5025
+ return !s || /^[a-z]+-?$/i.test(s) ? "" : s;
5026
+ }
5027
+ function rspLabel(protocol, notAdvertised) {
5028
+ if (typeof protocol !== "string")
5029
+ return "";
5030
+ return protocol ? protocol.toUpperCase() : notAdvertised || "Not advertised";
5031
+ }
5032
+ var LINK_BASE = { twitter: "https://x.com/", linkedin: "https://www.linkedin.com/in/", github: "https://github.com/" };
5033
+ var shortDate = (ms) => {
5034
+ try {
5035
+ return new Date(ms).toLocaleString(void 0, { dateStyle: "medium", timeStyle: "short" });
5036
+ } catch (e) {
5037
+ return new Date(ms).toLocaleString();
5038
+ }
5039
+ };
5040
+ function friendCardView(friend, prof, T = {}, fmtDate2 = shortDate) {
5041
+ const f = friend || {};
5042
+ const p = prof || {};
5043
+ const name = clean2(p.displayName) || clean2(f.alias) || clean2(f.name);
5044
+ const ens = clean2(p.ens) || clean2(f.ensClaim) || clean2(f.ens);
5045
+ const description = clean2(p.description) || clean2(f.description);
5046
+ const avatarUrl = clean2(p.avatarUrl) || clean2(f.avatarUrl) || clean2(f.pushedAvatarUrl);
5047
+ const punkId = p.punkId != null ? p.punkId : f.punkId != null ? f.punkId : null;
5048
+ const userid = f.userId || f.id || "";
5049
+ const address = clean2(f.address) || clean2(p.address);
5050
+ const rows = [];
5051
+ if (friend) {
5052
+ const status = f.online ? T.statusOnline || "Online" : (T.statusOffline || "Offline") + (f.lastSessionAt ? " \xB7 " + (T.lastSeen || "last seen") + " " + fmtDate2(f.lastSessionAt) : "");
5053
+ rows.push({ key: "status", label: T.status || "Status", value: status, online: !!f.online });
5054
+ }
5055
+ if (clean2(p.eth))
5056
+ rows.push({ key: "eth", label: "ethereum", value: p.eth, copy: true, head: 8 });
5057
+ if (clean2(p.sol))
5058
+ rows.push({ key: "sol", label: "solana", value: p.sol, copy: true, head: 8 });
5059
+ if (userid)
5060
+ rows.push({ key: "userid", label: T.userId || "user id", value: userid, copy: true, head: 10 });
5061
+ if (address && address !== userid)
5062
+ rows.push({ key: "address", label: T.addr || "address", value: address, copy: true, head: 8 });
5063
+ const links = Object.entries(p.links || {}).filter(([, h]) => clean2(h)).map(([k, h]) => ({ key: k, label: k, href: (LINK_BASE[k] || "") + h }));
5064
+ const site = clean2(f.profileUrl);
5065
+ if (site && !links.some((l) => l.href === site))
5066
+ links.push({ key: "website", label: T.website || "website", href: site });
5067
+ const client = [];
5068
+ if (friend) {
5069
+ const plat = platformLabel(f.platform);
5070
+ if (plat)
5071
+ client.push({ key: "platform", label: T.friendPlatform || "Platform", value: plat });
5072
+ const os = osVersionLabel(f.osVersion);
5073
+ if (os)
5074
+ client.push({ key: "os", label: T.friendOsVersion || "OS version", value: os });
5075
+ const app = clean2(f.appVersion);
5076
+ if (app)
5077
+ client.push({ key: "app", label: T.friendAppVersion || "App version", value: app });
5078
+ const rsp = rspLabel(f.rspProtocol, T.friendRspNotAdvertised);
5079
+ if (rsp)
5080
+ client.push({ key: "rsp", label: "RSP", value: rsp });
5081
+ }
5082
+ return { name, ens, description, avatarUrl, punkId, userid, address, rows, links, client };
5083
+ }
4963
5084
  function CopyBtn({ value, copiedText = "Copied", copyFailedText = "Copy failed", copyTitle = "Copy" }) {
4964
5085
  const [status, setStatus] = React.useState(null);
4965
5086
  const timer = React.useRef(null);
@@ -5236,7 +5357,7 @@ ${peer.address}`
5236
5357
  function DkPublicProfile({ T, userid, fallbackName, onClose, isFriend, isMe, onMessage, card, friend }) {
5237
5358
  const view = card ? nameCardView(card, friend ? [friend] : []) : null;
5238
5359
  const [st, setSt] = React.useState({ loading: true });
5239
- const ensV = useEnsVerdict(userid, st.prof && st.prof.ens);
5360
+ const ensV = useEnsVerdict(userid, st.prof && st.prof.ens || friend && (friend.ensClaim || friend.ens) || "");
5240
5361
  const [addState, setAddState] = React.useState(null);
5241
5362
  const [recOpen, setRecOpen] = React.useState(false);
5242
5363
  const [recPeers, setRecPeers] = React.useState(null);
@@ -5252,13 +5373,14 @@ ${peer.address}`
5252
5373
  };
5253
5374
  const recommendTo = (p) => {
5254
5375
  const prof2 = st.prof || {};
5376
+ const fc = friend ? friendCardView(friend, st.prof, T) : null;
5255
5377
  const text = dkEncodeBeagleContact({
5256
- name: prof2.displayName || fallbackName || "",
5257
- ens: prof2.ens || "",
5378
+ name: fc && fc.name || prof2.displayName || fallbackName || "",
5379
+ ens: fc && fc.ens || prof2.ens || "",
5258
5380
  userid,
5259
- address: prof2.address || "",
5260
- avatar: prof2.avatarUrl || "",
5261
- description: prof2.description || ""
5381
+ address: fc && fc.address || prof2.address || "",
5382
+ avatar: fc && fc.avatarUrl || prof2.avatarUrl || "",
5383
+ description: fc && fc.description || prof2.description || ""
5262
5384
  });
5263
5385
  setRecState((s) => ({ ...s, [p.id]: "busy" }));
5264
5386
  fetch("/api/chat-send", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ userid: p.userId, text }) }).then((r) => r.json()).then((r) => setRecState((s) => ({ ...s, [p.id]: r.ok !== false ? "sent" : r.error || "failed" }))).catch((e) => setRecState((s) => ({ ...s, [p.id]: String(e && e.message || e) })));
@@ -5282,17 +5404,20 @@ ${peer.address}`
5282
5404
  };
5283
5405
  }, [userid]);
5284
5406
  const prof = st.prof;
5285
- const LINK_BASE = { twitter: "https://x.com/", linkedin: "https://www.linkedin.com/in/", github: "https://github.com/" };
5286
- const links = prof ? Object.entries(prof.links || {}) : [];
5407
+ const fv = isFriend && friend ? friendCardView(friend, prof, T) : null;
5408
+ const pv = prof || {};
5409
+ const LINK_BASE2 = { twitter: "https://x.com/", linkedin: "https://www.linkedin.com/in/", github: "https://github.com/" };
5410
+ const links = fv ? fv.links.map((l) => [l.label, l.href, true]) : prof ? Object.entries(prof.links || {}) : [];
5411
+ const cardAddress = fv ? fv.address : pv.address;
5287
5412
  const lbl = { width: 110, flexShrink: 0, fontFamily: "var(--mono)", fontSize: 11, fontWeight: 600, color: "var(--faint)", textTransform: "uppercase", letterSpacing: 0.5 };
5288
5413
  const rowS = { display: "flex", alignItems: "center", gap: 10, padding: "10px 0", borderTop: "1px solid var(--line)" };
5289
- return /* @__PURE__ */ React.createElement("div", { onClick: onClose, style: { position: "fixed", inset: 0, zIndex: 90, background: "color-mix(in oklab, #000, transparent 38%)", display: "flex", alignItems: "center", justifyContent: "center", padding: 24 } }, /* @__PURE__ */ React.createElement("div", { onClick: (e) => e.stopPropagation(), style: { width: 420, maxWidth: "94vw", background: "var(--panel)", border: "1px solid var(--line)", borderRadius: 16, padding: "20px 22px", display: "flex", flexDirection: "column", gap: 14 } }, /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 14 } }, prof && prof.avatarUrl ? /* @__PURE__ */ React.createElement(DkImgAvatar, { url: prof.avatarUrl, seed: userid, size: 56, radius: 14 }) : prof && prof.punkId != null ? /* @__PURE__ */ React.createElement(DkPunkAvatar, { id: prof.punkId, size: 56, radius: 14, fallbackSeed: userid }) : friend ? /* @__PURE__ */ React.createElement(DkAvatar, { peer: friend, size: 56, radius: 14, dot: false }) : card && card.avatar ? /* @__PURE__ */ React.createElement(DkImgAvatar, { url: card.avatar, seed: userid, size: 56, radius: 14 }) : /* @__PURE__ */ React.createElement(DkIdenticon, { seed: userid, size: 56, radius: 14 }), /* @__PURE__ */ React.createElement("div", { style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--ui)", fontSize: 17, fontWeight: 700, color: "var(--text)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, prof && prof.displayName || fallbackName || shortKey(userid, 10, 6)), prof && prof.ens && /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 5, fontFamily: "var(--mono)", fontSize: 12, color: "var(--accent)", marginTop: 2 } }, prof.ens, /* @__PURE__ */ React.createElement(DkEnsMark, { verdict: ensV, T }))), /* @__PURE__ */ React.createElement(Btn, { icon: "x", size: "sm", onClick: onClose })), st.loading ? /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--faint)" } }, T.dirLoading || "loading\u2026") : !prof && view ? /* @__PURE__ */ React.createElement(DkNameCardNoProfile, { T, view, card, onMessage, isMe }) : !prof ? /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--faint)" } }, T.pubNone || "No public profile \u2014 this user has not registered a beagles.eth name.") : /* @__PURE__ */ React.createElement("div", { style: { display: "flex", flexDirection: "column" } }, prof.description && /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--dim)", paddingBottom: 12, lineHeight: 1.5 } }, prof.description), links.length > 0 && // Label keeps its column; pills wrap inside their OWN container so
5414
+ return /* @__PURE__ */ React.createElement("div", { onClick: onClose, style: { position: "fixed", inset: 0, zIndex: 90, background: "color-mix(in oklab, #000, transparent 38%)", display: "flex", alignItems: "center", justifyContent: "center", padding: 24 } }, /* @__PURE__ */ React.createElement("div", { onClick: (e) => e.stopPropagation(), style: { width: 420, maxWidth: "94vw", maxHeight: "calc(100dvh - 48px)", overflowY: "auto", background: "var(--panel)", border: "1px solid var(--line)", borderRadius: 16, padding: "20px 22px", display: "flex", flexDirection: "column", gap: 14 } }, /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 14 } }, prof && prof.avatarUrl ? /* @__PURE__ */ React.createElement(DkImgAvatar, { url: prof.avatarUrl, seed: userid, size: 56, radius: 14 }) : prof && prof.punkId != null ? /* @__PURE__ */ React.createElement(DkPunkAvatar, { id: prof.punkId, size: 56, radius: 14, fallbackSeed: userid }) : fv && fv.avatarUrl ? /* @__PURE__ */ React.createElement(DkImgAvatar, { url: fv.avatarUrl, seed: userid, size: 56, radius: 14 }) : friend ? /* @__PURE__ */ React.createElement(DkAvatar, { peer: friend, size: 56, radius: 14, dot: false }) : card && card.avatar ? /* @__PURE__ */ React.createElement(DkImgAvatar, { url: card.avatar, seed: userid, size: 56, radius: 14 }) : /* @__PURE__ */ React.createElement(DkIdenticon, { seed: userid, size: 56, radius: 14 }), /* @__PURE__ */ React.createElement("div", { style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--ui)", fontSize: 17, fontWeight: 700, color: "var(--text)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, fv && fv.name || prof && prof.displayName || fallbackName || shortKey(userid, 10, 6)), (fv ? fv.ens : prof && prof.ens) && /* @__PURE__ */ React.createElement("div", { "data-testid": "friend-card-ens", style: { display: "flex", alignItems: "center", gap: 5, fontFamily: "var(--mono)", fontSize: 12, color: "var(--accent)", marginTop: 2 } }, fv ? fv.ens : prof.ens, /* @__PURE__ */ React.createElement(DkEnsMark, { verdict: ensV, T }))), /* @__PURE__ */ React.createElement(Btn, { icon: "x", size: "sm", onClick: onClose })), st.loading && !fv ? /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--faint)" } }, T.dirLoading || "loading\u2026") : !prof && !fv && view ? /* @__PURE__ */ React.createElement(DkNameCardNoProfile, { T, view, card, onMessage, isMe }) : !prof && !fv ? /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--faint)" } }, T.pubNone || "No public profile \u2014 this user has not registered a beagles.eth name.") : /* @__PURE__ */ React.createElement("div", { "data-testid": fv ? "friend-card" : void 0, style: { display: "flex", flexDirection: "column" } }, (fv ? fv.description : pv.description) && /* @__PURE__ */ React.createElement("div", { "data-testid": "friend-card-bio", style: { fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--dim)", paddingBottom: 12, lineHeight: 1.5, overflowWrap: "anywhere" } }, fv ? fv.description : pv.description), links.length > 0 && // Label keeps its column; pills wrap inside their OWN container so
5290
5415
  // an overflowing pill lands under the first pill, never under the label.
5291
- /* @__PURE__ */ React.createElement("div", { style: { ...rowS, alignItems: "flex-start" } }, /* @__PURE__ */ React.createElement("span", { style: { ...lbl, paddingTop: 5 } }, T.linksCard || "links"), /* @__PURE__ */ React.createElement("div", { style: { flex: 1, minWidth: 0, display: "flex", gap: 8, flexWrap: "wrap" } }, links.map(([k, h]) => /* @__PURE__ */ React.createElement(
5416
+ /* @__PURE__ */ React.createElement("div", { style: { ...rowS, alignItems: "flex-start" } }, /* @__PURE__ */ React.createElement("span", { style: { ...lbl, paddingTop: 5 } }, T.linksCard || "links"), /* @__PURE__ */ React.createElement("div", { style: { flex: 1, minWidth: 0, display: "flex", gap: 8, flexWrap: "wrap" } }, links.map(([k, h, full]) => /* @__PURE__ */ React.createElement(
5292
5417
  "a",
5293
5418
  {
5294
5419
  key: k,
5295
- href: (LINK_BASE[k] || "") + h,
5420
+ href: full ? h : (LINK_BASE2[k] || "") + h,
5296
5421
  target: "_blank",
5297
5422
  rel: "noreferrer",
5298
5423
  style: { display: "inline-flex", alignItems: "center", gap: 5, padding: "4px 10px", borderRadius: 999, border: "1px solid var(--line)", textDecoration: "none", fontFamily: "var(--ui)", fontSize: 12, color: "var(--accent)" }
@@ -5301,10 +5426,13 @@ ${peer.address}`
5301
5426
  " \u2197"
5302
5427
  )))), (() => {
5303
5428
  const kvRow = (label, value, head = 8) => /* @__PURE__ */ React.createElement("div", { style: rowS, key: label }, /* @__PURE__ */ React.createElement("span", { style: lbl }, label), /* @__PURE__ */ React.createElement("span", { title: value, style: { flex: 1, minWidth: 0, fontFamily: "var(--mono)", fontSize: 11.5, color: "var(--dim)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, shortKey(value, head, 6)), /* @__PURE__ */ React.createElement(CopyBtn, { value, copiedText: T.copied, copyFailedText: T.copyFailed, copyTitle: T.copy }));
5429
+ if (fv) {
5430
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, fv.rows.map((r) => r.copy ? kvRow(r.label, r.value, r.head) : /* @__PURE__ */ React.createElement("div", { style: rowS, key: r.key, "data-testid": "friend-card-" + r.key }, /* @__PURE__ */ React.createElement("span", { style: lbl }, r.label), /* @__PURE__ */ React.createElement("span", { style: { flex: 1, minWidth: 0, display: "inline-flex", alignItems: "center", gap: 6, fontFamily: "var(--mono)", fontSize: 11.5, color: "var(--dim)" } }, r.key === "status" && /* @__PURE__ */ React.createElement("span", { style: { width: 7, height: 7, borderRadius: 999, flexShrink: 0, background: r.online ? "var(--online)" : "var(--faint)" } }), r.value))));
5431
+ }
5304
5432
  return /* @__PURE__ */ React.createElement(React.Fragment, null, prof.eth && kvRow("ethereum", prof.eth), prof.sol && kvRow("solana", prof.sol), kvRow(T.userId || "user id", userid, 10), prof.address && kvRow(T.addr || "address", prof.address));
5305
5433
  })(), (() => {
5306
5434
  const cta = { padding: "7px 16px", borderRadius: 9, cursor: "pointer", fontFamily: "var(--ui)", fontSize: 12.5 };
5307
- return /* @__PURE__ */ React.createElement("div", { style: { ...rowS, justifyContent: "flex-end", gap: 8 } }, !isMe && prof.address && /* @__PURE__ */ React.createElement(
5435
+ return /* @__PURE__ */ React.createElement("div", { style: { ...rowS, justifyContent: "flex-end", gap: 8 } }, !isMe && cardAddress && /* @__PURE__ */ React.createElement(
5308
5436
  "button",
5309
5437
  {
5310
5438
  onClick: openRecommend,
@@ -5318,10 +5446,10 @@ ${peer.address}`
5318
5446
  style: { ...cta, border: "none", background: "var(--accent)", color: "#fff" }
5319
5447
  },
5320
5448
  T.pubMessage || "Message"
5321
- ), !isMe && !isFriend && prof.address && (addState === "sent" ? /* @__PURE__ */ React.createElement(Tag, { tone: "accent" }, T.dirSent || "requested") : addState && addState !== "busy" ? /* @__PURE__ */ React.createElement("span", { title: addState, style: { fontFamily: "var(--ui)", fontSize: 11.5, color: "var(--warn, #f59e0b)" } }, T.addFailed || "failed") : /* @__PURE__ */ React.createElement(
5449
+ ), !isMe && !isFriend && pv.address && (addState === "sent" ? /* @__PURE__ */ React.createElement(Tag, { tone: "accent" }, T.dirSent || "requested") : addState && addState !== "busy" ? /* @__PURE__ */ React.createElement("span", { title: addState, style: { fontFamily: "var(--ui)", fontSize: 11.5, color: "var(--warn, #f59e0b)" } }, T.addFailed || "failed") : /* @__PURE__ */ React.createElement(
5322
5450
  "button",
5323
5451
  {
5324
- onClick: () => addFriend(prof.address),
5452
+ onClick: () => addFriend(pv.address),
5325
5453
  disabled: addState === "busy",
5326
5454
  style: { ...cta, border: "none", background: "var(--accent)", color: "#fff", opacity: addState === "busy" ? 0.6 : 1 }
5327
5455
  },
@@ -5337,7 +5465,7 @@ ${peer.address}`
5337
5465
  /* @__PURE__ */ React.createElement(DkAvatar, { peer: p, size: 26, radius: 7, dot: false }),
5338
5466
  /* @__PURE__ */ React.createElement("span", { style: { flex: 1, minWidth: 0, fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--text)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, /* @__PURE__ */ React.createElement(DkVerifiedName, { userid: p.userId, name: p.alias, fallback: shortKey(p.userId, 8, 6), T })),
5339
5467
  recState[p.id] === "sent" ? /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--ui)", fontSize: 11.5, color: "var(--online)" } }, T.pubRecSent || "sent \u2713") : recState[p.id] === "busy" ? /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--ui)", fontSize: 11.5, color: "var(--faint)" } }, "\u2026") : recState[p.id] ? /* @__PURE__ */ React.createElement("span", { title: recState[p.id], style: { fontFamily: "var(--ui)", fontSize: 11.5, color: "var(--warn, #f59e0b)" } }, T.addFailed || "failed") : /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--ui)", fontSize: 11.5, color: "var(--accent)" } }, T.send || "Send")
5340
- ))))));
5468
+ ))), fv && fv.client.length > 0 && /* @__PURE__ */ React.createElement("div", { "data-testid": "friend-card-client" }, fv.client.map((r) => /* @__PURE__ */ React.createElement("div", { key: r.key, style: rowS, "data-testid": "friend-card-" + r.key }, /* @__PURE__ */ React.createElement("span", { style: lbl }, r.label), /* @__PURE__ */ React.createElement("span", { title: r.value, style: { flex: 1, minWidth: 0, color: "var(--dim)", fontFamily: "var(--mono)", fontSize: 11.5, overflowWrap: "anywhere" } }, r.value)))))));
5341
5469
  }
5342
5470
  function dkAvatarDataUrl(file) {
5343
5471
  return new Promise((resolve, reject) => {
@@ -6215,6 +6343,8 @@ ${peer.address}`
6215
6343
  justifyContent: "center"
6216
6344
  } }, /* @__PURE__ */ React.createElement(Icon, { name: app.icon, size: 19, color: "var(--accent)", stroke: 1.8 })), /* @__PURE__ */ React.createElement("div", { style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--ui)", fontSize: 14, fontWeight: 600, color: "var(--text)" } }, pickText(app.name, t && t.lang, app.id)), /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--ui)", fontSize: 12.5, color: "var(--faint)", marginTop: 2 } }, pickText(app.blurb, t && t.lang, "")), /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--mono)", fontSize: 11, color: "var(--dim)", marginTop: 3 } }, app.host ? zh ? "\u672C\u673A\u5E94\u7528" : "runs in this app" : String(app.origin || "").replace(/^https?:\/\//, ""))), /* @__PURE__ */ React.createElement(Btn, { tone: "accent", size: "sm", onClick: busy ? void 0 : () => open(app) }, busy === app.id ? zh ? "\u6253\u5F00\u4E2D\u2026" : "opening\u2026" : zh ? "\u6253\u5F00" : "Open")))));
6217
6345
  }
6346
+ var DK_Z_CALL_OVERLAY = 1e3;
6347
+ var DK_Z_INCOMING_CALL = 1010;
6218
6348
  var CLAIM_SUPPRESS_MS = 5 * 6e4;
6219
6349
  function newPageId() {
6220
6350
  return "p" + Math.random().toString(36).slice(2, 10) + Date.now().toString(36).slice(-4);
@@ -7154,7 +7284,7 @@ ${peer.address}`
7154
7284
  return null;
7155
7285
  const peer = (peers || []).find((p) => p.id === inc.peerId) || { id: inc.peerId };
7156
7286
  const name = verifiedLabel(inc.peerId, peer.alias) || peer.name || shortKey(inc.peerId, 10, 6);
7157
- return /* @__PURE__ */ React.createElement("div", { style: { position: "fixed", inset: 0, zIndex: 80, background: "color-mix(in oklab, var(--bg), transparent 15%)", display: "flex", alignItems: "center", justifyContent: "center" } }, /* @__PURE__ */ React.createElement("div", { style: { width: 320, padding: 26, borderRadius: 18, background: "var(--panel)", border: "1px solid var(--line)", textAlign: "center", boxShadow: "0 20px 60px rgba(0,0,0,0.4)" } }, /* @__PURE__ */ React.createElement("div", { style: { position: "relative", display: "inline-flex", alignItems: "center", justifyContent: "center", marginBottom: 14 } }, /* @__PURE__ */ React.createElement("span", { style: { position: "absolute", width: 96, height: 96, borderRadius: 999, border: "2px solid var(--accent)", animation: "dkpulse 2s ease-out infinite" } }), /* @__PURE__ */ React.createElement(DkIdenticon, { seed: inc.peerId, size: 72, radius: 18 })), /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--mono)", fontSize: 17, fontWeight: 700, color: "var(--text)" } }, name), /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--mono)", fontSize: 12.5, color: "var(--faint)", marginTop: 4, display: "flex", gap: 6, alignItems: "center", justifyContent: "center" } }, /* @__PURE__ */ React.createElement(Icon, { name: inc.video ? "video" : "phone", size: 14, stroke: 2 }), T && (inc.video ? T.incomingVideo : T.incomingAudio) || "Incoming " + (inc.video ? "video" : "audio") + " call"), (inc.via === "rsp" || inc.via === "rsp-doorbell") && /* @__PURE__ */ React.createElement("div", { style: { color: "var(--faint)", fontSize: 12, marginTop: 6 } }, inc.via === "rsp-doorbell" ? "RSP \xB7 Doorbell" : "RSP"), /* @__PURE__ */ React.createElement("div", { style: { display: "flex", gap: 14, justifyContent: "center", marginTop: 22 } }, /* @__PURE__ */ React.createElement(CallBtn, { icon: "phone", label: T && T.decline || "Decline", danger: true, onClick: ctl.reject }), /* @__PURE__ */ React.createElement(CallBtn, { icon: inc.video ? "video" : "phone", label: T && T.accept || "Accept", active: true, onClick: ctl.accept }))));
7287
+ return /* @__PURE__ */ React.createElement("div", { "data-testid": "incoming-call", style: { position: "fixed", inset: 0, zIndex: DK_Z_INCOMING_CALL, background: "color-mix(in oklab, var(--bg), transparent 15%)", display: "flex", alignItems: "center", justifyContent: "center" } }, /* @__PURE__ */ React.createElement("div", { style: { width: 320, padding: 26, borderRadius: 18, background: "var(--panel)", border: "1px solid var(--line)", textAlign: "center", boxShadow: "0 20px 60px rgba(0,0,0,0.4)" } }, /* @__PURE__ */ React.createElement("div", { style: { position: "relative", display: "inline-flex", alignItems: "center", justifyContent: "center", marginBottom: 14 } }, /* @__PURE__ */ React.createElement("span", { style: { position: "absolute", width: 96, height: 96, borderRadius: 999, border: "2px solid var(--accent)", animation: "dkpulse 2s ease-out infinite" } }), /* @__PURE__ */ React.createElement(DkIdenticon, { seed: inc.peerId, size: 72, radius: 18 })), /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--mono)", fontSize: 17, fontWeight: 700, color: "var(--text)" } }, name), /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--mono)", fontSize: 12.5, color: "var(--faint)", marginTop: 4, display: "flex", gap: 6, alignItems: "center", justifyContent: "center" } }, /* @__PURE__ */ React.createElement(Icon, { name: inc.video ? "video" : "phone", size: 14, stroke: 2 }), T && (inc.video ? T.incomingVideo : T.incomingAudio) || "Incoming " + (inc.video ? "video" : "audio") + " call"), (inc.via === "rsp" || inc.via === "rsp-doorbell") && /* @__PURE__ */ React.createElement("div", { style: { color: "var(--faint)", fontSize: 12, marginTop: 6 } }, inc.via === "rsp-doorbell" ? "RSP \xB7 Doorbell" : "RSP"), /* @__PURE__ */ React.createElement("div", { style: { display: "flex", gap: 14, justifyContent: "center", marginTop: 22 } }, /* @__PURE__ */ React.createElement(CallBtn, { icon: "phone", label: T && T.decline || "Decline", danger: true, onClick: ctl.reject }), /* @__PURE__ */ React.createElement(CallBtn, { icon: inc.video ? "video" : "phone", label: T && T.accept || "Accept", active: true, onClick: ctl.accept }))));
7158
7288
  }
7159
7289
  function CallBtn({ icon, label, onClick, active, danger, wide }) {
7160
7290
  const bg = danger ? "var(--danger)" : active ? "var(--accent)" : "var(--chip)";
@@ -7207,7 +7337,7 @@ ${peer.address}`
7207
7337
  };
7208
7338
  const canShare = connected && typeof navigator !== "undefined" && navigator.mediaDevices && navigator.mediaDevices.getDisplayMedia;
7209
7339
  const controls = /* @__PURE__ */ React.createElement("div", { style: { display: "flex", gap: 18, alignItems: "flex-start" } }, /* @__PURE__ */ React.createElement(CallBtn, { icon: muted ? "micFill" : "mic", label: muted ? T && T.unmute || "unmute" : T && T.mute || "mute", active: muted, onClick: toggleMute }), canShare && /* @__PURE__ */ React.createElement(CallBtn, { icon: "monitor", label: ctl.sharing ? T && T.stopShare || "stop share" : T && T.share || "share", active: ctl.sharing, onClick: ctl.toggleShare }), /* @__PURE__ */ React.createElement(CallBtn, { icon: "phone", label: T && T.endCall || "end", danger: true, wide: true, onClick: ctl.hangup }));
7210
- return /* @__PURE__ */ React.createElement("div", { style: { position: "fixed", inset: 0, zIndex: 70, background: "var(--bg)", display: "flex", flexDirection: "column" } }, ctl.remoteStream && /* @__PURE__ */ React.createElement(AudioSink, { stream: ctl.remoteStream }), /* @__PURE__ */ React.createElement("div", { style: { height: 52, flexShrink: 0, display: "flex", alignItems: "center", gap: 10, padding: "0 18px", borderBottom: "1px solid var(--line)" } }, /* @__PURE__ */ React.createElement(Icon, { name: video ? "video" : "phone", size: 16, color: "var(--accent)", stroke: 2 }), /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 13, fontWeight: 700, color: "var(--text)" } }, name), /* @__PURE__ */ React.createElement(Tag, { tone: callStateTone(call.ended ? call.state : connected ? "connected" : call.state) }, stateLabel), noticeText && /* @__PURE__ */ React.createElement(Tag, { tone: "danger" }, noticeText), /* @__PURE__ */ React.createElement("div", { style: { flex: 1 } }), connected && /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 14, fontWeight: 700, color: "var(--text)", letterSpacing: 1 } }, mm, ":", ss)), video ? (() => {
7340
+ return /* @__PURE__ */ React.createElement("div", { "data-testid": "call-overlay", style: { position: "fixed", inset: 0, zIndex: DK_Z_CALL_OVERLAY, background: "var(--bg)", display: "flex", flexDirection: "column" } }, ctl.remoteStream && /* @__PURE__ */ React.createElement(AudioSink, { stream: ctl.remoteStream }), /* @__PURE__ */ React.createElement("div", { style: { height: 52, flexShrink: 0, display: "flex", alignItems: "center", gap: 10, padding: "0 18px", borderBottom: "1px solid var(--line)" } }, /* @__PURE__ */ React.createElement(Icon, { name: video ? "video" : "phone", size: 16, color: "var(--accent)", stroke: 2 }), /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 13, fontWeight: 700, color: "var(--text)" } }, name), /* @__PURE__ */ React.createElement(Tag, { tone: callStateTone(call.ended ? call.state : connected ? "connected" : call.state) }, stateLabel), noticeText && /* @__PURE__ */ React.createElement(Tag, { tone: "danger" }, noticeText), /* @__PURE__ */ React.createElement("div", { style: { flex: 1 } }), connected && /* @__PURE__ */ React.createElement("span", { style: { fontFamily: "var(--mono)", fontSize: 14, fontWeight: 700, color: "var(--text)", letterSpacing: 1 } }, mm, ":", ss)), video ? (() => {
7211
7341
  const tiles = [
7212
7342
  { key: "remote", stream: ctl.remoteStream, label: name, mirror: false },
7213
7343
  { key: "local", stream: ctl.localStream, label: ctl.sharing ? T && T.yourScreen || "Your screen" : T && T.you || "You", mirror: !ctl.sharing }
@@ -7416,6 +7546,8 @@ ${peer.address}`
7416
7546
  var DEFAULTS = {
7417
7547
  openTimeoutMs: 2e4,
7418
7548
  // DataChannel open
7549
+ offerResendMs: 3e3,
7550
+ // sender: repeat the offer until answered
7419
7551
  highWater: 4 * 1024 * 1024,
7420
7552
  // in-flight bytes before the send loop waits
7421
7553
  bufferWaitMs: 3e4,
@@ -7508,6 +7640,7 @@ ${peer.address}`
7508
7640
  const PC = o.RTCPeerConnection;
7509
7641
  const sessions = /* @__PURE__ */ new Map();
7510
7642
  const finished = /* @__PURE__ */ new Map();
7643
+ const ended = /* @__PURE__ */ new Map();
7511
7644
  const envelope = (fileId, type, extra) => Object.assign({ dkRtc: 1, kind: FILE_RTC_KIND, fileId, type, ts: Date.now() }, extra || {});
7512
7645
  const signal = (peerId, fileId, type, extra) => o.bus.send(peerId, envelope(fileId, type, extra));
7513
7646
  let off = null;
@@ -7516,6 +7649,9 @@ ${peer.address}`
7516
7649
  for (const [id, at] of finished)
7517
7650
  if (at < cut)
7518
7651
  finished.delete(id);
7652
+ for (const [id, at] of ended)
7653
+ if (at < cut)
7654
+ ended.delete(id);
7519
7655
  };
7520
7656
  const closeRecv = (fileId) => {
7521
7657
  const s = sessions.get(fileId);
@@ -7534,6 +7670,7 @@ ${peer.address}`
7534
7670
  } catch (e) {
7535
7671
  }
7536
7672
  sessions.delete(fileId);
7673
+ ended.set(fileId, Date.now());
7537
7674
  };
7538
7675
  const attachChannel = (peerId, fileId, s, dc) => {
7539
7676
  dc.binaryType = "arraybuffer";
@@ -7594,15 +7731,17 @@ ${peer.address}`
7594
7731
  try {
7595
7732
  if (env.type === "offer") {
7596
7733
  pruneFinished();
7597
- if (finished.has(fileId)) {
7734
+ if (finished.has(fileId) || ended.has(fileId)) {
7598
7735
  log("[file-rtc] offer for a finished transfer ignored " + fileId);
7599
7736
  return;
7600
7737
  }
7601
- if (s && s.pc && s.pc.signalingState !== "closed") {
7602
- log("[file-rtc] duplicate offer ignored for " + fileId);
7738
+ if (s) {
7739
+ if (s.answerSdp && s.peerId === peerId)
7740
+ signal(peerId, fileId, "answer", { sdp: s.answerSdp }).catch(() => {
7741
+ });
7603
7742
  return;
7604
7743
  }
7605
- const sess = { peerId, pc: null, dc: null, meta: env.meta || null, chunks: [], received: 0, pendingCandidates: [], completed: false };
7744
+ const sess = { peerId, pc: null, dc: null, meta: env.meta || null, chunks: [], received: 0, pendingCandidates: [], completed: false, answerSdp: null };
7606
7745
  sessions.set(fileId, sess);
7607
7746
  const pc = new PC({ iceServers: await o.iceServers() });
7608
7747
  sess.pc = pc;
@@ -7623,6 +7762,7 @@ ${peer.address}`
7623
7762
  }
7624
7763
  const answer = await pc.createAnswer();
7625
7764
  await pc.setLocalDescription(answer);
7765
+ sess.answerSdp = answer.sdp;
7626
7766
  await signal(peerId, fileId, "answer", { sdp: answer.sdp });
7627
7767
  } else if (env.type === "candidate" && s && env.candidate) {
7628
7768
  if (s.pc && s.pc.remoteDescription) {
@@ -7658,6 +7798,8 @@ ${peer.address}`
7658
7798
  log("[file-rtc] stale answer ignored for " + env.fileId + " state=" + s.pc.signalingState);
7659
7799
  return;
7660
7800
  }
7801
+ if (s.stopResend)
7802
+ s.stopResend();
7661
7803
  await s.pc.setRemoteDescription({ type: "answer", sdp: env.sdp });
7662
7804
  for (const c of s.pendingCandidates.splice(0)) {
7663
7805
  try {
@@ -7679,7 +7821,7 @@ ${peer.address}`
7679
7821
  const fileId = newId();
7680
7822
  const pc = new PC({ iceServers: await o.iceServers() });
7681
7823
  const dc = pc.createDataChannel("agentnet-file", { ordered: true });
7682
- const s = { peerId, pc, dc, pendingCandidates: [] };
7824
+ const s = { peerId, pc, dc, pendingCandidates: [], stopResend: null };
7683
7825
  senders.set(fileId, s);
7684
7826
  let acked = null;
7685
7827
  const ack = new Promise((resolve) => {
@@ -7695,7 +7837,15 @@ ${peer.address}`
7695
7837
  } catch (e) {
7696
7838
  }
7697
7839
  });
7840
+ let resendTimer = null;
7841
+ s.stopResend = () => {
7842
+ if (resendTimer) {
7843
+ clearInterval(resendTimer);
7844
+ resendTimer = null;
7845
+ }
7846
+ };
7698
7847
  const cleanup = () => {
7848
+ s.stopResend();
7699
7849
  try {
7700
7850
  dc.close();
7701
7851
  } catch (e) {
@@ -7717,8 +7867,25 @@ ${peer.address}`
7717
7867
  const offer = await pc.createOffer();
7718
7868
  await pc.setLocalDescription(offer);
7719
7869
  const mime = file.type || "application/octet-stream";
7720
- await signal(peerId, fileId, "offer", { sdp: offer.sdp, meta: { name: file.name, size: file.size, mime } });
7721
- await waitForOpen(dc, opt.openTimeoutMs, () => rtcState(pc));
7870
+ const meta = { name: file.name, size: file.size, mime };
7871
+ await signal(peerId, fileId, "offer", { sdp: offer.sdp, meta });
7872
+ let resends = 0;
7873
+ resendTimer = setInterval(() => {
7874
+ if (pc.signalingState !== "have-local-offer" || dc.readyState !== "connecting") {
7875
+ s.stopResend();
7876
+ return;
7877
+ }
7878
+ resends++;
7879
+ log("[file-rtc] no answer yet, offer resent (" + resends + ") " + fileId);
7880
+ const sdp = pc.localDescription && pc.localDescription.sdp || offer.sdp;
7881
+ signal(peerId, fileId, "offer", { sdp, meta }).catch(() => {
7882
+ });
7883
+ }, opt.offerResendMs);
7884
+ try {
7885
+ await waitForOpen(dc, opt.openTimeoutMs, () => rtcState(pc));
7886
+ } finally {
7887
+ s.stopResend();
7888
+ }
7722
7889
  dc.send(JSON.stringify({ type: "meta", name: file.name, size: file.size, mime }));
7723
7890
  let sent = 0;
7724
7891
  const startedAt = Date.now();
@@ -7800,7 +7967,8 @@ ${peer.address}`
7800
7967
  sendFile,
7801
7968
  // for tests
7802
7969
  _sessions: sessions,
7803
- _finished: finished
7970
+ _finished: finished,
7971
+ _ended: ended
7804
7972
  };
7805
7973
  }
7806
7974
  function dkFileIceServers() {
@@ -8360,6 +8528,15 @@ ${peer.address}`
8360
8528
  updLanNoRestart: "Installed, but the daemon did not come back within a minute \u2014 the new version applies on its next start.",
8361
8529
  pubOpen: "View public profile",
8362
8530
  pubNone: "No public profile \u2014 this user has not registered a beagles.eth name.",
8531
+ friendPlatform: "Platform",
8532
+ friendOsVersion: "OS version",
8533
+ friendAppVersion: "App version",
8534
+ friendRspNotAdvertised: "Not advertised",
8535
+ status: "Status",
8536
+ statusOnline: "Online",
8537
+ statusOffline: "Offline",
8538
+ lastSeen: "last seen",
8539
+ website: "website",
8363
8540
  ensNoEthWallet: "no Ethereum wallet extension found (MetaMask\u2026)",
8364
8541
  ensNoSolWallet: "no Solana wallet extension found (Phantom\u2026)",
8365
8542
  ensWalletOwned: "registered via your mobile wallet as",
@@ -8597,6 +8774,15 @@ ${peer.address}`
8597
8774
  updLanNoRestart: "\u5DF2\u5B89\u88C5,\u4F46 daemon \u4E00\u5206\u949F\u5185\u6CA1\u6709\u91CD\u65B0\u8D77\u6765\u2014\u2014\u4E0B\u6B21\u542F\u52A8\u65F6\u751F\u6548\u3002",
8598
8775
  pubOpen: "\u67E5\u770B\u516C\u5F00\u8D44\u6599",
8599
8776
  pubNone: "\u6682\u65E0\u516C\u5F00\u8D44\u6599\u2014\u2014\u5BF9\u65B9\u8FD8\u6CA1\u6709\u6CE8\u518C beagles.eth \u540D\u5B57\u3002",
8777
+ friendPlatform: "\u5E73\u53F0",
8778
+ friendOsVersion: "\u7CFB\u7EDF\u7248\u672C",
8779
+ friendAppVersion: "\u5E94\u7528\u7248\u672C",
8780
+ friendRspNotAdvertised: "\u672A\u58F0\u660E\u652F\u6301",
8781
+ status: "\u72B6\u6001",
8782
+ statusOnline: "\u5728\u7EBF",
8783
+ statusOffline: "\u79BB\u7EBF",
8784
+ lastSeen: "\u6700\u540E\u5728\u7EBF",
8785
+ website: "\u7F51\u7AD9",
8600
8786
  ensNoEthWallet: "\u672A\u68C0\u6D4B\u5230\u4EE5\u592A\u574A\u94B1\u5305\u63D2\u4EF6(MetaMask \u7B49)",
8601
8787
  ensNoSolWallet: "\u672A\u68C0\u6D4B\u5230 Solana \u94B1\u5305\u63D2\u4EF6(Phantom \u7B49)",
8602
8788
  ensWalletOwned: "\u5DF2\u901A\u8FC7\u624B\u673A\u94B1\u5305\u6CE8\u518C\u4E3A",
@@ -9168,19 +9354,20 @@ ${peer.address}`
9168
9354
  });
9169
9355
  if (!peerTakesRtcFile(peerId))
9170
9356
  return toxcore();
9357
+ const viaCarrier = (rtcError) => toxcore().then((rr) => Object.assign({}, rr, { rtcFailed: true, rtcError: rtcError || "WebRTC file send failed" }));
9171
9358
  return rtcFileCtl.sendFile(peerId, file, onProgress).then((r) => {
9172
9359
  if (r && r.ok && r.via === "webrtc") {
9173
9360
  return fetch(
9174
9361
  "/api/webrtc-file-save?dir=out&userid=" + encodeURIComponent(peerId) + "&name=" + encodeURIComponent(file.name),
9175
9362
  { method: "POST", body: file }
9176
- ).then(() => {
9363
+ ).catch(() => null).then(() => {
9177
9364
  data.loadThread(peerId);
9178
9365
  data.refresh();
9179
9366
  return { ok: true, via: "webrtc" };
9180
9367
  });
9181
9368
  }
9182
- return toxcore();
9183
- }).catch(() => toxcore());
9369
+ return viaCarrier(r && r.error);
9370
+ }, (e) => viaCarrier(e && e.message || String(e)));
9184
9371
  };
9185
9372
  const onSendRtcFile = (file, onProgress) => {
9186
9373
  if (!activeId || !file)
@@ -5,7 +5,24 @@ export interface FriendStoreEntry {
5
5
  punkId?: number;
6
6
  platform?: string;
7
7
  appVersion?: string;
8
+ osVersion?: string;
9
+ /** Their status line (Carrier userinfo description). */
10
+ description?: string;
11
+ /** The profile link they set (userinfo url). */
12
+ profileUrl?: string;
13
+ /** The beagles.eth name they CLAIM in their profile — unverified here; the
14
+ * UI marks it verified only from the gateway's record for this userid. */
15
+ ens?: string;
16
+ /** The avatar URL they advertised (http(s) only). */
17
+ avatarUrl?: string;
18
+ /** "rsp/1", "rsp/2", … when their profile extra declares RSP with a node;
19
+ * "" when a profile arrived without one; undefined when none arrived. */
20
+ rspProtocol?: string;
21
+ /** Last live session with them (ms epoch), when the SDK recorded one. */
22
+ sessionAt?: number;
8
23
  }
24
+ /** RSP declared in a profile's `extra` JSON: {"rsp":{"protocol":"rsp/2","nodeUrl":"https://…"}}. */
25
+ export declare function rspProtocolFromExtra(extra: unknown): string;
9
26
  /** A punk id as the store or a backend may carry it: a finite non-negative
10
27
  * number. Punk 0 is a real CryptoPunk; a string or a negative is not one. */
11
28
  export declare function punkIdOf(v: unknown): number | undefined;
@@ -10,9 +10,39 @@
10
10
  // version): lan ≤ 0.1.308 dropped these from its friends-list, so on a
11
11
  // daemon backend only a beagles.eth record could supply an avatar — on
12
12
  // mac-dev 8 of 16 pushed punks never reached the screen (2026-10-31).
13
+ // The rest of that profile too (status line, OS version, profile URL, the
14
+ // beagles.eth name they claim, RSP support from `extra`): the friend card
15
+ // shows what the phone apps show (decent-hq 2026-11-25; first attempted on
16
+ // codex/js-friend-client-info, 68c38cc).
13
17
  //
14
18
  // Cached by mtime: the list is polled every 2.5s per tab.
15
19
  import { readFileSync, statSync } from "node:fs";
20
+ const str = (v, max = 256) => typeof v === "string" && v.trim() && v.length <= max ? v.trim() : undefined;
21
+ const httpUrl = (v) => {
22
+ const s = str(v, 2048);
23
+ if (!s)
24
+ return undefined;
25
+ try {
26
+ const u = new URL(s);
27
+ return u.protocol === "https:" || u.protocol === "http:" ? s : undefined;
28
+ }
29
+ catch {
30
+ return undefined;
31
+ }
32
+ };
33
+ /** RSP declared in a profile's `extra` JSON: {"rsp":{"protocol":"rsp/2","nodeUrl":"https://…"}}. */
34
+ export function rspProtocolFromExtra(extra) {
35
+ if (typeof extra !== "string" || extra.length > 1024)
36
+ return "";
37
+ try {
38
+ const rsp = JSON.parse(extra)?.rsp;
39
+ if (typeof rsp?.protocol === "string" && /^rsp\/[1-9]\d{0,3}$/i.test(rsp.protocol) && httpUrl(rsp.nodeUrl)) {
40
+ return rsp.protocol.toLowerCase();
41
+ }
42
+ }
43
+ catch { /* no RSP declaration */ }
44
+ return "";
45
+ }
16
46
  /** A punk id as the store or a backend may carry it: a finite non-negative
17
47
  * number. Punk 0 is a real CryptoPunk; a string or a negative is not one. */
18
48
  export function punkIdOf(v) {
@@ -39,6 +69,16 @@ export function parseFriendStore(raw) {
39
69
  punkId: punkIdOf(r.punkId),
40
70
  platform: typeof r.platform === "string" ? r.platform : undefined,
41
71
  appVersion: typeof r.appVersion === "string" ? r.appVersion : undefined,
72
+ osVersion: str(r.osVersion, 64),
73
+ description: str(r.description, 512),
74
+ profileUrl: httpUrl(r.url),
75
+ ens: typeof r.ens === "string" && /^[a-z0-9-]+(\.[a-z0-9-]+)*\.eth$/i.test(r.ens.trim()) ? r.ens.trim().toLowerCase() : undefined,
76
+ avatarUrl: httpUrl(r.avatarUrl),
77
+ // A profile arrived when any of its fields did (protoVersion is set by
78
+ // every client that pushes one).
79
+ rspProtocol: (typeof r.extra === "string" || typeof r.protoVersion === "number" || typeof r.platform === "string")
80
+ ? rspProtocolFromExtra(r.extra) : undefined,
81
+ sessionAt: typeof r.sessionAt === "number" ? r.sessionAt : undefined,
42
82
  });
43
83
  }
44
84
  return map;
package/dist/server.js CHANGED
@@ -2250,6 +2250,16 @@ export function startBeagleServer(opts) {
2250
2250
  // The client they advertised with their profile, for the UI.
2251
2251
  platform: f.platform ?? stamp?.platform ?? null,
2252
2252
  appVersion: f.appVersion ?? stamp?.appVersion ?? null,
2253
+ // The rest of their pushed profile, for the friend card (what the
2254
+ // phone apps show). From the SDK's store: the daemon's
2255
+ // friends-list does not carry these.
2256
+ osVersion: f.osVersion ?? stamp?.osVersion ?? null,
2257
+ description: f.description || f.descr || stamp?.description || null,
2258
+ profileUrl: stamp?.profileUrl ?? null,
2259
+ ensClaim: stamp?.ens ?? null,
2260
+ pushedAvatarUrl: stamp?.avatarUrl ?? null,
2261
+ rspProtocol: stamp?.rspProtocol ?? null,
2262
+ lastSessionAt: stamp?.sessionAt ?? null,
2253
2263
  };
2254
2264
  });
2255
2265
  const pend = pending.ok ? (pending.data?.pending ?? []) : [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decentnetwork/beagle",
3
- "version": "0.1.151",
3
+ "version": "0.1.153",
4
4
  "description": "Beagle — P2P chat, file transfer and calls for regular users, on the Decent Network. No admin privilege required.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -26,7 +26,7 @@
26
26
  "start": "node dist/cli.js"
27
27
  },
28
28
  "dependencies": {
29
- "@decentnetwork/beagle-ui": "^0.2.53",
29
+ "@decentnetwork/beagle-ui": "^0.2.55",
30
30
  "@decentnetwork/chat-components": "^0.1.3",
31
31
  "@decentnetwork/lan": "^0.1.316",
32
32
  "@decentnetwork/peer": "^0.1.178",