@zlink-systems/framework 0.26.0 → 0.28.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 (561) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/contracts/Actors/ZLinkActorClient.d.ts +1 -1
  3. package/dist/contracts/Channels/Calls.d.ts +1 -1
  4. package/dist/contracts/Common/CoreTypes.d.ts +6 -0
  5. package/dist/contracts/Common/CoreTypes.js +7 -0
  6. package/dist/contracts/Common/index.d.ts +1 -1
  7. package/dist/contracts/Common/index.js +0 -1
  8. package/dist/contracts/Configuration/Builders.d.ts +0 -1
  9. package/dist/contracts/Configuration/Configs.d.ts +0 -1
  10. package/dist/contracts/Configuration/InternalDefaults.d.ts +8 -0
  11. package/dist/contracts/Configuration/InternalDefaults.js +9 -1
  12. package/dist/contracts/Configuration/Registration.d.ts +13 -2
  13. package/dist/contracts/Configuration/Registration.js +58 -36
  14. package/dist/contracts/Configuration/RegistrationBuilderPolicy.d.ts +13 -1
  15. package/dist/contracts/Configuration/RegistrationBuilderPolicy.js +38 -1
  16. package/dist/contracts/Configuration/RegistrationBuilders.d.ts +2 -3
  17. package/dist/contracts/Configuration/RegistrationBuilders.js +27 -32
  18. package/dist/contracts/Configuration/RegistrationTypes.d.ts +1 -5
  19. package/dist/contracts/Configuration/RegistrationValidators.js +15 -14
  20. package/dist/contracts/Configuration/TimerRegistrationValidator.js +3 -2
  21. package/dist/contracts/Dispatch/ZLinkDispatchOptions.d.ts +1 -1
  22. package/dist/contracts/Handlers/JsonContract.js +10 -4
  23. package/dist/contracts/Locations/Authority.d.ts +1 -1
  24. package/dist/contracts/Locations/Authority.js +3 -2
  25. package/dist/contracts/Locations/Options.js +1 -1
  26. package/dist/contracts/Locations/Stores.d.ts +12 -0
  27. package/dist/contracts/Locations/Stores.js +9 -0
  28. package/dist/contracts/Spots/Contracts.d.ts +2 -2
  29. package/dist/contracts/Streams/BoundSessionContracts.d.ts +1 -1
  30. package/dist/contracts/Streams/IZLinkSession.d.ts +2 -3
  31. package/dist/contracts/Streams/IZLinkSessionActor.d.ts +2 -2
  32. package/dist/internal.d.ts +4 -0
  33. package/dist/internal.js +15 -1
  34. package/dist/nest-integration.d.ts +4 -2
  35. package/dist/nest-integration.js +14 -4
  36. package/dist/runtime/abort.d.ts +1 -0
  37. package/dist/runtime/abort.js +8 -5
  38. package/dist/runtime/activation-admission.d.ts +1 -2
  39. package/dist/runtime/activation-admission.js +2 -6
  40. package/dist/runtime/actors/actor-authority-payload-codec.d.ts +1 -2
  41. package/dist/runtime/actors/actor-authority-payload-codec.js +34 -18
  42. package/dist/runtime/actors/actor-client.d.ts +2 -2
  43. package/dist/runtime/actors/actor-client.js +49 -153
  44. package/dist/runtime/actors/actor-context.d.ts +3 -5
  45. package/dist/runtime/actors/actor-context.js +13 -11
  46. package/dist/runtime/actors/actor-handoff.d.ts +4 -4
  47. package/dist/runtime/actors/actor-handoff.js +8 -8
  48. package/dist/runtime/actors/actor-lifecycle-snapshot.js +2 -1
  49. package/dist/runtime/actors/actor-local-native-join.d.ts +11 -6
  50. package/dist/runtime/actors/actor-local-native-join.js +83 -105
  51. package/dist/runtime/actors/actor-native-lookup.js +2 -8
  52. package/dist/runtime/actors/actor-packet-relay-wire.d.ts +3 -3
  53. package/dist/runtime/actors/actor-packet-relay-wire.js +5 -3
  54. package/dist/runtime/actors/actor-remote-joiner.d.ts +1 -1
  55. package/dist/runtime/actors/actor-remote-joiner.js +5 -9
  56. package/dist/runtime/actors/actor-remote-wire.js +5 -3
  57. package/dist/runtime/actors/actor-request-deadline.d.ts +1 -0
  58. package/dist/runtime/actors/actor-request-deadline.js +6 -0
  59. package/dist/runtime/actors/actor-retry-delay.js +2 -1
  60. package/dist/runtime/actors/actor-routed-join-transport.d.ts +2 -3
  61. package/dist/runtime/actors/actor-runtime-state.d.ts +9 -21
  62. package/dist/runtime/actors/actor-runtime-state.js +70 -187
  63. package/dist/runtime/actors/bound-session-wire.js +2 -7
  64. package/dist/runtime/actors/deferred-join-completion.d.ts +11 -6
  65. package/dist/runtime/actors/deferred-join-completion.js +1 -0
  66. package/dist/runtime/actors/index.d.ts +9 -7
  67. package/dist/runtime/actors/index.js +87 -69
  68. package/dist/runtime/actors/spot-actor-dispatch.d.ts +3 -3
  69. package/dist/runtime/actors/spot-actor-dispatch.js +25 -10
  70. package/dist/runtime/actors/transferred-actor-rollback.d.ts +3 -5
  71. package/dist/runtime/actors/transferred-actor-rollback.js +9 -42
  72. package/dist/runtime/admission.d.ts +2 -0
  73. package/dist/runtime/admission.js +7 -1
  74. package/dist/runtime/application-jobs/application-job-queue-scope.d.ts +1 -1
  75. package/dist/runtime/application-jobs/application-job-queue-scope.js +1 -1
  76. package/dist/runtime/backend/contracts/index.d.ts +7 -27
  77. package/dist/runtime/backend/mesh-actor-session-node-adapter.js +1 -17
  78. package/dist/runtime/backend/mesh-dispatch-pump.d.ts +1 -2
  79. package/dist/runtime/backend/mesh-dispatch-pump.js +95 -107
  80. package/dist/runtime/backend/node/node-backend-adapter-support.d.ts +3 -1
  81. package/dist/runtime/backend/node/node-backend-adapter-support.js +51 -10
  82. package/dist/runtime/backend/node/node-dealer-channel-client-transport.d.ts +1 -1
  83. package/dist/runtime/backend/node/node-dealer-channel-client-transport.js +1 -2
  84. package/dist/runtime/backend/node/node-event-loop-poller.d.ts +2 -2
  85. package/dist/runtime/backend/node/node-event-loop-poller.js +6 -7
  86. package/dist/runtime/backend/node/node-monitor-backend-adapter.js +1 -0
  87. package/dist/runtime/backend/node/node-raw-binding-port.js +41 -34
  88. package/dist/runtime/backend/node/node-raw-mesh-backend.d.ts +14 -15
  89. package/dist/runtime/backend/node/node-raw-mesh-backend.js +146 -118
  90. package/dist/runtime/backend/node/node-socket-backend-adapter.js +4 -3
  91. package/dist/runtime/backend/raw-binding-port.d.ts +1 -1
  92. package/dist/runtime/backend/runtime-values.d.ts +4 -1
  93. package/dist/runtime/backend/runtime-values.js +2 -0
  94. package/dist/runtime/channels/channel-clients.d.ts +20 -8
  95. package/dist/runtime/channels/channel-clients.js +73 -59
  96. package/dist/runtime/channels/channel-envelope-inspection.js +2 -1
  97. package/dist/runtime/channels/channel-envelope.d.ts +1 -1
  98. package/dist/runtime/channels/channel-envelope.js +51 -39
  99. package/dist/runtime/channels/channel-outbound-operations.d.ts +5 -2
  100. package/dist/runtime/channels/channel-outbound-operations.js +25 -42
  101. package/dist/runtime/channels/channel-receive-loops.d.ts +8 -3
  102. package/dist/runtime/channels/channel-receive-loops.js +27 -6
  103. package/dist/runtime/channels/channel-runtime-lifecycle.d.ts +12 -1
  104. package/dist/runtime/channels/channel-runtime-lifecycle.js +48 -28
  105. package/dist/runtime/channels/channel-runtime-manager.d.ts +4 -4
  106. package/dist/runtime/channels/channel-runtime-manager.js +13 -10
  107. package/dist/runtime/channels/channel-socket-options.js +3 -12
  108. package/dist/runtime/channels/channel-socket-registry.d.ts +14 -29
  109. package/dist/runtime/channels/channel-socket-registry.js +240 -177
  110. package/dist/runtime/channels/channel-transports.d.ts +21 -31
  111. package/dist/runtime/channels/channel-transports.js +80 -62
  112. package/dist/runtime/channels/client-server-location-runtime.d.ts +1 -1
  113. package/dist/runtime/channels/client-server-location-runtime.js +10 -11
  114. package/dist/runtime/channels/client-server-service-wire.d.ts +7 -2
  115. package/dist/runtime/channels/client-server-service-wire.js +32 -11
  116. package/dist/runtime/channels/dispatch-error-reporter.d.ts +1 -2
  117. package/dist/runtime/channels/dispatch-error-reporter.js +2 -1
  118. package/dist/runtime/channels/fanout-location-runtime.d.ts +16 -3
  119. package/dist/runtime/channels/fanout-location-runtime.js +130 -72
  120. package/dist/runtime/channels/local-spot-route-transport.d.ts +1 -1
  121. package/dist/runtime/channels/local-spot-route-transport.js +1 -3
  122. package/dist/runtime/channels/router-socket-spot-route-transport.d.ts +1 -1
  123. package/dist/runtime/channels/router-socket-spot-route-transport.js +2 -2
  124. package/dist/runtime/channels/source-spot-router.d.ts +1 -1
  125. package/dist/runtime/channels/source-spot-router.js +2 -4
  126. package/dist/runtime/channels/spot-direct-envelope.d.ts +1 -0
  127. package/dist/runtime/channels/spot-direct-envelope.js +4 -3
  128. package/dist/runtime/channels/spot-node-route-transport.d.ts +1 -1
  129. package/dist/runtime/channels/spot-node-route-transport.js +5 -5
  130. package/dist/runtime/channels/spot-route-bridge-transport.d.ts +1 -1
  131. package/dist/runtime/channels/spot-route-bridge-transport.js +2 -2
  132. package/dist/runtime/channels/spot-route-dispatch-strategy.d.ts +2 -4
  133. package/dist/runtime/channels/spot-route-dispatch-strategy.js +11 -12
  134. package/dist/runtime/diagnostics/diagnostic-text.d.ts +2 -0
  135. package/dist/runtime/diagnostics/diagnostic-text.js +7 -0
  136. package/dist/runtime/diagnostics/dispatch-error-details.d.ts +3 -0
  137. package/dist/runtime/diagnostics/dispatch-error-details.js +30 -2
  138. package/dist/runtime/diagnostics/flow-context.d.ts +6 -0
  139. package/dist/runtime/diagnostics/flow-context.js +16 -2
  140. package/dist/runtime/diagnostics/index.d.ts +4 -2
  141. package/dist/runtime/diagnostics/index.js +14 -4
  142. package/dist/runtime/diagnostics/message-flow.d.ts +1 -1
  143. package/dist/runtime/diagnostics/message-flow.js +10 -19
  144. package/dist/runtime/diagnostics/runtime-metrics.d.ts +94 -31
  145. package/dist/runtime/diagnostics/runtime-metrics.js +168 -105
  146. package/dist/runtime/diagnostics/runtime-observation-queue.js +3 -2
  147. package/dist/runtime/diagnostics/topology-runtime-projections.d.ts +2 -4
  148. package/dist/runtime/diagnostics/topology-runtime-projections.js +135 -154
  149. package/dist/runtime/disposal.d.ts +5 -0
  150. package/dist/runtime/disposal.js +22 -0
  151. package/dist/runtime/execution/index.d.ts +12 -9
  152. package/dist/runtime/execution/index.js +58 -14
  153. package/dist/runtime/execution/serial-execution-queue.d.ts +8 -2
  154. package/dist/runtime/execution/serial-execution-queue.js +54 -15
  155. package/dist/runtime/execution/state-lane.d.ts +8 -1
  156. package/dist/runtime/execution/state-lane.js +118 -3
  157. package/dist/runtime/foundation/actor-join-recovery-codec.d.ts +3 -0
  158. package/dist/runtime/foundation/actor-join-recovery-codec.js +15 -11
  159. package/dist/runtime/foundation/event-loop-resources.d.ts +2 -24
  160. package/dist/runtime/foundation/event-loop-resources.js +6 -119
  161. package/dist/runtime/foundation/operation-identity.d.ts +2 -0
  162. package/dist/runtime/foundation/operation-identity.js +9 -5
  163. package/dist/runtime/foundation/operation-registry.d.ts +5 -7
  164. package/dist/runtime/foundation/operation-registry.js +34 -44
  165. package/dist/runtime/foundation/raw-service-mesh-runtime.d.ts +8 -5
  166. package/dist/runtime/foundation/raw-service-mesh-runtime.js +79 -94
  167. package/dist/runtime/foundation/runtime-state-projections.d.ts +3 -1
  168. package/dist/runtime/foundation/runtime-state-projections.js +8 -0
  169. package/dist/runtime/foundation/service-authority-payload-codec.js +22 -12
  170. package/dist/runtime/foundation/service-discovery-registry.d.ts +4 -0
  171. package/dist/runtime/foundation/service-discovery-registry.js +22 -3
  172. package/dist/runtime/foundation/service-instance-activation-recovery-codec.js +8 -4
  173. package/dist/runtime/foundation/service-liveness-registry.js +2 -1
  174. package/dist/runtime/foundation/service-maintenance-runtime.d.ts +0 -1
  175. package/dist/runtime/foundation/service-maintenance-runtime.js +0 -6
  176. package/dist/runtime/foundation/service-metadata-codec.js +3 -3
  177. package/dist/runtime/foundation/service-relocation-aggregate-committer.d.ts +2 -5
  178. package/dist/runtime/foundation/service-relocation-aggregate-committer.js +1 -48
  179. package/dist/runtime/foundation/service-relocation-object-owner.js +3 -2
  180. package/dist/runtime/foundation/service-relocation-runtime.js +43 -32
  181. package/dist/runtime/foundation/service-runtime-contracts.d.ts +40 -8
  182. package/dist/runtime/foundation/service-runtime-contracts.js +25 -1
  183. package/dist/runtime/foundation/service-session-binding-ingress-port.d.ts +0 -12
  184. package/dist/runtime/foundation/service-stateful-registry.d.ts +2 -0
  185. package/dist/runtime/foundation/service-stateful-registry.js +10 -2
  186. package/dist/runtime/foundation/service-stateful-runtime.d.ts +26 -25
  187. package/dist/runtime/foundation/service-stateful-runtime.js +217 -204
  188. package/dist/runtime/foundation/service-stateful-wire-codec.d.ts +3 -3
  189. package/dist/runtime/foundation/service-stateful-wire-codec.js +89 -55
  190. package/dist/runtime/foundation/service-topology-registry.d.ts +0 -1
  191. package/dist/runtime/foundation/service-topology-registry.js +17 -32
  192. package/dist/runtime/foundation/service-wire-binary-primitives.d.ts +5 -0
  193. package/dist/runtime/foundation/service-wire-binary-primitives.js +6 -0
  194. package/dist/runtime/foundation/service-wire-codec.js +10 -8
  195. package/dist/runtime/foundation/service-wire-constants.generated.d.ts +1 -0
  196. package/dist/runtime/foundation/service-wire-constants.generated.js +2 -1
  197. package/dist/runtime/foundation/service-wire-m6a-codec.d.ts +2 -0
  198. package/dist/runtime/foundation/service-wire-m6a-codec.js +23 -13
  199. package/dist/runtime/framework-errors-internal.d.ts +2 -1
  200. package/dist/runtime/framework-errors-internal.js +343 -122
  201. package/dist/runtime/handlers/handler-instance-scope.d.ts +3 -1
  202. package/dist/runtime/handlers/handler-instance-scope.js +61 -74
  203. package/dist/runtime/host/actor-packet-relay.d.ts +11 -8
  204. package/dist/runtime/host/actor-packet-relay.js +54 -99
  205. package/dist/runtime/host/actor-placement-coordinator.js +7 -5
  206. package/dist/runtime/host/actor-runtime-options-factory.d.ts +2 -0
  207. package/dist/runtime/host/actor-runtime-options-factory.js +17 -4
  208. package/dist/runtime/host/actor-transfer-runtime.d.ts +16 -18
  209. package/dist/runtime/host/actor-transfer-runtime.js +143 -176
  210. package/dist/runtime/host/application-job-queue.js +16 -33
  211. package/dist/runtime/host/bound-session-relay.js +1 -1
  212. package/dist/runtime/host/channel-runtime-options-factory.js +1 -1
  213. package/dist/runtime/host/index.d.ts +14 -13
  214. package/dist/runtime/host/index.js +190 -171
  215. package/dist/runtime/host/instance-activation-authority.d.ts +2 -3
  216. package/dist/runtime/host/instance-activation-authority.js +17 -45
  217. package/dist/runtime/host/location-runtime-owner.d.ts +1 -1
  218. package/dist/runtime/host/location-runtime-owner.js +2 -2
  219. package/dist/runtime/host/remote-actor-join-receiver.d.ts +2 -2
  220. package/dist/runtime/host/remote-actor-join-receiver.js +1 -14
  221. package/dist/runtime/host/remote-actor-packet-target-store.d.ts +3 -2
  222. package/dist/runtime/host/remote-actor-packet-target-store.js +8 -47
  223. package/dist/runtime/host/remote-bound-session-relay.d.ts +2 -3
  224. package/dist/runtime/host/remote-bound-session-relay.js +15 -28
  225. package/dist/runtime/host/route-mesh-runtime.d.ts +13 -11
  226. package/dist/runtime/host/route-mesh-runtime.js +171 -252
  227. package/dist/runtime/host/runtime-shutdown.d.ts +2 -0
  228. package/dist/runtime/host/runtime-shutdown.js +18 -21
  229. package/dist/runtime/host/service-relocation-control.js +6 -1
  230. package/dist/runtime/host/service-relocation-host-runtime.d.ts +21 -30
  231. package/dist/runtime/host/service-relocation-host-runtime.js +508 -416
  232. package/dist/runtime/host/spot-address-transport.d.ts +3 -12
  233. package/dist/runtime/host/spot-address-transport.js +78 -220
  234. package/dist/runtime/host/spot-node-runtime-options-factory.d.ts +1 -1
  235. package/dist/runtime/host/spot-node-runtime-options-factory.js +3 -2
  236. package/dist/runtime/host/spot-runtime-options-factory.d.ts +4 -10
  237. package/dist/runtime/host/spot-runtime-options-factory.js +50 -14
  238. package/dist/runtime/host/user-spot-creation-coordinator.d.ts +3 -3
  239. package/dist/runtime/host/user-spot-creation-coordinator.js +11 -8
  240. package/dist/runtime/locations/aggregate-inventory-store.js +13 -10
  241. package/dist/runtime/locations/authority-key-codec.js +4 -3
  242. package/dist/runtime/locations/auto-connect-reconciler.d.ts +4 -0
  243. package/dist/runtime/locations/auto-connect-reconciler.js +37 -25
  244. package/dist/runtime/locations/creation-operation-id.js +6 -4
  245. package/dist/runtime/locations/domain-store-contract.d.ts +3 -3
  246. package/dist/runtime/locations/in-memory-authority-store.js +31 -15
  247. package/dist/runtime/locations/in-memory-location-store.d.ts +2 -2
  248. package/dist/runtime/locations/in-memory-location-store.js +17 -14
  249. package/dist/runtime/locations/in-memory-provider-location-store.d.ts +1 -0
  250. package/dist/runtime/locations/in-memory-provider-location-store.js +72 -22
  251. package/dist/runtime/locations/key-codec.js +3 -2
  252. package/dist/runtime/locations/lease-tracker.d.ts +3 -5
  253. package/dist/runtime/locations/lease-tracker.js +7 -11
  254. package/dist/runtime/locations/lifecycle.d.ts +4 -9
  255. package/dist/runtime/locations/lifecycle.js +2 -31
  256. package/dist/runtime/locations/location-store-failure.d.ts +2 -0
  257. package/dist/runtime/locations/location-store-failure.js +7 -0
  258. package/dist/runtime/locations/location-store-pages.d.ts +3 -0
  259. package/dist/runtime/locations/location-store-pages.js +13 -0
  260. package/dist/runtime/locations/location-store-repository.d.ts +5 -7
  261. package/dist/runtime/locations/location-store-repository.js +309 -336
  262. package/dist/runtime/locations/relocation-blob.js +18 -5
  263. package/dist/runtime/locations/resolvers.d.ts +5 -5
  264. package/dist/runtime/locations/resolvers.js +37 -28
  265. package/dist/runtime/locations/runtime.d.ts +5 -4
  266. package/dist/runtime/locations/runtime.js +123 -92
  267. package/dist/runtime/locations/spot-location-claims.d.ts +6 -0
  268. package/dist/runtime/locations/spot-location-claims.js +42 -1
  269. package/dist/runtime/messaging/payload-codec.js +26 -20
  270. package/dist/runtime/messaging/request-deadline.d.ts +3 -0
  271. package/dist/runtime/messaging/request-deadline.js +39 -0
  272. package/dist/runtime/messaging/submission-result.d.ts +4 -0
  273. package/dist/runtime/messaging/submission-result.js +56 -1
  274. package/dist/runtime/protocol/service_wire_codec.generated.d.ts +1 -0
  275. package/dist/runtime/protocol/service_wire_codec.generated.js +12 -7
  276. package/dist/runtime/spots/formal-remote-actor-transfer-registry.d.ts +4 -1
  277. package/dist/runtime/spots/index.d.ts +14 -20
  278. package/dist/runtime/spots/index.js +302 -176
  279. package/dist/runtime/spots/spot-activation-registry.d.ts +3 -5
  280. package/dist/runtime/spots/spot-activation-registry.js +14 -50
  281. package/dist/runtime/spots/spot-activation-state.d.ts +1 -1
  282. package/dist/runtime/spots/spot-activation-state.js +2 -2
  283. package/dist/runtime/spots/spot-activation.d.ts +3 -4
  284. package/dist/runtime/spots/spot-activation.js +49 -32
  285. package/dist/runtime/spots/spot-actor-admission-coordinator.d.ts +1 -2
  286. package/dist/runtime/spots/spot-actor-admission-coordinator.js +3 -40
  287. package/dist/runtime/spots/spot-actor-join-dispatch.d.ts +10 -18
  288. package/dist/runtime/spots/spot-actor-join-dispatch.js +4 -52
  289. package/dist/runtime/spots/spot-actor-membership.d.ts +4 -6
  290. package/dist/runtime/spots/spot-actor-membership.js +22 -45
  291. package/dist/runtime/spots/spot-actor-packet-dispatch.d.ts +0 -1
  292. package/dist/runtime/spots/spot-actor-packet-dispatch.js +0 -9
  293. package/dist/runtime/spots/spot-actor-packet-relay-dispatch.d.ts +2 -2
  294. package/dist/runtime/spots/spot-actor-packet-relay-dispatch.js +1 -7
  295. package/dist/runtime/spots/spot-context.d.ts +2 -2
  296. package/dist/runtime/spots/spot-entry-activation.d.ts +2 -2
  297. package/dist/runtime/spots/spot-entry-activation.js +9 -20
  298. package/dist/runtime/spots/spot-lifecycle-metrics.js +3 -2
  299. package/dist/runtime/spots/spot-manager-public.d.ts +5 -6
  300. package/dist/runtime/spots/spot-manager-public.js +5 -4
  301. package/dist/runtime/spots/spot-node-autoconnect.js +22 -31
  302. package/dist/runtime/spots/spot-node-runtime-manager.d.ts +19 -18
  303. package/dist/runtime/spots/spot-node-runtime-manager.js +67 -72
  304. package/dist/runtime/spots/spot-outbound.d.ts +7 -8
  305. package/dist/runtime/spots/spot-outbound.js +21 -23
  306. package/dist/runtime/spots/spot-remote-codec.js +5 -3
  307. package/dist/runtime/spots/spot-route-packet-dispatch.d.ts +2 -2
  308. package/dist/runtime/spots/spot-route-packet-dispatch.js +8 -8
  309. package/dist/runtime/spots/spot-route-replies.d.ts +2 -2
  310. package/dist/runtime/spots/spot-route-replies.js +3 -1
  311. package/dist/runtime/spots/spot-routed-actor-admission.d.ts +3 -3
  312. package/dist/runtime/spots/spot-routed-actor-admission.js +3 -12
  313. package/dist/runtime/spots/spot-routed-frame-dispatch.d.ts +1 -2
  314. package/dist/runtime/spots/spot-routed-frame-dispatch.js +0 -1
  315. package/dist/runtime/spots/spot-routed-spot-packet-dispatch.d.ts +4 -0
  316. package/dist/runtime/spots/spot-routed-spot-packet-dispatch.js +65 -15
  317. package/dist/runtime/spots/spot-runtime-ports.d.ts +2 -16
  318. package/dist/runtime/spots/spot-serial-executor.js +2 -2
  319. package/dist/runtime/spots/spot-serial-turn-executor.d.ts +27 -7
  320. package/dist/runtime/spots/spot-serial-turn-executor.js +83 -11
  321. package/dist/runtime/spots/spot-timer.d.ts +3 -2
  322. package/dist/runtime/streams/actor-session-binding-registry.d.ts +16 -29
  323. package/dist/runtime/streams/actor-session-binding-registry.js +142 -212
  324. package/dist/runtime/streams/actor-session-binding-runtime-owner.d.ts +1 -4
  325. package/dist/runtime/streams/bound-actor-relay-sender.d.ts +8 -4
  326. package/dist/runtime/streams/bound-actor-relay-sender.js +65 -41
  327. package/dist/runtime/streams/bound-session-service.d.ts +7 -0
  328. package/dist/runtime/streams/bound-session-service.js +12 -2
  329. package/dist/runtime/streams/index.d.ts +16 -17
  330. package/dist/runtime/streams/index.js +22 -23
  331. package/dist/runtime/streams/managed-stream.d.ts +5 -2
  332. package/dist/runtime/streams/managed-stream.js +20 -13
  333. package/dist/runtime/streams/native-fallback-bound-session.js +14 -19
  334. package/dist/runtime/streams/protocol.d.ts +6 -33
  335. package/dist/runtime/streams/protocol.js +38 -110
  336. package/dist/runtime/streams/session-actor-coordinator.d.ts +2 -3
  337. package/dist/runtime/streams/session-actor-coordinator.js +12 -4
  338. package/dist/runtime/streams/session-calls.d.ts +6 -8
  339. package/dist/runtime/streams/session-calls.js +6 -22
  340. package/dist/runtime/streams/session-context.d.ts +10 -10
  341. package/dist/runtime/streams/session-context.js +25 -10
  342. package/dist/runtime/streams/session-requests.js +2 -1
  343. package/dist/runtime/streams/stream-binding-runtime-ports.d.ts +16 -1
  344. package/dist/runtime/streams/stream-frame-factory.js +2 -2
  345. package/dist/runtime/streams/stream-session-runtime.d.ts +10 -11
  346. package/dist/runtime/streams/stream-session-runtime.js +25 -33
  347. package/dist/runtime/workers/index.d.ts +2 -2
  348. package/dist/runtime/workers/index.js +5 -4
  349. package/package.json +3 -3
  350. package/src/contracts/Actors/ZLinkActorClient.ts +1 -1
  351. package/src/contracts/Channels/Calls.ts +1 -1
  352. package/src/contracts/Common/CoreTypes.ts +7 -0
  353. package/src/contracts/Common/index.ts +1 -1
  354. package/src/contracts/Configuration/Builders.ts +0 -1
  355. package/src/contracts/Configuration/Configs.ts +0 -1
  356. package/src/contracts/Configuration/InternalDefaults.ts +12 -0
  357. package/src/contracts/Configuration/Registration.ts +92 -48
  358. package/src/contracts/Configuration/RegistrationBuilderPolicy.ts +44 -2
  359. package/src/contracts/Configuration/RegistrationBuilders.ts +77 -71
  360. package/src/contracts/Configuration/RegistrationTypes.ts +1 -5
  361. package/src/contracts/Configuration/RegistrationValidators.ts +19 -17
  362. package/src/contracts/Configuration/TimerRegistrationValidator.ts +4 -2
  363. package/src/contracts/Dispatch/ZLinkDispatchOptions.ts +1 -0
  364. package/src/contracts/Handlers/JsonContract.ts +14 -4
  365. package/src/contracts/Locations/Authority.ts +7 -3
  366. package/src/contracts/Locations/Options.ts +1 -1
  367. package/src/contracts/Locations/Stores.ts +14 -0
  368. package/src/contracts/Spots/Contracts.ts +2 -2
  369. package/src/contracts/Streams/BoundSessionContracts.ts +1 -1
  370. package/src/contracts/Streams/IZLinkSession.ts +2 -3
  371. package/src/contracts/Streams/IZLinkSessionActor.ts +2 -6
  372. package/src/internal.ts +14 -0
  373. package/src/nest-integration.ts +28 -10
  374. package/src/runtime/abort.ts +6 -5
  375. package/src/runtime/activation-admission.ts +2 -8
  376. package/src/runtime/actors/actor-authority-payload-codec.ts +58 -20
  377. package/src/runtime/actors/actor-client.ts +85 -218
  378. package/src/runtime/actors/actor-context.ts +39 -33
  379. package/src/runtime/actors/actor-handoff.ts +24 -22
  380. package/src/runtime/actors/actor-lifecycle-snapshot.ts +2 -1
  381. package/src/runtime/actors/actor-local-native-join.ts +172 -174
  382. package/src/runtime/actors/actor-native-lookup.ts +2 -9
  383. package/src/runtime/actors/actor-packet-relay-wire.ts +18 -12
  384. package/src/runtime/actors/actor-remote-joiner.ts +9 -11
  385. package/src/runtime/actors/actor-remote-wire.ts +5 -3
  386. package/src/runtime/actors/actor-request-deadline.ts +4 -0
  387. package/src/runtime/actors/actor-retry-delay.ts +2 -1
  388. package/src/runtime/actors/actor-routed-join-transport.ts +3 -5
  389. package/src/runtime/actors/actor-runtime-state.ts +85 -247
  390. package/src/runtime/actors/bound-session-wire.ts +2 -8
  391. package/src/runtime/actors/deferred-join-completion.ts +10 -6
  392. package/src/runtime/actors/index.ts +100 -79
  393. package/src/runtime/actors/spot-actor-dispatch.ts +60 -29
  394. package/src/runtime/actors/transferred-actor-rollback.ts +11 -62
  395. package/src/runtime/admission.ts +8 -1
  396. package/src/runtime/application-jobs/application-job-queue-scope.ts +4 -4
  397. package/src/runtime/backend/contracts/index.ts +14 -37
  398. package/src/runtime/backend/mesh-actor-session-node-adapter.ts +2 -18
  399. package/src/runtime/backend/mesh-dispatch-pump.ts +111 -117
  400. package/src/runtime/backend/node/node-backend-adapter-support.ts +67 -10
  401. package/src/runtime/backend/node/node-dealer-channel-client-transport.ts +0 -2
  402. package/src/runtime/backend/node/node-event-loop-poller.ts +8 -12
  403. package/src/runtime/backend/node/node-monitor-backend-adapter.ts +1 -0
  404. package/src/runtime/backend/node/node-raw-binding-port.ts +44 -49
  405. package/src/runtime/backend/node/node-raw-mesh-backend.ts +227 -170
  406. package/src/runtime/backend/node/node-socket-backend-adapter.ts +4 -3
  407. package/src/runtime/backend/raw-binding-port.ts +1 -1
  408. package/src/runtime/backend/runtime-values.ts +4 -1
  409. package/src/runtime/channels/channel-clients.ts +139 -102
  410. package/src/runtime/channels/channel-envelope-inspection.ts +2 -1
  411. package/src/runtime/channels/channel-envelope.ts +74 -57
  412. package/src/runtime/channels/channel-outbound-operations.ts +40 -55
  413. package/src/runtime/channels/channel-receive-loops.ts +39 -7
  414. package/src/runtime/channels/channel-runtime-lifecycle.ts +60 -27
  415. package/src/runtime/channels/channel-runtime-manager.ts +12 -30
  416. package/src/runtime/channels/channel-socket-options.ts +8 -15
  417. package/src/runtime/channels/channel-socket-registry.ts +291 -196
  418. package/src/runtime/channels/channel-transports.ts +168 -145
  419. package/src/runtime/channels/client-server-location-runtime.ts +17 -17
  420. package/src/runtime/channels/client-server-service-wire.ts +40 -12
  421. package/src/runtime/channels/dispatch-error-reporter.ts +7 -5
  422. package/src/runtime/channels/fanout-location-runtime.ts +172 -91
  423. package/src/runtime/channels/local-spot-route-transport.ts +1 -5
  424. package/src/runtime/channels/router-socket-spot-route-transport.ts +2 -6
  425. package/src/runtime/channels/source-spot-router.ts +2 -9
  426. package/src/runtime/channels/spot-direct-envelope.ts +1 -1
  427. package/src/runtime/channels/spot-node-route-transport.ts +7 -9
  428. package/src/runtime/channels/spot-route-bridge-transport.ts +5 -12
  429. package/src/runtime/channels/spot-route-dispatch-strategy.ts +11 -30
  430. package/src/runtime/diagnostics/diagnostic-text.ts +4 -0
  431. package/src/runtime/diagnostics/dispatch-error-details.ts +36 -1
  432. package/src/runtime/diagnostics/flow-context.ts +16 -2
  433. package/src/runtime/diagnostics/index.ts +27 -17
  434. package/src/runtime/diagnostics/message-flow.ts +15 -25
  435. package/src/runtime/diagnostics/runtime-metrics.ts +181 -113
  436. package/src/runtime/diagnostics/runtime-observation-queue.ts +3 -2
  437. package/src/runtime/diagnostics/topology-runtime-projections.ts +194 -162
  438. package/src/runtime/disposal.ts +19 -0
  439. package/src/runtime/execution/index.ts +60 -20
  440. package/src/runtime/execution/serial-execution-queue.ts +131 -18
  441. package/src/runtime/execution/state-lane.ts +142 -4
  442. package/src/runtime/foundation/actor-join-recovery-codec.ts +13 -8
  443. package/src/runtime/foundation/event-loop-resources.ts +5 -122
  444. package/src/runtime/foundation/operation-identity.ts +11 -5
  445. package/src/runtime/foundation/operation-registry.ts +33 -50
  446. package/src/runtime/foundation/raw-service-mesh-runtime.ts +127 -125
  447. package/src/runtime/foundation/runtime-state-projections.ts +9 -1
  448. package/src/runtime/foundation/service-authority-payload-codec.ts +31 -13
  449. package/src/runtime/foundation/service-discovery-registry.ts +32 -3
  450. package/src/runtime/foundation/service-instance-activation-recovery-codec.ts +12 -4
  451. package/src/runtime/foundation/service-liveness-registry.ts +2 -1
  452. package/src/runtime/foundation/service-maintenance-runtime.ts +0 -10
  453. package/src/runtime/foundation/service-metadata-codec.ts +2 -2
  454. package/src/runtime/foundation/service-relocation-aggregate-committer.ts +3 -66
  455. package/src/runtime/foundation/service-relocation-object-owner.ts +5 -2
  456. package/src/runtime/foundation/service-relocation-runtime.ts +57 -35
  457. package/src/runtime/foundation/service-runtime-contracts.ts +46 -10
  458. package/src/runtime/foundation/service-session-binding-ingress-port.ts +0 -17
  459. package/src/runtime/foundation/service-stateful-registry.ts +14 -2
  460. package/src/runtime/foundation/service-stateful-runtime.ts +322 -276
  461. package/src/runtime/foundation/service-stateful-wire-codec.ts +128 -80
  462. package/src/runtime/foundation/service-topology-registry.ts +23 -32
  463. package/src/runtime/foundation/service-wire-binary-primitives.ts +6 -0
  464. package/src/runtime/foundation/service-wire-codec.ts +15 -8
  465. package/src/runtime/foundation/service-wire-constants.generated.ts +1 -0
  466. package/src/runtime/foundation/service-wire-m6a-codec.ts +29 -15
  467. package/src/runtime/framework-errors-internal.ts +380 -134
  468. package/src/runtime/handlers/handler-instance-scope.ts +68 -95
  469. package/src/runtime/host/actor-packet-relay.ts +63 -160
  470. package/src/runtime/host/actor-placement-coordinator.ts +8 -5
  471. package/src/runtime/host/actor-runtime-options-factory.ts +27 -8
  472. package/src/runtime/host/actor-transfer-runtime.ts +180 -260
  473. package/src/runtime/host/application-job-queue.ts +28 -34
  474. package/src/runtime/host/bound-session-relay.ts +1 -2
  475. package/src/runtime/host/channel-runtime-options-factory.ts +1 -2
  476. package/src/runtime/host/index.ts +327 -320
  477. package/src/runtime/host/instance-activation-authority.ts +89 -109
  478. package/src/runtime/host/location-runtime-owner.ts +4 -2
  479. package/src/runtime/host/remote-actor-join-receiver.ts +3 -31
  480. package/src/runtime/host/remote-actor-packet-target-store.ts +17 -58
  481. package/src/runtime/host/remote-bound-session-relay.ts +16 -57
  482. package/src/runtime/host/route-mesh-runtime.ts +228 -271
  483. package/src/runtime/host/runtime-shutdown.ts +17 -21
  484. package/src/runtime/host/service-relocation-control.ts +14 -1
  485. package/src/runtime/host/service-relocation-host-runtime.ts +699 -561
  486. package/src/runtime/host/spot-address-transport.ts +175 -356
  487. package/src/runtime/host/spot-node-runtime-options-factory.ts +6 -3
  488. package/src/runtime/host/spot-runtime-options-factory.ts +73 -22
  489. package/src/runtime/host/user-spot-creation-coordinator.ts +36 -22
  490. package/src/runtime/locations/aggregate-inventory-store.ts +16 -13
  491. package/src/runtime/locations/authority-key-codec.ts +7 -3
  492. package/src/runtime/locations/auto-connect-reconciler.ts +39 -26
  493. package/src/runtime/locations/creation-operation-id.ts +6 -3
  494. package/src/runtime/locations/domain-store-contract.ts +12 -3
  495. package/src/runtime/locations/in-memory-authority-store.ts +44 -15
  496. package/src/runtime/locations/in-memory-location-store.ts +50 -39
  497. package/src/runtime/locations/in-memory-provider-location-store.ts +100 -25
  498. package/src/runtime/locations/key-codec.ts +3 -2
  499. package/src/runtime/locations/lease-tracker.ts +8 -14
  500. package/src/runtime/locations/lifecycle.ts +13 -43
  501. package/src/runtime/locations/location-store-failure.ts +4 -0
  502. package/src/runtime/locations/location-store-pages.ts +18 -0
  503. package/src/runtime/locations/location-store-repository.ts +457 -482
  504. package/src/runtime/locations/relocation-blob.ts +17 -6
  505. package/src/runtime/locations/resolvers.ts +75 -49
  506. package/src/runtime/locations/runtime.ts +220 -110
  507. package/src/runtime/locations/spot-location-claims.ts +58 -1
  508. package/src/runtime/messaging/payload-codec.ts +35 -24
  509. package/src/runtime/messaging/request-deadline.ts +58 -0
  510. package/src/runtime/messaging/submission-result.ts +72 -2
  511. package/src/runtime/protocol/service_wire_codec.generated.ts +18 -8
  512. package/src/runtime/protocol/service_wire_pilot_codec.generated.ts +1 -1
  513. package/src/runtime/spots/formal-remote-actor-transfer-registry.ts +4 -1
  514. package/src/runtime/spots/index.ts +433 -229
  515. package/src/runtime/spots/spot-activation-registry.ts +30 -69
  516. package/src/runtime/spots/spot-activation-state.ts +2 -2
  517. package/src/runtime/spots/spot-activation.ts +67 -37
  518. package/src/runtime/spots/spot-actor-admission-coordinator.ts +5 -57
  519. package/src/runtime/spots/spot-actor-join-dispatch.ts +24 -77
  520. package/src/runtime/spots/spot-actor-membership.ts +40 -72
  521. package/src/runtime/spots/spot-actor-packet-dispatch.ts +0 -16
  522. package/src/runtime/spots/spot-actor-packet-relay-dispatch.ts +3 -15
  523. package/src/runtime/spots/spot-context.ts +3 -3
  524. package/src/runtime/spots/spot-entry-activation.ts +13 -30
  525. package/src/runtime/spots/spot-lifecycle-metrics.ts +3 -2
  526. package/src/runtime/spots/spot-manager-public.ts +21 -17
  527. package/src/runtime/spots/spot-node-autoconnect.ts +20 -26
  528. package/src/runtime/spots/spot-node-runtime-manager.ts +136 -125
  529. package/src/runtime/spots/spot-outbound.ts +59 -47
  530. package/src/runtime/spots/spot-remote-codec.ts +7 -3
  531. package/src/runtime/spots/spot-route-packet-dispatch.ts +25 -24
  532. package/src/runtime/spots/spot-route-replies.ts +6 -4
  533. package/src/runtime/spots/spot-routed-actor-admission.ts +13 -26
  534. package/src/runtime/spots/spot-routed-frame-dispatch.ts +2 -3
  535. package/src/runtime/spots/spot-routed-spot-packet-dispatch.ts +95 -22
  536. package/src/runtime/spots/spot-runtime-ports.ts +5 -27
  537. package/src/runtime/spots/spot-serial-executor.ts +2 -2
  538. package/src/runtime/spots/spot-serial-turn-executor.ts +112 -11
  539. package/src/runtime/spots/spot-timer.ts +3 -2
  540. package/src/runtime/streams/actor-session-binding-registry.ts +179 -269
  541. package/src/runtime/streams/actor-session-binding-runtime-owner.ts +0 -8
  542. package/src/runtime/streams/bound-actor-relay-sender.ts +98 -66
  543. package/src/runtime/streams/bound-session-service.ts +22 -2
  544. package/src/runtime/streams/index.ts +78 -68
  545. package/src/runtime/streams/managed-stream.ts +32 -23
  546. package/src/runtime/streams/native-fallback-bound-session.ts +14 -28
  547. package/src/runtime/streams/protocol.ts +34 -88
  548. package/src/runtime/streams/session-actor-coordinator.ts +17 -5
  549. package/src/runtime/streams/session-calls.ts +11 -36
  550. package/src/runtime/streams/session-context.ts +60 -25
  551. package/src/runtime/streams/session-requests.ts +2 -1
  552. package/src/runtime/streams/stream-binding-runtime-ports.ts +22 -1
  553. package/src/runtime/streams/stream-frame-factory.ts +2 -3
  554. package/src/runtime/streams/stream-session-runtime.ts +57 -59
  555. package/src/runtime/workers/index.ts +13 -12
  556. package/dist/runtime/actors/post-commit-actor-location.d.ts +0 -19
  557. package/dist/runtime/actors/post-commit-actor-location.js +0 -72
  558. package/dist/runtime/spots/spot-native-actor-join-admission.d.ts +0 -26
  559. package/dist/runtime/spots/spot-native-actor-join-admission.js +0 -106
  560. package/src/runtime/actors/post-commit-actor-location.ts +0 -121
  561. package/src/runtime/spots/spot-native-actor-join-admission.ts +0 -155
