@floegence/flowersec-core 6.1.0 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (712) hide show
  1. package/README.md +101 -170
  2. package/THIRD_PARTY_NOTICES.md +7 -3072
  3. package/dist/browser/connectSessionV3.d.ts +44 -0
  4. package/dist/browser/connectSessionV3.js +261 -0
  5. package/dist/browser/directWebSocketProfileV1.d.ts +14 -0
  6. package/dist/browser/directWebSocketProfileV1.js +71 -0
  7. package/dist/browser/httpDirectV1.d.ts +30 -0
  8. package/dist/browser/httpDirectV1.js +52 -0
  9. package/dist/browser/index.d.ts +10 -15
  10. package/dist/browser/index.js +4 -5
  11. package/dist/browser/privateLoopbackV1.d.ts +30 -0
  12. package/dist/browser/privateLoopbackV1.js +70 -0
  13. package/dist/cli.d.ts +1 -24
  14. package/dist/cli.js +129 -91
  15. package/dist/cliSpendMarker.js +8 -0
  16. package/dist/defaults.d.ts +23 -1
  17. package/dist/defaults.js +23 -1
  18. package/dist/facade.d.ts +21 -104
  19. package/dist/facade.js +8 -45
  20. package/dist/framing/jsonframe.d.ts +21 -0
  21. package/dist/framing/jsonframe.js +107 -0
  22. package/dist/node/acceptor.d.ts +1 -0
  23. package/dist/node/acceptor.js +1 -0
  24. package/dist/node/acceptorV3.d.ts +70 -0
  25. package/dist/node/acceptorV3.js +295 -0
  26. package/dist/node/byteStreamDuplex.d.ts +4 -0
  27. package/dist/node/byteStreamDuplex.js +69 -0
  28. package/dist/node/connectSessionV3.d.ts +33 -0
  29. package/dist/node/connectSessionV3.js +93 -0
  30. package/dist/node/connectionPath.d.ts +0 -2
  31. package/dist/node/connectionPath.js +0 -18
  32. package/dist/node/index.d.ts +16 -52
  33. package/dist/node/index.js +6 -24
  34. package/dist/node/listenerIngress.d.ts +5 -0
  35. package/dist/node/listenerIngress.js +12 -0
  36. package/dist/node/nativeTransportAddon.d.ts +142 -0
  37. package/dist/node/nativeTransportAddon.js +235 -0
  38. package/dist/node/proxyServer.d.ts +4 -30
  39. package/dist/node/proxyServer.js +169 -600
  40. package/dist/node/rawQuicAdapterV3.d.ts +11 -0
  41. package/dist/node/rawQuicAdapterV3.js +83 -0
  42. package/dist/node/rawQuicServerV3.d.ts +34 -0
  43. package/dist/node/rawQuicServerV3.js +60 -0
  44. package/dist/node/runtimeAuthorizationV3.d.ts +41 -0
  45. package/dist/node/runtimeAuthorizationV3.js +156 -0
  46. package/dist/node/tunnelRuntimeV3.d.ts +60 -0
  47. package/dist/node/tunnelRuntimeV3.js +837 -0
  48. package/dist/node/webSocketServerV3.d.ts +28 -0
  49. package/dist/node/webSocketServerV3.js +220 -0
  50. package/dist/proxy/fetch.d.ts +2 -3
  51. package/dist/proxy/fetch.js +29 -96
  52. package/dist/proxy/index.d.ts +1 -5
  53. package/dist/proxy/index.js +0 -2
  54. package/dist/proxy/integration.d.ts +8 -12
  55. package/dist/proxy/integration.js +16 -23
  56. package/dist/proxy/policy.d.ts +0 -5
  57. package/dist/proxy/policy.js +22 -60
  58. package/dist/proxy/runtime.d.ts +1 -3
  59. package/dist/proxy/runtime.js +186 -404
  60. package/dist/proxy/scope.js +2 -2
  61. package/dist/proxy/serviceWorker.d.ts +0 -3
  62. package/dist/proxy/serviceWorker.js +176 -634
  63. package/dist/proxy/serviceWorkerRuntime.js +1 -26
  64. package/dist/proxy/stream.d.ts +6 -17
  65. package/dist/proxy/stream.js +40 -9
  66. package/dist/proxy/types.d.ts +11 -50
  67. package/dist/proxy/windowBridge.d.ts +3 -11
  68. package/dist/proxy/windowBridge.js +31 -70
  69. package/dist/proxy/wsPatch.js +26 -34
  70. package/dist/public/contract.d.ts +74 -1
  71. package/dist/public/contract.js +8 -0
  72. package/dist/public/sessionHandlers.d.ts +47 -0
  73. package/dist/public/sessionHandlers.js +151 -0
  74. package/dist/public/streamHandlers.d.ts +20 -0
  75. package/dist/public/streamHandlers.js +127 -0
  76. package/dist/public/streamMetadata.d.ts +2 -34
  77. package/dist/public/streamMetadata.js +13 -206
  78. package/dist/rpc/client.d.ts +34 -0
  79. package/dist/rpc/client.js +244 -0
  80. package/dist/rpc/server.d.ts +59 -0
  81. package/dist/rpc/server.js +255 -0
  82. package/dist/rpc/validate.d.ts +4 -0
  83. package/dist/{application/rpcJSON.js → rpc/validate.js} +1 -1
  84. package/dist/rpc/wire.d.ts +15 -0
  85. package/dist/v3/admissionError.d.ts +4 -0
  86. package/dist/v3/admissionError.js +8 -0
  87. package/dist/v3/artifact.d.ts +145 -0
  88. package/dist/v3/artifact.js +1180 -0
  89. package/dist/v3/artifactLease.d.ts +19 -0
  90. package/dist/v3/artifactLease.js +128 -0
  91. package/dist/v3/browserRuntime.d.ts +37 -0
  92. package/dist/v3/browserRuntime.js +197 -0
  93. package/dist/v3/browserSessionRuntime.d.ts +2 -0
  94. package/dist/v3/browserSessionRuntime.js +21 -0
  95. package/dist/v3/capability.d.ts +32 -0
  96. package/dist/v3/capability.js +345 -0
  97. package/dist/v3/carrier.d.ts +86 -0
  98. package/dist/v3/carrier.js +414 -0
  99. package/dist/v3/connectionController.d.ts +101 -0
  100. package/dist/v3/connectionController.js +888 -0
  101. package/dist/v3/contract.d.ts +70 -0
  102. package/dist/v3/contract.js +3 -0
  103. package/dist/v3/controller.d.ts +45 -0
  104. package/dist/v3/controller.js +316 -0
  105. package/dist/v3/handshake.d.ts +81 -0
  106. package/dist/v3/handshake.js +471 -0
  107. package/dist/v3/jcs.d.ts +6 -0
  108. package/dist/v3/jcs.js +69 -0
  109. package/dist/v3/jsonPreflight.d.ts +1 -0
  110. package/dist/v3/jsonPreflight.js +251 -0
  111. package/dist/v3/nodeRuntime.d.ts +43 -0
  112. package/dist/v3/nodeRuntime.js +437 -0
  113. package/dist/v3/nodeSessionRuntime.d.ts +2 -0
  114. package/dist/v3/nodeSessionRuntime.js +13 -0
  115. package/dist/v3/protocol.d.ts +100 -0
  116. package/dist/v3/protocol.js +715 -0
  117. package/dist/v3/publicApi.d.ts +12 -0
  118. package/dist/v3/publicApi.js +46 -0
  119. package/dist/v3/publicSession.js +316 -0
  120. package/dist/v3/runtimeAdapters.d.ts +9 -0
  121. package/dist/v3/runtimeAdapters.js +109 -0
  122. package/dist/v3/security.d.ts +36 -0
  123. package/dist/v3/security.js +113 -0
  124. package/dist/v3/serverAdmission.d.ts +42 -0
  125. package/dist/v3/serverAdmission.js +242 -0
  126. package/dist/v3/session.d.ts +339 -0
  127. package/dist/v3/session.js +2399 -0
  128. package/dist/v3/sessionConnector.d.ts +46 -0
  129. package/dist/v3/sessionConnector.js +534 -0
  130. package/dist/v3/streamLifetimeLedger.d.ts +32 -0
  131. package/dist/v3/streamLifetimeLedger.js +146 -0
  132. package/dist/v3/streamMetadata.js +7 -0
  133. package/dist/v3/transportConstants.d.ts +56 -0
  134. package/dist/v3/transportConstants.js +59 -0
  135. package/dist/v3/tunnelIngress.d.ts +8 -0
  136. package/dist/v3/tunnelIngress.js +21 -0
  137. package/dist/v3/unreliableMessage.d.ts +44 -0
  138. package/dist/v3/unreliableMessage.js +287 -0
  139. package/dist/v3/webSocketCarrier.d.ts +33 -0
  140. package/dist/v3/webSocketCarrier.js +380 -0
  141. package/dist/v3/webTransportCarrier.d.ts +27 -0
  142. package/dist/v3/webTransportCarrier.js +580 -0
  143. package/dist/ws-client/binaryTransport.d.ts +65 -0
  144. package/dist/ws-client/binaryTransport.js +348 -0
  145. package/dist/yamux/byteReader.d.ts +13 -0
  146. package/dist/yamux/byteReader.js +81 -0
  147. package/dist/yamux/constants.d.ts +10 -0
  148. package/dist/yamux/constants.js +14 -0
  149. package/dist/yamux/errors.d.ts +15 -0
  150. package/dist/yamux/errors.js +34 -0
  151. package/dist/yamux/header.d.ts +20 -0
  152. package/dist/yamux/header.js +30 -0
  153. package/dist/yamux/session.d.ts +81 -0
  154. package/dist/yamux/session.js +401 -0
  155. package/dist/yamux/stream.d.ts +42 -0
  156. package/dist/yamux/stream.js +307 -0
  157. package/package.json +20 -19
  158. package/sbom/cyclonedx.json +43 -761
  159. package/sbom/spdx.json +49 -566
  160. package/dist/application/rpcJSON.d.ts +0 -15
  161. package/dist/browser/clientV4.d.ts +0 -61
  162. package/dist/browser/clientV4.js +0 -179
  163. package/dist/browser/indexedDBPoolV4.d.ts +0 -101
  164. package/dist/browser/indexedDBPoolV4.js +0 -634
  165. package/dist/browser/liveHTTPSV4.d.ts +0 -35
  166. package/dist/browser/liveHTTPSV4.js +0 -162
  167. package/dist/browser/localBrowserBridge.d.ts +0 -20
  168. package/dist/browser/localBrowserBridge.js +0 -82
  169. package/dist/browser/poolServerAllow.d.ts +0 -21
  170. package/dist/browser/poolServerAllow.js +0 -151
  171. package/dist/browser/webTransportPositionsV4.d.ts +0 -16
  172. package/dist/browser/webTransportPositionsV4.js +0 -75
  173. package/dist/browser/webTransportStreamV4.d.ts +0 -36
  174. package/dist/browser/webTransportStreamV4.js +0 -370
  175. package/dist/browser/webTransportV4.d.ts +0 -126
  176. package/dist/browser/webTransportV4.js +0 -627
  177. package/dist/browser/wssV4.d.ts +0 -69
  178. package/dist/browser/wssV4.js +0 -339
  179. package/dist/generated/brotliWorker.d.ts +0 -1
  180. package/dist/generated/brotliWorker.js +0 -3
  181. package/dist/generated/idna151.d.ts +0 -2
  182. package/dist/generated/idna151.js +0 -38
  183. package/dist/generated/normalization151.d.ts +0 -5
  184. package/dist/generated/normalization151.js +0 -878
  185. package/dist/generated/sqliteWorkers.d.ts +0 -2
  186. package/dist/generated/sqliteWorkers.js +0 -3
  187. package/dist/generated/transportV4APIResults.d.ts +0 -145
  188. package/dist/generated/transportV4APIResults.js +0 -52
  189. package/dist/generated/transportV4Registry.d.ts +0 -3758
  190. package/dist/generated/transportV4Registry.js +0 -29
  191. package/dist/interop/browserRunner.d.ts +0 -72
  192. package/dist/interop/browserRunner.js +0 -354
  193. package/dist/interop/currentClock.d.ts +0 -3
  194. package/dist/interop/currentClock.js +0 -39
  195. package/dist/interop/currentContracts.d.ts +0 -6
  196. package/dist/interop/currentContracts.js +0 -14
  197. package/dist/interop/currentNativeTunnel.d.ts +0 -31
  198. package/dist/interop/currentNativeTunnel.js +0 -185
  199. package/dist/interop/currentParity.d.ts +0 -68
  200. package/dist/interop/currentParity.js +0 -392
  201. package/dist/interop/currentPeer.d.ts +0 -252
  202. package/dist/interop/currentPeer.js +0 -677
  203. package/dist/interop/currentRegisteredTunnelPeer.d.ts +0 -37
  204. package/dist/interop/currentRegisteredTunnelPeer.js +0 -93
  205. package/dist/interop/currentRelayPeer.d.ts +0 -131
  206. package/dist/interop/currentRelayPeer.js +0 -263
  207. package/dist/interop/currentServer.d.ts +0 -44
  208. package/dist/interop/currentServer.js +0 -299
  209. package/dist/interop/currentTLSPin.d.ts +0 -9
  210. package/dist/interop/currentTLSPin.js +0 -44
  211. package/dist/interop/currentTunnelMaterial.d.ts +0 -34
  212. package/dist/interop/currentTunnelMaterial.js +0 -100
  213. package/dist/interop/httpApplicationPeer.d.ts +0 -15
  214. package/dist/interop/httpApplicationPeer.js +0 -167
  215. package/dist/interop/invalidProofPeer.d.ts +0 -8
  216. package/dist/interop/invalidProofPeer.js +0 -106
  217. package/dist/interop/proxyServerPeer.js +0 -49
  218. package/dist/interop/serverParityPeer.d.ts +0 -101
  219. package/dist/interop/serverParityPeer.js +0 -609
  220. package/dist/node/acceptorCurrent.d.ts +0 -55
  221. package/dist/node/acceptorCurrent.js +0 -286
  222. package/dist/node/admissionRecord.d.ts +0 -23
  223. package/dist/node/admissionRecord.js +0 -178
  224. package/dist/node/clientV4.d.ts +0 -59
  225. package/dist/node/clientV4.js +0 -197
  226. package/dist/node/endpointDialer.d.ts +0 -70
  227. package/dist/node/endpointDialer.js +0 -231
  228. package/dist/node/endpointListener.d.ts +0 -48
  229. package/dist/node/endpointListener.js +0 -403
  230. package/dist/node/endpointTransport.d.ts +0 -7
  231. package/dist/node/endpointTransport.js +0 -18
  232. package/dist/node/grantIssuerCurrent.d.ts +0 -64
  233. package/dist/node/grantIssuerCurrent.js +0 -355
  234. package/dist/node/liveHTTPSV4.d.ts +0 -28
  235. package/dist/node/liveHTTPSV4.js +0 -298
  236. package/dist/node/liveTunnelAuthorityCurrent.d.ts +0 -153
  237. package/dist/node/liveTunnelAuthorityCurrent.js +0 -590
  238. package/dist/node/nativeDuplexBridgeV4.d.ts +0 -41
  239. package/dist/node/nativeDuplexBridgeV4.js +0 -494
  240. package/dist/node/nativeTransportCurrent.d.ts +0 -196
  241. package/dist/node/nativeTransportCurrent.js +0 -37
  242. package/dist/node/poolServerAllow.d.ts +0 -33
  243. package/dist/node/poolServerAllow.js +0 -277
  244. package/dist/node/proxyCredentials.d.ts +0 -67
  245. package/dist/node/proxyCredentials.js +0 -364
  246. package/dist/node/proxyNetwork.d.ts +0 -18
  247. package/dist/node/proxyNetwork.js +0 -213
  248. package/dist/node/rawQUICCurrent.d.ts +0 -139
  249. package/dist/node/rawQUICCurrent.js +0 -1177
  250. package/dist/node/registeredLiveTunnelControl.d.ts +0 -74
  251. package/dist/node/registeredLiveTunnelControl.js +0 -865
  252. package/dist/node/registeredPoolTunnelAuthority.d.ts +0 -50
  253. package/dist/node/registeredPoolTunnelAuthority.js +0 -305
  254. package/dist/node/registeredTunnelControl.d.ts +0 -189
  255. package/dist/node/registeredTunnelControl.js +0 -1007
  256. package/dist/node/registeredWinnerContinuation.d.ts +0 -26
  257. package/dist/node/registeredWinnerContinuation.js +0 -83
  258. package/dist/node/relayNativePair.d.ts +0 -62
  259. package/dist/node/relayNativePair.js +0 -737
  260. package/dist/node/relayRecord.d.ts +0 -57
  261. package/dist/node/relayRecord.js +0 -275
  262. package/dist/node/serveRawQUIC.d.ts +0 -58
  263. package/dist/node/serveRawQUIC.js +0 -331
  264. package/dist/node/serveWSS.d.ts +0 -58
  265. package/dist/node/serveWSS.js +0 -309
  266. package/dist/node/sqliteAdmission.d.ts +0 -100
  267. package/dist/node/sqliteAdmission.js +0 -1185
  268. package/dist/node/sqliteExecutionContentV4.d.ts +0 -63
  269. package/dist/node/sqliteExecutionContentV4.js +0 -251
  270. package/dist/node/sqliteExecutionV4.d.ts +0 -114
  271. package/dist/node/sqliteExecutionV4.js +0 -1052
  272. package/dist/node/sqliteFormat.d.ts +0 -20
  273. package/dist/node/sqliteFormat.js +0 -72
  274. package/dist/node/sqliteInspectionV4.d.ts +0 -7
  275. package/dist/node/sqliteInspectionV4.js +0 -47
  276. package/dist/node/sqliteNativeV4.d.ts +0 -3
  277. package/dist/node/sqliteNativeV4.js +0 -16
  278. package/dist/node/sqlitePoolV4.d.ts +0 -41
  279. package/dist/node/sqlitePoolV4.js +0 -282
  280. package/dist/node/sqlitePoolWorkerProgramV4.js +0 -411
  281. package/dist/node/sqlitePoolWorkerV4.d.ts +0 -67
  282. package/dist/node/sqlitePoolWorkerV4.js +0 -206
  283. package/dist/node/sqliteV4.d.ts +0 -82
  284. package/dist/node/sqliteV4.js +0 -166
  285. package/dist/node/sqliteWorkerProgramV4.js +0 -175
  286. package/dist/node/sqliteWorkerV4.d.ts +0 -47
  287. package/dist/node/sqliteWorkerV4.js +0 -142
  288. package/dist/node/streamDuplexV4.d.ts +0 -33
  289. package/dist/node/streamDuplexV4.js +0 -359
  290. package/dist/node/tunnelListenerPreparation.d.ts +0 -37
  291. package/dist/node/tunnelListenerPreparation.js +0 -162
  292. package/dist/node/tunnelRuntime.d.ts +0 -124
  293. package/dist/node/tunnelRuntime.js +0 -1205
  294. package/dist/node/webTransportCurrent.d.ts +0 -24
  295. package/dist/node/webTransportCurrent.js +0 -12
  296. package/dist/node/wssV4.d.ts +0 -99
  297. package/dist/node/wssV4.js +0 -846
  298. package/dist/proxy/admission.d.ts +0 -21
  299. package/dist/proxy/admission.js +0 -126
  300. package/dist/proxy/brotliBody.d.ts +0 -10
  301. package/dist/proxy/brotliBody.js +0 -85
  302. package/dist/proxy/credentialControl.d.ts +0 -30
  303. package/dist/proxy/credentialControl.js +0 -86
  304. package/dist/proxy/currentStream.d.ts +0 -24
  305. package/dist/proxy/currentStream.js +0 -158
  306. package/dist/proxy/headers.d.ts +0 -8
  307. package/dist/proxy/headers.js +0 -63
  308. package/dist/proxy/publicationOwner.d.ts +0 -10
  309. package/dist/proxy/publicationOwner.js +0 -130
  310. package/dist/proxy/requestAssociation.d.ts +0 -11
  311. package/dist/proxy/requestAssociation.js +0 -8
  312. package/dist/proxy/surface.d.ts +0 -45
  313. package/dist/proxy/surface.js +0 -384
  314. package/dist/proxy/wire.d.ts +0 -11
  315. package/dist/proxy/wire.js +0 -214
  316. package/dist/public/streamKind.d.ts +0 -3
  317. package/dist/public/streamKind.js +0 -19
  318. package/dist/testSupport/tlsFixture.d.ts +0 -2
  319. package/dist/testSupport/tlsFixture.js +0 -8
  320. package/dist/v4/admissionOffer.d.ts +0 -8
  321. package/dist/v4/admissionOffer.js +0 -1
  322. package/dist/v4/checkpoint.d.ts +0 -23
  323. package/dist/v4/checkpoint.js +0 -16
  324. package/dist/v4/clientServices.d.ts +0 -35
  325. package/dist/v4/clientServices.js +0 -11
  326. package/dist/v4/connectionDiagnostic.d.ts +0 -42
  327. package/dist/v4/connectionDiagnostic.js +0 -45
  328. package/dist/v4/connectionRequirements.d.ts +0 -5
  329. package/dist/v4/connectionRequirements.js +0 -34
  330. package/dist/v4/controller.d.ts +0 -122
  331. package/dist/v4/controller.js +0 -1161
  332. package/dist/v4/controllerNotifications.d.ts +0 -81
  333. package/dist/v4/controllerNotifications.js +0 -610
  334. package/dist/v4/diagnostics.d.ts +0 -44
  335. package/dist/v4/diagnostics.js +0 -9
  336. package/dist/v4/drain.d.ts +0 -39
  337. package/dist/v4/drain.js +0 -80
  338. package/dist/v4/duplexBridge.d.ts +0 -53
  339. package/dist/v4/duplexBridge.js +0 -446
  340. package/dist/v4/entrypoints.d.ts +0 -20
  341. package/dist/v4/entrypoints.js +0 -50
  342. package/dist/v4/eventSource.d.ts +0 -34
  343. package/dist/v4/eventSource.js +0 -28
  344. package/dist/v4/handlerPlan.d.ts +0 -53
  345. package/dist/v4/handlerPlan.js +0 -129
  346. package/dist/v4/liveness.d.ts +0 -20
  347. package/dist/v4/liveness.js +0 -10
  348. package/dist/v4/localReport.d.ts +0 -17
  349. package/dist/v4/localReport.js +0 -10
  350. package/dist/v4/messageDefinition.d.ts +0 -66
  351. package/dist/v4/messageDefinition.js +0 -109
  352. package/dist/v4/messageStream.d.ts +0 -89
  353. package/dist/v4/messageStream.js +0 -1375
  354. package/dist/v4/notificationOperation.d.ts +0 -30
  355. package/dist/v4/notificationOperation.js +0 -31
  356. package/dist/v4/notificationSubscription.d.ts +0 -47
  357. package/dist/v4/notificationSubscription.js +0 -24
  358. package/dist/v4/operationReference.d.ts +0 -28
  359. package/dist/v4/operationReference.js +0 -61
  360. package/dist/v4/operationReferenceCodec.d.ts +0 -20
  361. package/dist/v4/operationReferenceCodec.js +0 -129
  362. package/dist/v4/operationReferenceStore.d.ts +0 -90
  363. package/dist/v4/operationReferenceStore.js +0 -272
  364. package/dist/v4/operationResultRead.d.ts +0 -26
  365. package/dist/v4/operationResultRead.js +0 -24
  366. package/dist/v4/poolControl.d.ts +0 -11
  367. package/dist/v4/poolControl.js +0 -50
  368. package/dist/v4/poolSource.d.ts +0 -93
  369. package/dist/v4/poolSource.js +0 -900
  370. package/dist/v4/profileDHReference.d.ts +0 -2
  371. package/dist/v4/profileDHReference.js +0 -42
  372. package/dist/v4/public.d.ts +0 -232
  373. package/dist/v4/public.js +0 -632
  374. package/dist/v4/responsePublication.d.ts +0 -48
  375. package/dist/v4/responsePublication.js +0 -227
  376. package/dist/v4/resume.d.ts +0 -17
  377. package/dist/v4/resume.js +0 -15
  378. package/dist/v4/runtime/applicationExecutor.d.ts +0 -190
  379. package/dist/v4/runtime/applicationExecutor.js +0 -759
  380. package/dist/v4/runtime/applicationHeader.d.ts +0 -61
  381. package/dist/v4/runtime/applicationHeader.js +0 -222
  382. package/dist/v4/runtime/canonicalText.d.ts +0 -8
  383. package/dist/v4/runtime/canonicalText.js +0 -142
  384. package/dist/v4/runtime/cbor.d.ts +0 -92
  385. package/dist/v4/runtime/cbor.js +0 -728
  386. package/dist/v4/runtime/cborWriter.d.ts +0 -18
  387. package/dist/v4/runtime/cborWriter.js +0 -59
  388. package/dist/v4/runtime/checkpointToken.d.ts +0 -41
  389. package/dist/v4/runtime/checkpointToken.js +0 -61
  390. package/dist/v4/runtime/clientAdmission.d.ts +0 -40
  391. package/dist/v4/runtime/clientAdmission.js +0 -378
  392. package/dist/v4/runtime/clientSessionSpec.d.ts +0 -45
  393. package/dist/v4/runtime/clientSessionSpec.js +0 -91
  394. package/dist/v4/runtime/clock.d.ts +0 -80
  395. package/dist/v4/runtime/clock.js +0 -284
  396. package/dist/v4/runtime/connectionFacts.d.ts +0 -23
  397. package/dist/v4/runtime/connectionFacts.js +0 -106
  398. package/dist/v4/runtime/contractAcceptance.d.ts +0 -20
  399. package/dist/v4/runtime/contractAcceptance.js +0 -91
  400. package/dist/v4/runtime/contractQuery.d.ts +0 -57
  401. package/dist/v4/runtime/contractQuery.js +0 -265
  402. package/dist/v4/runtime/contractQueryAccess.d.ts +0 -25
  403. package/dist/v4/runtime/contractQueryAccess.js +0 -117
  404. package/dist/v4/runtime/contractQueryAcquisition.d.ts +0 -83
  405. package/dist/v4/runtime/contractQueryAcquisition.js +0 -572
  406. package/dist/v4/runtime/contractQueryClient.d.ts +0 -70
  407. package/dist/v4/runtime/contractQueryClient.js +0 -411
  408. package/dist/v4/runtime/contractQueryCodecs.d.ts +0 -20
  409. package/dist/v4/runtime/contractQueryCodecs.js +0 -71
  410. package/dist/v4/runtime/contractQueryExchange.d.ts +0 -36
  411. package/dist/v4/runtime/contractQueryExchange.js +0 -160
  412. package/dist/v4/runtime/contractQueryService.d.ts +0 -42
  413. package/dist/v4/runtime/contractQueryService.js +0 -572
  414. package/dist/v4/runtime/contractQuerySession.d.ts +0 -38
  415. package/dist/v4/runtime/contractQuerySession.js +0 -158
  416. package/dist/v4/runtime/contractRoutes.d.ts +0 -87
  417. package/dist/v4/runtime/contractRoutes.js +0 -396
  418. package/dist/v4/runtime/contractSnapshotReader.d.ts +0 -59
  419. package/dist/v4/runtime/contractSnapshotReader.js +0 -418
  420. package/dist/v4/runtime/contractSnapshotWriter.d.ts +0 -32
  421. package/dist/v4/runtime/contractSnapshotWriter.js +0 -208
  422. package/dist/v4/runtime/controllerServiceSource.d.ts +0 -23
  423. package/dist/v4/runtime/controllerServiceSource.js +0 -109
  424. package/dist/v4/runtime/controllerUnaryRoute.d.ts +0 -28
  425. package/dist/v4/runtime/controllerUnaryRoute.js +0 -1
  426. package/dist/v4/runtime/credentialNamespace.d.ts +0 -143
  427. package/dist/v4/runtime/credentialNamespace.js +0 -1286
  428. package/dist/v4/runtime/credentialSupport.d.ts +0 -60
  429. package/dist/v4/runtime/credentialSupport.js +0 -294
  430. package/dist/v4/runtime/credentialVerifier.d.ts +0 -404
  431. package/dist/v4/runtime/credentialVerifier.js +0 -1443
  432. package/dist/v4/runtime/cryptoUsage.d.ts +0 -135
  433. package/dist/v4/runtime/cryptoUsage.js +0 -552
  434. package/dist/v4/runtime/deadline.d.ts +0 -31
  435. package/dist/v4/runtime/deadline.js +0 -188
  436. package/dist/v4/runtime/diagnosticCounters.d.ts +0 -15
  437. package/dist/v4/runtime/diagnosticCounters.js +0 -78
  438. package/dist/v4/runtime/diagnosticObservation.d.ts +0 -25
  439. package/dist/v4/runtime/diagnosticObservation.js +0 -67
  440. package/dist/v4/runtime/diagnosticSink.d.ts +0 -16
  441. package/dist/v4/runtime/diagnosticSink.js +0 -320
  442. package/dist/v4/runtime/ed25519.d.ts +0 -1
  443. package/dist/v4/runtime/ed25519.js +0 -34
  444. package/dist/v4/runtime/endpointHop.d.ts +0 -12
  445. package/dist/v4/runtime/endpointHop.js +0 -26
  446. package/dist/v4/runtime/envelope.d.ts +0 -66
  447. package/dist/v4/runtime/envelope.js +0 -275
  448. package/dist/v4/runtime/environment.d.ts +0 -277
  449. package/dist/v4/runtime/environment.js +0 -1913
  450. package/dist/v4/runtime/executionManagementChannel.d.ts +0 -27
  451. package/dist/v4/runtime/executionManagementChannel.js +0 -733
  452. package/dist/v4/runtime/executionManagementCodec.d.ts +0 -84
  453. package/dist/v4/runtime/executionManagementCodec.js +0 -127
  454. package/dist/v4/runtime/executionStorage.d.ts +0 -71
  455. package/dist/v4/runtime/executionStorage.js +0 -10
  456. package/dist/v4/runtime/fixedDiagnosticExecutor.d.ts +0 -34
  457. package/dist/v4/runtime/fixedDiagnosticExecutor.js +0 -149
  458. package/dist/v4/runtime/fixedManagementExecutor.d.ts +0 -21
  459. package/dist/v4/runtime/fixedManagementExecutor.js +0 -153
  460. package/dist/v4/runtime/fixedQueryExecutor.d.ts +0 -46
  461. package/dist/v4/runtime/fixedQueryExecutor.js +0 -311
  462. package/dist/v4/runtime/grantDigest.d.ts +0 -9
  463. package/dist/v4/runtime/grantDigest.js +0 -31
  464. package/dist/v4/runtime/hopAuthentication.d.ts +0 -51
  465. package/dist/v4/runtime/hopAuthentication.js +0 -392
  466. package/dist/v4/runtime/host.d.ts +0 -15
  467. package/dist/v4/runtime/host.js +0 -332
  468. package/dist/v4/runtime/initializerWorkload.d.ts +0 -38
  469. package/dist/v4/runtime/initializerWorkload.js +0 -164
  470. package/dist/v4/runtime/lifecycle.d.ts +0 -5
  471. package/dist/v4/runtime/lifecycle.js +0 -17
  472. package/dist/v4/runtime/liveAuthorization.d.ts +0 -42
  473. package/dist/v4/runtime/liveAuthorization.js +0 -133
  474. package/dist/v4/runtime/liveAuthorizationWire.d.ts +0 -8
  475. package/dist/v4/runtime/liveAuthorizationWire.js +0 -31
  476. package/dist/v4/runtime/liveCarrierPreparation.d.ts +0 -9
  477. package/dist/v4/runtime/liveCarrierPreparation.js +0 -27
  478. package/dist/v4/runtime/liveness.d.ts +0 -37
  479. package/dist/v4/runtime/liveness.js +0 -319
  480. package/dist/v4/runtime/maintenancePositions.d.ts +0 -29
  481. package/dist/v4/runtime/maintenancePositions.js +0 -152
  482. package/dist/v4/runtime/messageCodec.d.ts +0 -20
  483. package/dist/v4/runtime/messageCodec.js +0 -192
  484. package/dist/v4/runtime/namespaceContinuity.d.ts +0 -20
  485. package/dist/v4/runtime/namespaceContinuity.js +0 -176
  486. package/dist/v4/runtime/nativeCandidates.d.ts +0 -18
  487. package/dist/v4/runtime/nativeCandidates.js +0 -109
  488. package/dist/v4/runtime/nativeFailure.d.ts +0 -10
  489. package/dist/v4/runtime/nativeFailure.js +0 -32
  490. package/dist/v4/runtime/nativeFrame.d.ts +0 -47
  491. package/dist/v4/runtime/nativeFrame.js +0 -318
  492. package/dist/v4/runtime/nativeIngress.d.ts +0 -30
  493. package/dist/v4/runtime/nativeIngress.js +0 -177
  494. package/dist/v4/runtime/nativePositions.d.ts +0 -24
  495. package/dist/v4/runtime/nativePositions.js +0 -131
  496. package/dist/v4/runtime/nativeProviderPositions.d.ts +0 -16
  497. package/dist/v4/runtime/nativeProviderPositions.js +0 -75
  498. package/dist/v4/runtime/nativeSend.d.ts +0 -15
  499. package/dist/v4/runtime/nativeSend.js +0 -57
  500. package/dist/v4/runtime/noiseHandshake.d.ts +0 -70
  501. package/dist/v4/runtime/noiseHandshake.js +0 -373
  502. package/dist/v4/runtime/noiseWasmBinary.d.ts +0 -2
  503. package/dist/v4/runtime/noiseWasmBinary.js +0 -3
  504. package/dist/v4/runtime/notifyChannel.d.ts +0 -37
  505. package/dist/v4/runtime/notifyChannel.js +0 -277
  506. package/dist/v4/runtime/notifyDispatch.d.ts +0 -108
  507. package/dist/v4/runtime/notifyDispatch.js +0 -717
  508. package/dist/v4/runtime/notifyExecution.d.ts +0 -18
  509. package/dist/v4/runtime/notifyExecution.js +0 -59
  510. package/dist/v4/runtime/notifyPreparation.d.ts +0 -70
  511. package/dist/v4/runtime/notifyPreparation.js +0 -465
  512. package/dist/v4/runtime/openAdmission.d.ts +0 -125
  513. package/dist/v4/runtime/openAdmission.js +0 -810
  514. package/dist/v4/runtime/peerOpenPreparation.d.ts +0 -18
  515. package/dist/v4/runtime/peerOpenPreparation.js +0 -61
  516. package/dist/v4/runtime/poolJournal.d.ts +0 -18
  517. package/dist/v4/runtime/poolJournal.js +0 -14
  518. package/dist/v4/runtime/poolJournalStorage.d.ts +0 -4
  519. package/dist/v4/runtime/poolJournalStorage.js +0 -172
  520. package/dist/v4/runtime/poolRecord.d.ts +0 -9
  521. package/dist/v4/runtime/poolRecord.js +0 -23
  522. package/dist/v4/runtime/poolRecordStorage.d.ts +0 -10
  523. package/dist/v4/runtime/poolRecordStorage.js +0 -216
  524. package/dist/v4/runtime/poolServerAllow.d.ts +0 -49
  525. package/dist/v4/runtime/poolServerAllow.js +0 -38
  526. package/dist/v4/runtime/poolSpend.d.ts +0 -20
  527. package/dist/v4/runtime/poolSpend.js +0 -4
  528. package/dist/v4/runtime/queryRenewalPosition.d.ts +0 -59
  529. package/dist/v4/runtime/queryRenewalPosition.js +0 -220
  530. package/dist/v4/runtime/random.d.ts +0 -15
  531. package/dist/v4/runtime/random.js +0 -71
  532. package/dist/v4/runtime/rawStreamPreparation.d.ts +0 -40
  533. package/dist/v4/runtime/rawStreamPreparation.js +0 -125
  534. package/dist/v4/runtime/receiveDirection.d.ts +0 -135
  535. package/dist/v4/runtime/receiveDirection.js +0 -957
  536. package/dist/v4/runtime/receiveWorkspace.d.ts +0 -19
  537. package/dist/v4/runtime/receiveWorkspace.js +0 -82
  538. package/dist/v4/runtime/record.d.ts +0 -7
  539. package/dist/v4/runtime/record.js +0 -173
  540. package/dist/v4/runtime/recordCrypto.d.ts +0 -121
  541. package/dist/v4/runtime/recordCrypto.js +0 -633
  542. package/dist/v4/runtime/recordWorkspace.d.ts +0 -17
  543. package/dist/v4/runtime/recordWorkspace.js +0 -69
  544. package/dist/v4/runtime/registeredCarrierPreparation.d.ts +0 -17
  545. package/dist/v4/runtime/registeredCarrierPreparation.js +0 -191
  546. package/dist/v4/runtime/rekey.d.ts +0 -40
  547. package/dist/v4/runtime/rekey.js +0 -362
  548. package/dist/v4/runtime/relayCredentials.d.ts +0 -126
  549. package/dist/v4/runtime/relayCredentials.js +0 -349
  550. package/dist/v4/runtime/replayWindow.d.ts +0 -6
  551. package/dist/v4/runtime/replayWindow.js +0 -59
  552. package/dist/v4/runtime/resources.d.ts +0 -200
  553. package/dist/v4/runtime/resources.js +0 -1236
  554. package/dist/v4/runtime/resumeCodec.d.ts +0 -44
  555. package/dist/v4/runtime/resumeCodec.js +0 -192
  556. package/dist/v4/runtime/resumeStream.d.ts +0 -23
  557. package/dist/v4/runtime/resumeStream.js +0 -23
  558. package/dist/v4/runtime/rpcApplication.d.ts +0 -234
  559. package/dist/v4/runtime/rpcApplication.js +0 -2170
  560. package/dist/v4/runtime/rpcApplicationServices.d.ts +0 -18
  561. package/dist/v4/runtime/rpcApplicationServices.js +0 -62
  562. package/dist/v4/runtime/rpcCallCapacity.d.ts +0 -62
  563. package/dist/v4/runtime/rpcCallCapacity.js +0 -289
  564. package/dist/v4/runtime/rpcChannel.d.ts +0 -58
  565. package/dist/v4/runtime/rpcChannel.js +0 -334
  566. package/dist/v4/runtime/rpcCompletion.d.ts +0 -42
  567. package/dist/v4/runtime/rpcCompletion.js +0 -152
  568. package/dist/v4/runtime/rpcEventSource.d.ts +0 -27
  569. package/dist/v4/runtime/rpcEventSource.js +0 -201
  570. package/dist/v4/runtime/rpcFragment.d.ts +0 -42
  571. package/dist/v4/runtime/rpcFragment.js +0 -227
  572. package/dist/v4/runtime/rpcInput.d.ts +0 -41
  573. package/dist/v4/runtime/rpcInput.js +0 -137
  574. package/dist/v4/runtime/rpcNetwork.d.ts +0 -143
  575. package/dist/v4/runtime/rpcNetwork.js +0 -652
  576. package/dist/v4/runtime/rpcOutputInterest.d.ts +0 -20
  577. package/dist/v4/runtime/rpcOutputInterest.js +0 -106
  578. package/dist/v4/runtime/rpcPayload.d.ts +0 -24
  579. package/dist/v4/runtime/rpcPayload.js +0 -82
  580. package/dist/v4/runtime/rpcPreacceptedStreams.d.ts +0 -46
  581. package/dist/v4/runtime/rpcPreacceptedStreams.js +0 -406
  582. package/dist/v4/runtime/rpcPublisher.d.ts +0 -49
  583. package/dist/v4/runtime/rpcPublisher.js +0 -406
  584. package/dist/v4/runtime/rpcReceiver.d.ts +0 -40
  585. package/dist/v4/runtime/rpcReceiver.js +0 -255
  586. package/dist/v4/runtime/rpcResumeDispatch.d.ts +0 -46
  587. package/dist/v4/runtime/rpcResumeDispatch.js +0 -266
  588. package/dist/v4/runtime/rpcStream.d.ts +0 -14
  589. package/dist/v4/runtime/rpcStream.js +0 -12
  590. package/dist/v4/runtime/rpcStreamMessages.d.ts +0 -53
  591. package/dist/v4/runtime/rpcStreamMessages.js +0 -428
  592. package/dist/v4/runtime/rpcStreamPreparation.d.ts +0 -21
  593. package/dist/v4/runtime/rpcStreamPreparation.js +0 -110
  594. package/dist/v4/runtime/rpcStreamingDispatch.d.ts +0 -26
  595. package/dist/v4/runtime/rpcStreamingDispatch.js +0 -607
  596. package/dist/v4/runtime/rpcStreamingExchange.d.ts +0 -91
  597. package/dist/v4/runtime/rpcStreamingExchange.js +0 -812
  598. package/dist/v4/runtime/rpcUnaryCall.d.ts +0 -16
  599. package/dist/v4/runtime/rpcUnaryCall.js +0 -152
  600. package/dist/v4/runtime/rpcUnaryDispatch.d.ts +0 -34
  601. package/dist/v4/runtime/rpcUnaryDispatch.js +0 -569
  602. package/dist/v4/runtime/rpcUnaryExchange.d.ts +0 -127
  603. package/dist/v4/runtime/rpcUnaryExchange.js +0 -1042
  604. package/dist/v4/runtime/rpcUnaryPreparation.d.ts +0 -102
  605. package/dist/v4/runtime/rpcUnaryPreparation.js +0 -736
  606. package/dist/v4/runtime/rpcUnaryRegistration.d.ts +0 -33
  607. package/dist/v4/runtime/rpcUnaryRegistration.js +0 -113
  608. package/dist/v4/runtime/rpcUnaryResultRecipient.d.ts +0 -21
  609. package/dist/v4/runtime/rpcUnaryResultRecipient.js +0 -57
  610. package/dist/v4/runtime/schema.d.ts +0 -26
  611. package/dist/v4/runtime/schema.js +0 -668
  612. package/dist/v4/runtime/schemaRegistry.d.ts +0 -128
  613. package/dist/v4/runtime/schemaRegistry.js +0 -74
  614. package/dist/v4/runtime/sendBudget.d.ts +0 -10
  615. package/dist/v4/runtime/sendBudget.js +0 -46
  616. package/dist/v4/runtime/serveGroup.d.ts +0 -73
  617. package/dist/v4/runtime/serveGroup.js +0 -589
  618. package/dist/v4/runtime/serverAdmission.d.ts +0 -33
  619. package/dist/v4/runtime/serverAdmission.js +0 -342
  620. package/dist/v4/runtime/serverAdmissionAuthority.d.ts +0 -23
  621. package/dist/v4/runtime/serverAdmissionAuthority.js +0 -5
  622. package/dist/v4/runtime/serverSessionSpec.d.ts +0 -9
  623. package/dist/v4/runtime/serverSessionSpec.js +0 -12
  624. package/dist/v4/runtime/serviceBinding.d.ts +0 -128
  625. package/dist/v4/runtime/serviceBinding.js +0 -1435
  626. package/dist/v4/runtime/serviceBindingConfig.d.ts +0 -72
  627. package/dist/v4/runtime/serviceBindingConfig.js +0 -85
  628. package/dist/v4/runtime/serviceBindingPool.d.ts +0 -58
  629. package/dist/v4/runtime/serviceBindingPool.js +0 -327
  630. package/dist/v4/runtime/serviceContract.d.ts +0 -111
  631. package/dist/v4/runtime/serviceContract.js +0 -588
  632. package/dist/v4/runtime/serviceInputs.d.ts +0 -30
  633. package/dist/v4/runtime/serviceInputs.js +0 -201
  634. package/dist/v4/runtime/serviceOfferPlan.d.ts +0 -81
  635. package/dist/v4/runtime/serviceOfferPlan.js +0 -335
  636. package/dist/v4/runtime/serviceOfferScheduler.d.ts +0 -12
  637. package/dist/v4/runtime/serviceOfferScheduler.js +0 -201
  638. package/dist/v4/runtime/serviceOfferWork.d.ts +0 -25
  639. package/dist/v4/runtime/serviceOfferWork.js +0 -1
  640. package/dist/v4/runtime/session.d.ts +0 -411
  641. package/dist/v4/runtime/session.js +0 -6369
  642. package/dist/v4/runtime/sessionActivity.d.ts +0 -19
  643. package/dist/v4/runtime/sessionActivity.js +0 -97
  644. package/dist/v4/runtime/sessionAdmission.d.ts +0 -93
  645. package/dist/v4/runtime/sessionAdmission.js +0 -498
  646. package/dist/v4/runtime/sessionCleanup.d.ts +0 -47
  647. package/dist/v4/runtime/sessionCleanup.js +0 -268
  648. package/dist/v4/runtime/sessionKeyPreparation.d.ts +0 -19
  649. package/dist/v4/runtime/sessionKeyPreparation.js +0 -50
  650. package/dist/v4/runtime/signedMap.d.ts +0 -68
  651. package/dist/v4/runtime/signedMap.js +0 -425
  652. package/dist/v4/runtime/streamAdapter.d.ts +0 -113
  653. package/dist/v4/runtime/streamAdapter.js +0 -62
  654. package/dist/v4/runtime/streamData.d.ts +0 -11
  655. package/dist/v4/runtime/streamData.js +0 -50
  656. package/dist/v4/runtime/streamOpenPreparation.d.ts +0 -23
  657. package/dist/v4/runtime/streamOpenPreparation.js +0 -77
  658. package/dist/v4/runtime/streamRegistration.d.ts +0 -87
  659. package/dist/v4/runtime/streamRegistration.js +0 -296
  660. package/dist/v4/runtime/taskObservation.d.ts +0 -1
  661. package/dist/v4/runtime/taskObservation.js +0 -48
  662. package/dist/v4/runtime/timeArithmetic.d.ts +0 -29
  663. package/dist/v4/runtime/timeArithmetic.js +0 -107
  664. package/dist/v4/runtime/unreliable.d.ts +0 -76
  665. package/dist/v4/runtime/unreliable.js +0 -473
  666. package/dist/v4/runtime/volatileExecutions.d.ts +0 -128
  667. package/dist/v4/runtime/volatileExecutions.js +0 -792
  668. package/dist/v4/runtime/wireRegistry.d.ts +0 -52
  669. package/dist/v4/runtime/wireRegistry.js +0 -29
  670. package/dist/v4/runtime/writeRequest.d.ts +0 -42
  671. package/dist/v4/runtime/writeRequest.js +0 -237
  672. package/dist/v4/serve.d.ts +0 -107
  673. package/dist/v4/serve.js +0 -80
  674. package/dist/v4/serviceClient.d.ts +0 -92
  675. package/dist/v4/serviceClient.js +0 -323
  676. package/dist/v4/serviceDefinition.d.ts +0 -138
  677. package/dist/v4/serviceDefinition.js +0 -150
  678. package/dist/v4/serviceDependencies.d.ts +0 -66
  679. package/dist/v4/serviceDependencies.js +0 -250
  680. package/dist/v4/serviceFactory.d.ts +0 -31
  681. package/dist/v4/serviceFactory.js +0 -157
  682. package/dist/v4/serviceHandlers.d.ts +0 -55
  683. package/dist/v4/serviceHandlers.js +0 -15
  684. package/dist/v4/serviceMembers.d.ts +0 -4
  685. package/dist/v4/serviceMembers.js +0 -12
  686. package/dist/v4/staticServiceContracts.d.ts +0 -43
  687. package/dist/v4/staticServiceContracts.js +0 -161
  688. package/dist/v4/storageFormat.d.ts +0 -16
  689. package/dist/v4/storageFormat.js +0 -5
  690. package/dist/v4/streamContent.d.ts +0 -30
  691. package/dist/v4/streamContent.js +0 -29
  692. package/dist/v4/streamHandlers.d.ts +0 -61
  693. package/dist/v4/streamHandlers.js +0 -16
  694. package/dist/v4/streamingOperation.d.ts +0 -64
  695. package/dist/v4/streamingOperation.js +0 -141
  696. package/dist/v4/strictEd25519Reference.d.ts +0 -2
  697. package/dist/v4/strictEd25519Reference.js +0 -37
  698. package/dist/v4/testSupport/cbor.d.ts +0 -124
  699. package/dist/v4/testSupport/cbor.js +0 -230
  700. package/dist/v4/testSupport/credentials.d.ts +0 -55
  701. package/dist/v4/testSupport/credentials.js +0 -111
  702. package/dist/v4/testSupport/unicode.d.ts +0 -19
  703. package/dist/v4/testSupport/unicode.js +0 -112
  704. package/dist/v4/unaryOperation.d.ts +0 -59
  705. package/dist/v4/unaryOperation.js +0 -80
  706. package/dist/v4/unreliable.d.ts +0 -26
  707. package/dist/v4/unreliable.js +0 -10
  708. package/dist/v4/webStreams.d.ts +0 -30
  709. package/dist/v4/webStreams.js +0 -377
  710. /package/dist/{interop/proxyServerPeer.d.ts → rpc/wire.js} +0 -0
  711. /package/dist/{node/sqlitePoolWorkerProgramV4.d.ts → v3/publicSession.d.ts} +0 -0
  712. /package/dist/{node/sqliteWorkerProgramV4.d.ts → v3/streamMetadata.d.ts} +0 -0
