ysk-server-core 1.0.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 (1526) hide show
  1. package/README.md +16 -0
  2. package/dist/agents/comms.d.ts +33 -0
  3. package/dist/agents/comms.d.ts.map +1 -0
  4. package/dist/agents/comms.js +67 -0
  5. package/dist/agents/comms.js.map +1 -0
  6. package/dist/agents/fleet.d.ts +60 -0
  7. package/dist/agents/fleet.d.ts.map +1 -0
  8. package/dist/agents/fleet.js +260 -0
  9. package/dist/agents/fleet.js.map +1 -0
  10. package/dist/agents/index.d.ts +7 -0
  11. package/dist/agents/index.d.ts.map +1 -0
  12. package/dist/agents/index.js +7 -0
  13. package/dist/agents/index.js.map +1 -0
  14. package/dist/agents/install.d.ts +34 -0
  15. package/dist/agents/install.d.ts.map +1 -0
  16. package/dist/agents/install.js +154 -0
  17. package/dist/agents/install.js.map +1 -0
  18. package/dist/agents/outbound-agent.d.ts +40 -0
  19. package/dist/agents/outbound-agent.d.ts.map +1 -0
  20. package/dist/agents/outbound-agent.js +135 -0
  21. package/dist/agents/outbound-agent.js.map +1 -0
  22. package/dist/agents/probe.d.ts +44 -0
  23. package/dist/agents/probe.d.ts.map +1 -0
  24. package/dist/agents/probe.js +129 -0
  25. package/dist/agents/probe.js.map +1 -0
  26. package/dist/agents/runtime.d.ts +25 -0
  27. package/dist/agents/runtime.d.ts.map +1 -0
  28. package/dist/agents/runtime.js +82 -0
  29. package/dist/agents/runtime.js.map +1 -0
  30. package/dist/config/schema.d.ts +58 -0
  31. package/dist/config/schema.d.ts.map +1 -0
  32. package/dist/config/schema.js +112 -0
  33. package/dist/config/schema.js.map +1 -0
  34. package/dist/db/database.d.ts +24 -0
  35. package/dist/db/database.d.ts.map +1 -0
  36. package/dist/db/database.js +31 -0
  37. package/dist/db/database.js.map +1 -0
  38. package/dist/db/document-store.d.ts +66 -0
  39. package/dist/db/document-store.d.ts.map +1 -0
  40. package/dist/db/document-store.js +363 -0
  41. package/dist/db/document-store.js.map +1 -0
  42. package/dist/db/index.d.ts +4 -0
  43. package/dist/db/index.d.ts.map +1 -0
  44. package/dist/db/index.js +4 -0
  45. package/dist/db/index.js.map +1 -0
  46. package/dist/db/schema.d.ts +8 -0
  47. package/dist/db/schema.d.ts.map +1 -0
  48. package/dist/db/schema.js +124 -0
  49. package/dist/db/schema.js.map +1 -0
  50. package/dist/db/store.d.ts +257 -0
  51. package/dist/db/store.d.ts.map +1 -0
  52. package/dist/db/store.js +100 -0
  53. package/dist/db/store.js.map +1 -0
  54. package/dist/email/autodiscover.d.ts +17 -0
  55. package/dist/email/autodiscover.d.ts.map +1 -0
  56. package/dist/email/autodiscover.js +70 -0
  57. package/dist/email/autodiscover.js.map +1 -0
  58. package/dist/email/deliverability.d.ts +55 -0
  59. package/dist/email/deliverability.d.ts.map +1 -0
  60. package/dist/email/deliverability.js +135 -0
  61. package/dist/email/deliverability.js.map +1 -0
  62. package/dist/email/dns-records.d.ts +70 -0
  63. package/dist/email/dns-records.d.ts.map +1 -0
  64. package/dist/email/dns-records.js +249 -0
  65. package/dist/email/dns-records.js.map +1 -0
  66. package/dist/email/dnsbl.d.ts +45 -0
  67. package/dist/email/dnsbl.d.ts.map +1 -0
  68. package/dist/email/dnsbl.js +127 -0
  69. package/dist/email/dnsbl.js.map +1 -0
  70. package/dist/email/domain-flags-apply.d.ts +78 -0
  71. package/dist/email/domain-flags-apply.d.ts.map +1 -0
  72. package/dist/email/domain-flags-apply.js +304 -0
  73. package/dist/email/domain-flags-apply.js.map +1 -0
  74. package/dist/email/dovecot-passdb.d.ts +59 -0
  75. package/dist/email/dovecot-passdb.d.ts.map +1 -0
  76. package/dist/email/dovecot-passdb.js +220 -0
  77. package/dist/email/dovecot-passdb.js.map +1 -0
  78. package/dist/email/email-bootstrap.d.ts +69 -0
  79. package/dist/email/email-bootstrap.d.ts.map +1 -0
  80. package/dist/email/email-bootstrap.js +294 -0
  81. package/dist/email/email-bootstrap.js.map +1 -0
  82. package/dist/email/index.d.ts +22 -0
  83. package/dist/email/index.d.ts.map +1 -0
  84. package/dist/email/index.js +22 -0
  85. package/dist/email/index.js.map +1 -0
  86. package/dist/email/live-checks.d.ts +52 -0
  87. package/dist/email/live-checks.d.ts.map +1 -0
  88. package/dist/email/live-checks.js +124 -0
  89. package/dist/email/live-checks.js.map +1 -0
  90. package/dist/email/mail-policy.d.ts +24 -0
  91. package/dist/email/mail-policy.d.ts.map +1 -0
  92. package/dist/email/mail-policy.js +318 -0
  93. package/dist/email/mail-policy.js.map +1 -0
  94. package/dist/email/mail-queue.d.ts +23 -0
  95. package/dist/email/mail-queue.d.ts.map +1 -0
  96. package/dist/email/mail-queue.js +188 -0
  97. package/dist/email/mail-queue.js.map +1 -0
  98. package/dist/email/mail-tls-apply.d.ts +31 -0
  99. package/dist/email/mail-tls-apply.d.ts.map +1 -0
  100. package/dist/email/mail-tls-apply.js +134 -0
  101. package/dist/email/mail-tls-apply.js.map +1 -0
  102. package/dist/email/password-hash.d.ts +16 -0
  103. package/dist/email/password-hash.d.ts.map +1 -0
  104. package/dist/email/password-hash.js +56 -0
  105. package/dist/email/password-hash.js.map +1 -0
  106. package/dist/email/relay.d.ts +45 -0
  107. package/dist/email/relay.d.ts.map +1 -0
  108. package/dist/email/relay.js +122 -0
  109. package/dist/email/relay.js.map +1 -0
  110. package/dist/email/roundcube-sso-plugin.d.ts +44 -0
  111. package/dist/email/roundcube-sso-plugin.d.ts.map +1 -0
  112. package/dist/email/roundcube-sso-plugin.js +278 -0
  113. package/dist/email/roundcube-sso-plugin.js.map +1 -0
  114. package/dist/email/sender-rate-policy.d.ts +24 -0
  115. package/dist/email/sender-rate-policy.d.ts.map +1 -0
  116. package/dist/email/sender-rate-policy.js +245 -0
  117. package/dist/email/sender-rate-policy.js.map +1 -0
  118. package/dist/email/service.d.ts +211 -0
  119. package/dist/email/service.d.ts.map +1 -0
  120. package/dist/email/service.js +1017 -0
  121. package/dist/email/service.js.map +1 -0
  122. package/dist/email/sieve.d.ts +32 -0
  123. package/dist/email/sieve.d.ts.map +1 -0
  124. package/dist/email/sieve.js +80 -0
  125. package/dist/email/sieve.js.map +1 -0
  126. package/dist/email/warmup.d.ts +26 -0
  127. package/dist/email/warmup.d.ts.map +1 -0
  128. package/dist/email/warmup.js +59 -0
  129. package/dist/email/warmup.js.map +1 -0
  130. package/dist/email/webmail-apply.d.ts +40 -0
  131. package/dist/email/webmail-apply.d.ts.map +1 -0
  132. package/dist/email/webmail-apply.js +191 -0
  133. package/dist/email/webmail-apply.js.map +1 -0
  134. package/dist/email/webmail-project.d.ts +194 -0
  135. package/dist/email/webmail-project.d.ts.map +1 -0
  136. package/dist/email/webmail-project.js +1365 -0
  137. package/dist/email/webmail-project.js.map +1 -0
  138. package/dist/email/webmail-sso.d.ts +40 -0
  139. package/dist/email/webmail-sso.d.ts.map +1 -0
  140. package/dist/email/webmail-sso.js +87 -0
  141. package/dist/email/webmail-sso.js.map +1 -0
  142. package/dist/errors/index.d.ts +2 -0
  143. package/dist/errors/index.d.ts.map +1 -0
  144. package/dist/errors/index.js +2 -0
  145. package/dist/errors/index.js.map +1 -0
  146. package/dist/files/index.d.ts +5 -0
  147. package/dist/files/index.d.ts.map +1 -0
  148. package/dist/files/index.js +5 -0
  149. package/dist/files/index.js.map +1 -0
  150. package/dist/files/manager.d.ts +172 -0
  151. package/dist/files/manager.d.ts.map +1 -0
  152. package/dist/files/manager.js +525 -0
  153. package/dist/files/manager.js.map +1 -0
  154. package/dist/files/shares.d.ts +36 -0
  155. package/dist/files/shares.d.ts.map +1 -0
  156. package/dist/files/shares.js +136 -0
  157. package/dist/files/shares.js.map +1 -0
  158. package/dist/files/versions.d.ts +16 -0
  159. package/dist/files/versions.d.ts.map +1 -0
  160. package/dist/files/versions.js +90 -0
  161. package/dist/files/versions.js.map +1 -0
  162. package/dist/files/webdav.d.ts +42 -0
  163. package/dist/files/webdav.d.ts.map +1 -0
  164. package/dist/files/webdav.js +116 -0
  165. package/dist/files/webdav.js.map +1 -0
  166. package/dist/host/executor.d.ts +93 -0
  167. package/dist/host/executor.d.ts.map +1 -0
  168. package/dist/host/executor.js +764 -0
  169. package/dist/host/executor.js.map +1 -0
  170. package/dist/host/health.d.ts +29 -0
  171. package/dist/host/health.d.ts.map +1 -0
  172. package/dist/host/health.js +132 -0
  173. package/dist/host/health.js.map +1 -0
  174. package/dist/host/host-job.d.ts +27 -0
  175. package/dist/host/host-job.d.ts.map +1 -0
  176. package/dist/host/host-job.js +38 -0
  177. package/dist/host/host-job.js.map +1 -0
  178. package/dist/host/host-overview.d.ts +54 -0
  179. package/dist/host/host-overview.d.ts.map +1 -0
  180. package/dist/host/host-overview.js +459 -0
  181. package/dist/host/host-overview.js.map +1 -0
  182. package/dist/host/host-power.d.ts +27 -0
  183. package/dist/host/host-power.d.ts.map +1 -0
  184. package/dist/host/host-power.js +99 -0
  185. package/dist/host/host-power.js.map +1 -0
  186. package/dist/host/index.d.ts +7 -0
  187. package/dist/host/index.d.ts.map +1 -0
  188. package/dist/host/index.js +7 -0
  189. package/dist/host/index.js.map +1 -0
  190. package/dist/host/timezones.d.ts +19 -0
  191. package/dist/host/timezones.d.ts.map +1 -0
  192. package/dist/host/timezones.js +64 -0
  193. package/dist/host/timezones.js.map +1 -0
  194. package/dist/host-browse/audio-bridge.d.ts +20 -0
  195. package/dist/host-browse/audio-bridge.d.ts.map +1 -0
  196. package/dist/host-browse/audio-bridge.js +96 -0
  197. package/dist/host-browse/audio-bridge.js.map +1 -0
  198. package/dist/host-browse/bookmarks.d.ts +44 -0
  199. package/dist/host-browse/bookmarks.d.ts.map +1 -0
  200. package/dist/host-browse/bookmarks.js +54 -0
  201. package/dist/host-browse/bookmarks.js.map +1 -0
  202. package/dist/host-browse/browser-engine.d.ts +167 -0
  203. package/dist/host-browse/browser-engine.d.ts.map +1 -0
  204. package/dist/host-browse/browser-engine.js +777 -0
  205. package/dist/host-browse/browser-engine.js.map +1 -0
  206. package/dist/host-browse/chrome-as-user.d.ts +34 -0
  207. package/dist/host-browse/chrome-as-user.d.ts.map +1 -0
  208. package/dist/host-browse/chrome-as-user.js +131 -0
  209. package/dist/host-browse/chrome-as-user.js.map +1 -0
  210. package/dist/host-browse/chrome-probe.d.ts +11 -0
  211. package/dist/host-browse/chrome-probe.d.ts.map +1 -0
  212. package/dist/host-browse/chrome-probe.js +62 -0
  213. package/dist/host-browse/chrome-probe.js.map +1 -0
  214. package/dist/host-browse/cookie-jar.d.ts +25 -0
  215. package/dist/host-browse/cookie-jar.d.ts.map +1 -0
  216. package/dist/host-browse/cookie-jar.js +126 -0
  217. package/dist/host-browse/cookie-jar.js.map +1 -0
  218. package/dist/host-browse/danger.d.ts +20 -0
  219. package/dist/host-browse/danger.d.ts.map +1 -0
  220. package/dist/host-browse/danger.js +84 -0
  221. package/dist/host-browse/danger.js.map +1 -0
  222. package/dist/host-browse/downloads.d.ts +31 -0
  223. package/dist/host-browse/downloads.d.ts.map +1 -0
  224. package/dist/host-browse/downloads.js +61 -0
  225. package/dist/host-browse/downloads.js.map +1 -0
  226. package/dist/host-browse/ephemeral-user.d.ts +39 -0
  227. package/dist/host-browse/ephemeral-user.d.ts.map +1 -0
  228. package/dist/host-browse/ephemeral-user.js +100 -0
  229. package/dist/host-browse/ephemeral-user.js.map +1 -0
  230. package/dist/host-browse/headers.d.ts +18 -0
  231. package/dist/host-browse/headers.d.ts.map +1 -0
  232. package/dist/host-browse/headers.js +93 -0
  233. package/dist/host-browse/headers.js.map +1 -0
  234. package/dist/host-browse/index.d.ts +18 -0
  235. package/dist/host-browse/index.d.ts.map +1 -0
  236. package/dist/host-browse/index.js +18 -0
  237. package/dist/host-browse/index.js.map +1 -0
  238. package/dist/host-browse/live-ticket.d.ts +19 -0
  239. package/dist/host-browse/live-ticket.d.ts.map +1 -0
  240. package/dist/host-browse/live-ticket.js +39 -0
  241. package/dist/host-browse/live-ticket.js.map +1 -0
  242. package/dist/host-browse/rewrite-html.d.ts +22 -0
  243. package/dist/host-browse/rewrite-html.d.ts.map +1 -0
  244. package/dist/host-browse/rewrite-html.js +134 -0
  245. package/dist/host-browse/rewrite-html.js.map +1 -0
  246. package/dist/host-browse/service.d.ts +122 -0
  247. package/dist/host-browse/service.d.ts.map +1 -0
  248. package/dist/host-browse/service.js +934 -0
  249. package/dist/host-browse/service.js.map +1 -0
  250. package/dist/host-browse/session-store.d.ts +57 -0
  251. package/dist/host-browse/session-store.d.ts.map +1 -0
  252. package/dist/host-browse/session-store.js +182 -0
  253. package/dist/host-browse/session-store.js.map +1 -0
  254. package/dist/host-browse/ssrf.d.ts +27 -0
  255. package/dist/host-browse/ssrf.d.ts.map +1 -0
  256. package/dist/host-browse/ssrf.js +191 -0
  257. package/dist/host-browse/ssrf.js.map +1 -0
  258. package/dist/host-browse/stream-presets.d.ts +33 -0
  259. package/dist/host-browse/stream-presets.d.ts.map +1 -0
  260. package/dist/host-browse/stream-presets.js +84 -0
  261. package/dist/host-browse/stream-presets.js.map +1 -0
  262. package/dist/host-browse/types.d.ts +151 -0
  263. package/dist/host-browse/types.d.ts.map +1 -0
  264. package/dist/host-browse/types.js +42 -0
  265. package/dist/host-browse/types.js.map +1 -0
  266. package/dist/hosting/adminer.d.ts +21 -0
  267. package/dist/hosting/adminer.d.ts.map +1 -0
  268. package/dist/hosting/adminer.js +183 -0
  269. package/dist/hosting/adminer.js.map +1 -0
  270. package/dist/hosting/apache/artifacts.d.ts +57 -0
  271. package/dist/hosting/apache/artifacts.d.ts.map +1 -0
  272. package/dist/hosting/apache/artifacts.js +309 -0
  273. package/dist/hosting/apache/artifacts.js.map +1 -0
  274. package/dist/hosting/apache/index.d.ts +8 -0
  275. package/dist/hosting/apache/index.d.ts.map +1 -0
  276. package/dist/hosting/apache/index.js +8 -0
  277. package/dist/hosting/apache/index.js.map +1 -0
  278. package/dist/hosting/apache/render-site.d.ts +17 -0
  279. package/dist/hosting/apache/render-site.d.ts.map +1 -0
  280. package/dist/hosting/apache/render-site.js +93 -0
  281. package/dist/hosting/apache/render-site.js.map +1 -0
  282. package/dist/hosting/apache/service.d.ts +27 -0
  283. package/dist/hosting/apache/service.d.ts.map +1 -0
  284. package/dist/hosting/apache/service.js +162 -0
  285. package/dist/hosting/apache/service.js.map +1 -0
  286. package/dist/hosting/apache/settings.d.ts +25 -0
  287. package/dist/hosting/apache/settings.d.ts.map +1 -0
  288. package/dist/hosting/apache/settings.js +104 -0
  289. package/dist/hosting/apache/settings.js.map +1 -0
  290. package/dist/hosting/apache/sites-list.d.ts +51 -0
  291. package/dist/hosting/apache/sites-list.d.ts.map +1 -0
  292. package/dist/hosting/apache/sites-list.js +188 -0
  293. package/dist/hosting/apache/sites-list.js.map +1 -0
  294. package/dist/hosting/apache/sync.d.ts +24 -0
  295. package/dist/hosting/apache/sync.d.ts.map +1 -0
  296. package/dist/hosting/apache/sync.js +148 -0
  297. package/dist/hosting/apache/sync.js.map +1 -0
  298. package/dist/hosting/apache/types.d.ts +28 -0
  299. package/dist/hosting/apache/types.d.ts.map +1 -0
  300. package/dist/hosting/apache/types.js +9 -0
  301. package/dist/hosting/apache/types.js.map +1 -0
  302. package/dist/hosting/app-templates.d.ts +44 -0
  303. package/dist/hosting/app-templates.d.ts.map +1 -0
  304. package/dist/hosting/app-templates.js +477 -0
  305. package/dist/hosting/app-templates.js.map +1 -0
  306. package/dist/hosting/apply-audit.d.ts +31 -0
  307. package/dist/hosting/apply-audit.d.ts.map +1 -0
  308. package/dist/hosting/apply-audit.js +149 -0
  309. package/dist/hosting/apply-audit.js.map +1 -0
  310. package/dist/hosting/apply-honesty.d.ts +25 -0
  311. package/dist/hosting/apply-honesty.d.ts.map +1 -0
  312. package/dist/hosting/apply-honesty.js +16 -0
  313. package/dist/hosting/apply-honesty.js.map +1 -0
  314. package/dist/hosting/backup-cron.d.ts +299 -0
  315. package/dist/hosting/backup-cron.d.ts.map +1 -0
  316. package/dist/hosting/backup-cron.js +1021 -0
  317. package/dist/hosting/backup-cron.js.map +1 -0
  318. package/dist/hosting/backup-remote.d.ts +44 -0
  319. package/dist/hosting/backup-remote.d.ts.map +1 -0
  320. package/dist/hosting/backup-remote.js +196 -0
  321. package/dist/hosting/backup-remote.js.map +1 -0
  322. package/dist/hosting/backup-restic.d.ts +82 -0
  323. package/dist/hosting/backup-restic.d.ts.map +1 -0
  324. package/dist/hosting/backup-restic.js +290 -0
  325. package/dist/hosting/backup-restic.js.map +1 -0
  326. package/dist/hosting/bt-tracker/index.d.ts +10 -0
  327. package/dist/hosting/bt-tracker/index.d.ts.map +1 -0
  328. package/dist/hosting/bt-tracker/index.js +10 -0
  329. package/dist/hosting/bt-tracker/index.js.map +1 -0
  330. package/dist/hosting/bt-tracker/prepare-share-bt.d.ts +17 -0
  331. package/dist/hosting/bt-tracker/prepare-share-bt.d.ts.map +1 -0
  332. package/dist/hosting/bt-tracker/prepare-share-bt.js +54 -0
  333. package/dist/hosting/bt-tracker/prepare-share-bt.js.map +1 -0
  334. package/dist/hosting/bt-tracker/process.d.ts +28 -0
  335. package/dist/hosting/bt-tracker/process.d.ts.map +1 -0
  336. package/dist/hosting/bt-tracker/process.js +210 -0
  337. package/dist/hosting/bt-tracker/process.js.map +1 -0
  338. package/dist/hosting/bt-tracker/restore-shares.d.ts +24 -0
  339. package/dist/hosting/bt-tracker/restore-shares.d.ts.map +1 -0
  340. package/dist/hosting/bt-tracker/restore-shares.js +140 -0
  341. package/dist/hosting/bt-tracker/restore-shares.js.map +1 -0
  342. package/dist/hosting/bt-tracker/scrape.d.ts +23 -0
  343. package/dist/hosting/bt-tracker/scrape.d.ts.map +1 -0
  344. package/dist/hosting/bt-tracker/scrape.js +147 -0
  345. package/dist/hosting/bt-tracker/scrape.js.map +1 -0
  346. package/dist/hosting/bt-tracker/seeder.d.ts +45 -0
  347. package/dist/hosting/bt-tracker/seeder.d.ts.map +1 -0
  348. package/dist/hosting/bt-tracker/seeder.js +154 -0
  349. package/dist/hosting/bt-tracker/seeder.js.map +1 -0
  350. package/dist/hosting/bt-tracker/service.d.ts +99 -0
  351. package/dist/hosting/bt-tracker/service.d.ts.map +1 -0
  352. package/dist/hosting/bt-tracker/service.js +405 -0
  353. package/dist/hosting/bt-tracker/service.js.map +1 -0
  354. package/dist/hosting/bt-tracker/settings.d.ts +38 -0
  355. package/dist/hosting/bt-tracker/settings.d.ts.map +1 -0
  356. package/dist/hosting/bt-tracker/settings.js +151 -0
  357. package/dist/hosting/bt-tracker/settings.js.map +1 -0
  358. package/dist/hosting/bt-tracker/torrent-create.d.ts +44 -0
  359. package/dist/hosting/bt-tracker/torrent-create.d.ts.map +1 -0
  360. package/dist/hosting/bt-tracker/torrent-create.js +194 -0
  361. package/dist/hosting/bt-tracker/torrent-create.js.map +1 -0
  362. package/dist/hosting/bt-tracker/torrent-jobs.d.ts +40 -0
  363. package/dist/hosting/bt-tracker/torrent-jobs.d.ts.map +1 -0
  364. package/dist/hosting/bt-tracker/torrent-jobs.js +109 -0
  365. package/dist/hosting/bt-tracker/torrent-jobs.js.map +1 -0
  366. package/dist/hosting/bt-tracker/worker.d.ts +2 -0
  367. package/dist/hosting/bt-tracker/worker.d.ts.map +1 -0
  368. package/dist/hosting/bt-tracker/worker.js +47 -0
  369. package/dist/hosting/bt-tracker/worker.js.map +1 -0
  370. package/dist/hosting/cdn/dns-sync.d.ts +131 -0
  371. package/dist/hosting/cdn/dns-sync.d.ts.map +1 -0
  372. package/dist/hosting/cdn/dns-sync.js +520 -0
  373. package/dist/hosting/cdn/dns-sync.js.map +1 -0
  374. package/dist/hosting/cdn/edge-render.d.ts +76 -0
  375. package/dist/hosting/cdn/edge-render.d.ts.map +1 -0
  376. package/dist/hosting/cdn/edge-render.js +380 -0
  377. package/dist/hosting/cdn/edge-render.js.map +1 -0
  378. package/dist/hosting/cdn/fan-out.d.ts +67 -0
  379. package/dist/hosting/cdn/fan-out.d.ts.map +1 -0
  380. package/dist/hosting/cdn/fan-out.js +807 -0
  381. package/dist/hosting/cdn/fan-out.js.map +1 -0
  382. package/dist/hosting/cdn/fleet-payload.d.ts +42 -0
  383. package/dist/hosting/cdn/fleet-payload.d.ts.map +1 -0
  384. package/dist/hosting/cdn/fleet-payload.js +128 -0
  385. package/dist/hosting/cdn/fleet-payload.js.map +1 -0
  386. package/dist/hosting/cdn/from-project.d.ts +39 -0
  387. package/dist/hosting/cdn/from-project.d.ts.map +1 -0
  388. package/dist/hosting/cdn/from-project.js +101 -0
  389. package/dist/hosting/cdn/from-project.js.map +1 -0
  390. package/dist/hosting/cdn/index.d.ts +10 -0
  391. package/dist/hosting/cdn/index.d.ts.map +1 -0
  392. package/dist/hosting/cdn/index.js +10 -0
  393. package/dist/hosting/cdn/index.js.map +1 -0
  394. package/dist/hosting/cdn/metrics.d.ts +69 -0
  395. package/dist/hosting/cdn/metrics.d.ts.map +1 -0
  396. package/dist/hosting/cdn/metrics.js +270 -0
  397. package/dist/hosting/cdn/metrics.js.map +1 -0
  398. package/dist/hosting/cdn/nodes.d.ts +51 -0
  399. package/dist/hosting/cdn/nodes.d.ts.map +1 -0
  400. package/dist/hosting/cdn/nodes.js +282 -0
  401. package/dist/hosting/cdn/nodes.js.map +1 -0
  402. package/dist/hosting/cdn/sites.d.ts +27 -0
  403. package/dist/hosting/cdn/sites.d.ts.map +1 -0
  404. package/dist/hosting/cdn/sites.js +265 -0
  405. package/dist/hosting/cdn/sites.js.map +1 -0
  406. package/dist/hosting/cdn/ssl.d.ts +82 -0
  407. package/dist/hosting/cdn/ssl.d.ts.map +1 -0
  408. package/dist/hosting/cdn/ssl.js +593 -0
  409. package/dist/hosting/cdn/ssl.js.map +1 -0
  410. package/dist/hosting/cloudflare-dns.d.ts +65 -0
  411. package/dist/hosting/cloudflare-dns.d.ts.map +1 -0
  412. package/dist/hosting/cloudflare-dns.js +206 -0
  413. package/dist/hosting/cloudflare-dns.js.map +1 -0
  414. package/dist/hosting/database.d.ts +27 -0
  415. package/dist/hosting/database.d.ts.map +1 -0
  416. package/dist/hosting/database.js +51 -0
  417. package/dist/hosting/database.js.map +1 -0
  418. package/dist/hosting/datadir-perms.d.ts +19 -0
  419. package/dist/hosting/datadir-perms.d.ts.map +1 -0
  420. package/dist/hosting/datadir-perms.js +55 -0
  421. package/dist/hosting/datadir-perms.js.map +1 -0
  422. package/dist/hosting/db-browser-project.d.ts +67 -0
  423. package/dist/hosting/db-browser-project.d.ts.map +1 -0
  424. package/dist/hosting/db-browser-project.js +287 -0
  425. package/dist/hosting/db-browser-project.js.map +1 -0
  426. package/dist/hosting/db-client.d.ts +33 -0
  427. package/dist/hosting/db-client.d.ts.map +1 -0
  428. package/dist/hosting/db-client.js +70 -0
  429. package/dist/hosting/db-client.js.map +1 -0
  430. package/dist/hosting/db-cluster/apply-local.d.ts +35 -0
  431. package/dist/hosting/db-cluster/apply-local.d.ts.map +1 -0
  432. package/dist/hosting/db-cluster/apply-local.js +349 -0
  433. package/dist/hosting/db-cluster/apply-local.js.map +1 -0
  434. package/dist/hosting/db-cluster/fleet-dispatch.d.ts +42 -0
  435. package/dist/hosting/db-cluster/fleet-dispatch.d.ts.map +1 -0
  436. package/dist/hosting/db-cluster/fleet-dispatch.js +116 -0
  437. package/dist/hosting/db-cluster/fleet-dispatch.js.map +1 -0
  438. package/dist/hosting/db-cluster/import-sync.d.ts +18 -0
  439. package/dist/hosting/db-cluster/import-sync.d.ts.map +1 -0
  440. package/dist/hosting/db-cluster/import-sync.js +57 -0
  441. package/dist/hosting/db-cluster/import-sync.js.map +1 -0
  442. package/dist/hosting/db-cluster/index.d.ts +14 -0
  443. package/dist/hosting/db-cluster/index.d.ts.map +1 -0
  444. package/dist/hosting/db-cluster/index.js +14 -0
  445. package/dist/hosting/db-cluster/index.js.map +1 -0
  446. package/dist/hosting/db-cluster/peer-ops.d.ts +50 -0
  447. package/dist/hosting/db-cluster/peer-ops.d.ts.map +1 -0
  448. package/dist/hosting/db-cluster/peer-ops.js +470 -0
  449. package/dist/hosting/db-cluster/peer-ops.js.map +1 -0
  450. package/dist/hosting/db-cluster/plan-mariadb-galera.d.ts +14 -0
  451. package/dist/hosting/db-cluster/plan-mariadb-galera.d.ts.map +1 -0
  452. package/dist/hosting/db-cluster/plan-mariadb-galera.js +190 -0
  453. package/dist/hosting/db-cluster/plan-mariadb-galera.js.map +1 -0
  454. package/dist/hosting/db-cluster/plan-mysql-replica.d.ts +13 -0
  455. package/dist/hosting/db-cluster/plan-mysql-replica.d.ts.map +1 -0
  456. package/dist/hosting/db-cluster/plan-mysql-replica.js +221 -0
  457. package/dist/hosting/db-cluster/plan-mysql-replica.js.map +1 -0
  458. package/dist/hosting/db-cluster/plan-postgres-replica.d.ts +11 -0
  459. package/dist/hosting/db-cluster/plan-postgres-replica.d.ts.map +1 -0
  460. package/dist/hosting/db-cluster/plan-postgres-replica.js +193 -0
  461. package/dist/hosting/db-cluster/plan-postgres-replica.js.map +1 -0
  462. package/dist/hosting/db-cluster/plan-redis-replica.d.ts +10 -0
  463. package/dist/hosting/db-cluster/plan-redis-replica.d.ts.map +1 -0
  464. package/dist/hosting/db-cluster/plan-redis-replica.js +184 -0
  465. package/dist/hosting/db-cluster/plan-redis-replica.js.map +1 -0
  466. package/dist/hosting/db-cluster/plan.d.ts +15 -0
  467. package/dist/hosting/db-cluster/plan.d.ts.map +1 -0
  468. package/dist/hosting/db-cluster/plan.js +59 -0
  469. package/dist/hosting/db-cluster/plan.js.map +1 -0
  470. package/dist/hosting/db-cluster/probe.d.ts +37 -0
  471. package/dist/hosting/db-cluster/probe.d.ts.map +1 -0
  472. package/dist/hosting/db-cluster/probe.js +414 -0
  473. package/dist/hosting/db-cluster/probe.js.map +1 -0
  474. package/dist/hosting/db-cluster/push-peer.d.ts +85 -0
  475. package/dist/hosting/db-cluster/push-peer.d.ts.map +1 -0
  476. package/dist/hosting/db-cluster/push-peer.js +360 -0
  477. package/dist/hosting/db-cluster/push-peer.js.map +1 -0
  478. package/dist/hosting/db-cluster/store.d.ts +12 -0
  479. package/dist/hosting/db-cluster/store.d.ts.map +1 -0
  480. package/dist/hosting/db-cluster/store.js +240 -0
  481. package/dist/hosting/db-cluster/store.js.map +1 -0
  482. package/dist/hosting/db-cluster/types.d.ts +83 -0
  483. package/dist/hosting/db-cluster/types.d.ts.map +1 -0
  484. package/dist/hosting/db-cluster/types.js +6 -0
  485. package/dist/hosting/db-cluster/types.js.map +1 -0
  486. package/dist/hosting/db-dump.d.ts +39 -0
  487. package/dist/hosting/db-dump.d.ts.map +1 -0
  488. package/dist/hosting/db-dump.js +150 -0
  489. package/dist/hosting/db-dump.js.map +1 -0
  490. package/dist/hosting/db-engine.d.ts +75 -0
  491. package/dist/hosting/db-engine.d.ts.map +1 -0
  492. package/dist/hosting/db-engine.js +225 -0
  493. package/dist/hosting/db-engine.js.map +1 -0
  494. package/dist/hosting/db-service-config.d.ts +100 -0
  495. package/dist/hosting/db-service-config.d.ts.map +1 -0
  496. package/dist/hosting/db-service-config.js +410 -0
  497. package/dist/hosting/db-service-config.js.map +1 -0
  498. package/dist/hosting/defense/auto-ban.d.ts +86 -0
  499. package/dist/hosting/defense/auto-ban.d.ts.map +1 -0
  500. package/dist/hosting/defense/auto-ban.js +573 -0
  501. package/dist/hosting/defense/auto-ban.js.map +1 -0
  502. package/dist/hosting/defense/automation.d.ts +104 -0
  503. package/dist/hosting/defense/automation.d.ts.map +1 -0
  504. package/dist/hosting/defense/automation.js +475 -0
  505. package/dist/hosting/defense/automation.js.map +1 -0
  506. package/dist/hosting/defense/cf-ufw.d.ts +23 -0
  507. package/dist/hosting/defense/cf-ufw.d.ts.map +1 -0
  508. package/dist/hosting/defense/cf-ufw.js +108 -0
  509. package/dist/hosting/defense/cf-ufw.js.map +1 -0
  510. package/dist/hosting/defense/cloudflare-ua.d.ts +58 -0
  511. package/dist/hosting/defense/cloudflare-ua.d.ts.map +1 -0
  512. package/dist/hosting/defense/cloudflare-ua.js +167 -0
  513. package/dist/hosting/defense/cloudflare-ua.js.map +1 -0
  514. package/dist/hosting/defense/defense-service.d.ts +96 -0
  515. package/dist/hosting/defense/defense-service.d.ts.map +1 -0
  516. package/dist/hosting/defense/defense-service.js +597 -0
  517. package/dist/hosting/defense/defense-service.js.map +1 -0
  518. package/dist/hosting/defense/geoip/downloader.d.ts +24 -0
  519. package/dist/hosting/defense/geoip/downloader.d.ts.map +1 -0
  520. package/dist/hosting/defense/geoip/downloader.js +179 -0
  521. package/dist/hosting/defense/geoip/downloader.js.map +1 -0
  522. package/dist/hosting/defense/geoip/index.d.ts +32 -0
  523. package/dist/hosting/defense/geoip/index.d.ts.map +1 -0
  524. package/dist/hosting/defense/geoip/index.js +140 -0
  525. package/dist/hosting/defense/geoip/index.js.map +1 -0
  526. package/dist/hosting/defense/geoip/lookup.d.ts +4 -0
  527. package/dist/hosting/defense/geoip/lookup.d.ts.map +1 -0
  528. package/dist/hosting/defense/geoip/lookup.js +320 -0
  529. package/dist/hosting/defense/geoip/lookup.js.map +1 -0
  530. package/dist/hosting/defense/geoip/nginx-geo.d.ts +19 -0
  531. package/dist/hosting/defense/geoip/nginx-geo.d.ts.map +1 -0
  532. package/dist/hosting/defense/geoip/nginx-geo.js +94 -0
  533. package/dist/hosting/defense/geoip/nginx-geo.js.map +1 -0
  534. package/dist/hosting/defense/geoip/policy.d.ts +21 -0
  535. package/dist/hosting/defense/geoip/policy.d.ts.map +1 -0
  536. package/dist/hosting/defense/geoip/policy.js +161 -0
  537. package/dist/hosting/defense/geoip/policy.js.map +1 -0
  538. package/dist/hosting/defense/geoip/providers.d.ts +30 -0
  539. package/dist/hosting/defense/geoip/providers.d.ts.map +1 -0
  540. package/dist/hosting/defense/geoip/providers.js +98 -0
  541. package/dist/hosting/defense/geoip/providers.js.map +1 -0
  542. package/dist/hosting/defense/geoip/types.d.ts +102 -0
  543. package/dist/hosting/defense/geoip/types.d.ts.map +1 -0
  544. package/dist/hosting/defense/geoip/types.js +89 -0
  545. package/dist/hosting/defense/geoip/types.js.map +1 -0
  546. package/dist/hosting/defense/index.d.ts +12 -0
  547. package/dist/hosting/defense/index.d.ts.map +1 -0
  548. package/dist/hosting/defense/index.js +12 -0
  549. package/dist/hosting/defense/index.js.map +1 -0
  550. package/dist/hosting/defense/intel.d.ts +26 -0
  551. package/dist/hosting/defense/intel.d.ts.map +1 -0
  552. package/dist/hosting/defense/intel.js +148 -0
  553. package/dist/hosting/defense/intel.js.map +1 -0
  554. package/dist/hosting/defense/nginx-limits.d.ts +39 -0
  555. package/dist/hosting/defense/nginx-limits.d.ts.map +1 -0
  556. package/dist/hosting/defense/nginx-limits.js +142 -0
  557. package/dist/hosting/defense/nginx-limits.js.map +1 -0
  558. package/dist/hosting/defense/presets.d.ts +12 -0
  559. package/dist/hosting/defense/presets.d.ts.map +1 -0
  560. package/dist/hosting/defense/presets.js +128 -0
  561. package/dist/hosting/defense/presets.js.map +1 -0
  562. package/dist/hosting/defense/signals.d.ts +60 -0
  563. package/dist/hosting/defense/signals.d.ts.map +1 -0
  564. package/dist/hosting/defense/signals.js +176 -0
  565. package/dist/hosting/defense/signals.js.map +1 -0
  566. package/dist/hosting/defense/types.d.ts +134 -0
  567. package/dist/hosting/defense/types.d.ts.map +1 -0
  568. package/dist/hosting/defense/types.js +5 -0
  569. package/dist/hosting/defense/types.js.map +1 -0
  570. package/dist/hosting/dns-cluster.d.ts +100 -0
  571. package/dist/hosting/dns-cluster.d.ts.map +1 -0
  572. package/dist/hosting/dns-cluster.js +532 -0
  573. package/dist/hosting/dns-cluster.js.map +1 -0
  574. package/dist/hosting/dns-health.d.ts +93 -0
  575. package/dist/hosting/dns-health.d.ts.map +1 -0
  576. package/dist/hosting/dns-health.js +491 -0
  577. package/dist/hosting/dns-health.js.map +1 -0
  578. package/dist/hosting/dns-lookup.d.ts +22 -0
  579. package/dist/hosting/dns-lookup.d.ts.map +1 -0
  580. package/dist/hosting/dns-lookup.js +114 -0
  581. package/dist/hosting/dns-lookup.js.map +1 -0
  582. package/dist/hosting/dns-validate.d.ts +25 -0
  583. package/dist/hosting/dns-validate.d.ts.map +1 -0
  584. package/dist/hosting/dns-validate.js +145 -0
  585. package/dist/hosting/dns-validate.js.map +1 -0
  586. package/dist/hosting/dns-zone.d.ts +112 -0
  587. package/dist/hosting/dns-zone.d.ts.map +1 -0
  588. package/dist/hosting/dns-zone.js +365 -0
  589. package/dist/hosting/dns-zone.js.map +1 -0
  590. package/dist/hosting/dnssec.d.ts +22 -0
  591. package/dist/hosting/dnssec.d.ts.map +1 -0
  592. package/dist/hosting/dnssec.js +170 -0
  593. package/dist/hosting/dnssec.js.map +1 -0
  594. package/dist/hosting/extras.d.ts +106 -0
  595. package/dist/hosting/extras.d.ts.map +1 -0
  596. package/dist/hosting/extras.js +294 -0
  597. package/dist/hosting/extras.js.map +1 -0
  598. package/dist/hosting/fail2ban-ops.d.ts +72 -0
  599. package/dist/hosting/fail2ban-ops.d.ts.map +1 -0
  600. package/dist/hosting/fail2ban-ops.js +229 -0
  601. package/dist/hosting/fail2ban-ops.js.map +1 -0
  602. package/dist/hosting/firewall-ops.d.ts +109 -0
  603. package/dist/hosting/firewall-ops.d.ts.map +1 -0
  604. package/dist/hosting/firewall-ops.js +398 -0
  605. package/dist/hosting/firewall-ops.js.map +1 -0
  606. package/dist/hosting/ftps-service.d.ts +182 -0
  607. package/dist/hosting/ftps-service.d.ts.map +1 -0
  608. package/dist/hosting/ftps-service.js +909 -0
  609. package/dist/hosting/ftps-service.js.map +1 -0
  610. package/dist/hosting/git-deploy.d.ts +33 -0
  611. package/dist/hosting/git-deploy.d.ts.map +1 -0
  612. package/dist/hosting/git-deploy.js +181 -0
  613. package/dist/hosting/git-deploy.js.map +1 -0
  614. package/dist/hosting/global-search.d.ts +23 -0
  615. package/dist/hosting/global-search.d.ts.map +1 -0
  616. package/dist/hosting/global-search.js +296 -0
  617. package/dist/hosting/global-search.js.map +1 -0
  618. package/dist/hosting/host-migrate/bootstrap-target.d.ts +84 -0
  619. package/dist/hosting/host-migrate/bootstrap-target.d.ts.map +1 -0
  620. package/dist/hosting/host-migrate/bootstrap-target.js +457 -0
  621. package/dist/hosting/host-migrate/bootstrap-target.js.map +1 -0
  622. package/dist/hosting/host-migrate/index.d.ts +16 -0
  623. package/dist/hosting/host-migrate/index.d.ts.map +1 -0
  624. package/dist/hosting/host-migrate/index.js +16 -0
  625. package/dist/hosting/host-migrate/index.js.map +1 -0
  626. package/dist/hosting/host-migrate/inventory.d.ts +27 -0
  627. package/dist/hosting/host-migrate/inventory.d.ts.map +1 -0
  628. package/dist/hosting/host-migrate/inventory.js +386 -0
  629. package/dist/hosting/host-migrate/inventory.js.map +1 -0
  630. package/dist/hosting/host-migrate/job-store.d.ts +23 -0
  631. package/dist/hosting/host-migrate/job-store.d.ts.map +1 -0
  632. package/dist/hosting/host-migrate/job-store.js +126 -0
  633. package/dist/hosting/host-migrate/job-store.js.map +1 -0
  634. package/dist/hosting/host-migrate/orchestrator.d.ts +69 -0
  635. package/dist/hosting/host-migrate/orchestrator.d.ts.map +1 -0
  636. package/dist/hosting/host-migrate/orchestrator.js +376 -0
  637. package/dist/hosting/host-migrate/orchestrator.js.map +1 -0
  638. package/dist/hosting/host-migrate/package-source.d.ts +88 -0
  639. package/dist/hosting/host-migrate/package-source.d.ts.map +1 -0
  640. package/dist/hosting/host-migrate/package-source.js +473 -0
  641. package/dist/hosting/host-migrate/package-source.js.map +1 -0
  642. package/dist/hosting/host-migrate/post-transfer.d.ts +32 -0
  643. package/dist/hosting/host-migrate/post-transfer.d.ts.map +1 -0
  644. package/dist/hosting/host-migrate/post-transfer.js +81 -0
  645. package/dist/hosting/host-migrate/post-transfer.js.map +1 -0
  646. package/dist/hosting/host-migrate/preflight.d.ts +58 -0
  647. package/dist/hosting/host-migrate/preflight.d.ts.map +1 -0
  648. package/dist/hosting/host-migrate/preflight.js +315 -0
  649. package/dist/hosting/host-migrate/preflight.js.map +1 -0
  650. package/dist/hosting/host-migrate/reapply.d.ts +36 -0
  651. package/dist/hosting/host-migrate/reapply.d.ts.map +1 -0
  652. package/dist/hosting/host-migrate/reapply.js +361 -0
  653. package/dist/hosting/host-migrate/reapply.js.map +1 -0
  654. package/dist/hosting/host-migrate/redis-dump.d.ts +25 -0
  655. package/dist/hosting/host-migrate/redis-dump.d.ts.map +1 -0
  656. package/dist/hosting/host-migrate/redis-dump.js +153 -0
  657. package/dist/hosting/host-migrate/redis-dump.js.map +1 -0
  658. package/dist/hosting/host-migrate/restore.d.ts +62 -0
  659. package/dist/hosting/host-migrate/restore.d.ts.map +1 -0
  660. package/dist/hosting/host-migrate/restore.js +420 -0
  661. package/dist/hosting/host-migrate/restore.js.map +1 -0
  662. package/dist/hosting/host-migrate/temp-key.d.ts +56 -0
  663. package/dist/hosting/host-migrate/temp-key.d.ts.map +1 -0
  664. package/dist/hosting/host-migrate/temp-key.js +207 -0
  665. package/dist/hosting/host-migrate/temp-key.js.map +1 -0
  666. package/dist/hosting/host-migrate/transfer.d.ts +57 -0
  667. package/dist/hosting/host-migrate/transfer.d.ts.map +1 -0
  668. package/dist/hosting/host-migrate/transfer.js +408 -0
  669. package/dist/hosting/host-migrate/transfer.js.map +1 -0
  670. package/dist/hosting/host-migrate/transport.d.ts +96 -0
  671. package/dist/hosting/host-migrate/transport.d.ts.map +1 -0
  672. package/dist/hosting/host-migrate/transport.js +363 -0
  673. package/dist/hosting/host-migrate/transport.js.map +1 -0
  674. package/dist/hosting/host-migrate/types.d.ts +8 -0
  675. package/dist/hosting/host-migrate/types.d.ts.map +1 -0
  676. package/dist/hosting/host-migrate/types.js +9 -0
  677. package/dist/hosting/host-migrate/types.js.map +1 -0
  678. package/dist/hosting/host-migrate/verify.d.ts +29 -0
  679. package/dist/hosting/host-migrate/verify.d.ts.map +1 -0
  680. package/dist/hosting/host-migrate/verify.js +268 -0
  681. package/dist/hosting/host-migrate/verify.js.map +1 -0
  682. package/dist/hosting/index.d.ts +103 -0
  683. package/dist/hosting/index.d.ts.map +1 -0
  684. package/dist/hosting/index.js +103 -0
  685. package/dist/hosting/index.js.map +1 -0
  686. package/dist/hosting/log-center/catalog.d.ts +33 -0
  687. package/dist/hosting/log-center/catalog.d.ts.map +1 -0
  688. package/dist/hosting/log-center/catalog.js +321 -0
  689. package/dist/hosting/log-center/catalog.js.map +1 -0
  690. package/dist/hosting/log-center/file-tail.d.ts +20 -0
  691. package/dist/hosting/log-center/file-tail.d.ts.map +1 -0
  692. package/dist/hosting/log-center/file-tail.js +89 -0
  693. package/dist/hosting/log-center/file-tail.js.map +1 -0
  694. package/dist/hosting/log-center/index.d.ts +6 -0
  695. package/dist/hosting/log-center/index.d.ts.map +1 -0
  696. package/dist/hosting/log-center/index.js +6 -0
  697. package/dist/hosting/log-center/index.js.map +1 -0
  698. package/dist/hosting/log-center/journal.d.ts +35 -0
  699. package/dist/hosting/log-center/journal.d.ts.map +1 -0
  700. package/dist/hosting/log-center/journal.js +248 -0
  701. package/dist/hosting/log-center/journal.js.map +1 -0
  702. package/dist/hosting/log-center/service.d.ts +92 -0
  703. package/dist/hosting/log-center/service.d.ts.map +1 -0
  704. package/dist/hosting/log-center/service.js +548 -0
  705. package/dist/hosting/log-center/service.js.map +1 -0
  706. package/dist/hosting/log-center/types.d.ts +103 -0
  707. package/dist/hosting/log-center/types.d.ts.map +1 -0
  708. package/dist/hosting/log-center/types.js +17 -0
  709. package/dist/hosting/log-center/types.js.map +1 -0
  710. package/dist/hosting/managed-resources.d.ts +87 -0
  711. package/dist/hosting/managed-resources.d.ts.map +1 -0
  712. package/dist/hosting/managed-resources.js +561 -0
  713. package/dist/hosting/managed-resources.js.map +1 -0
  714. package/dist/hosting/mysql-provision.d.ts +37 -0
  715. package/dist/hosting/mysql-provision.d.ts.map +1 -0
  716. package/dist/hosting/mysql-provision.js +91 -0
  717. package/dist/hosting/mysql-provision.js.map +1 -0
  718. package/dist/hosting/nginx-settings.d.ts +47 -0
  719. package/dist/hosting/nginx-settings.d.ts.map +1 -0
  720. package/dist/hosting/nginx-settings.js +147 -0
  721. package/dist/hosting/nginx-settings.js.map +1 -0
  722. package/dist/hosting/nginx-sites-list.d.ts +31 -0
  723. package/dist/hosting/nginx-sites-list.d.ts.map +1 -0
  724. package/dist/hosting/nginx-sites-list.js +86 -0
  725. package/dist/hosting/nginx-sites-list.js.map +1 -0
  726. package/dist/hosting/nginx-ssl.d.ts +84 -0
  727. package/dist/hosting/nginx-ssl.d.ts.map +1 -0
  728. package/dist/hosting/nginx-ssl.js +342 -0
  729. package/dist/hosting/nginx-ssl.js.map +1 -0
  730. package/dist/hosting/nginx-sync.d.ts +38 -0
  731. package/dist/hosting/nginx-sync.d.ts.map +1 -0
  732. package/dist/hosting/nginx-sync.js +141 -0
  733. package/dist/hosting/nginx-sync.js.map +1 -0
  734. package/dist/hosting/node-apply.d.ts +32 -0
  735. package/dist/hosting/node-apply.d.ts.map +1 -0
  736. package/dist/hosting/node-apply.js +86 -0
  737. package/dist/hosting/node-apply.js.map +1 -0
  738. package/dist/hosting/package-limits.d.ts +38 -0
  739. package/dist/hosting/package-limits.d.ts.map +1 -0
  740. package/dist/hosting/package-limits.js +129 -0
  741. package/dist/hosting/package-limits.js.map +1 -0
  742. package/dist/hosting/panel-tls.d.ts +150 -0
  743. package/dist/hosting/panel-tls.d.ts.map +1 -0
  744. package/dist/hosting/panel-tls.js +533 -0
  745. package/dist/hosting/panel-tls.js.map +1 -0
  746. package/dist/hosting/php-disable-functions.d.ts +25 -0
  747. package/dist/hosting/php-disable-functions.d.ts.map +1 -0
  748. package/dist/hosting/php-disable-functions.js +79 -0
  749. package/dist/hosting/php-disable-functions.js.map +1 -0
  750. package/dist/hosting/php-extensions.d.ts +118 -0
  751. package/dist/hosting/php-extensions.d.ts.map +1 -0
  752. package/dist/hosting/php-extensions.js +482 -0
  753. package/dist/hosting/php-extensions.js.map +1 -0
  754. package/dist/hosting/php-fpm.d.ts +38 -0
  755. package/dist/hosting/php-fpm.d.ts.map +1 -0
  756. package/dist/hosting/php-fpm.js +94 -0
  757. package/dist/hosting/php-fpm.js.map +1 -0
  758. package/dist/hosting/php-ini-catalog.d.ts +55 -0
  759. package/dist/hosting/php-ini-catalog.d.ts.map +1 -0
  760. package/dist/hosting/php-ini-catalog.js +469 -0
  761. package/dist/hosting/php-ini-catalog.js.map +1 -0
  762. package/dist/hosting/php-ini.d.ts +54 -0
  763. package/dist/hosting/php-ini.d.ts.map +1 -0
  764. package/dist/hosting/php-ini.js +299 -0
  765. package/dist/hosting/php-ini.js.map +1 -0
  766. package/dist/hosting/pm2-apply.d.ts +163 -0
  767. package/dist/hosting/pm2-apply.d.ts.map +1 -0
  768. package/dist/hosting/pm2-apply.js +629 -0
  769. package/dist/hosting/pm2-apply.js.map +1 -0
  770. package/dist/hosting/pm2-status.d.ts +59 -0
  771. package/dist/hosting/pm2-status.d.ts.map +1 -0
  772. package/dist/hosting/pm2-status.js +188 -0
  773. package/dist/hosting/pm2-status.js.map +1 -0
  774. package/dist/hosting/postfix-bootstrap.d.ts +56 -0
  775. package/dist/hosting/postfix-bootstrap.d.ts.map +1 -0
  776. package/dist/hosting/postfix-bootstrap.js +212 -0
  777. package/dist/hosting/postfix-bootstrap.js.map +1 -0
  778. package/dist/hosting/postgres-provision.d.ts +48 -0
  779. package/dist/hosting/postgres-provision.d.ts.map +1 -0
  780. package/dist/hosting/postgres-provision.js +166 -0
  781. package/dist/hosting/postgres-provision.js.map +1 -0
  782. package/dist/hosting/powerdns-apply.d.ts +215 -0
  783. package/dist/hosting/powerdns-apply.d.ts.map +1 -0
  784. package/dist/hosting/powerdns-apply.js +790 -0
  785. package/dist/hosting/powerdns-apply.js.map +1 -0
  786. package/dist/hosting/process-fleet.d.ts +55 -0
  787. package/dist/hosting/process-fleet.d.ts.map +1 -0
  788. package/dist/hosting/process-fleet.js +203 -0
  789. package/dist/hosting/process-fleet.js.map +1 -0
  790. package/dist/hosting/production-readiness.d.ts +47 -0
  791. package/dist/hosting/production-readiness.d.ts.map +1 -0
  792. package/dist/hosting/production-readiness.js +797 -0
  793. package/dist/hosting/production-readiness.js.map +1 -0
  794. package/dist/hosting/project-isolation-status.d.ts +47 -0
  795. package/dist/hosting/project-isolation-status.d.ts.map +1 -0
  796. package/dist/hosting/project-isolation-status.js +150 -0
  797. package/dist/hosting/project-isolation-status.js.map +1 -0
  798. package/dist/hosting/project-logs.d.ts +124 -0
  799. package/dist/hosting/project-logs.d.ts.map +1 -0
  800. package/dist/hosting/project-logs.js +510 -0
  801. package/dist/hosting/project-logs.js.map +1 -0
  802. package/dist/hosting/project-ops.d.ts +324 -0
  803. package/dist/hosting/project-ops.d.ts.map +1 -0
  804. package/dist/hosting/project-ops.js +2509 -0
  805. package/dist/hosting/project-ops.js.map +1 -0
  806. package/dist/hosting/project-os-user.d.ts +44 -0
  807. package/dist/hosting/project-os-user.d.ts.map +1 -0
  808. package/dist/hosting/project-os-user.js +279 -0
  809. package/dist/hosting/project-os-user.js.map +1 -0
  810. package/dist/hosting/project-ownership.d.ts +21 -0
  811. package/dist/hosting/project-ownership.d.ts.map +1 -0
  812. package/dist/hosting/project-ownership.js +52 -0
  813. package/dist/hosting/project-ownership.js.map +1 -0
  814. package/dist/hosting/project-service.d.ts +156 -0
  815. package/dist/hosting/project-service.d.ts.map +1 -0
  816. package/dist/hosting/project-service.js +950 -0
  817. package/dist/hosting/project-service.js.map +1 -0
  818. package/dist/hosting/project-user-run.d.ts +61 -0
  819. package/dist/hosting/project-user-run.d.ts.map +1 -0
  820. package/dist/hosting/project-user-run.js +130 -0
  821. package/dist/hosting/project-user-run.js.map +1 -0
  822. package/dist/hosting/project-web-group.d.ts +21 -0
  823. package/dist/hosting/project-web-group.d.ts.map +1 -0
  824. package/dist/hosting/project-web-group.js +79 -0
  825. package/dist/hosting/project-web-group.js.map +1 -0
  826. package/dist/hosting/project.d.ts +58 -0
  827. package/dist/hosting/project.d.ts.map +1 -0
  828. package/dist/hosting/project.js +154 -0
  829. package/dist/hosting/project.js.map +1 -0
  830. package/dist/hosting/public-files.d.ts +53 -0
  831. package/dist/hosting/public-files.d.ts.map +1 -0
  832. package/dist/hosting/public-files.js +324 -0
  833. package/dist/hosting/public-files.js.map +1 -0
  834. package/dist/hosting/quota.d.ts +36 -0
  835. package/dist/hosting/quota.d.ts.map +1 -0
  836. package/dist/hosting/quota.js +70 -0
  837. package/dist/hosting/quota.js.map +1 -0
  838. package/dist/hosting/real-ip/apply.d.ts +17 -0
  839. package/dist/hosting/real-ip/apply.d.ts.map +1 -0
  840. package/dist/hosting/real-ip/apply.js +62 -0
  841. package/dist/hosting/real-ip/apply.js.map +1 -0
  842. package/dist/hosting/real-ip/index.d.ts +7 -0
  843. package/dist/hosting/real-ip/index.d.ts.map +1 -0
  844. package/dist/hosting/real-ip/index.js +7 -0
  845. package/dist/hosting/real-ip/index.js.map +1 -0
  846. package/dist/hosting/real-ip/providers.d.ts +12 -0
  847. package/dist/hosting/real-ip/providers.d.ts.map +1 -0
  848. package/dist/hosting/real-ip/providers.js +237 -0
  849. package/dist/hosting/real-ip/providers.js.map +1 -0
  850. package/dist/hosting/real-ip/refresh.d.ts +17 -0
  851. package/dist/hosting/real-ip/refresh.d.ts.map +1 -0
  852. package/dist/hosting/real-ip/refresh.js +113 -0
  853. package/dist/hosting/real-ip/refresh.js.map +1 -0
  854. package/dist/hosting/real-ip/render.d.ts +39 -0
  855. package/dist/hosting/real-ip/render.d.ts.map +1 -0
  856. package/dist/hosting/real-ip/render.js +132 -0
  857. package/dist/hosting/real-ip/render.js.map +1 -0
  858. package/dist/hosting/real-ip/store.d.ts +9 -0
  859. package/dist/hosting/real-ip/store.d.ts.map +1 -0
  860. package/dist/hosting/real-ip/store.js +66 -0
  861. package/dist/hosting/real-ip/store.js.map +1 -0
  862. package/dist/hosting/real-ip/types.d.ts +41 -0
  863. package/dist/hosting/real-ip/types.d.ts.map +1 -0
  864. package/dist/hosting/real-ip/types.js +10 -0
  865. package/dist/hosting/real-ip/types.js.map +1 -0
  866. package/dist/hosting/rebuild.d.ts +82 -0
  867. package/dist/hosting/rebuild.d.ts.map +1 -0
  868. package/dist/hosting/rebuild.js +241 -0
  869. package/dist/hosting/rebuild.js.map +1 -0
  870. package/dist/hosting/redis-browser.d.ts +109 -0
  871. package/dist/hosting/redis-browser.d.ts.map +1 -0
  872. package/dist/hosting/redis-browser.js +312 -0
  873. package/dist/hosting/redis-browser.js.map +1 -0
  874. package/dist/hosting/redis-provision.d.ts +39 -0
  875. package/dist/hosting/redis-provision.d.ts.map +1 -0
  876. package/dist/hosting/redis-provision.js +107 -0
  877. package/dist/hosting/redis-provision.js.map +1 -0
  878. package/dist/hosting/runtime-latest.d.ts +33 -0
  879. package/dist/hosting/runtime-latest.d.ts.map +1 -0
  880. package/dist/hosting/runtime-latest.js +180 -0
  881. package/dist/hosting/runtime-latest.js.map +1 -0
  882. package/dist/hosting/runtime-panel-defaults.d.ts +7 -0
  883. package/dist/hosting/runtime-panel-defaults.d.ts.map +1 -0
  884. package/dist/hosting/runtime-panel-defaults.js +43 -0
  885. package/dist/hosting/runtime-panel-defaults.js.map +1 -0
  886. package/dist/hosting/runtime-plugins.d.ts +164 -0
  887. package/dist/hosting/runtime-plugins.d.ts.map +1 -0
  888. package/dist/hosting/runtime-plugins.js +799 -0
  889. package/dist/hosting/runtime-plugins.js.map +1 -0
  890. package/dist/hosting/runtime-probe.d.ts +155 -0
  891. package/dist/hosting/runtime-probe.d.ts.map +1 -0
  892. package/dist/hosting/runtime-probe.js +1872 -0
  893. package/dist/hosting/runtime-probe.js.map +1 -0
  894. package/dist/hosting/runtime-tools.d.ts +20 -0
  895. package/dist/hosting/runtime-tools.d.ts.map +1 -0
  896. package/dist/hosting/runtime-tools.js +41 -0
  897. package/dist/hosting/runtime-tools.js.map +1 -0
  898. package/dist/hosting/runtime-tuning.d.ts +46 -0
  899. package/dist/hosting/runtime-tuning.d.ts.map +1 -0
  900. package/dist/hosting/runtime-tuning.js +289 -0
  901. package/dist/hosting/runtime-tuning.js.map +1 -0
  902. package/dist/hosting/runtime.d.ts +163 -0
  903. package/dist/hosting/runtime.d.ts.map +1 -0
  904. package/dist/hosting/runtime.js +709 -0
  905. package/dist/hosting/runtime.js.map +1 -0
  906. package/dist/hosting/service-catalog/index.d.ts +10 -0
  907. package/dist/hosting/service-catalog/index.d.ts.map +1 -0
  908. package/dist/hosting/service-catalog/index.js +22 -0
  909. package/dist/hosting/service-catalog/index.js.map +1 -0
  910. package/dist/hosting/service-catalog/mysql.d.ts +5 -0
  911. package/dist/hosting/service-catalog/mysql.d.ts.map +1 -0
  912. package/dist/hosting/service-catalog/mysql.js +257 -0
  913. package/dist/hosting/service-catalog/mysql.js.map +1 -0
  914. package/dist/hosting/service-catalog/postgres.d.ts +3 -0
  915. package/dist/hosting/service-catalog/postgres.d.ts.map +1 -0
  916. package/dist/hosting/service-catalog/postgres.js +140 -0
  917. package/dist/hosting/service-catalog/postgres.js.map +1 -0
  918. package/dist/hosting/service-catalog/redis.d.ts +3 -0
  919. package/dist/hosting/service-catalog/redis.d.ts.map +1 -0
  920. package/dist/hosting/service-catalog/redis.js +146 -0
  921. package/dist/hosting/service-catalog/redis.js.map +1 -0
  922. package/dist/hosting/service-catalog/types.d.ts +59 -0
  923. package/dist/hosting/service-catalog/types.d.ts.map +1 -0
  924. package/dist/hosting/service-catalog/types.js +72 -0
  925. package/dist/hosting/service-catalog/types.js.map +1 -0
  926. package/dist/hosting/service-console.d.ts +51 -0
  927. package/dist/hosting/service-console.d.ts.map +1 -0
  928. package/dist/hosting/service-console.js +480 -0
  929. package/dist/hosting/service-console.js.map +1 -0
  930. package/dist/hosting/service-exposure/geo-countries.d.ts +51 -0
  931. package/dist/hosting/service-exposure/geo-countries.d.ts.map +1 -0
  932. package/dist/hosting/service-exposure/geo-countries.js +245 -0
  933. package/dist/hosting/service-exposure/geo-countries.js.map +1 -0
  934. package/dist/hosting/service-exposure/index.d.ts +5 -0
  935. package/dist/hosting/service-exposure/index.d.ts.map +1 -0
  936. package/dist/hosting/service-exposure/index.js +5 -0
  937. package/dist/hosting/service-exposure/index.js.map +1 -0
  938. package/dist/hosting/service-exposure/ports.d.ts +38 -0
  939. package/dist/hosting/service-exposure/ports.d.ts.map +1 -0
  940. package/dist/hosting/service-exposure/ports.js +175 -0
  941. package/dist/hosting/service-exposure/ports.js.map +1 -0
  942. package/dist/hosting/service-exposure/store.d.ts +18 -0
  943. package/dist/hosting/service-exposure/store.d.ts.map +1 -0
  944. package/dist/hosting/service-exposure/store.js +158 -0
  945. package/dist/hosting/service-exposure/store.js.map +1 -0
  946. package/dist/hosting/service-exposure/sync.d.ts +89 -0
  947. package/dist/hosting/service-exposure/sync.d.ts.map +1 -0
  948. package/dist/hosting/service-exposure/sync.js +365 -0
  949. package/dist/hosting/service-exposure/sync.js.map +1 -0
  950. package/dist/hosting/service-matrix.d.ts +31 -0
  951. package/dist/hosting/service-matrix.d.ts.map +1 -0
  952. package/dist/hosting/service-matrix.js +282 -0
  953. package/dist/hosting/service-matrix.js.map +1 -0
  954. package/dist/hosting/sftp-keys.d.ts +35 -0
  955. package/dist/hosting/sftp-keys.d.ts.map +1 -0
  956. package/dist/hosting/sftp-keys.js +151 -0
  957. package/dist/hosting/sftp-keys.js.map +1 -0
  958. package/dist/hosting/software-catalog.d.ts +56 -0
  959. package/dist/hosting/software-catalog.d.ts.map +1 -0
  960. package/dist/hosting/software-catalog.js +380 -0
  961. package/dist/hosting/software-catalog.js.map +1 -0
  962. package/dist/hosting/software-install.d.ts +88 -0
  963. package/dist/hosting/software-install.d.ts.map +1 -0
  964. package/dist/hosting/software-install.js +610 -0
  965. package/dist/hosting/software-install.js.map +1 -0
  966. package/dist/hosting/software-probe/HostSoftwareProbe.d.ts +45 -0
  967. package/dist/hosting/software-probe/HostSoftwareProbe.d.ts.map +1 -0
  968. package/dist/hosting/software-probe/HostSoftwareProbe.js +362 -0
  969. package/dist/hosting/software-probe/HostSoftwareProbe.js.map +1 -0
  970. package/dist/hosting/software-probe/index.d.ts +6 -0
  971. package/dist/hosting/software-probe/index.d.ts.map +1 -0
  972. package/dist/hosting/software-probe/index.js +6 -0
  973. package/dist/hosting/software-probe/index.js.map +1 -0
  974. package/dist/hosting/software-probe/registry.d.ts +11 -0
  975. package/dist/hosting/software-probe/registry.d.ts.map +1 -0
  976. package/dist/hosting/software-probe/registry.js +100 -0
  977. package/dist/hosting/software-probe/registry.js.map +1 -0
  978. package/dist/hosting/software-probe/resolve-bin.d.ts +38 -0
  979. package/dist/hosting/software-probe/resolve-bin.d.ts.map +1 -0
  980. package/dist/hosting/software-probe/resolve-bin.js +168 -0
  981. package/dist/hosting/software-probe/resolve-bin.js.map +1 -0
  982. package/dist/hosting/software-probe/shell.d.ts +22 -0
  983. package/dist/hosting/software-probe/shell.d.ts.map +1 -0
  984. package/dist/hosting/software-probe/shell.js +41 -0
  985. package/dist/hosting/software-probe/shell.js.map +1 -0
  986. package/dist/hosting/software-probe/types.d.ts +57 -0
  987. package/dist/hosting/software-probe/types.d.ts.map +1 -0
  988. package/dist/hosting/software-probe/types.js +6 -0
  989. package/dist/hosting/software-probe/types.js.map +1 -0
  990. package/dist/hosting/software-uninstall.d.ts +67 -0
  991. package/dist/hosting/software-uninstall.d.ts.map +1 -0
  992. package/dist/hosting/software-uninstall.js +333 -0
  993. package/dist/hosting/software-uninstall.js.map +1 -0
  994. package/dist/hosting/sql-engine-health/actions.d.ts +20 -0
  995. package/dist/hosting/sql-engine-health/actions.d.ts.map +1 -0
  996. package/dist/hosting/sql-engine-health/actions.js +29 -0
  997. package/dist/hosting/sql-engine-health/actions.js.map +1 -0
  998. package/dist/hosting/sql-engine-health/compat.d.ts +33 -0
  999. package/dist/hosting/sql-engine-health/compat.d.ts.map +1 -0
  1000. package/dist/hosting/sql-engine-health/compat.js +45 -0
  1001. package/dist/hosting/sql-engine-health/compat.js.map +1 -0
  1002. package/dist/hosting/sql-engine-health/diagnose.d.ts +10 -0
  1003. package/dist/hosting/sql-engine-health/diagnose.d.ts.map +1 -0
  1004. package/dist/hosting/sql-engine-health/diagnose.js +268 -0
  1005. package/dist/hosting/sql-engine-health/diagnose.js.map +1 -0
  1006. package/dist/hosting/sql-engine-health/execute.d.ts +14 -0
  1007. package/dist/hosting/sql-engine-health/execute.d.ts.map +1 -0
  1008. package/dist/hosting/sql-engine-health/execute.js +130 -0
  1009. package/dist/hosting/sql-engine-health/execute.js.map +1 -0
  1010. package/dist/hosting/sql-engine-health/index.d.ts +6 -0
  1011. package/dist/hosting/sql-engine-health/index.d.ts.map +1 -0
  1012. package/dist/hosting/sql-engine-health/index.js +6 -0
  1013. package/dist/hosting/sql-engine-health/index.js.map +1 -0
  1014. package/dist/hosting/sql-engine-health/types.d.ts +63 -0
  1015. package/dist/hosting/sql-engine-health/types.d.ts.map +1 -0
  1016. package/dist/hosting/sql-engine-health/types.js +6 -0
  1017. package/dist/hosting/sql-engine-health/types.js.map +1 -0
  1018. package/dist/hosting/sql-engine-switch/grants.d.ts +10 -0
  1019. package/dist/hosting/sql-engine-switch/grants.d.ts.map +1 -0
  1020. package/dist/hosting/sql-engine-switch/grants.js +61 -0
  1021. package/dist/hosting/sql-engine-switch/grants.js.map +1 -0
  1022. package/dist/hosting/sql-engine-switch/index.d.ts +7 -0
  1023. package/dist/hosting/sql-engine-switch/index.d.ts.map +1 -0
  1024. package/dist/hosting/sql-engine-switch/index.js +7 -0
  1025. package/dist/hosting/sql-engine-switch/index.js.map +1 -0
  1026. package/dist/hosting/sql-engine-switch/migrate.d.ts +22 -0
  1027. package/dist/hosting/sql-engine-switch/migrate.d.ts.map +1 -0
  1028. package/dist/hosting/sql-engine-switch/migrate.js +389 -0
  1029. package/dist/hosting/sql-engine-switch/migrate.js.map +1 -0
  1030. package/dist/hosting/sql-engine-switch/mysql-frozen.d.ts +74 -0
  1031. package/dist/hosting/sql-engine-switch/mysql-frozen.d.ts.map +1 -0
  1032. package/dist/hosting/sql-engine-switch/mysql-frozen.js +317 -0
  1033. package/dist/hosting/sql-engine-switch/mysql-frozen.js.map +1 -0
  1034. package/dist/hosting/sql-engine-switch/preview.d.ts +18 -0
  1035. package/dist/hosting/sql-engine-switch/preview.d.ts.map +1 -0
  1036. package/dist/hosting/sql-engine-switch/preview.js +173 -0
  1037. package/dist/hosting/sql-engine-switch/preview.js.map +1 -0
  1038. package/dist/hosting/sql-engine-switch/sql-auth.d.ts +9 -0
  1039. package/dist/hosting/sql-engine-switch/sql-auth.d.ts.map +1 -0
  1040. package/dist/hosting/sql-engine-switch/sql-auth.js +23 -0
  1041. package/dist/hosting/sql-engine-switch/sql-auth.js.map +1 -0
  1042. package/dist/hosting/sql-engine-switch/types.d.ts +51 -0
  1043. package/dist/hosting/sql-engine-switch/types.d.ts.map +1 -0
  1044. package/dist/hosting/sql-engine-switch/types.js +5 -0
  1045. package/dist/hosting/sql-engine-switch/types.js.map +1 -0
  1046. package/dist/hosting/sshd-sftp-snippet.d.ts +35 -0
  1047. package/dist/hosting/sshd-sftp-snippet.d.ts.map +1 -0
  1048. package/dist/hosting/sshd-sftp-snippet.js +135 -0
  1049. package/dist/hosting/sshd-sftp-snippet.js.map +1 -0
  1050. package/dist/hosting/ssl-certs.d.ts +151 -0
  1051. package/dist/hosting/ssl-certs.d.ts.map +1 -0
  1052. package/dist/hosting/ssl-certs.js +462 -0
  1053. package/dist/hosting/ssl-certs.js.map +1 -0
  1054. package/dist/hosting/ssl-le-errors.d.ts +19 -0
  1055. package/dist/hosting/ssl-le-errors.d.ts.map +1 -0
  1056. package/dist/hosting/ssl-le-errors.js +105 -0
  1057. package/dist/hosting/ssl-le-errors.js.map +1 -0
  1058. package/dist/hosting/stack/definitions.d.ts +67 -0
  1059. package/dist/hosting/stack/definitions.d.ts.map +1 -0
  1060. package/dist/hosting/stack/definitions.js +519 -0
  1061. package/dist/hosting/stack/definitions.js.map +1 -0
  1062. package/dist/hosting/stack/index.d.ts +4 -0
  1063. package/dist/hosting/stack/index.d.ts.map +1 -0
  1064. package/dist/hosting/stack/index.js +4 -0
  1065. package/dist/hosting/stack/index.js.map +1 -0
  1066. package/dist/hosting/stack/manifest.d.ts +48 -0
  1067. package/dist/hosting/stack/manifest.d.ts.map +1 -0
  1068. package/dist/hosting/stack/manifest.js +108 -0
  1069. package/dist/hosting/stack/manifest.js.map +1 -0
  1070. package/dist/hosting/stack/ops.d.ts +89 -0
  1071. package/dist/hosting/stack/ops.d.ts.map +1 -0
  1072. package/dist/hosting/stack/ops.js +485 -0
  1073. package/dist/hosting/stack/ops.js.map +1 -0
  1074. package/dist/hosting/system-apply.d.ts +242 -0
  1075. package/dist/hosting/system-apply.d.ts.map +1 -0
  1076. package/dist/hosting/system-apply.js +1148 -0
  1077. package/dist/hosting/system-apply.js.map +1 -0
  1078. package/dist/hosting/temp-db-user.d.ts +75 -0
  1079. package/dist/hosting/temp-db-user.d.ts.map +1 -0
  1080. package/dist/hosting/temp-db-user.js +230 -0
  1081. package/dist/hosting/temp-db-user.js.map +1 -0
  1082. package/dist/hosting/version-discovery.d.ts +59 -0
  1083. package/dist/hosting/version-discovery.d.ts.map +1 -0
  1084. package/dist/hosting/version-discovery.js +599 -0
  1085. package/dist/hosting/version-discovery.js.map +1 -0
  1086. package/dist/hosting/vnc/client-profiles.d.ts +78 -0
  1087. package/dist/hosting/vnc/client-profiles.d.ts.map +1 -0
  1088. package/dist/hosting/vnc/client-profiles.js +251 -0
  1089. package/dist/hosting/vnc/client-profiles.js.map +1 -0
  1090. package/dist/hosting/vnc/index.d.ts +13 -0
  1091. package/dist/hosting/vnc/index.d.ts.map +1 -0
  1092. package/dist/hosting/vnc/index.js +13 -0
  1093. package/dist/hosting/vnc/index.js.map +1 -0
  1094. package/dist/hosting/vnc/linux-user.d.ts +33 -0
  1095. package/dist/hosting/vnc/linux-user.d.ts.map +1 -0
  1096. package/dist/hosting/vnc/linux-user.js +114 -0
  1097. package/dist/hosting/vnc/linux-user.js.map +1 -0
  1098. package/dist/hosting/vnc/novnc.d.ts +89 -0
  1099. package/dist/hosting/vnc/novnc.d.ts.map +1 -0
  1100. package/dist/hosting/vnc/novnc.js +232 -0
  1101. package/dist/hosting/vnc/novnc.js.map +1 -0
  1102. package/dist/hosting/vnc/passwd.d.ts +16 -0
  1103. package/dist/hosting/vnc/passwd.d.ts.map +1 -0
  1104. package/dist/hosting/vnc/passwd.js +41 -0
  1105. package/dist/hosting/vnc/passwd.js.map +1 -0
  1106. package/dist/hosting/vnc/ports.d.ts +12 -0
  1107. package/dist/hosting/vnc/ports.d.ts.map +1 -0
  1108. package/dist/hosting/vnc/ports.js +36 -0
  1109. package/dist/hosting/vnc/ports.js.map +1 -0
  1110. package/dist/hosting/vnc/rfb-probe.d.ts +23 -0
  1111. package/dist/hosting/vnc/rfb-probe.d.ts.map +1 -0
  1112. package/dist/hosting/vnc/rfb-probe.js +95 -0
  1113. package/dist/hosting/vnc/rfb-probe.js.map +1 -0
  1114. package/dist/hosting/vnc/server-session.d.ts +69 -0
  1115. package/dist/hosting/vnc/server-session.d.ts.map +1 -0
  1116. package/dist/hosting/vnc/server-session.js +390 -0
  1117. package/dist/hosting/vnc/server-session.js.map +1 -0
  1118. package/dist/hosting/vnc/service.d.ts +135 -0
  1119. package/dist/hosting/vnc/service.d.ts.map +1 -0
  1120. package/dist/hosting/vnc/service.js +896 -0
  1121. package/dist/hosting/vnc/service.js.map +1 -0
  1122. package/dist/hosting/vnc/session-ticket.d.ts +37 -0
  1123. package/dist/hosting/vnc/session-ticket.d.ts.map +1 -0
  1124. package/dist/hosting/vnc/session-ticket.js +64 -0
  1125. package/dist/hosting/vnc/session-ticket.js.map +1 -0
  1126. package/dist/hosting/vnc/share-links.d.ts +27 -0
  1127. package/dist/hosting/vnc/share-links.d.ts.map +1 -0
  1128. package/dist/hosting/vnc/share-links.js +68 -0
  1129. package/dist/hosting/vnc/share-links.js.map +1 -0
  1130. package/dist/hosting/vnc/types.d.ts +87 -0
  1131. package/dist/hosting/vnc/types.d.ts.map +1 -0
  1132. package/dist/hosting/vnc/types.js +35 -0
  1133. package/dist/hosting/vnc/types.js.map +1 -0
  1134. package/dist/hosting/vnc/xstartup.d.ts +7 -0
  1135. package/dist/hosting/vnc/xstartup.d.ts.map +1 -0
  1136. package/dist/hosting/vnc/xstartup.js +50 -0
  1137. package/dist/hosting/vnc/xstartup.js.map +1 -0
  1138. package/dist/hosting/vpn/access-mode.d.ts +37 -0
  1139. package/dist/hosting/vpn/access-mode.d.ts.map +1 -0
  1140. package/dist/hosting/vpn/access-mode.js +126 -0
  1141. package/dist/hosting/vpn/access-mode.js.map +1 -0
  1142. package/dist/hosting/vpn/client-conf-protect.d.ts +28 -0
  1143. package/dist/hosting/vpn/client-conf-protect.d.ts.map +1 -0
  1144. package/dist/hosting/vpn/client-conf-protect.js +138 -0
  1145. package/dist/hosting/vpn/client-conf-protect.js.map +1 -0
  1146. package/dist/hosting/vpn/endpoint.d.ts +26 -0
  1147. package/dist/hosting/vpn/endpoint.d.ts.map +1 -0
  1148. package/dist/hosting/vpn/endpoint.js +90 -0
  1149. package/dist/hosting/vpn/endpoint.js.map +1 -0
  1150. package/dist/hosting/vpn/index.d.ts +12 -0
  1151. package/dist/hosting/vpn/index.d.ts.map +1 -0
  1152. package/dist/hosting/vpn/index.js +12 -0
  1153. package/dist/hosting/vpn/index.js.map +1 -0
  1154. package/dist/hosting/vpn/monitor.d.ts +141 -0
  1155. package/dist/hosting/vpn/monitor.d.ts.map +1 -0
  1156. package/dist/hosting/vpn/monitor.js +537 -0
  1157. package/dist/hosting/vpn/monitor.js.map +1 -0
  1158. package/dist/hosting/vpn/openvpn-conf.d.ts +34 -0
  1159. package/dist/hosting/vpn/openvpn-conf.d.ts.map +1 -0
  1160. package/dist/hosting/vpn/openvpn-conf.js +89 -0
  1161. package/dist/hosting/vpn/openvpn-conf.js.map +1 -0
  1162. package/dist/hosting/vpn/openvpn-ops.d.ts +72 -0
  1163. package/dist/hosting/vpn/openvpn-ops.d.ts.map +1 -0
  1164. package/dist/hosting/vpn/openvpn-ops.js +500 -0
  1165. package/dist/hosting/vpn/openvpn-ops.js.map +1 -0
  1166. package/dist/hosting/vpn/outline-ops.d.ts +71 -0
  1167. package/dist/hosting/vpn/outline-ops.d.ts.map +1 -0
  1168. package/dist/hosting/vpn/outline-ops.js +321 -0
  1169. package/dist/hosting/vpn/outline-ops.js.map +1 -0
  1170. package/dist/hosting/vpn/ports.d.ts +10 -0
  1171. package/dist/hosting/vpn/ports.d.ts.map +1 -0
  1172. package/dist/hosting/vpn/ports.js +48 -0
  1173. package/dist/hosting/vpn/ports.js.map +1 -0
  1174. package/dist/hosting/vpn/service.d.ts +114 -0
  1175. package/dist/hosting/vpn/service.d.ts.map +1 -0
  1176. package/dist/hosting/vpn/service.js +786 -0
  1177. package/dist/hosting/vpn/service.js.map +1 -0
  1178. package/dist/hosting/vpn/types.d.ts +66 -0
  1179. package/dist/hosting/vpn/types.d.ts.map +1 -0
  1180. package/dist/hosting/vpn/types.js +10 -0
  1181. package/dist/hosting/vpn/types.js.map +1 -0
  1182. package/dist/hosting/vpn/wireguard-conf.d.ts +31 -0
  1183. package/dist/hosting/vpn/wireguard-conf.d.ts.map +1 -0
  1184. package/dist/hosting/vpn/wireguard-conf.js +69 -0
  1185. package/dist/hosting/vpn/wireguard-conf.js.map +1 -0
  1186. package/dist/hosting/web-stats.d.ts +53 -0
  1187. package/dist/hosting/web-stats.d.ts.map +1 -0
  1188. package/dist/hosting/web-stats.js +177 -0
  1189. package/dist/hosting/web-stats.js.map +1 -0
  1190. package/dist/hosting/web-ui-build.d.ts +44 -0
  1191. package/dist/hosting/web-ui-build.d.ts.map +1 -0
  1192. package/dist/hosting/web-ui-build.js +297 -0
  1193. package/dist/hosting/web-ui-build.js.map +1 -0
  1194. package/dist/hosting/wizard.d.ts +43 -0
  1195. package/dist/hosting/wizard.d.ts.map +1 -0
  1196. package/dist/hosting/wizard.js +158 -0
  1197. package/dist/hosting/wizard.js.map +1 -0
  1198. package/dist/hosting/wordpress-download.d.ts +26 -0
  1199. package/dist/hosting/wordpress-download.d.ts.map +1 -0
  1200. package/dist/hosting/wordpress-download.js +70 -0
  1201. package/dist/hosting/wordpress-download.js.map +1 -0
  1202. package/dist/hosting/wordpress-setup.d.ts +40 -0
  1203. package/dist/hosting/wordpress-setup.d.ts.map +1 -0
  1204. package/dist/hosting/wordpress-setup.js +150 -0
  1205. package/dist/hosting/wordpress-setup.js.map +1 -0
  1206. package/dist/index.d.ts +19 -0
  1207. package/dist/index.d.ts.map +1 -0
  1208. package/dist/index.js +19 -0
  1209. package/dist/index.js.map +1 -0
  1210. package/dist/llm/gateway.d.ts +61 -0
  1211. package/dist/llm/gateway.d.ts.map +1 -0
  1212. package/dist/llm/gateway.js +98 -0
  1213. package/dist/llm/gateway.js.map +1 -0
  1214. package/dist/llm/http-transport.d.ts +6 -0
  1215. package/dist/llm/http-transport.d.ts.map +1 -0
  1216. package/dist/llm/http-transport.js +52 -0
  1217. package/dist/llm/http-transport.js.map +1 -0
  1218. package/dist/llm/index.d.ts +3 -0
  1219. package/dist/llm/index.d.ts.map +1 -0
  1220. package/dist/llm/index.js +3 -0
  1221. package/dist/llm/index.js.map +1 -0
  1222. package/dist/monitoring/index.d.ts +7 -0
  1223. package/dist/monitoring/index.d.ts.map +1 -0
  1224. package/dist/monitoring/index.js +7 -0
  1225. package/dist/monitoring/index.js.map +1 -0
  1226. package/dist/monitoring/metrics.d.ts +26 -0
  1227. package/dist/monitoring/metrics.d.ts.map +1 -0
  1228. package/dist/monitoring/metrics.js +144 -0
  1229. package/dist/monitoring/metrics.js.map +1 -0
  1230. package/dist/monitoring/notifications.d.ts +29 -0
  1231. package/dist/monitoring/notifications.d.ts.map +1 -0
  1232. package/dist/monitoring/notifications.js +337 -0
  1233. package/dist/monitoring/notifications.js.map +1 -0
  1234. package/dist/monitoring/process-signal.d.ts +78 -0
  1235. package/dist/monitoring/process-signal.d.ts.map +1 -0
  1236. package/dist/monitoring/process-signal.js +289 -0
  1237. package/dist/monitoring/process-signal.js.map +1 -0
  1238. package/dist/monitoring/process-snapshot.d.ts +21 -0
  1239. package/dist/monitoring/process-snapshot.d.ts.map +1 -0
  1240. package/dist/monitoring/process-snapshot.js +219 -0
  1241. package/dist/monitoring/process-snapshot.js.map +1 -0
  1242. package/dist/monitoring/project-usage.d.ts +45 -0
  1243. package/dist/monitoring/project-usage.d.ts.map +1 -0
  1244. package/dist/monitoring/project-usage.js +75 -0
  1245. package/dist/monitoring/project-usage.js.map +1 -0
  1246. package/dist/monitoring/top-snapshot.d.ts +47 -0
  1247. package/dist/monitoring/top-snapshot.d.ts.map +1 -0
  1248. package/dist/monitoring/top-snapshot.js +245 -0
  1249. package/dist/monitoring/top-snapshot.js.map +1 -0
  1250. package/dist/net/index.d.ts +7 -0
  1251. package/dist/net/index.d.ts.map +1 -0
  1252. package/dist/net/index.js +7 -0
  1253. package/dist/net/index.js.map +1 -0
  1254. package/dist/net/ip.d.ts +41 -0
  1255. package/dist/net/ip.d.ts.map +1 -0
  1256. package/dist/net/ip.js +326 -0
  1257. package/dist/net/ip.js.map +1 -0
  1258. package/dist/net/network-apply.d.ts +73 -0
  1259. package/dist/net/network-apply.d.ts.map +1 -0
  1260. package/dist/net/network-apply.js +712 -0
  1261. package/dist/net/network-apply.js.map +1 -0
  1262. package/dist/net/network-parse.d.ts +27 -0
  1263. package/dist/net/network-parse.d.ts.map +1 -0
  1264. package/dist/net/network-parse.js +162 -0
  1265. package/dist/net/network-parse.js.map +1 -0
  1266. package/dist/net/network-snapshot.d.ts +9 -0
  1267. package/dist/net/network-snapshot.d.ts.map +1 -0
  1268. package/dist/net/network-snapshot.js +241 -0
  1269. package/dist/net/network-snapshot.js.map +1 -0
  1270. package/dist/net/network-types.d.ts +107 -0
  1271. package/dist/net/network-types.d.ts.map +1 -0
  1272. package/dist/net/network-types.js +5 -0
  1273. package/dist/net/network-types.js.map +1 -0
  1274. package/dist/net/ssrf.d.ts +25 -0
  1275. package/dist/net/ssrf.d.ts.map +1 -0
  1276. package/dist/net/ssrf.js +127 -0
  1277. package/dist/net/ssrf.js.map +1 -0
  1278. package/dist/repositories/approval-repo.d.ts +13 -0
  1279. package/dist/repositories/approval-repo.d.ts.map +1 -0
  1280. package/dist/repositories/approval-repo.js +29 -0
  1281. package/dist/repositories/approval-repo.js.map +1 -0
  1282. package/dist/repositories/audit-repo.d.ts +21 -0
  1283. package/dist/repositories/audit-repo.d.ts.map +1 -0
  1284. package/dist/repositories/audit-repo.js +39 -0
  1285. package/dist/repositories/audit-repo.js.map +1 -0
  1286. package/dist/repositories/index.d.ts +7 -0
  1287. package/dist/repositories/index.d.ts.map +1 -0
  1288. package/dist/repositories/index.js +7 -0
  1289. package/dist/repositories/index.js.map +1 -0
  1290. package/dist/repositories/project-repo.d.ts +19 -0
  1291. package/dist/repositories/project-repo.d.ts.map +1 -0
  1292. package/dist/repositories/project-repo.js +142 -0
  1293. package/dist/repositories/project-repo.js.map +1 -0
  1294. package/dist/repositories/session-repo.d.ts +37 -0
  1295. package/dist/repositories/session-repo.d.ts.map +1 -0
  1296. package/dist/repositories/session-repo.js +141 -0
  1297. package/dist/repositories/session-repo.js.map +1 -0
  1298. package/dist/repositories/settings-repo.d.ts +10 -0
  1299. package/dist/repositories/settings-repo.d.ts.map +1 -0
  1300. package/dist/repositories/settings-repo.js +23 -0
  1301. package/dist/repositories/settings-repo.js.map +1 -0
  1302. package/dist/repositories/user-repo.d.ts +21 -0
  1303. package/dist/repositories/user-repo.d.ts.map +1 -0
  1304. package/dist/repositories/user-repo.js +104 -0
  1305. package/dist/repositories/user-repo.js.map +1 -0
  1306. package/dist/security/allowlist.d.ts +40 -0
  1307. package/dist/security/allowlist.d.ts.map +1 -0
  1308. package/dist/security/allowlist.js +167 -0
  1309. package/dist/security/allowlist.js.map +1 -0
  1310. package/dist/security/api-keys.d.ts +40 -0
  1311. package/dist/security/api-keys.d.ts.map +1 -0
  1312. package/dist/security/api-keys.js +99 -0
  1313. package/dist/security/api-keys.js.map +1 -0
  1314. package/dist/security/approval.d.ts +37 -0
  1315. package/dist/security/approval.d.ts.map +1 -0
  1316. package/dist/security/approval.js +152 -0
  1317. package/dist/security/approval.js.map +1 -0
  1318. package/dist/security/capabilities-enforce.d.ts +18 -0
  1319. package/dist/security/capabilities-enforce.d.ts.map +1 -0
  1320. package/dist/security/capabilities-enforce.js +29 -0
  1321. package/dist/security/capabilities-enforce.js.map +1 -0
  1322. package/dist/security/index.d.ts +14 -0
  1323. package/dist/security/index.d.ts.map +1 -0
  1324. package/dist/security/index.js +14 -0
  1325. package/dist/security/index.js.map +1 -0
  1326. package/dist/security/mfa/backup-export.d.ts +30 -0
  1327. package/dist/security/mfa/backup-export.d.ts.map +1 -0
  1328. package/dist/security/mfa/backup-export.js +57 -0
  1329. package/dist/security/mfa/backup-export.js.map +1 -0
  1330. package/dist/security/mfa/fail2ban-jails.d.ts +10 -0
  1331. package/dist/security/mfa/fail2ban-jails.d.ts.map +1 -0
  1332. package/dist/security/mfa/fail2ban-jails.js +71 -0
  1333. package/dist/security/mfa/fail2ban-jails.js.map +1 -0
  1334. package/dist/security/mfa/index.d.ts +9 -0
  1335. package/dist/security/mfa/index.d.ts.map +1 -0
  1336. package/dist/security/mfa/index.js +9 -0
  1337. package/dist/security/mfa/index.js.map +1 -0
  1338. package/dist/security/mfa/rate-limit.d.ts +30 -0
  1339. package/dist/security/mfa/rate-limit.d.ts.map +1 -0
  1340. package/dist/security/mfa/rate-limit.js +90 -0
  1341. package/dist/security/mfa/rate-limit.js.map +1 -0
  1342. package/dist/security/mfa/recovery-codes.d.ts +10 -0
  1343. package/dist/security/mfa/recovery-codes.d.ts.map +1 -0
  1344. package/dist/security/mfa/recovery-codes.js +38 -0
  1345. package/dist/security/mfa/recovery-codes.js.map +1 -0
  1346. package/dist/security/mfa/remember-device.d.ts +34 -0
  1347. package/dist/security/mfa/remember-device.d.ts.map +1 -0
  1348. package/dist/security/mfa/remember-device.js +112 -0
  1349. package/dist/security/mfa/remember-device.js.map +1 -0
  1350. package/dist/security/mfa/step-up.d.ts +9 -0
  1351. package/dist/security/mfa/step-up.d.ts.map +1 -0
  1352. package/dist/security/mfa/step-up.js +25 -0
  1353. package/dist/security/mfa/step-up.js.map +1 -0
  1354. package/dist/security/mfa/totp-crypto.d.ts +13 -0
  1355. package/dist/security/mfa/totp-crypto.d.ts.map +1 -0
  1356. package/dist/security/mfa/totp-crypto.js +29 -0
  1357. package/dist/security/mfa/totp-crypto.js.map +1 -0
  1358. package/dist/security/mfa/webauthn.d.ts +69 -0
  1359. package/dist/security/mfa/webauthn.d.ts.map +1 -0
  1360. package/dist/security/mfa/webauthn.js +178 -0
  1361. package/dist/security/mfa/webauthn.js.map +1 -0
  1362. package/dist/security/operation-level.d.ts +14 -0
  1363. package/dist/security/operation-level.d.ts.map +1 -0
  1364. package/dist/security/operation-level.js +39 -0
  1365. package/dist/security/operation-level.js.map +1 -0
  1366. package/dist/security/password-policy.d.ts +22 -0
  1367. package/dist/security/password-policy.d.ts.map +1 -0
  1368. package/dist/security/password-policy.js +50 -0
  1369. package/dist/security/password-policy.js.map +1 -0
  1370. package/dist/security/rbac.d.ts +18 -0
  1371. package/dist/security/rbac.d.ts.map +1 -0
  1372. package/dist/security/rbac.js +58 -0
  1373. package/dist/security/rbac.js.map +1 -0
  1374. package/dist/security/sandbox.d.ts +34 -0
  1375. package/dist/security/sandbox.d.ts.map +1 -0
  1376. package/dist/security/sandbox.js +62 -0
  1377. package/dist/security/sandbox.js.map +1 -0
  1378. package/dist/security/ssh-2fa/index.d.ts +4 -0
  1379. package/dist/security/ssh-2fa/index.d.ts.map +1 -0
  1380. package/dist/security/ssh-2fa/index.js +4 -0
  1381. package/dist/security/ssh-2fa/index.js.map +1 -0
  1382. package/dist/security/ssh-2fa/install.d.ts +93 -0
  1383. package/dist/security/ssh-2fa/install.d.ts.map +1 -0
  1384. package/dist/security/ssh-2fa/install.js +457 -0
  1385. package/dist/security/ssh-2fa/install.js.map +1 -0
  1386. package/dist/security/ssh-2fa/store.d.ts +44 -0
  1387. package/dist/security/ssh-2fa/store.d.ts.map +1 -0
  1388. package/dist/security/ssh-2fa/store.js +209 -0
  1389. package/dist/security/ssh-2fa/store.js.map +1 -0
  1390. package/dist/security/ssh-2fa/types.d.ts +33 -0
  1391. package/dist/security/ssh-2fa/types.d.ts.map +1 -0
  1392. package/dist/security/ssh-2fa/types.js +9 -0
  1393. package/dist/security/ssh-2fa/types.js.map +1 -0
  1394. package/dist/security/ssh-identity/crypto.d.ts +24 -0
  1395. package/dist/security/ssh-identity/crypto.d.ts.map +1 -0
  1396. package/dist/security/ssh-identity/crypto.js +109 -0
  1397. package/dist/security/ssh-identity/crypto.js.map +1 -0
  1398. package/dist/security/ssh-identity/generate.d.ts +18 -0
  1399. package/dist/security/ssh-identity/generate.d.ts.map +1 -0
  1400. package/dist/security/ssh-identity/generate.js +102 -0
  1401. package/dist/security/ssh-identity/generate.js.map +1 -0
  1402. package/dist/security/ssh-identity/index.d.ts +7 -0
  1403. package/dist/security/ssh-identity/index.d.ts.map +1 -0
  1404. package/dist/security/ssh-identity/index.js +7 -0
  1405. package/dist/security/ssh-identity/index.js.map +1 -0
  1406. package/dist/security/ssh-identity/install.d.ts +37 -0
  1407. package/dist/security/ssh-identity/install.d.ts.map +1 -0
  1408. package/dist/security/ssh-identity/install.js +281 -0
  1409. package/dist/security/ssh-identity/install.js.map +1 -0
  1410. package/dist/security/ssh-identity/ops.d.ts +77 -0
  1411. package/dist/security/ssh-identity/ops.d.ts.map +1 -0
  1412. package/dist/security/ssh-identity/ops.js +244 -0
  1413. package/dist/security/ssh-identity/ops.js.map +1 -0
  1414. package/dist/security/ssh-identity/store.d.ts +51 -0
  1415. package/dist/security/ssh-identity/store.d.ts.map +1 -0
  1416. package/dist/security/ssh-identity/store.js +240 -0
  1417. package/dist/security/ssh-identity/store.js.map +1 -0
  1418. package/dist/security/ssh-identity/types.d.ts +43 -0
  1419. package/dist/security/ssh-identity/types.d.ts.map +1 -0
  1420. package/dist/security/ssh-identity/types.js +9 -0
  1421. package/dist/security/ssh-identity/types.js.map +1 -0
  1422. package/dist/security/tool-executor.d.ts +39 -0
  1423. package/dist/security/tool-executor.d.ts.map +1 -0
  1424. package/dist/security/tool-executor.js +271 -0
  1425. package/dist/security/tool-executor.js.map +1 -0
  1426. package/dist/security/totp.d.ts +15 -0
  1427. package/dist/security/totp.d.ts.map +1 -0
  1428. package/dist/security/totp.js +97 -0
  1429. package/dist/security/totp.js.map +1 -0
  1430. package/dist/services/ai-task-service.d.ts +35 -0
  1431. package/dist/services/ai-task-service.d.ts.map +1 -0
  1432. package/dist/services/ai-task-service.js +208 -0
  1433. package/dist/services/ai-task-service.js.map +1 -0
  1434. package/dist/services/auth.d.ts +126 -0
  1435. package/dist/services/auth.d.ts.map +1 -0
  1436. package/dist/services/auth.js +705 -0
  1437. package/dist/services/auth.js.map +1 -0
  1438. package/dist/services/index.d.ts +9 -0
  1439. package/dist/services/index.d.ts.map +1 -0
  1440. package/dist/services/index.js +9 -0
  1441. package/dist/services/index.js.map +1 -0
  1442. package/dist/services/list-filter.d.ts +24 -0
  1443. package/dist/services/list-filter.d.ts.map +1 -0
  1444. package/dist/services/list-filter.js +90 -0
  1445. package/dist/services/list-filter.js.map +1 -0
  1446. package/dist/services/protection-probe.d.ts +31 -0
  1447. package/dist/services/protection-probe.d.ts.map +1 -0
  1448. package/dist/services/protection-probe.js +97 -0
  1449. package/dist/services/protection-probe.js.map +1 -0
  1450. package/dist/services/protection.d.ts +23 -0
  1451. package/dist/services/protection.d.ts.map +1 -0
  1452. package/dist/services/protection.js +51 -0
  1453. package/dist/services/protection.js.map +1 -0
  1454. package/dist/services/rbac-policy.d.ts +95 -0
  1455. package/dist/services/rbac-policy.d.ts.map +1 -0
  1456. package/dist/services/rbac-policy.js +260 -0
  1457. package/dist/services/rbac-policy.js.map +1 -0
  1458. package/dist/services/scheduler.d.ts +35 -0
  1459. package/dist/services/scheduler.d.ts.map +1 -0
  1460. package/dist/services/scheduler.js +124 -0
  1461. package/dist/services/scheduler.js.map +1 -0
  1462. package/dist/services/users-admin.d.ts +64 -0
  1463. package/dist/services/users-admin.d.ts.map +1 -0
  1464. package/dist/services/users-admin.js +249 -0
  1465. package/dist/services/users-admin.js.map +1 -0
  1466. package/dist/skills/index.d.ts +3 -0
  1467. package/dist/skills/index.d.ts.map +1 -0
  1468. package/dist/skills/index.js +3 -0
  1469. package/dist/skills/index.js.map +1 -0
  1470. package/dist/skills/playbooks.d.ts +32 -0
  1471. package/dist/skills/playbooks.d.ts.map +1 -0
  1472. package/dist/skills/playbooks.js +164 -0
  1473. package/dist/skills/playbooks.js.map +1 -0
  1474. package/dist/skills/task-planner.d.ts +74 -0
  1475. package/dist/skills/task-planner.d.ts.map +1 -0
  1476. package/dist/skills/task-planner.js +172 -0
  1477. package/dist/skills/task-planner.js.map +1 -0
  1478. package/dist/terminal/index.d.ts +4 -0
  1479. package/dist/terminal/index.d.ts.map +1 -0
  1480. package/dist/terminal/index.js +4 -0
  1481. package/dist/terminal/index.js.map +1 -0
  1482. package/dist/terminal/spawn-plan.d.ts +30 -0
  1483. package/dist/terminal/spawn-plan.d.ts.map +1 -0
  1484. package/dist/terminal/spawn-plan.js +63 -0
  1485. package/dist/terminal/spawn-plan.js.map +1 -0
  1486. package/dist/terminal/targets.d.ts +39 -0
  1487. package/dist/terminal/targets.d.ts.map +1 -0
  1488. package/dist/terminal/targets.js +51 -0
  1489. package/dist/terminal/targets.js.map +1 -0
  1490. package/dist/terminal/tickets.d.ts +34 -0
  1491. package/dist/terminal/tickets.d.ts.map +1 -0
  1492. package/dist/terminal/tickets.js +64 -0
  1493. package/dist/terminal/tickets.js.map +1 -0
  1494. package/dist/test/host.d.ts +11 -0
  1495. package/dist/test/host.d.ts.map +1 -0
  1496. package/dist/test/host.js +25 -0
  1497. package/dist/test/host.js.map +1 -0
  1498. package/dist/update/advisor.d.ts +39 -0
  1499. package/dist/update/advisor.d.ts.map +1 -0
  1500. package/dist/update/advisor.js +117 -0
  1501. package/dist/update/advisor.js.map +1 -0
  1502. package/dist/update/index.d.ts +7 -0
  1503. package/dist/update/index.d.ts.map +1 -0
  1504. package/dist/update/index.js +7 -0
  1505. package/dist/update/index.js.map +1 -0
  1506. package/dist/update/inventory.d.ts +40 -0
  1507. package/dist/update/inventory.d.ts.map +1 -0
  1508. package/dist/update/inventory.js +182 -0
  1509. package/dist/update/inventory.js.map +1 -0
  1510. package/dist/update/package-apply.d.ts +74 -0
  1511. package/dist/update/package-apply.d.ts.map +1 -0
  1512. package/dist/update/package-apply.js +188 -0
  1513. package/dist/update/package-apply.js.map +1 -0
  1514. package/dist/update/self-update-apply.d.ts +112 -0
  1515. package/dist/update/self-update-apply.d.ts.map +1 -0
  1516. package/dist/update/self-update-apply.js +437 -0
  1517. package/dist/update/self-update-apply.js.map +1 -0
  1518. package/dist/update/self-update.d.ts +33 -0
  1519. package/dist/update/self-update.d.ts.map +1 -0
  1520. package/dist/update/self-update.js +88 -0
  1521. package/dist/update/self-update.js.map +1 -0
  1522. package/dist/update/summary.d.ts +35 -0
  1523. package/dist/update/summary.d.ts.map +1 -0
  1524. package/dist/update/summary.js +88 -0
  1525. package/dist/update/summary.js.map +1 -0
  1526. package/package.json +54 -0
