@net-mesh/browser 0.38.2 → 0.39.0

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.
@@ -90,6 +90,8 @@ export declare class MeshSession {
90
90
  * iteration a page is already written to handle.
91
91
  */
92
92
  private readonly streams;
93
+ /** One attempt per peer at a time: see {@link PeerAttempts}. */
94
+ private readonly attempts;
93
95
  /**
94
96
  * The generation the streams in that set were opened under.
95
97
  *
@@ -218,6 +220,14 @@ export declare class MeshSession {
218
220
  * nothing is offered — a second offer would replace the working link
219
221
  * and close it under the peer. A leader too old to answer that reading
220
222
  * is asked for an offer, as before.
223
+ *
224
+ * **And on a pair still connecting**, as `BrowserNode.connectPeer` is:
225
+ * a call while this session's own `connectPeer` or `acceptPeer` for the
226
+ * peer is under way is answered by it rather than by a second offer.
227
+ * The healthy-pair reading runs inside that gate, just before any
228
+ * offer: it is a proxy round trip here, and read ahead of the gate it
229
+ * could be stale by the time the offer went out. See
230
+ * {@link PeerAttempts}.
221
231
  */
222
232
  connectPeer(nodeIdHex: string): Promise<PeerConnectOutcome>;
223
233
  /**
@@ -29,7 +29,7 @@
29
29
  import { fromWasmError, OrgCancelledError, OrgLeaderLostError, } from '../errors.js';
30
30
  import { clientStreamOrgTrampoline, duplexOrgTrampoline, OrgDuplex, OrgHandleRegistry, OrgServe, OrgStream, OrgUpload, streamingOrgTrampoline, toWasmOrgCallOptions, toWasmOrgServeOptions, unaryOrgTrampoline, } from '../org.js';
31
31
  import { buildConnectRequest, parseAttemptStatus, parseCounters, parseDescriptors, } from '../node.js';
32
- import { acceptPeer as driveAccept, connectPeer as driveConnect, } from '../peer-driver.js';
32
+ import { acceptPeer as driveAccept, connectPeer as driveConnect, PeerAttempts, } from '../peer-driver.js';
33
33
  import { LeafStream } from '../stream.js';
34
34
  import { idArg, loadLeafWasm } from '../wasm.js';
35
35
  import { isLifecycleEvent, parseSessionEvent, } from './events.js';
@@ -60,6 +60,8 @@ export class MeshSession {
60
60
  * iteration a page is already written to handle.
61
61
  */
62
62
  streams = new Set();
63
+ /** One attempt per peer at a time: see {@link PeerAttempts}. */
64
+ attempts = new PeerAttempts();
63
65
  /**
64
66
  * The generation the streams in that set were opened under.
65
67
  *
@@ -255,27 +257,33 @@ export class MeshSession {
255
257
  * nothing is offered — a second offer would replace the working link
256
258
  * and close it under the peer. A leader too old to answer that reading
257
259
  * is asked for an offer, as before.
260
+ *
261
+ * **And on a pair still connecting**, as `BrowserNode.connectPeer` is:
262
+ * a call while this session's own `connectPeer` or `acceptPeer` for the
263
+ * peer is under way is answered by it rather than by a second offer.
264
+ * The healthy-pair reading runs inside that gate, just before any
265
+ * offer: it is a proxy round trip here, and read ahead of the gate it
266
+ * could be stale by the time the offer went out. See
267
+ * {@link PeerAttempts}.
258
268
  */
259
269
  async connectPeer(nodeIdHex) {
260
- let settled;
261
- try {
262
- settled = (await this.inner.peer_direct_dialog(nodeIdHex)) ?? undefined;
263
- }
264
- catch {
265
- // A closed session is refused by the offer below, typed; an older
266
- // leader simply has no such reading.
267
- settled = undefined;
268
- }
269
- if (settled !== undefined)
270
- return { type: 'direct', peer: nodeIdHex, dialog: settled };
271
- return driveConnect(nodeIdHex, this.peerPrimitives(), parseAttemptStatus);
270
+ return this.attempts.connect(nodeIdHex, async () => {
271
+ try {
272
+ return (await this.inner.peer_direct_dialog(nodeIdHex)) ?? undefined;
273
+ }
274
+ catch {
275
+ // A closed session is refused by the offer below, typed; an
276
+ // older leader simply has no such reading.
277
+ return undefined;
278
+ }
279
+ }, () => driveConnect(nodeIdHex, this.peerPrimitives(), parseAttemptStatus));
272
280
  }
273
281
  /**
274
282
  * Answer the offer `nodeIdHex` filed — {@link connectPeer}'s
275
283
  * counterpart, on whichever tab holds the lock.
276
284
  */
277
285
  async acceptPeer(nodeIdHex) {
278
- return driveAccept(nodeIdHex, this.peerPrimitives(), parseAttemptStatus);
286
+ return this.attempts.accept(nodeIdHex, () => driveAccept(nodeIdHex, this.peerPrimitives(), parseAttemptStatus));
279
287
  }
280
288
  /**
281
289
  * The proxied primitives, each re-typed by the same mapper every
package/dist/local.js CHANGED
@@ -61,11 +61,16 @@ export function createLocalMesh(options = {}) {
61
61
  const targets = listeners.get(to);
62
62
  if (targets === undefined)
63
63
  throw new Error(`no local node ${to} on this mesh`);
64
+ // Exact decimal, as the real node's `stream_data` carries it. Hex
65
+ // here was wrong in a way that hid itself: a hex id with no letters
66
+ // in it (one random id in ~1,800) reads as a DIFFERENT node's
67
+ // decimal, so the store answered a joiner at an id not on the mesh.
68
+ const peerNode = BigInt(`0x${from}`).toString(10);
64
69
  for (const handler of [...targets]) {
65
70
  // A copy per receiver, as a network would hand each its own
66
71
  // bytes: a receiver that mutates its payload must not change
67
72
  // what another receiver — or the sender — holds.
68
- handler({ type: 'stream_data', streamId, peerNode: from, payload: payload.slice() });
73
+ handler({ type: 'stream_data', streamId, peerNode, payload: payload.slice() });
69
74
  }
70
75
  }
71
76
  function node(requested) {
@@ -72,6 +72,13 @@ export class LeafNode {
72
72
  * a silent retry.
73
73
  */
74
74
  call(service: string, payload: Uint8Array, timeout_ms?: number | null): Promise<Uint8Array>;
75
+ /**
76
+ * One org-scoped client-streaming call. `send` pushes items,
77
+ * `finish` half-closes and resolves the response body. See
78
+ * [`Self::call_org`] for the deadline, suspension and closure
79
+ * contract.
80
+ */
81
+ call_org_client_stream(service: string, opts: any): Promise<OrgUploadCallHandle>;
75
82
  /**
76
83
  * One org-scoped unary call.
77
84
  *
@@ -90,13 +97,6 @@ export class LeafNode {
90
97
  * fail typed.
91
98
  */
92
99
  call_org(service: string, payload: Uint8Array, opts: any): Promise<Uint8Array>;
93
- /**
94
- * One org-scoped client-streaming call. `send` pushes items,
95
- * `finish` half-closes and resolves the response body. See
96
- * [`Self::call_org`] for the deadline, suspension and closure
97
- * contract.
98
- */
99
- call_org_client_stream(service: string, opts: any): Promise<OrgUploadCallHandle>;
100
100
  /**
101
101
  * One org-scoped duplex call. See [`Self::call_org`] for the
102
102
  * deadline, suspension and closure contract.
@@ -521,6 +521,13 @@ export class LeafNode {
521
521
  * zeros.
522
522
  */
523
523
  rtc_stats_json(): string;
524
+ /**
525
+ * Serve one org-scoped client-streaming service:
526
+ * `handler(caller, requests)` resolves the response body. See
527
+ * [`Self::serve_org`] for the handler-drop contract and the
528
+ * close semantics.
529
+ */
530
+ serve_org_client_stream(service: string, access: string, handler: Function, opts: any): OrgServeHandle;
524
531
  /**
525
532
  * Serve one org-scoped unary service: `handler(caller, request)`
526
533
  * resolves the response body.
@@ -541,13 +548,6 @@ export class LeafNode {
541
548
  * openings (C9's protected split).
542
549
  */
543
550
  serve_org(service: string, access: string, handler: Function, opts: any): OrgServeHandle;
544
- /**
545
- * Serve one org-scoped client-streaming service:
546
- * `handler(caller, requests)` resolves the response body. See
547
- * [`Self::serve_org`] for the handler-drop contract and the
548
- * close semantics.
549
- */
550
- serve_org_client_stream(service: string, access: string, handler: Function, opts: any): OrgServeHandle;
551
551
  /**
552
552
  * Serve one org-scoped duplex service:
553
553
  * `handler(caller, requests, sink)` pulls requests and pushes
@@ -786,6 +786,11 @@ export class MeshSession {
786
786
  * Call an nRPC service.
787
787
  */
788
788
  call(service: string, payload: Uint8Array, timeout_ms?: number | null): Promise<Uint8Array>;
789
+ /**
790
+ * One org-scoped client-streaming call through the shared
791
+ * session. See [`Self::call_org`] for the contract.
792
+ */
793
+ call_org_client_stream(service: string, opts: any): Promise<OrgUploadCallHandle>;
789
794
  /**
790
795
  * One org-scoped unary call through the shared session.
791
796
  *
@@ -800,11 +805,6 @@ export class MeshSession {
800
805
  * refuses rather than addressing a successor's call.
801
806
  */
802
807
  call_org(service: string, payload: Uint8Array, opts: any): Promise<Uint8Array>;
803
- /**
804
- * One org-scoped client-streaming call through the shared
805
- * session. See [`Self::call_org`] for the contract.
806
- */
807
- call_org_client_stream(service: string, opts: any): Promise<OrgUploadCallHandle>;
808
808
  /**
809
809
  * One org-scoped duplex call through the shared session. See
810
810
  * [`Self::call_org`] for the contract.
@@ -942,6 +942,12 @@ export class MeshSession {
942
942
  * The lock and channel name.
943
943
  */
944
944
  scope(): string;
945
+ /**
946
+ * Serve one org-scoped client-streaming service through the
947
+ * shared session. See [`Self::serve_org`] for the handler-drop
948
+ * contract and the close semantics.
949
+ */
950
+ serve_org_client_stream(service: string, access: string, handler: Function, opts: any): OrgServeHandle;
945
951
  /**
946
952
  * Serve one org-scoped unary service through the shared
947
953
  * session: `handler(caller, request)` resolves the response
@@ -962,12 +968,6 @@ export class MeshSession {
962
968
  * new openings (C9's protected split).
963
969
  */
964
970
  serve_org(service: string, access: string, handler: Function, opts: any): OrgServeHandle;
965
- /**
966
- * Serve one org-scoped client-streaming service through the
967
- * shared session. See [`Self::serve_org`] for the handler-drop
968
- * contract and the close semantics.
969
- */
970
- serve_org_client_stream(service: string, access: string, handler: Function, opts: any): OrgServeHandle;
971
971
  /**
972
972
  * Serve one org-scoped duplex service through the shared
973
973
  * session. See [`Self::serve_org`] for the handler-drop
@@ -1453,16 +1453,16 @@ export interface InitOutput {
1453
1453
  readonly proxystream_send: (a: number, b: number) => number;
1454
1454
  readonly proxystream_stream_id_hex: (a: number, b: number) => void;
1455
1455
  readonly start: () => void;
1456
- readonly __wasm_bindgen_func_elem_6603: (a: number, b: number, c: number, d: number) => void;
1457
- readonly __wasm_bindgen_func_elem_6605: (a: number, b: number, c: number, d: number) => void;
1458
- readonly __wasm_bindgen_func_elem_2410: (a: number, b: number, c: number) => number;
1459
- readonly __wasm_bindgen_func_elem_2411: (a: number, b: number, c: number) => void;
1460
- readonly __wasm_bindgen_func_elem_2411_112: (a: number, b: number, c: number) => void;
1461
- readonly __wasm_bindgen_func_elem_2411_113: (a: number, b: number, c: number) => void;
1462
- readonly __wasm_bindgen_func_elem_2411_114: (a: number, b: number, c: number) => void;
1463
- readonly __wasm_bindgen_func_elem_2411_115: (a: number, b: number, c: number) => void;
1464
- readonly __wasm_bindgen_func_elem_2411_116: (a: number, b: number, c: number) => void;
1465
- readonly __wasm_bindgen_func_elem_2411_117: (a: number, b: number, c: number) => void;
1456
+ readonly __wasm_bindgen_func_elem_6509: (a: number, b: number, c: number, d: number) => void;
1457
+ readonly __wasm_bindgen_func_elem_6511: (a: number, b: number, c: number, d: number) => void;
1458
+ readonly __wasm_bindgen_func_elem_2365: (a: number, b: number, c: number) => number;
1459
+ readonly __wasm_bindgen_func_elem_2366: (a: number, b: number, c: number) => void;
1460
+ readonly __wasm_bindgen_func_elem_2366_112: (a: number, b: number, c: number) => void;
1461
+ readonly __wasm_bindgen_func_elem_2366_113: (a: number, b: number, c: number) => void;
1462
+ readonly __wasm_bindgen_func_elem_2366_114: (a: number, b: number, c: number) => void;
1463
+ readonly __wasm_bindgen_func_elem_2366_115: (a: number, b: number, c: number) => void;
1464
+ readonly __wasm_bindgen_func_elem_2366_116: (a: number, b: number, c: number) => void;
1465
+ readonly __wasm_bindgen_func_elem_2366_117: (a: number, b: number, c: number) => void;
1466
1466
  readonly __wbindgen_export: (a: number, b: number) => number;
1467
1467
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
1468
1468
  readonly __wbindgen_export3: (a: number) => void;
package/dist/net_leaf.js CHANGED
@@ -146,6 +146,21 @@ export class LeafNode {
146
146
  const ret = wasm.leafnode_call(this.__wbg_ptr, ptr0, len0, addHeapObject(payload), !isLikeNone(timeout_ms), isLikeNone(timeout_ms) ? 0 : timeout_ms);
147
147
  return takeObject(ret);
148
148
  }
149
+ /**
150
+ * One org-scoped client-streaming call. `send` pushes items,
151
+ * `finish` half-closes and resolves the response body. See
152
+ * [`Self::call_org`] for the deadline, suspension and closure
153
+ * contract.
154
+ * @param {string} service
155
+ * @param {any} opts
156
+ * @returns {Promise<OrgUploadCallHandle>}
157
+ */
158
+ call_org_client_stream(service, opts) {
159
+ const ptr0 = passStringToWasm0(service, wasm.__wbindgen_export, wasm.__wbindgen_export2);
160
+ const len0 = WASM_VECTOR_LEN;
161
+ const ret = wasm.leafnode_call_org_client_stream(this.__wbg_ptr, ptr0, len0, addHeapObject(opts));
162
+ return takeObject(ret);
163
+ }
149
164
  /**
150
165
  * One org-scoped unary call.
151
166
  *
@@ -173,21 +188,6 @@ export class LeafNode {
173
188
  const ret = wasm.leafnode_call_org(this.__wbg_ptr, ptr0, len0, addHeapObject(payload), addHeapObject(opts));
174
189
  return takeObject(ret);
175
190
  }
176
- /**
177
- * One org-scoped client-streaming call. `send` pushes items,
178
- * `finish` half-closes and resolves the response body. See
179
- * [`Self::call_org`] for the deadline, suspension and closure
180
- * contract.
181
- * @param {string} service
182
- * @param {any} opts
183
- * @returns {Promise<OrgUploadCallHandle>}
184
- */
185
- call_org_client_stream(service, opts) {
186
- const ptr0 = passStringToWasm0(service, wasm.__wbindgen_export, wasm.__wbindgen_export2);
187
- const len0 = WASM_VECTOR_LEN;
188
- const ret = wasm.leafnode_call_org_client_stream(this.__wbg_ptr, ptr0, len0, addHeapObject(opts));
189
- return takeObject(ret);
190
- }
191
191
  /**
192
192
  * One org-scoped duplex call. See [`Self::call_org`] for the
193
193
  * deadline, suspension and closure contract.
@@ -915,37 +915,24 @@ export class LeafNode {
915
915
  }
916
916
  }
917
917
  /**
918
- * Serve one org-scoped unary service: `handler(caller, request)`
919
- * resolves the response body.
920
- *
921
- * # The handler-drop contract (F-S3.1-2)
922
- *
923
- * The retire supervisor may drop the handler future without a
924
- * final poll — cancellation is observed through the retirement
925
- * observables (the terminal item, the sink's typed closed
926
- * refusal, and `retired`), never assumed as a handler-side
927
- * event; a detached observer holding `retired` observes the
928
- * signal. After retirement the handler sees typed refusals and
929
- * its return value is discarded — the terminal was already
930
- * sent.
931
- *
932
- * Closing the returned handle retires this registration's live
933
- * protected calls with their exact terminals and refuses new
934
- * openings (C9's protected split).
918
+ * Serve one org-scoped client-streaming service:
919
+ * `handler(caller, requests)` resolves the response body. See
920
+ * [`Self::serve_org`] for the handler-drop contract and the
921
+ * close semantics.
935
922
  * @param {string} service
936
923
  * @param {string} access
937
924
  * @param {Function} handler
938
925
  * @param {any} opts
939
926
  * @returns {OrgServeHandle}
940
927
  */
941
- serve_org(service, access, handler, opts) {
928
+ serve_org_client_stream(service, access, handler, opts) {
942
929
  try {
943
930
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
944
931
  const ptr0 = passStringToWasm0(service, wasm.__wbindgen_export, wasm.__wbindgen_export2);
945
932
  const len0 = WASM_VECTOR_LEN;
946
933
  const ptr1 = passStringToWasm0(access, wasm.__wbindgen_export, wasm.__wbindgen_export2);
947
934
  const len1 = WASM_VECTOR_LEN;
948
- wasm.leafnode_serve_org(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(handler), addHeapObject(opts));
935
+ wasm.leafnode_serve_org_client_stream(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(handler), addHeapObject(opts));
949
936
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
950
937
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
951
938
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -958,24 +945,37 @@ export class LeafNode {
958
945
  }
959
946
  }
960
947
  /**
961
- * Serve one org-scoped client-streaming service:
962
- * `handler(caller, requests)` resolves the response body. See
963
- * [`Self::serve_org`] for the handler-drop contract and the
964
- * close semantics.
948
+ * Serve one org-scoped unary service: `handler(caller, request)`
949
+ * resolves the response body.
950
+ *
951
+ * # The handler-drop contract (F-S3.1-2)
952
+ *
953
+ * The retire supervisor may drop the handler future without a
954
+ * final poll — cancellation is observed through the retirement
955
+ * observables (the terminal item, the sink's typed closed
956
+ * refusal, and `retired`), never assumed as a handler-side
957
+ * event; a detached observer holding `retired` observes the
958
+ * signal. After retirement the handler sees typed refusals and
959
+ * its return value is discarded — the terminal was already
960
+ * sent.
961
+ *
962
+ * Closing the returned handle retires this registration's live
963
+ * protected calls with their exact terminals and refuses new
964
+ * openings (C9's protected split).
965
965
  * @param {string} service
966
966
  * @param {string} access
967
967
  * @param {Function} handler
968
968
  * @param {any} opts
969
969
  * @returns {OrgServeHandle}
970
970
  */
971
- serve_org_client_stream(service, access, handler, opts) {
971
+ serve_org(service, access, handler, opts) {
972
972
  try {
973
973
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
974
974
  const ptr0 = passStringToWasm0(service, wasm.__wbindgen_export, wasm.__wbindgen_export2);
975
975
  const len0 = WASM_VECTOR_LEN;
976
976
  const ptr1 = passStringToWasm0(access, wasm.__wbindgen_export, wasm.__wbindgen_export2);
977
977
  const len1 = WASM_VECTOR_LEN;
978
- wasm.leafnode_serve_org_client_stream(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(handler), addHeapObject(opts));
978
+ wasm.leafnode_serve_org(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(handler), addHeapObject(opts));
979
979
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
980
980
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
981
981
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1434,6 +1434,19 @@ export class MeshSession {
1434
1434
  const ret = wasm.meshsession_call(this.__wbg_ptr, ptr0, len0, addHeapObject(payload), !isLikeNone(timeout_ms), isLikeNone(timeout_ms) ? 0 : timeout_ms);
1435
1435
  return takeObject(ret);
1436
1436
  }
1437
+ /**
1438
+ * One org-scoped client-streaming call through the shared
1439
+ * session. See [`Self::call_org`] for the contract.
1440
+ * @param {string} service
1441
+ * @param {any} opts
1442
+ * @returns {Promise<OrgUploadCallHandle>}
1443
+ */
1444
+ call_org_client_stream(service, opts) {
1445
+ const ptr0 = passStringToWasm0(service, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1446
+ const len0 = WASM_VECTOR_LEN;
1447
+ const ret = wasm.meshsession_call_org_client_stream(this.__wbg_ptr, ptr0, len0, addHeapObject(opts));
1448
+ return takeObject(ret);
1449
+ }
1437
1450
  /**
1438
1451
  * One org-scoped unary call through the shared session.
1439
1452
  *
@@ -1457,19 +1470,6 @@ export class MeshSession {
1457
1470
  const ret = wasm.meshsession_call_org(this.__wbg_ptr, ptr0, len0, addHeapObject(payload), addHeapObject(opts));
1458
1471
  return takeObject(ret);
1459
1472
  }
1460
- /**
1461
- * One org-scoped client-streaming call through the shared
1462
- * session. See [`Self::call_org`] for the contract.
1463
- * @param {string} service
1464
- * @param {any} opts
1465
- * @returns {Promise<OrgUploadCallHandle>}
1466
- */
1467
- call_org_client_stream(service, opts) {
1468
- const ptr0 = passStringToWasm0(service, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1469
- const len0 = WASM_VECTOR_LEN;
1470
- const ret = wasm.meshsession_call_org_client_stream(this.__wbg_ptr, ptr0, len0, addHeapObject(opts));
1471
- return takeObject(ret);
1472
- }
1473
1473
  /**
1474
1474
  * One org-scoped duplex call through the shared session. See
1475
1475
  * [`Self::call_org`] for the contract.
@@ -1799,37 +1799,23 @@ export class MeshSession {
1799
1799
  }
1800
1800
  }
1801
1801
  /**
1802
- * Serve one org-scoped unary service through the shared
1803
- * session: `handler(caller, request)` resolves the response
1804
- * body. The registration rides the proxy registry and its
1805
- * inbound calls dispatch to THIS follower's handle and no other.
1806
- *
1807
- * # The handler-drop contract (F-S3.1-2)
1808
- *
1809
- * The retire supervisor may drop the handler future without a
1810
- * final poll — cancellation is observed through the retirement
1811
- * observables (the terminal item, the sink's typed closed
1812
- * refusal, and `retired`), never assumed as a handler-side
1813
- * event; a detached observer holding `retired` observes the
1814
- * signal. After retirement the handler sees typed refusals and
1815
- * its return value is discarded — the terminal was already
1816
- * sent. Closing the returned handle retires this registration's
1817
- * live protected calls with their exact terminals and refuses
1818
- * new openings (C9's protected split).
1802
+ * Serve one org-scoped client-streaming service through the
1803
+ * shared session. See [`Self::serve_org`] for the handler-drop
1804
+ * contract and the close semantics.
1819
1805
  * @param {string} service
1820
1806
  * @param {string} access
1821
1807
  * @param {Function} handler
1822
1808
  * @param {any} opts
1823
1809
  * @returns {OrgServeHandle}
1824
1810
  */
1825
- serve_org(service, access, handler, opts) {
1811
+ serve_org_client_stream(service, access, handler, opts) {
1826
1812
  try {
1827
1813
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1828
1814
  const ptr0 = passStringToWasm0(service, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1829
1815
  const len0 = WASM_VECTOR_LEN;
1830
1816
  const ptr1 = passStringToWasm0(access, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1831
1817
  const len1 = WASM_VECTOR_LEN;
1832
- wasm.meshsession_serve_org(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(handler), addHeapObject(opts));
1818
+ wasm.meshsession_serve_org_client_stream(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(handler), addHeapObject(opts));
1833
1819
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1834
1820
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1835
1821
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1842,23 +1828,37 @@ export class MeshSession {
1842
1828
  }
1843
1829
  }
1844
1830
  /**
1845
- * Serve one org-scoped client-streaming service through the
1846
- * shared session. See [`Self::serve_org`] for the handler-drop
1847
- * contract and the close semantics.
1831
+ * Serve one org-scoped unary service through the shared
1832
+ * session: `handler(caller, request)` resolves the response
1833
+ * body. The registration rides the proxy registry and its
1834
+ * inbound calls dispatch to THIS follower's handle and no other.
1835
+ *
1836
+ * # The handler-drop contract (F-S3.1-2)
1837
+ *
1838
+ * The retire supervisor may drop the handler future without a
1839
+ * final poll — cancellation is observed through the retirement
1840
+ * observables (the terminal item, the sink's typed closed
1841
+ * refusal, and `retired`), never assumed as a handler-side
1842
+ * event; a detached observer holding `retired` observes the
1843
+ * signal. After retirement the handler sees typed refusals and
1844
+ * its return value is discarded — the terminal was already
1845
+ * sent. Closing the returned handle retires this registration's
1846
+ * live protected calls with their exact terminals and refuses
1847
+ * new openings (C9's protected split).
1848
1848
  * @param {string} service
1849
1849
  * @param {string} access
1850
1850
  * @param {Function} handler
1851
1851
  * @param {any} opts
1852
1852
  * @returns {OrgServeHandle}
1853
1853
  */
1854
- serve_org_client_stream(service, access, handler, opts) {
1854
+ serve_org(service, access, handler, opts) {
1855
1855
  try {
1856
1856
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1857
1857
  const ptr0 = passStringToWasm0(service, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1858
1858
  const len0 = WASM_VECTOR_LEN;
1859
1859
  const ptr1 = passStringToWasm0(access, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1860
1860
  const len1 = WASM_VECTOR_LEN;
1861
- wasm.meshsession_serve_org_client_stream(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(handler), addHeapObject(opts));
1861
+ wasm.meshsession_serve_org(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(handler), addHeapObject(opts));
1862
1862
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1863
1863
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1864
1864
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -2718,13 +2718,13 @@ function __wbg_get_imports() {
2718
2718
  const ret = getObject(arg0).error;
2719
2719
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
2720
2720
  },
2721
+ __wbg_error_68609ef5ca157ced: function(arg0, arg1) {
2722
+ console.error(getStringFromWasm0(arg0, arg1));
2723
+ },
2721
2724
  __wbg_error_6a23b57453026a47: function() { return handleError(function (arg0) {
2722
2725
  const ret = getObject(arg0).error;
2723
2726
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
2724
2727
  }, arguments); },
2725
- __wbg_error_6ac7db6e17cac0a2: function(arg0, arg1) {
2726
- console.error(getStringFromWasm0(arg0, arg1));
2727
- },
2728
2728
  __wbg_fetch_4178962c570137ca: function(arg0, arg1, arg2) {
2729
2729
  const ret = getObject(arg0).fetch(getStringFromWasm0(arg1, arg2));
2730
2730
  return addHeapObject(ret);
@@ -2914,7 +2914,7 @@ function __wbg_get_imports() {
2914
2914
  const a = state0.a;
2915
2915
  state0.a = 0;
2916
2916
  try {
2917
- return __wasm_bindgen_func_elem_6605(a, state0.b, arg0, arg1);
2917
+ return __wasm_bindgen_func_elem_6511(a, state0.b, arg0, arg1);
2918
2918
  } finally {
2919
2919
  state0.a = a;
2920
2920
  }
@@ -2956,7 +2956,7 @@ function __wbg_get_imports() {
2956
2956
  const a = state0.a;
2957
2957
  state0.a = 0;
2958
2958
  try {
2959
- return __wasm_bindgen_func_elem_6605(a, state0.b, arg0, arg1);
2959
+ return __wasm_bindgen_func_elem_6511(a, state0.b, arg0, arg1);
2960
2960
  } finally {
2961
2961
  state0.a = a;
2962
2962
  }
@@ -3266,47 +3266,47 @@ function __wbg_get_imports() {
3266
3266
  },
3267
3267
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
3268
3268
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 34, ret: Externref, inner_ret: Some(Externref) }, mutable: true }) -> Externref`.
3269
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_2410);
3269
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_2365);
3270
3270
  return addHeapObject(ret);
3271
3271
  },
3272
3272
  __wbindgen_generic_0000000000000002: function(arg0, arg1) {
3273
3273
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 35, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3274
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_2411);
3274
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_2366);
3275
3275
  return addHeapObject(ret);
3276
3276
  },
3277
3277
  __wbindgen_generic_0000000000000003: function(arg0, arg1) {
3278
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 906, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3279
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_6603);
3278
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 867, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3279
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_6509);
3280
3280
  return addHeapObject(ret);
3281
3281
  },
3282
3282
  __wbindgen_generic_0000000000000004: function(arg0, arg1) {
3283
3283
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 35, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3284
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_2411_112);
3284
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_2366_112);
3285
3285
  return addHeapObject(ret);
3286
3286
  },
3287
3287
  __wbindgen_generic_0000000000000005: function(arg0, arg1) {
3288
3288
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 35, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3289
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_2411_113);
3289
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_2366_113);
3290
3290
  return addHeapObject(ret);
3291
3291
  },
3292
3292
  __wbindgen_generic_0000000000000006: function(arg0, arg1) {
3293
3293
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 35, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3294
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_2411_114);
3294
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_2366_114);
3295
3295
  return addHeapObject(ret);
3296
3296
  },
3297
3297
  __wbindgen_generic_0000000000000007: function(arg0, arg1) {
3298
3298
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("RTCDataChannelEvent")], shim_idx: 35, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3299
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_2411_115);
3299
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_2366_115);
3300
3300
  return addHeapObject(ret);
3301
3301
  },
3302
3302
  __wbindgen_generic_0000000000000008: function(arg0, arg1) {
3303
3303
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("RTCPeerConnectionIceErrorEvent")], shim_idx: 35, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3304
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_2411_116);
3304
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_2366_116);
3305
3305
  return addHeapObject(ret);
3306
3306
  },
3307
3307
  __wbindgen_generic_0000000000000009: function(arg0, arg1) {
3308
3308
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("RTCPeerConnectionIceEvent")], shim_idx: 35, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3309
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_2411_117);
3309
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_2366_117);
3310
3310
  return addHeapObject(ret);
3311
3311
  },
3312
3312
  __wbindgen_generic_000000000000000a: function(arg0) {
@@ -3333,47 +3333,47 @@ function __wbg_get_imports() {
3333
3333
  };
3334
3334
  }
3335
3335
 
3336
- function __wasm_bindgen_func_elem_2411(arg0, arg1, arg2) {
3337
- wasm.__wasm_bindgen_func_elem_2411(arg0, arg1, addHeapObject(arg2));
3336
+ function __wasm_bindgen_func_elem_2366(arg0, arg1, arg2) {
3337
+ wasm.__wasm_bindgen_func_elem_2366(arg0, arg1, addHeapObject(arg2));
3338
3338
  }
3339
3339
 
3340
- function __wasm_bindgen_func_elem_2411_112(arg0, arg1, arg2) {
3341
- wasm.__wasm_bindgen_func_elem_2411_112(arg0, arg1, addHeapObject(arg2));
3340
+ function __wasm_bindgen_func_elem_2366_112(arg0, arg1, arg2) {
3341
+ wasm.__wasm_bindgen_func_elem_2366_112(arg0, arg1, addHeapObject(arg2));
3342
3342
  }
3343
3343
 
3344
- function __wasm_bindgen_func_elem_2411_113(arg0, arg1, arg2) {
3345
- wasm.__wasm_bindgen_func_elem_2411_113(arg0, arg1, addHeapObject(arg2));
3344
+ function __wasm_bindgen_func_elem_2366_113(arg0, arg1, arg2) {
3345
+ wasm.__wasm_bindgen_func_elem_2366_113(arg0, arg1, addHeapObject(arg2));
3346
3346
  }
3347
3347
 
3348
- function __wasm_bindgen_func_elem_2411_114(arg0, arg1, arg2) {
3349
- wasm.__wasm_bindgen_func_elem_2411_114(arg0, arg1, addHeapObject(arg2));
3348
+ function __wasm_bindgen_func_elem_2366_114(arg0, arg1, arg2) {
3349
+ wasm.__wasm_bindgen_func_elem_2366_114(arg0, arg1, addHeapObject(arg2));
3350
3350
  }
3351
3351
 
3352
- function __wasm_bindgen_func_elem_2411_115(arg0, arg1, arg2) {
3353
- wasm.__wasm_bindgen_func_elem_2411_115(arg0, arg1, addHeapObject(arg2));
3352
+ function __wasm_bindgen_func_elem_2366_115(arg0, arg1, arg2) {
3353
+ wasm.__wasm_bindgen_func_elem_2366_115(arg0, arg1, addHeapObject(arg2));
3354
3354
  }
3355
3355
 
3356
- function __wasm_bindgen_func_elem_2411_116(arg0, arg1, arg2) {
3357
- wasm.__wasm_bindgen_func_elem_2411_116(arg0, arg1, addHeapObject(arg2));
3356
+ function __wasm_bindgen_func_elem_2366_116(arg0, arg1, arg2) {
3357
+ wasm.__wasm_bindgen_func_elem_2366_116(arg0, arg1, addHeapObject(arg2));
3358
3358
  }
3359
3359
 
3360
- function __wasm_bindgen_func_elem_2411_117(arg0, arg1, arg2) {
3361
- wasm.__wasm_bindgen_func_elem_2411_117(arg0, arg1, addHeapObject(arg2));
3360
+ function __wasm_bindgen_func_elem_2366_117(arg0, arg1, arg2) {
3361
+ wasm.__wasm_bindgen_func_elem_2366_117(arg0, arg1, addHeapObject(arg2));
3362
3362
  }
3363
3363
 
3364
- function __wasm_bindgen_func_elem_2410(arg0, arg1, arg2) {
3365
- const ret = wasm.__wasm_bindgen_func_elem_2410(arg0, arg1, addHeapObject(arg2));
3364
+ function __wasm_bindgen_func_elem_2365(arg0, arg1, arg2) {
3365
+ const ret = wasm.__wasm_bindgen_func_elem_2365(arg0, arg1, addHeapObject(arg2));
3366
3366
  return takeObject(ret);
3367
3367
  }
3368
3368
 
3369
- function __wasm_bindgen_func_elem_6605(arg0, arg1, arg2, arg3) {
3370
- wasm.__wasm_bindgen_func_elem_6605(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
3369
+ function __wasm_bindgen_func_elem_6511(arg0, arg1, arg2, arg3) {
3370
+ wasm.__wasm_bindgen_func_elem_6511(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
3371
3371
  }
3372
3372
 
3373
- function __wasm_bindgen_func_elem_6603(arg0, arg1, arg2) {
3373
+ function __wasm_bindgen_func_elem_6509(arg0, arg1, arg2) {
3374
3374
  try {
3375
3375
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3376
- wasm.__wasm_bindgen_func_elem_6603(retptr, arg0, arg1, addHeapObject(arg2));
3376
+ wasm.__wasm_bindgen_func_elem_6509(retptr, arg0, arg1, addHeapObject(arg2));
3377
3377
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3378
3378
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3379
3379
  if (r1) {
Binary file