@rikalabs/akter 0.1.0-alpha.1 → 0.1.0-alpha.4

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 (291) hide show
  1. package/CHANGELOG.md +51 -2
  2. package/README.md +2 -2
  3. package/dist/actor/definition.d.ts +13 -9
  4. package/dist/actor/descriptor.d.ts +1 -1
  5. package/dist/actor/descriptor.js +4 -4
  6. package/dist/client/calls.js +1 -1
  7. package/dist/client/index.d.ts +1 -1
  8. package/dist/client/index.js +1 -1
  9. package/dist/errors/actor.d.ts +11 -42
  10. package/dist/errors/actor.js +12 -42
  11. package/dist/index.d.ts +1 -1
  12. package/dist/index.js +1 -1
  13. package/dist/protocol/inspection.d.ts +221 -1
  14. package/dist/protocol/inspection.js +151 -2
  15. package/dist/protocol/wire.d.ts +6 -49
  16. package/dist/protocol/wire.js +1 -10
  17. package/dist/runtime/actors.d.ts +3 -0
  18. package/dist/runtime/app.d.ts +65 -0
  19. package/dist/runtime/app.js +38 -0
  20. package/dist/runtime/connections/holder.d.ts +11 -1
  21. package/dist/runtime/connections/holder.js +8 -4
  22. package/dist/runtime/connections/streams.d.ts +4 -4
  23. package/dist/runtime/content/store.js +15 -11
  24. package/dist/runtime/database/bounded.d.ts +4 -18
  25. package/dist/runtime/database/bounded.js +36 -22
  26. package/dist/runtime/database/coordination.d.ts +12 -3
  27. package/dist/runtime/database/coordination.js +29 -36
  28. package/dist/runtime/database/migrations.d.ts +61 -29
  29. package/dist/runtime/database/migrations.js +375 -139
  30. package/dist/runtime/database/replica.d.ts +4 -1
  31. package/dist/runtime/database/replica.js +4 -1
  32. package/dist/runtime/database/schema.d.ts +13 -0
  33. package/dist/runtime/database/schema.js +13 -0
  34. package/dist/runtime/database/shards.d.ts +31 -13
  35. package/dist/runtime/database/shards.js +38 -26
  36. package/dist/runtime/entity/register.d.ts +8 -1
  37. package/dist/runtime/entity/register.js +58 -7
  38. package/dist/runtime/index.d.ts +2 -0
  39. package/dist/runtime/index.js +1 -0
  40. package/dist/runtime/inspector/layer.d.ts +20 -0
  41. package/dist/runtime/inspector/layer.js +224 -5
  42. package/dist/runtime/inspector/queries.d.ts +54 -8
  43. package/dist/runtime/inspector/queries.js +84 -15
  44. package/dist/runtime/layer.d.ts +45 -36
  45. package/dist/runtime/layer.js +123 -55
  46. package/dist/runtime/operators/audit.d.ts +3 -0
  47. package/dist/runtime/operators/audit.js +6 -2
  48. package/dist/runtime/operators/repair.js +30 -10
  49. package/dist/runtime/operators/seed.js +4 -2
  50. package/dist/runtime/payloads/versions.js +20 -11
  51. package/dist/runtime/queries.js +4 -2
  52. package/dist/runtime/registration.d.ts +5 -2
  53. package/dist/runtime/registration.js +3 -3
  54. package/dist/runtime/runner.d.ts +12 -0
  55. package/dist/runtime/runner.js +12 -0
  56. package/dist/runtime/storage/codec.d.ts +19 -7
  57. package/dist/runtime/storage/codec.js +23 -7
  58. package/dist/runtime/storage/placements.d.ts +6 -1
  59. package/dist/runtime/storage/placements.js +98 -6
  60. package/dist/runtime/storage/retention.d.ts +6 -0
  61. package/dist/runtime/storage/retention.js +25 -13
  62. package/dist/runtime/subscriptions/relay.js +47 -44
  63. package/dist/runtime/subscriptions/storage.d.ts +3 -2
  64. package/dist/runtime/subscriptions/storage.js +9 -6
  65. package/dist/runtime/telemetry/live.d.ts +255 -0
  66. package/dist/runtime/telemetry/live.js +540 -0
  67. package/dist/runtime/telemetry/metrics.d.ts +2 -0
  68. package/dist/runtime/telemetry/metrics.js +4 -1
  69. package/dist/runtime/telemetry/sampler.js +33 -13
  70. package/dist/runtime/topology/locks.d.ts +6 -3
  71. package/dist/runtime/topology/locks.js +27 -4
  72. package/dist/runtime/turn/execute.d.ts +2 -0
  73. package/dist/runtime/turn/execute.js +5 -2
  74. package/dist/runtime/turn/pipeline.d.ts +5 -12
  75. package/dist/runtime/turn/pipeline.js +11 -11
  76. package/dist/runtime/turn/relay.d.ts +13 -3
  77. package/dist/runtime/turn/relay.js +27 -14
  78. package/dist/runtime/workflows/compatibility.js +84 -30
  79. package/dist/runtime/workflows/engine.js +20 -17
  80. package/dist/serve/layer.js +3 -2
  81. package/dist/testing/actor-test.d.ts +1 -23
  82. package/dist/testing/actor-test.js +1 -27
  83. package/dist/testing/index.d.ts +0 -12
  84. package/dist/testing/index.js +0 -6
  85. package/package.json +1 -1
  86. package/dist/runtime/database/neki/migrations.d.ts +0 -31
  87. package/dist/runtime/database/neki/migrations.js +0 -276
  88. package/dist/runtime/database/neki/session.d.ts +0 -23
  89. package/dist/runtime/database/neki/session.js +0 -31
  90. package/dist/testing/cluster.d.ts +0 -93
  91. package/dist/testing/cluster.js +0 -296
  92. package/dist/testing/conformance/access.d.ts +0 -5
  93. package/dist/testing/conformance/access.js +0 -531
  94. package/dist/testing/conformance/admission.d.ts +0 -11
  95. package/dist/testing/conformance/admission.js +0 -182
  96. package/dist/testing/conformance/adoption.d.ts +0 -2
  97. package/dist/testing/conformance/adoption.js +0 -1019
  98. package/dist/testing/conformance/assertions.d.ts +0 -202
  99. package/dist/testing/conformance/assertions.js +0 -849
  100. package/dist/testing/conformance/batches.d.ts +0 -41
  101. package/dist/testing/conformance/batches.js +0 -388
  102. package/dist/testing/conformance/blobs.d.ts +0 -14
  103. package/dist/testing/conformance/blobs.js +0 -405
  104. package/dist/testing/conformance/capacity.d.ts +0 -8
  105. package/dist/testing/conformance/capacity.js +0 -433
  106. package/dist/testing/conformance/client.d.ts +0 -5
  107. package/dist/testing/conformance/client.js +0 -719
  108. package/dist/testing/conformance/cold-serve.d.ts +0 -16
  109. package/dist/testing/conformance/cold-serve.js +0 -254
  110. package/dist/testing/conformance/connections/actors.d.ts +0 -1143
  111. package/dist/testing/conformance/connections/actors.js +0 -180
  112. package/dist/testing/conformance/connections/harness.d.ts +0 -1754
  113. package/dist/testing/conformance/connections/harness.js +0 -142
  114. package/dist/testing/conformance/connections/holders.d.ts +0 -4
  115. package/dist/testing/conformance/connections/holders.js +0 -165
  116. package/dist/testing/conformance/connections/lifecycle.d.ts +0 -4
  117. package/dist/testing/conformance/connections/lifecycle.js +0 -113
  118. package/dist/testing/conformance/connections/limits.d.ts +0 -4
  119. package/dist/testing/conformance/connections/limits.js +0 -127
  120. package/dist/testing/conformance/connections/reauthorization.d.ts +0 -4
  121. package/dist/testing/conformance/connections/reauthorization.js +0 -170
  122. package/dist/testing/conformance/connections/resync.d.ts +0 -4
  123. package/dist/testing/conformance/connections/resync.js +0 -360
  124. package/dist/testing/conformance/connections/takeover.d.ts +0 -4
  125. package/dist/testing/conformance/connections/takeover.js +0 -287
  126. package/dist/testing/conformance/connections.d.ts +0 -4
  127. package/dist/testing/conformance/connections.js +0 -15
  128. package/dist/testing/conformance/content-blobs.d.ts +0 -16
  129. package/dist/testing/conformance/content-blobs.js +0 -534
  130. package/dist/testing/conformance/counter.d.ts +0 -16
  131. package/dist/testing/conformance/counter.js +0 -813
  132. package/dist/testing/conformance/cron.d.ts +0 -5
  133. package/dist/testing/conformance/cron.js +0 -665
  134. package/dist/testing/conformance/drain.d.ts +0 -26
  135. package/dist/testing/conformance/drain.js +0 -540
  136. package/dist/testing/conformance/effect-control.d.ts +0 -38
  137. package/dist/testing/conformance/effect-control.js +0 -1059
  138. package/dist/testing/conformance/effects.d.ts +0 -23
  139. package/dist/testing/conformance/effects.js +0 -432
  140. package/dist/testing/conformance/events.d.ts +0 -28
  141. package/dist/testing/conformance/events.js +0 -335
  142. package/dist/testing/conformance/export.d.ts +0 -2
  143. package/dist/testing/conformance/export.js +0 -368
  144. package/dist/testing/conformance/fleet.d.ts +0 -444
  145. package/dist/testing/conformance/fleet.js +0 -1009
  146. package/dist/testing/conformance/groups.d.ts +0 -7
  147. package/dist/testing/conformance/groups.js +0 -353
  148. package/dist/testing/conformance/heap.d.ts +0 -3
  149. package/dist/testing/conformance/heap.js +0 -149
  150. package/dist/testing/conformance/http.d.ts +0 -2809
  151. package/dist/testing/conformance/http.js +0 -1234
  152. package/dist/testing/conformance/inspection-views.d.ts +0 -8
  153. package/dist/testing/conformance/inspection-views.js +0 -272
  154. package/dist/testing/conformance/inspector.d.ts +0 -7
  155. package/dist/testing/conformance/inspector.js +0 -650
  156. package/dist/testing/conformance/mint.d.ts +0 -58
  157. package/dist/testing/conformance/mint.js +0 -692
  158. package/dist/testing/conformance/multi-runner.d.ts +0 -8
  159. package/dist/testing/conformance/multi-runner.js +0 -403
  160. package/dist/testing/conformance/neki/plan.d.ts +0 -19
  161. package/dist/testing/conformance/neki/plan.js +0 -30
  162. package/dist/testing/conformance/observability.d.ts +0 -3
  163. package/dist/testing/conformance/observability.js +0 -343
  164. package/dist/testing/conformance/offline.d.ts +0 -4
  165. package/dist/testing/conformance/offline.js +0 -474
  166. package/dist/testing/conformance/operator-harness.d.ts +0 -57
  167. package/dist/testing/conformance/operator-harness.js +0 -78
  168. package/dist/testing/conformance/operator.d.ts +0 -3
  169. package/dist/testing/conformance/operator.js +0 -379
  170. package/dist/testing/conformance/outbox-cross-shard.d.ts +0 -14
  171. package/dist/testing/conformance/outbox-cross-shard.js +0 -160
  172. package/dist/testing/conformance/outbox.d.ts +0 -36
  173. package/dist/testing/conformance/outbox.js +0 -437
  174. package/dist/testing/conformance/payload-migrations.d.ts +0 -3
  175. package/dist/testing/conformance/payload-migrations.js +0 -612
  176. package/dist/testing/conformance/pipeline.d.ts +0 -3
  177. package/dist/testing/conformance/pipeline.js +0 -1040
  178. package/dist/testing/conformance/placement.d.ts +0 -22
  179. package/dist/testing/conformance/placement.js +0 -539
  180. package/dist/testing/conformance/platform.d.ts +0 -40
  181. package/dist/testing/conformance/platform.js +0 -101
  182. package/dist/testing/conformance/progress.d.ts +0 -39
  183. package/dist/testing/conformance/progress.js +0 -666
  184. package/dist/testing/conformance/properties.d.ts +0 -6
  185. package/dist/testing/conformance/properties.js +0 -295
  186. package/dist/testing/conformance/protocols.d.ts +0 -4
  187. package/dist/testing/conformance/protocols.js +0 -618
  188. package/dist/testing/conformance/provider/advertise.d.ts +0 -21
  189. package/dist/testing/conformance/provider/advertise.js +0 -44
  190. package/dist/testing/conformance/read-your-writes.d.ts +0 -20
  191. package/dist/testing/conformance/read-your-writes.js +0 -192
  192. package/dist/testing/conformance/reducers.d.ts +0 -8
  193. package/dist/testing/conformance/reducers.js +0 -258
  194. package/dist/testing/conformance/relay.d.ts +0 -42
  195. package/dist/testing/conformance/relay.js +0 -1115
  196. package/dist/testing/conformance/restore.d.ts +0 -43
  197. package/dist/testing/conformance/restore.js +0 -341
  198. package/dist/testing/conformance/retention.d.ts +0 -14
  199. package/dist/testing/conformance/retention.js +0 -463
  200. package/dist/testing/conformance/rls.d.ts +0 -24
  201. package/dist/testing/conformance/rls.js +0 -576
  202. package/dist/testing/conformance/simulation.d.ts +0 -31
  203. package/dist/testing/conformance/simulation.js +0 -167
  204. package/dist/testing/conformance/single-shard.d.ts +0 -2
  205. package/dist/testing/conformance/single-shard.js +0 -125
  206. package/dist/testing/conformance/singleton.d.ts +0 -3
  207. package/dist/testing/conformance/singleton.js +0 -293
  208. package/dist/testing/conformance/statements.d.ts +0 -60
  209. package/dist/testing/conformance/statements.js +0 -108
  210. package/dist/testing/conformance/streams.d.ts +0 -7
  211. package/dist/testing/conformance/streams.js +0 -280
  212. package/dist/testing/conformance/subscriptions/access.d.ts +0 -4
  213. package/dist/testing/conformance/subscriptions/access.js +0 -98
  214. package/dist/testing/conformance/subscriptions/actors.d.ts +0 -4910
  215. package/dist/testing/conformance/subscriptions/actors.js +0 -372
  216. package/dist/testing/conformance/subscriptions/cluster.d.ts +0 -4
  217. package/dist/testing/conformance/subscriptions/cluster.js +0 -89
  218. package/dist/testing/conformance/subscriptions/delivery.d.ts +0 -4
  219. package/dist/testing/conformance/subscriptions/delivery.js +0 -253
  220. package/dist/testing/conformance/subscriptions/deploys.d.ts +0 -4
  221. package/dist/testing/conformance/subscriptions/deploys.js +0 -162
  222. package/dist/testing/conformance/subscriptions/epochs.d.ts +0 -4
  223. package/dist/testing/conformance/subscriptions/epochs.js +0 -169
  224. package/dist/testing/conformance/subscriptions/failures.d.ts +0 -4
  225. package/dist/testing/conformance/subscriptions/failures.js +0 -108
  226. package/dist/testing/conformance/subscriptions/feeds.d.ts +0 -4
  227. package/dist/testing/conformance/subscriptions/feeds.js +0 -218
  228. package/dist/testing/conformance/subscriptions/harness.d.ts +0 -124
  229. package/dist/testing/conformance/subscriptions/harness.js +0 -143
  230. package/dist/testing/conformance/subscriptions/operator.d.ts +0 -4
  231. package/dist/testing/conformance/subscriptions/operator.js +0 -128
  232. package/dist/testing/conformance/subscriptions/retention.d.ts +0 -4
  233. package/dist/testing/conformance/subscriptions/retention.js +0 -288
  234. package/dist/testing/conformance/subscriptions/routing.d.ts +0 -4
  235. package/dist/testing/conformance/subscriptions/routing.js +0 -179
  236. package/dist/testing/conformance/subscriptions.d.ts +0 -4
  237. package/dist/testing/conformance/subscriptions.js +0 -19
  238. package/dist/testing/conformance/tables.d.ts +0 -125
  239. package/dist/testing/conformance/tables.js +0 -664
  240. package/dist/testing/conformance/transports/actors.d.ts +0 -1907
  241. package/dist/testing/conformance/transports/actors.js +0 -163
  242. package/dist/testing/conformance/transports/client.d.ts +0 -3
  243. package/dist/testing/conformance/transports/client.js +0 -237
  244. package/dist/testing/conformance/transports/feeds.d.ts +0 -3
  245. package/dist/testing/conformance/transports/feeds.js +0 -232
  246. package/dist/testing/conformance/transports/harness.d.ts +0 -93
  247. package/dist/testing/conformance/transports/harness.js +0 -84
  248. package/dist/testing/conformance/transports/streams.d.ts +0 -3
  249. package/dist/testing/conformance/transports/streams.js +0 -96
  250. package/dist/testing/conformance/transports/websocket.d.ts +0 -3
  251. package/dist/testing/conformance/transports/websocket.js +0 -384
  252. package/dist/testing/conformance/transports/wire.d.ts +0 -141
  253. package/dist/testing/conformance/transports/wire.js +0 -204
  254. package/dist/testing/conformance/transports.d.ts +0 -3
  255. package/dist/testing/conformance/transports.js +0 -11
  256. package/dist/testing/conformance/watch.d.ts +0 -59
  257. package/dist/testing/conformance/watch.js +0 -879
  258. package/dist/testing/conformance/workflow-engine.d.ts +0 -97
  259. package/dist/testing/conformance/workflow-engine.js +0 -253
  260. package/dist/testing/conformance/workflow-versions.d.ts +0 -3
  261. package/dist/testing/conformance/workflow-versions.js +0 -545
  262. package/dist/testing/conformance/workflows/access.d.ts +0 -4
  263. package/dist/testing/conformance/workflows/access.js +0 -147
  264. package/dist/testing/conformance/workflows/actors.d.ts +0 -2317
  265. package/dist/testing/conformance/workflows/actors.js +0 -305
  266. package/dist/testing/conformance/workflows/basics.d.ts +0 -4
  267. package/dist/testing/conformance/workflows/basics.js +0 -144
  268. package/dist/testing/conformance/workflows/engine.d.ts +0 -4
  269. package/dist/testing/conformance/workflows/engine.js +0 -80
  270. package/dist/testing/conformance/workflows/guards.d.ts +0 -4
  271. package/dist/testing/conformance/workflows/guards.js +0 -172
  272. package/dist/testing/conformance/workflows/harness.d.ts +0 -14
  273. package/dist/testing/conformance/workflows/harness.js +0 -44
  274. package/dist/testing/conformance/workflows/recovery.d.ts +0 -4
  275. package/dist/testing/conformance/workflows/recovery.js +0 -181
  276. package/dist/testing/conformance/workflows/starts.d.ts +0 -4
  277. package/dist/testing/conformance/workflows/starts.js +0 -57
  278. package/dist/testing/conformance/workflows/suspension.d.ts +0 -4
  279. package/dist/testing/conformance/workflows/suspension.js +0 -106
  280. package/dist/testing/conformance/workflows/waits.d.ts +0 -4
  281. package/dist/testing/conformance/workflows/waits.js +0 -284
  282. package/dist/testing/conformance/workflows.d.ts +0 -4
  283. package/dist/testing/conformance/workflows.js +0 -19
  284. package/dist/testing/conformance.d.ts +0 -330
  285. package/dist/testing/conformance.js +0 -364
  286. package/dist/testing/foundation.d.ts +0 -41
  287. package/dist/testing/foundation.js +0 -517
  288. package/dist/testing/simulate-cluster.d.ts +0 -112
  289. package/dist/testing/simulate-cluster.js +0 -257
  290. package/dist/testing/simulate.d.ts +0 -90
  291. package/dist/testing/simulate.js +0 -127