@@ -1,68 +1,75 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ZLinkUserSpotCreationCoordinator = exports.ZLinkHostSpotAddressTransport = exports.ZLinkRelocationStateIncompatibleError = exports.ZLinkRouteMeshRuntimeCoordinator = exports.ZLinkRetiringRollbackError = exports.transferIdString = exports.ZLinkActorTransferAuthorityRuntime = exports.ZLinkFrameworkRuntimeHost = void 0;
3
+ exports.ZLinkUserSpotCreationCoordinator = exports.ZLinkHostSpotAddressTransport = exports.ZLinkRelocationStateIncompatibleError = exports.ZLinkRouteMeshRuntimeCoordinator = exports.ZLinkRetiringRollbackError = exports.ZLinkDrainingStatePublishError = exports.transferIdString = exports.ZLinkActorTransferAuthorityRuntime = exports.ZLinkFrameworkRuntimeHost = void 0;
4
4
  exports.hasUnsupportedManualTopology = hasUnsupportedManualTopology;
5
5
  exports.hasExactPeerReadiness = hasExactPeerReadiness;
6
- const listener_records_1 = require("../foundation/listener-records");
7
- const framework_errors_internal_1 = require("../framework-errors-internal");
6
+ const location_store_pages_1 = require("../locations/location-store-pages");
7
+ const stream_wire_1 = require("@zlink-systems/stream-wire");
8
8
  const node_crypto_1 = require("node:crypto");
