@stryke/capnp 0.12.57 → 0.12.59

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 (63) hide show
  1. package/bin/capnpc.cjs +11454 -175
  2. package/bin/capnpc.mjs +11461 -174
  3. package/bin/capnpc.mjs.map +1 -1
  4. package/dist/capnp-es.GpvEvMIK-BH8YrftV.mjs +2362 -0
  5. package/dist/{capnp-es.GpvEvMIK-BsgDzeBH.mjs.map → capnp-es.GpvEvMIK-BH8YrftV.mjs.map} +1 -1
  6. package/dist/capnp-es.GpvEvMIK-BY4gHyC5.cjs +3171 -0
  7. package/dist/compile-Cxf2WDt0.mjs +3524 -0
  8. package/dist/{compile-DGAyhMqI.mjs.map → compile-Cxf2WDt0.mjs.map} +1 -1
  9. package/dist/compile-WDbSb0OW.cjs +3536 -0
  10. package/dist/compile.cjs +5 -1
  11. package/dist/compile.mjs +4 -1
  12. package/dist/dist-BZ3g4lB8.cjs +3889 -0
  13. package/dist/dist-Qno9L0HI.mjs +3693 -0
  14. package/dist/{dist-CK47iMja.mjs.map → dist-Qno9L0HI.mjs.map} +1 -1
  15. package/dist/helpers-BuE0WAt5.mjs +2457 -0
  16. package/dist/{helpers-rVOvMK2d.mjs.map → helpers-BuE0WAt5.mjs.map} +1 -1
  17. package/dist/helpers-a9QXtt7l.cjs +2471 -0
  18. package/dist/helpers.cjs +3 -1
  19. package/dist/helpers.mjs +3 -1
  20. package/dist/index.cjs +67 -1
  21. package/dist/index.mjs +7 -1
  22. package/dist/rpc-helpers.cjs +116 -1
  23. package/dist/rpc-helpers.mjs +114 -1
  24. package/dist/rpc-helpers.mjs.map +1 -1
  25. package/dist/types-Cuj2daUE.mjs +8 -0
  26. package/dist/{types-BujoAx-K.mjs.map → types-Cuj2daUE.mjs.map} +1 -1
  27. package/dist/types-DHrjS-69.cjs +13 -0
  28. package/dist/types.cjs +3 -1
  29. package/dist/types.mjs +3 -1
  30. package/package.json +4 -4
  31. package/schemas/cpp.cjs +6 -1
  32. package/schemas/cpp.mjs +5 -1
  33. package/schemas/cpp.mjs.map +1 -1
  34. package/schemas/persistent.cjs +204 -1
  35. package/schemas/persistent.mjs +198 -1
  36. package/schemas/persistent.mjs.map +1 -1
  37. package/schemas/rpc-twoparty.cjs +211 -1
  38. package/schemas/rpc-twoparty.mjs +204 -1
  39. package/schemas/rpc-twoparty.mjs.map +1 -1
  40. package/schemas/rpc.cjs +2424 -1
  41. package/schemas/rpc.mjs +2395 -1
  42. package/schemas/rpc.mjs.map +1 -1
  43. package/schemas/schema.cjs +2576 -1
  44. package/schemas/schema.mjs +2531 -1
  45. package/schemas/schema.mjs.map +1 -1
  46. package/schemas/src-BvgdYlCi.mjs +3067 -0
  47. package/schemas/{src-DqIy7I3p.mjs.map → src-BvgdYlCi.mjs.map} +1 -1
  48. package/schemas/src-C4qUIogl.cjs +3157 -0
  49. package/schemas/ts.cjs +6 -1
  50. package/schemas/ts.mjs +5 -1
  51. package/schemas/ts.mjs.map +1 -1
  52. package/dist/capnp-es.GpvEvMIK-BsgDzeBH.mjs +0 -12
  53. package/dist/capnp-es.GpvEvMIK-xNDcbmgx.cjs +0 -11
  54. package/dist/compile-B7Tm_xbT.cjs +0 -169
  55. package/dist/compile-DGAyhMqI.mjs +0 -163
  56. package/dist/dist-C1gSYYrg.cjs +0 -1
  57. package/dist/dist-CK47iMja.mjs +0 -2
  58. package/dist/helpers-DmrSADWE.cjs +0 -26
  59. package/dist/helpers-rVOvMK2d.mjs +0 -27
  60. package/dist/types-BujoAx-K.mjs +0 -2
  61. package/dist/types-D6FuBB1k.cjs +0 -1
  62. package/schemas/src-CGrmR2BO.cjs +0 -11
  63. package/schemas/src-DqIy7I3p.mjs +0 -12
