@astrale-os/sdk 0.6.0-beta.2 → 0.6.0-beta.21

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 (403) hide show
  1. package/README.md +74 -14
  2. package/dist/application/action/action.d.ts +6 -0
  3. package/dist/application/action/authoring.d.ts +1 -1
  4. package/dist/application/action/context.d.ts +17 -8
  5. package/dist/application/action/define.d.ts +3 -3
  6. package/dist/application/action/index.d.ts +1 -1
  7. package/dist/application/define.d.ts +5 -5
  8. package/dist/application/define.js +13 -13
  9. package/dist/application/dependency/index.d.ts +1 -1
  10. package/dist/application/dependency/invoker.d.ts +11 -6
  11. package/dist/application/domain.d.ts +28 -0
  12. package/dist/application/index.d.ts +3 -3
  13. package/dist/application/index.js +1 -1
  14. package/dist/application/mutation/authoring/properties.d.ts +5 -3
  15. package/dist/application/mutation/authoring/properties.js +35 -2
  16. package/dist/application/mutation/authoring/transition.js +4 -1
  17. package/dist/application/routes/admission.d.ts +2 -2
  18. package/dist/application/routes/admission.js +1 -1
  19. package/dist/application/routes/route.d.ts +2 -2
  20. package/dist/application/runtime/actions.js +3 -0
  21. package/dist/application/runtime/workflows.d.ts +2 -0
  22. package/dist/application/runtime/workflows.js +5 -0
  23. package/dist/application/workflow/authoring.d.ts +3 -2
  24. package/dist/application/workflow/context.d.ts +8 -2
  25. package/dist/application/workflow/define.d.ts +3 -3
  26. package/dist/application/workflow/define.js +19 -3
  27. package/dist/application/workflow/durable.d.ts +83 -0
  28. package/dist/application/workflow/index.d.ts +3 -2
  29. package/dist/application/workflow/runner/inline.js +3 -4
  30. package/dist/application/workflow/runner/runner.d.ts +2 -2
  31. package/dist/application/workflow/step/output.d.ts +2 -0
  32. package/dist/application/workflow/step/output.js +73 -0
  33. package/dist/application/workflow/workflow.d.ts +12 -0
  34. package/dist/deployment/adapter/adapter.d.ts +59 -11
  35. package/dist/deployment/adapter/bundle/bundle.d.ts +36 -0
  36. package/dist/deployment/adapter/bundle/file.d.ts +10 -0
  37. package/dist/deployment/adapter/bundle/index.d.ts +2 -0
  38. package/dist/deployment/adapter/define.d.ts +25 -3
  39. package/dist/deployment/adapter/define.js +101 -24
  40. package/dist/deployment/adapter/index.d.ts +6 -3
  41. package/dist/deployment/adapter/index.js +1 -0
  42. package/dist/deployment/adapter/legacy/adapter.d.ts +40 -0
  43. package/dist/deployment/adapter/{deploy → legacy/deploy}/context.d.ts +6 -2
  44. package/dist/deployment/adapter/legacy/deploy/index.d.ts +2 -0
  45. package/dist/deployment/adapter/legacy/deploy/index.js +1 -0
  46. package/dist/deployment/adapter/legacy/deploy/result.d.ts +89 -0
  47. package/dist/deployment/adapter/legacy/deploy/result.js +1 -0
  48. package/dist/deployment/adapter/legacy/index.d.ts +24 -0
  49. package/dist/deployment/adapter/legacy/index.js +1 -0
  50. package/dist/deployment/adapter/legacy/prepare/artifact.d.ts +43 -0
  51. package/dist/deployment/adapter/legacy/prepare/artifact.js +1 -0
  52. package/dist/deployment/adapter/legacy/prepare/context.d.ts +33 -0
  53. package/dist/deployment/adapter/legacy/prepare/context.js +1 -0
  54. package/dist/deployment/adapter/legacy/prepare/index.d.ts +2 -0
  55. package/dist/deployment/adapter/legacy/prepare/index.js +1 -0
  56. package/dist/deployment/adapter/release/context.d.ts +95 -0
  57. package/dist/deployment/adapter/release/context.js +1 -0
  58. package/dist/deployment/adapter/release/index.d.ts +3 -0
  59. package/dist/deployment/adapter/release/index.js +1 -0
  60. package/dist/deployment/adapter/release/list.d.ts +53 -0
  61. package/dist/deployment/adapter/release/list.js +1 -0
  62. package/dist/deployment/adapter/release/refusal.d.ts +10 -0
  63. package/dist/deployment/adapter/release/refusal.js +14 -0
  64. package/dist/deployment/adapter/release/result.d.ts +56 -0
  65. package/dist/deployment/adapter/release/result.js +1 -0
  66. package/dist/deployment/address/configuration.d.ts +83 -0
  67. package/dist/deployment/address/configuration.js +262 -0
  68. package/dist/deployment/address/fingerprint.d.ts +5 -0
  69. package/dist/deployment/address/fingerprint.js +27 -0
  70. package/dist/deployment/address/index.d.ts +5 -0
  71. package/dist/deployment/address/index.js +5 -0
  72. package/dist/deployment/address/label.d.ts +42 -0
  73. package/dist/deployment/address/label.js +80 -0
  74. package/dist/deployment/address/line.d.ts +29 -0
  75. package/dist/deployment/address/line.js +53 -0
  76. package/dist/deployment/address/record.d.ts +52 -0
  77. package/dist/deployment/address/record.js +104 -0
  78. package/dist/deployment/address/summary.d.ts +57 -0
  79. package/dist/deployment/address/summary.js +117 -0
  80. package/dist/deployment/address/vectors.d.ts +60 -0
  81. package/dist/deployment/address/vectors.js +517 -0
  82. package/dist/deployment/build/build.d.ts +2 -2
  83. package/dist/deployment/build/compile.d.ts +4 -4
  84. package/dist/deployment/build/compile.js +17 -17
  85. package/dist/deployment/build/index.d.ts +1 -0
  86. package/dist/deployment/build/index.js +1 -0
  87. package/dist/deployment/build/manifest.d.ts +59 -0
  88. package/dist/deployment/build/manifest.js +118 -0
  89. package/dist/deployment/build/material.js +2 -2
  90. package/dist/deployment/build/schema.d.ts +2 -2
  91. package/dist/deployment/deploy.d.ts +10 -10
  92. package/dist/deployment/deploy.js +3 -3
  93. package/dist/deployment/deployment.d.ts +9 -4
  94. package/dist/deployment/environment.d.ts +6 -0
  95. package/dist/deployment/environment.js +6 -0
  96. package/dist/deployment/index.d.ts +4 -4
  97. package/dist/deployment/index.js +1 -1
  98. package/dist/deployment/release/addressing.d.ts +9 -1
  99. package/dist/deployment/release/assemble.d.ts +6 -3
  100. package/dist/deployment/release/assemble.js +12 -10
  101. package/dist/deployment/release/index.d.ts +2 -0
  102. package/dist/deployment/release/index.js +2 -0
  103. package/dist/deployment/release/legacy/admission.d.ts +3 -0
  104. package/dist/deployment/release/legacy/admission.js +8 -0
  105. package/dist/deployment/release/legacy/assemble.d.ts +5 -0
  106. package/dist/deployment/release/legacy/assemble.js +20 -0
  107. package/dist/deployment/release/legacy/index.d.ts +35 -0
  108. package/dist/deployment/release/legacy/index.js +34 -0
  109. package/dist/deployment/release/legacy/release.d.ts +12 -0
  110. package/dist/deployment/release/legacy/release.js +1 -0
  111. package/dist/deployment/release/{publication → legacy}/seal.d.ts +3 -3
  112. package/dist/deployment/release/legacy/seal.js +17 -0
  113. package/dist/deployment/release/release.d.ts +16 -5
  114. package/dist/deployment/release/runtime.d.ts +2 -0
  115. package/dist/deployment/release/runtime.js +2 -0
  116. package/dist/deployment/release/seal.d.ts +14 -0
  117. package/dist/deployment/release/seal.js +22 -0
  118. package/dist/deployment/release/{publication → served}/callables.d.ts +2 -2
  119. package/dist/deployment/release/{publication → served}/callables.js +2 -2
  120. package/dist/deployment/release/served/index.d.ts +12 -0
  121. package/dist/deployment/release/served/index.js +22 -0
  122. package/dist/deployment/release/{publication → served}/views.d.ts +2 -2
  123. package/dist/deployment/runtime/admission.d.ts +2 -2
  124. package/dist/deployment/runtime/admission.js +5 -5
  125. package/dist/deployment/verify/index.d.ts +2 -1
  126. package/dist/deployment/verify/index.js +1 -0
  127. package/dist/deployment/verify/preflight/artifact.d.ts +1 -1
  128. package/dist/deployment/verify/preflight/bundle.d.ts +18 -0
  129. package/dist/deployment/verify/preflight/bundle.js +71 -0
  130. package/dist/deployment/verify/preflight/index.d.ts +2 -1
  131. package/dist/deployment/verify/preflight/index.js +1 -0
  132. package/dist/deployment/verify/preflight/publication.d.ts +2 -2
  133. package/dist/deployment/verify/preflight/publication.js +4 -3
  134. package/dist/deployment/verify/readiness/deployment.js +7 -15
  135. package/dist/deployment/verify/readiness/fetch.d.ts +13 -0
  136. package/dist/deployment/verify/readiness/fetch.js +26 -0
  137. package/dist/deployment/verify/readiness/identity.d.ts +3 -6
  138. package/dist/deployment/verify/readiness/identity.js +3 -3
  139. package/dist/deployment/verify/readiness/index.d.ts +11 -7
  140. package/dist/deployment/verify/readiness/index.js +15 -4
  141. package/dist/deployment/verify/readiness/legacy/index.d.ts +2 -0
  142. package/dist/deployment/verify/readiness/legacy/index.js +2 -0
  143. package/dist/deployment/verify/readiness/legacy/publication.d.ts +12 -0
  144. package/dist/deployment/verify/readiness/legacy/publication.js +23 -0
  145. package/dist/deployment/verify/readiness/release.d.ts +8 -0
  146. package/dist/deployment/verify/readiness/release.js +22 -0
  147. package/dist/execution/identity/authentication.d.ts +23 -2
  148. package/dist/execution/identity/authentication.js +64 -40
  149. package/dist/execution/identity/callback.d.ts +16 -15
  150. package/dist/execution/identity/callback.js +21 -16
  151. package/dist/execution/identity/delivery.d.ts +11 -4
  152. package/dist/execution/identity/delivery.js +47 -20
  153. package/dist/execution/identity/identity.d.ts +18 -3
  154. package/dist/execution/identity/identity.js +8 -4
  155. package/dist/execution/identity/jwks.js +57 -12
  156. package/dist/execution/index.d.ts +4 -2
  157. package/dist/execution/index.js +2 -1
  158. package/dist/execution/invocation/admission/authentication.d.ts +3 -8
  159. package/dist/execution/invocation/admission/authentication.js +10 -24
  160. package/dist/execution/invocation/admission/authority.d.ts +15 -8
  161. package/dist/execution/invocation/admission/authority.js +5 -0
  162. package/dist/execution/invocation/admission/input.d.ts +2 -2
  163. package/dist/execution/invocation/admission/input.js +16 -2
  164. package/dist/execution/invocation/dependency/bind.d.ts +1 -1
  165. package/dist/execution/invocation/dependency/bind.js +35 -14
  166. package/dist/execution/invocation/dispatch/context.d.ts +2 -1
  167. package/dist/execution/invocation/dispatch/context.js +1 -1
  168. package/dist/execution/invocation/invocation.js +58 -16
  169. package/dist/execution/invocation/result/project.js +41 -1
  170. package/dist/execution/node/serve.d.ts +2 -2
  171. package/dist/execution/node/serve.js +1 -1
  172. package/dist/execution/runtime/index.d.ts +1 -0
  173. package/dist/execution/runtime/index.js +1 -0
  174. package/dist/execution/runtime/load.d.ts +3 -3
  175. package/dist/execution/runtime/load.js +3 -2
  176. package/dist/execution/runtime/release.d.ts +22 -0
  177. package/dist/execution/runtime/release.js +14 -0
  178. package/dist/execution/serve.d.ts +10 -4
  179. package/dist/execution/serve.js +3 -0
  180. package/dist/execution/service/create.js +39 -7
  181. package/dist/execution/service/initialization.d.ts +4 -4
  182. package/dist/execution/service/initialization.js +23 -14
  183. package/dist/execution/service/release.d.ts +2 -2
  184. package/dist/execution/service/release.js +3 -2
  185. package/dist/execution/service/service.d.ts +15 -5
  186. package/dist/execution/service/serving/delivery.d.ts +6 -0
  187. package/dist/execution/service/{publication → serving}/delivery.js +5 -1
  188. package/dist/execution/service/{publication → serving}/index.d.ts +1 -1
  189. package/dist/execution/service/serving/installation.d.ts +4 -0
  190. package/dist/execution/service/serving/installation.js +9 -0
  191. package/dist/execution/service/serving/legacy/index.d.ts +15 -0
  192. package/dist/execution/service/serving/legacy/index.js +19 -0
  193. package/dist/execution/service/serving/source.d.ts +18 -0
  194. package/dist/execution/service/serving/source.js +19 -0
  195. package/dist/execution/workflows/discovery.d.ts +14 -0
  196. package/dist/execution/workflows/discovery.js +151 -0
  197. package/dist/execution/workflows/engine.d.ts +52 -0
  198. package/dist/execution/workflows/engine.js +1 -0
  199. package/dist/execution/workflows/envelope.d.ts +12 -0
  200. package/dist/execution/workflows/envelope.js +46 -0
  201. package/dist/execution/workflows/failure.d.ts +11 -0
  202. package/dist/execution/workflows/failure.js +43 -0
  203. package/dist/execution/workflows/index.d.ts +4 -0
  204. package/dist/execution/workflows/index.js +3 -0
  205. package/dist/execution/workflows/options.d.ts +40 -0
  206. package/dist/execution/workflows/options.js +83 -0
  207. package/dist/execution/workflows/receiver.d.ts +22 -0
  208. package/dist/execution/workflows/receiver.js +99 -0
  209. package/dist/execution/workflows/route.d.ts +14 -0
  210. package/dist/execution/workflows/route.js +40 -0
  211. package/dist/execution/workflows/run.d.ts +22 -0
  212. package/dist/execution/workflows/run.js +211 -0
  213. package/dist/index.d.ts +3 -3
  214. package/dist/index.js +1 -1
  215. package/dist/platform/release/index.d.ts +27 -0
  216. package/dist/platform/release/index.js +27 -0
  217. package/dist/platform/schema/index.d.ts +2 -1
  218. package/dist/platform/schema/property-input.d.ts +15 -0
  219. package/dist/platform/schema/property-input.js +1 -0
  220. package/dist/platform/schema/property.d.ts +5 -0
  221. package/dist/platform/versioning/dependents.d.ts +18 -0
  222. package/dist/platform/versioning/dependents.js +15 -0
  223. package/dist/platform/versioning/index.d.ts +5 -0
  224. package/dist/platform/versioning/index.js +5 -0
  225. package/dist/platform/versioning/name.d.ts +38 -0
  226. package/dist/platform/versioning/name.js +58 -0
  227. package/dist/platform/versioning/reference.d.ts +48 -0
  228. package/dist/platform/versioning/reference.js +95 -0
  229. package/dist/platform/versioning/version.d.ts +72 -0
  230. package/dist/platform/versioning/version.js +98 -0
  231. package/dist/project/admit.js +2 -2
  232. package/dist/project/define.d.ts +4 -4
  233. package/dist/project/define.js +55 -35
  234. package/dist/project/index.d.ts +1 -1
  235. package/dist/project/install-command.d.ts +10 -0
  236. package/dist/project/install-command.js +13 -0
  237. package/dist/project/project.d.ts +10 -8
  238. package/dist/testing/dataset/builder.d.ts +3 -3
  239. package/dist/testing/dataset/define.d.ts +1 -1
  240. package/dist/testing/load.js +1 -1
  241. package/dist/tooling/cli/arguments.d.ts +10 -5
  242. package/dist/tooling/cli/arguments.js +123 -52
  243. package/dist/tooling/cli/build.d.ts +55 -0
  244. package/dist/tooling/cli/build.js +77 -0
  245. package/dist/tooling/cli/bun.d.ts +0 -1
  246. package/dist/tooling/cli/bun.js +0 -7
  247. package/dist/tooling/cli/commit.d.ts +35 -0
  248. package/dist/tooling/cli/commit.js +235 -0
  249. package/dist/tooling/cli/deploy-mode.d.ts +82 -0
  250. package/dist/tooling/cli/deploy-mode.js +135 -0
  251. package/dist/tooling/cli/deploy-result.d.ts +85 -0
  252. package/dist/tooling/cli/deploy-result.js +64 -0
  253. package/dist/tooling/cli/diff/declared.d.ts +7 -0
  254. package/dist/tooling/cli/diff/declared.js +27 -0
  255. package/dist/tooling/cli/diff/index.d.ts +30 -0
  256. package/dist/tooling/cli/diff/index.js +58 -0
  257. package/dist/tooling/cli/diff/render.d.ts +15 -0
  258. package/dist/tooling/cli/diff/render.js +131 -0
  259. package/dist/tooling/cli/diff/report.d.ts +88 -0
  260. package/dist/tooling/cli/diff/report.js +154 -0
  261. package/dist/tooling/cli/dotenv.d.ts +2 -2
  262. package/dist/tooling/cli/dotenv.js +3 -33
  263. package/dist/tooling/cli/help.js +176 -59
  264. package/dist/tooling/cli/immutable-deployment.d.ts +83 -0
  265. package/dist/tooling/cli/immutable-deployment.js +135 -0
  266. package/dist/tooling/cli/index.d.ts +10 -4
  267. package/dist/tooling/cli/index.js +5 -3
  268. package/dist/tooling/cli/installed-on.d.ts +83 -0
  269. package/dist/tooling/cli/installed-on.js +156 -0
  270. package/dist/tooling/cli/legacy/deploy-result.d.ts +28 -0
  271. package/dist/tooling/cli/legacy/deploy-result.js +37 -0
  272. package/dist/tooling/cli/legacy/stable-target-adapter.d.ts +21 -0
  273. package/dist/tooling/cli/legacy/stable-target-adapter.js +14 -0
  274. package/dist/tooling/cli/legacy/stable-target-deploy.d.ts +40 -0
  275. package/dist/tooling/cli/legacy/stable-target-deploy.js +102 -0
  276. package/dist/tooling/cli/legacy/uploaded-build.d.ts +11 -0
  277. package/dist/tooling/cli/legacy/uploaded-build.js +22 -0
  278. package/dist/tooling/cli/list.d.ts +154 -0
  279. package/dist/tooling/cli/list.js +381 -0
  280. package/dist/tooling/cli/log.d.ts +5 -0
  281. package/dist/tooling/cli/log.js +9 -0
  282. package/dist/tooling/cli/orchestrate.d.ts +0 -6
  283. package/dist/tooling/cli/orchestrate.js +236 -88
  284. package/dist/tooling/cli/project.d.ts +3 -3
  285. package/dist/tooling/cli/publish/index.d.ts +73 -0
  286. package/dist/tooling/cli/publish/index.js +346 -0
  287. package/dist/tooling/cli/publish/report.d.ts +49 -0
  288. package/dist/tooling/cli/publish/report.js +15 -0
  289. package/dist/tooling/cli/registry/client.d.ts +114 -0
  290. package/dist/tooling/cli/registry/client.js +346 -0
  291. package/dist/tooling/cli/registry/error.d.ts +11 -0
  292. package/dist/tooling/cli/registry/error.js +17 -0
  293. package/dist/tooling/cli/registry/executable.d.ts +29 -0
  294. package/dist/tooling/cli/registry/executable.js +90 -0
  295. package/dist/tooling/cli/registry/index.d.ts +9 -0
  296. package/dist/tooling/cli/registry/index.js +8 -0
  297. package/dist/tooling/cli/registry/installations.d.ts +67 -0
  298. package/dist/tooling/cli/registry/installations.js +108 -0
  299. package/dist/tooling/cli/registry/process.d.ts +36 -0
  300. package/dist/tooling/cli/registry/process.js +119 -0
  301. package/dist/tooling/cli/secrets.d.ts +9 -0
  302. package/dist/tooling/cli/secrets.js +19 -0
  303. package/dist/tooling/cli/yank.d.ts +34 -0
  304. package/dist/tooling/cli/yank.js +32 -0
  305. package/dist/tooling/linter/implementations/source/callable-requirements.d.ts +1 -1
  306. package/dist/tooling/linter/implementations/source/callable-requirements.js +10 -10
  307. package/dist/tooling/linter/implementations/source/dependencies.js +12 -10
  308. package/dist/tooling/linter/implementations/source/global.js +1 -1
  309. package/dist/tooling/linter/implementations/source/mutations.js +17 -17
  310. package/dist/tooling/linter/implementations/source/providers.js +5 -5
  311. package/dist/tooling/linter/implementations/source/views.js +2 -2
  312. package/dist/tooling/linter/policy/generated.js +16 -16
  313. package/dist/tooling/packaging/declarations/ownership.js +1 -1
  314. package/dist/tooling/packaging/finalize.d.ts +1 -1
  315. package/dist/tooling/packaging/finalize.js +1 -1
  316. package/package.json +32 -11
  317. package/dist/application/application.d.ts +0 -28
  318. package/dist/deployment/adapter/deploy/index.d.ts +0 -2
  319. package/dist/deployment/adapter/deploy/result.d.ts +0 -50
  320. package/dist/deployment/adapter/prepare/artifact.d.ts +0 -33
  321. package/dist/deployment/adapter/prepare/context.d.ts +0 -23
  322. package/dist/deployment/adapter/prepare/index.d.ts +0 -2
  323. package/dist/deployment/release/publication/index.d.ts +0 -6
  324. package/dist/deployment/release/publication/index.js +0 -6
  325. package/dist/deployment/release/publication/manifest.d.ts +0 -3
  326. package/dist/deployment/release/publication/manifest.js +0 -5
  327. package/dist/deployment/release/publication/requirements.d.ts +0 -3
  328. package/dist/deployment/release/publication/requirements.js +0 -3
  329. package/dist/deployment/release/publication/seal.js +0 -39
  330. package/dist/deployment/verify/readiness/publication.d.ts +0 -11
  331. package/dist/deployment/verify/readiness/publication.js +0 -41
  332. package/dist/execution/service/publication/delivery.d.ts +0 -2
  333. package/dist/execution/service/publication/installation.d.ts +0 -3
  334. package/dist/execution/service/publication/installation.js +0 -8
  335. package/dist/execution/service/publication/source.d.ts +0 -3
  336. package/dist/execution/service/publication/source.js +0 -11
  337. package/dist/platform/publication/index.d.ts +0 -2
  338. package/dist/platform/publication/index.js +0 -2
  339. package/dist/tooling/cli/astrale/authority.d.ts +0 -5
  340. package/dist/tooling/cli/astrale/authority.js +0 -11
  341. package/dist/tooling/cli/astrale/executable.d.ts +0 -2
  342. package/dist/tooling/cli/astrale/executable.js +0 -47
  343. package/dist/tooling/cli/astrale/failure.d.ts +0 -6
  344. package/dist/tooling/cli/astrale/failure.js +0 -48
  345. package/dist/tooling/cli/astrale/instance.d.ts +0 -11
  346. package/dist/tooling/cli/astrale/instance.js +0 -52
  347. package/dist/tooling/cli/astrale/process.d.ts +0 -13
  348. package/dist/tooling/cli/astrale/process.js +0 -94
  349. package/dist/tooling/cli/astrale/version.d.ts +0 -18
  350. package/dist/tooling/cli/astrale/version.js +0 -55
  351. package/dist/tooling/cli/credential.d.ts +0 -2
  352. package/dist/tooling/cli/credential.js +0 -57
  353. package/dist/tooling/cli/development/candidate.d.ts +0 -25
  354. package/dist/tooling/cli/development/candidate.js +0 -176
  355. package/dist/tooling/cli/development/deployment.d.ts +0 -16
  356. package/dist/tooling/cli/development/deployment.js +0 -39
  357. package/dist/tooling/cli/development/develop.d.ts +0 -11
  358. package/dist/tooling/cli/development/develop.js +0 -243
  359. package/dist/tooling/cli/development/lease.d.ts +0 -18
  360. package/dist/tooling/cli/development/lease.js +0 -163
  361. package/dist/tooling/cli/development/lifecycle.d.ts +0 -9
  362. package/dist/tooling/cli/development/lifecycle.js +0 -43
  363. package/dist/tooling/cli/development/project-imports.d.ts +0 -22
  364. package/dist/tooling/cli/development/project-imports.js +0 -39
  365. package/dist/tooling/cli/development/project-lock.d.ts +0 -16
  366. package/dist/tooling/cli/development/project-lock.js +0 -41
  367. package/dist/tooling/cli/development/rebuild.d.ts +0 -13
  368. package/dist/tooling/cli/development/rebuild.js +0 -58
  369. package/dist/tooling/cli/development/release-evidence.d.ts +0 -4
  370. package/dist/tooling/cli/development/release-evidence.js +0 -10
  371. package/dist/tooling/cli/development/report.d.ts +0 -6
  372. package/dist/tooling/cli/development/report.js +0 -14
  373. package/dist/tooling/cli/development/session-file.d.ts +0 -53
  374. package/dist/tooling/cli/development/session-file.js +0 -337
  375. package/dist/tooling/cli/development/source-watch.d.ts +0 -14
  376. package/dist/tooling/cli/development/source-watch.js +0 -140
  377. package/dist/tooling/cli/development/sources.d.ts +0 -7
  378. package/dist/tooling/cli/development/sources.js +0 -48
  379. package/dist/tooling/cli/development/target-lock.d.ts +0 -16
  380. package/dist/tooling/cli/development/target-lock.js +0 -68
  381. package/dist/tooling/cli/development/view.d.ts +0 -28
  382. package/dist/tooling/cli/development/view.js +0 -151
  383. package/dist/tooling/cli/environment-release.d.ts +0 -21
  384. package/dist/tooling/cli/environment-release.js +0 -46
  385. package/dist/tooling/cli/evidence.d.ts +0 -11
  386. package/dist/tooling/cli/evidence.js +0 -53
  387. package/dist/tooling/cli/installation/index.d.ts +0 -2
  388. package/dist/tooling/cli/installation/index.js +0 -1
  389. package/dist/tooling/cli/installation/observation.d.ts +0 -10
  390. package/dist/tooling/cli/installation/observation.js +0 -44
  391. package/dist/tooling/cli/installation/reconcile.d.ts +0 -32
  392. package/dist/tooling/cli/installation/reconcile.js +0 -122
  393. /package/dist/application/{application.js → domain.js} +0 -0
  394. /package/dist/{deployment/adapter/deploy/context.js → application/workflow/durable.js} +0 -0
  395. /package/dist/deployment/adapter/{deploy/index.js → bundle/bundle.js} +0 -0
  396. /package/dist/deployment/adapter/{deploy/result.js → bundle/file.js} +0 -0
  397. /package/dist/deployment/adapter/{prepare → bundle}/index.js +0 -0
  398. /package/dist/deployment/adapter/{prepare/artifact.js → legacy/adapter.js} +0 -0
  399. /package/dist/deployment/adapter/{prepare → legacy/deploy}/context.js +0 -0
  400. /package/dist/deployment/release/{publication → served}/routes.d.ts +0 -0
  401. /package/dist/deployment/release/{publication → served}/routes.js +0 -0
  402. /package/dist/deployment/release/{publication → served}/views.js +0 -0
  403. /package/dist/execution/service/{publication → serving}/index.js +0 -0
