@akterjs/effect 0.0.0-stage → 0.1.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 (798) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +43 -2
  3. package/dist/contract/actor/actor-already-exists.errors.d.mts +8 -0
  4. package/dist/contract/actor/actor-already-exists.errors.mjs +4 -0
  5. package/dist/contract/actor/actor-definition.pure.d.mts +21 -0
  6. package/dist/contract/actor/actor-definition.pure.mjs +106 -0
  7. package/dist/contract/actor/actor-erased.errors.d.mts +8 -0
  8. package/dist/contract/actor/actor-erased.errors.mjs +4 -0
  9. package/dist/contract/actor/actor-names.pure.d.mts +11 -0
  10. package/dist/contract/actor/actor-names.pure.mjs +51 -0
  11. package/dist/contract/actor/actor-not-created.errors.d.mts +8 -0
  12. package/dist/contract/actor/actor-not-created.errors.mjs +4 -0
  13. package/dist/contract/actor/actor-not-registered.errors.d.mts +8 -0
  14. package/dist/contract/actor/actor-not-registered.errors.mjs +4 -0
  15. package/dist/contract/actor/actor-registry.service.d.mts +16 -0
  16. package/dist/contract/actor/actor-registry.service.mjs +21 -0
  17. package/dist/contract/actor/actor.contract.d.mts +238 -0
  18. package/dist/contract/actor/actor.contract.mjs +1 -0
  19. package/dist/contract/actor/host-interface.pure.d.mts +23 -0
  20. package/dist/contract/actor/host-interface.pure.mjs +39 -0
  21. package/dist/contract/actor/reserved-member.errors.d.mts +9 -0
  22. package/dist/contract/actor/reserved-member.errors.mjs +7 -0
  23. package/dist/contract/akter.service.d.mts +75 -0
  24. package/dist/contract/akter.service.mjs +134 -0
  25. package/dist/contract/caller/authentication.api.d.mts +6 -0
  26. package/dist/contract/caller/authentication.api.mjs +5 -0
  27. package/dist/contract/caller/caller-admission.pure.d.mts +27 -0
  28. package/dist/contract/caller/caller-admission.pure.mjs +59 -0
  29. package/dist/contract/caller/caller-not-allowed.errors.d.mts +16 -0
  30. package/dist/contract/caller/caller-not-allowed.errors.mjs +18 -0
  31. package/dist/contract/caller/caller.schema.d.mts +7 -0
  32. package/dist/contract/caller/caller.schema.mjs +8 -0
  33. package/dist/contract/caller/current-caller.service.d.mts +7 -0
  34. package/dist/contract/caller/current-caller.service.mjs +4 -0
  35. package/dist/contract/caller/principal.schema.d.mts +13 -0
  36. package/dist/contract/caller/principal.schema.mjs +10 -0
  37. package/dist/contract/caller/unauthenticated.errors.d.mts +8 -0
  38. package/dist/contract/caller/unauthenticated.errors.mjs +4 -0
  39. package/dist/contract/client/actor-client.adapter.d.mts +42 -0
  40. package/dist/contract/client/actor-client.adapter.mjs +90 -0
  41. package/dist/contract/client/actor-client.contract.d.mts +30 -0
  42. package/dist/contract/client/actor-client.contract.mjs +1 -0
  43. package/dist/contract/client/actor-rpc.contract.d.mts +33 -0
  44. package/dist/contract/client/actor-rpc.contract.mjs +16 -0
  45. package/dist/contract/client/actor-unavailable.errors.d.mts +9 -0
  46. package/dist/contract/client/actor-unavailable.errors.mjs +7 -0
  47. package/dist/contract/client/client-failure.contract.d.mts +28 -0
  48. package/dist/contract/client/client-failure.contract.mjs +28 -0
  49. package/dist/contract/client/invalid-request.errors.d.mts +9 -0
  50. package/dist/contract/client/invalid-request.errors.mjs +7 -0
  51. package/dist/contract/client/storage-limit.errors.d.mts +16 -0
  52. package/dist/contract/client/storage-limit.errors.mjs +14 -0
  53. package/dist/contract/command/command-id-expired.errors.d.mts +11 -0
  54. package/dist/contract/command/command-id-expired.errors.mjs +9 -0
  55. package/dist/contract/command/command-id.schema.d.mts +3 -0
  56. package/dist/contract/command/command-id.schema.mjs +4 -0
  57. package/dist/contract/command/command.contract.d.mts +117 -0
  58. package/dist/contract/command/command.contract.mjs +111 -0
  59. package/dist/contract/command/outbox-id.pure.d.mts +9 -0
  60. package/dist/contract/command/outbox-id.pure.mjs +14 -0
  61. package/dist/contract/command/outbox.schema.d.mts +9 -0
  62. package/dist/contract/command/outbox.schema.mjs +10 -0
  63. package/dist/contract/command/timer.schema.d.mts +20 -0
  64. package/dist/contract/command/timer.schema.mjs +14 -0
  65. package/dist/contract/computer/checkpoint-expired.errors.d.mts +12 -0
  66. package/dist/contract/computer/checkpoint-expired.errors.mjs +8 -0
  67. package/dist/contract/computer/computer-client-failure.contract.d.mts +16 -0
  68. package/dist/contract/computer/computer-client-failure.contract.mjs +1 -0
  69. package/dist/contract/computer/computer-client.adapter.d.mts +21 -0
  70. package/dist/contract/computer/computer-client.adapter.mjs +70 -0
  71. package/dist/contract/computer/computer-client.contract.d.mts +56 -0
  72. package/dist/contract/computer/computer-client.contract.mjs +1 -0
  73. package/dist/contract/computer/computer-held.errors.d.mts +13 -0
  74. package/dist/contract/computer/computer-held.errors.mjs +11 -0
  75. package/dist/contract/computer/computer-limit.errors.d.mts +15 -0
  76. package/dist/contract/computer/computer-limit.errors.mjs +13 -0
  77. package/dist/contract/computer/computer-lost.errors.d.mts +12 -0
  78. package/dist/contract/computer/computer-lost.errors.mjs +8 -0
  79. package/dist/contract/computer/computer-not-found.errors.d.mts +9 -0
  80. package/dist/contract/computer/computer-not-found.errors.mjs +5 -0
  81. package/dist/contract/computer/computer.schema.d.mts +122 -0
  82. package/dist/contract/computer/computer.schema.mjs +117 -0
  83. package/dist/contract/computer/computers-unavailable.errors.d.mts +9 -0
  84. package/dist/contract/computer/computers-unavailable.errors.mjs +5 -0
  85. package/dist/contract/computer/files/computer-files.schema.d.mts +28 -0
  86. package/dist/contract/computer/files/computer-files.schema.mjs +24 -0
  87. package/dist/contract/computer/rpc/computer-rpc.contract.d.mts +108 -0
  88. package/dist/contract/computer/rpc/computer-rpc.contract.mjs +117 -0
  89. package/dist/contract/computer/step/computer-step.contract.d.mts +21 -0
  90. package/dist/contract/computer/step/computer-step.contract.mjs +89 -0
  91. package/dist/contract/computer/step/computer-step.schema.d.mts +69 -0
  92. package/dist/contract/computer/step/computer-step.schema.mjs +71 -0
  93. package/dist/contract/computer/step/step-failure.schema.d.mts +13 -0
  94. package/dist/contract/computer/step/step-failure.schema.mjs +24 -0
  95. package/dist/contract/computer/step/step-not-found.errors.d.mts +9 -0
  96. package/dist/contract/computer/step/step-not-found.errors.mjs +5 -0
  97. package/dist/contract/description/published-contract.pure.d.mts +51 -0
  98. package/dist/contract/description/published-contract.pure.mjs +75 -0
  99. package/dist/contract/file/access/file-access-denied.errors.d.mts +11 -0
  100. package/dist/contract/file/access/file-access-denied.errors.mjs +9 -0
  101. package/dist/contract/file/access/file-access.contract.d.mts +35 -0
  102. package/dist/contract/file/access/file-access.contract.mjs +32 -0
  103. package/dist/contract/file/actor-files.contract.d.mts +50 -0
  104. package/dist/contract/file/actor-files.contract.mjs +1 -0
  105. package/dist/contract/file/blob-transfer.errors.d.mts +9 -0
  106. package/dist/contract/file/blob-transfer.errors.mjs +7 -0
  107. package/dist/contract/file/file-client-failure.contract.d.mts +24 -0
  108. package/dist/contract/file/file-client-failure.contract.mjs +1 -0
  109. package/dist/contract/file/file-client.adapter.d.mts +17 -0
  110. package/dist/contract/file/file-client.adapter.mjs +21 -0
  111. package/dist/contract/file/file-client.contract.d.mts +14 -0
  112. package/dist/contract/file/file-client.contract.mjs +1 -0
  113. package/dist/contract/file/file-listing.pure.d.mts +6 -0
  114. package/dist/contract/file/file-listing.pure.mjs +18 -0
  115. package/dist/contract/file/file-not-found.errors.d.mts +8 -0
  116. package/dist/contract/file/file-not-found.errors.mjs +4 -0
  117. package/dist/contract/file/file-path.pure.d.mts +4 -0
  118. package/dist/contract/file/file-path.pure.mjs +38 -0
  119. package/dist/contract/file/files-unavailable.errors.d.mts +8 -0
  120. package/dist/contract/file/files-unavailable.errors.mjs +4 -0
  121. package/dist/contract/file/invalid-file-request.errors.d.mts +9 -0
  122. package/dist/contract/file/invalid-file-request.errors.mjs +7 -0
  123. package/dist/contract/file/rpc/file-rpc.contract.d.mts +88 -0
  124. package/dist/contract/file/rpc/file-rpc.contract.mjs +117 -0
  125. package/dist/contract/file/rpc/file-too-large.errors.d.mts +13 -0
  126. package/dist/contract/file/rpc/file-too-large.errors.mjs +11 -0
  127. package/dist/contract/file/rpc/rpc-file-clients.layer.d.mts +10 -0
  128. package/dist/contract/file/rpc/rpc-file-clients.layer.mjs +95 -0
  129. package/dist/contract/fork/fork-rpc.contract.d.mts +40 -0
  130. package/dist/contract/fork/fork-rpc.contract.mjs +26 -0
  131. package/dist/contract/history/actor-journal.service.d.mts +58 -0
  132. package/dist/contract/history/actor-journal.service.mjs +67 -0
  133. package/dist/contract/history/history-entry.pure.d.mts +79 -0
  134. package/dist/contract/history/history-entry.pure.mjs +95 -0
  135. package/dist/contract/hosted/handler-failed.errors.d.mts +16 -0
  136. package/dist/contract/hosted/handler-failed.errors.mjs +14 -0
  137. package/dist/contract/hosted/handler-failure.pure.d.mts +21 -0
  138. package/dist/contract/hosted/handler-failure.pure.mjs +86 -0
  139. package/dist/contract/hosted/hosted-actor.service.d.mts +23 -0
  140. package/dist/contract/hosted/hosted-actor.service.mjs +64 -0
  141. package/dist/contract/hosted/hosted-command.service.d.mts +20 -0
  142. package/dist/contract/hosted/hosted-command.service.mjs +88 -0
  143. package/dist/contract/hosted/hosted-create.service.d.mts +17 -0
  144. package/dist/contract/hosted/hosted-create.service.mjs +67 -0
  145. package/dist/contract/hosted/hosted-error.contract.d.mts +11 -0
  146. package/dist/contract/hosted/hosted-error.contract.mjs +1 -0
  147. package/dist/contract/hosted/hosted-failure.schema.d.mts +18 -0
  148. package/dist/contract/hosted/hosted-failure.schema.mjs +31 -0
  149. package/dist/contract/hosted/hosted-outcome.contract.d.mts +18 -0
  150. package/dist/contract/hosted/hosted-outcome.contract.mjs +1 -0
  151. package/dist/contract/hosted/hosted-query.service.d.mts +16 -0
  152. package/dist/contract/hosted/hosted-query.service.mjs +42 -0
  153. package/dist/contract/hosted/hosted-request.pure.d.mts +61 -0
  154. package/dist/contract/hosted/hosted-request.pure.mjs +91 -0
  155. package/dist/contract/job/job-id.pure.d.mts +11 -0
  156. package/dist/contract/job/job-id.pure.mjs +20 -0
  157. package/dist/contract/job/job-patches.contract.d.mts +32 -0
  158. package/dist/contract/job/job-patches.contract.mjs +45 -0
  159. package/dist/contract/job/job-signal.schema.d.mts +13 -0
  160. package/dist/contract/job/job-signal.schema.mjs +16 -0
  161. package/dist/contract/job/reserved-payload-field.errors.d.mts +10 -0
  162. package/dist/contract/job/reserved-payload-field.errors.mjs +8 -0
  163. package/dist/contract/job/started-job.schema.d.mts +7 -0
  164. package/dist/contract/job/started-job.schema.mjs +8 -0
  165. package/dist/contract/json-codec.pure.d.mts +7 -0
  166. package/dist/contract/json-codec.pure.mjs +14 -0
  167. package/dist/contract/room.contract.d.mts +75 -0
  168. package/dist/contract/room.contract.mjs +36 -0
  169. package/dist/contract/secret/actor-secrets.adapter.d.mts +33 -0
  170. package/dist/contract/secret/actor-secrets.adapter.mjs +38 -0
  171. package/dist/contract/secret/invalid-secret-name.errors.d.mts +10 -0
  172. package/dist/contract/secret/invalid-secret-name.errors.mjs +8 -0
  173. package/dist/contract/secret/secret-unavailable.errors.d.mts +11 -0
  174. package/dist/contract/secret/secret-unavailable.errors.mjs +10 -0
  175. package/dist/contract/secret/secret.schema.d.mts +25 -0
  176. package/dist/contract/secret/secret.schema.mjs +34 -0
  177. package/dist/contract/spend/billing-unavailable.errors.d.mts +12 -0
  178. package/dist/contract/spend/billing-unavailable.errors.mjs +8 -0
  179. package/dist/contract/spend/spend-cap-reached.errors.d.mts +17 -0
  180. package/dist/contract/spend/spend-cap-reached.errors.mjs +15 -0
  181. package/dist/contract/state/actor-state.pure.d.mts +38 -0
  182. package/dist/contract/state/actor-state.pure.mjs +153 -0
  183. package/dist/contract/state/actor-state.service.d.mts +45 -0
  184. package/dist/contract/state/actor-state.service.mjs +18 -0
  185. package/dist/contract/state/state-migration.pure.d.mts +11 -0
  186. package/dist/contract/state/state-migration.pure.mjs +23 -0
  187. package/dist/contract/state/state-read.pure.d.mts +12 -0
  188. package/dist/contract/state/state-read.pure.mjs +22 -0
  189. package/dist/contract/state/state-unreadable.errors.d.mts +9 -0
  190. package/dist/contract/state/state-unreadable.errors.mjs +7 -0
  191. package/dist/host/actor/actor-database.service.d.mts +46 -0
  192. package/dist/host/actor/actor-database.service.mjs +112 -0
  193. package/dist/host/actor/actor-exclusive.pure.d.mts +7 -0
  194. package/dist/host/actor/actor-exclusive.pure.mjs +16 -0
  195. package/dist/host/actor/actor-records.sql.d.mts +29 -0
  196. package/dist/host/actor/actor-records.sql.mjs +26 -0
  197. package/dist/host/actor/reserved-name.errors.d.mts +10 -0
  198. package/dist/host/actor/reserved-name.errors.mjs +8 -0
  199. package/dist/host/actor/reserved-names.pure.d.mts +15 -0
  200. package/dist/host/actor/reserved-names.pure.mjs +20 -0
  201. package/dist/host/actor/room.actor.d.mts +4 -0
  202. package/dist/host/actor/room.actor.mjs +36 -0
  203. package/dist/host/blob/blob-frames.pure.d.mts +7 -0
  204. package/dist/host/blob/blob-frames.pure.mjs +28 -0
  205. package/dist/host/blob/blob-grant.schema.d.mts +14 -0
  206. package/dist/host/blob/blob-grant.schema.mjs +15 -0
  207. package/dist/host/blob/blob-grants.service.d.mts +28 -0
  208. package/dist/host/blob/blob-grants.service.mjs +129 -0
  209. package/dist/host/blob/blob-keyring.service.d.mts +18 -0
  210. package/dist/host/blob/blob-keyring.service.mjs +4 -0
  211. package/dist/host/blob/blob-range.pure.d.mts +13 -0
  212. package/dist/host/blob/blob-range.pure.mjs +23 -0
  213. package/dist/host/blob/blob-sealing.contract.d.mts +37 -0
  214. package/dist/host/blob/blob-sealing.contract.mjs +1 -0
  215. package/dist/host/blob/blob-sealing.service.d.mts +11 -0
  216. package/dist/host/blob/blob-sealing.service.mjs +16 -0
  217. package/dist/host/blob/export/blob-archive.sql.d.mts +21 -0
  218. package/dist/host/blob/export/blob-archive.sql.mjs +75 -0
  219. package/dist/host/blob/export/blob-export-holds.sql.d.mts +49 -0
  220. package/dist/host/blob/export/blob-export-holds.sql.mjs +25 -0
  221. package/dist/host/blob/plain-blob-sealing.pure.d.mts +5 -0
  222. package/dist/host/blob/plain-blob-sealing.pure.mjs +55 -0
  223. package/dist/host/blob/reference/blob-catalog.sql.d.mts +40 -0
  224. package/dist/host/blob/reference/blob-catalog.sql.mjs +145 -0
  225. package/dist/host/blob/reference/blob-coordinator.pure.d.mts +10 -0
  226. package/dist/host/blob/reference/blob-coordinator.pure.mjs +153 -0
  227. package/dist/host/blob/reference/blob-file-page.sql.d.mts +13 -0
  228. package/dist/host/blob/reference/blob-file-page.sql.mjs +21 -0
  229. package/dist/host/blob/reference/blob-forks.sql.d.mts +21 -0
  230. package/dist/host/blob/reference/blob-forks.sql.mjs +40 -0
  231. package/dist/host/blob/reference/blob-lineage.sql.d.mts +14 -0
  232. package/dist/host/blob/reference/blob-lineage.sql.mjs +24 -0
  233. package/dist/host/blob/reference/blob-reads.pure.d.mts +15 -0
  234. package/dist/host/blob/reference/blob-reads.pure.mjs +97 -0
  235. package/dist/host/blob/reference/blob-receipts.sql.d.mts +71 -0
  236. package/dist/host/blob/reference/blob-receipts.sql.mjs +176 -0
  237. package/dist/host/blob/reference/blob-transfer-adopt.pure.d.mts +21 -0
  238. package/dist/host/blob/reference/blob-transfer-adopt.pure.mjs +68 -0
  239. package/dist/host/blob/reference/blob-transfer-fork.pure.d.mts +15 -0
  240. package/dist/host/blob/reference/blob-transfer-fork.pure.mjs +125 -0
  241. package/dist/host/blob/reference/blob-transfer-upkeep.pure.d.mts +18 -0
  242. package/dist/host/blob/reference/blob-transfer-upkeep.pure.mjs +54 -0
  243. package/dist/host/blob/reference/blob-transfer.pure.d.mts +85 -0
  244. package/dist/host/blob/reference/blob-transfer.pure.mjs +1 -0
  245. package/dist/host/blob/sealed-blob-sealing.pure.d.mts +10 -0
  246. package/dist/host/blob/sealed-blob-sealing.pure.mjs +130 -0
  247. package/dist/host/blob/stream/blob-directory.pure.d.mts +18 -0
  248. package/dist/host/blob/stream/blob-directory.pure.mjs +84 -0
  249. package/dist/host/blob/stream/blob-length.pure.d.mts +9 -0
  250. package/dist/host/blob/stream/blob-length.pure.mjs +19 -0
  251. package/dist/host/blob/stream/blob-writing.pure.d.mts +8 -0
  252. package/dist/host/blob/stream/blob-writing.pure.mjs +15 -0
  253. package/dist/host/command/batch/command-batch.sql.d.mts +61 -0
  254. package/dist/host/command/batch/command-batch.sql.mjs +100 -0
  255. package/dist/host/command/command-context.adapter.d.mts +47 -0
  256. package/dist/host/command/command-context.adapter.mjs +90 -0
  257. package/dist/host/command/command-id-age.pure.d.mts +13 -0
  258. package/dist/host/command/command-id-age.pure.mjs +31 -0
  259. package/dist/host/command/command-id-reuse.pure.d.mts +28 -0
  260. package/dist/host/command/command-id-reuse.pure.mjs +38 -0
  261. package/dist/host/command/command-id-reused.errors.d.mts +13 -0
  262. package/dist/host/command/command-id-reused.errors.mjs +11 -0
  263. package/dist/host/command/command-journal.sql.d.mts +84 -0
  264. package/dist/host/command/command-journal.sql.mjs +74 -0
  265. package/dist/host/command/command-rejected.errors.d.mts +8 -0
  266. package/dist/host/command/command-rejected.errors.mjs +4 -0
  267. package/dist/host/command/command-replay.service.d.mts +62 -0
  268. package/dist/host/command/command-replay.service.mjs +140 -0
  269. package/dist/host/command/command-reply.pure.d.mts +8 -0
  270. package/dist/host/command/command-reply.pure.mjs +12 -0
  271. package/dist/host/command/command-runner.service.d.mts +68 -0
  272. package/dist/host/command/command-runner.service.mjs +215 -0
  273. package/dist/host/command/files/command-file-inputs.sql.d.mts +51 -0
  274. package/dist/host/command/files/command-file-inputs.sql.mjs +59 -0
  275. package/dist/host/command/history-pruned.errors.d.mts +10 -0
  276. package/dist/host/command/history-pruned.errors.mjs +8 -0
  277. package/dist/host/command/replay/replay-cursor-stalled.errors.d.mts +9 -0
  278. package/dist/host/command/replay/replay-cursor-stalled.errors.mjs +7 -0
  279. package/dist/host/command/replay/replay-cursor.pure.d.mts +7 -0
  280. package/dist/host/command/replay/replay-cursor.pure.mjs +12 -0
  281. package/dist/host/computer/computer-steps.sql.d.mts +14 -0
  282. package/dist/host/computer/computer-steps.sql.mjs +76 -0
  283. package/dist/host/computer/job-computers.service.d.mts +20 -0
  284. package/dist/host/computer/job-computers.service.mjs +59 -0
  285. package/dist/host/computer/local-computer-files.layer.d.mts +11 -0
  286. package/dist/host/computer/local-computer-files.layer.mjs +69 -0
  287. package/dist/host/computer/local-computer-log.layer.d.mts +23 -0
  288. package/dist/host/computer/local-computer-log.layer.mjs +64 -0
  289. package/dist/host/computer/local-computer-records.layer.d.mts +190 -0
  290. package/dist/host/computer/local-computer-records.layer.mjs +99 -0
  291. package/dist/host/computer/local-computer.schema.d.mts +69 -0
  292. package/dist/host/computer/local-computer.schema.mjs +29 -0
  293. package/dist/host/computer/local-computers.adapter.d.mts +18 -0
  294. package/dist/host/computer/local-computers.adapter.mjs +248 -0
  295. package/dist/host/computer/local-step.layer.d.mts +30 -0
  296. package/dist/host/computer/local-step.layer.mjs +119 -0
  297. package/dist/host/file/actor-file-storage.sql.d.mts +15 -0
  298. package/dist/host/file/actor-file-storage.sql.mjs +82 -0
  299. package/dist/host/file/actor-files.sql.d.mts +9 -0
  300. package/dist/host/file/actor-files.sql.mjs +3 -0
  301. package/dist/host/file/blob-home-lock.pure.d.mts +8 -0
  302. package/dist/host/file/blob-home-lock.pure.mjs +10 -0
  303. package/dist/host/file/blob-home.sql.d.mts +19 -0
  304. package/dist/host/file/blob-home.sql.mjs +30 -0
  305. package/dist/host/file/local-blob-home.service.d.mts +16 -0
  306. package/dist/host/file/local-blob-home.service.mjs +43 -0
  307. package/dist/host/file/local-blob-owner.sql.d.mts +30 -0
  308. package/dist/host/file/local-blob-owner.sql.mjs +68 -0
  309. package/dist/host/file/local-file-upkeep.pure.d.mts +12 -0
  310. package/dist/host/file/local-file-upkeep.pure.mjs +41 -0
  311. package/dist/host/file/replay-file-storage.sql.d.mts +7 -0
  312. package/dist/host/file/replay-file-storage.sql.mjs +26 -0
  313. package/dist/host/fork/actor-fork.sql.d.mts +52 -0
  314. package/dist/host/fork/actor-fork.sql.mjs +42 -0
  315. package/dist/host/fork/fork-computers.adapter.d.mts +43 -0
  316. package/dist/host/fork/fork-computers.adapter.mjs +193 -0
  317. package/dist/host/hash/blob-hashing.service.d.mts +10 -0
  318. package/dist/host/hash/blob-hashing.service.mjs +4 -0
  319. package/dist/host/job/job-durables.sql.d.mts +44 -0
  320. package/dist/host/job/job-durables.sql.mjs +136 -0
  321. package/dist/host/job/job-engine.adapter.d.mts +33 -0
  322. package/dist/host/job/job-engine.adapter.mjs +258 -0
  323. package/dist/host/job/job-journal.sql.d.mts +85 -0
  324. package/dist/host/job/job-journal.sql.mjs +109 -0
  325. package/dist/host/job/job-results.service.d.mts +37 -0
  326. package/dist/host/job/job-results.service.mjs +63 -0
  327. package/dist/host/job/job-runs.pure.d.mts +103 -0
  328. package/dist/host/job/job-runs.pure.mjs +193 -0
  329. package/dist/host/job/undelivered-result.pure.d.mts +49 -0
  330. package/dist/host/job/undelivered-result.pure.mjs +147 -0
  331. package/dist/host/layout/actor-layout.sql.d.mts +8 -0
  332. package/dist/host/layout/actor-layout.sql.mjs +33 -0
  333. package/dist/host/layout/layout-version.errors.d.mts +10 -0
  334. package/dist/host/layout/layout-version.errors.mjs +8 -0
  335. package/dist/host/layout/layout-version.pure.d.mts +10 -0
  336. package/dist/host/layout/layout-version.pure.mjs +14 -0
  337. package/dist/host/migration/actor-migrations.service.d.mts +46 -0
  338. package/dist/host/migration/actor-migrations.service.mjs +143 -0
  339. package/dist/host/migration/migration-edited.errors.d.mts +9 -0
  340. package/dist/host/migration/migration-edited.errors.mjs +7 -0
  341. package/dist/host/migration/migration-failed.errors.d.mts +12 -0
  342. package/dist/host/migration/migration-failed.errors.mjs +10 -0
  343. package/dist/host/migration/migration-failure.pure.d.mts +9 -0
  344. package/dist/host/migration/migration-failure.pure.mjs +19 -0
  345. package/dist/host/migration/migration-hasher.adapter.d.mts +15 -0
  346. package/dist/host/migration/migration-hasher.adapter.mjs +40 -0
  347. package/dist/host/migration/migration-missing.errors.d.mts +9 -0
  348. package/dist/host/migration/migration-missing.errors.mjs +7 -0
  349. package/dist/host/migration/migration-plan.pure.d.mts +20 -0
  350. package/dist/host/migration/migration-plan.pure.mjs +32 -0
  351. package/dist/host/outbox/actor-outbox.sql.d.mts +33 -0
  352. package/dist/host/outbox/actor-outbox.sql.mjs +28 -0
  353. package/dist/host/outbox/outbox-acknowledgements.sql.d.mts +12 -0
  354. package/dist/host/outbox/outbox-acknowledgements.sql.mjs +47 -0
  355. package/dist/host/outbox/outbox-runner.service.d.mts +37 -0
  356. package/dist/host/outbox/outbox-runner.service.mjs +155 -0
  357. package/dist/host/query/query-policy.pure.d.mts +15 -0
  358. package/dist/host/query/query-policy.pure.mjs +12 -0
  359. package/dist/host/query/query-runner.service.d.mts +42 -0
  360. package/dist/host/query/query-runner.service.mjs +72 -0
  361. package/dist/host/sqlite/actor-connections.pure.d.mts +26 -0
  362. package/dist/host/sqlite/actor-connections.pure.mjs +4 -0
  363. package/dist/host/sqlite/sqlite-connection.adapter.d.mts +22 -0
  364. package/dist/host/sqlite/sqlite-connection.adapter.mjs +151 -0
  365. package/dist/host/sqlite/sqlite-driver.service.d.mts +33 -0
  366. package/dist/host/sqlite/sqlite-driver.service.mjs +88 -0
  367. package/dist/host/sqlite/sqlite-parameters.pure.d.mts +5 -0
  368. package/dist/host/sqlite/sqlite-parameters.pure.mjs +21 -0
  369. package/dist/host/sqlite/sqlite-reason.pure.d.mts +8 -0
  370. package/dist/host/sqlite/sqlite-reason.pure.mjs +13 -0
  371. package/dist/host/timer/actor-timers.sql.d.mts +32 -0
  372. package/dist/host/timer/actor-timers.sql.mjs +8 -0
  373. package/dist/host/timer/timer-runner.service.d.mts +26 -0
  374. package/dist/host/timer/timer-runner.service.mjs +68 -0
  375. package/dist/host/upkeep/actor-due.sql.d.mts +26 -0
  376. package/dist/host/upkeep/actor-due.sql.mjs +43 -0
  377. package/dist/host/upkeep/actor-upkeep.service.d.mts +55 -0
  378. package/dist/host/upkeep/actor-upkeep.service.mjs +218 -0
  379. package/dist/host/upkeep/execution-authority.pure.d.mts +19 -0
  380. package/dist/host/upkeep/execution-authority.pure.mjs +10 -0
  381. package/dist/runtime/akter-local.layer.d.mts +28 -0
  382. package/dist/runtime/akter-local.layer.mjs +24 -0
  383. package/dist/runtime/akter.layer.d.mts +91 -0
  384. package/dist/runtime/akter.layer.mjs +99 -0
  385. package/dist/runtime/blob-hashing.layer.d.mts +4 -0
  386. package/dist/runtime/blob-hashing.layer.mjs +15 -0
  387. package/dist/runtime/hosted-environment.layer.d.mts +34 -0
  388. package/dist/runtime/hosted-environment.layer.mjs +40 -0
  389. package/dist/runtime/http-server.layer.d.mts +9 -0
  390. package/dist/runtime/http-server.layer.mjs +15 -0
  391. package/dist/runtime/local-actor-engine.layer.d.mts +10 -0
  392. package/dist/runtime/local-actor-engine.layer.mjs +14 -0
  393. package/dist/runtime/local-engine.layer.d.mts +15 -0
  394. package/dist/runtime/local-engine.layer.mjs +14 -0
  395. package/dist/runtime/local-environments.layer.d.mts +24 -0
  396. package/dist/runtime/local-environments.layer.mjs +159 -0
  397. package/dist/runtime/local-file-clients.layer.d.mts +13 -0
  398. package/dist/runtime/local-file-clients.layer.mjs +78 -0
  399. package/dist/runtime/local-job-runtime.layer.d.mts +19 -0
  400. package/dist/runtime/local-job-runtime.layer.mjs +21 -0
  401. package/dist/serve/archive/archived-actors.layer.d.mts +17 -0
  402. package/dist/serve/archive/archived-actors.layer.mjs +84 -0
  403. package/dist/serve/archive/archived-store.layer.d.mts +12 -0
  404. package/dist/serve/archive/archived-store.layer.mjs +40 -0
  405. package/dist/serve/engine/actor-engine.layer.d.mts +8 -0
  406. package/dist/serve/engine/actor-engine.layer.mjs +30 -0
  407. package/dist/serve/engine/actor-fork.service.d.mts +63 -0
  408. package/dist/serve/engine/actor-fork.service.mjs +277 -0
  409. package/dist/serve/engine/actor-holding.pure.d.mts +7 -0
  410. package/dist/serve/engine/actor-holding.pure.mjs +9 -0
  411. package/dist/serve/engine/actor-host.service.d.mts +66 -0
  412. package/dist/serve/engine/actor-host.service.mjs +209 -0
  413. package/dist/serve/engine/actor-location.service.d.mts +38 -0
  414. package/dist/serve/engine/actor-location.service.mjs +109 -0
  415. package/dist/serve/engine/actor-residents.pure.d.mts +92 -0
  416. package/dist/serve/engine/actor-residents.pure.mjs +201 -0
  417. package/dist/serve/engine/actor-shard.pure.d.mts +4 -0
  418. package/dist/serve/engine/actor-shard.pure.mjs +8 -0
  419. package/dist/serve/engine/actor-state.pure.d.mts +17 -0
  420. package/dist/serve/engine/actor-state.pure.mjs +20 -0
  421. package/dist/serve/engine/actors-not-hosted.errors.d.mts +9 -0
  422. package/dist/serve/engine/actors-not-hosted.errors.mjs +7 -0
  423. package/dist/serve/engine/job-runtime.layer.d.mts +6 -0
  424. package/dist/serve/engine/job-runtime.layer.mjs +5 -0
  425. package/dist/serve/environment/environment-already-exists.errors.d.mts +10 -0
  426. package/dist/serve/environment/environment-already-exists.errors.mjs +9 -0
  427. package/dist/serve/environment/environment-in-use.errors.d.mts +10 -0
  428. package/dist/serve/environment/environment-in-use.errors.mjs +14 -0
  429. package/dist/serve/environment/environment-not-found.errors.d.mts +10 -0
  430. package/dist/serve/environment/environment-not-found.errors.mjs +9 -0
  431. package/dist/serve/environment/environment-records.sql.d.mts +92 -0
  432. package/dist/serve/environment/environment-records.sql.mjs +59 -0
  433. package/dist/serve/environment/environment-store.sql.d.mts +38 -0
  434. package/dist/serve/environment/environment-store.sql.mjs +78 -0
  435. package/dist/serve/environment/local-environment.schema.d.mts +38 -0
  436. package/dist/serve/environment/local-environment.schema.mjs +43 -0
  437. package/dist/serve/environment/local-environments.service.d.mts +44 -0
  438. package/dist/serve/environment/local-environments.service.mjs +196 -0
  439. package/dist/serve/environment/promotion-notice.pure.d.mts +22 -0
  440. package/dist/serve/environment/promotion-notice.pure.mjs +30 -0
  441. package/dist/serve/environment/snapshot-operations.sql.d.mts +32 -0
  442. package/dist/serve/environment/snapshot-operations.sql.mjs +131 -0
  443. package/dist/serve/environment/store-snapshot.sql.d.mts +32 -0
  444. package/dist/serve/environment/store-snapshot.sql.mjs +74 -0
  445. package/dist/serve/erasure/local-actor-erasure.service.d.mts +26 -0
  446. package/dist/serve/erasure/local-actor-erasure.service.mjs +102 -0
  447. package/dist/serve/history/actor-host-runners.service.d.mts +23 -0
  448. package/dist/serve/history/actor-host-runners.service.mjs +35 -0
  449. package/dist/serve/hosted/hosted-app-build.errors.d.mts +13 -0
  450. package/dist/serve/hosted/hosted-app-build.errors.mjs +9 -0
  451. package/dist/serve/hosted/hosted-app-checks.layer.d.mts +15 -0
  452. package/dist/serve/hosted/hosted-app-checks.layer.mjs +32 -0
  453. package/dist/serve/hosted/hosted-file-forward.layer.d.mts +22 -0
  454. package/dist/serve/hosted/hosted-file-forward.layer.mjs +42 -0
  455. package/dist/serve/hosted/hosted-file-rpcs.layer.d.mts +25 -0
  456. package/dist/serve/hosted/hosted-file-rpcs.layer.mjs +82 -0
  457. package/dist/serve/hosted/hosted-file-server.layer.d.mts +18 -0
  458. package/dist/serve/hosted/hosted-file-server.layer.mjs +33 -0
  459. package/dist/serve/hosted/hosted-files.layer.d.mts +32 -0
  460. package/dist/serve/hosted/hosted-files.layer.mjs +55 -0
  461. package/dist/serve/hosted/hosted-runtime.layer.d.mts +42 -0
  462. package/dist/serve/hosted/hosted-runtime.layer.mjs +48 -0
  463. package/dist/serve/hosted/hosted-runtime.service.d.mts +77 -0
  464. package/dist/serve/hosted/hosted-runtime.service.mjs +74 -0
  465. package/dist/serve/hosted/hosted-secrets.layer.d.mts +10 -0
  466. package/dist/serve/hosted/hosted-secrets.layer.mjs +28 -0
  467. package/dist/serve/http/loopback-host.pure.d.mts +11 -0
  468. package/dist/serve/http/loopback-host.pure.mjs +29 -0
  469. package/dist/serve/inspect/actor-inspection.schema.d.mts +119 -0
  470. package/dist/serve/inspect/actor-inspection.schema.mjs +75 -0
  471. package/dist/serve/inspect/actor-inspection.sql.d.mts +12 -0
  472. package/dist/serve/inspect/actor-inspection.sql.mjs +43 -0
  473. package/dist/serve/inspect/inspect.service.d.mts +24 -0
  474. package/dist/serve/inspect/inspect.service.mjs +92 -0
  475. package/dist/serve/inspect/inspector-page.pure.d.mts +2 -0
  476. package/dist/serve/inspect/inspector-page.pure.mjs +155 -0
  477. package/dist/serve/inspect/inspector-wal.pure.d.mts +3 -0
  478. package/dist/serve/inspect/inspector-wal.pure.mjs +19 -0
  479. package/dist/serve/inspect/inspector.handlers.d.mts +5 -0
  480. package/dist/serve/inspect/inspector.handlers.mjs +50 -0
  481. package/dist/serve/inspect/inspector.layer.d.mts +9 -0
  482. package/dist/serve/inspect/inspector.layer.mjs +14 -0
  483. package/dist/serve/live/live-reads.service.d.mts +44 -0
  484. package/dist/serve/live/live-reads.service.mjs +152 -0
  485. package/dist/serve/live/live-tables.sql.d.mts +35 -0
  486. package/dist/serve/live/live-tables.sql.mjs +66 -0
  487. package/dist/serve/live/state-reads.pure.d.mts +11 -0
  488. package/dist/serve/live/state-reads.pure.mjs +7 -0
  489. package/dist/serve/rpc/actor-rpc.handlers.d.mts +24 -0
  490. package/dist/serve/rpc/actor-rpc.handlers.mjs +142 -0
  491. package/dist/serve/rpc/akter-server.layer.d.mts +18 -0
  492. package/dist/serve/rpc/akter-server.layer.mjs +61 -0
  493. package/dist/serve/rpc/computer/computer-copy.layer.d.mts +22 -0
  494. package/dist/serve/rpc/computer/computer-copy.layer.mjs +70 -0
  495. package/dist/serve/rpc/computer/computer-rpc-access.pure.d.mts +29 -0
  496. package/dist/serve/rpc/computer/computer-rpc-access.pure.mjs +46 -0
  497. package/dist/serve/rpc/computer/computer-rpc.layer.d.mts +39 -0
  498. package/dist/serve/rpc/computer/computer-rpc.layer.mjs +84 -0
  499. package/dist/serve/rpc/computer/step-rpc.handlers.d.mts +23 -0
  500. package/dist/serve/rpc/computer/step-rpc.handlers.mjs +43 -0
  501. package/dist/serve/rpc/development-authentication.handlers.d.mts +7 -0
  502. package/dist/serve/rpc/development-authentication.handlers.mjs +19 -0
  503. package/dist/serve/rpc/development-guard.pure.d.mts +10 -0
  504. package/dist/serve/rpc/development-guard.pure.mjs +16 -0
  505. package/dist/serve/rpc/file/file-rpc-access.pure.d.mts +55 -0
  506. package/dist/serve/rpc/file/file-rpc-access.pure.mjs +67 -0
  507. package/dist/serve/rpc/file/file-rpc.layer.d.mts +53 -0
  508. package/dist/serve/rpc/file/file-rpc.layer.mjs +143 -0
  509. package/dist/serve/rpc/file/upload-sessions.pure.d.mts +45 -0
  510. package/dist/serve/rpc/file/upload-sessions.pure.mjs +187 -0
  511. package/dist/serve/rpc/in-process-client.layer.d.mts +13 -0
  512. package/dist/serve/rpc/in-process-client.layer.mjs +34 -0
  513. package/dist/serve/rpc/listener-not-loopback.errors.d.mts +9 -0
  514. package/dist/serve/rpc/listener-not-loopback.errors.mjs +7 -0
  515. package/dist/serve/rpc/ndjson-only.pure.d.mts +5 -0
  516. package/dist/serve/rpc/ndjson-only.pure.mjs +14 -0
  517. package/dist/serve/rpc/served-rpc.layer.d.mts +6 -0
  518. package/dist/serve/rpc/served-rpc.layer.mjs +19 -0
  519. package/dist/serve/store/actor-not-migrated.errors.d.mts +10 -0
  520. package/dist/serve/store/actor-not-migrated.errors.mjs +8 -0
  521. package/dist/serve/store/store-migrations.layer.d.mts +5 -0
  522. package/dist/serve/store/store-migrations.layer.mjs +18 -0
  523. package/dist/serve/store/store-migrations.service.d.mts +26 -0
  524. package/dist/serve/store/store-migrations.service.mjs +47 -0
  525. package/dist/serve/store/store-unreadable.errors.d.mts +9 -0
  526. package/dist/serve/store/store-unreadable.errors.mjs +7 -0
  527. package/dist/serve/verify/verify.layer.d.mts +16 -0
  528. package/dist/serve/verify/verify.layer.mjs +36 -0
  529. package/dist/testing/story-driver.service.d.mts +29 -0
  530. package/dist/testing/story-driver.service.mjs +126 -0
  531. package/dist/testing/story.layer.d.mts +21 -0
  532. package/dist/testing/story.layer.mjs +42 -0
  533. package/package.json +106 -3
  534. package/src/contract/actor/actor-already-exists.errors.ts +8 -0
  535. package/src/contract/actor/actor-definition.pure.ts +157 -0
  536. package/src/contract/actor/actor-erased.errors.ts +8 -0
  537. package/src/contract/actor/actor-names.pure.ts +64 -0
  538. package/src/contract/actor/actor-not-created.errors.ts +8 -0
  539. package/src/contract/actor/actor-not-registered.errors.ts +8 -0
  540. package/src/contract/actor/actor-registry.service.ts +35 -0
  541. package/src/contract/actor/actor.contract.ts +409 -0
  542. package/src/contract/actor/host-interface.pure.ts +60 -0
  543. package/src/contract/actor/reserved-member.errors.ts +9 -0
  544. package/src/contract/akter.service.ts +233 -0
  545. package/src/contract/caller/authentication.api.ts +9 -0
  546. package/src/contract/caller/caller-admission.pure.ts +90 -0
  547. package/src/contract/caller/caller-not-allowed.errors.ts +26 -0
  548. package/src/contract/caller/caller.schema.ts +7 -0
  549. package/src/contract/caller/current-caller.service.ts +7 -0
  550. package/src/contract/caller/principal.schema.ts +13 -0
  551. package/src/contract/caller/unauthenticated.errors.ts +8 -0
  552. package/src/contract/client/actor-client.adapter.ts +217 -0
  553. package/src/contract/client/actor-client.contract.ts +53 -0
  554. package/src/contract/client/actor-rpc.contract.ts +91 -0
  555. package/src/contract/client/actor-unavailable.errors.ts +9 -0
  556. package/src/contract/client/client-failure.contract.ts +53 -0
  557. package/src/contract/client/invalid-request.errors.ts +9 -0
  558. package/src/contract/client/storage-limit.errors.ts +16 -0
  559. package/src/contract/command/command-id-expired.errors.ts +11 -0
  560. package/src/contract/command/command-id.schema.ts +5 -0
  561. package/src/contract/command/command.contract.ts +334 -0
  562. package/src/contract/command/outbox-id.pure.ts +25 -0
  563. package/src/contract/command/outbox.schema.ts +11 -0
  564. package/src/contract/command/timer.schema.ts +21 -0
  565. package/src/contract/computer/checkpoint-expired.errors.ts +12 -0
  566. package/src/contract/computer/computer-client-failure.contract.ts +27 -0
  567. package/src/contract/computer/computer-client.adapter.ts +110 -0
  568. package/src/contract/computer/computer-client.contract.ts +75 -0
  569. package/src/contract/computer/computer-held.errors.ts +10 -0
  570. package/src/contract/computer/computer-limit.errors.ts +11 -0
  571. package/src/contract/computer/computer-lost.errors.ts +10 -0
  572. package/src/contract/computer/computer-not-found.errors.ts +9 -0
  573. package/src/contract/computer/computer.schema.ts +159 -0
  574. package/src/contract/computer/computers-unavailable.errors.ts +9 -0
  575. package/src/contract/computer/files/computer-files.schema.ts +31 -0
  576. package/src/contract/computer/rpc/computer-rpc.contract.ts +140 -0
  577. package/src/contract/computer/step/computer-step.contract.ts +126 -0
  578. package/src/contract/computer/step/computer-step.schema.ts +80 -0
  579. package/src/contract/computer/step/step-failure.schema.ts +26 -0
  580. package/src/contract/computer/step/step-not-found.errors.ts +7 -0
  581. package/src/contract/description/published-contract.pure.ts +187 -0
  582. package/src/contract/file/access/file-access-denied.errors.ts +11 -0
  583. package/src/contract/file/access/file-access.contract.ts +56 -0
  584. package/src/contract/file/actor-files.contract.ts +78 -0
  585. package/src/contract/file/blob-transfer.errors.ts +6 -0
  586. package/src/contract/file/file-client-failure.contract.ts +43 -0
  587. package/src/contract/file/file-client.adapter.ts +45 -0
  588. package/src/contract/file/file-client.contract.ts +24 -0
  589. package/src/contract/file/file-listing.pure.ts +30 -0
  590. package/src/contract/file/file-not-found.errors.ts +6 -0
  591. package/src/contract/file/file-path.pure.ts +37 -0
  592. package/src/contract/file/files-unavailable.errors.ts +8 -0
  593. package/src/contract/file/invalid-file-request.errors.ts +9 -0
  594. package/src/contract/file/rpc/file-rpc.contract.ts +148 -0
  595. package/src/contract/file/rpc/file-too-large.errors.ts +10 -0
  596. package/src/contract/file/rpc/rpc-file-clients.layer.ts +184 -0
  597. package/src/contract/fork/fork-rpc.contract.ts +44 -0
  598. package/src/contract/history/actor-journal.service.ts +195 -0
  599. package/src/contract/history/history-entry.pure.ts +282 -0
  600. package/src/contract/hosted/handler-failed.errors.ts +16 -0
  601. package/src/contract/hosted/handler-failure.pure.ts +161 -0
  602. package/src/contract/hosted/hosted-actor.service.ts +97 -0
  603. package/src/contract/hosted/hosted-command.service.ts +114 -0
  604. package/src/contract/hosted/hosted-create.service.ts +95 -0
  605. package/src/contract/hosted/hosted-error.contract.ts +22 -0
  606. package/src/contract/hosted/hosted-failure.schema.ts +32 -0
  607. package/src/contract/hosted/hosted-outcome.contract.ts +21 -0
  608. package/src/contract/hosted/hosted-query.service.ts +50 -0
  609. package/src/contract/hosted/hosted-request.pure.ts +185 -0
  610. package/src/contract/job/job-id.pure.ts +37 -0
  611. package/src/contract/job/job-patches.contract.ts +86 -0
  612. package/src/contract/job/job-signal.schema.ts +23 -0
  613. package/src/contract/job/reserved-payload-field.errors.ts +10 -0
  614. package/src/contract/job/started-job.schema.ts +9 -0
  615. package/src/contract/json-codec.pure.ts +27 -0
  616. package/src/contract/room.contract.ts +31 -0
  617. package/src/contract/secret/actor-secrets.adapter.ts +87 -0
  618. package/src/contract/secret/invalid-secret-name.errors.ts +10 -0
  619. package/src/contract/secret/secret-unavailable.errors.ts +13 -0
  620. package/src/contract/secret/secret.schema.ts +43 -0
  621. package/src/contract/spend/billing-unavailable.errors.ts +12 -0
  622. package/src/contract/spend/spend-cap-reached.errors.ts +17 -0
  623. package/src/contract/state/actor-state.pure.ts +192 -0
  624. package/src/contract/state/actor-state.service.ts +69 -0
  625. package/src/contract/state/state-migration.pure.ts +57 -0
  626. package/src/contract/state/state-read.pure.ts +40 -0
  627. package/src/contract/state/state-unreadable.errors.ts +9 -0
  628. package/src/host/actor/actor-database.service.ts +145 -0
  629. package/src/host/actor/actor-exclusive.pure.ts +32 -0
  630. package/src/host/actor/actor-records.sql.ts +78 -0
  631. package/src/host/actor/reserved-name.errors.ts +10 -0
  632. package/src/host/actor/reserved-names.pure.ts +40 -0
  633. package/src/host/actor/room.actor.ts +57 -0
  634. package/src/host/blob/blob-frames.pure.ts +52 -0
  635. package/src/host/blob/blob-grant.schema.ts +22 -0
  636. package/src/host/blob/blob-grants.service.ts +197 -0
  637. package/src/host/blob/blob-keyring.service.ts +25 -0
  638. package/src/host/blob/blob-range.pure.ts +33 -0
  639. package/src/host/blob/blob-sealing.contract.ts +46 -0
  640. package/src/host/blob/blob-sealing.service.ts +25 -0
  641. package/src/host/blob/export/blob-archive.sql.ts +153 -0
  642. package/src/host/blob/export/blob-export-holds.sql.ts +91 -0
  643. package/src/host/blob/plain-blob-sealing.pure.ts +70 -0
  644. package/src/host/blob/reference/blob-catalog.sql.ts +339 -0
  645. package/src/host/blob/reference/blob-coordinator.pure.ts +217 -0
  646. package/src/host/blob/reference/blob-file-page.sql.ts +48 -0
  647. package/src/host/blob/reference/blob-forks.sql.ts +125 -0
  648. package/src/host/blob/reference/blob-lineage.sql.ts +63 -0
  649. package/src/host/blob/reference/blob-reads.pure.ts +172 -0
  650. package/src/host/blob/reference/blob-receipts.sql.ts +375 -0
  651. package/src/host/blob/reference/blob-transfer-adopt.pure.ts +127 -0
  652. package/src/host/blob/reference/blob-transfer-fork.pure.ts +174 -0
  653. package/src/host/blob/reference/blob-transfer-upkeep.pure.ts +132 -0
  654. package/src/host/blob/reference/blob-transfer.pure.ts +127 -0
  655. package/src/host/blob/sealed-blob-sealing.pure.ts +163 -0
  656. package/src/host/blob/stream/blob-directory.pure.ts +177 -0
  657. package/src/host/blob/stream/blob-length.pure.ts +40 -0
  658. package/src/host/blob/stream/blob-writing.pure.ts +49 -0
  659. package/src/host/command/batch/command-batch.sql.ts +207 -0
  660. package/src/host/command/command-context.adapter.ts +134 -0
  661. package/src/host/command/command-id-age.pure.ts +54 -0
  662. package/src/host/command/command-id-reuse.pure.ts +90 -0
  663. package/src/host/command/command-id-reused.errors.ts +13 -0
  664. package/src/host/command/command-journal.sql.ts +232 -0
  665. package/src/host/command/command-rejected.errors.ts +8 -0
  666. package/src/host/command/command-replay.service.ts +223 -0
  667. package/src/host/command/command-reply.pure.ts +21 -0
  668. package/src/host/command/command-runner.service.ts +320 -0
  669. package/src/host/command/files/command-file-inputs.sql.ts +114 -0
  670. package/src/host/command/history-pruned.errors.ts +10 -0
  671. package/src/host/command/replay/replay-cursor-stalled.errors.ts +9 -0
  672. package/src/host/command/replay/replay-cursor.pure.ts +19 -0
  673. package/src/host/computer/computer-steps.sql.ts +120 -0
  674. package/src/host/computer/job-computers.service.ts +84 -0
  675. package/src/host/computer/local-computer-files.layer.ts +103 -0
  676. package/src/host/computer/local-computer-log.layer.ts +115 -0
  677. package/src/host/computer/local-computer-records.layer.ts +205 -0
  678. package/src/host/computer/local-computer.schema.ts +36 -0
  679. package/src/host/computer/local-computers.adapter.ts +379 -0
  680. package/src/host/computer/local-step.layer.ts +174 -0
  681. package/src/host/file/actor-file-storage.sql.ts +79 -0
  682. package/src/host/file/actor-files.sql.ts +15 -0
  683. package/src/host/file/blob-home-lock.pure.ts +23 -0
  684. package/src/host/file/blob-home.sql.ts +55 -0
  685. package/src/host/file/local-blob-home.service.ts +71 -0
  686. package/src/host/file/local-blob-owner.sql.ts +89 -0
  687. package/src/host/file/local-file-upkeep.pure.ts +77 -0
  688. package/src/host/file/replay-file-storage.sql.ts +43 -0
  689. package/src/host/fork/actor-fork.sql.ts +110 -0
  690. package/src/host/fork/fork-computers.adapter.ts +366 -0
  691. package/src/host/hash/blob-hashing.service.ts +14 -0
  692. package/src/host/job/job-durables.sql.ts +214 -0
  693. package/src/host/job/job-engine.adapter.ts +420 -0
  694. package/src/host/job/job-journal.sql.ts +257 -0
  695. package/src/host/job/job-results.service.ts +111 -0
  696. package/src/host/job/job-runs.pure.ts +445 -0
  697. package/src/host/job/undelivered-result.pure.ts +265 -0
  698. package/src/host/layout/actor-layout.sql.ts +45 -0
  699. package/src/host/layout/layout-version.errors.ts +10 -0
  700. package/src/host/layout/layout-version.pure.ts +22 -0
  701. package/src/host/migration/actor-migrations.service.ts +159 -0
  702. package/src/host/migration/migration-edited.errors.ts +9 -0
  703. package/src/host/migration/migration-failed.errors.ts +12 -0
  704. package/src/host/migration/migration-failure.pure.ts +28 -0
  705. package/src/host/migration/migration-hasher.adapter.ts +70 -0
  706. package/src/host/migration/migration-missing.errors.ts +9 -0
  707. package/src/host/migration/migration-plan.pure.ts +66 -0
  708. package/src/host/outbox/actor-outbox.sql.ts +98 -0
  709. package/src/host/outbox/outbox-acknowledgements.sql.ts +93 -0
  710. package/src/host/outbox/outbox-runner.service.ts +253 -0
  711. package/src/host/query/query-policy.pure.ts +31 -0
  712. package/src/host/query/query-runner.service.ts +132 -0
  713. package/src/host/sqlite/actor-connections.pure.ts +44 -0
  714. package/src/host/sqlite/sqlite-connection.adapter.ts +260 -0
  715. package/src/host/sqlite/sqlite-driver.service.ts +151 -0
  716. package/src/host/sqlite/sqlite-parameters.pure.ts +28 -0
  717. package/src/host/sqlite/sqlite-reason.pure.ts +19 -0
  718. package/src/host/timer/actor-timers.sql.ts +67 -0
  719. package/src/host/timer/timer-runner.service.ts +117 -0
  720. package/src/host/upkeep/actor-due.sql.ts +71 -0
  721. package/src/host/upkeep/actor-upkeep.service.ts +404 -0
  722. package/src/host/upkeep/execution-authority.pure.ts +37 -0
  723. package/src/runtime/akter-local.layer.ts +49 -0
  724. package/src/runtime/akter.layer.ts +208 -0
  725. package/src/runtime/blob-hashing.layer.ts +21 -0
  726. package/src/runtime/hosted-environment.layer.ts +85 -0
  727. package/src/runtime/http-server.layer.ts +29 -0
  728. package/src/runtime/local-actor-engine.layer.ts +33 -0
  729. package/src/runtime/local-engine.layer.ts +37 -0
  730. package/src/runtime/local-environments.layer.ts +214 -0
  731. package/src/runtime/local-file-clients.layer.ts +112 -0
  732. package/src/runtime/local-job-runtime.layer.ts +38 -0
  733. package/src/serve/archive/archived-actors.layer.ts +97 -0
  734. package/src/serve/archive/archived-store.layer.ts +46 -0
  735. package/src/serve/engine/actor-engine.layer.ts +46 -0
  736. package/src/serve/engine/actor-fork.service.ts +403 -0
  737. package/src/serve/engine/actor-holding.pure.ts +28 -0
  738. package/src/serve/engine/actor-host.service.ts +454 -0
  739. package/src/serve/engine/actor-location.service.ts +219 -0
  740. package/src/serve/engine/actor-residents.pure.ts +500 -0
  741. package/src/serve/engine/actor-shard.pure.ts +13 -0
  742. package/src/serve/engine/actor-state.pure.ts +45 -0
  743. package/src/serve/engine/actors-not-hosted.errors.ts +9 -0
  744. package/src/serve/engine/job-runtime.layer.ts +13 -0
  745. package/src/serve/environment/environment-already-exists.errors.ts +9 -0
  746. package/src/serve/environment/environment-in-use.errors.ts +17 -0
  747. package/src/serve/environment/environment-not-found.errors.ts +9 -0
  748. package/src/serve/environment/environment-records.sql.ts +208 -0
  749. package/src/serve/environment/environment-store.sql.ts +116 -0
  750. package/src/serve/environment/local-environment.schema.ts +79 -0
  751. package/src/serve/environment/local-environments.service.ts +268 -0
  752. package/src/serve/environment/promotion-notice.pure.ts +63 -0
  753. package/src/serve/environment/snapshot-operations.sql.ts +210 -0
  754. package/src/serve/environment/store-snapshot.sql.ts +128 -0
  755. package/src/serve/erasure/local-actor-erasure.service.ts +170 -0
  756. package/src/serve/history/actor-host-runners.service.ts +85 -0
  757. package/src/serve/hosted/hosted-app-build.errors.ts +11 -0
  758. package/src/serve/hosted/hosted-app-checks.layer.ts +74 -0
  759. package/src/serve/hosted/hosted-file-forward.layer.ts +63 -0
  760. package/src/serve/hosted/hosted-file-rpcs.layer.ts +149 -0
  761. package/src/serve/hosted/hosted-file-server.layer.ts +75 -0
  762. package/src/serve/hosted/hosted-files.layer.ts +76 -0
  763. package/src/serve/hosted/hosted-runtime.layer.ts +145 -0
  764. package/src/serve/hosted/hosted-runtime.service.ts +128 -0
  765. package/src/serve/hosted/hosted-secrets.layer.ts +38 -0
  766. package/src/serve/http/loopback-host.pure.ts +67 -0
  767. package/src/serve/inspect/actor-inspection.schema.ts +94 -0
  768. package/src/serve/inspect/actor-inspection.sql.ts +112 -0
  769. package/src/serve/inspect/inspect.service.ts +173 -0
  770. package/src/serve/inspect/inspector-page.pure.ts +159 -0
  771. package/src/serve/inspect/inspector-wal.pure.ts +40 -0
  772. package/src/serve/inspect/inspector.handlers.ts +103 -0
  773. package/src/serve/inspect/inspector.layer.ts +26 -0
  774. package/src/serve/live/live-reads.service.ts +285 -0
  775. package/src/serve/live/live-tables.sql.ts +148 -0
  776. package/src/serve/live/state-reads.pure.ts +22 -0
  777. package/src/serve/rpc/actor-rpc.handlers.ts +242 -0
  778. package/src/serve/rpc/akter-server.layer.ts +119 -0
  779. package/src/serve/rpc/computer/computer-copy.layer.ts +95 -0
  780. package/src/serve/rpc/computer/computer-rpc-access.pure.ts +75 -0
  781. package/src/serve/rpc/computer/computer-rpc.layer.ts +143 -0
  782. package/src/serve/rpc/computer/step-rpc.handlers.ts +84 -0
  783. package/src/serve/rpc/development-authentication.handlers.ts +28 -0
  784. package/src/serve/rpc/development-guard.pure.ts +39 -0
  785. package/src/serve/rpc/file/file-rpc-access.pure.ts +119 -0
  786. package/src/serve/rpc/file/file-rpc.layer.ts +209 -0
  787. package/src/serve/rpc/file/upload-sessions.pure.ts +363 -0
  788. package/src/serve/rpc/in-process-client.layer.ts +62 -0
  789. package/src/serve/rpc/listener-not-loopback.errors.ts +9 -0
  790. package/src/serve/rpc/ndjson-only.pure.ts +33 -0
  791. package/src/serve/rpc/served-rpc.layer.ts +34 -0
  792. package/src/serve/store/actor-not-migrated.errors.ts +10 -0
  793. package/src/serve/store/store-migrations.layer.ts +35 -0
  794. package/src/serve/store/store-migrations.service.ts +76 -0
  795. package/src/serve/store/store-unreadable.errors.ts +9 -0
  796. package/src/serve/verify/verify.layer.ts +77 -0
  797. package/src/testing/story-driver.service.ts +266 -0
  798. package/src/testing/story.layer.ts +99 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,44 @@
