@xemahq/xema 0.14.0 → 0.15.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 (418) hide show
  1. package/README.md +23 -2
  2. package/dist/assets/appliance-base/distribution.lock.json +5144 -0
  3. package/dist/assets/appliance-base/images.lock.json +1706 -0
  4. package/dist/assets/appliance-lean/distribution.lock.json +2888 -0
  5. package/dist/assets/appliance-lean/images.lock.json +1229 -0
  6. package/dist/assets/boot-graph.json +339 -29
  7. package/dist/assets/cloud/distribution.lock.json +5278 -0
  8. package/dist/assets/cloud/images.lock.json +1713 -0
  9. package/dist/assets/core/distribution.lock.json +1802 -125
  10. package/dist/assets/core/images.lock.json +1175 -235
  11. package/dist/assets/distribution-assets.manifest.json +147 -0
  12. package/dist/assets/keycloak/realm-xema.json +412 -0
  13. package/dist/assets/minimal/distribution.lock.json +2710 -0
  14. package/dist/assets/minimal/images.lock.json +1149 -0
  15. package/dist/assets/oss/distribution.lock.json +2438 -226
  16. package/dist/assets/oss/images.lock.json +1502 -618
  17. package/dist/assets/starter/distribution.lock.json +3422 -0
  18. package/dist/assets/starter/images.lock.json +1404 -0
  19. package/dist/cli.d.ts.map +1 -1
  20. package/dist/cli.js +4 -0
  21. package/dist/cli.js.map +1 -1
  22. package/dist/commands/apply.js +1 -1
  23. package/dist/commands/apply.js.map +1 -1
  24. package/dist/commands/biome.d.ts.map +1 -1
  25. package/dist/commands/biome.js +84 -7
  26. package/dist/commands/biome.js.map +1 -1
  27. package/dist/commands/canopy.js +1 -1
  28. package/dist/commands/canopy.js.map +1 -1
  29. package/dist/commands/dev.d.ts.map +1 -1
  30. package/dist/commands/dev.js +27 -5
  31. package/dist/commands/dev.js.map +1 -1
  32. package/dist/commands/dist.d.ts +13 -0
  33. package/dist/commands/dist.d.ts.map +1 -1
  34. package/dist/commands/dist.js +50 -10
  35. package/dist/commands/dist.js.map +1 -1
  36. package/dist/commands/doctor.d.ts +25 -0
  37. package/dist/commands/doctor.d.ts.map +1 -1
  38. package/dist/commands/doctor.js +422 -18
  39. package/dist/commands/doctor.js.map +1 -1
  40. package/dist/commands/down.d.ts +10 -0
  41. package/dist/commands/down.d.ts.map +1 -1
  42. package/dist/commands/down.js +81 -41
  43. package/dist/commands/down.js.map +1 -1
  44. package/dist/commands/export.js +1 -1
  45. package/dist/commands/export.js.map +1 -1
  46. package/dist/commands/import.js +1 -1
  47. package/dist/commands/import.js.map +1 -1
  48. package/dist/commands/init.d.ts.map +1 -1
  49. package/dist/commands/init.js +56 -3
  50. package/dist/commands/init.js.map +1 -1
  51. package/dist/commands/installation.d.ts.map +1 -1
  52. package/dist/commands/installation.js +169 -12
  53. package/dist/commands/installation.js.map +1 -1
  54. package/dist/commands/license.d.ts +3 -0
  55. package/dist/commands/license.d.ts.map +1 -0
  56. package/dist/commands/license.js +97 -0
  57. package/dist/commands/license.js.map +1 -0
  58. package/dist/commands/login.d.ts +4 -0
  59. package/dist/commands/login.d.ts.map +1 -0
  60. package/dist/commands/login.js +127 -0
  61. package/dist/commands/login.js.map +1 -0
  62. package/dist/commands/logs.d.ts +21 -0
  63. package/dist/commands/logs.d.ts.map +1 -1
  64. package/dist/commands/logs.js +131 -22
  65. package/dist/commands/logs.js.map +1 -1
  66. package/dist/commands/objects.js +2 -2
  67. package/dist/commands/objects.js.map +1 -1
  68. package/dist/commands/plan.js +1 -1
  69. package/dist/commands/plan.js.map +1 -1
  70. package/dist/commands/run.js +1 -1
  71. package/dist/commands/run.js.map +1 -1
  72. package/dist/commands/serve.d.ts.map +1 -1
  73. package/dist/commands/serve.js +39 -6
  74. package/dist/commands/serve.js.map +1 -1
  75. package/dist/commands/shell.js +1 -1
  76. package/dist/commands/shell.js.map +1 -1
  77. package/dist/commands/up.d.ts.map +1 -1
  78. package/dist/commands/up.js +20 -5
  79. package/dist/commands/up.js.map +1 -1
  80. package/dist/dev/env-defaults.d.ts +1 -0
  81. package/dist/dev/env-defaults.d.ts.map +1 -1
  82. package/dist/dev/env-defaults.js +15 -6
  83. package/dist/dev/env-defaults.js.map +1 -1
  84. package/dist/dev/forked-worker-bootstrap-protocol.d.ts +17 -0
  85. package/dist/dev/forked-worker-bootstrap-protocol.d.ts.map +1 -0
  86. package/dist/dev/forked-worker-bootstrap-protocol.js +35 -0
  87. package/dist/dev/forked-worker-bootstrap-protocol.js.map +1 -0
  88. package/dist/dev/forked-worker-bootstrap.d.ts +18 -0
  89. package/dist/dev/forked-worker-bootstrap.d.ts.map +1 -0
  90. package/dist/dev/forked-worker-bootstrap.js +84 -0
  91. package/dist/dev/forked-worker-bootstrap.js.map +1 -0
  92. package/dist/dev/forked-worker.d.ts +14 -0
  93. package/dist/dev/forked-worker.d.ts.map +1 -1
  94. package/dist/dev/forked-worker.js +200 -33
  95. package/dist/dev/forked-worker.js.map +1 -1
  96. package/dist/lib/control-plane.d.ts +5 -1
  97. package/dist/lib/control-plane.d.ts.map +1 -1
  98. package/dist/lib/control-plane.js +56 -6
  99. package/dist/lib/control-plane.js.map +1 -1
  100. package/dist/runtime/asset-provenance.d.ts +17 -0
  101. package/dist/runtime/asset-provenance.d.ts.map +1 -0
  102. package/dist/runtime/asset-provenance.js +29 -0
  103. package/dist/runtime/asset-provenance.js.map +1 -0
  104. package/dist/runtime/auth/client-bootstrap.d.ts +11 -0
  105. package/dist/runtime/auth/client-bootstrap.d.ts.map +1 -0
  106. package/dist/runtime/auth/client-bootstrap.js +60 -0
  107. package/dist/runtime/auth/client-bootstrap.js.map +1 -0
  108. package/dist/runtime/auth/device-flow.d.ts +43 -0
  109. package/dist/runtime/auth/device-flow.d.ts.map +1 -0
  110. package/dist/runtime/auth/device-flow.js +201 -0
  111. package/dist/runtime/auth/device-flow.js.map +1 -0
  112. package/dist/runtime/auth/session-auth.d.ts +8 -0
  113. package/dist/runtime/auth/session-auth.d.ts.map +1 -0
  114. package/dist/runtime/auth/session-auth.js +43 -0
  115. package/dist/runtime/auth/session-auth.js.map +1 -0
  116. package/dist/runtime/auth/session-store.d.ts +19 -0
  117. package/dist/runtime/auth/session-store.d.ts.map +1 -0
  118. package/dist/runtime/auth/session-store.js +83 -0
  119. package/dist/runtime/auth/session-store.js.map +1 -0
  120. package/dist/runtime/auth/token-claims.d.ts +2 -0
  121. package/dist/runtime/auth/token-claims.d.ts.map +1 -0
  122. package/dist/runtime/auth/token-claims.js +45 -0
  123. package/dist/runtime/auth/token-claims.js.map +1 -0
  124. package/dist/runtime/biome-provenance.d.ts +26 -0
  125. package/dist/runtime/biome-provenance.d.ts.map +1 -0
  126. package/dist/runtime/biome-provenance.js +70 -0
  127. package/dist/runtime/biome-provenance.js.map +1 -0
  128. package/dist/runtime/biome-publish.d.ts +14 -0
  129. package/dist/runtime/biome-publish.d.ts.map +1 -1
  130. package/dist/runtime/biome-publish.js +69 -5
  131. package/dist/runtime/biome-publish.js.map +1 -1
  132. package/dist/runtime/biome-scaffold.d.ts.map +1 -1
  133. package/dist/runtime/biome-scaffold.js +0 -2
  134. package/dist/runtime/biome-scaffold.js.map +1 -1
  135. package/dist/runtime/biome-validate.d.ts.map +1 -1
  136. package/dist/runtime/biome-validate.js +4 -2
  137. package/dist/runtime/biome-validate.js.map +1 -1
  138. package/dist/runtime/cleanup.d.ts +10 -0
  139. package/dist/runtime/cleanup.d.ts.map +1 -0
  140. package/dist/runtime/cleanup.js +35 -0
  141. package/dist/runtime/cleanup.js.map +1 -0
  142. package/dist/runtime/config/init-presets.d.ts.map +1 -1
  143. package/dist/runtime/config/init-presets.js +6 -3
  144. package/dist/runtime/config/init-presets.js.map +1 -1
  145. package/dist/runtime/distribution/available-biome.d.ts.map +1 -1
  146. package/dist/runtime/distribution/available-biome.js +2 -0
  147. package/dist/runtime/distribution/available-biome.js.map +1 -1
  148. package/dist/runtime/distribution/compose.d.ts +2 -1
  149. package/dist/runtime/distribution/compose.d.ts.map +1 -1
  150. package/dist/runtime/distribution/compose.js +1 -0
  151. package/dist/runtime/distribution/compose.js.map +1 -1
  152. package/dist/runtime/env-seeder.d.ts.map +1 -1
  153. package/dist/runtime/env-seeder.js +44 -13
  154. package/dist/runtime/env-seeder.js.map +1 -1
  155. package/dist/runtime/foreground.d.ts +6 -1
  156. package/dist/runtime/foreground.d.ts.map +1 -1
  157. package/dist/runtime/foreground.js +30 -7
  158. package/dist/runtime/foreground.js.map +1 -1
  159. package/dist/runtime/infra/infra-catalog.d.ts +33 -1
  160. package/dist/runtime/infra/infra-catalog.d.ts.map +1 -1
  161. package/dist/runtime/infra/infra-catalog.js +201 -10
  162. package/dist/runtime/infra/infra-catalog.js.map +1 -1
  163. package/dist/runtime/infra/infra-environment.d.ts +10 -0
  164. package/dist/runtime/infra/infra-environment.d.ts.map +1 -0
  165. package/dist/runtime/infra/infra-environment.js +76 -0
  166. package/dist/runtime/infra/infra-environment.js.map +1 -0
  167. package/dist/runtime/infra/infra-plan.d.ts +2 -1
  168. package/dist/runtime/infra/infra-plan.d.ts.map +1 -1
  169. package/dist/runtime/infra/infra-plan.js +10 -0
  170. package/dist/runtime/infra/infra-plan.js.map +1 -1
  171. package/dist/runtime/infra/infra-runner.d.ts +12 -2
  172. package/dist/runtime/infra/infra-runner.d.ts.map +1 -1
  173. package/dist/runtime/infra/infra-runner.js +194 -73
  174. package/dist/runtime/infra/infra-runner.js.map +1 -1
  175. package/dist/runtime/infra/keycloak-realm.d.ts +25 -0
  176. package/dist/runtime/infra/keycloak-realm.d.ts.map +1 -0
  177. package/dist/runtime/infra/keycloak-realm.js +116 -0
  178. package/dist/runtime/infra/keycloak-realm.js.map +1 -0
  179. package/dist/runtime/infra/postgres-endpoint.d.ts +8 -0
  180. package/dist/runtime/infra/postgres-endpoint.d.ts.map +1 -0
  181. package/dist/runtime/infra/postgres-endpoint.js +21 -0
  182. package/dist/runtime/infra/postgres-endpoint.js.map +1 -0
  183. package/dist/runtime/installation/compiler.d.ts +104 -27
  184. package/dist/runtime/installation/compiler.d.ts.map +1 -1
  185. package/dist/runtime/installation/compiler.js +361 -95
  186. package/dist/runtime/installation/compiler.js.map +1 -1
  187. package/dist/runtime/installation/contract.d.ts +234 -63
  188. package/dist/runtime/installation/contract.d.ts.map +1 -1
  189. package/dist/runtime/installation/contract.js +396 -74
  190. package/dist/runtime/installation/contract.js.map +1 -1
  191. package/dist/runtime/installation/current-launcher-renderer.d.ts +12 -0
  192. package/dist/runtime/installation/current-launcher-renderer.d.ts.map +1 -0
  193. package/dist/runtime/installation/current-launcher-renderer.js +123 -0
  194. package/dist/runtime/installation/current-launcher-renderer.js.map +1 -0
  195. package/dist/runtime/installation/diff.d.ts +15 -0
  196. package/dist/runtime/installation/diff.d.ts.map +1 -1
  197. package/dist/runtime/installation/diff.js +66 -29
  198. package/dist/runtime/installation/diff.js.map +1 -1
  199. package/dist/runtime/installation/format.js +4 -4
  200. package/dist/runtime/installation/format.js.map +1 -1
  201. package/dist/runtime/installation/from-current-config.d.ts +3 -2
  202. package/dist/runtime/installation/from-current-config.d.ts.map +1 -1
  203. package/dist/runtime/installation/from-current-config.js +214 -44
  204. package/dist/runtime/installation/from-current-config.js.map +1 -1
  205. package/dist/runtime/installation/helm-release-readiness.d.ts +9 -0
  206. package/dist/runtime/installation/helm-release-readiness.d.ts.map +1 -0
  207. package/dist/runtime/installation/helm-release-readiness.js +97 -0
  208. package/dist/runtime/installation/helm-release-readiness.js.map +1 -0
  209. package/dist/runtime/installation/helm-release.d.ts +24 -0
  210. package/dist/runtime/installation/helm-release.d.ts.map +1 -0
  211. package/dist/runtime/installation/helm-release.js +96 -0
  212. package/dist/runtime/installation/helm-release.js.map +1 -0
  213. package/dist/runtime/installation/index.d.ts +9 -0
  214. package/dist/runtime/installation/index.d.ts.map +1 -1
  215. package/dist/runtime/installation/index.js +9 -0
  216. package/dist/runtime/installation/index.js.map +1 -1
  217. package/dist/runtime/installation/json-schema.d.ts +4 -0
  218. package/dist/runtime/installation/json-schema.d.ts.map +1 -0
  219. package/dist/runtime/installation/json-schema.js +16 -0
  220. package/dist/runtime/installation/json-schema.js.map +1 -0
  221. package/dist/runtime/installation/kubernetes-readiness.d.ts +60 -0
  222. package/dist/runtime/installation/kubernetes-readiness.d.ts.map +1 -0
  223. package/dist/runtime/installation/kubernetes-readiness.js +384 -0
  224. package/dist/runtime/installation/kubernetes-readiness.js.map +1 -0
  225. package/dist/runtime/installation/lifecycle.d.ts +6 -4
  226. package/dist/runtime/installation/lifecycle.d.ts.map +1 -1
  227. package/dist/runtime/installation/lifecycle.js +94 -7
  228. package/dist/runtime/installation/lifecycle.js.map +1 -1
  229. package/dist/runtime/installation/readiness-proof.d.ts +72 -0
  230. package/dist/runtime/installation/readiness-proof.d.ts.map +1 -0
  231. package/dist/runtime/installation/readiness-proof.js +142 -0
  232. package/dist/runtime/installation/readiness-proof.js.map +1 -0
  233. package/dist/runtime/installation/readiness.d.ts +21 -0
  234. package/dist/runtime/installation/readiness.d.ts.map +1 -0
  235. package/dist/runtime/installation/readiness.js +418 -0
  236. package/dist/runtime/installation/readiness.js.map +1 -0
  237. package/dist/runtime/installation/setup-profile.d.ts +8 -0
  238. package/dist/runtime/installation/setup-profile.d.ts.map +1 -0
  239. package/dist/runtime/installation/setup-profile.js +41 -0
  240. package/dist/runtime/installation/setup-profile.js.map +1 -0
  241. package/dist/runtime/installation/setup-renderer.d.ts +31 -0
  242. package/dist/runtime/installation/setup-renderer.d.ts.map +1 -0
  243. package/dist/runtime/installation/setup-renderer.js +238 -0
  244. package/dist/runtime/installation/setup-renderer.js.map +1 -0
  245. package/dist/runtime/installation/state-store.d.ts +11 -3
  246. package/dist/runtime/installation/state-store.d.ts.map +1 -1
  247. package/dist/runtime/installation/state-store.js +157 -37
  248. package/dist/runtime/installation/state-store.js.map +1 -1
  249. package/dist/runtime/installation/status.d.ts +6 -12
  250. package/dist/runtime/installation/status.d.ts.map +1 -1
  251. package/dist/runtime/installation/status.js +28 -114
  252. package/dist/runtime/installation/status.js.map +1 -1
  253. package/dist/runtime/installation/support-bundle.d.ts.map +1 -1
  254. package/dist/runtime/installation/support-bundle.js +18 -3
  255. package/dist/runtime/installation/support-bundle.js.map +1 -1
  256. package/dist/runtime/installation/to-current-config.d.ts +4 -0
  257. package/dist/runtime/installation/to-current-config.d.ts.map +1 -0
  258. package/dist/runtime/installation/to-current-config.js +171 -0
  259. package/dist/runtime/installation/to-current-config.js.map +1 -0
  260. package/dist/runtime/installation/validation.d.ts.map +1 -1
  261. package/dist/runtime/installation/validation.js +78 -0
  262. package/dist/runtime/installation/validation.js.map +1 -1
  263. package/dist/runtime/installation/validators/common.d.ts.map +1 -1
  264. package/dist/runtime/installation/validators/common.js +7 -4
  265. package/dist/runtime/installation/validators/common.js.map +1 -1
  266. package/dist/runtime/installation/validators/infrastructure.d.ts.map +1 -1
  267. package/dist/runtime/installation/validators/infrastructure.js +20 -2
  268. package/dist/runtime/installation/validators/infrastructure.js.map +1 -1
  269. package/dist/runtime/installation/validators/operational.d.ts.map +1 -1
  270. package/dist/runtime/installation/validators/operational.js +44 -102
  271. package/dist/runtime/installation/validators/operational.js.map +1 -1
  272. package/dist/runtime/installation/validators/profile.d.ts.map +1 -1
  273. package/dist/runtime/installation/validators/profile.js +53 -51
  274. package/dist/runtime/installation/validators/profile.js.map +1 -1
  275. package/dist/runtime/installation/validators/secrets.d.ts.map +1 -1
  276. package/dist/runtime/installation/validators/secrets.js +44 -27
  277. package/dist/runtime/installation/validators/secrets.js.map +1 -1
  278. package/dist/runtime/launch.d.ts +10 -0
  279. package/dist/runtime/launch.d.ts.map +1 -1
  280. package/dist/runtime/launch.js +123 -18
  281. package/dist/runtime/launch.js.map +1 -1
  282. package/dist/runtime/license/license-clock.d.ts +12 -0
  283. package/dist/runtime/license/license-clock.d.ts.map +1 -0
  284. package/dist/runtime/license/license-clock.js +57 -0
  285. package/dist/runtime/license/license-clock.js.map +1 -0
  286. package/dist/runtime/license/license-report.d.ts +19 -0
  287. package/dist/runtime/license/license-report.d.ts.map +1 -0
  288. package/dist/runtime/license/license-report.js +105 -0
  289. package/dist/runtime/license/license-report.js.map +1 -0
  290. package/dist/runtime/license/license-store.d.ts +5 -0
  291. package/dist/runtime/license/license-store.d.ts.map +1 -0
  292. package/dist/runtime/license/license-store.js +11 -0
  293. package/dist/runtime/license/license-store.js.map +1 -0
  294. package/dist/runtime/license/registry-credential.d.ts +26 -0
  295. package/dist/runtime/license/registry-credential.d.ts.map +1 -0
  296. package/dist/runtime/license/registry-credential.js +94 -0
  297. package/dist/runtime/license/registry-credential.js.map +1 -0
  298. package/dist/runtime/license/resolve-license.d.ts +30 -0
  299. package/dist/runtime/license/resolve-license.d.ts.map +1 -0
  300. package/dist/runtime/license/resolve-license.js +73 -0
  301. package/dist/runtime/license/resolve-license.js.map +1 -0
  302. package/dist/runtime/license/store-license.d.ts +18 -0
  303. package/dist/runtime/license/store-license.d.ts.map +1 -0
  304. package/dist/runtime/license/store-license.js +26 -0
  305. package/dist/runtime/license/store-license.js.map +1 -0
  306. package/dist/runtime/lock-loader.d.ts +3 -6
  307. package/dist/runtime/lock-loader.d.ts.map +1 -1
  308. package/dist/runtime/lock-loader.js +26 -20
  309. package/dist/runtime/lock-loader.js.map +1 -1
  310. package/dist/runtime/native-process-group.d.ts +46 -0
  311. package/dist/runtime/native-process-group.d.ts.map +1 -0
  312. package/dist/runtime/native-process-group.js +390 -0
  313. package/dist/runtime/native-process-group.js.map +1 -0
  314. package/dist/runtime/paths.d.ts +1 -0
  315. package/dist/runtime/paths.d.ts.map +1 -1
  316. package/dist/runtime/paths.js +1 -0
  317. package/dist/runtime/paths.js.map +1 -1
  318. package/dist/runtime/roster.d.ts +4 -3
  319. package/dist/runtime/roster.d.ts.map +1 -1
  320. package/dist/runtime/roster.js +17 -5
  321. package/dist/runtime/roster.js.map +1 -1
  322. package/dist/runtime/run-manifest.d.ts +34 -5
  323. package/dist/runtime/run-manifest.d.ts.map +1 -1
  324. package/dist/runtime/run-manifest.js +434 -120
  325. package/dist/runtime/run-manifest.js.map +1 -1
  326. package/dist/runtime/runner/container-preflight.d.ts +77 -0
  327. package/dist/runtime/runner/container-preflight.d.ts.map +1 -0
  328. package/dist/runtime/runner/container-preflight.js +360 -0
  329. package/dist/runtime/runner/container-preflight.js.map +1 -0
  330. package/dist/runtime/runner/container-runner.d.ts +8 -0
  331. package/dist/runtime/runner/container-runner.d.ts.map +1 -1
  332. package/dist/runtime/runner/container-runner.js +93 -16
  333. package/dist/runtime/runner/container-runner.js.map +1 -1
  334. package/dist/runtime/runner/docker-cli.d.ts +30 -2
  335. package/dist/runtime/runner/docker-cli.d.ts.map +1 -1
  336. package/dist/runtime/runner/docker-cli.js +275 -11
  337. package/dist/runtime/runner/docker-cli.js.map +1 -1
  338. package/dist/runtime/runner/health-probe.d.ts +1 -0
  339. package/dist/runtime/runner/health-probe.d.ts.map +1 -1
  340. package/dist/runtime/runner/health-probe.js +3 -2
  341. package/dist/runtime/runner/health-probe.js.map +1 -1
  342. package/dist/runtime/runner/helm-cli.d.ts +19 -1
  343. package/dist/runtime/runner/helm-cli.d.ts.map +1 -1
  344. package/dist/runtime/runner/helm-cli.js +76 -8
  345. package/dist/runtime/runner/helm-cli.js.map +1 -1
  346. package/dist/runtime/runner/helm-runner.d.ts +3 -0
  347. package/dist/runtime/runner/helm-runner.d.ts.map +1 -1
  348. package/dist/runtime/runner/helm-runner.js +23 -7
  349. package/dist/runtime/runner/helm-runner.js.map +1 -1
  350. package/dist/runtime/runner/host-platform.d.ts +39 -0
  351. package/dist/runtime/runner/host-platform.d.ts.map +1 -0
  352. package/dist/runtime/runner/host-platform.js +136 -0
  353. package/dist/runtime/runner/host-platform.js.map +1 -0
  354. package/dist/runtime/runner/kube-cli.d.ts +23 -0
  355. package/dist/runtime/runner/kube-cli.d.ts.map +1 -0
  356. package/dist/runtime/runner/kube-cli.js +112 -0
  357. package/dist/runtime/runner/kube-cli.js.map +1 -0
  358. package/dist/runtime/runner/native-runner.d.ts.map +1 -1
  359. package/dist/runtime/runner/native-runner.js +27 -3
  360. package/dist/runtime/runner/native-runner.js.map +1 -1
  361. package/dist/runtime/runner/service-runner.d.ts +5 -0
  362. package/dist/runtime/runner/service-runner.d.ts.map +1 -1
  363. package/dist/runtime/runner/service-runner.js.map +1 -1
  364. package/dist/runtime/runner/stream-outcome.d.ts +7 -0
  365. package/dist/runtime/runner/stream-outcome.d.ts.map +1 -0
  366. package/dist/runtime/runner/stream-outcome.js +13 -0
  367. package/dist/runtime/runner/stream-outcome.js.map +1 -0
  368. package/dist/runtime/secrets/managed-local-cipher.d.ts +18 -0
  369. package/dist/runtime/secrets/managed-local-cipher.d.ts.map +1 -0
  370. package/dist/runtime/secrets/managed-local-cipher.js +110 -0
  371. package/dist/runtime/secrets/managed-local-cipher.js.map +1 -0
  372. package/dist/runtime/secrets/managed-local-files.d.ts +4 -0
  373. package/dist/runtime/secrets/managed-local-files.d.ts.map +1 -0
  374. package/dist/runtime/secrets/managed-local-files.js +132 -0
  375. package/dist/runtime/secrets/managed-local-files.js.map +1 -0
  376. package/dist/runtime/secrets/managed-local-key-provider.d.ts +27 -0
  377. package/dist/runtime/secrets/managed-local-key-provider.d.ts.map +1 -0
  378. package/dist/runtime/secrets/managed-local-key-provider.js +144 -0
  379. package/dist/runtime/secrets/managed-local-key-provider.js.map +1 -0
  380. package/dist/runtime/secrets/managed-local-secret-store.d.ts +18 -0
  381. package/dist/runtime/secrets/managed-local-secret-store.d.ts.map +1 -0
  382. package/dist/runtime/secrets/managed-local-secret-store.js +82 -0
  383. package/dist/runtime/secrets/managed-local-secret-store.js.map +1 -0
  384. package/dist/runtime/secrets/managed-local-store.d.ts +7 -0
  385. package/dist/runtime/secrets/managed-local-store.d.ts.map +1 -1
  386. package/dist/runtime/secrets/managed-local-store.js +46 -127
  387. package/dist/runtime/secrets/managed-local-store.js.map +1 -1
  388. package/dist/runtime/sources/credentials.d.ts +2 -0
  389. package/dist/runtime/sources/credentials.d.ts.map +1 -1
  390. package/dist/runtime/sources/credentials.js +49 -0
  391. package/dist/runtime/sources/credentials.js.map +1 -1
  392. package/dist/runtime/sources/kinds/distribution.js +3 -3
  393. package/dist/runtime/sources/kinds/distribution.js.map +1 -1
  394. package/dist/runtime/sources/manifest-walk.d.ts +1 -0
  395. package/dist/runtime/sources/manifest-walk.d.ts.map +1 -1
  396. package/dist/runtime/sources/manifest-walk.js +16 -11
  397. package/dist/runtime/sources/manifest-walk.js.map +1 -1
  398. package/dist/runtime/sources/schema.d.ts.map +1 -1
  399. package/dist/runtime/sources/schema.js +51 -3
  400. package/dist/runtime/sources/schema.js.map +1 -1
  401. package/dist/runtime/store-client.d.ts +1 -1
  402. package/dist/runtime/store-client.d.ts.map +1 -1
  403. package/dist/runtime/store-client.js +2 -1
  404. package/dist/runtime/store-client.js.map +1 -1
  405. package/dist/runtime/store-submit.d.ts +31 -0
  406. package/dist/runtime/store-submit.d.ts.map +1 -0
  407. package/dist/runtime/store-submit.js +77 -0
  408. package/dist/runtime/store-submit.js.map +1 -0
  409. package/dist/runtime/supervisor.d.ts +12 -0
  410. package/dist/runtime/supervisor.d.ts.map +1 -1
  411. package/dist/runtime/supervisor.js +141 -26
  412. package/dist/runtime/supervisor.js.map +1 -1
  413. package/package.json +20 -29
  414. package/LICENSE +0 -176
  415. package/dist/lib/command-registry.d.ts +0 -5
  416. package/dist/lib/command-registry.d.ts.map +0 -1
  417. package/dist/lib/command-registry.js +0 -17
  418. package/dist/lib/command-registry.js.map +0 -1