@@ -0,0 +1,2509 @@
1
+ /**
2
+ * Project operations: real Node process deploy (pidfile + listen + HTTP health)
3
+ * and Nginx publish with correct upstream port.
4
+ */
5
+ import { existsSync, mkdirSync, readFileSync, writeFileSync, unlinkSync, openSync, closeSync, readdirSync, statSync } from 'node:fs';
6
+ import { join } from 'node:path';
7
+ import { ErrorCodes, YskError, tl } from 'ysk-server-shared';
8
+ import { checkHttp, findFreePort, isPortListening, waitHttpOk } from '../host/health.js';
9
+ import { applyNodeHosting } from './node-apply.js';
10
+ import { buildServerNameList, renderNginxPhpFpm, renderNginxProxy, renderNginxStatic, renderNginxSuspended } from './nginx-ssl.js';
11
+ import { syncNginxConfigs, writeManagedNginxConf } from './nginx-sync.js';
12
+ import { apacheBackendUpstream, defaultProcessCommands, defaultRuntimeVersion, detectBunEntry, detectJavaEntry, isProcessRuntime, renderProcessUnit, selectNodeRuntime, selectPhpRuntime, } from './runtime.js';
13
+ import { gitSync } from './git-deploy.js';
14
+ import { backupProject } from './backup-cron.js';
15
+ import { applyPhpHosting } from './system-apply.js';
16
+ import { resolveBestCertPaths } from './ssl-certs.js';
17
+ import { applyPhpFpmPool } from './php-fpm.js';
18
+ import { loadPhpIniSettings, loadProjectPhpIni, mergePhpIni, renderPhpAdminValueLines } from './php-ini.js';
19
+ import { loadRuntimeTuning, tuningToEnv } from './runtime-tuning.js';
20
+ import { assertQuotaMb, assertWithinQuota, checkProjectQuota } from './quota.js';
21
+ import { applyPm2Start, applyPm2Stop, writePm2Ecosystem } from './pm2-apply.js';
22
+ import { loadRealIpConfig } from './real-ip/index.js';
23
+ import { applyProjectWebGroupAccess } from './project-web-group.js';
24
+ import { assertOsIsolationForDeploy, canRunAsProjectUser, chownProjectHome, runAsProjectUser, shellQuote, spawnAsProjectUser } from './project-user-run.js';
25
+ import { applyOsUserLimits, chownHomeNow, probeOsUser } from './project-os-user.js';
26
+ /**
27
+ * Coerce a doc_root string to a safe relative path under project home.
28
+ * Strips leading slashes (legacy "absolute-looking" values), drops `..`.
29
+ */
30
+ export function coerceProjectDocRootRel(raw) {
31
+ let s = String(raw ?? 'app/public').trim().replace(/\\/g, '/');
32
+ if (!s)
33
+ return 'app/public';
34
+ // Drive letters / Windows — treat as invalid → default
35
+ if (/^[A-Za-z]:\//.test(s))
36
+ return 'app/public';
37
+ s = s.replace(/^\/+/, '');
38
+ const parts = s.split('/').filter((p) => p && p !== '.' && p !== '..' && !p.includes('\0'));
39
+ const out = parts.join('/');
40
+ return out.slice(0, 200) || 'app/public';
41
+ }
42
+ /**
43
+ * Normalize project document root for API save (relative to home only).
44
+ * Rejects `..` and empty; leading slash is stripped (same as home-relative intent).
45
+ */
46
+ export function normalizeProjectDocRoot(raw) {
47
+ if (raw == null)
48
+ return undefined;
49
+ const trimmed = String(raw).trim();
50
+ if (!trimmed)
51
+ return undefined;
52
+ if (trimmed.includes('..') || trimmed.includes('\0')) {
53
+ throw new YskError(ErrorCodes.VALIDATION, tl('notes.project.docRootInvalid'), {
54
+ httpStatus: 400,
55
+ details: { docRoot: raw },
56
+ });
57
+ }
58
+ if (/^[A-Za-z]:\//.test(trimmed.replace(/\\/g, '/'))) {
59
+ throw new YskError(ErrorCodes.VALIDATION, tl('notes.project.docRootMustBeRelative'), {
60
+ httpStatus: 400,
61
+ details: { docRoot: raw },
62
+ });
63
+ }
64
+ const rel = coerceProjectDocRootRel(trimmed);
65
+ return rel || undefined;
66
+ }
67
+ /** Resolve document root: relative doc_root under home, default app/public */
68
+ export function resolveProjectDocRoot(row) {
69
+ const rel = coerceProjectDocRootRel(row.doc_root ?? 'app/public');
70
+ return join(row.home_dir, rel);
71
+ }
72
+ /** Relative doc_root for nginx publish (static/php). */
73
+ export function resolveProjectDocRootRel(row) {
74
+ return coerceProjectDocRootRel(row.doc_root ?? 'app/public');
75
+ }
76
+ /**
77
+ * Pick process port: explicit opts → preferred_port → existing → free range.
78
+ * Preferred port busy by another process → validation error (honest).
79
+ */
80
+ export async function resolveProcessPort(opts) {
81
+ const pick = opts.requested ?? opts.preferred ?? opts.current;
82
+ if (pick != null && Number.isFinite(pick) && pick > 0 && pick < 65536) {
83
+ const port = Math.floor(pick);
84
+ // Allow reuse of our current port (still listening from previous process until stop)
85
+ if (opts.current === port)
86
+ return port;
87
+ const busy = await isPortListening(port);
88
+ if (busy) {
89
+ throw new YskError(ErrorCodes.VALIDATION, `Port ${port} is already in use`, {
90
+ httpStatus: 409,
91
+ details: { port },
92
+ });
93
+ }
94
+ return port;
95
+ }
96
+ return findFreePort(opts.from, opts.to);
97
+ }
98
+ /** PHP edge mode from last deploy (publish must not overwrite php -S with dead FPM). */
99
+ export function resolvePhpEdgeMode(row) {
100
+ const mode = String(row.last_health?.deployMode ?? '');
101
+ if (mode === 'php_builtin' || mode === 'php_proxy')
102
+ return 'php_proxy';
103
+ if (mode === 'php_fpm')
104
+ return 'php_fpm';
105
+ // Prefer FPM when no process port (production path)
106
+ if (row.port && row.process_status && row.process_status !== 'stopped') {
107
+ return 'php_proxy';
108
+ }
109
+ return 'php_fpm';
110
+ }
111
+ export class ProjectOpsService {
112
+ projects;
113
+ host;
114
+ dataDir;
115
+ audit;
116
+ constructor(projects, host, dataDir, audit) {
117
+ this.projects = projects;
118
+ this.host = host;
119
+ this.dataDir = dataDir;
120
+ this.audit = audit;
121
+ }
122
+ /**
123
+ * Full Node deploy path:
124
+ * 1) write app artifacts (.env, entry stub, unit)
125
+ * 2) allocate port
126
+ * 3) stop previous process if any
127
+ * 4) spawn node (detached) + pidfile
128
+ * 5) wait until port listens and HTTP returns 2xx
129
+ * 6) rewrite nginx conf with real upstream
130
+ * 7) persist status on project row
131
+ */
132
+ async deployNode(projectId, opts) {
133
+ const row = this.require(projectId);
134
+ if (row.runtime !== 'node') {
135
+ throw new YskError(ErrorCodes.VALIDATION, tl('notes.auto.n0249'), {
136
+ httpStatus: 400
137
+ });
138
+ }
139
+ assertOsIsolationForDeploy(row, this.host, 'Deploy Node');
140
+ await assertWithinQuota({
141
+ host: this.host,
142
+ projectId,
143
+ homeDir: row.home_dir,
144
+ quotaMb: row.quota_mb,
145
+ action: 'Deploy'
146
+ });
147
+ const notes = [];
148
+ const written = [];
149
+ if (!canRunAsProjectUser(row, this.host)) {
150
+ notes.push(tl('notes.auto.n1535'));
151
+ }
152
+ else {
153
+ notes.push(tl('notes.auto.t0171', { v0: (row.linux_user) }));
154
+ }
155
+ const entry = opts.entry ?? 'server.js';
156
+ const port = await resolveProcessPort({
157
+ requested: opts.port,
158
+ preferred: row.preferred_port,
159
+ current: row.port,
160
+ from: 3100,
161
+ to: 3999,
162
+ });
163
+ notes.push(tl('notes.auto.t0173', { v0: (port) }));
164
+ const nodeVer = opts.nodeVersion ?? row.runtime_version ?? defaultRuntimeVersion('node');
165
+ // Never use panel process.execPath under /root (→ systemd 203/EXEC for ysks_* users)
166
+ const nodeResolved = resolveNodeBinary(nodeVer, this.host);
167
+ const nodeBinary = nodeResolved.path;
168
+ notes.push(tl('notes.auto.t0172', { v0: (nodeBinary) }));
169
+ notes.push(...nodeResolved.notes);
170
+ const isolatedDeploy = this.host.executeEnabled() && this.host.isRoot() && Boolean(row.os_provisioned);
171
+ if (isolatedDeploy && !nodeBinaryExists(nodeBinary, this.host)) {
172
+ notes.push(tl('notes.deploy.nodeMissingIsolated', { path: nodeBinary, version: nodeVer }));
173
+ this.projects.updateRuntimeState(projectId, {
174
+ process_status: 'failed',
175
+ status: 'failed',
176
+ last_health: {
177
+ ok: false,
178
+ error: `node binary missing: ${nodeBinary}`,
179
+ at: new Date().toISOString(),
180
+ },
181
+ last_deploy_at: new Date().toISOString(),
182
+ last_deploy_notes: clipDeployNotes(notes),
183
+ });
184
+ return {
185
+ ok: false,
186
+ projectId,
187
+ port,
188
+ processStatus: 'failed',
189
+ listening: false,
190
+ notes,
191
+ written,
192
+ degraded: true,
193
+ deployMode: 'none',
194
+ requiresRoot: false,
195
+ requiresExecute: false,
196
+ };
197
+ }
198
+ const tuningEnv = tuningToEnv(loadRuntimeTuning(this.dataDir, 'node', nodeVer));
199
+ if (Object.keys(tuningEnv).length) {
200
+ notes.push(tl('notes.auto.t0174', { v0: (Object.keys(tuningEnv).join(', ')) }));
201
+ }
202
+ const preferSystemd = opts.enableSystemd === true ||
203
+ (opts.enableSystemd !== false && this.host.executeEnabled() && this.host.isRoot());
204
+ const unitName = `ysk-project-${row.linux_user}.service`;
205
+ // Clean slate: always release both runners before starting one (systemd↔PM2 switch)
206
+ if (this.host.executeEnabled()) {
207
+ if (this.host.isRoot()) {
208
+ const stopNotes = await stopAndDisableProjectUnit(this.host, unitName);
209
+ notes.push(...stopNotes);
210
+ }
211
+ const pm2Stop = await applyPm2Stop({ host: this.host, linuxUser: row.linux_user });
212
+ notes.push(...pm2Stop.notes);
213
+ }
214
+ await this.stopProcess(row, notes);
215
+ // Brief settle so port is free after systemd stop (EADDRINUSE → PM2 errored)
216
+ if (this.host.executeEnabled()) {
217
+ await new Promise((r) => setTimeout(r, 400));
218
+ }
219
+ const memoryMax = opts.memoryMax ?? row.memory_max;
220
+ const cpuQuotaPercent = opts.cpuQuotaPercent ?? row.cpu_quota_percent;
221
+ const apply = await applyNodeHosting({
222
+ dataDir: this.dataDir,
223
+ projectId: row.id,
224
+ projectName: row.name,
225
+ linuxUser: row.linux_user,
226
+ homeDir: row.home_dir,
227
+ nodeVersion: nodeVer,
228
+ entry,
229
+ port,
230
+ host: this.host,
231
+ enableService: preferSystemd,
232
+ nodeBinary,
233
+ memoryMax,
234
+ cpuQuotaPercent,
235
+ limitNOFILE: 65535,
236
+ env: tuningEnv
237
+ });
238
+ written.push(apply.envPath, apply.unitPath, apply.appDir);
239
+ notes.push(...apply.notes);
240
+ await chownProjectHome(this.host, row, notes);
241
+ const appDir = apply.appDir;
242
+ const entryPath = join(appDir, entry);
243
+ if (!existsSync(entryPath)) {
244
+ throw new YskError(ErrorCodes.INTERNAL, tl('notes.auto.t0175', { v0: (entryPath) }), {
245
+ httpStatus: 500
246
+ });
247
+ }
248
+ mkdirSync(join(row.home_dir, 'logs'), { recursive: true });
249
+ const pidfile = join(row.home_dir, 'app.pid');
250
+ this.projects.updateRuntimeState(projectId, {
251
+ port,
252
+ pid: undefined,
253
+ pidfile,
254
+ process_status: 'starting',
255
+ status: 'deploying',
256
+ last_health: undefined,
257
+ last_deploy_at: new Date().toISOString()
258
+ });
259
+ let pid;
260
+ let deployMode = 'pidfile';
261
+ let degraded = true;
262
+ let pm2App;
263
+ // Always write PM2 ecosystem (artifact only) for operators who use PM2 fleet
264
+ const eco = writePm2Ecosystem({
265
+ homeDir: row.home_dir,
266
+ linuxUser: row.linux_user,
267
+ appDir,
268
+ entry,
269
+ port,
270
+ nodeBinary,
271
+ maxMemoryRestart: memoryMax ?? row.memory_max ?? undefined,
272
+ env: tuningEnv
273
+ });
274
+ written.push(eco.ecosystemPath);
275
+ notes.push(...eco.notes);
276
+ pm2App = eco.appName;
277
+ await chownProjectHome(this.host, row, notes);
278
+ if (preferSystemd && this.host.executeEnabled() && this.host.isRoot()) {
279
+ // Production path: install unit and start via systemd
280
+ const r1 = await this.host.runCommand(['cp', apply.unitPath, `/etc/systemd/system/${unitName}`]);
281
+ const r2 = await this.host.runCommand(['systemctl', 'daemon-reload']);
282
+ const r3 = await this.host.runCommand(['systemctl', 'enable', '--now', unitName]);
283
+ notes.push(`systemd: cp exit=${r1.exitCode}, daemon-reload=${r2.exitCode}, enable=${r3.exitCode}`);
284
+ if (r1.exitCode === 0 && r3.exitCode === 0) {
285
+ const health = await assertSystemdUnitHealthy(this.host, unitName);
286
+ notes.push(...health.notes);
287
+ if (health.ok && health.mainPid) {
288
+ deployMode = 'systemd';
289
+ degraded = false;
290
+ pid = health.mainPid;
291
+ writeFileSync(pidfile, `${pid}\n`, 'utf8');
292
+ notes.push(tl('notes.auto.t0176', { v0: (unitName) }));
293
+ }
294
+ else {
295
+ notes.push(tl('notes.auto.n0443'));
296
+ if (!isProjectUserExecutablePath(nodeBinary)) {
297
+ notes.push(tl('notes.deploy.nodeRejectedPath', {
298
+ path: nodeBinary,
299
+ planned: selectNodeRuntime(nodeVer).binaryPath,
300
+ }));
301
+ }
302
+ else if (!nodeBinaryExists(nodeBinary, this.host)) {
303
+ notes.push(tl('notes.deploy.nodeMissing', { path: nodeBinary, version: nodeVer }));
304
+ }
305
+ // Stop crash loops when unit is broken
306
+ await this.host.runCommand(['systemctl', 'stop', unitName], { timeoutMs: 15_000 });
307
+ await this.host.runCommand(['systemctl', 'reset-failed', unitName], {
308
+ timeoutMs: 10_000,
309
+ });
310
+ }
311
+ }
312
+ else {
313
+ notes.push(tl('notes.auto.n0443'));
314
+ }
315
+ }
316
+ // PM2 when not on systemd (explicit enableSystemd:false or systemd failed)
317
+ const tryPm2 = deployMode !== 'systemd' && opts.preferPm2 !== false && this.host.executeEnabled();
318
+ if (tryPm2) {
319
+ // Belt-and-suspenders: unit must stay down so PM2 can bind PORT
320
+ if (this.host.isRoot()) {
321
+ notes.push(...(await stopAndDisableProjectUnit(this.host, unitName)));
322
+ }
323
+ const pm2 = await applyPm2Start({
324
+ host: this.host,
325
+ homeDir: row.home_dir,
326
+ linuxUser: row.linux_user,
327
+ appDir,
328
+ entry,
329
+ port,
330
+ nodeBinary,
331
+ execute: true,
332
+ maxMemoryRestart: memoryMax ?? row.memory_max ?? undefined,
333
+ env: tuningEnv
334
+ });
335
+ notes.push(...pm2.notes);
336
+ if (pm2.ok) {
337
+ deployMode = 'pm2';
338
+ degraded = false;
339
+ pid = pm2.pid;
340
+ if (pid)
341
+ writeFileSync(pidfile, `${pid}\n`, 'utf8');
342
+ notes.push(tl('notes.auto.t0177', { v0: (pm2.appName) }));
343
+ }
344
+ else if (!this.host.executeEnabled()) {
345
+ notes.push(tl('notes.auto.n1143'));
346
+ }
347
+ else {
348
+ notes.push(tl('notes.auto.n0152'));
349
+ notes.push('PM2 deploy failed — ensure systemd unit is stopped and port is free, then redeploy');
350
+ }
351
+ }
352
+ if (deployMode === 'pidfile') {
353
+ notes.push(tl('notes.auto.n1268'));
354
+ }
355
+ if (deployMode === 'pidfile') {
356
+ const logOut = join(row.home_dir, 'logs', 'app.out.log');
357
+ const logErr = join(row.home_dir, 'logs', 'app.err.log');
358
+ let child;
359
+ try {
360
+ const outFd = openSync(logOut, 'a');
361
+ const errFd = openSync(logErr, 'a');
362
+ const shellCmd = `${shellQuote(nodeBinary)} ${shellQuote(entry)}`;
363
+ const spawned = spawnAsProjectUser({
364
+ row,
365
+ host: this.host,
366
+ shellCmd,
367
+ cwd: appDir,
368
+ env: {
369
+ ...process.env,
370
+ NODE_ENV: 'production',
371
+ PORT: String(port),
372
+ HOST: '127.0.0.1',
373
+ ...tuningEnv
374
+ },
375
+ logOutFd: outFd,
376
+ logErrFd: errFd,
377
+ notes
378
+ });
379
+ child = spawned.child;
380
+ if (spawned.mode === 'degraded')
381
+ degraded = true;
382
+ closeSync(outFd);
383
+ closeSync(errFd);
384
+ }
385
+ catch (err) {
386
+ const msg = err instanceof Error ? err.message : String(err);
387
+ this.projects.updateRuntimeState(projectId, {
388
+ process_status: 'failed',
389
+ status: 'failed',
390
+ last_health: { ok: false, error: msg, at: new Date().toISOString() }
391
+ });
392
+ return {
393
+ ok: false,
394
+ projectId,
395
+ port,
396
+ pidfile,
397
+ processStatus: 'failed',
398
+ listening: false,
399
+ notes: [...notes, tl('notes.auto.t0178', { v0: (msg) })],
400
+ written,
401
+ degraded: true,
402
+ deployMode: 'pidfile',
403
+ requiresRoot: !this.host.isRoot(),
404
+ requiresExecute: !this.host.executeEnabled()
405
+ };
406
+ }
407
+ pid = child.pid;
408
+ if (!pid) {
409
+ this.projects.updateRuntimeState(projectId, {
410
+ process_status: 'failed',
411
+ status: 'failed'
412
+ });
413
+ return {
414
+ ok: false,
415
+ projectId,
416
+ port,
417
+ pidfile,
418
+ processStatus: 'failed',
419
+ listening: false,
420
+ notes: [...notes, tl('notes.auto.n0620')],
421
+ written,
422
+ degraded: true,
423
+ deployMode: 'pidfile'
424
+ };
425
+ }
426
+ child.unref();
427
+ writeFileSync(pidfile, `${pid}\n`, 'utf8');
428
+ notes.push(tl('notes.auto.t0179', { v0: (pid), v1: (pidfile) }));
429
+ }
430
+ const url = `http://127.0.0.1:${port}/`;
431
+ const health = await waitHttpOk(url, { timeoutMs: opts.healthTimeoutMs ?? 12_000 });
432
+ const listening = await isPortListening(port);
433
+ let processStatus = 'running';
434
+ if (!health.ok || !listening) {
435
+ processStatus = 'unhealthy';
436
+ notes.push(health.ok
437
+ ? 'HTTP ok but port check failed'
438
+ : `Health failed after ${health.ms}ms: ${health.error ?? health.status}`);
439
+ }
440
+ else {
441
+ notes.push(`Health OK in ${health.ms}ms (HTTP ${health.status}) body=${JSON.stringify(health.body)}`);
442
+ }
443
+ // Nginx with real upstream port (managed dataDir; system reload via publishNginx)
444
+ const serverName = buildServerNameList(row.domain ?? `${row.linux_user}.local`, row.domain_aliases);
445
+ const conf = renderNginxProxy({
446
+ serverName,
447
+ upstream: `http://127.0.0.1:${port}`,
448
+ ssl: false,
449
+ ...this.nginxRealIpOpts(row),
450
+ forceHttps: false,
451
+ hsts: false
452
+ });
453
+ const nginxPath = writeManagedNginxConf(this.dataDir, `${row.linux_user}.conf`, conf);
454
+ written.push(nginxPath);
455
+ notes.push(tl('notes.auto.t0180', { v0: (nginxPath) }));
456
+ const live = await this.syncNginxLive(notes, written);
457
+ const statusLabel = processStatus === 'running'
458
+ ? degraded
459
+ ? 'running_degraded'
460
+ : 'running'
461
+ : processStatus;
462
+ this.projects.updateRuntimeState(projectId, {
463
+ port,
464
+ pid,
465
+ pidfile,
466
+ process_status: processStatus,
467
+ status: statusLabel,
468
+ nginx_config_path: nginxPath,
469
+ last_health: {
470
+ ok: health.ok,
471
+ status: health.status,
472
+ body: health.body,
473
+ error: health.error,
474
+ ms: health.ms,
475
+ at: new Date().toISOString(),
476
+ url,
477
+ deployMode,
478
+ degraded,
479
+ nginxStatus: live.nginxStatus,
480
+ nginxReloaded: live.nginxReloaded,
481
+ },
482
+ last_deploy_at: new Date().toISOString(),
483
+ deploy_entry: entry,
484
+ last_deploy_notes: clipDeployNotes(notes)
485
+ });
486
+ this.audit?.append({
487
+ actor: opts.actor,
488
+ action: 'project.deploy_node',
489
+ resource: projectId,
490
+ detail: { port, pid, health, listening, nginxPath, deployMode, degraded, ...live },
491
+ ok: health.ok && listening
492
+ });
493
+ return {
494
+ ok: health.ok && listening,
495
+ projectId,
496
+ port,
497
+ pid,
498
+ pidfile,
499
+ url,
500
+ processStatus,
501
+ health: {
502
+ ok: health.ok,
503
+ status: health.status,
504
+ body: health.body,
505
+ ms: health.ms,
506
+ error: health.error
507
+ },
508
+ listening,
509
+ nginxPath,
510
+ notes,
511
+ written,
512
+ degraded,
513
+ deployMode,
514
+ nginxReloaded: live.nginxReloaded,
515
+ nginxStatus: live.nginxStatus,
516
+ systemdUnit: deployMode === 'systemd' ? unitName : undefined,
517
+ pm2App: deployMode === 'pm2' ? pm2App : undefined,
518
+ requiresRoot: !this.host.isRoot(),
519
+ requiresExecute: !this.host.executeEnabled()
520
+ };
521
+ }
522
+ /**
523
+ * Stop process via systemd / PM2 / pidfile (SIGTERM then SIGKILL).
524
+ */
525
+ async stopNode(projectId, actor) {
526
+ const row = this.require(projectId);
527
+ const notes = [];
528
+ const unitName = `ysk-project-${row.linux_user}.service`;
529
+ if (this.host.executeEnabled() && this.host.isRoot()) {
530
+ const r = await this.host.runCommand(['systemctl', 'stop', unitName], { timeoutMs: 15_000 });
531
+ notes.push(`systemctl stop ${unitName} exit=${r.exitCode}`);
532
+ }
533
+ if (this.host.executeEnabled()) {
534
+ const pm2Stop = await applyPm2Stop({ host: this.host, linuxUser: row.linux_user });
535
+ notes.push(...pm2Stop.notes);
536
+ }
537
+ await this.stopProcess(row, notes);
538
+ this.projects.updateRuntimeState(projectId, {
539
+ pid: undefined,
540
+ process_status: 'stopped',
541
+ status: 'stopped',
542
+ last_health: { ok: false, error: 'stopped', at: new Date().toISOString() }
543
+ });
544
+ this.audit?.append({
545
+ actor,
546
+ action: 'project.stop_node',
547
+ resource: projectId,
548
+ detail: { notes },
549
+ ok: true
550
+ });
551
+ return {
552
+ ok: true,
553
+ projectId,
554
+ port: row.port,
555
+ processStatus: 'stopped',
556
+ listening: false,
557
+ notes,
558
+ written: []
559
+ };
560
+ }
561
+ /**
562
+ * Static site deploy: ensure public/index.html, write nginx root conf,
563
+ * optional system conf.d sync + reload when root+EXECUTE.
564
+ * No process spawn (no port) — status is "published" when conf written.
565
+ */
566
+ async deployStatic(projectId, opts) {
567
+ const row = this.require(projectId);
568
+ if (row.runtime !== 'static' && row.runtime !== 'php') {
569
+ // allow static deploy for static; php public/ also works as static assets
570
+ if (row.runtime === 'node') {
571
+ throw new YskError(ErrorCodes.VALIDATION, tl('notes.auto.n1037'), { httpStatus: 400 });
572
+ }
573
+ }
574
+ await assertWithinQuota({
575
+ host: this.host,
576
+ projectId,
577
+ homeDir: row.home_dir,
578
+ quotaMb: row.quota_mb,
579
+ action: 'Deploy static'
580
+ });
581
+ const notes = [];
582
+ const written = [];
583
+ const docRoot = resolveProjectDocRoot(row);
584
+ mkdirSync(docRoot, { recursive: true });
585
+ const indexPath = join(docRoot, 'index.html');
586
+ if (!existsSync(indexPath)) {
587
+ writeFileSync(indexPath, `<!doctype html><html><head><meta charset="utf-8"><title>${row.name}</title></head>
588
+ <body><h1>${row.name}</h1><p>YSK static site</p></body></html>\n`, 'utf8');
589
+ written.push(indexPath);
590
+ notes.push(tl('notes.auto.t0181', { v0: (indexPath) }));
591
+ }
592
+ else {
593
+ notes.push(tl('notes.auto.t0182', { v0: (indexPath) }));
594
+ }
595
+ const primary = row.domain ?? `${row.linux_user}.local`;
596
+ const serverName = buildServerNameList(primary, row.domain_aliases);
597
+ const wantSsl = Boolean(opts.ssl);
598
+ const cert = resolveBestCertPaths(this.dataDir, primary);
599
+ if (wantSsl && !cert.exists) {
600
+ return {
601
+ ok: false,
602
+ projectId: row.id,
603
+ processStatus: row.process_status ?? 'stopped',
604
+ listening: false,
605
+ notes: [
606
+ tl('notes.ops.sslNotReady', { domain: primary }),
607
+ tl('notes.ops.sslGoToPage'),
608
+ ],
609
+ written: [],
610
+ degraded: true,
611
+ nginxStatus: 'ssl_cert_missing',
612
+ };
613
+ }
614
+ const auth = await this.writeProjectHtpasswd(row);
615
+ const conf = renderNginxStatic({
616
+ serverName,
617
+ docRoot,
618
+ ssl: wantSsl && cert.exists,
619
+ ...this.nginxRealIpOpts(row),
620
+ sslCertificate: wantSsl && cert.exists ? cert.fullchain : undefined,
621
+ sslCertificateKey: wantSsl && cert.exists ? cert.privkey : undefined,
622
+ forceHttps: wantSsl && cert.exists && Boolean(row.force_https),
623
+ hsts: wantSsl && cert.exists && Boolean(row.hsts),
624
+ siteRedirectUrl: row.site_redirect_url,
625
+ authBasicUserFile: auth.path,
626
+ authBasicRealm: row.http_auth_user ? 'Restricted' : undefined,
627
+ bindIp: row.bind_ip
628
+ });
629
+ notes.push(...auth.notes);
630
+ const nginxPath = writeManagedNginxConf(this.dataDir, `${row.linux_user}.conf`, conf);
631
+ written.push(nginxPath);
632
+ notes.push(tl('notes.auto.t0183', { v0: (nginxPath) }));
633
+ notes.push(tl('notes.auto.t0184', { v0: (docRoot) }));
634
+ let nginxReloaded = false;
635
+ const wantReload = opts.reload === true ||
636
+ (opts.reload !== false && this.host.executeEnabled() && this.host.isRoot());
637
+ if (wantReload && this.host.executeEnabled() && this.host.isRoot()) {
638
+ const sync = await syncNginxConfigs({
639
+ dataDir: this.dataDir,
640
+ systemConfDir: '/etc/nginx/conf.d',
641
+ host: this.host,
642
+ dryRun: false
643
+ });
644
+ written.push(...sync.copied);
645
+ notes.push(...sync.notes);
646
+ if (sync.tested) {
647
+ const rel = await this.host.runCommand(['systemctl', 'reload', 'nginx'], {
648
+ timeoutMs: 15_000
649
+ });
650
+ nginxReloaded = rel.exitCode === 0;
651
+ notes.push(nginxReloaded
652
+ ? tl('notes.auto.n0810')
653
+ : tl('notes.nginx.reloadExit', { code: rel.exitCode }));
654
+ }
655
+ }
656
+ else if (wantReload) {
657
+ notes.push(tl('ops.blocked.nginxReload'));
658
+ }
659
+ else {
660
+ notes.push(tl('notes.auto.n0568'));
661
+ }
662
+ // Stop any leftover node/php process from previous runtime
663
+ await this.stopProcess(row, notes);
664
+ this.projects.updateRuntimeState(projectId, {
665
+ port: undefined,
666
+ pid: undefined,
667
+ pidfile: undefined,
668
+ process_status: 'running',
669
+ status: nginxReloaded ? 'running' : 'published',
670
+ nginx_config_path: nginxPath,
671
+ last_health: {
672
+ ok: true,
673
+ at: new Date().toISOString(),
674
+ deployMode: 'static_nginx',
675
+ degraded: !nginxReloaded,
676
+ docRoot
677
+ },
678
+ last_deploy_at: new Date().toISOString()
679
+ });
680
+ this.audit?.append({
681
+ actor: opts.actor,
682
+ action: 'project.deploy_static',
683
+ resource: projectId,
684
+ detail: { nginxPath, docRoot, nginxReloaded },
685
+ ok: true
686
+ });
687
+ return {
688
+ ok: true,
689
+ projectId,
690
+ processStatus: 'running',
691
+ listening: false,
692
+ nginxPath,
693
+ notes,
694
+ written,
695
+ degraded: !nginxReloaded,
696
+ deployMode: 'none',
697
+ nginxReloaded,
698
+ requiresRoot: !this.host.isRoot(),
699
+ requiresExecute: !this.host.executeEnabled()
700
+ };
701
+ }
702
+ /**
703
+ * Live health check against stored port; updates last_health.
704
+ */
705
+ async health(projectId) {
706
+ const row = this.require(projectId);
707
+ const port = row.port;
708
+ if (!port) {
709
+ return {
710
+ ok: false,
711
+ projectId,
712
+ processStatus: row.process_status ?? 'stopped',
713
+ listening: false,
714
+ notes: [tl('notes.auto.n0703')],
715
+ written: []
716
+ };
717
+ }
718
+ const url = `http://127.0.0.1:${port}/`;
719
+ const listening = await isPortListening(port);
720
+ const health = await checkHttp(url);
721
+ let processStatus = 'stopped';
722
+ if (listening && health.ok)
723
+ processStatus = 'running';
724
+ else if (listening)
725
+ processStatus = 'unhealthy';
726
+ else if (row.pid && isPidAlive(row.pid))
727
+ processStatus = 'unhealthy';
728
+ this.projects.updateRuntimeState(projectId, {
729
+ process_status: processStatus,
730
+ status: processStatus,
731
+ last_health: {
732
+ ok: health.ok,
733
+ status: health.status,
734
+ body: health.body,
735
+ error: health.error,
736
+ ms: health.ms,
737
+ at: new Date().toISOString(),
738
+ url
739
+ }
740
+ });
741
+ return {
742
+ ok: health.ok && listening,
743
+ projectId,
744
+ port,
745
+ pid: row.pid,
746
+ pidfile: row.pidfile,
747
+ url,
748
+ processStatus,
749
+ health: {
750
+ ok: health.ok,
751
+ status: health.status,
752
+ body: health.body,
753
+ ms: health.ms,
754
+ error: health.error
755
+ },
756
+ listening,
757
+ nginxPath: row.nginx_config_path,
758
+ notes: [
759
+ listening ? `Port ${port} is listening` : `Port ${port} is not listening`,
760
+ health.ok ? `HTTP OK ${health.status}` : `HTTP fail: ${health.error ?? health.status}`,
761
+ ],
762
+ written: []
763
+ };
764
+ }
765
+ /** Write htpasswd under dataDir when project has HTTP basic auth credentials. */
766
+ async writeProjectHtpasswd(row) {
767
+ if (!row.http_auth_user?.trim() || !row.http_auth_pass) {
768
+ return { notes: [] };
769
+ }
770
+ const htDir = join(this.dataDir, 'nginx', 'htpasswd');
771
+ mkdirSync(htDir, { recursive: true });
772
+ const path = join(htDir, `${row.linux_user}.htpasswd`);
773
+ const hashR = await this.host.runCommand(['openssl', 'passwd', '-apr1', row.http_auth_pass], { timeoutMs: 5_000 });
774
+ const hash = hashR.exitCode === 0 && hashR.stdout.trim()
775
+ ? hashR.stdout.trim()
776
+ : `{PLAIN}${row.http_auth_pass}`;
777
+ writeFileSync(path, `${row.http_auth_user.trim()}:${hash}\n`, 'utf8');
778
+ return {
779
+ path,
780
+ notes: [tl('notes.auto.t0185', { v0: (row.http_auth_user.trim()), v1: (path) })]
781
+ };
782
+ }
783
+ /**
784
+ * Write/update nginx conf for project and optionally sync to system conf.d.
785
+ * Runtime-aware: static / php-fpm / reverse-proxy.
786
+ */
787
+ async publishNginx(projectId, opts) {
788
+ const row = this.require(projectId);
789
+ if (row.status === 'suspended') {
790
+ return this.publishSuspendedNginx(projectId, opts.actor);
791
+ }
792
+ const primary = row.domain ?? `${row.linux_user}.local`;
793
+ const serverName = buildServerNameList(primary, row.domain_aliases);
794
+ // Prefer dataDir certs, then /etc/letsencrypt/live, then store paths.
795
+ // Auto-enable SSL when cert files exist unless caller explicitly sets ssl:false.
796
+ // (goLive used to pass only reload:true → HTTP-only conf while orphan SSL vhosts
797
+ // from deleted projects kept serving 443 → 502 Bad Gateway.)
798
+ const cert = resolveBestCertPaths(this.dataDir, primary);
799
+ const wantSsl = opts.ssl !== undefined ? opts.ssl : cert.exists;
800
+ const forceHttps = opts.forceHttps ?? Boolean(row.force_https);
801
+ const hsts = opts.hsts ?? Boolean(row.hsts);
802
+ if (opts.forceHttps !== undefined || opts.hsts !== undefined) {
803
+ this.projects.updateMeta(projectId, {
804
+ force_https: forceHttps,
805
+ hsts
806
+ });
807
+ }
808
+ // Never emit listen 443 / ssl_certificate when files are missing (breaks nginx -t).
809
+ if (wantSsl && !cert.exists) {
810
+ return {
811
+ ok: false,
812
+ projectId,
813
+ processStatus: row.process_status ?? 'stopped',
814
+ listening: false,
815
+ notes: [
816
+ tl('notes.ops.sslNotReadyDetail', { domain: primary }),
817
+ tl('notes.ops.sslGoToPage'),
818
+ tl('notes.ops.sslRejectWrite'),
819
+ ],
820
+ written: [],
821
+ degraded: true,
822
+ nginxStatus: 'ssl_cert_missing',
823
+ };
824
+ }
825
+ const auth = await this.writeProjectHtpasswd(row);
826
+ const authBasicUserFile = auth.path;
827
+ const sslCert = wantSsl && cert.exists ? cert.fullchain : undefined;
828
+ const sslKey = wantSsl && cert.exists ? cert.privkey : undefined;
829
+ const realIpOpts = this.nginxRealIpOpts(row);
830
+ const commonSsl = {
831
+ ssl: Boolean(wantSsl && cert.exists),
832
+ ...realIpOpts,
833
+ sslCertificate: sslCert,
834
+ sslCertificateKey: sslKey,
835
+ forceHttps: wantSsl && cert.exists && forceHttps,
836
+ hsts: wantSsl && cert.exists && hsts,
837
+ siteRedirectUrl: row.site_redirect_url,
838
+ authBasicUserFile,
839
+ authBasicRealm: row.http_auth_user ? 'Restricted' : undefined,
840
+ bindIp: row.bind_ip
841
+ };
842
+ const notes = [...auth.notes];
843
+ const written = [];
844
+ let conf;
845
+ let kind = 'proxy';
846
+ let port = row.port;
847
+ if (row.runtime === 'static') {
848
+ kind = 'static';
849
+ const docRoot = resolveProjectDocRoot(row);
850
+ conf = renderNginxStatic({
851
+ serverName,
852
+ docRoot,
853
+ ...commonSsl
854
+ });
855
+ }
856
+ else if (row.runtime === 'php') {
857
+ const edge = resolvePhpEdgeMode(row);
858
+ if (edge === 'php_proxy') {
859
+ if (!port) {
860
+ return {
861
+ ok: false,
862
+ projectId,
863
+ processStatus: row.process_status ?? 'stopped',
864
+ listening: false,
865
+ notes: [
866
+ ...notes,
867
+ 'PHP proxy mode needs a process port — deploy first (or use FPM production path)',
868
+ ],
869
+ written,
870
+ degraded: true,
871
+ nginxStatus: 'needs_deploy',
872
+ };
873
+ }
874
+ kind = 'php-proxy';
875
+ conf = renderNginxProxy({
876
+ serverName,
877
+ upstream: `http://127.0.0.1:${port}`,
878
+ ...commonSsl
879
+ });
880
+ }
881
+ else {
882
+ // Nginx → Apache backend → PHP-FPM (never direct fastcgi from nginx)
883
+ kind = 'php-apache';
884
+ const docRoot = resolveProjectDocRoot(row);
885
+ const phpVer = selectPhpRuntime(row.runtime_version || '8.2').version;
886
+ const fpmSocket = `/run/php/php${phpVer}-fpm-${row.linux_user}.sock`;
887
+ conf = renderNginxPhpFpm({
888
+ serverName,
889
+ docRoot,
890
+ fpmSocket,
891
+ apacheUpstream: apacheBackendUpstream(),
892
+ ...commonSsl
893
+ });
894
+ }
895
+ }
896
+ else {
897
+ // Process runtimes: require a real port — never invent 3000/3100
898
+ if (!port) {
899
+ return {
900
+ ok: false,
901
+ projectId,
902
+ processStatus: row.process_status ?? 'stopped',
903
+ listening: false,
904
+ notes: [
905
+ ...notes,
906
+ 'No process port — deploy the app before publishing nginx proxy',
907
+ ],
908
+ written,
909
+ degraded: true,
910
+ nginxStatus: 'needs_deploy',
911
+ };
912
+ }
913
+ kind = 'proxy';
914
+ conf = renderNginxProxy({
915
+ serverName,
916
+ upstream: `http://127.0.0.1:${port}`,
917
+ ...commonSsl
918
+ });
919
+ }
920
+ const nginxPath = writeManagedNginxConf(this.dataDir, `${row.linux_user}.conf`, conf);
921
+ written.push(nginxPath);
922
+ notes.push(tl('notes.email.wroteNginx', { nginxPath }));
923
+ notes.push(tl('notes.auto.t0186', { v0: kind }));
924
+ if (serverName.includes(' '))
925
+ notes.push(`server_name:${serverName}`);
926
+ if (wantSsl && forceHttps)
927
+ notes.push(tl('notes.auto.n0829'));
928
+ if (wantSsl && hsts)
929
+ notes.push(tl('notes.auto.n0745'));
930
+ if (row.site_redirect_url)
931
+ notes.push(tl('notes.auto.t0187', { v0: row.site_redirect_url }));
932
+ if (wantSsl && cert.exists) {
933
+ notes.push(tl('notes.auto.t0188', { v0: cert.fullchain }));
934
+ }
935
+ else if (wantSsl) {
936
+ notes.push(tl('notes.auto.t0189', { v0: primary }));
937
+ }
938
+ const wantReload = opts.reload ??
939
+ Boolean(this.host.executeEnabled() && this.host.isRoot());
940
+ const live = await this.syncNginxLive(notes, written, {
941
+ systemConfDir: opts.systemConfDir,
942
+ reload: wantReload,
943
+ });
944
+ this.projects.updateRuntimeState(projectId, {
945
+ nginx_config_path: nginxPath,
946
+ last_health: {
947
+ ...(row.last_health ?? {}),
948
+ nginxStatus: live.nginxStatus,
949
+ nginxReloaded: live.nginxReloaded,
950
+ edgeKind: kind,
951
+ at: new Date().toISOString()
952
+ }
953
+ });
954
+ this.projects.updateNginxPath(projectId, nginxPath);
955
+ const reloadBlocked = wantReload && live.nginxStatus === 'requires_execute';
956
+ const reloadFailed = wantReload &&
957
+ (live.nginxStatus === 'nginx_t_failed' ||
958
+ live.nginxStatus.startsWith('reload_failed'));
959
+ const ok = !reloadBlocked && !reloadFailed;
960
+ this.audit?.append({
961
+ actor: opts.actor,
962
+ action: 'project.publish_nginx',
963
+ resource: projectId,
964
+ detail: {
965
+ nginxPath,
966
+ port,
967
+ kind,
968
+ nginxReloaded: live.nginxReloaded,
969
+ nginxStatus: live.nginxStatus,
970
+ serverName,
971
+ forceHttps,
972
+ hsts,
973
+ ok
974
+ },
975
+ ok
976
+ });
977
+ return {
978
+ ok,
979
+ projectId,
980
+ port,
981
+ processStatus: row.process_status ?? 'stopped',
982
+ listening: port ? await isPortListening(port) : false,
983
+ nginxPath,
984
+ notes: [
985
+ ...notes,
986
+ reloadBlocked
987
+ ? tl('notes.auto.n1227')
988
+ : reloadFailed
989
+ ? tl('notes.auto.n1218')
990
+ : live.nginxReloaded
991
+ ? tl('notes.auto.n0001')
992
+ : tl('notes.auto.n0007'),
993
+ ],
994
+ written,
995
+ nginxReloaded: live.nginxReloaded,
996
+ nginxStatus: live.nginxStatus,
997
+ requiresExecute: !this.host.executeEnabled(),
998
+ requiresRoot: !this.host.isRoot(),
999
+ degraded: !live.nginxReloaded
1000
+ };
1001
+ }
1002
+ /**
1003
+ * Sync managed conf.d → system and optionally nginx -t + reload.
1004
+ */
1005
+ async syncNginxLive(notes, written, opts) {
1006
+ const systemDir = opts?.systemConfDir ??
1007
+ (this.host.executeEnabled() && this.host.isRoot() ? '/etc/nginx/conf.d' : undefined);
1008
+ const sync = await syncNginxConfigs({
1009
+ dataDir: this.dataDir,
1010
+ systemConfDir: systemDir,
1011
+ host: this.host,
1012
+ });
1013
+ notes.push(...sync.notes);
1014
+ written.push(...sync.copied);
1015
+ let nginxReloaded = false;
1016
+ let nginxStatus = systemDir ? 'synced' : 'managed_only';
1017
+ const wantReload = opts?.reload ?? Boolean(systemDir && this.host.executeEnabled() && this.host.isRoot());
1018
+ if (wantReload && this.host.executeEnabled()) {
1019
+ const t = await this.host.runCommand(['nginx', '-t'], { timeoutMs: 10_000 });
1020
+ notes.push(t.exitCode === 0
1021
+ ? tl('notes.nginx.configOk')
1022
+ : tl('notes.tpl.nginxConfigFailed', { detail: (t.stderr || t.stdout).trim() }));
1023
+ if (t.exitCode === 0) {
1024
+ const r = await this.host.runCommand(['systemctl', 'reload', 'nginx'], {
1025
+ timeoutMs: 15_000,
1026
+ });
1027
+ nginxReloaded = r.exitCode === 0;
1028
+ nginxStatus = nginxReloaded ? 'reloaded' : `reload_failed:${r.stderr}`;
1029
+ notes.push(nginxReloaded
1030
+ ? tl('notes.nginx.reloaded')
1031
+ : tl('notes.auto.t0190', { v0: r.stderr }));
1032
+ }
1033
+ else {
1034
+ nginxStatus = 'nginx_t_failed';
1035
+ }
1036
+ }
1037
+ else if (wantReload) {
1038
+ notes.push(tl('ops.blocked.nginxReload'));
1039
+ nginxStatus = 'requires_execute';
1040
+ }
1041
+ return { nginxReloaded, nginxStatus };
1042
+ }
1043
+ /**
1044
+ * After create+template (or explicit goLive): deploy by runtime then publish nginx.
1045
+ * Does not rollback project row on failure — returns honest notes.
1046
+ */
1047
+ async goLive(projectId, opts) {
1048
+ const row = this.require(projectId);
1049
+ const notes = [];
1050
+ let deploy;
1051
+ let publish;
1052
+ const persistNotes = (ok) => {
1053
+ this.projects.updateRuntimeState(projectId, {
1054
+ last_deploy_notes: clipDeployNotes(notes),
1055
+ last_deploy_at: new Date().toISOString(),
1056
+ last_health: {
1057
+ ...(this.require(projectId).last_health ?? {}),
1058
+ goLiveOk: ok,
1059
+ goLiveAt: new Date().toISOString(),
1060
+ at: new Date().toISOString(),
1061
+ },
1062
+ });
1063
+ this.audit?.append({
1064
+ actor: opts.actor,
1065
+ action: 'project.go_live',
1066
+ resource: projectId,
1067
+ detail: {
1068
+ ok,
1069
+ deployOk: deploy?.ok,
1070
+ publishOk: publish?.ok,
1071
+ notes: clipDeployNotes(notes),
1072
+ },
1073
+ ok,
1074
+ });
1075
+ };
1076
+ try {
1077
+ if (row.runtime === 'php') {
1078
+ deploy = await this.deployPhp(projectId, {
1079
+ actor: opts.actor,
1080
+ port: opts.port ?? row.preferred_port,
1081
+ });
1082
+ }
1083
+ else if (row.runtime === 'static') {
1084
+ deploy = await this.deployStatic(projectId, {
1085
+ actor: opts.actor,
1086
+ reload: false,
1087
+ });
1088
+ }
1089
+ else if (isProcessRuntime(row.runtime) && row.runtime !== 'node') {
1090
+ deploy = await this.deployProcess(projectId, {
1091
+ actor: opts.actor,
1092
+ port: opts.port ?? row.preferred_port,
1093
+ });
1094
+ }
1095
+ else {
1096
+ deploy = await this.deployNode(projectId, {
1097
+ actor: opts.actor,
1098
+ port: opts.port ?? row.preferred_port,
1099
+ });
1100
+ }
1101
+ notes.push(...(deploy.notes ?? []));
1102
+ if (!deploy.ok) {
1103
+ notes.push(tl('notes.goLive.deployIncomplete'));
1104
+ persistNotes(false);
1105
+ return { ok: false, deploy, notes };
1106
+ }
1107
+ }
1108
+ catch (e) {
1109
+ const msg = e instanceof Error ? e.message : String(e);
1110
+ notes.push(tl('notes.goLive.deployFailed', { detail: msg }));
1111
+ persistNotes(false);
1112
+ return { ok: false, notes };
1113
+ }
1114
+ // deploy* already wrote conf; publish re-renders with SSL flags + ensures system sync
1115
+ try {
1116
+ publish = await this.publishNginx(projectId, {
1117
+ actor: opts.actor,
1118
+ reload: true,
1119
+ });
1120
+ notes.push(...(publish.notes ?? []));
1121
+ if (!publish.ok) {
1122
+ notes.push(tl('notes.goLive.publishIncomplete'));
1123
+ persistNotes(false);
1124
+ return { ok: false, deploy, publish, notes };
1125
+ }
1126
+ }
1127
+ catch (e) {
1128
+ const msg = e instanceof Error ? e.message : String(e);
1129
+ notes.push(tl('notes.goLive.publishFailed', { detail: msg }));
1130
+ persistNotes(false);
1131
+ return { ok: false, deploy, notes };
1132
+ }
1133
+ const ok = true;
1134
+ persistNotes(ok);
1135
+ return { ok, deploy, publish, notes };
1136
+ }
1137
+ /**
1138
+ * Suspend: stop process + publish 503 vhost + status=suspended.
1139
+ */
1140
+ async suspend(projectId, actor) {
1141
+ const row = this.require(projectId);
1142
+ const notes = [];
1143
+ const stop = await this.stopNode(projectId, actor);
1144
+ notes.push(...(stop.notes ?? []));
1145
+ const pub = await this.publishSuspendedNginx(projectId, actor);
1146
+ notes.push(...pub.notes);
1147
+ this.projects.updateRuntimeState(projectId, {
1148
+ status: 'suspended',
1149
+ process_status: 'stopped',
1150
+ nginx_config_path: pub.nginxPath
1151
+ });
1152
+ this.audit?.append({
1153
+ actor,
1154
+ action: 'project.suspend',
1155
+ resource: projectId,
1156
+ detail: { domain: row.domain },
1157
+ ok: true
1158
+ });
1159
+ return {
1160
+ ok: true,
1161
+ projectId,
1162
+ processStatus: 'stopped',
1163
+ listening: false,
1164
+ nginxPath: pub.nginxPath,
1165
+ notes: [tl('notes.auto.n0691'), ...notes],
1166
+ written: pub.written,
1167
+ degraded: pub.degraded,
1168
+ requiresExecute: pub.requiresExecute,
1169
+ requiresRoot: pub.requiresRoot,
1170
+ nginxReloaded: pub.nginxReloaded,
1171
+ nginxStatus: pub.nginxStatus
1172
+ };
1173
+ }
1174
+ /**
1175
+ * Unsuspend: clear suspended flag and re-publish normal nginx (no SSL by default).
1176
+ */
1177
+ async unsuspend(projectId, actor) {
1178
+ this.require(projectId);
1179
+ this.projects.updateMeta(projectId, { status: 'stopped' });
1180
+ this.projects.updateRuntimeState(projectId, {
1181
+ status: 'stopped',
1182
+ process_status: 'stopped'
1183
+ });
1184
+ const pub = await this.publishNginx(projectId, { actor, ssl: false });
1185
+ this.audit?.append({
1186
+ actor,
1187
+ action: 'project.unsuspend',
1188
+ resource: projectId,
1189
+ detail: {},
1190
+ ok: true
1191
+ });
1192
+ return {
1193
+ ...pub,
1194
+ notes: [tl('notes.auto.n0690'), ...pub.notes]
1195
+ };
1196
+ }
1197
+ async publishSuspendedNginx(projectId, actor) {
1198
+ const row = this.require(projectId);
1199
+ const serverName = buildServerNameList(row.domain ?? `${row.linux_user}.local`, row.domain_aliases);
1200
+ const conf = renderNginxSuspended(serverName);
1201
+ const nginxPath = writeManagedNginxConf(this.dataDir, `${row.linux_user}.conf`, conf);
1202
+ const systemDir = this.host.executeEnabled() && this.host.isRoot() ? '/etc/nginx/conf.d' : undefined;
1203
+ const sync = await syncNginxConfigs({
1204
+ dataDir: this.dataDir,
1205
+ systemConfDir: systemDir,
1206
+ host: this.host
1207
+ });
1208
+ const notes = [tl('notes.auto.t0191', { v0: (nginxPath) }), ...sync.notes];
1209
+ let nginxReloaded = false;
1210
+ let nginxStatus = 'managed_only';
1211
+ if (systemDir && this.host.executeEnabled()) {
1212
+ const t = await this.host.runCommand(['nginx', '-t'], { timeoutMs: 10_000 });
1213
+ if (t.exitCode === 0) {
1214
+ const r = await this.host.runCommand(['systemctl', 'reload', 'nginx'], { timeoutMs: 15_000 });
1215
+ nginxReloaded = r.exitCode === 0;
1216
+ nginxStatus = nginxReloaded ? 'reloaded' : `reload_failed`;
1217
+ }
1218
+ else {
1219
+ nginxStatus = 'nginx_t_failed';
1220
+ }
1221
+ }
1222
+ this.projects.updateNginxPath(projectId, nginxPath);
1223
+ void actor;
1224
+ return {
1225
+ ok: true,
1226
+ projectId,
1227
+ processStatus: 'stopped',
1228
+ listening: false,
1229
+ nginxPath,
1230
+ notes,
1231
+ written: [nginxPath, ...sync.copied],
1232
+ nginxReloaded,
1233
+ nginxStatus,
1234
+ requiresExecute: !this.host.executeEnabled(),
1235
+ requiresRoot: !this.host.isRoot(),
1236
+ degraded: !nginxReloaded
1237
+ };
1238
+ }
1239
+ /**
1240
+ * Live status from pidfile / systemd / port (system truth).
1241
+ */
1242
+ async liveStatus(projectId) {
1243
+ const row = this.require(projectId);
1244
+ const port = row.port;
1245
+ const listening = port ? await isPortListening(port) : false;
1246
+ const pid = row.pid;
1247
+ const pidAlive = pid ? isPidAlive(pid) : false;
1248
+ let systemdActive;
1249
+ const unitName = `ysk-project-${row.linux_user}.service`;
1250
+ if (this.host.pathExists('/bin/systemctl') || this.host.pathExists('/usr/bin/systemctl')) {
1251
+ const r = await this.host.runCommand(['systemctl', 'is-active', unitName], { timeoutMs: 5_000 });
1252
+ systemdActive = (r.stdout || r.stderr || '').trim() || `exit_${r.exitCode}`;
1253
+ }
1254
+ let processStatus = row.process_status ?? 'stopped';
1255
+ if (listening)
1256
+ processStatus = 'running';
1257
+ else if (pidAlive)
1258
+ processStatus = 'unhealthy';
1259
+ let deployMode = 'pidfile_or_none';
1260
+ if (systemdActive === 'active')
1261
+ deployMode = 'systemd';
1262
+ else if (row.last_health && typeof row.last_health === 'object') {
1263
+ const dm = row.last_health.deployMode;
1264
+ if (dm === 'pm2' || dm === 'pidfile' || dm === 'systemd')
1265
+ deployMode = dm;
1266
+ }
1267
+ const degraded = deployMode !== 'systemd' && deployMode !== 'pm2';
1268
+ return {
1269
+ projectId,
1270
+ processStatus,
1271
+ port,
1272
+ pid,
1273
+ listening,
1274
+ pidAlive,
1275
+ systemdActive,
1276
+ degraded,
1277
+ deployMode,
1278
+ lastHealth: row.last_health,
1279
+ osProvisioned: row.os_provisioned,
1280
+ linuxUser: row.linux_user
1281
+ };
1282
+ }
1283
+ /**
1284
+ * Git clone/pull into project app dir, then redeploy runtime (all kinds).
1285
+ */
1286
+ async gitDeploy(projectId, opts) {
1287
+ const row = this.require(projectId);
1288
+ const gitUrl = opts.gitUrl ?? row.git_url;
1289
+ if (!gitUrl) {
1290
+ throw new YskError(ErrorCodes.VALIDATION, tl('notes.auto.n1414'), {
1291
+ httpStatus: 400
1292
+ });
1293
+ }
1294
+ const appDir = join(row.home_dir, 'app');
1295
+ const git = await gitSync({
1296
+ host: this.host,
1297
+ gitUrl,
1298
+ targetDir: appDir,
1299
+ branch: opts.branch ?? row.git_branch,
1300
+ depth: opts.depth ?? 1
1301
+ });
1302
+ this.projects.updateRuntimeState(projectId, {
1303
+ git_url: gitUrl,
1304
+ git_branch: git.branch ?? opts.branch,
1305
+ git_commit: git.commit
1306
+ });
1307
+ const notes = [...git.notes];
1308
+ if (git.ok) {
1309
+ await chownProjectHome(this.host, row, notes);
1310
+ }
1311
+ const savedEntry = opts.entry?.trim() || row.deploy_entry?.trim() || undefined;
1312
+ let redeployResult;
1313
+ if (git.ok && opts.redeploy !== false) {
1314
+ if (row.runtime === 'node') {
1315
+ redeployResult = await this.deployNode(projectId, {
1316
+ actor: opts.actor,
1317
+ entry: savedEntry
1318
+ });
1319
+ notes.push(...redeployResult.notes);
1320
+ }
1321
+ else if (row.runtime === 'static') {
1322
+ redeployResult = await this.deployStatic(projectId, { actor: opts.actor });
1323
+ notes.push(...redeployResult.notes);
1324
+ }
1325
+ else if (row.runtime === 'php') {
1326
+ redeployResult = await this.deployPhp(projectId, { actor: opts.actor });
1327
+ notes.push(...redeployResult.notes);
1328
+ }
1329
+ else if (isProcessRuntime(row.runtime)) {
1330
+ redeployResult = await this.deployProcess(projectId, {
1331
+ actor: opts.actor,
1332
+ entry: savedEntry,
1333
+ skipBuild: opts.skipBuild
1334
+ });
1335
+ notes.push(...redeployResult.notes);
1336
+ }
1337
+ else {
1338
+ notes.push(tl('notes.auto.t0192', { v0: (row.runtime) }));
1339
+ }
1340
+ }
1341
+ this.audit?.append({
1342
+ actor: opts.actor,
1343
+ action: 'project.git_deploy',
1344
+ resource: projectId,
1345
+ detail: { git, redeploy: Boolean(redeployResult) },
1346
+ ok: git.ok && (redeployResult?.ok ?? true)
1347
+ });
1348
+ return {
1349
+ ok: git.ok && (redeployResult?.ok ?? true),
1350
+ projectId,
1351
+ port: redeployResult?.port ?? row.port,
1352
+ pid: redeployResult?.pid ?? row.pid,
1353
+ url: redeployResult?.url,
1354
+ processStatus: redeployResult?.processStatus ?? (row.process_status || 'stopped'),
1355
+ listening: redeployResult?.listening ?? false,
1356
+ nginxPath: redeployResult?.nginxPath ?? row.nginx_config_path,
1357
+ notes,
1358
+ written: redeployResult?.written ?? [],
1359
+ git,
1360
+ degraded: redeployResult?.degraded ?? true
1361
+ };
1362
+ }
1363
+ /**
1364
+ * Write env vars to app/.env and store on project.
1365
+ */
1366
+ setEnv(projectId, envVars, actor) {
1367
+ const row = this.require(projectId);
1368
+ const appDir = join(row.home_dir, 'app');
1369
+ mkdirSync(appDir, { recursive: true });
1370
+ const merged = { ...(row.env_vars ?? {}), ...envVars };
1371
+ // remove empty keys
1372
+ for (const [k, v] of Object.entries(merged)) {
1373
+ if (v === '' || v === undefined)
1374
+ delete merged[k];
1375
+ }
1376
+ const envPath = join(appDir, '.env');
1377
+ const lines = Object.entries(merged).map(([k, v]) => `${k}=${String(v).replace(/\n/g, ' ')}`);
1378
+ writeFileSync(envPath, lines.join('\n') + '\n', 'utf8');
1379
+ this.projects.updateRuntimeState(projectId, { env_vars: merged });
1380
+ this.audit?.append({
1381
+ actor,
1382
+ action: 'project.set_env',
1383
+ resource: projectId,
1384
+ detail: { keys: Object.keys(merged) },
1385
+ ok: true
1386
+ });
1387
+ return {
1388
+ ok: true,
1389
+ projectId,
1390
+ processStatus: row.process_status ?? 'stopped',
1391
+ listening: false,
1392
+ notes: [tl('notes.auto.t0193', { v0: (envPath), v1: (Object.keys(merged).length) })],
1393
+ written: [envPath]
1394
+ };
1395
+ }
1396
+ /**
1397
+ * Tar backup of project home under dataDir/backups.
1398
+ */
1399
+ async backup(projectId, actor) {
1400
+ const row = this.require(projectId);
1401
+ const r = await backupProject({
1402
+ host: this.host,
1403
+ dataDir: this.dataDir,
1404
+ projectId,
1405
+ homeDir: row.home_dir
1406
+ });
1407
+ if (r.ok && r.archivePath) {
1408
+ this.projects.updateRuntimeState(projectId, {
1409
+ last_backup_path: r.archivePath,
1410
+ last_backup_at: new Date().toISOString()
1411
+ });
1412
+ }
1413
+ this.audit?.append({
1414
+ actor,
1415
+ action: 'project.backup',
1416
+ resource: projectId,
1417
+ detail: r,
1418
+ ok: r.ok
1419
+ });
1420
+ return {
1421
+ ok: r.ok,
1422
+ projectId,
1423
+ processStatus: row.process_status ?? 'stopped',
1424
+ listening: false,
1425
+ notes: r.notes,
1426
+ written: r.archivePath ? [r.archivePath] : [],
1427
+ archivePath: r.archivePath
1428
+ };
1429
+ }
1430
+ /**
1431
+ * PHP deploy dual-mode:
1432
+ * - production: Nginx → Apache backend → PHP-FPM (root + YSK_EXECUTE)
1433
+ * - degraded: `php -S` + nginx proxy (verifiable without root)
1434
+ */
1435
+ async deployPhp(projectId, opts) {
1436
+ const row = this.require(projectId);
1437
+ if (row.runtime !== 'php' && row.runtime !== 'static') {
1438
+ if (row.runtime === 'node') {
1439
+ throw new YskError(ErrorCodes.VALIDATION, tl('notes.auto.n1036'), {
1440
+ httpStatus: 400
1441
+ });
1442
+ }
1443
+ }
1444
+ // PHP production paths require OS user (FPM pool runs as project user)
1445
+ if (row.runtime === 'php') {
1446
+ assertOsIsolationForDeploy(row, this.host, 'Deploy PHP');
1447
+ }
1448
+ await assertWithinQuota({
1449
+ host: this.host,
1450
+ projectId,
1451
+ homeDir: row.home_dir,
1452
+ quotaMb: row.quota_mb,
1453
+ action: 'Deploy PHP'
1454
+ });
1455
+ const notes = [];
1456
+ const written = [];
1457
+ if (row.runtime === 'php' && canRunAsProjectUser(row, this.host)) {
1458
+ notes.push(tl('notes.auto.t0194', { v0: (row.linux_user) }));
1459
+ }
1460
+ else if (row.runtime === 'php') {
1461
+ notes.push(tl('notes.auto.n0148'));
1462
+ }
1463
+ let port;
1464
+ try {
1465
+ port = await resolveProcessPort({
1466
+ requested: opts.port,
1467
+ preferred: row.preferred_port,
1468
+ current: row.port,
1469
+ from: 8100,
1470
+ to: 8999,
1471
+ });
1472
+ }
1473
+ catch {
1474
+ // FPM path may not need a port; only allocate when falling back to php -S
1475
+ port = opts.port ?? row.port ?? (await findFreePort(8100, 8999));
1476
+ }
1477
+ const docRoot = resolveProjectDocRoot(row);
1478
+ mkdirSync(docRoot, { recursive: true });
1479
+ const domain = row.domain ?? `${row.linux_user}.local`;
1480
+ const aliases = (row.domain_aliases || [])
1481
+ .map((a) => String(a).trim())
1482
+ .filter(Boolean);
1483
+ const phpVersion = opts.phpVersion ?? row.runtime_version ?? '8.2';
1484
+ const phpRt = selectPhpRuntime(phpVersion);
1485
+ if (opts.phpVersion && opts.phpVersion !== row.runtime_version) {
1486
+ this.projects.updateMeta(projectId, { runtime_version: phpRt.version });
1487
+ notes.push(tl('notes.auto.t0195', { v0: (phpRt.version) }));
1488
+ }
1489
+ // Production = Nginx → Apache → FPM (default on when root+EXECUTE)
1490
+ const canProd = this.host.executeEnabled() &&
1491
+ this.host.isRoot() &&
1492
+ opts.forceBuiltin !== true &&
1493
+ opts.preferFpm !== false;
1494
+ // FPM first so Apache SetHandler sock exists when site reloads
1495
+ const mergedIni = mergePhpIni(loadPhpIniSettings(this.dataDir, phpVersion), loadProjectPhpIni(this.dataDir, projectId, phpVersion));
1496
+ const adminValueLines = renderPhpAdminValueLines(mergedIni);
1497
+ if (adminValueLines.length) {
1498
+ notes.push(tl('notes.auto.t0196', { v0: (adminValueLines.length) }));
1499
+ }
1500
+ const fpm = await applyPhpFpmPool({
1501
+ dataDir: this.dataDir,
1502
+ poolName: row.linux_user,
1503
+ linuxUser: row.linux_user,
1504
+ phpVersion,
1505
+ host: this.host,
1506
+ enable: canProd,
1507
+ adminValueLines
1508
+ });
1509
+ written.push(...fpm.written);
1510
+ notes.push(...fpm.notes);
1511
+ // Apache vhost always enabled on production path (Nginx must proxy via Apache)
1512
+ const apply = await applyPhpHosting({
1513
+ dataDir: this.dataDir,
1514
+ domain,
1515
+ serverAliases: aliases,
1516
+ docRoot,
1517
+ phpVersion,
1518
+ poolName: row.linux_user,
1519
+ host: this.host,
1520
+ enableSite: canProd || opts.enableApache === true,
1521
+ projects: this.projects.list().map((p) => ({ ...p })),
1522
+ });
1523
+ await chownProjectHome(this.host, row, notes);
1524
+ // Re-apply ysk-web so Apache/www-data can read DocumentRoot after chown
1525
+ const wg = await applyProjectWebGroupAccess({
1526
+ host: this.host,
1527
+ linuxUser: row.linux_user,
1528
+ linuxGroup: row.linux_group,
1529
+ homeDir: row.home_dir,
1530
+ });
1531
+ notes.push(...wg.notes);
1532
+ written.push(...apply.written);
1533
+ notes.push(...apply.notes);
1534
+ await this.stopProcess(row, notes);
1535
+ // —— Production: FPM + Apache site → Nginx proxy_pass Apache ——
1536
+ if (fpm.enabled && apply.siteEnabled) {
1537
+ const fpmSocket = `/run/php/php${phpRt.version}-fpm-${row.linux_user}.sock`;
1538
+ const authPhp = await this.writeProjectHtpasswd(row);
1539
+ const certProd = resolveBestCertPaths(this.dataDir, domain);
1540
+ const conf = renderNginxPhpFpm({
1541
+ serverName: buildServerNameList(domain, row.domain_aliases),
1542
+ docRoot,
1543
+ fpmSocket,
1544
+ apacheUpstream: apply.apacheUpstream,
1545
+ ssl: certProd.exists,
1546
+ sslCertificate: certProd.exists ? certProd.fullchain : undefined,
1547
+ sslCertificateKey: certProd.exists ? certProd.privkey : undefined,
1548
+ ...this.nginxRealIpOpts(row),
1549
+ forceHttps: certProd.exists && Boolean(row.force_https),
1550
+ hsts: certProd.exists && Boolean(row.hsts),
1551
+ siteRedirectUrl: row.site_redirect_url,
1552
+ authBasicUserFile: authPhp.path,
1553
+ authBasicRealm: row.http_auth_user ? 'Restricted' : undefined,
1554
+ bindIp: row.bind_ip
1555
+ });
1556
+ notes.push(...authPhp.notes);
1557
+ const nginxPath = writeManagedNginxConf(this.dataDir, `${row.linux_user}.conf`, conf);
1558
+ written.push(nginxPath);
1559
+ notes.push(tl('notes.auto.t0197', { v0: (nginxPath) }));
1560
+ notes.push(`nginx proxy_pass ${apply.apacheUpstream} → Apache → FPM ${fpmSocket}`);
1561
+ // best-effort system sync + nginx -t + reload
1562
+ let nginxReloaded = false;
1563
+ if (this.host.executeEnabled() && this.host.isRoot()) {
1564
+ const sync = await syncNginxConfigs({
1565
+ dataDir: this.dataDir,
1566
+ systemConfDir: '/etc/nginx/conf.d',
1567
+ host: this.host,
1568
+ dryRun: false
1569
+ });
1570
+ written.push(...sync.copied);
1571
+ notes.push(...sync.notes);
1572
+ if (sync.tested) {
1573
+ const rel = await this.host.runCommand(['systemctl', 'reload', 'nginx'], {
1574
+ timeoutMs: 15_000
1575
+ });
1576
+ nginxReloaded = rel.exitCode === 0;
1577
+ notes.push(nginxReloaded
1578
+ ? tl('notes.nginx.reloaded')
1579
+ : tl('notes.auto.t0198', { v0: (rel.exitCode), v1: (rel.stderr) }));
1580
+ }
1581
+ }
1582
+ this.projects.updateRuntimeState(projectId, {
1583
+ port: undefined,
1584
+ pid: undefined,
1585
+ pidfile: undefined,
1586
+ process_status: 'running',
1587
+ status: 'running',
1588
+ nginx_config_path: nginxPath,
1589
+ last_health: {
1590
+ ok: true,
1591
+ at: new Date().toISOString(),
1592
+ deployMode: 'php_apache_fpm',
1593
+ degraded: false,
1594
+ fpmSocket,
1595
+ apacheUpstream: apply.apacheUpstream,
1596
+ nginxReloaded
1597
+ },
1598
+ last_deploy_at: new Date().toISOString()
1599
+ });
1600
+ this.audit?.append({
1601
+ actor: opts.actor,
1602
+ action: 'project.deploy_php',
1603
+ resource: projectId,
1604
+ detail: {
1605
+ deployMode: 'php_apache_fpm',
1606
+ fpmSocket,
1607
+ apacheUpstream: apply.apacheUpstream,
1608
+ nginxPath,
1609
+ nginxReloaded,
1610
+ },
1611
+ ok: true
1612
+ });
1613
+ return {
1614
+ ok: true,
1615
+ projectId,
1616
+ processStatus: 'running',
1617
+ listening: false,
1618
+ nginxPath,
1619
+ notes: [
1620
+ ...notes,
1621
+ 'Production: Nginx → Apache → PHP-FPM — verify via public hostname after reload',
1622
+ ],
1623
+ written,
1624
+ degraded: false,
1625
+ deployMode: 'none',
1626
+ nginxReloaded
1627
+ };
1628
+ }
1629
+ if (canProd && (!fpm.enabled || !apply.siteEnabled)) {
1630
+ notes.push(`Production path incomplete (fpm=${fpm.enabled} apacheSite=${apply.siteEnabled}) — falling back to php -S (degraded)`);
1631
+ }
1632
+ else {
1633
+ notes.push(tl('notes.auto.n1269'));
1634
+ }
1635
+ // —— Degraded path: php -S ——
1636
+ const phpBin = await resolvePhpBinary(this.host, phpVersion);
1637
+ if (!phpBin) {
1638
+ this.projects.updateRuntimeState(projectId, {
1639
+ port,
1640
+ process_status: 'failed',
1641
+ status: 'failed'
1642
+ });
1643
+ return {
1644
+ ok: false,
1645
+ projectId,
1646
+ port,
1647
+ processStatus: 'failed',
1648
+ listening: false,
1649
+ notes: [...notes, tl('notes.auto.n0374')],
1650
+ written,
1651
+ degraded: true,
1652
+ deployMode: 'pidfile'
1653
+ };
1654
+ }
1655
+ const pidfile = join(row.home_dir, 'app.pid');
1656
+ const logOut = join(row.home_dir, 'logs', 'php.out.log');
1657
+ const logErr = join(row.home_dir, 'logs', 'php.err.log');
1658
+ mkdirSync(join(row.home_dir, 'logs'), { recursive: true });
1659
+ const outFd = openSync(logOut, 'a');
1660
+ const errFd = openSync(logErr, 'a');
1661
+ const phpShell = `${shellQuote(phpBin)} -S 127.0.0.1:${port} -t ${shellQuote(docRoot)}`;
1662
+ const { child, mode: phpMode } = spawnAsProjectUser({
1663
+ row,
1664
+ host: this.host,
1665
+ shellCmd: phpShell,
1666
+ cwd: docRoot,
1667
+ env: { ...process.env, PORT: String(port) },
1668
+ logOutFd: outFd,
1669
+ logErrFd: errFd,
1670
+ notes
1671
+ });
1672
+ closeSync(outFd);
1673
+ closeSync(errFd);
1674
+ const pid = child.pid;
1675
+ if (!pid) {
1676
+ return {
1677
+ ok: false,
1678
+ projectId,
1679
+ port,
1680
+ processStatus: 'failed',
1681
+ listening: false,
1682
+ notes: [...notes, tl('notes.auto.n0147')],
1683
+ written,
1684
+ degraded: true,
1685
+ deployMode: 'pidfile'
1686
+ };
1687
+ }
1688
+ child.unref();
1689
+ writeFileSync(pidfile, `${pid}\n`, 'utf8');
1690
+ notes.push(tl('notes.auto.t0199', { v0: (pid), v1: (port) }) +
1691
+ (phpMode === 'isolated' ? `(user=${row.linux_user})` : '(degraded)'));
1692
+ await chownProjectHome(this.host, row, notes);
1693
+ const url = `http://127.0.0.1:${port}/`;
1694
+ // acceptRedirect: Roundcube force_https returns 3xx to public HTTPS; following breaks loopback health
1695
+ const health = await waitHttpOk(url, {
1696
+ timeoutMs: opts.healthTimeoutMs ?? 12_000,
1697
+ acceptRedirect: true,
1698
+ });
1699
+ const listening = await isPortListening(port);
1700
+ const processStatus = health.ok && listening ? 'running' : 'unhealthy';
1701
+ // Proxy nginx for degraded path (local health via php -S)
1702
+ const certDeg = resolveBestCertPaths(this.dataDir, domain);
1703
+ const conf = renderNginxProxy({
1704
+ serverName: buildServerNameList(domain, row.domain_aliases),
1705
+ upstream: `http://127.0.0.1:${port}`,
1706
+ ssl: certDeg.exists,
1707
+ sslCertificate: certDeg.exists ? certDeg.fullchain : undefined,
1708
+ sslCertificateKey: certDeg.exists ? certDeg.privkey : undefined,
1709
+ ...this.nginxRealIpOpts(row),
1710
+ forceHttps: certDeg.exists && Boolean(row.force_https),
1711
+ hsts: certDeg.exists && Boolean(row.hsts),
1712
+ bindIp: row.bind_ip,
1713
+ });
1714
+ const nginxPath = writeManagedNginxConf(this.dataDir, `${row.linux_user}.conf`, conf);
1715
+ written.push(nginxPath);
1716
+ const live = await this.syncNginxLive(notes, written);
1717
+ this.projects.updateRuntimeState(projectId, {
1718
+ port,
1719
+ pid,
1720
+ pidfile,
1721
+ process_status: processStatus,
1722
+ status: processStatus === 'running' ? 'running_degraded' : processStatus,
1723
+ nginx_config_path: nginxPath,
1724
+ last_health: {
1725
+ ok: health.ok,
1726
+ status: health.status,
1727
+ body: health.body,
1728
+ error: health.error,
1729
+ ms: health.ms,
1730
+ at: new Date().toISOString(),
1731
+ url,
1732
+ deployMode: 'php_builtin',
1733
+ degraded: true,
1734
+ nginxStatus: live.nginxStatus,
1735
+ nginxReloaded: live.nginxReloaded,
1736
+ },
1737
+ last_deploy_at: new Date().toISOString()
1738
+ });
1739
+ this.audit?.append({
1740
+ actor: opts.actor,
1741
+ action: 'project.deploy_php',
1742
+ resource: projectId,
1743
+ detail: { port, pid, health, listening, deployMode: 'php_builtin' },
1744
+ ok: health.ok && listening
1745
+ });
1746
+ return {
1747
+ ok: health.ok && listening,
1748
+ projectId,
1749
+ port,
1750
+ pid,
1751
+ pidfile,
1752
+ url,
1753
+ processStatus,
1754
+ health: {
1755
+ ok: health.ok,
1756
+ status: health.status,
1757
+ body: health.body,
1758
+ ms: health.ms,
1759
+ error: health.error
1760
+ },
1761
+ listening,
1762
+ nginxPath,
1763
+ notes,
1764
+ written,
1765
+ degraded: true,
1766
+ deployMode: 'pidfile',
1767
+ requiresRoot: !this.host.isRoot(),
1768
+ requiresExecute: !this.host.executeEnabled()
1769
+ };
1770
+ }
1771
+ /**
1772
+ * Set systemd resource limits stored for next deploy (+ optional live set-property via applyOsLimits).
1773
+ */
1774
+ setResources(projectId, resources, actor) {
1775
+ const row = this.require(projectId);
1776
+ if (resources.memoryMax != null && !/^\d+[KMG]?$/i.test(resources.memoryMax)) {
1777
+ throw new YskError(ErrorCodes.VALIDATION, tl('notes.auto.n0328'), {
1778
+ httpStatus: 400
1779
+ });
1780
+ }
1781
+ if (resources.cpuQuotaPercent != null &&
1782
+ (!Number.isFinite(resources.cpuQuotaPercent) ||
1783
+ resources.cpuQuotaPercent < 1 ||
1784
+ resources.cpuQuotaPercent > 10000)) {
1785
+ throw new YskError(ErrorCodes.VALIDATION, tl('notes.auto.n0087'), { httpStatus: 400 });
1786
+ }
1787
+ if (resources.tasksMax != null &&
1788
+ (!Number.isFinite(resources.tasksMax) ||
1789
+ resources.tasksMax < 1 ||
1790
+ resources.tasksMax > 1_000_000)) {
1791
+ throw new YskError(ErrorCodes.VALIDATION, tl('notes.auto.n0196'), { httpStatus: 400 });
1792
+ }
1793
+ if (resources.limitNofile != null &&
1794
+ (!Number.isFinite(resources.limitNofile) ||
1795
+ resources.limitNofile < 64 ||
1796
+ resources.limitNofile > 10_000_000)) {
1797
+ throw new YskError(ErrorCodes.VALIDATION, tl('notes.auto.n0129'), {
1798
+ httpStatus: 400
1799
+ });
1800
+ }
1801
+ this.projects.updateRuntimeState(projectId, {
1802
+ memory_max: resources.memoryMax,
1803
+ cpu_quota_percent: resources.cpuQuotaPercent,
1804
+ tasks_max: resources.tasksMax,
1805
+ limit_nofile: resources.limitNofile
1806
+ });
1807
+ this.audit?.append({
1808
+ actor,
1809
+ action: 'project.set_resources',
1810
+ resource: projectId,
1811
+ detail: resources,
1812
+ ok: true
1813
+ });
1814
+ return {
1815
+ ok: true,
1816
+ projectId,
1817
+ processStatus: row.process_status ?? 'stopped',
1818
+ listening: false,
1819
+ notes: [
1820
+ `memoryMax=${resources.memoryMax ?? row.memory_max ?? 'unset'}`,
1821
+ `cpuQuota=${resources.cpuQuotaPercent ?? row.cpu_quota_percent ?? 'unset'}%`,
1822
+ `tasksMax=${resources.tasksMax ?? row.tasks_max ?? 'unset'}`,
1823
+ `limitNofile=${resources.limitNofile ?? row.limit_nofile ?? 'unset'}`,
1824
+ tl('notes.auto.n0763'),
1825
+ ],
1826
+ written: []
1827
+ };
1828
+ }
1829
+ /**
1830
+ * Set soft disk quota (MiB); hard setquota runs on applyOsLimits when available.
1831
+ */
1832
+ async setQuota(projectId, quotaMb, actor) {
1833
+ assertQuotaMb(quotaMb);
1834
+ const row = this.require(projectId);
1835
+ this.projects.updateRuntimeState(projectId, { quota_mb: quotaMb });
1836
+ const quota = await checkProjectQuota({
1837
+ host: this.host,
1838
+ projectId,
1839
+ homeDir: row.home_dir,
1840
+ quotaMb
1841
+ });
1842
+ this.audit?.append({
1843
+ actor,
1844
+ action: 'project.set_quota',
1845
+ resource: projectId,
1846
+ detail: quota,
1847
+ ok: true
1848
+ });
1849
+ return {
1850
+ ok: true,
1851
+ projectId,
1852
+ processStatus: row.process_status ?? 'stopped',
1853
+ listening: false,
1854
+ notes: [
1855
+ `quota=${quotaMb}MB`,
1856
+ `used=${quota.usedMb}MB`,
1857
+ ...quota.notes,
1858
+ tl('notes.auto.n1463'),
1859
+ ],
1860
+ written: [],
1861
+ quota
1862
+ };
1863
+ }
1864
+ async getOsUser(projectId) {
1865
+ const row = this.require(projectId);
1866
+ const live = await probeOsUser(this.host, row);
1867
+ return {
1868
+ live,
1869
+ limits: {
1870
+ quotaMb: row.quota_mb,
1871
+ memoryMax: row.memory_max,
1872
+ cpuQuotaPercent: row.cpu_quota_percent,
1873
+ tasksMax: row.tasks_max,
1874
+ limitNofile: row.limit_nofile,
1875
+ shell: row.shell ?? '/usr/sbin/nologin',
1876
+ accountLocked: row.account_locked
1877
+ }
1878
+ };
1879
+ }
1880
+ /**
1881
+ * Patch shell / lock + resource fields then apply to OS (best-effort).
1882
+ */
1883
+ async patchOsUser(projectId, patch, actor) {
1884
+ this.require(projectId);
1885
+ if (patch.shell != null) {
1886
+ const s = patch.shell.trim();
1887
+ if (!s.startsWith('/') || s.includes('..') || s.length > 128) {
1888
+ throw new YskError(ErrorCodes.VALIDATION, tl('notes.auto.n0432'), { httpStatus: 400 });
1889
+ }
1890
+ }
1891
+ if (patch.quotaMb != null)
1892
+ assertQuotaMb(patch.quotaMb);
1893
+ this.projects.updateRuntimeState(projectId, {
1894
+ shell: patch.shell?.trim(),
1895
+ account_locked: patch.accountLocked,
1896
+ memory_max: patch.memoryMax,
1897
+ cpu_quota_percent: patch.cpuQuotaPercent,
1898
+ tasks_max: patch.tasksMax,
1899
+ limit_nofile: patch.limitNofile,
1900
+ quota_mb: patch.quotaMb
1901
+ });
1902
+ const fresh = this.require(projectId);
1903
+ const result = await applyOsUserLimits({
1904
+ host: this.host,
1905
+ row: fresh,
1906
+ dataDir: this.dataDir
1907
+ });
1908
+ this.audit?.append({
1909
+ actor,
1910
+ action: 'project.os_user_patch',
1911
+ resource: projectId,
1912
+ detail: { patch, result },
1913
+ ok: result.ok
1914
+ });
1915
+ return { ...result, projectId };
1916
+ }
1917
+ async applyOsLimits(projectId, actor) {
1918
+ const row = this.require(projectId);
1919
+ const result = await applyOsUserLimits({
1920
+ host: this.host,
1921
+ row,
1922
+ dataDir: this.dataDir
1923
+ });
1924
+ this.audit?.append({
1925
+ actor,
1926
+ action: 'project.os_user_apply_limits',
1927
+ resource: projectId,
1928
+ detail: result,
1929
+ ok: result.ok
1930
+ });
1931
+ return { ...result, projectId };
1932
+ }
1933
+ async chownOsHome(projectId, actor) {
1934
+ const row = this.require(projectId);
1935
+ const r = await chownHomeNow(this.host, row);
1936
+ this.audit?.append({
1937
+ actor,
1938
+ action: 'project.os_user_chown',
1939
+ resource: projectId,
1940
+ detail: r,
1941
+ ok: r.ok
1942
+ });
1943
+ return { ...r, projectId };
1944
+ }
1945
+ async quotaStatus(projectId) {
1946
+ const row = this.require(projectId);
1947
+ return checkProjectQuota({
1948
+ host: this.host,
1949
+ projectId,
1950
+ homeDir: row.home_dir,
1951
+ quotaMb: row.quota_mb
1952
+ });
1953
+ }
1954
+ require(id) {
1955
+ const row = this.projects.findById(id);
1956
+ if (!row) {
1957
+ throw new YskError(ErrorCodes.NOT_FOUND, tl('notes.project.notFound', { id }), { httpStatus: 404 });
1958
+ }
1959
+ return row;
1960
+ }
1961
+ /** Multi-CDN real client IP opts for nginx renderers. */
1962
+ nginxRealIpOpts(row) {
1963
+ return {
1964
+ cloudflareRealIp: true,
1965
+ realIpProvider: (row.real_ip_provider || 'inherit'),
1966
+ realIpHost: loadRealIpConfig(this.dataDir),
1967
+ };
1968
+ }
1969
+ async stopProcess(row, notes) {
1970
+ const pidfile = row.pidfile ?? join(row.home_dir, 'app.pid');
1971
+ let pid = row.pid;
1972
+ if (!pid && existsSync(pidfile)) {
1973
+ const raw = readFileSync(pidfile, 'utf8').trim();
1974
+ const n = Number(raw);
1975
+ if (Number.isFinite(n) && n > 0)
1976
+ pid = n;
1977
+ }
1978
+ if (pid && isPidAlive(pid)) {
1979
+ try {
1980
+ process.kill(pid, 'SIGTERM');
1981
+ notes.push(tl('notes.auto.t0200', { v0: (pid) }));
1982
+ await waitUntilDead(pid, 3000);
1983
+ if (isPidAlive(pid)) {
1984
+ process.kill(pid, 'SIGKILL');
1985
+ notes.push(tl('notes.auto.t0201', { v0: (pid) }));
1986
+ }
1987
+ }
1988
+ catch (e) {
1989
+ notes.push(`kill ${pid}: ${e instanceof Error ? e.message : String(e)}`);
1990
+ }
1991
+ }
1992
+ else if (pid) {
1993
+ notes.push(tl('notes.auto.t0202', { v0: (pid) }));
1994
+ }
1995
+ if (existsSync(pidfile)) {
1996
+ try {
1997
+ unlinkSync(pidfile);
1998
+ }
1999
+ catch {
2000
+ /* ignore */
2001
+ }
2002
+ }
2003
+ }
2004
+ /**
2005
+ * Deploy process-style runtimes: python / go / rust
2006
+ * (Node keeps deployNode for PM2/systemd richness.)
2007
+ * Build optional → write unit → pidfile spawn → health check → nginx proxy conf.
2008
+ */
2009
+ async deployProcess(projectId, opts) {
2010
+ const row = this.require(projectId);
2011
+ if (!isProcessRuntime(row.runtime) || row.runtime === 'node') {
2012
+ if (row.runtime === 'node') {
2013
+ return this.deployNode(projectId, { actor: opts.actor, entry: opts.entry, port: opts.port });
2014
+ }
2015
+ throw new YskError(ErrorCodes.VALIDATION, tl('notes.auto.t0203', { v0: (row.runtime) }), { httpStatus: 400 });
2016
+ }
2017
+ assertOsIsolationForDeploy(row, this.host, 'Deploy');
2018
+ await assertWithinQuota({
2019
+ host: this.host,
2020
+ projectId,
2021
+ homeDir: row.home_dir,
2022
+ quotaMb: row.quota_mb,
2023
+ action: 'Deploy'
2024
+ });
2025
+ const notes = [];
2026
+ const written = [];
2027
+ if (!canRunAsProjectUser(row, this.host)) {
2028
+ notes.push(tl('notes.auto.n1534'));
2029
+ }
2030
+ else {
2031
+ notes.push(tl('notes.auto.t0204', { v0: (row.linux_user) }));
2032
+ }
2033
+ const appDir = join(row.home_dir, 'app');
2034
+ mkdirSync(appDir, { recursive: true });
2035
+ mkdirSync(join(row.home_dir, 'logs'), { recursive: true });
2036
+ const port = await resolveProcessPort({
2037
+ requested: opts.port,
2038
+ preferred: row.preferred_port,
2039
+ current: row.port,
2040
+ from: 3200,
2041
+ to: 3999,
2042
+ });
2043
+ const cargoName = resolveCargoPackageName(appDir);
2044
+ // entry: request → saved deploy_entry → auto-detect per runtime
2045
+ let entry = opts.entry?.trim() || row.deploy_entry?.trim() || undefined;
2046
+ if (!entry && row.runtime === 'python') {
2047
+ entry = detectPythonEntry(appDir) ?? undefined;
2048
+ }
2049
+ if (!entry && row.runtime === 'rust' && cargoName) {
2050
+ entry = `./target/release/${cargoName}`;
2051
+ }
2052
+ if (!entry && (row.runtime === 'java' || row.runtime === 'kotlin')) {
2053
+ entry = detectJavaEntry(appDir) ?? undefined;
2054
+ }
2055
+ if (!entry && row.runtime === 'bun') {
2056
+ entry = detectBunEntry(appDir) ?? undefined;
2057
+ }
2058
+ const cmds = defaultProcessCommands(row.runtime, {
2059
+ version: row.runtime_version,
2060
+ entry,
2061
+ port,
2062
+ cargoName: cargoName ?? undefined
2063
+ });
2064
+ notes.push(tl('notes.auto.t0205', { v0: (row.runtime), v1: (port), v2: (cmds.entry) }));
2065
+ await this.stopProcess(row, notes);
2066
+ if (cmds.build && !opts.skipBuild) {
2067
+ notes.push(tl('notes.auto.t0206', { v0: (cmds.build) }));
2068
+ const build = await runAsProjectUser(this.host, row, cmds.build, {
2069
+ timeoutMs: 600_000,
2070
+ cwd: appDir,
2071
+ notes
2072
+ });
2073
+ if (build.exitCode !== 0) {
2074
+ const detail = (build.stderr || build.stdout || '').trim().slice(0, 600) ||
2075
+ `(no stdout/stderr; exit=${build.exitCode})`;
2076
+ notes.push(tl('notes.auto.t0207', { v0: detail }));
2077
+ this.projects.updateRuntimeState(projectId, {
2078
+ process_status: 'failed',
2079
+ status: 'failed',
2080
+ port,
2081
+ last_deploy_notes: clipDeployNotes(notes),
2082
+ });
2083
+ return {
2084
+ ok: false,
2085
+ projectId,
2086
+ port,
2087
+ processStatus: 'failed',
2088
+ listening: false,
2089
+ notes,
2090
+ written,
2091
+ degraded: true,
2092
+ requiresRoot: !this.host.isRoot(),
2093
+ requiresExecute: !this.host.executeEnabled()
2094
+ };
2095
+ }
2096
+ notes.push(tl('notes.auto.n0821'));
2097
+ await chownProjectHome(this.host, row, notes);
2098
+ }
2099
+ const rtKind = row.runtime;
2100
+ const tuningEnv = tuningToEnv(loadRuntimeTuning(this.dataDir, rtKind, row.runtime_version ?? 'default'));
2101
+ if (Object.keys(tuningEnv).length) {
2102
+ notes.push(tl('notes.auto.t0208', { v0: (row.runtime), v1: (Object.keys(tuningEnv).join(', ')) }));
2103
+ }
2104
+ const processEnv = {
2105
+ PORT: String(port),
2106
+ HOST: '127.0.0.1',
2107
+ ...tuningEnv
2108
+ };
2109
+ const unitBody = renderProcessUnit({
2110
+ projectName: row.name,
2111
+ linuxUser: row.linux_user,
2112
+ appDir,
2113
+ homeDir: row.home_dir,
2114
+ execStart: cmds.execStart,
2115
+ port,
2116
+ env: processEnv,
2117
+ memoryMax: row.memory_max,
2118
+ cpuQuotaPercent: row.cpu_quota_percent,
2119
+ tasksMax: row.tasks_max,
2120
+ limitNOFILE: row.limit_nofile
2121
+ });
2122
+ const unitManaged = join(this.dataDir, 'systemd', `ysk-project-${row.linux_user}.service`);
2123
+ mkdirSync(join(this.dataDir, 'systemd'), { recursive: true });
2124
+ writeFileSync(unitManaged, unitBody, 'utf8');
2125
+ written.push(unitManaged);
2126
+ notes.push(tl('notes.auto.t0209', { v0: (unitManaged) }));
2127
+ let unitActive = false;
2128
+ const processUnitName = `ysk-project-${row.linux_user}.service`;
2129
+ const pidfile = join(row.home_dir, 'app.pid');
2130
+ let pid;
2131
+ if (this.host.executeEnabled() && this.host.isRoot() && row.os_provisioned) {
2132
+ const systemUnit = `/etc/systemd/system/${processUnitName}`;
2133
+ try {
2134
+ writeFileSync(systemUnit, unitBody, 'utf8');
2135
+ written.push(systemUnit);
2136
+ await this.host.runCommand(['systemctl', 'daemon-reload'], { timeoutMs: 15_000 });
2137
+ const en = await this.host.runCommand(['systemctl', 'enable', '--now', processUnitName], { timeoutMs: 30_000 });
2138
+ if (en.exitCode === 0) {
2139
+ const health = await assertSystemdUnitHealthy(this.host, processUnitName);
2140
+ notes.push(...health.notes);
2141
+ if (health.ok) {
2142
+ notes.push(tl('notes.auto.t0210', { v0: (row.linux_user) }));
2143
+ unitActive = true;
2144
+ if (health.mainPid) {
2145
+ pid = health.mainPid;
2146
+ writeFileSync(pidfile, `${pid}\n`, 'utf8');
2147
+ }
2148
+ }
2149
+ else {
2150
+ notes.push(tl('notes.auto.t0211', { v0: health.detail || 'unit not healthy' }));
2151
+ await this.host.runCommand(['systemctl', 'stop', processUnitName], {
2152
+ timeoutMs: 15_000,
2153
+ });
2154
+ await this.host.runCommand(['systemctl', 'reset-failed', processUnitName], {
2155
+ timeoutMs: 10_000,
2156
+ });
2157
+ }
2158
+ }
2159
+ else
2160
+ notes.push(tl('notes.auto.t0211', { v0: (en.stderr || en.stdout) }));
2161
+ }
2162
+ catch (e) {
2163
+ notes.push(tl('notes.auto.t0212', { v0: (e instanceof Error ? e.message : String(e)) }));
2164
+ }
2165
+ }
2166
+ else {
2167
+ notes.push(tl('notes.auto.n0949'));
2168
+ }
2169
+ if (!unitActive) {
2170
+ const active = await this.host.runCommand(['systemctl', 'is-active', processUnitName], { timeoutMs: 5_000 });
2171
+ unitActive = active.stdout.trim() === 'active';
2172
+ }
2173
+ if (!unitActive) {
2174
+ const logOut = join(row.home_dir, 'logs', 'app.out.log');
2175
+ const logErr = join(row.home_dir, 'logs', 'app.err.log');
2176
+ try {
2177
+ const outFd = openSync(logOut, 'a');
2178
+ const errFd = openSync(logErr, 'a');
2179
+ const { child } = spawnAsProjectUser({
2180
+ row,
2181
+ host: this.host,
2182
+ shellCmd: cmds.execStart,
2183
+ cwd: appDir,
2184
+ env: {
2185
+ ...process.env,
2186
+ ...processEnv
2187
+ },
2188
+ logOutFd: outFd,
2189
+ logErrFd: errFd,
2190
+ notes
2191
+ });
2192
+ closeSync(outFd);
2193
+ closeSync(errFd);
2194
+ pid = child.pid;
2195
+ if (pid) {
2196
+ child.unref();
2197
+ writeFileSync(pidfile, `${pid}\n`, 'utf8');
2198
+ notes.push(tl('notes.tpl.pidStarted', {
2199
+ pid,
2200
+ extra: row.linux_user
2201
+ ? tl('notes.tpl.pidUser', { user: row.linux_user })
2202
+ : tl('notes.tpl.pidDegraded'),
2203
+ }));
2204
+ }
2205
+ else {
2206
+ notes.push(tl('notes.auto.n0378'));
2207
+ }
2208
+ }
2209
+ catch (err) {
2210
+ notes.push(tl('notes.auto.t0214', { v0: (err instanceof Error ? err.message : String(err)) }));
2211
+ }
2212
+ }
2213
+ await chownProjectHome(this.host, row, notes);
2214
+ const url = `http://127.0.0.1:${port}/`;
2215
+ const health = await waitHttpOk(url, { timeoutMs: opts.healthTimeoutMs ?? 15_000 });
2216
+ const listening = await isPortListening(port);
2217
+ let processStatus = 'running';
2218
+ if (!health.ok || !listening) {
2219
+ processStatus = listening ? 'unhealthy' : 'failed';
2220
+ notes.push(health.ok
2221
+ ? tl('notes.auto.n0633')
2222
+ : tl('notes.auto.t0215', { v0: (health.ms), v1: (health.error ?? health.status) }));
2223
+ }
2224
+ else {
2225
+ notes.push(tl('notes.auto.t0216', { v0: (health.ms) }));
2226
+ }
2227
+ const serverName = buildServerNameList(row.domain ?? `${row.linux_user}.local`, row.domain_aliases);
2228
+ const conf = renderNginxProxy({
2229
+ serverName,
2230
+ upstream: `http://127.0.0.1:${port}`,
2231
+ ssl: false,
2232
+ ...this.nginxRealIpOpts(row),
2233
+ forceHttps: false,
2234
+ hsts: false,
2235
+ siteRedirectUrl: row.site_redirect_url,
2236
+ bindIp: row.bind_ip
2237
+ });
2238
+ const nginxPath = writeManagedNginxConf(this.dataDir, `${row.linux_user}.conf`, conf);
2239
+ written.push(nginxPath);
2240
+ notes.push(tl('notes.auto.t0217', { v0: (nginxPath) }));
2241
+ const live = await this.syncNginxLive(notes, written);
2242
+ this.projects.updateRuntimeState(projectId, {
2243
+ port,
2244
+ pid,
2245
+ pidfile,
2246
+ process_status: processStatus,
2247
+ status: processStatus === 'running' ? 'running' : processStatus,
2248
+ last_health: {
2249
+ ok: health.ok,
2250
+ status: health.status,
2251
+ ms: health.ms,
2252
+ at: new Date().toISOString(),
2253
+ nginxStatus: live.nginxStatus,
2254
+ nginxReloaded: live.nginxReloaded,
2255
+ },
2256
+ last_deploy_at: new Date().toISOString(),
2257
+ nginx_config_path: nginxPath,
2258
+ deploy_entry: cmds.entry,
2259
+ last_deploy_notes: clipDeployNotes(notes)
2260
+ });
2261
+ this.audit?.append({
2262
+ actor: opts.actor,
2263
+ action: 'project.deploy_process',
2264
+ resource: projectId,
2265
+ detail: { runtime: row.runtime, port, processStatus, entry: cmds.entry, ...live },
2266
+ ok: processStatus === 'running'
2267
+ });
2268
+ return {
2269
+ ok: processStatus === 'running',
2270
+ projectId,
2271
+ port,
2272
+ pid,
2273
+ pidfile,
2274
+ processStatus,
2275
+ listening,
2276
+ url,
2277
+ notes,
2278
+ written,
2279
+ deployMode: unitActive ? 'systemd' : 'pidfile',
2280
+ nginxReloaded: live.nginxReloaded,
2281
+ nginxStatus: live.nginxStatus,
2282
+ requiresRoot: !this.host.isRoot(),
2283
+ requiresExecute: !this.host.executeEnabled()
2284
+ };
2285
+ }
2286
+ }
2287
+ /**
2288
+ * Whether systemd unit is actually running after enable --now.
2289
+ * enable exit 0 alone is insufficient (203/EXEC dies immediately).
2290
+ */
2291
+ export async function assertSystemdUnitHealthy(host, unitName) {
2292
+ const notes = [];
2293
+ const act = await host.runCommand(['systemctl', 'is-active', unitName], { timeoutMs: 5_000 });
2294
+ const active = (act.stdout || '').trim();
2295
+ const mainPidR = await host.runCommand(['systemctl', 'show', '-p', 'MainPID', '--value', unitName], { timeoutMs: 5_000 });
2296
+ const resultR = await host.runCommand(['systemctl', 'show', '-p', 'Result', '--value', unitName], { timeoutMs: 5_000 });
2297
+ const unitResult = (resultR.stdout || '').trim();
2298
+ const n = Number((mainPidR.stdout || '').trim());
2299
+ const mainPid = Number.isFinite(n) && n > 0 ? n : undefined;
2300
+ const detail = `is-active=${active || '?'}, Result=${unitResult || '?'}, MainPID=${mainPid ?? 0}`;
2301
+ notes.push(`systemd: ${detail}`);
2302
+ // Type=simple: active + MainPID>0 is the real success signal
2303
+ const ok = active === 'active' && mainPid != null;
2304
+ if (!ok) {
2305
+ notes.push(tl('notes.deploy.unitUnhealthy', { detail, unit: unitName }));
2306
+ }
2307
+ return { ok, active, result: unitResult, mainPid, notes, detail };
2308
+ }
2309
+ function nodeBinaryExists(path, host) {
2310
+ if (!path || path === 'node')
2311
+ return true; // PATH name — cannot prove here
2312
+ if (host?.pathExists?.(path))
2313
+ return true;
2314
+ try {
2315
+ return existsSync(path);
2316
+ }
2317
+ catch {
2318
+ return false;
2319
+ }
2320
+ }
2321
+ /**
2322
+ * Stop + disable project systemd unit so PM2 (or a new unit start) can bind the port.
2323
+ * Idempotent; safe when unit missing.
2324
+ */
2325
+ export async function stopAndDisableProjectUnit(host, unitName) {
2326
+ const notes = [];
2327
+ if (!host.executeEnabled() || !host.isRoot()) {
2328
+ notes.push(`skip stop/disable ${unitName} (need root+execute)`);
2329
+ return notes;
2330
+ }
2331
+ const stop = await host.runCommand(['systemctl', 'stop', unitName], { timeoutMs: 20_000 });
2332
+ notes.push(`systemctl stop ${unitName} exit=${stop.exitCode}`);
2333
+ const dis = await host.runCommand(['systemctl', 'disable', unitName], { timeoutMs: 15_000 });
2334
+ notes.push(`systemctl disable ${unitName} exit=${dis.exitCode}`);
2335
+ await host.runCommand(['systemctl', 'reset-failed', unitName], { timeoutMs: 10_000 });
2336
+ return notes;
2337
+ }
2338
+ /**
2339
+ * True if a project linux user (ysks_*) can exec this path.
2340
+ * Rejects root-private and per-user toolchains (hermes/nvm/cargo under /root).
2341
+ */
2342
+ export function isProjectUserExecutablePath(bin) {
2343
+ const p = String(bin || '').trim();
2344
+ if (!p)
2345
+ return false;
2346
+ // bare names resolve via unit PATH
2347
+ if (!p.startsWith('/'))
2348
+ return true;
2349
+ if (p.startsWith('/root/'))
2350
+ return false;
2351
+ if (p.includes('/.hermes/'))
2352
+ return false;
2353
+ // Private toolchains under a home dir are not shared with project users
2354
+ if (/\/\.(nvm|fnm|local\/share\/fnm|volta|cargo)\//.test(p))
2355
+ return false;
2356
+ if (/\/go\/bin\//.test(p) && (p.includes('/root/') || p.includes('/home/'))) {
2357
+ // allow only if under project home would need more context — block generic home go/bin
2358
+ if (!p.includes('/ysk-server') && !p.includes('/usr/local/ysk'))
2359
+ return false;
2360
+ }
2361
+ return true;
2362
+ }
2363
+ /** @deprecated use isProjectUserExecutablePath */
2364
+ export function isProjectUserExecutableNodePath(bin) {
2365
+ return isProjectUserExecutablePath(bin);
2366
+ }
2367
+ /**
2368
+ * Resolve Node binary for project deploy (systemd User=ysks_*).
2369
+ * Prefer /usr/local/ysk/node/<major>/bin/node (toolchain install layout).
2370
+ * Never put panel process.execPath under /root into systemd (203/EXEC).
2371
+ *
2372
+ * Degraded deploys (no root / no execute) may use panel nvm/hermes path because
2373
+ * the process runs as the panel user, not ysks_*.
2374
+ */
2375
+ export function resolveNodeBinary(version, host) {
2376
+ const notes = [];
2377
+ const plan = selectNodeRuntime(version || defaultRuntimeVersion('node'));
2378
+ const major = plan.version;
2379
+ const planned = plan.binaryPath;
2380
+ // Root+execute → unit runs as project user; private panel Node is forbidden
2381
+ const isolatedTarget = Boolean(host?.executeEnabled() && host?.isRoot());
2382
+ const candidates = [
2383
+ planned,
2384
+ `/usr/local/ysk/node/${major}/bin/node`,
2385
+ `/usr/bin/node${major}`,
2386
+ '/usr/local/bin/node',
2387
+ '/usr/bin/node',
2388
+ ];
2389
+ const exists = (p) => {
2390
+ if (host?.pathExists?.(p))
2391
+ return true;
2392
+ try {
2393
+ return existsSync(p);
2394
+ }
2395
+ catch {
2396
+ return false;
2397
+ }
2398
+ };
2399
+ for (const c of candidates) {
2400
+ if (!isProjectUserExecutablePath(c))
2401
+ continue;
2402
+ if (exists(c)) {
2403
+ // Prefer planned major path; only accept system node if major matches or ysk path missing
2404
+ if (c === planned || c.includes(`/ysk/node/${major}/`)) {
2405
+ if (c !== planned) {
2406
+ notes.push(tl('notes.deploy.usingFallback', { path: c, planned }));
2407
+ }
2408
+ return { path: c, notes };
2409
+ }
2410
+ // /usr/bin/node — only if no ysk major path; note version may skew
2411
+ if (c === '/usr/bin/node' || c === '/usr/local/bin/node' || c === `/usr/bin/node${major}`) {
2412
+ notes.push(tl('notes.deploy.usingFallback', { path: c, planned }));
2413
+ return { path: c, notes };
2414
+ }
2415
+ }
2416
+ }
2417
+ if (process.execPath && exists(process.execPath)) {
2418
+ if (isProjectUserExecutablePath(process.execPath)) {
2419
+ notes.push(tl('notes.deploy.usingPanelExec', { path: process.execPath }));
2420
+ return { path: process.execPath, notes };
2421
+ }
2422
+ if (!isolatedTarget) {
2423
+ // Dev / non-root panel: same-user pidfile can use nvm/hermes path
2424
+ notes.push(tl('notes.deploy.usingPanelDegraded', { path: process.execPath }));
2425
+ return { path: process.execPath, notes };
2426
+ }
2427
+ notes.push(tl('notes.deploy.skippedPanelNode', { path: process.execPath }));
2428
+ }
2429
+ notes.push(tl('notes.deploy.nodeNotFoundPlanned', { version: major, planned }));
2430
+ return { path: planned, notes };
2431
+ }
2432
+ /** String path helper for callers that only need the path. */
2433
+ export function resolveNodeBinaryPath(version, host) {
2434
+ return resolveNodeBinary(version, host).path;
2435
+ }
2436
+ function clipDeployNotes(notes) {
2437
+ return notes.filter(Boolean).slice(-8);
2438
+ }
2439
+ /**
2440
+ * Prefer Django wsgi, then FastAPI main:app, then app.py / main.py script.
2441
+ */
2442
+ export function detectPythonEntry(appDir) {
2443
+ // Django: */wsgi.py under first-level package
2444
+ try {
2445
+ for (const name of readdirSync(appDir)) {
2446
+ const sub = join(appDir, name);
2447
+ try {
2448
+ if (!statSync(sub).isDirectory())
2449
+ continue;
2450
+ }
2451
+ catch {
2452
+ continue;
2453
+ }
2454
+ if (existsSync(join(sub, 'wsgi.py')) && existsSync(join(sub, 'settings.py'))) {
2455
+ return `${name}.wsgi:application`;
2456
+ }
2457
+ }
2458
+ }
2459
+ catch {
2460
+ /* fall through */
2461
+ }
2462
+ if (existsSync(join(appDir, 'main.py')))
2463
+ return 'main:app';
2464
+ if (existsSync(join(appDir, 'app.py')))
2465
+ return 'app.py';
2466
+ return null;
2467
+ }
2468
+ /** Read [package] name from Cargo.toml for release binary path. */
2469
+ export function resolveCargoPackageName(appDir) {
2470
+ const p = join(appDir, 'Cargo.toml');
2471
+ if (!existsSync(p))
2472
+ return null;
2473
+ try {
2474
+ const text = readFileSync(p, 'utf8');
2475
+ const m = text.match(/^\s*name\s*=\s*"([^"]+)"/m);
2476
+ return m?.[1] ?? null;
2477
+ }
2478
+ catch {
2479
+ return null;
2480
+ }
2481
+ }
2482
+ async function resolvePhpBinary(host, version) {
2483
+ const { resolveBin } = await import('./software-probe/index.js');
2484
+ const candidates = [`php${version}`, `php${version.split('.')[0]}`, 'php'];
2485
+ for (const bin of candidates) {
2486
+ const p = await resolveBin(host, bin);
2487
+ if (p)
2488
+ return p;
2489
+ }
2490
+ return null;
2491
+ }
2492
+ export function isPidAlive(pid) {
2493
+ try {
2494
+ process.kill(pid, 0);
2495
+ return true;
2496
+ }
2497
+ catch {
2498
+ return false;
2499
+ }
2500
+ }
2501
+ async function waitUntilDead(pid, timeoutMs) {
2502
+ const start = Date.now();
2503
+ while (Date.now() - start < timeoutMs) {
2504
+ if (!isPidAlive(pid))
2505
+ return;
2506
+ await new Promise((r) => setTimeout(r, 100));
2507
+ }
2508
+ }
2509
+ //# sourceMappingURL=project-ops.js.map