@owlmeans/viable-sdk 0.1.18-rc.8 → 0.1.18

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 (498) hide show
  1. package/README.md +29 -11
  2. package/agent-meta/manifest.json +16 -0
  3. package/agent-meta/skills/viable-sdk/SKILL.md +1033 -0
  4. package/build/api/collect/types.d.ts +30 -0
  5. package/build/api/collect/types.d.ts.map +1 -0
  6. package/build/api/collect/types.js +2 -0
  7. package/build/api/collect/types.js.map +1 -0
  8. package/build/api/collect.d.ts +14 -0
  9. package/build/api/collect.d.ts.map +1 -0
  10. package/build/api/collect.js +132 -0
  11. package/build/api/collect.js.map +1 -0
  12. package/build/api/consts.local.d.ts +21 -0
  13. package/build/api/consts.local.d.ts.map +1 -0
  14. package/build/api/consts.local.js +25 -0
  15. package/build/api/consts.local.js.map +1 -0
  16. package/build/api/index.d.ts +5 -0
  17. package/build/api/index.d.ts.map +1 -1
  18. package/build/api/index.js +2 -0
  19. package/build/api/index.js.map +1 -1
  20. package/build/api/remote.d.ts +13 -6
  21. package/build/api/remote.d.ts.map +1 -1
  22. package/build/api/remote.js +302 -35
  23. package/build/api/remote.js.map +1 -1
  24. package/build/api/transport/types.d.ts +14 -0
  25. package/build/api/transport/types.d.ts.map +1 -0
  26. package/build/api/transport/types.js +2 -0
  27. package/build/api/transport/types.js.map +1 -0
  28. package/build/api/transport.d.ts +4 -0
  29. package/build/api/transport.d.ts.map +1 -0
  30. package/build/api/transport.js +32 -0
  31. package/build/api/transport.js.map +1 -0
  32. package/build/api/types.d.ts +9 -0
  33. package/build/api/types.d.ts.map +1 -0
  34. package/build/api/types.js +2 -0
  35. package/build/api/types.js.map +1 -0
  36. package/build/api/types.local.d.ts +3 -0
  37. package/build/api/types.local.d.ts.map +1 -0
  38. package/build/api/types.local.js +2 -0
  39. package/build/api/types.local.js.map +1 -0
  40. package/build/consts.d.ts +29 -14
  41. package/build/consts.d.ts.map +1 -1
  42. package/build/consts.js +30 -14
  43. package/build/consts.js.map +1 -1
  44. package/build/context/consts.local.d.ts +18 -0
  45. package/build/context/consts.local.d.ts.map +1 -0
  46. package/build/context/consts.local.js +18 -0
  47. package/build/context/consts.local.js.map +1 -0
  48. package/build/context/index.d.ts +3 -7
  49. package/build/context/index.d.ts.map +1 -1
  50. package/build/context/index.js +58 -25
  51. package/build/context/index.js.map +1 -1
  52. package/build/context/types.d.ts +26 -0
  53. package/build/context/types.d.ts.map +1 -0
  54. package/build/context/types.js +2 -0
  55. package/build/context/types.js.map +1 -0
  56. package/build/executor/boot-check.d.ts +1 -40
  57. package/build/executor/boot-check.d.ts.map +1 -1
  58. package/build/executor/boot-check.js +22 -19
  59. package/build/executor/boot-check.js.map +1 -1
  60. package/build/executor/consts.d.ts +55 -0
  61. package/build/executor/consts.d.ts.map +1 -0
  62. package/build/executor/consts.js +66 -0
  63. package/build/executor/consts.js.map +1 -0
  64. package/build/executor/consts.local.d.ts +63 -0
  65. package/build/executor/consts.local.d.ts.map +1 -0
  66. package/build/executor/consts.local.js +69 -0
  67. package/build/executor/consts.local.js.map +1 -0
  68. package/build/executor/env/types.d.ts +40 -0
  69. package/build/executor/env/types.d.ts.map +1 -0
  70. package/build/executor/env/types.js +2 -0
  71. package/build/executor/env/types.js.map +1 -0
  72. package/build/executor/env.d.ts +11 -20
  73. package/build/executor/env.d.ts.map +1 -1
  74. package/build/executor/env.js +39 -59
  75. package/build/executor/env.js.map +1 -1
  76. package/build/executor/errors.d.ts +15 -0
  77. package/build/executor/errors.d.ts.map +1 -1
  78. package/build/executor/errors.js +19 -2
  79. package/build/executor/errors.js.map +1 -1
  80. package/build/executor/files/types.d.ts +106 -0
  81. package/build/executor/files/types.d.ts.map +1 -0
  82. package/build/executor/files/types.js +2 -0
  83. package/build/executor/files/types.js.map +1 -0
  84. package/build/executor/files.d.ts +2 -50
  85. package/build/executor/files.d.ts.map +1 -1
  86. package/build/executor/files.js +225 -68
  87. package/build/executor/files.js.map +1 -1
  88. package/build/executor/git/types.d.ts +19 -0
  89. package/build/executor/git/types.d.ts.map +1 -0
  90. package/build/executor/git/types.js +2 -0
  91. package/build/executor/git/types.js.map +1 -0
  92. package/build/executor/git.d.ts +4 -36
  93. package/build/executor/git.d.ts.map +1 -1
  94. package/build/executor/git.js +206 -241
  95. package/build/executor/git.js.map +1 -1
  96. package/build/executor/glob/types.d.ts +12 -0
  97. package/build/executor/glob/types.d.ts.map +1 -0
  98. package/build/executor/glob/types.js +2 -0
  99. package/build/executor/glob/types.js.map +1 -0
  100. package/build/executor/glob.d.ts +4 -0
  101. package/build/executor/glob.d.ts.map +1 -0
  102. package/build/executor/glob.js +11 -0
  103. package/build/executor/glob.js.map +1 -0
  104. package/build/executor/health/types.d.ts +39 -0
  105. package/build/executor/health/types.d.ts.map +1 -0
  106. package/build/executor/health/types.js +2 -0
  107. package/build/executor/health/types.js.map +1 -0
  108. package/build/executor/health.d.ts +3 -83
  109. package/build/executor/health.d.ts.map +1 -1
  110. package/build/executor/health.js +76 -91
  111. package/build/executor/health.js.map +1 -1
  112. package/build/executor/index.d.ts +14 -15
  113. package/build/executor/index.d.ts.map +1 -1
  114. package/build/executor/index.js +36 -18
  115. package/build/executor/index.js.map +1 -1
  116. package/build/executor/integrity/types.d.ts +25 -0
  117. package/build/executor/integrity/types.d.ts.map +1 -0
  118. package/build/executor/integrity/types.js +2 -0
  119. package/build/executor/integrity/types.js.map +1 -0
  120. package/build/executor/integrity.d.ts +5 -15
  121. package/build/executor/integrity.d.ts.map +1 -1
  122. package/build/executor/integrity.js +28 -39
  123. package/build/executor/integrity.js.map +1 -1
  124. package/build/executor/layout/types.d.ts +69 -0
  125. package/build/executor/layout/types.d.ts.map +1 -0
  126. package/build/executor/layout/types.js +2 -0
  127. package/build/executor/layout/types.js.map +1 -0
  128. package/build/executor/layout.d.ts +9 -56
  129. package/build/executor/layout.d.ts.map +1 -1
  130. package/build/executor/layout.js +35 -82
  131. package/build/executor/layout.js.map +1 -1
  132. package/build/executor/shell/types.d.ts +76 -0
  133. package/build/executor/shell/types.d.ts.map +1 -0
  134. package/build/executor/shell/types.js +2 -0
  135. package/build/executor/shell/types.js.map +1 -0
  136. package/build/executor/shell.d.ts +3 -78
  137. package/build/executor/shell.d.ts.map +1 -1
  138. package/build/executor/shell.js +61 -91
  139. package/build/executor/shell.js.map +1 -1
  140. package/build/executor/spawn/types.d.ts +98 -0
  141. package/build/executor/spawn/types.d.ts.map +1 -0
  142. package/build/executor/spawn/types.js +2 -0
  143. package/build/executor/spawn/types.js.map +1 -0
  144. package/build/executor/spawn.d.ts +3 -103
  145. package/build/executor/spawn.d.ts.map +1 -1
  146. package/build/executor/spawn.js +192 -274
  147. package/build/executor/spawn.js.map +1 -1
  148. package/build/executor/types.d.ts +123 -0
  149. package/build/executor/types.d.ts.map +1 -0
  150. package/build/executor/types.js +2 -0
  151. package/build/executor/types.js.map +1 -0
  152. package/build/executor/types.local.d.ts +6 -0
  153. package/build/executor/types.local.d.ts.map +1 -0
  154. package/build/executor/types.local.js +2 -0
  155. package/build/executor/types.local.js.map +1 -0
  156. package/build/index.d.ts +14 -1
  157. package/build/index.d.ts.map +1 -1
  158. package/build/index.js +5 -1
  159. package/build/index.js.map +1 -1
  160. package/build/project/consts.d.ts +17 -0
  161. package/build/project/consts.d.ts.map +1 -0
  162. package/build/project/consts.js +17 -0
  163. package/build/project/consts.js.map +1 -0
  164. package/build/project/consts.local.d.ts +4 -0
  165. package/build/project/consts.local.d.ts.map +1 -0
  166. package/build/project/consts.local.js +4 -0
  167. package/build/project/consts.local.js.map +1 -0
  168. package/build/project/dotenv/types.d.ts +39 -0
  169. package/build/project/dotenv/types.d.ts.map +1 -0
  170. package/build/project/dotenv/types.js +2 -0
  171. package/build/project/dotenv/types.js.map +1 -0
  172. package/build/project/dotenv.d.ts +4 -0
  173. package/build/project/dotenv.d.ts.map +1 -0
  174. package/build/project/dotenv.js +56 -0
  175. package/build/project/dotenv.js.map +1 -0
  176. package/build/project/env/types.d.ts +40 -0
  177. package/build/project/env/types.d.ts.map +1 -0
  178. package/build/project/env/types.js +2 -0
  179. package/build/project/env/types.js.map +1 -0
  180. package/build/project/env.d.ts +2 -98
  181. package/build/project/env.d.ts.map +1 -1
  182. package/build/project/env.js +63 -215
  183. package/build/project/env.js.map +1 -1
  184. package/build/project/marker/types.d.ts +33 -0
  185. package/build/project/marker/types.d.ts.map +1 -0
  186. package/build/project/marker/types.js +2 -0
  187. package/build/project/marker/types.js.map +1 -0
  188. package/build/project/marker.d.ts +4 -25
  189. package/build/project/marker.d.ts.map +1 -1
  190. package/build/project/marker.js +40 -43
  191. package/build/project/marker.js.map +1 -1
  192. package/build/project/probe/types.d.ts +22 -0
  193. package/build/project/probe/types.d.ts.map +1 -0
  194. package/build/project/probe/types.js +2 -0
  195. package/build/project/probe/types.js.map +1 -0
  196. package/build/project/probe.d.ts +4 -0
  197. package/build/project/probe.d.ts.map +1 -0
  198. package/build/project/probe.js +39 -0
  199. package/build/project/probe.js.map +1 -0
  200. package/build/project/report/types.d.ts +18 -0
  201. package/build/project/report/types.d.ts.map +1 -0
  202. package/build/project/report/types.js +2 -0
  203. package/build/project/report/types.js.map +1 -0
  204. package/build/project/report.d.ts +7 -0
  205. package/build/project/report.d.ts.map +1 -0
  206. package/build/project/report.js +68 -0
  207. package/build/project/report.js.map +1 -0
  208. package/build/project/setup/types.d.ts +32 -0
  209. package/build/project/setup/types.d.ts.map +1 -0
  210. package/build/project/setup/types.js +2 -0
  211. package/build/project/setup/types.js.map +1 -0
  212. package/build/project/setup.d.ts +4 -53
  213. package/build/project/setup.d.ts.map +1 -1
  214. package/build/project/setup.js +112 -175
  215. package/build/project/setup.js.map +1 -1
  216. package/build/project/types.d.ts +37 -0
  217. package/build/project/types.d.ts.map +1 -0
  218. package/build/project/types.js +2 -0
  219. package/build/project/types.js.map +1 -0
  220. package/build/run/consts.local.d.ts +3 -0
  221. package/build/run/consts.local.d.ts.map +1 -0
  222. package/build/run/consts.local.js +26 -0
  223. package/build/run/consts.local.js.map +1 -0
  224. package/build/run/index.d.ts +11 -69
  225. package/build/run/index.d.ts.map +1 -1
  226. package/build/run/index.js +9 -147
  227. package/build/run/index.js.map +1 -1
  228. package/build/run/local/types.d.ts +39 -0
  229. package/build/run/local/types.d.ts.map +1 -0
  230. package/build/run/local/types.js +2 -0
  231. package/build/run/local/types.js.map +1 -0
  232. package/build/run/local.d.ts +3 -0
  233. package/build/run/local.d.ts.map +1 -0
  234. package/build/run/local.js +130 -0
  235. package/build/run/local.js.map +1 -0
  236. package/build/run/process/types.d.ts +15 -0
  237. package/build/run/process/types.d.ts.map +1 -0
  238. package/build/run/process/types.js +2 -0
  239. package/build/run/process/types.js.map +1 -0
  240. package/build/run/process.d.ts +4 -0
  241. package/build/run/process.d.ts.map +1 -0
  242. package/build/run/process.js +20 -0
  243. package/build/run/process.js.map +1 -0
  244. package/build/run/serve.d.ts +14 -9
  245. package/build/run/serve.d.ts.map +1 -1
  246. package/build/run/serve.js +1 -25
  247. package/build/run/serve.js.map +1 -1
  248. package/build/run/state/types.d.ts +35 -0
  249. package/build/run/state/types.d.ts.map +1 -0
  250. package/build/run/state/types.js +2 -0
  251. package/build/run/state/types.js.map +1 -0
  252. package/build/run/state.d.ts +3 -62
  253. package/build/run/state.d.ts.map +1 -1
  254. package/build/run/state.js +96 -123
  255. package/build/run/state.js.map +1 -1
  256. package/build/run/types.d.ts +78 -0
  257. package/build/run/types.d.ts.map +1 -0
  258. package/build/run/types.js +2 -0
  259. package/build/run/types.js.map +1 -0
  260. package/build/session/consts.local.d.ts +5 -0
  261. package/build/session/consts.local.d.ts.map +1 -0
  262. package/build/session/consts.local.js +5 -0
  263. package/build/session/consts.local.js.map +1 -0
  264. package/build/session/index.d.ts +5 -10
  265. package/build/session/index.d.ts.map +1 -1
  266. package/build/session/index.js +84 -15
  267. package/build/session/index.js.map +1 -1
  268. package/build/session/questions.d.ts +16 -0
  269. package/build/session/questions.d.ts.map +1 -0
  270. package/build/session/questions.js +17 -0
  271. package/build/session/questions.js.map +1 -0
  272. package/build/session/queue.d.ts +61 -0
  273. package/build/session/queue.d.ts.map +1 -0
  274. package/build/session/queue.js +156 -0
  275. package/build/session/queue.js.map +1 -0
  276. package/build/session/tasks.d.ts +11 -30
  277. package/build/session/tasks.d.ts.map +1 -1
  278. package/build/session/tasks.js +18 -78
  279. package/build/session/tasks.js.map +1 -1
  280. package/build/session/types.d.ts +20 -0
  281. package/build/session/types.d.ts.map +1 -0
  282. package/build/session/types.js +2 -0
  283. package/build/session/types.js.map +1 -0
  284. package/build/task/consts.d.ts +12 -0
  285. package/build/task/consts.d.ts.map +1 -0
  286. package/build/task/consts.js +12 -0
  287. package/build/task/consts.js.map +1 -0
  288. package/build/task/consts.local.d.ts +19 -0
  289. package/build/task/consts.local.d.ts.map +1 -0
  290. package/build/task/consts.local.js +72 -0
  291. package/build/task/consts.local.js.map +1 -0
  292. package/build/task/driver.d.ts +1 -28
  293. package/build/task/driver.d.ts.map +1 -1
  294. package/build/task/driver.js +2 -9
  295. package/build/task/driver.js.map +1 -1
  296. package/build/task/envelope/types.d.ts +29 -0
  297. package/build/task/envelope/types.d.ts.map +1 -0
  298. package/build/task/envelope/types.js +2 -0
  299. package/build/task/envelope/types.js.map +1 -0
  300. package/build/task/envelope.d.ts +4 -34
  301. package/build/task/envelope.d.ts.map +1 -1
  302. package/build/task/envelope.js +103 -165
  303. package/build/task/envelope.js.map +1 -1
  304. package/build/task/index.d.ts +5 -0
  305. package/build/task/index.d.ts.map +1 -1
  306. package/build/task/index.js +2 -0
  307. package/build/task/index.js.map +1 -1
  308. package/build/task/inquiry/types.d.ts +38 -0
  309. package/build/task/inquiry/types.d.ts.map +1 -0
  310. package/build/task/inquiry/types.js +2 -0
  311. package/build/task/inquiry/types.js.map +1 -0
  312. package/build/task/inquiry.d.ts +5 -0
  313. package/build/task/inquiry.d.ts.map +1 -0
  314. package/build/task/inquiry.js +188 -0
  315. package/build/task/inquiry.js.map +1 -0
  316. package/build/task/types.d.ts +48 -0
  317. package/build/task/types.d.ts.map +1 -0
  318. package/build/task/types.js +2 -0
  319. package/build/task/types.js.map +1 -0
  320. package/build/tools/account/types.d.ts +24 -0
  321. package/build/tools/account/types.d.ts.map +1 -0
  322. package/build/tools/account/types.js +2 -0
  323. package/build/tools/account/types.js.map +1 -0
  324. package/build/tools/account.d.ts +4 -0
  325. package/build/tools/account.d.ts.map +1 -0
  326. package/build/tools/account.js +72 -0
  327. package/build/tools/account.js.map +1 -0
  328. package/build/tools/blueprints/types.d.ts +5 -0
  329. package/build/tools/blueprints/types.d.ts.map +1 -0
  330. package/build/tools/blueprints/types.js +2 -0
  331. package/build/tools/blueprints/types.js.map +1 -0
  332. package/build/tools/blueprints.d.ts +4 -0
  333. package/build/tools/blueprints.d.ts.map +1 -0
  334. package/build/tools/blueprints.js +23 -0
  335. package/build/tools/blueprints.js.map +1 -0
  336. package/build/tools/catalogue/types.d.ts +8 -0
  337. package/build/tools/catalogue/types.d.ts.map +1 -0
  338. package/build/tools/catalogue/types.js +2 -0
  339. package/build/tools/catalogue/types.js.map +1 -0
  340. package/build/tools/catalogue.d.ts +8 -6
  341. package/build/tools/catalogue.d.ts.map +1 -1
  342. package/build/tools/catalogue.js +2565 -213
  343. package/build/tools/catalogue.js.map +1 -1
  344. package/build/tools/config/types.d.ts +19 -0
  345. package/build/tools/config/types.d.ts.map +1 -0
  346. package/build/tools/config/types.js +2 -0
  347. package/build/tools/config/types.js.map +1 -0
  348. package/build/tools/config.d.ts +4 -0
  349. package/build/tools/config.d.ts.map +1 -0
  350. package/build/tools/config.js +42 -0
  351. package/build/tools/config.js.map +1 -0
  352. package/build/tools/consts.d.ts +61 -0
  353. package/build/tools/consts.d.ts.map +1 -0
  354. package/build/tools/consts.js +515 -0
  355. package/build/tools/consts.js.map +1 -0
  356. package/build/tools/consts.local.d.ts +131 -0
  357. package/build/tools/consts.local.d.ts.map +1 -0
  358. package/build/tools/consts.local.js +236 -0
  359. package/build/tools/consts.local.js.map +1 -0
  360. package/build/tools/control/types.d.ts +17 -0
  361. package/build/tools/control/types.d.ts.map +1 -0
  362. package/build/tools/control/types.js +2 -0
  363. package/build/tools/control/types.js.map +1 -0
  364. package/build/tools/control.d.ts +4 -0
  365. package/build/tools/control.d.ts.map +1 -0
  366. package/build/tools/control.js +44 -0
  367. package/build/tools/control.js.map +1 -0
  368. package/build/tools/feed/types.d.ts +21 -0
  369. package/build/tools/feed/types.d.ts.map +1 -0
  370. package/build/tools/feed/types.js +2 -0
  371. package/build/tools/feed/types.js.map +1 -0
  372. package/build/tools/feed.d.ts +4 -0
  373. package/build/tools/feed.d.ts.map +1 -0
  374. package/build/tools/feed.js +75 -0
  375. package/build/tools/feed.js.map +1 -0
  376. package/build/tools/git/types.d.ts +25 -0
  377. package/build/tools/git/types.d.ts.map +1 -0
  378. package/build/tools/git/types.js +2 -0
  379. package/build/tools/git/types.js.map +1 -0
  380. package/build/tools/git.d.ts +4 -0
  381. package/build/tools/git.d.ts.map +1 -0
  382. package/build/tools/git.js +83 -0
  383. package/build/tools/git.js.map +1 -0
  384. package/build/tools/handover/types.d.ts +49 -0
  385. package/build/tools/handover/types.d.ts.map +1 -0
  386. package/build/tools/handover/types.js +2 -0
  387. package/build/tools/handover/types.js.map +1 -0
  388. package/build/tools/handover.d.ts +8 -0
  389. package/build/tools/handover.d.ts.map +1 -0
  390. package/build/tools/handover.js +138 -0
  391. package/build/tools/handover.js.map +1 -0
  392. package/build/tools/host/types.d.ts +34 -0
  393. package/build/tools/host/types.d.ts.map +1 -0
  394. package/build/tools/host/types.js +2 -0
  395. package/build/tools/host/types.js.map +1 -0
  396. package/build/tools/host.d.ts +4 -0
  397. package/build/tools/host.d.ts.map +1 -0
  398. package/build/tools/host.js +13 -0
  399. package/build/tools/host.js.map +1 -0
  400. package/build/tools/iam/types.d.ts +44 -0
  401. package/build/tools/iam/types.d.ts.map +1 -0
  402. package/build/tools/iam/types.js +2 -0
  403. package/build/tools/iam/types.js.map +1 -0
  404. package/build/tools/iam.d.ts +4 -0
  405. package/build/tools/iam.d.ts.map +1 -0
  406. package/build/tools/iam.js +229 -0
  407. package/build/tools/iam.js.map +1 -0
  408. package/build/tools/index.d.ts +27 -1
  409. package/build/tools/index.d.ts.map +1 -1
  410. package/build/tools/index.js +14 -1
  411. package/build/tools/index.js.map +1 -1
  412. package/build/tools/inflight/types.d.ts +47 -0
  413. package/build/tools/inflight/types.d.ts.map +1 -0
  414. package/build/tools/inflight/types.js +2 -0
  415. package/build/tools/inflight/types.js.map +1 -0
  416. package/build/tools/inflight.d.ts +3 -0
  417. package/build/tools/inflight.d.ts.map +1 -0
  418. package/build/tools/inflight.js +88 -0
  419. package/build/tools/inflight.js.map +1 -0
  420. package/build/tools/kits/types.d.ts +12 -0
  421. package/build/tools/kits/types.d.ts.map +1 -0
  422. package/build/tools/kits/types.js +2 -0
  423. package/build/tools/kits/types.js.map +1 -0
  424. package/build/tools/kits.d.ts +4 -0
  425. package/build/tools/kits.d.ts.map +1 -0
  426. package/build/tools/kits.js +33 -0
  427. package/build/tools/kits.js.map +1 -0
  428. package/build/tools/mcp.d.ts +13 -19
  429. package/build/tools/mcp.d.ts.map +1 -1
  430. package/build/tools/mcp.js +117 -38
  431. package/build/tools/mcp.js.map +1 -1
  432. package/build/tools/platform.d.ts +14 -0
  433. package/build/tools/platform.d.ts.map +1 -0
  434. package/build/tools/platform.js +90 -0
  435. package/build/tools/platform.js.map +1 -0
  436. package/build/tools/production/types.d.ts +22 -0
  437. package/build/tools/production/types.d.ts.map +1 -0
  438. package/build/tools/production/types.js +2 -0
  439. package/build/tools/production/types.js.map +1 -0
  440. package/build/tools/production.d.ts +4 -0
  441. package/build/tools/production.d.ts.map +1 -0
  442. package/build/tools/production.js +80 -0
  443. package/build/tools/production.js.map +1 -0
  444. package/build/tools/refusal/types.d.ts +95 -0
  445. package/build/tools/refusal/types.d.ts.map +1 -0
  446. package/build/tools/refusal/types.js +2 -0
  447. package/build/tools/refusal/types.js.map +1 -0
  448. package/build/tools/refusal.d.ts +4 -0
  449. package/build/tools/refusal.d.ts.map +1 -0
  450. package/build/tools/refusal.js +663 -0
  451. package/build/tools/refusal.js.map +1 -0
  452. package/build/tools/settings/types.d.ts +42 -0
  453. package/build/tools/settings/types.d.ts.map +1 -0
  454. package/build/tools/settings/types.js +2 -0
  455. package/build/tools/settings/types.js.map +1 -0
  456. package/build/tools/settings.d.ts +4 -0
  457. package/build/tools/settings.d.ts.map +1 -0
  458. package/build/tools/settings.js +71 -0
  459. package/build/tools/settings.js.map +1 -0
  460. package/build/tools/status/types.d.ts +25 -0
  461. package/build/tools/status/types.d.ts.map +1 -0
  462. package/build/tools/status/types.js +2 -0
  463. package/build/tools/status/types.js.map +1 -0
  464. package/build/tools/status.d.ts +4 -0
  465. package/build/tools/status.d.ts.map +1 -0
  466. package/build/tools/status.js +183 -0
  467. package/build/tools/status.js.map +1 -0
  468. package/build/tools/stories/types.d.ts +48 -0
  469. package/build/tools/stories/types.d.ts.map +1 -0
  470. package/build/tools/stories/types.js +2 -0
  471. package/build/tools/stories/types.js.map +1 -0
  472. package/build/tools/stories.d.ts +8 -0
  473. package/build/tools/stories.d.ts.map +1 -0
  474. package/build/tools/stories.js +79 -0
  475. package/build/tools/stories.js.map +1 -0
  476. package/build/tools/types.d.ts +177 -26
  477. package/build/tools/types.d.ts.map +1 -1
  478. package/build/tools/types.js +1 -32
  479. package/build/tools/types.js.map +1 -1
  480. package/build/types.d.ts +391 -26
  481. package/build/types.d.ts.map +1 -1
  482. package/build/utils.d.ts +8 -0
  483. package/build/utils.d.ts.map +1 -0
  484. package/build/utils.js +12 -0
  485. package/build/utils.js.map +1 -0
  486. package/package.json +30 -34
  487. package/build/harness/index.d.ts +0 -28
  488. package/build/harness/index.d.ts.map +0 -1
  489. package/build/harness/index.js +0 -83
  490. package/build/harness/index.js.map +0 -1
  491. package/build/harness/templates.d.ts +0 -30
  492. package/build/harness/templates.d.ts.map +0 -1
  493. package/build/harness/templates.js +0 -154
  494. package/build/harness/templates.js.map +0 -1
  495. package/build/tools/jobs.d.ts +0 -12
  496. package/build/tools/jobs.d.ts.map +0 -1
  497. package/build/tools/jobs.js +0 -47
  498. package/build/tools/jobs.js.map +0 -1
