@zlink-systems/framework 0.29.1 → 0.30.1

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 (322) hide show
  1. package/LICENSE +150 -68
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/contracts/Actors/ZLinkActorClient.d.ts +2 -1
  4. package/dist/contracts/Channels/Calls.d.ts +2 -1
  5. package/dist/contracts/Common/ZLinkMessageMetadata.js +11 -5
  6. package/dist/contracts/Configuration/Builders.d.ts +1 -2
  7. package/dist/contracts/Configuration/Configs.d.ts +0 -5
  8. package/dist/contracts/Configuration/RegistrationBuilders.js +6 -4
  9. package/dist/contracts/Configuration/RegistrationTypes.d.ts +1 -6
  10. package/dist/contracts/Configuration/RegistrationValidators.js +4 -4
  11. package/dist/contracts/Configuration/index.d.ts +1 -1
  12. package/dist/contracts/Handlers/Attributes.d.ts +5 -13
  13. package/dist/contracts/Handlers/Attributes.js +7 -11
  14. package/dist/contracts/Handlers/JsonContract.d.ts +2 -46
  15. package/dist/contracts/Handlers/JsonContract.js +4 -153
  16. package/dist/contracts/Spots/Contracts.d.ts +2 -1
  17. package/dist/internal.d.ts +1 -0
  18. package/dist/internal.js +3 -1
  19. package/dist/nest-integration.d.ts +1 -1
  20. package/dist/nest-integration.js +2 -1
  21. package/dist/runtime/actors/actor-client.d.ts +1 -1
  22. package/dist/runtime/actors/actor-client.js +14 -12
  23. package/dist/runtime/actors/actor-handoff.d.ts +3 -2
  24. package/dist/runtime/actors/actor-handoff.js +15 -7
  25. package/dist/runtime/actors/actor-join-relocation.d.ts +1 -0
  26. package/dist/runtime/actors/actor-local-native-join.js +9 -12
  27. package/dist/runtime/actors/actor-remote-wire.js +15 -0
  28. package/dist/runtime/actors/actor-routed-join-transport.d.ts +6 -2
  29. package/dist/runtime/actors/actor-routed-json-request.d.ts +2 -0
  30. package/dist/runtime/actors/index.d.ts +2 -1
  31. package/dist/runtime/actors/index.js +18 -6
  32. package/dist/runtime/actors/spot-actor-dispatch.js +2 -2
  33. package/dist/runtime/admission.d.ts +1 -1
  34. package/dist/runtime/admission.js +15 -5
  35. package/dist/runtime/application-jobs/application-ingress-record-owner.d.ts +9 -9
  36. package/dist/runtime/application-jobs/application-ingress-record-owner.js +45 -23
  37. package/dist/runtime/application-jobs/application-job-queue-scope.d.ts +5 -2
  38. package/dist/runtime/application-jobs/application-job-queue-scope.js +41 -21
  39. package/dist/runtime/application-jobs/contracts.d.ts +15 -2
  40. package/dist/runtime/backend/contracts/index.d.ts +27 -27
  41. package/dist/runtime/backend/mesh-completion-table.d.ts +15 -5
  42. package/dist/runtime/backend/mesh-completion-table.js +160 -50
  43. package/dist/runtime/backend/mesh-dispatch-pump.d.ts +3 -0
  44. package/dist/runtime/backend/mesh-dispatch-pump.js +53 -36
  45. package/dist/runtime/backend/node/node-backend-adapter-factory.js +6 -1
  46. package/dist/runtime/backend/node/node-backend-adapter-support.d.ts +3 -3
  47. package/dist/runtime/backend/node/node-backend-adapter-support.js +33 -31
  48. package/dist/runtime/backend/node/node-dealer-channel-client-transport.d.ts +1 -1
  49. package/dist/runtime/backend/node/node-dealer-channel-client-transport.js +5 -2
  50. package/dist/runtime/backend/node/node-mesh-backend-adapter.d.ts +1 -9
  51. package/dist/runtime/backend/node/node-mesh-backend-adapter.js +1 -1
  52. package/dist/runtime/backend/node/node-raw-binding-port.js +50 -25
  53. package/dist/runtime/backend/node/node-raw-mesh-backend.d.ts +22 -16
  54. package/dist/runtime/backend/node/node-raw-mesh-backend.js +133 -149
  55. package/dist/runtime/backend/node/node-socket-backend-adapter.js +15 -10
  56. package/dist/runtime/backend/raw-binding-port.d.ts +10 -3
  57. package/dist/runtime/backend/runtime-message.d.ts +1 -0
  58. package/dist/runtime/backend/runtime-message.js +5 -0
  59. package/dist/runtime/backend/runtime-values.d.ts +1 -0
  60. package/dist/runtime/backend/runtime-values.js +2 -1
  61. package/dist/runtime/channels/channel-clients.d.ts +1 -0
  62. package/dist/runtime/channels/channel-clients.js +58 -21
  63. package/dist/runtime/channels/channel-dispatch-pipeline.d.ts +3 -2
  64. package/dist/runtime/channels/channel-dispatch-pipeline.js +20 -11
  65. package/dist/runtime/channels/channel-dispatch-services.d.ts +1 -0
  66. package/dist/runtime/channels/channel-dispatch-services.js +45 -0
  67. package/dist/runtime/channels/channel-dispatchers.d.ts +1 -1
  68. package/dist/runtime/channels/channel-dispatchers.js +27 -26
  69. package/dist/runtime/channels/channel-envelope-inspection.d.ts +1 -2
  70. package/dist/runtime/channels/channel-envelope-inspection.js +1 -16
  71. package/dist/runtime/channels/channel-envelope.d.ts +1 -0
  72. package/dist/runtime/channels/channel-envelope.js +83 -8
  73. package/dist/runtime/channels/channel-outbound-operations.d.ts +2 -2
  74. package/dist/runtime/channels/channel-outbound-operations.js +8 -8
  75. package/dist/runtime/channels/channel-receive-loops.js +3 -3
  76. package/dist/runtime/channels/channel-runtime-lifecycle.js +2 -1
  77. package/dist/runtime/channels/channel-runtime-manager.d.ts +6 -6
  78. package/dist/runtime/channels/channel-runtime-manager.js +12 -12
  79. package/dist/runtime/channels/channel-socket-registry.d.ts +10 -3
  80. package/dist/runtime/channels/channel-socket-registry.js +59 -82
  81. package/dist/runtime/channels/channel-transports.d.ts +18 -15
  82. package/dist/runtime/channels/channel-transports.js +48 -31
  83. package/dist/runtime/channels/local-spot-route-transport.d.ts +1 -1
  84. package/dist/runtime/channels/local-spot-route-transport.js +2 -1
  85. package/dist/runtime/channels/router-socket-spot-route-transport.d.ts +2 -2
  86. package/dist/runtime/channels/router-socket-spot-route-transport.js +4 -4
  87. package/dist/runtime/channels/source-spot-router.d.ts +2 -2
  88. package/dist/runtime/channels/source-spot-router.js +4 -4
  89. package/dist/runtime/channels/spot-node-route-transport.d.ts +2 -2
  90. package/dist/runtime/channels/spot-node-route-transport.js +4 -4
  91. package/dist/runtime/channels/spot-route-bridge-transport.d.ts +2 -2
  92. package/dist/runtime/channels/spot-route-bridge-transport.js +4 -4
  93. package/dist/runtime/channels/spot-route-dispatch-strategy.d.ts +5 -4
  94. package/dist/runtime/channels/spot-route-dispatch-strategy.js +18 -18
  95. package/dist/runtime/diagnostics/message-flow.d.ts +1 -0
  96. package/dist/runtime/diagnostics/message-flow.js +3 -3
  97. package/dist/runtime/execution/serial-execution-queue.d.ts +1 -0
  98. package/dist/runtime/execution/serial-execution-queue.js +1 -0
  99. package/dist/runtime/foundation/actor-join-recovery-codec.js +2 -2
  100. package/dist/runtime/foundation/durable-service-request.d.ts +14 -0
  101. package/dist/runtime/foundation/durable-service-request.js +98 -0
  102. package/dist/runtime/foundation/operation-identity.d.ts +1 -0
  103. package/dist/runtime/foundation/operation-identity.js +5 -1
  104. package/dist/runtime/foundation/raw-service-mesh-runtime.d.ts +37 -6
  105. package/dist/runtime/foundation/raw-service-mesh-runtime.js +473 -220
  106. package/dist/runtime/foundation/service-liveness-registry.d.ts +20 -8
  107. package/dist/runtime/foundation/service-liveness-registry.js +57 -44
  108. package/dist/runtime/foundation/service-mailbox.d.ts +3 -0
  109. package/dist/runtime/foundation/service-mailbox.js +2 -1
  110. package/dist/runtime/foundation/service-relocation-object-owner.d.ts +1 -0
  111. package/dist/runtime/foundation/service-relocation-object-owner.js +1 -0
  112. package/dist/runtime/foundation/service-relocation-runtime.d.ts +2 -0
  113. package/dist/runtime/foundation/service-relocation-runtime.js +13 -1
  114. package/dist/runtime/foundation/service-runtime-contracts.d.ts +2 -0
  115. package/dist/runtime/foundation/service-stateful-runtime.d.ts +10 -9
  116. package/dist/runtime/foundation/service-stateful-runtime.js +78 -126
  117. package/dist/runtime/foundation/service-stateful-wire-codec.d.ts +5 -7
  118. package/dist/runtime/foundation/service-stateful-wire-codec.js +43 -61
  119. package/dist/runtime/foundation/service-topology-registry.d.ts +16 -4
  120. package/dist/runtime/foundation/service-topology-registry.js +69 -30
  121. package/dist/runtime/foundation/service-wire-m6a-codec.d.ts +3 -3
  122. package/dist/runtime/foundation/service-wire-m6a-codec.js +36 -38
  123. package/dist/runtime/handlers/handler-instance-scope.d.ts +8 -0
  124. package/dist/runtime/handlers/handler-instance-scope.js +54 -11
  125. package/dist/runtime/host/actor-packet-relay.js +7 -7
  126. package/dist/runtime/host/actor-runtime-options-factory.js +2 -2
  127. package/dist/runtime/host/application-job-queue.d.ts +28 -9
  128. package/dist/runtime/host/application-job-queue.js +214 -50
  129. package/dist/runtime/host/entry-actor-runtime.d.ts +1 -0
  130. package/dist/runtime/host/entry-actor-runtime.js +4 -1
  131. package/dist/runtime/host/index.d.ts +7 -1
  132. package/dist/runtime/host/index.js +154 -126
  133. package/dist/runtime/host/instance-activation-authority.d.ts +2 -1
  134. package/dist/runtime/host/instance-activation-authority.js +89 -25
  135. package/dist/runtime/host/remote-bound-session-relay.js +2 -18
  136. package/dist/runtime/host/route-mesh-runtime.js +1 -1
  137. package/dist/runtime/host/service-relocation-control.d.ts +1 -0
  138. package/dist/runtime/host/service-relocation-control.js +10 -4
  139. package/dist/runtime/host/service-relocation-host-runtime.d.ts +6 -8
  140. package/dist/runtime/host/service-relocation-host-runtime.js +215 -243
  141. package/dist/runtime/host/spot-address-transport.d.ts +1 -0
  142. package/dist/runtime/host/spot-address-transport.js +28 -14
  143. package/dist/runtime/host/spot-runtime-options-factory.js +3 -2
  144. package/dist/runtime/host/user-spot-creation-coordinator.d.ts +1 -0
  145. package/dist/runtime/host/user-spot-creation-coordinator.js +1 -0
  146. package/dist/runtime/locations/actor-location-claims.d.ts +2 -2
  147. package/dist/runtime/locations/actor-location-claims.js +34 -19
  148. package/dist/runtime/locations/domain-store-contract.d.ts +2 -2
  149. package/dist/runtime/locations/in-memory-authority-store.d.ts +4 -2
  150. package/dist/runtime/locations/in-memory-authority-store.js +80 -8
  151. package/dist/runtime/locations/in-memory-location-store.d.ts +2 -2
  152. package/dist/runtime/locations/in-memory-location-store.js +19 -3
  153. package/dist/runtime/locations/internal-location-contracts.d.ts +3 -0
  154. package/dist/runtime/locations/lifecycle.d.ts +1 -2
  155. package/dist/runtime/locations/lifecycle.js +2 -5
  156. package/dist/runtime/locations/location-store-repository.d.ts +3 -2
  157. package/dist/runtime/locations/location-store-repository.js +165 -22
  158. package/dist/runtime/locations/resolvers.d.ts +2 -1
  159. package/dist/runtime/locations/resolvers.js +10 -1
  160. package/dist/runtime/locations/runtime.d.ts +1 -1
  161. package/dist/runtime/locations/runtime.js +24 -23
  162. package/dist/runtime/messaging/framework-json-v1.d.ts +4 -6
  163. package/dist/runtime/messaging/framework-json-v1.js +38 -294
  164. package/dist/runtime/messaging/packet-name.d.ts +1 -1
  165. package/dist/runtime/messaging/packet-name.js +8 -24
  166. package/dist/runtime/messaging/request-result.d.ts +2 -0
  167. package/dist/runtime/messaging/request-result.js +54 -0
  168. package/dist/runtime/messaging/submission-result.d.ts +2 -1
  169. package/dist/runtime/messaging/submission-result.js +7 -4
  170. package/dist/runtime/protocol/service_wire_codec.generated.d.ts +15 -0
  171. package/dist/runtime/protocol/service_wire_codec.generated.js +144 -0
  172. package/dist/runtime/protocol/service_wire_pilot_codec.generated.d.ts +9 -0
  173. package/dist/runtime/protocol/service_wire_pilot_codec.generated.js +14 -1
  174. package/dist/runtime/spots/formal-remote-actor-admission-registry.d.ts +9 -2
  175. package/dist/runtime/spots/formal-remote-actor-admission-registry.js +33 -19
  176. package/dist/runtime/spots/index.d.ts +7 -3
  177. package/dist/runtime/spots/index.js +23 -16
  178. package/dist/runtime/spots/spot-activation.d.ts +3 -1
  179. package/dist/runtime/spots/spot-activation.js +21 -12
  180. package/dist/runtime/spots/spot-actor-admission-coordinator.d.ts +2 -1
  181. package/dist/runtime/spots/spot-actor-admission-coordinator.js +11 -10
  182. package/dist/runtime/spots/spot-actor-packet-dispatch.d.ts +4 -1
  183. package/dist/runtime/spots/spot-actor-packet-dispatch.js +7 -5
  184. package/dist/runtime/spots/spot-actor-packet-drain.js +2 -0
  185. package/dist/runtime/spots/spot-actor-packet-relay-dispatch.js +1 -0
  186. package/dist/runtime/spots/spot-entry-activation.js +9 -3
  187. package/dist/runtime/spots/spot-handler-registry.d.ts +3 -1
  188. package/dist/runtime/spots/spot-handler-registry.js +18 -8
  189. package/dist/runtime/spots/spot-node-autoconnect.js +4 -3
  190. package/dist/runtime/spots/spot-node-runtime-manager.d.ts +2 -1
  191. package/dist/runtime/spots/spot-node-runtime-manager.js +4 -11
  192. package/dist/runtime/spots/spot-outbound.d.ts +3 -0
  193. package/dist/runtime/spots/spot-outbound.js +24 -15
  194. package/dist/runtime/spots/spot-routed-spot-packet-dispatch.d.ts +1 -0
  195. package/dist/runtime/spots/spot-routed-spot-packet-dispatch.js +1 -1
  196. package/dist/runtime/spots/spot-routing-internal.d.ts +6 -0
  197. package/dist/runtime/spots/spot-runtime-ports.d.ts +3 -1
  198. package/dist/runtime/spots/spot-subscription-dispatch.js +0 -3
  199. package/dist/runtime/spots/spot-timer.js +1 -0
  200. package/dist/runtime/streams/stream-session-runtime.d.ts +1 -1
  201. package/dist/runtime/streams/stream-session-runtime.js +14 -28
  202. package/package.json +3 -3
  203. package/src/contracts/Actors/ZLinkActorClient.ts +2 -1
  204. package/src/contracts/Channels/Calls.ts +2 -1
  205. package/src/contracts/Common/ZLinkMessageMetadata.ts +13 -8
  206. package/src/contracts/Configuration/Builders.ts +1 -2
  207. package/src/contracts/Configuration/Configs.ts +0 -6
  208. package/src/contracts/Configuration/RegistrationBuilders.ts +8 -12
  209. package/src/contracts/Configuration/RegistrationTypes.ts +1 -6
  210. package/src/contracts/Configuration/RegistrationValidators.ts +9 -10
  211. package/src/contracts/Configuration/index.ts +1 -6
  212. package/src/contracts/Handlers/Attributes.ts +14 -21
  213. package/src/contracts/Handlers/JsonContract.ts +8 -216
  214. package/src/contracts/Spots/Contracts.ts +2 -1
  215. package/src/internal.ts +1 -0
  216. package/src/nest-integration.ts +1 -0
  217. package/src/runtime/actors/actor-client.ts +40 -16
  218. package/src/runtime/actors/actor-handoff.ts +22 -8
  219. package/src/runtime/actors/actor-join-relocation.ts +1 -0
  220. package/src/runtime/actors/actor-local-native-join.ts +17 -26
  221. package/src/runtime/actors/actor-remote-wire.ts +17 -0
  222. package/src/runtime/actors/actor-routed-join-transport.ts +14 -4
  223. package/src/runtime/actors/actor-routed-json-request.ts +10 -2
  224. package/src/runtime/actors/index.ts +19 -5
  225. package/src/runtime/actors/spot-actor-dispatch.ts +4 -2
  226. package/src/runtime/admission.ts +18 -5
  227. package/src/runtime/application-jobs/application-ingress-record-owner.ts +53 -27
  228. package/src/runtime/application-jobs/application-job-queue-scope.ts +56 -22
  229. package/src/runtime/application-jobs/contracts.ts +28 -2
  230. package/src/runtime/backend/contracts/index.ts +63 -32
  231. package/src/runtime/backend/mesh-completion-table.ts +175 -59
  232. package/src/runtime/backend/mesh-dispatch-pump.ts +59 -32
  233. package/src/runtime/backend/node/node-backend-adapter-factory.ts +12 -5
  234. package/src/runtime/backend/node/node-backend-adapter-support.ts +42 -31
  235. package/src/runtime/backend/node/node-dealer-channel-client-transport.ts +12 -2
  236. package/src/runtime/backend/node/node-mesh-backend-adapter.ts +3 -10
  237. package/src/runtime/backend/node/node-raw-binding-port.ts +73 -37
  238. package/src/runtime/backend/node/node-raw-mesh-backend.ts +209 -176
  239. package/src/runtime/backend/node/node-socket-backend-adapter.ts +32 -13
  240. package/src/runtime/backend/raw-binding-port.ts +18 -3
  241. package/src/runtime/backend/runtime-message.ts +6 -0
  242. package/src/runtime/backend/runtime-values.ts +1 -0
  243. package/src/runtime/channels/channel-clients.ts +90 -41
  244. package/src/runtime/channels/channel-dispatch-pipeline.ts +69 -34
  245. package/src/runtime/channels/channel-dispatch-services.ts +69 -1
  246. package/src/runtime/channels/channel-dispatchers.ts +29 -27
  247. package/src/runtime/channels/channel-envelope-inspection.ts +2 -16
  248. package/src/runtime/channels/channel-envelope.ts +133 -8
  249. package/src/runtime/channels/channel-outbound-operations.ts +22 -8
  250. package/src/runtime/channels/channel-receive-loops.ts +3 -3
  251. package/src/runtime/channels/channel-runtime-lifecycle.ts +7 -1
  252. package/src/runtime/channels/channel-runtime-manager.ts +29 -12
  253. package/src/runtime/channels/channel-socket-registry.ts +84 -130
  254. package/src/runtime/channels/channel-transports.ts +128 -60
  255. package/src/runtime/channels/local-spot-route-transport.ts +3 -1
  256. package/src/runtime/channels/router-socket-spot-route-transport.ts +13 -4
  257. package/src/runtime/channels/source-spot-router.ts +8 -4
  258. package/src/runtime/channels/spot-node-route-transport.ts +8 -4
  259. package/src/runtime/channels/spot-route-bridge-transport.ts +6 -4
  260. package/src/runtime/channels/spot-route-dispatch-strategy.ts +47 -18
  261. package/src/runtime/diagnostics/message-flow.ts +1 -1
  262. package/src/runtime/execution/serial-execution-queue.ts +2 -0
  263. package/src/runtime/foundation/actor-join-recovery-codec.ts +2 -2
  264. package/src/runtime/foundation/durable-service-request.ts +137 -0
  265. package/src/runtime/foundation/operation-identity.ts +5 -1
  266. package/src/runtime/foundation/raw-service-mesh-runtime.ts +642 -253
  267. package/src/runtime/foundation/service-liveness-registry.ts +68 -59
  268. package/src/runtime/foundation/service-mailbox.ts +7 -1
  269. package/src/runtime/foundation/service-relocation-object-owner.ts +2 -0
  270. package/src/runtime/foundation/service-relocation-runtime.ts +18 -1
  271. package/src/runtime/foundation/service-runtime-contracts.ts +7 -1
  272. package/src/runtime/foundation/service-stateful-runtime.ts +128 -160
  273. package/src/runtime/foundation/service-stateful-wire-codec.ts +55 -84
  274. package/src/runtime/foundation/service-topology-registry.ts +103 -42
  275. package/src/runtime/foundation/service-wire-m6a-codec.ts +57 -38
  276. package/src/runtime/handlers/handler-instance-scope.ts +67 -16
  277. package/src/runtime/host/actor-packet-relay.ts +7 -0
  278. package/src/runtime/host/actor-runtime-options-factory.ts +14 -2
  279. package/src/runtime/host/application-job-queue.ts +249 -48
  280. package/src/runtime/host/entry-actor-runtime.ts +5 -0
  281. package/src/runtime/host/index.ts +224 -160
  282. package/src/runtime/host/instance-activation-authority.ts +132 -27
  283. package/src/runtime/host/remote-bound-session-relay.ts +2 -23
  284. package/src/runtime/host/route-mesh-runtime.ts +1 -1
  285. package/src/runtime/host/service-relocation-control.ts +11 -5
  286. package/src/runtime/host/service-relocation-host-runtime.ts +317 -291
  287. package/src/runtime/host/spot-address-transport.ts +49 -24
  288. package/src/runtime/host/spot-runtime-options-factory.ts +4 -0
  289. package/src/runtime/host/user-spot-creation-coordinator.ts +8 -0
  290. package/src/runtime/locations/actor-location-claims.ts +52 -30
  291. package/src/runtime/locations/domain-store-contract.ts +6 -2
  292. package/src/runtime/locations/in-memory-authority-store.ts +113 -9
  293. package/src/runtime/locations/in-memory-location-store.ts +25 -3
  294. package/src/runtime/locations/internal-location-contracts.ts +4 -0
  295. package/src/runtime/locations/lifecycle.ts +8 -26
  296. package/src/runtime/locations/location-store-repository.ts +220 -15
  297. package/src/runtime/locations/resolvers.ts +25 -2
  298. package/src/runtime/locations/runtime.ts +28 -24
  299. package/src/runtime/messaging/framework-json-v1.ts +5 -325
  300. package/src/runtime/messaging/packet-name.ts +5 -25
  301. package/src/runtime/messaging/request-result.ts +58 -0
  302. package/src/runtime/messaging/submission-result.ts +7 -3
  303. package/src/runtime/protocol/service_wire_codec.generated.ts +131 -1
  304. package/src/runtime/protocol/service_wire_pilot_codec.generated.ts +4 -4
  305. package/src/runtime/spots/formal-remote-actor-admission-registry.ts +45 -23
  306. package/src/runtime/spots/index.ts +30 -2
  307. package/src/runtime/spots/spot-activation.ts +33 -10
  308. package/src/runtime/spots/spot-actor-admission-coordinator.ts +13 -0
  309. package/src/runtime/spots/spot-actor-packet-dispatch.ts +10 -0
  310. package/src/runtime/spots/spot-actor-packet-drain.ts +2 -0
  311. package/src/runtime/spots/spot-actor-packet-relay-dispatch.ts +1 -0
  312. package/src/runtime/spots/spot-entry-activation.ts +12 -2
  313. package/src/runtime/spots/spot-handler-registry.ts +41 -8
  314. package/src/runtime/spots/spot-node-autoconnect.ts +6 -2
  315. package/src/runtime/spots/spot-node-runtime-manager.ts +7 -12
  316. package/src/runtime/spots/spot-outbound.ts +36 -16
  317. package/src/runtime/spots/spot-routed-spot-packet-dispatch.ts +2 -1
  318. package/src/runtime/spots/spot-routing-internal.ts +14 -0
  319. package/src/runtime/spots/spot-runtime-ports.ts +3 -0
  320. package/src/runtime/spots/spot-subscription-dispatch.ts +0 -3
  321. package/src/runtime/spots/spot-timer.ts +5 -1
  322. package/src/runtime/streams/stream-session-runtime.ts +13 -30
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DefaultZLinkSpotOutbound = void 0;
4
4
  exports.sendToSpotHandle = sendToSpotHandle;
