@zlink-systems/framework 0.30.3 → 0.32.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 (398) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/contracts/Actors/ZLinkActor.d.ts +2 -0
  3. package/dist/contracts/Actors/ZLinkSessionBindingIdentity.d.ts +6 -0
  4. package/dist/contracts/Actors/ZLinkSessionBindingIdentity.js +2 -0
  5. package/dist/contracts/Actors/index.d.ts +1 -0
  6. package/dist/contracts/Actors/index.js +1 -0
  7. package/dist/contracts/Common/CoreTypes.d.ts +1 -0
  8. package/dist/contracts/Common/HandlerMessageType.d.ts +8 -0
  9. package/dist/contracts/Common/HandlerMessageType.js +41 -0
  10. package/dist/contracts/Common/ZLinkEncodedPayload.d.ts +1 -1
  11. package/dist/contracts/Common/ZLinkEncodedPayload.js +12 -20
  12. package/dist/contracts/Common/ZLinkMessage.js +11 -7
  13. package/dist/contracts/Common/encoded-payload-storage.d.ts +0 -2
  14. package/dist/contracts/Common/encoded-payload-storage.js +4 -16
  15. package/dist/contracts/Common/index.d.ts +1 -1
  16. package/dist/contracts/Common/payload-slab.d.ts +4 -0
  17. package/dist/contracts/Common/payload-slab.js +30 -0
  18. package/dist/contracts/Configuration/RegistrationBuilders.js +15 -9
  19. package/dist/contracts/Configuration/RegistrationTypes.d.ts +19 -0
  20. package/dist/contracts/Handlers/Contexts.d.ts +1 -0
  21. package/dist/contracts/Locations/Authority.d.ts +2 -0
  22. package/dist/internal.d.ts +9 -0
  23. package/dist/internal.js +23 -1
  24. package/dist/nest-integration.d.ts +1 -0
  25. package/dist/nest-integration.js +3 -1
  26. package/dist/runtime/actors/actor-client.d.ts +6 -2
  27. package/dist/runtime/actors/actor-client.js +120 -82
  28. package/dist/runtime/actors/actor-context.js +16 -5
  29. package/dist/runtime/actors/actor-execution-context.js +2 -2
  30. package/dist/runtime/actors/actor-handoff.d.ts +12 -1
  31. package/dist/runtime/actors/actor-handoff.js +79 -34
  32. package/dist/runtime/actors/actor-join-deferred-scope.js +6 -6
  33. package/dist/runtime/actors/actor-local-native-join.d.ts +2 -2
  34. package/dist/runtime/actors/actor-local-native-join.js +19 -17
  35. package/dist/runtime/actors/actor-mailbox.d.ts +1 -1
  36. package/dist/runtime/actors/actor-remote-joiner.d.ts +2 -2
  37. package/dist/runtime/actors/actor-remote-joiner.js +4 -4
  38. package/dist/runtime/actors/actor-routed-join-transport.d.ts +9 -3
  39. package/dist/runtime/actors/actor-routed-json-request.d.ts +3 -0
  40. package/dist/runtime/actors/actor-runtime-contracts.d.ts +2 -2
  41. package/dist/runtime/actors/actor-runtime-state.d.ts +1 -1
  42. package/dist/runtime/actors/spot-actor-dispatch.d.ts +9 -5
  43. package/dist/runtime/actors/spot-actor-dispatch.js +60 -38
  44. package/dist/runtime/admission.d.ts +6 -4
  45. package/dist/runtime/admission.js +21 -10
  46. package/dist/runtime/application-jobs/application-ingress-record-owner.d.ts +1 -0
  47. package/dist/runtime/application-jobs/application-ingress-record-owner.js +3 -0
  48. package/dist/runtime/backend/contracts/index.d.ts +26 -10
  49. package/dist/runtime/backend/mesh-completion-table.d.ts +7 -1
  50. package/dist/runtime/backend/mesh-completion-table.js +84 -20
  51. package/dist/runtime/backend/mesh-dispatch-pump.d.ts +19 -6
  52. package/dist/runtime/backend/mesh-dispatch-pump.js +246 -147
  53. package/dist/runtime/backend/node/node-backend-adapter-support.d.ts +3 -2
  54. package/dist/runtime/backend/node/node-backend-adapter-support.js +27 -19
  55. package/dist/runtime/backend/node/node-dealer-channel-client-transport.d.ts +5 -2
  56. package/dist/runtime/backend/node/node-dealer-channel-client-transport.js +70 -13
  57. package/dist/runtime/backend/node/node-event-loop-poller.d.ts +2 -2
  58. package/dist/runtime/backend/node/node-event-loop-poller.js +4 -3
  59. package/dist/runtime/backend/node/node-mesh-backend-adapter.js +5 -1
  60. package/dist/runtime/backend/node/node-raw-binding-port.d.ts +7 -2
  61. package/dist/runtime/backend/node/node-raw-binding-port.js +99 -63
  62. package/dist/runtime/backend/node/node-raw-mesh-backend.d.ts +34 -16
  63. package/dist/runtime/backend/node/node-raw-mesh-backend.js +210 -106
  64. package/dist/runtime/backend/node/node-socket-backend-adapter.js +20 -6
  65. package/dist/runtime/backend/raw-binding-port.d.ts +6 -3
  66. package/dist/runtime/channels/channel-clients.js +3 -3
  67. package/dist/runtime/channels/channel-dispatch-pipeline.d.ts +11 -7
  68. package/dist/runtime/channels/channel-dispatch-pipeline.js +40 -22
  69. package/dist/runtime/channels/channel-dispatch-services.d.ts +3 -1
  70. package/dist/runtime/channels/channel-dispatch-services.js +7 -6
  71. package/dist/runtime/channels/channel-dispatchers.d.ts +13 -6
  72. package/dist/runtime/channels/channel-dispatchers.js +57 -36
  73. package/dist/runtime/channels/channel-envelope.d.ts +2 -2
  74. package/dist/runtime/channels/channel-envelope.js +609 -83
  75. package/dist/runtime/channels/channel-multipart.d.ts +1 -0
  76. package/dist/runtime/channels/channel-multipart.js +10 -6
  77. package/dist/runtime/channels/channel-outbound-operations.d.ts +6 -9
  78. package/dist/runtime/channels/channel-outbound-operations.js +107 -105
  79. package/dist/runtime/channels/channel-receive-loops.d.ts +9 -7
  80. package/dist/runtime/channels/channel-receive-loops.js +126 -90
  81. package/dist/runtime/channels/channel-runtime-lifecycle.d.ts +23 -6
  82. package/dist/runtime/channels/channel-runtime-lifecycle.js +47 -38
  83. package/dist/runtime/channels/channel-runtime-manager.d.ts +13 -6
  84. package/dist/runtime/channels/channel-runtime-manager.js +32 -14
  85. package/dist/runtime/channels/channel-socket-registry.d.ts +28 -4
  86. package/dist/runtime/channels/channel-socket-registry.js +9 -1
  87. package/dist/runtime/channels/channel-transports.d.ts +23 -16
  88. package/dist/runtime/channels/channel-transports.js +139 -119
  89. package/dist/runtime/channels/dispatch-error-reporter.d.ts +4 -4
  90. package/dist/runtime/channels/dispatch-error-reporter.js +5 -5
  91. package/dist/runtime/channels/fanout-location-runtime.d.ts +1 -1
  92. package/dist/runtime/channels/local-spot-route-transport.d.ts +5 -2
  93. package/dist/runtime/channels/local-spot-route-transport.js +15 -18
  94. package/dist/runtime/channels/router-socket-spot-route-transport.d.ts +6 -3
  95. package/dist/runtime/channels/router-socket-spot-route-transport.js +33 -19
  96. package/dist/runtime/channels/source-spot-router.d.ts +6 -3
  97. package/dist/runtime/channels/source-spot-router.js +34 -23
  98. package/dist/runtime/channels/spot-node-route-transport.d.ts +6 -3
  99. package/dist/runtime/channels/spot-node-route-transport.js +23 -17
  100. package/dist/runtime/channels/spot-route-bridge-transport.d.ts +6 -3
  101. package/dist/runtime/channels/spot-route-bridge-transport.js +38 -24
  102. package/dist/runtime/channels/spot-route-dispatch-strategy.d.ts +8 -4
  103. package/dist/runtime/channels/spot-route-dispatch-strategy.js +36 -23
  104. package/dist/runtime/diagnostics/dispatch-error-details.js +9 -3
  105. package/dist/runtime/diagnostics/message-flow-bootstrap.d.ts +1 -0
  106. package/dist/runtime/diagnostics/message-flow-bootstrap.js +8 -0
  107. package/dist/runtime/diagnostics/message-flow-delivery.d.ts +47 -0
  108. package/dist/runtime/diagnostics/message-flow-delivery.js +149 -0
  109. package/dist/runtime/diagnostics/message-flow-record.d.ts +50 -0
  110. package/dist/runtime/diagnostics/message-flow-record.js +228 -0
  111. package/dist/runtime/diagnostics/message-flow-worker.d.ts +1 -0
  112. package/dist/runtime/diagnostics/message-flow-worker.js +118 -0
  113. package/dist/runtime/diagnostics/message-flow.d.ts +7 -19
  114. package/dist/runtime/diagnostics/message-flow.js +42 -290
  115. package/dist/runtime/diagnostics/runtime-metrics.d.ts +4 -3
  116. package/dist/runtime/diagnostics/runtime-metrics.js +8 -4
  117. package/dist/runtime/execution/index.d.ts +1 -0
  118. package/dist/runtime/execution/index.js +6 -3
  119. package/dist/runtime/execution/serial-execution-queue.d.ts +26 -13
  120. package/dist/runtime/execution/serial-execution-queue.js +75 -71
  121. package/dist/runtime/foundation/durable-service-request.d.ts +12 -3
  122. package/dist/runtime/foundation/durable-service-request.js +158 -73
  123. package/dist/runtime/foundation/operation-registry.d.ts +33 -3
  124. package/dist/runtime/foundation/operation-registry.js +272 -33
  125. package/dist/runtime/foundation/raw-service-mesh-runtime.d.ts +62 -23
  126. package/dist/runtime/foundation/raw-service-mesh-runtime.js +373 -194
  127. package/dist/runtime/foundation/request-runtime.d.ts +17 -0
  128. package/dist/runtime/foundation/request-runtime.js +163 -0
  129. package/dist/runtime/foundation/service-discovery-registry.d.ts +4 -0
  130. package/dist/runtime/foundation/service-discovery-registry.js +6 -0
  131. package/dist/runtime/foundation/service-liveness-registry.d.ts +1 -1
  132. package/dist/runtime/foundation/service-mailbox.d.ts +4 -2
  133. package/dist/runtime/foundation/service-mailbox.js +4 -1
  134. package/dist/runtime/foundation/service-relocation-object-owner.d.ts +2 -2
  135. package/dist/runtime/foundation/service-relocation-object-owner.js +12 -5
  136. package/dist/runtime/foundation/service-runtime-contracts.d.ts +7 -2
  137. package/dist/runtime/foundation/service-stateful-registry.d.ts +6 -2
  138. package/dist/runtime/foundation/service-stateful-registry.js +38 -17
  139. package/dist/runtime/foundation/service-stateful-runtime.d.ts +91 -26
  140. package/dist/runtime/foundation/service-stateful-runtime.js +245 -120
  141. package/dist/runtime/foundation/service-stateful-wire-codec.d.ts +3 -0
  142. package/dist/runtime/foundation/service-stateful-wire-codec.js +15 -0
  143. package/dist/runtime/foundation/service-topology-registry.d.ts +2 -0
  144. package/dist/runtime/foundation/service-topology-registry.js +13 -3
  145. package/dist/runtime/foundation/service-wire-constants.generated.d.ts +1 -0
  146. package/dist/runtime/foundation/service-wire-constants.generated.js +12 -0
  147. package/dist/runtime/foundation/service-wire-m6a-codec.d.ts +5 -1
  148. package/dist/runtime/foundation/service-wire-m6a-codec.js +50 -15
  149. package/dist/runtime/host/actor-packet-relay.d.ts +5 -6
  150. package/dist/runtime/host/actor-packet-relay.js +58 -57
  151. package/dist/runtime/host/actor-placement-coordinator.d.ts +1 -1
  152. package/dist/runtime/host/actor-runtime-options-factory.d.ts +2 -0
  153. package/dist/runtime/host/actor-runtime-options-factory.js +3 -2
  154. package/dist/runtime/host/actor-transfer-runtime.d.ts +3 -3
  155. package/dist/runtime/host/application-job-queue.d.ts +7 -5
  156. package/dist/runtime/host/application-job-queue.js +33 -21
  157. package/dist/runtime/host/bound-session-relay.js +0 -1
  158. package/dist/runtime/host/channel-runtime-options-factory.d.ts +2 -0
  159. package/dist/runtime/host/channel-runtime-options-factory.js +1 -0
  160. package/dist/runtime/host/entry-actor-runtime.d.ts +5 -2
  161. package/dist/runtime/host/entry-actor-runtime.js +2 -2
  162. package/dist/runtime/host/index.d.ts +106 -37
  163. package/dist/runtime/host/index.js +303 -151
  164. package/dist/runtime/host/location-runtime-owner.d.ts +2 -2
  165. package/dist/runtime/host/location-runtime-owner.js +1 -1
  166. package/dist/runtime/host/service-relocation-host-runtime.d.ts +195 -45
  167. package/dist/runtime/host/service-relocation-host-runtime.js +257 -144
  168. package/dist/runtime/host/spot-address-transport.d.ts +3 -0
  169. package/dist/runtime/host/spot-address-transport.js +73 -76
  170. package/dist/runtime/host/spot-runtime-options-factory.js +2 -0
  171. package/dist/runtime/host/user-spot-creation-coordinator.d.ts +3 -1
  172. package/dist/runtime/host/user-spot-creation-coordinator.js +49 -21
  173. package/dist/runtime/internal-observation.d.ts +1 -0
  174. package/dist/runtime/internal-observation.js +5 -0
  175. package/dist/runtime/locations/actor-location-claims.d.ts +1 -1
  176. package/dist/runtime/locations/actor-location-claims.js +15 -6
  177. package/dist/runtime/locations/auto-connect-loop.d.ts +0 -1
  178. package/dist/runtime/locations/auto-connect-loop.js +25 -19
  179. package/dist/runtime/locations/auto-connect-planner.js +2 -5
  180. package/dist/runtime/locations/auto-connect-reconciler.d.ts +1 -0
  181. package/dist/runtime/locations/auto-connect-reconciler.js +35 -23
  182. package/dist/runtime/locations/in-memory-authority-store.d.ts +1 -0
  183. package/dist/runtime/locations/in-memory-authority-store.js +15 -5
  184. package/dist/runtime/locations/in-memory-location-store.d.ts +0 -2
  185. package/dist/runtime/locations/in-memory-location-store.js +1 -38
  186. package/dist/runtime/locations/lifecycle.d.ts +1 -1
  187. package/dist/runtime/locations/lifecycle.js +2 -2
  188. package/dist/runtime/locations/location-store-repository.d.ts +0 -1
  189. package/dist/runtime/locations/location-store-repository.js +163 -246
  190. package/dist/runtime/locations/resolvers.d.ts +8 -1
  191. package/dist/runtime/locations/resolvers.js +16 -2
  192. package/dist/runtime/locations/runtime.d.ts +3 -3
  193. package/dist/runtime/locations/runtime.js +12 -16
  194. package/dist/runtime/messaging/creation-payload-codec.js +8 -7
  195. package/dist/runtime/messaging/framework-json-v1.d.ts +1 -1
  196. package/dist/runtime/messaging/framework-json-v1.js +6 -2
  197. package/dist/runtime/messaging/payload-codec.js +21 -35
  198. package/dist/runtime/messaging/request-deadline.d.ts +4 -2
  199. package/dist/runtime/messaging/request-deadline.js +40 -25
  200. package/dist/runtime/messaging/request-result.d.ts +14 -1
  201. package/dist/runtime/messaging/request-result.js +74 -13
  202. package/dist/runtime/protocol/service_wire_codec.generated.d.ts +4 -0
  203. package/dist/runtime/protocol/service_wire_codec.generated.js +17 -7
  204. package/dist/runtime/spots/index.d.ts +28 -7
  205. package/dist/runtime/spots/index.js +31 -6
  206. package/dist/runtime/spots/spot-activation-registry.d.ts +3 -2
  207. package/dist/runtime/spots/spot-activation-registry.js +13 -8
  208. package/dist/runtime/spots/spot-activation-state.d.ts +2 -0
  209. package/dist/runtime/spots/spot-activation-state.js +1 -0
  210. package/dist/runtime/spots/spot-actor-admission-coordinator.d.ts +9 -4
  211. package/dist/runtime/spots/spot-actor-admission-coordinator.js +33 -12
  212. package/dist/runtime/spots/spot-actor-ingress-admission.d.ts +40 -0
  213. package/dist/runtime/spots/spot-actor-ingress-admission.js +78 -0
  214. package/dist/runtime/spots/spot-actor-membership.js +3 -3
  215. package/dist/runtime/spots/spot-actor-packet-dispatch.d.ts +16 -43
  216. package/dist/runtime/spots/spot-actor-packet-dispatch.js +56 -113
  217. package/dist/runtime/spots/spot-actor-packet-drain.d.ts +1 -0
  218. package/dist/runtime/spots/spot-actor-packet-drain.js +12 -5
  219. package/dist/runtime/spots/spot-entry-activation.d.ts +4 -3
  220. package/dist/runtime/spots/spot-entry-activation.js +7 -12
  221. package/dist/runtime/spots/spot-handler-registry.d.ts +5 -1
  222. package/dist/runtime/spots/spot-handler-registry.js +31 -15
  223. package/dist/runtime/spots/spot-manager-public.js +3 -2
  224. package/dist/runtime/spots/spot-node-runtime-manager.d.ts +11 -6
  225. package/dist/runtime/spots/spot-node-runtime-manager.js +6 -1
  226. package/dist/runtime/spots/spot-outbound.d.ts +8 -2
  227. package/dist/runtime/spots/spot-outbound.js +5 -5
  228. package/dist/runtime/spots/spot-route-packet-dispatch.js +13 -8
  229. package/dist/runtime/spots/spot-routed-spot-packet-dispatch.d.ts +3 -3
  230. package/dist/runtime/spots/spot-routed-spot-packet-dispatch.js +9 -5
  231. package/dist/runtime/spots/spot-runtime-ports.d.ts +2 -2
  232. package/dist/runtime/spots/spot-serial-executor.d.ts +2 -1
  233. package/dist/runtime/spots/spot-serial-turn-executor.js +20 -26
  234. package/dist/runtime/spots/spot-subscription-dispatch.js +5 -2
  235. package/dist/runtime/spots/spot-timer.d.ts +1 -1
  236. package/dist/runtime/streams/actor-session-binding-registry.d.ts +11 -3
  237. package/dist/runtime/streams/actor-session-binding-registry.js +28 -0
  238. package/dist/runtime/streams/bound-actor-relay-sender.d.ts +2 -2
  239. package/dist/runtime/streams/bound-actor-relay-sender.js +3 -4
  240. package/dist/runtime/streams/bound-session-service.js +6 -7
  241. package/dist/runtime/streams/index.d.ts +3 -3
  242. package/dist/runtime/streams/index.js +22 -2
  243. package/dist/runtime/streams/managed-stream.js +2 -1
  244. package/dist/runtime/streams/session-calls.d.ts +1 -1
  245. package/dist/runtime/streams/session-calls.js +3 -9
  246. package/dist/runtime/streams/session-context.d.ts +2 -2
  247. package/dist/runtime/streams/session-context.js +2 -2
  248. package/dist/runtime/streams/stream-session-runtime.d.ts +1 -0
  249. package/dist/runtime/streams/stream-session-runtime.js +64 -33
  250. package/package.json +3 -3
  251. package/src/contracts/Actors/ZLinkActor.ts +6 -0
  252. package/src/contracts/Actors/ZLinkSessionBindingIdentity.ts +7 -0
  253. package/src/contracts/Actors/index.ts +1 -0
  254. package/src/contracts/Common/CoreTypes.ts +1 -0
  255. package/src/contracts/Common/HandlerMessageType.ts +50 -0
  256. package/src/contracts/Common/ZLinkEncodedPayload.ts +13 -25
  257. package/src/contracts/Common/ZLinkMessage.ts +11 -7
  258. package/src/contracts/Common/encoded-payload-storage.ts +4 -16
  259. package/src/contracts/Common/index.ts +1 -1
  260. package/src/contracts/Common/payload-slab.ts +29 -0
  261. package/src/contracts/Configuration/RegistrationBuilders.ts +29 -15
  262. package/src/contracts/Configuration/RegistrationTypes.ts +19 -0
  263. package/src/contracts/Handlers/Contexts.ts +1 -0
  264. package/src/contracts/Locations/Authority.ts +7 -1
  265. package/src/internal.ts +17 -0
  266. package/src/nest-integration.ts +1 -0
  267. package/src/runtime/actors/actor-client.ts +257 -163
  268. package/src/runtime/actors/actor-context.ts +26 -14
  269. package/src/runtime/actors/actor-execution-context.ts +2 -2
  270. package/src/runtime/actors/actor-handoff.ts +86 -51
  271. package/src/runtime/actors/actor-join-deferred-scope.ts +6 -6
  272. package/src/runtime/actors/actor-local-native-join.ts +38 -17
  273. package/src/runtime/actors/actor-mailbox.ts +1 -1
  274. package/src/runtime/actors/actor-remote-joiner.ts +8 -4
  275. package/src/runtime/actors/actor-routed-join-transport.ts +13 -5
  276. package/src/runtime/actors/actor-routed-json-request.ts +3 -0
  277. package/src/runtime/actors/actor-runtime-contracts.ts +4 -2
  278. package/src/runtime/actors/actor-runtime-state.ts +1 -1
  279. package/src/runtime/actors/spot-actor-dispatch.ts +70 -68
  280. package/src/runtime/admission.ts +42 -15
  281. package/src/runtime/application-jobs/application-ingress-record-owner.ts +4 -0
  282. package/src/runtime/backend/contracts/index.ts +77 -10
  283. package/src/runtime/backend/mesh-completion-table.ts +106 -15
  284. package/src/runtime/backend/mesh-dispatch-pump.ts +294 -146
  285. package/src/runtime/backend/node/node-backend-adapter-support.ts +42 -32
  286. package/src/runtime/backend/node/node-dealer-channel-client-transport.ts +91 -34
  287. package/src/runtime/backend/node/node-event-loop-poller.ts +14 -5
  288. package/src/runtime/backend/node/node-mesh-backend-adapter.ts +5 -1
  289. package/src/runtime/backend/node/node-raw-binding-port.ts +180 -69
  290. package/src/runtime/backend/node/node-raw-mesh-backend.ts +386 -157
  291. package/src/runtime/backend/node/node-socket-backend-adapter.ts +56 -11
  292. package/src/runtime/backend/raw-binding-port.ts +13 -5
  293. package/src/runtime/channels/channel-clients.ts +26 -11
  294. package/src/runtime/channels/channel-dispatch-pipeline.ts +77 -65
  295. package/src/runtime/channels/channel-dispatch-services.ts +7 -12
  296. package/src/runtime/channels/channel-dispatchers.ts +93 -39
  297. package/src/runtime/channels/channel-envelope.ts +680 -144
  298. package/src/runtime/channels/channel-multipart.ts +17 -13
  299. package/src/runtime/channels/channel-outbound-operations.ts +204 -178
  300. package/src/runtime/channels/channel-receive-loops.ts +160 -107
  301. package/src/runtime/channels/channel-runtime-lifecycle.ts +64 -59
  302. package/src/runtime/channels/channel-runtime-manager.ts +74 -27
  303. package/src/runtime/channels/channel-socket-registry.ts +20 -5
  304. package/src/runtime/channels/channel-transports.ts +414 -287
  305. package/src/runtime/channels/dispatch-error-reporter.ts +4 -9
  306. package/src/runtime/channels/local-spot-route-transport.ts +27 -29
  307. package/src/runtime/channels/router-socket-spot-route-transport.ts +63 -32
  308. package/src/runtime/channels/source-spot-router.ts +75 -38
  309. package/src/runtime/channels/spot-node-route-transport.ts +67 -37
  310. package/src/runtime/channels/spot-route-bridge-transport.ts +62 -30
  311. package/src/runtime/channels/spot-route-dispatch-strategy.ts +105 -34
  312. package/src/runtime/diagnostics/dispatch-error-details.ts +10 -2
  313. package/src/runtime/diagnostics/message-flow-bootstrap.ts +6 -0
  314. package/src/runtime/diagnostics/message-flow-delivery.ts +171 -0
  315. package/src/runtime/diagnostics/message-flow-record.ts +295 -0
  316. package/src/runtime/diagnostics/message-flow-worker.ts +146 -0
  317. package/src/runtime/diagnostics/message-flow.ts +49 -362
  318. package/src/runtime/diagnostics/runtime-metrics.ts +10 -4
  319. package/src/runtime/execution/index.ts +6 -0
  320. package/src/runtime/execution/serial-execution-queue.ts +94 -96
  321. package/src/runtime/foundation/durable-service-request.ts +212 -89
  322. package/src/runtime/foundation/operation-registry.ts +287 -38
  323. package/src/runtime/foundation/raw-service-mesh-runtime.ts +617 -292
  324. package/src/runtime/foundation/request-runtime.ts +227 -0
  325. package/src/runtime/foundation/service-discovery-registry.ts +7 -0
  326. package/src/runtime/foundation/service-liveness-registry.ts +1 -1
  327. package/src/runtime/foundation/service-mailbox.ts +7 -2
  328. package/src/runtime/foundation/service-relocation-object-owner.ts +21 -6
  329. package/src/runtime/foundation/service-runtime-contracts.ts +12 -2
  330. package/src/runtime/foundation/service-stateful-registry.ts +52 -19
  331. package/src/runtime/foundation/service-stateful-runtime.ts +365 -198
  332. package/src/runtime/foundation/service-stateful-wire-codec.ts +18 -0
  333. package/src/runtime/foundation/service-topology-registry.ts +21 -3
  334. package/src/runtime/foundation/service-wire-constants.generated.ts +10 -0
  335. package/src/runtime/foundation/service-wire-m6a-codec.ts +69 -17
  336. package/src/runtime/host/actor-packet-relay.ts +160 -156
  337. package/src/runtime/host/actor-placement-coordinator.ts +1 -1
  338. package/src/runtime/host/actor-runtime-options-factory.ts +7 -2
  339. package/src/runtime/host/actor-transfer-runtime.ts +3 -3
  340. package/src/runtime/host/application-job-queue.ts +56 -27
  341. package/src/runtime/host/bound-session-relay.ts +0 -1
  342. package/src/runtime/host/channel-runtime-options-factory.ts +3 -0
  343. package/src/runtime/host/entry-actor-runtime.ts +14 -6
  344. package/src/runtime/host/index.ts +388 -113
  345. package/src/runtime/host/location-runtime-owner.ts +3 -3
  346. package/src/runtime/host/service-relocation-host-runtime.ts +380 -252
  347. package/src/runtime/host/spot-address-transport.ts +110 -95
  348. package/src/runtime/host/spot-runtime-options-factory.ts +3 -0
  349. package/src/runtime/host/user-spot-creation-coordinator.ts +69 -22
  350. package/src/runtime/internal-observation.ts +2 -0
  351. package/src/runtime/locations/actor-location-claims.ts +42 -16
  352. package/src/runtime/locations/auto-connect-loop.ts +24 -16
  353. package/src/runtime/locations/auto-connect-planner.ts +2 -5
  354. package/src/runtime/locations/auto-connect-reconciler.ts +37 -24
  355. package/src/runtime/locations/in-memory-authority-store.ts +27 -7
  356. package/src/runtime/locations/in-memory-location-store.ts +1 -74
  357. package/src/runtime/locations/lifecycle.ts +4 -2
  358. package/src/runtime/locations/location-store-repository.ts +228 -308
  359. package/src/runtime/locations/resolvers.ts +20 -8
  360. package/src/runtime/locations/runtime.ts +16 -28
  361. package/src/runtime/messaging/creation-payload-codec.ts +12 -10
  362. package/src/runtime/messaging/framework-json-v1.ts +10 -1
  363. package/src/runtime/messaging/payload-codec.ts +50 -75
  364. package/src/runtime/messaging/request-deadline.ts +47 -39
  365. package/src/runtime/messaging/request-result.ts +88 -17
  366. package/src/runtime/protocol/service_wire_codec.generated.ts +18 -8
  367. package/src/runtime/protocol/service_wire_pilot_codec.generated.ts +1 -1
  368. package/src/runtime/spots/index.ts +57 -10
  369. package/src/runtime/spots/spot-activation-registry.ts +12 -8
  370. package/src/runtime/spots/spot-activation-state.ts +2 -0
  371. package/src/runtime/spots/spot-actor-admission-coordinator.ts +62 -37
  372. package/src/runtime/spots/spot-actor-ingress-admission.ts +157 -0
  373. package/src/runtime/spots/spot-actor-membership.ts +8 -5
  374. package/src/runtime/spots/spot-actor-packet-dispatch.ts +122 -206
  375. package/src/runtime/spots/spot-actor-packet-drain.ts +21 -6
  376. package/src/runtime/spots/spot-entry-activation.ts +25 -35
  377. package/src/runtime/spots/spot-handler-registry.ts +72 -15
  378. package/src/runtime/spots/spot-manager-public.ts +4 -2
  379. package/src/runtime/spots/spot-node-runtime-manager.ts +16 -7
  380. package/src/runtime/spots/spot-outbound.ts +26 -10
  381. package/src/runtime/spots/spot-route-packet-dispatch.ts +18 -8
  382. package/src/runtime/spots/spot-routed-spot-packet-dispatch.ts +14 -8
  383. package/src/runtime/spots/spot-runtime-ports.ts +5 -2
  384. package/src/runtime/spots/spot-serial-executor.ts +1 -1
  385. package/src/runtime/spots/spot-serial-turn-executor.ts +25 -40
  386. package/src/runtime/spots/spot-subscription-dispatch.ts +9 -2
  387. package/src/runtime/spots/spot-timer.ts +1 -1
  388. package/src/runtime/streams/actor-session-binding-registry.ts +46 -3
  389. package/src/runtime/streams/bound-actor-relay-sender.ts +16 -5
  390. package/src/runtime/streams/bound-session-service.ts +10 -7
  391. package/src/runtime/streams/index.ts +30 -4
  392. package/src/runtime/streams/managed-stream.ts +2 -1
  393. package/src/runtime/streams/session-calls.ts +9 -14
  394. package/src/runtime/streams/session-context.ts +6 -11
  395. package/src/runtime/streams/stream-session-runtime.ts +79 -40
  396. package/dist/runtime/spots/spot-lifecycle-metrics.d.ts +0 -8
  397. package/dist/runtime/spots/spot-lifecycle-metrics.js +0 -17
  398. package/src/runtime/spots/spot-lifecycle-metrics.ts +0 -16