@@ -0,0 +1,43 @@
1
+ import { declaredErrorFactory, declaredErrorOf } from '../../application/error/index.js';
2
+ /** Metadata key the Kernel reads a declared failure from (`backend/restate` outcome decoding). */
3
+ const FAILURE = 'astrale.failure';
4
+ const STATUS = {
5
+ VALIDATION_ERROR: 422,
6
+ NOT_FOUND: 404,
7
+ CONFLICT: 409,
8
+ UNSUPPORTED: 422,
9
+ };
10
+ /**
11
+ * Encode a declared business error of `definition` as a terminal engine failure, or return
12
+ * undefined for any other error, which the engine retries.
13
+ */
14
+ export function terminalFailure(engine, cause, definition) {
15
+ const declared = declaredErrorOf(cause, definition);
16
+ if (declared === undefined)
17
+ return undefined;
18
+ return new engine.TerminalError(declared.message, {
19
+ errorCode: STATUS[declared.family],
20
+ metadata: {
21
+ [FAILURE]: JSON.stringify({
22
+ family: declared.family,
23
+ code: declared.code,
24
+ message: declared.message,
25
+ details: declared.details,
26
+ }),
27
+ },
28
+ });
29
+ }
30
+ /**
31
+ * The declared business error a journaled Step failed with, rebuilt through the definition's own
32
+ * factory, so a replay throws what the live run threw.
33
+ */
34
+ export function replayedFailure(engine, cause, definition) {
35
+ if (!(cause instanceof engine.TerminalError) || cause instanceof engine.CancelledError) {
36
+ return undefined;
37
+ }
38
+ const encoded = cause.metadata?.[FAILURE];
39
+ if (encoded === undefined)
40
+ return undefined;
41
+ const failure = JSON.parse(encoded);
42
+ return declaredErrorFactory(definition)(failure.code, failure.details);
43
+ }
@@ -0,0 +1,4 @@
1
+ export type { DurableEngine, EngineRetryPolicy, EngineSharedContext, EngineWorkflowContext, EngineWorkflowDefinition, } from './engine.js';
2
+ export { durableServing, type AdmittedDurableServing, type DurableServing, type DurableServingProvider, } from './options.js';
3
+ export { createDurableReceiver, type DurableReceiver } from './receiver.js';
4
+ export { isDurableRequest, isCanonicalDurableRequest, isLegacyDurableRequest } from './route.js';
@@ -0,0 +1,3 @@
1
+ export { durableServing, } from './options.js';
2
+ export { createDurableReceiver } from './receiver.js';
3
+ export { isDurableRequest, isCanonicalDurableRequest, isLegacyDurableRequest } from './route.js';
@@ -0,0 +1,40 @@
1
+ import type { Fetch } from '@astrale-os/kernel-client';
2
+ import type { DurableEngine, EngineRetryPolicy } from './engine.js';
3
+ /** Serving configuration of the durable Workflows of one deployment. */
4
+ export interface DurableServing {
5
+ /** The Restate SDK Fetch build of this platform. */
6
+ readonly engine: DurableEngine;
7
+ /**
8
+ * @deprecated Explicit signing authority for retained callbacks registered before issuer-prefixed
9
+ * paths. Canonical requests discover their authority from the named Kernel and ignore these keys.
10
+ */
11
+ readonly identityKeys?: readonly string[];
12
+ /** Fetch capability used for HTTPS discovery of a canonical request's Kernel engine. */
13
+ readonly fetch?: Fetch;
14
+ /**
15
+ * How long the engine retains a finished run. At least the Host minimum (one hour or more, one
16
+ * day by default); the Kernel resubmits an unstarted call only within half of it. Seven days by
17
+ * default.
18
+ */
19
+ readonly retentionMs?: number;
20
+ /** Attempts of a failing run before it pauses for `resume` or `cancel`. The Host caps them. */
21
+ readonly retry?: {
22
+ readonly maxAttempts?: number;
23
+ readonly initialIntervalMs?: number;
24
+ readonly maxIntervalMs?: number;
25
+ };
26
+ /** Deadline of one Step, including its Kernel calls. One minute by default. */
27
+ readonly stepTimeoutMs?: number;
28
+ }
29
+ /** Resolve a deployment's engine only when its durable receiver is first requested. */
30
+ export type DurableServingProvider = (request: Request) => DurableServing | undefined | Promise<DurableServing | undefined>;
31
+ export interface AdmittedDurableServing {
32
+ readonly engine: DurableEngine;
33
+ readonly identityKeys: readonly string[];
34
+ readonly fetch: Fetch;
35
+ readonly retentionMs: number;
36
+ readonly retryPolicy: EngineRetryPolicy;
37
+ readonly stepTimeoutMs: number;
38
+ }
39
+ /** Capture one durable serving configuration, failing closed on any gap. */
40
+ export declare function durableServing(input: DurableServing): AdmittedDurableServing;
@@ -0,0 +1,83 @@
1
+ import { acceptWorkflowEngineIdentityKey } from '@astrale-os/kernel-protocol/issuer/workflow-engine';
2
+ const HOUR_MS = 60 * 60_000;
3
+ const DAY_MS = 24 * HOUR_MS;
4
+ const MAXIMUM_IDENTITY_KEYS = 16;
5
+ /** Capture one durable serving configuration, failing closed on any gap. */
6
+ export function durableServing(input) {
7
+ if (input === null ||
8
+ typeof input !== 'object' ||
9
+ Array.isArray(input) ||
10
+ Reflect.ownKeys(input).some((key) => key !== 'engine' &&
11
+ key !== 'identityKeys' &&
12
+ key !== 'fetch' &&
13
+ key !== 'retentionMs' &&
14
+ key !== 'retry' &&
15
+ key !== 'stepTimeoutMs')) {
16
+ invalid('Durable serving options are invalid.');
17
+ }
18
+ const engine = input.engine;
19
+ if (engine === null ||
20
+ typeof engine !== 'object' ||
21
+ typeof engine.createEndpointHandler !== 'function' ||
22
+ typeof engine.workflow !== 'function' ||
23
+ typeof engine.TerminalError !== 'function' ||
24
+ typeof engine.CancelledError !== 'function') {
25
+ invalid('Durable serving requires the Restate SDK Fetch entrypoint of this platform.');
26
+ }
27
+ const keys = input.identityKeys;
28
+ let identityKeys = Object.freeze([]);
29
+ if (keys !== undefined) {
30
+ if (!Array.isArray(keys) || keys.length === 0 || keys.length > MAXIMUM_IDENTITY_KEYS) {
31
+ invalid('Durable serving requires engine request identity keys (publickeyv1_…).');
32
+ }
33
+ // Legacy callbacks retain their original sixteen-key input budget and duplicate policy.
34
+ try {
35
+ identityKeys = Object.freeze(Array.from(keys, acceptWorkflowEngineIdentityKey));
36
+ }
37
+ catch (cause) {
38
+ throw new TypeError('Durable serving requires engine request identity keys (publickeyv1_…).', { cause });
39
+ }
40
+ }
41
+ const fetch = input.fetch ?? globalThis.fetch.bind(globalThis);
42
+ if (typeof fetch !== 'function')
43
+ invalid('Durable serving requires Fetch for engine discovery.');
44
+ const retry = input.retry ?? {};
45
+ if (retry === null ||
46
+ typeof retry !== 'object' ||
47
+ Array.isArray(retry) ||
48
+ Reflect.ownKeys(retry).some((key) => key !== 'maxAttempts' && key !== 'initialIntervalMs' && key !== 'maxIntervalMs')) {
49
+ invalid('Durable retry options are invalid.');
50
+ }
51
+ const initialInterval = bounded(retry.initialIntervalMs, 1_000, 1, HOUR_MS, 'initialIntervalMs');
52
+ const maxInterval = bounded(retry.maxIntervalMs, 60_000, initialInterval, DAY_MS, 'maxIntervalMs');
53
+ return Object.freeze({
54
+ engine: Object.freeze({
55
+ createEndpointHandler: engine.createEndpointHandler.bind(engine),
56
+ workflow: engine.workflow.bind(engine),
57
+ TerminalError: engine.TerminalError,
58
+ CancelledError: engine.CancelledError,
59
+ }),
60
+ identityKeys,
61
+ fetch,
62
+ retentionMs: bounded(input.retentionMs, 7 * DAY_MS, HOUR_MS, 365 * DAY_MS, 'retentionMs'),
63
+ retryPolicy: Object.freeze({
64
+ maxAttempts: bounded(retry.maxAttempts, 20, 1, 1_000, 'maxAttempts'),
65
+ onMaxAttempts: 'pause',
66
+ initialInterval,
67
+ maxInterval,
68
+ exponentiationFactor: 2,
69
+ }),
70
+ stepTimeoutMs: bounded(input.stepTimeoutMs, 60_000, 1_000, HOUR_MS, 'stepTimeoutMs'),
71
+ });
72
+ }
73
+ function bounded(input, fallback, minimum, maximum, label) {
74
+ if (input === undefined)
75
+ return fallback;
76
+ if (!Number.isSafeInteger(input) || input < minimum || input > maximum) {
77
+ invalid(`Durable ${label} must be an integer between ${minimum} and ${maximum}.`);
78
+ }
79
+ return input;
80
+ }
81
+ function invalid(message) {
82
+ throw new TypeError(message);
83
+ }
@@ -0,0 +1,22 @@
1
+ import type { RuntimeWorkflow } from '../../application/runtime/workflows.js';
2
+ import type { Domain } from '../../platform/schema/index.js';
3
+ import type { Identity } from '../identity/index.js';
4
+ import type { AdmittedDurableServing } from './options.js';
5
+ /** Serves the engine's discovery and invocations of this deployment's durable Workflows. */
6
+ export interface DurableReceiver {
7
+ fetch(request: Request): Promise<Response>;
8
+ }
9
+ /**
10
+ * Route `…/invoke/restate/<Kernel issuer>/<declaration key>/<service>/{discover,invoke/…}` to one
11
+ * engine endpoint. Retained services registered before issuer-prefixed paths keep their old
12
+ * `<declaration key>/<service>` route with explicit legacy signing keys. Canonical routes discover
13
+ * their signing authority at the named Kernel; that issuer also binds the run envelope. Each
14
+ * endpoint serves exactly that service with the declared Workflow. A declaration this Release does not
15
+ * serve durably is refused, so an endpoint never runs code it does not declare.
16
+ */
17
+ export declare function createDurableReceiver(input: {
18
+ readonly workflows: readonly RuntimeWorkflow[];
19
+ readonly domain: Domain;
20
+ readonly identity: Identity;
21
+ readonly serving: AdmittedDurableServing;
22
+ }): DurableReceiver;
@@ -0,0 +1,99 @@
1
+ import { workflowEngineDiscovery, WorkflowEngineUnavailable } from './discovery.js';
2
+ import { durableRoute } from './route.js';
3
+ import { durableHandlers } from './run.js';
4
+ const MAXIMUM_ENDPOINTS = 256;
5
+ /**
6
+ * Route `…/invoke/restate/<Kernel issuer>/<declaration key>/<service>/{discover,invoke/…}` to one
7
+ * engine endpoint. Retained services registered before issuer-prefixed paths keep their old
8
+ * `<declaration key>/<service>` route with explicit legacy signing keys. Canonical routes discover
9
+ * their signing authority at the named Kernel; that issuer also binds the run envelope. Each
10
+ * endpoint serves exactly that service with the declared Workflow. A declaration this Release does not
11
+ * serve durably is refused, so an endpoint never runs code it does not declare.
12
+ */
13
+ export function createDurableReceiver(input) {
14
+ const executor = input.identity.executor;
15
+ if (executor === undefined) {
16
+ throw new TypeError('Durable Workflows require an execution Identity that can act as the Domain.');
17
+ }
18
+ const bound = executor.bind(input.identity);
19
+ const declared = new Map(input.workflows
20
+ .filter((workflow) => workflow.durable)
21
+ .map((workflow) => [workflow.callable.key, workflow]));
22
+ const endpoints = new Map();
23
+ const { engine } = input.serving;
24
+ const discovery = workflowEngineDiscovery(input.serving.fetch);
25
+ return Object.freeze({
26
+ async fetch(request) {
27
+ const route = durableRoute(request);
28
+ if (route === undefined)
29
+ return refused();
30
+ const { kernel, declaration, service } = route;
31
+ const workflow = declared.get(declaration);
32
+ if (workflow === undefined)
33
+ return refused();
34
+ let identityKeys = input.serving.identityKeys;
35
+ if (kernel !== undefined) {
36
+ try {
37
+ identityKeys = (await discovery.resolve(kernel)).identity_keys;
38
+ }
39
+ catch (cause) {
40
+ if (!(cause instanceof WorkflowEngineUnavailable))
41
+ throw cause;
42
+ return unavailable();
43
+ }
44
+ }
45
+ else if (identityKeys.length === 0)
46
+ return refused();
47
+ request.signal.throwIfAborted();
48
+ const cacheKey = JSON.stringify([kernel ?? null, declaration, service, identityKeys]);
49
+ let endpoint = endpoints.get(cacheKey);
50
+ if (endpoint === undefined) {
51
+ const definition = engine.workflow({
52
+ name: service,
53
+ handlers: durableHandlers({
54
+ workflow,
55
+ domain: input.domain,
56
+ executor: bound,
57
+ serving: input.serving,
58
+ ...(kernel === undefined ? {} : { kernel }),
59
+ }),
60
+ options: {
61
+ workflowRetention: input.serving.retentionMs,
62
+ retryPolicy: input.serving.retryPolicy,
63
+ },
64
+ });
65
+ try {
66
+ endpoint = engine.createEndpointHandler({
67
+ identityKeys: [...identityKeys],
68
+ services: [definition],
69
+ });
70
+ }
71
+ catch (cause) {
72
+ if (kernel === undefined)
73
+ throw cause;
74
+ discovery.forget(kernel, identityKeys);
75
+ return unavailable();
76
+ }
77
+ if (endpoints.size >= MAXIMUM_ENDPOINTS)
78
+ endpoints.delete(endpoints.keys().next().value);
79
+ endpoints.set(cacheKey, endpoint);
80
+ }
81
+ const response = await endpoint(request);
82
+ if (kernel !== undefined && response.status === 401)
83
+ discovery.invalidate(kernel, identityKeys);
84
+ return response;
85
+ },
86
+ });
87
+ }
88
+ function refused() {
89
+ return new Response('{"error":"Unknown durable declaration."}', {
90
+ status: 404,
91
+ headers: { 'content-type': 'application/json', 'cache-control': 'no-store' },
92
+ });
93
+ }
94
+ function unavailable() {
95
+ return new Response('{"error":"Workflow engine authority is unavailable."}', {
96
+ status: 503,
97
+ headers: { 'content-type': 'application/json', 'cache-control': 'no-store' },
98
+ });
99
+ }
@@ -0,0 +1,14 @@
1
+ import type { IssuerId } from '../../platform/auth/index.js';
2
+ export interface DurableRoute {
3
+ readonly kernel?: IssuerId;
4
+ readonly declaration: string;
5
+ readonly service: string;
6
+ }
7
+ /** Whether the request is owned by the durable receiver, including malformed paths. */
8
+ export declare function isDurableRequest(request: Request): boolean;
9
+ /** Canonical requests discover authority at the HTTPS Kernel named by this admitted route. */
10
+ export declare function isCanonicalDurableRequest(request: Request): boolean;
11
+ /** Retained callbacks need explicit legacy signing authority before an engine module is loaded. */
12
+ export declare function isLegacyDurableRequest(request: Request): boolean;
13
+ /** One wire decoder shared by the receiver and platform lazy-load eligibility. */
14
+ export declare function durableRoute(request: Request): DurableRoute | undefined;
@@ -0,0 +1,40 @@
1
+ import { Key } from '@astrale-os/kernel-dsl/v1/addressing';
2
+ import { invocationPath } from '../../deployment/release/invocation.js';
3
+ import { AuthValueError } from '../../platform/auth/index.js';
4
+ import { httpIssuer } from '../identity/errors.js';
5
+ const PREFIX = `${invocationPath()}/restate/`;
6
+ const SERVICE = /^[A-Za-z_][A-Za-z0-9_]{0,127}$/u;
7
+ /** Whether the request is owned by the durable receiver, including malformed paths. */
8
+ export function isDurableRequest(request) {
9
+ return new URL(request.url).pathname.startsWith(PREFIX);
10
+ }
11
+ /** Canonical requests discover authority at the HTTPS Kernel named by this admitted route. */
12
+ export function isCanonicalDurableRequest(request) {
13
+ return durableRoute(request)?.kernel !== undefined;
14
+ }
15
+ /** Retained callbacks need explicit legacy signing authority before an engine module is loaded. */
16
+ export function isLegacyDurableRequest(request) {
17
+ const route = durableRoute(request);
18
+ return route !== undefined && route.kernel === undefined;
19
+ }
20
+ /** One wire decoder shared by the receiver and platform lazy-load eligibility. */
21
+ export function durableRoute(request) {
22
+ const pathname = new URL(request.url).pathname;
23
+ if (!pathname.startsWith(PREFIX))
24
+ return undefined;
25
+ const parts = pathname.slice(PREFIX.length).split('/');
26
+ try {
27
+ const first = decodeURIComponent(parts[0] ?? '');
28
+ const kernel = Key.is(first) ? undefined : httpIssuer(first, false);
29
+ const declaration = kernel === undefined ? first : decodeURIComponent(parts[1] ?? '');
30
+ const service = parts[kernel === undefined ? 1 : 2] ?? '';
31
+ if (!Key.is(declaration) || !SERVICE.test(service))
32
+ return undefined;
33
+ return Object.freeze({ ...(kernel === undefined ? {} : { kernel }), declaration, service });
34
+ }
35
+ catch (cause) {
36
+ if (cause instanceof URIError || cause instanceof AuthValueError || cause instanceof TypeError)
37
+ return undefined;
38
+ throw cause;
39
+ }
40
+ }
@@ -0,0 +1,22 @@
1
+ import type { RuntimeWorkflow } from '../../application/runtime/workflows.js';
2
+ import type { IssuerId } from '../../platform/auth/index.js';
3
+ import type { Domain } from '../../platform/schema/index.js';
4
+ import type { Identity } from '../identity/index.js';
5
+ import type { EngineSharedContext, EngineWorkflowContext } from './engine.js';
6
+ import type { AdmittedDurableServing } from './options.js';
7
+ type Executor = NonNullable<Identity['executor']>;
8
+ export interface DurableRun {
9
+ readonly kernel?: IssuerId;
10
+ readonly workflow: RuntimeWorkflow;
11
+ readonly domain: Domain;
12
+ readonly executor: Executor;
13
+ readonly serving: AdmittedDurableServing;
14
+ }
15
+ /** Engine handlers of one durable Workflow: the `run` and the shared `signal`. */
16
+ export declare function durableHandlers(input: DurableRun): Readonly<{
17
+ run: (context: EngineWorkflowContext, raw: unknown) => Promise<import("../../platform/schema/index.js").Value>;
18
+ signal(context: EngineSharedContext, raw: unknown): Promise<{
19
+ accepted: boolean;
20
+ }>;
21
+ }>;
22
+ export {};
@@ -0,0 +1,211 @@
1
+ import { declaredErrorFactory } from '../../application/error/index.js';
2
+ import { bindMutation } from '../../application/mutation/execution/executor.js';
3
+ import { bindQuery } from '../../application/query/execution/executor.js';
4
+ import { acceptStepId } from '../../application/workflow/step/index.js';
5
+ import { acceptStepOutput } from '../../application/workflow/step/output.js';
6
+ import { ResponseError } from '../../platform/client/index.js';
7
+ import { bindSession, execution as executionMethods } from '../../platform/client/session/index.js';
8
+ import { validateOutput } from '../invocation/result/index.js';
9
+ import { decodeEnvelope } from './envelope.js';
10
+ import { replayedFailure, terminalFailure } from './failure.js';
11
+ /** Token of a Workflow that declares none. */
12
+ const DEFAULT_COMPAT = '0';
13
+ const MAXIMUM_SLEEP_MS = 365 * 24 * 60 * 60_000;
14
+ const MAXIMUM_PROMISE_NAME = 128;
15
+ /** Bounds of one `result` wait and of the durable pause between two of them. */
16
+ const AWAIT_WAIT_MS = 10_000;
17
+ const AWAIT_MAXIMUM_PAUSE_MS = 5 * 60_000;
18
+ /** Engine handlers of one durable Workflow: the `run` and the shared `signal`. */
19
+ export function durableHandlers(input) {
20
+ const { engine } = input.serving;
21
+ return Object.freeze({
22
+ run: (context, raw) => run(input, context, raw),
23
+ async signal(context, raw) {
24
+ const request = signalRequest(raw);
25
+ try {
26
+ await context.promise(request.name).resolve(request.value);
27
+ return { accepted: true };
28
+ }
29
+ catch (cause) {
30
+ // The engine refuses to resolve a promise twice with a terminal failure.
31
+ if (cause instanceof engine.TerminalError)
32
+ return { accepted: false };
33
+ throw cause;
34
+ }
35
+ },
36
+ });
37
+ }
38
+ async function run(input, context, raw) {
39
+ const { workflow, serving } = input;
40
+ const { engine } = serving;
41
+ const definition = workflow.definition;
42
+ // Journaled first. A redeployment that changed the token cannot replay this run: it fails every
43
+ // attempt with this reason until the engine pauses it, then `resume` on compatible code or cancel.
44
+ const token = definition.compat ?? DEFAULT_COMPAT;
45
+ const recorded = await context.run('compat', async () => token);
46
+ if (recorded !== token) {
47
+ throw new Error(`Workflow ${workflow.address} started under compat token ${JSON.stringify(recorded)}; ` +
48
+ `this deployment declares ${JSON.stringify(token)}.`);
49
+ }
50
+ // Code that cannot read what the Kernel recorded pauses the run the same way.
51
+ const envelope = admitted(workflow, raw, input.kernel);
52
+ const durable = durableContext(input, context, envelope);
53
+ let output;
54
+ try {
55
+ output = await definition.run(durable);
56
+ }
57
+ catch (cause) {
58
+ throw terminalFailure(engine, cause, definition) ?? cause;
59
+ }
60
+ return validateOutput(workflow.callable, output);
61
+ }
62
+ function admitted(workflow, raw, kernel) {
63
+ const envelope = decodeEnvelope(raw);
64
+ if (kernel !== undefined && envelope.execution.kernel !== kernel) {
65
+ throw new TypeError('Durable envelope Kernel differs from its authenticated endpoint.');
66
+ }
67
+ const diagnostics = workflow.callable.validateInput(envelope.input);
68
+ if (diagnostics.length > 0) {
69
+ throw new TypeError(`Workflow ${workflow.address} cannot read the recorded input.`);
70
+ }
71
+ const instance = 'static' in workflow.callable && workflow.callable.static === false;
72
+ if (instance !== (envelope.execution.receiver !== undefined)) {
73
+ throw new TypeError(`Workflow ${workflow.address} cannot use the recorded receiver.`);
74
+ }
75
+ return envelope;
76
+ }
77
+ function durableContext(input, context, envelope) {
78
+ const { serving, domain, workflow } = input;
79
+ const { engine } = serving;
80
+ const definition = workflow.definition;
81
+ const execution = envelope.execution;
82
+ const signal = context.request().attemptCompletedSignal;
83
+ const steps = new Set();
84
+ /** One journaled unit of work acting as the Domain, with keys derived from its name. */
85
+ const journal = (name, execute) => Promise.resolve(context.run(name, async () => {
86
+ const deadline = Date.now() + serving.stepTimeoutMs;
87
+ const session = input.executor(execution.kernel, execution.id, { deadline, signal });
88
+ try {
89
+ const kernel = keyed(bindSessionOf(session, deadline, signal), await keySequence(execution.id, name));
90
+ const output = await execute(Object.freeze({
91
+ kernel,
92
+ query: bindQuery(kernel, domain),
93
+ mutate: bindMutation(kernel, domain),
94
+ }));
95
+ try {
96
+ return acceptStepOutput(output);
97
+ }
98
+ catch (cause) {
99
+ throw new TypeError(`Workflow ${name} output must be portable.`, { cause });
100
+ }
101
+ }
102
+ catch (cause) {
103
+ throw terminalFailure(engine, cause, definition) ?? cause;
104
+ }
105
+ finally {
106
+ session.close();
107
+ }
108
+ })).catch((cause) => {
109
+ throw replayedFailure(engine, cause, definition) ?? cause;
110
+ });
111
+ const step = (id, execute) => {
112
+ let accepted;
113
+ try {
114
+ accepted = acceptStepId(id);
115
+ if (steps.has(accepted))
116
+ throw new TypeError(`Workflow Step ${accepted} occurs more than once.`);
117
+ }
118
+ catch (cause) {
119
+ return Promise.reject(cause);
120
+ }
121
+ steps.add(accepted);
122
+ return journal(`step:${accepted}`, execute);
123
+ };
124
+ return Object.freeze({
125
+ domain,
126
+ input: envelope.input,
127
+ execution,
128
+ error: declaredErrorFactory(definition),
129
+ step: Object.freeze({
130
+ run: step,
131
+ mutate: (id, mutation, value) => step(id, (authority) => authority.mutate(mutation, value)),
132
+ }),
133
+ async sleep(durationMs) {
134
+ if (!Number.isSafeInteger(durationMs) || durationMs < 0 || durationMs > MAXIMUM_SLEEP_MS) {
135
+ throw new TypeError(`Durable sleep must be an integer between 0 and ${MAXIMUM_SLEEP_MS} ms.`);
136
+ }
137
+ await context.sleep(durationMs);
138
+ },
139
+ async promise(name) {
140
+ if (typeof name !== 'string' || name.length === 0 || name.length > MAXIMUM_PROMISE_NAME) {
141
+ throw new TypeError('Durable promise name must have 1 to 128 characters.');
142
+ }
143
+ return (await context.promise(name).get());
144
+ },
145
+ cancelled: (error) => error instanceof engine.CancelledError,
146
+ async awaitExecution(target) {
147
+ for (let poll = 1;; poll++) {
148
+ const polled = await journal(`await:${target.id}:${poll}`, async ({ kernel }) => {
149
+ try {
150
+ const outcome = await kernel.invoke(executionMethods.result(target), {
151
+ waitMs: Math.min(AWAIT_WAIT_MS, Math.floor(serving.stepTimeoutMs / 2)),
152
+ });
153
+ return { ended: true, outcome };
154
+ }
155
+ catch (cause) {
156
+ if (cause instanceof ResponseError && cause.reason?.code === 'EXECUTION_PENDING') {
157
+ return { ended: false };
158
+ }
159
+ throw cause;
160
+ }
161
+ });
162
+ if (polled.ended)
163
+ return polled.outcome;
164
+ await context.sleep(Math.min(AWAIT_MAXIMUM_PAUSE_MS, 1_000 * 2 ** Math.min(poll, 16)));
165
+ }
166
+ },
167
+ ...(execution.receiver === undefined ? {} : { self: execution.receiver }),
168
+ });
169
+ }
170
+ function bindSessionOf(session, deadline, signal) {
171
+ return bindSession(session, { deadline, signal });
172
+ }
173
+ /**
174
+ * Every `invoke` and Mutation of one Step without its own key carries the next key of the Step's
175
+ * sequence. The sequence restarts with every attempt, so a retried Step replays the same keys and
176
+ * the Kernel answers with the first outcome, or `IDEMPOTENCY_KEY_CONFLICT` if the request changed.
177
+ */
178
+ function keyed(session, next) {
179
+ const invokeSource = session.invoke;
180
+ const mutateSource = session.mutate;
181
+ const invoke = ((reference, value, options) => invokeSource(reference, value, withKey(options, next)));
182
+ const mutate = ((author, options) => mutateSource(author, withKey(options, next)));
183
+ return Object.freeze({ ...session, invoke, mutate });
184
+ }
185
+ function withKey(options, next) {
186
+ if (options?.idempotencyKey !== undefined || options?.body !== undefined)
187
+ return options;
188
+ return { ...options, idempotencyKey: next() };
189
+ }
190
+ async function keySequence(execution, name) {
191
+ const digest = new Uint8Array(await crypto.subtle.digest('SHA-256', new TextEncoder().encode(name)));
192
+ const prefix = `${execution}.${Array.from(digest.subarray(0, 12), hex).join('')}`;
193
+ let position = 0;
194
+ return () => `${prefix}.${++position}`;
195
+ }
196
+ function hex(byte) {
197
+ return byte.toString(16).padStart(2, '0');
198
+ }
199
+ function signalRequest(input) {
200
+ if (input === null ||
201
+ typeof input !== 'object' ||
202
+ Array.isArray(input) ||
203
+ typeof input.name !== 'string') {
204
+ throw new TypeError('Durable signal request is invalid.');
205
+ }
206
+ const { name, value } = input;
207
+ if (name.length === 0 || name.length > MAXIMUM_PROMISE_NAME) {
208
+ throw new TypeError('Durable signal name must have 1 to 128 characters.');
209
+ }
210
+ return { name, value: value ?? null };
211
+ }
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /** Curated SDK authoring journey. Semantic values remain available from focused subpaths. */
2
2
  export { defineAction } from './application/action/index.js';
