@zlink-systems/framework 0.21.0 → 0.22.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 (487) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/contracts/Common/ZLinkMessage.js +5 -5
  3. package/dist/contracts/Configuration/CodecContentType.js +5 -7
  4. package/dist/contracts/Configuration/DiagnosticsValidation.js +1 -6
  5. package/dist/contracts/Configuration/EndpointNotation.js +4 -8
  6. package/dist/contracts/Configuration/Registration.js +14 -11
  7. package/dist/contracts/Configuration/RegistrationBuilders.js +32 -25
  8. package/dist/contracts/Configuration/RegistrationNormalizers.js +25 -26
  9. package/dist/contracts/Configuration/RegistrationValidators.js +36 -38
  10. package/dist/contracts/Configuration/SendTimeoutValidation.js +4 -4
  11. package/dist/contracts/Configuration/TimerRegistrationValidator.js +7 -7
  12. package/dist/contracts/Handlers/JsonContract.js +23 -11
  13. package/dist/contracts/Spots/SpotKind.js +16 -8
  14. package/dist/location-store-integration.js +16 -16
  15. package/dist/nest-integration.js +17 -11
  16. package/dist/runtime/abort.js +9 -5
  17. package/dist/runtime/actors/actor-authority-payload-codec.js +12 -16
  18. package/dist/runtime/actors/actor-authority-publication.js +18 -17
  19. package/dist/runtime/actors/actor-client.js +83 -63
  20. package/dist/runtime/actors/actor-context.js +24 -18
  21. package/dist/runtime/actors/actor-creation.js +4 -3
  22. package/dist/runtime/actors/actor-handoff.js +89 -92
  23. package/dist/runtime/actors/actor-local-native-join.js +18 -19
  24. package/dist/runtime/actors/actor-mailbox.js +1 -1
  25. package/dist/runtime/actors/actor-message-follow-context.js +24 -21
  26. package/dist/runtime/actors/actor-packet-relay-wire.js +1 -3
  27. package/dist/runtime/actors/actor-remote-joiner.js +20 -17
  28. package/dist/runtime/actors/actor-remote-wire.js +6 -7
  29. package/dist/runtime/actors/actor-runtime-state.js +87 -81
  30. package/dist/runtime/actors/actor-transfer-registry.js +3 -5
  31. package/dist/runtime/actors/bound-session-wire.js +14 -9
  32. package/dist/runtime/actors/deferred-join-accepted-journal.js +158 -124
  33. package/dist/runtime/actors/index.js +2 -5
  34. package/dist/runtime/actors/post-commit-actor-binder.js +3 -6
  35. package/dist/runtime/actors/post-commit-actor-location.js +1 -1
  36. package/dist/runtime/actors/spot-actor-dispatch.js +5 -5
  37. package/dist/runtime/actors/transferred-actor-rollback.js +4 -4
  38. package/dist/runtime/admission.js +2 -6
  39. package/dist/runtime/application-jobs/application-ingress-record-owner.js +2 -6
  40. package/dist/runtime/application-jobs/receive-flow-controller.js +11 -12
  41. package/dist/runtime/backend/mesh-completion-table.js +1 -3
  42. package/dist/runtime/backend/mesh-dispatch-pump.js +12 -16
  43. package/dist/runtime/backend/node/node-backend-adapter-factory.js +1 -3
  44. package/dist/runtime/backend/node/node-backend-adapter-support.js +26 -17
  45. package/dist/runtime/backend/node/node-mesh-backend-adapter.js +4 -3
  46. package/dist/runtime/backend/node/node-raw-binding-port.js +7 -6
  47. package/dist/runtime/backend/node/node-raw-mesh-backend.js +116 -113
  48. package/dist/runtime/backend/node/node-socket-backend-adapter.js +12 -13
  49. package/dist/runtime/backend/runtime-message.js +3 -3
  50. package/dist/runtime/backend/runtime-values.d.ts +2 -2
  51. package/dist/runtime/backend/runtime-values.js +4 -5
  52. package/dist/runtime/channels/channel-clients.js +27 -24
  53. package/dist/runtime/channels/channel-dispatch-pipeline.js +10 -18
  54. package/dist/runtime/channels/channel-dispatch-services.js +7 -4
  55. package/dist/runtime/channels/channel-dispatchers.js +9 -9
  56. package/dist/runtime/channels/channel-envelope-inspection.js +16 -13
  57. package/dist/runtime/channels/channel-envelope.js +83 -47
  58. package/dist/runtime/channels/channel-outbound-operations.js +8 -8
  59. package/dist/runtime/channels/channel-receive-loops.js +20 -22
  60. package/dist/runtime/channels/channel-receive-task-tracker.js +1 -1
  61. package/dist/runtime/channels/channel-runtime-lifecycle.js +61 -56
  62. package/dist/runtime/channels/channel-runtime-manager.js +18 -9
  63. package/dist/runtime/channels/channel-socket-registry.js +126 -123
  64. package/dist/runtime/channels/channel-transports.js +43 -33
  65. package/dist/runtime/channels/client-server-location-runtime.js +32 -40
  66. package/dist/runtime/channels/client-server-service-wire.js +29 -22
  67. package/dist/runtime/channels/dispatch-error-reporter.js +9 -7
  68. package/dist/runtime/channels/fanout-location-runtime.js +34 -47
  69. package/dist/runtime/channels/fanout-service-wire.js +3 -5
  70. package/dist/runtime/channels/local-spot-route-transport.js +7 -1
  71. package/dist/runtime/channels/route-member-snapshot.js +3 -3
  72. package/dist/runtime/channels/source-spot-router.js +6 -2
  73. package/dist/runtime/channels/spot-route-bridge-transport.js +5 -2
  74. package/dist/runtime/channels/spot-route-dispatch-strategy.js +2 -2
  75. package/dist/runtime/channels/spot-route-target-resolver.js +6 -6
  76. package/dist/runtime/diagnostics/index.js +38 -10
  77. package/dist/runtime/diagnostics/message-flow.js +47 -39
  78. package/dist/runtime/diagnostics/runtime-metrics.js +18 -9
  79. package/dist/runtime/diagnostics/runtime-observation-queue.js +8 -10
  80. package/dist/runtime/diagnostics/topology-runtime-projections.js +17 -10
  81. package/dist/runtime/execution/index.js +7 -6
  82. package/dist/runtime/execution/serial-execution-queue.js +12 -18
  83. package/dist/runtime/execution/state-lane.js +2 -2
  84. package/dist/runtime/foundation/actor-join-recovery-codec.js +31 -23
  85. package/dist/runtime/foundation/event-loop-resources.js +4 -4
  86. package/dist/runtime/foundation/message-follow-suppression-registry.js +4 -4
  87. package/dist/runtime/foundation/raw-service-mesh-runtime.js +136 -136
  88. package/dist/runtime/foundation/route-mesh-connection-policy.js +4 -4
  89. package/dist/runtime/foundation/runtime-state-projections.js +22 -11
  90. package/dist/runtime/foundation/service-authority-payload-codec.js +13 -15
  91. package/dist/runtime/foundation/service-discovery-registry.js +35 -33
  92. package/dist/runtime/foundation/service-instance-activation-recovery-codec.js +20 -22
  93. package/dist/runtime/foundation/service-liveness-registry.js +16 -12
  94. package/dist/runtime/foundation/service-maintenance-runtime.js +2 -4
  95. package/dist/runtime/foundation/service-relocation-aggregate-committer.js +24 -24
  96. package/dist/runtime/foundation/service-relocation-object-owner.js +6 -6
  97. package/dist/runtime/foundation/service-relocation-runtime.js +137 -94
  98. package/dist/runtime/foundation/service-runtime-contracts.js +5 -5
  99. package/dist/runtime/foundation/service-stateful-registry.js +24 -23
  100. package/dist/runtime/foundation/service-stateful-runtime.js +416 -438
  101. package/dist/runtime/foundation/service-stateful-wire-codec.js +95 -98
  102. package/dist/runtime/foundation/service-topology-registry.js +96 -95
  103. package/dist/runtime/foundation/service-weighted-selection.js +6 -11
  104. package/dist/runtime/foundation/service-wire-binary-primitives.js +5 -6
  105. package/dist/runtime/foundation/service-wire-m6a-codec.js +46 -35
  106. package/dist/runtime/framework-errors-internal.js +7 -10
  107. package/dist/runtime/handlers/handler-instance-scope.js +4 -5
  108. package/dist/runtime/handlers/index.js +3 -1
  109. package/dist/runtime/host/actor-packet-relay.js +74 -70
  110. package/dist/runtime/host/actor-placement-coordinator.js +29 -31
  111. package/dist/runtime/host/actor-runtime-options-factory.js +12 -14
  112. package/dist/runtime/host/actor-transfer-authority-runtime.js +7 -9
  113. package/dist/runtime/host/actor-transfer-runtime.js +176 -153
  114. package/dist/runtime/host/application-job-queue.js +18 -22
  115. package/dist/runtime/host/bound-session-relay.js +3 -1
  116. package/dist/runtime/host/channel-runtime-options-factory.js +31 -14
  117. package/dist/runtime/host/host-capacity-status.js +8 -4
  118. package/dist/runtime/host/index.js +244 -227
  119. package/dist/runtime/host/instance-activation-authority.js +93 -96
  120. package/dist/runtime/host/location-runtime-owner.js +16 -14
  121. package/dist/runtime/host/mesh-router-resolver.js +11 -13
  122. package/dist/runtime/host/relocation-direct-transfer.js +10 -9
  123. package/dist/runtime/host/remote-actor-join-receiver.js +20 -15
  124. package/dist/runtime/host/remote-actor-packet-target-store.js +18 -22
  125. package/dist/runtime/host/remote-bound-session-relay.js +97 -73
  126. package/dist/runtime/host/route-mesh-runtime.js +64 -69
  127. package/dist/runtime/host/runtime-shutdown.js +1 -2
  128. package/dist/runtime/host/service-relocation-host-runtime.js +586 -511
  129. package/dist/runtime/host/spot-address-transport.js +69 -71
  130. package/dist/runtime/host/spot-runtime-options-factory.js +30 -29
  131. package/dist/runtime/host/stateful-authority-route-runtime.js +65 -68
  132. package/dist/runtime/host/user-spot-creation-coordinator.js +61 -67
  133. package/dist/runtime/locations/actor-location-claims.js +26 -20
  134. package/dist/runtime/locations/aggregate-inventory-store.js +72 -75
  135. package/dist/runtime/locations/authority-key-codec.js +7 -7
  136. package/dist/runtime/locations/auto-connect-loop.js +3 -3
  137. package/dist/runtime/locations/auto-connect-planner.js +25 -19
  138. package/dist/runtime/locations/auto-connect-reconciler.js +51 -31
  139. package/dist/runtime/locations/in-memory-authority-store.js +128 -118
  140. package/dist/runtime/locations/in-memory-location-store.js +195 -168
  141. package/dist/runtime/locations/in-memory-provider-location-store.js +8 -10
  142. package/dist/runtime/locations/key-codec.js +1 -1
  143. package/dist/runtime/locations/lease-tracker.js +23 -21
  144. package/dist/runtime/locations/lifecycle.js +4 -5
  145. package/dist/runtime/locations/location-store-repository.js +368 -324
  146. package/dist/runtime/locations/opaque-record-key.js +2 -2
  147. package/dist/runtime/locations/resolvers.js +73 -82
  148. package/dist/runtime/locations/runtime.js +68 -63
  149. package/dist/runtime/locations/spot-location-claims.js +39 -35
  150. package/dist/runtime/messaging/framework-json-v1.js +7 -7
  151. package/dist/runtime/messaging/packet-name.js +7 -6
  152. package/dist/runtime/messaging/payload-codec.js +21 -18
  153. package/dist/runtime/protocol/service_wire_codec.generated.d.ts +30 -2
  154. package/dist/runtime/protocol/service_wire_codec.generated.js +1671 -234
  155. package/dist/runtime/routing-id.js +3 -5
  156. package/dist/runtime/spots/formal-remote-actor-admission-registry.js +35 -31
  157. package/dist/runtime/spots/formal-remote-actor-transfer-registry.js +1 -2
  158. package/dist/runtime/spots/index.js +208 -219
  159. package/dist/runtime/spots/spot-activation-registry.js +15 -14
  160. package/dist/runtime/spots/spot-activation-state.js +17 -15
  161. package/dist/runtime/spots/spot-activation.js +33 -16
  162. package/dist/runtime/spots/spot-actor-admission-coordinator.js +18 -15
  163. package/dist/runtime/spots/spot-actor-membership.js +1 -3
  164. package/dist/runtime/spots/spot-actor-packet-dispatch.js +23 -20
  165. package/dist/runtime/spots/spot-actor-packet-drain.js +12 -10
  166. package/dist/runtime/spots/spot-actor-packet-relay-dispatch.js +10 -6
  167. package/dist/runtime/spots/spot-closing.js +3 -7
  168. package/dist/runtime/spots/spot-context.js +2 -2
  169. package/dist/runtime/spots/spot-entry-activation.js +13 -14
  170. package/dist/runtime/spots/spot-handle.js +6 -3
  171. package/dist/runtime/spots/spot-handler-registry.js +12 -12
  172. package/dist/runtime/spots/spot-manager-public.js +5 -6
  173. package/dist/runtime/spots/spot-native-actor-join-admission.js +4 -3
  174. package/dist/runtime/spots/spot-node-autoconnect.js +15 -18
  175. package/dist/runtime/spots/spot-node-runtime-manager.js +74 -85
  176. package/dist/runtime/spots/spot-outbound.js +10 -14
  177. package/dist/runtime/spots/spot-remote-codec.js +22 -26
  178. package/dist/runtime/spots/spot-remote-route-codec.js +5 -7
  179. package/dist/runtime/spots/spot-route-packet-dispatch.js +16 -14
  180. package/dist/runtime/spots/spot-route-replies.js +4 -6
  181. package/dist/runtime/spots/spot-routed-actor-admission.js +9 -7
  182. package/dist/runtime/spots/spot-routed-bound-session-dispatch.js +1 -2
  183. package/dist/runtime/spots/spot-routed-frame-dispatch.js +5 -5
  184. package/dist/runtime/spots/spot-routed-spot-packet-dispatch.js +14 -10
  185. package/dist/runtime/spots/spot-serial-executor.js +5 -8
  186. package/dist/runtime/spots/spot-serial-turn-executor.js +4 -6
  187. package/dist/runtime/spots/spot-subscription-dispatch.js +5 -5
  188. package/dist/runtime/spots/spot-timer.js +25 -29
  189. package/dist/runtime/streams/actor-session-binding-registry.js +98 -107
  190. package/dist/runtime/streams/actor-session-lifecycle-coordinator.js +3 -1
  191. package/dist/runtime/streams/bound-actor-relay-sender.js +18 -16
  192. package/dist/runtime/streams/bound-session-service.js +8 -9
  193. package/dist/runtime/streams/index.js +20 -19
  194. package/dist/runtime/streams/managed-stream.js +32 -30
  195. package/dist/runtime/streams/native-fallback-bound-session.js +21 -17
  196. package/dist/runtime/streams/protocol.js +29 -18
  197. package/dist/runtime/streams/session-actor-coordinator.js +34 -37
  198. package/dist/runtime/streams/session-context.js +30 -28
  199. package/dist/runtime/streams/session-provider.js +2 -2
  200. package/dist/runtime/streams/session-serial-executor.js +1 -2
  201. package/dist/runtime/streams/stream-frame-factory.js +11 -5
  202. package/dist/runtime/streams/stream-session-runtime.js +70 -66
  203. package/dist/runtime/workers/index.js +15 -4
  204. package/package.json +2 -2
  205. package/src/contracts/Channels/RouteCalls.ts +6 -1
  206. package/src/contracts/Common/ZLinkMessage.ts +5 -5
  207. package/src/contracts/Common/ZLinkMessageMetadata.ts +4 -3
  208. package/src/contracts/Configuration/Builders.ts +14 -14
  209. package/src/contracts/Configuration/CodecContentType.ts +8 -10
  210. package/src/contracts/Configuration/DiagnosticsValidation.ts +1 -6
  211. package/src/contracts/Configuration/EndpointNotation.ts +11 -11
  212. package/src/contracts/Configuration/ObjectRoles.ts +1 -3
  213. package/src/contracts/Configuration/Registration.ts +46 -17
  214. package/src/contracts/Configuration/RegistrationBuilderPolicy.ts +10 -8
  215. package/src/contracts/Configuration/RegistrationBuilders.ts +107 -96
  216. package/src/contracts/Configuration/RegistrationCodecRegistry.ts +9 -3
  217. package/src/contracts/Configuration/RegistrationNormalizers.ts +116 -84
  218. package/src/contracts/Configuration/RegistrationTypes.ts +21 -25
  219. package/src/contracts/Configuration/RegistrationValidators.ts +122 -73
  220. package/src/contracts/Configuration/RouteChannelInternalState.ts +1 -4
  221. package/src/contracts/Configuration/RuntimeEndpointConnections.ts +4 -1
  222. package/src/contracts/Configuration/SendTimeoutValidation.ts +6 -4
  223. package/src/contracts/Configuration/TimerRegistrationValidator.ts +8 -13
  224. package/src/contracts/Dispatch/ZLinkDispatchOptions.ts +1 -6
  225. package/src/contracts/Errors/index.ts +1 -4
  226. package/src/contracts/Handlers/Attributes.ts +15 -9
  227. package/src/contracts/Handlers/IZLinkChannelHandlers.ts +24 -4
  228. package/src/contracts/Handlers/JsonContract.ts +53 -19
  229. package/src/contracts/Locations/ActorTransfer.ts +1 -5
  230. package/src/contracts/Locations/Authority.ts +4 -11
  231. package/src/contracts/Locations/Keys.ts +6 -1
  232. package/src/contracts/Locations/Options.ts +3 -2
  233. package/src/contracts/Locations/RelocationStore.ts +1 -4
  234. package/src/contracts/Locations/Resolvers.ts +5 -5
  235. package/src/contracts/Locations/RuntimeQuery.ts +6 -2
  236. package/src/contracts/Locations/Stores.ts +1 -2
  237. package/src/contracts/Locations/index.ts +2 -8
  238. package/src/contracts/RouteMesh/Contracts.ts +1 -7
  239. package/src/contracts/RouteMesh/RuntimeTopology.ts +1 -4
  240. package/src/contracts/Spots/Contracts.ts +2 -8
  241. package/src/contracts/Spots/SpotKind.ts +16 -8
  242. package/src/contracts/Spots/ZLinkSpot.ts +8 -11
  243. package/src/contracts/Streams/IZLinkSession.ts +0 -1
  244. package/src/contracts/Streams/IZLinkSessionActor.ts +5 -1
  245. package/src/contracts/Streams/IZLinkSessionPacketHandler.ts +5 -1
  246. package/src/internal.ts +5 -4
  247. package/src/location-store-integration.ts +24 -16
  248. package/src/nest-integration.ts +40 -25
  249. package/src/runtime/abort.ts +10 -4
  250. package/src/runtime/actors/actor-authority-payload-codec.ts +20 -29
  251. package/src/runtime/actors/actor-authority-publication.ts +92 -77
  252. package/src/runtime/actors/actor-client.ts +162 -133
  253. package/src/runtime/actors/actor-context.ts +138 -130
  254. package/src/runtime/actors/actor-creation.ts +47 -44
  255. package/src/runtime/actors/actor-execution-context.ts +6 -4
  256. package/src/runtime/actors/actor-handoff.ts +269 -293
  257. package/src/runtime/actors/actor-join-deferred-scope.ts +5 -4
  258. package/src/runtime/actors/actor-lifecycle-snapshot.ts +5 -8
  259. package/src/runtime/actors/actor-local-native-join.ts +131 -159
  260. package/src/runtime/actors/actor-mailbox.ts +16 -19
  261. package/src/runtime/actors/actor-message-follow-context.ts +46 -36
  262. package/src/runtime/actors/actor-packet-relay-wire.ts +32 -21
  263. package/src/runtime/actors/actor-remote-joiner.ts +50 -54
  264. package/src/runtime/actors/actor-remote-wire.ts +9 -13
  265. package/src/runtime/actors/actor-routed-join-transport.ts +10 -2
  266. package/src/runtime/actors/actor-runtime-contracts.ts +2 -5
  267. package/src/runtime/actors/actor-runtime-state.ts +127 -124
  268. package/src/runtime/actors/actor-transfer-registry.ts +9 -14
  269. package/src/runtime/actors/actor-transport-delivery-gate.ts +4 -6
  270. package/src/runtime/actors/bound-session-wire.ts +37 -17
  271. package/src/runtime/actors/deferred-join-accepted-journal.ts +351 -320
  272. package/src/runtime/actors/index.ts +43 -86
  273. package/src/runtime/actors/post-commit-actor-binder.ts +10 -10
  274. package/src/runtime/actors/post-commit-actor-location.ts +30 -23
  275. package/src/runtime/actors/spot-actor-dispatch.ts +78 -53
  276. package/src/runtime/actors/transferred-actor-rollback.ts +18 -13
  277. package/src/runtime/admission.ts +9 -9
  278. package/src/runtime/application-jobs/application-ingress-record-owner.ts +5 -15
  279. package/src/runtime/application-jobs/application-job-queue-handler-start-gate.ts +3 -2
  280. package/src/runtime/application-jobs/receive-flow-controller.ts +17 -14
  281. package/src/runtime/backend/contracts/index.ts +73 -52
  282. package/src/runtime/backend/mesh-actor-session-node-adapter.ts +4 -14
  283. package/src/runtime/backend/mesh-completion-table.ts +6 -9
  284. package/src/runtime/backend/mesh-dispatch-pump.ts +38 -30
  285. package/src/runtime/backend/node/node-backend-adapter-factory.ts +23 -21
  286. package/src/runtime/backend/node/node-backend-adapter-support.ts +36 -22
  287. package/src/runtime/backend/node/node-dealer-channel-client-transport.ts +59 -58
  288. package/src/runtime/backend/node/node-event-loop-poller.ts +2 -10
  289. package/src/runtime/backend/node/node-mesh-backend-adapter.ts +12 -5
  290. package/src/runtime/backend/node/node-monitor-backend-adapter.ts +4 -3
  291. package/src/runtime/backend/node/node-raw-binding-port.ts +29 -29
  292. package/src/runtime/backend/node/node-raw-mesh-backend.ts +335 -383
  293. package/src/runtime/backend/node/node-socket-backend-adapter.ts +101 -54
  294. package/src/runtime/backend/runtime-message.ts +5 -3
  295. package/src/runtime/backend/runtime-values.ts +10 -7
  296. package/src/runtime/channels/channel-autoconnect.ts +1 -4
  297. package/src/runtime/channels/channel-clients.ts +93 -73
  298. package/src/runtime/channels/channel-dispatch-pipeline.ts +40 -42
  299. package/src/runtime/channels/channel-dispatch-services.ts +51 -49
  300. package/src/runtime/channels/channel-dispatchers.ts +152 -96
  301. package/src/runtime/channels/channel-envelope-inspection.ts +20 -16
  302. package/src/runtime/channels/channel-envelope.ts +256 -150
  303. package/src/runtime/channels/channel-multipart.ts +13 -5
  304. package/src/runtime/channels/channel-outbound-operations.ts +37 -41
  305. package/src/runtime/channels/channel-receive-loops.ts +102 -98
  306. package/src/runtime/channels/channel-receive-task-tracker.ts +1 -1
  307. package/src/runtime/channels/channel-runtime-lifecycle.ts +248 -190
  308. package/src/runtime/channels/channel-runtime-manager.ts +63 -37
  309. package/src/runtime/channels/channel-socket-options.ts +3 -10
  310. package/src/runtime/channels/channel-socket-registry.ts +331 -273
  311. package/src/runtime/channels/channel-transports.ts +215 -197
  312. package/src/runtime/channels/client-server-location-runtime.ts +116 -100
  313. package/src/runtime/channels/client-server-service-wire.ts +37 -36
  314. package/src/runtime/channels/dispatch-error-reporter.ts +11 -8
  315. package/src/runtime/channels/fanout-location-runtime.ts +91 -94
  316. package/src/runtime/channels/fanout-service-wire.ts +5 -12
  317. package/src/runtime/channels/handler-filter-scope.ts +1 -4
  318. package/src/runtime/channels/index.ts +1 -4
  319. package/src/runtime/channels/local-spot-route-transport.ts +20 -5
  320. package/src/runtime/channels/route-member-snapshot.ts +11 -5
  321. package/src/runtime/channels/router-socket-spot-route-transport.ts +1 -7
  322. package/src/runtime/channels/source-spot-router.ts +26 -22
  323. package/src/runtime/channels/spot-direct-envelope.ts +10 -8
  324. package/src/runtime/channels/spot-node-route-transport.ts +13 -16
  325. package/src/runtime/channels/spot-route-bridge-transport.ts +26 -9
  326. package/src/runtime/channels/spot-route-dispatch-strategy.ts +40 -13
  327. package/src/runtime/channels/spot-route-target-resolver.ts +18 -9
  328. package/src/runtime/codecs/index.ts +3 -2
  329. package/src/runtime/diagnostics/flow-context.ts +12 -3
  330. package/src/runtime/diagnostics/index.ts +96 -61
  331. package/src/runtime/diagnostics/internal-event-contracts.ts +87 -33
  332. package/src/runtime/diagnostics/message-flow.ts +95 -76
  333. package/src/runtime/diagnostics/runtime-metrics.ts +46 -24
  334. package/src/runtime/diagnostics/runtime-observation-queue.ts +17 -28
  335. package/src/runtime/diagnostics/topology-runtime-projections.ts +62 -43
  336. package/src/runtime/execution/index.ts +18 -26
  337. package/src/runtime/execution/serial-execution-queue.ts +31 -40
  338. package/src/runtime/execution/state-lane.ts +2 -2
  339. package/src/runtime/foundation/actor-join-recovery-codec.ts +69 -51
  340. package/src/runtime/foundation/event-loop-resources.ts +8 -4
  341. package/src/runtime/foundation/message-follow-suppression-registry.ts +7 -14
  342. package/src/runtime/foundation/operation-identity.ts +1 -2
  343. package/src/runtime/foundation/operation-registry.ts +8 -2
  344. package/src/runtime/foundation/raw-service-mesh-runtime.ts +312 -385
  345. package/src/runtime/foundation/route-mesh-connection-policy.ts +7 -8
  346. package/src/runtime/foundation/runtime-state-projections.ts +24 -23
  347. package/src/runtime/foundation/service-authority-payload-codec.ts +54 -57
  348. package/src/runtime/foundation/service-discovery-registry.ts +67 -59
  349. package/src/runtime/foundation/service-instance-activation-recovery-codec.ts +28 -29
  350. package/src/runtime/foundation/service-liveness-registry.ts +18 -13
  351. package/src/runtime/foundation/service-mailbox.ts +14 -14
  352. package/src/runtime/foundation/service-maintenance-runtime.ts +22 -21
  353. package/src/runtime/foundation/service-metadata-codec.ts +2 -9
  354. package/src/runtime/foundation/service-relocation-aggregate-committer.ts +39 -36
  355. package/src/runtime/foundation/service-relocation-coordinator.ts +1 -4
  356. package/src/runtime/foundation/service-relocation-object-owner.ts +40 -58
  357. package/src/runtime/foundation/service-relocation-runtime.ts +292 -216
  358. package/src/runtime/foundation/service-runtime-contracts.ts +8 -8
  359. package/src/runtime/foundation/service-session-binding-ingress-port.ts +1 -4
  360. package/src/runtime/foundation/service-stateful-registry.ts +69 -59
  361. package/src/runtime/foundation/service-stateful-runtime.ts +1174 -1112
  362. package/src/runtime/foundation/service-stateful-wire-codec.ts +318 -270
  363. package/src/runtime/foundation/service-topology-registry.ts +157 -159
  364. package/src/runtime/foundation/service-weighted-selection.ts +9 -15
  365. package/src/runtime/foundation/service-wire-binary-primitives.ts +6 -12
  366. package/src/runtime/foundation/service-wire-m6a-codec.ts +69 -47
  367. package/src/runtime/framework-errors-internal.ts +31 -30
  368. package/src/runtime/handlers/handler-instance-scope.ts +18 -29
  369. package/src/runtime/handlers/index.ts +18 -8
  370. package/src/runtime/host/actor-packet-relay.ts +290 -261
  371. package/src/runtime/host/actor-placement-coordinator.ts +165 -150
  372. package/src/runtime/host/actor-runtime-options-factory.ts +89 -87
  373. package/src/runtime/host/actor-transfer-authority-runtime.ts +46 -38
  374. package/src/runtime/host/actor-transfer-runtime.ts +391 -395
  375. package/src/runtime/host/application-job-queue.ts +32 -48
  376. package/src/runtime/host/bound-session-relay.ts +7 -9
  377. package/src/runtime/host/channel-runtime-options-factory.ts +75 -35
  378. package/src/runtime/host/host-capacity-status.ts +10 -9
  379. package/src/runtime/host/index.ts +861 -789
  380. package/src/runtime/host/instance-activation-authority.ts +125 -143
  381. package/src/runtime/host/location-runtime-owner.ts +38 -26
  382. package/src/runtime/host/mesh-router-resolver.ts +30 -23
  383. package/src/runtime/host/relocation-direct-transfer.ts +15 -15
  384. package/src/runtime/host/relocation-integrity-fault-gate.ts +3 -2
  385. package/src/runtime/host/remote-actor-join-receiver.ts +43 -34
  386. package/src/runtime/host/remote-actor-packet-target-store.ts +54 -52
  387. package/src/runtime/host/remote-bound-session-relay.ts +274 -247
  388. package/src/runtime/host/route-mesh-runtime-options.ts +1 -3
  389. package/src/runtime/host/route-mesh-runtime.ts +227 -181
  390. package/src/runtime/host/runtime-shutdown.ts +4 -3
  391. package/src/runtime/host/service-relocation-control.ts +14 -5
  392. package/src/runtime/host/service-relocation-host-runtime.ts +1388 -1165
  393. package/src/runtime/host/spot-address-transport.ts +284 -237
  394. package/src/runtime/host/spot-node-runtime-options-factory.ts +14 -8
  395. package/src/runtime/host/spot-runtime-options-factory.ts +71 -62
  396. package/src/runtime/host/stateful-authority-route-runtime.ts +117 -116
  397. package/src/runtime/host/user-spot-creation-coordinator.ts +225 -220
  398. package/src/runtime/locations/actor-location-claims.ts +61 -49
  399. package/src/runtime/locations/actor-session-route-claims.ts +1 -4
  400. package/src/runtime/locations/aggregate-inventory-store.ts +105 -134
  401. package/src/runtime/locations/authority-key-codec.ts +13 -10
  402. package/src/runtime/locations/auto-connect-loop.ts +14 -11
  403. package/src/runtime/locations/auto-connect-planner.ts +42 -31
  404. package/src/runtime/locations/auto-connect-reconciler.ts +106 -63
  405. package/src/runtime/locations/canonical-codec.ts +3 -1
  406. package/src/runtime/locations/creation-operation-id.ts +4 -3
  407. package/src/runtime/locations/domain-store-contract.ts +13 -7
  408. package/src/runtime/locations/in-memory-authority-store.ts +232 -199
  409. package/src/runtime/locations/in-memory-location-store.ts +432 -250
  410. package/src/runtime/locations/in-memory-provider-location-store.ts +16 -17
  411. package/src/runtime/locations/internal-store-contracts.ts +95 -38
  412. package/src/runtime/locations/key-codec.ts +3 -4
  413. package/src/runtime/locations/lease-tracker.ts +36 -27
  414. package/src/runtime/locations/lifecycle-runtime.ts +15 -3
  415. package/src/runtime/locations/lifecycle.ts +33 -28
  416. package/src/runtime/locations/location-store-repository.ts +1329 -1185
  417. package/src/runtime/locations/opaque-record-key.ts +4 -9
  418. package/src/runtime/locations/resolvers.ts +201 -178
  419. package/src/runtime/locations/runtime.ts +251 -159
  420. package/src/runtime/locations/spot-location-claims.ts +110 -112
  421. package/src/runtime/messaging/creation-payload-codec.ts +4 -1
  422. package/src/runtime/messaging/framework-json-v1.ts +34 -15
  423. package/src/runtime/messaging/packet-name.ts +8 -6
  424. package/src/runtime/messaging/payload-codec.ts +70 -50
  425. package/src/runtime/messaging/submission-result.ts +6 -9
  426. package/src/runtime/protocol/service_wire_codec.generated.ts +1376 -159
  427. package/src/runtime/protocol/service_wire_pilot_codec.generated.ts +1 -1
  428. package/src/runtime/routing-id.ts +10 -7
  429. package/src/runtime/spots/formal-remote-actor-admission-registry.ts +56 -62
  430. package/src/runtime/spots/formal-remote-actor-transfer-registry.ts +23 -20
  431. package/src/runtime/spots/index.ts +593 -563
  432. package/src/runtime/spots/spot-activation-registry.ts +38 -34
  433. package/src/runtime/spots/spot-activation-state.ts +43 -51
  434. package/src/runtime/spots/spot-activation.ts +179 -116
  435. package/src/runtime/spots/spot-actor-admission-coordinator.ts +110 -78
  436. package/src/runtime/spots/spot-actor-join-dispatch.ts +57 -41
  437. package/src/runtime/spots/spot-actor-lifecycle-drain.ts +5 -7
  438. package/src/runtime/spots/spot-actor-membership.ts +25 -27
  439. package/src/runtime/spots/spot-actor-packet-dispatch.ts +184 -153
  440. package/src/runtime/spots/spot-actor-packet-drain.ts +54 -42
  441. package/src/runtime/spots/spot-actor-packet-relay-dispatch.ts +37 -39
  442. package/src/runtime/spots/spot-closing.ts +11 -12
  443. package/src/runtime/spots/spot-context.ts +46 -26
  444. package/src/runtime/spots/spot-entry-activation.ts +84 -65
  445. package/src/runtime/spots/spot-handle.ts +17 -15
  446. package/src/runtime/spots/spot-handler-registry.ts +44 -31
  447. package/src/runtime/spots/spot-location-claim.ts +5 -4
  448. package/src/runtime/spots/spot-manager-public.ts +62 -82
  449. package/src/runtime/spots/spot-native-actor-join-admission.ts +20 -16
  450. package/src/runtime/spots/spot-node-autoconnect.ts +54 -61
  451. package/src/runtime/spots/spot-node-runtime-manager.ts +230 -221
  452. package/src/runtime/spots/spot-outbound.ts +47 -59
  453. package/src/runtime/spots/spot-publisher-transport.ts +5 -4
  454. package/src/runtime/spots/spot-remote-codec.ts +66 -65
  455. package/src/runtime/spots/spot-remote-route-codec.ts +61 -41
  456. package/src/runtime/spots/spot-route-packet-dispatch.ts +128 -95
  457. package/src/runtime/spots/spot-route-replies.ts +23 -24
  458. package/src/runtime/spots/spot-route-reply-wire.ts +3 -2
  459. package/src/runtime/spots/spot-routed-actor-admission.ts +37 -27
  460. package/src/runtime/spots/spot-routed-bound-session-dispatch.ts +11 -17
  461. package/src/runtime/spots/spot-routed-frame-dispatch.ts +18 -15
  462. package/src/runtime/spots/spot-routed-spot-packet-dispatch.ts +35 -26
  463. package/src/runtime/spots/spot-routing-internal.ts +1 -4
  464. package/src/runtime/spots/spot-runtime-ports.ts +5 -5
  465. package/src/runtime/spots/spot-serial-executor.ts +5 -9
  466. package/src/runtime/spots/spot-serial-turn-executor.ts +19 -26
  467. package/src/runtime/spots/spot-subscription-dispatch.ts +56 -46
  468. package/src/runtime/spots/spot-timer.ts +98 -91
  469. package/src/runtime/streams/actor-session-binding-registry.ts +277 -235
  470. package/src/runtime/streams/actor-session-binding-runtime-owner.ts +7 -4
  471. package/src/runtime/streams/actor-session-lifecycle-coordinator.ts +3 -1
  472. package/src/runtime/streams/bound-actor-relay-sender.ts +53 -51
  473. package/src/runtime/streams/bound-session-response-target.ts +29 -8
  474. package/src/runtime/streams/bound-session-service.ts +39 -39
  475. package/src/runtime/streams/index.ts +176 -100
  476. package/src/runtime/streams/managed-stream.ts +98 -87
  477. package/src/runtime/streams/native-fallback-bound-session.ts +57 -52
  478. package/src/runtime/streams/protocol.ts +73 -43
  479. package/src/runtime/streams/session-actor-coordinator.ts +97 -89
  480. package/src/runtime/streams/session-calls.ts +2 -8
  481. package/src/runtime/streams/session-context.ts +66 -48
  482. package/src/runtime/streams/session-provider.ts +5 -7
  483. package/src/runtime/streams/session-serial-executor.ts +7 -6
  484. package/src/runtime/streams/stream-binding-runtime-ports.ts +79 -29
  485. package/src/runtime/streams/stream-frame-factory.ts +55 -38
  486. package/src/runtime/streams/stream-session-runtime.ts +268 -210
  487. package/src/runtime/workers/index.ts +68 -29