@@ -0,0 +1,37 @@
1
+ import type { ConnectMarker } from '@owlmeans/viable-common';
2
+ export interface TargetEnv {
3
+ /** Project-relative path → the values that file declares. */
4
+ files: Record<string, Record<string, string>>;
5
+ /** Everything the target's processes see, later files overriding earlier ones. */
6
+ values: Record<string, string>;
7
+ }
8
+ export interface DiscoveredProject {
9
+ /** The directory holding `.viable/connect.json` — the project root, not where the search began. */
10
+ dir: string;
11
+ marker: ConnectMarker;
12
+ }
13
+ export interface ServiceState {
14
+ /** A connection string is present in the project's own half of the `.env`. */
15
+ configured: boolean;
16
+ /** Something answers where it points. False for an unset URL and for one nothing listens on. */
17
+ reachable: boolean;
18
+ /** The value, with everything between the scheme and the host removed. */
19
+ redacted?: string;
20
+ }
21
+ export interface SetupReport {
22
+ dir: string;
23
+ /** Only a project with a worker needs a queue store; for the rest it is noise. */
24
+ needsWorker: boolean;
25
+ database: ServiceState;
26
+ queue: ServiceState;
27
+ /** The command-line tools the paths below depend on. */
28
+ tools: {
29
+ bun: boolean;
30
+ git: boolean;
31
+ docker: boolean;
32
+ };
33
+ platform: NodeJS.Platform;
34
+ /** Whether the file holding these values is kept out of the project's history. */
35
+ envIgnored: boolean;
36
+ }
37
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/project/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAE5D,MAAM,WAAW,SAAS;IACxB,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IAC7C,kFAAkF;IAClF,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC/B;AAED,MAAM,WAAW,iBAAiB;IAChC,mGAAmG;IACnG,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,aAAa,CAAA;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,8EAA8E;IAC9E,UAAU,EAAE,OAAO,CAAA;IACnB,gGAAgG;IAChG,SAAS,EAAE,OAAO,CAAA;IAClB,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAA;IACX,kFAAkF;IAClF,WAAW,EAAE,OAAO,CAAA;IACpB,QAAQ,EAAE,YAAY,CAAA;IACtB,KAAK,EAAE,YAAY,CAAA;IACnB,wDAAwD;IACxD,KAAK,EAAE;QAAE,GAAG,EAAE,OAAO,CAAC;QAAC,GAAG,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAA;IACtD,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAA;IACzB,kFAAkF;IAClF,UAAU,EAAE,OAAO,CAAA;CACpB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/project/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export declare const MIME: Record<string, string>;
2
+ export declare const PLACEHOLDER: string;
3
+ //# sourceMappingURL=consts.local.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.local.d.ts","sourceRoot":"","sources":["../../src/run/consts.local.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAmBvC,CAAA;AAED,eAAO,MAAM,WAAW,QAIJ,CAAA"}
@@ -0,0 +1,26 @@
1
+ export const MIME = {
2
+ '.html': 'text/html; charset=utf-8',
3
+ '.js': 'application/javascript; charset=utf-8',
4
+ '.mjs': 'application/javascript; charset=utf-8',
5
+ '.css': 'text/css; charset=utf-8',
6
+ '.json': 'application/json; charset=utf-8',
7
+ '.map': 'application/json; charset=utf-8',
8
+ '.webmanifest': 'application/manifest+json',
9
+ '.svg': 'image/svg+xml',
10
+ '.png': 'image/png',
11
+ '.jpg': 'image/jpeg',
12
+ '.jpeg': 'image/jpeg',
13
+ '.gif': 'image/gif',
14
+ '.webp': 'image/webp',
15
+ '.ico': 'image/x-icon',
16
+ '.woff': 'font/woff',
17
+ '.woff2': 'font/woff2',
18
+ '.ttf': 'font/ttf',
19
+ '.txt': 'text/plain; charset=utf-8',
20
+ };
21
+ export const PLACEHOLDER = '<!doctype html><html lang="en"><head><meta charset="UTF-8"/>'
22
+ + '<meta name="viewport" content="width=device-width, initial-scale=1.0"/>'
23
+ + '<title>Not built yet</title></head><body style="font-family:sans-serif">'
24
+ + '<p style="padding:2rem">This project has not been built yet. Run a build and reload.</p>'
25
+ + '</body></html>';
26
+ //# sourceMappingURL=consts.local.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.local.js","sourceRoot":"","sources":["../../src/run/consts.local.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAA2B;IAC1C,OAAO,EAAE,0BAA0B;IACnC,KAAK,EAAE,uCAAuC;IAC9C,MAAM,EAAE,uCAAuC;IAC/C,MAAM,EAAE,yBAAyB;IACjC,OAAO,EAAE,iCAAiC;IAC1C,MAAM,EAAE,iCAAiC;IACzC,cAAc,EAAE,2BAA2B;IAC3C,MAAM,EAAE,eAAe;IACvB,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,WAAW;IACnB,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,cAAc;IACtB,OAAO,EAAE,WAAW;IACpB,QAAQ,EAAE,YAAY;IACtB,MAAM,EAAE,UAAU;IAClB,MAAM,EAAE,2BAA2B;CACpC,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,8DAA8D;MACrF,yEAAyE;MACzE,0EAA0E;MAC1E,0FAA0F;MAC1F,gBAAgB,CAAA"}
@@ -1,75 +1,17 @@
1
- import type { LocalRunRecord } from './state.js';
1
+ import type { LocalRunStatus, RunLocalOptions, RunLocalResult } from './types.js';
2
2
  export * from './state.js';
