@zlink-systems/framework 0.24.0 → 0.26.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 (215) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/contracts/Channels/IZLinkFanoutClient.d.ts +0 -6
  3. package/dist/contracts/RouteMesh/RuntimeTopology.d.ts +8 -0
  4. package/dist/internal.d.ts +1 -0
  5. package/dist/internal.js +1 -0
  6. package/dist/runtime/activation-admission.d.ts +29 -0
  7. package/dist/runtime/activation-admission.js +61 -0
  8. package/dist/runtime/actors/actor-context.js +6 -6
  9. package/dist/runtime/actors/actor-handoff.d.ts +9 -3
  10. package/dist/runtime/actors/actor-handoff.js +28 -17
  11. package/dist/runtime/actors/actor-local-native-join.js +2 -18
  12. package/dist/runtime/actors/actor-remote-joiner.d.ts +2 -2
  13. package/dist/runtime/actors/actor-remote-joiner.js +6 -8
  14. package/dist/runtime/actors/actor-runtime-contracts.d.ts +4 -2
  15. package/dist/runtime/actors/actor-source-transfer.d.ts +5 -5
  16. package/dist/runtime/actors/deferred-join-completion.d.ts +14 -0
  17. package/dist/runtime/actors/deferred-join-completion.js +20 -0
  18. package/dist/runtime/actors/index.d.ts +1 -1
  19. package/dist/runtime/actors/index.js +15 -5
  20. package/dist/runtime/admission.d.ts +5 -1
  21. package/dist/runtime/admission.js +4 -0
  22. package/dist/runtime/backend/contracts/index.d.ts +2 -10
  23. package/dist/runtime/backend/mesh-actor-session-node-adapter.js +2 -9
  24. package/dist/runtime/backend/node/node-backend-adapter-factory.d.ts +1 -2
  25. package/dist/runtime/backend/node/node-backend-adapter-factory.js +4 -18
  26. package/dist/runtime/backend/node/node-backend-adapter-support.d.ts +6 -3
  27. package/dist/runtime/backend/node/node-backend-adapter-support.js +12 -28
  28. package/dist/runtime/backend/node/node-event-loop-poller.d.ts +1 -1
  29. package/dist/runtime/backend/node/node-event-loop-poller.js +8 -2
  30. package/dist/runtime/backend/node/node-raw-binding-port.d.ts +1 -1
  31. package/dist/runtime/backend/node/node-raw-binding-port.js +11 -3
  32. package/dist/runtime/backend/node/node-raw-mesh-backend.d.ts +12 -9
  33. package/dist/runtime/backend/node/node-raw-mesh-backend.js +61 -29
  34. package/dist/runtime/backend/node/node-socket-backend-adapter.js +1 -1
  35. package/dist/runtime/backend/raw-binding-port.d.ts +12 -0
  36. package/dist/runtime/channels/channel-clients.d.ts +0 -1
  37. package/dist/runtime/channels/channel-clients.js +0 -8
  38. package/dist/runtime/channels/channel-outbound-operations.js +2 -10
  39. package/dist/runtime/channels/channel-runtime-manager.d.ts +2 -5
  40. package/dist/runtime/channels/channel-runtime-manager.js +1 -12
  41. package/dist/runtime/channels/channel-socket-registry.d.ts +17 -4
  42. package/dist/runtime/channels/channel-socket-registry.js +49 -62
  43. package/dist/runtime/channels/channel-transports.d.ts +0 -3
  44. package/dist/runtime/channels/fanout-location-runtime.js +3 -9
  45. package/dist/runtime/execution/index.d.ts +18 -8
  46. package/dist/runtime/execution/index.js +55 -29
  47. package/dist/runtime/execution/serial-execution-queue.d.ts +5 -6
  48. package/dist/runtime/execution/serial-execution-queue.js +49 -15
  49. package/dist/runtime/foundation/listener-records.d.ts +11 -0
  50. package/dist/runtime/foundation/listener-records.js +20 -0
  51. package/dist/runtime/foundation/raw-service-mesh-runtime.d.ts +10 -21
  52. package/dist/runtime/foundation/raw-service-mesh-runtime.js +66 -392
  53. package/dist/runtime/foundation/service-authority-payload-codec.d.ts +1 -0
  54. package/dist/runtime/foundation/service-authority-payload-codec.js +8 -0
  55. package/dist/runtime/foundation/service-maintenance-runtime.js +23 -2
  56. package/dist/runtime/foundation/service-relocation-coordinator.d.ts +9 -0
  57. package/dist/runtime/foundation/service-relocation-coordinator.js +14 -1
  58. package/dist/runtime/foundation/service-relocation-object-owner.d.ts +8 -0
  59. package/dist/runtime/foundation/service-relocation-object-owner.js +16 -4
  60. package/dist/runtime/foundation/service-session-binding-ingress-port.d.ts +6 -13
  61. package/dist/runtime/foundation/service-stateful-runtime.d.ts +10 -7
  62. package/dist/runtime/foundation/service-stateful-runtime.js +100 -60
  63. package/dist/runtime/foundation/service-stateful-wire-codec.d.ts +9 -4
  64. package/dist/runtime/foundation/service-stateful-wire-codec.js +153 -90
  65. package/dist/runtime/foundation/service-topology-registry.d.ts +1 -2
  66. package/dist/runtime/foundation/service-topology-registry.js +6 -30
  67. package/dist/runtime/host/actor-transfer-runtime.d.ts +17 -15
  68. package/dist/runtime/host/actor-transfer-runtime.js +73 -86
  69. package/dist/runtime/host/index.d.ts +6 -2
  70. package/dist/runtime/host/index.js +63 -37
  71. package/dist/runtime/host/remote-bound-session-relay.js +4 -3
  72. package/dist/runtime/host/route-mesh-runtime.d.ts +2 -0
  73. package/dist/runtime/host/route-mesh-runtime.js +7 -5
  74. package/dist/runtime/host/service-relocation-host-runtime.d.ts +50 -8
  75. package/dist/runtime/host/service-relocation-host-runtime.js +343 -270
  76. package/dist/runtime/host/spot-runtime-options-factory.d.ts +7 -4
  77. package/dist/runtime/host/spot-runtime-options-factory.js +4 -8
  78. package/dist/runtime/host/stateful-authority-route-runtime.js +6 -2
  79. package/dist/runtime/host/user-spot-creation-coordinator.d.ts +11 -3
  80. package/dist/runtime/host/user-spot-creation-coordinator.js +85 -87
  81. package/dist/runtime/locations/in-memory-provider-location-store.js +8 -6
  82. package/dist/runtime/locations/lifecycle.d.ts +1 -1
  83. package/dist/runtime/locations/lifecycle.js +2 -2
  84. package/dist/runtime/locations/resolvers.js +7 -2
  85. package/dist/runtime/locations/spot-location-claims.d.ts +2 -2
  86. package/dist/runtime/locations/spot-location-claims.js +3 -27
  87. package/dist/runtime/protocol/service_wire_codec.generated.d.ts +1 -0
  88. package/dist/runtime/protocol/service_wire_codec.generated.js +5 -1
  89. package/dist/runtime/protocol/service_wire_pilot_codec.generated.d.ts +1 -0
  90. package/dist/runtime/protocol/service_wire_pilot_codec.generated.js +3 -2
  91. package/dist/runtime/spots/formal-remote-actor-admission-registry.d.ts +3 -3
  92. package/dist/runtime/spots/formal-remote-actor-admission-registry.js +4 -4
  93. package/dist/runtime/spots/formal-remote-actor-transfer-registry.d.ts +3 -3
  94. package/dist/runtime/spots/index.d.ts +25 -19
  95. package/dist/runtime/spots/index.js +207 -205
  96. package/dist/runtime/spots/spot-activation-registry.d.ts +4 -2
  97. package/dist/runtime/spots/spot-activation-registry.js +34 -31
  98. package/dist/runtime/spots/spot-activation-state.d.ts +2 -11
  99. package/dist/runtime/spots/spot-activation-state.js +4 -17
  100. package/dist/runtime/spots/spot-activation.d.ts +8 -6
  101. package/dist/runtime/spots/spot-activation.js +54 -49
  102. package/dist/runtime/spots/spot-actor-admission-coordinator.d.ts +1 -1
  103. package/dist/runtime/spots/spot-actor-admission-coordinator.js +1 -1
  104. package/dist/runtime/spots/spot-actor-join-dispatch.d.ts +2 -2
  105. package/dist/runtime/spots/spot-actor-join-dispatch.js +3 -5
  106. package/dist/runtime/spots/spot-actor-lifecycle-drain.js +2 -2
  107. package/dist/runtime/spots/spot-actor-membership.d.ts +4 -0
  108. package/dist/runtime/spots/spot-actor-membership.js +26 -12
  109. package/dist/runtime/spots/spot-entry-activation.d.ts +1 -2
  110. package/dist/runtime/spots/spot-entry-activation.js +0 -1
  111. package/dist/runtime/spots/spot-manager-public.js +1 -1
  112. package/dist/runtime/spots/spot-native-actor-join-admission.d.ts +1 -1
  113. package/dist/runtime/spots/spot-native-actor-join-admission.js +2 -2
  114. package/dist/runtime/spots/spot-node-runtime-manager.d.ts +5 -5
  115. package/dist/runtime/spots/spot-node-runtime-manager.js +7 -11
  116. package/dist/runtime/spots/spot-outbound.js +1 -29
  117. package/dist/runtime/spots/spot-routed-actor-admission.d.ts +1 -0
  118. package/dist/runtime/spots/spot-routed-actor-admission.js +10 -0
  119. package/dist/runtime/spots/spot-routed-frame-dispatch.d.ts +2 -6
  120. package/dist/runtime/spots/spot-routed-frame-dispatch.js +2 -70
  121. package/dist/runtime/spots/spot-runtime-ports.d.ts +3 -5
  122. package/dist/runtime/spots/spot-serial-executor.d.ts +5 -0
  123. package/dist/runtime/spots/spot-serial-executor.js +8 -1
  124. package/dist/runtime/spots/spot-serial-turn-executor.d.ts +3 -0
  125. package/dist/runtime/spots/spot-serial-turn-executor.js +8 -4
  126. package/dist/runtime/streams/actor-session-binding-registry.d.ts +13 -15
  127. package/dist/runtime/streams/actor-session-binding-registry.js +19 -171
  128. package/dist/runtime/streams/actor-session-binding-runtime-owner.d.ts +3 -4
  129. package/dist/runtime/streams/bound-session-service.js +1 -18
  130. package/dist/runtime/streams/index.d.ts +2 -0
  131. package/dist/runtime/streams/index.js +19 -19
  132. package/dist/runtime/streams/session-serial-executor.js +2 -2
  133. package/package.json +3 -3
  134. package/src/contracts/Channels/IZLinkFanoutClient.ts +0 -7
  135. package/src/contracts/RouteMesh/RuntimeTopology.ts +10 -0
  136. package/src/internal.ts +1 -0
  137. package/src/runtime/activation-admission.ts +78 -0
  138. package/src/runtime/actors/actor-context.ts +6 -6
  139. package/src/runtime/actors/actor-handoff.ts +31 -23
  140. package/src/runtime/actors/actor-local-native-join.ts +3 -42
  141. package/src/runtime/actors/actor-remote-joiner.ts +6 -25
  142. package/src/runtime/actors/actor-runtime-contracts.ts +4 -10
  143. package/src/runtime/actors/actor-source-transfer.ts +5 -18
  144. package/src/runtime/actors/deferred-join-completion.ts +40 -0
  145. package/src/runtime/actors/index.ts +22 -9
  146. package/src/runtime/admission.ts +5 -1
  147. package/src/runtime/backend/contracts/index.ts +2 -13
  148. package/src/runtime/backend/mesh-actor-session-node-adapter.ts +2 -10
  149. package/src/runtime/backend/node/node-backend-adapter-factory.ts +5 -25
  150. package/src/runtime/backend/node/node-backend-adapter-support.ts +9 -29
  151. package/src/runtime/backend/node/node-event-loop-poller.ts +14 -2
  152. package/src/runtime/backend/node/node-raw-binding-port.ts +17 -3
  153. package/src/runtime/backend/node/node-raw-mesh-backend.ts +65 -32
  154. package/src/runtime/backend/node/node-socket-backend-adapter.ts +2 -2
  155. package/src/runtime/backend/raw-binding-port.ts +13 -0
  156. package/src/runtime/channels/channel-clients.ts +0 -11
  157. package/src/runtime/channels/channel-outbound-operations.ts +3 -11
  158. package/src/runtime/channels/channel-runtime-manager.ts +4 -15
  159. package/src/runtime/channels/channel-socket-registry.ts +69 -71
  160. package/src/runtime/channels/channel-transports.ts +0 -3
  161. package/src/runtime/channels/fanout-location-runtime.ts +4 -16
  162. package/src/runtime/execution/index.ts +68 -30
  163. package/src/runtime/execution/serial-execution-queue.ts +52 -20
  164. package/src/runtime/foundation/listener-records.ts +21 -0
  165. package/src/runtime/foundation/raw-service-mesh-runtime.ts +66 -466
  166. package/src/runtime/foundation/service-authority-payload-codec.ts +10 -0
  167. package/src/runtime/foundation/service-maintenance-runtime.ts +30 -9
  168. package/src/runtime/foundation/service-relocation-coordinator.ts +13 -0
  169. package/src/runtime/foundation/service-relocation-object-owner.ts +18 -5
  170. package/src/runtime/foundation/service-session-binding-ingress-port.ts +6 -14
  171. package/src/runtime/foundation/service-stateful-runtime.ts +151 -89
  172. package/src/runtime/foundation/service-stateful-wire-codec.ts +203 -121
  173. package/src/runtime/foundation/service-topology-registry.ts +8 -48
  174. package/src/runtime/host/actor-transfer-runtime.ts +94 -166
  175. package/src/runtime/host/index.ts +119 -54
  176. package/src/runtime/host/remote-bound-session-relay.ts +4 -3
  177. package/src/runtime/host/route-mesh-runtime.ts +9 -5
  178. package/src/runtime/host/service-relocation-host-runtime.ts +495 -376
  179. package/src/runtime/host/spot-runtime-options-factory.ts +24 -13
  180. package/src/runtime/host/stateful-authority-route-runtime.ts +8 -4
  181. package/src/runtime/host/user-spot-creation-coordinator.ts +147 -142
  182. package/src/runtime/locations/in-memory-provider-location-store.ts +11 -7
  183. package/src/runtime/locations/lifecycle.ts +3 -2
  184. package/src/runtime/locations/resolvers.ts +19 -13
  185. package/src/runtime/locations/spot-location-claims.ts +5 -34
  186. package/src/runtime/protocol/service_wire_codec.generated.ts +9 -2
  187. package/src/runtime/protocol/service_wire_pilot_codec.generated.ts +4 -4
  188. package/src/runtime/spots/formal-remote-actor-admission-registry.ts +6 -6
  189. package/src/runtime/spots/formal-remote-actor-transfer-registry.ts +3 -3
  190. package/src/runtime/spots/index.ts +341 -295
  191. package/src/runtime/spots/spot-activation-registry.ts +41 -31
  192. package/src/runtime/spots/spot-activation-state.ts +4 -16
  193. package/src/runtime/spots/spot-activation.ts +102 -80
  194. package/src/runtime/spots/spot-actor-admission-coordinator.ts +2 -2
  195. package/src/runtime/spots/spot-actor-join-dispatch.ts +6 -7
  196. package/src/runtime/spots/spot-actor-lifecycle-drain.ts +20 -18
  197. package/src/runtime/spots/spot-actor-membership.ts +81 -17
  198. package/src/runtime/spots/spot-entry-activation.ts +0 -3
  199. package/src/runtime/spots/spot-manager-public.ts +8 -4
  200. package/src/runtime/spots/spot-native-actor-join-admission.ts +2 -2
  201. package/src/runtime/spots/spot-node-runtime-manager.ts +12 -18
  202. package/src/runtime/spots/spot-outbound.ts +4 -47
  203. package/src/runtime/spots/spot-routed-actor-admission.ts +20 -0
  204. package/src/runtime/spots/spot-routed-frame-dispatch.ts +6 -76
  205. package/src/runtime/spots/spot-runtime-ports.ts +6 -17
  206. package/src/runtime/spots/spot-serial-executor.ts +9 -1
  207. package/src/runtime/spots/spot-serial-turn-executor.ts +10 -4
  208. package/src/runtime/streams/actor-session-binding-registry.ts +20 -308
  209. package/src/runtime/streams/actor-session-binding-runtime-owner.ts +2 -12
  210. package/src/runtime/streams/bound-session-service.ts +2 -36
  211. package/src/runtime/streams/index.ts +29 -27
  212. package/src/runtime/streams/session-serial-executor.ts +2 -2
  213. package/dist/runtime/actors/deferred-join-accepted-journal.d.ts +0 -47
  214. package/dist/runtime/actors/deferred-join-accepted-journal.js +0 -992
  215. package/src/runtime/actors/deferred-join-accepted-journal.ts +0 -1346