9
- const runtime_message_1 = require("../backend/runtime-message");
10
- const runtime_values_1 = require("../backend/runtime-values");
11
- const service_runtime_contracts_1 = require("../foundation/service-runtime-contracts");
12
- const runtime_state_projections_1 = require("../foundation/runtime-state-projections");
13
- const abort_1 = require("../abort");
14
- const backend_1 = require("../backend");
15
- const LEGACY_MESH_SEND_TIMEOUT_MS = 1000;
16
9
  const contracts_1 = require("../../contracts");
17
- const submission_result_1 = require("../messaging/submission-result");
18
- const ZLinkDispatchOptions_1 = require("../../contracts/Dispatch/ZLinkDispatchOptions");
10
+ const ConfigurationException_1 = require("../../contracts/Configuration/ConfigurationException");
19
11
  const DiagnosticsValidation_1 = require("../../contracts/Configuration/DiagnosticsValidation");
20
- const channels_1 = require("../channels");
21
- const channel_envelope_1 = require("../channels/channel-envelope");
12
+ const InternalDefaults_1 = require("../../contracts/Configuration/InternalDefaults");
13
+ const Registration_1 = require("../../contracts/Configuration/Registration");
14
+ const ZLinkDispatchOptions_1 = require("../../contracts/Dispatch/ZLinkDispatchOptions");
15
+ const Locations_1 = require("../../contracts/Locations");
16
+ const Stores_1 = require("../../contracts/Locations/Stores");
17
+ const abort_1 = require("../abort");
18
+ const activation_admission_1 = require("../activation-admission");
22
19
  const actors_1 = require("../actors");