@@ -1,36 +1,76 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RunManifestServiceState = void 0;
3
4
  exports.runManifestPath = runManifestPath;
4
5
  exports.writeRunManifest = writeRunManifest;
5
6
  exports.readRunManifest = readRunManifest;
6
- exports.clearRunManifest = clearRunManifest;
7
+ exports.parseRunManifestPayload = parseRunManifestPayload;
8
+ exports.clearRunManifestStrict = clearRunManifestStrict;
7
9
  exports.appendRunManifestEntry = appendRunManifestEntry;
10
+ exports.markRunManifestEntryReady = markRunManifestEntryReady;
11
+ exports.removeRunManifestEntryAfterVerifiedStop = removeRunManifestEntryAfterVerifiedStop;
12
+ exports.runManifestEntryVerifiedStopped = runManifestEntryVerifiedStopped;
8
13
  exports.parsePidHandle = parsePidHandle;
9
14
  exports.reapStaleServices = reapStaleServices;
15
+ exports.runManifestEntryProcessGroupMatches = runManifestEntryProcessGroupMatches;
16
+ exports.runManifestEntryOwnsPort = runManifestEntryOwnsPort;
17
+ exports.runManifestEntryOwnsPortAsync = runManifestEntryOwnsPortAsync;
18
+ exports.runManifestEntryProcessMatches = runManifestEntryProcessMatches;
19
+ exports.runManifestLauncherIsActive = runManifestLauncherIsActive;
20
+ exports.runManifestEntryProcessMatchesAsync = runManifestEntryProcessMatchesAsync;
10
21
  const node_child_process_1 = require("node:child_process");
