@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,7 +1,9 @@
1
1
  import type { ZLinkActorContext } from './ZLinkActorContext';
2
2
  import type { ZLinkActorJoinCompletion } from './ZLinkActorFactory';
3
+ import type { ZLinkSessionBindingIdentity } from './ZLinkSessionBindingIdentity';
3
4
  export interface ZLinkActor {
4
5
  readonly context: ZLinkActorContext;
5
6
  configure?(): void;
6
7
  onJoinCompleted?(completion: ZLinkActorJoinCompletion): Promise<void>;
8
+ onDuplicateBind?(current: ZLinkSessionBindingIdentity, incoming: ZLinkSessionBindingIdentity, signal: AbortSignal): Promise<string | undefined>;
7
9
  }
@@ -0,0 +1,6 @@
1
+ import type { RoutingId } from '../Common';
2
+ export interface ZLinkSessionBindingIdentity {
3
+ readonly sessionOwnerNodeRid: RoutingId;
4
+ readonly sessionOwnerNodeGeneration: bigint;
5
+ readonly bindingGeneration: bigint;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,5 @@
1
1
  export * from './ZLinkActor';
2
+ export * from './ZLinkSessionBindingIdentity';
2
3
  export * from './ZLinkActorContext';
3
4
  export * from './ZLinkActorClient';
4
5
  export * from './ZLinkActorFactory';
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./ZLinkActor"), exports);
18
+ __exportStar(require("./ZLinkSessionBindingIdentity"), exports);
18
19
  __exportStar(require("./ZLinkActorContext"), exports);
19
20
  __exportStar(require("./ZLinkActorClient"), exports);
20
21
  __exportStar(require("./ZLinkActorFactory"), exports);
@@ -1,4 +1,5 @@
1
1
  export type Type<T = unknown> = new (...args: never[]) => T;
2
+ export type ZLinkMessageTypeResolver<T = unknown> = Type<T> | (() => Type<T>);
2
3
  export type RoutingId = string;
3
4
  /** Global logical Actor identity. It does not encode a Mesh or owner route. */
4
5
  export type ActorId = string;
@@ -0,0 +1,8 @@
1
+ import type { Type } from './CoreTypes';
2
+ export interface ZLinkHandlerMessageType {
3
+ readonly type: Type;
4
+ }
5
+ /** Reads a handler's declared type once and defers/caches a lazy resolver until decode. */
6
+ export declare function resolveHandlerMessageType(handlerType: Type): ZLinkHandlerMessageType | undefined;
7
+ /** Converts a stored registration resolver to the constructor expected by a codec. */
8
+ export declare function resolveMessageTypeForDecode(messageType?: ZLinkHandlerMessageType): Type | undefined;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveHandlerMessageType = resolveHandlerMessageType;
4
+ exports.resolveMessageTypeForDecode = resolveMessageTypeForDecode;
5
+ /** Reads a handler's declared type once and defers/caches a lazy resolver until decode. */
6
+ function resolveHandlerMessageType(handlerType) {
7
+ const declared = handlerType.messageType;
8
+ if (declared === undefined)
9
+ return undefined;
10
+ if (isTypeConstructor(declared))
11
+ return { type: declared };
12
+ let state = 'unresolved';
13
+ let resolved;
14
+ let failure;
15
+ return {
16
+ get type() {
17
+ if (state === 'unresolved') {
18
+ try {
19
+ resolved = declared();
20
+ state = 'resolved';
21
+ }
22
+ catch (error) {
23
+ failure = error;
24
+ state = 'failed';
25
+ }
26
+ }
27
+ if (state === 'failed')
28
+ throw failure;
29
+ return resolved;
30
+ }
31
+ };
32
+ }
33
+ /** Converts a stored registration resolver to the constructor expected by a codec. */
34
+ function resolveMessageTypeForDecode(messageType) {
35
+ return messageType?.type;
36
+ }
37
+ function isTypeConstructor(value) {
38
+ // Class constructors have a non-writable prototype property; ordinary resolver functions do not.
39
+ return (typeof value === 'function' &&
40
+ Object.getOwnPropertyDescriptor(value, 'prototype')?.writable === false);
41
+ }
@@ -1,4 +1,5 @@
1
1
  export declare class ZLinkEncodedPayload {
2
+ #private;
2
3
  private constructor();
3
4
  /** Copies the supplied bytes. */
4
5
  static from(bytes: Uint8Array): ZLinkEncodedPayload;
@@ -14,5 +15,4 @@ export declare class ZLinkEncodedPayload {
14
15
  isEmpty(): boolean;
15
16
  getString(encoding?: BufferEncoding): string;
16
17
  close(): void;
17
- private stored;
18
18
  }
@@ -1,15 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ZLinkEncodedPayload = void 0;
4
- const encoded_payload_storage_1 = require("./encoded-payload-storage");
5
4
  class ZLinkEncodedPayload {
5
+ #bytes;
6
6
  constructor(bytes, owned) {
7
- if (owned) {
8
- (0, encoded_payload_storage_1.adoptEncodedPayload)(this, bytes);
9
- }
10
- else {
11
- (0, encoded_payload_storage_1.storeEncodedPayload)(this, bytes);
12
- }
7
+ this.#bytes = !owned
8
+ ? Buffer.from(bytes)
9
+ : Buffer.isBuffer(bytes)
10
+ ? bytes
11
+ : Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
13
12
  }
14
13
  /** Copies the supplied bytes. */
15
14
  static from(bytes) {
@@ -21,36 +20,29 @@ class ZLinkEncodedPayload {
21
20
  }
22
21
  /** Returns a copy of the stored bytes. */
23
22
  data() {
24
- return new Uint8Array(this.stored());
23
+ return new Uint8Array(this.#bytes);
25
24
  }
26
25
  /** Returns the stored bytes without copying. Do not modify this view or its backing buffer. */
27
26
  view() {
28
- return this.stored();
27
+ return this.#bytes;
29
28
  }
30
29
  toBytes() {
31
30
  return this.data();
32
31
  }
33
32
  copy() {
34
- return ZLinkEncodedPayload.from(this.stored());
33
+ return ZLinkEncodedPayload.from(this.#bytes);
35
34
  }
36
35
  size() {
37
- return this.stored().length;
36
+ return this.#bytes.length;
38
37
  }
39
38
  isEmpty() {
40
- return this.stored().length === 0;
39
+ return this.#bytes.length === 0;
41
40
  }
42
41
  getString(encoding = 'utf8') {
43
- return this.stored().toString(encoding);
42
+ return this.#bytes.toString(encoding);
44
43
  }
45
44
  close() {
46
45
  // ZLinkEncodedPayload owns managed memory only; this mirrors Message-like readers.
47
46
  }
48
- stored() {
49
- const payload = (0, encoded_payload_storage_1.borrowEncodedPayload)(this);
50
- if (payload === undefined) {
51
- throw new Error('ZLink encoded payload storage is unavailable.');
52
- }
53
- return payload;
54
- }
55
47
  }
56
48
  exports.ZLinkEncodedPayload = ZLinkEncodedPayload;
@@ -115,13 +115,17 @@ function materializeZLinkMessageValue(value, type) {
115
115
  return value;
116
116
  }
117
117
  const materialized = Object.create(prototype);
118
- for (const [key, item] of Object.entries(value)) {
119
- Object.defineProperty(materialized, key, {
120
- configurable: true,
121
- enumerable: true,
122
- value: item,
123
- writable: true
124
- });
118
+ const descriptor = {
119
+ configurable: true,
120
+ enumerable: true,
121
+ value: undefined,
122
+ writable: true
123
+ };
124
+ for (const key in value) {
125
+ if (Object.prototype.hasOwnProperty.call(value, key)) {
126
+ descriptor.value = value[key];
127
+ Object.defineProperty(materialized, key, descriptor);
128
+ }
125
129
  }
126
130
  return materialized;
127
131
  }
@@ -1,3 +1 @@
1
- export declare function storeEncodedPayload(owner: object, bytes: Uint8Array): Buffer;
2
- export declare function adoptEncodedPayload(owner: object, bytes: Uint8Array): Buffer;
3
1
  export declare function borrowEncodedPayload(owner: object): Buffer | undefined;
@@ -1,21 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.storeEncodedPayload = storeEncodedPayload;
4
- exports.adoptEncodedPayload = adoptEncodedPayload;
5
3
  exports.borrowEncodedPayload = borrowEncodedPayload;
6
- const encodedPayloadStorage = new WeakMap();
7
- function storeEncodedPayload(owner, bytes) {
8
- const stored = Buffer.from(bytes);
9
- encodedPayloadStorage.set(owner, stored);
10
- return stored;
11
- }
12
- function adoptEncodedPayload(owner, bytes) {
13
- const stored = Buffer.isBuffer(bytes)
14
- ? bytes
15
- : Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
16
- encodedPayloadStorage.set(owner, stored);
17
- return stored;
18
- }
4
+ const ZLinkEncodedPayload_1 = require("./ZLinkEncodedPayload");
19
5
  function borrowEncodedPayload(owner) {
20
- return encodedPayloadStorage.get(owner);
6
+ return owner instanceof ZLinkEncodedPayload_1.ZLinkEncodedPayload
7
+ ? ZLinkEncodedPayload_1.ZLinkEncodedPayload.prototype.view.call(owner)
8
+ : undefined;
21
9
  }
@@ -1,5 +1,5 @@
1
1
  export * from './ActorRef';
2
- export type { Type, RoutingId, ActorId, SpotId } from './CoreTypes';
2
+ export type { Type, ZLinkMessageTypeResolver, RoutingId, ActorId, SpotId } from './CoreTypes';
3
3
  export * from './ZLinkEncodedPayload';
4
4
  export * from './ZLinkMessageMetadata';
5
5
  export { ZLinkMessage, isZLinkMessage } from './ZLinkMessage';
@@ -0,0 +1,4 @@
1
+ /** Allocates independent bytes; previously returned regions are never reused. */
2
+ export declare function allocatePayloadBytes(length: number): Buffer;
3
+ /** Copies bytes into an exact, standalone backing store with no Buffer pool. */
4
+ export declare function copyPayloadBytes(bytes: Uint8Array): Buffer;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.allocatePayloadBytes = allocatePayloadBytes;
4
+ exports.copyPayloadBytes = copyPayloadBytes;
5
+ const SLAB_BYTES = 64 * 1024;
6
+ const MAX_POOLED_BYTES = 16 * 1024;
7
+ const ALIGNMENT = 8;
8
+ let slab;
9
+ let offset = 0;
10
+ /** Allocates independent bytes; previously returned regions are never reused. */
11
+ function allocatePayloadBytes(length) {
12
+ if (length > MAX_POOLED_BYTES || length < 0 || !Number.isInteger(length)) {
13
+ return Buffer.allocUnsafe(length);
14
+ }
15
+ if (slab === undefined || offset + length > SLAB_BYTES) {
16
+ slab = Buffer.allocUnsafe(SLAB_BYTES);
17
+ offset = 0;
18
+ }
19
+ const bytes = slab.subarray(offset, offset + length);
20
+ offset += Math.ceil(length / ALIGNMENT) * ALIGNMENT;
21
+ // Transient runtime frames only; local queues and application boundaries
22
+ // copy before they retain or expose these bytes.
23
+ return bytes;
24
+ }
25
+ /** Copies bytes into an exact, standalone backing store with no Buffer pool. */
26
+ function copyPayloadBytes(bytes) {
27
+ const copy = Buffer.allocUnsafeSlow(bytes.byteLength);
28
+ copy.set(bytes);
29
+ return copy;
30
+ }
@@ -11,6 +11,7 @@ const DiagnosticsValidation_1 = require("./DiagnosticsValidation");
11
11
  const EndpointNotation_1 = require("./EndpointNotation");
12
12
  const FanoutTopic_1 = require("./FanoutTopic");
13
13
  const SendTimeoutValidation_1 = require("./SendTimeoutValidation");
14
+ const HandlerMessageType_1 = require("../Common/HandlerMessageType");
14
15
  const InternalDefaults_1 = require("./InternalDefaults");
15
16
  const ObjectRoles_1 = require("./ObjectRoles");
16
17
  const RegistrationBuilderPolicy_1 = require("./RegistrationBuilderPolicy");
@@ -509,12 +510,12 @@ class DefaultClientServerChannelServerBuilder {
509
510
  }
510
511
  addSendHandler(handlerType) {
511
512
  this.channel.sendHandlers ??= [];
512
- this.channel.sendHandlers.push({ packetName: handlerPacketName(handlerType), handlerType });
513
+ this.channel.sendHandlers.push(handlerRegistration(handlerType));
513
514
  return this;
514
515
  }
515
516
  addRequestHandler(handlerType) {
516
517
  this.channel.requestHandlers ??= [];
517
- this.channel.requestHandlers.push({ packetName: handlerPacketName(handlerType), handlerType });
518
+ this.channel.requestHandlers.push(handlerRegistration(handlerType));
518
519
  return this;
519
520
  }
520
521
  get server() {
@@ -777,15 +778,12 @@ class DefaultMeshNodeBuilder {
777
778
  }
778
779
  addRouteSendHandler(handlerType) {
779
780
  this.node.routeSendHandlers ??= [];
780
- this.node.routeSendHandlers.push({ packetName: handlerPacketName(handlerType), handlerType });
781
+ this.node.routeSendHandlers.push(handlerRegistration(handlerType));
781
782
  return this;
782
783
  }
783
784
  addRouteRequestHandler(handlerType) {
784
785
  this.node.routeRequestHandlers ??= [];
785
- this.node.routeRequestHandlers.push({
786
- packetName: handlerPacketName(handlerType),
787
- handlerType
788
- });
786
+ this.node.routeRequestHandlers.push(handlerRegistration(handlerType));
789
787
  return this;
790
788
  }
791
789
  updateBind() {
@@ -1064,12 +1062,12 @@ class DefaultMeshChannelServerBuilder {
1064
1062
  }
1065
1063
  addSendHandler(handlerType) {
1066
1064
  this.channel.sendHandlers ??= [];
1067
- this.channel.sendHandlers.push({ packetName: handlerPacketName(handlerType), handlerType });
1065
+ this.channel.sendHandlers.push(handlerRegistration(handlerType));
1068
1066
  return this;
1069
1067
  }
1070
1068
  addRequestHandler(handlerType) {
1071
1069
  this.channel.requestHandlers ??= [];
1072
- this.channel.requestHandlers.push({ packetName: handlerPacketName(handlerType), handlerType });
1070
+ this.channel.requestHandlers.push(handlerRegistration(handlerType));
1073
1071
  return this;
1074
1072
  }
1075
1073
  }
@@ -1177,6 +1175,14 @@ function rejectDuplicateObjectType(registrations, stableType, meshName) {
1177
1175
  throw new ConfigurationException_1.ZLinkConfigurationException(`Duplicate object factory '${stableType}' on RouteMesh '${meshName}'.`);
1178
1176
  }
1179
1177
  }
1178
+ function handlerRegistration(handlerType) {
1179
+ const messageType = (0, HandlerMessageType_1.resolveHandlerMessageType)(handlerType);
1180
+ return {
1181
+ packetName: handlerPacketName(handlerType),
1182
+ handlerType,
1183
+ ...(messageType === undefined ? {} : { messageType })
1184
+ };
1185
+ }
1180
1186
  function handlerPacketName(handlerType) {
1181
1187
  return ((0, Attributes_1.readZLinkDecoratorMetadata)(handlerType).find((metadata) => metadata.kind === 'packet' && metadata.packetName !== undefined)?.packetName ?? handlerType.name);
1182
1188
  }
@@ -1,3 +1,4 @@
1
+ import type { ZLinkHandlerMessageType } from '../Common/HandlerMessageType';
1
2
  import type { RoutingId, Type, ZLinkActor, ZLinkActorFactory, ZLinkEntrySpot, ZLinkHandlerFilter, ZLinkInstanceSpot, ZLinkMetricsOptions, ZLinkMessageContext, ZLinkPublishMessageContext, ZLinkRouteMessageContext, ZLinkSpot, ZLinkStreamCompressionOptions, ZLinkTimerOptions } from '../../contracts';
2
3
  import type { AutoHwmProfileValue } from '@zlink-systems/zlink';
3
4
  import type { ZLinkMessageSerializer } from '../Codecs';
@@ -270,18 +271,22 @@ export interface ZLinkMeshChannelOptions {
270
271
  export interface ZLinkMeshSendHandlerRegistration {
271
272
  readonly packetName: string;
272
273
  readonly handlerType: Type;
274
+ readonly messageType?: ZLinkHandlerMessageType;
273
275
  }
274
276
  export interface ZLinkMeshRequestHandlerRegistration {
275
277
  readonly packetName: string;
276
278
  readonly handlerType: Type;
279
+ readonly messageType?: ZLinkHandlerMessageType;
277
280
  }
278
281
  export interface ZLinkRouteMeshSendHandlerRegistration {
279
282
  readonly packetName: string;
280
283
  readonly handlerType: Type;
284
+ readonly messageType?: ZLinkHandlerMessageType;
281
285
  }
282
286
  export interface ZLinkRouteMeshRequestHandlerRegistration {
283
287
  readonly packetName: string;
284
288
  readonly handlerType: Type;
289
+ readonly messageType?: ZLinkHandlerMessageType;
285
290
  }
286
291
  export interface ZLinkEntrySpotTimerHandlerRegistration {
287
292
  readonly entrySpotType: Type<ZLinkEntrySpot>;
@@ -294,24 +299,28 @@ export interface ZLinkEntrySpotPacketHandlerRegistration {
294
299
  readonly entrySpotType: Type<ZLinkEntrySpot>;
295
300
  readonly handlerType: Type;
296
301
  readonly packetName?: string;
302
+ readonly messageType?: ZLinkHandlerMessageType;
297
303
  }
298
304
  export interface ZLinkEntrySpotSubscriptionHandlerRegistration {
299
305
  readonly entrySpotType: Type<ZLinkEntrySpot>;
300
306
  readonly handlerType: Type;
301
307
  readonly channelName: string;
302
308
  readonly topic: string;
309
+ readonly messageType?: ZLinkHandlerMessageType;
303
310
  }
304
311
  export interface ZLinkEntrySpotActorSendHandlerRegistration {
305
312
  readonly entrySpotType: Type<ZLinkEntrySpot>;
306
313
  readonly actorType: Type<ZLinkActor>;
307
314
  readonly handlerType: Type;
308
315
  readonly packetName: string;
316
+ readonly messageType?: ZLinkHandlerMessageType;
309
317
  }
310
318
  export interface ZLinkEntrySpotActorRequestHandlerRegistration {
311
319
  readonly entrySpotType: Type<ZLinkEntrySpot>;
312
320
  readonly actorType: Type<ZLinkActor>;
313
321
  readonly handlerType: Type;
314
322
  readonly packetName: string;
323
+ readonly messageType?: ZLinkHandlerMessageType;
315
324
  }
316
325
  export interface ZLinkSpotTimerHandlerRegistration {
317
326
  readonly spotType: Type<ZLinkSpot>;
@@ -324,24 +333,28 @@ export interface ZLinkSpotPacketHandlerRegistration {
324
333
  readonly spotType: Type<ZLinkSpot>;
325
334
  readonly handlerType: Type;
326
335
  readonly packetName?: string;
336
+ readonly messageType?: ZLinkHandlerMessageType;
327
337
  }
328
338
  export interface ZLinkSpotSubscriptionHandlerRegistration {
329
339
  readonly spotType: Type<ZLinkSpot>;
330
340
  readonly handlerType: Type;
331
341
  readonly channelName: string;
332
342
  readonly topic: string;
343
+ readonly messageType?: ZLinkHandlerMessageType;
333
344
  }
334
345
  export interface ZLinkSpotActorSendHandlerRegistration {
335
346
  readonly spotType: Type<ZLinkSpot>;
336
347
  readonly actorType: Type<ZLinkActor>;
337
348
  readonly handlerType: Type;
338
349
  readonly packetName: string;
350
+ readonly messageType?: ZLinkHandlerMessageType;
339
351
  }
340
352
  export interface ZLinkSpotActorRequestHandlerRegistration {
341
353
  readonly spotType: Type<ZLinkSpot>;
342
354
  readonly actorType: Type<ZLinkActor>;
343
355
  readonly handlerType: Type;
344
356
  readonly packetName: string;
357
+ readonly messageType?: ZLinkHandlerMessageType;
345
358
  }
346
359
  export interface ZLinkSpotRouterCapabilityOptions {
347
360
  readonly bind?: string;
@@ -368,21 +381,26 @@ export interface ZLinkRouteChannelHandlerOptions {
368
381
  readonly kind: 'send' | 'request';
369
382
  readonly packetName: string;
370
383
  readonly handler: ZLinkRouteChannelSendHandler | ZLinkRouteChannelRequestHandler;
384
+ readonly messageType?: ZLinkHandlerMessageType;
371
385
  }
372
386
  export interface ZLinkRouteChannelSendHandlerRegistration {
373
387
  readonly packetName: string;
374
388
  readonly handler: ZLinkRouteChannelSendHandler;
389
+ readonly messageType?: ZLinkHandlerMessageType;
375
390
  }
376
391
  export interface ZLinkRouteChannelRequestHandlerRegistration {
377
392
  readonly packetName: string;
378
393
  readonly handler: ZLinkRouteChannelRequestHandler;
394
+ readonly messageType?: ZLinkHandlerMessageType;
379
395
  }
380
396
  export interface ZLinkChannelPublishHandlerRegistration {
381
397
  readonly packetName: string;
382
398
  readonly handler: ZLinkChannelPublishHandler;
399
+ readonly messageType?: ZLinkHandlerMessageType;
383
400
  }
384
401
  export interface ZLinkChannelRequestHandlerRegistration {
385
402
  readonly packetName: string;
403
+ readonly messageType?: ZLinkHandlerMessageType;
386
404
  readonly handler?: {
387
405
  handle(payload: unknown, context: ZLinkMessageContext): Promise<unknown>;
388
406
  };
@@ -390,6 +408,7 @@ export interface ZLinkChannelRequestHandlerRegistration {
390
408
  }
391
409
  export interface ZLinkChannelSendHandlerRegistration {
392
410
  readonly packetName: string;
411
+ readonly messageType?: ZLinkHandlerMessageType;
393
412
  readonly handler?: {
394
413
  handle(payload: unknown, context: ZLinkMessageContext): Promise<void>;
395
414
  };
@@ -6,6 +6,7 @@ export interface ZLinkMessageContext {
6
6
  readonly contentType?: string;
7
7
  readonly metadata: ZLinkMessageMetadata;
8
8
  readonly correlationId?: string;
9
+ readonly receivedAt: Date;
9
10
  }
10
11
  export interface ZLinkPublishMessageContext extends ZLinkMessageContext {
11
12
  readonly channelName: string;
@@ -1,3 +1,4 @@
1
+ import type { ZLinkFrameworkErrorKind } from '../Errors';
1
2
  import type { RoutingId } from '../Common';
2
3
  import type { ZLinkMeshNodeDescriptorKey } from './Keys';
3
4
  import type { ZLinkLocationOwnerToken } from './Writes';
@@ -83,6 +84,7 @@ export type ZLinkAuthorityCompareExchangeResult = ({
83
84
  } | {
84
85
  readonly kind: 'conflict';
85
86
  readonly current: ZLinkAuthorityReadResult;
87
+ readonly membershipFailure?: ZLinkFrameworkErrorKind.NotFound | ZLinkFrameworkErrorKind.Unavailable;
86
88
  } | {
87
89
  readonly kind: 'generationExhausted';
88
90
  };
@@ -3,6 +3,11 @@ export * from './index';
3
3
  export { requireValidSendTimeoutMs } from './contracts/Configuration/SendTimeoutValidation';
4
4
  export * from './runtime/diagnostics';
5
5
  export * from './runtime/host';
6
+ export { ZLinkActorPlacementCoordinator } from './runtime/host/actor-placement-coordinator';
7
+ export { ZLinkActorTransferRuntime } from './runtime/host/actor-transfer-runtime';
8
+ export { ApplicationJobQueue, ApplicationJobQueuePermit, nodeEffectiveProcessorCount, resolveApplicationJobQueueConfiguration } from './runtime/host/application-job-queue';
9
+ export { ZLinkLocationRuntimeOwner } from './runtime/host/location-runtime-owner';
10
+ export { relocationFailedFailureCode, ZLinkHostServiceRelocationRuntime } from './runtime/host/service-relocation-host-runtime';
6
11
  export * from './runtime/admission';
7
12
  export * from './runtime/activation-admission';
8
13
  export * from './runtime/streams';
@@ -17,9 +22,13 @@ export * from './runtime/locations/canonical-codec';
17
22
  export { ZLinkLocationAutoConnectType, ZLinkLocationKind, ZLinkRouteKind } from './contracts/Locations/Values';
18
23
  export { ZLinkLocationWriteIntent, ZLinkLocationWriteStatus } from './contracts/Locations/Writes';
19
24
  export * from './runtime/channels';
25
+ export { ZLinkChannelRuntimeLifecycle } from './runtime/channels/channel-runtime-lifecycle';
26
+ export { ZLinkChannelSocketRegistry } from './runtime/channels/channel-socket-registry';
27
+ export { ZLinkChannelDispatchPipeline } from './runtime/channels/channel-dispatch-pipeline';
20
28
  export * from './runtime/backend';
21
29
  export * from './runtime/codecs';
22
30
  export * from './runtime/execution';
31
+ export { ZLinkSerialExecutionQueue } from './runtime/execution/serial-execution-queue';
23
32
  export * from './runtime/handlers';
24
33
  export * from './runtime/messaging';
25
34
  export * from './runtime/foundation';
package/dist/internal.js CHANGED
@@ -14,13 +14,27 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.requirePublicWeight = exports.isValidCapacity = exports.isValidListenerPort = exports.isValidPositiveCapacity = exports.isValidPublicWeight = exports.ZLINK_MAX_CAPACITY = exports.ZLINK_MAX_PUBLIC_WEIGHT = exports.MAX_LISTENER_PORT = exports.ZLINK_MAX_STABLE_TYPE_BYTES = exports.ZLINK_RELOCATION_MAX_BLOB_REFERENCE_BYTES = exports.ZLinkLocationWriteStatus = exports.ZLinkLocationWriteIntent = exports.ZLinkRouteKind = exports.ZLinkLocationKind = exports.ZLinkLocationAutoConnectType = exports.requireValidSendTimeoutMs = void 0;
17
+ exports.requirePublicWeight = exports.isValidCapacity = exports.isValidListenerPort = exports.isValidPositiveCapacity = exports.isValidPublicWeight = exports.ZLINK_MAX_CAPACITY = exports.ZLINK_MAX_PUBLIC_WEIGHT = exports.MAX_LISTENER_PORT = exports.ZLINK_MAX_STABLE_TYPE_BYTES = exports.ZLINK_RELOCATION_MAX_BLOB_REFERENCE_BYTES = exports.ZLinkSerialExecutionQueue = exports.ZLinkChannelDispatchPipeline = exports.ZLinkChannelSocketRegistry = exports.ZLinkChannelRuntimeLifecycle = exports.ZLinkLocationWriteStatus = exports.ZLinkLocationWriteIntent = exports.ZLinkRouteKind = exports.ZLinkLocationKind = exports.ZLinkLocationAutoConnectType = exports.ZLinkHostServiceRelocationRuntime = exports.relocationFailedFailureCode = exports.ZLinkLocationRuntimeOwner = exports.resolveApplicationJobQueueConfiguration = exports.nodeEffectiveProcessorCount = exports.ApplicationJobQueuePermit = exports.ApplicationJobQueue = exports.ZLinkActorTransferRuntime = exports.ZLinkActorPlacementCoordinator = exports.requireValidSendTimeoutMs = void 0;
18
18
  /** Test and companion-package integration surface. It is not exported by package.json. */
19
19
  __exportStar(require("./index"), exports);
20
20
  var SendTimeoutValidation_1 = require("./contracts/Configuration/SendTimeoutValidation");
21
21
  Object.defineProperty(exports, "requireValidSendTimeoutMs", { enumerable: true, get: function () { return SendTimeoutValidation_1.requireValidSendTimeoutMs; } });
22
22
  __exportStar(require("./runtime/diagnostics"), exports);
23
23
  __exportStar(require("./runtime/host"), exports);
24
+ var actor_placement_coordinator_1 = require("./runtime/host/actor-placement-coordinator");
25
+ Object.defineProperty(exports, "ZLinkActorPlacementCoordinator", { enumerable: true, get: function () { return actor_placement_coordinator_1.ZLinkActorPlacementCoordinator; } });
26
+ var actor_transfer_runtime_1 = require("./runtime/host/actor-transfer-runtime");
27
+ Object.defineProperty(exports, "ZLinkActorTransferRuntime", { enumerable: true, get: function () { return actor_transfer_runtime_1.ZLinkActorTransferRuntime; } });
28
+ var application_job_queue_1 = require("./runtime/host/application-job-queue");
29
+ Object.defineProperty(exports, "ApplicationJobQueue", { enumerable: true, get: function () { return application_job_queue_1.ApplicationJobQueue; } });
30
+ Object.defineProperty(exports, "ApplicationJobQueuePermit", { enumerable: true, get: function () { return application_job_queue_1.ApplicationJobQueuePermit; } });
31
+ Object.defineProperty(exports, "nodeEffectiveProcessorCount", { enumerable: true, get: function () { return application_job_queue_1.nodeEffectiveProcessorCount; } });
32
+ Object.defineProperty(exports, "resolveApplicationJobQueueConfiguration", { enumerable: true, get: function () { return application_job_queue_1.resolveApplicationJobQueueConfiguration; } });
33
+ var location_runtime_owner_1 = require("./runtime/host/location-runtime-owner");
34
+ Object.defineProperty(exports, "ZLinkLocationRuntimeOwner", { enumerable: true, get: function () { return location_runtime_owner_1.ZLinkLocationRuntimeOwner; } });
35
+ var service_relocation_host_runtime_1 = require("./runtime/host/service-relocation-host-runtime");
36
+ Object.defineProperty(exports, "relocationFailedFailureCode", { enumerable: true, get: function () { return service_relocation_host_runtime_1.relocationFailedFailureCode; } });
37
+ Object.defineProperty(exports, "ZLinkHostServiceRelocationRuntime", { enumerable: true, get: function () { return service_relocation_host_runtime_1.ZLinkHostServiceRelocationRuntime; } });
24
38
  __exportStar(require("./runtime/admission"), exports);
25
39
  __exportStar(require("./runtime/activation-admission"), exports);
26
40
  __exportStar(require("./runtime/streams"), exports);
@@ -40,9 +54,17 @@ var Writes_1 = require("./contracts/Locations/Writes");
40
54
  Object.defineProperty(exports, "ZLinkLocationWriteIntent", { enumerable: true, get: function () { return Writes_1.ZLinkLocationWriteIntent; } });
41
55
  Object.defineProperty(exports, "ZLinkLocationWriteStatus", { enumerable: true, get: function () { return Writes_1.ZLinkLocationWriteStatus; } });
42
56
  __exportStar(require("./runtime/channels"), exports);
57
+ var channel_runtime_lifecycle_1 = require("./runtime/channels/channel-runtime-lifecycle");
58
+ Object.defineProperty(exports, "ZLinkChannelRuntimeLifecycle", { enumerable: true, get: function () { return channel_runtime_lifecycle_1.ZLinkChannelRuntimeLifecycle; } });
59
+ var channel_socket_registry_1 = require("./runtime/channels/channel-socket-registry");
60
+ Object.defineProperty(exports, "ZLinkChannelSocketRegistry", { enumerable: true, get: function () { return channel_socket_registry_1.ZLinkChannelSocketRegistry; } });
61
+ var channel_dispatch_pipeline_1 = require("./runtime/channels/channel-dispatch-pipeline");
62
+ Object.defineProperty(exports, "ZLinkChannelDispatchPipeline", { enumerable: true, get: function () { return channel_dispatch_pipeline_1.ZLinkChannelDispatchPipeline; } });
43
63
  __exportStar(require("./runtime/backend"), exports);
44
64
  __exportStar(require("./runtime/codecs"), exports);
45
65
  __exportStar(require("./runtime/execution"), exports);
66
+ var serial_execution_queue_1 = require("./runtime/execution/serial-execution-queue");
67
+ Object.defineProperty(exports, "ZLinkSerialExecutionQueue", { enumerable: true, get: function () { return serial_execution_queue_1.ZLinkSerialExecutionQueue; } });
46
68
  __exportStar(require("./runtime/handlers"), exports);
47
69
  __exportStar(require("./runtime/messaging"), exports);
48
70
  __exportStar(require("./runtime/foundation"), exports);
@@ -3,6 +3,7 @@ export type * from './contracts/Configuration/RegistrationTypes';
3
3
  export type * from './contracts';
4
4
  export { ZLinkSpotActorSend, ZLinkSpotActorRequest } from './contracts/Handlers/Attributes';
5
5
  export { registerActorFactory, registerRelocationStore, validateRoutingIdPrefix, registerEntrySpot, registerSpotFactory, validateActorTransferTimeout, validateMessageFollowDuration, validateSessionReplacementCallbackTimeout } from './contracts/Configuration/RegistrationBuilderPolicy';
6
+ export { resolveHandlerMessageType } from './contracts/Common/HandlerMessageType';
6
7
  import type { ZLinkLocationRuntimeQuery, ZLinkActorClient, ZLinkActorManager, ZLinkChannelClient, ZLinkClientServerRuntime, ZLinkCodecRegistryBuilder, ZLinkCodecRegistrar, ZLinkDispatchOptions, ZLinkDispatchOptionsBuilder, ZLinkFanoutClient, ZLinkFanoutRuntime, ZLinkRouteClient, ZLinkRouteMeshRuntime, ZLinkRouteMeshRuntimeOptions, ZLinkSpotManager, ZLinkSpotOutbound, ZLinkSpotPublisherClient, ZLinkStreamCompressionBuilder, ZLinkStreamCompressionCodec } from './contracts';
7
8
  import type { ZLinkProviderResolver } from './contracts/Common/ZLinkProviderResolver';
8
9
  import type { ZLinkSpotHandleResolver } from './runtime/spots/spot-handle';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.disposeIntegrationHandlers = exports.disposeIntegrationHandler = exports.registerIntegrationHandlerInstanceScopeFactory = exports.registerIntegrationHandlerFilterScope = exports.validateSessionReplacementCallbackTimeout = exports.validateMessageFollowDuration = exports.validateActorTransferTimeout = exports.registerSpotFactory = exports.registerEntrySpot = exports.validateRoutingIdPrefix = exports.registerRelocationStore = exports.registerActorFactory = exports.ZLinkSpotActorRequest = exports.ZLinkSpotActorSend = exports.hasSpotPublisherClient = exports.hasSpotNode = exports.hasActorManager = exports.normalizeFrameworkRegistration = exports.createFrameworkRegistration = exports.ZLinkConfigurationException = void 0;
3
+ exports.disposeIntegrationHandlers = exports.disposeIntegrationHandler = exports.registerIntegrationHandlerInstanceScopeFactory = exports.registerIntegrationHandlerFilterScope = exports.resolveHandlerMessageType = exports.validateSessionReplacementCallbackTimeout = exports.validateMessageFollowDuration = exports.validateActorTransferTimeout = exports.registerSpotFactory = exports.registerEntrySpot = exports.validateRoutingIdPrefix = exports.registerRelocationStore = exports.registerActorFactory = exports.ZLinkSpotActorRequest = exports.ZLinkSpotActorSend = exports.hasSpotPublisherClient = exports.hasSpotNode = exports.hasActorManager = exports.normalizeFrameworkRegistration = exports.createFrameworkRegistration = exports.ZLinkConfigurationException = void 0;
4
4
  exports.createIntegrationDispatchOptionsBuilder = createIntegrationDispatchOptionsBuilder;
5
5
  exports.createIntegrationInboundDispatchOptionsBuilder = createIntegrationInboundDispatchOptionsBuilder;
6
6
  exports.createIntegrationLocationOptionsBuilder = createIntegrationLocationOptionsBuilder;
@@ -35,6 +35,8 @@ Object.defineProperty(exports, "registerSpotFactory", { enumerable: true, get: f
35
35
  Object.defineProperty(exports, "validateActorTransferTimeout", { enumerable: true, get: function () { return RegistrationBuilderPolicy_1.validateActorTransferTimeout; } });
36
36
  Object.defineProperty(exports, "validateMessageFollowDuration", { enumerable: true, get: function () { return RegistrationBuilderPolicy_1.validateMessageFollowDuration; } });
37
37
  Object.defineProperty(exports, "validateSessionReplacementCallbackTimeout", { enumerable: true, get: function () { return RegistrationBuilderPolicy_1.validateSessionReplacementCallbackTimeout; } });
38
+ var HandlerMessageType_1 = require("./contracts/Common/HandlerMessageType");
39
+ Object.defineProperty(exports, "resolveHandlerMessageType", { enumerable: true, get: function () { return HandlerMessageType_1.resolveHandlerMessageType; } });
38
40
  const RegistrationBuilders_1 = require("./contracts/Configuration/RegistrationBuilders");
39
41
  const RegistrationCodecRegistry_1 = require("./contracts/Configuration/RegistrationCodecRegistry");
40
42
  const channels_1 = require("./runtime/channels");
@@ -1,9 +1,12 @@
1
+ import { RequestRuntime } from '../foundation/request-runtime';
2
+ import type { PendingOperation } from '../foundation/operation-registry';
1
3
  import { type ActorRef, type ZLinkActorClient, type ZLinkActorRequestCall, type ZLinkActorSendCall, type ZLinkMessageSerializer } from '../../contracts';
2
4
  import type { Message } from '../../contracts/Common/Message';
3
5
  import { type ZLinkBackendMeshNode, type ZLinkMeshCompletionTable } from '../backend';
4
6
  import type { ZLinkStoreLocationResolvers } from '../locations';
5
7
  import type { ZLinkActorRoutedJoinTransport } from './actor-routed-join-transport';
6
8
  export interface ZLinkActorClientOptions {
9
+ readonly requests?: RequestRuntime;
7
10
  readonly nodeProvider: (meshName: string) => ZLinkBackendMeshNode | undefined;
8
11
  readonly completionTableProvider: (meshName: string) => ZLinkMeshCompletionTable | undefined;
9
12
  readonly locationResolver: () => ZLinkStoreLocationResolvers | undefined;
@@ -11,7 +14,7 @@ export interface ZLinkActorClientOptions {
11
14
  readonly defaultRequestTimeoutMs?: number;
12
15
  readonly staleActorRefReporter?: (meshName: string, actorId: string) => void;
13
16
  readonly staleActorRefPredicate?: (meshName: string, actor: ActorRef) => boolean;
14
- readonly handoffCapture?: (meshName: string, actorId: string, parts: readonly Message[], returnResponse: boolean, actor: ActorRef, deadlineUnixMs?: number, onAdmitted?: () => void) => Promise<unknown> | undefined;
17
+ readonly handoffCapture?: (meshName: string, actorId: string, parts: readonly Message[], returnResponse: boolean, actor: ActorRef, deadlineUnixMs?: number, onAdmitted?: () => void, requestOperation?: PendingOperation<unknown>) => Promise<unknown> | undefined;
15
18
  readonly sendErrorReporter?: (error: unknown) => void;
16
19
  readonly routeTransport?: ZLinkActorRoutedJoinTransport;
17
20
  readonly transportDeliveryGate?: () => {
@@ -20,13 +23,14 @@ export interface ZLinkActorClientOptions {
20
23
  }
21
24
  export declare class DefaultZLinkActorClient implements ZLinkActorClient {
22
25
  private readonly options;
26
+ private readonly requests;
23
27
  constructor(options: ZLinkActorClientOptions);
24
28
  sendToActor(actorId: string, message: unknown): ZLinkActorSendCall;
25
29
  requestToActor(actorId: string, request: unknown): ZLinkActorRequestCall;
26
30
  private send;
27
31
  private request;
28
32
  private resolveActorRoute;
29
- private invalidateActorRoute;
33
+ private mapActorFailure;
30
34
  private throwIfKnownStale;
31
35
  private createPacketParts;
32
36
  private submitActorSend;