1
- # Temporary Holding Version
1
+ # @akterjs/effect
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The Effect SDK. One package with five entry points, by who loads them:
4
+
5
+ The Effect SDK for Akter: durable actors with their state in their own SQLite database, their files, jobs and computers.
6
+
7
+ ```sh
8
+ npm install @akterjs/effect @akterjs/client effect
9
+ npm install -D akter
10
+ ```
11
+
12
+ Docs: https://docs.akter.dev. Pricing: https://docs.akter.dev/pricing.
13
+
14
+ - the root, `@akterjs/effect`: the runtime `Akter`, which is the contract `Akter` plus `Akter.serve`, `Akter.local`, `Akter.environments` and `Akter.migrate`, and `Verify.replay`.
15
+
16
+ - `contract`: `Akter.make`, commands, queries and errors. Imports only `effect`, so hosts, Workers, browsers and clients can all load it (ADR 0006).
17
+ - `host`: the runtime that runs actor handlers, one SQLite transaction per command.
18
+ - `local`: the local engine behind `akter dev`, on a folder with the production layout.
19
+ - `testing`: `Story`, actor tests on a temporary folder with real SQLite.
20
+
21
+ Status: Phase 1 in progress. `contract` exports `Akter`: `Akter.make`, `Akter.command`, `Akter.query`, `Room.update`, `Akter.schedule(delay, Room.commands.close, payload)` and `Akter.cancel(timerId)`, where a timer id is a branded `TimerId`, and `Akter.send(Workspace.commands.addMember, workspaceId, payload)` (these need `ActorState`, provided to commands only, so a query that calls them fails to typecheck), and the handler context (`yield* Akter`, `Akter.actorKey`, `Akter.id`, `Akter.now`, `Akter.principal`, `Akter.sql`). `Akter.Principal` is `{ id: PrincipalId }`, where `Akter.PrincipalId` is a branded string that stays a plain string on the wire; a contract's `callers` schema types its `id` as `Akter.PrincipalId`. A contract's `callers` names each kind of principal it accepts and that kind's schema, and defaults to `{ user: Principal }`; a command or query may narrow it with `callers: ["user"]`. A caller of a kind the member does not allow fails with `CallerNotAllowedError` before the handler runs, and nothing is journaled. The gate logs each refusal as a warning, `caller refused`, annotated with the actor, member, caller kind, principal id and the refusal (`CallerNotAllowedError` or `InvalidRequestError`), and never the payload; a refusal stays out of the journal so a retried command id is never answered with a stale refusal and a probing caller costs the actor no durable write. Each actor's `principal` (`Room.principal`) is typed as the kinds its contract declares, while `Akter.principal` is `{ id }`. The `Authentication` RPC middleware (`contract/authentication.api`) provides the `CurrentCaller`; the development authentication in `serve` reads it from the `akter-principal` header and falls back to the development principal, and refuses a header that claims the `actor` caller, which only the engine's deliveries use. A command or query may not be named `callers`, `client`, `commands`, `computer`, `create`, `ensure`, `files`, `fork`, `handlers`, `history`, `historyStream`, `initial`, `jobs`, `key`, `name`, `principal`, `queries`, `rpcs`, `state`, `then`, `toLayer`, `update` or `warm`: those names belong to the actor object and the clients (`then` so a Promise client handle is never thenable), and `Akter.make` rejects them at the type level and throws `ReservedMemberError` for an untyped caller. Each actor's `toLayer` registers its handlers in `ActorRegistry` (`contract/actor-registry`), `rpcs` is its `RpcGroup`, and `client(key)` is a typed client for one actor (see `@akterjs/client`). `contract/room` and `host/room` are the reference room. In `host`, `ActorDatabase.open` opens an actor's `actor.db`: it creates Akter's reserved `akter_` tables (state, command journal, timers, outbox, failed deliveries, workflow, migrations, layout version), applies the actor's numbered migrations in one transaction after checking the stored hashes of applied ones (a migration that fails rolls them all back with `MigrationFailedError`, whose message names the migration and SQLite's reason and code, also kept as `sqliteMessage` and `sqliteCode`), and upgrades state written under an older schema through `Akter.migrateState`. `SqliteDriver.layerNode` runs it on `node:sqlite`, which both Bun and Node provide, and every `SqlError` it raises keeps SQLite's message and code in its message (`Failed to execute statement: file is not a database (SQLite error 26)`), so `ActorUnavailableError` and `HandlerFailedError` carry them too; only `.adapter` files may import a SQLite driver. `pnpm test` runs the suites on Node and `pnpm test:bun` runs them on Bun, and every result is labelled `|node|` or `|bun|`. `pnpm test:browser` and `pnpm test:workerd` run the contract tests in headless Chromium and in workerd. `CommandRunner.run` runs one command in one transaction: a command id already in the journal returns its recorded exit without running anything; otherwise the handler runs in a savepoint that rolls back on a typed error or a defect, the new state is saved on success, and a journal row records the command, payload, principal, exit, the values of `Akter.id` and `Akter.now`, and the time. `Room.history(key, { since })` returns `{ coveredSince, entries }`: the journal read back as entries typed by the contract: `kind: "recorded"` with the decoded payload, principal and `Exit`; `kind: "created"` for `akter.create` and `akter.ensure`, with the `mode`, the payload decoded by the contract's `create` schema, the principal and an `Exit` that can fail with `ActorAlreadyExistsError` or `HandlerFailedError`; and `kind: "result"` for a job's result, with the `job`, its `result` typed by the job's `success` and `error` schemas, and the result handler's `exit`. It marks an entry that an older contract wrote as `kind: "unreadable"` with the reason, instead of failing the read. It needs `ActorJournal`, which `Akter.local` provides: it reads through a second, query-only connection, so a read never waits for a running command, and with `Akter.historyRetention("7 days")` provided a background job deletes older entries every hour and an actor's first call after it opens deletes them first (by default nothing is deleted). `coveredSince` is the time from which the entries are complete: the requested `since`, or later if a prune deleted entries after it. A prune that deletes entries records its cutoff in `akter_meta`, so an actor whose history was never pruned reports `since` even with a retention. `Room.historyStream(key, { since })` reads the same journal 500 commands at a time and emits each page as `{ coveredSince, entries }`, and `Room.historyCoveredSince(key, { since })` returns only that time, without reading entries. With a retention, a command id must be a UUIDv7, which clients mint, so the host can tell its age: a retry whose row was pruned fails with `CommandIdExpiredError` instead of running again, and an id that is not a UUIDv7 or was minted more than 5 minutes ahead of the host's clock fails with `InvalidRequestError`. Outbox message ids are age-checked the same way. Timer commands (`timer:<id>`) and job-result commands (`result:<job id>`) are not, because the actor's own engine claims each one in the transaction that journals it, so it can't arrive twice. A failed SQL statement in a handler rolls the command back and fails it with `HandlerFailedError`, which is journaled and replayed for the same command id. The reply is returned only after `COMMIT`. `CommandRunner.create` runs an actor's `create` handler (`mode: "create"`) or attaches to an existing actor (`mode: "ensure"`) in the same kind of transaction, journaled as `akter.create` or `akter.ensure`; `create` on an existing actor fails with `ActorAlreadyExistsError`, and a command to an actor with `create` that does not exist yet fails with `ActorNotCreatedError`. `QueryRunner.run` runs a query on a second, read-only connection (`query_only`) inside one deferred read transaction, so it sees the last committed state and tables, never waits for a running command, adds no journal rows, and fails with `HandlerFailedError` if it tries to write. A command's `Akter.schedule` and `Akter.cancel` write and delete `akter_timers` rows in the command's transaction, and only if the command succeeds; a timer runs as the principal that scheduled it. `TimerRunner.fireDue` runs each due timer as a journaled command with the id `timer:<id>`, deleting its row in the same transaction, so a timer fires at most once, a timer a neighboring command cancelled never fires, and a crash before the commit leaves it pending. `TimerRunner.nextDue` returns the earliest pending due time, for the engine's next wake. Each entry of an actor's `commands` carries its `address` (`actor`, the `key` schema and `member`), so `Akter.send` encodes the target key and payload and writes an `akter_outbox` row in the command's transaction, only if the command succeeds, with the command id `outbox:<id>`, where the id is a UUIDv7 minted like `Akter.id`, so it is recorded with the command and its age is the time the message was sent. Only the engine's `actor` caller may send an `outbox:` id, so a client that learns a message's id can't take it first and make the delivery fail. `OutboxRunner.deliver` sends each pending row as a command with that id, so the target's journal runs it once however often it arrives, and deletes the row only after the send succeeds. With a retention on the target, a message whose age passes it is refused with `CommandIdExpiredError` and kept as a failed delivery, so a redelivery after the target pruned its journal row never runs twice. A delivered command runs as the sending actor, the `actor` caller `{ actor, id, key }` (`Akter.ActorPrincipal`, whose `id` is `<actor>/<key>`). A target declares that caller in `callers` and lists `"actor"` on each member that accepts messages; a member that does not list it refuses the message with `CallerNotAllowedError`, even when it names no callers.
22
+
23
+ An actor declares jobs with `jobs: { charge: Akter.job({ payload: { amount: Schema.Int }, success: ChargeId, error: CardDeclinedError }) }`. `Order.jobs.charge` is an Effect `Workflow` named `Order/charge`, and its handler is a layer written the Effect way, `Order.jobs.charge.toLayer(({ amount }) => ...)`, in a `.job.ts` file, where the `workflow-determinism` rule checks that the body does I/O, time and randomness only inside an `Activity`. A command starts a job with `Akter.start(Order.jobs.charge, { amount })`, which needs `ActorState` like `Akter.send` and returns the job's id, `<actor>/<encoded key>/<recorded id>`. The job is written in the command's transaction, so a command that rolls back never starts its job, and a command that names another actor's job dies. After the commit the actor's upkeep starts the job. A `WorkflowEngine` journals each job in the actor's `akter_workflow` table, under the actor's command lock: the job and its payload, each activity attempt's result, each `DurableDeferred` result, each `DurableClock` wake time and the final result. When an actor opens, its upkeep resumes every job with no final result, so finished activities return their journaled results instead of running again, and a clock wakes at the time it journaled. `Akter.local` also provides that `WorkflowEngine`, which job handler layers, `Order.jobs.charge.poll(id)` and `DurableDeferred.succeed` need. When a job ends, its result comes back to the actor as a command: `toLayer` takes `results: { charge: (order, result, job) => ... }`, one handler per job, where `result` is an `Exit` typed by the job's `success` and `error` schemas and `job.id` is the id `Akter.start` returned. A result handler can do whatever a command handler can. `JobResults.deliver` runs it with the command id `result:<job id>`, journaled as `akter.result.charge`, as the actor itself (`Akter.ActorPrincipal`, with no caller gate and no command id age check), and stores the job's final result in the same transaction. So a result lands once, and a crash before that commit leaves the job open: the reopened actor replays it from its journaled activities and delivers the result then. `Room.history` shows a result command as `kind: "result"`. A job can't start another job.
24
+
25
+ `Akter.serve({ actors: [Room] })` serves every listed actor as one RPC group at `/rpc` over HTTP with NDJSON, through `RpcServer` on `HttpRouter`. The HTTP server is a platform layer picked at startup: `BunHttpServer` on Bun and `NodeHttpServer` on Node (`runtime/http-server.layer`). It needs an engine, an `ActorHost`, rather than the handlers: `Akter.serve({ actors: [Room] }).pipe(Layer.provide(Akter.local(".akter").pipe(Layer.provide(RoomLive))))`. `Akter.local(directory)` is the local engine on a folder, the open counterpart of the private production engine in akter-cloud. It hosts the actors whose handler layers (`Room.toLayer`) are provided to it, and needs no server, network, Archil or Cloudflare. When serve and `Akter.local` run in one process, building the server fails with `ActorsNotHostedError`, naming each listed actor the engine has no handlers for. An engine in another process can't be checked that way, so a call to an actor it doesn't host fails with `InvalidRequestError`. Calls go to `ActorHost` (`serve/actor-host`), which opens an actor's database on its first call under `ActorLocation` in the production layout (`<directory>/shards/<NNN>/<Type>/<key>/` holding `actor.db` and `files/`, `.akter` by default). The shard is Effect Cluster's `Math.abs(hashString(key) % 300) + 1`, written with three digits, and the key is URI-encoded, with an all-dot key's dots written as `%2E` and the empty key as `%`, keeps it open, runs one command at a time per actor and runs queries through `QueryRunner`, so a query never waits for a command and a write in a query fails with `HandlerFailedError`. A query's `/subscribe` RPC and the actor's `state/subscribe` RPC stream the current result and then one `{ value, version }` per commit that changed it, where `version` is the newest journal `seq`. After each commit, the host reads which tables the commit touched (temporary triggers on its own connection; `akter_state` counts only when the value changed) and reruns only the subscribed queries that read one of them, found by `EXPLAIN`ing the statements the query ran. Updates go out after `COMMIT`, a rolled-back command sends none, and closing the stream stops the reruns. An actor declared with `create` also gets `<Actor>/create` and `<Actor>/ensure` RPCs, which take a command id and route to `CommandRunner.create` in that mode, so a retry with the same id replays the journaled result, `ActorAlreadyExistsError` included. Every actor also gets a `<Actor>/warm` RPC, which takes only the key and opens the actor's database through `ActorHost.warm` without running a command, so it journals nothing and leaves the version as it was. A key that was never created opens nothing, so a warm never creates an actor. Reads of such a key open nothing either: a query, `history`, `coveredSince` or the first answer of a `state` or query subscription reads one in-memory, query-only copy of the actor type's migrated schema, so an actor declared with `initial` answers its initial state at version 0 and one declared with `create` answers `ActorNotCreatedError`. Those reads, `files` included, run one at a time, and a query that writes to the copy (by turning `query_only` off, say) fails with `ActorUnavailableError` and the copy is rebuilt. A subscription then attaches to the actor when a command first opens it and sends what that command committed (`tests/serve/engine/actor-host.service.test.ts`). After each command, and for every actor it finds under `shards/` when it starts, the engine delivers the actor's outbox and fires its due timers. A message the target refuses (`CallerNotAllowedError`, `ActorNotCreatedError`, `InvalidRequestError`) leaves the outbox and is recorded in the sender's `akter_failed_deliveries` with a warning, and a target that can't be reached is retried up to 10 times with backoff capped at 30 seconds, after which the message stays in the outbox, an error is logged, and it goes out with the sender's next command or the sweep at the next start. A refusal (`CallerNotAllowedError`, `ActorNotCreatedError`, `InvalidRequestError`), a failed handler statement (`HandlerFailedError`), a database the host can't open or write (`ActorUnavailableError`) and the member's declared error reach the client as their own classes. Until verified principals arrive (Phase 2), the server uses the development authentication, where any caller picks its principal, so it listens on `127.0.0.1` unless given a `hostname`, and building it on a listener that isn't loopback fails with `ListenerNotLoopbackError`, whose message names the address it got, unless `unsafeExposeDevelopmentAuth` is set. Loopback is 127.0.0.0/8, `::1` (a bracketed `[::1]` hostname works too) and the IPv4-mapped `::ffff:127.0.0.1`. It also answers 421 to a request whose `Host` isn't `localhost`, a 127.0.0.0/8 address or `[::1]`, before routing or reading `akter-principal`, so a page that rebinds its own name to the listener's address gets nothing, and 403 to a request whose `Origin` isn't a loopback page. `allowedHosts: ["app.test"]` adds names the Host check accepts, and `allowedHosts: true` accepts any. `unsafeExposeDevelopmentAuth` turns the Origin check off but keeps the Host check, so an exposed listener still needs its names in `allowedHosts`. `Akter.inspector` takes the same `allowedHosts`. A POST whose body isn't `application/ndjson` (or `application/x-ndjson`) gets 415 in every case, so another site can't send one without a CORS preflight the server never answers.
26
+
27
+ `Akter.migrate({ directory, dryRun })` applies pending migrations to every actor in a local folder now instead of on each actor's next open (`akter migrate --all`). It needs the same handler layers as `Akter.local` and returns a `Stream` of `{ actor, key, from, to }`, one per actor in actor-then-key order, where `from` and `to` are the migration versions before and after. Each actor migrates in its own transaction, as `ActorDatabase.open` would. The first actor that fails ends the stream with `ActorNotMigratedError`, naming its type and key: the actors before it stay migrated, its own transaction rolls back, and the actors after it are not opened. With `dryRun: true` it opens each database with `PRAGMA query_only` and reports the versions it would reach without running a migration or writing to `actor.db` or its WAL. Like any SQLite reader it still updates the read marks in `actor.db-shm`, the WAL's shared-memory index, which holds no data; Bun's `node:sqlite` leaves that file and the WAL in place after a close, where Node removes them. A folder it can't list fails with `StoreUnreadableError`.
28
+
29
+ A data directory holds environments, each a store of its own, and `LocalEnvironments` (`serve/environment/`) snapshots, branches and promotes them under Akter Cloud's names, shapes and errors (`NotFoundError`, `AlreadyExistsError`, `InUseError`). The record is `<directory>/environments.db`; the first environment, `dev`, is the directory itself, so an existing folder keeps working. `Akter.local(directory)` serves the environment promoted to serve, and `Akter.local({ directory, environment })` pins one, such as a quiet branch to call before promoting it. The engine reads the record every second and applies it: on a promote it closes the old environment's engine, opens the new one and opens its `UpkeepGate`, so held timers fire, held outbox messages go out and jobs resume from the snapshot's journal. While an environment is quiet its upkeep waits at that gate: nothing is dropped. The engine also takes each Pending snapshot of the environment it serves: each actor's database is copied with `VACUUM INTO` under that actor's command lock, under the file home's hold so the blobs and catalog match, into `<directory>/snapshots/<snapshot-n>` beside the store, never as a link to a live file. `branch` copies a Ready snapshot into `<directory>/environments/<name>`, quiet. `promote` switches the serving environment in one transaction and answers a `Promotion` whose `notice` names what the switch leaves out; promoting the one that serves answers the same `Promotion` again. `Akter.environments(directory)` provides `LocalEnvironments` without an engine, as `akter dev snapshots` and `akter dev environments` use it; what it changes, the running engine applies on its next look, and a snapshot it asks for is waited on for up to 30 seconds while that engine takes it. `Akter.inspector` and `Akter.migrate` still read the directory itself, the `dev` environment.
30
+
31
+ With `AKTER_LOCAL_COMPUTERS=true`, `Akter.local` runs each environment's computers on the machine, under `<store>/computers/<Actor>/<key>/<name>/` (`host/computer/`): a computer is a directory whose `disk` is each step's working directory and `HOME`, so its files last across pause, resume, stop and restarts, and removing it deletes them. A step runs its command in `sh -c` with a fixed `PATH` and no other environment, once by its key (a step sent again reads back the recorded outcome, or `Unknown` when it never recorded one), returns at most 4 MiB of each stream with `truncated`, and is killed with its process group at its timeout. A store holds at most 4 computers, a held computer stays paused (a stopped one stays stopped) until its hold resumes it, and a fork copies the disk. Egress, ingress and secrets are recorded but not enforced, and a computer keeps no process past its step. Job activities reach them through `Actor.computer(key)`, because `Akter.jobs` and `Akter.local` share one `JobComputers`, which the engine binds to the store it serves; on any other engine they fail with `ComputersUnavailableError` until one binds. The `<Actor>/computer/*` RPCs that `akter dev` serves reach the same computers. The variable is off by default, because a local step runs unsandboxed on this machine: then `Akter.jobs` gives the app no computers, so ones another layer provides stay visible, and every computer call answers `ComputersUnavailableError` as before.
32
+
33
+ `testing` exports `Story`. `Story.run(Handlers, function* (story) { ... })` runs the given handlers on the local engine in a new temporary folder, with real SQLite, and removes the folder afterwards. `story.actor(Room, RoomId.make("lobby"))` returns a client typed from the contract: each command and query is a method that fails with the member's declared error or the host's own failure (`CallerNotAllowedError`, `ActorNotCreatedError`, `HandlerFailedError` and the rest), and a handler's defect dies the call. Calls go in as the user `story` unless `{ as: { kind, principal } }` names another caller the contract declares. `story.create(Agent, key, { input })` creates an actor declared with `create`. A command returns only after the outbox messages it sent, and any they sent in turn, are delivered, and `story.advance(duration)` moves `TestClock` and fires every timer and job clock that falls due, delivering what those timers send. `Story` provides the `WorkflowEngine` too, so a job runs as far as it can before the command that started it returns, and `Order.jobs.charge.poll(id)` reads its result. `Story.run` advances the `TestClock` that `it.effect` provides, and provides its own when none is present.
34
+
35
+ `Verify.replay(RoomLive, { actor: Room, directory, key })` reruns an actor's command journal against the given handlers and reports the first command whose outcome differs. It opens the actor's `actor.db` query-only and reads the journal 500 commands at a time inside one read transaction, so it never writes to the actor. It replays into a new in-memory database built from the handlers' own migrations, starting from the actor's first command. Each command gets the ids and times it recorded through `Akter.id` and `Akter.now`, plus fresh ones if the new code asks for more, and runs with its recorded principal, through the same `CommandRunner` as a live command. The `ReplayReport` names the window it replayed (how many commands, and the first and last seq and time), and its `difference` is `Option.none()` or the first differing command with the journaled outcome it `expected` and the `actual` one. The actual outcome is either the new journaled exit or a refusal, such as `CallerNotAllowedError`, that was never journaled. Replay stops at the first difference, because later commands ran on state that no longer matches. It compares outcomes only: a change that alters state, timers or sent messages without changing a reply shows up at the first later command whose outcome it changes. An actor with no `actor.db` replays as an empty window. A layer that doesn't host the actor fails with `ActorNotRegisteredError`, and an unreadable file fails with `ActorUnavailableError`. When a history retention has pruned the start of the journal, replay can't rebuild the state the first kept command ran on, so it fails with `HistoryPrunedError`, whose `coveredSince` is the time from which the history is complete, the same time `Room.historyCoveredSince(key)` returns. Inside `Story.run`, `story.replay(Room, key)` replays against the story's own handlers. `akter history <Actor>/<key> --verify` runs it from the command line.
36
+
37
+ Every error class the package defines is exported from the root, `@akterjs/effect`, so a caller can write `instanceof` or `Effect.catchTag` against a typed import instead of matching on a tag string. That covers each member of the hosted error union a command, query or create can fail with (`ActorAlreadyExistsError`, `ActorNotCreatedError`, `CallerNotAllowedError`, `CommandIdExpiredError`, `HandlerFailedError`, `InvalidRequestError`), and the errors of the engine, migrations and serving, such as `ActorUnavailableError`, `UnauthenticatedError`, `MigrationFailedError` and `ActorsNotHostedError`. `contract/errors` exports the ones a client call can fail with, so a browser or Worker bundle can name them without the engine.
38
+
39
+ `@akterjs/effect/hosted` exports `HostedRuntime` and its layer `hostedRuntime` for a host that keeps its own SQLite connection, such as Akter Cloud's engine. `HostedRuntime.declare(name)` finds the actor among the handlers provided to `hostedRuntime` and hashes its migrations, which can wait. `HostedRuntime.open({ actor, filename, sql })` then applies any pending migrations on the `SqlClient` it is handed, and it never waits, so a host can open the actor inside a synchronous batch. After that, `run`, `create`, `history` and `coveredSince` are `CommandRunner`'s and `QueryRunner`'s, and they read and write through that same client. `HostedRuntime` opens no database of its own. A host whose client nests `withTransaction` as a savepoint can run each command inside its own batch, and the journal the command writes is the one `Room.history` reads. `HostedRuntime.historyRetention` is `CommandRunner`'s retention. `HostedRuntime.upkeep({ exclusive, key, opened, send })` starts the upkeep `Akter.local` runs for an opened actor: it runs the actor's committed jobs, fires its due timers and hands each outbox message to `send`. Every read and write it makes goes through `exclusive`, which a host makes the actor's next batch, so a write is durable before the upkeep moves on. It returns the actor's `jobs` store and `kick`, which the host calls after each commit that wrote. `send` gets the target's `actor`, `key`, `member` and `payload`, the sender's `principal`, and a `commandId` that stays the same on every attempt, so a host can deliver the message once. A failed `send` leaves the message in the outbox, and the upkeep retries it with backoff. `HostedRuntime.locateJobs` tells the job engine how to find an actor's `jobs` store from a job id. `HostedRuntime.nextDue(opened)` returns the earliest instant the actor has work: its next timer, or now while a job is open or a message waits. A host can wake the actor then. `HostedRuntime.version({ commandId, opened })` returns the version a command committed at: its position in the journal, which a later command never changes, the same for a retried command id, and none for an id the actor never journaled (a refused call). Send it with the reply so a client can wait for a read at that version or later. `HostedRuntime.live({ exclusive, opened })` opens the same live reads `Akter.local` serves: `state` is the internal raw-row stream; `stateFor(principal)` and `subscribe(request)` are caller-gated streams of `{ value, version }`. `stateFor` uses the same admission and initial-state fill as RPC, then encodes the actor's state schema as JSON text. `stateReads` from `@akterjs/effect/hosted/state` exposes that same adapter for a host's never-created-actor stream. Their `version` is the actor's committed version at the read. `refresh` re-runs only the reads whose tables a command touched since the last refresh. Call `refresh` only after the batch is durable, after `fdatasync`, and only while no other batch is open on the actor's connection, so no reader sees a version that a crash could take back. `exclusive` gives that only to a host that runs one command at a time. A host that groups commands into batches would put the refresh in the next batch, behind commands already queued, and it would read their writes before they are durable. Akter Cloud's engine runs `refresh` on the actor's serve fiber instead, after the batch ships and before the next batch is taken, so no later batch can commit while it reads. Its test `a push never carries a write whose batch has not shipped yet` holds a commit's `fdatasync` and checks that no reading carries that commit's write until the batch ships. `hostedRuntime` also provides the `WorkflowEngine` that `Order.jobs.charge.toLayer` registers job handlers on. `hostedFileHome({ catalog, root })` opens a file home for such a host: blobs go under `root`, sealed by the `BlobSealing` the host provides (Cloud seals them under each actor's key), and their claims and reference counts go on `catalog`, a connection only the home writes. `hostedActorFiles({ exclusive, home, identity, opened, snapshot })` then gives an opened actor its files on that home: `identity` names the actor to the keyring and the catalog, every read and write of the actor's own file tables goes through `exclusive`, so it never interleaves with a command batch, and the returned actor's commands reach the files through `Akter.files`. It recovers unfinished uploads, settles references and keeps them settled until its scope closes (`tests/serve/hosted/hosted-files.layer.test.ts`).
40
+
41
+ `hostedApp(app.layer)` composes a loaded bundle with its runtime, providing one journaled job engine before either job registration or actor upkeep starts. It shares that engine provider with `Akter.local`. A bundled job carries the app's strict payload and result codecs; the host does not reconstruct them with its own Schema instance. A bundle without those codecs fails at load with `HostedAppBuildError`, asking for an SDK rebuild.
42
+
43
+ - Depends on: `effect` (peer), `@effect/platform-bun` and `@effect/platform-node` (the HTTP servers).
44
+ - Must not depend on: any private package.
@@ -0,0 +1,8 @@
1
+ import { Schema } from "effect";
2
+ declare const ActorAlreadyExistsError_base: Schema.Class<ActorAlreadyExistsError, Schema.TaggedStruct<"ActorAlreadyExistsError", {
3
+ readonly actor: Schema.String;
4
+ }>, import("effect/Cause").YieldableError & {
5
+ readonly brand: unique symbol;
6
+ }>;
7
+ export declare class ActorAlreadyExistsError extends ActorAlreadyExistsError_base {}
8
+ export {};
@@ -0,0 +1,4 @@
1
+ import { Schema } from "effect";
2
+ // src/contract/actor/actor-already-exists.errors.ts
3
+ var ActorAlreadyExistsError = class extends Schema.TaggedError()("ActorAlreadyExistsError", { actor: Schema.String }) {};
4
+ export { ActorAlreadyExistsError };
@@ -0,0 +1,21 @@
1
+ import { ActorDefinition, ActorHandlers, ActorOptions, AddressedCommands, DefinitionOf, HostedActor, PrincipalOf } from "./actor.contract.mjs";
2
+ import { ActorRpcs } from "../client/actor-rpc.contract.mjs";
3
+ import { Principal } from "../caller/principal.schema.mjs";
4
+ import { Declaring, reservedMembers } from "./actor-names.pure.mjs";
5
+ import { fileAccess } from "../file/access/file-access.contract.mjs";
6
+ import { Context, Effect, Option } from "effect";
7
+ declare function definitionOf<Options extends ActorOptions>(declaring: Declaring<Options>): DefinitionOf<Options>;
8
+ interface Naming<Name extends string, Definition extends ActorDefinition> {
9
+ readonly definition: Definition;
10
+ readonly name: Name;
11
+ }
12
+ declare function commandsOf<Name extends string, Definition extends ActorDefinition>(naming: Naming<Name, Definition>): AddressedCommands<Name, Definition>;
13
+ declare function initialOf<Options extends ActorOptions>(options: Options): Option.Option<() => Options["state"]["Type"]>;
14
+ declare function principalOf<Definition extends ActorDefinition, Needs>(principal: Effect.Effect<Principal, never, Needs>): Effect.Effect<PrincipalOf<Definition>, never, Needs>;
15
+ declare const handlersKey: <Name extends string>(name: Name) => Context.Key<ActorHandlers<Name>, HostedActor>;
16
+ interface NamedDefinition {
17
+ readonly definition: ActorDefinition;
18
+ readonly name: string;
19
+ }
20
+ declare const rpcsOf: ({ definition, name }: NamedDefinition) => ActorRpcs;
21
+ export { commandsOf, definitionOf, fileAccess, handlersKey, initialOf, principalOf, reservedMembers, rpcsOf };
@@ -0,0 +1,106 @@
1
+ import { creationErrors, creationModesOf } from "../client/actor-rpc.contract.mjs";
2
+ import { fileRpcsOf } from "../file/rpc/file-rpc.contract.mjs";
3
+ import { Authentication } from "../caller/authentication.api.mjs";
4
+ import { forkRpcOf } from "../fork/fork-rpc.contract.mjs";
5
+ import { computerRpcsOf } from "../computer/rpc/computer-rpc.contract.mjs";
6
+ import { CommandId } from "../command/command-id.schema.mjs";
7
+ import { declaredSchema } from "../command/command.contract.mjs";
8
+ import { HostedFailure } from "../hosted/hosted-failure.schema.mjs";
9
+ import { Principal } from "../caller/principal.schema.mjs";
10
+ import { rejectInvalidSecrets, rejectReserved, reservedMembers } from "./actor-names.pure.mjs";
11
+ import { fileAccess } from "../file/access/file-access.contract.mjs";
12
+ import { Array, Context, Option, Record, Schema, pipe } from "effect";
13
+ import { Rpc, RpcGroup } from "effect/rpc";
14
+ // src/contract/actor/actor-definition.pure.ts
15
+ function definitionOf(declaring) {
16
+ const { options } = declaring;
17
+ rejectReserved(declaring);
18
+ rejectInvalidSecrets(declaring);
19
+ return {
20
+ callers: options.callers ?? { user: Principal },
21
+ commands: options.commands,
22
+ create: pipe(Option.fromNullishOr(options.create), Option.match({
23
+ onNone: () => Schema.Never,
24
+ onSome: (input) => declaredSchema(input)
25
+ })),
26
+ fileAccess: Option.filter(Option.fromNullishOr(options.files), (declared) => Option.exists(declared.callers, Array.isReadonlyArrayNonEmpty)),
27
+ jobs: options.jobs ?? {},
28
+ key: options.key,
29
+ queries: options.queries ?? {},
30
+ secrets: Array.dedupe(options.secrets ?? []),
31
+ state: options.state
32
+ };
33
+ }
34
+ function commandsOf({ definition, name }) {
35
+ return Record.map(definition.commands, (declaration, member) => ({
36
+ ...declaration,
37
+ address: {
38
+ actor: name,
39
+ key: definition.key,
40
+ member
41
+ }
42
+ }));
43
+ }
44
+ function initialOf(options) {
45
+ return Option.fromNullishOr(options.initial);
46
+ }
47
+ function principalOf(principal) {
48
+ return principal;
49
+ }
50
+ const handlersKey = (name) => Context.Service(`@akterjs/effect/contract/actor-handlers/${name}`);
51
+ const failureOf = (declared) => Schema.Union([declared, HostedFailure]);
52
+ const updateOf = (value) => Schema.Struct({
53
+ value,
54
+ version: Schema.Int
55
+ });
56
+ const subscriptionTag = (name, member) => `${name}/${member}/subscribe`;
57
+ const creationTag = (name, mode) => `${name}/${mode}`;
58
+ const created = Schema.Void;
59
+ const warmTag = (name) => `${name}/warm`;
60
+ const rpcsOf = ({ definition, name }) => RpcGroup.make(...Array.map(Record.toEntries(definition.commands), ([member, declaration]) => Rpc.make(`${name}/${member}`, {
61
+ error: failureOf(declaration.error),
62
+ payload: {
63
+ commandId: CommandId,
64
+ key: definition.key,
65
+ payload: declaration.payload
66
+ },
67
+ success: declaration.success
68
+ })), ...Array.map(Record.toEntries(definition.queries), ([member, declaration]) => Rpc.make(`${name}/${member}`, {
69
+ error: failureOf(declaration.error),
70
+ payload: {
71
+ key: definition.key,
72
+ payload: declaration.payload
73
+ },
74
+ success: declaration.success
75
+ })), ...Array.map(Record.toEntries(definition.queries), ([member, declaration]) => Rpc.make(subscriptionTag(name, member), {
76
+ error: failureOf(declaration.error),
77
+ payload: {
78
+ key: definition.key,
79
+ payload: declaration.payload
80
+ },
81
+ stream: true,
82
+ success: updateOf(declaration.success)
83
+ })), ...Array.map(creationModesOf(definition.create), (mode) => Rpc.make(creationTag(name, mode), {
84
+ error: failureOf(creationErrors[mode]),
85
+ payload: {
86
+ commandId: CommandId,
87
+ key: definition.key,
88
+ payload: definition.create
89
+ },
90
+ success: created
91
+ })), Rpc.make(warmTag(name), {
92
+ error: failureOf(Schema.Never),
93
+ payload: { key: definition.key }
94
+ }), Rpc.make(subscriptionTag(name, "state"), {
95
+ error: failureOf(Schema.Never),
96
+ payload: { key: definition.key },
97
+ stream: true,
98
+ success: updateOf(definition.state)
99
+ }), ...Option.match(definition.fileAccess, {
100
+ onNone: () => [],
101
+ onSome: () => fileRpcsOf(name)
102
+ }), forkRpcOf({
103
+ actor: name,
104
+ key: definition.key
105
+ }), ...computerRpcsOf(name)).middleware(Authentication);
106
+ export { commandsOf, definitionOf, fileAccess, handlersKey, initialOf, principalOf, reservedMembers, rpcsOf };
@@ -0,0 +1,8 @@
1
+ import { Schema } from "effect";
2
+ declare const ActorErasedError_base: Schema.Class<ActorErasedError, Schema.TaggedStruct<"ActorErasedError", {
3
+ readonly actor: Schema.String;
4
+ }>, import("effect/Cause").YieldableError & {
5
+ readonly brand: unique symbol;
6
+ }>;
7
+ export declare class ActorErasedError extends ActorErasedError_base {}
8
+ export {};
@@ -0,0 +1,4 @@
1
+ import { Schema } from "effect";
2
+ // src/contract/actor/actor-erased.errors.ts
3
+ var ActorErasedError = class extends Schema.TaggedError()("ActorErasedError", { actor: Schema.String }) {};
4
+ export { ActorErasedError };
@@ -0,0 +1,11 @@
1
+ import { ActorOptions, ReservedMember } from "./actor.contract.mjs";
2
+ /** Every name the actor object and its clients use, so no command or query may take one. */
3
+ declare const reservedMembers: readonly ReservedMember[];
4
+ interface Declaring<Options extends ActorOptions> {
5
+ readonly name: string;
6
+ readonly options: Options;
7
+ }
8
+ declare const rejectReserved: ({ name, options }: Declaring<ActorOptions>) => void;
9
+ /** A secret name no environment could set is a mistake in the declaration, refused where the actor is made. */
10
+ declare const rejectInvalidSecrets: ({ name, options }: Declaring<ActorOptions>) => void;
11
+ export { type Declaring, rejectInvalidSecrets, rejectReserved, reservedMembers };
@@ -0,0 +1,51 @@
1
+ import { ReservedMemberError } from "./reserved-member.errors.mjs";
2
+ import { InvalidSecretNameError } from "../secret/invalid-secret-name.errors.mjs";
3
+ import { SecretName } from "../secret/secret.schema.mjs";
4
+ import { Array, Option, Record, Schema } from "effect";
5
+ // src/contract/actor/actor-names.pure.ts
6
+ const isSecretName = Schema.is(SecretName);
7
+ /** Every name the actor object and its clients use, so no command or query may take one. */
8
+ const reservedMembers = [
9
+ "callers",
10
+ "client",
11
+ "commands",
12
+ "computer",
13
+ "create",
14
+ "ensure",
15
+ "files",
16
+ "fork",
17
+ "handlers",
18
+ "history",
19
+ "historyStream",
20
+ "initial",
21
+ "jobs",
22
+ "key",
23
+ "name",
24
+ "principal",
25
+ "queries",
26
+ "rpcs",
27
+ "secret",
28
+ "secrets",
29
+ "state",
30
+ "then",
31
+ "toLayer",
32
+ "update",
33
+ "warm"
34
+ ];
35
+ const rejectReserved = ({ name, options }) => {
36
+ const members = [...Record.keys(options.commands), ...Record.keys(options.queries ?? {})];
37
+ const reserved = Array.findFirst(members, (member) => Array.contains(reservedMembers, member));
38
+ if (Option.isSome(reserved)) throw ReservedMemberError.make({
39
+ actor: name,
40
+ member: reserved.value
41
+ });
42
+ };
43
+ /** A secret name no environment could set is a mistake in the declaration, refused where the actor is made. */
44
+ const rejectInvalidSecrets = ({ name, options }) => {
45
+ const invalid = Array.findFirst(options.secrets ?? [], (secret) => !isSecretName(secret));
46
+ if (Option.isSome(invalid)) throw InvalidSecretNameError.make({
47
+ actor: name,
48
+ secret: invalid.value
49
+ });
50
+ };
51
+ export { rejectInvalidSecrets, rejectReserved, reservedMembers };
@@ -0,0 +1,8 @@
1
+ import { Schema } from "effect";
2
+ declare const ActorNotCreatedError_base: Schema.Class<ActorNotCreatedError, Schema.TaggedStruct<"ActorNotCreatedError", {
3
+ readonly actor: Schema.String;
4
+ }>, import("effect/Cause").YieldableError & {
5
+ readonly brand: unique symbol;
6
+ }>;
7
+ export declare class ActorNotCreatedError extends ActorNotCreatedError_base {}
8
+ export {};
@@ -0,0 +1,4 @@
1
+ import { Schema } from "effect";
2
+ // src/contract/actor/actor-not-created.errors.ts
3
+ var ActorNotCreatedError = class extends Schema.TaggedError()("ActorNotCreatedError", { actor: Schema.String }) {};
4
+ export { ActorNotCreatedError };
@@ -0,0 +1,8 @@
1
+ import { Schema } from "effect";
2
+ declare const ActorNotRegisteredError_base: Schema.Class<ActorNotRegisteredError, Schema.TaggedStruct<"ActorNotRegisteredError", {
3
+ readonly actor: Schema.String;
4
+ }>, import("effect/Cause").YieldableError & {
5
+ readonly brand: unique symbol;
6
+ }>;
7
+ export declare class ActorNotRegisteredError extends ActorNotRegisteredError_base {}
8
+ export {};
@@ -0,0 +1,4 @@
1
+ import { Schema } from "effect";
2
+ // src/contract/actor/actor-not-registered.errors.ts
3
+ var ActorNotRegisteredError = class extends Schema.TaggedError()("ActorNotRegisteredError", { actor: Schema.String }) {};
4
+ export { ActorNotRegisteredError };
@@ -0,0 +1,16 @@
1
+ import { HostedActor } from "./actor.contract.mjs";
2
+ import { ActorNotRegisteredError } from "./actor-not-registered.errors.mjs";
3
+ import { Context, Effect, Layer } from "effect";
4
+ declare const ActorRegistry_base: Context.ServiceClass<ActorRegistry, "@akterjs/effect/contract/actor/actor-registry.service/ActorRegistry", {
5
+ readonly lookup: (name: string) => Effect.Effect<HostedActor, ActorNotRegisteredError>;
6
+ readonly register: (actor: HostedActor) => Effect.Effect<void>;
7
+ }> & {
8
+ readonly make: Effect.Effect<{
9
+ readonly lookup: (name: string) => Effect.Effect<HostedActor, ActorNotRegisteredError>;
10
+ readonly register: (actor: HostedActor) => Effect.Effect<void>;
11
+ }, never, never>;
12
+ };
13
+ export declare class ActorRegistry extends ActorRegistry_base {
14
+ static readonly layer: Layer.Layer<ActorRegistry, never, never>;
15
+ }
16
+ export {};
@@ -0,0 +1,21 @@
1
+ import { ActorNotRegisteredError } from "./actor-not-registered.errors.mjs";
2
+ import { Context, Effect, HashMap, Layer, Option, Ref } from "effect";
3
+ // src/contract/actor/actor-registry.service.ts
4
+ var ActorRegistry = class extends Context.Service()("@akterjs/effect/contract/actor/actor-registry.service/ActorRegistry", { make: Effect.gen(function* makeActorRegistry() {
5
+ const actors = yield* Ref.make(HashMap.empty());
6
+ const register = Effect.fn("ActorRegistry.register")(function* register(actor) {
7
+ yield* Ref.update(actors, HashMap.set(actor.name, actor));
8
+ });
9
+ return {
10
+ lookup: Effect.fn("ActorRegistry.lookup")(function* lookup(name) {
11
+ const current = yield* Ref.get(actors);
12
+ const found = HashMap.get(current, name);
13
+ if (Option.isNone(found)) return yield* ActorNotRegisteredError.make({ actor: name });
14
+ return found.value;
15
+ }),
16
+ register
17
+ };
18
+ }) }) {
19
+ static layer = Layer.effect(this, this.make);
20
+ };
21
+ export { ActorRegistry };