@@ -2,6 +2,7 @@
2
2
  /* This file is generated by render-service-wire-typescript.mjs. */
3
3
  /* eslint-disable */
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.RelocationEnvelopeV1LogicalStreamDecoder = exports.LogicalDecodeError = void 0;
5
6
  exports.decodeU8 = decodeU8;
6
7
  exports.encodeU8 = encodeU8;
7
8
  exports.decodeU16 = decodeU16;
@@ -482,7 +483,10 @@ exports.decodeRelocationManifestV1DurableFormat = decodeRelocationManifestV1Dura
482
483
  exports.encodeRelocationManifestV1DurableFormat = encodeRelocationManifestV1DurableFormat;
483
484
  exports.decodeRelocationEnvelopeV1LogicalStream = decodeRelocationEnvelopeV1LogicalStream;
484
485
  exports.encodeRelocationEnvelopeV1LogicalStream = encodeRelocationEnvelopeV1LogicalStream;
485
- function fail(message) { throw new RangeError(message); }
486
+ class ServiceWireProtocolError extends RangeError {
487
+ constructor(message) { super(message); this.name = "ServiceWireProtocolError"; }
488
+ }
489
+ function fail(message) { throw new ServiceWireProtocolError(message); }
486
490
  class ServiceWireCapacityError extends RangeError {
487
491
  constructor(message) { super(message); this.name = "ServiceWireCapacityError"; }
488
492
  }