@@ -1,3 +1,5 @@
1
+ import { type ZLinkRouteToActorJoinPrewarm, type ZLinkActorIngressRoute } from './spot-actor-ingress-admission';
2
+ import type { ZLinkSpotActorHandoffRuntime } from './spot-runtime-ports';
1
3
  import type { ApplicationJobOrigin } from '../application-jobs/contracts';
2
4
  import type { ActorRef, RoutingId, ZLinkActor, ZLinkMessageSerializer, ZLinkSpot } from '../../contracts';
3
5
  import type { Message } from '../../contracts/Common/Message';
@@ -19,6 +21,7 @@ export interface ZLinkActorRequestTerminal {
19
21
  /** One admitted Actor packet and the routing context that must move with it. */
20
22
  export interface ZLinkActorPacketDelivery {
21
23
  readonly origin: ApplicationJobOrigin;
24
+ readonly receivedAt?: Date;
22
25
  readonly actorId: string;
23
26
  readonly parts: readonly Message[];
24
27
  readonly returnResponse: boolean;
@@ -28,39 +31,15 @@ export interface ZLinkActorPacketDelivery {
28
31
  readonly messageFollowOrigin?: ZLinkMessageFollowOrigin;
29
32
  readonly sourceSessionRid?: RoutingId;
30
33
  }
31
- /**
32
- * Spec 15 §4.2 relocation temporary queue: consulted when {@code
33
- * resolveActor} finds nothing for an arrival that carries an exact object
34
- * identity. Parks the arrival if an Actor Join admission attempt is in
35
- * flight for {@code (actorId, objectGeneration)}, or reports not-found so
36
- * the caller falls through to its existing missing-actor handling
37
- * unchanged.
38
- */
39
- export type ZLinkRouteToActorJoinPrewarm = (actorId: string, objectGeneration: bigint, arrival: {
40
- readonly origin: ApplicationJobOrigin;
41
- readonly header: Buffer;
42
- readonly payload: Buffer;
43
- readonly returnResponse: boolean;
44
- readonly remoteBoundSessionTarget?: ZLinkRemoteBoundSessionTarget;
45
- readonly fallbackActorRef?: ActorRef;
46
- readonly requestTerminal?: ZLinkActorRequestTerminal;
47
- readonly resolve: (value: unknown) => void;
48
- readonly reject: (reason: unknown) => void;
49
- }) => 'parked' | 'not-found';
34
+ export type { ZLinkRouteToActorJoinPrewarm } from './spot-actor-ingress-admission';
50
35
  interface ZLinkSpotActorPacketDispatchOptions {
36
+ readonly admission?: import('../admission').ZLinkRuntimeAdmissionGate;
51
37
  readonly spot: ZLinkSpot | (() => ZLinkSpot);
52
38
  readonly spotId: () => string;
53
39
  readonly registry: ZLinkSpotActorHandlerRegistryRuntime;
54
- readonly serial?: ZLinkSpotSerialTurnExecutor;
55
40
  readonly resolveActor: (actorId: string) => ZLinkActor | undefined;
56
- readonly actorLeft?: (actorId: string) => boolean;
57
- readonly routeBeforeLocal?: (delivery: ZLinkActorPacketDelivery) => Promise<{
58
- readonly handled: boolean;
59
- readonly response?: unknown;
60
- } | undefined> | {
61
- readonly handled: boolean;
62
- readonly response?: unknown;
63
- } | undefined;
41
+ readonly hasDepartedActor?: (actorId: string) => boolean;
42
+ readonly routeBeforeLocal?: ZLinkActorIngressRoute;
64
43
  readonly onDisconnectActor: (actor: ZLinkActor) => Promise<void>;
65
44
  readonly actorResponseSender?: (actor: ZLinkActor, packetName: string, requestSeq: bigint, response: unknown, replyOptions: ZLinkActorResponseOptions, fallbackBoundSessionTarget?: ZLinkRemoteBoundSessionTarget, fallbackActorRef?: ActorRef, signal?: AbortSignal) => Promise<void> | void;
66
45
  readonly actorErrorSender?: (actorId: string, packetName: string, requestSeq: bigint, error: unknown, metadata: ReadonlyMap<string, string>, fallbackBoundSessionTarget?: ZLinkRemoteBoundSessionTarget, fallbackActorRef?: ActorRef) => Promise<void> | void;
@@ -69,26 +48,20 @@ interface ZLinkSpotActorPacketDispatchOptions {
69
48
  readonly dispatchErrors?: ZLinkDispatchErrorReporter;
70
49
  readonly routeToActorJoinPrewarm?: ZLinkRouteToActorJoinPrewarm;
71
50
  }
51
+ export type ZLinkActorPacketExecution = {
52
+ readonly terminal: Promise<unknown>;
53
+ } | {
54
+ readonly response: unknown;
55
+ };
72
56
  export declare class ZLinkSpotActorPacketDispatch {
73
57
  private readonly options;
74
58
  constructor(options: ZLinkSpotActorPacketDispatchOptions);
75
- dispatch(origin: ApplicationJobOrigin, actorId: string, parts: readonly Message[], returnResponse?: boolean, remoteBoundSessionTarget?: ZLinkRemoteBoundSessionTarget, fallbackActorRef?: ActorRef, requestTerminal?: ZLinkActorRequestTerminal): Promise<unknown>;
76
- dispatchDelivery(delivery: ZLinkActorPacketDelivery): Promise<unknown>;
77
- private handleMissingActor;
78
- /**
79
- * Spec 15 §4.2 relocation temporary queue: parks one arrival for a
80
- * missing Actor that carries an exact object identity, instead of
81
- * dropping it (Send) or replying HandlerNotFound (Request). Returns
82
- * {@code undefined} when no admission attempt owns this object — the
83
- * caller falls through to its existing missing-actor handling unchanged.
84
- * Header/payload are copied to owned buffers before parking so the
85
- * arrival survives independently of the original {@link Message}
86
- * lifetime.
87
- */
88
- private parkForActorJoinPrewarm;
59
+ dispatch(serial: ZLinkSpotSerialTurnExecutor | undefined, origin: ApplicationJobOrigin, actorId: string, parts: readonly Message[], returnResponse?: boolean, remoteBoundSessionTarget?: ZLinkRemoteBoundSessionTarget, fallbackActorRef?: ActorRef, requestTerminal?: ZLinkActorRequestTerminal): Promise<unknown>;
60
+ dispatchDelivery(serial: ZLinkSpotSerialTurnExecutor | undefined, delivery: ZLinkActorPacketDelivery): Promise<unknown>;
61
+ admitDelivery(serial: ZLinkSpotSerialTurnExecutor | undefined, delivery: ZLinkActorPacketDelivery, handoffRuntime?: ZLinkSpotActorHandoffRuntime): Promise<ZLinkActorPacketExecution>;
62
+ private dispatchUnavailableActor;
89
63
  private createPayloadDecoder;
90
64
  private dispatchActorPacket;
91
65
  private reportInvalidFrame;
92
66
  private trace;
93
67
  }
94
- export {};
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ZLinkSpotActorPacketDispatch = void 0;
4
- const actor_message_follow_context_1 = require("../actors/actor-message-follow-context");
4
+ const spot_actor_ingress_admission_1 = require("./spot-actor-ingress-admission");
5
5
  const actor_context_1 = require("../actors/actor-context");
6
6
  const session_disconnected_wire_1 = require("../actors/session-disconnected-wire");
7
7
  const routing_id_1 = require("../routing-id");
@@ -9,6 +9,7 @@ const framework_errors_internal_1 = require("../framework-errors-internal");
9
9
  const contracts_1 = require("../../contracts");
10
10
  const ZLinkDispatchOptions_1 = require("../../contracts/Dispatch/ZLinkDispatchOptions");
11
11
  const diagnostics_1 = require("../diagnostics");
12
+ const dispatch_error_details_1 = require("../diagnostics/dispatch-error-details");
12
13
  const flow_context_1 = require("../diagnostics/flow-context");
13
14
  const managed_stream_1 = require("../streams/managed-stream");
14
15
  const actors_1 = require("../actors");
@@ -22,9 +23,10 @@ class ZLinkSpotActorPacketDispatch {
22
23
  constructor(options) {
23
24
  this.options = options;
24
25
  }
25
- dispatch(origin, actorId, parts, returnResponse = false, remoteBoundSessionTarget, fallbackActorRef, requestTerminal) {
26
- return this.dispatchDelivery({
26
+ dispatch(serial, origin, actorId, parts, returnResponse = false, remoteBoundSessionTarget, fallbackActorRef, requestTerminal) {
27
+ return this.dispatchDelivery(serial, {
27
28
  origin,
29
+ receivedAt: new Date(),
28
30
  actorId,
29
31
  parts,
30
32
  returnResponse,
@@ -33,11 +35,16 @@ class ZLinkSpotActorPacketDispatch {
33
35
  requestTerminal
34
36
  });
35
37
  }
36
- async dispatchDelivery(delivery) {
37
- const { actorId, parts, returnResponse, remoteBoundSessionTarget, fallbackActorRef, requestTerminal } = delivery;
38
+ async dispatchDelivery(serial, delivery) {
39
+ const result = await this.admitDelivery(serial, delivery);
40
+ return 'terminal' in result ? await result.terminal : result.response;
41
+ }
42
+ async admitDelivery(serial, delivery, handoffRuntime) {
43
+ const { actorId, parts, returnResponse, receivedAt: deliveryReceivedAt, remoteBoundSessionTarget, fallbackActorRef, requestTerminal } = delivery;
44
+ const receivedAt = deliveryReceivedAt ?? new Date();
38
45
  if (parts.length < 2) {
39
46
  this.reportInvalidFrame(actorId, ZLinkDispatchOptions_1.ZLinkDispatchMessageKind.ActorSend);
40
- return undefined;
47
+ return { response: undefined };
41
48
  }
42
49
  // Spec 26 §4.1: one level read per processing point — the same gate value
43
50
  // drives both the decode and the flow-context install.
@@ -71,23 +78,26 @@ class ZLinkSpotActorPacketDispatch {
71
78
  const disconnectedReply = disconnected && header.kind === protocol_1.ZLinkStreamMessageKind.Request
72
79
  ? emptyDisconnectedReply
73
80
  : undefined;
74
- if (this.options.actorLeft?.(actorId) === true && disconnected) {
75
- return disconnectedReply;
76
- }
77
- const routed = await this.options.routeBeforeLocal?.(delivery);
78
- if (routed?.handled === true) {
79
- return routed.response;
80
- }
81
- const actor = this.options.resolveActor(actorId);
82
- if (actor === undefined) {
83
- return this.handleMissingActor(delivery.origin, actorId, parts, header, messageKind, action, returnResponse, remoteBoundSessionTarget, fallbackActorRef, requestTerminal);
84
- }
81
+ const admitted = (0, spot_actor_ingress_admission_1.resolveActorIngress)(delivery, messageKind === ZLinkDispatchOptions_1.ZLinkDispatchMessageKind.ActorRequest, {
82
+ handoffRuntime,
83
+ routeBeforeLocal: this.options.routeBeforeLocal,
84
+ resolveActor: this.options.resolveActor,
85
+ hasDepartedActor: this.options.hasDepartedActor,
86
+ routeToActorJoinPrewarm: this.options.routeToActorJoinPrewarm
87
+ });
88
+ if ('terminal' in admitted)
89
+ return { terminal: admitted.terminal };
90
+ if (admitted.kind === 'stale')
91
+ return {
92
+ response: await this.dispatchUnavailableActor(admitted.error, actorId, header, messageKind, action, returnResponse, remoteBoundSessionTarget, fallbackActorRef)
93
+ };
94
+ const actor = admitted.actor;
85
95
  if (disconnected) {
86
96
  const identity = (0, session_disconnected_wire_1.decodeSessionDisconnected)((0, protocol_1.messageToBytes)(parts[1]));
87
97
  if (identity === undefined) {
88
98
  if (this.options.dispatchErrors?.captureEnabled() === true)
89
99
  this.reportInvalidFrame(actorId, messageKind, new contracts_1.ZLinkFrameworkException(contracts_1.ZLinkFrameworkErrorKind.ProtocolError, 'ProtocolError: malformed Session disconnect identity.'), 'warning');
90
- return disconnectedReply;
100
+ return { response: disconnectedReply };
91
101
  }
92
102
  const current = actor.context instanceof actor_context_1.DefaultZLinkActorContext
93
103
  ? actor.context.currentSessionBinding
@@ -96,43 +106,34 @@ class ZLinkSpotActorPacketDispatch {
96
106
  (!(0, routing_id_1.routingIdsEqual)(current.sessionNodeRid, identity.sessionOwnerNodeRid) ||
97
107
  current.sessionOwnerNodeGeneration !== identity.sessionOwnerNodeGeneration ||
98
108
  current.bindingGeneration !== identity.bindingGeneration))
99
- return disconnectedReply;
109
+ return { response: disconnectedReply };
100
110
  await this.options.onDisconnectActor(actor);
101
- return disconnectedReply;
111
+ this.trace(messageKind === ZLinkDispatchOptions_1.ZLinkDispatchMessageKind.ActorRequest
112
+ ? ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Replied
113
+ : ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Completed, actorId, header, messageKind);
114
+ return { response: disconnectedReply };
102
115
  }
103
116
  const decodePayload = this.createPayloadDecoder(parts[1], header);
104
- return this.dispatchActorPacket(actor, actorId, decodePayload, header, messageKind, action, returnResponse, remoteBoundSessionTarget, fallbackActorRef, requestTerminal, requestDeadlineUnixMs, (0, serial_work_size_1.zlinkSerialWorkOptions)(parts[1].data().byteLength, (0, serial_work_size_1.zlinkMetadataByteLength)(header.metadata)));
117
+ return {
118
+ response: await this.dispatchActorPacket(actor, actorId, decodePayload, header, messageKind, action, returnResponse, remoteBoundSessionTarget, fallbackActorRef, requestTerminal, requestDeadlineUnixMs, serial, (0, serial_work_size_1.zlinkSerialWorkOptions)(parts[1].data().byteLength, (0, serial_work_size_1.zlinkMetadataByteLength)(header.metadata)), receivedAt)
119
+ };
105
120
  });
106
121
  }
107
- async handleMissingActor(origin, actorId, parts, header, messageKind, action, returnResponse, fallbackBoundSessionTarget, fallbackActorRef, requestTerminal) {
108
- if (this.options.routeToActorJoinPrewarm !== undefined &&
109
- fallbackActorRef !== undefined &&
110
- parts.length >= 2 &&
111
- // A Request without a terminal has no way to complete once
112
- // migrated later — parking it would leave the caller hanging
113
- // forever with no reply route. Fall through to the existing
114
- // missing-actor handling for that shape instead.
115
- (messageKind !== ZLinkDispatchOptions_1.ZLinkDispatchMessageKind.ActorRequest || requestTerminal !== undefined)) {
116
- const parked = this.parkForActorJoinPrewarm(origin, actorId, parts, messageKind, returnResponse, fallbackBoundSessionTarget, fallbackActorRef, requestTerminal);
117
- if (parked !== undefined)
118
- return parked;
119
- }
122
+ async dispatchUnavailableActor(missingActorError, actorId, header, messageKind, action, returnResponse, fallbackBoundSessionTarget, fallbackActorRef) {
120
123
  this.options.dispatchErrors?.report({
121
124
  surface: ZLinkDispatchOptions_1.ZLinkDispatchErrorSurface.SpotActor,
122
125
  messageKind,
123
- reason: ZLinkDispatchOptions_1.ZLinkRuntimeDispatchErrorReason.HandlerMissing,
126
+ reason: (0, dispatch_error_details_1.dispatchReasonFromError)(missingActorError),
124
127
  action,
125
128
  packetName: header.name,
126
129
  spotId: this.options.spotId(),
127
130
  actorId,
128
- correlationId: header.correlationId ?? header.requestSeq?.toString()
131
+ correlationId: header.correlationId ?? header.requestSeq?.toString(),
132
+ error: missingActorError
129
133
  });
130
134
  if (messageKind !== ZLinkDispatchOptions_1.ZLinkDispatchMessageKind.ActorRequest) {
131
135
  return undefined;
132
136
  }
133
- const missingActorError = (0, framework_errors_internal_1.createInternalFrameworkException)((0, actor_message_follow_context_1.actorMessageFollowContext)(fallbackActorRef) === undefined
134
- ? framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.ActorDispatchHandlerNotFound
135
- : framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.ActorLocationStale, `SPOT actor is not registered locally: ${actorId}`);
136
137
  if (header.requestSeq !== undefined &&
137
138
  !returnResponse &&
138
139
  this.options.actorErrorSender !== undefined) {
@@ -141,77 +142,23 @@ class ZLinkSpotActorPacketDispatch {
141
142
  }
142
143
  throw missingActorError;
143
144
  }
144
- /**
145
- * Spec 15 §4.2 relocation temporary queue: parks one arrival for a
146
- * missing Actor that carries an exact object identity, instead of
147
- * dropping it (Send) or replying HandlerNotFound (Request). Returns
148
- * {@code undefined} when no admission attempt owns this object — the
149
- * caller falls through to its existing missing-actor handling unchanged.
150
- * Header/payload are copied to owned buffers before parking so the
151
- * arrival survives independently of the original {@link Message}
152
- * lifetime.
153
- */
154
- parkForActorJoinPrewarm(origin, actorId, parts, messageKind, returnResponse, remoteBoundSessionTarget, fallbackActorRef, requestTerminal) {
155
- const isRequest = messageKind === ZLinkDispatchOptions_1.ZLinkDispatchMessageKind.ActorRequest;
156
- let resolve = () => undefined;
157
- let reject = () => undefined;
158
- const result = new Promise((res, rej) => {
159
- resolve = res;
160
- reject = rej;
161
- });
162
- // A Request's real reply must still travel through the exact mailbox
163
- // correlation the original caller captured in `requestTerminal` — not
164
- // through this method's own return value, which the caller only uses
165
- // to decide whether it still owes a reply itself. Wrapping keeps that
166
- // reply route intact across the (possibly much later) redelivery at
167
- // migration time while also releasing the original caller once the
168
- // real reply has gone out, so it never sends a premature empty one.
169
- const wrappedRequestTerminal = requestTerminal === undefined
170
- ? undefined
171
- : Object.assign(async (response, preparedReply) => {
172
- try {
173
- await requestTerminal(response, preparedReply);
174
- resolve(undefined);
175
- }
176
- catch (error) {
177
- reject(error);
178
- throw error;
179
- }
180
- }, { prepare: requestTerminal.prepare });
181
- const route = this.options.routeToActorJoinPrewarm(actorId, fallbackActorRef.objectGeneration, {
182
- origin,
183
- header: Buffer.from(parts[0].data()),
184
- payload: Buffer.from(parts[1].data()),
185
- returnResponse,
186
- remoteBoundSessionTarget,
187
- fallbackActorRef,
188
- requestTerminal: wrappedRequestTerminal,
189
- resolve,
190
- reject
191
- });
192
- if (route !== 'parked')
193
- return undefined;
194
- // A Send has no reply to wait for: the migrated redelivery still runs
195
- // in order later, but this caller's own await is done once parking is
196
- // confirmed.
197
- if (!isRequest)
198
- resolve(undefined);
199
- return result;
200
- }
201
145
  createPayloadDecoder(message, header) {
202
- return () => (0, payload_codec_1.decodeFrameworkTypedPayloadMessage)(message, this.options.messageSerializers, undefined, (0, protocol_1.streamCodecContentType)(header.codec), header.name);
146
+ return (messageType) => (0, payload_codec_1.decodeFrameworkTypedPayloadMessage)(message, this.options.messageSerializers, messageType, (0, protocol_1.streamCodecContentType)(header.codec), header.name);
203
147
  }
204
- async dispatchActorPacket(actor, actorId, decodePayload, header, messageKind, action, returnResponse, fallbackBoundSessionTarget, fallbackActorRef, requestTerminal, requestDeadlineUnixMs, workOptions) {
148
+ async dispatchActorPacket(actor, actorId, decodePayload, header, messageKind, action, returnResponse, fallbackBoundSessionTarget, fallbackActorRef, requestTerminal, requestDeadlineUnixMs, serial, workOptions, receivedAt) {
205
149
  const spot = typeof this.options.spot === 'function' ? this.options.spot() : this.options.spot;
206
150
  const dispatcher = new actors_1.ZLinkSpotActorDispatcher({
207
151
  registry: this.options.registry,
208
152
  spot,
209
153
  providerResolver: this.options.providerResolver,
210
- serial: this.options.serial,
154
+ serial,
211
155
  serialWorkOptions: workOptions,
212
156
  messageSerializers: this.options.messageSerializers,
213
157
  onAdmitted: () => this.trace(ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Admitted, actorId, header, messageKind),
214
158
  onHandlerStart: () => {
159
+ if (this.options.admission?.ownerAdmissionOpen() === false) {
160
+ throw (0, framework_errors_internal_1.createInternalFrameworkException)(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.RequestRejected, 'Actor handler was rejected because Location owner admission is closed.');
161
+ }
215
162
  // A transferred backlog is returned to the Actor queue as one FIFO
216
163
  // prefix. Check the request deadline when its owner turn actually
217
164
  // starts, not when that prefix is admitted.
@@ -220,8 +167,8 @@ class ZLinkSpotActorPacketDispatch {
220
167
  Date.now() >= requestDeadlineUnixMs) {
221
168
  throw (0, framework_errors_internal_1.createInternalFrameworkException)(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.DeadlineExceeded, `Actor request '${actorId}' expired before handler admission.`);
222
169
  }
223
- (0, application_job_queue_scope_1.releaseApplicationJobPermitBeforeHandler)();
224
170
  this.trace(ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Dispatched, actorId, header, messageKind);
171
+ (0, application_job_queue_scope_1.releaseApplicationJobPermitBeforeHandler)();
225
172
  }
226
173
  });
227
174
  try {
@@ -229,7 +176,8 @@ class ZLinkSpotActorPacketDispatch {
229
176
  await dispatcher.dispatchSendDecoded(actor, header.name, decodePayload, {
230
177
  meshName: spot.context.meshName,
231
178
  metadata: (0, contracts_1.zlinkMessageMetadata)(header.metadata),
232
- correlationId: header.correlationId ?? undefined
179
+ correlationId: header.correlationId ?? undefined,
180
+ receivedAt
233
181
  });
234
182
  this.trace(ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Completed, actorId, header, ZLinkDispatchOptions_1.ZLinkDispatchMessageKind.ActorSend);
235
183
  return undefined;
@@ -253,7 +201,8 @@ class ZLinkSpotActorPacketDispatch {
253
201
  await dispatcher.dispatchRequestThenDecoded(actor, header.name, decodePayload, {
254
202
  meshName: spot.context.meshName,
255
203
  metadata: (0, contracts_1.zlinkMessageMetadata)(header.metadata),
256
- correlationId: header.correlationId ?? header.requestSeq.toString()
204
+ correlationId: header.correlationId ?? header.requestSeq.toString(),
205
+ receivedAt
257
206
  }, async (response) => {
258
207
  this.trace(ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Replied, actorId, header, ZLinkDispatchOptions_1.ZLinkDispatchMessageKind.ActorRequest);
259
208
  await requestTerminal(response, preparedReplyReady ? preparedReply : undefined);
@@ -269,7 +218,8 @@ class ZLinkSpotActorPacketDispatch {
269
218
  const response = await dispatcher.dispatchRequestDecoded(actor, header.name, decodePayload, {
270
219
  meshName: spot.context.meshName,
271
220
  metadata: (0, contracts_1.zlinkMessageMetadata)(header.metadata),
272
- correlationId: header.correlationId ?? header.requestSeq.toString()
221
+ correlationId: header.correlationId ?? header.requestSeq.toString(),
222
+ receivedAt
273
223
  });
274
224
  this.trace(ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Replied, actorId, header, ZLinkDispatchOptions_1.ZLinkDispatchMessageKind.ActorRequest);
275
225
  return response;
@@ -277,7 +227,8 @@ class ZLinkSpotActorPacketDispatch {
277
227
  await dispatcher.dispatchRequestThenDecoded(actor, header.name, decodePayload, {
278
228
  meshName: spot.context.meshName,
279
229
  metadata: (0, contracts_1.zlinkMessageMetadata)(header.metadata),
280
- correlationId: header.correlationId ?? header.requestSeq.toString()
230
+ correlationId: header.correlationId ?? header.requestSeq.toString(),
231
+ receivedAt
281
232
  }, async (response, replyOptions) => {
282
233
  this.trace(ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Replied, actorId, header, ZLinkDispatchOptions_1.ZLinkDispatchMessageKind.ActorRequest);
283
234
  await this.options.actorResponseSender?.(actor, header.name, requestSeq, response, replyOptions, fallbackBoundSessionTarget, fallbackActorRef, undefined);
@@ -288,15 +239,7 @@ class ZLinkSpotActorPacketDispatch {
288
239
  this.options.dispatchErrors?.report({
289
240
  surface: ZLinkDispatchOptions_1.ZLinkDispatchErrorSurface.SpotActor,
290
241
  messageKind,
291
- reason: error instanceof contracts_1.ZLinkFrameworkException &&
292
- (0, framework_errors_internal_1.internalFrameworkErrorKind)(error) ===
293
- framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.ActorDispatchHandlerNotFound
294
- ? ZLinkDispatchOptions_1.ZLinkRuntimeDispatchErrorReason.HandlerMissing
295
- : error instanceof contracts_1.ZLinkFrameworkException &&
296
- (0, framework_errors_internal_1.internalFrameworkErrorKind)(error) ===
297
- framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.PayloadDecodeFailed
298
- ? ZLinkDispatchOptions_1.ZLinkRuntimeDispatchErrorReason.PayloadDecodeFailed
299
- : ZLinkDispatchOptions_1.ZLinkRuntimeDispatchErrorReason.HandlerException,
242
+ reason: (0, dispatch_error_details_1.dispatchReasonFromError)(error),
300
243
  action,
301
244
  packetName: header.name,
302
245
  spotId: this.options.spotId(),
@@ -21,6 +21,7 @@ interface ZLinkSpotActorPacketDrainOptions {
21
21
  readonly replyActorNoBind?: (info: ZLinkBackendActorRecvInfo, parts: readonly Message[], result: RequestResult) => void;
22
22
  readonly waitIdle: () => Promise<void>;
23
23
  readonly flowEnabled?: () => boolean;
24
+ readonly receivedAtClock?: () => Date;
24
25
  }
25
26
  export declare class ZLinkSpotActorPacketDrain {
26
27
  private readonly options;
@@ -9,6 +9,7 @@ const protocol_1 = require("../streams/protocol");
9
9
  const actor_reply_1 = require("../actors/actor-reply");
10
10
  const bound_session_response_target_1 = require("../streams/bound-session-response-target");
11
11
  const ZLINK_SPOT_ACTOR_RECV_INFO_NO_BIND = 1;
12
+ const systemReceivedAtClock = () => new Date();
12
13
  class ZLinkSpotActorPacketDrain {
13
14
  options;
14
15
  continuations = new Map();
@@ -24,6 +25,7 @@ class ZLinkSpotActorPacketDrain {
24
25
  let requestId;
25
26
  let flags;
26
27
  let packetKey;
28
+ let receivedAt;
27
29
  try {
28
30
  for (;;) {
29
31
  const part = info.recvActorPart(spot_native_flags_1.ZLINK_RECV_DONT_WAIT);
@@ -31,7 +33,8 @@ class ZLinkSpotActorPacketDrain {
31
33
  if (parts.length > 0 && packetKey !== undefined) {
32
34
  this.continuations.set(packetKey, {
33
35
  owner: continuationOwner(parts[0], this.flowEnabled()),
34
- parts: parts.splice(0)
36
+ parts: parts.splice(0),
37
+ receivedAt: receivedAt ?? (this.options.receivedAtClock ?? systemReceivedAtClock)()
35
38
  });
36
39
  return;
37
40
  }
@@ -42,6 +45,8 @@ class ZLinkSpotActorPacketDrain {
42
45
  if (packetKey === undefined) {
43
46
  packetKey = currentPacketKey;
44
47
  const pending = this.continuations.get(currentPacketKey);
48
+ receivedAt =
49
+ pending?.receivedAt ?? (this.options.receivedAtClock ?? systemReceivedAtClock)();
45
50
  if (pending !== undefined) {
46
51
  if (isStreamHeaderMessage(part.message, this.flowEnabled())) {
47
52
  closeMessages(pending.parts);
@@ -79,7 +84,7 @@ class ZLinkSpotActorPacketDrain {
79
84
  return;
80
85
  }
81
86
  if (noBindInfo !== undefined) {
82
- await this.dispatchNoBindActorRequest(noBindInfo, actorId, parts, actorRef);
87
+ await this.dispatchNoBindActorRequest(noBindInfo, actorId, parts, actorRef, receivedAt ?? (this.options.receivedAtClock ?? systemReceivedAtClock)());
83
88
  }
84
89
  else {
85
90
  await this.options.actorPacketHandler({
@@ -88,7 +93,8 @@ class ZLinkSpotActorPacketDrain {
88
93
  parts,
89
94
  returnResponse: false,
90
95
  sourceSessionRid,
91
- fallbackActorRef: actorRef
96
+ fallbackActorRef: actorRef,
97
+ receivedAt
92
98
  });
93
99
  }
94
100
  }
@@ -129,7 +135,7 @@ class ZLinkSpotActorPacketDrain {
129
135
  return false;
130
136
  }
131
137
  }
132
- async dispatchNoBindActorRequest(info, actorId, parts, actorRef) {
138
+ async dispatchNoBindActorRequest(info, actorId, parts, actorRef, receivedAt) {
133
139
  try {
134
140
  const response = await this.options.actorPacketHandler?.({
135
141
  origin: 'remote',
@@ -137,7 +143,8 @@ class ZLinkSpotActorPacketDrain {
137
143
  parts,
138
144
  returnResponse: true,
139
145
  sourceSessionRid: info.sourceSessionRid,
140
- fallbackActorRef: actorRef
146
+ fallbackActorRef: actorRef,
147
+ receivedAt
141
148
  });
142
149
  this.options.replyActorNoBind?.(info, [this.encodeActorReplyFrame(parts[0], protocol_1.ZLinkStreamMessageKind.Response, response)], runtime_values_1.RequestResult.Ok);
143
150
  }
@@ -10,9 +10,11 @@ import { type ZLinkActorPacketDelivery } from './spot-actor-packet-dispatch';
10
10
  import { type ZLinkDetachedTaskRunner } from './spot-actor-join-dispatch';
11
11
  import { type ZLinkSpotRoutedTransport } from './spot-outbound';
12
12
  import { ZLinkSpotSerialTurnExecutor } from './spot-serial-turn-executor';
13
+ import { ZLinkSpotSerialExecutor } from './spot-serial-executor';
13
14
  import { type ZLinkActorHandoffPacket } from '../actors/actor-handoff';
14
15
  import type { ZLinkEntryActorRuntime, ZLinkSpotActorTransferRuntime, ZLinkSpotActorHandoffRuntime, ZLinkSpotBoundSessionRuntime } from './spot-runtime-ports';
15
16
  interface ZLinkEntrySpotActivationOptions {
17
+ readonly admission?: import('../admission').ZLinkRuntimeAdmissionGate;
16
18
  readonly entrySpotType: Type<ZLinkEntrySpot>;
17
19
  readonly timerHandlers?: readonly ZLinkEntrySpotTimerHandlerRegistration[];
18
20
  readonly packetHandlers?: readonly ZLinkEntrySpotPacketHandlerRegistration[];
@@ -44,13 +46,12 @@ interface ZLinkEntrySpotActivationOptions {
44
46
  export declare class ZLinkEntrySpotActivation {
45
47
  private readonly options;
46
48
  private readonly serial;
47
- private readonly spotSerialExecutor;
49
+ readonly spotSerialExecutor: ZLinkSpotSerialExecutor;
48
50
  private readonly timers;
49
51
  private readonly actorHandlers;
50
52
  private readonly handlers;
51
53
  private readonly outbound;
52
54
  private readonly workerRuntime;
53
- private readonly lifecycleMetrics;
54
55
  private readonly packetDispatch;
55
56
  private readonly actorPacketDispatch;
56
57
  private initialized;
@@ -72,7 +73,7 @@ export declare class ZLinkEntrySpotActivation {
72
73
  readonly channelName: string;
73
74
  readonly contentType?: string;
74
75
  }, returnResponse: boolean): Promise<unknown>;
75
- dispatchPacketEncoded(packetName: string | undefined, decodePayload: () => unknown, context: {
76
+ dispatchPacketEncoded(packetName: string | undefined, decodePayload: (messageType?: Type) => unknown, context: {
76
77
  readonly channelName: string;
77
78
  readonly contentType?: string;
78
79
  }, returnResponse: boolean): Promise<unknown>;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ZLinkEntrySpotActivation = void 0;
4
+ const spot_actor_admission_coordinator_1 = require("./spot-actor-admission-coordinator");
4
5
  const application_job_queue_scope_1 = require("../application-jobs/application-job-queue-scope");
5
6
  const contracts_1 = require("../../contracts");
6
7
  const abort_1 = require("../abort");
@@ -21,7 +22,6 @@ const spot_timer_1 = require("./spot-timer");
21
22
  const spot_context_1 = require("./spot-context");
22
23
  const spot_routed_spot_packet_dispatch_1 = require("./spot-routed-spot-packet-dispatch");
23
24
  const actor_handoff_1 = require("../actors/actor-handoff");
24
- const spot_lifecycle_metrics_1 = require("./spot-lifecycle-metrics");
25
25
  class ZLinkEntrySpotActivation {
26
26
  options;
27
27
  serial;
@@ -31,7 +31,6 @@ class ZLinkEntrySpotActivation {
31
31
  handlers;
32
32
  outbound;
33
33
  workerRuntime;
34
- lifecycleMetrics;
35
34
  packetDispatch;
36
35
  actorPacketDispatch;
37
36
  initialized = false;
@@ -58,7 +57,6 @@ class ZLinkEntrySpotActivation {
58
57
  meshName: options.spotNodeName
59
58
  });
60
59
  this.timers = new spot_timer_1.ZLinkSpotTimerRegistry(options.metrics, () => options.dispatchErrors?.flow.flowCreationEnabled() ?? true);
61
- this.lifecycleMetrics = new spot_lifecycle_metrics_1.ZLinkSpotLifecycleMetrics(options.metrics);
62
60
  this.workerRuntime = options.workerRuntime ?? new workers_1.ZLinkWorkerRuntime();
63
61
  this.context = (0, spot_context_1.createEntrySpotContext)({
64
62
  spotId: String(options.nativeSpot.routingId),
@@ -97,11 +95,12 @@ class ZLinkEntrySpotActivation {
97
95
  dispatchErrors: options.dispatchErrors
98
96
  });
99
97
  this.actorPacketDispatch = new spot_actor_packet_dispatch_1.ZLinkSpotActorPacketDispatch({
98
+ admission: this.options.admission,
100
99
  spot: () => this.entrySpot,
101
100
  spotId: () => String(this.options.nativeSpot.routingId),
102
101
  registry: this.actorHandlers,
103
102
  resolveActor: (targetActorId) => this.options.entryActorRuntime?.resolveActor(targetActorId),
104
- routeBeforeLocal: (target) => this.options.entryActorRuntime?.routePacket(target.actorId, target.parts, target.returnResponse, target.remoteBoundSessionTarget, target.fallbackActorRef),
103
+ routeBeforeLocal: (delivery) => this.options.entryActorRuntime?.routePacket(delivery.actorId, delivery.parts, delivery.returnResponse, delivery.remoteBoundSessionTarget, delivery.fallbackActorRef, delivery.origin, delivery.requestTerminal, delivery.messageFollowOrigin),
105
104
  onDisconnectActor: (actor) => this.notifyDisconnectActor(actor),
106
105
  actorResponseSender: this.options.boundSessionRuntime?.sendActorResponse.bind(this.options.boundSessionRuntime),
107
106
  actorErrorSender: this.options.boundSessionRuntime?.sendActorError.bind(this.options.boundSessionRuntime),
@@ -162,7 +161,7 @@ class ZLinkEntrySpotActivation {
162
161
  await this.serial.execute(() => this.entrySpot.onInitialize?.());
163
162
  this.attachActorJoinDispatch();
164
163
  this.initialized = true;
165
- this.lifecycleMetrics.opened('entry');
164
+ this.options.metrics?.recordSpotCount(this.options.spotNodeName, 'entry', 1);
166
165
  }
167
166
  async dispose(deadline) {
168
167
  if (this.disposed)
@@ -189,7 +188,7 @@ class ZLinkEntrySpotActivation {
189
188
  await this.options.nativeSpot.dispose();
190
189
  });
191
190
  if (this.initialized) {
192
- this.lifecycleMetrics.closed('entry');
191
+ this.options.metrics?.recordSpotCount(this.options.spotNodeName, 'entry', -1);
193
192
  }
194
193
  if (errors.length === 1)
195
194
  throw errors[0];
@@ -291,11 +290,7 @@ class ZLinkEntrySpotActivation {
291
290
  return this.serial.execute(() => this.entrySpot.onDisconnectActor?.(actor));
292
291
  }
293
292
  async dispatchActorPacket(delivery) {
294
- const { actorId, parts, returnResponse, remoteBoundSessionTarget, fallbackActorRef, messageFollowOrigin } = delivery;
295
- const handoff = this.options.actorHandoffRuntime?.capture(delivery.origin, actorId, parts, returnResponse, remoteBoundSessionTarget, fallbackActorRef, undefined, messageFollowOrigin);
296
- if (handoff !== undefined)
297
- return await handoff;
298
- return this.spotSerialExecutor.executeActor(actorId, () => this.dispatchActorPacketInsideMailbox(delivery));
293
+ return (0, spot_actor_admission_coordinator_1.dispatchActorPacketInMailbox)((operation) => this.spotSerialExecutor.executeActor(delivery.actorId, operation), () => this.actorPacketDispatch.admitDelivery(undefined, delivery, this.options.actorHandoffRuntime));
299
294
  }
300
295
  /** Restores source packets through the Entry Actor's existing executor. */
301
296
  admitActorPacketPrefix(actorId, records) {
@@ -325,7 +320,7 @@ class ZLinkEntrySpotActivation {
325
320
  }));
326
321
  }
327
322
  async dispatchActorPacketInsideMailbox(delivery) {
328
- return this.actorPacketDispatch.dispatchDelivery(delivery);
323
+ return this.actorPacketDispatch.dispatchDelivery(undefined, delivery);
329
324
  }
330
325
  replyActorNoBind(info, parts, result) {
331
326
  this.options.nativeNode.replyActorNoBind(info, parts, result);
@@ -1,3 +1,4 @@
1
+ import type { ZLinkHandlerMessageType } from '../../contracts/Common/HandlerMessageType';
1
2
  import type { Type, ZLinkActor, ZLinkEntrySpot, ZLinkInstanceSpot, ZLinkInstanceSpotHandlerRegistry, ZLinkSpot, ZLinkSpotHandlerRegistry, ZLinkSpotTimerHandler } from '../../contracts';
2
3
  import type { ZLinkEntrySpotActorRequestHandlerRegistration, ZLinkEntrySpotActorSendHandlerRegistration, ZLinkEntrySpotPacketHandlerRegistration, ZLinkEntrySpotSubscriptionHandlerRegistration, ZLinkSpotActorRequestHandlerRegistration, ZLinkSpotActorSendHandlerRegistration, ZLinkSpotPacketHandlerRegistration, ZLinkSpotSubscriptionHandlerRegistration } from '../../contracts/Configuration/RegistrationTypes';
3
4
  import type { ZLinkProviderResolver } from '../../contracts/Common/ZLinkProviderResolver';
@@ -5,6 +6,7 @@ import { ZLinkActorPacketKind, ZLinkSpotActorHandlerRegistryRuntime } from '../a
5
6
  export interface ZLinkSpotHandlerRegistration {
6
7
  readonly kind: 'packet' | 'subscribe' | 'actorSend' | 'actorRequest' | 'timer';
7
8
  readonly handlerType: Type;
9
+ readonly messageType?: ZLinkHandlerMessageType;
8
10
  readonly packetName?: string;
9
11
  readonly channelName?: string;
10
12
  readonly topic?: string;
@@ -18,11 +20,13 @@ export declare class DefaultZLinkSpotHandlerRegistry<TActor extends ZLinkActor =
18
20
  addHandler<THandler>(handlerType: Type<THandler>, packetName?: string): this;
19
21
  addActorPacket<THandler, TRegisteredActor extends ZLinkActor>(handlerType: Type<THandler>, actorType: Type<TRegisteredActor>): this;
20
22
  addPacket(handlerType: Type, packetName?: string): this;
23
+ addPacketRegistration(handlerType: Type, packetName: string | undefined, messageType: ZLinkHandlerMessageType | undefined): this;
21
24
  packet(packetName: string, handlerType: Type): this;
22
- addActorPacketRegistration(kind: ZLinkActorPacketKind, handlerType: Type, actorType: Type<TActor>, packetName: string): this;
25
+ addActorPacketRegistration(kind: ZLinkActorPacketKind, handlerType: Type, actorType: Type<TActor>, packetName: string, messageType: ZLinkHandlerMessageType | undefined): this;
23
26
  actorSend(packetName: string, handlerType: Type, actorType?: Type<TActor>): this;
24
27
  actorRequest(packetName: string, handlerType: Type, actorType?: Type<TActor>): this;
25
28
  addSubscribe(handlerType: Type, channelName: string, topic: string): this;
29
+ addSubscriptionRegistration(handlerType: Type, channelName: string, topic: string, messageType: ZLinkHandlerMessageType | undefined): this;
26
30
  subscribe(channelName: string, topic: string, handlerType: Type): this;
27
31
  addTimerHandler<THandler extends ZLinkSpotTimerHandler<ZLinkSpot>>(handlerType: Type<THandler>): this;
28
32
  snapshot(): readonly ZLinkSpotHandlerRegistration[];