@stryke/capnp 0.12.95 → 0.12.97

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.
Files changed (119) hide show
  1. package/bin/capnpc.cjs +418 -316
  2. package/bin/capnpc.d.cts +909 -4
  3. package/bin/capnpc.d.cts.map +1 -1
  4. package/bin/capnpc.d.mts +909 -4
  5. package/bin/capnpc.d.mts.map +1 -1
  6. package/bin/capnpc.mjs +381 -280
  7. package/bin/capnpc.mjs.map +1 -1
  8. package/dist/capnp-es.BHkXHvyK-B3-d8RNu.d.mts +2991 -0
  9. package/dist/capnp-es.BHkXHvyK-B3-d8RNu.d.mts.map +1 -0
  10. package/dist/capnp-es.BHkXHvyK-CQWXOqvU.d.cts +2991 -0
  11. package/dist/capnp-es.BHkXHvyK-CQWXOqvU.d.cts.map +1 -0
  12. package/dist/{capnp-es.GpvEvMIK-C4q8I6qy.mjs → capnp-es.GpvEvMIK-CH8kq1KS.mjs} +13 -6
  13. package/dist/{capnp-es.GpvEvMIK-C4q8I6qy.mjs.map → capnp-es.GpvEvMIK-CH8kq1KS.mjs.map} +1 -1
  14. package/dist/{capnp-es.GpvEvMIK-BcYm5JyH.cjs → capnp-es.GpvEvMIK-CZ5ZimCD.cjs} +12 -5
  15. package/dist/{compile-ySRLGi2G.mjs → compile-D_BOc0dD.mjs} +109 -15
  16. package/dist/compile-D_BOc0dD.mjs.map +1 -0
  17. package/dist/{compile-DgmKft8T.cjs → compile-Yq1zhccM.cjs} +113 -19
  18. package/dist/compile.cjs +2 -2
  19. package/dist/compile.d.cts +38 -3
  20. package/dist/compile.d.cts.map +1 -0
  21. package/dist/compile.d.mts +38 -3
  22. package/dist/compile.d.mts.map +1 -0
  23. package/dist/compile.mjs +1 -2
  24. package/dist/{dist-BlvFBzSi.mjs → dist-DQ7xmzRT.mjs} +385 -16
  25. package/dist/dist-DQ7xmzRT.mjs.map +1 -0
  26. package/dist/{dist-YywzZL3Q.cjs → dist-VMGxvENY.cjs} +381 -12
  27. package/dist/{helpers-B1zJTrkG.mjs → helpers-2TldkyGG.mjs} +149 -149
  28. package/dist/helpers-2TldkyGG.mjs.map +1 -0
  29. package/dist/{helpers-B7aznH9v.cjs → helpers-Dn4nWOb7.cjs} +177 -177
  30. package/dist/helpers.cjs +2 -1
  31. package/dist/helpers.d.cts +1 -2
  32. package/dist/helpers.d.cts.map +1 -1
  33. package/dist/helpers.d.mts +1 -2
  34. package/dist/helpers.d.mts.map +1 -1
  35. package/dist/helpers.mjs +1 -1
  36. package/dist/index-63Za7yNc.d.cts +736 -0
  37. package/dist/index-63Za7yNc.d.cts.map +1 -0
  38. package/dist/index-LYXu6eWz.d.mts +736 -0
  39. package/dist/index-LYXu6eWz.d.mts.map +1 -0
  40. package/dist/index.cjs +5 -5
  41. package/dist/index.d.cts +5 -4
  42. package/dist/index.d.mts +5 -4
  43. package/dist/index.mjs +4 -5
  44. package/dist/rpc-helpers.cjs +4 -3
  45. package/dist/rpc-helpers.d.cts +3 -4
  46. package/dist/rpc-helpers.d.cts.map +1 -1
  47. package/dist/rpc-helpers.d.mts +3 -4
  48. package/dist/rpc-helpers.d.mts.map +1 -1
  49. package/dist/rpc-helpers.mjs +2 -2
  50. package/dist/types-BjCOVfgj.d.cts +1506 -0
  51. package/dist/types-BjCOVfgj.d.cts.map +1 -0
  52. package/dist/types-CVzMn-TI.d.mts +1506 -0
  53. package/dist/types-CVzMn-TI.d.mts.map +1 -0
  54. package/dist/types.cjs +8 -2
  55. package/dist/types.d.cts +1 -1
  56. package/dist/types.d.mts +1 -1
  57. package/dist/types.mjs +7 -2
  58. package/dist/types.mjs.map +1 -0
  59. package/package.json +8 -8
  60. package/schemas/cpp.cjs +1 -0
  61. package/schemas/cpp.d.cts.map +1 -1
  62. package/schemas/cpp.d.mts.map +1 -1
  63. package/schemas/index-BB47pUzp.d.cts +742 -0
  64. package/schemas/index-BB47pUzp.d.cts.map +1 -0
  65. package/schemas/index-DprjZUdT.d.mts +742 -0
  66. package/schemas/index-DprjZUdT.d.mts.map +1 -0
  67. package/schemas/persistent.cjs +2 -1
  68. package/schemas/persistent.d.cts +48 -21
  69. package/schemas/persistent.d.cts.map +1 -1
  70. package/schemas/persistent.d.mts +48 -21
  71. package/schemas/persistent.d.mts.map +1 -1
  72. package/schemas/persistent.mjs +1 -1
  73. package/schemas/persistent.mjs.map +1 -1
  74. package/schemas/rpc-twoparty.cjs +20 -1
  75. package/schemas/rpc-twoparty.d.cts +17 -17
  76. package/schemas/rpc-twoparty.d.cts.map +1 -1
  77. package/schemas/rpc-twoparty.d.mts +17 -17
  78. package/schemas/rpc-twoparty.d.mts.map +1 -1
  79. package/schemas/rpc-twoparty.mjs +19 -1
  80. package/schemas/rpc-twoparty.mjs.map +1 -1
  81. package/schemas/rpc.cjs +371 -1
  82. package/schemas/rpc.d.cts +141 -141
  83. package/schemas/rpc.d.cts.map +1 -1
  84. package/schemas/rpc.d.mts +141 -141
  85. package/schemas/rpc.d.mts.map +1 -1
  86. package/schemas/rpc.mjs +370 -1
  87. package/schemas/rpc.mjs.map +1 -1
  88. package/schemas/schema.cjs +96 -1
  89. package/schemas/schema.d.cts +286 -228
  90. package/schemas/schema.d.cts.map +1 -1
  91. package/schemas/schema.d.mts +286 -228
  92. package/schemas/schema.d.mts.map +1 -1
  93. package/schemas/schema.mjs +95 -1
  94. package/schemas/schema.mjs.map +1 -1
  95. package/schemas/{src-2eLj6yCr.cjs → src-B6FhDNiV.cjs} +19 -12
  96. package/schemas/{src-s2pCu2mc.mjs → src-B97sIXSw.mjs} +19 -13
  97. package/schemas/src-B97sIXSw.mjs.map +1 -0
  98. package/schemas/ts.cjs +1 -0
  99. package/schemas/ts.d.cts.map +1 -1
  100. package/schemas/ts.d.mts.map +1 -1
  101. package/dist/compile-DccxA7WZ.d.cts +0 -40
  102. package/dist/compile-DccxA7WZ.d.cts.map +0 -1
  103. package/dist/compile-UkKIpqrK.d.mts +0 -40
  104. package/dist/compile-UkKIpqrK.d.mts.map +0 -1
  105. package/dist/compile-ySRLGi2G.mjs.map +0 -1
  106. package/dist/dist-BlvFBzSi.mjs.map +0 -1
  107. package/dist/helpers-B1zJTrkG.mjs.map +0 -1
  108. package/dist/types-Cuj2daUE.mjs +0 -8
  109. package/dist/types-Cuj2daUE.mjs.map +0 -1
  110. package/dist/types-D03SjfBL.d.mts +0 -55
  111. package/dist/types-D03SjfBL.d.mts.map +0 -1
  112. package/dist/types-D52qMMoK.d.cts +0 -55
  113. package/dist/types-D52qMMoK.d.cts.map +0 -1
  114. package/dist/types-DHrjS-69.cjs +0 -13
  115. package/schemas/index-BAJMwFip.d.mts +0 -96
  116. package/schemas/index-BAJMwFip.d.mts.map +0 -1
  117. package/schemas/index-b7dam4EA.d.cts +0 -96
  118. package/schemas/index-b7dam4EA.d.cts.map +0 -1
  119. package/schemas/src-s2pCu2mc.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { $t as initData, A as RPC_BAD_TARGET, At as getListElementSize, B as RPC_QUESTION_ID_REUSED, Bt as getStructPointerLength, C as MAX_DEPTH, Cn as setUint64, Ct as getInt8, D as Pointer, Dn as validate, Dt as getList, En as trackPointerAllocation, Et as getInterfacePointer, F as RPC_IMPORT_CLOSED, Ft as getPointerSection, G as RPC_UNKNOWN_EXPORT_ID, Gt as getTargetListLength, H as RPC_RETURN_FOR_UNKNOWN_QUESTION, Ht as getTargetCompositeListSize, I as RPC_METHOD_ERROR, It as getPointerType, J as Text, Jt as getText, K as RPC_ZERO_REF, Kt as getTargetPointerType, L as RPC_METHOD_NOT_IMPLEMENTED, Lt as getSize, M as RPC_ERROR, Mt as getOffsetWords, N as RPC_FINISH_UNKNOWN_ANSWER, Nt as getPointer, O as PointerAllocationResult, Ot as getListByteLength, P as RPC_FULFILL_ALREADY_CALLED, Pt as getPointerAs, Q as checkPointerBounds, Qt as getUint8, R as RPC_NO_MAIN_INTERFACE, Rt as getStruct, S as ListElementSize, Sn as setUint32, St as getInt64, T as ObjectSize, Tn as testWhich, Tt as getInterfaceClientOrNullAt, U as RPC_UNKNOWN_ANSWER_ID, Ut as getTargetCompositeListTag, V as RPC_QUEUE_CALL_CANCEL, Vt as getStructSize, W as RPC_UNKNOWN_CAP_DESCRIPTOR, Wt as getTargetListElementSize, X as adopt, Xt as getUint32, Y as add, Yt as getUint16, Z as checkDataBounds, Zt as getUint64, _ as ErrorAnswer, _n as setInterfacePointer, _t as getFarSegmentId, an as isNull, at as dump, b as INVARIANT_UNREACHABLE_CODE, bn as setText, bt as getInt16, cn as resize, ct as followFar, dn as setFloat32, dt as getAs, en as initList, et as copyFrom, fn as setFloat64, ft as getBit, g as Data, gn as setInt8, gt as getDataSection, h as AnyStruct, hn as setInt64, ht as getData, i as getBitMask, in as isDoubleFar, it as disown, j as RPC_CALL_QUEUE_FULL, jt as getListLength, k as PointerType, kt as getListElementByteLength, ln as setBit, lt as followFars, m as getUint8Mask, mn as setInt32, mt as getContent, nn as initStruct, nt as copyFromList, ot as erase, pn as setInt16, pt as getCapabilityId, q as Struct, qt as getTargetStructSize, r as CompositeList, rn as initStructAt, rt as copyFromStruct, sn as relocateTo, st as erasePointer, t as Message, tn as initPointer, tt as copyFromInterface, un as setFarPointer, ut as format, v as ErrorClient, vn as setListPointer, vt as getFloat32, w as NOT_IMPLEMENTED, wn as setUint8, wt as getInterfaceClientOrNull, x as List, xn as setUint16, xt as getInt32, y as FixedAnswer, yn as setStructPointer, yt as getFloat64, z as RPC_NULL_CLIENT, zt as getStructDataWords } from "./capnp-es.GpvEvMIK-C4q8I6qy.mjs";
