@decentnetwork/beagle 0.1.10 → 0.1.12

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.10";
1
+ window.__DK_UI_VERSION="0.1.12";
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"/>',
@@ -3149,14 +3149,19 @@ function useCallController(selfId, onCallLog) {
3149
3149
  alert("Could not start call: " + (e && e.message || e));
3150
3150
  });
3151
3151
  }, [waitEngine]);
3152
+ const incomingRef = React.useRef(null);
3153
+ React.useEffect(() => {
3154
+ incomingRef.current = incoming;
3155
+ }, [incoming]);
3156
+ const activeRef = React.useRef(null);
3157
+ React.useEffect(() => {
3158
+ activeRef.current = active;
3159
+ }, [active]);
3152
3160
  const accept = React.useCallback(() => {
3153
- let pending = null;
3154
- setIncoming((inc) => {
3155
- pending = inc;
3156
- return null;
3157
- });
3161
+ const pending = incomingRef.current;
3158
3162
  if (!pending)
3159
3163
  return;
3164
+ setIncoming(null);
3160
3165
  setActive({ callId: pending.callId, peerId: pending.peerId, video: pending.video, direction: "incoming", state: "connecting" });
3161
3166
  waitEngine().then((eng) => {
3162
3167
  if (!eng)
@@ -3166,19 +3171,17 @@ function useCallController(selfId, onCallLog) {
3166
3171
  }, [waitEngine]);
3167
3172
  const reject = React.useCallback(() => {
3168
3173
  const eng = engineRef.current;
3169
- setIncoming((inc) => {
3170
- if (eng && inc)
3171
- eng.reject(inc.callId);
3172
- return null;
3173
- });
3174
+ const inc = incomingRef.current;
3175
+ if (eng && inc)
3176
+ eng.reject(inc.callId);
3177
+ setIncoming(null);
3174
3178
  }, []);
3175
3179
  const hangup = React.useCallback(() => {
3176
3180
  const eng = engineRef.current;
3177
- setActive((a) => {
3178
- if (eng && a && a.callId)
3179
- eng.hangup(a.callId);
3180
- return null;
3181
- });
3181
+ const a = activeRef.current;
3182
+ if (eng && a && a.callId)
3183
+ eng.hangup(a.callId);
3184
+ setActive(null);
3182
3185
  setLocalStream(null);
3183
3186
  setRemoteStream(null);
3184
3187
  }, []);
@@ -303,6 +303,10 @@ var PeerWebRTC = (() => {
303
303
  const answer = await session.pc.createAnswer();
304
304
  await session.pc.setLocalDescription(answer);
305
305
  await __privateMethod(this, _send, send_fn).call(this, session.peerId, { type: "answer", sdp: answer.sdp, callId });
306
+ try {
307
+ await __privateMethod(this, _send, send_fn).call(this, session.peerId, { type: "action", action: "accept", callId });
308
+ } catch {
309
+ }
306
310
  __privateMethod(this, _setState, setState_fn).call(this, session, "connecting");
307
311
  await __privateMethod(this, _flushLocalCandidates, flushLocalCandidates_fn).call(this, session);
308
312
  __privateMethod(this, _log, log_fn).call(this, `accept callId=${callId}`);
@@ -61,7 +61,12 @@ export class EmbeddedHost {
61
61
  * random one and the tab the user was looking at stayed silent
62
62
  * (INBOX 2026-08-05: "能打出去接不进来"). */
63
63
  #callLog = [];
64
- #callSeq = 0;
64
+ /** Seeded with the epoch so a cursor from a PREVIOUS process incarnation is
65
+ * always smaller than any new signal's seq. Seeded at 0, a restart made
66
+ * every open tab deaf: their old cursor (say 27) exceeded the fresh
67
+ * counter, so `seq > since` never matched and calls stopped ringing until
68
+ * a hard refresh. */
69
+ #callSeq = Date.now();
65
70
  #callWaiters = [];
66
71
  /** fileId -> which chat message it belongs to, so progress can patch it. */
67
72
  #activeSends = new Map();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decentnetwork/beagle",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
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",
@@ -28,7 +28,7 @@
28
28
  "@decentnetwork/chat-components": "^0.1.3",
29
29
  "@decentnetwork/lan": "^0.1.256",
30
30
  "@decentnetwork/peer": "^0.1.138",
31
- "@decentnetwork/peer-webrtc": "^0.2.10",
31
+ "@decentnetwork/peer-webrtc": "^0.2.11",
32
32
  "js-yaml": "^4.1.0",
33
33
  "yargs": "^17.7.2"
34
34
  },