3
+ export type * from './state/types.js';
4
+ export * from './process.js';
5
+ export type * from './process/types.js';
6
+ export * from './local.js';
7
+ export type * from './local/types.js';
8
+ export type * from './types.js';
3
9
  export * from './serve.js';
4
- export interface RunLocalOptions {
5
- /** Build before starting. On by default — starting a stale `dist/` is the confusing failure. */
6
- build?: boolean;
7
- log?: (line: string) => void;
8
- }
9
- export interface RunLocalResult {
10
- record: LocalRunRecord | null;
11
- /**
12
- * The ports the run uses, so a caller can print an address without composing one.
13
- *
14
- * Stated even when a process did not come up: they are where the app WILL answer, and whether
15
- * it does yet is what `error`, `buildError` and {@link localStatus} are for.
16
- */
17
- api: number;
18
- web: number;
19
- worker?: number;
20
- /** The reason nothing was started, or the tree was refused. */
21
- error?: string;
22
- /** A build ran and failed. The web server still comes up so the state is visible. */
23
- buildError?: string;
24
- }
25
- /** One supervised process, as a status read finds it. */
26
- export interface LocalProcessStatus {
27
- pid: number;
28
- port: number;
29
- alive: boolean;
30
- }
31
- export interface LocalRunStatus {
32
- running: boolean;
33
- startedAt?: string;
34
- /** Ports, flat, for a caller composing an address or a one-line report. */
35
- api?: number;
36
- worker?: number;
37
- web?: number;
38
- /** The target's own boot phase, when it got far enough to report one. */
39
- phase?: string;
40
- /** Whether the target says it is serving — never the same question as "the pid is alive". */
41
- ready?: boolean;
42
- /** Why it is not ready. Absent when it is. */
43
- reason?: string;
44
- processes: {
45
- api?: LocalProcessStatus;
46
- worker?: LocalProcessStatus;
47
- web?: LocalProcessStatus;
48
- };
49
- }
50
- /**
51
- * Build the target, start its processes, serve its browser app.
52
- *
53
- * A previous run is stopped first: both halves bind fixed ports, and a replacement that races the
54
- * process it is replacing loses the bind and exits — with nothing announcing it, since a failed
55
- * `listen` says nothing on its own.
56
- */
10
+ export type { LocalProcessStatus, LocalRunStatus, RunLocalOptions, RunLocalResult } from './types.js';
11
+ /** @deprecated compat:factory-refactor — use `makeLocalRunHelper(dir).runLocal(…)` */
57
12
  export declare const runLocal: (dir: string, options?: RunLocalOptions) => Promise<RunLocalResult>;