5
5
  exports.requestToSpotHandle = requestToSpotHandle;
6
+ const request_result_1 = require("../messaging/request-result");
6
7
  const contracts_1 = require("../../contracts");
7
8
  const CoreTypes_1 = require("../../contracts/Common/CoreTypes");
8
9
  const configuration_1 = require("../configuration");
@@ -115,14 +116,13 @@ function createAddressedSpotSendCall(serial, transport, spotId, message, sourceS
115
116
  }
116
117
  function createAddressedSpotRequestCall(serial, transport, spotId, request, sourceSpotProvider) {
117
118
  const options = newAddressCallOptions();
118
- const begin = (waitPolicy, signal) => {
119
- markSubmitted(options);
120
- rejectSameSpotAsyncRequest(serial, spotId, waitPolicy);
119
+ const begin = (signal, onAdmitted) => {
121
120
  return startRequestOnSerial(serial, () => ({
122
121
  pending: transport.requestToSpotAddress(spotId, request, {
123
122
  ...freezeAddressCallOptions(options, sourceSpotProvider?.()),
124
123
  timeoutMs: options.timeoutMs,
125
- signal
124
+ signal,
125
+ onAdmitted
126
126
  })
127
127
  }));
128
128
  };
@@ -153,12 +153,15 @@ function createAddressedSpotRequestCall(serial, transport, spotId, request, sour
153
153
  return this;
154
154
  },
155
155
  submit(signal) {
156
- const pending = begin('async', signal);
157
- return serial.isCurrentTurn ? pending : (0, workers_1.deliverOnSerial)(serial, pending);
156
+ markSubmitted(options);
157
+ rejectSameSpotAsyncRequest(serial, spotId, 'async');
158
+ return (0, request_result_1.createZLinkRequest)((onAdmitted) => begin(signal, onAdmitted), (pending) => (serial.isCurrentTurn ? pending : (0, workers_1.deliverOnSerial)(serial, pending)));
158
159
  },
159
160
  yield(signal) {
160
161
  const turn = (0, execution_1.requireZLinkYieldTurn)();
161
- const pending = begin('yield', signal);
162
+ markSubmitted(options);
163
+ rejectSameSpotAsyncRequest(serial, spotId, 'yield');
164
+ const pending = begin(signal);
162
165
  return turn.yieldPromise(pending);
163
166
  }
164
167
  };
@@ -250,7 +253,12 @@ function wrapPublishCall(serial, inner) {
250
253
  };
251
254
  }