@@ -40,6 +40,24 @@ export declare const ActorRow: Schema.Struct<{
40
40
  readonly lastEventSequence: Schema.Finite;
41
41
  }>;
42
42
  export type ActorRow = typeof ActorRow.Type;
43
+ /**
44
+ * An actor as a list shows it, with its last command: the command and commit
45
+ * time of its receipt with the newest recorded commit time among its 256
46
+ * greatest command ids, null when none of them records one.
47
+ */
48
+ export declare const ActorListRow: Schema.Struct<{
49
+ readonly actorType: Schema.String;
50
+ readonly actorId: Schema.String;
51
+ readonly placement: Schema.NullOr<Schema.String>;
52
+ readonly generation: Schema.Finite;
53
+ readonly created: Schema.Boolean;
54
+ readonly lastEventSequence: Schema.Finite;
55
+ readonly lastCommand: Schema.NullOr<Schema.Struct<{
56
+ readonly command: Schema.String;
57
+ readonly committedAtMs: Schema.Finite;
58
+ }>>;
59
+ }>;
60
+ export type ActorListRow = typeof ActorListRow.Type;
43
61
  /** A page of actors; `next` is the identity to continue from, or null at the end. */
44
62
  export declare const ActorsPage: Schema.Struct<{
45
63
  readonly actors: Schema.$Array<Schema.Struct<{
@@ -49,6 +67,10 @@ export declare const ActorsPage: Schema.Struct<{
49
67
  readonly generation: Schema.Finite;
50
68
  readonly created: Schema.Boolean;
51
69
  readonly lastEventSequence: Schema.Finite;
70
+ readonly lastCommand: Schema.NullOr<Schema.Struct<{
71
+ readonly command: Schema.String;
72
+ readonly committedAtMs: Schema.Finite;
73
+ }>>;
52
74
  }>>;
53
75
  readonly next: Schema.NullOr<Schema.Struct<{
54
76
  actorType: Schema.String;
@@ -186,7 +208,10 @@ export declare const WorkflowRow: Schema.Struct<{
186
208
  export type WorkflowRow = typeof WorkflowRow.Type;
187
209
  /**
188
210
  * A command receipt with its outcome, expiry in epoch milliseconds and the
189
- * sequences of the events it emitted.
211
+ * sequences of the events it emitted. `startedAtMs` is the database clock its
212
+ * batch's fenced read selected and `committedAtMs` the database clock when
213
+ * its commit wrote it; both are null on a receipt written before the runtime
214
+ * recorded them.
190
215
  */
191
216
  export declare const ReceiptRow: Schema.Struct<{
192
217
  readonly commandId: Schema.String;
@@ -203,6 +228,8 @@ export declare const ReceiptRow: Schema.Struct<{
203
228
  readonly undecodable: Schema.String;
204
229
  }>]>>;
205
230
  readonly expiresAtMs: Schema.Finite;
231
+ readonly startedAtMs: Schema.NullOr<Schema.Finite>;
232
+ readonly committedAtMs: Schema.NullOr<Schema.Finite>;
206
233
  readonly events: Schema.$Array<Schema.Finite>;
207
234
  }>;
208
235
  export type ReceiptRow = typeof ReceiptRow.Type;
@@ -257,6 +284,8 @@ export declare const ActorDetail: Schema.Struct<{
257
284
  readonly undecodable: Schema.String;
258
285
  }>]>>;
259
286
  readonly expiresAtMs: Schema.Finite;
287
+ readonly startedAtMs: Schema.NullOr<Schema.Finite>;
288
+ readonly committedAtMs: Schema.NullOr<Schema.Finite>;
260
289
  readonly events: Schema.$Array<Schema.Finite>;
261
290
  }>>;
262
291
  readonly events: Schema.$Array<Schema.Struct<{
@@ -532,6 +561,8 @@ export declare const OperatorActorDetail: Schema.Struct<{
532
561
  }>]>>;
533
562
  readonly outcomeTag: Schema.NullOr<Schema.String>;
534
563
  readonly expiresAtMs: Schema.Finite;
564
+ readonly startedAtMs: Schema.NullOr<Schema.Finite>;
565
+ readonly committedAtMs: Schema.NullOr<Schema.Finite>;
535
566
  readonly events: Schema.$Array<Schema.Finite>;
536
567
  readonly outcome: Schema.optionalKey<Schema.NullOr<Schema.Union<readonly [Schema.Struct<{
537
568
  readonly json: Schema.Codec<Schema.Json, Schema.Json, never, never>;
@@ -693,6 +724,8 @@ export declare const ActorReceiptRow: Schema.Struct<{
693
724
  readonly undecodable: Schema.String;
694
725
  }>]>>;
695
726
  readonly expiresAtMs: Schema.Finite;
727
+ readonly startedAtMs: Schema.NullOr<Schema.Finite>;
728
+ readonly committedAtMs: Schema.NullOr<Schema.Finite>;
696
729
  readonly events: Schema.$Array<Schema.Finite>;
697
730
  }>;
698
731
  export type ActorReceiptRow = typeof ActorReceiptRow.Type;
@@ -718,6 +751,8 @@ export declare const ReceiptsPage: Schema.Struct<{
718
751
  readonly undecodable: Schema.String;
719
752
  }>]>>;