58
- /**
59
- * Stop whatever the run record names, and forget it.
60
- *
61
- * Safe to call when nothing is running: the record is the only authority, and a stale one names
62
- * pids that are simply not alive. The children are detached, so they outlive the process that
63
- * started them — which is exactly why the record is a file and this is the only way to end them.
64
- */
13
+ /** @deprecated compat:factory-refactor — use `makeLocalRunHelper(dir).stopLocal()` */
65
14
  export declare const stopLocal: (dir: string) => Promise<void>;
66
- /**
67
- * What is running, and whether the target is actually serving.
68
- *
69
- * Two independent facts, because either one alone lies. A live pid says nothing about a target
70
- * that bound its port and then failed to reach its database — it answers `200` with `db.ok:false`
71
- * and would otherwise read as healthy. A health answer says nothing about a process that died
72
- * while something else holds the port.
73
- */
15
+ /** @deprecated compat:factory-refactor — use `makeLocalRunHelper(dir).localStatus()` */
74
16
  export declare const localStatus: (dir: string) => Promise<LocalRunStatus>;
75
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/run/index.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAEhD,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAgB1B,MAAM,WAAW,eAAe;IAC9B,gGAAgG;IAChG,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAC7B;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,cAAc,GAAG,IAAI,CAAA;IAC7B;;;;;OAKG;IACH,GAAG,EAAE,MA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EAAE,MAAM,YAAY,CAAA;AAEjF,cAAc,YAAY,CAAA;AAC1B,mBAAmB,kBAAkB,CAAA;AACrC,cAAc,cAAc,CAAA;AAC5B,mBAAmB,oBAAoB,CAAA;AACvC,cAAc,YAAY,CAAA;AAC1B,mBAAmB,kBAAkB,CAAA;AACrC,mBAAmB,YAAY,CAAA;AAC/B,cAAc,YAAY,CAAA;AAE1B,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAErG,sFAAsF;AACtF,eAAO,MAAM,QAAQ,QAAe,MAAM,YAAW,eAAe,KAAQ,OAAO,CAAC,cAAc,CACjD,CAAA;AAEjD,sFAAsF;AACtF,eAAO,MAAM,SAAS,QAAe,MAAM,KAAG,OAAO,CAAC,IAAI,CAA8C,CAAA;AAExG,wFAAwF;AACxF,eAAO,MAAM,WAAW,QAAe,MAAM,KAAG,OAAO,CAAC,cAAc,CAAgD,CAAA"}
@@ -1,150 +1,12 @@
1
- import fs from 'fs-extra';
2
- import p from 'node:path';
3
- import { SlotCommandType, SlotShellCommand, TARGET_API_PORT, TARGET_WEB_PORT, TARGET_WORKER_PORT } from '@owlmeans/viable-common';
4
- import { makeLocalSlotExecutor } from '../executor/index.js';
5
- import { readTargetHealth } from '../executor/health.js';
6
- import { integrityRefusal } from '../executor/integrity.js';
7
- import { apiPath, webPath } from '../executor/layout.js';
8
- import { isAlive } from '../executor/spawn.js';
9
- import { createLocalServer } from './serve.js';
10
- import { apiRunning, clearRun, readRun, startApi, startWorker, stopProcess, writeRun } from './state.js';
1
+ import { makeLocalRunHelper } from './local.js';
11
2
  export * from './state.js';