252
255
  function wrapRequestCall(serial, inner) {
253
- const begin = (signal) => startRequestOnSerial(serial, () => ({ pending: inner.submit(signal) }));
256
+ const begin = (signal, onAdmitted) => startRequestOnSerial(serial, () => {
257
+ const pending = inner.submit(signal);
258
+ if (onAdmitted !== undefined)
259
+ void pending.admitted.then(onAdmitted, () => undefined);
260
+ return { pending };
261
+ });
254
262
  return {
255
263
  metadata(key, value) {
256
264
  if (typeof key === 'string')
@@ -264,8 +272,7 @@ function wrapRequestCall(serial, inner) {
264
272
  return this;
265
273
  },
266
274
  submit(signal) {
267
- const pending = begin(signal);
268
- return serial.isCurrentTurn ? pending : (0, workers_1.deliverOnSerial)(serial, pending);
275
+ return (0, request_result_1.createZLinkRequest)((onAdmitted) => begin(signal, onAdmitted), (pending) => (serial.isCurrentTurn ? pending : (0, workers_1.deliverOnSerial)(serial, pending)));
269
276
  },
270
277
  yield(signal) {
271
278
  const turn = (0, execution_1.requireZLinkYieldTurn)();
@@ -320,15 +327,15 @@ function wrapRoutedSpotSendCall(serial, transport, spot, message, spotRouterChan
320
327
  function wrapRoutedSpotRequestCall(serial, transport, spot, request, spotRouterChannelIdForMesh, sourceSpotProvider) {
321
328
  let selectedTimeoutMs;
322
329
  const metadata = new Map();
323
- const begin = (waitPolicy, signal) => {
330
+ const begin = (signal, onAdmitted) => {
324
331
  // A request to the current Spot would wait behind the handler that owns
325
332
  // the same Spot claim. Reject it before resolving a route or submitting
326
333
  // transport work; one-way self-send remains a valid FIFO admission.
327
- rejectSameSpotAsyncRequest(serial, spot.spotId, waitPolicy);
328
334
  return startRequestOnSerial(serial, () => ({
329
335
  pending: requestToSpotHandle(transport, spot, request, {
330
336
  timeoutMs: selectedTimeoutMs,
331
337
  signal,
338
+ onAdmitted,
332
339
  metadata,
333
340
  spotRouterChannelIdForMesh,
334
341
  sourceSpot: sourceSpotProvider?.()
@@ -352,12 +359,13 @@ function wrapRoutedSpotRequestCall(serial, transport, spot, request, spotRouterC
352
359
  return this;
353
360
  },
354
361
  submit(signal) {
355
- const pending = begin('async', signal);
356
- return serial.isCurrentTurn ? pending : (0, workers_1.deliverOnSerial)(serial, pending);
362
+ rejectSameSpotAsyncRequest(serial, spot.spotId, 'async');
363
+ return (0, request_result_1.createZLinkRequest)((onAdmitted) => begin(signal, onAdmitted), (pending) => (serial.isCurrentTurn ? pending : (0, workers_1.deliverOnSerial)(serial, pending)));
357
364
  },
358
365
  yield(signal) {
359
366
  const turn = (0, execution_1.requireZLinkYieldTurn)();
360
- const pending = begin('yield', signal);
367
+ rejectSameSpotAsyncRequest(serial, spot.spotId, 'yield');
368
+ const pending = begin(signal);
361
369
  return turn.yieldPromise(pending);
362
370
  }
363
371
  };
@@ -395,6 +403,7 @@ async function requestToSpotHandle(transport, spot, request, options = {}) {
395
403
  packetName,
396
404
  timeoutMs: options.timeoutMs,
397
405
  signal: options.signal,
406
+ onAdmitted: options.onAdmitted,
398
407
  metadata: options.metadata
399
408
  };
400
409
  if (options.sourceSpot !== undefined && transport.requestFromSpotToSpot !== undefined) {
@@ -23,6 +23,7 @@ interface ZLinkRoutedSpotPacketDispatchOptions {
23
23
  }
24
24
  interface ZLinkRoutedSpotPacketContext {
25
25
  readonly channelName: string;
26
+ readonly onAdmitted?: () => void;
26
27
  readonly contentType?: string;
27
28
  readonly workOptions?: ZLinkSerialWorkOptions;
28
29
  readonly admissionTimeoutMs?: number;
@@ -151,7 +151,7 @@ class ZLinkRoutedSpotPacketDispatch {
151
151
  if (activation.serial.isCurrentTurn) {
152
152
  throw (0, framework_errors_internal_1.createInternalFrameworkException)(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.InvalidOperation, `Spot '${spotId}' cannot await a request to its current serial turn.`);
153
153
  }
154
- await activation.serial.execute(runHandler, context.workOptions, instanceIntent ? runHandler : undefined);
154
+ await activation.serial.execute(runHandler, { ...context.workOptions, onAdmitted: context.onAdmitted }, instanceIntent ? runHandler : undefined);
155
155
  }
156
156
  }
157
157
  catch (error) {
@@ -1,6 +1,7 @@
1
1
  import type { RoutingId } from '../../contracts/Common';
2
2
  import type { ZLinkFrameworkRuntimeState, ZLinkSpotKind } from '../../contracts';
3
3
  export interface ZLinkSpotRouteResolver {
4
+ resolve(spotId: RoutingId, signal: AbortSignal | undefined, instanceIntent: true): Promise<ZLinkSpotRouteTarget | ZLinkInstanceReactivationRoute>;
4
5
  resolve(spotId: RoutingId, signal?: AbortSignal): Promise<ZLinkSpotRouteTarget>;
5
6
  invalidate?(spotId: RoutingId): void;
6
7
  }
@@ -26,3 +27,8 @@ export interface ZLinkSpotRouteTarget {
26
27
  /** Current state of the owning MeshNode, when the route was resolved from Location Store. */
27
28
  readonly targetNodeState?: ZLinkFrameworkRuntimeState;
28
29
  }
30
+ export interface ZLinkInstanceReactivationRoute extends Pick<ZLinkSpotRouteTarget, 'spotId' | 'spotKind' | 'stableType'> {
31
+ readonly kind: 'coldActivation';
32
+ readonly meshName: string;
33
+ readonly stableType: string;
34
+ }
@@ -1,3 +1,4 @@
1
+ import type { ApplicationJobOrigin } from '../application-jobs/contracts';
1
2
  import type { ActorRef, RoutingId, ZLinkActor, ZLinkActorJoinOperationId, ZLinkSpot } from '../../contracts';
2
3
  import type { Message } from '../../contracts/Common/Message';
3
4
  import type { ZLinkMessageFollowOrigin } from '../foundation/service-runtime-contracts';
@@ -7,6 +8,7 @@ import type { ZLinkActorResponseOptions } from './spot-actor-packet-dispatch';
7
8
  import type { ZLinkRemoteActorJoinActor, ZLinkRoutedActorTransferProvider } from './spot-remote-codec';
8
9
  import type { ZLinkBackendSpotNode } from '../backend/contracts';
9
10
  export interface ZLinkEntryActorRuntime {
11
+ releaseMembers?(meshName: string): Promise<void>;
10
12
  resolveActor(actorId: string): ZLinkActor | undefined;
11
13
  commitActorTransaction(actor: ZLinkActor, onJoined: () => Promise<void>): Promise<void>;
12
14
  destroyActor(node: ZLinkBackendSpotNode, entryNodeRid: RoutingId, actor: ZLinkActor, signal?: AbortSignal): Promise<void>;
@@ -44,5 +46,5 @@ export interface ZLinkSpotBoundSessionRuntime {
44
46
  sendActorError(actorId: string, packetName: string, requestSeq: bigint, error: unknown, metadata: ReadonlyMap<string, string>, fallbackBoundSessionTarget?: ZLinkRemoteBoundSessionTarget, actorRef?: ActorRef, signal?: AbortSignal): Promise<void>;
45
47
  }
46
48
  export interface ZLinkSpotActorHandoffRuntime {
47
- capture(actorId: string, parts: readonly Message[], returnResponse?: boolean, remoteBoundSessionTarget?: ZLinkRemoteBoundSessionTarget, fallbackActorRef?: ActorRef, deadlineUnixMs?: number, messageFollowOrigin?: ZLinkMessageFollowOrigin, provisionalReplay?: ZLinkActorHandoffDispatch): Promise<unknown> | undefined;
49
+ capture(origin: ApplicationJobOrigin, actorId: string, parts: readonly Message[], returnResponse?: boolean, remoteBoundSessionTarget?: ZLinkRemoteBoundSessionTarget, fallbackActorRef?: ActorRef, deadlineUnixMs?: number, messageFollowOrigin?: ZLinkMessageFollowOrigin, provisionalReplay?: ZLinkActorHandoffDispatch): Promise<unknown> | undefined;
48
50
  }
@@ -31,9 +31,6 @@ class ZLinkSpotSubscriptionDispatch {
31
31
  }
32
32
  const key = subscriptionKey(registration.channelName, registration.topic);
33
33
  const existing = this.handlers.get(key) ?? [];
34
- if (existing.some((entry) => entry.handlerType === registration.handlerType)) {
35
- continue;
36
- }
37
34
  existing.push(registration);
38
35
  this.handlers.set(key, existing);
39
36
  this.options.nativeSpot.setSubscription(registration.channelName, registration.topic);
@@ -50,6 +50,7 @@ class ZLinkSpotTimerRegistry {
50
50
  async add(name, periodMs, options, handlerType, serial, spot, providerResolver, signal, reportFailure) {
51
51
  (0, TimerRegistrationValidator_1.validateTimerRegistration)(name, periodMs, options);
52
52
  (0, abort_1.throwIfAborted)(signal);
53
+ (0, handler_instance_scope_1.prepareHandlerInstance)(providerResolver, handlerType);
53
54
  const handler = await (0, handler_instance_scope_1.resolveLifecycleHandler)(spot, handlerType, providerResolver);
54
55
  const prepared = await this.lane.run(() => this.prepareAddCore(name));
55
56
  if (prepared.previous !== undefined)
@@ -134,7 +134,7 @@ export declare class ZLinkStreamSessionNodeRuntime {
134
134
  private readonly receiveAbortController;
135
135
  private receiveLoop;
136
136
  private monitorLoop;
137
- private readonly receiveWake;
137
+ private receiveWake;
138
138
  private receiveWorkSinceYield;
139
139
  constructor(options: ZLinkStreamSessionNodeRuntimeOptions & ZLinkStreamLivenessOptions);
140
140
  start(): void;
@@ -33,27 +33,6 @@ const systemLivenessClock = {
33
33
  setTimer: (callback, delayMs) => setTimeout(callback, Math.min(delayMs, MAX_TIMER_DELAY_MS)),
34
34
  clearTimer: (timer) => clearTimeout(timer)
35
35
  };
36
- class ZLinkStreamReceiveWake {
37
- pending;
38
- resolvePending;
39
- finish = () => {
40
- const resolve = this.resolvePending;
41
- this.pending = undefined;
42
- this.resolvePending = undefined;
43
- resolve?.();
44
- };
45
- wait() {
46
- if (this.pending !== undefined)
47
- return this.pending;
48
- this.pending = new Promise((resolve) => {
49
- this.resolvePending = resolve;
50
- });
51
- return this.pending;
52
- }
53
- wake() {
54
- this.finish();
55
- }
56
- }
57
36
  class ZLinkStreamSessionRuntime {
58
37
  options;
59
38
  removeSession;
@@ -650,7 +629,7 @@ class ZLinkStreamSessionNodeRuntime {
650
629
  receiveAbortController = new AbortController();
651
630
  receiveLoop;
652
631
  monitorLoop;
653
- receiveWake = new ZLinkStreamReceiveWake();
632
+ receiveWake;
654
633
  receiveWorkSinceYield = 0;
655
634
  constructor(options) {
656
635
  this.options = options;
@@ -759,7 +738,7 @@ class ZLinkStreamSessionNodeRuntime {
759
738
  let packet;
760
739
  let packetTransferred = false;
761
740
  try {
762
- permit = await this.options.applicationJobQueue.acquire(signal);
741
+ permit = await this.options.applicationJobQueue.acquire(signal, 'remote');
763
742
  if (this.isReceiveStopped(signal)) {
764
743
  permit.releaseAfterInternalProcessing();
765
744
  break;
@@ -1113,13 +1092,20 @@ class ZLinkStreamSessionNodeRuntime {
1113
1092
  });
1114
1093
  }
1115
1094
  async waitReceiveLoopWake(signal) {
1116
- await Promise.race([
1117
- this.options.readablePoller.waitForReadable(signal),
1118
- this.receiveWake.wait()
1119
- ]);
1095
+ const wake = new AbortController();
1096
+ this.receiveWake = wake;
1097
+ try {
1098
+ // Readiness, internal wake and shutdown share one cancellable wait;
1099
+ // no losing Promise retains reactions across receive cycles.
1100
+ await this.options.readablePoller.waitForReadable(AbortSignal.any([signal, wake.signal]));
1101
+ }
1102
+ finally {
1103
+ wake.abort();
1104
+ this.receiveWake = undefined;
1105
+ }
1120
1106
  }
1121
1107
  wakeReceiveLoop() {
1122
- this.receiveWake.wake();
1108
+ this.receiveWake?.abort();
1123
1109
  }
1124
1110
  getOrCreateSession(routingId) {
1125
1111
  const sessionId = (0, managed_stream_1.streamSessionIdFromRoutingId)(routingId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zlink-systems/framework",
3
- "version": "0.29.1",
3
+ "version": "0.30.1",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "repository": {
6
6
  "type": "git",
@@ -19,7 +19,7 @@
19
19
  "dependencies": {
20
20
  "@opentelemetry/api": "^1.9.1",
21
21
  "@opentelemetry/api-logs": "^0.221.0",
22
- "@zlink-systems/stream-wire": "0.29.1",
23
- "@zlink-systems/zlink": "1.17.0"
22
+ "@zlink-systems/stream-wire": "0.30.1",
23
+ "@zlink-systems/zlink": "1.19.0"
24
24
  }
25
25
  }
@@ -1,4 +1,5 @@
1
1
  import type { ActorId } from '../Common';
2
+ import type { ZLinkRequest } from '../Handlers/Attributes';
2
3
 
3
4
  export interface ZLinkActorClient {
4
5
  sendToActor(actorId: ActorId, message: unknown): ZLinkActorSendCall;
@@ -13,6 +14,6 @@ export interface ZLinkActorSendCall {
13
14
  export interface ZLinkActorRequestCall {
14
15
  metadata(key: string, value: string): this;
15
16
  timeout(timeoutMs: number): this;
16
- submit<TReply>(signal?: AbortSignal): Promise<TReply>;
17
+ submit<TReply>(signal?: AbortSignal): ZLinkRequest<TReply>;
17
18
  yield<TReply>(signal?: AbortSignal): Promise<TReply>;
18
19
  }
@@ -1,4 +1,5 @@
1
1
  import type { ZLinkMessageMetadata } from '../Common';
2
+ import type { ZLinkRequest } from '../Handlers/Attributes';
2
3
 
3
4
  export interface ZLinkSendCall {
4
5
  metadata(key: string, value: string): this;
@@ -10,7 +11,7 @@ export interface ZLinkRequestCall {
10
11
  metadata(key: string, value: string): this;
11
12
  metadata(metadata: ZLinkMessageMetadata): this;
12
13
  timeout(timeoutMs: number): this;
13
- submit<TReply>(signal?: AbortSignal): Promise<TReply>;
14
+ submit<TReply>(signal?: AbortSignal): ZLinkRequest<TReply>;
14
15
  }
15
16
 
16
17
  export interface ZLinkChannelRequestCall extends ZLinkRequestCall {
@@ -11,7 +11,7 @@ export interface ZLinkMessageMetadataPolicy {
11
11
  class ImmutableZLinkMessageMetadata implements ZLinkMessageMetadata {
12
12
  readonly values: ReadonlyMap<string, string>;
13
13
 
14
- constructor(values: ReadonlyMap<string, string> | Readonly<Record<string, string>> = new Map()) {
14
+ constructor(values: Iterable<readonly [string, string]> = []) {
15
15
  this.values = Object.freeze(new ImmutableMetadataMap(values));
16
16
  }
17
17
 
@@ -23,12 +23,8 @@ class ImmutableZLinkMessageMetadata implements ZLinkMessageMetadata {
23
23
  class ImmutableMetadataMap implements ReadonlyMap<string, string> {
24
24
  readonly #values: Map<string, string>;
25
25
 
26
- constructor(values: ReadonlyMap<string, string> | Readonly<Record<string, string>>) {
27
- this.#values = new Map(
28
- typeof (values as ReadonlyMap<string, string>)[Symbol.iterator] === 'function'
29
- ? (values as ReadonlyMap<string, string>)
30
- : Object.entries(values)
31
- );
26
+ constructor(values: Iterable<readonly [string, string]>) {
27
+ this.#values = new Map(values);
32
28
  }
33
29
 
34
30
  get size(): number {
@@ -74,5 +70,14 @@ export const ZLinkMessageMetadataEmpty: ZLinkMessageMetadata = Object.freeze(
74
70
  export function zlinkMessageMetadata(
75
71
  values: ReadonlyMap<string, string> | Readonly<Record<string, string>>
76
72
  ): ZLinkMessageMetadata {
77
- return Object.freeze(new ImmutableZLinkMessageMetadata(values));
73
+ const entries =
74
+ typeof (values as ReadonlyMap<string, string>)[Symbol.iterator] === 'function'
75
+ ? (values as ReadonlyMap<string, string>)
76
+ : Object.entries(values);
77
+ const size = Array.isArray(entries)
78
+ ? entries.length
79
+ : (entries as ReadonlyMap<string, string>).size;
80
+ return size === 0
81
+ ? ZLinkMessageMetadataEmpty
82
+ : Object.freeze(new ImmutableZLinkMessageMetadata(entries));
78
83
  }
@@ -7,7 +7,6 @@ import type { ZLinkDispatchOptionsBuilder, ZLinkInboundDispatchOptions } from '.
7
7
  import type { ZLinkLocationOptions, ZLinkLocationStore, ZLinkRelocationStore } from '../Locations';
8
8
  import type { RoutingId, Type } from '../Common';
9
9
  import type { ZLinkWorkerOptions } from './RegistrationTypes';
10
- import type { ZLinkSpotPublisherConfig } from './Configs';
11
10
  import type {
12
11
  ZLinkActorFactoryBuilder,
13
12
  ZLinkInstanceSpotFactoryBuilder,
@@ -120,7 +119,6 @@ export interface ZLinkMeshNodeBuilder {
120
119
  setActivationConcurrency(limit: number): this;
121
120
  setInstanceSpotIdleTimeout(timeoutMs: number): this;
122
121
  configureRouterSocket(): ZLinkMeshNodeSocketConfig;
123
- configureSpotPublisher(): ZLinkSpotPublisherConfig;
124
122
  peerConnections(): ZLinkMeshPeerConnections;
125
123
  setDefaultRequestTimeout(timeoutMs: number): this;
126
124
  objects(): ZLinkMeshObjectRoleBuilder;
@@ -180,6 +178,7 @@ export interface ZLinkFanoutChannelBuilder {
180
178
  routingId(routingId: string): this;
181
179
  setRoutingIdPrefix(prefix: string): this;
182
180
  setNoDrop(noDrop?: boolean): this;
181
+ setSendTimeout(timeoutMs: number): this;
183
182
  enableSubscriber(): this;
184
183
  subscribe(topic: string): this;
185
184
  connect(endpoint: string): this;
@@ -19,9 +19,3 @@ export interface ZLinkOutboundRouteConfig {
19
19
  targetNodeRid: RoutingId;
20
20
  endpoint: string;
21
21
  }
22
-
23
- export interface ZLinkSpotPublisherConfig {
24
- sendHighWaterMark: number;
25
- sendTimeoutMs?: number;
26
- lingerMs?: number;
27
- }
@@ -27,7 +27,6 @@ import type {
27
27
  ZLinkSession,
28
28
  ZLinkSessionFactory,
29
29
  ZLinkSpot,
30
- ZLinkSpotPublisherConfig,
31
30
  ZLinkStreamCompressionBuilder,
32
31
  ZLinkStreamCompressionCodec,
33
32
  ZLinkStreamNodeBuilder,
@@ -53,6 +52,7 @@ import type { ZLinkEndpointConnections } from './Connections';
53
52
  import { requireMessageFlowLogMode, requireTraceSampleRate } from './DiagnosticsValidation';
54
53
  import { normalizeEndpoint } from './EndpointNotation';
55
54
  import { requirePublicFanoutTopic } from './FanoutTopic';
55
+ import { requireValidSendTimeoutMs } from './SendTimeoutValidation';
56
56
  import { DEFAULT_STREAM_NODE_MAX_MESSAGE_SIZE } from './InternalDefaults';
57
57
  import {
58
58
  type ZLinkActorFactoryBuilder,
@@ -519,6 +519,12 @@ class DefaultFanoutChannelBuilder implements ZLinkFanoutChannelBuilder {
519
519
  return this;
520
520
  }
521
521
 
522
+ setSendTimeout(timeoutMs: number): this {
523
+ requireValidSendTimeoutMs(`Fanout channel '${this.name}' send timeout`, timeoutMs);
524
+ this.channel.sendTimeoutMs = timeoutMs;
525
+ return this;
526
+ }
527
+
522
528
  enableSubscriber(endpoint?: string): this {
523
529
  this.selectSubscriberMode(endpoint === undefined ? 'automatic' : 'manual');
524
530
  this.channel.subscriber ??= { manualConnections: [] };
@@ -984,11 +990,6 @@ class DefaultMeshNodeBuilder implements ZLinkMeshNodeBuilder {
984
990
  return this.node.router as ZLinkMeshNodeSocketConfig;
985
991
  }
986
992
 
987
- configureSpotPublisher(): ZLinkSpotPublisherConfig {
988
- this.node.publisherConfig ??= {};
989
- return this.node.publisherConfig as ZLinkSpotPublisherConfig;
990
- }
991
-
992
993
  peerConnections(): ZLinkMeshPeerConnections {
993
994
  this.node.router ??= {};
994
995
  return new DefaultMeshPeerConnections(this.node.router);
@@ -1576,6 +1577,7 @@ interface MutableChannelOptions {
1576
1577
  routingId?: string;
1577
1578
  routingIdPrefix?: string;
1578
1579
  noDrop?: boolean;
1580
+ sendTimeoutMs?: number;
1579
1581
  publisher?: MutablePublisherCapabilityOptions;
1580
1582
  publishHandlers?: ZLinkChannelPublishHandlerRegistration[];
1581
1583
  subscriptions?: string[];
@@ -1607,7 +1609,6 @@ interface MutableClientCapabilityOptions {
1607
1609
  }
1608
1610
 
1609
1611
  interface MutablePublisherCapabilityOptions {
1610
- sendTimeoutMs?: number;
1611
1612
  bind?: string;
1612
1613
  bindHost?: string;
1613
1614
  advertiseHost?: string;
@@ -1668,11 +1669,6 @@ interface MutableSpotNodeOptions {
1668
1669
  routeSendHandlers?: Array<{ packetName: string; handlerType: Type }>;
1669
1670
  routeRequestHandlers?: Array<{ packetName: string; handlerType: Type }>;
1670
1671
  requestTimeoutMs?: number;
1671
- publisherConfig?: {
1672
- sendHighWaterMark?: number;
1673
- sendTimeoutMs?: number;
1674
- lingerMs?: number;
1675
- };
1676
1672
  }
1677
1673
 
1678
1674
  interface MutableObjectFactoryRegistration<T, TImplementation = T, TOptions = unknown> {
@@ -166,6 +166,7 @@ export interface ZLinkChannelOptions {
166
166
  readonly routingId?: string;
167
167
  readonly routingIdPrefix?: string;
168
168
  readonly noDrop?: boolean;
169
+ readonly sendTimeoutMs?: number;
169
170
  readonly requestTimeoutMs?: number;
170
171
  readonly client?: ZLinkClientCapabilityOptions;
171
172
  readonly publisher?: ZLinkPublisherCapabilityOptions;
@@ -196,7 +197,6 @@ export interface ZLinkClientCapabilityOptions {
196
197
  }
197
198
 
198
199
  export interface ZLinkPublisherCapabilityOptions {
199
- readonly sendTimeoutMs?: number;
200
200
  readonly bind?: string;
201
201
  readonly bindHost?: string;
202
202
  readonly advertiseHost?: string;
@@ -297,11 +297,6 @@ export interface ZLinkSpotNodeOptions {
297
297
  readonly routeSendHandlers?: readonly ZLinkRouteMeshSendHandlerRegistration[];
298
298
  readonly routeRequestHandlers?: readonly ZLinkRouteMeshRequestHandlerRegistration[];
299
299
  readonly requestTimeoutMs?: number;
300
- readonly publisherConfig?: {
301
- readonly sendHighWaterMark?: number;
302
- readonly sendTimeoutMs?: number;
303
- readonly lingerMs?: number;
304
- };
305
300
  readonly entrySpotTimerHandlers?: readonly ZLinkEntrySpotTimerHandlerRegistration[];
306
301
  readonly entrySpotPacketHandlers?: readonly ZLinkEntrySpotPacketHandlerRegistration[];
307
302
  readonly entrySpotSubscriptionHandlers?: readonly ZLinkEntrySpotSubscriptionHandlerRegistration[];
@@ -217,9 +217,12 @@ function validateChannelCapabilities(
217
217
  if (channel.noDrop !== undefined && typeof channel.noDrop !== 'boolean') {
218
218
  throw new ZLinkConfigurationException(`Channel '${channelName}' NoDrop must be a boolean.`);
219
219
  }
220
- if (channel.noDrop !== undefined && channel.publisher === undefined) {
220
+ if (
221
+ (channel.noDrop !== undefined || channel.sendTimeoutMs !== undefined) &&
222
+ channel.publisher === undefined
223
+ ) {
221
224
  throw new ZLinkConfigurationException(
222
- `Channel '${channelName}' NoDrop requires a publisher role.`
225
+ `Channel '${channelName}': NoDrop and send timeout require the publisher role.`
223
226
  );
224
227
  }
225
228
  if (channel.server !== undefined) {
@@ -235,11 +238,11 @@ function validateChannelCapabilities(
235
238
  requirePeerWeight(`channel '${channelName}' server weight`, channel.server.weight);
236
239
  requireSocketOptions(`channel '${channelName}' server`, channel.server);
237
240
  }
241
+ requireValidSendTimeoutMs(
242
+ `channel '${channelName}' publisher sendTimeoutMs`,
243
+ channel.sendTimeoutMs
244
+ );
238
245
  if (channel.publisher !== undefined) {
239
- requireValidSendTimeoutMs(
240
- `channel '${channelName}' publisher sendTimeoutMs`,
241
- channel.publisher.sendTimeoutMs
242
- );
243
246
  requireEndpoint(`channel '${channelName}' publisher`, channel.publisher.bind);
244
247
  validateListenerNetworkIdentity(
245
248
  `channel '${channelName}' publisher`,
@@ -345,10 +348,6 @@ function validateSpotNodes(registration: ZLinkFrameworkRegistration): void {
345
348
  `SpotNode '${spotNodeName}' instanceSpotIdleTimeoutMs`,
346
349
  spotNode.instanceSpotIdleTimeoutMs
347
350
  );
348
- requireValidSendTimeoutMs(
349
- `SpotNode '${spotNodeName}' publisher sendTimeoutMs`,
350
- spotNode.publisherConfig?.sendTimeoutMs
351
- );
352
351
  validateSpotNodeFactories(spotNodeName, spotNode);
353
352
  validateSpotNodeTimers(spotNode);
354
353
  if (
@@ -20,12 +20,7 @@ export type {
20
20
  ZLinkStreamSocketConfig,
21
21
  ZLinkStreamNodeBuilder
22
22
  } from './Builders';
23
- export type {
24
- ZLinkOutboundRouteConfig,
25
- ZLinkRouteConfig,
26
- ZLinkSocketConfig,
27
- ZLinkSpotPublisherConfig
28
- } from './Configs';
23
+ export type { ZLinkOutboundRouteConfig, ZLinkRouteConfig, ZLinkSocketConfig } from './Configs';
29
24
  export * from './Connections';
30
25
  export * from './ObjectRoles';
31
26
  export type {
@@ -4,23 +4,25 @@ import {
4
4
  type ZLinkPacketJsonContract
5
5
  } from './JsonContract';
6
6
 
7
- export const ZLINK_DECORATOR_METADATA = Symbol.for('@zlink-systems/framework:decorator');
8
-
9
- export interface ZLinkDecoratorMetadata {
10
- readonly kind: string;
11
- readonly packetName?: string;
12
- readonly groupName?: string;
13
- readonly methodName?: string;
14
- readonly meshName?: string;
15
- readonly channelName?: string;
16
- readonly topic?: string;
17
- readonly jsonContract?: ZLinkPacketJsonContract;
18
- }
7
+ import {
8
+ ZLINK_DECORATOR_METADATA,
9
+ readZLinkDecoratorMetadata,
10
+ type ZLinkDecoratorMetadata
11
+ } from '@zlink-systems/stream-wire/internal/json';
12
+ export {
13
+ ZLINK_DECORATOR_METADATA,
14
+ readZLinkDecoratorMetadata
15
+ } from '@zlink-systems/stream-wire/internal/json';
16
+ export type { ZLinkDecoratorMetadata } from '@zlink-systems/stream-wire/internal/json';
19
17
 
20
18
  export function ZLinkHandlerGroup(groupName: string): ClassDecorator {
21
19
  return classDecorator({ kind: 'handlerGroup', groupName });
22
20
  }
23
21
 
22
+ export interface ZLinkRequest<TReply> extends Promise<TReply> {
23
+ readonly admitted: Promise<void>;
24
+ }
25
+
24
26
  export function ZLinkRequest(packetName?: string): MethodDecorator {
25
27
  return methodDecorator({ kind: 'request', packetName });
26
28
  }
@@ -106,12 +108,3 @@ function appendMetadata(target: object, metadata: ZLinkDecoratorMetadata): void
106
108
  writable: false
107
109
  });
108
110
  }
109
-
110
- export function readZLinkDecoratorMetadata(target: object): readonly ZLinkDecoratorMetadata[] {
111
- if (!Object.prototype.hasOwnProperty.call(target, ZLINK_DECORATOR_METADATA)) {
112
- return [];
113
- }
114
- return (target as Record<symbol, unknown>)[
115
- ZLINK_DECORATOR_METADATA
116
- ] as readonly ZLinkDecoratorMetadata[];
117
- }