720
753
  readonly expiresAtMs: Schema.Finite;
754
+ readonly startedAtMs: Schema.NullOr<Schema.Finite>;
755
+ readonly committedAtMs: Schema.NullOr<Schema.Finite>;
721
756
  readonly events: Schema.$Array<Schema.Finite>;
722
757
  }>>;
723
758
  readonly next: Schema.NullOr<Schema.Struct<{
@@ -805,3 +840,188 @@ export declare const JobTypesPage: Schema.Struct<{
805
840
  }>>;
806
841
  readonly next: Schema.NullOr<Schema.String>;
807
842
  }>;
843
+ /**
844
+ * Which runner answered a live read and what it covers: its name and region
845
+ * as the inspector was configured (null when not), when it began recording,
846
+ * and how many other runners the cluster lists (null when it could not tell).
847
+ * A live answer is this runner's alone; it covers the deployment only when
848
+ * `peers` is 0.
849
+ */
850
+ export declare const LiveScope: Schema.Struct<{
851
+ readonly runner: Schema.NullOr<Schema.String>;
852
+ readonly region: Schema.NullOr<Schema.String>;
853
+ readonly startedAtMs: Schema.Finite;
854
+ readonly peers: Schema.NullOr<Schema.Finite>;
855
+ }>;
856
+ export type LiveScope = typeof LiveScope.Type;
857
+ /**
858
+ * One runner's live view of a tenant: its rates, resident activations and
859
+ * deepest mailbox overall, and per actor type that has either.
860
+ */
861
+ export declare const LiveOverview: Schema.Struct<{
862
+ readonly scope: Schema.Struct<{
863
+ readonly runner: Schema.NullOr<Schema.String>;
864
+ readonly region: Schema.NullOr<Schema.String>;
865
+ readonly startedAtMs: Schema.Finite;
866
+ readonly peers: Schema.NullOr<Schema.Finite>;
867
+ }>;
868
+ readonly total: Schema.Struct<{
869
+ readonly perSecond: Schema.NullOr<Schema.Finite>;
870
+ readonly p50Ms: Schema.NullOr<Schema.Finite>;
871
+ readonly p99Ms: Schema.NullOr<Schema.Finite>;
872
+ readonly awake: Schema.Finite;
873
+ readonly maxMailbox: Schema.NullOr<Schema.Struct<{
874
+ readonly depth: Schema.Finite;
875
+ readonly actorType: Schema.String;
876
+ readonly actorId: Schema.String;
877
+ }>>;
878
+ }>;
879
+ readonly actorTypes: Schema.$Array<Schema.Struct<{
880
+ readonly perSecond: Schema.NullOr<Schema.Finite>;
881
+ readonly p50Ms: Schema.NullOr<Schema.Finite>;
882
+ readonly p99Ms: Schema.NullOr<Schema.Finite>;
883
+ readonly actorType: Schema.String;
884
+ readonly awake: Schema.Finite;
885
+ readonly maxMailbox: Schema.NullOr<Schema.Struct<{
886
+ readonly depth: Schema.Finite;
887
+ readonly actorId: Schema.String;
888
+ }>>;
889
+ }>>;
890
+ }>;
891
+ export type LiveOverview = typeof LiveOverview.Type;
892
+ /**
893
+ * One actor type's commands over a window: the rate at each slot this runner
894
+ * observed (minutes for `1h`, hours otherwise), oldest first, and each
895
+ * command's volume; `activity` is null when the runner cannot say.
896
+ */
897
+ export declare const LiveActivity: Schema.Struct<{
898
+ readonly scope: Schema.Struct<{
899
+ readonly runner: Schema.NullOr<Schema.String>;
900
+ readonly region: Schema.NullOr<Schema.String>;
901
+ readonly startedAtMs: Schema.Finite;
902
+ readonly peers: Schema.NullOr<Schema.Finite>;
903
+ }>;
904
+ readonly activity: Schema.NullOr<Schema.Struct<{
905
+ readonly sinceMs: Schema.Finite;
906
+ readonly points: Schema.$Array<Schema.Struct<{
907
+ readonly atMs: Schema.Finite;
908
+ readonly perSecond: Schema.Finite;
909
+ }>>;
910
+ readonly commands: Schema.$Array<Schema.Struct<{
911
+ readonly command: Schema.String;
912
+ readonly count: Schema.Finite;
913
+ readonly perSecond: Schema.Finite;
914
+ }>>;
915
+ }>>;
916
+ }>;
917
+ export type LiveActivity = typeof LiveActivity.Type;
918
+ /** One actor type's turn times over a window as a histogram and percentiles; null when the runner cannot say. */
919
+ export declare const LiveLatency: Schema.Struct<{
920
+ readonly scope: Schema.Struct<{
921
+ readonly runner: Schema.NullOr<Schema.String>;
922
+ readonly region: Schema.NullOr<Schema.String>;
923
+ readonly startedAtMs: Schema.Finite;
924
+ readonly peers: Schema.NullOr<Schema.Finite>;
925
+ }>;
926
+ readonly latency: Schema.NullOr<Schema.Struct<{
927
+ readonly sinceMs: Schema.Finite;
928
+ readonly count: Schema.Finite;
929
+ readonly buckets: Schema.$Array<Schema.Struct<{
930
+ readonly upToMs: Schema.NullOr<Schema.Finite>;
931
+ readonly count: Schema.Finite;
932
+ }>>;
933
+ readonly p50Ms: Schema.NullOr<Schema.Finite>;
934
+ readonly p95Ms: Schema.NullOr<Schema.Finite>;
935
+ readonly p99Ms: Schema.NullOr<Schema.Finite>;
936
+ }>>;
937
+ }>;
938
+ export type LiveLatency = typeof LiveLatency.Type;
939
+ /**
940
+ * Named actors as this runner holds them: whether each is resident, its
941
+ * mailbox depth when it is, its open sockets and its open feeds per event.
942
+ */
943
+ export declare const LiveActors: Schema.Struct<{
944
+ readonly scope: Schema.Struct<{
945
+ readonly runner: Schema.NullOr<Schema.String>;
946
+ readonly region: Schema.NullOr<Schema.String>;
947
+ readonly startedAtMs: Schema.Finite;
948
+ readonly peers: Schema.NullOr<Schema.Finite>;
949
+ }>;
950
+ readonly actors: Schema.$Array<Schema.Struct<{
951
+ readonly actorId: Schema.String;
952
+ readonly awake: Schema.Boolean;
953
+ readonly mailbox: Schema.NullOr<Schema.Finite>;
954
+ readonly sockets: Schema.Finite;
955
+ readonly feeds: Schema.$Array<Schema.Struct<{
956
+ readonly event: Schema.String;
957
+ readonly subscribers: Schema.Finite;
958
+ }>>;
959
+ }>>;
960
+ }>;
961
+ export type LiveActors = typeof LiveActors.Type;
962
+ /** The tenant's open WebSocket sessions and SSE responses on this runner, overall and per actor type. */
963
+ export declare const LiveConnections: Schema.Struct<{
964
+ readonly sockets: Schema.Finite;
965
+ readonly feeds: Schema.Finite;
966
+ readonly streams: Schema.Finite;
967
+ readonly watches: Schema.Finite;
968
+ readonly scope: Schema.Struct<{
969
+ readonly runner: Schema.NullOr<Schema.String>;
970
+ readonly region: Schema.NullOr<Schema.String>;
971
+ readonly startedAtMs: Schema.Finite;
972
+ readonly peers: Schema.NullOr<Schema.Finite>;
973
+ }>;
974
+ readonly byActorType: Schema.$Array<Schema.Struct<{
975
+ readonly sockets: Schema.Finite;
976
+ readonly feeds: Schema.Finite;
977
+ readonly streams: Schema.Finite;
978
+ readonly watches: Schema.Finite;
979
+ readonly actorType: Schema.String;
980
+ }>>;
981
+ }>;
982
+ export type LiveConnections = typeof LiveConnections.Type;
983
+ /**
984
+ * One committed command as the command stream sends it: its turn's time on
985
+ * the database clock (`atMs` read after `COMMIT`), its caller key, outcome,
986
+ * the declared failure's tag, and a bounded, redacted payload preview.
987
+ */
988
+ export declare const StreamCommand: Schema.Struct<{
989
+ readonly id: Schema.String;
990
+ readonly commandId: Schema.String;
991
+ readonly atMs: Schema.Finite;
992
+ readonly durationMs: Schema.Finite;
993
+ readonly actorType: Schema.String;
994
+ readonly actorId: Schema.String;
995
+ readonly command: Schema.String;
996
+ readonly callerKey: Schema.NullOr<Schema.Union<readonly [Schema.Struct<{
997
+ readonly json: Schema.Codec<Schema.Json, Schema.Json, never, never>;
998
+ }>, Schema.Struct<{
999
+ readonly undecodable: Schema.String;
1000
+ }>]>>;
1001
+ readonly outcomeTag: Schema.Literals<readonly ["Success", "Failure"]>;
1002
+ readonly errorTag: Schema.NullOr<Schema.String>;
1003
+ readonly payloadPreview: Schema.NullOr<Schema.String>;
1004
+ }>;
1005
+ export type StreamCommand = typeof StreamCommand.Type;
1006
+ /**
1007
+ * Each cron entry the runtime registers, with the tenant's pending ticks of
1008
+ * it, the soonest one's due time, and the newest committed tick among the
1009
+ * type's newest receipts: its command id, commit time, duration and outcome.
1010
+ */
1011
+ export declare const Schedules: Schema.Struct<{
1012
+ readonly schedules: Schema.$Array<Schema.Struct<{
1013
+ readonly actorType: Schema.String;
1014
+ readonly key: Schema.String;
1015
+ readonly expression: Schema.String;
1016
+ readonly command: Schema.String;
1017
+ readonly pending: Schema.Finite;
1018
+ readonly nextDueAtMs: Schema.NullOr<Schema.Finite>;
1019
+ readonly lastRun: Schema.NullOr<Schema.Struct<{
1020
+ readonly commandId: Schema.String;
1021
+ readonly committedAtMs: Schema.Finite;
1022
+ readonly durationMs: Schema.NullOr<Schema.Finite>;
1023
+ readonly outcomeTag: Schema.NullOr<Schema.String>;
1024
+ }>>;
1025
+ }>>;
1026
+ }>;
1027
+ export type Schedules = typeof Schedules.Type;
@@ -35,9 +35,18 @@ export const ActorRow = Schema.Struct({
35
35
  created: Schema.Boolean,
36
36
  lastEventSequence: Schema.Finite,
37
37
  });