1
+ import { $t as initData, A as RPC_BAD_TARGET, At as getListElementSize, B as RPC_QUESTION_ID_REUSED, Bt as getStructPointerLength, C as MAX_DEPTH, Cn as setUint64, Ct as getInt8, D as Pointer, Dn as validate, Dt as getList, En as trackPointerAllocation, Et as getInterfacePointer, F as RPC_IMPORT_CLOSED, Ft as getPointerSection, G as RPC_UNKNOWN_EXPORT_ID, Gt as getTargetListLength, H as RPC_RETURN_FOR_UNKNOWN_QUESTION, Ht as getTargetCompositeListSize, I as RPC_METHOD_ERROR, It as getPointerType, J as Text, Jt as getText, K as RPC_ZERO_REF, Kt as getTargetPointerType, L as RPC_METHOD_NOT_IMPLEMENTED, Lt as getSize, M as RPC_ERROR, Mt as getOffsetWords, N as RPC_FINISH_UNKNOWN_ANSWER, Nt as getPointer, O as PointerAllocationResult, Ot as getListByteLength, P as RPC_FULFILL_ALREADY_CALLED, Pt as getPointerAs, Q as checkPointerBounds, Qt as getUint8, R as RPC_NO_MAIN_INTERFACE, Rt as getStruct, S as ListElementSize, Sn as setUint32, St as getInt64, T as ObjectSize, Tn as testWhich, Tt as getInterfaceClientOrNullAt, U as RPC_UNKNOWN_ANSWER_ID, Ut as getTargetCompositeListTag, V as RPC_QUEUE_CALL_CANCEL, Vt as getStructSize, W as RPC_UNKNOWN_CAP_DESCRIPTOR, Wt as getTargetListElementSize, X as adopt, Xt as getUint32, Y as add, Yt as getUint16, Z as checkDataBounds, Zt as getUint64, _ as ErrorAnswer, _n as setInterfacePointer, _t as getFarSegmentId, an as isNull, at as dump, b as INVARIANT_UNREACHABLE_CODE, bn as setText, bt as getInt16, cn as resize, ct as followFar, dn as setFloat32, dt as getAs, en as initList, et as copyFrom, fn as setFloat64, ft as getBit, g as Data, gn as setInt8, gt as getDataSection, h as AnyStruct, hn as setInt64, ht as getData, i as getBitMask, in as isDoubleFar, it as disown, j as RPC_CALL_QUEUE_FULL, jt as getListLength, k as PointerType, kt as getListElementByteLength, ln as setBit, lt as followFars, m as getUint8Mask, mn as setInt32, mt as getContent, nn as initStruct, nt as copyFromList, ot as erase, pn as setInt16, pt as getCapabilityId, q as Struct, qt as getTargetStructSize, r as CompositeList, rn as initStructAt, rt as copyFromStruct, sn as relocateTo, st as erasePointer, t as Message$1, tn as initPointer, tt as copyFromInterface, un as setFarPointer, ut as format, v as ErrorClient, vn as setListPointer, vt as getFloat32, w as NOT_IMPLEMENTED, wn as setUint8, wt as getInterfaceClientOrNull, x as List, xn as setUint16, xt as getInt32, y as FixedAnswer, yn as setStructPointer, yt as getFloat64, z as RPC_NULL_CLIENT, zt as getStructDataWords } from "./capnp-es.GpvEvMIK-CH8kq1KS.mjs";
2
2
 