20
+ const actor_message_follow_context_1 = require("../actors/actor-message-follow-context");
23
21
  const actor_transport_delivery_gate_1 = require("../actors/actor-transport-delivery-gate");
22
+ const admission_1 = require("../admission");
24
23
  const application_job_queue_handler_start_gate_1 = require("../application-jobs/application-job-queue-handler-start-gate");
25
- const execution_1 = require("../execution");
24
+ const application_job_queue_scope_1 = require("../application-jobs/application-job-queue-scope");
25
+ const backend_1 = require("../backend");
26
+ const runtime_message_1 = require("../backend/runtime-message");
27
+ const runtime_values_1 = require("../backend/runtime-values");
28
+ const channels_1 = require("../channels");
29
+ const channel_envelope_1 = require("../channels/channel-envelope");
26
30
  const diagnostics_1 = require("../diagnostics");
27
- const topology_runtime_projections_1 = require("../diagnostics/topology-runtime-projections");
31
+ const runtime_metrics_1 = require("../diagnostics/runtime-metrics");
28
32
  const runtime_observation_queue_1 = require("../diagnostics/runtime-observation-queue");
33
+ const topology_runtime_projections_1 = require("../diagnostics/topology-runtime-projections");
34
+ const execution_1 = require("../execution");
35
+ const listener_records_1 = require("../foundation/listener-records");
36
+ const runtime_state_projections_1 = require("../foundation/runtime-state-projections");
37
+ const service_authority_payload_codec_1 = require("../foundation/service-authority-payload-codec");
38
+ const service_relocation_coordinator_1 = require("../foundation/service-relocation-coordinator");
39
+ const service_relocation_runtime_1 = require("../foundation/service-relocation-runtime");
40
+ const service_runtime_contracts_1 = require("../foundation/service-runtime-contracts");
41
+ const framework_errors_internal_1 = require("../framework-errors-internal");
42
+ const locations_1 = require("../locations");
43
+ const creation_payload_codec_1 = require("../messaging/creation-payload-codec");
44
+ const payload_codec_1 = require("../messaging/payload-codec");
45
+ const submission_result_1 = require("../messaging/submission-result");
46
+ const routing_id_1 = require("../routing-id");
29
47
  const spots_1 = require("../spots");
30
- const actor_message_follow_context_1 = require("../actors/actor-message-follow-context");
31
- const actors_2 = require("../actors");
32
48
  const streams_1 = require("../streams");
33
- const locations_1 = require("../locations");
34
- const Locations_1 = require("../../contracts/Locations");
49
+ const actor_placement_coordinator_1 = require("./actor-placement-coordinator");
35
50
  const actor_runtime_options_factory_1 = require("./actor-runtime-options-factory");
36
- const actor_transfer_runtime_1 = require("./actor-transfer-runtime");
37
51
  const actor_transfer_authority_runtime_1 = require("./actor-transfer-authority-runtime");