38
+ /**
39
+ * An actor as a list shows it, with its last command: the command and commit
40
+ * time of its receipt with the newest recorded commit time among its 256
41
+ * greatest command ids, null when none of them records one.
42
+ */
43
+ export const ActorListRow = Schema.Struct({
44
+ ...ActorRow.fields,
45
+ lastCommand: Schema.NullOr(Schema.Struct({ command: Schema.String, committedAtMs: Millis })),
46
+ });
38
47
  /** A page of actors; `next` is the identity to continue from, or null at the end. */
39
48
  export const ActorsPage = Schema.Struct({
40
- actors: Schema.Array(ActorRow),
49
+ actors: Schema.Array(ActorListRow),
41
50
  next: Schema.NullOr(Schema.Struct(Identity)),
42
51
  });
43
52
  /** A staged intent with its target, attempts, last error and due time in epoch milliseconds. */
@@ -112,7 +121,10 @@ export const WorkflowRow = Schema.Struct({
112
121
  });
113
122
  /**
114
123
  * A command receipt with its outcome, expiry in epoch milliseconds and the
115
- * sequences of the events it emitted.
124
+ * sequences of the events it emitted. `startedAtMs` is the database clock its
125
+ * batch's fenced read selected and `committedAtMs` the database clock when
126
+ * its commit wrote it; both are null on a receipt written before the runtime
127
+ * recorded them.
116
128
  */