3
3
  export type { Action, ActionContext, ActionOutputOf, Caller, DeclaredErrorDefinition, DeclaredErrorFactory, DeclaredErrorFamily, DeclaredErrorOptions, DeclaredErrors, } from './application/action/index.js';
4
- export { defineApplication, defineFrontend, external, requirements, route, routes, vite, } from './application/index.js';
5
- export type { Application, Frontend, Requirements, Route, Routes } from './application/index.js';
4
+ export { defineDomain, defineFrontend, external, requirements, route, routes, vite, } from './application/index.js';
5
+ export type { DomainDefinition, Frontend, Requirements, Route, Routes, } from './application/index.js';
6
6
  export { defineIntegration, defineProvider } from './application/integration/index.js';
7
7
  export type { IntegrationClient, IntegrationDefinition, Provider, } from './application/integration/index.js';
8
8
  export { defineMutation, executeMutation } from './application/mutation/index.js';
@@ -18,4 +18,4 @@ export type { Build, Deployment, Release } from './deployment/index.js';
18
18
  export { defineProject } from './project/index.js';
19
19
  export type { Project } from './project/index.js';
20
20
  export { serve } from './execution/index.js';
21
- export type { ServedApplication } from './execution/index.js';
21
+ export type { ServedDomain } from './execution/index.js';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /** Curated SDK authoring journey. Semantic values remain available from focused subpaths. */
2
2
  export { defineAction } from './application/action/index.js';