52
+ const actor_transfer_runtime_1 = require("./actor-transfer-runtime");
53
+ const application_job_queue_1 = require("./application-job-queue");
54
+ const bound_session_relay_1 = require("./bound-session-relay");
55
+ const channel_runtime_options_factory_1 = require("./channel-runtime-options-factory");
38
56
  const entry_actor_runtime_1 = require("./entry-actor-runtime");
57
+ const host_capacity_status_1 = require("./host-capacity-status");
58
+ const instance_activation_authority_1 = require("./instance-activation-authority");
39
59
  const location_runtime_owner_1 = require("./location-runtime-owner");
40
60
  const mesh_router_resolver_1 = require("./mesh-router-resolver");
41
- const bound_session_relay_1 = require("./bound-session-relay");
42
- const routing_id_1 = require("../routing-id");
43
- const service_authority_payload_codec_1 = require("../foundation/service-authority-payload-codec");
44
- const service_relocation_runtime_1 = require("../foundation/service-relocation-runtime");
45
- const spot_runtime_options_factory_1 = require("./spot-runtime-options-factory");
46
- const channel_runtime_options_factory_1 = require("./channel-runtime-options-factory");
47
- const spot_node_runtime_options_factory_1 = require("./spot-node-runtime-options-factory");
48
- const runtime_shutdown_1 = require("./runtime-shutdown");
49
- const admission_1 = require("../admission");
50
- const activation_admission_1 = require("../activation-admission");
51
61
  const route_mesh_runtime_1 = require("./route-mesh-runtime");
52
- const service_relocation_coordinator_1 = require("../foundation/service-relocation-coordinator");
53
- const ConfigurationException_1 = require("../../contracts/Configuration/ConfigurationException");
54
- const stateful_authority_route_runtime_1 = require("./stateful-authority-route-runtime");
55
- const instance_activation_authority_1 = require("./instance-activation-authority");
56
- const spot_address_transport_1 = require("./spot-address-transport");
57
- const user_spot_creation_coordinator_1 = require("./user-spot-creation-coordinator");
58
- const actor_placement_coordinator_1 = require("./actor-placement-coordinator");
59
- const payload_codec_1 = require("../messaging/payload-codec");
60
- const creation_payload_codec_1 = require("../messaging/creation-payload-codec");
61
62
  const route_mesh_runtime_options_1 = require("./route-mesh-runtime-options");
63
+ const runtime_shutdown_1 = require("./runtime-shutdown");
62
64
  const service_relocation_host_runtime_1 = require("./service-relocation-host-runtime");