117
129
  export const ReceiptRow = Schema.Struct({
118
130
  commandId: Schema.String,
@@ -121,6 +133,8 @@ export const ReceiptRow = Schema.Struct({
121
133
  outcomeTag: Schema.NullOr(Schema.String),
122
134
  outcome: Stored,
123
135
  expiresAtMs: Millis,
136
+ startedAtMs: Schema.NullOr(Millis),
137
+ committedAtMs: Schema.NullOr(Millis),
124
138
  events: Schema.Array(Schema.Finite),
125
139
  });
126
140
  /** A stored event with its sequence, size in bytes and emission time in epoch milliseconds. */
@@ -241,3 +255,138 @@ export const JobTypesPage = Schema.Struct({
241
255
  jobTypes: Schema.Array(JobTypeRow),
242
256
  next: Schema.NullOr(Schema.String),
243
257
  });
258
+ /**
259
+ * Which runner answered a live read and what it covers: its name and region
260
+ * as the inspector was configured (null when not), when it began recording,
261
+ * and how many other runners the cluster lists (null when it could not tell).
262
+ * A live answer is this runner's alone; it covers the deployment only when
263
+ * `peers` is 0.
264
+ */
265
+ export const LiveScope = Schema.Struct({
266
+ runner: Schema.NullOr(Schema.String),
267
+ region: Schema.NullOr(Schema.String),
268
+ startedAtMs: Millis,
269
+ peers: Schema.NullOr(Schema.Finite),
270
+ });
271
+ /**
272
+ * A recent rate and turn times: commands per second over the current minute
273
+ * and the four before it, and the median and 99th percentile turn time over
274
+ * the last hour, each null when the runner cannot say (or, for a percentile,
275
+ * when no turn committed). Percentiles are histogram bucket bounds capped by
276
+ * the slowest turn seen.
277
+ */
278
+ const LiveRates = {
279
+ perSecond: Schema.NullOr(Schema.Finite),
280
+ p50Ms: Schema.NullOr(Schema.Finite),
281
+ p99Ms: Schema.NullOr(Schema.Finite),
282
+ };
283
+ /** The deepest mailbox among resident activations, null when none is resident. */
284
+ const MaxMailbox = Schema.NullOr(Schema.Struct({ depth: Schema.Finite, actorId: Schema.String }));
285
+ /**
286
+ * One runner's live view of a tenant: its rates, resident activations and
287
+ * deepest mailbox overall, and per actor type that has either.
288
+ */
289
+ export const LiveOverview = Schema.Struct({
290
+ scope: LiveScope,
291
+ total: Schema.Struct({
292
+ ...LiveRates,
293
+ awake: Schema.Finite,
294
+ maxMailbox: Schema.NullOr(Schema.Struct({ depth: Schema.Finite, actorType: Schema.String, actorId: Schema.String })),
295
+ }),
296
+ actorTypes: Schema.Array(Schema.Struct({
297
+ actorType: Schema.String,
298
+ ...LiveRates,
299
+ awake: Schema.Finite,
300
+ maxMailbox: MaxMailbox,
301
+ })),
302
+ });
303
+ /**
304
+ * One actor type's commands over a window: the rate at each slot this runner
305
+ * observed (minutes for `1h`, hours otherwise), oldest first, and each
306
+ * command's volume; `activity` is null when the runner cannot say.
307
+ */
308
+ export const LiveActivity = Schema.Struct({
309
+ scope: LiveScope,
310
+ activity: Schema.NullOr(Schema.Struct({
311
+ sinceMs: Millis,
312
+ points: Schema.Array(Schema.Struct({ atMs: Millis, perSecond: Schema.Finite })),
313
+ commands: Schema.Array(Schema.Struct({ command: Schema.String, count: Schema.Finite, perSecond: Schema.Finite })),
314
+ })),
315
+ });
316
+ /** One actor type's turn times over a window as a histogram and percentiles; null when the runner cannot say. */
317
+ export const LiveLatency = Schema.Struct({
318
+ scope: LiveScope,
319
+ latency: Schema.NullOr(Schema.Struct({
320
+ sinceMs: Millis,
321
+ count: Schema.Finite,
322
+ buckets: Schema.Array(Schema.Struct({ upToMs: Schema.NullOr(Schema.Finite), count: Schema.Finite })),
323
+ p50Ms: Schema.NullOr(Schema.Finite),
324
+ p95Ms: Schema.NullOr(Schema.Finite),
325
+ p99Ms: Schema.NullOr(Schema.Finite),
326
+ })),
327
+ });
328
+ /**
329
+ * Named actors as this runner holds them: whether each is resident, its
330
+ * mailbox depth when it is, its open sockets and its open feeds per event.
331
+ */
332
+ export const LiveActors = Schema.Struct({
333
+ scope: LiveScope,
334
+ actors: Schema.Array(Schema.Struct({
335
+ actorId: Schema.String,
336
+ awake: Schema.Boolean,
337
+ mailbox: Schema.NullOr(Schema.Finite),
338
+ sockets: Schema.Finite,
339
+ feeds: Schema.Array(Schema.Struct({ event: Schema.String, subscribers: Schema.Finite })),
340
+ })),
341
+ });
342
+ const ConnectionCounts = {
343
+ sockets: Schema.Finite,
344
+ feeds: Schema.Finite,
345
+ streams: Schema.Finite,
346
+ watches: Schema.Finite,
347
+ };
348
+ /** The tenant's open WebSocket sessions and SSE responses on this runner, overall and per actor type. */
349
+ export const LiveConnections = Schema.Struct({
350
+ scope: LiveScope,
351
+ ...ConnectionCounts,
352
+ byActorType: Schema.Array(Schema.Struct({ actorType: Schema.String, ...ConnectionCounts })),
353
+ });
354
+ /**
355
+ * One committed command as the command stream sends it: its turn's time on
356
+ * the database clock (`atMs` read after `COMMIT`), its caller key, outcome,
357
+ * the declared failure's tag, and a bounded, redacted payload preview.
358
+ */
359
+ export const StreamCommand = Schema.Struct({
360
+ id: Schema.String,
361
+ commandId: Schema.String,
362
+ atMs: Millis,
363
+ durationMs: Schema.Finite,
364
+ actorType: Schema.String,
365
+ actorId: Schema.String,
366
+ command: Schema.String,
367
+ callerKey: Stored,
368
+ outcomeTag: Schema.Literals(["Success", "Failure"]),
369
+ errorTag: Schema.NullOr(Schema.String),
370
+ payloadPreview: Schema.NullOr(Schema.String),
371
+ });
372
+ /**
373
+ * Each cron entry the runtime registers, with the tenant's pending ticks of
374
+ * it, the soonest one's due time, and the newest committed tick among the
375
+ * type's newest receipts: its command id, commit time, duration and outcome.
376
+ */
377
+ export const Schedules = Schema.Struct({
378
+ schedules: Schema.Array(Schema.Struct({
379
+ actorType: Schema.String,
380
+ key: Schema.String,
381
+ expression: Schema.String,
382
+ command: Schema.String,
383
+ pending: Schema.Finite,
384
+ nextDueAtMs: Schema.NullOr(Millis),
385
+ lastRun: Schema.NullOr(Schema.Struct({
386
+ commandId: Schema.String,
387
+ committedAtMs: Millis,
388
+ durationMs: Schema.NullOr(Schema.Finite),
389
+ outcomeTag: Schema.NullOr(Schema.String),
390
+ })),
391
+ })),
392
+ });
@@ -31,33 +31,10 @@ declare const reasonSchemas: {
31
31
  readonly _tag: Schema.tag<"QuotaExceeded">;
32
32
  readonly organizationId: Schema.String;
33
33
  readonly period: Schema.String;
34
- readonly limitUnits: Schema.Finite;
35
- readonly usedUnits: Schema.Finite;
36
- readonly requestedUnits: Schema.Finite;
37
- readonly unitsPerCommand: Schema.Int;
38
- readonly retryAfterMs: Schema.Finite;
39
- }>;
40
- readonly SpendLimitExceeded: Schema.TaggedStruct<"SpendLimitExceeded", {
41
- readonly _tag: Schema.tag<"SpendLimitExceeded">;
42
- readonly organizationId: Schema.String;
43
- readonly period: Schema.String;
44
- readonly limitCents: Schema.Finite;
45
- readonly projectedCents: Schema.Finite;
46
- }>;
47
- readonly ConnectionLimitExceeded: Schema.TaggedStruct<"ConnectionLimitExceeded", {
48
- readonly _tag: Schema.tag<"ConnectionLimitExceeded">;
49
- readonly organizationId: Schema.String;
50
- readonly kind: Schema.Literals<readonly ["socket", "sse"]>;
34
+ readonly cap: Schema.Literals<readonly ["compute", "connections", "spend"]>;
51
35
  readonly limit: Schema.Finite;
52
- readonly open: Schema.Finite;
53
- }>;
54
- readonly StorageQuotaExceeded: Schema.TaggedStruct<"StorageQuotaExceeded", {
55
- readonly _tag: Schema.tag<"StorageQuotaExceeded">;
56
- readonly organizationId: Schema.String;
57
- readonly deployment: Schema.String;
58
- readonly tenant: Schema.String;
59
- readonly limitBytes: Schema.Finite;
60
- readonly usedBytes: Schema.Finite;
36
+ readonly used: Schema.Finite;
37
+ readonly retryAfterMs: Schema.Finite;
61
38
  }>;
62
39
  readonly InvalidInput: Schema.TaggedStruct<"InvalidInput", {
63
40
  readonly _tag: Schema.tag<"InvalidInput">;
@@ -92,12 +69,6 @@ export declare const envelope: (route: {
92
69
  }> | Schema.TaggedStruct<"CommandExpired", {
93
70
  readonly _tag: Schema.tag<"CommandExpired">;
94
71
  readonly commandId: Schema.String;
95
- }> | Schema.TaggedStruct<"ConnectionLimitExceeded", {
96
- readonly _tag: Schema.tag<"ConnectionLimitExceeded">;
97
- readonly organizationId: Schema.String;
98
- readonly kind: Schema.Literals<readonly ["socket", "sse"]>;
99
- readonly limit: Schema.Finite;
100
- readonly open: Schema.Finite;
101
72
  }> | Schema.TaggedStruct<"InvalidCommandId", {
102
73
  readonly commandId: Schema.String;
103
74
  readonly code: Schema.Literals<readonly ["malformed", "future", "window", "version"]>;
@@ -112,29 +83,15 @@ export declare const envelope: (route: {
112
83
  readonly _tag: Schema.tag<"QuotaExceeded">;
113
84
  readonly organizationId: Schema.String;
114
85
  readonly period: Schema.String;
115
- readonly limitUnits: Schema.Finite;
116
- readonly usedUnits: Schema.Finite;
117
- readonly requestedUnits: Schema.Finite;
118
- readonly unitsPerCommand: Schema.Int;
86
+ readonly cap: Schema.Literals<readonly ["compute", "connections", "spend"]>;
87
+ readonly limit: Schema.Finite;
88
+ readonly used: Schema.Finite;
119
89
  readonly retryAfterMs: Schema.Finite;
120
90
  }> | Schema.TaggedStruct<"RunnerAtCapacity", {}> | Schema.TaggedStruct<"SessionEnded", {
121
91
  readonly _tag: Schema.tag<"SessionEnded">;
122
92
  readonly cause: Schema.Literals<readonly ["ClientClosed", "ServerClosed", "SlowConsumer", "HolderShutdown", "HolderLost", "OwnerLost", "ActivationEnded", "ActorUnavailable", "Defect", "Terminated"]>;
123
93
  readonly resync: Schema.Boolean;
124
94
  readonly retryAfterMs: Schema.optional<Schema.Finite>;
125
- }> | Schema.TaggedStruct<"SpendLimitExceeded", {
126
- readonly _tag: Schema.tag<"SpendLimitExceeded">;
127
- readonly organizationId: Schema.String;
128
- readonly period: Schema.String;
129
- readonly limitCents: Schema.Finite;
130
- readonly projectedCents: Schema.Finite;
131
- }> | Schema.TaggedStruct<"StorageQuotaExceeded", {
132
- readonly _tag: Schema.tag<"StorageQuotaExceeded">;
133
- readonly organizationId: Schema.String;
134
- readonly deployment: Schema.String;
135
- readonly tenant: Schema.String;
136
- readonly limitBytes: Schema.Finite;
137
- readonly usedBytes: Schema.Finite;
138
95
  }> | Schema.TaggedStruct<"Timeout", {
139
96
  readonly _tag: Schema.tag<"Timeout">;
140
97
  readonly commandId: Schema.optionalKey<Schema.String>;
@@ -1,5 +1,5 @@
1
1
  import { Effect, Match, Option, Schema } from "effect";
2
- import { ActorError, ActorUnavailable, CommandConflict, CommandExpired, ConnectionLimitExceeded, InvalidCommandId, InvalidInput, Reason, QuotaExceeded, SessionEnded, SpendLimitExceeded, StorageQuotaExceeded, Timeout, Unauthorized, withRetryAfter, } from "../errors/actor.js";
2
+ import { ActorError, ActorUnavailable, CommandConflict, CommandExpired, InvalidCommandId, InvalidInput, Reason, QuotaExceeded, SessionEnded, Timeout, Unauthorized, withRetryAfter, } from "../errors/actor.js";
3
3
  /** The served protocol's major version, sent and checked as `durable-protocol`. */
4
4
  export const PROTOCOL = 1;
5
5
  const reasonSchemas = {
@@ -16,9 +16,6 @@ const reasonSchemas = {
16
16
  MailboxFull: Schema.TaggedStruct("MailboxFull", {}),
17
17
  RunnerAtCapacity: Schema.TaggedStruct("RunnerAtCapacity", {}),
18
18
  QuotaExceeded: Schema.TaggedStruct("QuotaExceeded", QuotaExceeded.fields),
19
- SpendLimitExceeded: Schema.TaggedStruct("SpendLimitExceeded", SpendLimitExceeded.fields),
20
- ConnectionLimitExceeded: Schema.TaggedStruct("ConnectionLimitExceeded", ConnectionLimitExceeded.fields),
21
- StorageQuotaExceeded: Schema.TaggedStruct("StorageQuotaExceeded", StorageQuotaExceeded.fields),
22
19
  InvalidInput: Schema.TaggedStruct("InvalidInput", InvalidInput.fields),
23
20
  SessionEnded: Schema.TaggedStruct("SessionEnded", SessionEnded.fields),
24
21
  };
@@ -66,9 +63,6 @@ export const statusOf = (reason) => Match.value(reason).pipe(Match.tagsExhaustiv
66
63
  ActorUnavailable: () => 503,
67
64
  RunnerAtCapacity: () => 503,
68
65
  QuotaExceeded: () => 429,
69
- SpendLimitExceeded: () => 402,
70
- ConnectionLimitExceeded: () => 429,
71
- StorageQuotaExceeded: () => 429,
72
66
  Timeout: () => 504,
73
67
  NotCreated: () => 404,
74
68
  MailboxFull: () => 429,
@@ -81,9 +75,6 @@ export const closeCodeOf = (reason) => Match.value(reason).pipe(Match.tagsExhaus
81
75
  ActorUnavailable: () => 1013,
82
76
  RunnerAtCapacity: () => 1013,
83
77
  QuotaExceeded: () => 1008,
84
- SpendLimitExceeded: () => 1008,
85
- ConnectionLimitExceeded: () => 1008,
86
- StorageQuotaExceeded: () => 1008,
87
78
  NotCreated: () => 4404,
88
79
  Unauthorized: (unauthorized) => unauthorized.code === "reauthorization_unavailable" ? 1013 : 1008,
89
80
  InvalidInput: () => 4400,
@@ -1,3 +1,4 @@
1
+ import type { LiveRuntime } from "./telemetry/live.ts";
1
2
  import { Context, type Effect, type Scope, type Stream } from "effect";
2
3
  import type { Transport } from "./connections/transport.ts";
3
4
  import type { Holder } from "./connections/holder.ts";
@@ -18,6 +19,8 @@ declare const InternalActors_base: Context.ServiceClass<InternalActors, "@rikala
18
19
  readonly transport: Transport;
19
20
  /** This runner's in-process connection holder. */
20
21
  readonly holder: Holder;
22
+ /** What this runner knows only in memory, for the inspector's live reads. */
23
+ readonly live: LiveRuntime["Service"];
21
24
  /** Ends the actor's activation on this runner as idle expiry would. */
22
25
  readonly hibernate: (ref: ActorRef) => Effect.Effect<void>;
23
26
  readonly execute: (request: Request) => Effect.Effect<Executed, ActorError>;
@@ -0,0 +1,65 @@
1
+ import { type Crypto, Layer, Schema } from "effect";
2
+ import type { SqlClient } from "effect/sql";
3
+ import type { layer } from "./layer.ts";
4
+ export declare const TypeId: unique symbol;
5
+ /** What `Actors.layer` provides: the actor runtime every handler layer registers with. */
6
+ type RuntimeServices = Layer.Success<ReturnType<typeof layer>>;
7
+ /**
8
+ * Every service a hosted app's layer may require. The host builds
9
+ * `Actors.layer` over its own database and provides it with the SQL client and
10
+ * `Crypto`, so an app never constructs a runtime and a requirement outside
11
+ * this union is a compile error at `App.make`.
12
+ */
13
+ export type AppServices = RuntimeServices | SqlClient.SqlClient | Crypto.Crypto;
14
+ declare const AppLayerFailed_base: Schema.Class<AppLayerFailed, Schema.TaggedStruct<"AppLayerFailed", {
15
+ readonly cause: Schema.Defect;
16
+ }>, import("effect/Cause").YieldableError>;
17
+ /** Building the app's layer failed; `cause` is what the layer failed with. */
18
+ export declare class AppLayerFailed extends AppLayerFailed_base {
19
+ }
20
+ /**
21
+ * An actor definition as an app declares it: its name, which `Actors.serve`
22
+ * routes by, and its declared members, which `checkWorkflows` compares with
23
+ * stored executions before a rollout.
24
+ */
25
+ export interface AppActor {
26
+ readonly name: string;
27
+ readonly api: object;
28
+ }
29
+ /**
30
+ * A hosted app: the actor definitions to serve and one layer that registers
31
+ * their handlers and builds any services they need from `AppServices` alone.
32
+ */
33
+ export interface App {
34
+ readonly [TypeId]: typeof TypeId;
35
+ readonly actors: ReadonlyArray<AppActor>;
36
+ readonly layer: Layer.Layer<never, AppLayerFailed, AppServices>;
37
+ }
38
+ /**
39
+ * Declares a hosted app, the default export of `src/app.ts`. Any handler
40
+ * requirement the layer leaves unprovided fails to compile here, which is why
41
+ * the host accepts only values this constructor branded: a layer's
42
+ * requirements cannot be checked at run time. A failure building the layer
43
+ * becomes `AppLayerFailed`, so a host that loads the app knows its error type.
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * export default App.make({ actors: [Counter], layer: CounterLive })
48
+ * ```
49
+ */
50
+ declare const make: <E = never>(app: {
51
+ readonly actors: ReadonlyArray<AppActor>;
52
+ readonly layer: Layer.Layer<never, E, AppServices>;
53
+ }) => App;
54
+ /**
55
+ * Whether `value` is an app `App.make` built: branded, with actors that each
56
+ * have a name and an `api` object, and a layer. A loader uses it on a module's default export before providing the
57
+ * layer.
58
+ */
59
+ declare const is: (value: unknown) => value is App;
60
+ /** Hosted app declaration and the loader's check of a module's default export. */
61
+ export declare const App: {
62
+ make: typeof make;
63
+ is: typeof is;
64
+ };
65
+ export {};