package/schemas/rpc.mjs CHANGED
@@ -1,2 +1,2396 @@
1
- import{d as e,l as t,o as n,s as r,t as i,u as a}from"./src-DqIy7I3p.mjs";const o=BigInt(`0xb312981b2552a250`),s={UNIMPLEMENTED:0,ABORT:1,BOOTSTRAP:8,CALL:2,RETURN:3,FINISH:4,RESOLVE:5,RELEASE:6,DISEMBARGO:13,OBSOLETE_SAVE:7,OBSOLETE_DELETE:9,PROVIDE:10,ACCEPT:11,JOIN:12};var c=class t extends e{static UNIMPLEMENTED=s.UNIMPLEMENTED;static ABORT=s.ABORT;static BOOTSTRAP=s.BOOTSTRAP;static CALL=s.CALL;static RETURN=s.RETURN;static FINISH=s.FINISH;static RESOLVE=s.RESOLVE;static RELEASE=s.RELEASE;static DISEMBARGO=s.DISEMBARGO;static OBSOLETE_SAVE=s.OBSOLETE_SAVE;static OBSOLETE_DELETE=s.OBSOLETE_DELETE;static PROVIDE=s.PROVIDE;static ACCEPT=s.ACCEPT;static JOIN=s.JOIN;static _capnp={displayName:`Message`,id:`91b79f1f808db032`,size:new a(8,1)};_adoptUnimplemented(e){i.setUint16(0,0,this),i.adopt(e,i.getPointer(0,this))}_disownUnimplemented(){return i.disown(this.unimplemented)}get unimplemented(){return i.testWhich(`unimplemented`,i.getUint16(0,this),0,this),i.getStruct(0,t,this)}_hasUnimplemented(){return!i.isNull(i.getPointer(0,this))}_initUnimplemented(){return i.setUint16(0,0,this),i.initStructAt(0,t,this)}get _isUnimplemented(){return i.getUint16(0,this)===0}set unimplemented(e){i.setUint16(0,0,this),i.copyFrom(e,i.getPointer(0,this))}_adoptAbort(e){i.setUint16(0,1,this),i.adopt(e,i.getPointer(0,this))}_disownAbort(){return i.disown(this.abort)}get abort(){return i.testWhich(`abort`,i.getUint16(0,this),1,this),i.getStruct(0,F,this)}_hasAbort(){return!i.isNull(i.getPointer(0,this))}_initAbort(){return i.setUint16(0,1,this),i.initStructAt(0,F,this)}get _isAbort(){return i.getUint16(0,this)===1}set abort(e){i.setUint16(0,1,this),i.copyFrom(e,i.getPointer(0,this))}_adoptBootstrap(e){i.setUint16(0,8,this),i.adopt(e,i.getPointer(0,this))}_disownBootstrap(){return i.disown(this.bootstrap)}get bootstrap(){return i.testWhich(`bootstrap`,i.getUint16(0,this),8,this),i.getStruct(0,l,this)}_hasBootstrap(){return!i.isNull(i.getPointer(0,this))}_initBootstrap(){return i.setUint16(0,8,this),i.initStructAt(0,l,this)}get _isBootstrap(){return i.getUint16(0,this)===8}set bootstrap(e){i.setUint16(0,8,this),i.copyFrom(e,i.getPointer(0,this))}_adoptCall(e){i.setUint16(0,2,this),i.adopt(e,i.getPointer(0,this))}_disownCall(){return i.disown(this.call)}get call(){return i.testWhich(`call`,i.getUint16(0,this),2,this),i.getStruct(0,f,this)}_hasCall(){return!i.isNull(i.getPointer(0,this))}_initCall(){return i.setUint16(0,2,this),i.initStructAt(0,f,this)}get _isCall(){return i.getUint16(0,this)===2}set call(e){i.setUint16(0,2,this),i.copyFrom(e,i.getPointer(0,this))}_adoptReturn(e){i.setUint16(0,3,this),i.adopt(e,i.getPointer(0,this))}_disownReturn(){return i.disown(this.return)}get return(){return i.testWhich(`return`,i.getUint16(0,this),3,this),i.getStruct(0,m,this)}_hasReturn(){return!i.isNull(i.getPointer(0,this))}_initReturn(){return i.setUint16(0,3,this),i.initStructAt(0,m,this)}get _isReturn(){return i.getUint16(0,this)===3}set return(e){i.setUint16(0,3,this),i.copyFrom(e,i.getPointer(0,this))}_adoptFinish(e){i.setUint16(0,4,this),i.adopt(e,i.getPointer(0,this))}_disownFinish(){return i.disown(this.finish)}get finish(){return i.testWhich(`finish`,i.getUint16(0,this),4,this),i.getStruct(0,h,this)}_hasFinish(){return!i.isNull(i.getPointer(0,this))}_initFinish(){return i.setUint16(0,4,this),i.initStructAt(0,h,this)}get _isFinish(){return i.getUint16(0,this)===4}set finish(e){i.setUint16(0,4,this),i.copyFrom(e,i.getPointer(0,this))}_adoptResolve(e){i.setUint16(0,5,this),i.adopt(e,i.getPointer(0,this))}_disownResolve(){return i.disown(this.resolve)}get resolve(){return i.testWhich(`resolve`,i.getUint16(0,this),5,this),i.getStruct(0,_,this)}_hasResolve(){return!i.isNull(i.getPointer(0,this))}_initResolve(){return i.setUint16(0,5,this),i.initStructAt(0,_,this)}get _isResolve(){return i.getUint16(0,this)===5}set resolve(e){i.setUint16(0,5,this),i.copyFrom(e,i.getPointer(0,this))}_adoptRelease(e){i.setUint16(0,6,this),i.adopt(e,i.getPointer(0,this))}_disownRelease(){return i.disown(this.release)}get release(){return i.testWhich(`release`,i.getUint16(0,this),6,this),i.getStruct(0,v,this)}_hasRelease(){return!i.isNull(i.getPointer(0,this))}_initRelease(){return i.setUint16(0,6,this),i.initStructAt(0,v,this)}get _isRelease(){return i.getUint16(0,this)===6}set release(e){i.setUint16(0,6,this),i.copyFrom(e,i.getPointer(0,this))}_adoptDisembargo(e){i.setUint16(0,13,this),i.adopt(e,i.getPointer(0,this))}_disownDisembargo(){return i.disown(this.disembargo)}get disembargo(){return i.testWhich(`disembargo`,i.getUint16(0,this),13,this),i.getStruct(0,x,this)}_hasDisembargo(){return!i.isNull(i.getPointer(0,this))}_initDisembargo(){return i.setUint16(0,13,this),i.initStructAt(0,x,this)}get _isDisembargo(){return i.getUint16(0,this)===13}set disembargo(e){i.setUint16(0,13,this),i.copyFrom(e,i.getPointer(0,this))}_adoptObsoleteSave(e){i.setUint16(0,7,this),i.adopt(e,i.getPointer(0,this))}_disownObsoleteSave(){return i.disown(this.obsoleteSave)}get obsoleteSave(){return i.testWhich(`obsoleteSave`,i.getUint16(0,this),7,this),i.getPointer(0,this)}_hasObsoleteSave(){return!i.isNull(i.getPointer(0,this))}get _isObsoleteSave(){return i.getUint16(0,this)===7}set obsoleteSave(e){i.setUint16(0,7,this),i.copyFrom(e,i.getPointer(0,this))}_adoptObsoleteDelete(e){i.setUint16(0,9,this),i.adopt(e,i.getPointer(0,this))}_disownObsoleteDelete(){return i.disown(this.obsoleteDelete)}get obsoleteDelete(){return i.testWhich(`obsoleteDelete`,i.getUint16(0,this),9,this),i.getPointer(0,this)}_hasObsoleteDelete(){return!i.isNull(i.getPointer(0,this))}get _isObsoleteDelete(){return i.getUint16(0,this)===9}set obsoleteDelete(e){i.setUint16(0,9,this),i.copyFrom(e,i.getPointer(0,this))}_adoptProvide(e){i.setUint16(0,10,this),i.adopt(e,i.getPointer(0,this))}_disownProvide(){return i.disown(this.provide)}get provide(){return i.testWhich(`provide`,i.getUint16(0,this),10,this),i.getStruct(0,S,this)}_hasProvide(){return!i.isNull(i.getPointer(0,this))}_initProvide(){return i.setUint16(0,10,this),i.initStructAt(0,S,this)}get _isProvide(){return i.getUint16(0,this)===10}set provide(e){i.setUint16(0,10,this),i.copyFrom(e,i.getPointer(0,this))}_adoptAccept(e){i.setUint16(0,11,this),i.adopt(e,i.getPointer(0,this))}_disownAccept(){return i.disown(this.accept)}get accept(){return i.testWhich(`accept`,i.getUint16(0,this),11,this),i.getStruct(0,C,this)}_hasAccept(){return!i.isNull(i.getPointer(0,this))}_initAccept(){return i.setUint16(0,11,this),i.initStructAt(0,C,this)}get _isAccept(){return i.getUint16(0,this)===11}set accept(e){i.setUint16(0,11,this),i.copyFrom(e,i.getPointer(0,this))}_adoptJoin(e){i.setUint16(0,12,this),i.adopt(e,i.getPointer(0,this))}_disownJoin(){return i.disown(this.join)}get join(){return i.testWhich(`join`,i.getUint16(0,this),12,this),i.getStruct(0,w,this)}_hasJoin(){return!i.isNull(i.getPointer(0,this))}_initJoin(){return i.setUint16(0,12,this),i.initStructAt(0,w,this)}get _isJoin(){return i.getUint16(0,this)===12}set join(e){i.setUint16(0,12,this),i.copyFrom(e,i.getPointer(0,this))}toString(){return`Message_`+super.toString()}which(){return i.getUint16(0,this)}},l=class extends e{static _capnp={displayName:`Bootstrap`,id:`e94ccf8031176ec4`,size:new a(8,1)};get questionId(){return i.getUint32(0,this)}set questionId(e){i.setUint32(0,e,this)}_adoptDeprecatedObjectId(e){i.adopt(e,i.getPointer(0,this))}_disownDeprecatedObjectId(){return i.disown(this.deprecatedObjectId)}get deprecatedObjectId(){return i.getPointer(0,this)}_hasDeprecatedObjectId(){return!i.isNull(i.getPointer(0,this))}set deprecatedObjectId(e){i.copyFrom(e,i.getPointer(0,this))}toString(){return`Bootstrap_`+super.toString()}};const u={CALLER:0,YOURSELF:1,THIRD_PARTY:2};var d=class extends e{static CALLER=u.CALLER;static YOURSELF=u.YOURSELF;static THIRD_PARTY=u.THIRD_PARTY;static _capnp={displayName:`sendResultsTo`,id:`dae8b0f61aab5f99`,size:new a(24,3)};get _isCaller(){return i.getUint16(6,this)===0}set caller(e){i.setUint16(6,0,this)}get _isYourself(){return i.getUint16(6,this)===1}set yourself(e){i.setUint16(6,1,this)}_adoptThirdParty(e){i.setUint16(6,2,this),i.adopt(e,i.getPointer(2,this))}_disownThirdParty(){return i.disown(this.thirdParty)}get thirdParty(){return i.testWhich(`thirdParty`,i.getUint16(6,this),2,this),i.getPointer(2,this)}_hasThirdParty(){return!i.isNull(i.getPointer(2,this))}get _isThirdParty(){return i.getUint16(6,this)===2}set thirdParty(e){i.setUint16(6,2,this),i.copyFrom(e,i.getPointer(2,this))}toString(){return`Call_SendResultsTo_`+super.toString()}which(){return i.getUint16(6,this)}},f=class t extends e{static _capnp={displayName:`Call`,id:`836a53ce789d4cd4`,size:new a(24,3),defaultAllowThirdPartyTailCall:r(!1,0),defaultNoPromisePipelining:r(!1,1),defaultOnlyPromisePipeline:r(!1,2)};get questionId(){return i.getUint32(0,this)}set questionId(e){i.setUint32(0,e,this)}_adoptTarget(e){i.adopt(e,i.getPointer(0,this))}_disownTarget(){return i.disown(this.target)}get target(){return i.getStruct(0,E,this)}_hasTarget(){return!i.isNull(i.getPointer(0,this))}_initTarget(){return i.initStructAt(0,E,this)}set target(e){i.copyFrom(e,i.getPointer(0,this))}get interfaceId(){return i.getUint64(8,this)}set interfaceId(e){i.setUint64(8,e,this)}get methodId(){return i.getUint16(4,this)}set methodId(e){i.setUint16(4,e,this)}get allowThirdPartyTailCall(){return i.getBit(128,this,t._capnp.defaultAllowThirdPartyTailCall)}set allowThirdPartyTailCall(e){i.setBit(128,e,this,t._capnp.defaultAllowThirdPartyTailCall)}get noPromisePipelining(){return i.getBit(129,this,t._capnp.defaultNoPromisePipelining)}set noPromisePipelining(e){i.setBit(129,e,this,t._capnp.defaultNoPromisePipelining)}get onlyPromisePipeline(){return i.getBit(130,this,t._capnp.defaultOnlyPromisePipeline)}set onlyPromisePipeline(e){i.setBit(130,e,this,t._capnp.defaultOnlyPromisePipeline)}_adoptParams(e){i.adopt(e,i.getPointer(1,this))}_disownParams(){return i.disown(this.params)}get params(){return i.getStruct(1,D,this)}_hasParams(){return!i.isNull(i.getPointer(1,this))}_initParams(){return i.initStructAt(1,D,this)}set params(e){i.copyFrom(e,i.getPointer(1,this))}get sendResultsTo(){return i.getAs(d,this)}_initSendResultsTo(){return i.getAs(d,this)}toString(){return`Call_`+super.toString()}};const p={RESULTS:0,EXCEPTION:1,CANCELED:2,RESULTS_SENT_ELSEWHERE:3,TAKE_FROM_OTHER_QUESTION:4,ACCEPT_FROM_THIRD_PARTY:5};var m=class t extends e{static RESULTS=p.RESULTS;static EXCEPTION=p.EXCEPTION;static CANCELED=p.CANCELED;static RESULTS_SENT_ELSEWHERE=p.RESULTS_SENT_ELSEWHERE;static TAKE_FROM_OTHER_QUESTION=p.TAKE_FROM_OTHER_QUESTION;static ACCEPT_FROM_THIRD_PARTY=p.ACCEPT_FROM_THIRD_PARTY;static _capnp={displayName:`Return`,id:`9e19b28d3db3573a`,size:new a(16,1),defaultReleaseParamCaps:r(!0,0),defaultNoFinishNeeded:r(!1,1)};get answerId(){return i.getUint32(0,this)}set answerId(e){i.setUint32(0,e,this)}get releaseParamCaps(){return i.getBit(32,this,t._capnp.defaultReleaseParamCaps)}set releaseParamCaps(e){i.setBit(32,e,this,t._capnp.defaultReleaseParamCaps)}get noFinishNeeded(){return i.getBit(33,this,t._capnp.defaultNoFinishNeeded)}set noFinishNeeded(e){i.setBit(33,e,this,t._capnp.defaultNoFinishNeeded)}_adoptResults(e){i.setUint16(6,0,this),i.adopt(e,i.getPointer(0,this))}_disownResults(){return i.disown(this.results)}get results(){return i.testWhich(`results`,i.getUint16(6,this),0,this),i.getStruct(0,D,this)}_hasResults(){return!i.isNull(i.getPointer(0,this))}_initResults(){return i.setUint16(6,0,this),i.initStructAt(0,D,this)}get _isResults(){return i.getUint16(6,this)===0}set results(e){i.setUint16(6,0,this),i.copyFrom(e,i.getPointer(0,this))}_adoptException(e){i.setUint16(6,1,this),i.adopt(e,i.getPointer(0,this))}_disownException(){return i.disown(this.exception)}get exception(){return i.testWhich(`exception`,i.getUint16(6,this),1,this),i.getStruct(0,F,this)}_hasException(){return!i.isNull(i.getPointer(0,this))}_initException(){return i.setUint16(6,1,this),i.initStructAt(0,F,this)}get _isException(){return i.getUint16(6,this)===1}set exception(e){i.setUint16(6,1,this),i.copyFrom(e,i.getPointer(0,this))}get _isCanceled(){return i.getUint16(6,this)===2}set canceled(e){i.setUint16(6,2,this)}get _isResultsSentElsewhere(){return i.getUint16(6,this)===3}set resultsSentElsewhere(e){i.setUint16(6,3,this)}get takeFromOtherQuestion(){return i.testWhich(`takeFromOtherQuestion`,i.getUint16(6,this),4,this),i.getUint32(8,this)}get _isTakeFromOtherQuestion(){return i.getUint16(6,this)===4}set takeFromOtherQuestion(e){i.setUint16(6,4,this),i.setUint32(8,e,this)}_adoptAcceptFromThirdParty(e){i.setUint16(6,5,this),i.adopt(e,i.getPointer(0,this))}_disownAcceptFromThirdParty(){return i.disown(this.acceptFromThirdParty)}get acceptFromThirdParty(){return i.testWhich(`acceptFromThirdParty`,i.getUint16(6,this),5,this),i.getPointer(0,this)}_hasAcceptFromThirdParty(){return!i.isNull(i.getPointer(0,this))}get _isAcceptFromThirdParty(){return i.getUint16(6,this)===5}set acceptFromThirdParty(e){i.setUint16(6,5,this),i.copyFrom(e,i.getPointer(0,this))}toString(){return`Return_`+super.toString()}which(){return i.getUint16(6,this)}},h=class t extends e{static _capnp={displayName:`Finish`,id:`d37d2eb2c2f80e63`,size:new a(8,0),defaultReleaseResultCaps:r(!0,0),defaultRequireEarlyCancellationWorkaround:r(!0,1)};get questionId(){return i.getUint32(0,this)}set questionId(e){i.setUint32(0,e,this)}get releaseResultCaps(){return i.getBit(32,this,t._capnp.defaultReleaseResultCaps)}set releaseResultCaps(e){i.setBit(32,e,this,t._capnp.defaultReleaseResultCaps)}get requireEarlyCancellationWorkaround(){return i.getBit(33,this,t._capnp.defaultRequireEarlyCancellationWorkaround)}set requireEarlyCancellationWorkaround(e){i.setBit(33,e,this,t._capnp.defaultRequireEarlyCancellationWorkaround)}toString(){return`Finish_`+super.toString()}};const g={CAP:0,EXCEPTION:1};var _=class extends e{static CAP=g.CAP;static EXCEPTION=g.EXCEPTION;static _capnp={displayName:`Resolve`,id:`bbc29655fa89086e`,size:new a(8,1)};get promiseId(){return i.getUint32(0,this)}set promiseId(e){i.setUint32(0,e,this)}_adoptCap(e){i.setUint16(4,0,this),i.adopt(e,i.getPointer(0,this))}_disownCap(){return i.disown(this.cap)}get cap(){return i.testWhich(`cap`,i.getUint16(4,this),0,this),i.getStruct(0,k,this)}_hasCap(){return!i.isNull(i.getPointer(0,this))}_initCap(){return i.setUint16(4,0,this),i.initStructAt(0,k,this)}get _isCap(){return i.getUint16(4,this)===0}set cap(e){i.setUint16(4,0,this),i.copyFrom(e,i.getPointer(0,this))}_adoptException(e){i.setUint16(4,1,this),i.adopt(e,i.getPointer(0,this))}_disownException(){return i.disown(this.exception)}get exception(){return i.testWhich(`exception`,i.getUint16(4,this),1,this),i.getStruct(0,F,this)}_hasException(){return!i.isNull(i.getPointer(0,this))}_initException(){return i.setUint16(4,1,this),i.initStructAt(0,F,this)}get _isException(){return i.getUint16(4,this)===1}set exception(e){i.setUint16(4,1,this),i.copyFrom(e,i.getPointer(0,this))}toString(){return`Resolve_`+super.toString()}which(){return i.getUint16(4,this)}},v=class extends e{static _capnp={displayName:`Release`,id:`ad1a6c0d7dd07497`,size:new a(8,0)};get id(){return i.getUint32(0,this)}set id(e){i.setUint32(0,e,this)}get referenceCount(){return i.getUint32(4,this)}set referenceCount(e){i.setUint32(4,e,this)}toString(){return`Release_`+super.toString()}};const y={SENDER_LOOPBACK:0,RECEIVER_LOOPBACK:1,ACCEPT:2,PROVIDE:3};var b=class extends e{static SENDER_LOOPBACK=y.SENDER_LOOPBACK;static RECEIVER_LOOPBACK=y.RECEIVER_LOOPBACK;static ACCEPT=y.ACCEPT;static PROVIDE=y.PROVIDE;static _capnp={displayName:`context`,id:`d562b4df655bdd4d`,size:new a(8,1)};get senderLoopback(){return i.testWhich(`senderLoopback`,i.getUint16(4,this),0,this),i.getUint32(0,this)}get _isSenderLoopback(){return i.getUint16(4,this)===0}set senderLoopback(e){i.setUint16(4,0,this),i.setUint32(0,e,this)}get receiverLoopback(){return i.testWhich(`receiverLoopback`,i.getUint16(4,this),1,this),i.getUint32(0,this)}get _isReceiverLoopback(){return i.getUint16(4,this)===1}set receiverLoopback(e){i.setUint16(4,1,this),i.setUint32(0,e,this)}get _isAccept(){return i.getUint16(4,this)===2}set accept(e){i.setUint16(4,2,this)}get provide(){return i.testWhich(`provide`,i.getUint16(4,this),3,this),i.getUint32(0,this)}get _isProvide(){return i.getUint16(4,this)===3}set provide(e){i.setUint16(4,3,this),i.setUint32(0,e,this)}toString(){return`Disembargo_Context_`+super.toString()}which(){return i.getUint16(4,this)}},x=class extends e{static _capnp={displayName:`Disembargo`,id:`f964368b0fbd3711`,size:new a(8,1)};_adoptTarget(e){i.adopt(e,i.getPointer(0,this))}_disownTarget(){return i.disown(this.target)}get target(){return i.getStruct(0,E,this)}_hasTarget(){return!i.isNull(i.getPointer(0,this))}_initTarget(){return i.initStructAt(0,E,this)}set target(e){i.copyFrom(e,i.getPointer(0,this))}get context(){return i.getAs(b,this)}_initContext(){return i.getAs(b,this)}toString(){return`Disembargo_`+super.toString()}},S=class extends e{static _capnp={displayName:`Provide`,id:`9c6a046bfbc1ac5a`,size:new a(8,2)};get questionId(){return i.getUint32(0,this)}set questionId(e){i.setUint32(0,e,this)}_adoptTarget(e){i.adopt(e,i.getPointer(0,this))}_disownTarget(){return i.disown(this.target)}get target(){return i.getStruct(0,E,this)}_hasTarget(){return!i.isNull(i.getPointer(0,this))}_initTarget(){return i.initStructAt(0,E,this)}set target(e){i.copyFrom(e,i.getPointer(0,this))}_adoptRecipient(e){i.adopt(e,i.getPointer(1,this))}_disownRecipient(){return i.disown(this.recipient)}get recipient(){return i.getPointer(1,this)}_hasRecipient(){return!i.isNull(i.getPointer(1,this))}set recipient(e){i.copyFrom(e,i.getPointer(1,this))}toString(){return`Provide_`+super.toString()}},C=class extends e{static _capnp={displayName:`Accept`,id:`d4c9b56290554016`,size:new a(8,1)};get questionId(){return i.getUint32(0,this)}set questionId(e){i.setUint32(0,e,this)}_adoptProvision(e){i.adopt(e,i.getPointer(0,this))}_disownProvision(){return i.disown(this.provision)}get provision(){return i.getPointer(0,this)}_hasProvision(){return!i.isNull(i.getPointer(0,this))}set provision(e){i.copyFrom(e,i.getPointer(0,this))}get embargo(){return i.getBit(32,this)}set embargo(e){i.setBit(32,e,this)}toString(){return`Accept_`+super.toString()}},w=class extends e{static _capnp={displayName:`Join`,id:`fbe1980490e001af`,size:new a(8,2)};get questionId(){return i.getUint32(0,this)}set questionId(e){i.setUint32(0,e,this)}_adoptTarget(e){i.adopt(e,i.getPointer(0,this))}_disownTarget(){return i.disown(this.target)}get target(){return i.getStruct(0,E,this)}_hasTarget(){return!i.isNull(i.getPointer(0,this))}_initTarget(){return i.initStructAt(0,E,this)}set target(e){i.copyFrom(e,i.getPointer(0,this))}_adoptKeyPart(e){i.adopt(e,i.getPointer(1,this))}_disownKeyPart(){return i.disown(this.keyPart)}get keyPart(){return i.getPointer(1,this)}_hasKeyPart(){return!i.isNull(i.getPointer(1,this))}set keyPart(e){i.copyFrom(e,i.getPointer(1,this))}toString(){return`Join_`+super.toString()}};const T={IMPORTED_CAP:0,PROMISED_ANSWER:1};var E=class extends e{static IMPORTED_CAP=T.IMPORTED_CAP;static PROMISED_ANSWER=T.PROMISED_ANSWER;static _capnp={displayName:`MessageTarget`,id:`95bc14545813fbc1`,size:new a(8,1)};get importedCap(){return i.testWhich(`importedCap`,i.getUint16(4,this),0,this),i.getUint32(0,this)}get _isImportedCap(){return i.getUint16(4,this)===0}set importedCap(e){i.setUint16(4,0,this),i.setUint32(0,e,this)}_adoptPromisedAnswer(e){i.setUint16(4,1,this),i.adopt(e,i.getPointer(0,this))}_disownPromisedAnswer(){return i.disown(this.promisedAnswer)}get promisedAnswer(){return i.testWhich(`promisedAnswer`,i.getUint16(4,this),1,this),i.getStruct(0,M,this)}_hasPromisedAnswer(){return!i.isNull(i.getPointer(0,this))}_initPromisedAnswer(){return i.setUint16(4,1,this),i.initStructAt(0,M,this)}get _isPromisedAnswer(){return i.getUint16(4,this)===1}set promisedAnswer(e){i.setUint16(4,1,this),i.copyFrom(e,i.getPointer(0,this))}toString(){return`MessageTarget_`+super.toString()}which(){return i.getUint16(4,this)}},D=class t extends e{static _capnp={displayName:`Payload`,id:`9a0e61223d96743b`,size:new a(0,2)};static _CapTable;_adoptContent(e){i.adopt(e,i.getPointer(0,this))}_disownContent(){return i.disown(this.content)}get content(){return i.getPointer(0,this)}_hasContent(){return!i.isNull(i.getPointer(0,this))}set content(e){i.copyFrom(e,i.getPointer(0,this))}_adoptCapTable(e){i.adopt(e,i.getPointer(1,this))}_disownCapTable(){return i.disown(this.capTable)}get capTable(){return i.getList(1,t._CapTable,this)}_hasCapTable(){return!i.isNull(i.getPointer(1,this))}_initCapTable(e){return i.initList(1,t._CapTable,e,this)}set capTable(e){i.copyFrom(e,i.getPointer(1,this))}toString(){return`Payload_`+super.toString()}};const O={NONE:0,SENDER_HOSTED:1,SENDER_PROMISE:2,RECEIVER_HOSTED:3,RECEIVER_ANSWER:4,THIRD_PARTY_HOSTED:5};var k=class n extends e{static NONE=O.NONE;static SENDER_HOSTED=O.SENDER_HOSTED;static SENDER_PROMISE=O.SENDER_PROMISE;static RECEIVER_HOSTED=O.RECEIVER_HOSTED;static RECEIVER_ANSWER=O.RECEIVER_ANSWER;static THIRD_PARTY_HOSTED=O.THIRD_PARTY_HOSTED;static _capnp={displayName:`CapDescriptor`,id:`8523ddc40b86b8b0`,size:new a(8,1),defaultAttachedFd:t(255)};get _isNone(){return i.getUint16(0,this)===0}set none(e){i.setUint16(0,0,this)}get senderHosted(){return i.testWhich(`senderHosted`,i.getUint16(0,this),1,this),i.getUint32(4,this)}get _isSenderHosted(){return i.getUint16(0,this)===1}set senderHosted(e){i.setUint16(0,1,this),i.setUint32(4,e,this)}get senderPromise(){return i.testWhich(`senderPromise`,i.getUint16(0,this),2,this),i.getUint32(4,this)}get _isSenderPromise(){return i.getUint16(0,this)===2}set senderPromise(e){i.setUint16(0,2,this),i.setUint32(4,e,this)}get receiverHosted(){return i.testWhich(`receiverHosted`,i.getUint16(0,this),3,this),i.getUint32(4,this)}get _isReceiverHosted(){return i.getUint16(0,this)===3}set receiverHosted(e){i.setUint16(0,3,this),i.setUint32(4,e,this)}_adoptReceiverAnswer(e){i.setUint16(0,4,this),i.adopt(e,i.getPointer(0,this))}_disownReceiverAnswer(){return i.disown(this.receiverAnswer)}get receiverAnswer(){return i.testWhich(`receiverAnswer`,i.getUint16(0,this),4,this),i.getStruct(0,M,this)}_hasReceiverAnswer(){return!i.isNull(i.getPointer(0,this))}_initReceiverAnswer(){return i.setUint16(0,4,this),i.initStructAt(0,M,this)}get _isReceiverAnswer(){return i.getUint16(0,this)===4}set receiverAnswer(e){i.setUint16(0,4,this),i.copyFrom(e,i.getPointer(0,this))}_adoptThirdPartyHosted(e){i.setUint16(0,5,this),i.adopt(e,i.getPointer(0,this))}_disownThirdPartyHosted(){return i.disown(this.thirdPartyHosted)}get thirdPartyHosted(){return i.testWhich(`thirdPartyHosted`,i.getUint16(0,this),5,this),i.getStruct(0,N,this)}_hasThirdPartyHosted(){return!i.isNull(i.getPointer(0,this))}_initThirdPartyHosted(){return i.setUint16(0,5,this),i.initStructAt(0,N,this)}get _isThirdPartyHosted(){return i.getUint16(0,this)===5}set thirdPartyHosted(e){i.setUint16(0,5,this),i.copyFrom(e,i.getPointer(0,this))}get attachedFd(){return i.getUint8(2,this,n._capnp.defaultAttachedFd)}set attachedFd(e){i.setUint8(2,e,this,n._capnp.defaultAttachedFd)}toString(){return`CapDescriptor_`+super.toString()}which(){return i.getUint16(0,this)}};const A={NOOP:0,GET_POINTER_FIELD:1};var j=class extends e{static NOOP=A.NOOP;static GET_POINTER_FIELD=A.GET_POINTER_FIELD;static _capnp={displayName:`Op`,id:`f316944415569081`,size:new a(8,0)};get _isNoop(){return i.getUint16(0,this)===0}set noop(e){i.setUint16(0,0,this)}get getPointerField(){return i.testWhich(`getPointerField`,i.getUint16(0,this),1,this),i.getUint16(2,this)}get _isGetPointerField(){return i.getUint16(0,this)===1}set getPointerField(e){i.setUint16(0,1,this),i.setUint16(2,e,this)}toString(){return`PromisedAnswer_Op_`+super.toString()}which(){return i.getUint16(0,this)}},M=class t extends e{static Op=j;static _capnp={displayName:`PromisedAnswer`,id:`d800b1d6cd6f1ca0`,size:new a(8,1)};static _Transform;get questionId(){return i.getUint32(0,this)}set questionId(e){i.setUint32(0,e,this)}_adoptTransform(e){i.adopt(e,i.getPointer(0,this))}_disownTransform(){return i.disown(this.transform)}get transform(){return i.getList(0,t._Transform,this)}_hasTransform(){return!i.isNull(i.getPointer(0,this))}_initTransform(e){return i.initList(0,t._Transform,e,this)}set transform(e){i.copyFrom(e,i.getPointer(0,this))}toString(){return`PromisedAnswer_`+super.toString()}},N=class extends e{static _capnp={displayName:`ThirdPartyCapDescriptor`,id:`d37007fde1f0027d`,size:new a(8,1)};_adoptId(e){i.adopt(e,i.getPointer(0,this))}_disownId(){return i.disown(this.id)}get id(){return i.getPointer(0,this)}_hasId(){return!i.isNull(i.getPointer(0,this))}set id(e){i.copyFrom(e,i.getPointer(0,this))}get vineId(){return i.getUint32(0,this)}set vineId(e){i.setUint32(0,e,this)}toString(){return`ThirdPartyCapDescriptor_`+super.toString()}};const P={FAILED:0,OVERLOADED:1,DISCONNECTED:2,UNIMPLEMENTED:3};var F=class extends e{static Type=P;static _capnp={displayName:`Exception`,id:`d625b7063acf691a`,size:new a(8,2)};get reason(){return i.getText(0,this)}set reason(e){i.setText(0,e,this)}get type(){return i.getUint16(4,this)}set type(e){i.setUint16(4,e,this)}get obsoleteIsCallersFault(){return i.getBit(0,this)}set obsoleteIsCallersFault(e){i.setBit(0,e,this)}get obsoleteDurability(){return i.getUint16(2,this)}set obsoleteDurability(e){i.setUint16(2,e,this)}get trace(){return i.getText(1,this)}set trace(e){i.setText(1,e,this)}toString(){return`Exception_`+super.toString()}};D._CapTable=n(k),M._Transform=n(j);export{C as Accept,l as Bootstrap,f as Call,d as Call_SendResultsTo,u as Call_SendResultsTo_Which,k as CapDescriptor,O as CapDescriptor_Which,x as Disembargo,b as Disembargo_Context,y as Disembargo_Context_Which,F as Exception,P as Exception_Type,h as Finish,w as Join,c as Message,E as MessageTarget,T as MessageTarget_Which,s as Message_Which,D as Payload,M as PromisedAnswer,j as PromisedAnswer_Op,A as PromisedAnswer_Op_Which,S as Provide,v as Release,_ as Resolve,g as Resolve_Which,m as Return,p as Return_Which,N as ThirdPartyCapDescriptor,o as _capnpFileId};
1
+ import { d as Struct, l as getUint8Mask, o as CompositeList, s as getBitMask, t as utils, u as ObjectSize } from "./src-BvgdYlCi.mjs";
2
+
3
+ //#region schemas/rpc.ts
4
+ const _capnpFileId = BigInt("0xb312981b2552a250");
5
+ const Message_Which = {
6
+ UNIMPLEMENTED: 0,
7
+ ABORT: 1,
8
+ BOOTSTRAP: 8,
9
+ CALL: 2,
10
+ RETURN: 3,
11
+ FINISH: 4,
12
+ RESOLVE: 5,
13
+ RELEASE: 6,
14
+ DISEMBARGO: 13,
15
+ OBSOLETE_SAVE: 7,
16
+ OBSOLETE_DELETE: 9,
17
+ PROVIDE: 10,
18
+ ACCEPT: 11,
19
+ JOIN: 12
20
+ };
21
+ /**
22
+ * An RPC connection is a bi-directional stream of Messages.
23
+ *
24
+ */
25
+ var Message = class Message extends Struct {
26
+ static UNIMPLEMENTED = Message_Which.UNIMPLEMENTED;
27
+ static ABORT = Message_Which.ABORT;
28
+ static BOOTSTRAP = Message_Which.BOOTSTRAP;
29
+ static CALL = Message_Which.CALL;
30
+ static RETURN = Message_Which.RETURN;
31
+ static FINISH = Message_Which.FINISH;
32
+ static RESOLVE = Message_Which.RESOLVE;
33
+ static RELEASE = Message_Which.RELEASE;
34
+ static DISEMBARGO = Message_Which.DISEMBARGO;
35
+ static OBSOLETE_SAVE = Message_Which.OBSOLETE_SAVE;
36
+ static OBSOLETE_DELETE = Message_Which.OBSOLETE_DELETE;
37
+ static PROVIDE = Message_Which.PROVIDE;
38
+ static ACCEPT = Message_Which.ACCEPT;
39
+ static JOIN = Message_Which.JOIN;
40
+ static _capnp = {
41
+ displayName: "Message",
42
+ id: "91b79f1f808db032",
43
+ size: new ObjectSize(8, 1)
44
+ };
45
+ _adoptUnimplemented(value) {
46
+ utils.setUint16(0, 0, this);
47
+ utils.adopt(value, utils.getPointer(0, this));
48
+ }
49
+ _disownUnimplemented() {
50
+ return utils.disown(this.unimplemented);
51
+ }
52
+ /**
53
+ * The sender previously received this message from the peer but didn't understand it or doesn't
54
+ * yet implement the functionality that was requested. So, the sender is echoing the message
55
+ * back. In some cases, the receiver may be able to recover from this by pretending the sender
56
+ * had taken some appropriate "null" action.
57
+ *
58
+ * For example, say `resolve` is received by a level 0 implementation (because a previous call
59
+ * or return happened to contain a promise). The level 0 implementation will echo it back as
60
+ * `unimplemented`. The original sender can then simply release the cap to which the promise
61
+ * had resolved, thus avoiding a leak.
62
+ *
63
+ * For any message type that introduces a question, if the message comes back unimplemented,
64
+ * the original sender may simply treat it as if the question failed with an exception.
65
+ *
66
+ * In cases where there is no sensible way to react to an `unimplemented` message (without
67
+ * resource leaks or other serious problems), the connection may need to be aborted. This is
68
+ * a gray area; different implementations may take different approaches.
69
+ *
70
+ */
71
+ get unimplemented() {
72
+ utils.testWhich("unimplemented", utils.getUint16(0, this), 0, this);
73
+ return utils.getStruct(0, Message, this);
74
+ }
75
+ _hasUnimplemented() {
76
+ return !utils.isNull(utils.getPointer(0, this));
77
+ }
78
+ _initUnimplemented() {
79
+ utils.setUint16(0, 0, this);
80
+ return utils.initStructAt(0, Message, this);
81
+ }
82
+ get _isUnimplemented() {
83
+ return utils.getUint16(0, this) === 0;
84
+ }
85
+ set unimplemented(value) {
86
+ utils.setUint16(0, 0, this);
87
+ utils.copyFrom(value, utils.getPointer(0, this));
88
+ }
89
+ _adoptAbort(value) {
90
+ utils.setUint16(0, 1, this);
91
+ utils.adopt(value, utils.getPointer(0, this));
92
+ }
93
+ _disownAbort() {
94
+ return utils.disown(this.abort);
95
+ }
96
+ /**
97
+ * Sent when a connection is being aborted due to an unrecoverable error. This could be e.g.
98
+ * because the sender received an invalid or nonsensical message or because the sender had an
99
+ * internal error. The sender will shut down the outgoing half of the connection after `abort`
100
+ * and will completely close the connection shortly thereafter (it's up to the sender how much
101
+ * of a time buffer they want to offer for the client to receive the `abort` before the
102
+ * connection is reset).
103
+ *
104
+ */
105
+ get abort() {
106
+ utils.testWhich("abort", utils.getUint16(0, this), 1, this);
107
+ return utils.getStruct(0, Exception, this);
108
+ }
109
+ _hasAbort() {
110
+ return !utils.isNull(utils.getPointer(0, this));
111
+ }
112
+ _initAbort() {
113
+ utils.setUint16(0, 1, this);
114
+ return utils.initStructAt(0, Exception, this);
115
+ }
116
+ get _isAbort() {
117
+ return utils.getUint16(0, this) === 1;
118
+ }
119
+ set abort(value) {
120
+ utils.setUint16(0, 1, this);
121
+ utils.copyFrom(value, utils.getPointer(0, this));
122
+ }
123
+ _adoptBootstrap(value) {
124
+ utils.setUint16(0, 8, this);
125
+ utils.adopt(value, utils.getPointer(0, this));
126
+ }
127
+ _disownBootstrap() {
128
+ return utils.disown(this.bootstrap);
129
+ }
130
+ /**
131
+ * Request the peer's bootstrap interface.
132
+ *
133
+ */
134
+ get bootstrap() {
135
+ utils.testWhich("bootstrap", utils.getUint16(0, this), 8, this);
136
+ return utils.getStruct(0, Bootstrap, this);
137
+ }
138
+ _hasBootstrap() {
139
+ return !utils.isNull(utils.getPointer(0, this));
140
+ }
141
+ _initBootstrap() {
142
+ utils.setUint16(0, 8, this);
143
+ return utils.initStructAt(0, Bootstrap, this);
144
+ }
145
+ get _isBootstrap() {
146
+ return utils.getUint16(0, this) === 8;
147
+ }
148
+ set bootstrap(value) {
149
+ utils.setUint16(0, 8, this);
150
+ utils.copyFrom(value, utils.getPointer(0, this));
151
+ }
152
+ _adoptCall(value) {
153
+ utils.setUint16(0, 2, this);
154
+ utils.adopt(value, utils.getPointer(0, this));
155
+ }
156
+ _disownCall() {
157
+ return utils.disown(this.call);
158
+ }
159
+ /**
160
+ * Begin a method call.
161
+ *
162
+ */
163
+ get call() {
164
+ utils.testWhich("call", utils.getUint16(0, this), 2, this);
165
+ return utils.getStruct(0, Call, this);
166
+ }
167
+ _hasCall() {
168
+ return !utils.isNull(utils.getPointer(0, this));
169
+ }
170
+ _initCall() {
171
+ utils.setUint16(0, 2, this);
172
+ return utils.initStructAt(0, Call, this);
173
+ }
174
+ get _isCall() {
175
+ return utils.getUint16(0, this) === 2;
176
+ }
177
+ set call(value) {
178
+ utils.setUint16(0, 2, this);
179
+ utils.copyFrom(value, utils.getPointer(0, this));
180
+ }
181
+ _adoptReturn(value) {
182
+ utils.setUint16(0, 3, this);
183
+ utils.adopt(value, utils.getPointer(0, this));
184
+ }
185
+ _disownReturn() {
186
+ return utils.disown(this.return);
187
+ }
188
+ /**
189
+ * Complete a method call.
190
+ *
191
+ */
192
+ get return() {
193
+ utils.testWhich("return", utils.getUint16(0, this), 3, this);
194
+ return utils.getStruct(0, Return, this);
195
+ }
196
+ _hasReturn() {
197
+ return !utils.isNull(utils.getPointer(0, this));
198
+ }
199
+ _initReturn() {
200
+ utils.setUint16(0, 3, this);
201
+ return utils.initStructAt(0, Return, this);
202
+ }
203
+ get _isReturn() {
204
+ return utils.getUint16(0, this) === 3;
205
+ }
206
+ set return(value) {
207
+ utils.setUint16(0, 3, this);
208
+ utils.copyFrom(value, utils.getPointer(0, this));
209
+ }
210
+ _adoptFinish(value) {
211
+ utils.setUint16(0, 4, this);
212
+ utils.adopt(value, utils.getPointer(0, this));
213
+ }
214
+ _disownFinish() {
215
+ return utils.disown(this.finish);
216
+ }
217
+ /**
218
+ * Release a returned answer / cancel a call.
219
+ *
220
+ */
221
+ get finish() {
222
+ utils.testWhich("finish", utils.getUint16(0, this), 4, this);
223
+ return utils.getStruct(0, Finish, this);
224
+ }
225
+ _hasFinish() {
226
+ return !utils.isNull(utils.getPointer(0, this));
227
+ }
228
+ _initFinish() {
229
+ utils.setUint16(0, 4, this);
230
+ return utils.initStructAt(0, Finish, this);
231
+ }
232
+ get _isFinish() {
233
+ return utils.getUint16(0, this) === 4;
234
+ }
235
+ set finish(value) {
236
+ utils.setUint16(0, 4, this);
237
+ utils.copyFrom(value, utils.getPointer(0, this));
238
+ }
239
+ _adoptResolve(value) {
240
+ utils.setUint16(0, 5, this);
241
+ utils.adopt(value, utils.getPointer(0, this));
242
+ }
243
+ _disownResolve() {
244
+ return utils.disown(this.resolve);
245
+ }
246
+ /**
247
+ * Resolve a previously-sent promise.
248
+ *
249
+ */
250
+ get resolve() {
251
+ utils.testWhich("resolve", utils.getUint16(0, this), 5, this);
252
+ return utils.getStruct(0, Resolve, this);
253
+ }
254
+ _hasResolve() {
255
+ return !utils.isNull(utils.getPointer(0, this));
256
+ }
257
+ _initResolve() {
258
+ utils.setUint16(0, 5, this);
259
+ return utils.initStructAt(0, Resolve, this);
260
+ }
261
+ get _isResolve() {
262
+ return utils.getUint16(0, this) === 5;
263
+ }
264
+ set resolve(value) {
265
+ utils.setUint16(0, 5, this);
266
+ utils.copyFrom(value, utils.getPointer(0, this));
267
+ }
268
+ _adoptRelease(value) {
269
+ utils.setUint16(0, 6, this);
270
+ utils.adopt(value, utils.getPointer(0, this));
271
+ }
272
+ _disownRelease() {
273
+ return utils.disown(this.release);
274
+ }
275
+ /**
276
+ * Release a capability so that the remote object can be deallocated.
277
+ *
278
+ */
279
+ get release() {
280
+ utils.testWhich("release", utils.getUint16(0, this), 6, this);
281
+ return utils.getStruct(0, Release, this);
282
+ }
283
+ _hasRelease() {
284
+ return !utils.isNull(utils.getPointer(0, this));
285
+ }
286
+ _initRelease() {
287
+ utils.setUint16(0, 6, this);
288
+ return utils.initStructAt(0, Release, this);
289
+ }
290
+ get _isRelease() {
291
+ return utils.getUint16(0, this) === 6;
292
+ }
293
+ set release(value) {
294
+ utils.setUint16(0, 6, this);
295
+ utils.copyFrom(value, utils.getPointer(0, this));
296
+ }
297
+ _adoptDisembargo(value) {
298
+ utils.setUint16(0, 13, this);
299
+ utils.adopt(value, utils.getPointer(0, this));
300
+ }
301
+ _disownDisembargo() {
302
+ return utils.disown(this.disembargo);
303
+ }
304
+ /**
305
+ * Lift an embargo used to enforce E-order over promise resolution.
306
+ *
307
+ */
308
+ get disembargo() {
309
+ utils.testWhich("disembargo", utils.getUint16(0, this), 13, this);
310
+ return utils.getStruct(0, Disembargo, this);
311
+ }
312
+ _hasDisembargo() {
313
+ return !utils.isNull(utils.getPointer(0, this));
314
+ }
315
+ _initDisembargo() {
316
+ utils.setUint16(0, 13, this);
317
+ return utils.initStructAt(0, Disembargo, this);
318
+ }
319
+ get _isDisembargo() {
320
+ return utils.getUint16(0, this) === 13;
321
+ }
322
+ set disembargo(value) {
323
+ utils.setUint16(0, 13, this);
324
+ utils.copyFrom(value, utils.getPointer(0, this));
325
+ }
326
+ _adoptObsoleteSave(value) {
327
+ utils.setUint16(0, 7, this);
328
+ utils.adopt(value, utils.getPointer(0, this));
329
+ }
330
+ _disownObsoleteSave() {
331
+ return utils.disown(this.obsoleteSave);
332
+ }
333
+ /**
334
+ * Obsolete request to save a capability, resulting in a SturdyRef. This has been replaced
335
+ * by the `Persistent` interface defined in `persistent.capnp`. This operation was never
336
+ * implemented.
337
+ *
338
+ */
339
+ get obsoleteSave() {
340
+ utils.testWhich("obsoleteSave", utils.getUint16(0, this), 7, this);
341
+ return utils.getPointer(0, this);
342
+ }
343
+ _hasObsoleteSave() {
344
+ return !utils.isNull(utils.getPointer(0, this));
345
+ }
346
+ get _isObsoleteSave() {
347
+ return utils.getUint16(0, this) === 7;
348
+ }
349
+ set obsoleteSave(value) {
350
+ utils.setUint16(0, 7, this);
351
+ utils.copyFrom(value, utils.getPointer(0, this));
352
+ }
353
+ _adoptObsoleteDelete(value) {
354
+ utils.setUint16(0, 9, this);
355
+ utils.adopt(value, utils.getPointer(0, this));
356
+ }
357
+ _disownObsoleteDelete() {
358
+ return utils.disown(this.obsoleteDelete);
359
+ }
360
+ /**
361
+ * Obsolete way to delete a SturdyRef. This operation was never implemented.
362
+ *
363
+ */
364
+ get obsoleteDelete() {
365
+ utils.testWhich("obsoleteDelete", utils.getUint16(0, this), 9, this);
366
+ return utils.getPointer(0, this);
367
+ }
368
+ _hasObsoleteDelete() {
369
+ return !utils.isNull(utils.getPointer(0, this));
370
+ }
371
+ get _isObsoleteDelete() {
372
+ return utils.getUint16(0, this) === 9;
373
+ }
374
+ set obsoleteDelete(value) {
375
+ utils.setUint16(0, 9, this);
376
+ utils.copyFrom(value, utils.getPointer(0, this));
377
+ }
378
+ _adoptProvide(value) {
379
+ utils.setUint16(0, 10, this);
380
+ utils.adopt(value, utils.getPointer(0, this));
381
+ }
382
+ _disownProvide() {
383
+ return utils.disown(this.provide);
384
+ }
385
+ /**
386
+ * Provide a capability to a third party.
387
+ *
388
+ */
389
+ get provide() {
390
+ utils.testWhich("provide", utils.getUint16(0, this), 10, this);
391
+ return utils.getStruct(0, Provide, this);
392
+ }
393
+ _hasProvide() {
394
+ return !utils.isNull(utils.getPointer(0, this));
395
+ }
396
+ _initProvide() {
397
+ utils.setUint16(0, 10, this);
398
+ return utils.initStructAt(0, Provide, this);
399
+ }
400
+ get _isProvide() {
401
+ return utils.getUint16(0, this) === 10;
402
+ }
403
+ set provide(value) {
404
+ utils.setUint16(0, 10, this);
405
+ utils.copyFrom(value, utils.getPointer(0, this));
406
+ }
407
+ _adoptAccept(value) {
408
+ utils.setUint16(0, 11, this);
409
+ utils.adopt(value, utils.getPointer(0, this));
410
+ }
411
+ _disownAccept() {
412
+ return utils.disown(this.accept);
413
+ }
414
+ /**
415
+ * Accept a capability provided by a third party.
416
+ *
417
+ */
418
+ get accept() {
419
+ utils.testWhich("accept", utils.getUint16(0, this), 11, this);
420
+ return utils.getStruct(0, Accept, this);
421
+ }
422
+ _hasAccept() {
423
+ return !utils.isNull(utils.getPointer(0, this));
424
+ }
425
+ _initAccept() {
426
+ utils.setUint16(0, 11, this);
427
+ return utils.initStructAt(0, Accept, this);
428
+ }
429
+ get _isAccept() {
430
+ return utils.getUint16(0, this) === 11;
431
+ }
432
+ set accept(value) {
433
+ utils.setUint16(0, 11, this);
434
+ utils.copyFrom(value, utils.getPointer(0, this));
435
+ }
436
+ _adoptJoin(value) {
437
+ utils.setUint16(0, 12, this);
438
+ utils.adopt(value, utils.getPointer(0, this));
439
+ }
440
+ _disownJoin() {
441
+ return utils.disown(this.join);
442
+ }
443
+ /**
444
+ * Directly connect to the common root of two or more proxied caps.
445
+ *
446
+ */
447
+ get join() {
448
+ utils.testWhich("join", utils.getUint16(0, this), 12, this);
449
+ return utils.getStruct(0, Join, this);
450
+ }
451
+ _hasJoin() {
452
+ return !utils.isNull(utils.getPointer(0, this));
453
+ }
454
+ _initJoin() {
455
+ utils.setUint16(0, 12, this);
456
+ return utils.initStructAt(0, Join, this);
457
+ }
458
+ get _isJoin() {
459
+ return utils.getUint16(0, this) === 12;
460
+ }
461
+ set join(value) {
462
+ utils.setUint16(0, 12, this);
463
+ utils.copyFrom(value, utils.getPointer(0, this));
464
+ }
465
+ toString() {
466
+ return "Message_" + super.toString();
467
+ }
468
+ which() {
469
+ return utils.getUint16(0, this);
470
+ }
471
+ };
472
+ /**
473
+ * **(level 0)**
474
+ *
475
+ * Get the "bootstrap" interface exported by the remote vat.
476
+ *
477
+ * For level 0, 1, and 2 implementations, the "bootstrap" interface is simply the main interface
478
+ * exported by a vat. If the vat acts as a server fielding connections from clients, then the
479
+ * bootstrap interface defines the basic functionality available to a client when it connects.
480
+ * The exact interface definition obviously depends on the application.
481
+ *
482
+ * We call this a "bootstrap" because in an ideal Cap'n Proto world, bootstrap interfaces would
483
+ * never be used. In such a world, any time you connect to a new vat, you do so because you
484
+ * received an introduction from some other vat (see `ThirdPartyCapId`). Thus, the first message
485
+ * you send is `Accept`, and further communications derive from there. `Bootstrap` is not used.
486
+ *
487
+ * In such an ideal world, DNS itself would support Cap'n Proto -- performing a DNS lookup would
488
+ * actually return a new Cap'n Proto capability, thus introducing you to the target system via
489
+ * level 3 RPC. Applications would receive the capability to talk to DNS in the first place as
490
+ * an initial endowment or part of a Powerbox interaction. Therefore, an app can form arbitrary
491
+ * connections without ever using `Bootstrap`.
492
+ *
493
+ * Of course, in the real world, DNS is not Cap'n-Proto-based, and we don't want Cap'n Proto to
494
+ * require a whole new internet infrastructure to be useful. Therefore, we offer bootstrap
495
+ * interfaces as a way to get up and running without a level 3 introduction. Thus, bootstrap
496
+ * interfaces are used to "bootstrap" from other, non-Cap'n-Proto-based means of service discovery,
497
+ * such as legacy DNS.
498
+ *
499
+ * Note that a vat need not provide a bootstrap interface, and in fact many vats (especially those
500
+ * acting as clients) do not. In this case, the vat should either reply to `Bootstrap` with a
501
+ * `Return` indicating an exception, or should return a dummy capability with no methods.
502
+ *
503
+ */
504
+ var Bootstrap = class extends Struct {
505
+ static _capnp = {
506
+ displayName: "Bootstrap",
507
+ id: "e94ccf8031176ec4",
508
+ size: new ObjectSize(8, 1)
509
+ };
510
+ /**
511
+ * A new question ID identifying this request, which will eventually receive a Return message
512
+ * containing the restored capability.
513
+ *
514
+ */
515
+ get questionId() {
516
+ return utils.getUint32(0, this);
517
+ }
518
+ set questionId(value) {
519
+ utils.setUint32(0, value, this);
520
+ }
521
+ _adoptDeprecatedObjectId(value) {
522
+ utils.adopt(value, utils.getPointer(0, this));
523
+ }
524
+ _disownDeprecatedObjectId() {
525
+ return utils.disown(this.deprecatedObjectId);
526
+ }
527
+ /**
528
+ * ** DEPRECATED **
529
+ *
530
+ * A Vat may export multiple bootstrap interfaces. In this case, `deprecatedObjectId` specifies
531
+ * which one to return. If this pointer is null, then the default bootstrap interface is returned.
532
+ *
533
+ * As of version 0.5, use of this field is deprecated. If a service wants to export multiple
534
+ * bootstrap interfaces, it should instead define a single bootstrap interface that has methods
535
+ * that return each of the other interfaces.
536
+ *
537
+ * **History**
538
+ *
539
+ * In the first version of Cap'n Proto RPC (0.4.x) the `Bootstrap` message was called `Restore`.
540
+ * At the time, it was thought that this would eventually serve as the way to restore SturdyRefs
541
+ * (level 2). Meanwhile, an application could offer its "main" interface on a well-known
542
+ * (non-secret) SturdyRef.
543
+ *
544
+ * Since level 2 RPC was not implemented at the time, the `Restore` message was in practice only
545
+ * used to obtain the main interface. Since most applications had only one main interface that
546
+ * they wanted to restore, they tended to designate this with a null `objectId`.
547
+ *
548
+ * Unfortunately, the earliest version of the EZ RPC interfaces set a precedent of exporting
549
+ * multiple main interfaces by allowing them to be exported under string names. In this case,
550
+ * `objectId` was a Text value specifying the name.
551
+ *
552
+ * All of this proved problematic for several reasons:
553
+ *
554
+ * - The arrangement assumed that a client wishing to restore a SturdyRef would know exactly what
555
+ * machine to connect to and would be able to immediately restore a SturdyRef on connection.
556
+ * However, in practice, the ability to restore SturdyRefs is itself a capability that may
557
+ * require going through an authentication process to obtain. Thus, it makes more sense to
558
+ * define a "restorer service" as a full Cap'n Proto interface. If this restorer interface is
559
+ * offered as the vat's bootstrap interface, then this is equivalent to the old arrangement.
560
+ *
561
+ * - Overloading "Restore" for the purpose of obtaining well-known capabilities encouraged the
562
+ * practice of exporting singleton services with string names. If singleton services are desired,
563
+ * it is better to have one main interface that has methods that can be used to obtain each
564
+ * service, in order to get all the usual benefits of schemas and type checking.
565
+ *
566
+ * - Overloading "Restore" also had a security problem: Often, "main" or "well-known"
567
+ * capabilities exported by a vat are in fact not public: they are intended to be accessed only
568
+ * by clients who are capable of forming a connection to the vat. This can lead to trouble if
569
+ * the client itself has other clients and wishes to forward some `Restore` requests from those
570
+ * external clients -- it has to be very careful not to allow through `Restore` requests
571
+ * addressing the default capability.
572
+ *
573
+ * For example, consider the case of a sandboxed Sandstorm application and its supervisor. The
574
+ * application exports a default capability to its supervisor that provides access to
575
+ * functionality that only the supervisor is supposed to access. Meanwhile, though, applications
576
+ * may publish other capabilities that may be persistent, in which case the application needs
577
+ * to field `Restore` requests that could come from anywhere. These requests of course have to
578
+ * pass through the supervisor, as all communications with the outside world must. But, the
579
+ * supervisor has to be careful not to honor an external request addressing the application's
580
+ * default capability, since this capability is privileged. Unfortunately, the default
581
+ * capability cannot be given an unguessable name, because then the supervisor itself would not
582
+ * be able to address it!
583
+ *
584
+ * As of Cap'n Proto 0.5, `Restore` has been renamed to `Bootstrap` and is no longer planned for
585
+ * use in restoring SturdyRefs.
586
+ *
587
+ * Note that 0.4 also defined a message type called `Delete` that, like `Restore`, addressed a
588
+ * SturdyRef, but indicated that the client would not restore the ref again in the future. This
589
+ * operation was never implemented, so it was removed entirely. If a "delete" operation is desired,
590
+ * it should exist as a method on the same interface that handles restoring SturdyRefs. However,
591
+ * the utility of such an operation is questionable. You wouldn't be able to rely on it for
592
+ * garbage collection since a client could always disappear permanently without remembering to
593
+ * delete all its SturdyRefs, thus leaving them dangling forever. Therefore, it is advisable to
594
+ * design systems such that SturdyRefs never represent "owned" pointers.
595
+ *
596
+ * For example, say a SturdyRef points to an image file hosted on some server. That image file
597
+ * should also live inside a collection (a gallery, perhaps) hosted on the same server, owned by
598
+ * a user who can delete the image at any time. If the user deletes the image, the SturdyRef
599
+ * stops working. On the other hand, if the SturdyRef is discarded, this has no effect on the
600
+ * existence of the image in its collection.
601
+ *
602
+ */
603
+ get deprecatedObjectId() {
604
+ return utils.getPointer(0, this);
605
+ }
606
+ _hasDeprecatedObjectId() {
607
+ return !utils.isNull(utils.getPointer(0, this));
608
+ }
609
+ set deprecatedObjectId(value) {
610
+ utils.copyFrom(value, utils.getPointer(0, this));
611
+ }
612
+ toString() {
613
+ return "Bootstrap_" + super.toString();
614
+ }
615
+ };
616
+ const Call_SendResultsTo_Which = {
617
+ CALLER: 0,
618
+ YOURSELF: 1,
619
+ THIRD_PARTY: 2
620
+ };
621
+ /**
622
+ * Where should the return message be sent?
623
+ *
624
+ */
625
+ var Call_SendResultsTo = class extends Struct {
626
+ static CALLER = Call_SendResultsTo_Which.CALLER;
627
+ static YOURSELF = Call_SendResultsTo_Which.YOURSELF;
628
+ static THIRD_PARTY = Call_SendResultsTo_Which.THIRD_PARTY;
629
+ static _capnp = {
630
+ displayName: "sendResultsTo",
631
+ id: "dae8b0f61aab5f99",
632
+ size: new ObjectSize(24, 3)
633
+ };
634
+ get _isCaller() {
635
+ return utils.getUint16(6, this) === 0;
636
+ }
637
+ set caller(_) {
638
+ utils.setUint16(6, 0, this);
639
+ }
640
+ get _isYourself() {
641
+ return utils.getUint16(6, this) === 1;
642
+ }
643
+ set yourself(_) {
644
+ utils.setUint16(6, 1, this);
645
+ }
646
+ _adoptThirdParty(value) {
647
+ utils.setUint16(6, 2, this);
648
+ utils.adopt(value, utils.getPointer(2, this));
649
+ }
650
+ _disownThirdParty() {
651
+ return utils.disown(this.thirdParty);
652
+ }
653
+ /**
654
+ * **(level 3)**
655
+ *
656
+ * The call's result should be returned to a different vat. The receiver (the callee) expects
657
+ * to receive an `Accept` message from the indicated vat, and should return the call's result
658
+ * to it, rather than to the sender of the `Call`.
659
+ *
660
+ * This operates much like `yourself`, above, except that Carol is in a separate Vat C. `Call`
661
+ * messages are sent from Vat A -> Vat B and Vat B -> Vat C. A `Return` message is sent from
662
+ * Vat B -> Vat A that contains `acceptFromThirdParty` in place of results. When Vat A sends
663
+ * an `Accept` to Vat C, it receives back a `Return` containing the call's actual result. Vat C
664
+ * also sends a `Return` to Vat B with `resultsSentElsewhere`.
665
+ *
666
+ */
667
+ get thirdParty() {
668
+ utils.testWhich("thirdParty", utils.getUint16(6, this), 2, this);
669
+ return utils.getPointer(2, this);
670
+ }
671
+ _hasThirdParty() {
672
+ return !utils.isNull(utils.getPointer(2, this));
673
+ }
674
+ get _isThirdParty() {
675
+ return utils.getUint16(6, this) === 2;
676
+ }
677
+ set thirdParty(value) {
678
+ utils.setUint16(6, 2, this);
679
+ utils.copyFrom(value, utils.getPointer(2, this));
680
+ }
681
+ toString() {
682
+ return "Call_SendResultsTo_" + super.toString();
683
+ }
684
+ which() {
685
+ return utils.getUint16(6, this);
686
+ }
687
+ };
688
+ /**
689
+ * **(level 0)**
690
+ *
691
+ * Message type initiating a method call on a capability.
692
+ *
693
+ */
694
+ var Call = class Call extends Struct {
695
+ static _capnp = {
696
+ displayName: "Call",
697
+ id: "836a53ce789d4cd4",
698
+ size: new ObjectSize(24, 3),
699
+ defaultAllowThirdPartyTailCall: getBitMask(false, 0),
700
+ defaultNoPromisePipelining: getBitMask(false, 1),
701
+ defaultOnlyPromisePipeline: getBitMask(false, 2)
702
+ };
703
+ /**
704
+ * A number, chosen by the caller, that identifies this call in future messages. This number
705
+ * must be different from all other calls originating from the same end of the connection (but
706
+ * may overlap with question IDs originating from the opposite end). A fine strategy is to use
707
+ * sequential question IDs, but the recipient should not assume this.
708
+ *
709
+ * A question ID can be reused once both:
710
+ * - A matching Return has been received from the callee.
711
+ * - A matching Finish has been sent from the caller.
712
+ *
713
+ */
714
+ get questionId() {
715
+ return utils.getUint32(0, this);
716
+ }
717
+ set questionId(value) {
718
+ utils.setUint32(0, value, this);
719
+ }
720
+ _adoptTarget(value) {
721
+ utils.adopt(value, utils.getPointer(0, this));
722
+ }
723
+ _disownTarget() {
724
+ return utils.disown(this.target);
725
+ }
726
+ /**
727
+ * The object that should receive this call.
728
+ *
729
+ */
730
+ get target() {
731
+ return utils.getStruct(0, MessageTarget, this);
732
+ }
733
+ _hasTarget() {
734
+ return !utils.isNull(utils.getPointer(0, this));
735
+ }
736
+ _initTarget() {
737
+ return utils.initStructAt(0, MessageTarget, this);
738
+ }
739
+ set target(value) {
740
+ utils.copyFrom(value, utils.getPointer(0, this));
741
+ }
742
+ /**
743
+ * The type ID of the interface being called. Each capability may implement multiple interfaces.
744
+ *
745
+ */
746
+ get interfaceId() {
747
+ return utils.getUint64(8, this);
748
+ }
749
+ set interfaceId(value) {
750
+ utils.setUint64(8, value, this);
751
+ }
752
+ /**
753
+ * The ordinal number of the method to call within the requested interface.
754
+ *
755
+ */
756
+ get methodId() {
757
+ return utils.getUint16(4, this);
758
+ }
759
+ set methodId(value) {
760
+ utils.setUint16(4, value, this);
761
+ }
762
+ /**
763
+ * Indicates whether or not the receiver is allowed to send a `Return` containing
764
+ * `acceptFromThirdParty`. Level 3 implementations should set this true. Otherwise, the callee
765
+ * will have to proxy the return in the case of a tail call to a third-party vat.
766
+ *
767
+ */
768
+ get allowThirdPartyTailCall() {
769
+ return utils.getBit(128, this, Call._capnp.defaultAllowThirdPartyTailCall);
770
+ }
771
+ set allowThirdPartyTailCall(value) {
772
+ utils.setBit(128, value, this, Call._capnp.defaultAllowThirdPartyTailCall);
773
+ }
774
+ /**
775
+ * If true, the sender promises that it won't make any promise-pipelined calls on the results of
776
+ * this call. If it breaks this promise, the receiver may throw an arbitrary error from such
777
+ * calls.
778
+ *
779
+ * The receiver may use this as an optimization, by skipping the bookkeeping needed for pipelining
780
+ * when no pipelined calls are expected. The sender typically sets this to false when the method's
781
+ * schema does not specify any return capabilities.
782
+ *
783
+ */
784
+ get noPromisePipelining() {
785
+ return utils.getBit(129, this, Call._capnp.defaultNoPromisePipelining);
786
+ }
787
+ set noPromisePipelining(value) {
788
+ utils.setBit(129, value, this, Call._capnp.defaultNoPromisePipelining);
789
+ }
790
+ /**
791
+ * If true, the sender only plans to use this call to make pipelined calls. The receiver need not
792
+ * send a `Return` message (but is still allowed to do so).
793
+ *
794
+ * Since the sender does not know whether a `Return` will be sent, it must release all state
795
+ * related to the call when it sends `Finish`. However, in the case that the callee does not
796
+ * recognize this hint and chooses to send a `Return`, then technically the caller is not allowed
797
+ * to reuse the question ID until it receives said `Return`. This creates a conundrum: How does
798
+ * the caller decide when it's OK to reuse the ID? To sidestep the problem, the C++ implementation
799
+ * uses high-numbered IDs (with the high-order bit set) for such calls, and cycles through the
800
+ * IDs in order. If all 2^31 IDs in this space are used without ever seeing a `Return`, then the
801
+ * implementation assumes that the other end is in fact honoring the hint, and the ID counter is
802
+ * allowed to loop around. If a `Return` is ever seen when `onlyPromisePipeline` was set, then
803
+ * the implementation stops using this hint.
804
+ *
805
+ */
806
+ get onlyPromisePipeline() {
807
+ return utils.getBit(130, this, Call._capnp.defaultOnlyPromisePipeline);
808
+ }
809
+ set onlyPromisePipeline(value) {
810
+ utils.setBit(130, value, this, Call._capnp.defaultOnlyPromisePipeline);
811
+ }
812
+ _adoptParams(value) {
813
+ utils.adopt(value, utils.getPointer(1, this));
814
+ }
815
+ _disownParams() {
816
+ return utils.disown(this.params);
817
+ }
818
+ /**
819
+ * The call parameters. `params.content` is a struct whose fields correspond to the parameters of
820
+ * the method.
821
+ *
822
+ */
823
+ get params() {
824
+ return utils.getStruct(1, Payload, this);
825
+ }
826
+ _hasParams() {
827
+ return !utils.isNull(utils.getPointer(1, this));
828
+ }
829
+ _initParams() {
830
+ return utils.initStructAt(1, Payload, this);
831
+ }
832
+ set params(value) {
833
+ utils.copyFrom(value, utils.getPointer(1, this));
834
+ }
835
+ /**
836
+ * Where should the return message be sent?
837
+ *
838
+ */
839
+ get sendResultsTo() {
840
+ return utils.getAs(Call_SendResultsTo, this);
841
+ }
842
+ _initSendResultsTo() {
843
+ return utils.getAs(Call_SendResultsTo, this);
844
+ }
845
+ toString() {
846
+ return "Call_" + super.toString();
847
+ }
848
+ };
849
+ const Return_Which = {
850
+ RESULTS: 0,
851
+ EXCEPTION: 1,
852
+ CANCELED: 2,
853
+ RESULTS_SENT_ELSEWHERE: 3,
854
+ TAKE_FROM_OTHER_QUESTION: 4,
855
+ ACCEPT_FROM_THIRD_PARTY: 5
856
+ };
857
+ /**
858
+ * **(level 0)**
859
+ *
860
+ * Message type sent from callee to caller indicating that the call has completed.
861
+ *
862
+ */
863
+ var Return = class Return extends Struct {
864
+ static RESULTS = Return_Which.RESULTS;
865
+ static EXCEPTION = Return_Which.EXCEPTION;
866
+ static CANCELED = Return_Which.CANCELED;
867
+ static RESULTS_SENT_ELSEWHERE = Return_Which.RESULTS_SENT_ELSEWHERE;
868
+ static TAKE_FROM_OTHER_QUESTION = Return_Which.TAKE_FROM_OTHER_QUESTION;
869
+ static ACCEPT_FROM_THIRD_PARTY = Return_Which.ACCEPT_FROM_THIRD_PARTY;
870
+ static _capnp = {
871
+ displayName: "Return",
872
+ id: "9e19b28d3db3573a",
873
+ size: new ObjectSize(16, 1),
874
+ defaultReleaseParamCaps: getBitMask(true, 0),
875
+ defaultNoFinishNeeded: getBitMask(false, 1)
876
+ };
877
+ /**
878
+ * Equal to the QuestionId of the corresponding `Call` message.
879
+ *
880
+ */
881
+ get answerId() {
882
+ return utils.getUint32(0, this);
883
+ }
884
+ set answerId(value) {
885
+ utils.setUint32(0, value, this);
886
+ }
887
+ /**
888
+ * If true, all capabilities that were in the params should be considered released. The sender
889
+ * must not send separate `Release` messages for them. Level 0 implementations in particular
890
+ * should always set this true. This defaults true because if level 0 implementations forget to
891
+ * set it they'll never notice (just silently leak caps), but if level >=1 implementations forget
892
+ * to set it to false they'll quickly get errors.
893
+ *
894
+ * The receiver should act as if the sender had sent a release message with count=1 for each
895
+ * CapDescriptor in the original Call message.
896
+ *
897
+ */
898
+ get releaseParamCaps() {
899
+ return utils.getBit(32, this, Return._capnp.defaultReleaseParamCaps);
900
+ }
901
+ set releaseParamCaps(value) {
902
+ utils.setBit(32, value, this, Return._capnp.defaultReleaseParamCaps);
903
+ }
904
+ /**
905
+ * If true, the sender does not need the receiver to send a `Finish` message; its answer table
906
+ * entry has already been cleaned up. This implies that the results do not contain any
907
+ * capabilities, since the `Finish` message would normally release those capabilities from
908
+ * promise pipelining responsibility. The caller may still send a `Finish` message if it wants,
909
+ * which will be silently ignored by the callee.
910
+ *
911
+ */
912
+ get noFinishNeeded() {
913
+ return utils.getBit(33, this, Return._capnp.defaultNoFinishNeeded);
914
+ }
915
+ set noFinishNeeded(value) {
916
+ utils.setBit(33, value, this, Return._capnp.defaultNoFinishNeeded);
917
+ }
918
+ _adoptResults(value) {
919
+ utils.setUint16(6, 0, this);
920
+ utils.adopt(value, utils.getPointer(0, this));
921
+ }
922
+ _disownResults() {
923
+ return utils.disown(this.results);
924
+ }
925
+ /**
926
+ * The result.
927
+ *
928
+ * For regular method calls, `results.content` points to the result struct.
929
+ *
930
+ * For a `Return` in response to an `Accept` or `Bootstrap`, `results` contains a single
931
+ * capability (rather than a struct), and `results.content` is just a capability pointer with
932
+ * index 0. A `Finish` is still required in this case.
933
+ *
934
+ */
935
+ get results() {
936
+ utils.testWhich("results", utils.getUint16(6, this), 0, this);
937
+ return utils.getStruct(0, Payload, this);
938
+ }
939
+ _hasResults() {
940
+ return !utils.isNull(utils.getPointer(0, this));
941
+ }
942
+ _initResults() {
943
+ utils.setUint16(6, 0, this);
944
+ return utils.initStructAt(0, Payload, this);
945
+ }
946
+ get _isResults() {
947
+ return utils.getUint16(6, this) === 0;
948
+ }
949
+ set results(value) {
950
+ utils.setUint16(6, 0, this);
951
+ utils.copyFrom(value, utils.getPointer(0, this));
952
+ }
953
+ _adoptException(value) {
954
+ utils.setUint16(6, 1, this);
955
+ utils.adopt(value, utils.getPointer(0, this));
956
+ }
957
+ _disownException() {
958
+ return utils.disown(this.exception);
959
+ }
960
+ /**
961
+ * Indicates that the call failed and explains why.
962
+ *
963
+ */
964
+ get exception() {
965
+ utils.testWhich("exception", utils.getUint16(6, this), 1, this);
966
+ return utils.getStruct(0, Exception, this);
967
+ }
968
+ _hasException() {
969
+ return !utils.isNull(utils.getPointer(0, this));
970
+ }
971
+ _initException() {
972
+ utils.setUint16(6, 1, this);
973
+ return utils.initStructAt(0, Exception, this);
974
+ }
975
+ get _isException() {
976
+ return utils.getUint16(6, this) === 1;
977
+ }
978
+ set exception(value) {
979
+ utils.setUint16(6, 1, this);
980
+ utils.copyFrom(value, utils.getPointer(0, this));
981
+ }
982
+ get _isCanceled() {
983
+ return utils.getUint16(6, this) === 2;
984
+ }
985
+ set canceled(_) {
986
+ utils.setUint16(6, 2, this);
987
+ }
988
+ get _isResultsSentElsewhere() {
989
+ return utils.getUint16(6, this) === 3;
990
+ }
991
+ set resultsSentElsewhere(_) {
992
+ utils.setUint16(6, 3, this);
993
+ }
994
+ /**
995
+ * The sender has also sent (before this message) a `Call` with the given question ID and with
996
+ * `sendResultsTo.yourself` set, and the results of that other call should be used as the
997
+ * results here. `takeFromOtherQuestion` can only used once per question.
998
+ *
999
+ */
1000
+ get takeFromOtherQuestion() {
1001
+ utils.testWhich("takeFromOtherQuestion", utils.getUint16(6, this), 4, this);
1002
+ return utils.getUint32(8, this);
1003
+ }
1004
+ get _isTakeFromOtherQuestion() {
1005
+ return utils.getUint16(6, this) === 4;
1006
+ }
1007
+ set takeFromOtherQuestion(value) {
1008
+ utils.setUint16(6, 4, this);
1009
+ utils.setUint32(8, value, this);
1010
+ }
1011
+ _adoptAcceptFromThirdParty(value) {
1012
+ utils.setUint16(6, 5, this);
1013
+ utils.adopt(value, utils.getPointer(0, this));
1014
+ }
1015
+ _disownAcceptFromThirdParty() {
1016
+ return utils.disown(this.acceptFromThirdParty);
1017
+ }
1018
+ /**
1019
+ * **(level 3)**
1020
+ *
1021
+ * The caller should contact a third-party vat to pick up the results. An `Accept` message
1022
+ * sent to the vat will return the result. This pairs with `Call.sendResultsTo.thirdParty`.
1023
+ * It should only be used if the corresponding `Call` had `allowThirdPartyTailCall` set.
1024
+ *
1025
+ */
1026
+ get acceptFromThirdParty() {
1027
+ utils.testWhich("acceptFromThirdParty", utils.getUint16(6, this), 5, this);
1028
+ return utils.getPointer(0, this);
1029
+ }
1030
+ _hasAcceptFromThirdParty() {
1031
+ return !utils.isNull(utils.getPointer(0, this));
1032
+ }
1033
+ get _isAcceptFromThirdParty() {
1034
+ return utils.getUint16(6, this) === 5;
1035
+ }
1036
+ set acceptFromThirdParty(value) {
1037
+ utils.setUint16(6, 5, this);
1038
+ utils.copyFrom(value, utils.getPointer(0, this));
1039
+ }
1040
+ toString() {
1041
+ return "Return_" + super.toString();
1042
+ }
1043
+ which() {
1044
+ return utils.getUint16(6, this);
1045
+ }
1046
+ };
1047
+ /**
1048
+ * **(level 0)**
1049
+ *
1050
+ * Message type sent from the caller to the callee to indicate:
1051
+ * 1) The questionId will no longer be used in any messages sent by the callee (no further
1052
+ * pipelined requests).
1053
+ * 2) If the call has not returned yet, the caller no longer cares about the result. If nothing
1054
+ * else cares about the result either (e.g. there are no other outstanding calls pipelined on
1055
+ * the result of this one) then the callee may wish to immediately cancel the operation and
1056
+ * send back a Return message with "canceled" set. However, implementations are not required
1057
+ * to support premature cancellation -- instead, the implementation may wait until the call
1058
+ * actually completes and send a normal `Return` message.
1059
+ *
1060
+ * TODO(someday): Should we separate (1) and implicitly releasing result capabilities? It would be
1061
+ * possible and useful to notify the server that it doesn't need to keep around the response to
1062
+ * service pipeline requests even though the caller still wants to receive it / hasn't yet
1063
+ * finished processing it. It could also be useful to notify the server that it need not marshal
1064
+ * the results because the caller doesn't want them anyway, even if the caller is still sending
1065
+ * pipelined calls, although this seems less useful (just saving some bytes on the wire).
1066
+ *
1067
+ */
1068
+ var Finish = class Finish extends Struct {
1069
+ static _capnp = {
1070
+ displayName: "Finish",
1071
+ id: "d37d2eb2c2f80e63",
1072
+ size: new ObjectSize(8, 0),
1073
+ defaultReleaseResultCaps: getBitMask(true, 0),
1074
+ defaultRequireEarlyCancellationWorkaround: getBitMask(true, 1)
1075
+ };
1076
+ /**
1077
+ * ID of the call whose result is to be released.
1078
+ *
1079
+ */
1080
+ get questionId() {
1081
+ return utils.getUint32(0, this);
1082
+ }
1083
+ set questionId(value) {
1084
+ utils.setUint32(0, value, this);
1085
+ }
1086
+ /**
1087
+ * If true, all capabilities that were in the results should be considered released. The sender
1088
+ * must not send separate `Release` messages for them. Level 0 implementations in particular
1089
+ * should always set this true. This defaults true because if level 0 implementations forget to
1090
+ * set it they'll never notice (just silently leak caps), but if level >=1 implementations forget
1091
+ * set it false they'll quickly get errors.
1092
+ *
1093
+ */
1094
+ get releaseResultCaps() {
1095
+ return utils.getBit(32, this, Finish._capnp.defaultReleaseResultCaps);
1096
+ }
1097
+ set releaseResultCaps(value) {
1098
+ utils.setBit(32, value, this, Finish._capnp.defaultReleaseResultCaps);
1099
+ }
1100
+ /**
1101
+ * If true, if the RPC system receives this Finish message before the original call has even been
1102
+ * delivered, it should defer cancellation util after delivery. In particular, this gives the
1103
+ * destination object a chance to opt out of cancellation, e.g. as controlled by the
1104
+ * `allowCancellation` annotation defined in `c++.capnp`.
1105
+ *
1106
+ * This is a work-around. Versions 1.0 and up of Cap'n Proto always set this to false. However,
1107
+ * older versions of Cap'n Proto unintentionally exhibited this errant behavior by default, and
1108
+ * as a result programs built with older versions could be inadvertently relying on their peers
1109
+ * to implement the behavior. The purpose of this flag is to let newer versions know when the
1110
+ * peer is an older version, so that it can attempt to work around the issue.
1111
+ *
1112
+ * See also comments in handleFinish() in rpc.c++ for more details.
1113
+ *
1114
+ */
1115
+ get requireEarlyCancellationWorkaround() {
1116
+ return utils.getBit(33, this, Finish._capnp.defaultRequireEarlyCancellationWorkaround);
1117
+ }
1118
+ set requireEarlyCancellationWorkaround(value) {
1119
+ utils.setBit(33, value, this, Finish._capnp.defaultRequireEarlyCancellationWorkaround);
1120
+ }
1121
+ toString() {
1122
+ return "Finish_" + super.toString();
1123
+ }
1124
+ };
1125
+ const Resolve_Which = {
1126
+ CAP: 0,
1127
+ EXCEPTION: 1
1128
+ };
1129
+ /**
1130
+ * **(level 1)**
1131
+ *
1132
+ * Message type sent to indicate that a previously-sent promise has now been resolved to some other
1133
+ * object (possibly another promise) -- or broken, or canceled.
1134
+ *
1135
+ * Keep in mind that it's possible for a `Resolve` to be sent to a level 0 implementation that
1136
+ * doesn't implement it. For example, a method call or return might contain a capability in the
1137
+ * payload. Normally this is fine even if the receiver is level 0, because they will implicitly
1138
+ * release all such capabilities on return / finish. But if the cap happens to be a promise, then
1139
+ * a follow-up `Resolve` may be sent regardless of this release. The level 0 receiver will reply
1140
+ * with an `unimplemented` message, and the sender (of the `Resolve`) can respond to this as if the
1141
+ * receiver had immediately released any capability to which the promise resolved.
1142
+ *
1143
+ * When implementing promise resolution, it's important to understand how embargos work and the
1144
+ * tricky case of the Tribble 4-way race condition. See the comments for the Disembargo message,
1145
+ * below.
1146
+ *
1147
+ */
1148
+ var Resolve = class extends Struct {
1149
+ static CAP = Resolve_Which.CAP;
1150
+ static EXCEPTION = Resolve_Which.EXCEPTION;
1151
+ static _capnp = {
1152
+ displayName: "Resolve",
1153
+ id: "bbc29655fa89086e",
1154
+ size: new ObjectSize(8, 1)
1155
+ };
1156
+ /**
1157
+ * The ID of the promise to be resolved.
1158
+ *
1159
+ * Unlike all other instances of `ExportId` sent from the exporter, the `Resolve` message does
1160
+ * _not_ increase the reference count of `promiseId`. In fact, it is expected that the receiver
1161
+ * will release the export soon after receiving `Resolve`, and the sender will not send this
1162
+ * `ExportId` again until it has been released and recycled.
1163
+ *
1164
+ * When an export ID sent over the wire (e.g. in a `CapDescriptor`) is indicated to be a promise,
1165
+ * this indicates that the sender will follow up at some point with a `Resolve` message. If the
1166
+ * same `promiseId` is sent again before `Resolve`, still only one `Resolve` is sent. If the
1167
+ * same ID is sent again later _after_ a `Resolve`, it can only be because the export's
1168
+ * reference count hit zero in the meantime and the ID was re-assigned to a new export, therefore
1169
+ * this later promise does _not_ correspond to the earlier `Resolve`.
1170
+ *
1171
+ * If a promise ID's reference count reaches zero before a `Resolve` is sent, the `Resolve`
1172
+ * message may or may not still be sent (the `Resolve` may have already been in-flight when
1173
+ * `Release` was sent, but if the `Release` is received before `Resolve` then there is no longer
1174
+ * any reason to send a `Resolve`). Thus a `Resolve` may be received for a promise of which
1175
+ * the receiver has no knowledge, because it already released it earlier. In this case, the
1176
+ * receiver should simply release the capability to which the promise resolved.
1177
+ *
1178
+ */
1179
+ get promiseId() {
1180
+ return utils.getUint32(0, this);
1181
+ }
1182
+ set promiseId(value) {
1183
+ utils.setUint32(0, value, this);
1184
+ }
1185
+ _adoptCap(value) {
1186
+ utils.setUint16(4, 0, this);
1187
+ utils.adopt(value, utils.getPointer(0, this));
1188
+ }
1189
+ _disownCap() {
1190
+ return utils.disown(this.cap);
1191
+ }
1192
+ /**
1193
+ * The object to which the promise resolved.
1194
+ *
1195
+ * The sender promises that from this point forth, until `promiseId` is released, it shall
1196
+ * simply forward all messages to the capability designated by `cap`. This is true even if
1197
+ * `cap` itself happens to designate another promise, and that other promise later resolves --
1198
+ * messages sent to `promiseId` shall still go to that other promise, not to its resolution.
1199
+ * This is important in the case that the receiver of the `Resolve` ends up sending a
1200
+ * `Disembargo` message towards `promiseId` in order to control message ordering -- that
1201
+ * `Disembargo` really needs to reflect back to exactly the object designated by `cap` even
1202
+ * if that object is itself a promise.
1203
+ *
1204
+ */
1205
+ get cap() {
1206
+ utils.testWhich("cap", utils.getUint16(4, this), 0, this);
1207
+ return utils.getStruct(0, CapDescriptor, this);
1208
+ }
1209
+ _hasCap() {
1210
+ return !utils.isNull(utils.getPointer(0, this));
1211
+ }
1212
+ _initCap() {
1213
+ utils.setUint16(4, 0, this);
1214
+ return utils.initStructAt(0, CapDescriptor, this);
1215
+ }
1216
+ get _isCap() {
1217
+ return utils.getUint16(4, this) === 0;
1218
+ }
1219
+ set cap(value) {
1220
+ utils.setUint16(4, 0, this);
1221
+ utils.copyFrom(value, utils.getPointer(0, this));
1222
+ }
1223
+ _adoptException(value) {
1224
+ utils.setUint16(4, 1, this);
1225
+ utils.adopt(value, utils.getPointer(0, this));
1226
+ }
1227
+ _disownException() {
1228
+ return utils.disown(this.exception);
1229
+ }
1230
+ /**
1231
+ * Indicates that the promise was broken.
1232
+ *
1233
+ */
1234
+ get exception() {
1235
+ utils.testWhich("exception", utils.getUint16(4, this), 1, this);
1236
+ return utils.getStruct(0, Exception, this);
1237
+ }
1238
+ _hasException() {
1239
+ return !utils.isNull(utils.getPointer(0, this));
1240
+ }
1241
+ _initException() {
1242
+ utils.setUint16(4, 1, this);
1243
+ return utils.initStructAt(0, Exception, this);
1244
+ }
1245
+ get _isException() {
1246
+ return utils.getUint16(4, this) === 1;
1247
+ }
1248
+ set exception(value) {
1249
+ utils.setUint16(4, 1, this);
1250
+ utils.copyFrom(value, utils.getPointer(0, this));
1251
+ }
1252
+ toString() {
1253
+ return "Resolve_" + super.toString();
1254
+ }
1255
+ which() {
1256
+ return utils.getUint16(4, this);
1257
+ }
1258
+ };
1259
+ /**
1260
+ * **(level 1)**
1261
+ *
1262
+ * Message type sent to indicate that the sender is done with the given capability and the receiver
1263
+ * can free resources allocated to it.
1264
+ *
1265
+ */
1266
+ var Release = class extends Struct {
1267
+ static _capnp = {
1268
+ displayName: "Release",
1269
+ id: "ad1a6c0d7dd07497",
1270
+ size: new ObjectSize(8, 0)
1271
+ };
1272
+ /**
1273
+ * What to release.
1274
+ *
1275
+ */
1276
+ get id() {
1277
+ return utils.getUint32(0, this);
1278
+ }
1279
+ set id(value) {
1280
+ utils.setUint32(0, value, this);
1281
+ }
1282
+ /**
1283
+ * The amount by which to decrement the reference count. The export is only actually released
1284
+ * when the reference count reaches zero.
1285
+ *
1286
+ */
1287
+ get referenceCount() {
1288
+ return utils.getUint32(4, this);
1289
+ }
1290
+ set referenceCount(value) {
1291
+ utils.setUint32(4, value, this);
1292
+ }
1293
+ toString() {
1294
+ return "Release_" + super.toString();
1295
+ }
1296
+ };
1297
+ const Disembargo_Context_Which = {
1298
+ SENDER_LOOPBACK: 0,
1299
+ RECEIVER_LOOPBACK: 1,
1300
+ ACCEPT: 2,
1301
+ PROVIDE: 3
1302
+ };
1303
+ var Disembargo_Context = class extends Struct {
1304
+ static SENDER_LOOPBACK = Disembargo_Context_Which.SENDER_LOOPBACK;
1305
+ static RECEIVER_LOOPBACK = Disembargo_Context_Which.RECEIVER_LOOPBACK;
1306
+ static ACCEPT = Disembargo_Context_Which.ACCEPT;
1307
+ static PROVIDE = Disembargo_Context_Which.PROVIDE;
1308
+ static _capnp = {
1309
+ displayName: "context",
1310
+ id: "d562b4df655bdd4d",
1311
+ size: new ObjectSize(8, 1)
1312
+ };
1313
+ /**
1314
+ * The sender is requesting a disembargo on a promise that is known to resolve back to a
1315
+ * capability hosted by the sender. As soon as the receiver has echoed back all pipelined calls
1316
+ * on this promise, it will deliver the Disembargo back to the sender with `receiverLoopback`
1317
+ * set to the same value as `senderLoopback`. This value is chosen by the sender, and since
1318
+ * it is also consumed be the sender, the sender can use whatever strategy it wants to make sure
1319
+ * the value is unambiguous.
1320
+ *
1321
+ * The receiver must verify that the target capability actually resolves back to the sender's
1322
+ * vat. Otherwise, the sender has committed a protocol error and should be disconnected.
1323
+ *
1324
+ */
1325
+ get senderLoopback() {
1326
+ utils.testWhich("senderLoopback", utils.getUint16(4, this), 0, this);
1327
+ return utils.getUint32(0, this);
1328
+ }
1329
+ get _isSenderLoopback() {
1330
+ return utils.getUint16(4, this) === 0;
1331
+ }
1332
+ set senderLoopback(value) {
1333
+ utils.setUint16(4, 0, this);
1334
+ utils.setUint32(0, value, this);
1335
+ }
1336
+ /**
1337
+ * The receiver previously sent a `senderLoopback` Disembargo towards a promise resolving to
1338
+ * this capability, and that Disembargo is now being echoed back.
1339
+ *
1340
+ */
1341
+ get receiverLoopback() {
1342
+ utils.testWhich("receiverLoopback", utils.getUint16(4, this), 1, this);
1343
+ return utils.getUint32(0, this);
1344
+ }
1345
+ get _isReceiverLoopback() {
1346
+ return utils.getUint16(4, this) === 1;
1347
+ }
1348
+ set receiverLoopback(value) {
1349
+ utils.setUint16(4, 1, this);
1350
+ utils.setUint32(0, value, this);
1351
+ }
1352
+ get _isAccept() {
1353
+ return utils.getUint16(4, this) === 2;
1354
+ }
1355
+ set accept(_) {
1356
+ utils.setUint16(4, 2, this);
1357
+ }
1358
+ /**
1359
+ * **(level 3)**
1360
+ *
1361
+ * The sender is requesting a disembargo on a capability currently being provided to a third
1362
+ * party. The question ID identifies the `Provide` message previously sent by the sender to
1363
+ * this capability. On receipt, the receiver (the capability host) shall release the embargo
1364
+ * on the `Accept` message that it has received from the third party. See `Accept.embargo` for
1365
+ * an example.
1366
+ *
1367
+ */
1368
+ get provide() {
1369
+ utils.testWhich("provide", utils.getUint16(4, this), 3, this);
1370
+ return utils.getUint32(0, this);
1371
+ }
1372
+ get _isProvide() {
1373
+ return utils.getUint16(4, this) === 3;
1374
+ }
1375
+ set provide(value) {
1376
+ utils.setUint16(4, 3, this);
1377
+ utils.setUint32(0, value, this);
1378
+ }
1379
+ toString() {
1380
+ return "Disembargo_Context_" + super.toString();
1381
+ }
1382
+ which() {
1383
+ return utils.getUint16(4, this);
1384
+ }
1385
+ };
1386
+ /**
1387
+ * **(level 1)**
1388
+ *
1389
+ * Message sent to indicate that an embargo on a recently-resolved promise may now be lifted.
1390
+ *
1391
+ * Embargos are used to enforce E-order in the presence of promise resolution. That is, if an
1392
+ * application makes two calls foo() and bar() on the same capability reference, in that order,
1393
+ * the calls should be delivered in the order in which they were made. But if foo() is called
1394
+ * on a promise, and that promise happens to resolve before bar() is called, then the two calls
1395
+ * may travel different paths over the network, and thus could arrive in the wrong order. In
1396
+ * this case, the call to `bar()` must be embargoed, and a `Disembargo` message must be sent along
1397
+ * the same path as `foo()` to ensure that the `Disembargo` arrives after `foo()`. Once the
1398
+ * `Disembargo` arrives, `bar()` can then be delivered.
1399
+ *
1400
+ * There are two particular cases where embargos are important. Consider object Alice, in Vat A,
1401
+ * who holds a promise P, pointing towards Vat B, that eventually resolves to Carol. The two
1402
+ * cases are:
1403
+ * - Carol lives in Vat A, i.e. next to Alice. In this case, Vat A needs to send a `Disembargo`
1404
+ * message that echos through Vat B and back, to ensure that all pipelined calls on the promise
1405
+ * have been delivered.
1406
+ * - Carol lives in a different Vat C. When the promise resolves, a three-party handoff occurs
1407
+ * (see `Provide` and `Accept`, which constitute level 3 of the protocol). In this case, we
1408
+ * piggyback on the state that has already been set up to handle the handoff: the `Accept`
1409
+ * message (from Vat A to Vat C) is embargoed, as are all pipelined messages sent to it, while
1410
+ * a `Disembargo` message is sent from Vat A through Vat B to Vat C. See `Accept.embargo` for
1411
+ * an example.
1412
+ *
1413
+ * Note that in the case where Carol actually lives in Vat B (i.e., the same vat that the promise
1414
+ * already pointed at), no embargo is needed, because the pipelined calls are delivered over the
1415
+ * same path as the later direct calls.
1416
+ *
1417
+ * Keep in mind that promise resolution happens both in the form of Resolve messages as well as
1418
+ * Return messages (which resolve PromisedAnswers). Embargos apply in both cases.
1419
+ *
1420
+ * An alternative strategy for enforcing E-order over promise resolution could be for Vat A to
1421
+ * implement the embargo internally. When Vat A is notified of promise resolution, it could
1422
+ * send a dummy no-op call to promise P and wait for it to complete. Until that call completes,
1423
+ * all calls to the capability are queued locally. This strategy works, but is pessimistic:
1424
+ * in the three-party case, it requires an A -> B -> C -> B -> A round trip before calls can start
1425
+ * being delivered directly to from Vat A to Vat C. The `Disembargo` message allows latency to be
1426
+ * reduced. (In the two-party loopback case, the `Disembargo` message is just a more explicit way
1427
+ * of accomplishing the same thing as a no-op call, but isn't any faster.)
1428
+ *
1429
+ * *The Tribble 4-way Race Condition*
1430
+ *
1431
+ * Any implementation of promise resolution and embargos must be aware of what we call the
1432
+ * "Tribble 4-way race condition", after Dean Tribble, who explained the problem in a lively
1433
+ * Friam meeting.
1434
+ *
1435
+ * Embargos are designed to work in the case where a two-hop path is being shortened to one hop.
1436
+ * But sometimes there are more hops. Imagine that Alice has a reference to a remote promise P1
1437
+ * that eventually resolves to _another_ remote promise P2 (in a third vat), which _at the same
1438
+ * time_ happens to resolve to Bob (in a fourth vat). In this case, we're shortening from a 3-hop
1439
+ * path (with four parties) to a 1-hop path (Alice -> Bob).
1440
+ *
1441
+ * Extending the embargo/disembargo protocol to be able to shorted multiple hops at once seems
1442
+ * difficult. Instead, we make a rule that prevents this case from coming up:
1443
+ *
1444
+ * One a promise P has been resolved to a remote object reference R, then all further messages
1445
+ * received addressed to P will be forwarded strictly to R. Even if it turns out later that R is
1446
+ * itself a promise, and has resolved to some other object Q, messages sent to P will still be
1447
+ * forwarded to R, not directly to Q (R will of course further forward the messages to Q).
1448
+ *
1449
+ * This rule does not cause a significant performance burden because once P has resolved to R, it
1450
+ * is expected that people sending messages to P will shortly start sending them to R instead and
1451
+ * drop P. P is at end-of-life anyway, so it doesn't matter if it ignores chances to further
1452
+ * optimize its path.
1453
+ *
1454
+ * Note well: the Tribble 4-way race condition does not require each vat to be *distinct*; as long
1455
+ * as each resolution crosses a network boundary the race can occur -- so this concerns even level
1456
+ * 1 implementations, not just level 3 implementations.
1457
+ *
1458
+ */
1459
+ var Disembargo = class extends Struct {
1460
+ static _capnp = {
1461
+ displayName: "Disembargo",
1462
+ id: "f964368b0fbd3711",
1463
+ size: new ObjectSize(8, 1)
1464
+ };
1465
+ _adoptTarget(value) {
1466
+ utils.adopt(value, utils.getPointer(0, this));
1467
+ }
1468
+ _disownTarget() {
1469
+ return utils.disown(this.target);
1470
+ }
1471
+ /**
1472
+ * What is to be disembargoed.
1473
+ *
1474
+ */
1475
+ get target() {
1476
+ return utils.getStruct(0, MessageTarget, this);
1477
+ }
1478
+ _hasTarget() {
1479
+ return !utils.isNull(utils.getPointer(0, this));
1480
+ }
1481
+ _initTarget() {
1482
+ return utils.initStructAt(0, MessageTarget, this);
1483
+ }
1484
+ set target(value) {
1485
+ utils.copyFrom(value, utils.getPointer(0, this));
1486
+ }
1487
+ get context() {
1488
+ return utils.getAs(Disembargo_Context, this);
1489
+ }
1490
+ _initContext() {
1491
+ return utils.getAs(Disembargo_Context, this);
1492
+ }
1493
+ toString() {
1494
+ return "Disembargo_" + super.toString();
1495
+ }
1496
+ };
1497
+ /**
1498
+ * **(level 3)**
1499
+ *
1500
+ * Message type sent to indicate that the sender wishes to make a particular capability implemented
1501
+ * by the receiver available to a third party for direct access (without the need for the third
1502
+ * party to proxy through the sender).
1503
+ *
1504
+ * (In CapTP, `Provide` and `Accept` are methods of the global `NonceLocator` object exported by
1505
+ * every vat. In Cap'n Proto, we bake this into the core protocol.)
1506
+ *
1507
+ */
1508
+ var Provide = class extends Struct {
1509
+ static _capnp = {
1510
+ displayName: "Provide",
1511
+ id: "9c6a046bfbc1ac5a",
1512
+ size: new ObjectSize(8, 2)
1513
+ };
1514
+ /**
1515
+ * Question ID to be held open until the recipient has received the capability. A result will be
1516
+ * returned once the third party has successfully received the capability. The sender must at some
1517
+ * point send a `Finish` message as with any other call, and that message can be used to cancel the
1518
+ * whole operation.
1519
+ *
1520
+ */
1521
+ get questionId() {
1522
+ return utils.getUint32(0, this);
1523
+ }
1524
+ set questionId(value) {
1525
+ utils.setUint32(0, value, this);
1526
+ }
1527
+ _adoptTarget(value) {
1528
+ utils.adopt(value, utils.getPointer(0, this));
1529
+ }
1530
+ _disownTarget() {
1531
+ return utils.disown(this.target);
1532
+ }
1533
+ /**
1534
+ * What is to be provided to the third party.
1535
+ *
1536
+ */
1537
+ get target() {
1538
+ return utils.getStruct(0, MessageTarget, this);
1539
+ }
1540
+ _hasTarget() {
1541
+ return !utils.isNull(utils.getPointer(0, this));
1542
+ }
1543
+ _initTarget() {
1544
+ return utils.initStructAt(0, MessageTarget, this);
1545
+ }
1546
+ set target(value) {
1547
+ utils.copyFrom(value, utils.getPointer(0, this));
1548
+ }
1549
+ _adoptRecipient(value) {
1550
+ utils.adopt(value, utils.getPointer(1, this));
1551
+ }
1552
+ _disownRecipient() {
1553
+ return utils.disown(this.recipient);
1554
+ }
1555
+ /**
1556
+ * Identity of the third party that is expected to pick up the capability.
1557
+ *
1558
+ */
1559
+ get recipient() {
1560
+ return utils.getPointer(1, this);
1561
+ }
1562
+ _hasRecipient() {
1563
+ return !utils.isNull(utils.getPointer(1, this));
1564
+ }
1565
+ set recipient(value) {
1566
+ utils.copyFrom(value, utils.getPointer(1, this));
1567
+ }
1568
+ toString() {
1569
+ return "Provide_" + super.toString();
1570
+ }
1571
+ };
1572
+ /**
1573
+ * **(level 3)**
1574
+ *
1575
+ * Message type sent to pick up a capability hosted by the receiving vat and provided by a third
1576
+ * party. The third party previously designated the capability using `Provide`.
1577
+ *
1578
+ * This message is also used to pick up a redirected return -- see `Return.acceptFromThirdParty`.
1579
+ *
1580
+ */
1581
+ var Accept = class extends Struct {
1582
+ static _capnp = {
1583
+ displayName: "Accept",
1584
+ id: "d4c9b56290554016",
1585
+ size: new ObjectSize(8, 1)
1586
+ };
1587
+ /**
1588
+ * A new question ID identifying this accept message, which will eventually receive a Return
1589
+ * message containing the provided capability (or the call result in the case of a redirected
1590
+ * return).
1591
+ *
1592
+ */
1593
+ get questionId() {
1594
+ return utils.getUint32(0, this);
1595
+ }
1596
+ set questionId(value) {
1597
+ utils.setUint32(0, value, this);
1598
+ }
1599
+ _adoptProvision(value) {
1600
+ utils.adopt(value, utils.getPointer(0, this));
1601
+ }
1602
+ _disownProvision() {
1603
+ return utils.disown(this.provision);
1604
+ }
1605
+ /**
1606
+ * Identifies the provided object to be picked up.
1607
+ *
1608
+ */
1609
+ get provision() {
1610
+ return utils.getPointer(0, this);
1611
+ }
1612
+ _hasProvision() {
1613
+ return !utils.isNull(utils.getPointer(0, this));
1614
+ }
1615
+ set provision(value) {
1616
+ utils.copyFrom(value, utils.getPointer(0, this));
1617
+ }
1618
+ /**
1619
+ * If true, this accept shall be temporarily embargoed. The resulting `Return` will not be sent,
1620
+ * and any pipelined calls will not be delivered, until the embargo is released. The receiver
1621
+ * (the capability host) will expect the provider (the vat that sent the `Provide` message) to
1622
+ * eventually send a `Disembargo` message with the field `context.provide` set to the question ID
1623
+ * of the original `Provide` message. At that point, the embargo is released and the queued
1624
+ * messages are delivered.
1625
+ *
1626
+ * For example:
1627
+ * - Alice, in Vat A, holds a promise P, which currently points toward Vat B.
1628
+ * - Alice calls foo() on P. The `Call` message is sent to Vat B.
1629
+ * - The promise P in Vat B ends up resolving to Carol, in Vat C.
1630
+ * - Vat B sends a `Provide` message to Vat C, identifying Vat A as the recipient.
1631
+ * - Vat B sends a `Resolve` message to Vat A, indicating that the promise has resolved to a
1632
+ * `ThirdPartyCapId` identifying Carol in Vat C.
1633
+ * - Vat A sends an `Accept` message to Vat C to pick up the capability. Since Vat A knows that
1634
+ * it has an outstanding call to the promise, it sets `embargo` to `true` in the `Accept`
1635
+ * message.
1636
+ * - Vat A sends a `Disembargo` message to Vat B on promise P, with `context.accept` set.
1637
+ * - Alice makes a call bar() to promise P, which is now pointing towards Vat C. Alice doesn't
1638
+ * know anything about the mechanics of promise resolution happening under the hood, but she
1639
+ * expects that bar() will be delivered after foo() because that is the order in which she
1640
+ * initiated the calls.
1641
+ * - Vat A sends the bar() call to Vat C, as a pipelined call on the result of the `Accept` (which
1642
+ * hasn't returned yet, due to the embargo). Since calls to the newly-accepted capability
1643
+ * are embargoed, Vat C does not deliver the call yet.
1644
+ * - At some point, Vat B forwards the foo() call from the beginning of this example on to Vat C.
1645
+ * - Vat B forwards the `Disembargo` from Vat A on to vat C. It sets `context.provide` to the
1646
+ * question ID of the `Provide` message it had sent previously.
1647
+ * - Vat C receives foo() before `Disembargo`, thus allowing it to correctly deliver foo()
1648
+ * before delivering bar().
1649
+ * - Vat C receives `Disembargo` from Vat B. It can now send a `Return` for the `Accept` from
1650
+ * Vat A, as well as deliver bar().
1651
+ *
1652
+ */
1653
+ get embargo() {
1654
+ return utils.getBit(32, this);
1655
+ }
1656
+ set embargo(value) {
1657
+ utils.setBit(32, value, this);
1658
+ }
1659
+ toString() {
1660
+ return "Accept_" + super.toString();
1661
+ }
1662
+ };
1663
+ /**
1664
+ * **(level 4)**
1665
+ *
1666
+ * Message type sent to implement E.join(), which, given a number of capabilities that are
1667
+ * expected to be equivalent, finds the underlying object upon which they all agree and forms a
1668
+ * direct connection to it, skipping any proxies that may have been constructed by other vats
1669
+ * while transmitting the capability. See:
1670
+ * http://erights.org/elib/equality/index.html
1671
+ *
1672
+ * Note that this should only serve to bypass fully-transparent proxies -- proxies that were
1673
+ * created merely for convenience, without any intention of hiding the underlying object.
1674
+ *
1675
+ * For example, say Bob holds two capabilities hosted by Alice and Carol, but he expects that both
1676
+ * are simply proxies for a capability hosted elsewhere. He then issues a join request, which
1677
+ * operates as follows:
1678
+ * - Bob issues Join requests on both Alice and Carol. Each request contains a different piece
1679
+ * of the JoinKey.
1680
+ * - Alice is proxying a capability hosted by Dana, so forwards the request to Dana's cap.
1681
+ * - Dana receives the first request and sees that the JoinKeyPart is one of two. She notes that
1682
+ * she doesn't have the other part yet, so she records the request and responds with a
1683
+ * JoinResult.
1684
+ * - Alice relays the JoinAnswer back to Bob.
1685
+ * - Carol is also proxying a capability from Dana, and so forwards her Join request to Dana as
1686
+ * well.
1687
+ * - Dana receives Carol's request and notes that she now has both parts of a JoinKey. She
1688
+ * combines them in order to form information needed to form a secure connection to Bob. She
1689
+ * also responds with another JoinResult.
1690
+ * - Bob receives the responses from Alice and Carol. He uses the returned JoinResults to
1691
+ * determine how to connect to Dana and attempts to form the connection. Since Bob and Dana now
1692
+ * agree on a secret key that neither Alice nor Carol ever saw, this connection can be made
1693
+ * securely even if Alice or Carol is conspiring against the other. (If Alice and Carol are
1694
+ * conspiring _together_, they can obviously reproduce the key, but this doesn't matter because
1695
+ * the whole point of the join is to verify that Alice and Carol agree on what capability they
1696
+ * are proxying.)
1697
+ *
1698
+ * If the two capabilities aren't actually proxies of the same object, then the join requests
1699
+ * will come back with conflicting `hostId`s and the join will fail before attempting to form any
1700
+ * connection.
1701
+ *
1702
+ */
1703
+ var Join = class extends Struct {
1704
+ static _capnp = {
1705
+ displayName: "Join",
1706
+ id: "fbe1980490e001af",
1707
+ size: new ObjectSize(8, 2)
1708
+ };
1709
+ /**
1710
+ * Question ID used to respond to this Join. (Note that this ID only identifies one part of the
1711
+ * request for one hop; each part has a different ID and relayed copies of the request have
1712
+ * (probably) different IDs still.)
1713
+ *
1714
+ * The receiver will reply with a `Return` whose `results` is a JoinResult. This `JoinResult`
1715
+ * is relayed from the joined object's host, possibly with transformation applied as needed
1716
+ * by the network.
1717
+ *
1718
+ * Like any return, the result must be released using a `Finish`. However, this release
1719
+ * should not occur until the joiner has either successfully connected to the joined object.
1720
+ * Vats relaying a `Join` message similarly must not release the result they receive until the
1721
+ * return they relayed back towards the joiner has itself been released. This allows the
1722
+ * joined object's host to detect when the Join operation is canceled before completing -- if
1723
+ * it receives a `Finish` for one of the join results before the joiner successfully
1724
+ * connects. It can then free any resources it had allocated as part of the join.
1725
+ *
1726
+ */
1727
+ get questionId() {
1728
+ return utils.getUint32(0, this);
1729
+ }
1730
+ set questionId(value) {
1731
+ utils.setUint32(0, value, this);
1732
+ }
1733
+ _adoptTarget(value) {
1734
+ utils.adopt(value, utils.getPointer(0, this));
1735
+ }
1736
+ _disownTarget() {
1737
+ return utils.disown(this.target);
1738
+ }
1739
+ /**
1740
+ * The capability to join.
1741
+ *
1742
+ */
1743
+ get target() {
1744
+ return utils.getStruct(0, MessageTarget, this);
1745
+ }
1746
+ _hasTarget() {
1747
+ return !utils.isNull(utils.getPointer(0, this));
1748
+ }
1749
+ _initTarget() {
1750
+ return utils.initStructAt(0, MessageTarget, this);
1751
+ }
1752
+ set target(value) {
1753
+ utils.copyFrom(value, utils.getPointer(0, this));
1754
+ }
1755
+ _adoptKeyPart(value) {
1756
+ utils.adopt(value, utils.getPointer(1, this));
1757
+ }
1758
+ _disownKeyPart() {
1759
+ return utils.disown(this.keyPart);
1760
+ }
1761
+ /**
1762
+ * A part of the join key. These combine to form the complete join key, which is used to establish
1763
+ * a direct connection.
1764
+ *
1765
+ */
1766
+ get keyPart() {
1767
+ return utils.getPointer(1, this);
1768
+ }
1769
+ _hasKeyPart() {
1770
+ return !utils.isNull(utils.getPointer(1, this));
1771
+ }
1772
+ set keyPart(value) {
1773
+ utils.copyFrom(value, utils.getPointer(1, this));
1774
+ }
1775
+ toString() {
1776
+ return "Join_" + super.toString();
1777
+ }
1778
+ };
1779
+ const MessageTarget_Which = {
1780
+ IMPORTED_CAP: 0,
1781
+ PROMISED_ANSWER: 1
1782
+ };
1783
+ /**
1784
+ * The target of a `Call` or other messages that target a capability.
1785
+ *
1786
+ */
1787
+ var MessageTarget = class extends Struct {
1788
+ static IMPORTED_CAP = MessageTarget_Which.IMPORTED_CAP;
1789
+ static PROMISED_ANSWER = MessageTarget_Which.PROMISED_ANSWER;
1790
+ static _capnp = {
1791
+ displayName: "MessageTarget",
1792
+ id: "95bc14545813fbc1",
1793
+ size: new ObjectSize(8, 1)
1794
+ };
1795
+ /**
1796
+ * This message is to a capability or promise previously imported by the caller (exported by
1797
+ * the receiver).
1798
+ *
1799
+ */
1800
+ get importedCap() {
1801
+ utils.testWhich("importedCap", utils.getUint16(4, this), 0, this);
1802
+ return utils.getUint32(0, this);
1803
+ }
1804
+ get _isImportedCap() {
1805
+ return utils.getUint16(4, this) === 0;
1806
+ }
1807
+ set importedCap(value) {
1808
+ utils.setUint16(4, 0, this);
1809
+ utils.setUint32(0, value, this);
1810
+ }
1811
+ _adoptPromisedAnswer(value) {
1812
+ utils.setUint16(4, 1, this);
1813
+ utils.adopt(value, utils.getPointer(0, this));
1814
+ }
1815
+ _disownPromisedAnswer() {
1816
+ return utils.disown(this.promisedAnswer);
1817
+ }
1818
+ /**
1819
+ * This message is to a capability that is expected to be returned by another call that has not
1820
+ * yet been completed.
1821
+ *
1822
+ * At level 0, this is supported only for addressing the result of a previous `Bootstrap`, so
1823
+ * that initial startup doesn't require a round trip.
1824
+ *
1825
+ */
1826
+ get promisedAnswer() {
1827
+ utils.testWhich("promisedAnswer", utils.getUint16(4, this), 1, this);
1828
+ return utils.getStruct(0, PromisedAnswer, this);
1829
+ }
1830
+ _hasPromisedAnswer() {
1831
+ return !utils.isNull(utils.getPointer(0, this));
1832
+ }
1833
+ _initPromisedAnswer() {
1834
+ utils.setUint16(4, 1, this);
1835
+ return utils.initStructAt(0, PromisedAnswer, this);
1836
+ }
1837
+ get _isPromisedAnswer() {
1838
+ return utils.getUint16(4, this) === 1;
1839
+ }
1840
+ set promisedAnswer(value) {
1841
+ utils.setUint16(4, 1, this);
1842
+ utils.copyFrom(value, utils.getPointer(0, this));
1843
+ }
1844
+ toString() {
1845
+ return "MessageTarget_" + super.toString();
1846
+ }
1847
+ which() {
1848
+ return utils.getUint16(4, this);
1849
+ }
1850
+ };
1851
+ /**
1852
+ * Represents some data structure that might contain capabilities.
1853
+ *
1854
+ */
1855
+ var Payload = class Payload extends Struct {
1856
+ static _capnp = {
1857
+ displayName: "Payload",
1858
+ id: "9a0e61223d96743b",
1859
+ size: new ObjectSize(0, 2)
1860
+ };
1861
+ static _CapTable;
1862
+ _adoptContent(value) {
1863
+ utils.adopt(value, utils.getPointer(0, this));
1864
+ }
1865
+ _disownContent() {
1866
+ return utils.disown(this.content);
1867
+ }
1868
+ /**
1869
+ * Some Cap'n Proto data structure. Capability pointers embedded in this structure index into
1870
+ * `capTable`.
1871
+ *
1872
+ */
1873
+ get content() {
1874
+ return utils.getPointer(0, this);
1875
+ }
1876
+ _hasContent() {
1877
+ return !utils.isNull(utils.getPointer(0, this));
1878
+ }
1879
+ set content(value) {
1880
+ utils.copyFrom(value, utils.getPointer(0, this));
1881
+ }
1882
+ _adoptCapTable(value) {
1883
+ utils.adopt(value, utils.getPointer(1, this));
1884
+ }
1885
+ _disownCapTable() {
1886
+ return utils.disown(this.capTable);
1887
+ }
1888
+ /**
1889
+ * Descriptors corresponding to the cap pointers in `content`.
1890
+ *
1891
+ */
1892
+ get capTable() {
1893
+ return utils.getList(1, Payload._CapTable, this);
1894
+ }
1895
+ _hasCapTable() {
1896
+ return !utils.isNull(utils.getPointer(1, this));
1897
+ }
1898
+ _initCapTable(length) {
1899
+ return utils.initList(1, Payload._CapTable, length, this);
1900
+ }
1901
+ set capTable(value) {
1902
+ utils.copyFrom(value, utils.getPointer(1, this));
1903
+ }
1904
+ toString() {
1905
+ return "Payload_" + super.toString();
1906
+ }
1907
+ };
1908
+ const CapDescriptor_Which = {
1909
+ NONE: 0,
1910
+ SENDER_HOSTED: 1,
1911
+ SENDER_PROMISE: 2,
1912
+ RECEIVER_HOSTED: 3,
1913
+ RECEIVER_ANSWER: 4,
1914
+ THIRD_PARTY_HOSTED: 5
1915
+ };
1916
+ /**
1917
+ * **(level 1)**
1918
+ *
1919
+ * When an application-defined type contains an interface pointer, that pointer contains an index
1920
+ * into the message's capability table -- i.e. the `capTable` part of the `Payload`. Each
1921
+ * capability in the table is represented as a `CapDescriptor`. The runtime API should not reveal
1922
+ * the CapDescriptor directly to the application, but should instead wrap it in some kind of
1923
+ * callable object with methods corresponding to the interface that the capability implements.
1924
+ *
1925
+ * Keep in mind that `ExportIds` in a `CapDescriptor` are subject to reference counting. See the
1926
+ * description of `ExportId`.
1927
+ *
1928
+ * Note that it is currently not possible to include a broken capability in the CapDescriptor
1929
+ * table. Instead, create a new export (`senderPromise`) for each broken capability and then
1930
+ * immediately follow the payload-bearing Call or Return message with one Resolve message for each
1931
+ * broken capability, resolving it to an exception.
1932
+ *
1933
+ */
1934
+ var CapDescriptor = class CapDescriptor extends Struct {
1935
+ static NONE = CapDescriptor_Which.NONE;
1936
+ static SENDER_HOSTED = CapDescriptor_Which.SENDER_HOSTED;
1937
+ static SENDER_PROMISE = CapDescriptor_Which.SENDER_PROMISE;
1938
+ static RECEIVER_HOSTED = CapDescriptor_Which.RECEIVER_HOSTED;
1939
+ static RECEIVER_ANSWER = CapDescriptor_Which.RECEIVER_ANSWER;
1940
+ static THIRD_PARTY_HOSTED = CapDescriptor_Which.THIRD_PARTY_HOSTED;
1941
+ static _capnp = {
1942
+ displayName: "CapDescriptor",
1943
+ id: "8523ddc40b86b8b0",
1944
+ size: new ObjectSize(8, 1),
1945
+ defaultAttachedFd: getUint8Mask(255)
1946
+ };
1947
+ get _isNone() {
1948
+ return utils.getUint16(0, this) === 0;
1949
+ }
1950
+ set none(_) {
1951
+ utils.setUint16(0, 0, this);
1952
+ }
1953
+ /**
1954
+ * The ID of a capability in the sender's export table (receiver's import table). It may be a
1955
+ * newly allocated table entry, or an existing entry (increments the reference count).
1956
+ *
1957
+ */
1958
+ get senderHosted() {
1959
+ utils.testWhich("senderHosted", utils.getUint16(0, this), 1, this);
1960
+ return utils.getUint32(4, this);
1961
+ }
1962
+ get _isSenderHosted() {
1963
+ return utils.getUint16(0, this) === 1;
1964
+ }
1965
+ set senderHosted(value) {
1966
+ utils.setUint16(0, 1, this);
1967
+ utils.setUint32(4, value, this);
1968
+ }
1969
+ /**
1970
+ * A promise that the sender will resolve later. The sender will send exactly one Resolve
1971
+ * message at a future point in time to replace this promise. Note that even if the same
1972
+ * `senderPromise` is received multiple times, only one `Resolve` is sent to cover all of
1973
+ * them. If `senderPromise` is released before the `Resolve` is sent, the sender (of this
1974
+ * `CapDescriptor`) may choose not to send the `Resolve` at all.
1975
+ *
1976
+ */
1977
+ get senderPromise() {
1978
+ utils.testWhich("senderPromise", utils.getUint16(0, this), 2, this);
1979
+ return utils.getUint32(4, this);
1980
+ }
1981
+ get _isSenderPromise() {
1982
+ return utils.getUint16(0, this) === 2;
1983
+ }
1984
+ set senderPromise(value) {
1985
+ utils.setUint16(0, 2, this);
1986
+ utils.setUint32(4, value, this);
1987
+ }
1988
+ /**
1989
+ * A capability (or promise) previously exported by the receiver (imported by the sender).
1990
+ *
1991
+ */
1992
+ get receiverHosted() {
1993
+ utils.testWhich("receiverHosted", utils.getUint16(0, this), 3, this);
1994
+ return utils.getUint32(4, this);
1995
+ }
1996
+ get _isReceiverHosted() {
1997
+ return utils.getUint16(0, this) === 3;
1998
+ }
1999
+ set receiverHosted(value) {
2000
+ utils.setUint16(0, 3, this);
2001
+ utils.setUint32(4, value, this);
2002
+ }
2003
+ _adoptReceiverAnswer(value) {
2004
+ utils.setUint16(0, 4, this);
2005
+ utils.adopt(value, utils.getPointer(0, this));
2006
+ }
2007
+ _disownReceiverAnswer() {
2008
+ return utils.disown(this.receiverAnswer);
2009
+ }
2010
+ /**
2011
+ * A capability expected to be returned in the results of a currently-outstanding call posed
2012
+ * by the sender.
2013
+ *
2014
+ */
2015
+ get receiverAnswer() {
2016
+ utils.testWhich("receiverAnswer", utils.getUint16(0, this), 4, this);
2017
+ return utils.getStruct(0, PromisedAnswer, this);
2018
+ }
2019
+ _hasReceiverAnswer() {
2020
+ return !utils.isNull(utils.getPointer(0, this));
2021
+ }
2022
+ _initReceiverAnswer() {
2023
+ utils.setUint16(0, 4, this);
2024
+ return utils.initStructAt(0, PromisedAnswer, this);
2025
+ }
2026
+ get _isReceiverAnswer() {
2027
+ return utils.getUint16(0, this) === 4;
2028
+ }
2029
+ set receiverAnswer(value) {
2030
+ utils.setUint16(0, 4, this);
2031
+ utils.copyFrom(value, utils.getPointer(0, this));
2032
+ }
2033
+ _adoptThirdPartyHosted(value) {
2034
+ utils.setUint16(0, 5, this);
2035
+ utils.adopt(value, utils.getPointer(0, this));
2036
+ }
2037
+ _disownThirdPartyHosted() {
2038
+ return utils.disown(this.thirdPartyHosted);
2039
+ }
2040
+ /**
2041
+ * **(level 3)**
2042
+ *
2043
+ * A capability that lives in neither the sender's nor the receiver's vat. The sender needs
2044
+ * to form a direct connection to a third party to pick up the capability.
2045
+ *
2046
+ * Level 1 and 2 implementations that receive a `thirdPartyHosted` may simply send calls to its
2047
+ * `vine` instead.
2048
+ *
2049
+ */
2050
+ get thirdPartyHosted() {
2051
+ utils.testWhich("thirdPartyHosted", utils.getUint16(0, this), 5, this);
2052
+ return utils.getStruct(0, ThirdPartyCapDescriptor, this);
2053
+ }
2054
+ _hasThirdPartyHosted() {
2055
+ return !utils.isNull(utils.getPointer(0, this));
2056
+ }
2057
+ _initThirdPartyHosted() {
2058
+ utils.setUint16(0, 5, this);
2059
+ return utils.initStructAt(0, ThirdPartyCapDescriptor, this);
2060
+ }
2061
+ get _isThirdPartyHosted() {
2062
+ return utils.getUint16(0, this) === 5;
2063
+ }
2064
+ set thirdPartyHosted(value) {
2065
+ utils.setUint16(0, 5, this);
2066
+ utils.copyFrom(value, utils.getPointer(0, this));
2067
+ }
2068
+ /**
2069
+ * If the RPC message in which this CapDescriptor was delivered also had file descriptors
2070
+ * attached, and `fd` is a valid index into the list of attached file descriptors, then
2071
+ * that file descriptor should be attached to this capability. If `attachedFd` is out-of-bounds
2072
+ * for said list, then no FD is attached.
2073
+ *
2074
+ * For example, if the RPC message arrived over a Unix socket, then file descriptors may be
2075
+ * attached by sending an SCM_RIGHTS ancillary message attached to the data bytes making up the
2076
+ * raw message. Receivers who wish to opt into FD passing should arrange to receive SCM_RIGHTS
2077
+ * whenever receiving an RPC message. Senders who wish to send FDs need not verify whether the
2078
+ * receiver knows how to receive them, because the operating system will automatically discard
2079
+ * ancillary messages like SCM_RIGHTS if the receiver doesn't ask to receive them, including
2080
+ * automatically closing any FDs.
2081
+ *
2082
+ * It is up to the application protocol to define what capabilities are expected to have file
2083
+ * descriptors attached, and what those FDs mean. But, for example, an application could use this
2084
+ * to open a file on disk and then transmit the open file descriptor to a sandboxed process that
2085
+ * does not otherwise have permission to access the filesystem directly. This is usually an
2086
+ * optimization: the sending process could instead provide an RPC interface supporting all the
2087
+ * operations needed (such as reading and writing a file), but by passing the file descriptor
2088
+ * directly, the recipient can often perform operations much more efficiently. Application
2089
+ * designers are encouraged to provide such RPC interfaces and automatically fall back to them
2090
+ * when FD passing is not available, so that the application can still work when the parties are
2091
+ * remote over a network.
2092
+ *
2093
+ * An attached FD is most often associated with a `senderHosted` descriptor. It could also make
2094
+ * sense in the case of `thirdPartyHosted`: in this case, the sender is forwarding the FD that
2095
+ * they received from the third party, so that the receiver can start using it without first
2096
+ * interacting with the third party. This is an optional optimization -- the middleman may choose
2097
+ * not to forward capabilities, in which case the receiver will need to complete the handshake
2098
+ * with the third party directly before receiving the FD. If an implementation receives a second
2099
+ * attached FD after having already received one previously (e.g. both in a `thirdPartyHosted`
2100
+ * CapDescriptor and then later again when receiving the final capability directly from the
2101
+ * third party), the implementation should discard the later FD and stick with the original. At
2102
+ * present, there is no known reason why other capability types (e.g. `receiverHosted`) would want
2103
+ * to carry an attached FD, but we reserve the right to define a meaning for this in the future.
2104
+ *
2105
+ * Each file descriptor attached to the message must be used in no more than one CapDescriptor,
2106
+ * so that the receiver does not need to use dup() or refcounting to handle the possibility of
2107
+ * multiple capabilities using the same descriptor. If multiple CapDescriptors do point to the
2108
+ * same FD index, then the receiver can arbitrarily choose which capability ends up having the
2109
+ * FD attached.
2110
+ *
2111
+ * To mitigate DoS attacks, RPC implementations should limit the number of FDs they are willing to
2112
+ * receive in a single message to a small value. If a message happens to contain more than that,
2113
+ * the list is truncated. Moreover, in some cases, FD passing needs to be blocked entirely for
2114
+ * security or implementation reasons, in which case the list may be truncated to zero. Hence,
2115
+ * `attachedFd` might point past the end of the list, which the implementation should treat as if
2116
+ * no FD was attached at all.
2117
+ *
2118
+ * The type of this field was chosen to be UInt8 because Linux supports sending only a maximum
2119
+ * of 253 file descriptors in an SCM_RIGHTS message anyway, and CapDescriptor had two bytes of
2120
+ * padding left -- so after adding this, there is still one byte for a future feature.
2121
+ * Conveniently, this also means we're able to use 0xff as the default value, which will always
2122
+ * be out-of-range (of course, the implementation should explicitly enforce that 255 descriptors
2123
+ * cannot be sent at once, rather than relying on Linux to do so).
2124
+ *
2125
+ */
2126
+ get attachedFd() {
2127
+ return utils.getUint8(2, this, CapDescriptor._capnp.defaultAttachedFd);
2128
+ }
2129
+ set attachedFd(value) {
2130
+ utils.setUint8(2, value, this, CapDescriptor._capnp.defaultAttachedFd);
2131
+ }
2132
+ toString() {
2133
+ return "CapDescriptor_" + super.toString();
2134
+ }
2135
+ which() {
2136
+ return utils.getUint16(0, this);
2137
+ }
2138
+ };
2139
+ const PromisedAnswer_Op_Which = {
2140
+ NOOP: 0,
2141
+ GET_POINTER_FIELD: 1
2142
+ };
2143
+ var PromisedAnswer_Op = class extends Struct {
2144
+ static NOOP = PromisedAnswer_Op_Which.NOOP;
2145
+ static GET_POINTER_FIELD = PromisedAnswer_Op_Which.GET_POINTER_FIELD;
2146
+ static _capnp = {
2147
+ displayName: "Op",
2148
+ id: "f316944415569081",
2149
+ size: new ObjectSize(8, 0)
2150
+ };
2151
+ get _isNoop() {
2152
+ return utils.getUint16(0, this) === 0;
2153
+ }
2154
+ set noop(_) {
2155
+ utils.setUint16(0, 0, this);
2156
+ }
2157
+ /**
2158
+ * Get a pointer field within a struct. The number is an index into the pointer section, NOT
2159
+ * a field ordinal, so that the receiver does not need to understand the schema.
2160
+ *
2161
+ */
2162
+ get getPointerField() {
2163
+ utils.testWhich("getPointerField", utils.getUint16(0, this), 1, this);
2164
+ return utils.getUint16(2, this);
2165
+ }
2166
+ get _isGetPointerField() {
2167
+ return utils.getUint16(0, this) === 1;
2168
+ }
2169
+ set getPointerField(value) {
2170
+ utils.setUint16(0, 1, this);
2171
+ utils.setUint16(2, value, this);
2172
+ }
2173
+ toString() {
2174
+ return "PromisedAnswer_Op_" + super.toString();
2175
+ }
2176
+ which() {
2177
+ return utils.getUint16(0, this);
2178
+ }
2179
+ };
2180
+ /**
2181
+ * **(mostly level 1)**
2182
+ *
2183
+ * Specifies how to derive a promise from an unanswered question, by specifying the path of fields
2184
+ * to follow from the root of the eventual result struct to get to the desired capability. Used
2185
+ * to address method calls to a not-yet-returned capability or to pass such a capability as an
2186
+ * input to some other method call.
2187
+ *
2188
+ * Level 0 implementations must support `PromisedAnswer` only for the case where the answer is
2189
+ * to a `Bootstrap` message. In this case, `path` is always empty since `Bootstrap` always returns
2190
+ * a raw capability.
2191
+ *
2192
+ */
2193
+ var PromisedAnswer = class PromisedAnswer extends Struct {
2194
+ static Op = PromisedAnswer_Op;
2195
+ static _capnp = {
2196
+ displayName: "PromisedAnswer",
2197
+ id: "d800b1d6cd6f1ca0",
2198
+ size: new ObjectSize(8, 1)
2199
+ };
2200
+ static _Transform;
2201
+ /**
2202
+ * ID of the question (in the sender's question table / receiver's answer table) whose answer is
2203
+ * expected to contain the capability.
2204
+ *
2205
+ */
2206
+ get questionId() {
2207
+ return utils.getUint32(0, this);
2208
+ }
2209
+ set questionId(value) {
2210
+ utils.setUint32(0, value, this);
2211
+ }
2212
+ _adoptTransform(value) {
2213
+ utils.adopt(value, utils.getPointer(0, this));
2214
+ }
2215
+ _disownTransform() {
2216
+ return utils.disown(this.transform);
2217
+ }
2218
+ /**
2219
+ * Operations / transformations to apply to the result in order to get the capability actually
2220
+ * being addressed. E.g. if the result is a struct and you want to call a method on a capability
2221
+ * pointed to by a field of the struct, you need a `getPointerField` op.
2222
+ *
2223
+ */
2224
+ get transform() {
2225
+ return utils.getList(0, PromisedAnswer._Transform, this);
2226
+ }
2227
+ _hasTransform() {
2228
+ return !utils.isNull(utils.getPointer(0, this));
2229
+ }
2230
+ _initTransform(length) {
2231
+ return utils.initList(0, PromisedAnswer._Transform, length, this);
2232
+ }
2233
+ set transform(value) {
2234
+ utils.copyFrom(value, utils.getPointer(0, this));
2235
+ }
2236
+ toString() {
2237
+ return "PromisedAnswer_" + super.toString();
2238
+ }
2239
+ };
2240
+ /**
2241
+ * **(level 3)**
2242
+ *
2243
+ * Identifies a capability in a third-party vat that the sender wants the receiver to pick up.
2244
+ *
2245
+ */
2246
+ var ThirdPartyCapDescriptor = class extends Struct {
2247
+ static _capnp = {
2248
+ displayName: "ThirdPartyCapDescriptor",
2249
+ id: "d37007fde1f0027d",
2250
+ size: new ObjectSize(8, 1)
2251
+ };
2252
+ _adoptId(value) {
2253
+ utils.adopt(value, utils.getPointer(0, this));
2254
+ }
2255
+ _disownId() {
2256
+ return utils.disown(this.id);
2257
+ }
2258
+ /**
2259
+ * Identifies the third-party host and the specific capability to accept from it.
2260
+ *
2261
+ */
2262
+ get id() {
2263
+ return utils.getPointer(0, this);
2264
+ }
2265
+ _hasId() {
2266
+ return !utils.isNull(utils.getPointer(0, this));
2267
+ }
2268
+ set id(value) {
2269
+ utils.copyFrom(value, utils.getPointer(0, this));
2270
+ }
2271
+ /**
2272
+ * A proxy for the third-party object exported by the sender. In CapTP terminology this is called
2273
+ * a "vine", because it is an indirect reference to the third-party object that snakes through the
2274
+ * sender vat. This serves two purposes:
2275
+ *
2276
+ * * Level 1 and 2 implementations that don't understand how to connect to a third party may
2277
+ * simply send calls to the vine. Such calls will be forwarded to the third-party by the
2278
+ * sender.
2279
+ *
2280
+ * * Level 3 implementations must release the vine only once they have successfully picked up the
2281
+ * object from the third party. This ensures that the capability is not released by the sender
2282
+ * prematurely.
2283
+ *
2284
+ * The sender will close the `Provide` request that it has sent to the third party as soon as
2285
+ * it receives either a `Call` or a `Release` message directed at the vine.
2286
+ *
2287
+ */
2288
+ get vineId() {
2289
+ return utils.getUint32(0, this);
2290
+ }
2291
+ set vineId(value) {
2292
+ utils.setUint32(0, value, this);
2293
+ }
2294
+ toString() {
2295
+ return "ThirdPartyCapDescriptor_" + super.toString();
2296
+ }
2297
+ };
2298
+ const Exception_Type = {
2299
+ FAILED: 0,
2300
+ OVERLOADED: 1,
2301
+ DISCONNECTED: 2,
2302
+ UNIMPLEMENTED: 3
2303
+ };
2304
+ /**
2305
+ * **(level 0)**
2306
+ *
2307
+ * Describes an arbitrary error that prevented an operation (e.g. a call) from completing.
2308
+ *
2309
+ * Cap'n Proto exceptions always indicate that something went wrong. In other words, in a fantasy
2310
+ * world where everything always works as expected, no exceptions would ever be thrown. Clients
2311
+ * should only ever catch exceptions as a means to implement fault-tolerance, where "fault" can
2312
+ * mean:
2313
+ * - Bugs.
2314
+ * - Invalid input.
2315
+ * - Configuration errors.
2316
+ * - Network problems.
2317
+ * - Insufficient resources.
2318
+ * - Version skew (unimplemented functionality).
2319
+ * - Other logistical problems.
2320
+ *
2321
+ * Exceptions should NOT be used to flag application-specific conditions that a client is expected
2322
+ * to handle in an application-specific way. Put another way, in the Cap'n Proto world,
2323
+ * "checked exceptions" (where an interface explicitly defines the exceptions it throws and
2324
+ * clients are forced by the type system to handle those exceptions) do NOT make sense.
2325
+ *
2326
+ */
2327
+ var Exception = class extends Struct {
2328
+ static Type = Exception_Type;
2329
+ static _capnp = {
2330
+ displayName: "Exception",
2331
+ id: "d625b7063acf691a",
2332
+ size: new ObjectSize(8, 2)
2333
+ };
2334
+ /**
2335
+ * Human-readable failure description.
2336
+ *
2337
+ */
2338
+ get reason() {
2339
+ return utils.getText(0, this);
2340
+ }
2341
+ set reason(value) {
2342
+ utils.setText(0, value, this);
2343
+ }
2344
+ /**
2345
+ * The type of the error. The purpose of this enum is not to describe the error itself, but
2346
+ * rather to describe how the client might want to respond to the error.
2347
+ *
2348
+ */
2349
+ get type() {
2350
+ return utils.getUint16(4, this);
2351
+ }
2352
+ set type(value) {
2353
+ utils.setUint16(4, value, this);
2354
+ }
2355
+ /**
2356
+ * OBSOLETE. Ignore.
2357
+ *
2358
+ */
2359
+ get obsoleteIsCallersFault() {
2360
+ return utils.getBit(0, this);
2361
+ }
2362
+ set obsoleteIsCallersFault(value) {
2363
+ utils.setBit(0, value, this);
2364
+ }
2365
+ /**
2366
+ * OBSOLETE. See `type` instead.
2367
+ *
2368
+ */
2369
+ get obsoleteDurability() {
2370
+ return utils.getUint16(2, this);
2371
+ }
2372
+ set obsoleteDurability(value) {
2373
+ utils.setUint16(2, value, this);
2374
+ }
2375
+ /**
2376
+ * Stack trace text from the remote server. The format is not specified. By default,
2377
+ * implementations do not provide stack traces; the application must explicitly enable them
2378
+ * when desired.
2379
+ *
2380
+ */
2381
+ get trace() {
2382
+ return utils.getText(1, this);
2383
+ }
2384
+ set trace(value) {
2385
+ utils.setText(1, value, this);
2386
+ }
2387
+ toString() {
2388
+ return "Exception_" + super.toString();
2389
+ }
2390
+ };
2391
+ Payload._CapTable = CompositeList(CapDescriptor);
2392
+ PromisedAnswer._Transform = CompositeList(PromisedAnswer_Op);
2393
+
2394
+ //#endregion
2395
+ export { Accept, Bootstrap, Call, Call_SendResultsTo, Call_SendResultsTo_Which, CapDescriptor, CapDescriptor_Which, Disembargo, Disembargo_Context, Disembargo_Context_Which, Exception, Exception_Type, Finish, Join, Message, MessageTarget, MessageTarget_Which, Message_Which, Payload, PromisedAnswer, PromisedAnswer_Op, PromisedAnswer_Op_Which, Provide, Release, Resolve, Resolve_Which, Return, Return_Which, ThirdPartyCapDescriptor, _capnpFileId };
2
2396
  //# sourceMappingURL=rpc.mjs.map