3
3
  //#region ../../node_modules/.pnpm/capnp-es@0.0.11_patch_hash=503a440bd2bef41c0cb22819bc4ced5a7f04993fb999f0d944e284220f14916b_typescript@6.0.3/node_modules/capnp-es/dist/shared/capnp-es.UAt3nLGq.mjs
4
4
  var Interface = class extends Pointer {
@@ -58,7 +58,7 @@ function placeParams(call, contentPtr) {
58
58
  let p;
59
59
  if (contentPtr) p = new call.method.ParamsClass(contentPtr.segment, contentPtr.byteOffset, contentPtr._capnp.depthLimit);
60
60
  else {
61
- const msg = new Message();
61
+ const msg = new Message$1();
62
62
  p = new call.method.ParamsClass(msg.getSegment(0), 0);
63
63
  }
64
64
  initStruct(call.method.ParamsClass._capnp.size, p);
@@ -362,7 +362,7 @@ var Server = class {
362
362
  this.methods = methods;
363
363
  }
364
364
  startCall(call) {
365
- const results = new Message().initRoot(call.method.ResultsClass);
365
+ const results = new Message$1().initRoot(call.method.ResultsClass);
366
366
  call.serverMethod.impl.call(this.target, call.params, results).then(() => call.answer.fulfill(results)).catch((error_) => call.answer.reject(error_));
367
367
  }
368
368
  call(call) {
@@ -382,22 +382,100 @@ var Server = class {
382
382
  //#endregion
383
383
  //#region ../../node_modules/.pnpm/capnp-es@0.0.11_patch_hash=503a440bd2bef41c0cb22819bc4ced5a7f04993fb999f0d944e284220f14916b_typescript@6.0.3/node_modules/capnp-es/dist/capnp/rpc.mjs
384
384
  const Message_Which = {
385
+ /**
386
+ * The sender previously received this message from the peer but didn't understand it or doesn't
387
+ * yet implement the functionality that was requested. So, the sender is echoing the message
388
+ * back. In some cases, the receiver may be able to recover from this by pretending the sender
389
+ * had taken some appropriate "null" action.
390
+ *
391
+ * For example, say `resolve` is received by a level 0 implementation (because a previous call
392
+ * or return happened to contain a promise). The level 0 implementation will echo it back as
393
+ * `unimplemented`. The original sender can then simply release the cap to which the promise
394
+ * had resolved, thus avoiding a leak.
395
+ *
396
+ * For any message type that introduces a question, if the message comes back unimplemented,
397
+ * the original sender may simply treat it as if the question failed with an exception.
398
+ *
399
+ * In cases where there is no sensible way to react to an `unimplemented` message (without
400
+ * resource leaks or other serious problems), the connection may need to be aborted. This is
401
+ * a gray area; different implementations may take different approaches.
402
+ *
403
+ */
385
404
  UNIMPLEMENTED: 0,
405
+ /**
406
+ * Sent when a connection is being aborted due to an unrecoverable error. This could be e.g.
407
+ * because the sender received an invalid or nonsensical message or because the sender had an
408
+ * internal error. The sender will shut down the outgoing half of the connection after `abort`
409
+ * and will completely close the connection shortly thereafter (it's up to the sender how much
410
+ * of a time buffer they want to offer for the client to receive the `abort` before the
411
+ * connection is reset).
412
+ *
413
+ */
386
414
  ABORT: 1,
415
+ /**
416
+ * Request the peer's bootstrap interface.
417
+ *
418
+ */
387
419
  BOOTSTRAP: 8,
420
+ /**
421
+ * Begin a method call.
422
+ *
423
+ */
388
424
  CALL: 2,
425
+ /**
426
+ * Complete a method call.
427
+ *
428
+ */
389
429
  RETURN: 3,
430
+ /**
431
+ * Release a returned answer / cancel a call.
432
+ *
433
+ */
390
434
  FINISH: 4,
435
+ /**
436
+ * Resolve a previously-sent promise.
437
+ *
438
+ */
391
439
  RESOLVE: 5,
440
+ /**
441
+ * Release a capability so that the remote object can be deallocated.
442
+ *
443
+ */
392
444
  RELEASE: 6,
445
+ /**
446
+ * Lift an embargo used to enforce E-order over promise resolution.
447
+ *
448
+ */
393
449
  DISEMBARGO: 13,
450
+ /**
451
+ * Obsolete request to save a capability, resulting in a SturdyRef. This has been replaced
452
+ * by the `Persistent` interface defined in `persistent.capnp`. This operation was never
453
+ * implemented.
454
+ *
455
+ */
394
456
  OBSOLETE_SAVE: 7,
457
+ /**
458
+ * Obsolete way to delete a SturdyRef. This operation was never implemented.
459
+ *
460
+ */
395
461
  OBSOLETE_DELETE: 9,
462
+ /**
463
+ * Provide a capability to a third party.
464
+ *
465
+ */
396
466
  PROVIDE: 10,
467
+ /**
468
+ * Accept a capability provided by a third party.
469
+ *
470
+ */
397
471
  ACCEPT: 11,
472
+ /**
473
+ * Directly connect to the common root of two or more proxied caps.
474
+ *
475
+ */
398
476
  JOIN: 12
399
477
  };
400
- var Message$1 = class Message$1 extends Struct {
478
+ var Message = class Message extends Struct {
401
479
  static UNIMPLEMENTED = Message_Which.UNIMPLEMENTED;
402
480
  static ABORT = Message_Which.ABORT;
403
481
  static BOOTSTRAP = Message_Which.BOOTSTRAP;
@@ -445,14 +523,14 @@ var Message$1 = class Message$1 extends Struct {
445
523
  */
446
524
  get unimplemented() {
447
525
  testWhich("unimplemented", getUint16(0, this), 0, this);
448
- return getStruct(0, Message$1, this);
526
+ return getStruct(0, Message, this);
449
527
  }
450
528
  _hasUnimplemented() {
451
529
  return !isNull(getPointer(0, this));
452
530
  }
453
531
  _initUnimplemented() {
454
532
  setUint16(0, 0, this);
455
- return initStructAt(0, Message$1, this);
533
+ return initStructAt(0, Message, this);
456
534
  }
457
535
  get _isUnimplemented() {
458
536
  return getUint16(0, this) === 0;
@@ -957,8 +1035,65 @@ var Bootstrap = class extends Struct {
957
1035
  }
958
1036
  };
959
1037
  const Call_SendResultsTo_Which = {
1038
+ /**
1039
+ * Send the return message back to the caller (the usual).
1040
+ *
1041
+ */
960
1042
  CALLER: 0,
1043
+ /**
1044
+ * **(level 1)**
1045
+ *
1046
+ * Don't actually return the results to the sender. Instead, hold on to them and await
1047
+ * instructions from the sender regarding what to do with them. In particular, the sender
1048
+ * may subsequently send a `Return` for some other call (which the receiver had previously made
1049
+ * to the sender) with `takeFromOtherQuestion` set. The results from this call are then used
1050
+ * as the results of the other call.
1051
+ *
1052
+ * When `yourself` is used, the receiver must still send a `Return` for the call, but sets the
1053
+ * field `resultsSentElsewhere` in that `Return` rather than including the results.
1054
+ *
1055
+ * This feature can be used to implement tail calls in which a call from Vat A to Vat B ends up
1056
+ * returning the result of a call from Vat B back to Vat A.
1057
+ *
1058
+ * In particular, the most common use case for this feature is when Vat A makes a call to a
1059
+ * promise in Vat B, and then that promise ends up resolving to a capability back in Vat A.
1060
+ * Vat B must forward all the queued calls on that promise back to Vat A, but can set `yourself`
1061
+ * in the calls so that the results need not pass back through Vat B.
1062
+ *
1063
+ * For example:
1064
+ * - Alice, in Vat A, calls foo() on Bob in Vat B.
1065
+ * - Alice makes a pipelined call bar() on the promise returned by foo().
1066
+ * - Later on, Bob resolves the promise from foo() to point at Carol, who lives in Vat A (next
1067
+ * to Alice).
1068
+ * - Vat B dutifully forwards the bar() call to Carol. Let us call this forwarded call bar'().
1069
+ * Notice that bar() and bar'() are travelling in opposite directions on the same network
1070
+ * link.
1071
+ * - The `Call` for bar'() has `sendResultsTo` set to `yourself`.
1072
+ * - Vat B sends a `Return` for bar() with `takeFromOtherQuestion` set in place of the results,
1073
+ * with the value set to the question ID of bar'(). Vat B does not wait for bar'() to return,
1074
+ * as doing so would introduce unnecessary round trip latency.
1075
+ * - Vat A receives bar'() and delivers it to Carol.
1076
+ * - When bar'() returns, Vat A sends a `Return` for bar'() to Vat B, with `resultsSentElsewhere`
1077
+ * set in place of results.
1078
+ * - Vat A sends a `Finish` for the bar() call to Vat B.
1079
+ * - Vat B receives the `Finish` for bar() and sends a `Finish` for bar'().
1080
+ *
1081
+ */
961
1082
  YOURSELF: 1,
1083
+ /**
1084
+ * **(level 3)**
1085
+ *
1086
+ * The call's result should be returned to a different vat. The receiver (the callee) expects
1087
+ * to receive an `Accept` message from the indicated vat, and should return the call's result
1088
+ * to it, rather than to the sender of the `Call`.
1089
+ *
1090
+ * This operates much like `yourself`, above, except that Carol is in a separate Vat C. `Call`
1091
+ * messages are sent from Vat A -> Vat B and Vat B -> Vat C. A `Return` message is sent from
1092
+ * Vat B -> Vat A that contains `acceptFromThirdParty` in place of results. When Vat A sends
1093
+ * an `Accept` to Vat C, it receives back a `Return` containing the call's actual result. Vat C
1094
+ * also sends a `Return` to Vat B with `resultsSentElsewhere`.
1095
+ *
1096
+ */
962
1097
  THIRD_PARTY: 2
963
1098
  };
964
1099
  var Call_SendResultsTo = class extends Struct {
@@ -1180,11 +1315,54 @@ var Call = class Call extends Struct {
1180
1315
  }
1181
1316
  };
1182
1317
  const Return_Which = {
1318
+ /**
1319
+ * Equal to the QuestionId of the corresponding `Call` message.
1320
+ *
1321
+ */
1183
1322
  RESULTS: 0,
1323
+ /**
1324
+ * If true, all capabilities that were in the params should be considered released. The sender
1325
+ * must not send separate `Release` messages for them. Level 0 implementations in particular
1326
+ * should always set this true. This defaults true because if level 0 implementations forget to
1327
+ * set it they'll never notice (just silently leak caps), but if level >=1 implementations forget
1328
+ * to set it to false they'll quickly get errors.
1329
+ *
1330
+ * The receiver should act as if the sender had sent a release message with count=1 for each
1331
+ * CapDescriptor in the original Call message.
1332
+ *
1333
+ */
1184
1334
  EXCEPTION: 1,
1335
+ /**
1336
+ * The result.
1337
+ *
1338
+ * For regular method calls, `results.content` points to the result struct.
1339
+ *
1340
+ * For a `Return` in response to an `Accept` or `Bootstrap`, `results` contains a single
1341
+ * capability (rather than a struct), and `results.content` is just a capability pointer with
1342
+ * index 0. A `Finish` is still required in this case.
1343
+ *
1344
+ */
1185
1345
  CANCELED: 2,
1346
+ /**
1347
+ * Indicates that the call failed and explains why.
1348
+ *
1349
+ */
1186
1350
  RESULTS_SENT_ELSEWHERE: 3,
1351
+ /**
1352
+ * Indicates that the call was canceled due to the caller sending a Finish message
1353
+ * before the call had completed.
1354
+ *
1355
+ */
1187
1356
  TAKE_FROM_OTHER_QUESTION: 4,
1357
+ /**
1358
+ * This is set when returning from a `Call` that had `sendResultsTo` set to something other
1359
+ * than `caller`.
1360
+ *
1361
+ * It doesn't matter too much when this is sent, as the receiver doesn't need to do anything
1362
+ * with it, but the C++ implementation appears to wait for the call to finish before sending
1363
+ * this.
1364
+ *
1365
+ */
1188
1366
  ACCEPT_FROM_THIRD_PARTY: 5
1189
1367
  };
1190
1368
  var Return = class Return extends Struct {
@@ -1429,7 +1607,43 @@ var Finish = class Finish extends Struct {
1429
1607
  }
1430
1608
  };
1431
1609
  const Resolve_Which = {
1610
+ /**
1611
+ * The ID of the promise to be resolved.
1612
+ *
1613
+ * Unlike all other instances of `ExportId` sent from the exporter, the `Resolve` message does
1614
+ * _not_ increase the reference count of `promiseId`. In fact, it is expected that the receiver
1615
+ * will release the export soon after receiving `Resolve`, and the sender will not send this
1616
+ * `ExportId` again until it has been released and recycled.
1617
+ *
1618
+ * When an export ID sent over the wire (e.g. in a `CapDescriptor`) is indicated to be a promise,
1619
+ * this indicates that the sender will follow up at some point with a `Resolve` message. If the
1620
+ * same `promiseId` is sent again before `Resolve`, still only one `Resolve` is sent. If the
1621
+ * same ID is sent again later _after_ a `Resolve`, it can only be because the export's
1622
+ * reference count hit zero in the meantime and the ID was re-assigned to a new export, therefore
1623
+ * this later promise does _not_ correspond to the earlier `Resolve`.
1624
+ *
1625
+ * If a promise ID's reference count reaches zero before a `Resolve` is sent, the `Resolve`
1626
+ * message may or may not still be sent (the `Resolve` may have already been in-flight when
1627
+ * `Release` was sent, but if the `Release` is received before `Resolve` then there is no longer
1628
+ * any reason to send a `Resolve`). Thus a `Resolve` may be received for a promise of which
1629
+ * the receiver has no knowledge, because it already released it earlier. In this case, the
1630
+ * receiver should simply release the capability to which the promise resolved.
1631
+ *
1632
+ */
1432
1633
  CAP: 0,
1634
+ /**
1635
+ * The object to which the promise resolved.
1636
+ *
1637
+ * The sender promises that from this point forth, until `promiseId` is released, it shall
1638
+ * simply forward all messages to the capability designated by `cap`. This is true even if
1639
+ * `cap` itself happens to designate another promise, and that other promise later resolves --
1640
+ * messages sent to `promiseId` shall still go to that other promise, not to its resolution.
1641
+ * This is important in the case that the receiver of the `Resolve` ends up sending a
1642
+ * `Disembargo` message towards `promiseId` in order to control message ordering -- that
1643
+ * `Disembargo` really needs to reflect back to exactly the object designated by `cap` even
1644
+ * if that object is itself a promise.
1645
+ *
1646
+ */
1433
1647
  EXCEPTION: 1
1434
1648
  };
1435
1649
  var Resolve = class extends Struct {
@@ -1575,9 +1789,48 @@ var Release = class extends Struct {
1575
1789
  }
1576
1790
  };
1577
1791
  const Disembargo_Context_Which = {
1792
+ /**
1793
+ * The sender is requesting a disembargo on a promise that is known to resolve back to a
1794
+ * capability hosted by the sender. As soon as the receiver has echoed back all pipelined calls
1795
+ * on this promise, it will deliver the Disembargo back to the sender with `receiverLoopback`
1796
+ * set to the same value as `senderLoopback`. This value is chosen by the sender, and since
1797
+ * it is also consumed be the sender, the sender can use whatever strategy it wants to make sure
1798
+ * the value is unambiguous.
1799
+ *
1800
+ * The receiver must verify that the target capability actually resolves back to the sender's
1801
+ * vat. Otherwise, the sender has committed a protocol error and should be disconnected.
1802
+ *
1803
+ */
1578
1804
  SENDER_LOOPBACK: 0,
1805
+ /**
1806
+ * The receiver previously sent a `senderLoopback` Disembargo towards a promise resolving to
1807
+ * this capability, and that Disembargo is now being echoed back.
1808
+ *
1809
+ */
1579
1810
  RECEIVER_LOOPBACK: 1,
1811
+ /**
1812
+ * **(level 3)**
1813
+ *
1814
+ * The sender is requesting a disembargo on a promise that is known to resolve to a third-party
1815
+ * capability that the sender is currently in the process of accepting (using `Accept`).
1816
+ * The receiver of this `Disembargo` has an outstanding `Provide` on said capability. The
1817
+ * receiver should now send a `Disembargo` with `provide` set to the question ID of that
1818
+ * `Provide` message.
1819
+ *
1820
+ * See `Accept.embargo` for an example.
1821
+ *
1822
+ */
1580
1823
  ACCEPT: 2,
1824
+ /**
1825
+ * **(level 3)**
1826
+ *
1827
+ * The sender is requesting a disembargo on a capability currently being provided to a third
1828
+ * party. The question ID identifies the `Provide` message previously sent by the sender to
1829
+ * this capability. On receipt, the receiver (the capability host) shall release the embargo
1830
+ * on the `Accept` message that it has received from the third party. See `Accept.embargo` for
1831
+ * an example.
1832
+ *
1833
+ */
1581
1834
  PROVIDE: 3
1582
1835
  };
1583
1836
  var Disembargo_Context = class extends Struct {
@@ -1924,7 +2177,20 @@ var Join = class extends Struct {
1924
2177
  }
1925
2178
  };
1926
2179
  const MessageTarget_Which = {
2180
+ /**
2181
+ * This message is to a capability or promise previously imported by the caller (exported by
2182
+ * the receiver).
2183
+ *
2184
+ */
1927
2185
  IMPORTED_CAP: 0,
2186
+ /**
2187
+ * This message is to a capability that is expected to be returned by another call that has not
2188
+ * yet been completed.
2189
+ *
2190
+ * At level 0, this is supported only for addressing the result of a previous `Bootstrap`, so
2191
+ * that initial startup doesn't require a round trip.
2192
+ *
2193
+ */
1928
2194
  PROMISED_ANSWER: 1
1929
2195
  };
1930
2196
  var MessageTarget = class extends Struct {
@@ -2045,11 +2311,52 @@ var Payload = class Payload extends Struct {
2045
2311
  }
2046
2312
  };
2047
2313
  const CapDescriptor_Which = {
2314
+ /**
2315
+ * There is no capability here. This `CapDescriptor` should not appear in the payload content.
2316
+ * A `none` CapDescriptor can be generated when an application inserts a capability into a
2317
+ * message and then later changes its mind and removes it -- rewriting all of the other
2318
+ * capability pointers may be hard, so instead a tombstone is left, similar to the way a removed
2319
+ * struct or list instance is zeroed out of the message but the space is not reclaimed.
2320
+ * Hopefully this is unusual.
2321
+ *
2322
+ */
2048
2323
  NONE: 0,
2324
+ /**
2325
+ * The ID of a capability in the sender's export table (receiver's import table). It may be a
2326
+ * newly allocated table entry, or an existing entry (increments the reference count).
2327
+ *
2328
+ */
2049
2329
  SENDER_HOSTED: 1,
2330
+ /**
2331
+ * A promise that the sender will resolve later. The sender will send exactly one Resolve
2332
+ * message at a future point in time to replace this promise. Note that even if the same
2333
+ * `senderPromise` is received multiple times, only one `Resolve` is sent to cover all of
2334
+ * them. If `senderPromise` is released before the `Resolve` is sent, the sender (of this
2335
+ * `CapDescriptor`) may choose not to send the `Resolve` at all.
2336
+ *
2337
+ */
2050
2338
  SENDER_PROMISE: 2,
2339
+ /**
2340
+ * A capability (or promise) previously exported by the receiver (imported by the sender).
2341
+ *
2342
+ */
2051
2343
  RECEIVER_HOSTED: 3,
2344
+ /**
2345
+ * A capability expected to be returned in the results of a currently-outstanding call posed
2346
+ * by the sender.
2347
+ *
2348
+ */
2052
2349
  RECEIVER_ANSWER: 4,
2350
+ /**
2351
+ * **(level 3)**
2352
+ *
2353
+ * A capability that lives in neither the sender's nor the receiver's vat. The sender needs
2354
+ * to form a direct connection to a third party to pick up the capability.
2355
+ *
2356
+ * Level 1 and 2 implementations that receive a `thirdPartyHosted` may simply send calls to its
2357
+ * `vine` instead.
2358
+ *
2359
+ */
2053
2360
  THIRD_PARTY_HOSTED: 5
2054
2361
  };
2055
2362
  var CapDescriptor = class CapDescriptor extends Struct {
@@ -2258,7 +2565,17 @@ var CapDescriptor = class CapDescriptor extends Struct {
2258
2565
  }
2259
2566
  };
2260
2567
  const PromisedAnswer_Op_Which = {
2568
+ /**
2569
+ * Does nothing. This member is mostly defined so that we can make `Op` a union even
2570
+ * though (as of this writing) only one real operation is defined.
2571
+ *
2572
+ */
2261
2573
  NOOP: 0,
2574
+ /**
2575
+ * Get a pointer field within a struct. The number is an index into the pointer section, NOT
2576
+ * a field ordinal, so that the receiver does not need to understand the schema.
2577
+ *
2578
+ */
2262
2579
  GET_POINTER_FIELD: 1
2263
2580
  };
2264
2581
  var PromisedAnswer_Op = class extends Struct {
@@ -2398,9 +2715,61 @@ var ThirdPartyCapDescriptor = class extends Struct {
2398
2715
  }
2399
2716
  };
2400
2717
  const Exception_Type = {
2718
+ /**
2719
+ * A generic problem occurred, and it is believed that if the operation were repeated without
2720
+ * any change in the state of the world, the problem would occur again.
2721
+ *
2722
+ * A client might respond to this error by logging it for investigation by the developer and/or
2723
+ * displaying it to the user.
2724
+ *
2725
+ */
2401
2726
  FAILED: 0,
2727
+ /**
2728
+ * The request was rejected due to a temporary lack of resources.
2729
+ *
2730
+ * Examples include:
2731
+ * - There's not enough CPU time to keep up with incoming requests, so some are rejected.
2732
+ * - The server ran out of RAM or disk space during the request.
2733
+ * - The operation timed out (took significantly longer than it should have).
2734
+ *
2735
+ * A client might respond to this error by scheduling to retry the operation much later. The
2736
+ * client should NOT retry again immediately since this would likely exacerbate the problem.
2737
+ *
2738
+ */
2402
2739
  OVERLOADED: 1,
2740
+ /**
2741
+ * The method failed because a connection to some necessary capability was lost.
2742
+ *
2743
+ * Examples include:
2744
+ * - The client introduced the server to a third-party capability, the connection to that third
2745
+ * party was subsequently lost, and then the client requested that the server use the dead
2746
+ * capability for something.
2747
+ * - The client previously requested that the server obtain a capability from some third party.
2748
+ * The server returned a capability to an object wrapping the third-party capability. Later,
2749
+ * the server's connection to the third party was lost.
2750
+ * - The capability has been revoked. Revocation does not necessarily mean that the client is
2751
+ * no longer authorized to use the capability; it is often used simply as a way to force the
2752
+ * client to repeat the setup process, perhaps to efficiently move them to a new back-end or
2753
+ * get them to recognize some other change that has occurred.
2754
+ *
2755
+ * A client should normally respond to this error by releasing all capabilities it is currently
2756
+ * holding related to the one it called and then re-creating them by restoring SturdyRefs and/or
2757
+ * repeating the method calls used to create them originally. In other words, disconnect and
2758
+ * start over. This should in turn cause the server to obtain a new copy of the capability that
2759
+ * it lost, thus making everything work.
2760
+ *
2761
+ * If the client receives another `disconnected` error in the process of rebuilding the
2762
+ * capability and retrying the call, it should treat this as an `overloaded` error: the network
2763
+ * is currently unreliable, possibly due to load or other temporary issues.
2764
+ *
2765
+ */
2403
2766
  DISCONNECTED: 2,
2767
+ /**
2768
+ * The server doesn't implement the requested method. If there is some other method that the
2769
+ * client could call (perhaps an older and/or slower interface), it should try that instead.
2770
+ * Otherwise, this should be treated like `failed`.
2771
+ *
2772
+ */
2404
2773
  UNIMPLEMENTED: 3
2405
2774
  };
2406
2775
  var Exception = class extends Struct {
@@ -2898,7 +3267,7 @@ function toException(exc, err) {
2898
3267
  exc.type = Exception.Type.FAILED;
2899
3268
  }
2900
3269
  function newMessage() {
2901
- return new Message().initRoot(Message$1);
3270
+ return new Message$1().initRoot(Message);
2902
3271
  }
2903
3272
  function newFinishMessage(questionID, release) {
2904
3273
  const m = newMessage();
@@ -3342,7 +3711,7 @@ var Conn = class {
3342
3711
  const a = this.insertAnswer(id);
3343
3712
  if (a === null) return this.sendReturnException(id, new Error(RPC_QUESTION_ID_REUSED));
3344
3713
  if (this.main === void 0) return a.reject(new Error(RPC_NO_MAIN_INTERFACE));
3345
- const msg = new Message();
3714
+ const msg = new Message$1();
3346
3715
  msg.addCap(this.main);
3347
3716
  a.fulfill(new Interface(msg.getSegment(0), 0));
3348
3717
  }
@@ -3358,20 +3727,20 @@ var Conn = class {
3358
3727
  }
3359
3728
  handleMessage(m) {
3360
3729
  switch (m.which()) {
3361
- case Message$1.UNIMPLEMENTED: break;
3362
- case Message$1.BOOTSTRAP:
3730
+ case Message.UNIMPLEMENTED: break;
3731
+ case Message.BOOTSTRAP:
3363
3732
  this.handleBootstrapMessage(m);
3364
3733
  break;
3365
- case Message$1.ABORT:
3734
+ case Message.ABORT:
3366
3735
  this.shutdown(new RPCError(m.abort));
3367
3736
  break;
3368
- case Message$1.FINISH:
3737
+ case Message.FINISH:
3369
3738
  this.handleFinishMessage(m);
3370
3739
  break;
3371
- case Message$1.RETURN:
3740
+ case Message.RETURN:
3372
3741
  this.handleReturnMessage(m);
3373
3742
  break;
3374
- case Message$1.CALL:
3743
+ case Message.CALL:
3375
3744
  this.handleCallMessage(m);
3376
3745
  break;
3377
3746
  }
@@ -3681,7 +4050,7 @@ var DeferredTransport = class {
3681
4050
  };
3682
4051
  resolve = (buf) => {
3683
4052
  try {
3684
- this.d?.resolve(new Message(buf, false).getRoot(Message$1));
4053
+ this.d?.resolve(new Message$1(buf, false).getRoot(Message));
3685
4054
  } catch (error_) {
3686
4055
  this.d?.reject(error_);
3687
4056
  }
@@ -3690,4 +4059,4 @@ var DeferredTransport = class {
3690
4059
 
3691
4060
  //#endregion
3692
4061
  export { copyCall as A, isSameClient as C, Pipeline as D, Interface as E, isFuncCall as M, placeParams as N, Registry as O, clientFromResolution as S, Deferred as T, Uint64List as _, DeferredTransport as a, VoidList as b, Int16List as c, Int8List as d, InterfaceList as f, Uint32List as g, Uint16List as h, DataList as i, isDataCall as j, Server as k, Int32List as l, TextList as m, BoolList as n, Float32List as o, PointerList as p, Conn as r, Float64List as s, AnyPointerList as t, Int64List as u, Uint8List as v, utils as w, answerPipelineClient as x, Void as y };
3693
- //# sourceMappingURL=dist-BlvFBzSi.mjs.map
4062
+ //# sourceMappingURL=dist-DQ7xmzRT.mjs.map