@@ -1,792 +0,0 @@
1
- import { captureCheckpoint } from "./checkpointToken.js";
2
- import { executionStorage, executionMode } from "./executionStorage.js";
3
- import { captureExecutionTarget } from "./executionManagementCodec.js";
4
- import { sha256 } from "@noble/hashes/sha2.js";
5
- import { credentialOwner } from "./credentialSupport.js";
6
- import { RPCPayload, rpcPayloadCharge } from "./rpcPayload.js";
7
- import { RPCProtocolError } from "./rpcFragment.js";
8
- import { ResourceVector } from "./resources.js";
9
- import { timeAdd } from "./timeArithmetic.js";
10
- function securityText(value) { return typeof value === "string" && /^[a-z0-9][a-z0-9._:/@-]{0,127}$/u.test(value); }
11
- function digestText(value) { return typeof value === "string" && /^[0-9a-f]{64}$/u.test(value) && !/^0+$/u.test(value); }
12
- export function executionResultReadCharge(runtimeBytes) {
13
- return new ResourceVector([2048n + runtimeBytes, 0n, 0n, 4n, 0n, 0n, 0n, 0n, 0n, 0n, 0n]);
14
- }
15
- export function captureExecutionIdentity(input) {
16
- if (input === undefined)
17
- return;
18
- const { authority, subject, identityDigest } = input;
19
- if (!digestText(authority) || !securityText(subject) || !digestText(identityDigest))
20
- throw new RPCProtocolError("configuration_capacity");
21
- return Object.freeze({ authority, subject, identityDigest });
22
- }
23
- export function captureVolatileExecution(input) {
24
- if (executionStorage(input) !== undefined)
25
- return input;
26
- const { tenant, audience, namespace, callerAuthorities, maxRecords, maxActive, resultBytes } = input;
27
- if (![tenant, audience, namespace].every(securityText) || !Array.isArray(callerAuthorities) || callerAuthorities.length < 1 || callerAuthorities.length > 16 ||
28
- callerAuthorities.some(value => !digestText(value)) || new Set(callerAuthorities).size !== callerAuthorities.length ||
29
- !Number.isSafeInteger(maxRecords) || maxRecords < 1 || maxRecords > 8192 || !Number.isSafeInteger(maxActive) || maxActive < 1 || maxActive > Math.min(1024, maxRecords) ||
30
- typeof resultBytes !== "bigint" || resultBytes < 1n || resultBytes > 16777216n)
31
- throw new RPCProtocolError("configuration_capacity");
32
- return Object.freeze({ tenant, audience, namespace, callerAuthorities: Object.freeze([...callerAuthorities].sort()), maxRecords, maxActive, resultBytes });
33
- }
34
- export function executionServiceKey(config) {
35
- return `${config.tenant}\0${config.audience}\0${config.namespace}`;
36
- }
37
- export function volatileExecutionCharge(config, runtimeBytes) {
38
- // All compact records, keys, floors, finite observer indices and GC cursor
39
- // precede the first Session. Full result payloads are admitted per operation.
40
- const bytes = 8192n + BigInt(config.maxRecords) * 1536n + BigInt(config.callerAuthorities.length) * 256n + BigInt(config.maxActive * 3 + 8) * 512n + runtimeBytes;
41
- if (runtimeBytes <= 0n || bytes > 5242880n)
42
- throw new RPCProtocolError("configuration_capacity");
43
- return new ResourceVector([bytes, 0n, 0n, BigInt(config.maxRecords * 3 + 8), BigInt(config.maxActive * 3 + 8), BigInt(config.maxActive * 3 + 9), 1n, 0n, 0n, 0n, 0n]);
44
- }
45
- const capability = Symbol("original volatile execution attempt"), NativePromise = Promise;
46
- const signalAborted = Object.getOwnPropertyDescriptor(AbortSignal.prototype, "aborted").get;
47
- const addListener = EventTarget.prototype.addEventListener, removeListener = EventTarget.prototype.removeEventListener;
48
- const aborted = (signal) => signalAborted.call(signal);
49
- const hex = (bytes) => Array.from(bytes, value => value.toString(16).padStart(2, "0")).join("");
50
- /** One continuous logical service history shared by every original Session.
51
- * Absence is not cross-owner proof. No Session, certificate, method or contract
52
- * digest is added to the key, and no pressure/LRU deletion grants a new Start. */
53
- export class VolatileExecutions {
54
- config;
55
- configuration;
56
- #resources;
57
- #clock;
58
- #storage;
59
- #storageBound = false;
60
- #pendingStorage = 0;
61
- #pendingRecordWork = 0;
62
- async #storageWork(action) {
63
- if (this.#pendingStorage >= this.config.maxActive * 3 + 8)
64
- throw new RPCProtocolError("resource_exhausted");
65
- this.#pendingStorage++;
66
- try {
67
- return await action();
68
- }
69
- finally {
70
- this.#pendingStorage--;
71
- this.#collectClosed();
72
- }
73
- }
74
- async #recordWork(record, action) {
75
- if (record.transitions >= 64 || this.#pendingRecordWork >= this.config.maxActive * 3 + 8 || this.#pendingStorage >= this.config.maxActive * 3 + 8)
76
- throw new RPCProtocolError("resource_exhausted");
77
- const previous = record.transitionTail;
78
- let release;
79
- record.transitionTail = new Promise(resolve => { release = resolve; });
80
- record.transitions++;
81
- this.#pendingRecordWork++;
82
- try {
83
- return await this.#storageWork(async () => { await previous; return await action(); });
84
- }
85
- finally {
86
- record.transitions--;
87
- this.#pendingRecordWork--;
88
- // Custody extends through applying the real receipt, including payloads.
89
- // Failure and exit persist the final facts after all admitted transitions.
90
- if (record.transitions === 0) {
91
- const failure = record.deferredFailure;
92
- record.deferredFailure = undefined;
93
- if (failure !== undefined)
94
- this.fail(record, failure);
95
- if (record.exitRequested)
96
- this.exit(record);
97
- }
98
- release();
99
- this.#collectClosed();
100
- }
101
- }
102
- async #updateReceipt(facts, payload, guard, apply) {
103
- if (this.#storage === undefined) {
104
- guard?.();
105
- apply();
106
- return;
107
- }
108
- let delivered = false;
109
- await this.#storage.update(facts, payload, guard, () => {
110
- if (delivered)
111
- throw new RPCProtocolError("service_failed");
112
- delivered = true;
113
- apply();
114
- });
115
- if (!delivered)
116
- throw new RPCProtocolError("service_failed");
117
- }
118
- #applyResultReceipt(record, receipt) {
119
- // The admitted transition retains the original result allocation through
120
- // COMMIT. Custody settlement does not recheck a now-closed publication gate.
121
- record.result.write(0, receipt.payload);
122
- record.result.seal();
123
- record.resultDigest = receipt.facts.resultDigest;
124
- record.resultBytes = receipt.facts.resultBytes;
125
- record.resultCode = receipt.facts.resultCode;
126
- record.resultUntil = receipt.facts.resultUntil;
127
- record.state = receipt.facts.state;
128
- this.#notify(record);
129
- }
130
- #reference;
131
- #resultAccount;
132
- #records = new Map();
133
- #slots;
134
- #floors = new Map();
135
- #active = 0;
136
- #next = 0n;
137
- #cursor = 0;
138
- #closed = false;
139
- #busy = false;
140
- #timer;
141
- constructor(resources, clock, config) {
142
- this.#storage = executionStorage(config);
143
- this.config = captureVolatileExecution(config);
144
- this.configuration = JSON.stringify(this.config, (_key, value) => typeof value === "bigint" ? value.toString() : value);
145
- this.#resources = Object.freeze({ ...resources, accounts: Object.freeze([...resources.accounts]), owner: Object.freeze({ ...resources.owner }) });
146
- this.#clock = clock;
147
- const charge = volatileExecutionCharge(this.config, resources.runtimeBytes);
148
- const id = hex(sha256(new TextEncoder().encode(JSON.stringify([resources.owner.tenant, resources.owner.environment, "execution_results", executionServiceKey(this.config)])))).slice(0, 32);
149
- this.#reference = resources.root.reserve({ accounts: resources.accounts, owner: { ...resources.owner, kind: `execution_history_${id}` }, charge });
150
- this.#slots = new Array(this.config.maxRecords);
151
- try {
152
- const values = [...resources.root.snapshot().limit.values()];
153
- values[0] = config.resultBytes;
154
- this.#resultAccount = resources.root.account("pool", id, new ResourceVector(values));
155
- for (const authority of this.config.callerAuthorities)
156
- this.#floors.set(authority, 0n);
157
- if (this.#storage !== undefined) {
158
- this.#storage.bind(this.#reference);
159
- this.#storageBound = true;
160
- for (const [authority, floor] of this.#storage.floors())
161
- this.#floors.set(authority, floor);
162
- for (const saved of this.#storage.records()) {
163
- const facts = saved.facts;
164
- if (this.#records.size >= this.config.maxRecords || facts.active || this.#records.has(facts.key))
165
- throw new RPCProtocolError("service_unavailable");
166
- let result;
167
- if (saved.payload !== undefined) {
168
- const reference = resources.root.reserve({
169
- accounts: [...resources.accounts, this.#resultAccount],
170
- owner: credentialOwner(resources, `execution_result_${++this.#next}`), charge: rpcPayloadCharge(facts.limit, resources.runtimeBytes)
171
- });
172
- try {
173
- result = new RPCPayload(facts.limit, resources.runtimeBytes, reference);
174
- result.write(0, saved.payload);
175
- result.seal();
176
- }
177
- finally {
178
- reference.release();
179
- saved.payload.fill(0);
180
- }
181
- }
182
- const record = { ...facts, result, holders: 0, transitions: 0, transitionTail: Promise.resolve(), deferredFailure: undefined, exitRequested: false, stop: undefined, waiters: new Set() };
183
- this.#slots[this.#records.size] = record;
184
- this.#records.set(record.key, record);
185
- }
186
- }
187
- this.#timer = setTimeout(this.#tick, 1000);
188
- Object.freeze(this);
189
- }
190
- catch (error) {
191
- this.close();
192
- throw error;
193
- }
194
- }
195
- sameEnvironment(reference) { this.#check(); return this.#reference.sameEnvironment(reference); }
196
- #check() { if (this.#closed)
197
- throw new RPCProtocolError("service_unavailable"); this.#reference.check(); this.#storage?.check(); }
198
- async admit(input, route, routes, authentication, identity, access, stop) {
199
- this.#check();
200
- if (this.#busy)
201
- throw new RPCProtocolError("service_unavailable");
202
- this.#busy = true;
203
- let result, committedRecord;
204
- try {
205
- const header = input.header, contract = route.contract, config = this.config;
206
- const notification = header.kind === "execution_notify", streaming = header.kind === "execution_stream_request";
207
- if (input.state !== "complete" || !notification && !streaming && header.kind !== "execution_unary_request" && header.kind !== "resume_request" || contract.optionalUint(13) !== executionMode(config) ||
208
- contract.shape !== (notification ? "notify" : streaming ? "server_streaming" : "unary") || authentication.tenant !== config.tenant || authentication.audience !== config.audience ||
209
- route.namespace !== config.namespace || identity.subject !== authentication.peerSubject || identity.identityDigest !== authentication.peerIdentityDigest ||
210
- !this.#floors.has(identity.authority) || !input.sameEnvironment(this.#reference))
211
- throw new RPCProtocolError("permission_denied");
212
- const operation = new Uint8Array(32), request = new Uint8Array(32), digest = new Uint8Array(32);
213
- header.copyBytes(1, operation);
214
- header.copyBytes(4, request);
215
- header.copyBytes(6, digest);
216
- const key = `${identity.authority}\0${identity.subject}\0${hex(operation)}`, requestID = hex(request), contractID = hex(digest);
217
- let cutoff = 0n;
218
- for (let i = 0; i < 8; i++)
219
- cutoff = (cutoff << 8n) | BigInt(operation[i]);
220
- operation.fill(0);
221
- request.fill(0);
222
- digest.fill(0);
223
- access.check();
224
- this.#check();
225
- const existing = this.#records.get(key);
226
- if (existing !== undefined) {
227
- if (existing.request !== requestID || existing.contract !== contractID)
228
- throw new RPCProtocolError("operation_conflict");
229
- if (existing.holders >= 64)
230
- throw new RPCProtocolError("resource_exhausted");
231
- existing.holders++;
232
- return new VolatileExecutionAttempt(capability, this, existing, false);
233
- }
234
- const sample = this.#clock.sample(), now = sample.requireInterval();
235
- access.check();
236
- this.#check();
237
- if (cutoff <= this.#floors.get(identity.authority) || now.upperMS >= cutoff || cutoff > timeAdd(now.lowerMS, contract.uint(16)) ||
238
- now.upperMS >= header.uint(5) || header.uint(5) > timeAdd(now.lowerMS, contract.uint(17)))
239
- throw new RPCProtocolError("deadline_exceeded");
240
- routes.checkExecutionAdmission(route, cutoff, now);
241
- if (this.#active >= config.maxActive || this.#records.size >= config.maxRecords || this.#next === (1n << 64n) - 1n)
242
- throw new RPCProtocolError("resource_exhausted");
243
- const historyUntil = timeAdd(header.uint(5), contract.uint(14)), retention = contract.optionalUint(15) ?? 0n, limit = Number(header.uint(8));
244
- // Check the complete future retention arithmetic before registration.
245
- timeAdd(header.uint(5), retention);
246
- if (!notification && !streaming) {
247
- const r = this.#resources, reference = r.root.reserve({
248
- accounts: [...r.accounts, this.#resultAccount],
249
- owner: credentialOwner(r, `execution_result_${++this.#next}`), charge: rpcPayloadCharge(limit, r.runtimeBytes)
250
- });
251
- try {
252
- result = new RPCPayload(limit, r.runtimeBytes, reference);
253
- }
254
- finally {
255
- reference.release();
256
- }
257
- }
258
- access.check();
259
- this.#check();
260
- const finalTime = this.#clock.sample().requireInterval();
261
- this.#check();
262
- if (!access.current() || finalTime.upperMS >= cutoff || finalTime.upperMS >= header.uint(5) ||
263
- cutoff > timeAdd(finalTime.lowerMS, contract.uint(16)) || header.uint(5) > timeAdd(finalTime.lowerMS, contract.uint(17)))
264
- throw new RPCProtocolError("deadline_exceeded");
265
- routes.checkExecutionAdmission(route, cutoff, finalTime);
266
- const index = this.#slots.findIndex(value => value === undefined);
267
- if (index < 0)
268
- throw new RPCProtocolError("resource_exhausted");
269
- const record = {
270
- notification, streaming, metadataFinished: false, key, domain: identity.authority, request: requestID, contract: contractID, cutoff, historyUntil, retention, limit,
271
- state: "accepted", active: true, dispatched: false, cancelMode: contract.optionalUint(19) === 1n, cancelRequested: false, resultDigest: "0".repeat(64), result, resultBytes: 0, resultCode: undefined, resultUntil: undefined, error: undefined,
272
- holders: 1, transitions: 0, transitionTail: Promise.resolve(), deferredFailure: undefined, exitRequested: false, stop, waiters: new Set()
273
- };
274
- let registered = false;
275
- const receipt = () => {
276
- if (registered)
277
- throw new RPCProtocolError("service_failed");
278
- registered = true;
279
- committedRecord = record;
280
- this.#records.set(key, record);
281
- this.#slots[index] = record;
282
- this.#active++;
283
- result = undefined;
284
- };
285
- await this.#storageWork(() => {
286
- if (this.#storage === undefined) {
287
- receipt();
288
- return;
289
- }
290
- return this.#storage.register(record, contract, header.uint(5), () => { access.check(); this.#check(); routes.checkExecutionAdmission(route, cutoff, this.#clock.sample().requireInterval()); }, receipt);
291
- });
292
- if (!registered)
293
- throw new RPCProtocolError("service_failed");
294
- return new VolatileExecutionAttempt(capability, this, record, true);
295
- }
296
- catch (error) {
297
- if (committedRecord !== undefined) {
298
- // A receipt may have settled registration before a later SDK failure.
299
- // No public attempt owns its one holder, but history cannot be erased.
300
- this.fail(committedRecord, "service_unavailable");
301
- this.exit(committedRecord);
302
- this.release(committedRecord);
303
- }
304
- throw error;
305
- }
306
- finally {
307
- result?.close();
308
- this.#busy = false;
309
- this.#collectClosed();
310
- }
311
- }
312
- async enter(record, guard) {
313
- return await this.#recordWork(record, async () => {
314
- this.#check();
315
- if (!record.active || record.dispatched || record.state !== "accepted")
316
- throw new RPCProtocolError("service_unavailable");
317
- await this.#updateReceipt({ ...record, dispatched: true, state: "executing" }, undefined, () => { this.#check(); guard?.(); }, () => {
318
- record.dispatched = true;
319
- record.state = "executing";
320
- });
321
- this.#check();
322
- guard?.();
323
- });
324
- }
325
- async finish(record, bytes, code, executionCap) {
326
- return await this.#recordWork(record, async () => {
327
- this.#check();
328
- if (!record.active || !record.dispatched || record.resultUntil !== undefined || record.error !== undefined || bytes.length > record.limit)
329
- throw new RPCProtocolError("service_failed");
330
- const now = this.#clock.sample().requireInterval(), until = timeAdd(now.upperMS, record.retention);
331
- this.#check();
332
- if (record.error !== undefined || !record.active || record.resultUntil !== undefined || now.upperMS >= executionCap)
333
- throw new RPCProtocolError("deadline_exceeded");
334
- const resultDigest = hex(sha256(bytes)), state = code === undefined ? "completed" : "failed";
335
- const completed = { ...record, resultDigest, resultBytes: bytes.length, resultCode: code, resultUntil: until, state };
336
- await this.#updateReceipt(completed, bytes, () => { this.#check(); if (this.#clock.sample().requireInterval().upperMS >= executionCap)
337
- throw new RPCProtocolError("deadline_exceeded"); }, () => {
338
- this.#applyResultReceipt(record, { facts: completed, payload: bytes });
339
- });
340
- this.#check();
341
- });
342
- }
343
- async saveContent(record, position, payload, executionCap, guard) {
344
- return await this.#recordWork(record, async () => {
345
- this.#check();
346
- if (this.#storage === undefined || !record.streaming || !record.active || !record.dispatched || record.state !== "executing")
347
- throw new RPCProtocolError("service_unavailable");
348
- return (await this.#storage.saveContent(record, position, payload, executionCap, () => { this.#check(); guard(); }));
349
- });
350
- }
351
- async readContent(record, target, position, destination, readerType, guard) {
352
- return await this.#recordWork(record, async () => {
353
- this.#check();
354
- const captured = captureExecutionTarget(target), [authority, subject] = record.key.split("\0");
355
- if (this.#storage === undefined || !record.active || !record.dispatched || record.state !== "executing" || record.streaming || record.notification ||
356
- captured.authority !== authority || captured.subject !== subject || captured.tenant !== this.config.tenant || captured.audience !== this.config.audience || captured.namespace !== this.config.namespace)
357
- throw new RPCProtocolError("permission_denied");
358
- return (await this.#storage.readContent(record, captured, position, destination, readerType, () => { this.#check(); guard(); }));
359
- });
360
- }
361
- async issueCheckpoint(record, original, checkpoint, options, policy, executionCap, guard) {
362
- return await this.#recordWork(record, async () => {
363
- this.#check();
364
- if (this.#storage === undefined || record.notification || record.streaming || !record.active || !record.dispatched || record.state !== "executing" || record.resultUntil !== undefined || record.error !== undefined)
365
- throw new RPCProtocolError("service_unavailable");
366
- const captured = captureCheckpoint(original, checkpoint, options), target = captured.target;
367
- const [authority, subject, operation] = record.key.split("\0");
368
- if (target.tenant !== this.config.tenant || target.audience !== this.config.audience || target.namespace !== this.config.namespace ||
369
- target.authority !== authority || target.subject !== subject || target.operation === operation)
370
- throw new RPCProtocolError("permission_denied");
371
- const check = () => { this.#check(); guard(); };
372
- try {
373
- const result = await this.#storage.issueCheckpoint(record, target, captured.checkpoint, captured.options, policy, executionCap, check, receipt => this.#applyResultReceipt(record, receipt));
374
- result.payload.fill(0);
375
- }
376
- finally {
377
- captured.checkpoint.position.fill(0);
378
- }
379
- });
380
- }
381
- async finishResume(record, request, target, policy, executionCap, guard) {
382
- return await this.#recordWork(record, async () => {
383
- this.#check();
384
- if (this.#storage === undefined || record.notification || record.streaming || !record.active || !record.dispatched || record.resultUntil !== undefined || record.error !== undefined)
385
- throw new RPCProtocolError("service_unavailable");
386
- const result = await this.#storage.finishResume(record, request, target, policy, executionCap, () => { this.#check(); guard(); }, receipt => this.#applyResultReceipt(record, receipt));
387
- try {
388
- return result.outcome;
389
- }
390
- finally {
391
- result.payload.fill(0);
392
- }
393
- });
394
- }
395
- async finishNotification(record, executionCap) {
396
- return await this.#recordWork(record, async () => {
397
- this.#check();
398
- if (!record.notification || !record.active || !record.dispatched || record.error !== undefined || record.state !== "executing")
399
- throw new RPCProtocolError("service_failed");
400
- const now = this.#clock.sample().requireInterval();
401
- this.#check();
402
- if (now.upperMS >= executionCap)
403
- throw new RPCProtocolError("deadline_exceeded");
404
- await this.#updateReceipt({ ...record, state: "completed" }, undefined, () => { this.#check(); if (this.#clock.sample().requireInterval().upperMS >= executionCap)
405
- throw new RPCProtocolError("deadline_exceeded"); }, () => {
406
- record.state = "completed";
407
- this.#notify(record);
408
- });
409
- this.#check();
410
- });
411
- }
412
- async finishStreaming(record, executionCap, applicationError) {
413
- return await this.#recordWork(record, async () => {
414
- this.#check();
415
- if (!record.streaming || !record.active || !record.dispatched || record.metadataFinished || record.error !== undefined)
416
- throw new RPCProtocolError("service_failed");
417
- const now = this.#clock.sample().requireInterval();
418
- this.#check();
419
- if (now.upperMS >= executionCap)
420
- throw new RPCProtocolError("deadline_exceeded");
421
- // The stable stream contract promises execution metadata, not saved
422
- // items. Never turn the final item or an empty body into a unary result.
423
- const state = applicationError === undefined ? "completed" : "failed";
424
- await this.#updateReceipt({ ...record, metadataFinished: true, resultCode: applicationError, state }, undefined, () => { this.#check(); if (this.#clock.sample().requireInterval().upperMS >= executionCap)
425
- throw new RPCProtocolError("deadline_exceeded"); }, () => {
426
- record.metadataFinished = true;
427
- record.resultCode = applicationError;
428
- record.state = state;
429
- this.#notify(record);
430
- });
431
- this.#check();
432
- });
433
- }
434
- fail(record, code) {
435
- if (record.transitions !== 0) {
436
- record.deferredFailure ??= code;
437
- return;
438
- }
439
- if (record.metadataFinished || record.state === "completed" || record.resultUntil !== undefined || record.error !== undefined)
440
- return;
441
- record.error = code;
442
- record.state = record.dispatched ? "unknown" : "failed";
443
- // An uncertain persistent write fences the store. Keep the actual local
444
- // task and let explicit reopen recover its original persisted facts.
445
- try {
446
- void this.#recordWork(record, () => this.#storage?.update({ ...record })).catch(() => undefined);
447
- }
448
- catch { /* No publication authority. */ }
449
- this.#notify(record);
450
- }
451
- exit(record) {
452
- if (!record.active)
453
- return;
454
- if (record.transitions !== 0) {
455
- record.exitRequested = true;
456
- return;
457
- }
458
- record.exitRequested = false;
459
- if (!record.metadataFinished && record.state !== "completed" && record.resultUntil === undefined && record.error === undefined)
460
- this.fail(record, "service_failed");
461
- record.active = false;
462
- record.stop = undefined;
463
- try {
464
- void this.#recordWork(record, () => this.#storage?.update({ ...record })).catch(() => undefined);
465
- }
466
- catch { /* Reopen settles persisted active facts. */ }
467
- this.#active--;
468
- this.#collectClosed();
469
- }
470
- release(record) { record.holders--; this.#collectClosed(); }
471
- #notify(record) { for (const wake of [...record.waiters])
472
- wake(); }
473
- async wait(record, signal) {
474
- this.#check();
475
- if (record.metadataFinished || record.state === "completed" || record.resultUntil !== undefined || record.error !== undefined)
476
- return;
477
- if (record.waiters.size >= 64 || aborted(signal))
478
- throw new RPCProtocolError("service_unavailable");
479
- await new NativePromise((resolve, reject) => {
480
- const clean = () => { record.waiters.delete(wake); removeListener.call(signal, "abort", cancel); };
481
- const wake = () => { clean(); resolve(); }, cancel = () => { clean(); reject(new RPCProtocolError("service_unavailable")); };
482
- record.waiters.add(wake);
483
- addListener.call(signal, "abort", cancel, { once: true });
484
- if (aborted(signal))
485
- cancel();
486
- });
487
- }
488
- copyResult(record, destination) {
489
- this.#check();
490
- if (record.error !== undefined)
491
- return { bytes: 0, sdkError: record.error };
492
- const now = this.#clock.sample().requireInterval();
493
- this.#check();
494
- if (record.resultUntil === undefined)
495
- throw new RPCProtocolError("service_unavailable");
496
- if (record.result === undefined || now.lowerMS >= record.resultUntil)
497
- return { bytes: 0, sdkError: "result_expired" };
498
- if (now.upperMS >= record.resultUntil)
499
- return { bytes: 0, sdkError: "service_unavailable" };
500
- const borrow = record.result.borrowShared(record.resultBytes);
501
- try {
502
- destination.write(0, borrow.bytes);
503
- }
504
- finally {
505
- borrow.release();
506
- }
507
- return { bytes: record.resultBytes, ...(record.resultCode === undefined ? {} : { applicationError: record.resultCode }) };
508
- }
509
- /** A read pins only the original immutable backing. Its charged metadata
510
- * and the pin follow the publisher through the actual last fragment tail. */
511
- captureResult(target, access, reference, runtimeBytes) {
512
- this.#check();
513
- if (this.#busy)
514
- throw new RPCProtocolError("service_unavailable");
515
- this.#busy = true;
516
- let metadata, borrow;
517
- try {
518
- access.check();
519
- this.#check();
520
- if (!access.current() || !reference.sameEnvironment(this.#reference) || target.tenant !== this.config.tenant ||
521
- target.audience !== this.config.audience || target.namespace !== this.config.namespace || !this.#floors.has(target.authority))
522
- throw new RPCProtocolError("permission_denied");
523
- const record = this.#records.get(`${target.authority}\0${target.subject}\0${target.operation}`);
524
- // The fixed RPC error catalog has no absent-history assertion. The
525
- // separate bounded QueryOperation supplies that observation when needed.
526
- if (record === undefined)
527
- throw new RPCProtocolError("service_unavailable");
528
- if (record.request !== target.requestDigest || record.contract !== target.contractDigest)
529
- throw new RPCProtocolError("operation_conflict");
530
- const check = () => {
531
- access.check();
532
- this.#check();
533
- const now = this.#clock.sample().requireInterval();
534
- access.check();
535
- this.#check();
536
- if (!access.current() || record.resultUntil === undefined)
537
- throw new RPCProtocolError("service_unavailable");
538
- if (record.result === undefined || now.lowerMS >= record.resultUntil)
539
- throw new RPCProtocolError("result_expired");
540
- if (now.upperMS >= record.resultUntil)
541
- throw new RPCProtocolError("service_unavailable");
542
- };
543
- check();
544
- if (record.holders >= 64)
545
- throw new RPCProtocolError("resource_exhausted");
546
- metadata = reference.take(executionResultReadCharge(runtimeBytes));
547
- borrow = record.result.borrowShared(record.resultBytes);
548
- const original = borrow, owned = metadata;
549
- let held = true;
550
- const result = Object.freeze({
551
- payload: Object.freeze({
552
- bytes: original.bytes, retainSend: original.retainSend, release: () => {
553
- if (!held)
554
- return;
555
- held = false;
556
- original.release();
557
- owned.release();
558
- this.release(record);
559
- }
560
- }), guard: Object.freeze({
561
- check: () => {
562
- if (!held)
563
- throw new RPCProtocolError("service_unavailable");
564
- owned.check();
565
- check();
566
- if (!held)
567
- throw new RPCProtocolError("service_unavailable");
568
- }, current: () => held && !this.#closed && access.current()
569
- })
570
- });
571
- record.holders++;
572
- borrow = undefined;
573
- metadata = undefined;
574
- return result;
575
- }
576
- finally {
577
- borrow?.release();
578
- metadata?.release();
579
- this.#busy = false;
580
- this.#collectClosed();
581
- }
582
- }
583
- /** Current Session authority must be checked before lookup. A remote target
584
- * does not prove continuity of an absent RAM record. Cancellation changes
585
- * the original record before any cooperative application signal is emitted. */
586
- async manage(target, cancel, access) {
587
- this.#check();
588
- if (this.#busy)
589
- return { status: "unavailable" };
590
- this.#busy = true;
591
- let notify;
592
- try {
593
- access.check();
594
- this.#check();
595
- const now = this.#clock.sample().requireInterval();
596
- access.check();
597
- this.#check();
598
- if (!access.current() || target.tenant !== this.config.tenant || target.audience !== this.config.audience || target.namespace !== this.config.namespace ||
599
- !this.#floors.has(target.authority))
600
- throw new RPCProtocolError("permission_denied");
601
- const record = this.#records.get(`${target.authority}\0${target.subject}\0${target.operation}`);
602
- if (record === undefined) {
603
- const key = `${target.authority}\0${target.subject}\0${target.operation}`, cutoff = BigInt("0x" + target.operation.slice(0, 16));
604
- const reason = (await this.#storageWork(() => this.#storage?.absence(key, target.authority, cutoff, () => { access.check(); this.#check(); }))) ?? "history_unknown";
605
- return Object.freeze({
606
- status: cancel ? "ok" : reason === "not_registered" ? "not_found" : "history_unknown",
607
- observation: Object.freeze({ found: false, reason }), ...(cancel ? { cancelResult: reason } : {})
608
- });
609
- }
610
- if (record.request !== target.requestDigest || record.contract !== target.contractDigest)
611
- throw new RPCProtocolError("operation_conflict");
612
- if (cancel && !record.cancelMode)
613
- return { status: "unsupported" };
614
- let cancelResult = "terminal";
615
- if (cancel)
616
- await this.#recordWork(record, async () => {
617
- access.check();
618
- this.#check();
619
- if (["accepted", "executing", "unknown"].includes(record.state)) {
620
- const state = record.dispatched ? record.state : "failed", error = record.dispatched ? record.error : "service_unavailable";
621
- await this.#updateReceipt({ ...record, cancelRequested: true, state, error }, undefined, () => { access.check(); this.#check(); }, () => {
622
- // A failed or uncertain durable write cannot publish a cancellation
623
- // fact or dispatch a cooperative signal as though it were confirmed.
624
- if (!record.cancelRequested)
625
- notify = record.stop;
626
- record.cancelRequested = true;
627
- record.state = state;
628
- record.error = error;
629
- cancelResult = "requested";
630
- });
631
- }
632
- });
633
- const formed = record.resultUntil !== undefined, deleted = formed && (record.result === undefined || now.lowerMS >= record.resultUntil);
634
- const observation = Object.freeze({
635
- found: true,
636
- reason: record.error === undefined ? "none" : record.cancelRequested && !record.dispatched ? "cancelled" : record.error === "deadline_exceeded" ? "deadline_exceeded" : record.dispatched ? "work_outcome_unknown" : "dispatch_unavailable",
637
- state: record.state, cancelRequested: record.cancelRequested, dispatched: record.dispatched, workActive: record.active,
638
- historyNotBeforeGCMS: record.historyUntil, resultNotAfterMS: record.resultUntil ?? 0n,
639
- resultAvailable: formed && record.result !== undefined && now.upperMS < record.resultUntil, resultDeleted: deleted,
640
- resultBytes: record.resultBytes, applicationErrorCode: record.resultCode ?? 0, resultDigest: record.resultDigest
641
- });
642
- return Object.freeze({ status: cancel ? "ok" : deleted ? "result_expired" : "ok", observation, ...(cancel ? { cancelResult } : {}) });
643
- }
644
- finally {
645
- this.#busy = false;
646
- // AbortSignal dispatch can enter application listeners. Leave the finite
647
- // history gate first; the signal never supplies work-exit evidence.
648
- if (notify !== undefined)
649
- queueMicrotask(notify);
650
- this.#collectClosed();
651
- }
652
- }
653
- #tick = async () => {
654
- this.#timer = undefined;
655
- if (this.#closed)
656
- return;
657
- if (this.#busy) {
658
- this.#timer = setTimeout(this.#tick, 1000);
659
- return;
660
- }
661
- this.#busy = true;
662
- try {
663
- const now = this.#clock.sample().requireInterval();
664
- this.#check();
665
- for (let count = 0; count < Math.min(8, this.#slots.length); count++) {
666
- const index = this.#cursor;
667
- this.#cursor = (index + 1) % this.#slots.length;
668
- const record = this.#slots[index];
669
- if (record === undefined || record.transitions !== 0)
670
- continue;
671
- if (!record.active && record.holders === 0 && record.result !== undefined && (record.resultUntil === undefined || now.lowerMS >= record.resultUntil)) {
672
- (await this.#storageWork(() => this.#storage?.expireResult(record.key)));
673
- record.result.close();
674
- record.result = undefined;
675
- }
676
- if (record.active || record.holders !== 0 || record.result !== undefined || now.lowerMS < record.historyUntil || now.lowerMS < record.cutoff)
677
- continue;
678
- // Install the original domain's floor before deleting any key detail.
679
- const floor = record.cutoff > this.#floors.get(record.domain) ? record.cutoff : this.#floors.get(record.domain);
680
- (await this.#storageWork(() => this.#storage?.remove(record.key, record.domain, floor)));
681
- this.#floors.set(record.domain, floor);
682
- this.#records.delete(record.key);
683
- this.#slots[index] = undefined;
684
- }
685
- }
686
- catch { /* Unavailable trusted time cannot delete history or advance a floor. */ }
687
- finally {
688
- this.#busy = false;
689
- this.#collectClosed();
690
- }
691
- if (!this.#closed)
692
- this.#timer = setTimeout(this.#tick, 1000);
693
- };
694
- close() {
695
- if (this.#closed)
696
- return;
697
- this.#closed = true;
698
- if (this.#timer !== undefined)
699
- clearTimeout(this.#timer);
700
- this.#timer = undefined;
701
- for (const record of this.#records.values()) {
702
- this.fail(record, "service_unavailable");
703
- record.stop?.();
704
- }
705
- this.#collectClosed();
706
- }
707
- #collectClosed() {
708
- if (!this.#closed || this.#busy || this.#pendingStorage !== 0 || this.#pendingRecordWork !== 0 || this.#active !== 0 || [...this.#records.values()].some(record => record.holders !== 0 || record.transitions !== 0))
709
- return;
710
- for (const record of this.#records.values())
711
- record.result?.close();
712
- this.#records.clear();
713
- this.#slots.fill(undefined);
714
- this.#floors.clear();
715
- if (this.#storageBound) {
716
- this.#storageBound = false;
717
- this.#storage.release();
718
- }
719
- this.#resultAccount?.close();
720
- this.#resultAccount = undefined;
721
- this.#reference?.release();
722
- this.#reference = undefined;
723
- }
724
- cleanupComplete() { this.#collectClosed(); return this.#reference === undefined; }
725
- }
726
- /** A duplicate has observation rights only. Only the first complete input
727
- * receives the original one-use execution work capability. */
728
- export class VolatileExecutionAttempt {
729
- created;
730
- #owner;
731
- #exited = false;
732
- #record;
733
- constructor(token, owner, record, created) {
734
- this.created = created;
735
- if (token !== capability)
736
- throw new RPCProtocolError("rpc_owner");
737
- this.#owner = owner;
738
- this.#record = record;
739
- Object.freeze(this);
740
- }
741
- async enter(guard) {
742
- if (!this.created)
743
- throw new RPCProtocolError("rpc_owner");
744
- (await this.#owner.enter(this.#record, guard));
745
- }
746
- async finish(bytes, code, executionCap) {
747
- if (!this.created)
748
- throw new RPCProtocolError("rpc_owner");
749
- (await this.#owner.finish(this.#record, bytes, code, executionCap));
750
- }
751
- async saveContent(position, payload, executionCap, guard) {
752
- if (!this.created || this.#exited)
753
- throw new RPCProtocolError("rpc_owner");
754
- return (await this.#owner.saveContent(this.#record, position, payload, executionCap, guard));
755
- }
756
- async readContent(target, position, destination, readerType, guard) {
757
- if (!this.created || this.#exited)
758
- throw new RPCProtocolError("rpc_owner");
759
- return (await this.#owner.readContent(this.#record, target, position, destination, readerType, guard));
760
- }
761
- async issueCheckpoint(original, checkpoint, options, policy, executionCap, guard) {
762
- if (!this.created || this.#exited)
763
- throw new RPCProtocolError("rpc_owner");
764
- (await this.#owner.issueCheckpoint(this.#record, original, checkpoint, options, policy, executionCap, guard));
765
- }
766
- async finishResume(request, target, policy, executionCap, guard) {
767
- if (!this.created || this.#exited)
768
- throw new RPCProtocolError("rpc_owner");
769
- return (await this.#owner.finishResume(this.#record, request, target, policy, executionCap, guard));
770
- }
771
- async finishNotification(executionCap) {
772
- if (!this.created)
773
- throw new RPCProtocolError("rpc_owner");
774
- (await this.#owner.finishNotification(this.#record, executionCap));
775
- }
776
- async finishStreaming(executionCap, applicationError) {
777
- if (!this.created)
778
- throw new RPCProtocolError("rpc_owner");
779
- (await this.#owner.finishStreaming(this.#record, executionCap, applicationError));
780
- }
781
- fail(code) { if (this.created)
782
- this.#owner?.fail(this.#record, code); }
783
- exit() { if (this.#exited || !this.created)
784
- return; this.#exited = true; this.#owner?.exit(this.#record); }
785
- wait(signal) { return this.#owner.wait(this.#record, signal); }
786
- copyResult(destination) { return this.#owner.copyResult(this.#record, destination); }
787
- release() { this.exit(); const owner = this.#owner; this.#owner = undefined; owner?.release(this.#record); }
788
- }
789
- for (const owner of [VolatileExecutions, VolatileExecutionAttempt]) {
790
- Object.freeze(owner.prototype);
791
- Object.freeze(owner);
792
- }