22
+ const node_crypto_1 = require("node:crypto");
11
23
  const node_fs_1 = require("node:fs");
12
24
  const node_os_1 = require("node:os");
13
25
  const node_path_1 = require("node:path");
26
+ const native_process_group_1 = require("./native-process-group");
14
27
  const forked_worker_1 = require("../dev/forked-worker");
28
+ var RunManifestServiceState;
29
+ (function (RunManifestServiceState) {
30
+ RunManifestServiceState["Starting"] = "starting";
31
+ RunManifestServiceState["Ready"] = "ready";
32
+ })(RunManifestServiceState || (exports.RunManifestServiceState = RunManifestServiceState = {}));
15
33
  const REAP_GRACE_MS = 3_000;
16
34
  const OWNERSHIP_PROBE_TIMEOUT_MS = 2_000;
17
- const FORKED_MAIN_MODULE = 'dist/main.js';
18
- const WATCH_TARGET_MODULE = 'src/main.ts';
19
- const WATCH_RUNNER_MARKER = 'tsx';
20
- const MAX_ANCESTRY_DEPTH = 16;
21
- function runManifestPath() {
22
- return (0, node_path_1.join)((0, node_os_1.homedir)(), '.xema', 'run', 'current.json');
35
+ function runManifestPath(executionId) {
36
+ const digest = (0, node_crypto_1.createHash)('sha256')
37
+ .update(executionId)
38
+ .digest('hex');
39
+ return (0, node_path_1.join)((0, node_os_1.homedir)(), '.xema', 'run', 'sessions', `${digest}.json`);
23
40
  }
24
41
  function writeRunManifest(manifest) {
25
- const path = runManifestPath();
26
- (0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(path), { recursive: true });
27
- (0, node_fs_1.writeFileSync)(path, `${JSON.stringify(manifest, null, 2)}\n`, 'utf8');
42
+ const path = runManifestPath(manifest.executionId);
43
+ const directory = (0, node_path_1.dirname)(path);
44
+ (0, node_fs_1.mkdirSync)(directory, { recursive: true, mode: 0o700 });
45
+ const temporaryPath = `${path}.${String(process.pid)}.${(0, node_crypto_1.randomUUID)()}.tmp`;
46
+ let descriptor;
47
+ try {
48
+ descriptor = (0, node_fs_1.openSync)(temporaryPath, 'wx', 0o600);
49
+ (0, node_fs_1.writeFileSync)(descriptor, `${JSON.stringify(manifest, null, 2)}\n`, 'utf8');
50
+ (0, node_fs_1.fsyncSync)(descriptor);
51
+ (0, node_fs_1.closeSync)(descriptor);
52
+ descriptor = undefined;
53
+ (0, node_fs_1.renameSync)(temporaryPath, path);
54
+ const directoryDescriptor = (0, node_fs_1.openSync)(directory, 'r');
55
+ try {
56
+ (0, node_fs_1.fsyncSync)(directoryDescriptor);
57
+ }
58
+ finally {
59
+ (0, node_fs_1.closeSync)(directoryDescriptor);
60
+ }
61
+ }
62
+ catch (error) {
63
+ if (descriptor !== undefined) {
64
+ (0, node_fs_1.closeSync)(descriptor);
65
+ }
66
+ (0, node_fs_1.rmSync)(temporaryPath, { force: true });
67
+ throw error;
68
+ }
28
69
  }
29
- function readRunManifest() {
30
- return readRunManifestFile()?.services ?? [];
70
+ function readRunManifest(installationId) {
71
+ return readRunManifestFiles(installationId).flatMap(({ manifest }) => manifest.services);
31
72
  }
32
- function readRunManifestFile() {
33
- const path = runManifestPath();
73
+ function readRunManifestFile(path) {
34
74
  if (!(0, node_fs_1.existsSync)(path)) {
35
75
  return undefined;
36
76
  }
@@ -38,36 +78,150 @@ function readRunManifestFile() {
38
78
  try {
39
79
  raw = (0, node_fs_1.readFileSync)(path, 'utf8');
40
80
  }
41
- catch {
42
- return undefined;
81
+ catch (error) {
82
+ throw new Error(`Cannot read native run manifest ${path}.`, {
83
+ cause: error,
84
+ });
43
85
  }
44
86
  let parsed;
45
87
  try {
46
88
  parsed = JSON.parse(raw);
47
89
  }
48
- catch {
49
- return undefined;
90
+ catch (error) {
91
+ throw new Error(`Native run manifest ${path} is not valid JSON.`, {
92
+ cause: error,
93
+ });
50
94
  }
51
- return normalizeManifest(parsed);
52
- }
53
- function clearRunManifest() {
54
95
  try {
55
- (0, node_fs_1.rmSync)(runManifestPath(), { force: true });
96
+ return parseRunManifestPayload(parsed);
56
97
  }
57
- catch {
98
+ catch (error) {
99
+ throw new Error(`Native run manifest ${path} has an invalid schema.`, {
100
+ cause: error,
101
+ });
102
+ }
103
+ }
104
+ function parseRunManifestPayload(value) {
105
+ const manifest = normalizeManifest(value);
106
+ if (manifest === undefined) {
107
+ throw new Error('Native run manifest payload has an invalid schema.');
108
+ }
109
+ return manifest;
110
+ }
111
+ function readRunManifestFiles(installationId) {
112
+ return sessionManifestPaths().flatMap((path) => {
113
+ const manifest = readRunManifestFile(path);
114
+ return manifest === undefined ||
115
+ (installationId !== undefined &&
116
+ manifest.installationId !== installationId)
117
+ ? []
118
+ : [{ path, manifest }];
119
+ });
120
+ }
121
+ function sessionManifestPaths() {
122
+ const directory = (0, node_path_1.join)((0, node_os_1.homedir)(), '.xema', 'run', 'sessions');
123
+ if (!(0, node_fs_1.existsSync)(directory)) {
124
+ return [];
58
125
  }
126
+ return (0, node_fs_1.readdirSync)(directory, { withFileTypes: true })
127
+ .filter((entry) => entry.isFile() && entry.name.endsWith('.json'))
128
+ .map((entry) => (0, node_path_1.join)(directory, entry.name))
129
+ .sort();
130
+ }
131
+ function clearRunManifestStrict(executionId) {
132
+ (0, node_fs_1.rmSync)(runManifestPath(executionId), { force: true });
59
133
  }
60
134
  function appendRunManifestEntry(entry) {
61
- const existing = readRunManifestFile();
135
+ const existing = readRunManifestFile(runManifestPath(entry.executionId));
62
136
  const base = existing ?? {
63
137
  startedAt: new Date().toISOString(),
64
138
  pid: process.pid,
139
+ launcherFingerprint: (0, native_process_group_1.captureProcessFingerprint)(process.pid),
140
+ installationId: entry.installationId,
141
+ planHash: entry.planHash,
142
+ executionId: entry.executionId,
65
143
  services: [],
66
144
  };
145
+ if (base.installationId !== entry.installationId ||
146
+ base.planHash !== entry.planHash ||
147
+ base.executionId !== entry.executionId) {
148
+ throw new Error(`Run manifest identity mismatch for execution ${entry.executionId}.`);
149
+ }
67
150
  const services = base.services.filter((s) => s.pid !== entry.pid);
68
- services.push({ ...entry, mode: (0, forked_worker_1.resolveLaunchMode)() });
151
+ const processFingerprint = (0, native_process_group_1.captureProcessFingerprint)(entry.pid);
152
+ const processGroupId = (0, native_process_group_1.processGroupIdForPid)(entry.pid);
153
+ if (processGroupId !== entry.pid) {
154
+ throw new Error(`Native service pid ${String(entry.pid)} is not the leader of its dedicated ` +
155
+ `process group (observed PGID ${String(processGroupId)}).`);
156
+ }
157
+ services.push({
158
+ ...entry,
159
+ mode: (0, forked_worker_1.resolveLaunchMode)(),
160
+ processFingerprint,
161
+ processGroupId,
162
+ processGroupMembers: [{ pid: entry.pid, processFingerprint }],
163
+ state: RunManifestServiceState.Starting,
164
+ });
69
165
  writeRunManifest({ ...base, services });
70
166
  }
167
+ function markRunManifestEntryReady(executionId, pid) {
168
+ const path = runManifestPath(executionId);
169
+ const manifest = readRunManifestFile(path);
170
+ if (manifest === undefined) {
171
+ throw new Error(`Cannot mark pid ${String(pid)} ready: execution manifest is missing.`);
172
+ }
173
+ let matched = false;
174
+ const services = manifest.services.map((entry) => {
175
+ if (entry.pid !== pid) {
176
+ return entry;
177
+ }
178
+ matched = true;
179
+ const processGroupMembers = captureProcessGroupMemberIdentities(entry.processGroupId);
180
+ const leader = processGroupMembers.find((member) => member.pid === entry.pid);
181
+ if (leader === undefined ||
182
+ leader.processFingerprint !== entry.processFingerprint) {
183
+ throw new Error(`Cannot mark pid ${String(pid)} ready: process-group leader identity changed.`);
184
+ }
185
+ return {
186
+ ...entry,
187
+ processGroupMembers,
188
+ state: RunManifestServiceState.Ready,
189
+ };
190
+ });
191
+ if (!matched) {
192
+ throw new Error(`Cannot mark pid ${String(pid)} ready: ownership record is missing.`);
193
+ }
194
+ writeRunManifest({ ...manifest, services });
195
+ }
196
+ function removeRunManifestEntryAfterVerifiedStop(executionId, pid) {
197
+ const path = runManifestPath(executionId);
198
+ const manifest = readRunManifestFile(path);
199
+ if (manifest === undefined) {
200
+ return;
201
+ }
202
+ const entry = manifest.services.find((candidate) => candidate.pid === pid);
203
+ if (entry === undefined) {
204
+ return;
205
+ }
206
+ if (!runManifestEntryVerifiedStopped(entry)) {
207
+ throw new Error(`Refusing to remove pre-ready ownership evidence because process group ` +
208
+ `${String(entry.processGroupId)} is not verified empty.`);
209
+ }
210
+ const services = manifest.services.filter((candidate) => candidate.pid !== pid);
211
+ if (services.length === 0) {
212
+ (0, node_fs_1.rmSync)(path, { force: true });
213
+ return;
214
+ }
215
+ writeRunManifest({ ...manifest, services });
216
+ }
217
+ function runManifestEntryVerifiedStopped(entry, groupMembers = native_process_group_1.processGroupMembers) {
218
+ try {
219
+ return groupMembers(entry.processGroupId).length === 0;
220
+ }
221
+ catch {
222
+ return false;
223
+ }
224
+ }
71
225
  function parsePidHandle(handle) {
72
226
  const prefix = 'pid:';
73
227
  if (!handle.startsWith(prefix)) {
@@ -76,85 +230,202 @@ function parsePidHandle(handle) {
76
230
  const pid = Number.parseInt(handle.slice(prefix.length), 10);
77
231
  return Number.isInteger(pid) && pid > 0 ? pid : undefined;
78
232
  }
79
- function reapStaleServices() {
233
+ function reapStaleServices(installationId) {
80
234
  const killed = [];
81
235
  const skipped = [];
82
- const manifest = readRunManifestFile();
83
- if (!manifest || manifest.services.length === 0) {
84
- clearRunManifest();
236
+ const manifests = readRunManifestFiles(installationId);
237
+ if (manifests.length === 0) {
85
238
  return { killed, skipped };
86
239
  }
87
240
  const confirmed = [];
88
- for (const entry of manifest.services) {
89
- if (!isAlive(entry.pid)) {
90
- continue;
241
+ const staleManifests = manifests.filter(({ manifest }) => !runManifestLauncherIsActive(manifest));
242
+ for (const { manifest } of staleManifests) {
243
+ for (const entry of manifest.services) {
244
+ const ownership = resolveOwnedProcessGroup(entry);
245
+ if (ownership === 'gone') {
246
+ continue;
247
+ }
248
+ if (ownership === 'owned') {
249
+ confirmed.push(entry);
250
+ }
251
+ else {
252
+ skipped.push(entry);
253
+ }
91
254
  }
92
- const pids = resolveReapPids(entry);
93
- if (pids !== null && pids.length > 0) {
94
- confirmed.push({ entry, pids });
255
+ }
256
+ for (const entry of confirmed) {
257
+ try {
258
+ const terminated = (0, native_process_group_1.terminateProcessGroupSync)(entry.processGroupId, REAP_GRACE_MS, OWNERSHIP_PROBE_TIMEOUT_MS, ownershipCheckingControl(entry));
259
+ if (terminated) {
260
+ killed.push(entry);
261
+ }
262
+ else {
263
+ skipped.push(entry);
264
+ }
95
265
  }
96
- else {
266
+ catch {
97
267
  skipped.push(entry);
98
268
  }
99
269
  }
100
- const allPids = [...new Set(confirmed.flatMap((c) => c.pids))];
101
- for (const pid of allPids) {
102
- trySignal(pid, 'SIGTERM');
270
+ for (const { path, manifest } of staleManifests) {
271
+ const retained = skipped.filter((entry) => entry.executionId === manifest.executionId);
272
+ if (retained.length === 0) {
273
+ (0, node_fs_1.rmSync)(path, { force: true });
274
+ }
275
+ else {
276
+ writeRunManifest({ ...manifest, services: retained });
277
+ }
103
278
  }
104
- if (allPids.length > 0) {
105
- sleepSync(REAP_GRACE_MS);
279
+ return { killed, skipped };
280
+ }
281
+ function resolveOwnedProcessGroup(entry) {
282
+ let members;
283
+ try {
284
+ members = (0, native_process_group_1.processGroupMembers)(entry.processGroupId);
106
285
  }
107
- for (const pid of allPids) {
108
- if (isAlive(pid)) {
109
- trySignal(pid, 'SIGKILL');
110
- }
286
+ catch {
287
+ return 'unverified';
111
288
  }
112
- for (const { entry } of confirmed) {
113
- killed.push(entry);
289
+ if (members.length === 0) {
290
+ return 'gone';
114
291
  }
115
- clearRunManifest();
116
- return { killed, skipped };
292
+ return groupHasRecordedMember(entry, members) ? 'owned' : 'unverified';
293
+ }
294
+ function groupHasRecordedMember(entry, members, fingerprint = native_process_group_1.captureProcessFingerprint) {
295
+ return entry.processGroupMembers.some((identity) => {
296
+ if (!members.includes(identity.pid)) {
297
+ return false;
298
+ }
299
+ try {
300
+ return fingerprint(identity.pid) === identity.processFingerprint;
301
+ }
302
+ catch {
303
+ return false;
304
+ }
305
+ });
306
+ }
307
+ function runManifestEntryProcessGroupMatches(entry, members, fingerprint = native_process_group_1.captureProcessFingerprint) {
308
+ return groupHasRecordedMember(entry, members, fingerprint);
309
+ }
310
+ function captureProcessGroupMemberIdentities(processGroupId) {
311
+ const members = (0, native_process_group_1.processGroupMembers)(processGroupId);
312
+ if (members.length === 0) {
313
+ throw new Error(`Cannot capture ownership for empty process group ${String(processGroupId)}.`);
314
+ }
315
+ return members.map((pid) => ({
316
+ pid,
317
+ processFingerprint: (0, native_process_group_1.captureProcessFingerprint)(pid),
318
+ }));
319
+ }
320
+ function ownershipCheckingControl(entry) {
321
+ return {
322
+ members: (processGroupId) => {
323
+ const members = (0, native_process_group_1.processGroupMembers)(processGroupId);
324
+ if (members.length === 0) {
325
+ return [];
326
+ }
327
+ if (!groupHasRecordedMember(entry, members)) {
328
+ throw new Error(`Process group ${String(processGroupId)} no longer matches recorded ownership.`);
329
+ }
330
+ return members;
331
+ },
332
+ signal: (processGroupId, signal) => {
333
+ const members = (0, native_process_group_1.processGroupMembers)(processGroupId);
334
+ if (members.length === 0) {
335
+ return;
336
+ }
337
+ if (!groupHasRecordedMember(entry, members)) {
338
+ throw new Error(`Refusing to signal process group ${String(processGroupId)} because ` +
339
+ 'its current members no longer match recorded birth identities.');
340
+ }
341
+ try {
342
+ process.kill(-processGroupId, signal);
343
+ }
344
+ catch (error) {
345
+ if (error.code !== 'ESRCH') {
346
+ throw error;
347
+ }
348
+ }
349
+ },
350
+ wait: sleepSync,
351
+ };
352
+ }
353
+ function runManifestEntryOwnsPort(entry) {
354
+ const listeners = listeningPids(entry.port);
355
+ const members = (0, native_process_group_1.processGroupMembers)(entry.processGroupId);
356
+ return listeners.some((listener) => members.includes(listener));
117
357
  }
118
- function resolveReapPids(entry) {
119
- return entry.mode === forked_worker_1.LaunchMode.Watch
120
- ? resolveWatchReapPids(entry)
121
- : resolveDistReapPids(entry);
358
+ async function runManifestEntryOwnsPortAsync(entry) {
359
+ const [listeners, members] = await Promise.all([
360
+ listeningPidsAsync(entry.port),
361
+ (0, native_process_group_1.processGroupMembersAsync)(entry.processGroupId),
362
+ ]);
363
+ return listeners.some((listener) => members.includes(listener));
122
364
  }
123
- function resolveDistReapPids(entry) {
124
- const command = processCommand(entry.pid);
125
- if (command !== null && command.includes(FORKED_MAIN_MODULE)) {
126
- return [entry.pid];
365
+ function runManifestEntryProcessMatches(entry, fingerprint = native_process_group_1.captureProcessFingerprint) {
366
+ try {
367
+ return fingerprint(entry.pid) === entry.processFingerprint;
127
368
  }
128
- if (listeningPids(entry.port).includes(entry.pid)) {
129
- return [entry.pid];
369
+ catch {
370
+ return false;
130
371
  }
131
- return null;
132
372
  }
133
- function resolveWatchReapPids(entry) {
134
- const command = processCommand(entry.pid);
135
- const supervisorConfirmed = command !== null && looksLikeWatchSupervisor(command);
136
- const ownedListeners = listeningPids(entry.port).filter((listener) => listener === entry.pid || isDescendantOf(listener, entry.pid));
137
- if (!supervisorConfirmed && ownedListeners.length === 0) {
138
- return null;
373
+ function runManifestLauncherIsActive(manifest, alive = isAlive, fingerprint = native_process_group_1.captureProcessFingerprint) {
374
+ return (alive(manifest.pid) &&
375
+ runManifestEntryProcessMatches({
376
+ pid: manifest.pid,
377
+ processFingerprint: manifest.launcherFingerprint,
378
+ }, fingerprint));
379
+ }
380
+ async function runManifestEntryProcessMatchesAsync(entry) {
381
+ try {
382
+ return ((await (0, native_process_group_1.captureProcessFingerprintAsync)(entry.pid)) ===
383
+ entry.processFingerprint);
384
+ }
385
+ catch {
386
+ return false;
139
387
  }
140
- return [...new Set([entry.pid, ...ownedListeners])];
141
388
  }
142
389
  function normalizeManifest(value) {
143
390
  if (typeof value !== 'object' || value === null) {
144
391
  return undefined;
145
392
  }
146
393
  const obj = value;
147
- const rawServices = Array.isArray(obj.services) ? obj.services : [];
394
+ if (typeof obj.installationId !== 'string' ||
395
+ obj.installationId.length === 0 ||
396
+ typeof obj.planHash !== 'string' ||
397
+ obj.planHash.length === 0 ||
398
+ typeof obj.executionId !== 'string' ||
399
+ obj.executionId.length === 0 ||
400
+ typeof obj.startedAt !== 'string' ||
401
+ !Number.isFinite(Date.parse(obj.startedAt)) ||
402
+ typeof obj.pid !== 'number' ||
403
+ !Number.isInteger(obj.pid) ||
404
+ obj.pid <= 0 ||
405
+ typeof obj.launcherFingerprint !== 'string' ||
406
+ !/^[a-f0-9]{64}$/.test(obj.launcherFingerprint) ||
407
+ !Array.isArray(obj.services)) {
408
+ return undefined;
409
+ }
410
+ const rawServices = obj.services;
148
411
  const services = [];
149
412
  for (const raw of rawServices) {
150
413
  const entry = normalizeEntry(raw);
151
- if (entry) {
152
- services.push(entry);
414
+ if (entry === undefined ||
415
+ entry.installationId !== obj.installationId ||
416
+ entry.planHash !== obj.planHash ||
417
+ entry.executionId !== obj.executionId) {
418
+ return undefined;
153
419
  }
420
+ services.push(entry);
154
421
  }
155
422
  return {
156
- startedAt: typeof obj.startedAt === 'string' ? obj.startedAt : '',
157
- pid: typeof obj.pid === 'number' ? obj.pid : 0,
423
+ startedAt: obj.startedAt,
424
+ pid: obj.pid,
425
+ launcherFingerprint: obj.launcherFingerprint,
426
+ installationId: obj.installationId,
427
+ planHash: obj.planHash,
428
+ executionId: obj.executionId,
158
429
  services,
159
430
  };
160
431
  }
@@ -163,17 +434,74 @@ function normalizeEntry(value) {
163
434
  return undefined;
164
435
  }
165
436
  const obj = value;
166
- if (typeof obj.name !== 'string' || typeof obj.pid !== 'number' || typeof obj.port !== 'number') {
437
+ if (typeof obj.name !== 'string' ||
438
+ typeof obj.pid !== 'number' ||
439
+ typeof obj.port !== 'number' ||
440
+ typeof obj.installationId !== 'string' ||
441
+ obj.installationId.length === 0 ||
442
+ typeof obj.planHash !== 'string' ||
443
+ obj.planHash.length === 0 ||
444
+ typeof obj.executionId !== 'string' ||
445
+ obj.executionId.length === 0 ||
446
+ typeof obj.processFingerprint !== 'string' ||
447
+ !/^[a-f0-9]{64}$/.test(obj.processFingerprint) ||
448
+ typeof obj.processGroupId !== 'number' ||
449
+ !Number.isInteger(obj.processGroupId) ||
450
+ obj.processGroupId <= 0 ||
451
+ obj.processGroupId !== obj.pid ||
452
+ !Array.isArray(obj.processGroupMembers) ||
453
+ (obj.state !== RunManifestServiceState.Starting &&
454
+ obj.state !== RunManifestServiceState.Ready)) {
167
455
  return undefined;
168
456
  }
169
457
  if (!Number.isInteger(obj.pid) || obj.pid <= 0) {
170
458
  return undefined;
171
459
  }
460
+ if (!Number.isInteger(obj.port) || obj.port <= 0 || obj.port > 65_535) {
461
+ return undefined;
462
+ }
172
463
  const mode = parseLaunchMode(obj.mode);
173
464
  if (mode === undefined) {
174
465
  return undefined;
175
466
  }
176
- return { name: obj.name, pid: obj.pid, port: obj.port, mode };
467
+ const processGroupMemberIdentities = [];
468
+ for (const rawIdentity of obj.processGroupMembers) {
469
+ const identity = normalizeProcessGroupMemberIdentity(rawIdentity);
470
+ if (identity === undefined) {
471
+ return undefined;
472
+ }
473
+ processGroupMemberIdentities.push(identity);
474
+ }
475
+ if (!processGroupMemberIdentities.some((identity) => identity.pid === obj.pid &&
476
+ identity.processFingerprint === obj.processFingerprint)) {
477
+ return undefined;
478
+ }
479
+ return {
480
+ name: obj.name,
481
+ pid: obj.pid,
482
+ port: obj.port,
483
+ installationId: obj.installationId,
484
+ planHash: obj.planHash,
485
+ executionId: obj.executionId,
486
+ processFingerprint: obj.processFingerprint,
487
+ processGroupId: obj.processGroupId,
488
+ processGroupMembers: processGroupMemberIdentities,
489
+ state: obj.state,
490
+ mode,
491
+ };
492
+ }
493
+ function normalizeProcessGroupMemberIdentity(value) {
494
+ if (typeof value !== 'object' || value === null) {
495
+ return undefined;
496
+ }
497
+ const obj = value;
498
+ return typeof obj.pid === 'number' &&
499
+ Number.isInteger(obj.pid) &&
500
+ obj.pid > 0 &&
501
+ typeof obj.processFingerprint === 'string' &&
502
+ /^[a-f0-9]{64}$/.test(obj.processFingerprint)
503
+ ? { pid: obj.pid, processFingerprint: obj.processFingerprint }
504
+ : undefined;
177
505
  }
178
506
  function parseLaunchMode(value) {
179
507
  if (value === forked_worker_1.LaunchMode.Dist || value === forked_worker_1.LaunchMode.Watch) {
@@ -193,25 +521,6 @@ function isAlive(pid) {
193
521
  return err.code === 'EPERM';
194
522
  }
195
523
  }
196
- function looksLikeWatchSupervisor(command) {
197
- return (command.includes(WATCH_RUNNER_MARKER) &&
198
- command.includes('watch') &&
199
- command.includes(WATCH_TARGET_MODULE));
200
- }
201
- function processCommand(pid) {
202
- try {
203
- const out = (0, node_child_process_1.execFileSync)('ps', ['-p', String(pid), '-o', 'args='], {
204
- encoding: 'utf8',
205
- timeout: OWNERSHIP_PROBE_TIMEOUT_MS,
206
- stdio: ['ignore', 'pipe', 'ignore'],
207
- });
208
- const line = out.trim();
209
- return line.length > 0 ? line : null;
210
- }
211
- catch {
212
- return null;
213
- }
214
- }
215
524
  function listeningPids(port) {
216
525
  if (!Number.isInteger(port) || port <= 0) {
217
526
  return [];
@@ -233,39 +542,44 @@ function listeningPids(port) {
233
542
  return [];
234
543
  }
235
544
  }
236
- function parentPidOf(pid) {
237
- try {
238
- const out = (0, node_child_process_1.execFileSync)('ps', ['-p', String(pid), '-o', 'ppid='], {
239
- encoding: 'utf8',
240
- timeout: OWNERSHIP_PROBE_TIMEOUT_MS,
241
- stdio: ['ignore', 'pipe', 'ignore'],
242
- });
243
- const ppid = Number.parseInt(out.trim(), 10);
244
- return Number.isInteger(ppid) && ppid > 0 ? ppid : undefined;
245
- }
246
- catch {
247
- return undefined;
248
- }
249
- }
250
- function isDescendantOf(pid, ancestor) {
251
- let cursor = parentPidOf(pid);
252
- let depth = 0;
253
- while (cursor !== undefined && cursor > 1 && depth < MAX_ANCESTRY_DEPTH) {
254
- if (cursor === ancestor) {
255
- return true;
256
- }
257
- cursor = parentPidOf(cursor);
258
- depth += 1;
545
+ async function listeningPidsAsync(port) {
546
+ if (!Number.isInteger(port) || port <= 0) {
547
+ return [];
259
548
  }
260
- return false;
261
- }
262
- function trySignal(pid, signal) {
263
549
  try {
264
- process.kill(pid, signal);
550
+ const out = await execFileText('lsof', [
551
+ '-nP',
552
+ `-iTCP:${String(port)}`,
553
+ '-sTCP:LISTEN',
554
+ '-t',
555
+ ]);
556
+ return out
557
+ .split('\n')
558
+ .map((value) => value.trim())
559
+ .filter((value) => value.length > 0)
560
+ .map((value) => Number.parseInt(value, 10))
561
+ .filter((value) => Number.isInteger(value) && value > 0);
265
562
  }
266
563
  catch {
564
+ return [];
267
565
  }
268
566
  }
567
+ function execFileText(command, args) {
568
+ return new Promise((resolve, reject) => {
569
+ (0, node_child_process_1.execFile)(command, [...args], {
570
+ encoding: 'utf8',
571
+ timeout: OWNERSHIP_PROBE_TIMEOUT_MS,
572
+ killSignal: 'SIGKILL',
573
+ maxBuffer: 1024 * 1024,
574
+ }, (error, stdout) => {
575
+ if (error) {
576
+ reject(error);
577
+ return;
578
+ }
579
+ resolve(stdout);
580
+ });
581
+ });
582
+ }
269
583
  function sleepSync(ms) {
270
584
  const signal = new Int32Array(new SharedArrayBuffer(4));
271
585
  Atomics.wait(signal, 0, 0, ms);