@kumiai/rpc 0.12.1 → 0.12.3

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/lib/app-lane.js CHANGED
@@ -277,12 +277,16 @@ function frameID(topicID, bytes) {
277
277
  const restored = pendingRecords.find((record)=>record.frame.protocol === name && record.frame.topicID === topicID && record.frame.position === position);
278
278
  takeAppFrame(frames, {
279
279
  position,
280
- sealed: restored == null ? {
281
- state: 'sealed',
282
- bytes: message.payload
283
- } : {
280
+ // This member's own frame, read back from the log: MLS cannot open what its own
281
+ // sender ratchet sealed, and the drain would drop it as its own echo anyway.
282
+ sealed: restored != null ? {
284
283
  state: 'pending',
285
284
  id: restored.frame.id
285
+ } : normalizeDID(message.senderDID) === localDID ? {
286
+ state: 'done'
287
+ } : {
288
+ state: 'sealed',
289
+ bytes: message.payload
286
290
  }
287
291
  }, crypto.pending != null);
288
292
  after = position;
package/lib/peer-epoch.js CHANGED
@@ -3,6 +3,7 @@ import { BroadcastClient, createBroadcastResponder, createBroadcastTransport, en
3
3
  import { decodeAppAAD, encodeAppAAD } from './app-aad.js';
4
4
  import { isFrameAhead } from './crypto.js';
5
5
  import { createDirectedClient, createInboxAcceptor, createInboxPath, createUnroutedTagResponder } from './directed.js';
6
+ import { PeerDisposedError } from './errors.js';
6
7
  import { assertFrameFits } from './frame-size.js';
7
8
  import { adaptBusHandlers } from './handlers.js';
8
9
  import { wrapGatherOptions } from './host-boundary.js';
@@ -233,6 +234,7 @@ import { inboxTopic, protocolTopic } from './topic.js';
233
234
  };
234
235
  /** Wait while an advance can move the handle before its new anchor is captured. */ const sealForSegment = async (name, bytes, intent = 'ephemeral')=>{
235
236
  while(true){
237
+ if (isDisposed()) throw new PeerDisposedError('Peer is disposed');
236
238
  const refused = sealError();
237
239
  if (refused != null) throw refused;
238
240
  const barrier = sealBarrier();
@@ -248,6 +250,7 @@ import { inboxTopic, protocolTopic } from './topic.js';
248
250
  intent
249
251
  })
250
252
  });
253
+ if (isDisposed()) throw new PeerDisposedError('Peer is disposed');
251
254
  const refusedAfter = sealError();
252
255
  if (refusedAfter != null) throw refusedAfter;
253
256
  if (anchor() === at && sealBarrier() == null) {
package/lib/peer.js CHANGED
@@ -2702,6 +2702,9 @@ export function createGroupPeer(input) {
2702
2702
  dispose: ()=>{
2703
2703
  if (disposePromise != null) return disposePromise;
2704
2704
  disposed = true;
2705
+ // Rotation can no longer release sealing writes that transport teardown must drain.
2706
+ sealError = new PeerDisposedError('Peer is disposed');
2707
+ finishSealBarrier();
2705
2708
  appOutboxAcceptance?.close();
2706
2709
  logDelivery?.close();
2707
2710
  clearRecoveryRetry();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumiai/rpc",
3
- "version": "0.12.1",
3
+ "version": "0.12.3",
4
4
  "description": "High-level MLS-aware group RPC for Enkaku: bus broadcast/anycast/gather plus directed RPC over the pub/sub hub",
5
5
  "keywords": [
6
6
  "rpc",
@@ -33,7 +33,7 @@
33
33
  "@kokuin/token": "^0.6.4",
34
34
  "@kumiai/broadcast": "^0.12.0",
35
35
  "@kumiai/hub-protocol": "^0.12.0",
36
- "@kumiai/hub-tunnel": "^0.12.0",
36
+ "@kumiai/hub-tunnel": "^0.12.1",
37
37
  "@noble/hashes": "^2.4.0",
38
38
  "@sozai/codec": "^0.4.3",
39
39
  "@sozai/event": "^0.1.6",