63
- const application_job_queue_1 = require("./application-job-queue");
64
- const application_job_queue_scope_1 = require("../application-jobs/application-job-queue-scope");
65
- const host_capacity_status_1 = require("./host-capacity-status");
65
+ const spot_address_transport_1 = require("./spot-address-transport");
66
+ const spot_node_runtime_options_factory_1 = require("./spot-node-runtime-options-factory");
67
+ const spot_runtime_options_factory_1 = require("./spot-runtime-options-factory");
68
+ const stateful_authority_route_runtime_1 = require("./stateful-authority-route-runtime");
69
+ const user_spot_creation_coordinator_1 = require("./user-spot-creation-coordinator");
70
+ const HOST_SHUTDOWN_POLL_INTERVAL_MS = 100;
71
+ const HANDOFF_ACCEPTANCE_POLL_INTERVAL_MS = 10;
72
+ const DEFAULT_HOST_CONTROL_TIMEOUT_MS = 30_000;
66
73
  class ZLinkFrameworkRuntimeHost {
67
74
  options;
68
75
  backendAdapterFactory;
@@ -72,6 +79,7 @@ class ZLinkFrameworkRuntimeHost {
72
79
  runtimeSequence = 0n;
73
80
  runtimeObservationSource = Symbol('zlink.framework-runtime');
74
81
  runtimeDeadline;
82
+ shutdownDeadline;
75
83
  runtimeRelocationResult;
76
84
  runtimeTerminationResult;
77
85
  relocationOperation;
@@ -109,11 +117,8 @@ class ZLinkFrameworkRuntimeHost {
109
117
  capacityStatus;
110
118
  metricRegistrations = [];
111
119
  admission = new admission_1.ZLinkRuntimeAdmissionGate(() => this.ownerAdmissionOpen());
112
- activationAdmission = new activation_admission_1.ZLinkActivationAdmission((meshName) => this.options.registration.spotNodes.get(meshName)?.activationConcurrencyLimit ?? 128, (meshName) => {
113
- void this.spotNodeRuntime
114
- ?.publishMeshNodeState(this.runtimeState, this.executionState?.abortController.signal, meshName)
115
- .catch(() => undefined);
116
- });
120
+ activationAdmission = new activation_admission_1.ZLinkActivationAdmission((meshName) => this.options.registration.spotNodes.get(meshName)?.activationConcurrencyLimit ??
121
+ InternalDefaults_1.DEFAULT_ACTIVATION_CONCURRENCY_LIMIT);
117
122
  cachedLocationSpotRouteResolver;
118
123
  actorClientLocationResolver;
119
124
  // Shared, runtime-mutable message-flow mode cell — installed once so
@@ -162,17 +167,7 @@ class ZLinkFrameworkRuntimeHost {
162
167
  this.fanoutRuntime = new topology_runtime_projections_1.ZLinkFanoutRuntimeProjection(() => this.channelRuntime, () => this.runtimeState);
163
168
  this.meshRouters = new mesh_router_resolver_1.MeshRouterResolver(options.registration);
164
169
  this.spotRouterChannelIdForMesh = this.meshRouters.spotRouterChannelIdByMesh();
165
- const sendTimeoutMsForSpotMesh = (meshName) => options.registration.spotNodes.get(meshName)?.router?.sendTimeoutMs ??
166
- LEGACY_MESH_SEND_TIMEOUT_MS;
167
- const sendTimeoutMsForSpotRouteChannel = (routeChannelId) => {
168
- const routeChannel = options.registration.routeChannelOptions.get(routeChannelId);
169
- if (routeChannel !== undefined) {
170
- return routeChannel.sendTimeoutMs ?? LEGACY_MESH_SEND_TIMEOUT_MS;
171
- }
172
- return sendTimeoutMsForSpotMesh(routeChannelId);
173
- };
174
- const defaultSpotSendTimeoutMs = Math.max(LEGACY_MESH_SEND_TIMEOUT_MS, ...[...options.registration.spotNodes.values()].map((node) => node.router?.sendTimeoutMs ?? LEGACY_MESH_SEND_TIMEOUT_MS), ...[...options.registration.routeChannelOptions.values()].map((route) => route.sendTimeoutMs ?? LEGACY_MESH_SEND_TIMEOUT_MS));
175
- this.routeTransport = new channels_1.ZLinkRuntimeRouteTransport(() => this.channelRuntime, (routerChannelId) => this.meshRouters.canUseRouterChannel(routerChannelId), () => this.spotNodeRuntime, { serializers: options.registration.messageSerializers }, (meshName, targetNodeRid) => this.meshRouters.classifyManualNodeTarget(meshName, targetNodeRid), (meshName, sourceNodeRid, parts) => this.submitLocalMeshRoute(meshName, sourceNodeRid, parts), this.metrics, () => this.flowCreationEnabled());
170
+ this.routeTransport = new channels_1.ZLinkRuntimeRouteTransport(() => this.channelRuntime, (routerChannelId) => this.meshRouters.canUseRouterChannel(routerChannelId), () => this.spotNodeRuntime, { serializers: options.registration.messageSerializers }, (meshName, targetNodeRid) => this.meshRouters.classifyManualNodeTarget(meshName, targetNodeRid), (meshName, sourceNodeRid, parts) => this.submitLocalMeshRoute(meshName, sourceNodeRid, parts), this.metrics, () => this.flowCreationEnabled(), () => this.createDispatchErrorReporter(this.runtimeOrPreStartErrorSink).flow);
176
171
  this.spotAddressTransport = new spot_address_transport_1.ZLinkHostSpotAddressTransport({
177
172
  resolver: () => this.createLocationSpotRouteResolver(),
178
173
  routed: this.routeTransport,
@@ -183,10 +178,7 @@ class ZLinkFrameworkRuntimeHost {
183
178
  meshNode: (meshName) => this.spotNodeRuntime?.meshNode(meshName),
184
179
  completions: (meshName) => this.spotNodeRuntime?.meshCompletionTable(meshName),
185
180
  codecs: { serializers: options.registration.messageSerializers },
186
- defaultRequestTimeoutMs: options.registration.requestTimeoutMs ?? 30_000,
187
- defaultSendTimeoutMs: defaultSpotSendTimeoutMs,
188
- sendTimeoutMsForMesh: sendTimeoutMsForSpotMesh,
189
- sendTimeoutMsForRouteChannel: sendTimeoutMsForSpotRouteChannel,
181
+ defaultRequestTimeoutMs: options.registration.requestTimeoutMs ?? Registration_1.DEFAULT_REQUEST_TIMEOUT_MS,
190
182
  dispatchErrors: this.createDispatchErrorReporter(this.runtimeOrPreStartErrorSink)
191
183
  });
192
184
  this.locationOwner = new location_runtime_owner_1.ZLinkLocationRuntimeOwner({
@@ -197,6 +189,7 @@ class ZLinkFrameworkRuntimeHost {
197
189
  rewriteAuthorityPayloadForOwner
198
190
  });
199
191
  this.streamBindingRuntime = new streams_1.ZLinkStreamBindingRuntime({
192
+ dispatchErrors: this.createDispatchErrorReporter(this.runtimeOrPreStartErrorSink),
200
193
  streamPayloadCodec: resolveStreamPayloadCodec(options.registration),
201
194
  streamCompression: options.registration.streamCompression,
202
195
  messageSerializers: options.registration.messageSerializers,
@@ -226,10 +219,10 @@ class ZLinkFrameworkRuntimeHost {
226
219
  ? Promise.resolve()
227
220
  : this.boundSessionRelay.actorPackets.confirmRemoteSessionBinding(actor, sessionNode.status().routingId, sessionRid, signal, options);
228
221
  },
229
- relay: (actor, header, payload, signal) => this.boundSessionRelay.actorPackets.relayActorPacket(actor, header, payload, signal),
222
+ relay: (actor, header, payload) => this.boundSessionRelay.actorPackets.relayActorPacket(actor, header, payload),
230
223
  notifyDisconnected: (actor, signal) => this.boundSessionRelay.actorPackets.notifyBoundActorDisconnected(actor, signal)
231
224
  });
232
- this.actorHandoff = new actors_2.ZLinkActorHandoffCoordinator({
225
+ this.actorHandoff = new actors_1.ZLinkActorHandoffCoordinator({
233
226
  routedTransport: this.routeTransport,
234
227
  messageFollowDurationMs: options.registration.locations.options.messageFollowDurationMs,
235
228
  requestTimeoutMs: options.registration.requestTimeoutMs,
@@ -385,7 +378,7 @@ class ZLinkFrameworkRuntimeHost {
385
378
  });
386
379
  }
387
380
  });
388
- this.actorTransferRegistry = new actors_2.ZLinkActorTransferRegistry(options.registration.spotNodes, options.providerResolver, options.registration.messageSerializers);
381
+ this.actorTransferRegistry = new actors_1.ZLinkActorTransferRegistry(options.registration.spotNodes, options.providerResolver, options.registration.messageSerializers);
389
382
  this.boundSessionFactory = new streams_1.DefaultZLinkBoundSessionFactory(this.streamBindingRuntime);
390
383
  this.boundSessionRelay = new bound_session_relay_1.ZLinkBoundSessionRelay({
391
384
  requestTimeoutMs: options.registration.requestTimeoutMs,
@@ -514,6 +507,7 @@ class ZLinkFrameworkRuntimeHost {
514
507
  });
515
508
  this.serviceRelocation = new service_relocation_host_runtime_1.ZLinkHostServiceRelocationRuntime({
516
509
  registration: options.registration,
510
+ targetAdmissionSealed: () => this.shutdownOperationStartedAt !== undefined,
517
511
  providerResolver: options.providerResolver,
518
512
  locationStore: () => this.locationOwner.currentStores?.locationStore,
519
513
  currentOwner: () => this.locationOwner.currentRuntime?.currentOwnerToken,
@@ -584,7 +578,7 @@ class ZLinkFrameworkRuntimeHost {
584
578
  this.routeMeshRuntime = this.routeMeshCoordinator;
585
579
  }
586
580
  get isStarted() {
587
- return this.executionState !== undefined;
581
+ return this.executionState !== undefined && !this.executionState.abortController.signal.aborted;
588
582
  }
589
583
  get status() {
590
584
  return {
@@ -613,6 +607,7 @@ class ZLinkFrameworkRuntimeHost {
613
607
  const queue = new runtime_observation_queue_1.RuntimeEventQueue(undefined, signal);
614
608
  this.runtimeObservers.add(queue);
615
609
  queue.onClose(() => this.runtimeObservers.delete(queue));
610
+ this.publishRuntimeStatus(queue, this.status);
616
611
  return queue;
617
612
  }
618
613
  resetCapacityMetrics() {
@@ -624,7 +619,7 @@ class ZLinkFrameworkRuntimeHost {
624
619
  }
625
620
  relocate(options) {
626
621
  const effectiveTargetApplicationVersion = validateRelocationOptions(options, this.options.registration.applicationVersion);
627
- const deadlineMs = options.deadlineMs ?? 30_000;
622
+ const deadlineMs = options.deadlineMs ?? DEFAULT_HOST_CONTROL_TIMEOUT_MS;
628
623
  if (!Number.isFinite(deadlineMs) || deadlineMs <= 0) {
629
624
  return Promise.reject(new RangeError('Relocation deadlineMs must be greater than zero.'));
630
625
  }
@@ -686,7 +681,7 @@ class ZLinkFrameworkRuntimeHost {
686
681
  return waitForRuntimeOperation(this.relocationOperation, options.signal);
687
682
  }
688
683
  shutdown(options) {
689
- const deadlineMs = options?.deadlineMs ?? 30_000;
684
+ const deadlineMs = options?.deadlineMs ?? DEFAULT_HOST_CONTROL_TIMEOUT_MS;
690
685
  if (!Number.isFinite(deadlineMs) || deadlineMs <= 0) {
691
686
  return Promise.reject(new RangeError('Shutdown deadlineMs must be greater than zero.'));
692
687
  }
@@ -756,46 +751,69 @@ class ZLinkFrameworkRuntimeHost {
756
751
  }
757
752
  }
758
753
  async runShutdown(deadlineMs) {
759
- const deadlineAtMs = performance.now() + deadlineMs;
760
- try {
761
- this.admission.close();
762
- this.setRuntimeState(contracts_1.ZLinkFrameworkRuntimeState.Draining);
763
- if (this.relocationOperation !== undefined &&
764
- this.relocationStopStarting?.signal.aborted === true) {
765
- await this.relocationOperation;
754
+ return await this.runWithShutdownDeadline(deadlineMs, async () => {
755
+ const deadlineAtMs = performance.now() + deadlineMs;
756
+ try {
757
+ this.admission.close();
758
+ if (this.runtimeState === contracts_1.ZLinkFrameworkRuntimeState.Preparing) {
759
+ this.executionState?.abortController.abort();
760
+ }
761
+ this.setRuntimeState(contracts_1.ZLinkFrameworkRuntimeState.Draining);
762
+ if (this.relocationOperation !== undefined &&
763
+ this.relocationStopStarting?.signal.aborted === true) {
764
+ await this.relocationOperation;
765
+ }
766
+ // Seal application admission before the public status reports that the
767
+ // host no longer accepts work. This prevents status polling from racing
768
+ // with the coordinator's synchronous seal step.
769
+ const unscopedStreamDrain = this.streamRuntime?.notifyUnscopedServerDrain();
770
+ const shutdown = this.routeMeshCoordinator.shutdownHost(this.runtimeDeadline, this.shutdownDeadline.signal);
771
+ const drain = await shutdown;
772
+ await unscopedStreamDrain;
773
+ await this.stop();
774
+ if (drain.kind === 'forceStopped') {
775
+ return this.completeTermination({
776
+ outcome: contracts_1.ZLinkFrameworkTerminationOutcome.ForceStopped,
777
+ reason: drain.reason === 'deadline_exceeded'
778
+ ? contracts_1.ZLinkFrameworkTerminationReason.DeadlineExceeded
779
+ : contracts_1.ZLinkFrameworkTerminationReason.TeardownFailed
780
+ });
781
+ }
782
+ if (performance.now() >= deadlineAtMs) {
783
+ throw (0, abort_1.createDeadlineExceededError)('Shutdown resource cleanup exceeded its deadline.');
784
+ }
785
+ return this.completeTermination({
786
+ outcome: contracts_1.ZLinkFrameworkTerminationOutcome.Stopped,
787
+ reason: contracts_1.ZLinkFrameworkTerminationReason.None
788
+ });
766
789
  }
767
- // Seal application admission before the public status reports that the
768
- // host no longer accepts work. This prevents status polling from racing
769
- // with the coordinator's synchronous seal step.
770
- const unscopedStreamDrain = this.streamRuntime?.notifyUnscopedServerDrain();
771
- const shutdown = this.routeMeshCoordinator.shutdownHost(this.runtimeDeadline, undefined, Math.max(0, deadlineAtMs - performance.now()));
772
- const drain = await shutdown;
773
- await unscopedStreamDrain;
774
- await this.stop();
775
- if (drain.kind === 'forceStopped') {
790
+ catch (error) {
791
+ await this.stop().catch(() => undefined);
776
792
  return this.completeTermination({
777
793
  outcome: contracts_1.ZLinkFrameworkTerminationOutcome.ForceStopped,
778
- reason: drain.reason === 'deadline_exceeded'
794
+ reason: (0, abort_1.isDeadlineExceededError)(error)
779
795
  ? contracts_1.ZLinkFrameworkTerminationReason.DeadlineExceeded
780
796
  : contracts_1.ZLinkFrameworkTerminationReason.TeardownFailed
781
797
  });
782
798
  }
783
- if (performance.now() >= deadlineAtMs) {
784
- throw (0, abort_1.createDeadlineExceededError)('Shutdown resource cleanup exceeded its deadline.');
785
- }
786
- return this.completeTermination({
787
- outcome: contracts_1.ZLinkFrameworkTerminationOutcome.Stopped,
788
- reason: contracts_1.ZLinkFrameworkTerminationReason.None
789
- });
799
+ });
800
+ }
801
+ async runWithShutdownDeadline(deadlineMs, operation) {
802
+ if (this.shutdownDeadline !== undefined)
803
+ return await operation();
804
+ const deadline = new AbortController();
805
+ this.shutdownDeadline = deadline;
806
+ const ownsRuntimeDeadline = this.runtimeDeadline === undefined;
807
+ this.runtimeDeadline ??= new Date(Date.now() + deadlineMs);
808
+ const timer = setTimeout(() => deadline.abort((0, abort_1.createDeadlineExceededError)('Shutdown deadline exceeded.')), Math.max(0, this.runtimeDeadline.getTime() - Date.now()));
809
+ try {
810
+ return await operation();
790
811
  }
791
- catch (error) {
792
- await this.stop().catch(() => undefined);
793
- return this.completeTermination({
794
- outcome: contracts_1.ZLinkFrameworkTerminationOutcome.ForceStopped,
795
- reason: (0, abort_1.isDeadlineExceededError)(error)
796
- ? contracts_1.ZLinkFrameworkTerminationReason.DeadlineExceeded
797
- : contracts_1.ZLinkFrameworkTerminationReason.TeardownFailed
798
- });
812
+ finally {
813
+ clearTimeout(timer);
814
+ this.shutdownDeadline = undefined;
815
+ if (ownsRuntimeDeadline)
816
+ this.runtimeDeadline = undefined;
799
817
  }
800
818
  }
801
819
  resetBlockedRelocation(result) {
@@ -822,13 +840,14 @@ class ZLinkFrameworkRuntimeHost {
822
840
  }
823
841
  recordRelocationResult(result) {
824
842
  if (this.relocationOperationStartedAt !== undefined) {
825
- this.metrics.duration('zlink.host.relocation.duration', Math.max(0, performance.now() - this.relocationOperationStartedAt) / 1000, {
843
+ this.metrics.duration(runtime_metrics_1.METRIC_NAMES.HostRelocationDuration, Math.max(0, performance.now() - this.relocationOperationStartedAt) /
844
+ runtime_metrics_1.MILLISECONDS_PER_SECOND, {
826
845
  mode: relocationModeMetricName(result.mode),
827
846
  outcome: result.outcome === contracts_1.ZLinkFrameworkRelocationOutcome.Relocated ? 'relocated' : 'blocked'
828
847
  });
829
848
  }
830
849
  if (result.outcome === contracts_1.ZLinkFrameworkRelocationOutcome.Blocked) {
831
- this.metrics.count('zlink.host.relocation.blocked', 1, {
850
+ this.metrics.count(runtime_metrics_1.METRIC_NAMES.HostRelocationBlocked, 1, {
832
851
  mode: relocationModeMetricName(result.mode),
833
852
  reason: relocationReasonMetricName(result.reason)
834
853
  });
@@ -847,14 +866,14 @@ class ZLinkFrameworkRuntimeHost {
847
866
  this.runtimeTerminationResult = result;
848
867
  this.runtimeDeadline = undefined;
849
868
  if (this.shutdownOperationStartedAt !== undefined) {
850
- this.metrics.duration('zlink.host.shutdown.duration', Math.max(0, performance.now() - this.shutdownOperationStartedAt) / 1000, {
869
+ this.metrics.duration(runtime_metrics_1.METRIC_NAMES.HostShutdownDuration, Math.max(0, performance.now() - this.shutdownOperationStartedAt) / runtime_metrics_1.MILLISECONDS_PER_SECOND, {
851
870
  outcome: result.outcome === contracts_1.ZLinkFrameworkTerminationOutcome.Stopped
852
871
  ? 'stopped'
853
872
  : 'force_stopped'
854
873
  });
855
874
  }
856
875
  if (result.outcome === contracts_1.ZLinkFrameworkTerminationOutcome.ForceStopped) {
857
- this.metrics.count('zlink.host.shutdown.forced', 1, {
876
+ this.metrics.count(runtime_metrics_1.METRIC_NAMES.HostShutdownForced, 1, {
858
877
  reason: terminationReasonMetricName(result.reason)
859
878
  });
860
879
  }
@@ -876,15 +895,15 @@ class ZLinkFrameworkRuntimeHost {
876
895
  this.notifyTopologyHostStateChanged();
877
896
  const status = this.status;
878
897
  for (const observer of this.runtimeObservers) {
879
- if (state === contracts_1.ZLinkFrameworkRuntimeState.Stopped) {
880
- observer.seal(status, this.runtimeObservationSource);
881
- }
882
- else {
883
- observer.push(status, this.runtimeObservationSource);
884
- }
898
+ this.publishRuntimeStatus(observer, status);
899
+ }
900
+ }
901
+ publishRuntimeStatus(observer, status) {
902
+ if ((0, runtime_state_projections_1.runtimeObservationIsTerminal)(status.state)) {
903
+ observer.complete(status, this.runtimeObservationSource);
885
904
  }
886
- if (state === contracts_1.ZLinkFrameworkRuntimeState.Stopped) {
887
- this.runtimeObservers.clear();
905
+ else {
906
+ observer.push(status, this.runtimeObservationSource);
888
907
  }
889
908
  }
890
909
  notifyTopologyHostStateChanged() {
@@ -1004,7 +1023,7 @@ class ZLinkFrameworkRuntimeHost {
1004
1023
  // Start bound receivers before publishing Serving descriptors. A
1005
1024
  // discovered ClientServer endpoint must already be able to dispatch.
1006
1025
  this.executionState.listenerTasks.push(...channelRuntime.start(this.executionState.taskRunner));
1007
- const locationRuntime = await this.locationOwner.startForRuntime(this.meshRouters.primaryMeshName(), spotNodeRuntime, channelRuntime);
1026
+ const locationRuntime = await this.locationOwner.startForRuntime(this.meshRouters.primaryMeshName(), spotNodeRuntime, channelRuntime, this.executionState.abortController.signal, () => this.shutdownDeadline.signal);
1008
1027
  startedLocationRuntime = locationRuntime;
1009
1028
  if (locationRuntime !== undefined) {
1010
1029
  this.installOwnerLeaseRecoveryPublication(locationRuntime, spotNodeRuntime, channelRuntime);
@@ -1046,15 +1065,24 @@ class ZLinkFrameworkRuntimeHost {
1046
1065
  this.lifecycleSink?.push('framework:started');
1047
1066
  }
1048
1067
  catch (error) {
1068
+ if (this.shutdownDeadline !== undefined && (0, abort_1.isAbortError)(error))
1069
+ throw error;
1049
1070
  await statefulAuthorityRoutes?.stop();
1050
- await (0, runtime_shutdown_1.rollbackRuntimeStart)({
1051
- context,
1052
- startedLocationRuntime,
1053
- streamRuntime,
1054
- spotNodeRuntime,
1055
- channelRuntime,
1056
- ownedStores: registeredRuntimeStores(this.options.registration)
1057
- });
1071
+ try {
1072
+ await this.runWithShutdownDeadline(DEFAULT_HOST_CONTROL_TIMEOUT_MS, async () => (0, runtime_shutdown_1.rollbackRuntimeStart)({
1073
+ context,
1074
+ startedLocationRuntime: startedLocationRuntime ?? this.locationOwner.currentRuntime,
1075
+ shutdownSignal: this.shutdownDeadline.signal,
1076
+ streamRuntime,
1077
+ spotNodeRuntime,
1078
+ channelRuntime,
1079
+ ownedStores: registeredRuntimeStores(this.options.registration)
1080
+ }));
1081
+ }
1082
+ catch (cleanupError) {
1083
+ this.runtimeOrPreStartErrorSink.reportRuntimeTaskException('framework start rollback', cleanupError);
1084
+ throw new AggregateError([error, cleanupError], 'Framework start and rollback failed.');
1085
+ }
1058
1086
  this.executionState = undefined;
1059
1087
  this.channelRuntime = undefined;
1060
1088
  this.spotNodeRuntime = undefined;
@@ -1067,7 +1095,7 @@ class ZLinkFrameworkRuntimeHost {
1067
1095
  }
1068
1096
  }
1069
1097
  async stop() {
1070
- await this.runLifecycle(() => this.stopCore());
1098
+ await this.runWithShutdownDeadline(DEFAULT_HOST_CONTROL_TIMEOUT_MS, async () => this.runLifecycle(() => this.stopCore()));
1071
1099
  }
1072
1100
  runtimeMetricMeshSnapshots() {
1073
1101
  const snapshots = [];
@@ -1117,6 +1145,7 @@ class ZLinkFrameworkRuntimeHost {
1117
1145
  if (state === undefined) {
1118
1146
  return;
1119
1147
  }
1148
+ state.abortController.abort();
1120
1149
  const channelRuntime = this.channelRuntime;
1121
1150
  const spotNodeRuntime = this.spotNodeRuntime;
1122
1151
  const streamRuntime = this.streamRuntime;
@@ -1124,24 +1153,25 @@ class ZLinkFrameworkRuntimeHost {
1124
1153
  this.stopTopologyObservers();
1125
1154
  this.removeOwnerLeaseRecoveryPublication();
1126
1155
  const locationSnapshot = this.locationOwner.clearForStop();
1127
- this.executionState = undefined;
1128
- this.channelRuntime = undefined;
1129
- this.spotNodeRuntime = undefined;
1130
- this.streamRuntime = undefined;
1131
- this.statefulAuthorityRoutes = undefined;
1132
- this.cachedLocationSpotRouteResolver = undefined;
1133
1156
  this.lifecycleSink?.push('framework:stop');
1134
1157
  await statefulAuthorityRoutes?.stop();
1135
1158
  await (0, runtime_shutdown_1.stopRuntimeParts)({
1136
1159
  state,
1137
1160
  locationSnapshot,
1138
1161
  cleanupDeadline: this.runtimeDeadline,
1162
+ shutdownSignal: this.shutdownDeadline.signal,
1139
1163
  streamRuntime,
1140
1164
  spotNodeRuntime,
1141
1165
  channelRuntime,
1142
1166
  serviceRelocation: this.serviceRelocation,
1143
1167
  ownedStores: registeredRuntimeStores(this.options.registration)
1144
1168
  });
1169
+ this.executionState = undefined;
1170
+ this.channelRuntime = undefined;
1171
+ this.spotNodeRuntime = undefined;
1172
+ this.streamRuntime = undefined;
1173
+ this.statefulAuthorityRoutes = undefined;
1174
+ this.cachedLocationSpotRouteResolver = undefined;
1145
1175
  this.listenerRecords.clear();
1146
1176
  this.lifecycleSink?.push('framework:stopped');
1147
1177
  if (this.shutdownOperation === undefined) {
@@ -1191,7 +1221,7 @@ class ZLinkFrameworkRuntimeHost {
1191
1221
  meshNodes: spotNodeRuntime.meshNodesByName,
1192
1222
  pollingIntervalMs: this.options.registration.locations.options.pollingIntervalMs ??
1193
1223
  Locations_1.zlinkDefaultLocationOptions.pollingIntervalMs,
1194
- pageSize: 1000,
1224
+ pageSize: Stores_1.ZLINK_PROVIDER_MAX_PAGE_SIZE,
1195
1225
  reportError: (error) => this.runtimeOrPreStartErrorSink.reportRuntimeTaskException('stateful authority route reconciliation', error),
1196
1226
  onSpotRouteChanged: (spotId) => this.cachedLocationSpotRouteResolver?.invalidate?.(spotId)
1197
1227
  });
@@ -1211,11 +1241,6 @@ class ZLinkFrameworkRuntimeHost {
1211
1241
  const activationNode = node;
1212
1242
  const spotManager = this.spotManager;
1213
1243
  if (spotManager !== undefined) {
1214
- activationNode.setSpotAdmissionProvider?.({
1215
- isClosing: (spotId) => spotManager.isSpotClosing(meshName, spotId),
1216
- awaitCloseDecision: (spotId) => spotManager.pendingSpotCloseDecision(meshName, spotId),
1217
- runtimeState: () => this.runtimeState
1218
- });
1219
1244
  this.registerInstanceApplicationLifecycle(meshName, activationNode, spotManager);
1220
1245
  }
1221
1246
  activationNode.registerAsyncInstanceActivationAuthority?.(new instance_activation_authority_1.ZLinkInstanceActivationAuthority({
@@ -1364,8 +1389,9 @@ class ZLinkFrameworkRuntimeHost {
1364
1389
  }
1365
1390
  }
1366
1391
  catch (error) {
1367
- throw new ZLinkDrainingStatePublishError(error);
1392
+ throw new route_mesh_runtime_1.ZLinkDrainingStatePublishError(error);
1368
1393
  }
1394
+ await awaitWithDrainSignal(this.serviceRelocation.drainTargetAttempts(), signal);
1369
1395
  }
1370
1396
  async cleanupOwnerForDrain(signal) {
1371
1397
  const runtime = this.locationOwner.currentRuntime;
@@ -1387,7 +1413,6 @@ class ZLinkFrameworkRuntimeHost {
1387
1413
  activationNode.registerInstanceApplicationLifecycle?.({
1388
1414
  isMaterialized: (target) => spotManager.isInstanceMaterialized(meshName, target.stableType, target.targetSpotId),
1389
1415
  isMaterializing: (target) => spotManager.isInstanceMaterializing(meshName, target.targetSpotId),
1390
- isClosing: (target) => spotManager.isInstanceClosing(meshName, target.targetSpotId),
1391
1416
  isIdleEvicting: (target) => spotManager.isInstanceSpotIdleEvicting(meshName, target.targetSpotId),
1392
1417
  beginIdleEviction: (target) => spotManager.beginInstanceSpotIdleEviction(meshName, target.targetSpotId),
1393
1418
  materialize: (target, objectGeneration) => spotManager.materializeInstance(meshName, target.stableType, target.targetSpotId, objectGeneration, this.executionState?.abortController.signal),
@@ -1402,12 +1427,6 @@ class ZLinkFrameworkRuntimeHost {
1402
1427
  setSpotManager(spotManager) {
1403
1428
  this.spotManager = spotManager;
1404
1429
  for (const [meshName, node] of this.spotNodeRuntime?.meshNodesByName ?? []) {
1405
- const admissionNode = node;
1406
- admissionNode.setSpotAdmissionProvider?.({
1407
- isClosing: (spotId) => spotManager.isSpotClosing(meshName, spotId),
1408
- awaitCloseDecision: (spotId) => spotManager.pendingSpotCloseDecision(meshName, spotId),
1409
- runtimeState: () => this.runtimeState
1410
- });
1411
1430
  this.registerInstanceApplicationLifecycle(meshName, node, spotManager);
1412
1431
  }
1413
1432
  }
@@ -1477,7 +1496,10 @@ class ZLinkFrameworkRuntimeHost {
1477
1496
  detachedTaskRunner: this.detachedTaskRunner(),
1478
1497
  metrics: this.metrics,
1479
1498
  admission: this.admission,
1480
- statefulExecutionAllowed: () => this.ownerAdmissionOpen()
1499
+ statefulExecution: {
1500
+ admissionOpen: () => this.ownerAdmissionOpen(),
1501
+ hostState: () => this.runtimeState
1502
+ }
1481
1503
  }).create(this.actorTransferRuntime),
1482
1504
  activationAdmission: this.activationAdmission
1483
1505
  };
@@ -1521,7 +1543,7 @@ class ZLinkFrameworkRuntimeHost {
1521
1543
  throw (0, framework_errors_internal_1.createInternalFrameworkException)(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.ObjectClientNotConfigured, `RouteMesh '${meshName}' has no object-client role.`);
1522
1544
  }
1523
1545
  const meshNode = this.spotNodeRuntime?.meshNode(meshName);
1524
- const descriptors = (await locationStore.listMeshNodes(meshName, undefined, signal)).items;
1546
+ const descriptors = await (0, location_store_pages_1.listAllMeshNodeDescriptors)(locationStore, meshName, signal);
1525
1547
  const selected = await selectReadyLocationPlacementDescriptor(descriptors, meshNode, signal, (descriptor) => {
1526
1548
  const capability = descriptor.objectCapabilities.find((candidate) => candidate.objectKind === 'actor' && candidate.stableType === stableType);
1527
1549
  const actors = descriptor.populationCapacity.actors;
@@ -1602,7 +1624,7 @@ class ZLinkFrameworkRuntimeHost {
1602
1624
  throw (0, framework_errors_internal_1.createInternalFrameworkException)(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.ObjectClientNotConfigured, `RouteMesh '${meshName}' has no object-client role.`);
1603
1625
  }
1604
1626
  const meshNode = this.spotNodeRuntime?.meshNode(meshName);
1605
- const descriptors = (await locationStore.listMeshNodes(meshName, undefined, signal)).items;
1627
+ const descriptors = await (0, location_store_pages_1.listAllMeshNodeDescriptors)(locationStore, meshName, signal);
1606
1628
  const selected = await selectReadyLocationPlacementDescriptor(descriptors, meshNode, signal, (descriptor) => {
1607
1629
  const capability = descriptor.objectCapabilities.find((candidate) => candidate.objectKind === 'user_spot' && candidate.stableType === request.stableType);
1608
1630
  const spotTypeCapacity = descriptor.populationCapacity.spotTypes.find((candidate) => candidate.objectKind === 'user_spot' && candidate.stableType === request.stableType);
@@ -1680,7 +1702,7 @@ class ZLinkFrameworkRuntimeHost {
1680
1702
  try {
1681
1703
  payload = {
1682
1704
  packetName: 'ZLinkFrameworkUserSpotReply',
1683
- contentType: 'application/octet-stream',
1705
+ contentType: stream_wire_1.ZlinkStreamContentType.Raw,
1684
1706
  payload: Buffer.from(message.data())
1685
1707
  };
1686
1708
  }
@@ -1804,7 +1826,7 @@ class ZLinkFrameworkRuntimeHost {
1804
1826
  }
1805
1827
  return node.requestUserSpotClose(targetNodeRid, request, timeoutMs);
1806
1828
  },
1807
- defaultTimeoutMs: this.options.registration.requestTimeoutMs ?? 30_000,
1829
+ defaultTimeoutMs: this.options.registration.requestTimeoutMs ?? Registration_1.DEFAULT_REQUEST_TIMEOUT_MS,
1808
1830
  messageSerializers: this.options.registration.messageSerializers
1809
1831
  });
1810
1832
  }
@@ -1824,6 +1846,8 @@ class ZLinkFrameworkRuntimeHost {
1824
1846
  meshCompletions: (meshName) => this.spotNodeRuntime?.meshCompletionTable(meshName),
1825
1847
  notifyEntrySpotActorCreated: (nodeRid, actor, createRequest, signal) => this.spotNodeRuntime?.notifyEntrySpotActorCreated(nodeRid, actor, createRequest, signal) ??
1826
1848
  Promise.resolve(undefined),
1849
+ notifyEntrySpotActorJoined: (actor, signal) => this.spotNodeRuntime?.notifyPrimaryEntrySpotActorJoined(actor, signal) ?? Promise.resolve(),
1850
+ notifyEntrySpotActorLeft: (actor, signal) => this.spotNodeRuntime?.notifyPrimaryEntrySpotActorLeft(actor, signal) ?? Promise.resolve(),
1827
1851
  locationLifecycle: () => this.locationOwner.currentLifecycle,
1828
1852
  primaryMeshName: () => this.meshRouters.primaryMeshName(),
1829
1853
  actorMeshName: (actorType) => this.meshRouters.actorMeshName(actorType),
@@ -1845,7 +1869,7 @@ class ZLinkFrameworkRuntimeHost {
1845
1869
  if (entrySpotId === undefined) {
1846
1870
  throw new ConfigurationException_1.ZLinkConfigurationException(`Actor '${actorRef.actorId}' authority requires its RouteMesh Entry Spot.`);
1847
1871
  }
1848
- await (0, actors_2.publishInitialActorAuthority)(store, {
1872
+ await (0, actors_1.publishInitialActorAuthority)(store, {
1849
1873
  actorType,
1850
1874
  actor: actorRef,
1851
1875
  meshName,
@@ -1913,6 +1937,7 @@ class ZLinkFrameworkRuntimeHost {
1913
1937
  }).create();
1914
1938
  return {
1915
1939
  ...options,
1940
+ errorSink: this.runtimeOrPreStartErrorSink,
1916
1941
  peerAdmissionSealed: (meshName) => !this.admission.accepts(meshName),
1917
1942
  messageFollowReceiver: (record) => {
1918
1943
  if (record.source.kind === 'actor') {
@@ -1951,10 +1976,8 @@ class ZLinkFrameworkRuntimeHost {
1951
1976
  throw new ConfigurationException_1.ZLinkConfigurationException('MeshNode Actor binding record has no binding generation.');
1952
1977
  }
1953
1978
  const binding = record.kindData;
1954
- const replyBindingFailure = (kind, message) => {
1955
- const terminal = kind === framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.ActorGenerationStale
1956
- ? { terminalResult: runtime_values_1.RequestResult.InvalidState, failureCode: 0 }
1957
- : (0, framework_errors_internal_1.internalFrameworkWireReply)((0, framework_errors_internal_1.createInternalFrameworkException)(kind, message));
1979
+ const replyBindingFailure = (kind) => {
1980
+ const terminal = (0, framework_errors_internal_1.internalFrameworkWireReply)(kind);
1958
1981
  if (record.replyFailure?.(terminal.terminalResult, terminal.failureCode) !== runtime_values_1.SubmitResult.Ok) {
1959
1982
  throw new ConfigurationException_1.ZLinkConfigurationException(`MeshNode Actor binding target '${binding.actor.actorId}' failure acknowledgement failed.`);
1960
1983
  }
@@ -1970,11 +1993,11 @@ class ZLinkFrameworkRuntimeHost {
1970
1993
  nativeActorRef === undefined ||
1971
1994
  nativeActorRef.actorId !== binding.actor.actorId ||
1972
1995
  !(0, routing_id_1.routingIdsEqual)(nativeActorRef.nodeRid, binding.actor.nodeRid)) {
1973
- replyBindingFailure(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.ActorLocationStale, `Actor '${binding.actor.actorId}' binding target is no longer current.`);
1996
+ replyBindingFailure(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.ActorLocationStale);
1974
1997
  return;
1975
1998
  }
1976
1999
  if (nativeActorRef.generation !== binding.actor.generation) {
1977
- replyBindingFailure(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.ActorGenerationStale, `Actor '${binding.actor.actorId}' binding object generation is stale.`);
2000
+ replyBindingFailure(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.ActorGenerationStale);
1978
2001
  return;
1979
2002
  }
1980
2003
  const node = state.meshName === meshName ? this.spotNodeRuntime?.meshNode(meshName) : undefined;
@@ -1986,7 +2009,7 @@ class ZLinkFrameworkRuntimeHost {
1986
2009
  localStatus.lifecycleGeneration !== binding.actorNodeGeneration ||
1987
2010
  state.locationGeneration !== binding.authorityOwnerGeneration ||
1988
2011
  state.isMoving) {
1989
- replyBindingFailure(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.ActorLocationStale, `Actor '${binding.actor.actorId}' binding authority fence is stale.`);
2012
+ replyBindingFailure(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.ActorLocationStale);
1990
2013
  return;
1991
2014
  }
1992
2015
  const sessionOwnerIsLocal = (0, routing_id_1.routingIdsEqual)(localStatus.routingId, binding.sessionNodeRid) &&
@@ -1999,6 +2022,7 @@ class ZLinkFrameworkRuntimeHost {
1999
2022
  nodeRid: binding.actor.nodeRid
2000
2023
  };
2001
2024
  if (sessionOwnerIsLocal) {
2025
+ (0, application_job_queue_scope_1.releaseApplicationJobPermitBeforeHandler)();
2002
2026
  await this.streamBindingRuntime.retireRemoteBinding(actorRef, binding.sessionRid, binding.bindingGeneration, signal);
2003
2027
  }
2004
2028
  state.retireBoundSessionBinding(binding);
@@ -2007,7 +2031,7 @@ class ZLinkFrameworkRuntimeHost {
2007
2031
  }
2008
2032
  const target = this.boundSessionRelay.boundSessions.resolveRemoteBoundSessionTarget(binding.sessionNodeRid, binding.sessionRid);
2009
2033
  if (target === undefined) {
2010
- replyBindingFailure(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.ActorLocationStale, `Actor '${binding.actor.actorId}' Session route is unavailable.`);
2034
+ replyBindingFailure(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.ActorLocationStale);
2011
2035
  return;
2012
2036
  }
2013
2037
  const installed = state.installBoundSessionBinding({
@@ -2020,7 +2044,7 @@ class ZLinkFrameworkRuntimeHost {
2020
2044
  bindingGeneration: binding.bindingGeneration
2021
2045
  });
2022
2046
  if (!installed) {
2023
- replyBindingFailure(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.ActorLocationStale, `Actor '${binding.actor.actorId}' Session binding generation is stale.`);
2047
+ replyBindingFailure(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.ActorLocationStale);
2024
2048
  return;
2025
2049
  }
2026
2050
  replyBindingSuccess();
@@ -2047,7 +2071,7 @@ class ZLinkFrameworkRuntimeHost {
2047
2071
  return;
2048
2072
  }
2049
2073
  if (record.kind === service_runtime_contracts_1.ReceiveKind.NodeRequest && record.parts.length === 1) {
2050
- const terminal = (0, actors_2.decodeRemoteActorSourceLeaveTerminal)(record.parts[0].data());
2074
+ const terminal = (0, actors_1.decodeRemoteActorSourceLeaveTerminal)(record.parts[0].data());
2051
2075
  if (terminal !== undefined) {
2052
2076
  if ((await this.spotManager?.completeFormalSourceLeaveTerminal(terminal.actorId, terminal.transferId, terminal.succeeded)) !== true) {
2053
2077
  throw new ConfigurationException_1.ZLinkConfigurationException(`Actor '${terminal.actorId}' has no matching formal transfer terminal gate.`);
@@ -2231,7 +2255,7 @@ class ZLinkFrameworkRuntimeHost {
2231
2255
  const resolver = authority === undefined
2232
2256
  ? legacy
2233
2257
  : new locations_1.ZLinkAuthoritySpotRouteResolver(authority, this.meshRouters.spotRouterChannelIdByMesh(), legacy, this.locationOwner.currentLeaseTracker, this.options.registration.locations.options.routeCacheMaxAgeMs, undefined, async (meshName, nodeRid, expectedLifecycleGeneration, signal) => {
2234
- const descriptor = (await authority.listMeshNodes(meshName, undefined, signal)).items.find((candidate) => (0, routing_id_1.routingIdsEqual)(candidate.rid, nodeRid) &&
2258
+ const descriptor = (await (0, location_store_pages_1.listAllMeshNodeDescriptors)(authority, meshName, signal)).find((candidate) => (0, routing_id_1.routingIdsEqual)(candidate.rid, nodeRid) &&
2235
2259
  candidate.lifecycleGeneration === expectedLifecycleGeneration);
2236
2260
  return descriptor?.state;
2237
2261
  });
@@ -2282,12 +2306,13 @@ function hasExactPeerReadiness(descriptors, local, peers) {
2282
2306
  replacementDescriptors.some((descriptor) => peers.some((peer) => peer.routingId !== null &&
2283
2307
  String(peer.routingId) === String(descriptor.rid) &&
2284
2308
  peer.lifecycleGeneration === descriptor.lifecycleGeneration &&
2285
- peer.state === 3)));
2309
+ peer.state === service_runtime_contracts_1.MeshPeerRuntimeState.Serving)));
2286
2310
  }
2287
2311
  var actor_transfer_authority_runtime_2 = require("./actor-transfer-authority-runtime");
2288
2312
  Object.defineProperty(exports, "ZLinkActorTransferAuthorityRuntime", { enumerable: true, get: function () { return actor_transfer_authority_runtime_2.ZLinkActorTransferAuthorityRuntime; } });
2289
2313
  Object.defineProperty(exports, "transferIdString", { enumerable: true, get: function () { return actor_transfer_authority_runtime_2.transferIdString; } });
2290
2314
  var route_mesh_runtime_2 = require("./route-mesh-runtime");
2315
+ Object.defineProperty(exports, "ZLinkDrainingStatePublishError", { enumerable: true, get: function () { return route_mesh_runtime_2.ZLinkDrainingStatePublishError; } });
2291
2316
  Object.defineProperty(exports, "ZLinkRetiringRollbackError", { enumerable: true, get: function () { return route_mesh_runtime_2.ZLinkRetiringRollbackError; } });
2292
2317
  Object.defineProperty(exports, "ZLinkRouteMeshRuntimeCoordinator", { enumerable: true, get: function () { return route_mesh_runtime_2.ZLinkRouteMeshRuntimeCoordinator; } });
2293
2318
  var service_relocation_host_runtime_2 = require("./service-relocation-host-runtime");
@@ -2301,7 +2326,7 @@ async function waitForForcedSessionNotification(operation) {
2301
2326
  return;
2302
2327
  let timeoutHandle;
2303
2328
  const timeout = new Promise((resolve) => {
2304
- timeoutHandle = setTimeout(resolve, 100);
2329
+ timeoutHandle = setTimeout(resolve, HOST_SHUTDOWN_POLL_INTERVAL_MS);
2305
2330
  });
2306
2331
  try {
2307
2332
  await Promise.race([operation.catch(() => undefined), timeout]);
@@ -2330,12 +2355,6 @@ async function awaitWithDrainSignal(operation, signal) {
2330
2355
  });
2331
2356
  });
2332
2357
  }
2333
- class ZLinkDrainingStatePublishError extends Error {
2334
- constructor(cause) {
2335
- super('Failed to publish draining peer rows.', { cause });
2336
- this.name = 'ZLinkDrainingStatePublishError';
2337
- }
2338
- }
2339
2358
  function resolveBackendAdapterFactory(internalOptions) {
2340
2359
  if (typeof internalOptions === 'object' &&
2341
2360
  internalOptions !== null &&
@@ -2465,7 +2484,7 @@ function waitForPlacementReadiness(signal) {
2465
2484
  const timer = setTimeout(() => {
2466
2485
  signal?.removeEventListener('abort', abort);
2467
2486
  resolve();
2468
- }, 10);
2487
+ }, HANDOFF_ACCEPTANCE_POLL_INTERVAL_MS);
2469
2488
  const abort = () => {
2470
2489
  clearTimeout(timer);
2471
2490
  signal?.removeEventListener('abort', abort);
@@ -2503,8 +2522,8 @@ function relocationReason(reason) {
2503
2522
  }
2504
2523
  function rewriteAuthorityPayloadForOwner(payload, owner) {
2505
2524
  const applicationPayload = (0, service_relocation_runtime_1.serviceRelocationAuthorityApplicationPayload)(payload);
2506
- const rewritten = (0, actors_2.isActorAuthorityPayload)(applicationPayload)
2507
- ? (0, actors_2.rewriteActorAuthorityOwner)(applicationPayload, owner)
2525
+ const rewritten = (0, actors_1.isActorAuthorityPayload)(applicationPayload)
2526
+ ? (0, actors_1.rewriteActorAuthorityOwner)(applicationPayload, owner)
2508
2527
  : ((0, service_authority_payload_codec_1.rewriteServiceAuthorityOwner)(applicationPayload, owner) ?? applicationPayload);
2509
2528
  return (0, service_relocation_runtime_1.replaceServiceRelocationAuthorityApplicationPayload)(payload, rewritten);
2510
2529
  }