3
+ export * from './process.js';
4
+ export * from './local.js';
12
5
  export * from './serve.js';
13
- /**
14
- * Run the generated application on the developer's own machine.
15
- *
16
- * The slot's equivalent is a pod: a publisher supervising two children and a static server, with
17
- * Kubernetes underneath. None of that exists here, and the parts that were about the pod are
18
- * deliberately not reproduced — there is no respawn ladder, no reconciler and no health route,
19
- * because a developer watching their own terminal is the supervisor. What IS reproduced is the
20
- * shape: the same ports, the same argv marker, the same environment, and the same "port ownership
21
- * is the only proof" rule about restarts.
22
- */
23
- /** Servers this process is holding, so a stop can close what a run opened. */
24
- const _servers = new Map();
25
- /**
26
- * Build the target, start its processes, serve its browser app.
27
- *
28
- * A previous run is stopped first: both halves bind fixed ports, and a replacement that races the
29
- * process it is replacing loses the bind and exits — with nothing announcing it, since a failed
30
- * `listen` says nothing on its own.
31
- */
32
- export const runLocal = async (dir, options = {}) => {
33
- const root = p.resolve(dir);
34
- const log = options.log ?? (() => undefined);
35
- const ports = { api: TARGET_API_PORT, web: TARGET_WEB_PORT };
36
- const refused = await integrityRefusal(root, 'Refused to run');
37
- if (refused != null) {
38
- return { record: null, ...ports, error: refused };
39
- }
40
- await stopLocal(root);
41
- let buildError;
42
- if (options.build !== false) {
43
- log('Building the target project…');
44
- const result = await makeLocalSlotExecutor(root, { log }).execute({
45
- type: SlotCommandType.Shell, command: SlotShellCommand.Build,
46
- });
47
- if (result.result != null) {
48
- buildError = result.result;
49
- }
50
- }
51
- const record = { dir: root, startedAt: new Date().toISOString() };
52
- // Only when the last build left something to spawn. Starting `bun dist/index.js` against a
53
- // missing bundle fails with a message about a file rather than about the build that never
54
- // produced it.
55
- if (await fs.pathExists(p.resolve(apiPath(root), 'dist', 'index.js'))) {
56
- record.api = await startApi(root);
57
- log(`Target api started on port ${record.api.port}`);
58
- }
59
- else {
60
- buildError ??= 'The target api has no build output — nothing was started.';
61
- }
62
- const worker = await startWorker(root);
63
- if (worker != null) {
64
- record.worker = worker;
65
- log(`Target worker started on port ${worker.port}`);
66
- }
67
- const server = createLocalServer(() => p.resolve(webPath(root), 'dist'), { apiPort: TARGET_API_PORT });
68
- await server.listen(TARGET_WEB_PORT);
69
- _servers.set(root, server);
70
- // The web server is this process, not a child: whoever called `runLocal` is holding it, and its
71
- // pid is what a later `localStatus` from another process checks for liveness.
72
- record.web = { pid: process.pid, port: TARGET_WEB_PORT };
73
- log(`Target app served at http://localhost:${TARGET_WEB_PORT}`);
74
- await writeRun(root, record);
75
- return {
76
- record,
77
- ...ports,
78
- ...(worker != null ? { worker: worker.port } : {}),
79
- ...(buildError != null ? { buildError } : {}),
80
- };
81
- };
82
- /**
83
- * Stop whatever the run record names, and forget it.
84
- *
85
- * Safe to call when nothing is running: the record is the only authority, and a stale one names
86
- * pids that are simply not alive. The children are detached, so they outlive the process that
87
- * started them — which is exactly why the record is a file and this is the only way to end them.
88
- */
89
- export const stopLocal = async (dir) => {
90
- const root = p.resolve(dir);
91
- const server = _servers.get(root);
92
- if (server != null) {
93
- _servers.delete(root);
94
- await server.close();
95
- }
96
- const record = await readRun(root);
97
- if (record == null)
98
- return;
99
- await stopProcess(record.worker);
100
- await stopProcess(record.api);
101
- await clearRun(root);
102
- };
103
- /**
104
- * What is running, and whether the target is actually serving.
105
- *
106
- * Two independent facts, because either one alone lies. A live pid says nothing about a target
107
- * that bound its port and then failed to reach its database — it answers `200` with `db.ok:false`
108
- * and would otherwise read as healthy. A health answer says nothing about a process that died
109
- * while something else holds the port.
110
- */
111
- export const localStatus = async (dir) => {
112
- const root = p.resolve(dir);
113
- const record = await readRun(root);
114
- if (record == null) {
115
- return { running: false, processes: {} };
116
- }
117
- const status = {
118
- running: apiRunning(record),
119
- startedAt: record.startedAt,
120
- processes: {},
121
- };
122
- if (record.api != null) {
123
- const port = record.api.port ?? TARGET_API_PORT;
124
- const health = await readTargetHealth(port, record.api.bootId ?? '', 2_000);
125
- status.api = port;
126
- status.ready = health.ready;
127
- if (health.phase != null)
128
- status.phase = health.phase;
129
- if (!health.ready)
130
- status.reason = health.reason;
131
- status.processes.api = {
132
- pid: record.api.pid, port, alive: isAlive(record.api.pid),
133
- };
134
- }
135
- if (record.worker != null) {
136
- const port = record.worker.port ?? TARGET_WORKER_PORT;
137
- status.worker = port;
138
- status.processes.worker = {
139
- pid: record.worker.pid, port, alive: isAlive(record.worker.pid),
140
- };
141
- }
142
- if (record.web != null) {
143
- status.web = record.web.port;
144
- status.processes.web = {
145
- pid: record.web.pid, port: record.web.port, alive: isAlive(record.web.pid),
146
- };
147
- }
148
- return status;
149
- };
6
+ /** @deprecated compat:factory-refactor — use `makeLocalRunHelper(dir).runLocal(…)` */
7
+ export const runLocal = async (dir, options = {}) => await makeLocalRunHelper(dir).runLocal(options);
8
+ /** @deprecated compat:factory-refactor — use `makeLocalRunHelper(dir).stopLocal()` */
9
+ export const stopLocal = async (dir) => await makeLocalRunHelper(dir).stopLocal();
10
+ /** @deprecated compat:factory-refactor — use `makeLocalRunHelper(dir).localStatus()` */
11
+ export const localStatus = async (dir) => await makeLocalRunHelper(dir).localStatus();
150
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/run/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAA;AACzB,OAAO,CAAC,MAAM,WAAW,CAAA;AAEzB,OAAO,EACL,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,kBAAkB,EACxF,MAAM,yBAAyB,CAAA;AAGhC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAE9C,OAAO,EACL,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAC5E,MAAM,YAAY,CAAA;AAGnB,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAE1B;;;;;;;;;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,CAAC;QACvB,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAA;QAC5B,MAAM,CAAC,SAAS,CAAC,GAAG,GAAG;YACrB,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC;SAC3E,CAAA;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/run/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAG/C,cAAc,YAAY,CAAA;AAE1B,cAAc,cAAc,CAAA;AAE5B,cAAc,YAAY,CAAA;AAG1B,cAAc,YAAY,CAAA;AAI1B,sFAAsF;AACtF,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,EAAE,GAAW,EAAE,OAAO,GAAoB,EAAE,EAA2B,EAAE,CACpG,MAAM,kBAAkB,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;AAEjD,sFAAsF;AACtF,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAAE,GAAW,EAAiB,EAAE,CAAC,MAAM,kBAAkB,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,CAAA;AAExG,wFAAwF;AACxF,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAAE,GAAW,EAA2B,EAAE,CAAC,MAAM,kBAAkB,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAA"}
@@ -0,0 +1,39 @@
1
+ import type { LocalRunStatus, RunLocalOptions, RunLocalResult } from '../types.js';
2
+ /**
3
+ * Run the generated application of ONE project directory on the developer's own machine.
4
+ *
5
+ * The slot's equivalent is a pod: a publisher supervising two children and a static server, with
6
+ * Kubernetes underneath. None of that exists here, and the parts that were about the pod are
7
+ * deliberately not reproduced — there is no respawn ladder, no reconciler and no health route,
8
+ * because a developer watching their own terminal is the supervisor. What IS reproduced is the
9
+ * shape: the same ports, the same argv marker, the same environment, and the same "port ownership
10
+ * is the only proof" rule about restarts.
11
+ */
12
+ export interface LocalRunHelper {
13
+ /**
14
+ * Build the target, start its processes, serve its browser app.
15
+ *
16
+ * A previous run is stopped first: both halves bind fixed ports, and a replacement that races the
17
+ * process it is replacing loses the bind and exits — with nothing announcing it, since a failed
18
+ * `listen` says nothing on its own.
19
+ */
20
+ runLocal: (options?: RunLocalOptions) => Promise<RunLocalResult>;
21
+ /**
22
+ * Stop whatever the run record names, and forget it.
23
+ *
24
+ * Safe to call when nothing is running: the record is the only authority, and a stale one names
25
+ * pids that are simply not alive. The children are detached, so they outlive the process that
26
+ * started them — which is exactly why the record is a file and this is the only way to end them.
27
+ */
28
+ stopLocal: () => Promise<void>;
29
+ /**
30
+ * What is running, and whether the target is actually serving.
31
+ *
32
+ * Two independent facts, because either one alone lies. A live pid says nothing about a target
33
+ * that bound its port and then failed to reach its database — it answers `200` with `db.ok:false`
34
+ * and would otherwise read as healthy. A health answer says nothing about a process that died
35
+ * while something else holds the port.
36
+ */
37
+ localStatus: () => Promise<LocalRunStatus>;
38
+ }
39
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/run/local/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAElF;;;;;;;;;GASG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;OAMG;IACH,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,eAAe,KAAK,OAAO,CAAC,cAAc,CAAC,CAAA;IAChE;;;;;;OAMG;IACH,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9B;;;;;;;OAOG;IACH,WAAW,EAAE,MAAM,OAAO,CAAC,cAAc,CAAC,CAAA;CAC3C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/run/local/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import type { LocalRunHelper } from './local/types.js';
2
+ export declare const makeLocalRunHelper: (dir: string) => LocalRunHelper;
3
+ //# sourceMappingURL=local.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../src/run/local.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAgBtD,eAAO,MAAM,kBAAkB,QAAS,MAAM,KAAG,cA4HhD,CAAA"}
@@ -0,0 +1,130 @@
1
+ import fs from 'fs-extra';
2
+ import p from 'node:path';
3
+ import { SlotCommandType, SlotShellCommand, TARGET_API_PORT, TARGET_WEB_PORT, TARGET_WORKER_PORT } from '@owlmeans/viable-common';
4
+ import { makeLocalSlotExecutor } from '../executor/index.js';
5
+ import { healthHelper } from '../executor/health.js';
6
+ import { integrityHelper } from '../executor/integrity.js';
7
+ import { makeLayoutHelper } from '../executor/layout.js';
8
+ import { spawnHelper } from '../executor/spawn.js';
9
+ import { createLocalServer } from './serve.js';
10
+ import { runProcessHelper } from './process.js';
11
+ import { makeRunStateHelper } from './state.js';
12
+ /**
13
+ * Run the generated application on the developer's own machine.
14
+ *
15
+ * The slot's equivalent is a pod: a publisher supervising two children and a static server, with
16
+ * Kubernetes underneath. None of that exists here, and the parts that were about the pod are
17
+ * deliberately not reproduced — there is no respawn ladder, no reconciler and no health route,
18
+ * because a developer watching their own terminal is the supervisor. What IS reproduced is the
19
+ * shape: the same ports, the same argv marker, the same environment, and the same "port ownership
20
+ * is the only proof" rule about restarts.
21
+ */
22
+ /** Servers this process is holding, so a stop can close what a run opened. */
23
+ const _servers = new Map();
24
+ export const makeLocalRunHelper = (dir) => {
25
+ const root = p.resolve(dir);
26
+ const layout = makeLayoutHelper(root);
27
+ const state = makeRunStateHelper(root);
28
+ const runLocal = async (options = {}) => {
29
+ const log = options.log ?? (() => undefined);
30
+ const ports = { api: TARGET_API_PORT, web: TARGET_WEB_PORT };
31
+ const refused = await integrityHelper.integrityRefusal(root, 'Refused to run');
32
+ if (refused != null) {
33
+ return { record: null, ...ports, error: refused };
34
+ }
35
+ await stopLocal();
36
+ let buildError;
37
+ if (options.build !== false) {
38
+ log('Building the target project…');
39
+ const result = await makeLocalSlotExecutor(root, { log }).execute({
40
+ type: SlotCommandType.Shell, command: SlotShellCommand.Build,
41
+ });
42
+ if (result.result != null) {
43
+ buildError = result.result;
44
+ }
45
+ }
46
+ const record = { dir: root, startedAt: new Date().toISOString() };
47
+ // Only when the last build left something to spawn. Starting `bun dist/index.js` against a
48
+ // missing bundle fails with a message about a file rather than about the build that never
49
+ // produced it.
50
+ if (await fs.pathExists(p.resolve(layout.apiPath(), 'dist', 'index.js'))) {
51
+ record.api = await state.startApi();
52
+ log(`Target api started on port ${record.api.port}`);
53
+ }
54
+ else {
55
+ buildError ??= 'The target api has no build output — nothing was started.';
56
+ }
57
+ const worker = await state.startWorker();
58
+ if (worker != null) {
59
+ record.worker = worker;
60
+ log(`Target worker started on port ${worker.port}`);
61
+ }
62
+ const server = createLocalServer(() => p.resolve(layout.webPath(), 'dist'), { apiPort: TARGET_API_PORT });
63
+ await server.listen(TARGET_WEB_PORT);
64
+ _servers.set(root, server);
65
+ // The web server is this process, not a child: whoever called `runLocal` is holding it, and its
66
+ // pid is what a later `localStatus` from another process checks for liveness.
67
+ record.web = { pid: process.pid, port: TARGET_WEB_PORT };
68
+ log(`Target app served at http://localhost:${TARGET_WEB_PORT}`);
69
+ await state.writeRun(record);
70
+ return {
71
+ record,
72
+ ...ports,
73
+ ...(worker != null ? { worker: worker.port } : {}),
74
+ ...(buildError != null ? { buildError } : {}),
75
+ };
76
+ };
77
+ const stopLocal = async () => {
78
+ const server = _servers.get(root);
79
+ if (server != null) {
80
+ _servers.delete(root);
81
+ await server.close();
82
+ }
83
+ const record = await state.readRun();
84
+ if (record == null)
85
+ return;
86
+ await runProcessHelper.stopProcess(record.worker);
87
+ await runProcessHelper.stopProcess(record.api);
88
+ await state.clearRun();
89
+ };
90
+ const localStatus = async () => {
91
+ const record = await state.readRun();
92
+ if (record == null) {
93
+ return { running: false, processes: {} };
94
+ }
95
+ const status = {
96
+ running: runProcessHelper.apiRunning(record),
97
+ startedAt: record.startedAt,
98
+ processes: {},
99
+ };
100
+ if (record.api != null) {
101
+ const port = record.api.port ?? TARGET_API_PORT;
102
+ const health = await healthHelper.readTargetHealth(port, record.api.bootId ?? '', 2_000);
103
+ status.api = port;
104
+ status.ready = health.ready;
105
+ if (health.phase != null)
106
+ status.phase = health.phase;
107
+ if (!health.ready)
108
+ status.reason = health.reason;
109
+ status.processes.api = {
110
+ pid: record.api.pid, port, alive: spawnHelper.isAlive(record.api.pid),
111
+ };
112
+ }
113
+ if (record.worker != null) {
114
+ const port = record.worker.port ?? TARGET_WORKER_PORT;
115
+ status.worker = port;
116
+ status.processes.worker = {
117
+ pid: record.worker.pid, port, alive: spawnHelper.isAlive(record.worker.pid),
118
+ };
119
+ }
120
+ if (record.web != null) {
121
+ status.web = record.web.port;
122
+ status.processes.web = {
123
+ pid: record.web.pid, port: record.web.port, alive: spawnHelper.isAlive(record.web.pid),
124
+ };
125
+ }
126
+ return status;
127
+ };
128
+ return { runLocal, stopLocal, localStatus };
129
+ };
130
+ //# sourceMappingURL=local.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local.js","sourceRoot":"","sources":["../../src/run/local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAA;AACzB,OAAO,CAAC,MAAM,WAAW,CAAA;AAEzB,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,kBAAkB,EA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AAC,GAAG,CAAC;aACtE,CAAA;QACH,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC;YAC1B,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,IAAI,kBAAkB,CAAA;YACrD,MAAM,CAAC,MAAM,GAAG,IAAI,CAAA;YACpB,MAAM,CAAC,SAAS,CAAC,MAAM,GAAG;gBACxB,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC;aAC5E,CAAA;QACH,CAAC;QAED,IAAI,MAAM,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAA;YAC5B,MAAM,CAAC,SAAS,CAAC,GAAG,GAAG;gBACrB,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC;aACvF,CAAA;QACH,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC,CAAA;IAED,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,CAAA;AAC7C,CAAC,CAAA"}
@@ -0,0 +1,15 @@
1
+ import type { LocalProcessRecord, LocalRunRecord } from '../types.js';
2
+ /** The liveness of the processes a run record names. */
3
+ export interface RunProcessHelper {
4
+ /** Whether the api recorded here is still a live process. */
5
+ apiRunning: (record: LocalRunRecord | null) => boolean;
6
+ /**
7
+ * Stop a recorded process and wait for its port to actually free.
8
+ *
9
+ * The port and not the pid is what a replacement needs, so that is what is waited on.
10
+ */
11
+ stopProcess: (record: LocalProcessRecord | undefined) => Promise<void>;
12
+ /** Whether anything is answering on the api's port right now. */
13
+ apiListening: (port?: number) => Promise<boolean>;
14
+ }
15
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/run/process/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAErE,wDAAwD;AACxD,MAAM,WAAW,gBAAgB;IAC/B,6DAA6D;IAC7D,UAAU,EAAE,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,KAAK,OAAO,CAAA;IACtD;;;;OAIG;IACH,WAAW,EAAE,CAAC,MAAM,EAAE,kBAAkB,GAAG,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACtE,iEAAiE;IACjE,YAAY,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CAClD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/run/process/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type { RunProcessHelper } from './process/types.js';
2
+ export declare const createRunProcessHelper: () => RunProcessHelper;
3
+ export declare const runProcessHelper: RunProcessHelper;
4
+ //# sourceMappingURL=process.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../src/run/process.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D,eAAO,MAAM,sBAAsB,QAAO,gBAqBzC,CAAA;AAED,eAAO,MAAM,gBAAgB,kBAA2B,CAAA"}
@@ -0,0 +1,20 @@
1
+ import { TARGET_API_PORT } from '@owlmeans/viable-common';
2
+ import { spawnHelper } from '../executor/spawn.js';
3
+ export const createRunProcessHelper = () => {
4
+ const apiRunning = (record) => record != null && spawnHelper.isAlive(record.api?.pid);
5
+ const stopProcess = async (record) => {
6
+ if (record == null)
7
+ return;
8
+ if (spawnHelper.isAlive(record.pid)) {
9
+ spawnHelper.signalGroup(record.pid, 'SIGTERM');
10
+ if (!await spawnHelper.waitForPortFree(record.port, 5_000)) {
11
+ spawnHelper.signalGroup(record.pid, 'SIGKILL');
12
+ }
13
+ }
14
+ await spawnHelper.waitForPortFree(record.port, 5_000);
15
+ };
16
+ const apiListening = async (port = TARGET_API_PORT) => await spawnHelper.probeListening(port);
17
+ return { apiRunning, stopProcess, apiListening };
18
+ };
19
+ export const runProcessHelper = createRunProcessHelper();
20
+ //# sourceMappingURL=process.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process.js","sourceRoot":"","sources":["../../src/run/process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAEzD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAIlD,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAqB,EAAE;IAC3D,MAAM,UAAU,GAAG,CAAC,MAA6B,EAAW,EAAE,CAC5D,MAAM,IAAI,IAAI,IAAI,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAExD,MAAM,WAAW,GAAG,KAAK,EAAE,MAAsC,EAAiB,EAAE;QAClF,IAAI,MAAM,IAAI,IAAI;YAAE,OAAM;QAE1B,IAAI,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;YACpC,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,CAAA;YAC9C,IAAI,CAAC,MAAM,WAAW,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;gBAC3D,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,CAAA;YAChD,CAAC;QACH,CAAC;QACD,MAAM,WAAW,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IACvD,CAAC,CAAA;IAED,MAAM,YAAY,GAAG,KAAK,EACxB,IAAI,GAAW,eAAe,EACZ,EAAE,CAAC,MAAM,WAAW,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA;IAE7D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,CAAA;AAClD,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,sBAAsB,EAAE,CAAA"}