@@ -1,11 +1,5 @@
1
1
  import type { ZLinkFanoutPublishCall } from './Calls';
2
- export interface ZLinkFanoutListenerStatus {
3
- readonly channelName: string;
4
- readonly endpoint: string;
5
- readonly observedAt: Date;
6
- }
7
2
  export interface ZLinkFanoutClient {
8
3
  publish(channelName: string, event: unknown): ZLinkFanoutPublishCall;
9
4
  publish(channelName: string, topic: string, event: unknown): ZLinkFanoutPublishCall;
10
- getListenerStatus(channelName: string): ZLinkFanoutListenerStatus;
11
5
  }
@@ -123,11 +123,19 @@ export interface ZLinkHostCapacityStatus {
123
123
  }
124
124
  export interface ZLinkFrameworkRuntime {
125
125
  readonly status: ZLinkFrameworkRuntimeStatus;
126
+ getListenerStatus(kind: ZLinkListenerKind, name: string): ZLinkListenerStatus;
126
127
  observe(signal?: AbortSignal): AsyncIterable<ZLinkObservedStatus<ZLinkFrameworkRuntimeStatus>>;
127
128
  resetCapacityMetrics(): void;
128
129
  relocate(options: ZLinkFrameworkRelocationOptions): Promise<ZLinkFrameworkRelocationResult>;
129
130
  shutdown(options?: ZLinkFrameworkLifecycleOptions): Promise<ZLinkFrameworkTerminationResult>;
130
131
  }