@@ -491,8 +495,9 @@ function numeric(value) { return typeof value === "bigint" ? value : BigInt(valu
491
495
  function same(left, right) { return typeof left === "bigint" || typeof right === "bigint" ? numeric(left) === numeric(right) : left === right; }
492
496
  function requireContext(context, name) { const value = context[name]; if (value === undefined)
493
497
  fail("missing decoder context " + name); return value; }
494
- function runtimePredicate(context, name, terminal, failure) { const predicate = context.runtimePredicates[name]; if (!predicate)
495
- fail("missing runtime predicate " + name); return predicate(terminal, failure); }
498
+ function validTerminalFailure(terminal, failure) { if (terminal === 0)
499
+ return failure === 0; if ([101, 103, 108, 109, 110, 111, 112, 113].includes(terminal))
500
+ return failure === 0; return new Map([[1, 102], [2, 105], [3, 107], [4, 107], [5, 105], [6, 102], [7, 107], [8, 102], [9, 102], [10, 102], [11, 102], [12, 104], [13, 105], [14, 102], [15, 106], [16, 104], [17, 105], [18, 106], [19, 105], [20, 105], [21, 107], [22, 106], [33, 107], [34, 107], [35, 105]]).get(failure) === terminal; }
496
501
  const encoder = new TextEncoder();
497
502
  const decoder = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
498
503
  function utf8(value) { const text = value; for (let index = 0; index < text.length; ++index) {
@@ -529,6 +534,157 @@ class Reader {
529
534
  done(label) { if (this.remaining)
530
535
  fail(label + " trailing bytes"); }
531
536
  }
537
+ class IncrementalReader {
538
+ offset = 0;
539
+ chunk = new Uint8Array();
540
+ chunkOffset = 0;
541
+ bufferedInputByteCount = 0;
542
+ get remaining() { return this.chunk.length - this.chunkOffset; }
543
+ supply(chunk) { if (this.remaining)
544
+ throw new Error("incremental reader still owns caller input"); this.chunk = chunk; this.chunkOffset = 0; }
545
+ release() { if (this.remaining)
546
+ throw new Error("incremental reader did not consume caller input"); this.discard(); }
547
+ discard() { this.chunk = new Uint8Array(); this.chunkOffset = 0; }
548
+ *take(length) { if (!Number.isSafeInteger(length) || length < 0 || length > 8)
549
+ fail("invalid incremental scalar read length"); const value = new Uint8Array(length); let filled = 0; while (filled < length) {
550
+ const available = this.remaining;
551
+ if (available === 0) {
552
+ this.bufferedInputByteCount = filled;
553
+ yield;
554
+ continue;
555
+ }
556
+ const count = Math.min(length - filled, available);
557
+ value.set(this.chunk.subarray(this.chunkOffset, this.chunkOffset + count), filled);
558
+ this.chunkOffset += count;
559
+ this.offset += count;
560
+ filled += count;
561
+ } this.bufferedInputByteCount = 0; return value; }
562
+ *bytes(length) { if (!Number.isSafeInteger(length) || length < 0)
563
+ fail("invalid incremental content length"); let value; try {
564
+ value = new Uint8Array(length);
565
+ }
566
+ catch {
567
+ return capacityFail("incremental content capacity");
568
+ } let filled = 0; while (filled < length) {
569
+ const available = this.remaining;
570
+ if (available === 0) {
571
+ this.bufferedInputByteCount = 0;
572
+ yield;
573
+ continue;
574
+ }
575
+ const count = Math.min(length - filled, available);
576
+ value.set(this.chunk.subarray(this.chunkOffset, this.chunkOffset + count), filled);
577
+ this.chunkOffset += count;
578
+ this.offset += count;
579
+ filled += count;
580
+ } return value; }
581
+ *text(length, forbidNul, label) { if (!Number.isSafeInteger(length) || length < 0)
582
+ fail("invalid incremental text length"); let value = "", remaining = length, codePoint = 0, needed = 0, minimum = 0; while (remaining > 0) {
583
+ if (this.remaining === 0) {
584
+ this.bufferedInputByteCount = 0;
585
+ yield;
586
+ continue;
587
+ }
588
+ const byte = this.chunk[this.chunkOffset++];
589
+ ++this.offset;
590
+ --remaining;
591
+ if (needed === 0) {
592
+ if (byte <= 0x7f) {
593
+ if (forbidNul && byte === 0)
594
+ fail(label + " NUL");
595
+ try {
596
+ value += String.fromCodePoint(byte);
597
+ }
598
+ catch {
599
+ return capacityFail(label + " capacity");
600
+ }
601
+ continue;
602
+ }
603
+ if (byte >= 0xc2 && byte <= 0xdf) {
604
+ codePoint = byte & 0x1f;
605
+ needed = 1;
606
+ minimum = 0x80;
607
+ continue;
608
+ }
609
+ if (byte >= 0xe0 && byte <= 0xef) {
610
+ codePoint = byte & 0x0f;
611
+ needed = 2;
612
+ minimum = 0x800;
613
+ continue;
614
+ }
615
+ if (byte >= 0xf0 && byte <= 0xf4) {
616
+ codePoint = byte & 0x07;
617
+ needed = 3;
618
+ minimum = 0x10000;
619
+ continue;
620
+ }
621
+ fail(label + " UTF-8");
622
+ }
623
+ if ((byte & 0xc0) !== 0x80)
624
+ fail(label + " UTF-8");
625
+ codePoint = (codePoint << 6) | (byte & 0x3f);
626
+ if (--needed === 0) {
627
+ if (codePoint < minimum || codePoint > 0x10ffff || (codePoint >= 0xd800 && codePoint <= 0xdfff) || (forbidNul && codePoint === 0))
628
+ fail(label + " UTF-8");
629
+ try {
630
+ value += String.fromCodePoint(codePoint);
631
+ }
632
+ catch {
633
+ return capacityFail(label + " capacity");
634
+ }
635
+ }
636
+ } if (needed !== 0)
637
+ fail(label + " UTF-8"); return value; }
638
+ bounded(length) { if (!Number.isSafeInteger(length) || length < 0)
639
+ fail("invalid bounded read length"); return new IncrementalBoundedReader(this, length); }
640
+ *u(width) { let value = 0n; for (const byte of yield* this.take(width))
641
+ value = (value << 8n) | BigInt(byte); return value; }
642
+ *i64() { const value = yield* this.u(8); return (value & (1n << 63n)) === 0n ? value : value - (1n << 64n); }
643
+ done(label) { if (this.remaining)
644
+ fail(label + " bounded body remainder"); }
645
+ }
646
+ class IncrementalBoundedReader {
647
+ source;
648
+ remaining;
649
+ offset = 0;
650
+ constructor(source, remaining) {
651
+ this.source = source;
652
+ this.remaining = remaining;
653
+ }
654
+ check(length) { if (!Number.isSafeInteger(length) || length < 0 || length > this.remaining)
655
+ fail("bounded service-wire value overflow"); }
656
+ consumed(length) { this.remaining -= length; this.offset += length; }
657
+ *take(length) { this.check(length); const value = yield* this.source.take(length); this.consumed(length); return value; }
658
+ *bytes(length) { this.check(length); const value = yield* this.source.bytes(length); this.consumed(length); return value; }
659
+ *text(length, forbidNul, label) { this.check(length); const value = yield* this.source.text(length, forbidNul, label); this.consumed(length); return value; }
660
+ bounded(length) { this.check(length); return new IncrementalNestedBoundedReader(this, length); }
661
+ *u(width) { let value = 0n; for (const byte of yield* this.take(width))
662
+ value = (value << 8n) | BigInt(byte); return value; }
663
+ *i64() { const value = yield* this.u(8); return (value & (1n << 63n)) === 0n ? value : value - (1n << 64n); }
664
+ done(label) { if (this.remaining)
665
+ fail(label + " bounded body remainder"); }
666
+ }
667
+ class IncrementalNestedBoundedReader {
668
+ parent;
669
+ remaining;
670
+ offset = 0;
671
+ constructor(parent, remaining) {
672
+ this.parent = parent;
673
+ this.remaining = remaining;
674
+ }
675
+ check(length) { if (!Number.isSafeInteger(length) || length < 0 || length > this.remaining)
676
+ fail("bounded service-wire value overflow"); }
677
+ consumed(length) { this.remaining -= length; this.offset += length; }
678
+ *take(length) { this.check(length); const value = yield* this.parent.take(length); this.consumed(length); return value; }
679
+ *bytes(length) { this.check(length); const value = yield* this.parent.bytes(length); this.consumed(length); return value; }
680
+ *text(length, forbidNul, label) { this.check(length); const value = yield* this.parent.text(length, forbidNul, label); this.consumed(length); return value; }
681
+ bounded(length) { this.check(length); return new IncrementalNestedBoundedReader(this, length); }
682
+ *u(width) { let value = 0n; for (const byte of yield* this.take(width))
683
+ value = (value << 8n) | BigInt(byte); return value; }
684
+ *i64() { const value = yield* this.u(8); return (value & (1n << 63n)) === 0n ? value : value - (1n << 64n); }
685
+ done(label) { if (this.remaining)
686
+ fail(label + " bounded body remainder"); }
687
+ }
532
688
  class Writer {
533
689
  chunks = [];
534
690
  length = 0;
@@ -576,6 +732,15 @@ function readU8(reader, context, enclosing, flags) {
576
732
  fail("u8 range");
577
733
  return Number(raw);
578
734
  }
735
+ function* readIncrementalU8(reader, context, enclosing, flags) {
736
+ void context;
737
+ void enclosing;
738
+ void flags;
739
+ const raw = yield* reader.u(1);
740
+ if (raw < 0n || raw > 255n)
741
+ fail("u8 range");
742
+ return Number(raw);
743
+ }
579
744
  function writeU8(input, writer, context, enclosing, flags) {
580
745
  void context;
581
746
  void enclosing;
@@ -597,6 +762,15 @@ function readU16(reader, context, enclosing, flags) {
597
762
  fail("u16 range");
598
763
  return Number(raw);
599
764
  }
765
+ function* readIncrementalU16(reader, context, enclosing, flags) {
766
+ void context;
767
+ void enclosing;
768
+ void flags;
769
+ const raw = yield* reader.u(2);
770
+ if (raw < 0n || raw > 65535n)
771
+ fail("u16 range");
772
+ return Number(raw);
773
+ }
600
774
  function writeU16(input, writer, context, enclosing, flags) {
601
775
  void context;
602
776
  void enclosing;
@@ -618,6 +792,15 @@ function readU32(reader, context, enclosing, flags) {
618
792
  fail("u32 range");
619
793
  return Number(raw);
620
794
  }
795
+ function* readIncrementalU32(reader, context, enclosing, flags) {
796
+ void context;
797
+ void enclosing;
798
+ void flags;
799
+ const raw = yield* reader.u(4);
800
+ if (raw < 0n || raw > 4294967295n)
801
+ fail("u32 range");
802
+ return Number(raw);
803
+ }
621
804
  function writeU32(input, writer, context, enclosing, flags) {
622
805
  void context;
623
806
  void enclosing;
@@ -660,6 +843,15 @@ function readU64(reader, context, enclosing, flags) {
660
843
  fail("u64 range");
661
844
  return raw;
662
845
  }
846
+ function* readIncrementalU64(reader, context, enclosing, flags) {
847
+ void context;
848
+ void enclosing;
849
+ void flags;
850
+ const raw = yield* reader.u(8);
851
+ if (raw < 0n || raw > 18446744073709551615n)
852
+ fail("u64 range");
853
+ return raw;
854
+ }
663
855
  function writeU64(input, writer, context, enclosing, flags) {
664
856
  void context;
665
857
  void enclosing;
@@ -681,6 +873,15 @@ function readNonzeroU64(reader, context, enclosing, flags) {
681
873
  fail("nonzero-u64 range");
682
874
  return raw;
683
875
  }
876
+ function* readIncrementalNonzeroU64(reader, context, enclosing, flags) {
877
+ void context;
878
+ void enclosing;
879
+ void flags;
880
+ const raw = yield* reader.u(8);
881
+ if (raw < 1n || raw > 9223372036854775807n)
882
+ fail("nonzero-u64 range");
883
+ return raw;
884
+ }
684
885
  function writeNonzeroU64(input, writer, context, enclosing, flags) {
685
886
  void context;
686
887
  void enclosing;
@@ -702,6 +903,15 @@ function readOrdinalOrZero(reader, context, enclosing, flags) {
702
903
  fail("ordinal-or-zero range");
703
904
  return raw;
704
905
  }
906
+ function* readIncrementalOrdinalOrZero(reader, context, enclosing, flags) {
907
+ void context;
908
+ void enclosing;
909
+ void flags;
910
+ const raw = yield* reader.u(8);
911
+ if (raw < 0n || raw > 9223372036854775807n)
912
+ fail("ordinal-or-zero range");
913
+ return raw;
914
+ }
705
915
  function writeOrdinalOrZero(input, writer, context, enclosing, flags) {
706
916
  void context;
707
917
  void enclosing;
@@ -765,6 +975,15 @@ function readApplicationVersion(reader, context, enclosing, flags) {
765
975
  fail("application-version range");
766
976
  return raw;
767
977
  }
978
+ function* readIncrementalApplicationVersion(reader, context, enclosing, flags) {
979
+ void context;
980
+ void enclosing;
981
+ void flags;
982
+ const raw = yield* reader.i64();
983
+ if (raw < 0n || raw > 9223372036854775807n)
984
+ fail("application-version range");
985
+ return raw;
986
+ }
768
987
  function writeApplicationVersion(input, writer, context, enclosing, flags) {
769
988
  void context;
770
989
  void enclosing;
@@ -794,6 +1013,17 @@ function readBool8(reader, context, enclosing, flags) {
794
1013
  default: fail("bool8 enum");
795
1014
  }
796
1015
  }
1016
+ function* readIncrementalBool8(reader, context, enclosing, flags) {
1017
+ void context;
1018
+ void enclosing;
1019
+ void flags;
1020
+ const raw = yield* reader.u(1);
1021
+ switch (Number(raw)) {
1022
+ case 0: return "false";
1023
+ case 1: return "true";
1024
+ default: fail("bool8 enum");
1025
+ }
1026
+ }
797
1027
  function writeBool8(input, writer, context, enclosing, flags) {
798
1028
  void context;
799
1029
  void enclosing;
@@ -808,13 +1038,26 @@ function readRid(reader, context, enclosing, flags) {
808
1038
  void enclosing;
809
1039
  void flags;
810
1040
  const length = Number(readU8(reader, context, enclosing, flags));
1041
+ if (length > 2147483647)
1042
+ capacityFail("rid capacity");
811
1043
  if (length > 255)
812
1044
  fail("rid length");
1045
+ if (length < 1)
1046
+ fail("rid length");
1047
+ return reader.take(length);
1048
+ }
1049
+ function* readIncrementalRid(reader, context, enclosing, flags) {
1050
+ void context;
1051
+ void enclosing;
1052
+ void flags;
1053
+ const length = Number(yield* readIncrementalU8(reader, context, enclosing, flags));
813
1054
  if (length > 2147483647)
814
1055
  capacityFail("rid capacity");
1056
+ if (length > 255)
1057
+ fail("rid length");
815
1058
  if (length < 1)
816
1059
  fail("rid length");
817
- return reader.take(length);
1060
+ return yield* reader.bytes(length);
818
1061
  }
819
1062
  function writeRid(input, writer, context, enclosing, flags) {
820
1063
  void context;
@@ -822,10 +1065,10 @@ function writeRid(input, writer, context, enclosing, flags) {
822
1065
  void flags;
823
1066
  const value = input;
824
1067
  const bytes = value;
825
- if (bytes.length > 255)
826
- fail("rid length");
827
1068
  if (bytes.length > 2147483647)
828
1069
  capacityFail("rid capacity");
1070
+ if (bytes.length > 255)
1071
+ fail("rid length");
829
1072
  if (bytes.length < 1)
830
1073
  fail("rid length");
831
1074
  writeU8(bytes.length, writer, context, enclosing, flags);
@@ -840,10 +1083,10 @@ function readOptionalRid(reader, context, enclosing, flags) {
840
1083
  const length = Number(readU8(reader, context, enclosing, flags));
841
1084
  if (length === 0)
842
1085
  return null;
843
- if (length > 255)
844
- fail("optional-rid length");
845
1086
  if (length > 2147483647)
846
1087
  capacityFail("optional-rid capacity");
1088
+ if (length > 255)
1089
+ fail("optional-rid length");
847
1090
  if (length < 0)
848
1091
  fail("optional-rid length");
849
1092
  return reader.take(length);
@@ -858,10 +1101,10 @@ function writeOptionalRid(input, writer, context, enclosing, flags) {
858
1101
  return;
859
1102
  }
860
1103
  const bytes = value;
861
- if (bytes.length > 255)
862
- fail("optional-rid length");
863
1104
  if (bytes.length > 2147483647)
864
1105
  capacityFail("optional-rid capacity");
1106
+ if (bytes.length > 255)
1107
+ fail("optional-rid length");
865
1108
  if (bytes.length < 0)
866
1109
  fail("optional-rid length");
867
1110
  writeU8(bytes.length, writer, context, enclosing, flags);
@@ -874,10 +1117,10 @@ function readText8(reader, context, enclosing, flags) {
874
1117
  void enclosing;
875
1118
  void flags;
876
1119
  const length = Number(readU8(reader, context, enclosing, flags));
877
- if (length > 255)
878
- fail("text8 length");
879
1120
  if (length > 2147483647)
880
1121
  capacityFail("text8 capacity");
1122
+ if (length > 255)
1123
+ fail("text8 length");
881
1124
  if (length < 1)
882
1125
  fail("text8 length");
883
1126
  const bytes = reader.take(length);
@@ -885,6 +1128,19 @@ function readText8(reader, context, enclosing, flags) {
885
1128
  fail("text8 NUL");
886
1129
  return decodeUtf8(bytes, "text8");
887
1130
  }
1131
+ function* readIncrementalText8(reader, context, enclosing, flags) {
1132
+ void context;
1133
+ void enclosing;
1134
+ void flags;
1135
+ const length = Number(yield* readIncrementalU8(reader, context, enclosing, flags));
1136
+ if (length > 2147483647)
1137
+ capacityFail("text8 capacity");
1138
+ if (length > 255)
1139
+ fail("text8 length");
1140
+ if (length < 1)
1141
+ fail("text8 length");
1142
+ return yield* reader.text(length, true, "text8");
1143
+ }
888
1144
  function writeText8(input, writer, context, enclosing, flags) {
889
1145
  void context;
890
1146
  void enclosing;
@@ -893,10 +1149,10 @@ function writeText8(input, writer, context, enclosing, flags) {
893
1149
  const bytes = utf8(value);
894
1150
  if (bytes.includes(0))
895
1151
  fail("text8 NUL");
896
- if (bytes.length > 255)
897
- fail("text8 length");
898
1152
  if (bytes.length > 2147483647)
899
1153
  capacityFail("text8 capacity");
1154
+ if (bytes.length > 255)
1155
+ fail("text8 length");
900
1156
  if (bytes.length < 1)
901
1157
  fail("text8 length");
902
1158
  writeU8(bytes.length, writer, context, enclosing, flags);
@@ -911,10 +1167,10 @@ function readOptionalText8(reader, context, enclosing, flags) {
911
1167
  const length = Number(readU8(reader, context, enclosing, flags));
912
1168
  if (length === 0)
913
1169
  return null;
914
- if (length > 255)
915
- fail("optional-text8 length");
916
1170
  if (length > 2147483647)
917
1171
  capacityFail("optional-text8 capacity");
1172
+ if (length > 255)
1173
+ fail("optional-text8 length");
918
1174
  if (length < 0)
919
1175
  fail("optional-text8 length");
920
1176
  const bytes = reader.take(length);
@@ -934,10 +1190,10 @@ function writeOptionalText8(input, writer, context, enclosing, flags) {
934
1190
  const bytes = utf8(value);
935
1191
  if (bytes.includes(0))
936
1192
  fail("optional-text8 NUL");
937
- if (bytes.length > 255)
938
- fail("optional-text8 length");
939
1193
  if (bytes.length > 2147483647)
940
1194
  capacityFail("optional-text8 capacity");
1195
+ if (bytes.length > 255)
1196
+ fail("optional-text8 length");
941
1197
  if (bytes.length < 0)
942
1198
  fail("optional-text8 length");
943
1199
  writeU8(bytes.length, writer, context, enclosing, flags);
@@ -950,10 +1206,10 @@ function readSha256Bytes(reader, context, enclosing, flags) {
950
1206
  void enclosing;
951
1207
  void flags;
952
1208
  const length = Number(readU8(reader, context, enclosing, flags));
953
- if (length > 32)
954
- fail("sha256-bytes length");
955
1209
  if (length > 2147483647)
956
1210
  capacityFail("sha256-bytes capacity");
1211
+ if (length > 32)
1212
+ fail("sha256-bytes length");
957
1213
  if (length < 32)
958
1214
  fail("sha256-bytes length");
959
1215
  return reader.take(length);
@@ -964,10 +1220,10 @@ function writeSha256Bytes(input, writer, context, enclosing, flags) {
964
1220
  void flags;
965
1221
  const value = input;
966
1222
  const bytes = value;
967
- if (bytes.length > 32)
968
- fail("sha256-bytes length");
969
1223
  if (bytes.length > 2147483647)
970
1224
  capacityFail("sha256-bytes capacity");
1225
+ if (bytes.length > 32)
1226
+ fail("sha256-bytes length");
971
1227
  if (bytes.length < 32)
972
1228
  fail("sha256-bytes length");
973
1229
  writeU8(bytes.length, writer, context, enclosing, flags);
@@ -1001,10 +1257,10 @@ function readText16(reader, context, enclosing, flags) {
1001
1257
  void enclosing;
1002
1258
  void flags;
1003
1259
  const length = Number(readU16(reader, context, enclosing, flags));
1004
- if (length > 65535)
1005
- fail("text16 length");
1006
1260
  if (length > 2147483647)
1007
1261
  capacityFail("text16 capacity");
1262
+ if (length > 65535)
1263
+ fail("text16 length");
1008
1264
  if (length < 0)
1009
1265
  fail("text16 length");
1010
1266
  const bytes = reader.take(length);
@@ -1020,10 +1276,10 @@ function writeText16(input, writer, context, enclosing, flags) {
1020
1276
  const bytes = utf8(value);
1021
1277
  if (bytes.includes(0))
1022
1278
  fail("text16 NUL");
1023
- if (bytes.length > 65535)
1024
- fail("text16 length");
1025
1279
  if (bytes.length > 2147483647)
1026
1280
  capacityFail("text16 capacity");
1281
+ if (bytes.length > 65535)
1282
+ fail("text16 length");
1027
1283
  if (bytes.length < 0)
1028
1284
  fail("text16 length");
1029
1285
  writeU16(bytes.length, writer, context, enclosing, flags);
@@ -1036,10 +1292,10 @@ function readNonemptyText16(reader, context, enclosing, flags) {
1036
1292
  void enclosing;
1037
1293
  void flags;
1038
1294
  const length = Number(readU16(reader, context, enclosing, flags));
1039
- if (length > 65535)
1040
- fail("nonempty-text16 length");
1041
1295
  if (length > 2147483647)
1042
1296
  capacityFail("nonempty-text16 capacity");
1297
+ if (length > 65535)
1298
+ fail("nonempty-text16 length");
1043
1299
  if (length < 1)
1044
1300
  fail("nonempty-text16 length");
1045
1301
  const bytes = reader.take(length);
@@ -1055,10 +1311,10 @@ function writeNonemptyText16(input, writer, context, enclosing, flags) {
1055
1311
  const bytes = utf8(value);
1056
1312
  if (bytes.includes(0))
1057
1313
  fail("nonempty-text16 NUL");
1058
- if (bytes.length > 65535)
1059
- fail("nonempty-text16 length");
1060
1314
  if (bytes.length > 2147483647)
1061
1315
  capacityFail("nonempty-text16 capacity");
1316
+ if (bytes.length > 65535)
1317
+ fail("nonempty-text16 length");
1062
1318
  if (bytes.length < 1)
1063
1319
  fail("nonempty-text16 length");
1064
1320
  writeU16(bytes.length, writer, context, enclosing, flags);
@@ -1071,10 +1327,10 @@ function readEndpoint(reader, context, enclosing, flags) {
1071
1327
  void enclosing;
1072
1328
  void flags;
1073
1329
  const length = Number(readU16(reader, context, enclosing, flags));
1074
- if (length > 4096)
1075
- fail("endpoint length");
1076
1330
  if (length > 2147483647)
1077
1331
  capacityFail("endpoint capacity");
1332
+ if (length > 4096)
1333
+ fail("endpoint length");
1078
1334
  if (length < 1)
1079
1335
  fail("endpoint length");
1080
1336
  const bytes = reader.take(length);
@@ -1090,10 +1346,10 @@ function writeEndpoint(input, writer, context, enclosing, flags) {
1090
1346
  const bytes = utf8(value);
1091
1347
  if (bytes.includes(0))
1092
1348
  fail("endpoint NUL");
1093
- if (bytes.length > 4096)
1094
- fail("endpoint length");
1095
1349
  if (bytes.length > 2147483647)
1096
1350
  capacityFail("endpoint capacity");
1351
+ if (bytes.length > 4096)
1352
+ fail("endpoint length");
1097
1353
  if (bytes.length < 1)
1098
1354
  fail("endpoint length");
1099
1355
  writeU16(bytes.length, writer, context, enclosing, flags);
@@ -1106,10 +1362,10 @@ function readBlob16(reader, context, enclosing, flags) {
1106
1362
  void enclosing;
1107
1363
  void flags;
1108
1364
  const length = Number(readU16(reader, context, enclosing, flags));
1109
- if (length > 65535)
1110
- fail("blob16 length");
1111
1365
  if (length > 2147483647)
1112
1366
  capacityFail("blob16 capacity");
1367
+ if (length > 65535)
1368
+ fail("blob16 length");
1113
1369
  if (length < 0)
1114
1370
  fail("blob16 length");
1115
1371
  return reader.take(length);
@@ -1120,10 +1376,10 @@ function writeBlob16(input, writer, context, enclosing, flags) {
1120
1376
  void flags;
1121
1377
  const value = input;
1122
1378
  const bytes = value;
1123
- if (bytes.length > 65535)
1124
- fail("blob16 length");
1125
1379
  if (bytes.length > 2147483647)
1126
1380
  capacityFail("blob16 capacity");
1381
+ if (bytes.length > 65535)
1382
+ fail("blob16 length");
1127
1383
  if (bytes.length < 0)
1128
1384
  fail("blob16 length");
1129
1385
  writeU16(bytes.length, writer, context, enclosing, flags);
@@ -1136,10 +1392,10 @@ function readNonemptyBlob16(reader, context, enclosing, flags) {
1136
1392
  void enclosing;
1137
1393
  void flags;
1138
1394
  const length = Number(readU16(reader, context, enclosing, flags));
1139
- if (length > 65535)
1140
- fail("nonempty-blob16 length");
1141
1395
  if (length > 2147483647)
1142
1396
  capacityFail("nonempty-blob16 capacity");
1397
+ if (length > 65535)
1398
+ fail("nonempty-blob16 length");
1143
1399
  if (length < 1)
1144
1400
  fail("nonempty-blob16 length");
1145
1401
  return reader.take(length);
@@ -1150,10 +1406,10 @@ function writeNonemptyBlob16(input, writer, context, enclosing, flags) {
1150
1406
  void flags;
1151
1407
  const value = input;
1152
1408
  const bytes = value;
1153
- if (bytes.length > 65535)
1154
- fail("nonempty-blob16 length");
1155
1409
  if (bytes.length > 2147483647)
1156
1410
  capacityFail("nonempty-blob16 capacity");
1411
+ if (bytes.length > 65535)
1412
+ fail("nonempty-blob16 length");
1157
1413
  if (bytes.length < 1)
1158
1414
  fail("nonempty-blob16 length");
1159
1415
  writeU16(bytes.length, writer, context, enclosing, flags);
@@ -1166,10 +1422,10 @@ function readPacketName(reader, context, enclosing, flags) {
1166
1422
  void enclosing;
1167
1423
  void flags;
1168
1424
  const length = Number(readU8(reader, context, enclosing, flags));
1169
- if (length > 255)
1170
- fail("packet-name length");
1171
1425
  if (length > 2147483647)
1172
1426
  capacityFail("packet-name capacity");
1427
+ if (length > 255)
1428
+ fail("packet-name length");
1173
1429
  if (length < 1)
1174
1430
  fail("packet-name length");
1175
1431
  const bytes = reader.take(length);
@@ -1177,6 +1433,19 @@ function readPacketName(reader, context, enclosing, flags) {
1177
1433
  fail("packet-name NUL");
1178
1434
  return decodeUtf8(bytes, "packet-name");
1179
1435
  }
1436
+ function* readIncrementalPacketName(reader, context, enclosing, flags) {
1437
+ void context;
1438
+ void enclosing;
1439
+ void flags;
1440
+ const length = Number(yield* readIncrementalU8(reader, context, enclosing, flags));
1441
+ if (length > 2147483647)
1442
+ capacityFail("packet-name capacity");
1443
+ if (length > 255)
1444
+ fail("packet-name length");
1445
+ if (length < 1)
1446
+ fail("packet-name length");
1447
+ return yield* reader.text(length, true, "packet-name");
1448
+ }
1180
1449
  function writePacketName(input, writer, context, enclosing, flags) {
1181
1450
  void context;
1182
1451
  void enclosing;
@@ -1185,10 +1454,10 @@ function writePacketName(input, writer, context, enclosing, flags) {
1185
1454
  const bytes = utf8(value);
1186
1455
  if (bytes.includes(0))
1187
1456
  fail("packet-name NUL");
1188
- if (bytes.length > 255)
1189
- fail("packet-name length");
1190
1457
  if (bytes.length > 2147483647)
1191
1458
  capacityFail("packet-name capacity");
1459
+ if (bytes.length > 255)
1460
+ fail("packet-name length");
1192
1461
  if (bytes.length < 1)
1193
1462
  fail("packet-name length");
1194
1463
  writeU8(bytes.length, writer, context, enclosing, flags);
@@ -1201,10 +1470,10 @@ function readContentType(reader, context, enclosing, flags) {
1201
1470
  void enclosing;
1202
1471
  void flags;
1203
1472
  const length = Number(readU8(reader, context, enclosing, flags));
1204
- if (length > 255)
1205
- fail("content-type length");
1206
1473
  if (length > 2147483647)
1207
1474
  capacityFail("content-type capacity");
1475
+ if (length > 255)
1476
+ fail("content-type length");
1208
1477
  if (length < 1)
1209
1478
  fail("content-type length");
1210
1479
  const bytes = reader.take(length);
@@ -1212,6 +1481,19 @@ function readContentType(reader, context, enclosing, flags) {
1212
1481
  fail("content-type NUL");
1213
1482
  return decodeUtf8(bytes, "content-type");
1214
1483
  }
1484
+ function* readIncrementalContentType(reader, context, enclosing, flags) {
1485
+ void context;
1486
+ void enclosing;
1487
+ void flags;
1488
+ const length = Number(yield* readIncrementalU8(reader, context, enclosing, flags));
1489
+ if (length > 2147483647)
1490
+ capacityFail("content-type capacity");
1491
+ if (length > 255)
1492
+ fail("content-type length");
1493
+ if (length < 1)
1494
+ fail("content-type length");
1495
+ return yield* reader.text(length, true, "content-type");
1496
+ }
1215
1497
  function writeContentType(input, writer, context, enclosing, flags) {
1216
1498
  void context;
1217
1499
  void enclosing;
@@ -1220,10 +1502,10 @@ function writeContentType(input, writer, context, enclosing, flags) {
1220
1502
  const bytes = utf8(value);
1221
1503
  if (bytes.includes(0))
1222
1504
  fail("content-type NUL");
1223
- if (bytes.length > 255)
1224
- fail("content-type length");
1225
1505
  if (bytes.length > 2147483647)
1226
1506
  capacityFail("content-type capacity");
1507
+ if (bytes.length > 255)
1508
+ fail("content-type length");
1227
1509
  if (bytes.length < 1)
1228
1510
  fail("content-type length");
1229
1511
  writeU8(bytes.length, writer, context, enclosing, flags);
@@ -1236,16 +1518,32 @@ function readApplicationPayloadBytes(reader, context, enclosing, flags) {
1236
1518
  void enclosing;
1237
1519
  void flags;
1238
1520
  const length = Number(readU32(reader, context, enclosing, flags));
1521
+ if (length > 2147483647)
1522
+ capacityFail("application-payload-bytes capacity");
1239
1523
  if (length > 4294966774)
1240
1524
  fail("application-payload-bytes length");
1525
+ if (length < 0)
1526
+ fail("application-payload-bytes length");
1527
+ const negotiatedMaximum = numeric(requireContext(context, "effectiveCompleteMessageBytesMinusActualEnvelopeOverhead"));
1528
+ if (negotiatedMaximum < 0n || negotiatedMaximum > 4294966774n || BigInt(length) > negotiatedMaximum)
1529
+ fail("application-payload-bytes negotiated maximum");
1530
+ return reader.take(length);
1531
+ }
1532
+ function* readIncrementalApplicationPayloadBytes(reader, context, enclosing, flags) {
1533
+ void context;
1534
+ void enclosing;
1535
+ void flags;
1536
+ const length = Number(yield* readIncrementalU32(reader, context, enclosing, flags));
1241
1537
  if (length > 2147483647)
1242
1538
  capacityFail("application-payload-bytes capacity");
1539
+ if (length > 4294966774)
1540
+ fail("application-payload-bytes length");
1243
1541
  if (length < 0)
1244
1542
  fail("application-payload-bytes length");
1245
1543
  const negotiatedMaximum = numeric(requireContext(context, "effectiveCompleteMessageBytesMinusActualEnvelopeOverhead"));
1246
1544
  if (negotiatedMaximum < 0n || negotiatedMaximum > 4294966774n || BigInt(length) > negotiatedMaximum)
1247
1545
  fail("application-payload-bytes negotiated maximum");
1248
- return reader.take(length);
1546
+ return yield* reader.bytes(length);
1249
1547
  }
1250
1548
  function writeApplicationPayloadBytes(input, writer, context, enclosing, flags) {
1251
1549
  void context;
@@ -1253,10 +1551,10 @@ function writeApplicationPayloadBytes(input, writer, context, enclosing, flags)
1253
1551
  void flags;
1254
1552
  const value = input;
1255
1553
  const bytes = value;
1256
- if (bytes.length > 4294966774)
1257
- fail("application-payload-bytes length");
1258
1554
  if (bytes.length > 2147483647)
1259
1555
  capacityFail("application-payload-bytes capacity");
1556
+ if (bytes.length > 4294966774)
1557
+ fail("application-payload-bytes length");
1260
1558
  if (bytes.length < 0)
1261
1559
  fail("application-payload-bytes length");
1262
1560
  writeU32(bytes.length, writer, context, enclosing, flags);
@@ -1293,6 +1591,32 @@ function readApplicationPayloadEnvelopeV1(reader, context, enclosing, flags) {
1293
1591
  fail("application-payload-envelope-v1 maximum");
1294
1592
  return decoded;
1295
1593
  }
1594
+ function* readIncrementalApplicationPayloadEnvelopeV1(reader, context, enclosing, flags) {
1595
+ void context;
1596
+ void enclosing;
1597
+ void flags;
1598
+ const limitStart = reader.offset;
1599
+ const decoded = yield* (function* () {
1600
+ const encodedStart = reader.offset;
1601
+ const version = yield* readIncrementalU8(reader, context, enclosing, flags);
1602
+ if (!same(version, 1))
1603
+ fail("application-payload-envelope-v1 version");
1604
+ const length = Number(yield* readIncrementalU32(reader, context, enclosing, flags));
1605
+ const body = reader.bounded(length);
1606
+ const value = {};
1607
+ value["packetName"] = yield* readIncrementalPacketName(body, context, value, flags);
1608
+ value["contentType"] = yield* readIncrementalContentType(body, context, value, flags);
1609
+ value["payload"] = yield* readIncrementalApplicationPayloadBytes(body, context, value, flags);
1610
+ body.done("application-payload-envelope-v1");
1611
+ const negotiatedMaximum = numeric(requireContext(context, "effectiveCompleteMessageBytes"));
1612
+ if (negotiatedMaximum < 0n || negotiatedMaximum > 4294967295n || BigInt(reader.offset - encodedStart) > negotiatedMaximum)
1613
+ fail("application-payload-envelope-v1 negotiated maximum");
1614
+ return value;
1615
+ })();
1616
+ if (reader.offset - limitStart > 4294967295)
1617
+ fail("application-payload-envelope-v1 maximum");
1618
+ return decoded;
1619
+ }
1296
1620
  function writeApplicationPayloadEnvelopeV1(input, writer, context, enclosing, flags) {
1297
1621
  void context;
1298
1622
  void enclosing;
@@ -1327,10 +1651,10 @@ function readMetadataValue(reader, context, enclosing, flags) {
1327
1651
  void enclosing;
1328
1652
  void flags;
1329
1653
  const length = Number(readU16(reader, context, enclosing, flags));
1330
- if (length > 1024)
1331
- fail("metadata-value length");
1332
1654
  if (length > 2147483647)
1333
1655
  capacityFail("metadata-value capacity");
1656
+ if (length > 1024)
1657
+ fail("metadata-value length");
1334
1658
  if (length < 0)
1335
1659
  fail("metadata-value length");
1336
1660
  const bytes = reader.take(length);
@@ -1338,6 +1662,19 @@ function readMetadataValue(reader, context, enclosing, flags) {
1338
1662
  fail("metadata-value NUL");
1339
1663
  return decodeUtf8(bytes, "metadata-value");
1340
1664
  }
1665
+ function* readIncrementalMetadataValue(reader, context, enclosing, flags) {
1666
+ void context;
1667
+ void enclosing;
1668
+ void flags;
1669
+ const length = Number(yield* readIncrementalU16(reader, context, enclosing, flags));
1670
+ if (length > 2147483647)
1671
+ capacityFail("metadata-value capacity");
1672
+ if (length > 1024)
1673
+ fail("metadata-value length");
1674
+ if (length < 0)
1675
+ fail("metadata-value length");
1676
+ return yield* reader.text(length, true, "metadata-value");
1677
+ }
1341
1678
  function writeMetadataValue(input, writer, context, enclosing, flags) {
1342
1679
  void context;
1343
1680
  void enclosing;
@@ -1346,10 +1683,10 @@ function writeMetadataValue(input, writer, context, enclosing, flags) {
1346
1683
  const bytes = utf8(value);
1347
1684
  if (bytes.includes(0))
1348
1685
  fail("metadata-value NUL");
1349
- if (bytes.length > 1024)
1350
- fail("metadata-value length");
1351
1686
  if (bytes.length > 2147483647)
1352
1687
  capacityFail("metadata-value capacity");
1688
+ if (bytes.length > 1024)
1689
+ fail("metadata-value length");
1353
1690
  if (bytes.length < 0)
1354
1691
  fail("metadata-value length");
1355
1692
  writeU16(bytes.length, writer, context, enclosing, flags);
@@ -1366,6 +1703,15 @@ function readMetadataEntry(reader, context, enclosing, flags) {
1366
1703
  value["value"] = readMetadataValue(reader, context, value, flags);
1367
1704
  return value;
1368
1705
  }
1706
+ function* readIncrementalMetadataEntry(reader, context, enclosing, flags) {
1707
+ void context;
1708
+ void enclosing;
1709
+ void flags;
1710
+ const value = {};
1711
+ value["key"] = yield* readIncrementalText8(reader, context, value, flags);
1712
+ value["value"] = yield* readIncrementalMetadataValue(reader, context, value, flags);
1713
+ return value;
1714
+ }
1369
1715
  function writeMetadataEntry(input, writer, context, enclosing, flags) {
1370
1716
  void context;
1371
1717
  void enclosing;
@@ -1393,10 +1739,60 @@ function readMetadataFrame(reader, context, enclosing, flags) {
1393
1739
  fail("metadata-frame constant");
1394
1740
  layout.count = readU8(reader, context, enclosing, flags);
1395
1741
  value.entries = Array.from({ length: Number(layout.count) }, () => readMetadataEntry(reader, context, enclosing, flags));
1396
- for (let left = 0; left < value.entries.length; ++left)
1397
- for (let right = left + 1; right < value.entries.length; ++right)
1398
- if (compareResults([compareBytes(utf8(value.entries[left]["key"]), utf8(value.entries[right]["key"]))]) === 0)
1399
- fail("metadata-frame unique");
1742
+ try {
1743
+ for (let left = 0; left < value.entries.length; ++left)
1744
+ for (let right = left + 1; right < value.entries.length; ++right)
1745
+ if (compareResults([compareBytes(utf8(value.entries[left]["key"]), utf8(value.entries[right]["key"]))]) === 0)
1746
+ fail("metadata-frame unique");
1747
+ }
1748
+ catch (error) {
1749
+ if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError)
1750
+ throw error;
1751
+ if (error instanceof RangeError)
1752
+ capacityFail("metadata-frame constraint capacity");
1753
+ throw error;
1754
+ }
1755
+ return value;
1756
+ })();
1757
+ if (reader.offset - limitStart > 1024)
1758
+ fail("metadata-frame maximum");
1759
+ return decoded;
1760
+ }
1761
+ function* readIncrementalMetadataFrame(reader, context, enclosing, flags) {
1762
+ void context;
1763
+ void enclosing;
1764
+ void flags;
1765
+ const limitStart = reader.offset;
1766
+ const decoded = yield* (function* () {
1767
+ const layout = {};
1768
+ const value = {};
1769
+ layout.version = yield* readIncrementalU8(reader, context, enclosing, flags);
1770
+ if (!same(layout.version, 1))
1771
+ fail("metadata-frame constant");
1772
+ layout.count = yield* readIncrementalU8(reader, context, enclosing, flags);
1773
+ value.entries = [];
1774
+ for (let index = 0; index < Number(layout.count); ++index) {
1775
+ const item = yield* readIncrementalMetadataEntry(reader, context, enclosing, flags);
1776
+ try {
1777
+ value.entries.push(item);
1778
+ }
1779
+ catch {
1780
+ capacityFail("metadata-frame capacity");
1781
+ }
1782
+ }
1783
+ try {
1784
+ for (let left = 0; left < value.entries.length; ++left)
1785
+ for (let right = left + 1; right < value.entries.length; ++right)
1786
+ if (compareResults([compareBytes(utf8(value.entries[left]["key"]), utf8(value.entries[right]["key"]))]) === 0)
1787
+ fail("metadata-frame unique");
1788
+ }
1789
+ catch (error) {
1790
+ if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError)
1791
+ throw error;
1792
+ if (error instanceof RangeError)
1793
+ capacityFail("metadata-frame constraint capacity");
1794
+ throw error;
1795
+ }
1400
1796
  return value;
1401
1797
  })();
1402
1798
  if (reader.offset - limitStart > 1024)
@@ -1409,10 +1805,19 @@ function writeMetadataFrame(input, writer, context, enclosing, flags) {
1409
1805
  void flags;
1410
1806
  const value = input;
1411
1807
  const limitStart = writer.length;
1412
- for (let left = 0; left < value.entries.length; ++left)
1413
- for (let right = left + 1; right < value.entries.length; ++right)
1414
- if (compareResults([compareBytes(utf8(value.entries[left]["key"]), utf8(value.entries[right]["key"]))]) === 0)
1415
- fail("metadata-frame unique");
1808
+ try {
1809
+ for (let left = 0; left < value.entries.length; ++left)
1810
+ for (let right = left + 1; right < value.entries.length; ++right)
1811
+ if (compareResults([compareBytes(utf8(value.entries[left]["key"]), utf8(value.entries[right]["key"]))]) === 0)
1812
+ fail("metadata-frame unique");
1813
+ }
1814
+ catch (error) {
1815
+ if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError)
1816
+ throw error;
1817
+ if (error instanceof RangeError)
1818
+ capacityFail("metadata-frame constraint capacity");
1819
+ throw error;
1820
+ }
1416
1821
  writeU8(1, writer, context, enclosing, flags);
1417
1822
  writeU8(value.entries.length, writer, context, enclosing, flags);
1418
1823
  for (const item of value.entries)
@@ -1473,6 +1878,18 @@ function readStatefulObjectKind(reader, context, enclosing, flags) {
1473
1878
  default: fail("stateful-object-kind enum");
1474
1879
  }
1475
1880
  }
1881
+ function* readIncrementalStatefulObjectKind(reader, context, enclosing, flags) {
1882
+ void context;
1883
+ void enclosing;
1884
+ void flags;
1885
+ const raw = yield* reader.u(1);
1886
+ switch (Number(raw)) {
1887
+ case 1: return "actor";
1888
+ case 2: return "userSpot";
1889
+ case 3: return "instanceSpot";
1890
+ default: fail("stateful-object-kind enum");
1891
+ }
1892
+ }
1476
1893
  function writeStatefulObjectKind(input, writer, context, enclosing, flags) {
1477
1894
  void context;
1478
1895
  void enclosing;
@@ -1709,6 +2126,18 @@ function readTimerOverrunPolicyKind(reader, context, enclosing, flags) {
1709
2126
  default: fail("timer-overrun-policy-kind enum");
1710
2127
  }
1711
2128
  }
2129
+ function* readIncrementalTimerOverrunPolicyKind(reader, context, enclosing, flags) {
2130
+ void context;
2131
+ void enclosing;
2132
+ void flags;
2133
+ const raw = yield* reader.u(1);
2134
+ switch (Number(raw)) {
2135
+ case 1: return "skipLateTicks";
2136
+ case 2: return "catchUpBounded";
2137
+ case 3: return "delayNextTick";
2138
+ default: fail("timer-overrun-policy-kind enum");
2139
+ }
2140
+ }
1712
2141
  function writeTimerOverrunPolicyKind(input, writer, context, enclosing, flags) {
1713
2142
  void context;
1714
2143
  void enclosing;
@@ -1763,6 +2192,18 @@ function readRelocationRole(reader, context, enclosing, flags) {
1763
2192
  default: fail("relocation-role enum");
1764
2193
  }
1765
2194
  }
2195
+ function* readIncrementalRelocationRole(reader, context, enclosing, flags) {
2196
+ void context;
2197
+ void enclosing;
2198
+ void flags;
2199
+ const raw = yield* reader.u(1);
2200
+ switch (Number(raw)) {
2201
+ case 1: return "source";
2202
+ case 2: return "target";
2203
+ case 3: return "coordinator";
2204
+ default: fail("relocation-role enum");
2205
+ }
2206
+ }
1766
2207
  function writeRelocationRole(input, writer, context, enclosing, flags) {
1767
2208
  void context;
1768
2209
  void enclosing;
@@ -1892,6 +2333,29 @@ function readMeshRecordKind(reader, context, enclosing, flags) {
1892
2333
  default: fail("mesh-record-kind enum");
1893
2334
  }
1894
2335
  }
2336
+ function* readIncrementalMeshRecordKind(reader, context, enclosing, flags) {
2337
+ void context;
2338
+ void enclosing;
2339
+ void flags;
2340
+ const raw = yield* reader.u(1);
2341
+ switch (Number(raw)) {
2342
+ case 1: return "nodeSend";
2343
+ case 2: return "nodeRequest";
2344
+ case 3: return "channelSend";
2345
+ case 4: return "channelRequest";
2346
+ case 5: return "spotSend";
2347
+ case 6: return "spotRequest";
2348
+ case 7: return "spotMulticast";
2349
+ case 8: return "spotControl";
2350
+ case 9: return "actorSend";
2351
+ case 10: return "actorRequest";
2352
+ case 11: return "completion";
2353
+ case 12: return "sendReady";
2354
+ case 13: return "relocationControl";
2355
+ case 14: return "instanceSpotActivation";
2356
+ default: fail("mesh-record-kind enum");
2357
+ }
2358
+ }
1895
2359
  function writeMeshRecordKind(input, writer, context, enclosing, flags) {
1896
2360
  void context;
1897
2361
  void enclosing;
@@ -1922,6 +2386,19 @@ function readFrozenSourceKind(reader, context, enclosing, flags) {
1922
2386
  default: fail("frozen-source-kind enum");
1923
2387
  }
1924
2388
  }
2389
+ function* readIncrementalFrozenSourceKind(reader, context, enclosing, flags) {
2390
+ void context;
2391
+ void enclosing;
2392
+ void flags;
2393
+ const raw = yield* reader.u(1);
2394
+ switch (Number(raw)) {
2395
+ case 1: return "node";
2396
+ case 2: return "spot";
2397
+ case 3: return "actor";
2398
+ case 4: return "boundSession";
2399
+ default: fail("frozen-source-kind enum");
2400
+ }
2401
+ }
1925
2402
  function writeFrozenSourceKind(input, writer, context, enclosing, flags) {
1926
2403
  void context;
1927
2404
  void enclosing;
@@ -1954,6 +2431,20 @@ function readMeshDestinationKind(reader, context, enclosing, flags) {
1954
2431
  default: fail("mesh-destination-kind enum");
1955
2432
  }
1956
2433
  }
2434
+ function* readIncrementalMeshDestinationKind(reader, context, enclosing, flags) {
2435
+ void context;
2436
+ void enclosing;
2437
+ void flags;
2438
+ const raw = yield* reader.u(1);
2439
+ switch (Number(raw)) {
2440
+ case 1: return "node";
2441
+ case 2: return "channel";
2442
+ case 3: return "spot";
2443
+ case 4: return "actor";
2444
+ case 5: return "boundSession";
2445
+ default: fail("mesh-destination-kind enum");
2446
+ }
2447
+ }
1957
2448
  function writeMeshDestinationKind(input, writer, context, enclosing, flags) {
1958
2449
  void context;
1959
2450
  void enclosing;
@@ -2062,6 +2553,20 @@ function readActorLifecycleKind(reader, context, enclosing, flags) {
2062
2553
  default: fail("actor-lifecycle-kind enum");
2063
2554
  }
2064
2555
  }
2556
+ function* readIncrementalActorLifecycleKind(reader, context, enclosing, flags) {
2557
+ void context;
2558
+ void enclosing;
2559
+ void flags;
2560
+ const raw = yield* reader.u(1);
2561
+ switch (Number(raw)) {
2562
+ case 1: return "created";
2563
+ case 2: return "joined";
2564
+ case 3: return "left";
2565
+ case 4: return "disconnected";
2566
+ case 5: return "destroyed";
2567
+ default: fail("actor-lifecycle-kind enum");
2568
+ }
2569
+ }
2065
2570
  function writeActorLifecycleKind(input, writer, context, enclosing, flags) {
2066
2571
  void context;
2067
2572
  void enclosing;
@@ -2156,6 +2661,25 @@ function readRelocationPhase(reader, context, enclosing, flags) {
2156
2661
  default: fail("relocation-phase enum");
2157
2662
  }
2158
2663
  }
2664
+ function* readIncrementalRelocationPhase(reader, context, enclosing, flags) {
2665
+ void context;
2666
+ void enclosing;
2667
+ void flags;
2668
+ const raw = yield* reader.u(1);
2669
+ switch (Number(raw)) {
2670
+ case 0: return "none";
2671
+ case 1: return "preparing";
2672
+ case 2: return "captured";
2673
+ case 3: return "prepared";
2674
+ case 4: return "committed";
2675
+ case 5: return "activating";
2676
+ case 6: return "activated";
2677
+ case 7: return "cleaning";
2678
+ case 8: return "completed";
2679
+ case 9: return "aborted";
2680
+ default: fail("relocation-phase enum");
2681
+ }
2682
+ }
2159
2683
  function writeRelocationPhase(input, writer, context, enclosing, flags) {
2160
2684
  void context;
2161
2685
  void enclosing;
@@ -2269,11 +2793,36 @@ function enumWireMeshOperationKind(value) {
2269
2793
  case "actorCreate": return 15;
2270
2794
  }
2271
2795
  }
2272
- function readMeshOperationKind(reader, context, enclosing, flags) {
2796
+ function readMeshOperationKind(reader, context, enclosing, flags) {
2797
+ void context;
2798
+ void enclosing;
2799
+ void flags;
2800
+ const raw = reader.u(4);
2801
+ switch (Number(raw)) {
2802
+ case 0: return "none";
2803
+ case 1: return "nodeRequest";
2804
+ case 2: return "channelRequest";
2805
+ case 3: return "spotRequest";
2806
+ case 4: return "actorRequest";
2807
+ case 5: return "actorLookup";
2808
+ case 6: return "actorDestroy";
2809
+ case 7: return "actorJoin";
2810
+ case 8: return "actorLeave";
2811
+ case 9: return "streamBind";
2812
+ case 10: return "streamUnbind";
2813
+ case 11: return "streamClose";
2814
+ case 12: return "instanceSpotRequest";
2815
+ case 13: return "userSpotCreate";
2816
+ case 14: return "userSpotClose";
2817
+ case 15: return "actorCreate";
2818
+ default: fail("mesh-operation-kind enum");
2819
+ }
2820
+ }
2821
+ function* readIncrementalMeshOperationKind(reader, context, enclosing, flags) {
2273
2822
  void context;
2274
2823
  void enclosing;
2275
2824
  void flags;
2276
- const raw = reader.u(4);
2825
+ const raw = yield* reader.u(4);
2277
2826
  switch (Number(raw)) {
2278
2827
  case 0: return "none";
2279
2828
  case 1: return "nodeRequest";
@@ -2344,6 +2893,29 @@ function readRequestTerminalResult(reader, context, enclosing, flags) {
2344
2893
  default: fail("request-terminal-result enum");
2345
2894
  }
2346
2895
  }
2896
+ function* readIncrementalRequestTerminalResult(reader, context, enclosing, flags) {
2897
+ void context;
2898
+ void enclosing;
2899
+ void flags;
2900
+ const raw = yield* reader.u(4);
2901
+ switch (Number(raw)) {
2902
+ case 0: return "ok";
2903
+ case 101: return "timedOut";
2904
+ case 102: return "notFound";
2905
+ case 103: return "terminated";
2906
+ case 104: return "protocolError";
2907
+ case 105: return "internalError";
2908
+ case 106: return "rejected";
2909
+ case 107: return "conflict";
2910
+ case 108: return "busy";
2911
+ case 109: return "notConnected";
2912
+ case 110: return "invalidArgument";
2913
+ case 111: return "invalidState";
2914
+ case 112: return "notSupported";
2915
+ case 113: return "backpressured";
2916
+ default: fail("request-terminal-result enum");
2917
+ }
2918
+ }
2347
2919
  function writeRequestTerminalResult(input, writer, context, enclosing, flags) {
2348
2920
  void context;
2349
2921
  void enclosing;
@@ -2418,6 +2990,41 @@ function readFrameworkErrorCode(reader, context, enclosing, flags) {
2418
2990
  default: fail("framework-error-code enum");
2419
2991
  }
2420
2992
  }
2993
+ function* readIncrementalFrameworkErrorCode(reader, context, enclosing, flags) {
2994
+ void context;
2995
+ void enclosing;
2996
+ void flags;
2997
+ const raw = yield* reader.u(4);
2998
+ switch (Number(raw)) {
2999
+ case 0: return "none";
3000
+ case 1: return "actorRouteNotFound";
3001
+ case 2: return "actorCreateFailed";
3002
+ case 3: return "actorAlreadyExists";
3003
+ case 4: return "actorTypeMismatch";
3004
+ case 5: return "spotCreateFailed";
3005
+ case 6: return "spotRouteNotFound";
3006
+ case 7: return "spotTypeMismatch";
3007
+ case 8: return "actorSessionNotBound";
3008
+ case 9: return "handlerNotFound";
3009
+ case 10: return "routeHandlerNotFound";
3010
+ case 11: return "actorDispatchHandlerNotFound";
3011
+ case 12: return "payloadDecodeFailed";
3012
+ case 13: return "routeNotConnected";
3013
+ case 14: return "requestTargetNotFound";
3014
+ case 15: return "requestRejected";
3015
+ case 16: return "requestProtocolError";
3016
+ case 17: return "requestFailed";
3017
+ case 18: return "workerQueueFull";
3018
+ case 19: return "workerTimedOut";
3019
+ case 20: return "workerFailed";
3020
+ case 21: return "actorLocationStale";
3021
+ case 22: return "actorCreateRejected";
3022
+ case 33: return "spotGenerationStale";
3023
+ case 34: return "spotMoving";
3024
+ case 35: return "relocationDataLost";
3025
+ default: fail("framework-error-code enum");
3026
+ }
3027
+ }
2421
3028
  function writeFrameworkErrorCode(input, writer, context, enclosing, flags) {
2422
3029
  void context;
2423
3030
  void enclosing;
@@ -2444,6 +3051,17 @@ function readInstanceOperationKind(reader, context, enclosing, flags) {
2444
3051
  default: fail("instance-operation-kind enum");
2445
3052
  }
2446
3053
  }
3054
+ function* readIncrementalInstanceOperationKind(reader, context, enclosing, flags) {
3055
+ void context;
3056
+ void enclosing;
3057
+ void flags;
3058
+ const raw = yield* reader.u(1);
3059
+ switch (Number(raw)) {
3060
+ case 1: return "send";
3061
+ case 2: return "request";
3062
+ default: fail("instance-operation-kind enum");
3063
+ }
3064
+ }
2447
3065
  function writeInstanceOperationKind(input, writer, context, enclosing, flags) {
2448
3066
  void context;
2449
3067
  void enclosing;
@@ -2470,6 +3088,17 @@ function readInstanceRouteKind(reader, context, enclosing, flags) {
2470
3088
  default: fail("instance-route-kind enum");
2471
3089
  }
2472
3090
  }
3091
+ function* readIncrementalInstanceRouteKind(reader, context, enclosing, flags) {
3092
+ void context;
3093
+ void enclosing;
3094
+ void flags;
3095
+ const raw = yield* reader.u(1);
3096
+ switch (Number(raw)) {
3097
+ case 1: return "ready";
3098
+ case 2: return "coldActivation";
3099
+ default: fail("instance-route-kind enum");
3100
+ }
3101
+ }
2473
3102
  function writeInstanceRouteKind(input, writer, context, enclosing, flags) {
2474
3103
  void context;
2475
3104
  void enclosing;
@@ -2672,6 +3301,15 @@ function readActorRef(reader, context, enclosing, flags) {
2672
3301
  value["objectGeneration"] = readNonzeroU64(reader, context, value, flags);
2673
3302
  return value;
2674
3303
  }
3304
+ function* readIncrementalActorRef(reader, context, enclosing, flags) {
3305
+ void context;
3306
+ void enclosing;
3307
+ void flags;
3308
+ const value = {};
3309
+ value["actorId"] = yield* readIncrementalText8(reader, context, value, flags);
3310
+ value["objectGeneration"] = yield* readIncrementalNonzeroU64(reader, context, value, flags);
3311
+ return value;
3312
+ }
2675
3313
  function writeActorRef(input, writer, context, enclosing, flags) {
2676
3314
  void context;
2677
3315
  void enclosing;
@@ -2695,6 +3333,15 @@ function readSpotRef(reader, context, enclosing, flags) {
2695
3333
  value["objectGeneration"] = readNonzeroU64(reader, context, value, flags);
2696
3334
  return value;
2697
3335
  }
3336
+ function* readIncrementalSpotRef(reader, context, enclosing, flags) {
3337
+ void context;
3338
+ void enclosing;
3339
+ void flags;
3340
+ const value = {};
3341
+ value["spotId"] = yield* readIncrementalText8(reader, context, value, flags);
3342
+ value["objectGeneration"] = yield* readIncrementalNonzeroU64(reader, context, value, flags);
3343
+ return value;
3344
+ }
2698
3345
  function writeSpotRef(input, writer, context, enclosing, flags) {
2699
3346
  void context;
2700
3347
  void enclosing;
@@ -2787,6 +3434,9 @@ function readCreationOperationTerminalV1(reader, context, enclosing, flags) {
2787
3434
  fail("creation-operation-terminal-v1 terminal-failure-shape");
2788
3435
  if (value["creation"] !== undefined && same(value["creation"]["createResult"], "existing") && !(same(value["hasApplicationPayload"], "false")))
2789
3436
  fail("creation-operation-terminal-v1 existing-has-no-application-payload");
3437
+ void context;
3438
+ if (!(validTerminalFailure(enumWireRequestTerminalResult(value["terminalResult"]), enumWireFrameworkErrorCode(value["failureCode"]))))
3439
+ fail("creation-operation-terminal-v1 runtime predicate");
2790
3440
  return value;
2791
3441
  })();
2792
3442
  if (reader.offset - limitStart > 1048576)
@@ -2805,6 +3455,9 @@ function writeCreationOperationTerminalV1(input, writer, context, enclosing, fla
2805
3455
  fail("creation-operation-terminal-v1 terminal-failure-shape");
2806
3456
  if (value["creation"] !== undefined && same(value["creation"]["createResult"], "existing") && !(same(value["hasApplicationPayload"], "false")))
2807
3457
  fail("creation-operation-terminal-v1 existing-has-no-application-payload");
3458
+ void context;
3459
+ if (!(validTerminalFailure(enumWireRequestTerminalResult(value["terminalResult"]), enumWireFrameworkErrorCode(value["failureCode"]))))
3460
+ fail("creation-operation-terminal-v1 runtime predicate");
2808
3461
  writeU8(1, writer, context, enclosing, flags);
2809
3462
  const body = new Writer();
2810
3463
  if (value["terminalResult"] === undefined)
@@ -2890,6 +3543,14 @@ function readSpotMembership(reader, context, enclosing, flags) {
2890
3543
  value["spot"] = readSpotRef(reader, context, value, flags);
2891
3544
  return value;
2892
3545
  }
3546
+ function* readIncrementalSpotMembership(reader, context, enclosing, flags) {
3547
+ void context;
3548
+ void enclosing;
3549
+ void flags;
3550
+ const value = {};
3551
+ value["spot"] = yield* readIncrementalSpotRef(reader, context, value, flags);
3552
+ return value;
3553
+ }
2893
3554
  function writeSpotMembership(input, writer, context, enclosing, flags) {
2894
3555
  void context;
2895
3556
  void enclosing;
@@ -3570,10 +4231,10 @@ function readAggregateParticipantMutationBytes(reader, context, enclosing, flags
3570
4231
  void enclosing;
3571
4232
  void flags;
3572
4233
  const length = Number(readU32(reader, context, enclosing, flags));
3573
- if (length > 1048576)
3574
- fail("aggregate-participant-mutation-bytes length");
3575
4234
  if (length > 2147483647)
3576
4235
  capacityFail("aggregate-participant-mutation-bytes capacity");
4236
+ if (length > 1048576)
4237
+ fail("aggregate-participant-mutation-bytes length");
3577
4238
  if (length < 1)
3578
4239
  fail("aggregate-participant-mutation-bytes length");
3579
4240
  return reader.take(length);
@@ -3584,10 +4245,10 @@ function writeAggregateParticipantMutationBytes(input, writer, context, enclosin
3584
4245
  void flags;
3585
4246
  const value = input;
3586
4247
  const bytes = value;
3587
- if (bytes.length > 1048576)
3588
- fail("aggregate-participant-mutation-bytes length");
3589
4248
  if (bytes.length > 2147483647)
3590
4249
  capacityFail("aggregate-participant-mutation-bytes capacity");
4250
+ if (bytes.length > 1048576)
4251
+ fail("aggregate-participant-mutation-bytes length");
3591
4252
  if (bytes.length < 1)
3592
4253
  fail("aggregate-participant-mutation-bytes length");
3593
4254
  writeU32(bytes.length, writer, context, enclosing, flags);
@@ -3630,13 +4291,18 @@ function readAggregateParticipantVector(reader, context, enclosing, flags) {
3630
4291
  if (count > 1024)
3631
4292
  fail("aggregate-participant-vector count");
3632
4293
  const value = Array.from({ length: count }, () => readMaintenanceAggregateParticipantV1(reader, context, enclosing, flags));
3633
- for (let index = 1; index < value.length; ++index)
3634
- if (compareBytes((same(value[index - 1]["object"]["objectKind"], "actor") ? canonicalAuthorityKey("zla1", ":", "a", [utf8(value[index - 1]["object"]["actor"]["actorId"])], 1, 255, 776) : same(value[index - 1]["object"]["objectKind"], "userSpot") ? canonicalAuthorityKey("zla1", ":", "s", [utf8(value[index - 1]["object"]["spot"]["spotId"])], 1, 255, 776) : same(value[index - 1]["object"]["objectKind"], "instanceSpot") ? canonicalAuthorityKey("zla1", ":", "s", [utf8(value[index - 1]["object"]["spotId"])], 1, 255, 776) : fail("aggregate-participant-vector authority key variant")), (same(value[index]["object"]["objectKind"], "actor") ? canonicalAuthorityKey("zla1", ":", "a", [utf8(value[index]["object"]["actor"]["actorId"])], 1, 255, 776) : same(value[index]["object"]["objectKind"], "userSpot") ? canonicalAuthorityKey("zla1", ":", "s", [utf8(value[index]["object"]["spot"]["spotId"])], 1, 255, 776) : same(value[index]["object"]["objectKind"], "instanceSpot") ? canonicalAuthorityKey("zla1", ":", "s", [utf8(value[index]["object"]["spotId"])], 1, 255, 776) : fail("aggregate-participant-vector authority key variant"))) >= 0)
3635
- fail("aggregate-participant-vector sorted");
3636
- for (let left = 0; left < value.length; ++left)
3637
- for (let right = left + 1; right < value.length; ++right)
3638
- if (compareBytes((same(value[left]["object"]["objectKind"], "actor") ? canonicalAuthorityKey("zla1", ":", "a", [utf8(value[left]["object"]["actor"]["actorId"])], 1, 255, 776) : same(value[left]["object"]["objectKind"], "userSpot") ? canonicalAuthorityKey("zla1", ":", "s", [utf8(value[left]["object"]["spot"]["spotId"])], 1, 255, 776) : same(value[left]["object"]["objectKind"], "instanceSpot") ? canonicalAuthorityKey("zla1", ":", "s", [utf8(value[left]["object"]["spotId"])], 1, 255, 776) : fail("aggregate-participant-vector authority key variant")), (same(value[right]["object"]["objectKind"], "actor") ? canonicalAuthorityKey("zla1", ":", "a", [utf8(value[right]["object"]["actor"]["actorId"])], 1, 255, 776) : same(value[right]["object"]["objectKind"], "userSpot") ? canonicalAuthorityKey("zla1", ":", "s", [utf8(value[right]["object"]["spot"]["spotId"])], 1, 255, 776) : same(value[right]["object"]["objectKind"], "instanceSpot") ? canonicalAuthorityKey("zla1", ":", "s", [utf8(value[right]["object"]["spotId"])], 1, 255, 776) : fail("aggregate-participant-vector authority key variant"))) === 0)
3639
- fail("aggregate-participant-vector unique");
4294
+ try {
4295
+ for (let index = 1; index < value.length; ++index)
4296
+ if (compareBytes((same(value[index - 1]["object"]["objectKind"], "actor") ? canonicalAuthorityKey("zla1", ":", "a", [utf8(value[index - 1]["object"]["actor"]["actorId"])], 1, 255, 776) : same(value[index - 1]["object"]["objectKind"], "userSpot") ? canonicalAuthorityKey("zla1", ":", "s", [utf8(value[index - 1]["object"]["spot"]["spotId"])], 1, 255, 776) : same(value[index - 1]["object"]["objectKind"], "instanceSpot") ? canonicalAuthorityKey("zla1", ":", "s", [utf8(value[index - 1]["object"]["spotId"])], 1, 255, 776) : fail("aggregate-participant-vector authority key variant")), (same(value[index]["object"]["objectKind"], "actor") ? canonicalAuthorityKey("zla1", ":", "a", [utf8(value[index]["object"]["actor"]["actorId"])], 1, 255, 776) : same(value[index]["object"]["objectKind"], "userSpot") ? canonicalAuthorityKey("zla1", ":", "s", [utf8(value[index]["object"]["spot"]["spotId"])], 1, 255, 776) : same(value[index]["object"]["objectKind"], "instanceSpot") ? canonicalAuthorityKey("zla1", ":", "s", [utf8(value[index]["object"]["spotId"])], 1, 255, 776) : fail("aggregate-participant-vector authority key variant"))) >= 0)
4297
+ fail("aggregate-participant-vector sorted");
4298
+ }
4299
+ catch (error) {
4300
+ if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError)
4301
+ throw error;
4302
+ if (error instanceof RangeError)
4303
+ capacityFail("aggregate-participant-vector constraint capacity");
4304
+ throw error;
4305
+ }
3640
4306
  return value;
3641
4307
  }
3642
4308
  function writeAggregateParticipantVector(input, writer, context, enclosing, flags) {
@@ -3646,13 +4312,18 @@ function writeAggregateParticipantVector(input, writer, context, enclosing, flag
3646
4312
  const value = input;
3647
4313
  if (!Array.isArray(value) || value.length > 1024)
3648
4314
  fail("aggregate-participant-vector count");
3649
- for (let index = 1; index < value.length; ++index)
3650
- if (compareBytes((same(value[index - 1]["object"]["objectKind"], "actor") ? canonicalAuthorityKey("zla1", ":", "a", [utf8(value[index - 1]["object"]["actor"]["actorId"])], 1, 255, 776) : same(value[index - 1]["object"]["objectKind"], "userSpot") ? canonicalAuthorityKey("zla1", ":", "s", [utf8(value[index - 1]["object"]["spot"]["spotId"])], 1, 255, 776) : same(value[index - 1]["object"]["objectKind"], "instanceSpot") ? canonicalAuthorityKey("zla1", ":", "s", [utf8(value[index - 1]["object"]["spotId"])], 1, 255, 776) : fail("aggregate-participant-vector authority key variant")), (same(value[index]["object"]["objectKind"], "actor") ? canonicalAuthorityKey("zla1", ":", "a", [utf8(value[index]["object"]["actor"]["actorId"])], 1, 255, 776) : same(value[index]["object"]["objectKind"], "userSpot") ? canonicalAuthorityKey("zla1", ":", "s", [utf8(value[index]["object"]["spot"]["spotId"])], 1, 255, 776) : same(value[index]["object"]["objectKind"], "instanceSpot") ? canonicalAuthorityKey("zla1", ":", "s", [utf8(value[index]["object"]["spotId"])], 1, 255, 776) : fail("aggregate-participant-vector authority key variant"))) >= 0)
3651
- fail("aggregate-participant-vector sorted");
3652
- for (let left = 0; left < value.length; ++left)
3653
- for (let right = left + 1; right < value.length; ++right)
3654
- if (compareBytes((same(value[left]["object"]["objectKind"], "actor") ? canonicalAuthorityKey("zla1", ":", "a", [utf8(value[left]["object"]["actor"]["actorId"])], 1, 255, 776) : same(value[left]["object"]["objectKind"], "userSpot") ? canonicalAuthorityKey("zla1", ":", "s", [utf8(value[left]["object"]["spot"]["spotId"])], 1, 255, 776) : same(value[left]["object"]["objectKind"], "instanceSpot") ? canonicalAuthorityKey("zla1", ":", "s", [utf8(value[left]["object"]["spotId"])], 1, 255, 776) : fail("aggregate-participant-vector authority key variant")), (same(value[right]["object"]["objectKind"], "actor") ? canonicalAuthorityKey("zla1", ":", "a", [utf8(value[right]["object"]["actor"]["actorId"])], 1, 255, 776) : same(value[right]["object"]["objectKind"], "userSpot") ? canonicalAuthorityKey("zla1", ":", "s", [utf8(value[right]["object"]["spot"]["spotId"])], 1, 255, 776) : same(value[right]["object"]["objectKind"], "instanceSpot") ? canonicalAuthorityKey("zla1", ":", "s", [utf8(value[right]["object"]["spotId"])], 1, 255, 776) : fail("aggregate-participant-vector authority key variant"))) === 0)
3655
- fail("aggregate-participant-vector unique");
4315
+ try {
4316
+ for (let index = 1; index < value.length; ++index)
4317
+ if (compareBytes((same(value[index - 1]["object"]["objectKind"], "actor") ? canonicalAuthorityKey("zla1", ":", "a", [utf8(value[index - 1]["object"]["actor"]["actorId"])], 1, 255, 776) : same(value[index - 1]["object"]["objectKind"], "userSpot") ? canonicalAuthorityKey("zla1", ":", "s", [utf8(value[index - 1]["object"]["spot"]["spotId"])], 1, 255, 776) : same(value[index - 1]["object"]["objectKind"], "instanceSpot") ? canonicalAuthorityKey("zla1", ":", "s", [utf8(value[index - 1]["object"]["spotId"])], 1, 255, 776) : fail("aggregate-participant-vector authority key variant")), (same(value[index]["object"]["objectKind"], "actor") ? canonicalAuthorityKey("zla1", ":", "a", [utf8(value[index]["object"]["actor"]["actorId"])], 1, 255, 776) : same(value[index]["object"]["objectKind"], "userSpot") ? canonicalAuthorityKey("zla1", ":", "s", [utf8(value[index]["object"]["spot"]["spotId"])], 1, 255, 776) : same(value[index]["object"]["objectKind"], "instanceSpot") ? canonicalAuthorityKey("zla1", ":", "s", [utf8(value[index]["object"]["spotId"])], 1, 255, 776) : fail("aggregate-participant-vector authority key variant"))) >= 0)
4318
+ fail("aggregate-participant-vector sorted");
4319
+ }
4320
+ catch (error) {
4321
+ if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError)
4322
+ throw error;
4323
+ if (error instanceof RangeError)
4324
+ capacityFail("aggregate-participant-vector constraint capacity");
4325
+ throw error;
4326
+ }
3656
4327
  writeU16(value.length, writer, context, enclosing, flags);
3657
4328
  for (const item of value)
3658
4329
  writeMaintenanceAggregateParticipantV1(item, writer, context, enclosing, flags);
@@ -3726,6 +4397,18 @@ function readActorRouteFence(reader, context, enclosing, flags) {
3726
4397
  value["expectedOwnerLeaseGeneration"] = readNonzeroU64(reader, context, value, flags);
3727
4398
  return value;
3728
4399
  }
4400
+ function* readIncrementalActorRouteFence(reader, context, enclosing, flags) {
4401
+ void context;
4402
+ void enclosing;
4403
+ void flags;
4404
+ const value = {};
4405
+ value["actor"] = yield* readIncrementalActorRef(reader, context, value, flags);
4406
+ value["targetNodeRid"] = yield* readIncrementalRid(reader, context, value, flags);
4407
+ value["targetNodeGeneration"] = yield* readIncrementalNonzeroU64(reader, context, value, flags);
4408
+ value["expectedAuthorityOwnerGeneration"] = yield* readIncrementalNonzeroU64(reader, context, value, flags);
4409
+ value["expectedOwnerLeaseGeneration"] = yield* readIncrementalNonzeroU64(reader, context, value, flags);
4410
+ return value;
4411
+ }
3729
4412
  function writeActorRouteFence(input, writer, context, enclosing, flags) {
3730
4413
  void context;
3731
4414
  void enclosing;
@@ -3761,6 +4444,18 @@ function readSpotRouteFence(reader, context, enclosing, flags) {
3761
4444
  value["expectedOwnerLeaseGeneration"] = readNonzeroU64(reader, context, value, flags);
3762
4445
  return value;
3763
4446
  }
4447
+ function* readIncrementalSpotRouteFence(reader, context, enclosing, flags) {
4448
+ void context;
4449
+ void enclosing;
4450
+ void flags;
4451
+ const value = {};
4452
+ value["spot"] = yield* readIncrementalSpotRef(reader, context, value, flags);
4453
+ value["targetNodeRid"] = yield* readIncrementalRid(reader, context, value, flags);
4454
+ value["targetNodeGeneration"] = yield* readIncrementalNonzeroU64(reader, context, value, flags);
4455
+ value["expectedAuthorityOwnerGeneration"] = yield* readIncrementalNonzeroU64(reader, context, value, flags);
4456
+ value["expectedOwnerLeaseGeneration"] = yield* readIncrementalNonzeroU64(reader, context, value, flags);
4457
+ return value;
4458
+ }
3764
4459
  function writeSpotRouteFence(input, writer, context, enclosing, flags) {
3765
4460
  void context;
3766
4461
  void enclosing;
@@ -3977,6 +4672,31 @@ function readRelocationObjectIdentity(reader, context, enclosing, flags) {
3977
4672
  body.done("relocation-object-identity");
3978
4673
  return value;
3979
4674
  }
4675
+ function* readIncrementalRelocationObjectIdentity(reader, context, enclosing, flags) {
4676
+ void context;
4677
+ void enclosing;
4678
+ void flags;
4679
+ const value = {};
4680
+ value["objectKind"] = yield* readIncrementalStatefulObjectKind(reader, context, enclosing, flags);
4681
+ const body = reader.bounded(Number(yield* readIncrementalU16(reader, context, enclosing, flags)));
4682
+ if (same(value["objectKind"], "actor")) {
4683
+ value["actor"] = yield* readIncrementalActorRef(body, context, value, flags);
4684
+ value["expectedAuthorityOwnerGeneration"] = yield* readIncrementalNonzeroU64(body, context, value, flags);
4685
+ }
4686
+ else if (same(value["objectKind"], "userSpot")) {
4687
+ value["spot"] = yield* readIncrementalSpotRef(body, context, value, flags);
4688
+ value["expectedAuthorityOwnerGeneration"] = yield* readIncrementalNonzeroU64(body, context, value, flags);
4689
+ }
4690
+ else if (same(value["objectKind"], "instanceSpot")) {
4691
+ value["instanceType"] = yield* readIncrementalText8(body, context, value, flags);
4692
+ value["spotId"] = yield* readIncrementalText8(body, context, value, flags);
4693
+ value["objectGeneration"] = yield* readIncrementalNonzeroU64(body, context, value, flags);
4694
+ }
4695
+ else
4696
+ fail("relocation-object-identity discriminator");
4697
+ body.done("relocation-object-identity");
4698
+ return value;
4699
+ }
3980
4700
  function writeRelocationObjectIdentity(input, writer, context, enclosing, flags) {
3981
4701
  void context;
3982
4702
  void enclosing;
@@ -4291,6 +5011,15 @@ function readOperationIdOrZero(reader, context, enclosing, flags) {
4291
5011
  value["low"] = readU64(reader, context, value, flags);
4292
5012
  return value;
4293
5013
  }
5014
+ function* readIncrementalOperationIdOrZero(reader, context, enclosing, flags) {
5015
+ void context;
5016
+ void enclosing;
5017
+ void flags;
5018
+ const value = {};
5019
+ value["high"] = yield* readIncrementalU64(reader, context, value, flags);
5020
+ value["low"] = yield* readIncrementalU64(reader, context, value, flags);
5021
+ return value;
5022
+ }
4294
5023
  function writeOperationIdOrZero(input, writer, context, enclosing, flags) {
4295
5024
  void context;
4296
5025
  void enclosing;
@@ -4310,10 +5039,10 @@ function readCreationContentReference(reader, context, enclosing, flags) {
4310
5039
  void enclosing;
4311
5040
  void flags;
4312
5041
  const length = Number(readU16(reader, context, enclosing, flags));
4313
- if (length > 4096)
4314
- fail("creation-content-reference length");
4315
5042
  if (length > 2147483647)
4316
5043
  capacityFail("creation-content-reference capacity");
5044
+ if (length > 4096)
5045
+ fail("creation-content-reference length");
4317
5046
  if (length < 1)
4318
5047
  fail("creation-content-reference length");
4319
5048
  const bytes = reader.take(length);
@@ -4329,10 +5058,10 @@ function writeCreationContentReference(input, writer, context, enclosing, flags)
4329
5058
  const bytes = utf8(value);
4330
5059
  if (bytes.includes(0))
4331
5060
  fail("creation-content-reference NUL");
4332
- if (bytes.length > 4096)
4333
- fail("creation-content-reference length");
4334
5061
  if (bytes.length > 2147483647)
4335
5062
  capacityFail("creation-content-reference capacity");
5063
+ if (bytes.length > 4096)
5064
+ fail("creation-content-reference length");
4336
5065
  if (bytes.length < 1)
4337
5066
  fail("creation-content-reference length");
4338
5067
  writeU16(bytes.length, writer, context, enclosing, flags);
@@ -4345,10 +5074,10 @@ function readRelocationReference(reader, context, enclosing, flags) {
4345
5074
  void enclosing;
4346
5075
  void flags;
4347
5076
  const length = Number(readU16(reader, context, enclosing, flags));
4348
- if (length > 4096)
4349
- fail("relocation-reference length");
4350
5077
  if (length > 2147483647)
4351
5078
  capacityFail("relocation-reference capacity");
5079
+ if (length > 4096)
5080
+ fail("relocation-reference length");
4352
5081
  if (length < 1)
4353
5082
  fail("relocation-reference length");
4354
5083
  const bytes = reader.take(length);
@@ -4364,10 +5093,10 @@ function writeRelocationReference(input, writer, context, enclosing, flags) {
4364
5093
  const bytes = utf8(value);
4365
5094
  if (bytes.includes(0))
4366
5095
  fail("relocation-reference NUL");
4367
- if (bytes.length > 4096)
4368
- fail("relocation-reference length");
4369
5096
  if (bytes.length > 2147483647)
4370
5097
  capacityFail("relocation-reference capacity");
5098
+ if (bytes.length > 4096)
5099
+ fail("relocation-reference length");
4371
5100
  if (bytes.length < 1)
4372
5101
  fail("relocation-reference length");
4373
5102
  writeU16(bytes.length, writer, context, enclosing, flags);
@@ -4380,10 +5109,10 @@ function readAuthorityStoreVersion(reader, context, enclosing, flags) {
4380
5109
  void enclosing;
4381
5110
  void flags;
4382
5111
  const length = Number(readU16(reader, context, enclosing, flags));
4383
- if (length > 4096)
4384
- fail("authority-store-version length");
4385
5112
  if (length > 2147483647)
4386
5113
  capacityFail("authority-store-version capacity");
5114
+ if (length > 4096)
5115
+ fail("authority-store-version length");
4387
5116
  if (length < 1)
4388
5117
  fail("authority-store-version length");
4389
5118
  const bytes = reader.take(length);
@@ -4391,6 +5120,19 @@ function readAuthorityStoreVersion(reader, context, enclosing, flags) {
4391
5120
  fail("authority-store-version NUL");
4392
5121
  return decodeUtf8(bytes, "authority-store-version");
4393
5122
  }
5123
+ function* readIncrementalAuthorityStoreVersion(reader, context, enclosing, flags) {
5124
+ void context;
5125
+ void enclosing;
5126
+ void flags;
5127
+ const length = Number(yield* readIncrementalU16(reader, context, enclosing, flags));
5128
+ if (length > 2147483647)
5129
+ capacityFail("authority-store-version capacity");
5130
+ if (length > 4096)
5131
+ fail("authority-store-version length");
5132
+ if (length < 1)
5133
+ fail("authority-store-version length");
5134
+ return yield* reader.text(length, true, "authority-store-version");
5135
+ }
4394
5136
  function writeAuthorityStoreVersion(input, writer, context, enclosing, flags) {
4395
5137
  void context;
4396
5138
  void enclosing;
@@ -4399,10 +5141,10 @@ function writeAuthorityStoreVersion(input, writer, context, enclosing, flags) {
4399
5141
  const bytes = utf8(value);
4400
5142
  if (bytes.includes(0))
4401
5143
  fail("authority-store-version NUL");
4402
- if (bytes.length > 4096)
4403
- fail("authority-store-version length");
4404
5144
  if (bytes.length > 2147483647)
4405
5145
  capacityFail("authority-store-version capacity");
5146
+ if (bytes.length > 4096)
5147
+ fail("authority-store-version length");
4406
5148
  if (bytes.length < 1)
4407
5149
  fail("authority-store-version length");
4408
5150
  writeU16(bytes.length, writer, context, enclosing, flags);
@@ -4422,6 +5164,18 @@ function readAuthorityGenerationFence(reader, context, enclosing, flags) {
4422
5164
  value["storeVersion"] = readAuthorityStoreVersion(reader, context, value, flags);
4423
5165
  return value;
4424
5166
  }
5167
+ function* readIncrementalAuthorityGenerationFence(reader, context, enclosing, flags) {
5168
+ void context;
5169
+ void enclosing;
5170
+ void flags;
5171
+ const value = {};
5172
+ value["objectGeneration"] = yield* readIncrementalNonzeroU64(reader, context, value, flags);
5173
+ value["ownerId"] = yield* readIncrementalText8(reader, context, value, flags);
5174
+ value["authorityOwnerGeneration"] = yield* readIncrementalNonzeroU64(reader, context, value, flags);
5175
+ value["leaseGeneration"] = yield* readIncrementalNonzeroU64(reader, context, value, flags);
5176
+ value["storeVersion"] = yield* readIncrementalAuthorityStoreVersion(reader, context, value, flags);
5177
+ return value;
5178
+ }
4425
5179
  function writeAuthorityGenerationFence(input, writer, context, enclosing, flags) {
4426
5180
  void context;
4427
5181
  void enclosing;
@@ -4553,6 +5307,17 @@ function readRelocationId(reader, context, enclosing, flags) {
4553
5307
  fail("relocation-id all zero");
4554
5308
  return value;
4555
5309
  }
5310
+ function* readIncrementalRelocationId(reader, context, enclosing, flags) {
5311
+ void context;
5312
+ void enclosing;
5313
+ void flags;
5314
+ const value = {};
5315
+ value["high"] = yield* readIncrementalU64(reader, context, value, flags);
5316
+ value["low"] = yield* readIncrementalU64(reader, context, value, flags);
5317
+ if (numeric(value["high"]) === 0n && numeric(value["low"]) === 0n)
5318
+ fail("relocation-id all zero");
5319
+ return value;
5320
+ }
4556
5321
  function writeRelocationId(input, writer, context, enclosing, flags) {
4557
5322
  void context;
4558
5323
  void enclosing;
@@ -4658,13 +5423,18 @@ function readChannelVector(reader, context, enclosing, flags) {
4658
5423
  void flags;
4659
5424
  const count = Number(readU16(reader, context, enclosing, flags));
4660
5425
  const value = Array.from({ length: count }, () => readChannelEntry(reader, context, enclosing, flags));
4661
- for (let index = 1; index < value.length; ++index)
4662
- if (compareResults([compareBytes(utf8(value[index - 1]["channelName"]), utf8(value[index]["channelName"]))]) >= 0)
4663
- fail("channel-vector sorted");
4664
- for (let left = 0; left < value.length; ++left)
4665
- for (let right = left + 1; right < value.length; ++right)
4666
- if (compareResults([compareBytes(utf8(value[left]["channelName"]), utf8(value[right]["channelName"]))]) === 0)
4667
- fail("channel-vector unique");
5426
+ try {
5427
+ for (let index = 1; index < value.length; ++index)
5428
+ if (compareResults([compareBytes(utf8(value[index - 1]["channelName"]), utf8(value[index]["channelName"]))]) >= 0)
5429
+ fail("channel-vector sorted");
5430
+ }
5431
+ catch (error) {
5432
+ if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError)
5433
+ throw error;
5434
+ if (error instanceof RangeError)
5435
+ capacityFail("channel-vector constraint capacity");
5436
+ throw error;
5437
+ }
4668
5438
  return value;
4669
5439
  }
4670
5440
  function writeChannelVector(input, writer, context, enclosing, flags) {
@@ -4674,13 +5444,18 @@ function writeChannelVector(input, writer, context, enclosing, flags) {
4674
5444
  const value = input;
4675
5445
  if (!Array.isArray(value))
4676
5446
  fail("channel-vector count");
4677
- for (let index = 1; index < value.length; ++index)
4678
- if (compareResults([compareBytes(utf8(value[index - 1]["channelName"]), utf8(value[index]["channelName"]))]) >= 0)
4679
- fail("channel-vector sorted");
4680
- for (let left = 0; left < value.length; ++left)
4681
- for (let right = left + 1; right < value.length; ++right)
4682
- if (compareResults([compareBytes(utf8(value[left]["channelName"]), utf8(value[right]["channelName"]))]) === 0)
4683
- fail("channel-vector unique");
5447
+ try {
5448
+ for (let index = 1; index < value.length; ++index)
5449
+ if (compareResults([compareBytes(utf8(value[index - 1]["channelName"]), utf8(value[index]["channelName"]))]) >= 0)
5450
+ fail("channel-vector sorted");
5451
+ }
5452
+ catch (error) {
5453
+ if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError)
5454
+ throw error;
5455
+ if (error instanceof RangeError)
5456
+ capacityFail("channel-vector constraint capacity");
5457
+ throw error;
5458
+ }
4684
5459
  writeU16(value.length, writer, context, enclosing, flags);
4685
5460
  for (const item of value)
4686
5461
  writeChannelEntry(item, writer, context, enclosing, flags);
@@ -4695,13 +5470,18 @@ function readSortedText8Vector(reader, context, enclosing, flags) {
4695
5470
  if (count > 1024)
4696
5471
  fail("sorted-text8-vector count");
4697
5472
  const value = Array.from({ length: count }, () => readText8(reader, context, enclosing, flags));
4698
- for (let index = 1; index < value.length; ++index)
4699
- if (compareResults([compareBytes(utf8(value[index - 1]), utf8(value[index]))]) >= 0)
4700
- fail("sorted-text8-vector sorted");
4701
- for (let left = 0; left < value.length; ++left)
4702
- for (let right = left + 1; right < value.length; ++right)
4703
- if (compareResults([compareBytes(utf8(value[left]), utf8(value[right]))]) === 0)
4704
- fail("sorted-text8-vector unique");
5473
+ try {
5474
+ for (let index = 1; index < value.length; ++index)
5475
+ if (compareResults([compareBytes(utf8(value[index - 1]), utf8(value[index]))]) >= 0)
5476
+ fail("sorted-text8-vector sorted");
5477
+ }
5478
+ catch (error) {
5479
+ if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError)
5480
+ throw error;
5481
+ if (error instanceof RangeError)
5482
+ capacityFail("sorted-text8-vector constraint capacity");
5483
+ throw error;
5484
+ }
4705
5485
  return value;
4706
5486
  }
4707
5487
  function writeSortedText8Vector(input, writer, context, enclosing, flags) {
@@ -4711,13 +5491,18 @@ function writeSortedText8Vector(input, writer, context, enclosing, flags) {
4711
5491
  const value = input;
4712
5492
  if (!Array.isArray(value) || value.length > 1024)
4713
5493
  fail("sorted-text8-vector count");
4714
- for (let index = 1; index < value.length; ++index)
4715
- if (compareResults([compareBytes(utf8(value[index - 1]), utf8(value[index]))]) >= 0)
4716
- fail("sorted-text8-vector sorted");
4717
- for (let left = 0; left < value.length; ++left)
4718
- for (let right = left + 1; right < value.length; ++right)
4719
- if (compareResults([compareBytes(utf8(value[left]), utf8(value[right]))]) === 0)
4720
- fail("sorted-text8-vector unique");
5494
+ try {
5495
+ for (let index = 1; index < value.length; ++index)
5496
+ if (compareResults([compareBytes(utf8(value[index - 1]), utf8(value[index]))]) >= 0)
5497
+ fail("sorted-text8-vector sorted");
5498
+ }
5499
+ catch (error) {
5500
+ if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError)
5501
+ throw error;
5502
+ if (error instanceof RangeError)
5503
+ capacityFail("sorted-text8-vector constraint capacity");
5504
+ throw error;
5505
+ }
4721
5506
  writeU16(value.length, writer, context, enclosing, flags);
4722
5507
  for (const item of value)
4723
5508
  writeText8(item, writer, context, enclosing, flags);
@@ -4775,13 +5560,18 @@ function readStatefulCapabilityVector(reader, context, enclosing, flags) {
4775
5560
  if (count > 1024)
4776
5561
  fail("stateful-capability-vector count");
4777
5562
  const value = Array.from({ length: count }, () => readStatefulCapabilityEntry(reader, context, enclosing, flags));
4778
- for (let index = 1; index < value.length; ++index)
4779
- if (compareResults([compareBigint(numeric(enumWireStatefulObjectKind(value[index - 1]["objectKind"])), numeric(enumWireStatefulObjectKind(value[index]["objectKind"]))), compareBytes(utf8(value[index - 1]["type"]), utf8(value[index]["type"]))]) >= 0)
4780
- fail("stateful-capability-vector sorted");
4781
- for (let left = 0; left < value.length; ++left)
4782
- for (let right = left + 1; right < value.length; ++right)
4783
- if (compareResults([compareBigint(numeric(enumWireStatefulObjectKind(value[left]["objectKind"])), numeric(enumWireStatefulObjectKind(value[right]["objectKind"]))), compareBytes(utf8(value[left]["type"]), utf8(value[right]["type"]))]) === 0)
4784
- fail("stateful-capability-vector unique");
5563
+ try {
5564
+ for (let index = 1; index < value.length; ++index)
5565
+ if (compareResults([compareBigint(numeric(enumWireStatefulObjectKind(value[index - 1]["objectKind"])), numeric(enumWireStatefulObjectKind(value[index]["objectKind"]))), compareBytes(utf8(value[index - 1]["type"]), utf8(value[index]["type"]))]) >= 0)
5566
+ fail("stateful-capability-vector sorted");
5567
+ }
5568
+ catch (error) {
5569
+ if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError)
5570
+ throw error;
5571
+ if (error instanceof RangeError)
5572
+ capacityFail("stateful-capability-vector constraint capacity");
5573
+ throw error;
5574
+ }
4785
5575
  return value;
4786
5576
  }
4787
5577
  function writeStatefulCapabilityVector(input, writer, context, enclosing, flags) {
@@ -4791,13 +5581,18 @@ function writeStatefulCapabilityVector(input, writer, context, enclosing, flags)
4791
5581
  const value = input;
4792
5582
  if (!Array.isArray(value) || value.length > 1024)
4793
5583
  fail("stateful-capability-vector count");
4794
- for (let index = 1; index < value.length; ++index)
4795
- if (compareResults([compareBigint(numeric(enumWireStatefulObjectKind(value[index - 1]["objectKind"])), numeric(enumWireStatefulObjectKind(value[index]["objectKind"]))), compareBytes(utf8(value[index - 1]["type"]), utf8(value[index]["type"]))]) >= 0)
4796
- fail("stateful-capability-vector sorted");
4797
- for (let left = 0; left < value.length; ++left)
4798
- for (let right = left + 1; right < value.length; ++right)
4799
- if (compareResults([compareBigint(numeric(enumWireStatefulObjectKind(value[left]["objectKind"])), numeric(enumWireStatefulObjectKind(value[right]["objectKind"]))), compareBytes(utf8(value[left]["type"]), utf8(value[right]["type"]))]) === 0)
4800
- fail("stateful-capability-vector unique");
5584
+ try {
5585
+ for (let index = 1; index < value.length; ++index)
5586
+ if (compareResults([compareBigint(numeric(enumWireStatefulObjectKind(value[index - 1]["objectKind"])), numeric(enumWireStatefulObjectKind(value[index]["objectKind"]))), compareBytes(utf8(value[index - 1]["type"]), utf8(value[index]["type"]))]) >= 0)
5587
+ fail("stateful-capability-vector sorted");
5588
+ }
5589
+ catch (error) {
5590
+ if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError)
5591
+ throw error;
5592
+ if (error instanceof RangeError)
5593
+ capacityFail("stateful-capability-vector constraint capacity");
5594
+ throw error;
5595
+ }
4801
5596
  writeU16(value.length, writer, context, enclosing, flags);
4802
5597
  for (const item of value)
4803
5598
  writeStatefulCapabilityEntry(item, writer, context, enclosing, flags);
@@ -5402,6 +6197,34 @@ function readSendReadyDestination(reader, context, enclosing, flags) {
5402
6197
  body.done("send-ready-destination");
5403
6198
  return value;
5404
6199
  }
6200
+ function* readIncrementalSendReadyDestination(reader, context, enclosing, flags) {
6201
+ void context;
6202
+ void enclosing;
6203
+ void flags;
6204
+ const value = {};
6205
+ value["destinationKind"] = yield* readIncrementalMeshDestinationKind(reader, context, enclosing, flags);
6206
+ const body = reader.bounded(Number(yield* readIncrementalU16(reader, context, enclosing, flags)));
6207
+ if (same(value["destinationKind"], "node")) {
6208
+ value["targetNodeRid"] = yield* readIncrementalRid(body, context, value, flags);
6209
+ }
6210
+ else if (same(value["destinationKind"], "channel")) {
6211
+ value["channelName"] = yield* readIncrementalText8(body, context, value, flags);
6212
+ }
6213
+ else if (same(value["destinationKind"], "spot")) {
6214
+ value["targetSpot"] = yield* readIncrementalSpotRouteFence(body, context, value, flags);
6215
+ }
6216
+ else if (same(value["destinationKind"], "actor")) {
6217
+ value["targetActor"] = yield* readIncrementalActorRouteFence(body, context, value, flags);
6218
+ }
6219
+ else if (same(value["destinationKind"], "boundSession")) {
6220
+ value["targetActor"] = yield* readIncrementalActorRouteFence(body, context, value, flags);
6221
+ value["bindingGeneration"] = yield* readIncrementalNonzeroU64(body, context, value, flags);
6222
+ }
6223
+ else
6224
+ fail("send-ready-destination discriminator");
6225
+ body.done("send-ready-destination");
6226
+ return value;
6227
+ }
5405
6228
  function writeSendReadyDestination(input, writer, context, enclosing, flags) {
5406
6229
  void context;
5407
6230
  void enclosing;
@@ -5464,6 +6287,15 @@ function readActorMembershipSnapshot(reader, context, enclosing, flags) {
5464
6287
  value["membership"] = readSpotMembership(reader, context, value, flags);
5465
6288
  return value;
5466
6289
  }
6290
+ function* readIncrementalActorMembershipSnapshot(reader, context, enclosing, flags) {
6291
+ void context;
6292
+ void enclosing;
6293
+ void flags;
6294
+ const value = {};
6295
+ value["actor"] = yield* readIncrementalActorRef(reader, context, value, flags);
6296
+ value["membership"] = yield* readIncrementalSpotMembership(reader, context, value, flags);
6297
+ return value;
6298
+ }
5467
6299
  function writeActorMembershipSnapshot(input, writer, context, enclosing, flags) {
5468
6300
  void context;
5469
6301
  void enclosing;
@@ -5495,6 +6327,23 @@ function readOptionalActorMembershipSnapshot(reader, context, enclosing, flags)
5495
6327
  body.done("optional-actor-membership-snapshot");
5496
6328
  return value;
5497
6329
  }
6330
+ function* readIncrementalOptionalActorMembershipSnapshot(reader, context, enclosing, flags) {
6331
+ void context;
6332
+ void enclosing;
6333
+ void flags;
6334
+ const value = {};
6335
+ value["hasSnapshot"] = yield* readIncrementalBool8(reader, context, enclosing, flags);
6336
+ const body = reader.bounded(Number(yield* readIncrementalU16(reader, context, enclosing, flags)));
6337
+ if (same(value["hasSnapshot"], "false")) {
6338
+ }
6339
+ else if (same(value["hasSnapshot"], "true")) {
6340
+ value["snapshot"] = yield* readIncrementalActorMembershipSnapshot(body, context, value, flags);
6341
+ }
6342
+ else
6343
+ fail("optional-actor-membership-snapshot discriminator");
6344
+ body.done("optional-actor-membership-snapshot");
6345
+ return value;
6346
+ }
5498
6347
  function writeOptionalActorMembershipSnapshot(input, writer, context, enclosing, flags) {
5499
6348
  void context;
5500
6349
  void enclosing;
@@ -5538,10 +6387,39 @@ function readActorControlData(reader, context, enclosing, flags) {
5538
6387
  value["current"] = readActorMembershipSnapshot(body, context, value, flags);
5539
6388
  }
5540
6389
  else if (same(value["lifecycleKind"], "disconnected")) {
5541
- value["current"] = readActorMembershipSnapshot(body, context, value, flags);
6390
+ value["current"] = readActorMembershipSnapshot(body, context, value, flags);
6391
+ }
6392
+ else if (same(value["lifecycleKind"], "destroyed")) {
6393
+ value["previous"] = readActorMembershipSnapshot(body, context, value, flags);
6394
+ }
6395
+ else
6396
+ fail("actor-control-data discriminator");
6397
+ body.done("actor-control-data");
6398
+ return value;
6399
+ }
6400
+ function* readIncrementalActorControlData(reader, context, enclosing, flags) {
6401
+ void context;
6402
+ void enclosing;
6403
+ void flags;
6404
+ const value = {};
6405
+ value["lifecycleKind"] = yield* readIncrementalActorLifecycleKind(reader, context, enclosing, flags);
6406
+ const body = reader.bounded(Number(yield* readIncrementalU16(reader, context, enclosing, flags)));
6407
+ if (same(value["lifecycleKind"], "created")) {
6408
+ value["current"] = yield* readIncrementalActorMembershipSnapshot(body, context, value, flags);
6409
+ }
6410
+ else if (same(value["lifecycleKind"], "joined")) {
6411
+ value["previous"] = yield* readIncrementalOptionalActorMembershipSnapshot(body, context, value, flags);
6412
+ value["current"] = yield* readIncrementalActorMembershipSnapshot(body, context, value, flags);
6413
+ }
6414
+ else if (same(value["lifecycleKind"], "left")) {
6415
+ value["previous"] = yield* readIncrementalActorMembershipSnapshot(body, context, value, flags);
6416
+ value["current"] = yield* readIncrementalActorMembershipSnapshot(body, context, value, flags);
6417
+ }
6418
+ else if (same(value["lifecycleKind"], "disconnected")) {
6419
+ value["current"] = yield* readIncrementalActorMembershipSnapshot(body, context, value, flags);
5542
6420
  }
5543
6421
  else if (same(value["lifecycleKind"], "destroyed")) {
5544
- value["previous"] = readActorMembershipSnapshot(body, context, value, flags);
6422
+ value["previous"] = yield* readIncrementalActorMembershipSnapshot(body, context, value, flags);
5545
6423
  }
5546
6424
  else
5547
6425
  fail("actor-control-data discriminator");
@@ -5611,7 +6489,24 @@ function readRelocationControlData(reader, context, enclosing, flags) {
5611
6489
  value["object"] = readRelocationObjectIdentity(reader, context, value, flags);
5612
6490
  value["terminalResult"] = readRequestTerminalResult(reader, context, value, flags);
5613
6491
  value["failureCode"] = readFrameworkErrorCode(reader, context, value, flags);
5614
- if (!(runtimePredicate(context, "service-wire-constants.valid-terminal-failure", enumWireRequestTerminalResult(value["terminalResult"]), enumWireFrameworkErrorCode(value["failureCode"]))))
6492
+ void context;
6493
+ if (!(validTerminalFailure(enumWireRequestTerminalResult(value["terminalResult"]), enumWireFrameworkErrorCode(value["failureCode"]))))
6494
+ fail("relocation-control-data runtime predicate");
6495
+ return value;
6496
+ }
6497
+ function* readIncrementalRelocationControlData(reader, context, enclosing, flags) {
6498
+ void context;
6499
+ void enclosing;
6500
+ void flags;
6501
+ const value = {};
6502
+ value["phase"] = yield* readIncrementalRelocationPhase(reader, context, value, flags);
6503
+ value["role"] = yield* readIncrementalRelocationRole(reader, context, value, flags);
6504
+ value["relocation"] = yield* readIncrementalRelocationId(reader, context, value, flags);
6505
+ value["object"] = yield* readIncrementalRelocationObjectIdentity(reader, context, value, flags);
6506
+ value["terminalResult"] = yield* readIncrementalRequestTerminalResult(reader, context, value, flags);
6507
+ value["failureCode"] = yield* readIncrementalFrameworkErrorCode(reader, context, value, flags);
6508
+ void context;
6509
+ if (!(validTerminalFailure(enumWireRequestTerminalResult(value["terminalResult"]), enumWireFrameworkErrorCode(value["failureCode"]))))
5615
6510
  fail("relocation-control-data runtime predicate");
5616
6511
  return value;
5617
6512
  }
@@ -5620,7 +6515,8 @@ function writeRelocationControlData(input, writer, context, enclosing, flags) {
5620
6515
  void enclosing;
5621
6516
  void flags;
5622
6517
  const value = input;
5623
- if (!(runtimePredicate(context, "service-wire-constants.valid-terminal-failure", enumWireRequestTerminalResult(value["terminalResult"]), enumWireFrameworkErrorCode(value["failureCode"]))))
6518
+ void context;
6519
+ if (!(validTerminalFailure(enumWireRequestTerminalResult(value["terminalResult"]), enumWireFrameworkErrorCode(value["failureCode"]))))
5624
6520
  fail("relocation-control-data runtime predicate");
5625
6521
  if (value["phase"] === undefined)
5626
6522
  fail("phase required");
@@ -5804,6 +6700,8 @@ function readFrozenRecordBody(reader, context, enclosing, flags) {
5804
6700
  if (same(value["hasPayload"], "true")) {
5805
6701
  value["payload"] = readApplicationPayloadEnvelopeV1(body, context, value, flags);
5806
6702
  }
6703
+ if (!validTerminalFailure(enumWireRequestTerminalResult(value["terminalResult"]), enumWireFrameworkErrorCode(value["failureCode"])))
6704
+ fail("terminal failure predicate");
5807
6705
  }
5808
6706
  else if (same(value["recordKind"], "sendReady")) {
5809
6707
  value["destination"] = readSendReadyDestination(body, context, value, flags);
@@ -5819,8 +6717,77 @@ function readFrozenRecordBody(reader, context, enclosing, flags) {
5819
6717
  }
5820
6718
  else
5821
6719
  fail("frozen-record-body discriminator");
5822
- if (same(value["recordKind"], "completion") && !(runtimePredicate(context, "service-wire-constants.valid-terminal-failure", enumWireRequestTerminalResult(value["terminalResult"]), enumWireFrameworkErrorCode(value["failureCode"]))))
5823
- fail("frozen-record-body runtime predicate");
6720
+ return value;
6721
+ }
6722
+ function* readIncrementalFrozenRecordBody(reader, context, enclosing, flags) {
6723
+ void context;
6724
+ void enclosing;
6725
+ void flags;
6726
+ const value = {};
6727
+ value["recordKind"] = enclosing["recordKind"];
6728
+ const body = reader;
6729
+ if (same(value["recordKind"], "nodeSend")) {
6730
+ value["payload"] = yield* readIncrementalApplicationPayloadEnvelopeV1(body, context, value, flags);
6731
+ }
6732
+ else if (same(value["recordKind"], "nodeRequest")) {
6733
+ value["payload"] = yield* readIncrementalApplicationPayloadEnvelopeV1(body, context, value, flags);
6734
+ }
6735
+ else if (same(value["recordKind"], "channelSend")) {
6736
+ value["channelName"] = yield* readIncrementalText8(body, context, value, flags);
6737
+ value["payload"] = yield* readIncrementalApplicationPayloadEnvelopeV1(body, context, value, flags);
6738
+ }
6739
+ else if (same(value["recordKind"], "channelRequest")) {
6740
+ value["channelName"] = yield* readIncrementalText8(body, context, value, flags);
6741
+ value["payload"] = yield* readIncrementalApplicationPayloadEnvelopeV1(body, context, value, flags);
6742
+ }
6743
+ else if (same(value["recordKind"], "spotSend")) {
6744
+ value["targetSpot"] = yield* readIncrementalSpotRouteFence(body, context, value, flags);
6745
+ value["payload"] = yield* readIncrementalApplicationPayloadEnvelopeV1(body, context, value, flags);
6746
+ }
6747
+ else if (same(value["recordKind"], "spotRequest")) {
6748
+ value["targetSpot"] = yield* readIncrementalSpotRouteFence(body, context, value, flags);
6749
+ value["payload"] = yield* readIncrementalApplicationPayloadEnvelopeV1(body, context, value, flags);
6750
+ }
6751
+ else if (same(value["recordKind"], "spotMulticast")) {
6752
+ value["channelName"] = yield* readIncrementalText8(body, context, value, flags);
6753
+ value["topic"] = yield* readIncrementalText8(body, context, value, flags);
6754
+ value["payload"] = yield* readIncrementalApplicationPayloadEnvelopeV1(body, context, value, flags);
6755
+ }
6756
+ else if (same(value["recordKind"], "spotControl")) {
6757
+ value["control"] = yield* readIncrementalActorControlData(body, context, value, flags);
6758
+ }
6759
+ else if (same(value["recordKind"], "actorSend")) {
6760
+ value["targetActor"] = yield* readIncrementalActorRouteFence(body, context, value, flags);
6761
+ value["payload"] = yield* readIncrementalApplicationPayloadEnvelopeV1(body, context, value, flags);
6762
+ }
6763
+ else if (same(value["recordKind"], "actorRequest")) {
6764
+ value["targetActor"] = yield* readIncrementalActorRouteFence(body, context, value, flags);
6765
+ value["payload"] = yield* readIncrementalApplicationPayloadEnvelopeV1(body, context, value, flags);
6766
+ }
6767
+ else if (same(value["recordKind"], "completion")) {
6768
+ value["terminalResult"] = yield* readIncrementalRequestTerminalResult(body, context, value, flags);
6769
+ value["failureCode"] = yield* readIncrementalFrameworkErrorCode(body, context, value, flags);
6770
+ value["hasPayload"] = yield* readIncrementalBool8(body, context, value, flags);
6771
+ if (same(value["hasPayload"], "true")) {
6772
+ value["payload"] = yield* readIncrementalApplicationPayloadEnvelopeV1(body, context, value, flags);
6773
+ }
6774
+ if (!validTerminalFailure(enumWireRequestTerminalResult(value["terminalResult"]), enumWireFrameworkErrorCode(value["failureCode"])))
6775
+ fail("terminal failure predicate");
6776
+ }
6777
+ else if (same(value["recordKind"], "sendReady")) {
6778
+ value["destination"] = yield* readIncrementalSendReadyDestination(body, context, value, flags);
6779
+ }
6780
+ else if (same(value["recordKind"], "relocationControl")) {
6781
+ value["control"] = yield* readIncrementalRelocationControlData(body, context, value, flags);
6782
+ }
6783
+ else if (same(value["recordKind"], "instanceSpotActivation")) {
6784
+ value["route"] = yield* readIncrementalInstanceRouteV1(body, context, value, flags);
6785
+ value["sourceNodeGeneration"] = yield* readIncrementalNonzeroU64(body, context, value, flags);
6786
+ value["operationKind"] = yield* readIncrementalInstanceOperationKind(body, context, value, flags);
6787
+ value["payload"] = yield* readIncrementalApplicationPayloadEnvelopeV1(body, context, value, flags);
6788
+ }
6789
+ else
6790
+ fail("frozen-record-body discriminator");
5824
6791
  return value;
5825
6792
  }
5826
6793
  function writeFrozenRecordBody(input, writer, context, enclosing, flags) {
@@ -5828,8 +6795,6 @@ function writeFrozenRecordBody(input, writer, context, enclosing, flags) {
5828
6795
  void enclosing;
5829
6796
  void flags;
5830
6797
  const value = input;
5831
- if (same(value["recordKind"], "completion") && !(runtimePredicate(context, "service-wire-constants.valid-terminal-failure", enumWireRequestTerminalResult(value["terminalResult"]), enumWireFrameworkErrorCode(value["failureCode"]))))
5832
- fail("frozen-record-body runtime predicate");
5833
6798
  const body = writer;
5834
6799
  if (same(value["recordKind"], "nodeSend")) {
5835
6800
  if (value["channelName"] !== undefined || value["targetSpot"] !== undefined || value["topic"] !== undefined || value["control"] !== undefined || value["targetActor"] !== undefined || value["terminalResult"] !== undefined || value["failureCode"] !== undefined || value["hasPayload"] !== undefined || value["destination"] !== undefined || value["route"] !== undefined || value["sourceNodeGeneration"] !== undefined || value["operationKind"] !== undefined)
@@ -5944,6 +6909,8 @@ function writeFrozenRecordBody(input, writer, context, enclosing, flags) {
5944
6909
  }
5945
6910
  else if (value["payload"] !== undefined)
5946
6911
  fail("payload forbidden");
6912
+ if (!validTerminalFailure(enumWireRequestTerminalResult(value["terminalResult"]), enumWireFrameworkErrorCode(value["failureCode"])))
6913
+ fail("terminal failure predicate");
5947
6914
  }
5948
6915
  else if (same(value["recordKind"], "sendReady")) {
5949
6916
  if (value["payload"] !== undefined || value["channelName"] !== undefined || value["targetSpot"] !== undefined || value["topic"] !== undefined || value["control"] !== undefined || value["targetActor"] !== undefined || value["terminalResult"] !== undefined || value["failureCode"] !== undefined || value["hasPayload"] !== undefined || value["route"] !== undefined || value["sourceNodeGeneration"] !== undefined || value["operationKind"] !== undefined)
@@ -6022,6 +6989,48 @@ function readFrozenSourceIdentity(reader, context, enclosing, flags) {
6022
6989
  body.done("frozen-source-identity");
6023
6990
  return value;
6024
6991
  }
6992
+ function* readIncrementalFrozenSourceIdentity(reader, context, enclosing, flags) {
6993
+ void context;
6994
+ void enclosing;
6995
+ void flags;
6996
+ const value = {};
6997
+ value["sourceKind"] = yield* readIncrementalFrozenSourceKind(reader, context, enclosing, flags);
6998
+ const body = reader.bounded(Number(yield* readIncrementalU16(reader, context, enclosing, flags)));
6999
+ if (same(value["sourceKind"], "node")) {
7000
+ value["sourceNodeRid"] = yield* readIncrementalRid(body, context, value, flags);
7001
+ value["sourceNodeGeneration"] = yield* readIncrementalNonzeroU64(body, context, value, flags);
7002
+ value["sourceOwnerId"] = yield* readIncrementalText8(body, context, value, flags);
7003
+ value["sourceOwnerLeaseGeneration"] = yield* readIncrementalNonzeroU64(body, context, value, flags);
7004
+ }
7005
+ else if (same(value["sourceKind"], "spot")) {
7006
+ value["sourceNodeRid"] = yield* readIncrementalRid(body, context, value, flags);
7007
+ value["sourceNodeGeneration"] = yield* readIncrementalNonzeroU64(body, context, value, flags);
7008
+ value["sourceOwnerId"] = yield* readIncrementalText8(body, context, value, flags);
7009
+ value["sourceOwnerLeaseGeneration"] = yield* readIncrementalNonzeroU64(body, context, value, flags);
7010
+ value["sourceSpotId"] = yield* readIncrementalText8(body, context, value, flags);
7011
+ }
7012
+ else if (same(value["sourceKind"], "actor")) {
7013
+ value["sourceNodeRid"] = yield* readIncrementalRid(body, context, value, flags);
7014
+ value["sourceNodeGeneration"] = yield* readIncrementalNonzeroU64(body, context, value, flags);
7015
+ value["sourceOwnerId"] = yield* readIncrementalText8(body, context, value, flags);
7016
+ value["sourceOwnerLeaseGeneration"] = yield* readIncrementalNonzeroU64(body, context, value, flags);
7017
+ value["sourceActor"] = yield* readIncrementalActorRef(body, context, value, flags);
7018
+ }
7019
+ else if (same(value["sourceKind"], "boundSession")) {
7020
+ value["sourceNodeRid"] = yield* readIncrementalRid(body, context, value, flags);
7021
+ value["sourceNodeGeneration"] = yield* readIncrementalNonzeroU64(body, context, value, flags);
7022
+ value["sourceOwnerId"] = yield* readIncrementalText8(body, context, value, flags);
7023
+ value["sourceOwnerLeaseGeneration"] = yield* readIncrementalNonzeroU64(body, context, value, flags);
7024
+ value["sourceActor"] = yield* readIncrementalActorRef(body, context, value, flags);
7025
+ value["sourceSessionRid"] = yield* readIncrementalRid(body, context, value, flags);
7026
+ value["sourceBindingGeneration"] = yield* readIncrementalNonzeroU64(body, context, value, flags);
7027
+ value["sourceSessionSequence"] = yield* readIncrementalNonzeroU64(body, context, value, flags);
7028
+ }
7029
+ else
7030
+ fail("frozen-source-identity discriminator");
7031
+ body.done("frozen-source-identity");
7032
+ return value;
7033
+ }
6025
7034
  function writeFrozenSourceIdentity(input, writer, context, enclosing, flags) {
6026
7035
  void context;
6027
7036
  void enclosing;
@@ -6146,6 +7155,33 @@ function readFrozenReplyRoute(reader, context, enclosing, flags) {
6146
7155
  body.done("frozen-reply-route");
6147
7156
  return value;
6148
7157
  }
7158
+ function* readIncrementalFrozenReplyRoute(reader, context, enclosing, flags) {
7159
+ void context;
7160
+ void enclosing;
7161
+ void flags;
7162
+ const value = {};
7163
+ value["originalOperationKind"] = enclosing["operationKind"];
7164
+ const body = reader.bounded(Number(yield* readIncrementalU16(reader, context, enclosing, flags)));
7165
+ if (same(value["originalOperationKind"], "nodeRequest")) {
7166
+ value["replyRouteId"] = yield* readIncrementalNonzeroU64(body, context, value, flags);
7167
+ }
7168
+ else if (same(value["originalOperationKind"], "channelRequest")) {
7169
+ value["replyRouteId"] = yield* readIncrementalNonzeroU64(body, context, value, flags);
7170
+ }
7171
+ else if (same(value["originalOperationKind"], "spotRequest")) {
7172
+ value["replyRouteId"] = yield* readIncrementalNonzeroU64(body, context, value, flags);
7173
+ }
7174
+ else if (same(value["originalOperationKind"], "actorRequest")) {
7175
+ value["replyRouteId"] = yield* readIncrementalNonzeroU64(body, context, value, flags);
7176
+ }
7177
+ else if (same(value["originalOperationKind"], "instanceSpotRequest")) {
7178
+ value["replyRouteId"] = yield* readIncrementalNonzeroU64(body, context, value, flags);
7179
+ }
7180
+ else {
7181
+ }
7182
+ body.done("frozen-reply-route");
7183
+ return value;
7184
+ }
6149
7185
  function writeFrozenReplyRoute(input, writer, context, enclosing, flags) {
6150
7186
  void context;
6151
7187
  void enclosing;
@@ -6204,6 +7240,23 @@ function readFrozenRecord(reader, context, enclosing, flags) {
6204
7240
  value["body"] = readFrozenRecordBody(reader, context, value, flags);
6205
7241
  return value;
6206
7242
  }
7243
+ function* readIncrementalFrozenRecord(reader, context, enclosing, flags) {
7244
+ void context;
7245
+ void enclosing;
7246
+ void flags;
7247
+ const value = {};
7248
+ value["recordKind"] = yield* readIncrementalMeshRecordKind(reader, context, value, flags);
7249
+ value["source"] = yield* readIncrementalFrozenSourceIdentity(reader, context, value, flags);
7250
+ value["hasMetadata"] = yield* readIncrementalBool8(reader, context, value, flags);
7251
+ if (same(value["hasMetadata"], "true")) {
7252
+ value["metadata"] = yield* readIncrementalMetadataFrame(reader, context, value, flags);
7253
+ }
7254
+ value["operationId"] = yield* readIncrementalOperationIdOrZero(reader, context, value, flags);
7255
+ value["operationKind"] = yield* readIncrementalMeshOperationKind(reader, context, value, flags);
7256
+ value["replyRoute"] = yield* readIncrementalFrozenReplyRoute(reader, context, value, flags);
7257
+ value["body"] = yield* readIncrementalFrozenRecordBody(reader, context, value, flags);
7258
+ return value;
7259
+ }
6207
7260
  function writeFrozenRecord(input, writer, context, enclosing, flags) {
6208
7261
  void context;
6209
7262
  void enclosing;
@@ -6267,6 +7320,33 @@ function readInstanceRouteV1(reader, context, enclosing, flags) {
6267
7320
  body.done("instance-route-v1");
6268
7321
  return value;
6269
7322
  }
7323
+ function* readIncrementalInstanceRouteV1(reader, context, enclosing, flags) {
7324
+ void context;
7325
+ void enclosing;
7326
+ void flags;
7327
+ const value = {};
7328
+ value["routeKind"] = yield* readIncrementalInstanceRouteKind(reader, context, enclosing, flags);
7329
+ const body = reader.bounded(Number(yield* readIncrementalU16(reader, context, enclosing, flags)));
7330
+ if (same(value["routeKind"], "ready")) {
7331
+ value["targetNodeRid"] = yield* readIncrementalRid(body, context, value, flags);
7332
+ value["targetNodeGeneration"] = yield* readIncrementalNonzeroU64(body, context, value, flags);
7333
+ value["targetSpotId"] = yield* readIncrementalText8(body, context, value, flags);
7334
+ value["authority"] = yield* readIncrementalAuthorityGenerationFence(body, context, value, flags);
7335
+ }
7336
+ else if (same(value["routeKind"], "coldActivation")) {
7337
+ value["targetNodeRid"] = yield* readIncrementalRid(body, context, value, flags);
7338
+ value["targetNodeGeneration"] = yield* readIncrementalNonzeroU64(body, context, value, flags);
7339
+ value["targetSpotId"] = yield* readIncrementalText8(body, context, value, flags);
7340
+ value["targetMeshName"] = yield* readIncrementalText8(body, context, value, flags);
7341
+ value["stableType"] = yield* readIncrementalText8(body, context, value, flags);
7342
+ value["targetDescriptorVersion"] = yield* readIncrementalText8(body, context, value, flags);
7343
+ value["deadlineUnixMs"] = yield* readIncrementalNonzeroU64(body, context, value, flags);
7344
+ }
7345
+ else
7346
+ fail("instance-route-v1 discriminator");
7347
+ body.done("instance-route-v1");
7348
+ return value;
7349
+ }
6270
7350
  function writeInstanceRouteV1(input, writer, context, enclosing, flags) {
6271
7351
  void context;
6272
7352
  void enclosing;
@@ -6624,6 +7704,16 @@ function readSavedWorkEntry(reader, context, enclosing, flags) {
6624
7704
  value["record"] = readFrozenRecord(reader, context, value, flags);
6625
7705
  return value;
6626
7706
  }
7707
+ function* readIncrementalSavedWorkEntry(reader, context, enclosing, flags) {
7708
+ void context;
7709
+ void enclosing;
7710
+ void flags;
7711
+ const value = {};
7712
+ value["participantId"] = yield* readIncrementalNonzeroU64(reader, context, value, flags);
7713
+ value["order"] = yield* readIncrementalNonzeroU64(reader, context, value, flags);
7714
+ value["record"] = yield* readIncrementalFrozenRecord(reader, context, value, flags);
7715
+ return value;
7716
+ }
6627
7717
  function writeSavedWorkEntry(input, writer, context, enclosing, flags) {
6628
7718
  void context;
6629
7719
  void enclosing;
@@ -6647,13 +7737,47 @@ function readSavedWorkVector(reader, context, enclosing, flags) {
6647
7737
  void flags;
6648
7738
  const count = Number(readU32(reader, context, enclosing, flags));
6649
7739
  const value = Array.from({ length: count }, () => readSavedWorkEntry(reader, context, enclosing, flags));
6650
- for (let index = 1; index < value.length; ++index)
6651
- if (compareResults([compareBigint(numeric(value[index - 1]["participantId"]), numeric(value[index]["participantId"])), compareBigint(numeric(value[index - 1]["order"]), numeric(value[index]["order"]))]) >= 0)
6652
- fail("saved-work-vector sorted");
6653
- for (let left = 0; left < value.length; ++left)
6654
- for (let right = left + 1; right < value.length; ++right)
6655
- if (compareResults([compareBigint(numeric(value[left]["participantId"]), numeric(value[right]["participantId"])), compareBigint(numeric(value[left]["order"]), numeric(value[right]["order"]))]) === 0)
6656
- fail("saved-work-vector unique");
7740
+ try {
7741
+ for (let index = 1; index < value.length; ++index)
7742
+ if (compareResults([compareBigint(numeric(value[index - 1]["participantId"]), numeric(value[index]["participantId"])), compareBigint(numeric(value[index - 1]["order"]), numeric(value[index]["order"]))]) >= 0)
7743
+ fail("saved-work-vector sorted");
7744
+ }
7745
+ catch (error) {
7746
+ if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError)
7747
+ throw error;
7748
+ if (error instanceof RangeError)
7749
+ capacityFail("saved-work-vector constraint capacity");
7750
+ throw error;
7751
+ }
7752
+ return value;
7753
+ }
7754
+ function* readIncrementalSavedWorkVector(reader, context, enclosing, flags) {
7755
+ void context;
7756
+ void enclosing;
7757
+ void flags;
7758
+ const count = Number(yield* readIncrementalU32(reader, context, enclosing, flags));
7759
+ const value = [];
7760
+ for (let index = 0; index < count; ++index) {
7761
+ const item = yield* readIncrementalSavedWorkEntry(reader, context, enclosing, flags);
7762
+ try {
7763
+ value.push(item);
7764
+ }
7765
+ catch {
7766
+ capacityFail("saved-work-vector capacity");
7767
+ }
7768
+ }
7769
+ try {
7770
+ for (let index = 1; index < value.length; ++index)
7771
+ if (compareResults([compareBigint(numeric(value[index - 1]["participantId"]), numeric(value[index]["participantId"])), compareBigint(numeric(value[index - 1]["order"]), numeric(value[index]["order"]))]) >= 0)
7772
+ fail("saved-work-vector sorted");
7773
+ }
7774
+ catch (error) {
7775
+ if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError)
7776
+ throw error;
7777
+ if (error instanceof RangeError)
7778
+ capacityFail("saved-work-vector constraint capacity");
7779
+ throw error;
7780
+ }
6657
7781
  return value;
6658
7782
  }
6659
7783
  function writeSavedWorkVector(input, writer, context, enclosing, flags) {
@@ -6663,13 +7787,18 @@ function writeSavedWorkVector(input, writer, context, enclosing, flags) {
6663
7787
  const value = input;
6664
7788
  if (!Array.isArray(value))
6665
7789
  fail("saved-work-vector count");
6666
- for (let index = 1; index < value.length; ++index)
6667
- if (compareResults([compareBigint(numeric(value[index - 1]["participantId"]), numeric(value[index]["participantId"])), compareBigint(numeric(value[index - 1]["order"]), numeric(value[index]["order"]))]) >= 0)
6668
- fail("saved-work-vector sorted");
6669
- for (let left = 0; left < value.length; ++left)
6670
- for (let right = left + 1; right < value.length; ++right)
6671
- if (compareResults([compareBigint(numeric(value[left]["participantId"]), numeric(value[right]["participantId"])), compareBigint(numeric(value[left]["order"]), numeric(value[right]["order"]))]) === 0)
6672
- fail("saved-work-vector unique");
7790
+ try {
7791
+ for (let index = 1; index < value.length; ++index)
7792
+ if (compareResults([compareBigint(numeric(value[index - 1]["participantId"]), numeric(value[index]["participantId"])), compareBigint(numeric(value[index - 1]["order"]), numeric(value[index]["order"]))]) >= 0)
7793
+ fail("saved-work-vector sorted");
7794
+ }
7795
+ catch (error) {
7796
+ if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError)
7797
+ throw error;
7798
+ if (error instanceof RangeError)
7799
+ capacityFail("saved-work-vector constraint capacity");
7800
+ throw error;
7801
+ }
6673
7802
  writeU32(value.length, writer, context, enclosing, flags);
6674
7803
  for (const item of value)
6675
7804
  writeSavedWorkEntry(item, writer, context, enclosing, flags);
@@ -6681,10 +7810,10 @@ function readDurableBlob(reader, context, enclosing, flags) {
6681
7810
  void enclosing;
6682
7811
  void flags;
6683
7812
  const length = Number(readU32(reader, context, enclosing, flags));
6684
- if (length > 67108864)
6685
- fail("durable-blob length");
6686
7813
  if (length > 2147483647)
6687
7814
  capacityFail("durable-blob capacity");
7815
+ if (length > 67108864)
7816
+ fail("durable-blob length");
6688
7817
  if (length < 0)
6689
7818
  fail("durable-blob length");
6690
7819
  return reader.take(length);
@@ -6695,10 +7824,10 @@ function writeDurableBlob(input, writer, context, enclosing, flags) {
6695
7824
  void flags;
6696
7825
  const value = input;
6697
7826
  const bytes = value;
6698
- if (bytes.length > 67108864)
6699
- fail("durable-blob length");
6700
7827
  if (bytes.length > 2147483647)
6701
7828
  capacityFail("durable-blob capacity");
7829
+ if (bytes.length > 67108864)
7830
+ fail("durable-blob length");
6702
7831
  if (bytes.length < 0)
6703
7832
  fail("durable-blob length");
6704
7833
  writeU32(bytes.length, writer, context, enclosing, flags);
@@ -6711,13 +7840,26 @@ function readDurableStateBlob(reader, context, enclosing, flags) {
6711
7840
  void enclosing;
6712
7841
  void flags;
6713
7842
  const length = Number(readU64(reader, context, enclosing, flags));
7843
+ if (length > 2147483647)
7844
+ capacityFail("durable-state-blob capacity");
6714
7845
  if (length > 67108864)
6715
7846
  fail("durable-state-blob length");
7847
+ if (length < 0)
7848
+ fail("durable-state-blob length");
7849
+ return reader.take(length);
7850
+ }
7851
+ function* readIncrementalDurableStateBlob(reader, context, enclosing, flags) {
7852
+ void context;
7853
+ void enclosing;
7854
+ void flags;
7855
+ const length = Number(yield* readIncrementalU64(reader, context, enclosing, flags));
6716
7856
  if (length > 2147483647)
6717
7857
  capacityFail("durable-state-blob capacity");
7858
+ if (length > 67108864)
7859
+ fail("durable-state-blob length");
6718
7860
  if (length < 0)
6719
7861
  fail("durable-state-blob length");
6720
- return reader.take(length);
7862
+ return yield* reader.bytes(length);
6721
7863
  }
6722
7864
  function writeDurableStateBlob(input, writer, context, enclosing, flags) {
6723
7865
  void context;
@@ -6725,10 +7867,10 @@ function writeDurableStateBlob(input, writer, context, enclosing, flags) {
6725
7867
  void flags;
6726
7868
  const value = input;
6727
7869
  const bytes = value;
6728
- if (bytes.length > 67108864)
6729
- fail("durable-state-blob length");
6730
7870
  if (bytes.length > 2147483647)
6731
7871
  capacityFail("durable-state-blob capacity");
7872
+ if (bytes.length > 67108864)
7873
+ fail("durable-state-blob length");
6732
7874
  if (bytes.length < 0)
6733
7875
  fail("durable-state-blob length");
6734
7876
  writeU64(numeric(bytes.length), writer, context, enclosing, flags);
@@ -6775,13 +7917,18 @@ function readRelocationChunkVectorV1(reader, context, enclosing, flags) {
6775
7917
  if (count > 4096)
6776
7918
  fail("relocation-chunk-vector-v1 count");
6777
7919
  const value = Array.from({ length: count }, () => readRelocationChunkEntryV1(reader, context, enclosing, flags));
6778
- for (let index = 1; index < value.length; ++index)
6779
- if (compareResults([compareBigint(numeric(value[index - 1]["order"]), numeric(value[index]["order"]))]) >= 0)
6780
- fail("relocation-chunk-vector-v1 sorted");
6781
- for (let left = 0; left < value.length; ++left)
6782
- for (let right = left + 1; right < value.length; ++right)
6783
- if (compareResults([compareBigint(numeric(value[left]["order"]), numeric(value[right]["order"]))]) === 0)
6784
- fail("relocation-chunk-vector-v1 unique");
7920
+ try {
7921
+ for (let index = 1; index < value.length; ++index)
7922
+ if (compareResults([compareBigint(numeric(value[index - 1]["order"]), numeric(value[index]["order"]))]) >= 0)
7923
+ fail("relocation-chunk-vector-v1 sorted");
7924
+ }
7925
+ catch (error) {
7926
+ if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError)
7927
+ throw error;
7928
+ if (error instanceof RangeError)
7929
+ capacityFail("relocation-chunk-vector-v1 constraint capacity");
7930
+ throw error;
7931
+ }
6785
7932
  return value;
6786
7933
  }
6787
7934
  function writeRelocationChunkVectorV1(input, writer, context, enclosing, flags) {
@@ -6791,13 +7938,18 @@ function writeRelocationChunkVectorV1(input, writer, context, enclosing, flags)
6791
7938
  const value = input;
6792
7939
  if (!Array.isArray(value) || value.length > 4096)
6793
7940
  fail("relocation-chunk-vector-v1 count");
6794
- for (let index = 1; index < value.length; ++index)
6795
- if (compareResults([compareBigint(numeric(value[index - 1]["order"]), numeric(value[index]["order"]))]) >= 0)
6796
- fail("relocation-chunk-vector-v1 sorted");
6797
- for (let left = 0; left < value.length; ++left)
6798
- for (let right = left + 1; right < value.length; ++right)
6799
- if (compareResults([compareBigint(numeric(value[left]["order"]), numeric(value[right]["order"]))]) === 0)
6800
- fail("relocation-chunk-vector-v1 unique");
7941
+ try {
7942
+ for (let index = 1; index < value.length; ++index)
7943
+ if (compareResults([compareBigint(numeric(value[index - 1]["order"]), numeric(value[index]["order"]))]) >= 0)
7944
+ fail("relocation-chunk-vector-v1 sorted");
7945
+ }
7946
+ catch (error) {
7947
+ if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError)
7948
+ throw error;
7949
+ if (error instanceof RangeError)
7950
+ capacityFail("relocation-chunk-vector-v1 constraint capacity");
7951
+ throw error;
7952
+ }
6801
7953
  writeU32(value.length, writer, context, enclosing, flags);
6802
7954
  for (const item of value)
6803
7955
  writeRelocationChunkEntryV1(item, writer, context, enclosing, flags);
@@ -6889,6 +8041,29 @@ function readRelocationApplicationState(reader, context, enclosing, flags) {
6889
8041
  fail("relocation-application-state maximum");
6890
8042
  return decoded;
6891
8043
  }
8044
+ function* readIncrementalRelocationApplicationState(reader, context, enclosing, flags) {
8045
+ void context;
8046
+ void enclosing;
8047
+ void flags;
8048
+ const limitStart = reader.offset;
8049
+ const decoded = yield* (function* () {
8050
+ const value = {};
8051
+ value["hasState"] = yield* readIncrementalBool8(reader, context, enclosing, flags);
8052
+ const body = reader.bounded(Number(yield* readIncrementalU64(reader, context, enclosing, flags)));
8053
+ if (same(value["hasState"], "false")) {
8054
+ }
8055
+ else if (same(value["hasState"], "true")) {
8056
+ value["payload"] = yield* readIncrementalDurableStateBlob(body, context, value, flags);
8057
+ }
8058
+ else
8059
+ fail("relocation-application-state discriminator");
8060
+ body.done("relocation-application-state");
8061
+ return value;
8062
+ })();
8063
+ if (reader.offset - limitStart > 274877906944)
8064
+ fail("relocation-application-state maximum");
8065
+ return decoded;
8066
+ }
6892
8067
  function writeRelocationApplicationState(input, writer, context, enclosing, flags) {
6893
8068
  void context;
6894
8069
  void enclosing;
@@ -6925,6 +8100,15 @@ function readRelocationParticipantApplicationState(reader, context, enclosing, f
6925
8100
  value["applicationState"] = readRelocationApplicationState(reader, context, value, flags);
6926
8101
  return value;
6927
8102
  }
8103
+ function* readIncrementalRelocationParticipantApplicationState(reader, context, enclosing, flags) {
8104
+ void context;
8105
+ void enclosing;
8106
+ void flags;
8107
+ const value = {};
8108
+ value["participantId"] = yield* readIncrementalNonzeroU64(reader, context, value, flags);
8109
+ value["applicationState"] = yield* readIncrementalRelocationApplicationState(reader, context, value, flags);
8110
+ return value;
8111
+ }
6928
8112
  function writeRelocationParticipantApplicationState(input, writer, context, enclosing, flags) {
6929
8113
  void context;
6930
8114
  void enclosing;
@@ -6947,13 +8131,49 @@ function readRelocationParticipantApplicationStateVector(reader, context, enclos
6947
8131
  if (count > 1024)
6948
8132
  fail("relocation-participant-application-state-vector count");
6949
8133
  const value = Array.from({ length: count }, () => readRelocationParticipantApplicationState(reader, context, enclosing, flags));
6950
- for (let index = 1; index < value.length; ++index)
6951
- if (compareResults([compareBigint(numeric(value[index - 1]["participantId"]), numeric(value[index]["participantId"]))]) >= 0)
6952
- fail("relocation-participant-application-state-vector sorted");
6953
- for (let left = 0; left < value.length; ++left)
6954
- for (let right = left + 1; right < value.length; ++right)
6955
- if (compareResults([compareBigint(numeric(value[left]["participantId"]), numeric(value[right]["participantId"]))]) === 0)
6956
- fail("relocation-participant-application-state-vector unique");
8134
+ try {
8135
+ for (let index = 1; index < value.length; ++index)
8136
+ if (compareResults([compareBigint(numeric(value[index - 1]["participantId"]), numeric(value[index]["participantId"]))]) >= 0)
8137
+ fail("relocation-participant-application-state-vector sorted");
8138
+ }
8139
+ catch (error) {
8140
+ if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError)
8141
+ throw error;
8142
+ if (error instanceof RangeError)
8143
+ capacityFail("relocation-participant-application-state-vector constraint capacity");
8144
+ throw error;
8145
+ }
8146
+ return value;
8147
+ }
8148
+ function* readIncrementalRelocationParticipantApplicationStateVector(reader, context, enclosing, flags) {
8149
+ void context;
8150
+ void enclosing;
8151
+ void flags;
8152
+ const count = Number(yield* readIncrementalU32(reader, context, enclosing, flags));
8153
+ if (count > 1024)
8154
+ fail("relocation-participant-application-state-vector count");
8155
+ const value = [];
8156
+ for (let index = 0; index < count; ++index) {
8157
+ const item = yield* readIncrementalRelocationParticipantApplicationState(reader, context, enclosing, flags);
8158
+ try {
8159
+ value.push(item);
8160
+ }
8161
+ catch {
8162
+ capacityFail("relocation-participant-application-state-vector capacity");
8163
+ }
8164
+ }
8165
+ try {
8166
+ for (let index = 1; index < value.length; ++index)
8167
+ if (compareResults([compareBigint(numeric(value[index - 1]["participantId"]), numeric(value[index]["participantId"]))]) >= 0)
8168
+ fail("relocation-participant-application-state-vector sorted");
8169
+ }
8170
+ catch (error) {
8171
+ if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError)
8172
+ throw error;
8173
+ if (error instanceof RangeError)
8174
+ capacityFail("relocation-participant-application-state-vector constraint capacity");
8175
+ throw error;
8176
+ }
6957
8177
  return value;
6958
8178
  }
6959
8179
  function writeRelocationParticipantApplicationStateVector(input, writer, context, enclosing, flags) {
@@ -6963,13 +8183,18 @@ function writeRelocationParticipantApplicationStateVector(input, writer, context
6963
8183
  const value = input;
6964
8184
  if (!Array.isArray(value) || value.length > 1024)
6965
8185
  fail("relocation-participant-application-state-vector count");
6966
- for (let index = 1; index < value.length; ++index)
6967
- if (compareResults([compareBigint(numeric(value[index - 1]["participantId"]), numeric(value[index]["participantId"]))]) >= 0)
6968
- fail("relocation-participant-application-state-vector sorted");
6969
- for (let left = 0; left < value.length; ++left)
6970
- for (let right = left + 1; right < value.length; ++right)
6971
- if (compareResults([compareBigint(numeric(value[left]["participantId"]), numeric(value[right]["participantId"]))]) === 0)
6972
- fail("relocation-participant-application-state-vector unique");
8186
+ try {
8187
+ for (let index = 1; index < value.length; ++index)
8188
+ if (compareResults([compareBigint(numeric(value[index - 1]["participantId"]), numeric(value[index]["participantId"]))]) >= 0)
8189
+ fail("relocation-participant-application-state-vector sorted");
8190
+ }
8191
+ catch (error) {
8192
+ if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError)
8193
+ throw error;
8194
+ if (error instanceof RangeError)
8195
+ capacityFail("relocation-participant-application-state-vector constraint capacity");
8196
+ throw error;
8197
+ }
6973
8198
  writeU32(value.length, writer, context, enclosing, flags);
6974
8199
  for (const item of value)
6975
8200
  writeRelocationParticipantApplicationState(item, writer, context, enclosing, flags);
@@ -6993,6 +8218,23 @@ function readRelocationTimerRegistration(reader, context, enclosing, flags) {
6993
8218
  value["nextScheduledAtUnixMilliseconds"] = readU64(reader, context, value, flags);
6994
8219
  return value;
6995
8220
  }
8221
+ function* readIncrementalRelocationTimerRegistration(reader, context, enclosing, flags) {
8222
+ void context;
8223
+ void enclosing;
8224
+ void flags;
8225
+ const value = {};
8226
+ value["participantId"] = yield* readIncrementalNonzeroU64(reader, context, value, flags);
8227
+ value["name"] = yield* readIncrementalText8(reader, context, value, flags);
8228
+ value["handlerType"] = yield* readIncrementalText8(reader, context, value, flags);
8229
+ value["periodMilliseconds"] = yield* readIncrementalNonzeroU64(reader, context, value, flags);
8230
+ value["overrunPolicy"] = yield* readIncrementalTimerOverrunPolicyKind(reader, context, value, flags);
8231
+ value["maxCatchUpTicks"] = yield* readIncrementalNonzeroU64(reader, context, value, flags);
8232
+ value["stopOnUnhandledException"] = yield* readIncrementalBool8(reader, context, value, flags);
8233
+ value["lastCompletedDeliveryIndex"] = yield* readIncrementalOrdinalOrZero(reader, context, value, flags);
8234
+ value["lastCompletedScheduledIndex"] = yield* readIncrementalOrdinalOrZero(reader, context, value, flags);
8235
+ value["nextScheduledAtUnixMilliseconds"] = yield* readIncrementalU64(reader, context, value, flags);
8236
+ return value;
8237
+ }
6996
8238
  function writeRelocationTimerRegistration(input, writer, context, enclosing, flags) {
6997
8239
  void context;
6998
8240
  void enclosing;
@@ -7037,13 +8279,47 @@ function readRelocationTimerRegistrationVector(reader, context, enclosing, flags
7037
8279
  void flags;
7038
8280
  const count = Number(readU32(reader, context, enclosing, flags));
7039
8281
  const value = Array.from({ length: count }, () => readRelocationTimerRegistration(reader, context, enclosing, flags));
7040
- for (let index = 1; index < value.length; ++index)
7041
- if (compareResults([compareBigint(numeric(numeric(value[index - 1]["participantId"])), numeric(numeric(value[index]["participantId"]))), compareBytes(utf8(value[index - 1]["name"]), utf8(value[index]["name"]))]) >= 0)
7042
- fail("relocation-timer-registration-vector sorted");
7043
- for (let left = 0; left < value.length; ++left)
7044
- for (let right = left + 1; right < value.length; ++right)
7045
- if (compareResults([compareBigint(numeric(numeric(value[left]["participantId"])), numeric(numeric(value[right]["participantId"]))), compareBytes(utf8(value[left]["name"]), utf8(value[right]["name"]))]) === 0)
7046
- fail("relocation-timer-registration-vector unique");
8282
+ try {
8283
+ for (let index = 1; index < value.length; ++index)
8284
+ if (compareResults([compareBigint(numeric(numeric(value[index - 1]["participantId"])), numeric(numeric(value[index]["participantId"]))), compareBytes(utf8(value[index - 1]["name"]), utf8(value[index]["name"]))]) >= 0)
8285
+ fail("relocation-timer-registration-vector sorted");
8286
+ }
8287
+ catch (error) {
8288
+ if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError)
8289
+ throw error;
8290
+ if (error instanceof RangeError)
8291
+ capacityFail("relocation-timer-registration-vector constraint capacity");
8292
+ throw error;
8293
+ }
8294
+ return value;
8295
+ }
8296
+ function* readIncrementalRelocationTimerRegistrationVector(reader, context, enclosing, flags) {
8297
+ void context;
8298
+ void enclosing;
8299
+ void flags;
8300
+ const count = Number(yield* readIncrementalU32(reader, context, enclosing, flags));
8301
+ const value = [];
8302
+ for (let index = 0; index < count; ++index) {
8303
+ const item = yield* readIncrementalRelocationTimerRegistration(reader, context, enclosing, flags);
8304
+ try {
8305
+ value.push(item);
8306
+ }
8307
+ catch {
8308
+ capacityFail("relocation-timer-registration-vector capacity");
8309
+ }
8310
+ }
8311
+ try {
8312
+ for (let index = 1; index < value.length; ++index)
8313
+ if (compareResults([compareBigint(numeric(numeric(value[index - 1]["participantId"])), numeric(numeric(value[index]["participantId"]))), compareBytes(utf8(value[index - 1]["name"]), utf8(value[index]["name"]))]) >= 0)
8314
+ fail("relocation-timer-registration-vector sorted");
8315
+ }
8316
+ catch (error) {
8317
+ if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError)
8318
+ throw error;
8319
+ if (error instanceof RangeError)
8320
+ capacityFail("relocation-timer-registration-vector constraint capacity");
8321
+ throw error;
8322
+ }
7047
8323
  return value;
7048
8324
  }
7049
8325
  function writeRelocationTimerRegistrationVector(input, writer, context, enclosing, flags) {
@@ -7053,13 +8329,18 @@ function writeRelocationTimerRegistrationVector(input, writer, context, enclosin
7053
8329
  const value = input;
7054
8330
  if (!Array.isArray(value))
7055
8331
  fail("relocation-timer-registration-vector count");
7056
- for (let index = 1; index < value.length; ++index)
7057
- if (compareResults([compareBigint(numeric(numeric(value[index - 1]["participantId"])), numeric(numeric(value[index]["participantId"]))), compareBytes(utf8(value[index - 1]["name"]), utf8(value[index]["name"]))]) >= 0)
7058
- fail("relocation-timer-registration-vector sorted");
7059
- for (let left = 0; left < value.length; ++left)
7060
- for (let right = left + 1; right < value.length; ++right)
7061
- if (compareResults([compareBigint(numeric(numeric(value[left]["participantId"])), numeric(numeric(value[right]["participantId"]))), compareBytes(utf8(value[left]["name"]), utf8(value[right]["name"]))]) === 0)
7062
- fail("relocation-timer-registration-vector unique");
8332
+ try {
8333
+ for (let index = 1; index < value.length; ++index)
8334
+ if (compareResults([compareBigint(numeric(numeric(value[index - 1]["participantId"])), numeric(numeric(value[index]["participantId"]))), compareBytes(utf8(value[index - 1]["name"]), utf8(value[index]["name"]))]) >= 0)
8335
+ fail("relocation-timer-registration-vector sorted");
8336
+ }
8337
+ catch (error) {
8338
+ if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError)
8339
+ throw error;
8340
+ if (error instanceof RangeError)
8341
+ capacityFail("relocation-timer-registration-vector constraint capacity");
8342
+ throw error;
8343
+ }
7063
8344
  writeU32(value.length, writer, context, enclosing, flags);
7064
8345
  for (const item of value)
7065
8346
  writeRelocationTimerRegistration(item, writer, context, enclosing, flags);
@@ -7080,6 +8361,20 @@ function readRelocationPendingTimerTick(reader, context, enclosing, flags) {
7080
8361
  value["skippedTicks"] = readOrdinalOrZero(reader, context, value, flags);
7081
8362
  return value;
7082
8363
  }
8364
+ function* readIncrementalRelocationPendingTimerTick(reader, context, enclosing, flags) {
8365
+ void context;
8366
+ void enclosing;
8367
+ void flags;
8368
+ const value = {};
8369
+ value["participantId"] = yield* readIncrementalNonzeroU64(reader, context, value, flags);
8370
+ value["order"] = yield* readIncrementalNonzeroU64(reader, context, value, flags);
8371
+ value["timerName"] = yield* readIncrementalText8(reader, context, value, flags);
8372
+ value["deliveryIndex"] = yield* readIncrementalNonzeroU64(reader, context, value, flags);
8373
+ value["scheduledIndex"] = yield* readIncrementalNonzeroU64(reader, context, value, flags);
8374
+ value["scheduledAtUnixMilliseconds"] = yield* readIncrementalU64(reader, context, value, flags);
8375
+ value["skippedTicks"] = yield* readIncrementalOrdinalOrZero(reader, context, value, flags);
8376
+ return value;
8377
+ }
7083
8378
  function writeRelocationPendingTimerTick(input, writer, context, enclosing, flags) {
7084
8379
  void context;
7085
8380
  void enclosing;
@@ -7115,13 +8410,47 @@ function readRelocationPendingTimerTickVector(reader, context, enclosing, flags)
7115
8410
  void flags;
7116
8411
  const count = Number(readU32(reader, context, enclosing, flags));
7117
8412
  const value = Array.from({ length: count }, () => readRelocationPendingTimerTick(reader, context, enclosing, flags));
7118
- for (let index = 1; index < value.length; ++index)
7119
- if (compareResults([compareBigint(numeric(value[index - 1]["participantId"]), numeric(value[index]["participantId"])), compareBigint(numeric(value[index - 1]["order"]), numeric(value[index]["order"]))]) >= 0)
7120
- fail("relocation-pending-timer-tick-vector sorted");
7121
- for (let left = 0; left < value.length; ++left)
7122
- for (let right = left + 1; right < value.length; ++right)
7123
- if (compareResults([compareBigint(numeric(value[left]["participantId"]), numeric(value[right]["participantId"])), compareBigint(numeric(value[left]["order"]), numeric(value[right]["order"]))]) === 0)
7124
- fail("relocation-pending-timer-tick-vector unique");
8413
+ try {
8414
+ for (let index = 1; index < value.length; ++index)
8415
+ if (compareResults([compareBigint(numeric(value[index - 1]["participantId"]), numeric(value[index]["participantId"])), compareBigint(numeric(value[index - 1]["order"]), numeric(value[index]["order"]))]) >= 0)
8416
+ fail("relocation-pending-timer-tick-vector sorted");
8417
+ }
8418
+ catch (error) {
8419
+ if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError)
8420
+ throw error;
8421
+ if (error instanceof RangeError)
8422
+ capacityFail("relocation-pending-timer-tick-vector constraint capacity");
8423
+ throw error;
8424
+ }
8425
+ return value;
8426
+ }
8427
+ function* readIncrementalRelocationPendingTimerTickVector(reader, context, enclosing, flags) {
8428
+ void context;
8429
+ void enclosing;
8430
+ void flags;
8431
+ const count = Number(yield* readIncrementalU32(reader, context, enclosing, flags));
8432
+ const value = [];
8433
+ for (let index = 0; index < count; ++index) {
8434
+ const item = yield* readIncrementalRelocationPendingTimerTick(reader, context, enclosing, flags);
8435
+ try {
8436
+ value.push(item);
8437
+ }
8438
+ catch {
8439
+ capacityFail("relocation-pending-timer-tick-vector capacity");
8440
+ }
8441
+ }
8442
+ try {
8443
+ for (let index = 1; index < value.length; ++index)
8444
+ if (compareResults([compareBigint(numeric(value[index - 1]["participantId"]), numeric(value[index]["participantId"])), compareBigint(numeric(value[index - 1]["order"]), numeric(value[index]["order"]))]) >= 0)
8445
+ fail("relocation-pending-timer-tick-vector sorted");
8446
+ }
8447
+ catch (error) {
8448
+ if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError)
8449
+ throw error;
8450
+ if (error instanceof RangeError)
8451
+ capacityFail("relocation-pending-timer-tick-vector constraint capacity");
8452
+ throw error;
8453
+ }
7125
8454
  return value;
7126
8455
  }
7127
8456
  function writeRelocationPendingTimerTickVector(input, writer, context, enclosing, flags) {
@@ -7131,13 +8460,18 @@ function writeRelocationPendingTimerTickVector(input, writer, context, enclosing
7131
8460
  const value = input;
7132
8461
  if (!Array.isArray(value))
7133
8462
  fail("relocation-pending-timer-tick-vector count");
7134
- for (let index = 1; index < value.length; ++index)
7135
- if (compareResults([compareBigint(numeric(value[index - 1]["participantId"]), numeric(value[index]["participantId"])), compareBigint(numeric(value[index - 1]["order"]), numeric(value[index]["order"]))]) >= 0)
7136
- fail("relocation-pending-timer-tick-vector sorted");
7137
- for (let left = 0; left < value.length; ++left)
7138
- for (let right = left + 1; right < value.length; ++right)
7139
- if (compareResults([compareBigint(numeric(value[left]["participantId"]), numeric(value[right]["participantId"])), compareBigint(numeric(value[left]["order"]), numeric(value[right]["order"]))]) === 0)
7140
- fail("relocation-pending-timer-tick-vector unique");
8463
+ try {
8464
+ for (let index = 1; index < value.length; ++index)
8465
+ if (compareResults([compareBigint(numeric(value[index - 1]["participantId"]), numeric(value[index]["participantId"])), compareBigint(numeric(value[index - 1]["order"]), numeric(value[index]["order"]))]) >= 0)
8466
+ fail("relocation-pending-timer-tick-vector sorted");
8467
+ }
8468
+ catch (error) {
8469
+ if (error instanceof ServiceWireProtocolError || error instanceof ServiceWireCapacityError)
8470
+ throw error;
8471
+ if (error instanceof RangeError)
8472
+ capacityFail("relocation-pending-timer-tick-vector constraint capacity");
8473
+ throw error;
8474
+ }
7141
8475
  writeU32(value.length, writer, context, enclosing, flags);
7142
8476
  for (const item of value)
7143
8477
  writeRelocationPendingTimerTick(item, writer, context, enclosing, flags);
@@ -7158,6 +8492,20 @@ function readRelocationEnvelopeV1(reader, context, enclosing, flags) {
7158
8492
  value["pendingTimerTicks"] = readRelocationPendingTimerTickVector(reader, context, value, flags);
7159
8493
  return value;
7160
8494
  }
8495
+ function* readIncrementalRelocationEnvelopeV1(reader, context, enclosing, flags) {
8496
+ void context;
8497
+ void enclosing;
8498
+ void flags;
8499
+ const value = {};
8500
+ value["relocation"] = yield* readIncrementalRelocationId(reader, context, value, flags);
8501
+ value["object"] = yield* readIncrementalRelocationObjectIdentity(reader, context, value, flags);
8502
+ value["applicationVersion"] = yield* readIncrementalApplicationVersion(reader, context, value, flags);
8503
+ value["applicationStates"] = yield* readIncrementalRelocationParticipantApplicationStateVector(reader, context, value, flags);
8504
+ value["savedWork"] = yield* readIncrementalSavedWorkVector(reader, context, value, flags);
8505
+ value["timerRegistrations"] = yield* readIncrementalRelocationTimerRegistrationVector(reader, context, value, flags);
8506
+ value["pendingTimerTicks"] = yield* readIncrementalRelocationPendingTimerTickVector(reader, context, value, flags);
8507
+ return value;
8508
+ }
7161
8509
  function writeRelocationEnvelopeV1(input, writer, context, enclosing, flags) {
7162
8510
  void context;
7163
8511
  void enclosing;
@@ -7569,14 +8917,16 @@ function decodeReplyCommand(frames, context) {
7569
8917
  value.payload = decodeApplicationPayloadEnvelopeV1(frames[frameIndex++], context);
7570
8918
  if (frameIndex !== frames.length)
7571
8919
  fail("reply frames");
7572
- if (!(runtimePredicate(context, "service-wire-constants.valid-terminal-failure", enumWireRequestTerminalResult(value["terminalResult"]), enumWireFrameworkErrorCode(value["failureCode"]))))
8920
+ void context;
8921
+ if (!(validTerminalFailure(enumWireRequestTerminalResult(value["terminalResult"]), enumWireFrameworkErrorCode(value["failureCode"]))))
7573
8922
  fail("reply runtime predicate");
7574
8923
  return value;
7575
8924
  }
7576
8925
  function encodeReplyCommand(value, context) {
7577
8926
  if ((value.flags & ~0) !== 0 || (value.flags & 0) !== 0)
7578
8927
  fail("reply flags");
7579
- if (!(runtimePredicate(context, "service-wire-constants.valid-terminal-failure", enumWireRequestTerminalResult(value["terminalResult"]), enumWireFrameworkErrorCode(value["failureCode"]))))
8928
+ void context;
8929
+ if (!(validTerminalFailure(enumWireRequestTerminalResult(value["terminalResult"]), enumWireFrameworkErrorCode(value["failureCode"]))))
7580
8930
  fail("reply runtime predicate");
7581
8931
  const writer = new Writer();
7582
8932
  writer.put([90, 77, 1, 20, value.flags]);
@@ -7597,8 +8947,13 @@ function encodeReplyCommand(value, context) {
7597
8947
  frames.push(encodeApplicationPayloadEnvelopeV1(value.payload, context));
7598
8948
  return frames;
7599
8949
  }
7600
- function validateReplyCommandRuntimePredicates(value, context) { if (!(runtimePredicate(context, "service-wire-constants.valid-terminal-failure", enumWireRequestTerminalResult(value["terminalResult"]), enumWireFrameworkErrorCode(value["failureCode"]))))
7601
- fail("reply runtime predicate"); }
8950
+ function validateReplyCommandRuntimePredicates(value, context) {
8951
+ void value;
8952
+ void context;
8953
+ void context;
8954
+ if (!(validTerminalFailure(enumWireRequestTerminalResult(value["terminalResult"]), enumWireFrameworkErrorCode(value["failureCode"]))))
8955
+ fail("reply runtime predicate");
8956
+ }
7602
8957
  function decodeSpotSendCommand(frames, context) {
7603
8958
  if (!frames.length)
7604
8959
  fail("spotSend frames");
@@ -8209,14 +9564,16 @@ function decodeReplyRelayCommand(frames, context) {
8209
9564
  value.payload = decodeApplicationPayloadEnvelopeV1(frames[frameIndex++], context);
8210
9565
  if (frameIndex !== frames.length)
8211
9566
  fail("replyRelay frames");
8212
- if (!(runtimePredicate(context, "service-wire-constants.valid-terminal-failure", enumWireRequestTerminalResult(value["terminalResult"]), enumWireFrameworkErrorCode(value["failureCode"]))))
9567
+ void context;
9568
+ if (!(validTerminalFailure(enumWireRequestTerminalResult(value["terminalResult"]), enumWireFrameworkErrorCode(value["failureCode"]))))
8213
9569
  fail("replyRelay runtime predicate");
8214
9570
  return value;
8215
9571
  }
8216
9572
  function encodeReplyRelayCommand(value, context) {
8217
9573
  if ((value.flags & ~0) !== 0 || (value.flags & 0) !== 0)
8218
9574
  fail("replyRelay flags");
8219
- if (!(runtimePredicate(context, "service-wire-constants.valid-terminal-failure", enumWireRequestTerminalResult(value["terminalResult"]), enumWireFrameworkErrorCode(value["failureCode"]))))
9575
+ void context;
9576
+ if (!(validTerminalFailure(enumWireRequestTerminalResult(value["terminalResult"]), enumWireFrameworkErrorCode(value["failureCode"]))))
8220
9577
  fail("replyRelay runtime predicate");
8221
9578
  const writer = new Writer();
8222
9579
  writer.put([90, 77, 1, 33, value.flags]);
@@ -8240,8 +9597,13 @@ function encodeReplyRelayCommand(value, context) {
8240
9597
  frames.push(encodeApplicationPayloadEnvelopeV1(value.payload, context));
8241
9598
  return frames;
8242
9599
  }
8243
- function validateReplyRelayCommandRuntimePredicates(value, context) { if (!(runtimePredicate(context, "service-wire-constants.valid-terminal-failure", enumWireRequestTerminalResult(value["terminalResult"]), enumWireFrameworkErrorCode(value["failureCode"]))))
8244
- fail("replyRelay runtime predicate"); }
9600
+ function validateReplyRelayCommandRuntimePredicates(value, context) {
9601
+ void value;
9602
+ void context;
9603
+ void context;
9604
+ if (!(validTerminalFailure(enumWireRequestTerminalResult(value["terminalResult"]), enumWireFrameworkErrorCode(value["failureCode"]))))
9605
+ fail("replyRelay runtime predicate");
9606
+ }
8245
9607
  function decodeRelocationCutoverCommand(frames, context) {
8246
9608
  if (!frames.length)
8247
9609
  fail("relocationCutover frames");
@@ -9163,7 +10525,82 @@ function decodeRelocationManifestV1DurableFormat(bytes, context) { if (bytes.len
9163
10525
  fail("relocation-manifest-v1 checksum"); return decodeRelocationManifestV1(body, context); }
9164
10526
  function encodeRelocationManifestV1DurableFormat(value, context) { const body = encodeRelocationManifestV1(value, context); const writer = new Writer(); writer.put([90, 76, 84, 77, 1]); writeU16(0, writer, context, {}, 0); writeU32(body.length, writer, context, {}, 0); writer.put(body); writer.u(BigInt(crc32c(writer.result())), 4); const bytes = writer.result(); if (bytes.length > 33554432)
9165
10527
  fail("relocation-manifest-v1 maximum"); return bytes; }
9166
- function decodeRelocationEnvelopeV1LogicalStream(bytes, context) { if (bytes.length > 274877906944)
9167
- fail("relocation-envelope-v1 maximum"); return decodeRelocationEnvelopeV1(bytes, context); }
10528
+ class LogicalDecodeError extends RangeError {
10529
+ kind;
10530
+ offset;
10531
+ constructor(kind, offset, options) {
10532
+ super(kind + " at byte " + offset, options);
10533
+ this.kind = kind;
10534
+ this.offset = offset;
10535
+ this.name = "LogicalDecodeError";
10536
+ }
10537
+ }
10538
+ exports.LogicalDecodeError = LogicalDecodeError;
10539
+ class RelocationEnvelopeV1LogicalStreamDecoder {
10540
+ static maximumContinuationDepth = 12;
10541
+ reader = new IncrementalReader();
10542
+ machine;
10543
+ state = "reading";
10544
+ pendingValue;
10545
+ totalInputByteCount = 0;
10546
+ constructor(context) {
10547
+ this.machine = readIncrementalRelocationEnvelopeV1(this.reader, context, {}, 0);
10548
+ }
10549
+ setSyntheticPriorInputByteCountForTest(value) { if (this.totalInputByteCount !== 0)
10550
+ throw new Error("decoder already used"); this.totalInputByteCount = value; }
10551
+ logicalFailure(error, forced) { if (error instanceof LogicalDecodeError)
10552
+ return error; const kind = forced ?? (error instanceof ServiceWireCapacityError ? "capacity" : "protocol"); return new LogicalDecodeError(kind, this.reader.offset, { cause: error }); }
10553
+ push(chunk, finalChunk) {
10554
+ if (this.state === "complete" || this.state === "failed")
10555
+ throw new Error("terminal logical decoder push");
10556
+ if (chunk.length > 274877906944 - this.totalInputByteCount) {
10557
+ this.state = "failed";
10558
+ throw this.logicalFailure(new RangeError("relocation-envelope-v1 encoded limit"), "limit");
10559
+ }
10560
+ this.totalInputByteCount += chunk.length;
10561
+ if (this.state === "await-final") {
10562
+ if (chunk.length !== 0) {
10563
+ this.state = "failed";
10564
+ throw this.logicalFailure(new RangeError("relocation-envelope-v1 trailing bytes"), "trailing");
10565
+ }
10566
+ if (!finalChunk)
10567
+ return { state: "needMore", bufferedInputByteCount: 0, consumedByteCount: this.reader.offset, continuationDepth: 12 };
10568
+ this.state = "complete";
10569
+ return { state: "complete", value: this.pendingValue, consumedByteCount: this.reader.offset, continuationDepth: 0 };
10570
+ }
10571
+ try {
10572
+ this.reader.supply(chunk);
10573
+ const result = this.machine.next();
10574
+ if (!result.done) {
10575
+ this.reader.release();
10576
+ if (finalChunk) {
10577
+ this.state = "failed";
10578
+ throw this.logicalFailure(new RangeError("relocation-envelope-v1 truncated"), "truncated");
10579
+ }
10580
+ return { state: "needMore", bufferedInputByteCount: this.reader.bufferedInputByteCount, consumedByteCount: this.reader.offset, continuationDepth: 12 };
10581
+ }
10582
+ if (this.reader.remaining !== 0) {
10583
+ this.state = "failed";
10584
+ throw this.logicalFailure(new RangeError("relocation-envelope-v1 trailing bytes"), "trailing");
10585
+ }
10586
+ this.reader.release();
10587
+ if (finalChunk) {
10588
+ this.state = "complete";
10589
+ return { state: "complete", value: result.value, consumedByteCount: this.reader.offset, continuationDepth: 0 };
10590
+ }
10591
+ this.pendingValue = result.value;
10592
+ this.state = "await-final";
10593
+ return { state: "needMore", bufferedInputByteCount: 0, consumedByteCount: this.reader.offset, continuationDepth: 12 };
10594
+ }
10595
+ catch (error) {
10596
+ this.reader.discard();
10597
+ this.state = "failed";
10598
+ throw this.logicalFailure(error);
10599
+ }
10600
+ }
10601
+ }
10602
+ exports.RelocationEnvelopeV1LogicalStreamDecoder = RelocationEnvelopeV1LogicalStreamDecoder;
10603
+ function decodeRelocationEnvelopeV1LogicalStream(bytes, context) { const step = new RelocationEnvelopeV1LogicalStreamDecoder(context).push(bytes, true); if (step.state !== "complete")
10604
+ fail("relocation-envelope-v1 truncated"); return step.value; }
9168
10605
  function encodeRelocationEnvelopeV1LogicalStream(value, context) { const bytes = encodeRelocationEnvelopeV1(value, context); if (bytes.length > 274877906944)
9169
10606
  fail("relocation-envelope-v1 maximum"); return bytes; }