3
- export { defineApplication, defineFrontend, external, requirements, route, routes, vite, } from './application/index.js';
3
+ export { defineDomain, defineFrontend, external, requirements, route, routes, vite, } from './application/index.js';
4
4
  export { defineIntegration, defineProvider } from './application/integration/index.js';
5
5
  export { defineMutation, executeMutation } from './application/mutation/index.js';
6
6
  export { defineCollectionQuery, defineCompositeQuery, defineQuery, executeQuery, } from './application/query/index.js';
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Canonical `DomainRelease` v4 wire contract and admission owned by the Astrale platform: the
3
+ * document a deployment serves at `release.json`, its release digest and `ReleaseRef`.
4
+ */
5
+ export * from '@astrale-os/kernel-protocol/release';
6
+ /**
7
+ * The Kernel's Publication v2/v3 codec (`@astrale-os/kernel-protocol/release/legacy`): `accept`,
8
+ * `seal`, `encode`, `url`/`PATH`, the bundle helpers, `PublicationError` and Delivery v1, which
9
+ * stable targets and pre-v4 Kernels still serve and read.
10
+ *
11
+ * @deprecated Read and seal `DomainRelease` v4 with this module's root exports.
12
+ *
13
+ * Short-term consumers, which took it from the removed `@astrale-os/sdk/publication`:
14
+ * - cli `src/lib/domain-publication.ts` and its test (C1a: `accept`, `PATH`, `PublicationError`);
15
+ * - admin `domain/providers/http-publication/resolver.ts`,
16
+ * `domain/providers/remote-kernel/instance-gateway.ts`,
17
+ * `domain/providers/scaleway/machine-provider.ts`, `domain/scripts/admin-bootstrap/cli.ts`,
18
+ * `domain/scripts/e2e/install-domain-set.ts`, their tests and two `worker/src` tests, which also
19
+ * seal v2/v3 fixtures (A10a);
20
+ * - domains issues `tests/deployment/archived-errors.test.ts` (SV16).
21
+ *
22
+ * Removal, in a breaking SDK release: once those consumers no longer import it (the CLI and Admin
23
+ * read `release.json`), at the latest with the Kernel folder it re-exports, which the Kernel
24
+ * removes once no supported Kernel predates v4, no installation pins a v2/v3 document and no
25
+ * stable Worker serves one (D10).
26
+ */
27
+ export { legacy } from '@astrale-os/kernel-protocol/release';