132
+ export type ZLinkListenerKind = 'routeMesh' | 'clientServer' | 'fanout' | 'stream';
133
+ export interface ZLinkListenerStatus {
134
+ readonly kind: ZLinkListenerKind;
135
+ readonly name: string;
136
+ readonly endpoint: string;
137
+ readonly observedAt: Date;
138
+ }
131
139
  export type ZLinkClientServerRole = 'client' | 'server' | 'clientAndServer';
132
140
  export interface ZLinkClientServerTargetStatus {
133
141
  readonly nodeRid: RoutingId;
@@ -3,6 +3,7 @@ export * from './index';
3
3
  export * from './runtime/diagnostics';
4
4
  export * from './runtime/host';
5
5
  export * from './runtime/admission';
6
+ export * from './runtime/activation-admission';
6
7
  export * from './runtime/streams';
7
8
  export * from './runtime/streams/protocol';
8
9
  export * from './runtime/actors';
package/dist/internal.js CHANGED
@@ -20,6 +20,7 @@ __exportStar(require("./index"), exports);
20
20
  __exportStar(require("./runtime/diagnostics"), exports);
21
21
  __exportStar(require("./runtime/host"), exports);
22
22
  __exportStar(require("./runtime/admission"), exports);
23
+ __exportStar(require("./runtime/activation-admission"), exports);
23
24
  __exportStar(require("./runtime/streams"), exports);
24
25
  __exportStar(require("./runtime/streams/protocol"), exports);
25
26
  __exportStar(require("./runtime/actors"), exports);
@@ -0,0 +1,29 @@
1
+ /** Current activation admission count and limit of one MeshNode. */
2
+ export interface ZLinkActivationConcurrency {
3
+ readonly active: number;
4
+ readonly limit: number;
5
+ }
6
+ /**
7
+ * MeshNode §5.1 "Pending activation": the single per-MeshNode record of activation admissions.
8
+ *
9
+ * Actor creation, User Spot creation, Instance Spot cold activation and a relocation target's
10
+ * Restore each hold one admission from the moment the target MeshNode receives the operation
11
+ * until Ready or its target commit, or until it ends by rejection, failure or cleanup. Entry Spot
12
+ * and Actor Join never acquire one. The limit is enforced here, and the status current value and
13
+ * the placement `IsAvailable` headroom both read this record.
14
+ */
15
+ export declare class ZLinkActivationAdmission {
16
+ private readonly limitOf;
17
+ private readonly changed?;
18
+ private readonly records;
19
+ constructor(limitOf: (meshName: string) => number, changed?: ((meshName: string) => void) | undefined);
20
+ current(meshName: string): ZLinkActivationConcurrency;
21
+ hasHeadroom(meshName: string): boolean;
22
+ /**
23
+ * Holds one admission for `meshName`. A MeshNode without headroom does not accept a new
24
+ * admission (MeshNode §5.1): the operation fails as Unavailable at once. The returned release
25
+ * is idempotent.
26
+ */
27
+ acquire(meshName: string, signal?: AbortSignal): Promise<() => void>;
28
+ private record;
29
+ }
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ZLinkActivationAdmission = void 0;
4
+ const framework_errors_internal_1 = require("./framework-errors-internal");
5
+ /**
6
+ * MeshNode §5.1 "Pending activation": the single per-MeshNode record of activation admissions.
7
+ *
8
+ * Actor creation, User Spot creation, Instance Spot cold activation and a relocation target's
9
+ * Restore each hold one admission from the moment the target MeshNode receives the operation
10
+ * until Ready or its target commit, or until it ends by rejection, failure or cleanup. Entry Spot
11
+ * and Actor Join never acquire one. The limit is enforced here, and the status current value and
12
+ * the placement `IsAvailable` headroom both read this record.
13
+ */
14
+ class ZLinkActivationAdmission {
15
+ limitOf;
16
+ changed;
17
+ records = new Map();
18
+ constructor(limitOf, changed) {
19
+ this.limitOf = limitOf;
20
+ this.changed = changed;
21
+ }
22
+ current(meshName) {
23
+ const record = this.records.get(meshName);
24
+ return { active: record?.active ?? 0, limit: record?.limit ?? this.limitOf(meshName) };
25
+ }
26
+ hasHeadroom(meshName) {
27
+ const { active, limit } = this.current(meshName);
28
+ return active < limit;
29
+ }
30
+ /**
31
+ * Holds one admission for `meshName`. A MeshNode without headroom does not accept a new
32
+ * admission (MeshNode §5.1): the operation fails as Unavailable at once. The returned release
33
+ * is idempotent.
34
+ */
35
+ async acquire(meshName, signal) {
36
+ signal?.throwIfAborted();
37
+ const record = this.record(meshName);
38
+ if (record.active >= record.limit) {
39
+ throw (0, framework_errors_internal_1.createInternalFrameworkException)(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.PlacementCapacityExhausted, `MeshNode '${meshName}' has no activation admission headroom.`);
40
+ }
41
+ record.active += 1;
42
+ this.changed?.(meshName);
43
+ let released = false;
44
+ return () => {
45
+ if (released)
46
+ return;
47
+ released = true;
48
+ record.active -= 1;
49
+ this.changed?.(meshName);
50
+ };
51
+ }
52
+ record(meshName) {
53
+ let record = this.records.get(meshName);
54
+ if (record === undefined) {
55
+ record = { meshName, limit: this.limitOf(meshName), active: 0 };
56
+ this.records.set(meshName, record);
57
+ }
58
+ return record;
59
+ }
60
+ }
61
+ exports.ZLinkActivationAdmission = ZLinkActivationAdmission;
@@ -146,7 +146,7 @@ class DefaultZLinkActorJoinSpotCall {
146
146
  discarded = true;
147
147
  this.state.endDeferredJoin();
148
148
  try {
149
- await this.coordinator.abortDeferredJoin?.(this.actor, this.state, operationId);
149
+ await this.coordinator.abortDeferredJoin?.(this.actor, this.state);
150
150
  }
151
151
  finally {
152
152
  deadline.close();
@@ -164,7 +164,7 @@ class DefaultZLinkActorJoinSpotCall {
164
164
  // The provisional ingress fence is installed only after the
165
165
  // handler terminal. Target admission starts before reply encoding,
166
166
  // while completion and finalization remain in execute().
167
- this.coordinator.beginDeferredJoin?.(this.actor, this.state, operationId);
167
+ this.coordinator.beginDeferredJoin?.(this.actor, this.state);
168
168
  pendingJoin = this.coordinator.joinSpot(this.actor, this.state, this.spotId, requestMessage, remainingJoinTimeout(deadline.atMs), deadline.signal, operationId);
169
169
  if (this.turn === undefined) {
170
170
  await pendingJoin.catch(() => undefined);
@@ -189,7 +189,7 @@ class DefaultZLinkActorJoinSpotCall {
189
189
  catch (error) {
190
190
  this.state.endDeferredJoin();
191
191
  await this.coordinator
192
- .abortDeferredJoin?.(this.actor, this.state, operationId)
192
+ .abortDeferredJoin?.(this.actor, this.state)
193
193
  .catch(() => undefined);
194
194
  await notifyJoinFailure(this.actor, operationId, error, this.coordinator);
195
195
  return;
@@ -271,7 +271,7 @@ class DefaultZLinkActorJoinEntrySpotCall {
271
271
  discarded = true;
272
272
  this.state.endDeferredJoin();
273
273
  try {
274
- await this.coordinator.abortDeferredJoin?.(this.actor, this.state, operationId);
274
+ await this.coordinator.abortDeferredJoin?.(this.actor, this.state);
275
275
  }
276
276
  finally {
277
277
  deadline.close();
@@ -286,7 +286,7 @@ class DefaultZLinkActorJoinEntrySpotCall {
286
286
  prepared = true;
287
287
  this.state.endDeferredJoin();
288
288
  try {
289
- this.coordinator.beginDeferredJoin?.(this.actor, this.state, operationId);
289
+ this.coordinator.beginDeferredJoin?.(this.actor, this.state);
290
290
  pendingJoin = this.coordinator.joinEntrySpot(this.actor, this.state, undefined, requestMessage, remainingJoinTimeout(deadline.atMs), deadline.signal, operationId);
291
291
  if (this.turn === undefined) {
292
292
  await pendingJoin.catch(() => undefined);
@@ -311,7 +311,7 @@ class DefaultZLinkActorJoinEntrySpotCall {
311
311
  catch (error) {
312
312
  this.state.endDeferredJoin();
313
313
  await this.coordinator
314
- .abortDeferredJoin?.(this.actor, this.state, operationId)
314
+ .abortDeferredJoin?.(this.actor, this.state)
315
315
  .catch(() => undefined);
316
316
  await notifyJoinFailure(this.actor, operationId, error, this.coordinator);
317
317
  return;
@@ -115,14 +115,14 @@ export declare class ZLinkActorHandoffCoordinator {
115
115
  private readonly replyRoutes;
116
116
  constructor(options: ZLinkActorHandoffCoordinatorOptions);
117
117
  begin(actorId: string, oldGeneration: bigint): void;
118
- beginProvisional(actorId: string, operationId: string, oldGeneration: bigint): void;
118
+ beginProvisional(actorId: string, oldGeneration: bigint): void;
119
119
  private startHandoff;
120
120
  isActive(actorId: string): boolean;
121
121
  isProvisional(actorId: string): boolean;
122
- promoteProvisional(actorId: string, operationId: string): void;
122
+ promoteProvisional(actorId: string): void;
123
123
  sealConnectionBoundIngress(actorId: string): void;
124
124
  activeSourceOwner(actorId: string): ZLinkActorMessageFollowOwnerFence | undefined;
125
- releaseDeferred(actorId: string, operationId: string, dispatch?: ZLinkActorHandoffDispatch, admission?: ZLinkActorHandoffReplayAdmission): Promise<void>;
125
+ releaseDeferred(actorId: string, dispatch?: ZLinkActorHandoffDispatch, admission?: ZLinkActorHandoffReplayAdmission): Promise<void>;
126
126
  releaseCanceled(actorId: string, dispatch: ZLinkActorHandoffDispatch, admission?: ZLinkActorHandoffReplayAdmission): Promise<void>;
127
127
  private admitHandoffPrefix;
128
128
  private admitPendingPrefix;
@@ -134,6 +134,12 @@ export declare class ZLinkActorHandoffCoordinator {
134
134
  private replayReleasedBacklog;
135
135
  private replayReleasedPending;
136
136
  private failReleasedPending;
137
+ /**
138
+ * Expired-owner terminal of a relocation (spec 28 §4.4): every pending
139
+ * record without a terminal fails once with `reason`. The handoff stays
140
+ * active, so the source never dispatches the Actor again.
141
+ */
142
+ failPending(actorId: string, reason: unknown): void;
137
143
  cancel(actorId: string): void;
138
144
  capture(actorId: string, parts: readonly Message[], returnResponse?: boolean, remoteBoundSessionTarget?: ZLinkRemoteBoundSessionTarget, fallbackActorRef?: ActorRef, deadlineUnixMs?: number, messageFollowOrigin?: ZLinkMessageFollowOrigin, provisionalReplay?: ZLinkActorHandoffDispatch): Promise<unknown> | undefined;
139
145
  snapshot(actorId: string): readonly ZLinkActorHandoffPacket[];
@@ -50,12 +50,12 @@ class ZLinkActorHandoffCoordinator {
50
50
  options.messageFollowDurationMs ?? exports.DEFAULT_MESSAGE_FOLLOW_DURATION_MS;
51
51
  }
52
52
  begin(actorId, oldGeneration) {
53
- this.startHandoff(actorId, oldGeneration, { phase: 'relocating' });
53
+ this.startHandoff(actorId, oldGeneration, 'relocating');
54
54
  }
55
- beginProvisional(actorId, operationId, oldGeneration) {
56
- this.startHandoff(actorId, oldGeneration, { phase: 'provisional', operationId });
55
+ beginProvisional(actorId, oldGeneration) {
56
+ this.startHandoff(actorId, oldGeneration, 'provisional');
57
57
  }
58
- startHandoff(actorId, oldGeneration, transition) {
58
+ startHandoff(actorId, oldGeneration, phase) {
59
59
  if (this.active.has(actorId)) {
60
60
  throw new Error(`Actor '${actorId}' already has an active packet handoff.`);
61
61
  }
@@ -98,8 +98,8 @@ class ZLinkActorHandoffCoordinator {
98
98
  oldNodeRidHex: sourceEvidence.nodeRidHex,
99
99
  sourceEvidence,
100
100
  sourceOwner,
101
- phase: transition.phase,
102
- ...(transition.phase === 'provisional' ? { operationId: transition.operationId } : {}),
101
+ phase,
102
+ deferredJoin: phase === 'provisional',
103
103
  connectionBoundSealed: false,
104
104
  pending: [],
105
105
  nextIndex: 0,
@@ -113,14 +113,11 @@ class ZLinkActorHandoffCoordinator {
113
113
  isProvisional(actorId) {
114
114
  return this.active.get(actorId)?.phase === 'provisional';
115
115
  }
116
- promoteProvisional(actorId, operationId) {
116
+ promoteProvisional(actorId) {
117
117
  const handoff = this.active.get(actorId);
118
- if (handoff === undefined) {
118
+ if (handoff?.phase !== 'provisional') {
119
119
  throw new Error(`Actor '${actorId}' does not have a provisional packet handoff.`);
120
120
  }
121
- if (handoff.phase !== 'provisional' || handoff.operationId !== operationId) {
122
- throw new Error(`Actor '${actorId}' packet handoff belongs to another operation.`);
123
- }
124
121
  handoff.phase = 'relocating';
125
122
  }
126
123
  sealConnectionBoundIngress(actorId) {
@@ -131,12 +128,12 @@ class ZLinkActorHandoffCoordinator {
131
128
  activeSourceOwner(actorId) {
132
129
  return this.active.get(actorId)?.sourceOwner;
133
130
  }
134
- async releaseDeferred(actorId, operationId, dispatch, admission) {
131
+ async releaseDeferred(actorId, dispatch, admission) {
135
132
  const handoff = this.active.get(actorId);
136
133
  if (handoff === undefined)
137
134
  return;
138
- if (handoff.operationId !== operationId) {
139
- throw new Error(`Actor '${actorId}' packet handoff belongs to another operation.`);
135
+ if (!handoff.deferredJoin) {
136
+ throw new Error(`Actor '${actorId}' packet handoff was not started by a deferred Join.`);
140
137
  }
141
138
  await this.releaseHandoff(actorId, handoff, dispatch ?? handoff.replay, admission);
142
139
  }
@@ -153,12 +150,12 @@ class ZLinkActorHandoffCoordinator {
153
150
  *
154
151
  * @internal
155
152
  */
156
- admitDeferredPrefix(actorId, operationId, queue, preparation, start = Promise.resolve()) {
153
+ admitDeferredPrefix(actorId, queue, preparation, start = Promise.resolve()) {
157
154
  const handoff = this.active.get(actorId);
158
155
  if (handoff === undefined)
159
156
  return { terminal: Promise.resolve() };
160
- if (handoff.operationId !== operationId) {
161
- throw new Error(`Actor '${actorId}' packet handoff belongs to another operation.`);
157
+ if (!handoff.deferredJoin) {
158
+ throw new Error(`Actor '${actorId}' packet handoff was not started by a deferred Join.`);
162
159
  }
163
160
  return this.admitHandoffPrefix(actorId, handoff, queue, preparation, start);
164
161
  }
@@ -396,6 +393,20 @@ class ZLinkActorHandoffCoordinator {
396
393
  }
397
394
  pending.reject?.(error);
398
395
  }
396
+ /**
397
+ * Expired-owner terminal of a relocation (spec 28 §4.4): every pending
398
+ * record without a terminal fails once with `reason`. The handoff stays
399
+ * active, so the source never dispatches the Actor again.
400
+ */
401
+ failPending(actorId, reason) {
402
+ const handoff = this.active.get(actorId);
403
+ if (handoff === undefined)
404
+ return;
405
+ for (const pending of handoff.pending.splice(0))
406
+ this.failReleasedPending(pending, reason);
407
+ handoff.snapshotIndex = -1;
408
+ handoff.pendingBytes = 0;
409
+ }
399
410
  cancel(actorId) {
400
411
  const handoff = this.active.get(actorId);
401
412
  if (handoff === undefined)
@@ -193,7 +193,7 @@ class ZLinkLocalNativeActorJoin {
193
193
  // (spec 32-framework-error-model:83-118); an OK terminal with no join
194
194
  // control is a protocol violation.
195
195
  throw admission.terminalResult !== 0 || admission.failureErrno !== 0
196
- ? remoteActorJoinFailureException(node, target, admission.terminalResult, admission.failureErrno, message)
196
+ ? (0, framework_errors_internal_1.wireReplyFailureException)(admission.terminalResult, admission.failureErrno, message)
197
197
  : (0, framework_errors_internal_1.createInternalFrameworkException)(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.RequestProtocolError, message);
198
198
  }
199
199
  if (control.joinResult !== 0) {
@@ -210,7 +210,7 @@ class ZLinkLocalNativeActorJoin {
210
210
  }
211
211
  if (admission.terminalResult !== 0 || admission.failureErrno !== 0) {
212
212
  (0, mesh_completion_table_1.closeMeshCompletion)(admission);
213
- throw remoteActorJoinFailureException(node, target, admission.terminalResult, admission.failureErrno, `Actor admission failed for '${actor.context.actorId}' with result '${admission.terminalResult}' and errno '${admission.failureErrno}'.`);
213
+ throw (0, framework_errors_internal_1.wireReplyFailureException)(admission.terminalResult, admission.failureErrno, `Actor admission failed for '${actor.context.actorId}' with result '${admission.terminalResult}' and errno '${admission.failureErrno}'.`);
214
214
  }
215
215
  disposeParts(admission.parts.slice(1));
216
216
  if (control.canonicalHandoffId !== undefined) {
@@ -359,22 +359,6 @@ function canonicalHandoffRelocationId(handoffId) {
359
359
  return (`${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}` +
360
360
  `-${hex.slice(16, 20)}-${hex.slice(20)}`);
361
361
  }
362
- function remoteActorJoinFailureException(node, target, terminalResult, failureErrno, message) {
363
- const failure = (0, framework_errors_internal_1.wireReplyFailureException)(terminalResult, failureErrno, message);
364
- const targetGeneration = target.targetNodeGeneration;
365
- if (failure.kind === contracts_1.ZLinkFrameworkErrorKind.DeadlineExceeded &&
366
- targetGeneration !== undefined &&
367
- targetGeneration !== 0n &&
368
- !node
369
- .peers()
370
- .some((peer) => peer.state === 3 &&
371
- peer.routingId !== null &&
372
- (0, routing_id_2.routingIdsEqual)(peer.routingId, target.targetNodeRid) &&
373
- peer.lifecycleGeneration === targetGeneration)) {
374
- return (0, framework_errors_internal_1.createInternalFrameworkException)(framework_errors_internal_1.ZLinkFrameworkInternalErrorKind.RouteNotConnected, 'wire Actor join target RouteMesh peer became unavailable');
375
- }
376
- return failure;
377
- }
378
362
  function runtimeActorMeshName(actor, state, fallback) {
379
363
  const context = actor.context;
380
364
  const stateMeshName = state?.meshName;
@@ -28,8 +28,8 @@ export declare class ZLinkActorNativeJoinCoordinator implements ZLinkActorJoinCo
28
28
  private readonly localJoin;
29
29
  messageFlow(): import('../diagnostics/message-flow').ZLinkMessageFlowTracer | undefined;
30
30
  constructor(options: ZLinkActorNativeJoinCoordinatorOptions);
31
- beginDeferredJoin(actor: ZLinkActor, state: ZLinkActorRuntimeState, operationId: import('../../contracts').ZLinkActorJoinOperationId): void;
32
- abortDeferredJoin(actor: ZLinkActor, state: ZLinkActorRuntimeState, operationId: import('../../contracts').ZLinkActorJoinOperationId): Promise<void>;
31
+ beginDeferredJoin(actor: ZLinkActor, state: ZLinkActorRuntimeState): void;
32
+ abortDeferredJoin(actor: ZLinkActor, state: ZLinkActorRuntimeState): Promise<void>;
33
33
  joinSpot(actor: ZLinkActor, state: ZLinkActorRuntimeState, spotId: RoutingId, request: Message, timeoutMs: number | undefined, signal: AbortSignal | undefined, completionOperationId?: import('../../contracts').ZLinkActorJoinOperationId): Promise<ZLinkActorJoinRuntimeResult<Message>>;
34
34
  joinEntrySpot(actor: ZLinkActor, state: ZLinkActorRuntimeState, nodeRid: RoutingId | undefined, request: Message, timeoutMs: number | undefined, signal: AbortSignal | undefined, completionOperationId?: import('../../contracts').ZLinkActorJoinOperationId): Promise<ZLinkActorJoinRuntimeResult<Message>>;
35
35
  private withDeferredJoinFinalizer;
@@ -7,7 +7,6 @@ const actor_native_lookup_1 = require("./actor-native-lookup");
7
7
  const post_commit_actor_location_1 = require("./post-commit-actor-location");
8
8
  const actor_local_native_join_1 = require("./actor-local-native-join");
9
9
  const post_commit_actor_binder_1 = require("./post-commit-actor-binder");
10
- const operation_identity_1 = require("../foundation/operation-identity");
11
10
  /** Selects local native join or remote two-phase transfer for each destination. */
12
11
  class ZLinkActorNativeJoinCoordinator {
13
12
  options;
@@ -38,11 +37,11 @@ class ZLinkActorNativeJoinCoordinator {
38
37
  messageSerializers: options.messageSerializers
39
38
  });
40
39
  }
41
- beginDeferredJoin(actor, state, operationId) {
42
- this.options.sourceTransfer?.beginDeferredActorHandoff?.(actor, state, (0, operation_identity_1.operationIdentityKey)(operationId));
40
+ beginDeferredJoin(actor, state) {
41
+ this.options.sourceTransfer?.beginDeferredActorHandoff?.(actor, state);
43
42
  }
44
- async abortDeferredJoin(actor, state, operationId) {
45
- await this.options.sourceTransfer?.cancelDeferredActorHandoff?.(actor, state, (0, operation_identity_1.operationIdentityKey)(operationId));
43
+ async abortDeferredJoin(actor, state) {
44
+ await this.options.sourceTransfer?.cancelDeferredActorHandoff?.(actor, state);
46
45
  }
47
46
  async joinSpot(actor, state, spotId, request, timeoutMs, signal, completionOperationId) {
48
47
  (0, abort_1.throwIfAborted)(signal);
@@ -85,15 +84,14 @@ class ZLinkActorNativeJoinCoordinator {
85
84
  withDeferredJoinFinalizer(actor, state, target, result, operationId) {
86
85
  if (operationId === undefined || this.options.sourceTransfer === undefined)
87
86
  return result;
88
- const key = (0, operation_identity_1.operationIdentityKey)(operationId);
89
87
  return {
90
88
  ...result,
91
89
  finalizeDeferredJoin: async () => {
92
90
  if (result.accepted && result.actor !== undefined && target !== undefined) {
93
- await this.options.sourceTransfer.completeDeferredActorHandoff?.(actor, target, result.actor, key);
91
+ await this.options.sourceTransfer.completeDeferredActorHandoff?.(actor, target, result.actor);
94
92
  }
95
93
  else {
96
- await this.options.sourceTransfer.cancelDeferredActorHandoff?.(actor, state, key);
94
+ await this.options.sourceTransfer.cancelDeferredActorHandoff?.(actor, state);
97
95
  }
98
96
  }
99
97
  };
@@ -6,6 +6,7 @@ import type { ZLinkLocationLifecycle } from '../locations';
6
6
  import type { ZLinkActorRuntimeState } from './actor-runtime-state';
7
7
  import type { ZLinkActorTransferRegistry } from './actor-transfer-registry';
8
8
  import type { ZLinkRuntimeAdmissionGate } from '../admission';
9
+ import type { ZLinkActivationAdmission } from '../activation-admission';
9
10
  export interface ZLinkActorJoinRuntimeResult<TReply> {
10
11
  readonly accepted: boolean;
11
12
  readonly actor?: import('../../contracts').ActorRef;
@@ -34,6 +35,7 @@ export interface ZLinkActorManagerOptions {
34
35
  readonly shutdownSignal?: AbortSignal;
35
36
  readonly metrics?: import('../diagnostics').ZLinkRuntimeMetrics;
36
37
  readonly admission?: ZLinkRuntimeAdmissionGate;
38
+ readonly activationAdmission?: ZLinkActivationAdmission;
37
39
  readonly placementCreate?: (actorId: string, actorType: string, createOnly: boolean, options: {
38
40
  readonly meshName?: string;
39
41
  readonly request?: unknown;
@@ -56,8 +58,8 @@ export interface ZLinkActorJoinCoordinator {
56
58
  * lookup. This is an internal ordering fence; it is not part of the public
57
59
  * actor context contract.
58
60
  */
59
- beginDeferredJoin?(actor: ZLinkActor, state: ZLinkActorRuntimeState, operationId: import('../../contracts').ZLinkActorJoinOperationId): void;
60
- abortDeferredJoin?(actor: ZLinkActor, state: ZLinkActorRuntimeState, operationId: import('../../contracts').ZLinkActorJoinOperationId): Promise<void>;
61
+ beginDeferredJoin?(actor: ZLinkActor, state: ZLinkActorRuntimeState): void;
62
+ abortDeferredJoin?(actor: ZLinkActor, state: ZLinkActorRuntimeState): Promise<void>;
61
63
  joinSpot(actor: ZLinkActor, state: ZLinkActorRuntimeState, spotId: RoutingId, request: Message, timeoutMs: number | undefined, signal: AbortSignal | undefined, completionOperationId?: import('../../contracts').ZLinkActorJoinOperationId): Promise<ZLinkActorJoinRuntimeResult<Message>>;
62
64
  joinEntrySpot(actor: ZLinkActor, state: ZLinkActorRuntimeState, nodeRid: RoutingId | undefined, request: Message, timeoutMs: number | undefined, signal: AbortSignal | undefined, completionOperationId?: import('../../contracts').ZLinkActorJoinOperationId): Promise<ZLinkActorJoinRuntimeResult<Message>>;
63
65
  }
@@ -16,12 +16,12 @@ export interface ZLinkPreparedActorSource {
16
16
  }
17
17
  export interface ZLinkActorSourceTransfer {
18
18
  /** Starts the ingress handoff before target route lookup. */
19
- beginDeferredActorHandoff?(actor: ZLinkActor, state: ZLinkActorRuntimeState, operationId: string): void;
19
+ beginDeferredActorHandoff?(actor: ZLinkActor, state: ZLinkActorRuntimeState): void;
20
20
  /** Changes a provisional ingress fence into a relocation handoff. */
21
- promoteDeferredActorHandoff?(actor: ZLinkActor, state: ZLinkActorRuntimeState, operationId: string): void;
21
+ promoteDeferredActorHandoff?(actor: ZLinkActor, state: ZLinkActorRuntimeState): void;
22
22
  /** Finishes a same-node deferred Join handoff after completion callback. */
23
- completeDeferredActorHandoff?(actor: ZLinkActor, target: ZLinkSpotRouteTarget, targetActorRef: ActorRef, operationId: string): Promise<void>;
23
+ completeDeferredActorHandoff?(actor: ZLinkActor, target: ZLinkSpotRouteTarget, targetActorRef: ActorRef): Promise<void>;
24
24
  /** Releases an early handoff when Join cannot commit. */
25
- cancelDeferredActorHandoff?(actor: ZLinkActor, state: ZLinkActorRuntimeState, operationId: string): Promise<void>;
26
- prepareSource(actor: ZLinkActor, state: ZLinkActorRuntimeState, signal?: AbortSignal, lifecycleAuthority?: 'framework' | 'core', deferredOperationId?: string, relocation?: ServiceWireOperationId): Promise<ZLinkPreparedActorSource>;
25
+ cancelDeferredActorHandoff?(actor: ZLinkActor, state: ZLinkActorRuntimeState): Promise<void>;
26
+ prepareSource(actor: ZLinkActor, state: ZLinkActorRuntimeState, signal?: AbortSignal, lifecycleAuthority?: 'framework' | 'core', deferredJoin?: boolean, relocation?: ServiceWireOperationId): Promise<ZLinkPreparedActorSource>;
27
27
  }
@@ -0,0 +1,14 @@
1
+ import type { ActorRef, ZLinkActorJoinOperationId } from '../../contracts';
2
+ /**
3
+ * The Accepted completion of a deferred cross-node Join. Spot Actor membership
4
+ * sections 4-5: the public OperationId, the optional reply and the delivery
5
+ * state live only while the current source and target processes run. The
6
+ * completion is never written to a Store and never replayed after a restart.
7
+ */
8
+ export interface ZLinkDeferredJoinCompletion {
9
+ readonly operationId: ZLinkActorJoinOperationId;
10
+ readonly actor: ActorRef;
11
+ readonly rawReply: Buffer;
12
+ readonly replyContentType?: string;
13
+ }
14
+ export declare function createDeferredJoinCompletion(actorId: string, operationId: ZLinkActorJoinOperationId, actor: ActorRef, rawReply: Uint8Array, replyContentType?: string): ZLinkDeferredJoinCompletion;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createDeferredJoinCompletion = createDeferredJoinCompletion;
4
+ function createDeferredJoinCompletion(actorId, operationId, actor, rawReply, replyContentType) {
5
+ if (actorId.length === 0 ||
6
+ actor.actorId !== actorId ||
7
+ actor.objectGeneration <= 0n ||
8
+ (operationId.high === 0n && operationId.low === 0n)) {
9
+ throw new Error('Deferred Join completion identity is invalid.');
10
+ }
11
+ if (replyContentType !== undefined && replyContentType.length === 0) {
12
+ throw new TypeError('Deferred Join reply content type must be non-empty.');
13
+ }
14
+ return {
15
+ operationId,
16
+ actor,
17
+ rawReply: Buffer.from(rawReply),
18
+ ...(replyContentType === undefined ? {} : { replyContentType })
19
+ };
20
+ }
@@ -7,7 +7,7 @@ export { ZLinkActorSerialExecutor } from './actor-mailbox';
7
7
  export { DEFAULT_MESSAGE_FOLLOW_DURATION_MS, ZLinkActorHandoffCoordinator, decodeHandoffPacket, type ZLinkActorHandoffPacket, type ZLinkActorHandoffDispatch, type ZLinkActorHandoffPrefixAdmission, type ZLinkActorHandoffPrefixQueue, type ZLinkActorHandoffPrefixRecord, type ZLinkActorHandoffPreparedReplayAdmission, type ZLinkActorHandoffReplayAdmission, type ZLinkActorHandoffReplayPreparation, type ZLinkActorHandoffResult } from './actor-handoff';
8
8
  export { actorMessageFollowContext, attachActorMessageFollowContext, decodeActorMessageFollowContext, type ZLinkActorMessageFollowContext, type ZLinkActorMessageFollowOwnerFence } from './actor-message-follow-context';
9
9
  export { ZLinkActorRuntimeState, mergeRemoteBoundSessionTarget, preferredRemoteBoundSessionTarget, toFrameworkActorRef, toFrameworkRoutingId, type ZLinkActorCreationOperation, type ZLinkRemoteActorPacketTarget, type ZLinkRemoteBoundSessionTarget } from './actor-runtime-state';
10
- export { isDeferredJoinAcceptedRootPublication, ZLinkDeferredJoinAcceptedJournal, type ZLinkDeferredJoinAcceptedRoot, type ZLinkDeferredJoinRootIdentity, type ZLinkDeferredJoinDeliveryCursor } from './deferred-join-accepted-journal';
10
+ export { createDeferredJoinCompletion, type ZLinkDeferredJoinCompletion } from './deferred-join-completion';
11
11
  export { decodeActorAuthorityIdentity, decodeRelocatingActorAuthorityIdentity, encodeActorAuthorityIdentity, isActorAuthorityPayload, rewriteActorAuthorityRoute, rewriteActorAuthorityOwner, publishInitialActorAuthority, type ZLinkActorAuthorityIdentity } from './actor-authority-publication';
12
12
  import { ZLinkActorRuntimeState } from './actor-runtime-state';
13
13
  export { ZLinkActorPacketKind, ZLinkSpotActorDispatcher, ZLinkSpotActorHandlerRegistryRuntime, type ZLinkActorPacketDescriptor, type ZLinkSpotActorDispatcherOptions } from './spot-actor-dispatch';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DefaultZLinkActorManager = exports.ZLINK_ACTOR_LIFECYCLE_SNAPSHOT = exports.createActorMembership = exports.createActorJoinRequest = exports.actorJoinIdentity = exports.ZLinkRemoteBoundSessionFenceError = exports.isRemoteBoundSessionFenceError = exports.encodeRemoteBoundSessionNack = exports.ZLINK_REMOTE_BOUND_SESSION_SEND_PACKET = exports.ZLINK_REMOTE_BOUND_SESSION_RESPONSE_PACKET = exports.ZLINK_REMOTE_BOUND_SESSION_FENCE_NACK_CODE = exports.ZLINK_REMOTE_BOUND_SESSION_ERROR_PACKET = exports.ZLINK_REMOTE_ACTOR_SESSION_DISCONNECTED_PACKET = exports.ZLINK_REMOTE_ACTOR_PACKET_RELAY_PACKET = exports.decodeRemoteActorSourceLeaveTerminal = exports.ZLINK_REMOTE_ACTOR_SOURCE_LEAVE_TERMINAL = exports.ZLINK_REMOTE_ACTOR_JOIN_PACKET = exports.ZLinkActorTransferRegistry = exports.ZLinkActorNativeJoinCoordinator = exports.ZLinkSpotActorHandlerRegistryRuntime = exports.ZLinkSpotActorDispatcher = exports.ZLinkActorPacketKind = exports.publishInitialActorAuthority = exports.rewriteActorAuthorityOwner = exports.rewriteActorAuthorityRoute = exports.isActorAuthorityPayload = exports.encodeActorAuthorityIdentity = exports.decodeRelocatingActorAuthorityIdentity = exports.decodeActorAuthorityIdentity = exports.ZLinkDeferredJoinAcceptedJournal = exports.isDeferredJoinAcceptedRootPublication = exports.toFrameworkRoutingId = exports.toFrameworkActorRef = exports.preferredRemoteBoundSessionTarget = exports.mergeRemoteBoundSessionTarget = exports.ZLinkActorRuntimeState = exports.decodeActorMessageFollowContext = exports.attachActorMessageFollowContext = exports.actorMessageFollowContext = exports.decodeHandoffPacket = exports.ZLinkActorHandoffCoordinator = exports.DEFAULT_MESSAGE_FOLLOW_DURATION_MS = exports.ZLinkActorSerialExecutor = exports.ZLINK_ACTOR_JOIN_ENTRY_SPOT_RUNTIME = exports.DefaultZLinkActorContext = exports.forwardEncodedActorPacket = exports.DefaultZLinkActorClient = void 0;
3
+ exports.DefaultZLinkActorManager = exports.ZLINK_ACTOR_LIFECYCLE_SNAPSHOT = exports.createActorMembership = exports.createActorJoinRequest = exports.actorJoinIdentity = exports.ZLinkRemoteBoundSessionFenceError = exports.isRemoteBoundSessionFenceError = exports.encodeRemoteBoundSessionNack = exports.ZLINK_REMOTE_BOUND_SESSION_SEND_PACKET = exports.ZLINK_REMOTE_BOUND_SESSION_RESPONSE_PACKET = exports.ZLINK_REMOTE_BOUND_SESSION_FENCE_NACK_CODE = exports.ZLINK_REMOTE_BOUND_SESSION_ERROR_PACKET = exports.ZLINK_REMOTE_ACTOR_SESSION_DISCONNECTED_PACKET = exports.ZLINK_REMOTE_ACTOR_PACKET_RELAY_PACKET = exports.decodeRemoteActorSourceLeaveTerminal = exports.ZLINK_REMOTE_ACTOR_SOURCE_LEAVE_TERMINAL = exports.ZLINK_REMOTE_ACTOR_JOIN_PACKET = exports.ZLinkActorTransferRegistry = exports.ZLinkActorNativeJoinCoordinator = exports.ZLinkSpotActorHandlerRegistryRuntime = exports.ZLinkSpotActorDispatcher = exports.ZLinkActorPacketKind = exports.publishInitialActorAuthority = exports.rewriteActorAuthorityOwner = exports.rewriteActorAuthorityRoute = exports.isActorAuthorityPayload = exports.encodeActorAuthorityIdentity = exports.decodeRelocatingActorAuthorityIdentity = exports.decodeActorAuthorityIdentity = exports.createDeferredJoinCompletion = exports.toFrameworkRoutingId = exports.toFrameworkActorRef = exports.preferredRemoteBoundSessionTarget = exports.mergeRemoteBoundSessionTarget = exports.ZLinkActorRuntimeState = exports.decodeActorMessageFollowContext = exports.attachActorMessageFollowContext = exports.actorMessageFollowContext = exports.decodeHandoffPacket = exports.ZLinkActorHandoffCoordinator = exports.DEFAULT_MESSAGE_FOLLOW_DURATION_MS = exports.ZLinkActorSerialExecutor = exports.ZLINK_ACTOR_JOIN_ENTRY_SPOT_RUNTIME = exports.DefaultZLinkActorContext = exports.forwardEncodedActorPacket = exports.DefaultZLinkActorClient = void 0;
4
4
  const framework_errors_internal_1 = require("../framework-errors-internal");
5
5
  const contracts_1 = require("../../contracts");
6
6
  const runtime_message_1 = require("../backend/runtime-message");
@@ -34,9 +34,8 @@ Object.defineProperty(exports, "mergeRemoteBoundSessionTarget", { enumerable: tr
34
34
  Object.defineProperty(exports, "preferredRemoteBoundSessionTarget", { enumerable: true, get: function () { return actor_runtime_state_1.preferredRemoteBoundSessionTarget; } });
35
35
  Object.defineProperty(exports, "toFrameworkActorRef", { enumerable: true, get: function () { return actor_runtime_state_1.toFrameworkActorRef; } });
36
36
  Object.defineProperty(exports, "toFrameworkRoutingId", { enumerable: true, get: function () { return actor_runtime_state_1.toFrameworkRoutingId; } });
37
- var deferred_join_accepted_journal_1 = require("./deferred-join-accepted-journal");
38
- Object.defineProperty(exports, "isDeferredJoinAcceptedRootPublication", { enumerable: true, get: function () { return deferred_join_accepted_journal_1.isDeferredJoinAcceptedRootPublication; } });
39
- Object.defineProperty(exports, "ZLinkDeferredJoinAcceptedJournal", { enumerable: true, get: function () { return deferred_join_accepted_journal_1.ZLinkDeferredJoinAcceptedJournal; } });
37
+ var deferred_join_completion_1 = require("./deferred-join-completion");
38
+ Object.defineProperty(exports, "createDeferredJoinCompletion", { enumerable: true, get: function () { return deferred_join_completion_1.createDeferredJoinCompletion; } });
40
39
  var actor_authority_publication_1 = require("./actor-authority-publication");
41
40
  Object.defineProperty(exports, "decodeActorAuthorityIdentity", { enumerable: true, get: function () { return actor_authority_publication_1.decodeActorAuthorityIdentity; } });
42
41
  Object.defineProperty(exports, "decodeRelocatingActorAuthorityIdentity", { enumerable: true, get: function () { return actor_authority_publication_1.decodeRelocatingActorAuthorityIdentity; } });
@@ -451,7 +450,18 @@ class DefaultZLinkActorManager {
451
450
  if (request !== undefined && createRequest.nativeRequest !== undefined) {
452
451
  state.setCreateRequestPayload(createRequest.nativeRequest.data());
453
452
  }
454
- const operation = state.getOrStartCreation(actorType, failIfExists, () => this.creation.createActor(actorId, actorType, state, createRequest, claimLocation, signal));
453
+ const operation = state.getOrStartCreation(actorType, failIfExists, async () => {
454
+ const meshName = state.meshName ?? this.options.actorMeshNameProvider?.(actorType);
455
+ const release = meshName === undefined
456
+ ? undefined
457
+ : await this.options.activationAdmission?.acquire(meshName, signal);
458
+ try {
459
+ return await this.creation.createActor(actorId, actorType, state, createRequest, claimLocation, signal);
460
+ }
461
+ finally {
462
+ release?.();
463
+ }
464
+ });
455
465
  if (operation.created) {
456
466
  void operation.task.then((result) => {
457
467
  if (result.status !== 'created') {
@@ -1,7 +1,11 @@
1
1
  import { ZLinkFrameworkInternalErrorKind } from './framework-errors-internal';
2
2
  export declare class ZLinkRuntimeAdmissionGate {
3
- private readonly ownerAdmissionOpen;
3
+ readonly ownerAdmissionOpen: () => boolean;
4
4
  private readonly meshes;
5
+ /**
6
+ * Location runtime §5: the host's single new-work decision (local admission deadline and host
7
+ * execution combination). A host without a Location Store has no such block.
8
+ */
5
9
  constructor(ownerAdmissionOpen?: () => boolean);
6
10
  get acceptsNewWork(): boolean;
7
11
  register(meshName: string): void;
@@ -5,6 +5,10 @@ const framework_errors_internal_1 = require("./framework-errors-internal");
5
5
  class ZLinkRuntimeAdmissionGate {
6
6
  ownerAdmissionOpen;
7
7
  meshes = new Map();
8
+ /**
9
+ * Location runtime §5: the host's single new-work decision (local admission deadline and host
10
+ * execution combination). A host without a Location Store has no such block.
11
+ */
8
12
  constructor(ownerAdmissionOpen = () => true) {
9
13
  this.ownerAdmissionOpen = ownerAdmissionOpen;
10
14
  }