jishushell 0.5.22 → 0.6.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3198) hide show
  1. package/apps/anythingllm-container.yaml +20 -177
  2. package/apps/browserless-chromium-container.yaml +17 -12
  3. package/apps/filebrowser-container.yaml +22 -9
  4. package/apps/hermes-container.yaml +23 -2
  5. package/apps/jishu-kb-container.yaml +152 -0
  6. package/apps/ollama-binary.yaml +32 -28
  7. package/apps/ollama-cpu-container.yaml +5 -0
  8. package/apps/ollama-with-hollama-binary.yaml +33 -28
  9. package/apps/openclaw-binary.yaml +34 -10
  10. package/apps/openclaw-container.yaml +33 -8
  11. package/apps/openclaw-with-ollama-container.yaml +8 -2
  12. package/apps/openclaw-with-searxng-container.yaml +18 -6
  13. package/apps/searxng-container.yaml +12 -7
  14. package/apps/weknora-container.yaml +29 -23
  15. package/dependencies/jishushell-panel-0.6.18.tgz +0 -0
  16. package/dist/cli/app.js +494 -192
  17. package/dist/cli/app.js.map +1 -1
  18. package/dist/cli/backup.js +112 -139
  19. package/dist/cli/backup.js.map +1 -1
  20. package/dist/cli/core.d.ts +30 -0
  21. package/dist/cli/core.js +1415 -0
  22. package/dist/cli/core.js.map +1 -0
  23. package/dist/cli/doctor.d.ts +1 -1
  24. package/dist/cli/doctor.js +50 -61
  25. package/dist/cli/doctor.js.map +1 -1
  26. package/dist/cli/job.js +62 -14
  27. package/dist/cli/job.js.map +1 -1
  28. package/dist/cli/llm.d.ts +1 -18
  29. package/dist/cli/llm.js +103 -83
  30. package/dist/cli/llm.js.map +1 -1
  31. package/dist/cli/managed-list.d.ts +1 -3
  32. package/dist/cli/managed-list.js +18 -16
  33. package/dist/cli/managed-list.js.map +1 -1
  34. package/dist/cli/migrate.d.ts +2 -0
  35. package/dist/cli/migrate.js +160 -0
  36. package/dist/cli/migrate.js.map +1 -0
  37. package/dist/cli.js +26 -2
  38. package/dist/cli.js.map +1 -1
  39. package/dist/config.d.ts +53 -44
  40. package/dist/config.js +216 -146
  41. package/dist/config.js.map +1 -1
  42. package/dist/constants.d.ts +0 -1
  43. package/dist/constants.js +0 -4
  44. package/dist/constants.js.map +1 -1
  45. package/dist/control.d.ts +7 -7
  46. package/dist/control.js +32 -24
  47. package/dist/control.js.map +1 -1
  48. package/dist/core.d.ts +5 -0
  49. package/dist/core.js +6 -0
  50. package/dist/core.js.map +1 -0
  51. package/dist/install.d.ts +3 -10
  52. package/dist/install.js +118 -43
  53. package/dist/install.js.map +1 -1
  54. package/dist/routes/apps.d.ts +1 -1
  55. package/dist/routes/apps.js +100 -234
  56. package/dist/routes/apps.js.map +1 -1
  57. package/dist/routes/auth.d.ts +1 -3
  58. package/dist/routes/auth.js +7 -14
  59. package/dist/routes/auth.js.map +1 -1
  60. package/dist/routes/backup.js +137 -334
  61. package/dist/routes/backup.js.map +1 -1
  62. package/dist/routes/external-mounts.d.ts +1 -1
  63. package/dist/routes/external-mounts.js +7 -7
  64. package/dist/routes/external-mounts.js.map +1 -1
  65. package/dist/routes/file-mounts.d.ts +4 -3
  66. package/dist/routes/file-mounts.js +51 -30
  67. package/dist/routes/file-mounts.js.map +1 -1
  68. package/dist/routes/files-organize.d.ts +2 -2
  69. package/dist/routes/files-organize.js +5 -5
  70. package/dist/routes/files-organize.js.map +1 -1
  71. package/dist/routes/files.d.ts +1 -1
  72. package/dist/routes/files.js +1 -1
  73. package/dist/routes/files.js.map +1 -1
  74. package/dist/routes/instances.d.ts +11 -4
  75. package/dist/routes/instances.js +482 -923
  76. package/dist/routes/instances.js.map +1 -1
  77. package/dist/routes/integration-apps.d.ts +14 -0
  78. package/dist/routes/integration-apps.js +81 -0
  79. package/dist/routes/integration-apps.js.map +1 -0
  80. package/dist/routes/integrations.d.ts +9 -0
  81. package/dist/routes/integrations.js +12 -0
  82. package/dist/routes/integrations.js.map +1 -0
  83. package/dist/routes/llm-proxy.d.ts +2 -0
  84. package/dist/routes/llm-proxy.js +294 -0
  85. package/dist/routes/llm-proxy.js.map +1 -0
  86. package/dist/routes/llm.d.ts +1 -1
  87. package/dist/routes/llm.js +25 -75
  88. package/dist/routes/llm.js.map +1 -1
  89. package/dist/routes/setup.js +93 -93
  90. package/dist/routes/setup.js.map +1 -1
  91. package/dist/routes/system.js +248 -54
  92. package/dist/routes/system.js.map +1 -1
  93. package/dist/routes/webdav.d.ts +1 -1
  94. package/dist/routes/webdav.js +2 -2
  95. package/dist/routes/webdav.js.map +1 -1
  96. package/dist/server.d.ts +2 -0
  97. package/dist/server.js +343 -312
  98. package/dist/server.js.map +1 -1
  99. package/dist/services/app-common/app-compiler.js +186 -0
  100. package/dist/services/app-common/app-compiler.js.map +1 -0
  101. package/dist/services/app-common/app-shared.d.ts +15 -0
  102. package/dist/services/app-common/app-shared.js +64 -0
  103. package/dist/services/app-common/app-shared.js.map +1 -0
  104. package/dist/services/app-common/capability-service.d.ts +45 -0
  105. package/dist/services/app-common/capability-service.js +331 -0
  106. package/dist/services/app-common/capability-service.js.map +1 -0
  107. package/dist/services/app-common/catalog-service.d.ts +59 -0
  108. package/dist/services/app-common/catalog-service.js +308 -0
  109. package/dist/services/app-common/catalog-service.js.map +1 -0
  110. package/dist/services/app-common/create-pipeline.d.ts +26 -0
  111. package/dist/services/app-common/create-pipeline.js +298 -0
  112. package/dist/services/app-common/create-pipeline.js.map +1 -0
  113. package/dist/services/app-common/delete-service.d.ts +5 -0
  114. package/dist/services/app-common/delete-service.js +104 -0
  115. package/dist/services/app-common/delete-service.js.map +1 -0
  116. package/dist/services/app-common/execution-owner.d.ts +23 -0
  117. package/dist/services/app-common/execution-owner.js +124 -0
  118. package/dist/services/app-common/execution-owner.js.map +1 -0
  119. package/dist/services/app-common/execution-service.d.ts +23 -0
  120. package/dist/services/app-common/execution-service.js +105 -0
  121. package/dist/services/app-common/execution-service.js.map +1 -0
  122. package/dist/services/app-common/id-normalizer.d.ts +31 -0
  123. package/dist/services/app-common/id-normalizer.js +83 -0
  124. package/dist/services/app-common/id-normalizer.js.map +1 -0
  125. package/dist/services/app-common/install-store.d.ts +34 -0
  126. package/dist/services/app-common/install-store.js +261 -0
  127. package/dist/services/app-common/install-store.js.map +1 -0
  128. package/dist/services/app-common/instance-store.d.ts +78 -0
  129. package/dist/services/app-common/instance-store.js +495 -0
  130. package/dist/services/app-common/instance-store.js.map +1 -0
  131. package/dist/services/app-common/integration-refs.d.ts +17 -0
  132. package/dist/services/app-common/integration-refs.js +47 -0
  133. package/dist/services/app-common/integration-refs.js.map +1 -0
  134. package/dist/services/app-common/lifecycle-pipeline.d.ts +62 -0
  135. package/dist/services/app-common/lifecycle-pipeline.js +317 -0
  136. package/dist/services/app-common/lifecycle-pipeline.js.map +1 -0
  137. package/dist/services/app-common/lifecycle-scripts.d.ts +38 -0
  138. package/dist/services/app-common/lifecycle-scripts.js +935 -0
  139. package/dist/services/app-common/lifecycle-scripts.js.map +1 -0
  140. package/dist/services/app-common/lifecycle-service.d.ts +68 -0
  141. package/dist/services/app-common/lifecycle-service.js +467 -0
  142. package/dist/services/app-common/lifecycle-service.js.map +1 -0
  143. package/dist/services/app-common/paths.d.ts +29 -0
  144. package/dist/services/app-common/paths.js +34 -0
  145. package/dist/services/app-common/paths.js.map +1 -0
  146. package/dist/services/app-common/platform-transform.d.ts +32 -0
  147. package/dist/services/app-common/platform-transform.js +65 -0
  148. package/dist/services/app-common/platform-transform.js.map +1 -0
  149. package/dist/services/app-common/provide-resolver.d.ts +29 -0
  150. package/dist/services/app-common/provide-resolver.js +129 -0
  151. package/dist/services/app-common/provide-resolver.js.map +1 -0
  152. package/dist/services/app-common/remote-spec.d.ts +14 -0
  153. package/dist/services/app-common/remote-spec.js +58 -0
  154. package/dist/services/app-common/remote-spec.js.map +1 -0
  155. package/dist/services/app-common/runtime-builder.d.ts +1 -0
  156. package/dist/services/app-common/runtime-builder.js +2 -0
  157. package/dist/services/app-common/runtime-builder.js.map +1 -0
  158. package/dist/services/app-common/runtime-facts.d.ts +19 -0
  159. package/dist/services/app-common/runtime-facts.js +126 -0
  160. package/dist/services/app-common/runtime-facts.js.map +1 -0
  161. package/dist/services/app-common/service.d.ts +9 -0
  162. package/dist/services/app-common/service.js +10 -0
  163. package/dist/services/app-common/service.js.map +1 -0
  164. package/dist/services/app-common/spec-materializer.d.ts +9 -0
  165. package/dist/services/app-common/spec-materializer.js +361 -0
  166. package/dist/services/app-common/spec-materializer.js.map +1 -0
  167. package/dist/services/app-common/status-refresh.d.ts +33 -0
  168. package/dist/services/app-common/status-refresh.js +759 -0
  169. package/dist/services/app-common/status-refresh.js.map +1 -0
  170. package/dist/services/app-common/task-service.d.ts +29 -0
  171. package/dist/services/app-common/task-service.js +93 -0
  172. package/dist/services/app-common/task-service.js.map +1 -0
  173. package/dist/services/app-common/terminal-session-manager.js +157 -0
  174. package/dist/services/app-common/terminal-session-manager.js.map +1 -0
  175. package/dist/services/app-modules/browserless/routes.d.ts +9 -0
  176. package/dist/services/app-modules/browserless/routes.js +517 -0
  177. package/dist/services/app-modules/browserless/routes.js.map +1 -0
  178. package/dist/services/app-modules/routes.d.ts +2 -0
  179. package/dist/services/app-modules/routes.js +5 -0
  180. package/dist/services/app-modules/routes.js.map +1 -0
  181. package/dist/services/backup/backup-admin.d.ts +95 -0
  182. package/dist/services/backup/backup-admin.js +246 -0
  183. package/dist/services/backup/backup-admin.js.map +1 -0
  184. package/dist/services/backup/backup-manager.d.ts +264 -0
  185. package/dist/services/backup/backup-manager.js +2318 -0
  186. package/dist/services/backup/backup-manager.js.map +1 -0
  187. package/dist/services/backup/backup-verify.js +240 -0
  188. package/dist/services/backup/backup-verify.js.map +1 -0
  189. package/dist/services/capabilities/browser-policy.d.ts +14 -0
  190. package/dist/services/capabilities/browser-policy.js +141 -0
  191. package/dist/services/capabilities/browser-policy.js.map +1 -0
  192. package/dist/services/capabilities/contract.d.ts +50 -0
  193. package/dist/services/capabilities/contract.js +129 -0
  194. package/dist/services/capabilities/contract.js.map +1 -0
  195. package/dist/services/capabilities/endpoint-validator.d.ts +42 -0
  196. package/dist/services/capabilities/endpoint-validator.js +114 -0
  197. package/dist/services/capabilities/endpoint-validator.js.map +1 -0
  198. package/dist/services/capabilities/health.d.ts +16 -0
  199. package/dist/services/capabilities/health.js +121 -0
  200. package/dist/services/capabilities/health.js.map +1 -0
  201. package/dist/services/capabilities/registry.d.ts +56 -0
  202. package/dist/services/capabilities/registry.js +222 -0
  203. package/dist/services/capabilities/registry.js.map +1 -0
  204. package/dist/services/capabilities/sync.d.ts +7 -0
  205. package/dist/services/capabilities/sync.js +223 -0
  206. package/dist/services/capabilities/sync.js.map +1 -0
  207. package/dist/services/capability-proxy/html-rewriters/browserless.d.ts +1 -0
  208. package/dist/services/capability-proxy/html-rewriters/browserless.js +83 -0
  209. package/dist/services/capability-proxy/html-rewriters/browserless.js.map +1 -0
  210. package/dist/services/capability-proxy/html-rewriters/index.d.ts +12 -0
  211. package/dist/services/capability-proxy/html-rewriters/index.js +25 -0
  212. package/dist/services/capability-proxy/html-rewriters/index.js.map +1 -0
  213. package/dist/services/capability-proxy/html-rewriters/jishukb.d.ts +1 -0
  214. package/dist/services/capability-proxy/html-rewriters/jishukb.js +161 -0
  215. package/dist/services/capability-proxy/html-rewriters/jishukb.js.map +1 -0
  216. package/dist/services/connections/admin.d.ts +80 -0
  217. package/dist/services/connections/admin.js +327 -0
  218. package/dist/services/connections/admin.js.map +1 -0
  219. package/dist/services/connections/apply.d.ts +110 -0
  220. package/dist/services/connections/apply.js +444 -0
  221. package/dist/services/connections/apply.js.map +1 -0
  222. package/dist/services/connections/resolver.d.ts +82 -0
  223. package/dist/services/connections/resolver.js +289 -0
  224. package/dist/services/connections/resolver.js.map +1 -0
  225. package/dist/services/connections/suggestions.d.ts +27 -0
  226. package/dist/services/connections/suggestions.js +124 -0
  227. package/dist/services/connections/suggestions.js.map +1 -0
  228. package/dist/services/connections/transactor.d.ts +39 -0
  229. package/dist/services/connections/transactor.js +307 -0
  230. package/dist/services/connections/transactor.js.map +1 -0
  231. package/dist/services/files/external-mounts.js +187 -0
  232. package/dist/services/files/external-mounts.js.map +1 -0
  233. package/dist/services/files/files-manager.d.ts +265 -0
  234. package/dist/services/files/files-manager.js +1189 -0
  235. package/dist/services/files/files-manager.js.map +1 -0
  236. package/dist/services/files/files-mounts.d.ts +42 -0
  237. package/dist/services/files/files-mounts.js +207 -0
  238. package/dist/services/files/files-mounts.js.map +1 -0
  239. package/dist/services/files/organize/applier.js +218 -0
  240. package/dist/services/files/organize/applier.js.map +1 -0
  241. package/dist/services/files/organize/rules.js +286 -0
  242. package/dist/services/files/organize/rules.js.map +1 -0
  243. package/dist/services/files/organize/scanner.js +366 -0
  244. package/dist/services/files/organize/scanner.js.map +1 -0
  245. package/dist/services/files/organize/store.js +82 -0
  246. package/dist/services/files/organize/store.js.map +1 -0
  247. package/dist/services/files/webdav/server.d.ts +47 -0
  248. package/dist/services/files/webdav/server.js +329 -0
  249. package/dist/services/files/webdav/server.js.map +1 -0
  250. package/dist/services/files/webdav/xml-builder.js.map +1 -0
  251. package/dist/services/instances/admin.d.ts +23 -0
  252. package/dist/services/instances/admin.js +218 -0
  253. package/dist/services/instances/admin.js.map +1 -0
  254. package/dist/services/instances/clone.d.ts +26 -0
  255. package/dist/services/instances/clone.js +78 -0
  256. package/dist/services/instances/clone.js.map +1 -0
  257. package/dist/services/instances/config-admin.d.ts +17 -0
  258. package/dist/services/instances/config-admin.js +181 -0
  259. package/dist/services/instances/config-admin.js.map +1 -0
  260. package/dist/services/instances/manager.d.ts +231 -0
  261. package/dist/services/instances/manager.js +1348 -0
  262. package/dist/services/instances/manager.js.map +1 -0
  263. package/dist/services/instances/passwords.js +173 -0
  264. package/dist/services/instances/passwords.js.map +1 -0
  265. package/dist/services/instances/types.d.ts +21 -0
  266. package/dist/services/instances/types.js +2 -0
  267. package/dist/services/instances/types.js.map +1 -0
  268. package/dist/services/integrations/anythingllm/integration.d.ts +25 -0
  269. package/dist/services/integrations/anythingllm/integration.js +251 -0
  270. package/dist/services/integrations/anythingllm/integration.js.map +1 -0
  271. package/dist/services/integrations/catalog.d.ts +3 -0
  272. package/dist/services/integrations/catalog.js +73 -0
  273. package/dist/services/integrations/catalog.js.map +1 -0
  274. package/dist/services/integrations/custom/integration.d.ts +28 -0
  275. package/dist/services/integrations/custom/integration.js +179 -0
  276. package/dist/services/integrations/custom/integration.js.map +1 -0
  277. package/dist/services/integrations/hermes/integration.d.ts +194 -0
  278. package/dist/services/integrations/hermes/integration.js +1669 -0
  279. package/dist/services/integrations/hermes/integration.js.map +1 -0
  280. package/dist/services/integrations/index.d.ts +40 -0
  281. package/dist/services/integrations/index.js +59 -0
  282. package/dist/services/integrations/index.js.map +1 -0
  283. package/dist/services/integrations/installable/catalog.d.ts +33 -0
  284. package/dist/services/integrations/installable/catalog.js +88 -0
  285. package/dist/services/integrations/installable/catalog.js.map +1 -0
  286. package/dist/services/integrations/installable/index.d.ts +35 -0
  287. package/dist/services/integrations/installable/index.js +170 -0
  288. package/dist/services/integrations/installable/index.js.map +1 -0
  289. package/dist/services/integrations/installable/installers/integration-probes.d.ts +50 -0
  290. package/dist/services/integrations/installable/installers/integration-probes.js +231 -0
  291. package/dist/services/integrations/installable/installers/integration-probes.js.map +1 -0
  292. package/dist/services/integrations/installable/installers/integration.d.ts +30 -0
  293. package/dist/services/integrations/installable/installers/integration.js +177 -0
  294. package/dist/services/integrations/installable/installers/integration.js.map +1 -0
  295. package/dist/services/integrations/installable/installers/registry-probe.js.map +1 -0
  296. package/dist/services/integrations/installable/installers/shell-script.d.ts +46 -0
  297. package/dist/services/integrations/installable/installers/shell-script.js +487 -0
  298. package/dist/services/integrations/installable/installers/shell-script.js.map +1 -0
  299. package/dist/services/integrations/installable/types.d.ts +130 -0
  300. package/dist/services/integrations/installable/types.js +19 -0
  301. package/dist/services/integrations/installable/types.js.map +1 -0
  302. package/dist/services/integrations/jishukb/integration.d.ts +22 -0
  303. package/dist/services/integrations/jishukb/integration.js +189 -0
  304. package/dist/services/integrations/jishukb/integration.js.map +1 -0
  305. package/dist/services/integrations/openclaw/anythingllm-shim.d.ts +46 -0
  306. package/dist/services/integrations/openclaw/anythingllm-shim.js +281 -0
  307. package/dist/services/integrations/openclaw/anythingllm-shim.js.map +1 -0
  308. package/dist/services/integrations/openclaw/drive-shim.d.ts +54 -0
  309. package/dist/services/integrations/openclaw/drive-shim.js +490 -0
  310. package/dist/services/integrations/openclaw/drive-shim.js.map +1 -0
  311. package/dist/services/integrations/openclaw/integration.d.ts +424 -0
  312. package/dist/services/integrations/openclaw/integration.js +4402 -0
  313. package/dist/services/integrations/openclaw/integration.js.map +1 -0
  314. package/dist/services/integrations/openclaw/jishukb-shim.d.ts +48 -0
  315. package/dist/services/integrations/openclaw/jishukb-shim.js +750 -0
  316. package/dist/services/integrations/openclaw/jishukb-shim.js.map +1 -0
  317. package/dist/services/integrations/openclaw/mcporter-lite.d.ts +24 -0
  318. package/dist/services/integrations/openclaw/mcporter-lite.js +276 -0
  319. package/dist/services/integrations/openclaw/mcporter-lite.js.map +1 -0
  320. package/dist/services/integrations/openclaw/mcporter.d.ts +46 -0
  321. package/dist/services/integrations/openclaw/mcporter.js +112 -0
  322. package/dist/services/integrations/openclaw/mcporter.js.map +1 -0
  323. package/dist/services/integrations/openclaw/routes.d.ts +21 -0
  324. package/dist/services/integrations/openclaw/routes.js +1191 -0
  325. package/dist/services/integrations/openclaw/routes.js.map +1 -0
  326. package/dist/services/integrations/registry.d.ts +17 -0
  327. package/dist/services/integrations/registry.js +36 -0
  328. package/dist/services/integrations/registry.js.map +1 -0
  329. package/dist/services/integrations/routes.d.ts +2 -0
  330. package/dist/services/integrations/routes.js +9 -0
  331. package/dist/services/integrations/routes.js.map +1 -0
  332. package/dist/services/integrations/types.d.ts +469 -0
  333. package/dist/services/integrations/types.js +2 -0
  334. package/dist/services/integrations/types.js.map +1 -0
  335. package/dist/services/legacy-migrator/classifier.d.ts +44 -0
  336. package/dist/services/legacy-migrator/classifier.js +309 -0
  337. package/dist/services/legacy-migrator/classifier.js.map +1 -0
  338. package/dist/services/legacy-migrator/executor.d.ts +42 -0
  339. package/dist/services/legacy-migrator/executor.js +637 -0
  340. package/dist/services/legacy-migrator/executor.js.map +1 -0
  341. package/dist/services/legacy-migrator/index.d.ts +31 -0
  342. package/dist/services/legacy-migrator/index.js +34 -0
  343. package/dist/services/legacy-migrator/index.js.map +1 -0
  344. package/dist/services/legacy-migrator/planner.d.ts +8 -0
  345. package/dist/services/legacy-migrator/planner.js +154 -0
  346. package/dist/services/legacy-migrator/planner.js.map +1 -0
  347. package/dist/services/legacy-migrator/provider-settings.d.ts +6 -0
  348. package/dist/services/legacy-migrator/provider-settings.js +72 -0
  349. package/dist/services/legacy-migrator/provider-settings.js.map +1 -0
  350. package/dist/services/legacy-migrator/report.d.ts +9 -0
  351. package/dist/services/legacy-migrator/report.js +99 -0
  352. package/dist/services/legacy-migrator/report.js.map +1 -0
  353. package/dist/services/legacy-migrator/scanner.d.ts +13 -0
  354. package/dist/services/legacy-migrator/scanner.js +157 -0
  355. package/dist/services/legacy-migrator/scanner.js.map +1 -0
  356. package/dist/services/legacy-migrator/types.d.ts +97 -0
  357. package/dist/services/legacy-migrator/types.js +23 -0
  358. package/dist/services/legacy-migrator/types.js.map +1 -0
  359. package/dist/services/llm-proxy/adapters.js +5 -4
  360. package/dist/services/llm-proxy/adapters.js.map +1 -1
  361. package/dist/services/llm-proxy/index.d.ts +8 -105
  362. package/dist/services/llm-proxy/index.js +12 -889
  363. package/dist/services/llm-proxy/index.js.map +1 -1
  364. package/dist/services/llm-proxy/instance-proxy.d.ts +61 -0
  365. package/dist/services/llm-proxy/instance-proxy.js +702 -0
  366. package/dist/services/llm-proxy/instance-proxy.js.map +1 -0
  367. package/dist/services/llm-proxy/probe.js +5 -14
  368. package/dist/services/llm-proxy/probe.js.map +1 -1
  369. package/dist/services/llm-proxy/providers.d.ts +21 -0
  370. package/dist/services/llm-proxy/providers.js +88 -0
  371. package/dist/services/llm-proxy/providers.js.map +1 -0
  372. package/dist/services/llm-proxy/proxy-runtime.d.ts +12 -0
  373. package/dist/services/llm-proxy/proxy-runtime.js +65 -0
  374. package/dist/services/llm-proxy/proxy-runtime.js.map +1 -0
  375. package/dist/services/llm-proxy/sse.d.ts +13 -3
  376. package/dist/services/llm-proxy/sse.js.map +1 -1
  377. package/dist/services/llm-proxy/ssrf.d.ts +11 -4
  378. package/dist/services/llm-proxy/ssrf.js +45 -7
  379. package/dist/services/llm-proxy/ssrf.js.map +1 -1
  380. package/dist/services/llm-proxy/validate-key.js +27 -51
  381. package/dist/services/llm-proxy/validate-key.js.map +1 -1
  382. package/dist/services/repair/runtime-repair.d.ts +22 -0
  383. package/dist/services/repair/runtime-repair.js +307 -0
  384. package/dist/services/repair/runtime-repair.js.map +1 -0
  385. package/dist/services/runtime/driver-registry.d.ts +21 -0
  386. package/dist/services/runtime/driver-registry.js +22 -0
  387. package/dist/services/runtime/driver-registry.js.map +1 -0
  388. package/dist/services/runtime/drivers/nomad.d.ts +260 -0
  389. package/dist/services/runtime/drivers/nomad.js +3092 -0
  390. package/dist/services/runtime/drivers/nomad.js.map +1 -0
  391. package/dist/services/runtime/errors.d.ts +3 -3
  392. package/dist/services/runtime/errors.js +3 -3
  393. package/dist/services/runtime/instance.d.ts +14 -16
  394. package/dist/services/runtime/instance.js +93 -110
  395. package/dist/services/runtime/instance.js.map +1 -1
  396. package/dist/services/runtime/job-id.d.ts +9 -0
  397. package/dist/services/runtime/job-id.js +15 -0
  398. package/dist/services/runtime/job-id.js.map +1 -0
  399. package/dist/services/runtime/mcp-shims/firewall.d.ts +2 -2
  400. package/dist/services/runtime/mcp-shims/firewall.js +2 -2
  401. package/dist/services/runtime/mcp-shims/searxng-shim.d.ts +3 -5
  402. package/dist/services/runtime/mcp-shims/searxng-shim.js +3 -5
  403. package/dist/services/runtime/mcp-shims/searxng-shim.js.map +1 -1
  404. package/dist/services/runtime/mcp-shims/write-mcp-entry.d.ts +20 -20
  405. package/dist/services/runtime/mcp-shims/write-mcp-entry.js +16 -16
  406. package/dist/services/runtime/mcp-shims/write-mcp-entry.js.map +1 -1
  407. package/dist/services/runtime/ownership-marker.d.ts +83 -0
  408. package/dist/services/runtime/ownership-marker.js +109 -0
  409. package/dist/services/runtime/ownership-marker.js.map +1 -0
  410. package/dist/services/runtime/types.d.ts +23 -511
  411. package/dist/services/runtime/types.js +0 -12
  412. package/dist/services/runtime/types.js.map +1 -1
  413. package/dist/services/runtime/workload-compiler.d.ts +17 -0
  414. package/dist/services/runtime/workload-compiler.js +525 -0
  415. package/dist/services/runtime/workload-compiler.js.map +1 -0
  416. package/dist/services/runtime/workload-types.d.ts +11 -0
  417. package/dist/services/runtime/workload-types.js +2 -0
  418. package/dist/services/runtime/workload-types.js.map +1 -0
  419. package/dist/services/setup/core-manager.d.ts +50 -0
  420. package/dist/services/setup/core-manager.js +456 -0
  421. package/dist/services/setup/core-manager.js.map +1 -0
  422. package/dist/services/setup/plugin-installer.js +136 -0
  423. package/dist/services/setup/plugin-installer.js.map +1 -0
  424. package/dist/services/setup/setup-manager.d.ts +158 -0
  425. package/dist/services/setup/setup-manager.js +2768 -0
  426. package/dist/services/setup/setup-manager.js.map +1 -0
  427. package/dist/services/system/cli-command.d.ts +5 -0
  428. package/dist/services/system/cli-command.js +18 -0
  429. package/dist/services/system/cli-command.js.map +1 -0
  430. package/dist/services/system/macos-launchd.d.ts +100 -0
  431. package/dist/services/system/macos-launchd.js +312 -0
  432. package/dist/services/system/macos-launchd.js.map +1 -0
  433. package/dist/services/system/repair-orchestrator.d.ts +71 -0
  434. package/dist/services/system/repair-orchestrator.js +412 -0
  435. package/dist/services/system/repair-orchestrator.js.map +1 -0
  436. package/dist/services/system/system-monitor.js +96 -0
  437. package/dist/services/system/system-monitor.js.map +1 -0
  438. package/dist/services/system/system-ollama-provider.d.ts +14 -0
  439. package/dist/services/system/system-ollama-provider.js +129 -0
  440. package/dist/services/system/system-ollama-provider.js.map +1 -0
  441. package/dist/services/system/system-reconciler.d.ts +59 -0
  442. package/dist/services/system/system-reconciler.js +710 -0
  443. package/dist/services/system/system-reconciler.js.map +1 -0
  444. package/dist/services/system/update-manager.d.ts +43 -0
  445. package/dist/services/system/update-manager.js +315 -0
  446. package/dist/services/system/update-manager.js.map +1 -0
  447. package/dist/services/system/upgrade-finalize.d.ts +80 -0
  448. package/dist/services/system/upgrade-finalize.js +507 -0
  449. package/dist/services/system/upgrade-finalize.js.map +1 -0
  450. package/dist/services/tasks/registry.d.ts +44 -0
  451. package/dist/services/tasks/registry.js +90 -0
  452. package/dist/services/tasks/registry.js.map +1 -0
  453. package/dist/services/telemetry/activation.d.ts +8 -4
  454. package/dist/services/telemetry/activation.js +12 -8
  455. package/dist/services/telemetry/activation.js.map +1 -1
  456. package/dist/services/telemetry/device-fingerprint.js +6 -1
  457. package/dist/services/telemetry/device-fingerprint.js.map +1 -1
  458. package/dist/services/telemetry/heartbeat.d.ts +8 -4
  459. package/dist/services/telemetry/heartbeat.js +12 -8
  460. package/dist/services/telemetry/heartbeat.js.map +1 -1
  461. package/dist/services/workspaces/builder.d.ts +29 -0
  462. package/dist/services/workspaces/builder.js +186 -0
  463. package/dist/services/workspaces/builder.js.map +1 -0
  464. package/dist/types.d.ts +361 -72
  465. package/dist/utils/docker-inspect.d.ts +19 -0
  466. package/dist/utils/docker-inspect.js +74 -0
  467. package/dist/utils/docker-inspect.js.map +1 -0
  468. package/dist/utils/instance-lock.d.ts +2 -2
  469. package/dist/utils/instance-lock.js +2 -2
  470. package/dist/utils/sudo-askpass.d.ts +23 -0
  471. package/dist/utils/sudo-askpass.js +83 -0
  472. package/dist/utils/sudo-askpass.js.map +1 -0
  473. package/install/jishu-install.sh +627 -109
  474. package/install/jishu-uninstall.sh +48 -12
  475. package/install/post-install.sh +316 -93
  476. package/install/post-uninstall.sh +99 -9
  477. package/node_modules/@fastify/accept-negotiator/LICENSE +22 -0
  478. package/node_modules/@fastify/accept-negotiator/README.md +52 -0
  479. package/node_modules/@fastify/accept-negotiator/index.js +170 -0
  480. package/node_modules/@fastify/accept-negotiator/package.json +77 -0
  481. package/node_modules/@fastify/accept-negotiator/types/index.d.ts +17 -0
  482. package/node_modules/@fastify/ajv-compiler/.gitattributes +2 -0
  483. package/node_modules/@fastify/ajv-compiler/.github/.stale.yml +21 -0
  484. package/node_modules/@fastify/ajv-compiler/.github/dependabot.yml +13 -0
  485. package/node_modules/@fastify/ajv-compiler/.github/tests_checker.yml +8 -0
  486. package/node_modules/@fastify/ajv-compiler/.github/workflows/ci.yml +33 -0
  487. package/node_modules/@fastify/ajv-compiler/LICENSE +23 -0
  488. package/node_modules/@fastify/ajv-compiler/README.md +237 -0
  489. package/node_modules/@fastify/ajv-compiler/benchmark/small-object.mjs +37 -0
  490. package/node_modules/@fastify/ajv-compiler/eslint.config.js +6 -0
  491. package/node_modules/@fastify/ajv-compiler/index.js +53 -0
  492. package/node_modules/@fastify/ajv-compiler/lib/default-ajv-options.js +14 -0
  493. package/node_modules/@fastify/ajv-compiler/lib/serializer-compiler.js +27 -0
  494. package/node_modules/@fastify/ajv-compiler/lib/validator-compiler.js +58 -0
  495. package/node_modules/@fastify/ajv-compiler/package.json +84 -0
  496. package/node_modules/@fastify/ajv-compiler/standalone.js +44 -0
  497. package/node_modules/@fastify/ajv-compiler/test/.gitkeep +0 -0
  498. package/node_modules/@fastify/ajv-compiler/test/duplicated-id-compile.test.js +55 -0
  499. package/node_modules/@fastify/ajv-compiler/test/index.test.js +307 -0
  500. package/node_modules/@fastify/ajv-compiler/test/plugins.test.js +246 -0
  501. package/node_modules/@fastify/ajv-compiler/test/serialization.test.js +279 -0
  502. package/node_modules/@fastify/ajv-compiler/test/standalone.test.js +203 -0
  503. package/node_modules/@fastify/ajv-compiler/types/index.d.ts +87 -0
  504. package/node_modules/@fastify/ajv-compiler/types/index.test-d.ts +302 -0
  505. package/node_modules/@fastify/error/.gitattributes +2 -0
  506. package/node_modules/@fastify/error/.github/dependabot.yml +13 -0
  507. package/node_modules/@fastify/error/.github/workflows/ci.yml +28 -0
  508. package/node_modules/@fastify/error/LICENSE +21 -0
  509. package/node_modules/@fastify/error/README.md +140 -0
  510. package/node_modules/@fastify/error/benchmarks/create.js +9 -0
  511. package/node_modules/@fastify/error/benchmarks/instantiate.js +18 -0
  512. package/node_modules/@fastify/error/benchmarks/no-stack.js +13 -0
  513. package/node_modules/@fastify/error/benchmarks/toString.js +11 -0
  514. package/node_modules/@fastify/error/eslint.config.js +6 -0
  515. package/node_modules/@fastify/error/index.js +100 -0
  516. package/node_modules/@fastify/error/package.json +75 -0
  517. package/node_modules/@fastify/error/test/index.test.js +232 -0
  518. package/node_modules/@fastify/error/test/instanceof.test.js +263 -0
  519. package/node_modules/@fastify/error/types/index.d.ts +49 -0
  520. package/node_modules/@fastify/error/types/index.test-d.ts +92 -0
  521. package/node_modules/@fastify/fast-json-stringify-compiler/.eslintrc +1 -0
  522. package/node_modules/@fastify/fast-json-stringify-compiler/.gitattributes +2 -0
  523. package/node_modules/@fastify/fast-json-stringify-compiler/.github/dependabot.yml +13 -0
  524. package/node_modules/@fastify/fast-json-stringify-compiler/.github/workflows/ci.yml +28 -0
  525. package/node_modules/@fastify/fast-json-stringify-compiler/LICENSE +21 -0
  526. package/node_modules/@fastify/fast-json-stringify-compiler/README.md +128 -0
  527. package/node_modules/@fastify/fast-json-stringify-compiler/eslint.config.js +6 -0
  528. package/node_modules/@fastify/fast-json-stringify-compiler/index.js +8 -0
  529. package/node_modules/@fastify/fast-json-stringify-compiler/package.json +71 -0
  530. package/node_modules/@fastify/fast-json-stringify-compiler/standalone.js +58 -0
  531. package/node_modules/@fastify/fast-json-stringify-compiler/test/duplicate-schema.test.js +26 -0
  532. package/node_modules/@fastify/fast-json-stringify-compiler/test/plugin.test.js +78 -0
  533. package/node_modules/@fastify/fast-json-stringify-compiler/test/standalone.test.js +230 -0
  534. package/node_modules/@fastify/fast-json-stringify-compiler/types/index.d.ts +41 -0
  535. package/node_modules/@fastify/fast-json-stringify-compiler/types/index.test-d.ts +142 -0
  536. package/node_modules/@fastify/forwarded/LICENSE +24 -0
  537. package/node_modules/@fastify/forwarded/README.md +43 -0
  538. package/node_modules/@fastify/forwarded/index.js +59 -0
  539. package/node_modules/@fastify/forwarded/package.json +74 -0
  540. package/node_modules/@fastify/forwarded/types/index.d.ts +14 -0
  541. package/node_modules/@fastify/merge-json-schemas/.gitattributes +2 -0
  542. package/node_modules/@fastify/merge-json-schemas/.github/dependabot.yml +13 -0
  543. package/node_modules/@fastify/merge-json-schemas/.github/workflows/ci.yml +23 -0
  544. package/node_modules/@fastify/merge-json-schemas/LICENSE +21 -0
  545. package/node_modules/@fastify/merge-json-schemas/README.md +119 -0
  546. package/node_modules/@fastify/merge-json-schemas/eslint.config.js +6 -0
  547. package/node_modules/@fastify/merge-json-schemas/index.js +357 -0
  548. package/node_modules/@fastify/merge-json-schemas/lib/errors.js +36 -0
  549. package/node_modules/@fastify/merge-json-schemas/lib/resolvers.js +127 -0
  550. package/node_modules/@fastify/merge-json-schemas/package.json +67 -0
  551. package/node_modules/@fastify/merge-json-schemas/test/additional-items.test.js +164 -0
  552. package/node_modules/@fastify/merge-json-schemas/test/additional-properties.test.js +129 -0
  553. package/node_modules/@fastify/merge-json-schemas/test/all-of.test.js +43 -0
  554. package/node_modules/@fastify/merge-json-schemas/test/any-of.test.js +81 -0
  555. package/node_modules/@fastify/merge-json-schemas/test/const.test.js +58 -0
  556. package/node_modules/@fastify/merge-json-schemas/test/contains.test.js +55 -0
  557. package/node_modules/@fastify/merge-json-schemas/test/custom-resolvers.test.js +50 -0
  558. package/node_modules/@fastify/merge-json-schemas/test/default-resolver.test.js +111 -0
  559. package/node_modules/@fastify/merge-json-schemas/test/default.test.js +50 -0
  560. package/node_modules/@fastify/merge-json-schemas/test/definitions.test.js +46 -0
  561. package/node_modules/@fastify/merge-json-schemas/test/defs.test.js +46 -0
  562. package/node_modules/@fastify/merge-json-schemas/test/dependencies.test.js +75 -0
  563. package/node_modules/@fastify/merge-json-schemas/test/dependent-required.test.js +75 -0
  564. package/node_modules/@fastify/merge-json-schemas/test/dependent-schemas.test.js +76 -0
  565. package/node_modules/@fastify/merge-json-schemas/test/enum.test.js +44 -0
  566. package/node_modules/@fastify/merge-json-schemas/test/exclusive-maximum.test.js +30 -0
  567. package/node_modules/@fastify/merge-json-schemas/test/exclusive-minimum.test.js +30 -0
  568. package/node_modules/@fastify/merge-json-schemas/test/format.test.js +36 -0
  569. package/node_modules/@fastify/merge-json-schemas/test/id.test.js +22 -0
  570. package/node_modules/@fastify/merge-json-schemas/test/if-then-else.test.js +550 -0
  571. package/node_modules/@fastify/merge-json-schemas/test/items.test.js +152 -0
  572. package/node_modules/@fastify/merge-json-schemas/test/max-items.test.js +30 -0
  573. package/node_modules/@fastify/merge-json-schemas/test/max-length.test.js +30 -0
  574. package/node_modules/@fastify/merge-json-schemas/test/max-properties.test.js +30 -0
  575. package/node_modules/@fastify/merge-json-schemas/test/maximum.test.js +30 -0
  576. package/node_modules/@fastify/merge-json-schemas/test/merge-schema.test.js +29 -0
  577. package/node_modules/@fastify/merge-json-schemas/test/min-items.test.js +30 -0
  578. package/node_modules/@fastify/merge-json-schemas/test/min-length.test.js +30 -0
  579. package/node_modules/@fastify/merge-json-schemas/test/min-properties.test.js +30 -0
  580. package/node_modules/@fastify/merge-json-schemas/test/minimum.test.js +30 -0
  581. package/node_modules/@fastify/merge-json-schemas/test/multiple-of.test.js +36 -0
  582. package/node_modules/@fastify/merge-json-schemas/test/not.test.js +29 -0
  583. package/node_modules/@fastify/merge-json-schemas/test/nullable.test.js +30 -0
  584. package/node_modules/@fastify/merge-json-schemas/test/one-of.test.js +144 -0
  585. package/node_modules/@fastify/merge-json-schemas/test/properties.test.js +312 -0
  586. package/node_modules/@fastify/merge-json-schemas/test/property-names.test.js +49 -0
  587. package/node_modules/@fastify/merge-json-schemas/test/required.test.js +30 -0
  588. package/node_modules/@fastify/merge-json-schemas/test/type.test.js +52 -0
  589. package/node_modules/@fastify/merge-json-schemas/test/unique-items.test.js +38 -0
  590. package/node_modules/@fastify/merge-json-schemas/test/utils.js +9 -0
  591. package/node_modules/@fastify/merge-json-schemas/types/index.d.ts +61 -0
  592. package/node_modules/@fastify/merge-json-schemas/types/index.test-d.ts +52 -0
  593. package/node_modules/@fastify/proxy-addr/.gitattributes +2 -0
  594. package/node_modules/@fastify/proxy-addr/.github/dependabot.yml +13 -0
  595. package/node_modules/@fastify/proxy-addr/.github/stale.yml +21 -0
  596. package/node_modules/@fastify/proxy-addr/.github/workflows/ci.yml +28 -0
  597. package/node_modules/@fastify/proxy-addr/LICENSE +24 -0
  598. package/node_modules/@fastify/proxy-addr/README.md +141 -0
  599. package/node_modules/@fastify/proxy-addr/benchmark/compiling.js +50 -0
  600. package/node_modules/@fastify/proxy-addr/benchmark/index.js +30 -0
  601. package/node_modules/@fastify/proxy-addr/benchmark/kind.js +57 -0
  602. package/node_modules/@fastify/proxy-addr/benchmark/matching.js +78 -0
  603. package/node_modules/@fastify/proxy-addr/eslint.config.js +6 -0
  604. package/node_modules/@fastify/proxy-addr/index.js +331 -0
  605. package/node_modules/@fastify/proxy-addr/package.json +73 -0
  606. package/node_modules/@fastify/proxy-addr/test/all.test.js +55 -0
  607. package/node_modules/@fastify/proxy-addr/test/base.test.js +365 -0
  608. package/node_modules/@fastify/proxy-addr/test/compile.test.js +58 -0
  609. package/node_modules/@fastify/proxy-addr/types/index.d.ts +18 -0
  610. package/node_modules/@fastify/proxy-addr/types/index.test-d.ts +27 -0
  611. package/node_modules/@fastify/send/.gitattributes +2 -0
  612. package/node_modules/@fastify/send/.github/dependabot.yml +13 -0
  613. package/node_modules/@fastify/send/.github/workflows/ci.yml +28 -0
  614. package/node_modules/@fastify/send/HISTORY.md +521 -0
  615. package/node_modules/@fastify/send/LICENSE +23 -0
  616. package/node_modules/@fastify/send/README.md +310 -0
  617. package/node_modules/@fastify/send/benchmarks/collapseLeadingSlashes.js +13 -0
  618. package/node_modules/@fastify/send/benchmarks/containsDotFile.js +15 -0
  619. package/node_modules/@fastify/send/benchmarks/isUtf8MimeType.js +23 -0
  620. package/node_modules/@fastify/send/benchmarks/normalizeList.js +14 -0
  621. package/node_modules/@fastify/send/benchmarks/parseBytesRange.js +15 -0
  622. package/node_modules/@fastify/send/eslint.config.js +6 -0
  623. package/node_modules/@fastify/send/examples/index.html +1 -0
  624. package/node_modules/@fastify/send/examples/simple.js +15 -0
  625. package/node_modules/@fastify/send/index.js +28 -0
  626. package/node_modules/@fastify/send/lib/collapseLeadingSlashes.js +25 -0
  627. package/node_modules/@fastify/send/lib/containsDotFile.js +23 -0
  628. package/node_modules/@fastify/send/lib/contentRange.js +18 -0
  629. package/node_modules/@fastify/send/lib/createHtmlDocument.js +29 -0
  630. package/node_modules/@fastify/send/lib/createHttpError.js +23 -0
  631. package/node_modules/@fastify/send/lib/isUtf8MimeType.js +12 -0
  632. package/node_modules/@fastify/send/lib/normalizeList.js +28 -0
  633. package/node_modules/@fastify/send/lib/parseBytesRange.js +133 -0
  634. package/node_modules/@fastify/send/lib/parseTokenList.js +46 -0
  635. package/node_modules/@fastify/send/lib/send.js +729 -0
  636. package/node_modules/@fastify/send/package.json +81 -0
  637. package/node_modules/@fastify/send/test/collapseLeadingSlashes.test.js +22 -0
  638. package/node_modules/@fastify/send/test/containsDotFile.test.js +18 -0
  639. package/node_modules/@fastify/send/test/fixtures/.hidden.txt +1 -0
  640. package/node_modules/@fastify/send/test/fixtures/.mine/.hidden.txt +1 -0
  641. package/node_modules/@fastify/send/test/fixtures/.mine/name.txt +1 -0
  642. package/node_modules/@fastify/send/test/fixtures/do..ts.txt +1 -0
  643. package/node_modules/@fastify/send/test/fixtures/empty.txt +0 -0
  644. package/node_modules/@fastify/send/test/fixtures/images/node-js.png +0 -0
  645. package/node_modules/@fastify/send/test/fixtures/name.d/name.txt +1 -0
  646. package/node_modules/@fastify/send/test/fixtures/name.dir/name.txt +1 -0
  647. package/node_modules/@fastify/send/test/fixtures/name.html +1 -0
  648. package/node_modules/@fastify/send/test/fixtures/name.txt +1 -0
  649. package/node_modules/@fastify/send/test/fixtures/no_ext +1 -0
  650. package/node_modules/@fastify/send/test/fixtures/nums.txt +1 -0
  651. package/node_modules/@fastify/send/test/fixtures/pets/.hidden.txt +1 -0
  652. package/node_modules/@fastify/send/test/fixtures/pets/index.html +3 -0
  653. package/node_modules/@fastify/send/test/fixtures/snow /342/230/203/index.html +0 -0
  654. package/node_modules/@fastify/send/test/fixtures/some thing.txt +1 -0
  655. package/node_modules/@fastify/send/test/fixtures/thing.html.html +1 -0
  656. package/node_modules/@fastify/send/test/fixtures/tobi.html +1 -0
  657. package/node_modules/@fastify/send/test/isUtf8MimeType.test.js +22 -0
  658. package/node_modules/@fastify/send/test/mime.test.js +56 -0
  659. package/node_modules/@fastify/send/test/normalizeList.test.js +28 -0
  660. package/node_modules/@fastify/send/test/parseBytesRange.test.js +103 -0
  661. package/node_modules/@fastify/send/test/send.1.test.js +646 -0
  662. package/node_modules/@fastify/send/test/send.2.test.js +977 -0
  663. package/node_modules/@fastify/send/test/send.3.test.js +133 -0
  664. package/node_modules/@fastify/send/test/utils.js +36 -0
  665. package/node_modules/@fastify/send/types/index.d.ts +167 -0
  666. package/node_modules/@fastify/send/types/index.test-d.ts +67 -0
  667. package/node_modules/@fastify/static/.gitattributes +5 -0
  668. package/node_modules/@fastify/static/.github/dependabot.yml +13 -0
  669. package/node_modules/@fastify/static/.github/workflows/ci.yml +33 -0
  670. package/node_modules/@fastify/static/.github/workflows/lock-threads.yml +19 -0
  671. package/node_modules/@fastify/static/LICENSE +21 -0
  672. package/node_modules/@fastify/static/README.md +538 -0
  673. package/node_modules/@fastify/static/eslint.config.js +7 -0
  674. package/node_modules/@fastify/static/example/public/.hidden/sample.json +1 -0
  675. package/node_modules/@fastify/static/example/public/images/sample.jpg +0 -0
  676. package/node_modules/@fastify/static/example/public/index.css +9 -0
  677. package/node_modules/@fastify/static/example/public/index.html +11 -0
  678. package/node_modules/@fastify/static/example/public/index.js +8 -0
  679. package/node_modules/@fastify/static/example/public2/test.css +4 -0
  680. package/node_modules/@fastify/static/example/public2/test.html +8 -0
  681. package/node_modules/@fastify/static/example/server-benchmark.js +39 -0
  682. package/node_modules/@fastify/static/example/server-compress.js +15 -0
  683. package/node_modules/@fastify/static/example/server-dir-list.js +38 -0
  684. package/node_modules/@fastify/static/example/server-hidden-file.js +15 -0
  685. package/node_modules/@fastify/static/example/server.js +13 -0
  686. package/node_modules/@fastify/static/index.js +726 -0
  687. package/node_modules/@fastify/static/lib/dirList.js +225 -0
  688. package/node_modules/@fastify/static/package.json +89 -0
  689. package/node_modules/@fastify/static/test/content-type/binary +0 -0
  690. package/node_modules/@fastify/static/test/content-type/binary.br +1 -0
  691. package/node_modules/@fastify/static/test/content-type/index.css +0 -0
  692. package/node_modules/@fastify/static/test/content-type/index.css.br +1 -0
  693. package/node_modules/@fastify/static/test/content-type/index.html +5 -0
  694. package/node_modules/@fastify/static/test/content-type/index.html.br +0 -0
  695. package/node_modules/@fastify/static/test/content-type/sample.jpg +0 -0
  696. package/node_modules/@fastify/static/test/content-type/test.txt +0 -0
  697. package/node_modules/@fastify/static/test/content-type/test.txt.br +1 -0
  698. package/node_modules/@fastify/static/test/content-type.test.js +144 -0
  699. package/node_modules/@fastify/static/test/dir-list.test.js +820 -0
  700. package/node_modules/@fastify/static/test/static/.example +1 -0
  701. package/node_modules/@fastify/static/test/static/100%.txt +1 -0
  702. package/node_modules/@fastify/static/test/static/a .md +1 -0
  703. package/node_modules/@fastify/static/test/static/deep/path/for/test/index.html +5 -0
  704. package/node_modules/@fastify/static/test/static/deep/path/for/test/purpose/foo.html +5 -0
  705. package/node_modules/@fastify/static/test/static/foo.html +3 -0
  706. package/node_modules/@fastify/static/test/static/foobar.html +3 -0
  707. package/node_modules/@fastify/static/test/static/index.css +0 -0
  708. package/node_modules/@fastify/static/test/static/index.html +5 -0
  709. package/node_modules/@fastify/static/test/static/shallow/sample.jpg +0 -0
  710. package/node_modules/@fastify/static/test/static-dotfiles/.aaa +0 -0
  711. package/node_modules/@fastify/static/test/static-dotfiles/dir/index.html +0 -0
  712. package/node_modules/@fastify/static/test/static-dotfiles/test.txt +0 -0
  713. package/node_modules/@fastify/static/test/static-encode/[...]/a .md +1 -0
  714. package/node_modules/@fastify/static/test/static-filtered/bar.private +1 -0
  715. package/node_modules/@fastify/static/test/static-filtered/deep/path/to/baz.html +3 -0
  716. package/node_modules/@fastify/static/test/static-filtered/deep/path/to/baz.private +1 -0
  717. package/node_modules/@fastify/static/test/static-filtered/index.html +3 -0
  718. package/node_modules/@fastify/static/test/static-hidden/.hidden/sample.json +1 -0
  719. package/node_modules/@fastify/static/test/static-pre-compressed/all-three.html +5 -0
  720. package/node_modules/@fastify/static/test/static-pre-compressed/all-three.html.br +0 -0
  721. package/node_modules/@fastify/static/test/static-pre-compressed/all-three.html.gz +0 -0
  722. package/node_modules/@fastify/static/test/static-pre-compressed/baz.json +3 -0
  723. package/node_modules/@fastify/static/test/static-pre-compressed/dir/index.html +5 -0
  724. package/node_modules/@fastify/static/test/static-pre-compressed/dir/index.html.br +0 -0
  725. package/node_modules/@fastify/static/test/static-pre-compressed/dir-gz/index.html +5 -0
  726. package/node_modules/@fastify/static/test/static-pre-compressed/dir-gz/index.html.gz +0 -0
  727. package/node_modules/@fastify/static/test/static-pre-compressed/empty/.gitkeep +0 -0
  728. package/node_modules/@fastify/static/test/static-pre-compressed/gzip-only.html +3 -0
  729. package/node_modules/@fastify/static/test/static-pre-compressed/gzip-only.html.gz +0 -0
  730. package/node_modules/@fastify/static/test/static-pre-compressed/index.html +5 -0
  731. package/node_modules/@fastify/static/test/static-pre-compressed/index.html.br +0 -0
  732. package/node_modules/@fastify/static/test/static-pre-compressed/sample.jpg +0 -0
  733. package/node_modules/@fastify/static/test/static-pre-compressed/sample.jpg.br +0 -0
  734. package/node_modules/@fastify/static/test/static-pre-compressed/uncompressed.html +3 -0
  735. package/node_modules/@fastify/static/test/static-symbolic-link/origin/subdir/subdir/index.html +3 -0
  736. package/node_modules/@fastify/static/test/static.test.js +4115 -0
  737. package/node_modules/@fastify/static/test/static2/bar.html +3 -0
  738. package/node_modules/@fastify/static/test/static2/index.html +3 -0
  739. package/node_modules/@fastify/static/types/index.d.ts +136 -0
  740. package/node_modules/@fastify/static/types/index.test-d.ts +240 -0
  741. package/node_modules/@lukeed/ms/dist/index.js +37 -0
  742. package/node_modules/@lukeed/ms/dist/index.min.js +1 -0
  743. package/node_modules/@lukeed/ms/dist/index.mjs +34 -0
  744. package/node_modules/@lukeed/ms/index.d.ts +2 -0
  745. package/node_modules/@lukeed/ms/license +9 -0
  746. package/node_modules/@lukeed/ms/package.json +48 -0
  747. package/node_modules/@lukeed/ms/readme.md +133 -0
  748. package/node_modules/@pinojs/redact/.github/dependabot.yml +13 -0
  749. package/node_modules/@pinojs/redact/.github/workflows/ci.yml +48 -0
  750. package/node_modules/@pinojs/redact/.github/workflows/publish-release.yml +43 -0
  751. package/node_modules/@pinojs/redact/LICENSE +21 -0
  752. package/node_modules/@pinojs/redact/README.md +350 -0
  753. package/node_modules/@pinojs/redact/benchmarks/basic.js +184 -0
  754. package/node_modules/@pinojs/redact/eslint.config.js +1 -0
  755. package/node_modules/@pinojs/redact/index.d.ts +52 -0
  756. package/node_modules/@pinojs/redact/index.js +529 -0
  757. package/node_modules/@pinojs/redact/index.test-d.ts +22 -0
  758. package/node_modules/@pinojs/redact/package.json +37 -0
  759. package/node_modules/@pinojs/redact/scripts/sync-version.mjs +20 -0
  760. package/node_modules/@pinojs/redact/test/actual-redact-comparison.test.js +211 -0
  761. package/node_modules/@pinojs/redact/test/index.test.js +824 -0
  762. package/node_modules/@pinojs/redact/test/integration.test.js +390 -0
  763. package/node_modules/@pinojs/redact/test/multiple-wildcards.test.js +227 -0
  764. package/node_modules/@pinojs/redact/test/prototype-pollution.test.js +223 -0
  765. package/node_modules/@pinojs/redact/test/selective-clone.test.js +115 -0
  766. package/node_modules/@pinojs/redact/tsconfig.json +19 -0
  767. package/node_modules/abstract-logging/Readme.md +47 -0
  768. package/node_modules/abstract-logging/index.js +18 -0
  769. package/node_modules/abstract-logging/package.json +25 -0
  770. package/node_modules/abstract-logging/test.js +17 -0
  771. package/node_modules/ajv/.runkit_example.js +23 -0
  772. package/node_modules/ajv/LICENSE +22 -0
  773. package/node_modules/ajv/README.md +207 -0
  774. package/node_modules/ajv/dist/2019.d.ts +19 -0
  775. package/node_modules/ajv/dist/2019.js +61 -0
  776. package/node_modules/ajv/dist/2019.js.map +1 -0
  777. package/node_modules/ajv/dist/2020.d.ts +19 -0
  778. package/node_modules/ajv/dist/2020.js +55 -0
  779. package/node_modules/ajv/dist/2020.js.map +1 -0
  780. package/node_modules/ajv/dist/ajv.d.ts +18 -0
  781. package/node_modules/ajv/dist/ajv.js +50 -0
  782. package/node_modules/ajv/dist/ajv.js.map +1 -0
  783. package/node_modules/ajv/dist/compile/codegen/code.d.ts +40 -0
  784. package/node_modules/ajv/dist/compile/codegen/code.js +156 -0
  785. package/node_modules/ajv/dist/compile/codegen/code.js.map +1 -0
  786. package/node_modules/ajv/dist/compile/codegen/index.d.ts +79 -0
  787. package/node_modules/ajv/dist/compile/codegen/index.js +697 -0
  788. package/node_modules/ajv/dist/compile/codegen/index.js.map +1 -0
  789. package/node_modules/ajv/dist/compile/codegen/scope.d.ts +79 -0
  790. package/node_modules/ajv/dist/compile/codegen/scope.js +143 -0
  791. package/node_modules/ajv/dist/compile/codegen/scope.js.map +1 -0
  792. package/node_modules/ajv/dist/compile/errors.d.ts +13 -0
  793. package/node_modules/ajv/dist/compile/errors.js +123 -0
  794. package/node_modules/ajv/dist/compile/errors.js.map +1 -0
  795. package/node_modules/ajv/dist/compile/index.d.ts +80 -0
  796. package/node_modules/ajv/dist/compile/index.js +242 -0
  797. package/node_modules/ajv/dist/compile/index.js.map +1 -0
  798. package/node_modules/ajv/dist/compile/jtd/parse.d.ts +4 -0
  799. package/node_modules/ajv/dist/compile/jtd/parse.js +350 -0
  800. package/node_modules/ajv/dist/compile/jtd/parse.js.map +1 -0
  801. package/node_modules/ajv/dist/compile/jtd/serialize.d.ts +4 -0
  802. package/node_modules/ajv/dist/compile/jtd/serialize.js +236 -0
  803. package/node_modules/ajv/dist/compile/jtd/serialize.js.map +1 -0
  804. package/node_modules/ajv/dist/compile/jtd/types.d.ts +6 -0
  805. package/node_modules/ajv/dist/compile/jtd/types.js +14 -0
  806. package/node_modules/ajv/dist/compile/jtd/types.js.map +1 -0
  807. package/node_modules/ajv/dist/compile/names.d.ts +20 -0
  808. package/node_modules/ajv/dist/compile/names.js +28 -0
  809. package/node_modules/ajv/dist/compile/names.js.map +1 -0
  810. package/node_modules/ajv/dist/compile/ref_error.d.ts +6 -0
  811. package/node_modules/ajv/dist/compile/ref_error.js +12 -0
  812. package/node_modules/ajv/dist/compile/ref_error.js.map +1 -0
  813. package/node_modules/ajv/dist/compile/resolve.d.ts +12 -0
  814. package/node_modules/ajv/dist/compile/resolve.js +155 -0
  815. package/node_modules/ajv/dist/compile/resolve.js.map +1 -0
  816. package/node_modules/ajv/dist/compile/rules.d.ts +28 -0
  817. package/node_modules/ajv/dist/compile/rules.js +26 -0
  818. package/node_modules/ajv/dist/compile/rules.js.map +1 -0
  819. package/node_modules/ajv/dist/compile/util.d.ts +40 -0
  820. package/node_modules/ajv/dist/compile/util.js +178 -0
  821. package/node_modules/ajv/dist/compile/util.js.map +1 -0
  822. package/node_modules/ajv/dist/compile/validate/applicability.d.ts +6 -0
  823. package/node_modules/ajv/dist/compile/validate/applicability.js +19 -0
  824. package/node_modules/ajv/dist/compile/validate/applicability.js.map +1 -0
  825. package/node_modules/ajv/dist/compile/validate/boolSchema.d.ts +4 -0
  826. package/node_modules/ajv/dist/compile/validate/boolSchema.js +50 -0
  827. package/node_modules/ajv/dist/compile/validate/boolSchema.js.map +1 -0
  828. package/node_modules/ajv/dist/compile/validate/dataType.d.ts +17 -0
  829. package/node_modules/ajv/dist/compile/validate/dataType.js +203 -0
  830. package/node_modules/ajv/dist/compile/validate/dataType.js.map +1 -0
  831. package/node_modules/ajv/dist/compile/validate/defaults.d.ts +2 -0
  832. package/node_modules/ajv/dist/compile/validate/defaults.js +35 -0
  833. package/node_modules/ajv/dist/compile/validate/defaults.js.map +1 -0
  834. package/node_modules/ajv/dist/compile/validate/index.d.ts +42 -0
  835. package/node_modules/ajv/dist/compile/validate/index.js +520 -0
  836. package/node_modules/ajv/dist/compile/validate/index.js.map +1 -0
  837. package/node_modules/ajv/dist/compile/validate/keyword.d.ts +8 -0
  838. package/node_modules/ajv/dist/compile/validate/keyword.js +124 -0
  839. package/node_modules/ajv/dist/compile/validate/keyword.js.map +1 -0
  840. package/node_modules/ajv/dist/compile/validate/subschema.d.ts +47 -0
  841. package/node_modules/ajv/dist/compile/validate/subschema.js +81 -0
  842. package/node_modules/ajv/dist/compile/validate/subschema.js.map +1 -0
  843. package/node_modules/ajv/dist/core.d.ts +174 -0
  844. package/node_modules/ajv/dist/core.js +618 -0
  845. package/node_modules/ajv/dist/core.js.map +1 -0
  846. package/node_modules/ajv/dist/jtd.d.ts +47 -0
  847. package/node_modules/ajv/dist/jtd.js +72 -0
  848. package/node_modules/ajv/dist/jtd.js.map +1 -0
  849. package/node_modules/ajv/dist/refs/data.json +13 -0
  850. package/node_modules/ajv/dist/refs/json-schema-2019-09/index.d.ts +2 -0
  851. package/node_modules/ajv/dist/refs/json-schema-2019-09/index.js +28 -0
  852. package/node_modules/ajv/dist/refs/json-schema-2019-09/index.js.map +1 -0
  853. package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/applicator.json +53 -0
  854. package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/content.json +17 -0
  855. package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/core.json +57 -0
  856. package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/format.json +14 -0
  857. package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/meta-data.json +37 -0
  858. package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json +90 -0
  859. package/node_modules/ajv/dist/refs/json-schema-2019-09/schema.json +39 -0
  860. package/node_modules/ajv/dist/refs/json-schema-2020-12/index.d.ts +2 -0
  861. package/node_modules/ajv/dist/refs/json-schema-2020-12/index.js +30 -0
  862. package/node_modules/ajv/dist/refs/json-schema-2020-12/index.js.map +1 -0
  863. package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json +48 -0
  864. package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json +17 -0
  865. package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json +51 -0
  866. package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json +14 -0
  867. package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json +37 -0
  868. package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json +15 -0
  869. package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json +90 -0
  870. package/node_modules/ajv/dist/refs/json-schema-2020-12/schema.json +55 -0
  871. package/node_modules/ajv/dist/refs/json-schema-draft-06.json +137 -0
  872. package/node_modules/ajv/dist/refs/json-schema-draft-07.json +151 -0
  873. package/node_modules/ajv/dist/refs/json-schema-secure.json +88 -0
  874. package/node_modules/ajv/dist/refs/jtd-schema.d.ts +3 -0
  875. package/node_modules/ajv/dist/refs/jtd-schema.js +118 -0
  876. package/node_modules/ajv/dist/refs/jtd-schema.js.map +1 -0
  877. package/node_modules/ajv/dist/runtime/equal.d.ts +6 -0
  878. package/node_modules/ajv/dist/runtime/equal.js +7 -0
  879. package/node_modules/ajv/dist/runtime/equal.js.map +1 -0
  880. package/node_modules/ajv/dist/runtime/parseJson.d.ts +18 -0
  881. package/node_modules/ajv/dist/runtime/parseJson.js +185 -0
  882. package/node_modules/ajv/dist/runtime/parseJson.js.map +1 -0
  883. package/node_modules/ajv/dist/runtime/quote.d.ts +5 -0
  884. package/node_modules/ajv/dist/runtime/quote.js +30 -0
  885. package/node_modules/ajv/dist/runtime/quote.js.map +1 -0
  886. package/node_modules/ajv/dist/runtime/re2.d.ts +6 -0
  887. package/node_modules/ajv/dist/runtime/re2.js +6 -0
  888. package/node_modules/ajv/dist/runtime/re2.js.map +1 -0
  889. package/node_modules/ajv/dist/runtime/timestamp.d.ts +5 -0
  890. package/node_modules/ajv/dist/runtime/timestamp.js +42 -0
  891. package/node_modules/ajv/dist/runtime/timestamp.js.map +1 -0
  892. package/node_modules/ajv/dist/runtime/ucs2length.d.ts +5 -0
  893. package/node_modules/ajv/dist/runtime/ucs2length.js +24 -0
  894. package/node_modules/ajv/dist/runtime/ucs2length.js.map +1 -0
  895. package/node_modules/ajv/dist/runtime/uri.d.ts +6 -0
  896. package/node_modules/ajv/dist/runtime/uri.js +6 -0
  897. package/node_modules/ajv/dist/runtime/uri.js.map +1 -0
  898. package/node_modules/ajv/dist/runtime/validation_error.d.ts +7 -0
  899. package/node_modules/ajv/dist/runtime/validation_error.js +11 -0
  900. package/node_modules/ajv/dist/runtime/validation_error.js.map +1 -0
  901. package/node_modules/ajv/dist/standalone/index.d.ts +6 -0
  902. package/node_modules/ajv/dist/standalone/index.js +90 -0
  903. package/node_modules/ajv/dist/standalone/index.js.map +1 -0
  904. package/node_modules/ajv/dist/standalone/instance.d.ts +12 -0
  905. package/node_modules/ajv/dist/standalone/instance.js +35 -0
  906. package/node_modules/ajv/dist/standalone/instance.js.map +1 -0
  907. package/node_modules/ajv/dist/types/index.d.ts +183 -0
  908. package/node_modules/ajv/dist/types/index.js +3 -0
  909. package/node_modules/ajv/dist/types/index.js.map +1 -0
  910. package/node_modules/ajv/dist/types/json-schema.d.ts +125 -0
  911. package/node_modules/ajv/dist/types/json-schema.js +3 -0
  912. package/node_modules/ajv/dist/types/json-schema.js.map +1 -0
  913. package/node_modules/ajv/dist/types/jtd-schema.d.ts +174 -0
  914. package/node_modules/ajv/dist/types/jtd-schema.js +3 -0
  915. package/node_modules/ajv/dist/types/jtd-schema.js.map +1 -0
  916. package/node_modules/ajv/dist/vocabularies/applicator/additionalItems.d.ts +8 -0
  917. package/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +49 -0
  918. package/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map +1 -0
  919. package/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.d.ts +6 -0
  920. package/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +106 -0
  921. package/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +1 -0
  922. package/node_modules/ajv/dist/vocabularies/applicator/allOf.d.ts +3 -0
  923. package/node_modules/ajv/dist/vocabularies/applicator/allOf.js +23 -0
  924. package/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +1 -0
  925. package/node_modules/ajv/dist/vocabularies/applicator/anyOf.d.ts +4 -0
  926. package/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +12 -0
  927. package/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map +1 -0
  928. package/node_modules/ajv/dist/vocabularies/applicator/contains.d.ts +7 -0
  929. package/node_modules/ajv/dist/vocabularies/applicator/contains.js +95 -0
  930. package/node_modules/ajv/dist/vocabularies/applicator/contains.js.map +1 -0
  931. package/node_modules/ajv/dist/vocabularies/applicator/dependencies.d.ts +21 -0
  932. package/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +85 -0
  933. package/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map +1 -0
  934. package/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.d.ts +3 -0
  935. package/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js +11 -0
  936. package/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js.map +1 -0
  937. package/node_modules/ajv/dist/vocabularies/applicator/if.d.ts +6 -0
  938. package/node_modules/ajv/dist/vocabularies/applicator/if.js +66 -0
  939. package/node_modules/ajv/dist/vocabularies/applicator/if.js.map +1 -0
  940. package/node_modules/ajv/dist/vocabularies/applicator/index.d.ts +13 -0
  941. package/node_modules/ajv/dist/vocabularies/applicator/index.js +44 -0
  942. package/node_modules/ajv/dist/vocabularies/applicator/index.js.map +1 -0
  943. package/node_modules/ajv/dist/vocabularies/applicator/items.d.ts +5 -0
  944. package/node_modules/ajv/dist/vocabularies/applicator/items.js +52 -0
  945. package/node_modules/ajv/dist/vocabularies/applicator/items.js.map +1 -0
  946. package/node_modules/ajv/dist/vocabularies/applicator/items2020.d.ts +6 -0
  947. package/node_modules/ajv/dist/vocabularies/applicator/items2020.js +30 -0
  948. package/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map +1 -0
  949. package/node_modules/ajv/dist/vocabularies/applicator/not.d.ts +4 -0
  950. package/node_modules/ajv/dist/vocabularies/applicator/not.js +26 -0
  951. package/node_modules/ajv/dist/vocabularies/applicator/not.js.map +1 -0
  952. package/node_modules/ajv/dist/vocabularies/applicator/oneOf.d.ts +6 -0
  953. package/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +60 -0
  954. package/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map +1 -0
  955. package/node_modules/ajv/dist/vocabularies/applicator/patternProperties.d.ts +3 -0
  956. package/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +75 -0
  957. package/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map +1 -0
  958. package/node_modules/ajv/dist/vocabularies/applicator/prefixItems.d.ts +3 -0
  959. package/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +12 -0
  960. package/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map +1 -0
  961. package/node_modules/ajv/dist/vocabularies/applicator/properties.d.ts +3 -0
  962. package/node_modules/ajv/dist/vocabularies/applicator/properties.js +54 -0
  963. package/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +1 -0
  964. package/node_modules/ajv/dist/vocabularies/applicator/propertyNames.d.ts +6 -0
  965. package/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +38 -0
  966. package/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map +1 -0
  967. package/node_modules/ajv/dist/vocabularies/applicator/thenElse.d.ts +3 -0
  968. package/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +13 -0
  969. package/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map +1 -0
  970. package/node_modules/ajv/dist/vocabularies/code.d.ts +17 -0
  971. package/node_modules/ajv/dist/vocabularies/code.js +131 -0
  972. package/node_modules/ajv/dist/vocabularies/code.js.map +1 -0
  973. package/node_modules/ajv/dist/vocabularies/core/id.d.ts +3 -0
  974. package/node_modules/ajv/dist/vocabularies/core/id.js +10 -0
  975. package/node_modules/ajv/dist/vocabularies/core/id.js.map +1 -0
  976. package/node_modules/ajv/dist/vocabularies/core/index.d.ts +3 -0
  977. package/node_modules/ajv/dist/vocabularies/core/index.js +16 -0
  978. package/node_modules/ajv/dist/vocabularies/core/index.js.map +1 -0
  979. package/node_modules/ajv/dist/vocabularies/core/ref.d.ts +8 -0
  980. package/node_modules/ajv/dist/vocabularies/core/ref.js +122 -0
  981. package/node_modules/ajv/dist/vocabularies/core/ref.js.map +1 -0
  982. package/node_modules/ajv/dist/vocabularies/discriminator/index.d.ts +5 -0
  983. package/node_modules/ajv/dist/vocabularies/discriminator/index.js +104 -0
  984. package/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +1 -0
  985. package/node_modules/ajv/dist/vocabularies/discriminator/types.d.ts +10 -0
  986. package/node_modules/ajv/dist/vocabularies/discriminator/types.js +9 -0
  987. package/node_modules/ajv/dist/vocabularies/discriminator/types.js.map +1 -0
  988. package/node_modules/ajv/dist/vocabularies/draft2020.d.ts +3 -0
  989. package/node_modules/ajv/dist/vocabularies/draft2020.js +23 -0
  990. package/node_modules/ajv/dist/vocabularies/draft2020.js.map +1 -0
  991. package/node_modules/ajv/dist/vocabularies/draft7.d.ts +3 -0
  992. package/node_modules/ajv/dist/vocabularies/draft7.js +17 -0
  993. package/node_modules/ajv/dist/vocabularies/draft7.js.map +1 -0
  994. package/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.d.ts +5 -0
  995. package/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js +30 -0
  996. package/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js.map +1 -0
  997. package/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.d.ts +5 -0
  998. package/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js +51 -0
  999. package/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js.map +1 -0
  1000. package/node_modules/ajv/dist/vocabularies/dynamic/index.d.ts +3 -0
  1001. package/node_modules/ajv/dist/vocabularies/dynamic/index.js +9 -0
  1002. package/node_modules/ajv/dist/vocabularies/dynamic/index.js.map +1 -0
  1003. package/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.d.ts +3 -0
  1004. package/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js +16 -0
  1005. package/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js.map +1 -0
  1006. package/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.d.ts +3 -0
  1007. package/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js +10 -0
  1008. package/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js.map +1 -0
  1009. package/node_modules/ajv/dist/vocabularies/errors.d.ts +9 -0
  1010. package/node_modules/ajv/dist/vocabularies/errors.js +3 -0
  1011. package/node_modules/ajv/dist/vocabularies/errors.js.map +1 -0
  1012. package/node_modules/ajv/dist/vocabularies/format/format.d.ts +8 -0
  1013. package/node_modules/ajv/dist/vocabularies/format/format.js +92 -0
  1014. package/node_modules/ajv/dist/vocabularies/format/format.js.map +1 -0
  1015. package/node_modules/ajv/dist/vocabularies/format/index.d.ts +3 -0
  1016. package/node_modules/ajv/dist/vocabularies/format/index.js +6 -0
  1017. package/node_modules/ajv/dist/vocabularies/format/index.js.map +1 -0
  1018. package/node_modules/ajv/dist/vocabularies/jtd/discriminator.d.ts +6 -0
  1019. package/node_modules/ajv/dist/vocabularies/jtd/discriminator.js +71 -0
  1020. package/node_modules/ajv/dist/vocabularies/jtd/discriminator.js.map +1 -0
  1021. package/node_modules/ajv/dist/vocabularies/jtd/elements.d.ts +5 -0
  1022. package/node_modules/ajv/dist/vocabularies/jtd/elements.js +24 -0
  1023. package/node_modules/ajv/dist/vocabularies/jtd/elements.js.map +1 -0
  1024. package/node_modules/ajv/dist/vocabularies/jtd/enum.d.ts +6 -0
  1025. package/node_modules/ajv/dist/vocabularies/jtd/enum.js +43 -0
  1026. package/node_modules/ajv/dist/vocabularies/jtd/enum.js.map +1 -0
  1027. package/node_modules/ajv/dist/vocabularies/jtd/error.d.ts +9 -0
  1028. package/node_modules/ajv/dist/vocabularies/jtd/error.js +20 -0
  1029. package/node_modules/ajv/dist/vocabularies/jtd/error.js.map +1 -0
  1030. package/node_modules/ajv/dist/vocabularies/jtd/index.d.ts +10 -0
  1031. package/node_modules/ajv/dist/vocabularies/jtd/index.js +29 -0
  1032. package/node_modules/ajv/dist/vocabularies/jtd/index.js.map +1 -0
  1033. package/node_modules/ajv/dist/vocabularies/jtd/metadata.d.ts +5 -0
  1034. package/node_modules/ajv/dist/vocabularies/jtd/metadata.js +25 -0
  1035. package/node_modules/ajv/dist/vocabularies/jtd/metadata.js.map +1 -0
  1036. package/node_modules/ajv/dist/vocabularies/jtd/nullable.d.ts +4 -0
  1037. package/node_modules/ajv/dist/vocabularies/jtd/nullable.js +22 -0
  1038. package/node_modules/ajv/dist/vocabularies/jtd/nullable.js.map +1 -0
  1039. package/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.d.ts +3 -0
  1040. package/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js +15 -0
  1041. package/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js.map +1 -0
  1042. package/node_modules/ajv/dist/vocabularies/jtd/properties.d.ts +22 -0
  1043. package/node_modules/ajv/dist/vocabularies/jtd/properties.js +149 -0
  1044. package/node_modules/ajv/dist/vocabularies/jtd/properties.js.map +1 -0
  1045. package/node_modules/ajv/dist/vocabularies/jtd/ref.d.ts +4 -0
  1046. package/node_modules/ajv/dist/vocabularies/jtd/ref.js +67 -0
  1047. package/node_modules/ajv/dist/vocabularies/jtd/ref.js.map +1 -0
  1048. package/node_modules/ajv/dist/vocabularies/jtd/type.d.ts +10 -0
  1049. package/node_modules/ajv/dist/vocabularies/jtd/type.js +69 -0
  1050. package/node_modules/ajv/dist/vocabularies/jtd/type.js.map +1 -0
  1051. package/node_modules/ajv/dist/vocabularies/jtd/union.d.ts +3 -0
  1052. package/node_modules/ajv/dist/vocabularies/jtd/union.js +12 -0
  1053. package/node_modules/ajv/dist/vocabularies/jtd/union.js.map +1 -0
  1054. package/node_modules/ajv/dist/vocabularies/jtd/values.d.ts +5 -0
  1055. package/node_modules/ajv/dist/vocabularies/jtd/values.js +51 -0
  1056. package/node_modules/ajv/dist/vocabularies/jtd/values.js.map +1 -0
  1057. package/node_modules/ajv/dist/vocabularies/metadata.d.ts +3 -0
  1058. package/node_modules/ajv/dist/vocabularies/metadata.js +18 -0
  1059. package/node_modules/ajv/dist/vocabularies/metadata.js.map +1 -0
  1060. package/node_modules/ajv/dist/vocabularies/next.d.ts +3 -0
  1061. package/node_modules/ajv/dist/vocabularies/next.js +8 -0
  1062. package/node_modules/ajv/dist/vocabularies/next.js.map +1 -0
  1063. package/node_modules/ajv/dist/vocabularies/unevaluated/index.d.ts +3 -0
  1064. package/node_modules/ajv/dist/vocabularies/unevaluated/index.js +7 -0
  1065. package/node_modules/ajv/dist/vocabularies/unevaluated/index.js.map +1 -0
  1066. package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.d.ts +6 -0
  1067. package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js +40 -0
  1068. package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js.map +1 -0
  1069. package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.d.ts +6 -0
  1070. package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js +65 -0
  1071. package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js.map +1 -0
  1072. package/node_modules/ajv/dist/vocabularies/validation/const.d.ts +6 -0
  1073. package/node_modules/ajv/dist/vocabularies/validation/const.js +25 -0
  1074. package/node_modules/ajv/dist/vocabularies/validation/const.js.map +1 -0
  1075. package/node_modules/ajv/dist/vocabularies/validation/dependentRequired.d.ts +5 -0
  1076. package/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js +12 -0
  1077. package/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js.map +1 -0
  1078. package/node_modules/ajv/dist/vocabularies/validation/enum.d.ts +8 -0
  1079. package/node_modules/ajv/dist/vocabularies/validation/enum.js +48 -0
  1080. package/node_modules/ajv/dist/vocabularies/validation/enum.js.map +1 -0
  1081. package/node_modules/ajv/dist/vocabularies/validation/index.d.ts +16 -0
  1082. package/node_modules/ajv/dist/vocabularies/validation/index.js +33 -0
  1083. package/node_modules/ajv/dist/vocabularies/validation/index.js.map +1 -0
  1084. package/node_modules/ajv/dist/vocabularies/validation/limitContains.d.ts +3 -0
  1085. package/node_modules/ajv/dist/vocabularies/validation/limitContains.js +15 -0
  1086. package/node_modules/ajv/dist/vocabularies/validation/limitContains.js.map +1 -0
  1087. package/node_modules/ajv/dist/vocabularies/validation/limitItems.d.ts +3 -0
  1088. package/node_modules/ajv/dist/vocabularies/validation/limitItems.js +24 -0
  1089. package/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map +1 -0
  1090. package/node_modules/ajv/dist/vocabularies/validation/limitLength.d.ts +3 -0
  1091. package/node_modules/ajv/dist/vocabularies/validation/limitLength.js +27 -0
  1092. package/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map +1 -0
  1093. package/node_modules/ajv/dist/vocabularies/validation/limitNumber.d.ts +11 -0
  1094. package/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +27 -0
  1095. package/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map +1 -0
  1096. package/node_modules/ajv/dist/vocabularies/validation/limitProperties.d.ts +3 -0
  1097. package/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +24 -0
  1098. package/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map +1 -0
  1099. package/node_modules/ajv/dist/vocabularies/validation/multipleOf.d.ts +8 -0
  1100. package/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +26 -0
  1101. package/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map +1 -0
  1102. package/node_modules/ajv/dist/vocabularies/validation/pattern.d.ts +8 -0
  1103. package/node_modules/ajv/dist/vocabularies/validation/pattern.js +33 -0
  1104. package/node_modules/ajv/dist/vocabularies/validation/pattern.js.map +1 -0
  1105. package/node_modules/ajv/dist/vocabularies/validation/required.d.ts +8 -0
  1106. package/node_modules/ajv/dist/vocabularies/validation/required.js +79 -0
  1107. package/node_modules/ajv/dist/vocabularies/validation/required.js.map +1 -0
  1108. package/node_modules/ajv/dist/vocabularies/validation/uniqueItems.d.ts +9 -0
  1109. package/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +64 -0
  1110. package/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map +1 -0
  1111. package/node_modules/ajv/lib/2019.ts +81 -0
  1112. package/node_modules/ajv/lib/2020.ts +75 -0
  1113. package/node_modules/ajv/lib/ajv.ts +70 -0
  1114. package/node_modules/ajv/lib/compile/codegen/code.ts +169 -0
  1115. package/node_modules/ajv/lib/compile/codegen/index.ts +852 -0
  1116. package/node_modules/ajv/lib/compile/codegen/scope.ts +215 -0
  1117. package/node_modules/ajv/lib/compile/errors.ts +184 -0
  1118. package/node_modules/ajv/lib/compile/index.ts +324 -0
  1119. package/node_modules/ajv/lib/compile/jtd/parse.ts +411 -0
  1120. package/node_modules/ajv/lib/compile/jtd/serialize.ts +277 -0
  1121. package/node_modules/ajv/lib/compile/jtd/types.ts +16 -0
  1122. package/node_modules/ajv/lib/compile/names.ts +27 -0
  1123. package/node_modules/ajv/lib/compile/ref_error.ts +13 -0
  1124. package/node_modules/ajv/lib/compile/resolve.ts +149 -0
  1125. package/node_modules/ajv/lib/compile/rules.ts +50 -0
  1126. package/node_modules/ajv/lib/compile/util.ts +213 -0
  1127. package/node_modules/ajv/lib/compile/validate/applicability.ts +22 -0
  1128. package/node_modules/ajv/lib/compile/validate/boolSchema.ts +47 -0
  1129. package/node_modules/ajv/lib/compile/validate/dataType.ts +230 -0
  1130. package/node_modules/ajv/lib/compile/validate/defaults.ts +32 -0
  1131. package/node_modules/ajv/lib/compile/validate/index.ts +582 -0
  1132. package/node_modules/ajv/lib/compile/validate/keyword.ts +171 -0
  1133. package/node_modules/ajv/lib/compile/validate/subschema.ts +135 -0
  1134. package/node_modules/ajv/lib/core.ts +892 -0
  1135. package/node_modules/ajv/lib/jtd.ts +132 -0
  1136. package/node_modules/ajv/lib/refs/data.json +13 -0
  1137. package/node_modules/ajv/lib/refs/json-schema-2019-09/index.ts +28 -0
  1138. package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/applicator.json +53 -0
  1139. package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/content.json +17 -0
  1140. package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/core.json +57 -0
  1141. package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/format.json +14 -0
  1142. package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/meta-data.json +37 -0
  1143. package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/validation.json +90 -0
  1144. package/node_modules/ajv/lib/refs/json-schema-2019-09/schema.json +39 -0
  1145. package/node_modules/ajv/lib/refs/json-schema-2020-12/index.ts +30 -0
  1146. package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/applicator.json +48 -0
  1147. package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/content.json +17 -0
  1148. package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/core.json +51 -0
  1149. package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/format-annotation.json +14 -0
  1150. package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/meta-data.json +37 -0
  1151. package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/unevaluated.json +15 -0
  1152. package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/validation.json +90 -0
  1153. package/node_modules/ajv/lib/refs/json-schema-2020-12/schema.json +55 -0
  1154. package/node_modules/ajv/lib/refs/json-schema-draft-06.json +137 -0
  1155. package/node_modules/ajv/lib/refs/json-schema-draft-07.json +151 -0
  1156. package/node_modules/ajv/lib/refs/json-schema-secure.json +88 -0
  1157. package/node_modules/ajv/lib/refs/jtd-schema.ts +130 -0
  1158. package/node_modules/ajv/lib/runtime/equal.ts +7 -0
  1159. package/node_modules/ajv/lib/runtime/parseJson.ts +177 -0
  1160. package/node_modules/ajv/lib/runtime/quote.ts +31 -0
  1161. package/node_modules/ajv/lib/runtime/re2.ts +6 -0
  1162. package/node_modules/ajv/lib/runtime/timestamp.ts +46 -0
  1163. package/node_modules/ajv/lib/runtime/ucs2length.ts +20 -0
  1164. package/node_modules/ajv/lib/runtime/uri.ts +6 -0
  1165. package/node_modules/ajv/lib/runtime/validation_error.ts +13 -0
  1166. package/node_modules/ajv/lib/standalone/index.ts +100 -0
  1167. package/node_modules/ajv/lib/standalone/instance.ts +36 -0
  1168. package/node_modules/ajv/lib/types/index.ts +244 -0
  1169. package/node_modules/ajv/lib/types/json-schema.ts +187 -0
  1170. package/node_modules/ajv/lib/types/jtd-schema.ts +273 -0
  1171. package/node_modules/ajv/lib/vocabularies/applicator/additionalItems.ts +56 -0
  1172. package/node_modules/ajv/lib/vocabularies/applicator/additionalProperties.ts +118 -0
  1173. package/node_modules/ajv/lib/vocabularies/applicator/allOf.ts +22 -0
  1174. package/node_modules/ajv/lib/vocabularies/applicator/anyOf.ts +14 -0
  1175. package/node_modules/ajv/lib/vocabularies/applicator/contains.ts +109 -0
  1176. package/node_modules/ajv/lib/vocabularies/applicator/dependencies.ts +112 -0
  1177. package/node_modules/ajv/lib/vocabularies/applicator/dependentSchemas.ts +11 -0
  1178. package/node_modules/ajv/lib/vocabularies/applicator/if.ts +80 -0
  1179. package/node_modules/ajv/lib/vocabularies/applicator/index.ts +53 -0
  1180. package/node_modules/ajv/lib/vocabularies/applicator/items.ts +59 -0
  1181. package/node_modules/ajv/lib/vocabularies/applicator/items2020.ts +36 -0
  1182. package/node_modules/ajv/lib/vocabularies/applicator/not.ts +38 -0
  1183. package/node_modules/ajv/lib/vocabularies/applicator/oneOf.ts +82 -0
  1184. package/node_modules/ajv/lib/vocabularies/applicator/patternProperties.ts +91 -0
  1185. package/node_modules/ajv/lib/vocabularies/applicator/prefixItems.ts +12 -0
  1186. package/node_modules/ajv/lib/vocabularies/applicator/properties.ts +57 -0
  1187. package/node_modules/ajv/lib/vocabularies/applicator/propertyNames.ts +50 -0
  1188. package/node_modules/ajv/lib/vocabularies/applicator/thenElse.ts +13 -0
  1189. package/node_modules/ajv/lib/vocabularies/code.ts +168 -0
  1190. package/node_modules/ajv/lib/vocabularies/core/id.ts +10 -0
  1191. package/node_modules/ajv/lib/vocabularies/core/index.ts +16 -0
  1192. package/node_modules/ajv/lib/vocabularies/core/ref.ts +129 -0
  1193. package/node_modules/ajv/lib/vocabularies/discriminator/index.ts +113 -0
  1194. package/node_modules/ajv/lib/vocabularies/discriminator/types.ts +12 -0
  1195. package/node_modules/ajv/lib/vocabularies/draft2020.ts +23 -0
  1196. package/node_modules/ajv/lib/vocabularies/draft7.ts +17 -0
  1197. package/node_modules/ajv/lib/vocabularies/dynamic/dynamicAnchor.ts +31 -0
  1198. package/node_modules/ajv/lib/vocabularies/dynamic/dynamicRef.ts +51 -0
  1199. package/node_modules/ajv/lib/vocabularies/dynamic/index.ts +9 -0
  1200. package/node_modules/ajv/lib/vocabularies/dynamic/recursiveAnchor.ts +14 -0
  1201. package/node_modules/ajv/lib/vocabularies/dynamic/recursiveRef.ts +10 -0
  1202. package/node_modules/ajv/lib/vocabularies/errors.ts +18 -0
  1203. package/node_modules/ajv/lib/vocabularies/format/format.ts +120 -0
  1204. package/node_modules/ajv/lib/vocabularies/format/index.ts +6 -0
  1205. package/node_modules/ajv/lib/vocabularies/jtd/discriminator.ts +89 -0
  1206. package/node_modules/ajv/lib/vocabularies/jtd/elements.ts +32 -0
  1207. package/node_modules/ajv/lib/vocabularies/jtd/enum.ts +45 -0
  1208. package/node_modules/ajv/lib/vocabularies/jtd/error.ts +23 -0
  1209. package/node_modules/ajv/lib/vocabularies/jtd/index.ts +37 -0
  1210. package/node_modules/ajv/lib/vocabularies/jtd/metadata.ts +24 -0
  1211. package/node_modules/ajv/lib/vocabularies/jtd/nullable.ts +21 -0
  1212. package/node_modules/ajv/lib/vocabularies/jtd/optionalProperties.ts +15 -0
  1213. package/node_modules/ajv/lib/vocabularies/jtd/properties.ts +184 -0
  1214. package/node_modules/ajv/lib/vocabularies/jtd/ref.ts +76 -0
  1215. package/node_modules/ajv/lib/vocabularies/jtd/type.ts +75 -0
  1216. package/node_modules/ajv/lib/vocabularies/jtd/union.ts +12 -0
  1217. package/node_modules/ajv/lib/vocabularies/jtd/values.ts +58 -0
  1218. package/node_modules/ajv/lib/vocabularies/metadata.ts +17 -0
  1219. package/node_modules/ajv/lib/vocabularies/next.ts +8 -0
  1220. package/node_modules/ajv/lib/vocabularies/unevaluated/index.ts +7 -0
  1221. package/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedItems.ts +47 -0
  1222. package/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedProperties.ts +85 -0
  1223. package/node_modules/ajv/lib/vocabularies/validation/const.ts +28 -0
  1224. package/node_modules/ajv/lib/vocabularies/validation/dependentRequired.ts +23 -0
  1225. package/node_modules/ajv/lib/vocabularies/validation/enum.ts +54 -0
  1226. package/node_modules/ajv/lib/vocabularies/validation/index.ts +49 -0
  1227. package/node_modules/ajv/lib/vocabularies/validation/limitContains.ts +16 -0
  1228. package/node_modules/ajv/lib/vocabularies/validation/limitItems.ts +26 -0
  1229. package/node_modules/ajv/lib/vocabularies/validation/limitLength.ts +30 -0
  1230. package/node_modules/ajv/lib/vocabularies/validation/limitNumber.ts +42 -0
  1231. package/node_modules/ajv/lib/vocabularies/validation/limitProperties.ts +26 -0
  1232. package/node_modules/ajv/lib/vocabularies/validation/multipleOf.ts +34 -0
  1233. package/node_modules/ajv/lib/vocabularies/validation/pattern.ts +39 -0
  1234. package/node_modules/ajv/lib/vocabularies/validation/required.ts +98 -0
  1235. package/node_modules/ajv/lib/vocabularies/validation/uniqueItems.ts +79 -0
  1236. package/node_modules/ajv/package.json +127 -0
  1237. package/node_modules/ajv-formats/LICENSE +21 -0
  1238. package/node_modules/ajv-formats/README.md +125 -0
  1239. package/node_modules/ajv-formats/dist/formats.d.ts +9 -0
  1240. package/node_modules/ajv-formats/dist/formats.js +208 -0
  1241. package/node_modules/ajv-formats/dist/formats.js.map +1 -0
  1242. package/node_modules/ajv-formats/dist/index.d.ts +15 -0
  1243. package/node_modules/ajv-formats/dist/index.js +37 -0
  1244. package/node_modules/ajv-formats/dist/index.js.map +1 -0
  1245. package/node_modules/ajv-formats/dist/limit.d.ts +10 -0
  1246. package/node_modules/ajv-formats/dist/limit.js +69 -0
  1247. package/node_modules/ajv-formats/dist/limit.js.map +1 -0
  1248. package/node_modules/ajv-formats/package.json +74 -0
  1249. package/node_modules/ajv-formats/src/formats.ts +269 -0
  1250. package/node_modules/ajv-formats/src/index.ts +62 -0
  1251. package/node_modules/ajv-formats/src/limit.ts +99 -0
  1252. package/node_modules/atomic-sleep/.travis.yml +11 -0
  1253. package/node_modules/atomic-sleep/LICENSE +22 -0
  1254. package/node_modules/atomic-sleep/index.js +38 -0
  1255. package/node_modules/atomic-sleep/package.json +37 -0
  1256. package/node_modules/atomic-sleep/readme.md +58 -0
  1257. package/node_modules/atomic-sleep/test.js +47 -0
  1258. package/node_modules/avvio/.borp.yaml +2 -0
  1259. package/node_modules/avvio/.gitattributes +2 -0
  1260. package/node_modules/avvio/.github/dependabot.yml +13 -0
  1261. package/node_modules/avvio/.github/release-drafter.yml +4 -0
  1262. package/node_modules/avvio/.github/workflows/ci.yml +33 -0
  1263. package/node_modules/avvio/LICENSE +24 -0
  1264. package/node_modules/avvio/README.md +700 -0
  1265. package/node_modules/avvio/boot.js +621 -0
  1266. package/node_modules/avvio/eslint.config.js +6 -0
  1267. package/node_modules/avvio/examples/example.js +72 -0
  1268. package/node_modules/avvio/index.d.ts +95 -0
  1269. package/node_modules/avvio/lib/create-promise.js +45 -0
  1270. package/node_modules/avvio/lib/debug.js +19 -0
  1271. package/node_modules/avvio/lib/errors.js +38 -0
  1272. package/node_modules/avvio/lib/execute-with-thenable.js +36 -0
  1273. package/node_modules/avvio/lib/get-plugin-name.js +34 -0
  1274. package/node_modules/avvio/lib/is-bundled-or-typescript-plugin.js +23 -0
  1275. package/node_modules/avvio/lib/is-promise-like.js +17 -0
  1276. package/node_modules/avvio/lib/plugin.js +279 -0
  1277. package/node_modules/avvio/lib/symbols.js +26 -0
  1278. package/node_modules/avvio/lib/thenify.js +60 -0
  1279. package/node_modules/avvio/lib/time-tree.js +200 -0
  1280. package/node_modules/avvio/lib/validate-plugin.js +26 -0
  1281. package/node_modules/avvio/package.json +74 -0
  1282. package/node_modules/avvio/test/after-and-ready.test.js +903 -0
  1283. package/node_modules/avvio/test/after-pass-through.test.js +33 -0
  1284. package/node_modules/avvio/test/after-self-promise.test.js +20 -0
  1285. package/node_modules/avvio/test/after-throw.test.js +26 -0
  1286. package/node_modules/avvio/test/after-use-after.test.js +87 -0
  1287. package/node_modules/avvio/test/async-await.test.js +323 -0
  1288. package/node_modules/avvio/test/await-after.test.js +448 -0
  1289. package/node_modules/avvio/test/await-self.test.js +31 -0
  1290. package/node_modules/avvio/test/await-use.test.js +295 -0
  1291. package/node_modules/avvio/test/basic.test.js +459 -0
  1292. package/node_modules/avvio/test/callbacks.test.js +116 -0
  1293. package/node_modules/avvio/test/catch-override-exception.test.js +27 -0
  1294. package/node_modules/avvio/test/chainable.test.js +70 -0
  1295. package/node_modules/avvio/test/close.test.js +562 -0
  1296. package/node_modules/avvio/test/errors.test.js +26 -0
  1297. package/node_modules/avvio/test/esm.mjs +12 -0
  1298. package/node_modules/avvio/test/esm.test.js +8 -0
  1299. package/node_modules/avvio/test/events-listeners.test.js +23 -0
  1300. package/node_modules/avvio/test/expose.test.js +76 -0
  1301. package/node_modules/avvio/test/fixtures/dummy.txt +1 -0
  1302. package/node_modules/avvio/test/fixtures/esm.mjs +3 -0
  1303. package/node_modules/avvio/test/fixtures/plugin-no-next.js +5 -0
  1304. package/node_modules/avvio/test/gh-issues/bug-205.test.js +17 -0
  1305. package/node_modules/avvio/test/lib/create-promise.test.js +56 -0
  1306. package/node_modules/avvio/test/lib/execute-with-thenable.test.js +86 -0
  1307. package/node_modules/avvio/test/lib/get-plugin-name.test.js +67 -0
  1308. package/node_modules/avvio/test/lib/is-bundled-or-typescript-plugin.test.js +20 -0
  1309. package/node_modules/avvio/test/lib/is-promise-like.test.js +20 -0
  1310. package/node_modules/avvio/test/lib/thenify.test.js +140 -0
  1311. package/node_modules/avvio/test/lib/time-tree.test.js +391 -0
  1312. package/node_modules/avvio/test/lib/validate-plugin.test.js +19 -0
  1313. package/node_modules/avvio/test/load-plugin.test.js +132 -0
  1314. package/node_modules/avvio/test/no-done.test.js +19 -0
  1315. package/node_modules/avvio/test/on-ready-timeout-await.test.js +33 -0
  1316. package/node_modules/avvio/test/override.test.js +385 -0
  1317. package/node_modules/avvio/test/plugin-loaded-so-far.test.js +81 -0
  1318. package/node_modules/avvio/test/plugin-name.test.js +58 -0
  1319. package/node_modules/avvio/test/plugin-timeout-await.test.js +33 -0
  1320. package/node_modules/avvio/test/plugin-timeout.test.js +227 -0
  1321. package/node_modules/avvio/test/pretty-print.test.js +76 -0
  1322. package/node_modules/avvio/test/reentrant.test.js +126 -0
  1323. package/node_modules/avvio/test/symbol-async-dispose.test.js +28 -0
  1324. package/node_modules/avvio/test/to-json.test.js +130 -0
  1325. package/node_modules/avvio/test/twice-done.test.js +23 -0
  1326. package/node_modules/avvio/test/types/index.ts +412 -0
  1327. package/node_modules/avvio/test/types/tsconfig.json +9 -0
  1328. package/node_modules/balanced-match/LICENSE.md +23 -0
  1329. package/node_modules/balanced-match/README.md +57 -0
  1330. package/node_modules/balanced-match/dist/commonjs/index.d.ts +9 -0
  1331. package/node_modules/balanced-match/dist/commonjs/index.d.ts.map +1 -0
  1332. package/node_modules/balanced-match/dist/commonjs/index.js +59 -0
  1333. package/node_modules/balanced-match/dist/commonjs/index.js.map +1 -0
  1334. package/node_modules/balanced-match/dist/commonjs/package.json +3 -0
  1335. package/node_modules/balanced-match/dist/esm/index.d.ts +9 -0
  1336. package/node_modules/balanced-match/dist/esm/index.d.ts.map +1 -0
  1337. package/node_modules/balanced-match/dist/esm/index.js +54 -0
  1338. package/node_modules/balanced-match/dist/esm/index.js.map +1 -0
  1339. package/node_modules/balanced-match/dist/esm/package.json +3 -0
  1340. package/node_modules/balanced-match/package.json +68 -0
  1341. package/node_modules/brace-expansion/LICENSE +23 -0
  1342. package/node_modules/brace-expansion/README.md +94 -0
  1343. package/node_modules/brace-expansion/dist/commonjs/index.d.ts +6 -0
  1344. package/node_modules/brace-expansion/dist/commonjs/index.d.ts.map +1 -0
  1345. package/node_modules/brace-expansion/dist/commonjs/index.js +201 -0
  1346. package/node_modules/brace-expansion/dist/commonjs/index.js.map +1 -0
  1347. package/node_modules/brace-expansion/dist/commonjs/package.json +3 -0
  1348. package/node_modules/brace-expansion/dist/esm/index.d.ts +6 -0
  1349. package/node_modules/brace-expansion/dist/esm/index.d.ts.map +1 -0
  1350. package/node_modules/brace-expansion/dist/esm/index.js +197 -0
  1351. package/node_modules/brace-expansion/dist/esm/index.js.map +1 -0
  1352. package/node_modules/brace-expansion/dist/esm/package.json +3 -0
  1353. package/node_modules/brace-expansion/package.json +64 -0
  1354. package/node_modules/content-disposition/LICENSE +22 -0
  1355. package/node_modules/content-disposition/README.md +141 -0
  1356. package/node_modules/content-disposition/index.js +536 -0
  1357. package/node_modules/content-disposition/package.json +40 -0
  1358. package/node_modules/cookie/LICENSE +24 -0
  1359. package/node_modules/cookie/README.md +295 -0
  1360. package/node_modules/cookie/dist/index.d.ts +148 -0
  1361. package/node_modules/cookie/dist/index.js +350 -0
  1362. package/node_modules/cookie/dist/index.js.map +1 -0
  1363. package/node_modules/cookie/package.json +47 -0
  1364. package/node_modules/depd/History.md +103 -0
  1365. package/node_modules/depd/LICENSE +22 -0
  1366. package/node_modules/depd/Readme.md +280 -0
  1367. package/node_modules/depd/index.js +538 -0
  1368. package/node_modules/depd/lib/browser/index.js +77 -0
  1369. package/node_modules/depd/package.json +45 -0
  1370. package/node_modules/dequal/dist/index.js +86 -0
  1371. package/node_modules/dequal/dist/index.min.js +1 -0
  1372. package/node_modules/dequal/dist/index.mjs +84 -0
  1373. package/node_modules/dequal/index.d.ts +1 -0
  1374. package/node_modules/dequal/license +21 -0
  1375. package/node_modules/dequal/lite/index.d.ts +1 -0
  1376. package/node_modules/dequal/lite/index.js +31 -0
  1377. package/node_modules/dequal/lite/index.min.js +1 -0
  1378. package/node_modules/dequal/lite/index.mjs +29 -0
  1379. package/node_modules/dequal/package.json +57 -0
  1380. package/node_modules/dequal/readme.md +112 -0
  1381. package/node_modules/escape-html/LICENSE +24 -0
  1382. package/node_modules/escape-html/Readme.md +43 -0
  1383. package/node_modules/escape-html/index.js +78 -0
  1384. package/node_modules/escape-html/package.json +24 -0
  1385. package/node_modules/fast-decode-uri-component/.travis.yml +12 -0
  1386. package/node_modules/fast-decode-uri-component/LICENSE +23 -0
  1387. package/node_modules/fast-decode-uri-component/README.md +43 -0
  1388. package/node_modules/fast-decode-uri-component/bench.js +35 -0
  1389. package/node_modules/fast-decode-uri-component/index.js +115 -0
  1390. package/node_modules/fast-decode-uri-component/package.json +33 -0
  1391. package/node_modules/fast-decode-uri-component/test.js +32 -0
  1392. package/node_modules/fast-deep-equal/LICENSE +21 -0
  1393. package/node_modules/fast-deep-equal/README.md +96 -0
  1394. package/node_modules/fast-deep-equal/es6/index.d.ts +2 -0
  1395. package/node_modules/fast-deep-equal/es6/index.js +72 -0
  1396. package/node_modules/fast-deep-equal/es6/react.d.ts +2 -0
  1397. package/node_modules/fast-deep-equal/es6/react.js +79 -0
  1398. package/node_modules/fast-deep-equal/index.d.ts +4 -0
  1399. package/node_modules/fast-deep-equal/index.js +46 -0
  1400. package/node_modules/fast-deep-equal/package.json +61 -0
  1401. package/node_modules/fast-deep-equal/react.d.ts +2 -0
  1402. package/node_modules/fast-deep-equal/react.js +53 -0
  1403. package/node_modules/fast-json-stringify/.gitattributes +2 -0
  1404. package/node_modules/fast-json-stringify/.github/dependabot.yml +13 -0
  1405. package/node_modules/fast-json-stringify/.github/workflows/ci.yml +33 -0
  1406. package/node_modules/fast-json-stringify/.github/workflows/lock-threads.yml +19 -0
  1407. package/node_modules/fast-json-stringify/LICENSE +22 -0
  1408. package/node_modules/fast-json-stringify/README.md +742 -0
  1409. package/node_modules/fast-json-stringify/benchmark/bench-cmp-branch.js +116 -0
  1410. package/node_modules/fast-json-stringify/benchmark/bench-cmp-lib.js +339 -0
  1411. package/node_modules/fast-json-stringify/benchmark/bench-thread.js +33 -0
  1412. package/node_modules/fast-json-stringify/benchmark/bench.js +391 -0
  1413. package/node_modules/fast-json-stringify/build/build-schema-validator.js +26 -0
  1414. package/node_modules/fast-json-stringify/eslint.config.js +9 -0
  1415. package/node_modules/fast-json-stringify/examples/example.js +81 -0
  1416. package/node_modules/fast-json-stringify/examples/server.js +42 -0
  1417. package/node_modules/fast-json-stringify/index.js +1312 -0
  1418. package/node_modules/fast-json-stringify/lib/location.js +24 -0
  1419. package/node_modules/fast-json-stringify/lib/merge-schemas.js +9 -0
  1420. package/node_modules/fast-json-stringify/lib/schema-validator.js +1134 -0
  1421. package/node_modules/fast-json-stringify/lib/serializer.js +141 -0
  1422. package/node_modules/fast-json-stringify/lib/standalone.js +34 -0
  1423. package/node_modules/fast-json-stringify/lib/validator.js +96 -0
  1424. package/node_modules/fast-json-stringify/package.json +89 -0
  1425. package/node_modules/fast-json-stringify/test/additionalProperties.test.js +332 -0
  1426. package/node_modules/fast-json-stringify/test/allof.test.js +751 -0
  1427. package/node_modules/fast-json-stringify/test/any.test.js +231 -0
  1428. package/node_modules/fast-json-stringify/test/anyof.test.js +812 -0
  1429. package/node_modules/fast-json-stringify/test/array.test.js +688 -0
  1430. package/node_modules/fast-json-stringify/test/asNumber.test.js +13 -0
  1431. package/node_modules/fast-json-stringify/test/basic.test.js +400 -0
  1432. package/node_modules/fast-json-stringify/test/bigint.test.js +76 -0
  1433. package/node_modules/fast-json-stringify/test/clean-cache.test.js +47 -0
  1434. package/node_modules/fast-json-stringify/test/const.test.js +314 -0
  1435. package/node_modules/fast-json-stringify/test/date.test.js +639 -0
  1436. package/node_modules/fast-json-stringify/test/debug-mode.test.js +142 -0
  1437. package/node_modules/fast-json-stringify/test/defaults.test.js +376 -0
  1438. package/node_modules/fast-json-stringify/test/enum.test.js +37 -0
  1439. package/node_modules/fast-json-stringify/test/fix-604.test.js +25 -0
  1440. package/node_modules/fast-json-stringify/test/fixtures/.keep +0 -0
  1441. package/node_modules/fast-json-stringify/test/if-then-else.test.js +540 -0
  1442. package/node_modules/fast-json-stringify/test/inferType.test.js +92 -0
  1443. package/node_modules/fast-json-stringify/test/infinity.test.js +55 -0
  1444. package/node_modules/fast-json-stringify/test/integer.test.js +194 -0
  1445. package/node_modules/fast-json-stringify/test/invalidSchema.test.js +38 -0
  1446. package/node_modules/fast-json-stringify/test/issue-479.test.js +57 -0
  1447. package/node_modules/fast-json-stringify/test/issue-793.test.js +107 -0
  1448. package/node_modules/fast-json-stringify/test/issue-794.test.js +177 -0
  1449. package/node_modules/fast-json-stringify/test/issue-836.test.js +183 -0
  1450. package/node_modules/fast-json-stringify/test/json-add-comma.test.js +57 -0
  1451. package/node_modules/fast-json-stringify/test/json-schema-test-suite/README.md +10 -0
  1452. package/node_modules/fast-json-stringify/test/json-schema-test-suite/draft4/required.json +54 -0
  1453. package/node_modules/fast-json-stringify/test/json-schema-test-suite/draft4.test.js +12 -0
  1454. package/node_modules/fast-json-stringify/test/json-schema-test-suite/draft6/required.json +70 -0
  1455. package/node_modules/fast-json-stringify/test/json-schema-test-suite/draft6.test.js +12 -0
  1456. package/node_modules/fast-json-stringify/test/json-schema-test-suite/draft7/required.json +70 -0
  1457. package/node_modules/fast-json-stringify/test/json-schema-test-suite/draft7.test.js +12 -0
  1458. package/node_modules/fast-json-stringify/test/json-schema-test-suite/util.js +31 -0
  1459. package/node_modules/fast-json-stringify/test/missing-values.test.js +88 -0
  1460. package/node_modules/fast-json-stringify/test/multi-type-serializer.test.js +19 -0
  1461. package/node_modules/fast-json-stringify/test/nestedObjects.test.js +63 -0
  1462. package/node_modules/fast-json-stringify/test/nullable.test.js +543 -0
  1463. package/node_modules/fast-json-stringify/test/oneof.test.js +510 -0
  1464. package/node_modules/fast-json-stringify/test/patternProperties.test.js +168 -0
  1465. package/node_modules/fast-json-stringify/test/recursion.test.js +245 -0
  1466. package/node_modules/fast-json-stringify/test/ref.json +12 -0
  1467. package/node_modules/fast-json-stringify/test/ref.test.js +2077 -0
  1468. package/node_modules/fast-json-stringify/test/regex.test.js +32 -0
  1469. package/node_modules/fast-json-stringify/test/required.test.js +204 -0
  1470. package/node_modules/fast-json-stringify/test/requiresAjv.test.js +50 -0
  1471. package/node_modules/fast-json-stringify/test/sanitize.test.js +141 -0
  1472. package/node_modules/fast-json-stringify/test/sanitize2.test.js +18 -0
  1473. package/node_modules/fast-json-stringify/test/sanitize3.test.js +17 -0
  1474. package/node_modules/fast-json-stringify/test/sanitize4.test.js +16 -0
  1475. package/node_modules/fast-json-stringify/test/sanitize5.test.js +16 -0
  1476. package/node_modules/fast-json-stringify/test/sanitize6.test.js +22 -0
  1477. package/node_modules/fast-json-stringify/test/sanitize7.test.js +68 -0
  1478. package/node_modules/fast-json-stringify/test/side-effect.test.js +196 -0
  1479. package/node_modules/fast-json-stringify/test/standalone-mode.test.js +219 -0
  1480. package/node_modules/fast-json-stringify/test/string.test.js +84 -0
  1481. package/node_modules/fast-json-stringify/test/surrogate.test.js +67 -0
  1482. package/node_modules/fast-json-stringify/test/toJSON.test.js +203 -0
  1483. package/node_modules/fast-json-stringify/test/typebox.test.js +36 -0
  1484. package/node_modules/fast-json-stringify/test/typesArray.test.js +550 -0
  1485. package/node_modules/fast-json-stringify/test/unknownFormats.test.js +27 -0
  1486. package/node_modules/fast-json-stringify/test/webpack.test.js +50 -0
  1487. package/node_modules/fast-json-stringify/types/index.d.ts +231 -0
  1488. package/node_modules/fast-json-stringify/types/index.tst.ts +259 -0
  1489. package/node_modules/fast-querystring/LICENSE +25 -0
  1490. package/node_modules/fast-querystring/README.md +114 -0
  1491. package/node_modules/fast-querystring/lib/index.d.ts +14 -0
  1492. package/node_modules/fast-querystring/lib/index.js +20 -0
  1493. package/node_modules/fast-querystring/lib/internals/querystring.js +96 -0
  1494. package/node_modules/fast-querystring/lib/parse.js +126 -0
  1495. package/node_modules/fast-querystring/lib/stringify.js +69 -0
  1496. package/node_modules/fast-querystring/package.json +56 -0
  1497. package/node_modules/fast-uri/.gitattributes +2 -0
  1498. package/node_modules/fast-uri/.github/dependabot.yml +13 -0
  1499. package/node_modules/fast-uri/.github/workflows/ci.yml +106 -0
  1500. package/node_modules/fast-uri/.github/workflows/lock-threads.yml +19 -0
  1501. package/node_modules/fast-uri/.github/workflows/package-manager-ci.yml +24 -0
  1502. package/node_modules/fast-uri/LICENSE +30 -0
  1503. package/node_modules/fast-uri/README.md +152 -0
  1504. package/node_modules/fast-uri/benchmark/benchmark.mjs +159 -0
  1505. package/node_modules/fast-uri/benchmark/equal.mjs +51 -0
  1506. package/node_modules/fast-uri/benchmark/non-simple-domain.mjs +22 -0
  1507. package/node_modules/fast-uri/benchmark/package.json +17 -0
  1508. package/node_modules/fast-uri/benchmark/string-array-to-hex-stripped.mjs +24 -0
  1509. package/node_modules/fast-uri/benchmark/ws-is-secure.mjs +65 -0
  1510. package/node_modules/fast-uri/eslint.config.js +6 -0
  1511. package/node_modules/fast-uri/index.js +406 -0
  1512. package/node_modules/fast-uri/lib/schemes.js +267 -0
  1513. package/node_modules/fast-uri/lib/utils.js +443 -0
  1514. package/node_modules/fast-uri/package.json +68 -0
  1515. package/node_modules/fast-uri/test/ajv.test.js +43 -0
  1516. package/node_modules/fast-uri/test/equal.test.js +117 -0
  1517. package/node_modules/fast-uri/test/fixtures/uri-js-parse.json +501 -0
  1518. package/node_modules/fast-uri/test/fixtures/uri-js-serialize.json +120 -0
  1519. package/node_modules/fast-uri/test/parse.test.js +323 -0
  1520. package/node_modules/fast-uri/test/resolve.test.js +87 -0
  1521. package/node_modules/fast-uri/test/rfc-3986.test.js +90 -0
  1522. package/node_modules/fast-uri/test/security-normalization.test.js +39 -0
  1523. package/node_modules/fast-uri/test/security.test.js +133 -0
  1524. package/node_modules/fast-uri/test/serialize.test.js +151 -0
  1525. package/node_modules/fast-uri/test/uri-js-compatibility.test.js +33 -0
  1526. package/node_modules/fast-uri/test/uri-js.test.js +912 -0
  1527. package/node_modules/fast-uri/test/util.test.js +38 -0
  1528. package/node_modules/fast-uri/tsconfig.json +9 -0
  1529. package/node_modules/fast-uri/types/index.d.ts +60 -0
  1530. package/node_modules/fast-uri/types/index.test-d.ts +17 -0
  1531. package/node_modules/fastify/.borp.yaml +3 -0
  1532. package/node_modules/fastify/.markdownlint-cli2.yaml +22 -0
  1533. package/node_modules/fastify/.prettierignore +1 -0
  1534. package/node_modules/fastify/GOVERNANCE.md +4 -0
  1535. package/node_modules/fastify/LICENSE +21 -0
  1536. package/node_modules/fastify/PROJECT_CHARTER.md +126 -0
  1537. package/node_modules/fastify/README.md +423 -0
  1538. package/node_modules/fastify/SECURITY.md +220 -0
  1539. package/node_modules/fastify/SPONSORS.md +24 -0
  1540. package/node_modules/fastify/build/build-error-serializer.js +35 -0
  1541. package/node_modules/fastify/build/build-validation.js +169 -0
  1542. package/node_modules/fastify/build/sync-version.js +11 -0
  1543. package/node_modules/fastify/docs/Guides/Benchmarking.md +60 -0
  1544. package/node_modules/fastify/docs/Guides/Database.md +321 -0
  1545. package/node_modules/fastify/docs/Guides/Delay-Accepting-Requests.md +608 -0
  1546. package/node_modules/fastify/docs/Guides/Detecting-When-Clients-Abort.md +172 -0
  1547. package/node_modules/fastify/docs/Guides/Ecosystem.md +730 -0
  1548. package/node_modules/fastify/docs/Guides/Fluent-Schema.md +127 -0
  1549. package/node_modules/fastify/docs/Guides/Getting-Started.md +620 -0
  1550. package/node_modules/fastify/docs/Guides/Index.md +43 -0
  1551. package/node_modules/fastify/docs/Guides/Migration-Guide-V3.md +287 -0
  1552. package/node_modules/fastify/docs/Guides/Migration-Guide-V4.md +267 -0
  1553. package/node_modules/fastify/docs/Guides/Migration-Guide-V5.md +727 -0
  1554. package/node_modules/fastify/docs/Guides/Plugins-Guide.md +520 -0
  1555. package/node_modules/fastify/docs/Guides/Prototype-Poisoning.md +383 -0
  1556. package/node_modules/fastify/docs/Guides/Recommendations.md +378 -0
  1557. package/node_modules/fastify/docs/Guides/Serverless.md +604 -0
  1558. package/node_modules/fastify/docs/Guides/Style-Guide.md +246 -0
  1559. package/node_modules/fastify/docs/Guides/Testing.md +481 -0
  1560. package/node_modules/fastify/docs/Guides/Write-Plugin.md +103 -0
  1561. package/node_modules/fastify/docs/Guides/Write-Type-Provider.md +34 -0
  1562. package/node_modules/fastify/docs/Reference/ContentTypeParser.md +271 -0
  1563. package/node_modules/fastify/docs/Reference/Decorators.md +436 -0
  1564. package/node_modules/fastify/docs/Reference/Encapsulation.md +194 -0
  1565. package/node_modules/fastify/docs/Reference/Errors.md +377 -0
  1566. package/node_modules/fastify/docs/Reference/HTTP2.md +94 -0
  1567. package/node_modules/fastify/docs/Reference/Hooks.md +958 -0
  1568. package/node_modules/fastify/docs/Reference/Index.md +73 -0
  1569. package/node_modules/fastify/docs/Reference/LTS.md +86 -0
  1570. package/node_modules/fastify/docs/Reference/Lifecycle.md +99 -0
  1571. package/node_modules/fastify/docs/Reference/Logging.md +268 -0
  1572. package/node_modules/fastify/docs/Reference/Middleware.md +79 -0
  1573. package/node_modules/fastify/docs/Reference/Plugins.md +245 -0
  1574. package/node_modules/fastify/docs/Reference/Principles.md +73 -0
  1575. package/node_modules/fastify/docs/Reference/Reply.md +1001 -0
  1576. package/node_modules/fastify/docs/Reference/Request.md +295 -0
  1577. package/node_modules/fastify/docs/Reference/Routes.md +802 -0
  1578. package/node_modules/fastify/docs/Reference/Server.md +2389 -0
  1579. package/node_modules/fastify/docs/Reference/Type-Providers.md +256 -0
  1580. package/node_modules/fastify/docs/Reference/TypeScript.md +1729 -0
  1581. package/node_modules/fastify/docs/Reference/Validation-and-Serialization.md +1130 -0
  1582. package/node_modules/fastify/docs/Reference/Warnings.md +58 -0
  1583. package/node_modules/fastify/docs/index.md +24 -0
  1584. package/node_modules/fastify/docs/resources/encapsulation_context.drawio +1 -0
  1585. package/node_modules/fastify/docs/resources/encapsulation_context.svg +3 -0
  1586. package/node_modules/fastify/eslint.config.js +35 -0
  1587. package/node_modules/fastify/examples/asyncawait.js +38 -0
  1588. package/node_modules/fastify/examples/benchmark/body.json +3 -0
  1589. package/node_modules/fastify/examples/benchmark/hooks-benchmark-async-await.js +44 -0
  1590. package/node_modules/fastify/examples/benchmark/hooks-benchmark.js +52 -0
  1591. package/node_modules/fastify/examples/benchmark/parser.js +47 -0
  1592. package/node_modules/fastify/examples/benchmark/simple.js +30 -0
  1593. package/node_modules/fastify/examples/benchmark/webstream.js +27 -0
  1594. package/node_modules/fastify/examples/hooks.js +91 -0
  1595. package/node_modules/fastify/examples/http2.js +39 -0
  1596. package/node_modules/fastify/examples/https.js +38 -0
  1597. package/node_modules/fastify/examples/parser.js +53 -0
  1598. package/node_modules/fastify/examples/plugin.js +12 -0
  1599. package/node_modules/fastify/examples/route-prefix.js +38 -0
  1600. package/node_modules/fastify/examples/shared-schema.js +38 -0
  1601. package/node_modules/fastify/examples/simple-stream.js +20 -0
  1602. package/node_modules/fastify/examples/simple.js +32 -0
  1603. package/node_modules/fastify/examples/simple.mjs +27 -0
  1604. package/node_modules/fastify/examples/typescript-server.ts +79 -0
  1605. package/node_modules/fastify/examples/use-plugin.js +29 -0
  1606. package/node_modules/fastify/fastify.d.ts +253 -0
  1607. package/node_modules/fastify/fastify.js +985 -0
  1608. package/node_modules/fastify/integration/server.js +29 -0
  1609. package/node_modules/fastify/integration/test.sh +23 -0
  1610. package/node_modules/fastify/lib/config-validator.js +1266 -0
  1611. package/node_modules/fastify/lib/content-type-parser.js +413 -0
  1612. package/node_modules/fastify/lib/content-type.js +160 -0
  1613. package/node_modules/fastify/lib/context.js +98 -0
  1614. package/node_modules/fastify/lib/decorate.js +152 -0
  1615. package/node_modules/fastify/lib/error-handler.js +173 -0
  1616. package/node_modules/fastify/lib/error-serializer.js +134 -0
  1617. package/node_modules/fastify/lib/error-status.js +14 -0
  1618. package/node_modules/fastify/lib/errors.js +516 -0
  1619. package/node_modules/fastify/lib/four-oh-four.js +190 -0
  1620. package/node_modules/fastify/lib/handle-request.js +195 -0
  1621. package/node_modules/fastify/lib/head-route.js +45 -0
  1622. package/node_modules/fastify/lib/hooks.js +429 -0
  1623. package/node_modules/fastify/lib/initial-config-validation.js +37 -0
  1624. package/node_modules/fastify/lib/logger-factory.js +136 -0
  1625. package/node_modules/fastify/lib/logger-pino.js +68 -0
  1626. package/node_modules/fastify/lib/noop-set.js +10 -0
  1627. package/node_modules/fastify/lib/plugin-override.js +90 -0
  1628. package/node_modules/fastify/lib/plugin-utils.js +169 -0
  1629. package/node_modules/fastify/lib/promise.js +23 -0
  1630. package/node_modules/fastify/lib/reply.js +1030 -0
  1631. package/node_modules/fastify/lib/req-id-gen-factory.js +52 -0
  1632. package/node_modules/fastify/lib/request.js +387 -0
  1633. package/node_modules/fastify/lib/route.js +686 -0
  1634. package/node_modules/fastify/lib/schema-controller.js +164 -0
  1635. package/node_modules/fastify/lib/schemas.js +207 -0
  1636. package/node_modules/fastify/lib/server.js +441 -0
  1637. package/node_modules/fastify/lib/symbols.js +71 -0
  1638. package/node_modules/fastify/lib/validation.js +280 -0
  1639. package/node_modules/fastify/lib/warnings.js +57 -0
  1640. package/node_modules/fastify/lib/wrap-thenable.js +84 -0
  1641. package/node_modules/fastify/package.json +225 -0
  1642. package/node_modules/fastify/scripts/validate-ecosystem-links.js +179 -0
  1643. package/node_modules/fastify/test/404s.test.js +2035 -0
  1644. package/node_modules/fastify/test/500s.test.js +422 -0
  1645. package/node_modules/fastify/test/allow-unsafe-regex.test.js +92 -0
  1646. package/node_modules/fastify/test/als.test.js +65 -0
  1647. package/node_modules/fastify/test/async-await.test.js +705 -0
  1648. package/node_modules/fastify/test/async-dispose.test.js +20 -0
  1649. package/node_modules/fastify/test/async_hooks.test.js +52 -0
  1650. package/node_modules/fastify/test/body-limit.test.js +224 -0
  1651. package/node_modules/fastify/test/buffer.test.js +74 -0
  1652. package/node_modules/fastify/test/build/error-serializer.test.js +36 -0
  1653. package/node_modules/fastify/test/build/version.test.js +14 -0
  1654. package/node_modules/fastify/test/build-certificate.js +109 -0
  1655. package/node_modules/fastify/test/bundler/README.md +29 -0
  1656. package/node_modules/fastify/test/bundler/esbuild/bundler-test.js +32 -0
  1657. package/node_modules/fastify/test/bundler/esbuild/package.json +10 -0
  1658. package/node_modules/fastify/test/bundler/esbuild/src/fail-plugin-version.js +14 -0
  1659. package/node_modules/fastify/test/bundler/esbuild/src/index.js +9 -0
  1660. package/node_modules/fastify/test/bundler/webpack/bundler-test.js +32 -0
  1661. package/node_modules/fastify/test/bundler/webpack/package.json +11 -0
  1662. package/node_modules/fastify/test/bundler/webpack/src/fail-plugin-version.js +14 -0
  1663. package/node_modules/fastify/test/bundler/webpack/src/index.js +9 -0
  1664. package/node_modules/fastify/test/bundler/webpack/webpack.config.js +15 -0
  1665. package/node_modules/fastify/test/case-insensitive.test.js +102 -0
  1666. package/node_modules/fastify/test/chainable.test.js +40 -0
  1667. package/node_modules/fastify/test/child-logger-factory.test.js +128 -0
  1668. package/node_modules/fastify/test/client-timeout.test.js +38 -0
  1669. package/node_modules/fastify/test/close-pipelining.test.js +78 -0
  1670. package/node_modules/fastify/test/close.test.js +706 -0
  1671. package/node_modules/fastify/test/conditional-pino.test.js +47 -0
  1672. package/node_modules/fastify/test/connection-timeout.test.js +42 -0
  1673. package/node_modules/fastify/test/constrained-routes.test.js +1138 -0
  1674. package/node_modules/fastify/test/content-length.test.js +174 -0
  1675. package/node_modules/fastify/test/content-parser.test.js +739 -0
  1676. package/node_modules/fastify/test/content-type.test.js +181 -0
  1677. package/node_modules/fastify/test/context-config.test.js +164 -0
  1678. package/node_modules/fastify/test/custom-http-server.test.js +118 -0
  1679. package/node_modules/fastify/test/custom-parser-async.test.js +59 -0
  1680. package/node_modules/fastify/test/custom-parser.0.test.js +701 -0
  1681. package/node_modules/fastify/test/custom-parser.1.test.js +266 -0
  1682. package/node_modules/fastify/test/custom-parser.2.test.js +91 -0
  1683. package/node_modules/fastify/test/custom-parser.3.test.js +208 -0
  1684. package/node_modules/fastify/test/custom-parser.4.test.js +218 -0
  1685. package/node_modules/fastify/test/custom-parser.5.test.js +130 -0
  1686. package/node_modules/fastify/test/custom-querystring-parser.test.js +129 -0
  1687. package/node_modules/fastify/test/decorator.test.js +1330 -0
  1688. package/node_modules/fastify/test/delete.test.js +344 -0
  1689. package/node_modules/fastify/test/diagnostics-channel/404.test.js +49 -0
  1690. package/node_modules/fastify/test/diagnostics-channel/async-delay-request.test.js +65 -0
  1691. package/node_modules/fastify/test/diagnostics-channel/async-request.test.js +64 -0
  1692. package/node_modules/fastify/test/diagnostics-channel/error-before-handler.test.js +35 -0
  1693. package/node_modules/fastify/test/diagnostics-channel/error-request.test.js +53 -0
  1694. package/node_modules/fastify/test/diagnostics-channel/error-status.test.js +123 -0
  1695. package/node_modules/fastify/test/diagnostics-channel/init.test.js +50 -0
  1696. package/node_modules/fastify/test/diagnostics-channel/sync-delay-request.test.js +49 -0
  1697. package/node_modules/fastify/test/diagnostics-channel/sync-request-reply.test.js +51 -0
  1698. package/node_modules/fastify/test/diagnostics-channel/sync-request.test.js +54 -0
  1699. package/node_modules/fastify/test/encapsulated-child-logger-factory.test.js +69 -0
  1700. package/node_modules/fastify/test/encapsulated-error-handler.test.js +237 -0
  1701. package/node_modules/fastify/test/esm/errorCodes.test.mjs +10 -0
  1702. package/node_modules/fastify/test/esm/esm.test.mjs +13 -0
  1703. package/node_modules/fastify/test/esm/index.test.js +8 -0
  1704. package/node_modules/fastify/test/esm/named-exports.mjs +14 -0
  1705. package/node_modules/fastify/test/esm/other.mjs +8 -0
  1706. package/node_modules/fastify/test/esm/plugin.mjs +8 -0
  1707. package/node_modules/fastify/test/fastify-instance.test.js +300 -0
  1708. package/node_modules/fastify/test/find-route.test.js +152 -0
  1709. package/node_modules/fastify/test/fluent-schema.test.js +209 -0
  1710. package/node_modules/fastify/test/genReqId.test.js +426 -0
  1711. package/node_modules/fastify/test/handler-context.test.js +45 -0
  1712. package/node_modules/fastify/test/handler-timeout.test.js +367 -0
  1713. package/node_modules/fastify/test/has-route.test.js +88 -0
  1714. package/node_modules/fastify/test/header-overflow.test.js +55 -0
  1715. package/node_modules/fastify/test/helper.js +496 -0
  1716. package/node_modules/fastify/test/hooks-async.test.js +1099 -0
  1717. package/node_modules/fastify/test/hooks.on-listen.test.js +1162 -0
  1718. package/node_modules/fastify/test/hooks.on-ready.test.js +421 -0
  1719. package/node_modules/fastify/test/hooks.test.js +3578 -0
  1720. package/node_modules/fastify/test/http-methods/copy.test.js +35 -0
  1721. package/node_modules/fastify/test/http-methods/custom-http-methods.test.js +114 -0
  1722. package/node_modules/fastify/test/http-methods/get.test.js +412 -0
  1723. package/node_modules/fastify/test/http-methods/head.test.js +263 -0
  1724. package/node_modules/fastify/test/http-methods/lock.test.js +108 -0
  1725. package/node_modules/fastify/test/http-methods/mkcalendar.test.js +143 -0
  1726. package/node_modules/fastify/test/http-methods/mkcol.test.js +35 -0
  1727. package/node_modules/fastify/test/http-methods/move.test.js +42 -0
  1728. package/node_modules/fastify/test/http-methods/propfind.test.js +136 -0
  1729. package/node_modules/fastify/test/http-methods/proppatch.test.js +105 -0
  1730. package/node_modules/fastify/test/http-methods/report.test.js +142 -0
  1731. package/node_modules/fastify/test/http-methods/search.test.js +233 -0
  1732. package/node_modules/fastify/test/http-methods/trace.test.js +21 -0
  1733. package/node_modules/fastify/test/http-methods/unlock.test.js +38 -0
  1734. package/node_modules/fastify/test/http2/closing.test.js +270 -0
  1735. package/node_modules/fastify/test/http2/constraint.test.js +109 -0
  1736. package/node_modules/fastify/test/http2/head.test.js +34 -0
  1737. package/node_modules/fastify/test/http2/plain.test.js +68 -0
  1738. package/node_modules/fastify/test/http2/secure-with-fallback.test.js +113 -0
  1739. package/node_modules/fastify/test/http2/secure.test.js +67 -0
  1740. package/node_modules/fastify/test/http2/unknown-http-method.test.js +34 -0
  1741. package/node_modules/fastify/test/https/custom-https-server.test.js +58 -0
  1742. package/node_modules/fastify/test/https/https.test.js +136 -0
  1743. package/node_modules/fastify/test/imports.test.js +17 -0
  1744. package/node_modules/fastify/test/inject.test.js +502 -0
  1745. package/node_modules/fastify/test/input-validation.js +335 -0
  1746. package/node_modules/fastify/test/internals/all.test.js +38 -0
  1747. package/node_modules/fastify/test/internals/content-type-parser.test.js +111 -0
  1748. package/node_modules/fastify/test/internals/context.test.js +31 -0
  1749. package/node_modules/fastify/test/internals/decorator.test.js +156 -0
  1750. package/node_modules/fastify/test/internals/errors.test.js +982 -0
  1751. package/node_modules/fastify/test/internals/handle-request.test.js +270 -0
  1752. package/node_modules/fastify/test/internals/hook-runner.test.js +449 -0
  1753. package/node_modules/fastify/test/internals/hooks.test.js +96 -0
  1754. package/node_modules/fastify/test/internals/initial-config.test.js +383 -0
  1755. package/node_modules/fastify/test/internals/logger.test.js +163 -0
  1756. package/node_modules/fastify/test/internals/plugin.test.js +170 -0
  1757. package/node_modules/fastify/test/internals/promise.test.js +63 -0
  1758. package/node_modules/fastify/test/internals/reply-serialize.test.js +714 -0
  1759. package/node_modules/fastify/test/internals/reply.test.js +1920 -0
  1760. package/node_modules/fastify/test/internals/req-id-gen-factory.test.js +133 -0
  1761. package/node_modules/fastify/test/internals/request-validate.test.js +1402 -0
  1762. package/node_modules/fastify/test/internals/request.test.js +506 -0
  1763. package/node_modules/fastify/test/internals/schema-controller-perf.test.js +40 -0
  1764. package/node_modules/fastify/test/internals/server.test.js +91 -0
  1765. package/node_modules/fastify/test/internals/validation.test.js +352 -0
  1766. package/node_modules/fastify/test/issue-4959.test.js +118 -0
  1767. package/node_modules/fastify/test/keep-alive-timeout.test.js +42 -0
  1768. package/node_modules/fastify/test/listen.1.test.js +154 -0
  1769. package/node_modules/fastify/test/listen.2.test.js +113 -0
  1770. package/node_modules/fastify/test/listen.3.test.js +83 -0
  1771. package/node_modules/fastify/test/listen.4.test.js +168 -0
  1772. package/node_modules/fastify/test/listen.5.test.js +122 -0
  1773. package/node_modules/fastify/test/logger/instantiation.test.js +341 -0
  1774. package/node_modules/fastify/test/logger/logger-test-utils.js +47 -0
  1775. package/node_modules/fastify/test/logger/logging.test.js +460 -0
  1776. package/node_modules/fastify/test/logger/options.test.js +579 -0
  1777. package/node_modules/fastify/test/logger/request.test.js +292 -0
  1778. package/node_modules/fastify/test/logger/response.test.js +183 -0
  1779. package/node_modules/fastify/test/logger/tap-parallel-not-ok +0 -0
  1780. package/node_modules/fastify/test/max-requests-per-socket.test.js +113 -0
  1781. package/node_modules/fastify/test/middleware.test.js +37 -0
  1782. package/node_modules/fastify/test/noop-set.test.js +19 -0
  1783. package/node_modules/fastify/test/nullable-validation.test.js +187 -0
  1784. package/node_modules/fastify/test/options.error-handler.test.js +5 -0
  1785. package/node_modules/fastify/test/options.test.js +5 -0
  1786. package/node_modules/fastify/test/output-validation.test.js +140 -0
  1787. package/node_modules/fastify/test/patch.error-handler.test.js +5 -0
  1788. package/node_modules/fastify/test/patch.test.js +5 -0
  1789. package/node_modules/fastify/test/plugin.1.test.js +230 -0
  1790. package/node_modules/fastify/test/plugin.2.test.js +314 -0
  1791. package/node_modules/fastify/test/plugin.3.test.js +287 -0
  1792. package/node_modules/fastify/test/plugin.4.test.js +504 -0
  1793. package/node_modules/fastify/test/plugin.helper.js +8 -0
  1794. package/node_modules/fastify/test/plugin.name.display.js +10 -0
  1795. package/node_modules/fastify/test/post-empty-body.test.js +38 -0
  1796. package/node_modules/fastify/test/pretty-print.test.js +366 -0
  1797. package/node_modules/fastify/test/promises.test.js +125 -0
  1798. package/node_modules/fastify/test/proto-poisoning.test.js +145 -0
  1799. package/node_modules/fastify/test/put.error-handler.test.js +5 -0
  1800. package/node_modules/fastify/test/put.test.js +5 -0
  1801. package/node_modules/fastify/test/register.test.js +184 -0
  1802. package/node_modules/fastify/test/reply-code.test.js +148 -0
  1803. package/node_modules/fastify/test/reply-early-hints.test.js +100 -0
  1804. package/node_modules/fastify/test/reply-error.test.js +815 -0
  1805. package/node_modules/fastify/test/reply-trailers.test.js +445 -0
  1806. package/node_modules/fastify/test/reply-web-stream-locked.test.js +37 -0
  1807. package/node_modules/fastify/test/request-error.test.js +624 -0
  1808. package/node_modules/fastify/test/request-header-host.test.js +339 -0
  1809. package/node_modules/fastify/test/request-id.test.js +118 -0
  1810. package/node_modules/fastify/test/request-port.test.js +72 -0
  1811. package/node_modules/fastify/test/request-timeout.test.js +53 -0
  1812. package/node_modules/fastify/test/route-hooks.test.js +635 -0
  1813. package/node_modules/fastify/test/route-prefix.test.js +904 -0
  1814. package/node_modules/fastify/test/route-shorthand.test.js +48 -0
  1815. package/node_modules/fastify/test/route.1.test.js +259 -0
  1816. package/node_modules/fastify/test/route.2.test.js +100 -0
  1817. package/node_modules/fastify/test/route.3.test.js +213 -0
  1818. package/node_modules/fastify/test/route.4.test.js +127 -0
  1819. package/node_modules/fastify/test/route.5.test.js +211 -0
  1820. package/node_modules/fastify/test/route.6.test.js +306 -0
  1821. package/node_modules/fastify/test/route.7.test.js +406 -0
  1822. package/node_modules/fastify/test/route.8.test.js +225 -0
  1823. package/node_modules/fastify/test/router-options.test.js +1108 -0
  1824. package/node_modules/fastify/test/same-shape.test.js +124 -0
  1825. package/node_modules/fastify/test/schema-examples.test.js +661 -0
  1826. package/node_modules/fastify/test/schema-feature.test.js +2198 -0
  1827. package/node_modules/fastify/test/schema-serialization.test.js +1171 -0
  1828. package/node_modules/fastify/test/schema-special-usage.test.js +1348 -0
  1829. package/node_modules/fastify/test/schema-validation.test.js +1593 -0
  1830. package/node_modules/fastify/test/scripts/validate-ecosystem-links.test.js +339 -0
  1831. package/node_modules/fastify/test/serialize-response.test.js +186 -0
  1832. package/node_modules/fastify/test/server.test.js +347 -0
  1833. package/node_modules/fastify/test/set-error-handler.test.js +69 -0
  1834. package/node_modules/fastify/test/skip-reply-send.test.js +317 -0
  1835. package/node_modules/fastify/test/stream-serializers.test.js +40 -0
  1836. package/node_modules/fastify/test/stream.1.test.js +94 -0
  1837. package/node_modules/fastify/test/stream.2.test.js +129 -0
  1838. package/node_modules/fastify/test/stream.3.test.js +198 -0
  1839. package/node_modules/fastify/test/stream.4.test.js +176 -0
  1840. package/node_modules/fastify/test/stream.5.test.js +188 -0
  1841. package/node_modules/fastify/test/sync-routes.test.js +32 -0
  1842. package/node_modules/fastify/test/throw.test.js +359 -0
  1843. package/node_modules/fastify/test/toolkit.js +63 -0
  1844. package/node_modules/fastify/test/trust-proxy.test.js +274 -0
  1845. package/node_modules/fastify/test/type-provider.test.js +22 -0
  1846. package/node_modules/fastify/test/types/content-type-parser.test-d.ts +72 -0
  1847. package/node_modules/fastify/test/types/decorate-request-reply.test-d.ts +18 -0
  1848. package/node_modules/fastify/test/types/dummy-plugin.ts +9 -0
  1849. package/node_modules/fastify/test/types/errors.test-d.ts +90 -0
  1850. package/node_modules/fastify/test/types/fastify.test-d.ts +352 -0
  1851. package/node_modules/fastify/test/types/hooks.test-d.ts +550 -0
  1852. package/node_modules/fastify/test/types/import.ts +2 -0
  1853. package/node_modules/fastify/test/types/instance.test-d.ts +588 -0
  1854. package/node_modules/fastify/test/types/logger.test-d.ts +277 -0
  1855. package/node_modules/fastify/test/types/plugin.test-d.ts +97 -0
  1856. package/node_modules/fastify/test/types/register.test-d.ts +237 -0
  1857. package/node_modules/fastify/test/types/reply.test-d.ts +254 -0
  1858. package/node_modules/fastify/test/types/request.test-d.ts +188 -0
  1859. package/node_modules/fastify/test/types/route.test-d.ts +553 -0
  1860. package/node_modules/fastify/test/types/schema.test-d.ts +135 -0
  1861. package/node_modules/fastify/test/types/serverFactory.test-d.ts +37 -0
  1862. package/node_modules/fastify/test/types/type-provider.test-d.ts +1213 -0
  1863. package/node_modules/fastify/test/types/using.test-d.ts +17 -0
  1864. package/node_modules/fastify/test/upgrade.test.js +52 -0
  1865. package/node_modules/fastify/test/url-rewriting.test.js +122 -0
  1866. package/node_modules/fastify/test/use-semicolon-delimiter.test.js +168 -0
  1867. package/node_modules/fastify/test/validation-error-handling.test.js +900 -0
  1868. package/node_modules/fastify/test/versioned-routes.test.js +603 -0
  1869. package/node_modules/fastify/test/web-api.test.js +616 -0
  1870. package/node_modules/fastify/test/wrap-thenable.test.js +30 -0
  1871. package/node_modules/fastify/types/content-type-parser.d.ts +75 -0
  1872. package/node_modules/fastify/types/context.d.ts +22 -0
  1873. package/node_modules/fastify/types/errors.d.ts +92 -0
  1874. package/node_modules/fastify/types/hooks.d.ts +875 -0
  1875. package/node_modules/fastify/types/instance.d.ts +609 -0
  1876. package/node_modules/fastify/types/logger.d.ts +107 -0
  1877. package/node_modules/fastify/types/plugin.d.ts +44 -0
  1878. package/node_modules/fastify/types/register.d.ts +42 -0
  1879. package/node_modules/fastify/types/reply.d.ts +81 -0
  1880. package/node_modules/fastify/types/request.d.ts +95 -0
  1881. package/node_modules/fastify/types/route.d.ts +199 -0
  1882. package/node_modules/fastify/types/schema.d.ts +61 -0
  1883. package/node_modules/fastify/types/server-factory.d.ts +19 -0
  1884. package/node_modules/fastify/types/type-provider.d.ts +130 -0
  1885. package/node_modules/fastify/types/utils.d.ts +98 -0
  1886. package/node_modules/fastify-plugin/.gitattributes +2 -0
  1887. package/node_modules/fastify-plugin/.github/dependabot.yml +13 -0
  1888. package/node_modules/fastify-plugin/.github/stale.yml +21 -0
  1889. package/node_modules/fastify-plugin/.github/workflows/ci.yml +28 -0
  1890. package/node_modules/fastify-plugin/LICENSE +23 -0
  1891. package/node_modules/fastify-plugin/README.md +188 -0
  1892. package/node_modules/fastify-plugin/eslint.config.js +6 -0
  1893. package/node_modules/fastify-plugin/lib/getPluginName.js +25 -0
  1894. package/node_modules/fastify-plugin/lib/toCamelCase.js +10 -0
  1895. package/node_modules/fastify-plugin/package.json +70 -0
  1896. package/node_modules/fastify-plugin/plugin.js +67 -0
  1897. package/node_modules/fastify-plugin/test/bundlers.test.js +110 -0
  1898. package/node_modules/fastify-plugin/test/checkVersion.test.js +67 -0
  1899. package/node_modules/fastify-plugin/test/composite.test.js +14 -0
  1900. package/node_modules/fastify-plugin/test/esm/esm.mjs +11 -0
  1901. package/node_modules/fastify-plugin/test/esm/index.test.js +11 -0
  1902. package/node_modules/fastify-plugin/test/extractPluginName.test.js +49 -0
  1903. package/node_modules/fastify-plugin/test/mu1tip1e.composite.test.js +15 -0
  1904. package/node_modules/fastify-plugin/test/test.js +396 -0
  1905. package/node_modules/fastify-plugin/test/toCamelCase.test.js +24 -0
  1906. package/node_modules/fastify-plugin/types/example-async.test-d.ts +19 -0
  1907. package/node_modules/fastify-plugin/types/example-callback.test-d.ts +19 -0
  1908. package/node_modules/fastify-plugin/types/plugin.d.ts +61 -0
  1909. package/node_modules/fastify-plugin/types/plugin.test-d.ts +166 -0
  1910. package/node_modules/fastq/LICENSE +13 -0
  1911. package/node_modules/fastq/README.md +310 -0
  1912. package/node_modules/fastq/SECURITY.md +15 -0
  1913. package/node_modules/fastq/bench.js +66 -0
  1914. package/node_modules/fastq/eslint.config.js +11 -0
  1915. package/node_modules/fastq/example.js +14 -0
  1916. package/node_modules/fastq/example.mjs +9 -0
  1917. package/node_modules/fastq/index.d.ts +59 -0
  1918. package/node_modules/fastq/package.json +49 -0
  1919. package/node_modules/fastq/queue.js +346 -0
  1920. package/node_modules/fastq/test/example.ts +83 -0
  1921. package/node_modules/fastq/test/promise.js +325 -0
  1922. package/node_modules/fastq/test/test.js +733 -0
  1923. package/node_modules/fastq/test/tsconfig.json +11 -0
  1924. package/node_modules/find-my-way/.github/dependabot.yml +34 -0
  1925. package/node_modules/find-my-way/.github/workflows/node.js.yml +68 -0
  1926. package/node_modules/find-my-way/LICENSE +21 -0
  1927. package/node_modules/find-my-way/README.md +885 -0
  1928. package/node_modules/find-my-way/benchmark/bench-thread.js +35 -0
  1929. package/node_modules/find-my-way/benchmark/bench.js +156 -0
  1930. package/node_modules/find-my-way/benchmark/compare-branches.js +113 -0
  1931. package/node_modules/find-my-way/benchmark/uri-decoding.js +55 -0
  1932. package/node_modules/find-my-way/example.js +29 -0
  1933. package/node_modules/find-my-way/index.d.ts +247 -0
  1934. package/node_modules/find-my-way/index.js +872 -0
  1935. package/node_modules/find-my-way/lib/constrainer.js +172 -0
  1936. package/node_modules/find-my-way/lib/handler-storage.js +175 -0
  1937. package/node_modules/find-my-way/lib/http-methods.js +13 -0
  1938. package/node_modules/find-my-way/lib/node.js +228 -0
  1939. package/node_modules/find-my-way/lib/null-object.js +8 -0
  1940. package/node_modules/find-my-way/lib/pretty-print.js +168 -0
  1941. package/node_modules/find-my-way/lib/strategies/accept-host.js +36 -0
  1942. package/node_modules/find-my-way/lib/strategies/accept-version.js +64 -0
  1943. package/node_modules/find-my-way/lib/strategies/http-method.js +15 -0
  1944. package/node_modules/find-my-way/lib/url-sanitizer.js +105 -0
  1945. package/node_modules/find-my-way/package.json +57 -0
  1946. package/node_modules/find-my-way/test/case-insensitive.test.js +230 -0
  1947. package/node_modules/find-my-way/test/constraint.custom-versioning.test.js +130 -0
  1948. package/node_modules/find-my-way/test/constraint.custom.async.test.js +111 -0
  1949. package/node_modules/find-my-way/test/constraint.custom.test.js +273 -0
  1950. package/node_modules/find-my-way/test/constraint.default-versioning.test.js +289 -0
  1951. package/node_modules/find-my-way/test/constraint.host.test.js +104 -0
  1952. package/node_modules/find-my-way/test/constraints.test.js +108 -0
  1953. package/node_modules/find-my-way/test/custom-querystring-parser.test.js +46 -0
  1954. package/node_modules/find-my-way/test/errors.test.js +484 -0
  1955. package/node_modules/find-my-way/test/fastify-issue-3129.test.js +34 -0
  1956. package/node_modules/find-my-way/test/fastify-issue-3957.test.js +23 -0
  1957. package/node_modules/find-my-way/test/find-route.test.js +275 -0
  1958. package/node_modules/find-my-way/test/find.test.js +16 -0
  1959. package/node_modules/find-my-way/test/for-in-loop.test.js +22 -0
  1960. package/node_modules/find-my-way/test/full-url.test.js +30 -0
  1961. package/node_modules/find-my-way/test/has-route.test.js +218 -0
  1962. package/node_modules/find-my-way/test/host-storage.test.js +27 -0
  1963. package/node_modules/find-my-way/test/http2/constraint.host.test.js +44 -0
  1964. package/node_modules/find-my-way/test/issue-101.test.js +31 -0
  1965. package/node_modules/find-my-way/test/issue-104.test.js +206 -0
  1966. package/node_modules/find-my-way/test/issue-110.test.js +31 -0
  1967. package/node_modules/find-my-way/test/issue-132.test.js +80 -0
  1968. package/node_modules/find-my-way/test/issue-145.test.js +24 -0
  1969. package/node_modules/find-my-way/test/issue-149.test.js +21 -0
  1970. package/node_modules/find-my-way/test/issue-151.test.js +54 -0
  1971. package/node_modules/find-my-way/test/issue-154.test.js +21 -0
  1972. package/node_modules/find-my-way/test/issue-161.test.js +88 -0
  1973. package/node_modules/find-my-way/test/issue-17.test.js +397 -0
  1974. package/node_modules/find-my-way/test/issue-175.test.js +80 -0
  1975. package/node_modules/find-my-way/test/issue-182.test.js +18 -0
  1976. package/node_modules/find-my-way/test/issue-190.test.js +44 -0
  1977. package/node_modules/find-my-way/test/issue-20.test.js +79 -0
  1978. package/node_modules/find-my-way/test/issue-206.test.js +121 -0
  1979. package/node_modules/find-my-way/test/issue-221.test.js +50 -0
  1980. package/node_modules/find-my-way/test/issue-234.test.js +94 -0
  1981. package/node_modules/find-my-way/test/issue-238.test.js +119 -0
  1982. package/node_modules/find-my-way/test/issue-240.test.js +30 -0
  1983. package/node_modules/find-my-way/test/issue-241.test.js +32 -0
  1984. package/node_modules/find-my-way/test/issue-247.test.js +51 -0
  1985. package/node_modules/find-my-way/test/issue-254.test.js +31 -0
  1986. package/node_modules/find-my-way/test/issue-28.test.js +618 -0
  1987. package/node_modules/find-my-way/test/issue-280.test.js +14 -0
  1988. package/node_modules/find-my-way/test/issue-285.test.js +37 -0
  1989. package/node_modules/find-my-way/test/issue-330.test.js +231 -0
  1990. package/node_modules/find-my-way/test/issue-44.test.js +149 -0
  1991. package/node_modules/find-my-way/test/issue-46.test.js +75 -0
  1992. package/node_modules/find-my-way/test/issue-49.test.js +108 -0
  1993. package/node_modules/find-my-way/test/issue-59.test.js +131 -0
  1994. package/node_modules/find-my-way/test/issue-62.test.js +28 -0
  1995. package/node_modules/find-my-way/test/issue-63.test.js +23 -0
  1996. package/node_modules/find-my-way/test/issue-67.test.js +50 -0
  1997. package/node_modules/find-my-way/test/issue-93.test.js +19 -0
  1998. package/node_modules/find-my-way/test/lookup-async.test.js +29 -0
  1999. package/node_modules/find-my-way/test/lookup.test.js +58 -0
  2000. package/node_modules/find-my-way/test/matching-order.test.js +17 -0
  2001. package/node_modules/find-my-way/test/max-param-length.test.js +44 -0
  2002. package/node_modules/find-my-way/test/methods.test.js +830 -0
  2003. package/node_modules/find-my-way/test/null-object.test.js +36 -0
  2004. package/node_modules/find-my-way/test/on-bad-url.test.js +72 -0
  2005. package/node_modules/find-my-way/test/optional-params.test.js +216 -0
  2006. package/node_modules/find-my-way/test/params-collisions.test.js +126 -0
  2007. package/node_modules/find-my-way/test/path-params-match.test.js +53 -0
  2008. package/node_modules/find-my-way/test/path-utils.test.js +68 -0
  2009. package/node_modules/find-my-way/test/pretty-print-tree.test.js +596 -0
  2010. package/node_modules/find-my-way/test/pretty-print.test.js +680 -0
  2011. package/node_modules/find-my-way/test/querystring.test.js +54 -0
  2012. package/node_modules/find-my-way/test/regex.test.js +269 -0
  2013. package/node_modules/find-my-way/test/repro-issue-414.test.js +57 -0
  2014. package/node_modules/find-my-way/test/routes-registered.test.js +45 -0
  2015. package/node_modules/find-my-way/test/server.test.js +368 -0
  2016. package/node_modules/find-my-way/test/shorthands.test.js +44 -0
  2017. package/node_modules/find-my-way/test/store.test.js +49 -0
  2018. package/node_modules/find-my-way/test/types/router.test-d.ts +188 -0
  2019. package/node_modules/find-my-way/test/url-sanitizer.test.js +43 -0
  2020. package/node_modules/glob/LICENSE.md +63 -0
  2021. package/node_modules/glob/README.md +1203 -0
  2022. package/node_modules/glob/dist/commonjs/glob.d.ts +396 -0
  2023. package/node_modules/glob/dist/commonjs/glob.d.ts.map +1 -0
  2024. package/node_modules/glob/dist/commonjs/glob.js +248 -0
  2025. package/node_modules/glob/dist/commonjs/glob.js.map +1 -0
  2026. package/node_modules/glob/dist/commonjs/has-magic.d.ts +14 -0
  2027. package/node_modules/glob/dist/commonjs/has-magic.d.ts.map +1 -0
  2028. package/node_modules/glob/dist/commonjs/has-magic.js +27 -0
  2029. package/node_modules/glob/dist/commonjs/has-magic.js.map +1 -0
  2030. package/node_modules/glob/dist/commonjs/ignore.d.ts +24 -0
  2031. package/node_modules/glob/dist/commonjs/ignore.d.ts.map +1 -0
  2032. package/node_modules/glob/dist/commonjs/ignore.js +119 -0
  2033. package/node_modules/glob/dist/commonjs/ignore.js.map +1 -0
  2034. package/node_modules/glob/dist/commonjs/index.d.ts +97 -0
  2035. package/node_modules/glob/dist/commonjs/index.d.ts.map +1 -0
  2036. package/node_modules/glob/dist/commonjs/index.js +68 -0
  2037. package/node_modules/glob/dist/commonjs/index.js.map +1 -0
  2038. package/node_modules/glob/dist/commonjs/index.min.js +4 -0
  2039. package/node_modules/glob/dist/commonjs/index.min.js.map +7 -0
  2040. package/node_modules/glob/dist/commonjs/package.json +3 -0
  2041. package/node_modules/glob/dist/commonjs/pattern.d.ts +79 -0
  2042. package/node_modules/glob/dist/commonjs/pattern.d.ts.map +1 -0
  2043. package/node_modules/glob/dist/commonjs/pattern.js +223 -0
  2044. package/node_modules/glob/dist/commonjs/pattern.js.map +1 -0
  2045. package/node_modules/glob/dist/commonjs/processor.d.ts +59 -0
  2046. package/node_modules/glob/dist/commonjs/processor.d.ts.map +1 -0
  2047. package/node_modules/glob/dist/commonjs/processor.js +301 -0
  2048. package/node_modules/glob/dist/commonjs/processor.js.map +1 -0
  2049. package/node_modules/glob/dist/commonjs/walker.d.ts +97 -0
  2050. package/node_modules/glob/dist/commonjs/walker.d.ts.map +1 -0
  2051. package/node_modules/glob/dist/commonjs/walker.js +387 -0
  2052. package/node_modules/glob/dist/commonjs/walker.js.map +1 -0
  2053. package/node_modules/glob/dist/esm/glob.d.ts +396 -0
  2054. package/node_modules/glob/dist/esm/glob.d.ts.map +1 -0
  2055. package/node_modules/glob/dist/esm/glob.js +244 -0
  2056. package/node_modules/glob/dist/esm/glob.js.map +1 -0
  2057. package/node_modules/glob/dist/esm/has-magic.d.ts +14 -0
  2058. package/node_modules/glob/dist/esm/has-magic.d.ts.map +1 -0
  2059. package/node_modules/glob/dist/esm/has-magic.js +23 -0
  2060. package/node_modules/glob/dist/esm/has-magic.js.map +1 -0
  2061. package/node_modules/glob/dist/esm/ignore.d.ts +24 -0
  2062. package/node_modules/glob/dist/esm/ignore.d.ts.map +1 -0
  2063. package/node_modules/glob/dist/esm/ignore.js +115 -0
  2064. package/node_modules/glob/dist/esm/ignore.js.map +1 -0
  2065. package/node_modules/glob/dist/esm/index.d.ts +97 -0
  2066. package/node_modules/glob/dist/esm/index.d.ts.map +1 -0
  2067. package/node_modules/glob/dist/esm/index.js +55 -0
  2068. package/node_modules/glob/dist/esm/index.js.map +1 -0
  2069. package/node_modules/glob/dist/esm/index.min.js +4 -0
  2070. package/node_modules/glob/dist/esm/index.min.js.map +7 -0
  2071. package/node_modules/glob/dist/esm/package.json +3 -0
  2072. package/node_modules/glob/dist/esm/pattern.d.ts +79 -0
  2073. package/node_modules/glob/dist/esm/pattern.d.ts.map +1 -0
  2074. package/node_modules/glob/dist/esm/pattern.js +219 -0
  2075. package/node_modules/glob/dist/esm/pattern.js.map +1 -0
  2076. package/node_modules/glob/dist/esm/processor.d.ts +59 -0
  2077. package/node_modules/glob/dist/esm/processor.d.ts.map +1 -0
  2078. package/node_modules/glob/dist/esm/processor.js +294 -0
  2079. package/node_modules/glob/dist/esm/processor.js.map +1 -0
  2080. package/node_modules/glob/dist/esm/walker.d.ts +97 -0
  2081. package/node_modules/glob/dist/esm/walker.d.ts.map +1 -0
  2082. package/node_modules/glob/dist/esm/walker.js +381 -0
  2083. package/node_modules/glob/dist/esm/walker.js.map +1 -0
  2084. package/node_modules/glob/package.json +98 -0
  2085. package/node_modules/http-errors/HISTORY.md +186 -0
  2086. package/node_modules/http-errors/LICENSE +23 -0
  2087. package/node_modules/http-errors/README.md +169 -0
  2088. package/node_modules/http-errors/index.js +290 -0
  2089. package/node_modules/http-errors/package.json +54 -0
  2090. package/node_modules/inherits/LICENSE +16 -0
  2091. package/node_modules/inherits/README.md +42 -0
  2092. package/node_modules/inherits/inherits.js +9 -0
  2093. package/node_modules/inherits/inherits_browser.js +27 -0
  2094. package/node_modules/inherits/package.json +29 -0
  2095. package/node_modules/ipaddr.js/LICENSE +19 -0
  2096. package/node_modules/ipaddr.js/README.md +229 -0
  2097. package/node_modules/ipaddr.js/ipaddr.min.js +1 -0
  2098. package/node_modules/ipaddr.js/lib/ipaddr.js +1082 -0
  2099. package/node_modules/ipaddr.js/lib/ipaddr.js.d.ts +72 -0
  2100. package/node_modules/ipaddr.js/package.json +36 -0
  2101. package/node_modules/jishushell-panel/LICENSE +6 -0
  2102. package/node_modules/jishushell-panel/README.md +47 -0
  2103. package/node_modules/jishushell-panel/output/dist/server.d.ts +13 -0
  2104. package/node_modules/jishushell-panel/output/dist/server.js +466 -0
  2105. package/node_modules/jishushell-panel/output/dist/server.js.map +1 -0
  2106. package/node_modules/jishushell-panel/output/public/assets/ApiKeyField-NKcbHjNz.js +1 -0
  2107. package/node_modules/jishushell-panel/output/public/assets/Dashboard-Da1fL38t.js +1 -0
  2108. package/node_modules/jishushell-panel/output/public/assets/HermesChatPanel-DZvmYsoh.js +1 -0
  2109. package/node_modules/jishushell-panel/output/public/assets/HermesConfigForm-BLUWlKwm.js +4 -0
  2110. package/node_modules/jishushell-panel/output/public/assets/InitPassword-BAKsshzk.js +1 -0
  2111. package/node_modules/jishushell-panel/output/public/assets/InstanceDetail-Dgyc_TX5.js +14 -0
  2112. package/node_modules/jishushell-panel/output/public/assets/Login-DHeOmwI8.js +1 -0
  2113. package/node_modules/jishushell-panel/output/public/assets/NewInstance-CIy0cYtp.js +1 -0
  2114. package/node_modules/jishushell-panel/output/public/assets/ProviderRecommendations-H0ByEYF0.js +1 -0
  2115. package/node_modules/jishushell-panel/output/public/assets/Settings-DAT-UMfP.js +1 -0
  2116. package/node_modules/jishushell-panel/output/public/assets/Setup-g3uckFYR.js +1 -0
  2117. package/node_modules/jishushell-panel/output/public/assets/WeixinLoginPanel-D-T6BxkQ.js +1 -0
  2118. package/node_modules/jishushell-panel/output/public/assets/api-C70Gt678.js +4 -0
  2119. package/node_modules/jishushell-panel/output/public/assets/index-DnnqTf7s.css +1 -0
  2120. package/node_modules/jishushell-panel/output/public/assets/index-ERt6_ngA.js +23 -0
  2121. package/node_modules/jishushell-panel/output/public/assets/registry-DF93EzIb.js +2 -0
  2122. package/node_modules/jishushell-panel/output/public/assets/rolldown-runtime-QTnfLwEv.js +1 -0
  2123. package/node_modules/jishushell-panel/output/public/assets/setup-task-q21GnI0E.js +1 -0
  2124. package/node_modules/jishushell-panel/output/public/assets/usePolling-DeoThIQn.js +1 -0
  2125. package/node_modules/jishushell-panel/output/public/assets/vendor-i18n-CS8DFbkQ.js +1 -0
  2126. package/node_modules/jishushell-panel/output/public/assets/vendor-react-Cc84NArf.js +8 -0
  2127. package/node_modules/jishushell-panel/output/public/index.html +22 -0
  2128. package/node_modules/jishushell-panel/package.json +33 -0
  2129. package/node_modules/json-schema-ref-resolver/.gitattributes +2 -0
  2130. package/node_modules/json-schema-ref-resolver/.github/dependabot.yml +13 -0
  2131. package/node_modules/json-schema-ref-resolver/.github/workflows/ci.yml +25 -0
  2132. package/node_modules/json-schema-ref-resolver/LICENSE +21 -0
  2133. package/node_modules/json-schema-ref-resolver/README.md +406 -0
  2134. package/node_modules/json-schema-ref-resolver/eslint.config.js +6 -0
  2135. package/node_modules/json-schema-ref-resolver/index.js +284 -0
  2136. package/node_modules/json-schema-ref-resolver/package.json +76 -0
  2137. package/node_modules/json-schema-ref-resolver/test/anchor.test.js +56 -0
  2138. package/node_modules/json-schema-ref-resolver/test/collisions.test.js +199 -0
  2139. package/node_modules/json-schema-ref-resolver/test/deref-schema.test.js +287 -0
  2140. package/node_modules/json-schema-ref-resolver/test/get-deref-schema.test.js +363 -0
  2141. package/node_modules/json-schema-ref-resolver/test/get-schema-dependencies.test.js +158 -0
  2142. package/node_modules/json-schema-ref-resolver/test/get-schema-refs.test.js +87 -0
  2143. package/node_modules/json-schema-ref-resolver/test/get-schema.test.js +222 -0
  2144. package/node_modules/json-schema-ref-resolver/test/has-schema.test.js +28 -0
  2145. package/node_modules/json-schema-ref-resolver/types/index.d.ts +67 -0
  2146. package/node_modules/json-schema-ref-resolver/types/index.test-d.ts +23 -0
  2147. package/node_modules/json-schema-traverse/.eslintrc.yml +27 -0
  2148. package/node_modules/json-schema-traverse/.github/FUNDING.yml +2 -0
  2149. package/node_modules/json-schema-traverse/.github/workflows/build.yml +28 -0
  2150. package/node_modules/json-schema-traverse/.github/workflows/publish.yml +27 -0
  2151. package/node_modules/json-schema-traverse/LICENSE +21 -0
  2152. package/node_modules/json-schema-traverse/README.md +95 -0
  2153. package/node_modules/json-schema-traverse/index.d.ts +40 -0
  2154. package/node_modules/json-schema-traverse/index.js +93 -0
  2155. package/node_modules/json-schema-traverse/package.json +43 -0
  2156. package/node_modules/json-schema-traverse/spec/.eslintrc.yml +6 -0
  2157. package/node_modules/json-schema-traverse/spec/fixtures/schema.js +125 -0
  2158. package/node_modules/json-schema-traverse/spec/index.spec.js +171 -0
  2159. package/node_modules/light-my-request/.gitattributes +2 -0
  2160. package/node_modules/light-my-request/.github/dependabot.yml +13 -0
  2161. package/node_modules/light-my-request/.github/stale.yml +21 -0
  2162. package/node_modules/light-my-request/.github/workflows/benchmark.yml +30 -0
  2163. package/node_modules/light-my-request/.github/workflows/ci.yml +23 -0
  2164. package/node_modules/light-my-request/LICENSE +32 -0
  2165. package/node_modules/light-my-request/README.md +261 -0
  2166. package/node_modules/light-my-request/benchmark/benchmark.js +164 -0
  2167. package/node_modules/light-my-request/build/build-validation.js +100 -0
  2168. package/node_modules/light-my-request/eslint.config.js +9 -0
  2169. package/node_modules/light-my-request/index.js +194 -0
  2170. package/node_modules/light-my-request/lib/config-validator.js +919 -0
  2171. package/node_modules/light-my-request/lib/form-data.js +79 -0
  2172. package/node_modules/light-my-request/lib/parse-url.js +47 -0
  2173. package/node_modules/light-my-request/lib/request.js +290 -0
  2174. package/node_modules/light-my-request/lib/response.js +240 -0
  2175. package/node_modules/light-my-request/node_modules/process-warning/.gitattributes +2 -0
  2176. package/node_modules/light-my-request/node_modules/process-warning/.github/dependabot.yml +13 -0
  2177. package/node_modules/light-my-request/node_modules/process-warning/.github/workflows/ci.yml +24 -0
  2178. package/node_modules/light-my-request/node_modules/process-warning/.taprc +2 -0
  2179. package/node_modules/light-my-request/node_modules/process-warning/LICENSE +21 -0
  2180. package/node_modules/light-my-request/node_modules/process-warning/README.md +118 -0
  2181. package/node_modules/light-my-request/node_modules/process-warning/benchmarks/warn.js +25 -0
  2182. package/node_modules/light-my-request/node_modules/process-warning/eslint.config.js +6 -0
  2183. package/node_modules/light-my-request/node_modules/process-warning/examples/example.js +11 -0
  2184. package/node_modules/light-my-request/node_modules/process-warning/index.js +124 -0
  2185. package/node_modules/light-my-request/node_modules/process-warning/package.json +73 -0
  2186. package/node_modules/light-my-request/node_modules/process-warning/test/emit-interpolated-string.test.js +29 -0
  2187. package/node_modules/light-my-request/node_modules/process-warning/test/emit-once-only.test.js +28 -0
  2188. package/node_modules/light-my-request/node_modules/process-warning/test/emit-reset.test.js +36 -0
  2189. package/node_modules/light-my-request/node_modules/process-warning/test/emit-set.test.js +30 -0
  2190. package/node_modules/light-my-request/node_modules/process-warning/test/emit-unlimited.test.js +37 -0
  2191. package/node_modules/light-my-request/node_modules/process-warning/test/index.test.js +99 -0
  2192. package/node_modules/light-my-request/node_modules/process-warning/test/issue-88.test.js +33 -0
  2193. package/node_modules/light-my-request/node_modules/process-warning/test/jest.test.js +22 -0
  2194. package/node_modules/light-my-request/node_modules/process-warning/test/no-warnings.test.js +80 -0
  2195. package/node_modules/light-my-request/node_modules/process-warning/types/index.d.ts +37 -0
  2196. package/node_modules/light-my-request/node_modules/process-warning/types/index.test-d.ts +36 -0
  2197. package/node_modules/light-my-request/package.json +85 -0
  2198. package/node_modules/light-my-request/test/async-await.test.js +55 -0
  2199. package/node_modules/light-my-request/test/index.test.js +2316 -0
  2200. package/node_modules/light-my-request/test/request.test.js +16 -0
  2201. package/node_modules/light-my-request/test/response.test.js +19 -0
  2202. package/node_modules/light-my-request/test/stream.test.js +359 -0
  2203. package/node_modules/light-my-request/types/index.d.ts +128 -0
  2204. package/node_modules/light-my-request/types/index.test-d.ts +149 -0
  2205. package/node_modules/mime/CHANGELOG.md +312 -0
  2206. package/node_modules/mime/LICENSE +21 -0
  2207. package/node_modules/mime/Mime.js +97 -0
  2208. package/node_modules/mime/README.md +178 -0
  2209. package/node_modules/mime/cli.js +46 -0
  2210. package/node_modules/mime/index.js +4 -0
  2211. package/node_modules/mime/lite.js +4 -0
  2212. package/node_modules/mime/package.json +52 -0
  2213. package/node_modules/mime/types/other.js +1 -0
  2214. package/node_modules/mime/types/standard.js +1 -0
  2215. package/node_modules/minimatch/LICENSE.md +55 -0
  2216. package/node_modules/minimatch/README.md +528 -0
  2217. package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts +2 -0
  2218. package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map +1 -0
  2219. package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +14 -0
  2220. package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map +1 -0
  2221. package/node_modules/minimatch/dist/commonjs/ast.d.ts +22 -0
  2222. package/node_modules/minimatch/dist/commonjs/ast.d.ts.map +1 -0
  2223. package/node_modules/minimatch/dist/commonjs/ast.js +845 -0
  2224. package/node_modules/minimatch/dist/commonjs/ast.js.map +1 -0
  2225. package/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts +8 -0
  2226. package/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map +1 -0
  2227. package/node_modules/minimatch/dist/commonjs/brace-expressions.js +150 -0
  2228. package/node_modules/minimatch/dist/commonjs/brace-expressions.js.map +1 -0
  2229. package/node_modules/minimatch/dist/commonjs/escape.d.ts +15 -0
  2230. package/node_modules/minimatch/dist/commonjs/escape.d.ts.map +1 -0
  2231. package/node_modules/minimatch/dist/commonjs/escape.js +30 -0
  2232. package/node_modules/minimatch/dist/commonjs/escape.js.map +1 -0
  2233. package/node_modules/minimatch/dist/commonjs/index.d.ts +174 -0
  2234. package/node_modules/minimatch/dist/commonjs/index.d.ts.map +1 -0
  2235. package/node_modules/minimatch/dist/commonjs/index.js +1127 -0
  2236. package/node_modules/minimatch/dist/commonjs/index.js.map +1 -0
  2237. package/node_modules/minimatch/dist/commonjs/package.json +3 -0
  2238. package/node_modules/minimatch/dist/commonjs/unescape.d.ts +22 -0
  2239. package/node_modules/minimatch/dist/commonjs/unescape.d.ts.map +1 -0
  2240. package/node_modules/minimatch/dist/commonjs/unescape.js +38 -0
  2241. package/node_modules/minimatch/dist/commonjs/unescape.js.map +1 -0
  2242. package/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts +2 -0
  2243. package/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map +1 -0
  2244. package/node_modules/minimatch/dist/esm/assert-valid-pattern.js +10 -0
  2245. package/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map +1 -0
  2246. package/node_modules/minimatch/dist/esm/ast.d.ts +22 -0
  2247. package/node_modules/minimatch/dist/esm/ast.d.ts.map +1 -0
  2248. package/node_modules/minimatch/dist/esm/ast.js +841 -0
  2249. package/node_modules/minimatch/dist/esm/ast.js.map +1 -0
  2250. package/node_modules/minimatch/dist/esm/brace-expressions.d.ts +8 -0
  2251. package/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map +1 -0
  2252. package/node_modules/minimatch/dist/esm/brace-expressions.js +146 -0
  2253. package/node_modules/minimatch/dist/esm/brace-expressions.js.map +1 -0
  2254. package/node_modules/minimatch/dist/esm/escape.d.ts +15 -0
  2255. package/node_modules/minimatch/dist/esm/escape.d.ts.map +1 -0
  2256. package/node_modules/minimatch/dist/esm/escape.js +26 -0
  2257. package/node_modules/minimatch/dist/esm/escape.js.map +1 -0
  2258. package/node_modules/minimatch/dist/esm/index.d.ts +174 -0
  2259. package/node_modules/minimatch/dist/esm/index.d.ts.map +1 -0
  2260. package/node_modules/minimatch/dist/esm/index.js +1114 -0
  2261. package/node_modules/minimatch/dist/esm/index.js.map +1 -0
  2262. package/node_modules/minimatch/dist/esm/package.json +3 -0
  2263. package/node_modules/minimatch/dist/esm/unescape.d.ts +22 -0
  2264. package/node_modules/minimatch/dist/esm/unescape.d.ts.map +1 -0
  2265. package/node_modules/minimatch/dist/esm/unescape.js +34 -0
  2266. package/node_modules/minimatch/dist/esm/unescape.js.map +1 -0
  2267. package/node_modules/minimatch/package.json +73 -0
  2268. package/node_modules/minipass/LICENSE.md +55 -0
  2269. package/node_modules/minipass/README.md +825 -0
  2270. package/node_modules/minipass/dist/commonjs/index.d.ts +545 -0
  2271. package/node_modules/minipass/dist/commonjs/index.d.ts.map +1 -0
  2272. package/node_modules/minipass/dist/commonjs/index.js +1038 -0
  2273. package/node_modules/minipass/dist/commonjs/index.js.map +1 -0
  2274. package/node_modules/minipass/dist/commonjs/package.json +3 -0
  2275. package/node_modules/minipass/dist/esm/index.d.ts +545 -0
  2276. package/node_modules/minipass/dist/esm/index.d.ts.map +1 -0
  2277. package/node_modules/minipass/dist/esm/index.js +1020 -0
  2278. package/node_modules/minipass/dist/esm/index.js.map +1 -0
  2279. package/node_modules/minipass/dist/esm/package.json +3 -0
  2280. package/node_modules/minipass/package.json +77 -0
  2281. package/node_modules/on-exit-leak-free/.github/dependabot.yml +12 -0
  2282. package/node_modules/on-exit-leak-free/.github/workflows/ci.yml +46 -0
  2283. package/node_modules/on-exit-leak-free/LICENSE +21 -0
  2284. package/node_modules/on-exit-leak-free/README.md +54 -0
  2285. package/node_modules/on-exit-leak-free/index.js +108 -0
  2286. package/node_modules/on-exit-leak-free/package.json +37 -0
  2287. package/node_modules/on-exit-leak-free/test/base.test.js +30 -0
  2288. package/node_modules/on-exit-leak-free/test/event-emitter-leak.test.js +23 -0
  2289. package/node_modules/on-exit-leak-free/test/fixtures/beforeExit.js +33 -0
  2290. package/node_modules/on-exit-leak-free/test/fixtures/close.js +21 -0
  2291. package/node_modules/on-exit-leak-free/test/fixtures/gc-not-close.js +24 -0
  2292. package/node_modules/on-exit-leak-free/test/fixtures/unregister.js +24 -0
  2293. package/node_modules/path-scurry/LICENSE.md +55 -0
  2294. package/node_modules/path-scurry/README.md +636 -0
  2295. package/node_modules/path-scurry/dist/commonjs/index.d.ts +1115 -0
  2296. package/node_modules/path-scurry/dist/commonjs/index.d.ts.map +1 -0
  2297. package/node_modules/path-scurry/dist/commonjs/index.js +2018 -0
  2298. package/node_modules/path-scurry/dist/commonjs/index.js.map +1 -0
  2299. package/node_modules/path-scurry/dist/commonjs/package.json +3 -0
  2300. package/node_modules/path-scurry/dist/esm/index.d.ts +1115 -0
  2301. package/node_modules/path-scurry/dist/esm/index.d.ts.map +1 -0
  2302. package/node_modules/path-scurry/dist/esm/index.js +1983 -0
  2303. package/node_modules/path-scurry/dist/esm/index.js.map +1 -0
  2304. package/node_modules/path-scurry/dist/esm/package.json +3 -0
  2305. package/node_modules/path-scurry/node_modules/lru-cache/LICENSE.md +55 -0
  2306. package/node_modules/path-scurry/node_modules/lru-cache/README.md +469 -0
  2307. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel-browser.d.ts.map +1 -0
  2308. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel-browser.js.map +1 -0
  2309. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel.d.ts +5 -0
  2310. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel.js +7 -0
  2311. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/index.d.ts +1400 -0
  2312. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/index.d.ts.map +1 -0
  2313. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/index.js +1726 -0
  2314. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/index.js.map +1 -0
  2315. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/index.min.js +2 -0
  2316. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/index.min.js.map +7 -0
  2317. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/perf.d.ts +12 -0
  2318. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/perf.d.ts.map +1 -0
  2319. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/perf.js +10 -0
  2320. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/perf.js.map +1 -0
  2321. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/diagnostics-channel-cjs.cjs.map +1 -0
  2322. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/diagnostics-channel-cjs.d.cts.map +1 -0
  2323. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/diagnostics-channel.d.ts +5 -0
  2324. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/diagnostics-channel.js +7 -0
  2325. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.d.ts +1400 -0
  2326. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.d.ts.map +1 -0
  2327. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +1726 -0
  2328. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js.map +1 -0
  2329. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.min.js +2 -0
  2330. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.min.js.map +7 -0
  2331. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/diagnostics-channel-node.d.ts.map +1 -0
  2332. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/diagnostics-channel-node.js.map +1 -0
  2333. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/diagnostics-channel.d.ts +5 -0
  2334. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/diagnostics-channel.js +9 -0
  2335. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/index.d.ts +1400 -0
  2336. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/index.d.ts.map +1 -0
  2337. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/index.js +1726 -0
  2338. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/index.js.map +1 -0
  2339. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/index.min.js +2 -0
  2340. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/index.min.js.map +7 -0
  2341. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/perf.d.ts +12 -0
  2342. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/perf.d.ts.map +1 -0
  2343. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/perf.js +10 -0
  2344. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/perf.js.map +1 -0
  2345. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/package.json +3 -0
  2346. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/perf.d.ts +12 -0
  2347. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/perf.d.ts.map +1 -0
  2348. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/perf.js +10 -0
  2349. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/perf.js.map +1 -0
  2350. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/diagnostics-channel-browser.d.ts.map +1 -0
  2351. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/diagnostics-channel-browser.js.map +1 -0
  2352. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.d.ts +5 -0
  2353. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.js +4 -0
  2354. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/index.d.ts +1400 -0
  2355. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/index.d.ts.map +1 -0
  2356. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/index.js +1722 -0
  2357. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/index.js.map +1 -0
  2358. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/index.min.js +2 -0
  2359. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/index.min.js.map +7 -0
  2360. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/perf.d.ts +12 -0
  2361. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/perf.d.ts.map +1 -0
  2362. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/perf.js +7 -0
  2363. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/perf.js.map +1 -0
  2364. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/diagnostics-channel-esm.d.mts.map +1 -0
  2365. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/diagnostics-channel-esm.mjs.map +1 -0
  2366. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/diagnostics-channel.d.ts +5 -0
  2367. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/diagnostics-channel.js +19 -0
  2368. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.d.ts +1400 -0
  2369. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.d.ts.map +1 -0
  2370. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.js +1722 -0
  2371. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.js.map +1 -0
  2372. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.min.js +2 -0
  2373. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.min.js.map +7 -0
  2374. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/diagnostics-channel-node.d.ts.map +1 -0
  2375. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/diagnostics-channel-node.js.map +1 -0
  2376. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/diagnostics-channel.d.ts +5 -0
  2377. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/diagnostics-channel.js +6 -0
  2378. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/index.d.ts +1400 -0
  2379. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/index.d.ts.map +1 -0
  2380. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/index.js +1722 -0
  2381. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/index.js.map +1 -0
  2382. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/index.min.js +2 -0
  2383. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/index.min.js.map +7 -0
  2384. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/perf.d.ts +12 -0
  2385. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/perf.d.ts.map +1 -0
  2386. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/perf.js +7 -0
  2387. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/perf.js.map +1 -0
  2388. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/package.json +3 -0
  2389. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/perf.d.ts +12 -0
  2390. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/perf.d.ts.map +1 -0
  2391. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/perf.js +7 -0
  2392. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/perf.js.map +1 -0
  2393. package/node_modules/path-scurry/node_modules/lru-cache/package.json +154 -0
  2394. package/node_modules/path-scurry/package.json +72 -0
  2395. package/node_modules/pino/.nojekyll +0 -0
  2396. package/node_modules/pino/.prettierignore +1 -0
  2397. package/node_modules/pino/CNAME +1 -0
  2398. package/node_modules/pino/CONTRIBUTING.md +30 -0
  2399. package/node_modules/pino/LICENSE +21 -0
  2400. package/node_modules/pino/README.md +177 -0
  2401. package/node_modules/pino/SECURITY.md +87 -0
  2402. package/node_modules/pino/benchmarks/basic.bench.js +95 -0
  2403. package/node_modules/pino/benchmarks/child-child.bench.js +52 -0
  2404. package/node_modules/pino/benchmarks/child-creation.bench.js +73 -0
  2405. package/node_modules/pino/benchmarks/child.bench.js +62 -0
  2406. package/node_modules/pino/benchmarks/deep-object.bench.js +88 -0
  2407. package/node_modules/pino/benchmarks/formatters.bench.js +50 -0
  2408. package/node_modules/pino/benchmarks/internal/custom-levels.js +67 -0
  2409. package/node_modules/pino/benchmarks/internal/just-pino-heavy.bench.js +76 -0
  2410. package/node_modules/pino/benchmarks/internal/just-pino.bench.js +182 -0
  2411. package/node_modules/pino/benchmarks/internal/parent-vs-child.bench.js +75 -0
  2412. package/node_modules/pino/benchmarks/internal/redact.bench.js +86 -0
  2413. package/node_modules/pino/benchmarks/long-string.bench.js +81 -0
  2414. package/node_modules/pino/benchmarks/multi-arg.bench.js +193 -0
  2415. package/node_modules/pino/benchmarks/multistream.js +98 -0
  2416. package/node_modules/pino/benchmarks/object.bench.js +82 -0
  2417. package/node_modules/pino/benchmarks/utils/generate-benchmark-doc.js +36 -0
  2418. package/node_modules/pino/benchmarks/utils/runbench.js +138 -0
  2419. package/node_modules/pino/benchmarks/utils/wrap-log-level.js +55 -0
  2420. package/node_modules/pino/bin.js +6 -0
  2421. package/node_modules/pino/browser.js +547 -0
  2422. package/node_modules/pino/build/sync-version.js +25 -0
  2423. package/node_modules/pino/docs/api.md +1593 -0
  2424. package/node_modules/pino/docs/asynchronous.md +40 -0
  2425. package/node_modules/pino/docs/benchmarks.md +55 -0
  2426. package/node_modules/pino/docs/browser.md +278 -0
  2427. package/node_modules/pino/docs/bundling.md +40 -0
  2428. package/node_modules/pino/docs/child-loggers.md +95 -0
  2429. package/node_modules/pino/docs/diagnostics.md +16 -0
  2430. package/node_modules/pino/docs/ecosystem.md +86 -0
  2431. package/node_modules/pino/docs/help.md +345 -0
  2432. package/node_modules/pino/docs/lts.md +64 -0
  2433. package/node_modules/pino/docs/pretty.md +35 -0
  2434. package/node_modules/pino/docs/redaction.md +135 -0
  2435. package/node_modules/pino/docs/transports.md +1376 -0
  2436. package/node_modules/pino/docs/web.md +309 -0
  2437. package/node_modules/pino/eslint.config.js +28 -0
  2438. package/node_modules/pino/examples/basic.js +43 -0
  2439. package/node_modules/pino/examples/transport.js +68 -0
  2440. package/node_modules/pino/favicon.ico +0 -0
  2441. package/node_modules/pino/file.js +12 -0
  2442. package/node_modules/pino/inc-version.sh +42 -0
  2443. package/node_modules/pino/index.html +55 -0
  2444. package/node_modules/pino/lib/caller.js +30 -0
  2445. package/node_modules/pino/lib/constants.js +28 -0
  2446. package/node_modules/pino/lib/deprecations.js +8 -0
  2447. package/node_modules/pino/lib/levels.js +241 -0
  2448. package/node_modules/pino/lib/meta.js +3 -0
  2449. package/node_modules/pino/lib/multistream.js +203 -0
  2450. package/node_modules/pino/lib/proto.js +256 -0
  2451. package/node_modules/pino/lib/redaction.js +114 -0
  2452. package/node_modules/pino/lib/symbols.js +74 -0
  2453. package/node_modules/pino/lib/time.js +39 -0
  2454. package/node_modules/pino/lib/tools.js +427 -0
  2455. package/node_modules/pino/lib/transport-stream.js +56 -0
  2456. package/node_modules/pino/lib/transport.js +289 -0
  2457. package/node_modules/pino/lib/worker.js +194 -0
  2458. package/node_modules/pino/package.json +120 -0
  2459. package/node_modules/pino/pino.d.ts +908 -0
  2460. package/node_modules/pino/pino.js +234 -0
  2461. package/node_modules/pino/test/basic.test.js +886 -0
  2462. package/node_modules/pino/test/broken-pipe.test.js +59 -0
  2463. package/node_modules/pino/test/browser-child.test.js +132 -0
  2464. package/node_modules/pino/test/browser-disabled.test.js +87 -0
  2465. package/node_modules/pino/test/browser-early-console-freeze.test.js +12 -0
  2466. package/node_modules/pino/test/browser-is-level-enabled.test.js +101 -0
  2467. package/node_modules/pino/test/browser-levels.test.js +241 -0
  2468. package/node_modules/pino/test/browser-serializers.test.js +352 -0
  2469. package/node_modules/pino/test/browser-timestamp.test.js +88 -0
  2470. package/node_modules/pino/test/browser-transmit.test.js +417 -0
  2471. package/node_modules/pino/test/browser.test.js +698 -0
  2472. package/node_modules/pino/test/complex-objects.test.js +36 -0
  2473. package/node_modules/pino/test/crlf.test.js +34 -0
  2474. package/node_modules/pino/test/custom-levels.test.js +267 -0
  2475. package/node_modules/pino/test/diagnostics.test.js +107 -0
  2476. package/node_modules/pino/test/error-key.test.js +37 -0
  2477. package/node_modules/pino/test/error.test.js +403 -0
  2478. package/node_modules/pino/test/escaping.test.js +93 -0
  2479. package/node_modules/pino/test/esm/esm.mjs +14 -0
  2480. package/node_modules/pino/test/esm/index.test.js +21 -0
  2481. package/node_modules/pino/test/esm/named-exports.mjs +29 -0
  2482. package/node_modules/pino/test/exit.test.js +79 -0
  2483. package/node_modules/pino/test/fixtures/broken-pipe/basic.js +9 -0
  2484. package/node_modules/pino/test/fixtures/broken-pipe/destination.js +10 -0
  2485. package/node_modules/pino/test/fixtures/broken-pipe/syncfalse.js +12 -0
  2486. package/node_modules/pino/test/fixtures/console-transport.js +13 -0
  2487. package/node_modules/pino/test/fixtures/crashing-transport.js +13 -0
  2488. package/node_modules/pino/test/fixtures/default-exit.js +8 -0
  2489. package/node_modules/pino/test/fixtures/destination-exit.js +8 -0
  2490. package/node_modules/pino/test/fixtures/eval/index.js +13 -0
  2491. package/node_modules/pino/test/fixtures/eval/node_modules/14-files.js +3 -0
  2492. package/node_modules/pino/test/fixtures/eval/node_modules/2-files.js +3 -0
  2493. package/node_modules/pino/test/fixtures/eval/node_modules/file1.js +5 -0
  2494. package/node_modules/pino/test/fixtures/eval/node_modules/file10.js +5 -0
  2495. package/node_modules/pino/test/fixtures/eval/node_modules/file11.js +5 -0
  2496. package/node_modules/pino/test/fixtures/eval/node_modules/file12.js +5 -0
  2497. package/node_modules/pino/test/fixtures/eval/node_modules/file13.js +5 -0
  2498. package/node_modules/pino/test/fixtures/eval/node_modules/file14.js +11 -0
  2499. package/node_modules/pino/test/fixtures/eval/node_modules/file2.js +5 -0
  2500. package/node_modules/pino/test/fixtures/eval/node_modules/file3.js +5 -0
  2501. package/node_modules/pino/test/fixtures/eval/node_modules/file4.js +5 -0
  2502. package/node_modules/pino/test/fixtures/eval/node_modules/file5.js +5 -0
  2503. package/node_modules/pino/test/fixtures/eval/node_modules/file6.js +5 -0
  2504. package/node_modules/pino/test/fixtures/eval/node_modules/file7.js +5 -0
  2505. package/node_modules/pino/test/fixtures/eval/node_modules/file8.js +5 -0
  2506. package/node_modules/pino/test/fixtures/eval/node_modules/file9.js +5 -0
  2507. package/node_modules/pino/test/fixtures/noop-transport.js +10 -0
  2508. package/node_modules/pino/test/fixtures/pretty/null-prototype.js +8 -0
  2509. package/node_modules/pino/test/fixtures/stdout-hack-protection.js +11 -0
  2510. package/node_modules/pino/test/fixtures/syncfalse-child.js +6 -0
  2511. package/node_modules/pino/test/fixtures/syncfalse-exit.js +9 -0
  2512. package/node_modules/pino/test/fixtures/syncfalse-flush-exit.js +10 -0
  2513. package/node_modules/pino/test/fixtures/syncfalse.js +6 -0
  2514. package/node_modules/pino/test/fixtures/syntax-error-esm.mjs +2 -0
  2515. package/node_modules/pino/test/fixtures/to-file-transport-with-transform.js +20 -0
  2516. package/node_modules/pino/test/fixtures/to-file-transport.js +13 -0
  2517. package/node_modules/pino/test/fixtures/to-file-transport.mjs +8 -0
  2518. package/node_modules/pino/test/fixtures/transport/index.js +12 -0
  2519. package/node_modules/pino/test/fixtures/transport/package.json +5 -0
  2520. package/node_modules/pino/test/fixtures/transport-exit-immediately-with-async-dest.js +16 -0
  2521. package/node_modules/pino/test/fixtures/transport-exit-immediately.js +11 -0
  2522. package/node_modules/pino/test/fixtures/transport-exit-on-ready.js +12 -0
  2523. package/node_modules/pino/test/fixtures/transport-invalid-node-options.js +26 -0
  2524. package/node_modules/pino/test/fixtures/transport-main.js +9 -0
  2525. package/node_modules/pino/test/fixtures/transport-many-lines.js +29 -0
  2526. package/node_modules/pino/test/fixtures/transport-preload-main.mjs +13 -0
  2527. package/node_modules/pino/test/fixtures/transport-preload.mjs +13 -0
  2528. package/node_modules/pino/test/fixtures/transport-string-stdout.js +9 -0
  2529. package/node_modules/pino/test/fixtures/transport-transform.js +21 -0
  2530. package/node_modules/pino/test/fixtures/transport-uses-pino-config.js +33 -0
  2531. package/node_modules/pino/test/fixtures/transport-with-on-exit.js +12 -0
  2532. package/node_modules/pino/test/fixtures/transport-worker-data.js +19 -0
  2533. package/node_modules/pino/test/fixtures/transport-worker-name.js +24 -0
  2534. package/node_modules/pino/test/fixtures/transport-worker.js +15 -0
  2535. package/node_modules/pino/test/fixtures/transport-wrong-export-type.js +3 -0
  2536. package/node_modules/pino/test/fixtures/ts/to-file-transport-native.mts +15 -0
  2537. package/node_modules/pino/test/fixtures/ts/to-file-transport-with-transform.ts +18 -0
  2538. package/node_modules/pino/test/fixtures/ts/to-file-transport.ts +11 -0
  2539. package/node_modules/pino/test/fixtures/ts/transpile.cjs +36 -0
  2540. package/node_modules/pino/test/fixtures/ts/transport-exit-immediately-with-async-dest.ts +15 -0
  2541. package/node_modules/pino/test/fixtures/ts/transport-exit-immediately.ts +10 -0
  2542. package/node_modules/pino/test/fixtures/ts/transport-exit-on-ready.ts +11 -0
  2543. package/node_modules/pino/test/fixtures/ts/transport-main.ts +8 -0
  2544. package/node_modules/pino/test/fixtures/ts/transport-string-stdout.ts +8 -0
  2545. package/node_modules/pino/test/fixtures/ts/transport-worker.ts +14 -0
  2546. package/node_modules/pino/test/formatters.test.js +364 -0
  2547. package/node_modules/pino/test/helper.d.ts +4 -0
  2548. package/node_modules/pino/test/helper.js +155 -0
  2549. package/node_modules/pino/test/hooks.test.js +114 -0
  2550. package/node_modules/pino/test/http.test.js +214 -0
  2551. package/node_modules/pino/test/internals/version.test.js +17 -0
  2552. package/node_modules/pino/test/is-level-enabled.test.js +179 -0
  2553. package/node_modules/pino/test/jest/basic.spec.js +10 -0
  2554. package/node_modules/pino/test/levels.test.js +810 -0
  2555. package/node_modules/pino/test/metadata.test.js +120 -0
  2556. package/node_modules/pino/test/mixin-merge-strategy.test.js +57 -0
  2557. package/node_modules/pino/test/mixin.test.js +241 -0
  2558. package/node_modules/pino/test/multistream.test.js +729 -0
  2559. package/node_modules/pino/test/redact.test.js +893 -0
  2560. package/node_modules/pino/test/serializers.test.js +257 -0
  2561. package/node_modules/pino/test/stdout-protection.test.js +41 -0
  2562. package/node_modules/pino/test/syncfalse.test.js +186 -0
  2563. package/node_modules/pino/test/timestamp-nano.test.js +37 -0
  2564. package/node_modules/pino/test/timestamp.test.js +124 -0
  2565. package/node_modules/pino/test/transport/big.test.js +42 -0
  2566. package/node_modules/pino/test/transport/bundlers-support.test.js +99 -0
  2567. package/node_modules/pino/test/transport/caller.test.js +24 -0
  2568. package/node_modules/pino/test/transport/core.test.js +733 -0
  2569. package/node_modules/pino/test/transport/core.transpiled.test.ts +114 -0
  2570. package/node_modules/pino/test/transport/crash.test.js +36 -0
  2571. package/node_modules/pino/test/transport/module-link.test.js +241 -0
  2572. package/node_modules/pino/test/transport/native-type-stripping.test.mjs +151 -0
  2573. package/node_modules/pino/test/transport/node-options.test.js +116 -0
  2574. package/node_modules/pino/test/transport/pipeline.test.js +137 -0
  2575. package/node_modules/pino/test/transport/preload.test.js +54 -0
  2576. package/node_modules/pino/test/transport/repl.test.js +15 -0
  2577. package/node_modules/pino/test/transport/sync-false.test.js +67 -0
  2578. package/node_modules/pino/test/transport/sync-true.test.js +57 -0
  2579. package/node_modules/pino/test/transport/targets.test.js +48 -0
  2580. package/node_modules/pino/test/transport/uses-pino-config.test.js +166 -0
  2581. package/node_modules/pino/test/transport-stream.test.js +40 -0
  2582. package/node_modules/pino/test/types/pino-import.test-d.cts +30 -0
  2583. package/node_modules/pino/test/types/pino-multistream.test-d.ts +28 -0
  2584. package/node_modules/pino/test/types/pino-top-export.test-d.ts +34 -0
  2585. package/node_modules/pino/test/types/pino-transport.test-d.ts +156 -0
  2586. package/node_modules/pino/test/types/pino-type-only.test-d.ts +75 -0
  2587. package/node_modules/pino/test/types/pino.test-d.ts +683 -0
  2588. package/node_modules/pino/test/types/pino.ts +91 -0
  2589. package/node_modules/pino/tsconfig.json +14 -0
  2590. package/node_modules/pino-abstract-transport/.github/dependabot.yml +13 -0
  2591. package/node_modules/pino-abstract-transport/.github/workflows/ci.yml +80 -0
  2592. package/node_modules/pino-abstract-transport/.husky/pre-commit +4 -0
  2593. package/node_modules/pino-abstract-transport/LICENSE +21 -0
  2594. package/node_modules/pino-abstract-transport/README.md +171 -0
  2595. package/node_modules/pino-abstract-transport/index.d.ts +122 -0
  2596. package/node_modules/pino-abstract-transport/index.js +128 -0
  2597. package/node_modules/pino-abstract-transport/package.json +41 -0
  2598. package/node_modules/pino-abstract-transport/test/base.test.js +473 -0
  2599. package/node_modules/pino-abstract-transport/test/fixtures/transport-async-iteration.js +22 -0
  2600. package/node_modules/pino-abstract-transport/test/fixtures/transport-on-data.js +22 -0
  2601. package/node_modules/pino-abstract-transport/test/fixtures/transport-transform.js +24 -0
  2602. package/node_modules/pino-abstract-transport/test/fixtures/worker-pipeline.js +15 -0
  2603. package/node_modules/pino-abstract-transport/test/match.js +24 -0
  2604. package/node_modules/pino-abstract-transport/test/types/index.test-d.ts +31 -0
  2605. package/node_modules/pino-abstract-transport/test/worker.test.js +372 -0
  2606. package/node_modules/pino-std-serializers/.editorconfig +13 -0
  2607. package/node_modules/pino-std-serializers/.github/dependabot.yml +13 -0
  2608. package/node_modules/pino-std-serializers/.github/workflows/ci.yml +81 -0
  2609. package/node_modules/pino-std-serializers/LICENSE +7 -0
  2610. package/node_modules/pino-std-serializers/Readme.md +182 -0
  2611. package/node_modules/pino-std-serializers/eslint.config.js +7 -0
  2612. package/node_modules/pino-std-serializers/index.d.ts +145 -0
  2613. package/node_modules/pino-std-serializers/index.js +36 -0
  2614. package/node_modules/pino-std-serializers/lib/err-helpers.js +118 -0
  2615. package/node_modules/pino-std-serializers/lib/err-proto.js +48 -0
  2616. package/node_modules/pino-std-serializers/lib/err-with-cause.js +48 -0
  2617. package/node_modules/pino-std-serializers/lib/err.js +45 -0
  2618. package/node_modules/pino-std-serializers/lib/req.js +100 -0
  2619. package/node_modules/pino-std-serializers/lib/res.js +47 -0
  2620. package/node_modules/pino-std-serializers/package.json +42 -0
  2621. package/node_modules/pino-std-serializers/test/err-with-cause.test.js +187 -0
  2622. package/node_modules/pino-std-serializers/test/err.test.js +200 -0
  2623. package/node_modules/pino-std-serializers/test/req.test.js +477 -0
  2624. package/node_modules/pino-std-serializers/test/res.test.js +120 -0
  2625. package/node_modules/pino-std-serializers/test/types/index.test-d.ts +71 -0
  2626. package/node_modules/pino-std-serializers/tsconfig.json +13 -0
  2627. package/node_modules/process-warning/.gitattributes +2 -0
  2628. package/node_modules/process-warning/.github/dependabot.yml +13 -0
  2629. package/node_modules/process-warning/.github/workflows/ci.yml +22 -0
  2630. package/node_modules/process-warning/LICENSE +21 -0
  2631. package/node_modules/process-warning/README.md +118 -0
  2632. package/node_modules/process-warning/benchmarks/warn.js +25 -0
  2633. package/node_modules/process-warning/eslint.config.js +6 -0
  2634. package/node_modules/process-warning/examples/example.js +11 -0
  2635. package/node_modules/process-warning/index.js +124 -0
  2636. package/node_modules/process-warning/package.json +73 -0
  2637. package/node_modules/process-warning/test/emit-interpolated-string.test.js +34 -0
  2638. package/node_modules/process-warning/test/emit-once-only.test.js +33 -0
  2639. package/node_modules/process-warning/test/emit-reset.test.js +40 -0
  2640. package/node_modules/process-warning/test/emit-set.test.js +35 -0
  2641. package/node_modules/process-warning/test/emit-unlimited.test.js +42 -0
  2642. package/node_modules/process-warning/test/index.test.js +99 -0
  2643. package/node_modules/process-warning/test/issue-88.test.js +38 -0
  2644. package/node_modules/process-warning/test/jest.test.js +24 -0
  2645. package/node_modules/process-warning/test/no-warnings.test.js +80 -0
  2646. package/node_modules/process-warning/test/promise.js +10 -0
  2647. package/node_modules/process-warning/types/index.d.ts +37 -0
  2648. package/node_modules/process-warning/types/index.test-d.ts +36 -0
  2649. package/node_modules/quick-format-unescaped/.github/workflows/ci.yml +21 -0
  2650. package/node_modules/quick-format-unescaped/LICENSE +21 -0
  2651. package/node_modules/quick-format-unescaped/benchmark.js +24 -0
  2652. package/node_modules/quick-format-unescaped/index.js +109 -0
  2653. package/node_modules/quick-format-unescaped/package.json +29 -0
  2654. package/node_modules/quick-format-unescaped/readme.md +66 -0
  2655. package/node_modules/quick-format-unescaped/test/index.js +136 -0
  2656. package/node_modules/real-require/LICENSE.md +21 -0
  2657. package/node_modules/real-require/README.md +51 -0
  2658. package/node_modules/real-require/package.json +49 -0
  2659. package/node_modules/real-require/src/index.js +14 -0
  2660. package/node_modules/require-from-string/index.js +34 -0
  2661. package/node_modules/require-from-string/license +21 -0
  2662. package/node_modules/require-from-string/package.json +28 -0
  2663. package/node_modules/require-from-string/readme.md +56 -0
  2664. package/node_modules/ret/LICENSE +21 -0
  2665. package/node_modules/ret/README.md +539 -0
  2666. package/node_modules/ret/dist/index.d.ts +7 -0
  2667. package/node_modules/ret/dist/index.js +26 -0
  2668. package/node_modules/ret/dist/index.js.map +1 -0
  2669. package/node_modules/ret/dist/reconstruct.d.ts +2 -0
  2670. package/node_modules/ret/dist/reconstruct.js +77 -0
  2671. package/node_modules/ret/dist/reconstruct.js.map +1 -0
  2672. package/node_modules/ret/dist/sets-lookup.d.ts +5 -0
  2673. package/node_modules/ret/dist/sets-lookup.js +51 -0
  2674. package/node_modules/ret/dist/sets-lookup.js.map +1 -0
  2675. package/node_modules/ret/dist/sets.d.ts +9 -0
  2676. package/node_modules/ret/dist/sets.js +43 -0
  2677. package/node_modules/ret/dist/sets.js.map +1 -0
  2678. package/node_modules/ret/dist/tokenizer.d.ts +8 -0
  2679. package/node_modules/ret/dist/tokenizer.js +361 -0
  2680. package/node_modules/ret/dist/tokenizer.js.map +1 -0
  2681. package/node_modules/ret/dist/types/index.d.ts +3 -0
  2682. package/node_modules/ret/dist/types/index.js +16 -0
  2683. package/node_modules/ret/dist/types/index.js.map +1 -0
  2684. package/node_modules/ret/dist/types/set-lookup.d.ts +8 -0
  2685. package/node_modules/ret/dist/types/set-lookup.js +3 -0
  2686. package/node_modules/ret/dist/types/set-lookup.js.map +1 -0
  2687. package/node_modules/ret/dist/types/tokens.d.ts +41 -0
  2688. package/node_modules/ret/dist/types/tokens.js +3 -0
  2689. package/node_modules/ret/dist/types/tokens.js.map +1 -0
  2690. package/node_modules/ret/dist/types/types.d.ts +10 -0
  2691. package/node_modules/ret/dist/types/types.js +15 -0
  2692. package/node_modules/ret/dist/types/types.js.map +1 -0
  2693. package/node_modules/ret/dist/util.d.ts +18 -0
  2694. package/node_modules/ret/dist/util.js +82 -0
  2695. package/node_modules/ret/dist/util.js.map +1 -0
  2696. package/node_modules/ret/dist/write-set-tokens.d.ts +14 -0
  2697. package/node_modules/ret/dist/write-set-tokens.js +108 -0
  2698. package/node_modules/ret/dist/write-set-tokens.js.map +1 -0
  2699. package/node_modules/ret/package.json +42 -0
  2700. package/node_modules/reusify/.github/dependabot.yml +7 -0
  2701. package/node_modules/reusify/.github/workflows/ci.yml +96 -0
  2702. package/node_modules/reusify/LICENSE +22 -0
  2703. package/node_modules/reusify/README.md +139 -0
  2704. package/node_modules/reusify/SECURITY.md +15 -0
  2705. package/node_modules/reusify/benchmarks/createNoCodeFunction.js +30 -0
  2706. package/node_modules/reusify/benchmarks/fib.js +13 -0
  2707. package/node_modules/reusify/benchmarks/reuseNoCodeFunction.js +38 -0
  2708. package/node_modules/reusify/eslint.config.js +14 -0
  2709. package/node_modules/reusify/package.json +50 -0
  2710. package/node_modules/reusify/reusify.d.ts +14 -0
  2711. package/node_modules/reusify/reusify.js +33 -0
  2712. package/node_modules/reusify/test.js +66 -0
  2713. package/node_modules/reusify/tsconfig.json +11 -0
  2714. package/node_modules/rfdc/.github/workflows/ci.yml +21 -0
  2715. package/node_modules/rfdc/LICENSE +15 -0
  2716. package/node_modules/rfdc/default.js +3 -0
  2717. package/node_modules/rfdc/index.d.ts +13 -0
  2718. package/node_modules/rfdc/index.js +198 -0
  2719. package/node_modules/rfdc/index.test-d.ts +13 -0
  2720. package/node_modules/rfdc/package.json +73 -0
  2721. package/node_modules/rfdc/readme.md +181 -0
  2722. package/node_modules/rfdc/test/index.js +306 -0
  2723. package/node_modules/safe-regex2/.gitattributes +2 -0
  2724. package/node_modules/safe-regex2/.github/dependabot.yml +13 -0
  2725. package/node_modules/safe-regex2/.github/workflows/ci.yml +33 -0
  2726. package/node_modules/safe-regex2/.github/workflows/lock-threads.yml +19 -0
  2727. package/node_modules/safe-regex2/LICENSE +21 -0
  2728. package/node_modules/safe-regex2/README.md +68 -0
  2729. package/node_modules/safe-regex2/bin/safe-regex2.js +58 -0
  2730. package/node_modules/safe-regex2/eslint.config.js +6 -0
  2731. package/node_modules/safe-regex2/example/safe.js +5 -0
  2732. package/node_modules/safe-regex2/index.js +76 -0
  2733. package/node_modules/safe-regex2/package.json +78 -0
  2734. package/node_modules/safe-regex2/test/regex.test.js +58 -0
  2735. package/node_modules/safe-regex2/types/index.d.ts +9 -0
  2736. package/node_modules/safe-regex2/types/index.test-d.ts +12 -0
  2737. package/node_modules/safe-stable-stringify/LICENSE +21 -0
  2738. package/node_modules/safe-stable-stringify/esm/package.json +4 -0
  2739. package/node_modules/safe-stable-stringify/esm/wrapper.d.ts +4 -0
  2740. package/node_modules/safe-stable-stringify/esm/wrapper.js +6 -0
  2741. package/node_modules/safe-stable-stringify/index.d.ts +22 -0
  2742. package/node_modules/safe-stable-stringify/index.js +625 -0
  2743. package/node_modules/safe-stable-stringify/package.json +65 -0
  2744. package/node_modules/safe-stable-stringify/readme.md +179 -0
  2745. package/node_modules/secure-json-parse/.airtap.yml +7 -0
  2746. package/node_modules/secure-json-parse/.gitattributes +2 -0
  2747. package/node_modules/secure-json-parse/.github/dependabot.yml +13 -0
  2748. package/node_modules/secure-json-parse/.github/stale.yml +21 -0
  2749. package/node_modules/secure-json-parse/.github/workflows/ci.yml +149 -0
  2750. package/node_modules/secure-json-parse/LICENSE +19 -0
  2751. package/node_modules/secure-json-parse/README.md +132 -0
  2752. package/node_modules/secure-json-parse/benchmarks/ignore.js +35 -0
  2753. package/node_modules/secure-json-parse/benchmarks/no__proto__.js +40 -0
  2754. package/node_modules/secure-json-parse/benchmarks/package.json +15 -0
  2755. package/node_modules/secure-json-parse/benchmarks/remove.js +39 -0
  2756. package/node_modules/secure-json-parse/benchmarks/throw.js +49 -0
  2757. package/node_modules/secure-json-parse/benchmarks/valid.js +49 -0
  2758. package/node_modules/secure-json-parse/eslint.config.js +6 -0
  2759. package/node_modules/secure-json-parse/index.js +161 -0
  2760. package/node_modules/secure-json-parse/package.json +74 -0
  2761. package/node_modules/secure-json-parse/test/index.test.js +649 -0
  2762. package/node_modules/secure-json-parse/types/index.d.ts +60 -0
  2763. package/node_modules/secure-json-parse/types/index.test-d.ts +43 -0
  2764. package/node_modules/semver/LICENSE +15 -0
  2765. package/node_modules/semver/README.md +680 -0
  2766. package/node_modules/semver/bin/semver.js +195 -0
  2767. package/node_modules/semver/classes/comparator.js +143 -0
  2768. package/node_modules/semver/classes/index.js +7 -0
  2769. package/node_modules/semver/classes/range.js +573 -0
  2770. package/node_modules/semver/classes/semver.js +350 -0
  2771. package/node_modules/semver/functions/clean.js +8 -0
  2772. package/node_modules/semver/functions/cmp.js +54 -0
  2773. package/node_modules/semver/functions/coerce.js +62 -0
  2774. package/node_modules/semver/functions/compare-build.js +9 -0
  2775. package/node_modules/semver/functions/compare-loose.js +5 -0
  2776. package/node_modules/semver/functions/compare.js +7 -0
  2777. package/node_modules/semver/functions/diff.js +60 -0
  2778. package/node_modules/semver/functions/eq.js +5 -0
  2779. package/node_modules/semver/functions/gt.js +5 -0
  2780. package/node_modules/semver/functions/gte.js +5 -0
  2781. package/node_modules/semver/functions/inc.js +21 -0
  2782. package/node_modules/semver/functions/lt.js +5 -0
  2783. package/node_modules/semver/functions/lte.js +5 -0
  2784. package/node_modules/semver/functions/major.js +5 -0
  2785. package/node_modules/semver/functions/minor.js +5 -0
  2786. package/node_modules/semver/functions/neq.js +5 -0
  2787. package/node_modules/semver/functions/parse.js +18 -0
  2788. package/node_modules/semver/functions/patch.js +5 -0
  2789. package/node_modules/semver/functions/prerelease.js +8 -0
  2790. package/node_modules/semver/functions/rcompare.js +5 -0
  2791. package/node_modules/semver/functions/rsort.js +5 -0
  2792. package/node_modules/semver/functions/satisfies.js +12 -0
  2793. package/node_modules/semver/functions/sort.js +5 -0
  2794. package/node_modules/semver/functions/truncate.js +48 -0
  2795. package/node_modules/semver/functions/valid.js +8 -0
  2796. package/node_modules/semver/index.js +93 -0
  2797. package/node_modules/semver/internal/constants.js +37 -0
  2798. package/node_modules/semver/internal/debug.js +11 -0
  2799. package/node_modules/semver/internal/identifiers.js +29 -0
  2800. package/node_modules/semver/internal/lrucache.js +42 -0
  2801. package/node_modules/semver/internal/parse-options.js +17 -0
  2802. package/node_modules/semver/internal/re.js +223 -0
  2803. package/node_modules/semver/package.json +78 -0
  2804. package/node_modules/semver/preload.js +4 -0
  2805. package/node_modules/semver/range.bnf +17 -0
  2806. package/node_modules/semver/ranges/gtr.js +6 -0
  2807. package/node_modules/semver/ranges/intersects.js +9 -0
  2808. package/node_modules/semver/ranges/ltr.js +6 -0
  2809. package/node_modules/semver/ranges/max-satisfying.js +27 -0
  2810. package/node_modules/semver/ranges/min-satisfying.js +26 -0
  2811. package/node_modules/semver/ranges/min-version.js +63 -0
  2812. package/node_modules/semver/ranges/outside.js +82 -0
  2813. package/node_modules/semver/ranges/simplify.js +49 -0
  2814. package/node_modules/semver/ranges/subset.js +249 -0
  2815. package/node_modules/semver/ranges/to-comparators.js +10 -0
  2816. package/node_modules/semver/ranges/valid.js +13 -0
  2817. package/node_modules/set-cookie-parser/LICENSE +21 -0
  2818. package/node_modules/set-cookie-parser/README.md +202 -0
  2819. package/node_modules/set-cookie-parser/lib/set-cookie.js +242 -0
  2820. package/node_modules/set-cookie-parser/package.json +45 -0
  2821. package/node_modules/setprototypeof/LICENSE +13 -0
  2822. package/node_modules/setprototypeof/README.md +31 -0
  2823. package/node_modules/setprototypeof/index.d.ts +2 -0
  2824. package/node_modules/setprototypeof/index.js +17 -0
  2825. package/node_modules/setprototypeof/package.json +38 -0
  2826. package/node_modules/setprototypeof/test/index.js +24 -0
  2827. package/node_modules/sonic-boom/.eslintignore +2 -0
  2828. package/node_modules/sonic-boom/.taprc +3 -0
  2829. package/node_modules/sonic-boom/LICENSE +21 -0
  2830. package/node_modules/sonic-boom/README.md +153 -0
  2831. package/node_modules/sonic-boom/bench.js +98 -0
  2832. package/node_modules/sonic-boom/check.js +18 -0
  2833. package/node_modules/sonic-boom/example.js +8 -0
  2834. package/node_modules/sonic-boom/fixtures/firehose.js +22 -0
  2835. package/node_modules/sonic-boom/index.js +733 -0
  2836. package/node_modules/sonic-boom/package.json +52 -0
  2837. package/node_modules/sonic-boom/test/destroy.test.js +49 -0
  2838. package/node_modules/sonic-boom/test/end.test.js +98 -0
  2839. package/node_modules/sonic-boom/test/flush-sync.test.js +140 -0
  2840. package/node_modules/sonic-boom/test/flush.test.js +419 -0
  2841. package/node_modules/sonic-boom/test/fsync.test.js +63 -0
  2842. package/node_modules/sonic-boom/test/helper.js +42 -0
  2843. package/node_modules/sonic-boom/test/minlength.test.js +35 -0
  2844. package/node_modules/sonic-boom/test/mode.test.js +116 -0
  2845. package/node_modules/sonic-boom/test/periodicflush.test.js +61 -0
  2846. package/node_modules/sonic-boom/test/reopen.test.js +239 -0
  2847. package/node_modules/sonic-boom/test/retry.test.js +414 -0
  2848. package/node_modules/sonic-boom/test/sync.test.js +261 -0
  2849. package/node_modules/sonic-boom/test/write.test.js +515 -0
  2850. package/node_modules/sonic-boom/types/index.d.ts +63 -0
  2851. package/node_modules/sonic-boom/types/tests/test.ts +4 -0
  2852. package/node_modules/split2/LICENSE +13 -0
  2853. package/node_modules/split2/README.md +85 -0
  2854. package/node_modules/split2/bench.js +27 -0
  2855. package/node_modules/split2/index.js +141 -0
  2856. package/node_modules/split2/package.json +39 -0
  2857. package/node_modules/split2/test.js +409 -0
  2858. package/node_modules/statuses/HISTORY.md +87 -0
  2859. package/node_modules/statuses/LICENSE +23 -0
  2860. package/node_modules/statuses/README.md +139 -0
  2861. package/node_modules/statuses/codes.json +65 -0
  2862. package/node_modules/statuses/index.js +146 -0
  2863. package/node_modules/statuses/package.json +49 -0
  2864. package/node_modules/thread-stream/.claude/settings.local.json +15 -0
  2865. package/node_modules/thread-stream/.github/dependabot.yml +13 -0
  2866. package/node_modules/thread-stream/.github/workflows/ci.yml +74 -0
  2867. package/node_modules/thread-stream/LICENSE +21 -0
  2868. package/node_modules/thread-stream/README.md +138 -0
  2869. package/node_modules/thread-stream/bench.js +85 -0
  2870. package/node_modules/thread-stream/eslint.config.js +10 -0
  2871. package/node_modules/thread-stream/index.d.ts +99 -0
  2872. package/node_modules/thread-stream/index.js +645 -0
  2873. package/node_modules/thread-stream/lib/indexes.js +11 -0
  2874. package/node_modules/thread-stream/lib/wait.js +77 -0
  2875. package/node_modules/thread-stream/lib/worker.js +298 -0
  2876. package/node_modules/thread-stream/node_modules/real-require/LICENSE.md +21 -0
  2877. package/node_modules/thread-stream/node_modules/real-require/README.md +51 -0
  2878. package/node_modules/thread-stream/node_modules/real-require/package.json +38 -0
  2879. package/node_modules/thread-stream/node_modules/real-require/src/index.js +14 -0
  2880. package/node_modules/thread-stream/package.json +50 -0
  2881. package/node_modules/thread-stream/test/base.test.js +259 -0
  2882. package/node_modules/thread-stream/test/bench.test.js +38 -0
  2883. package/node_modules/thread-stream/test/bundlers.test.js +59 -0
  2884. package/node_modules/thread-stream/test/close-on-gc.js +37 -0
  2885. package/node_modules/thread-stream/test/commonjs-fallback.test.js +75 -0
  2886. package/node_modules/thread-stream/test/context.test.js +21 -0
  2887. package/node_modules/thread-stream/test/create-and-exit.js +16 -0
  2888. package/node_modules/thread-stream/test/custom-worker.js +9 -0
  2889. package/node_modules/thread-stream/test/dir with spaces/test-package.zip +0 -0
  2890. package/node_modules/thread-stream/test/emit-event.js +22 -0
  2891. package/node_modules/thread-stream/test/end.test.js +56 -0
  2892. package/node_modules/thread-stream/test/error.js +14 -0
  2893. package/node_modules/thread-stream/test/esm.test.mjs +46 -0
  2894. package/node_modules/thread-stream/test/event.test.js +24 -0
  2895. package/node_modules/thread-stream/test/exit.js +14 -0
  2896. package/node_modules/thread-stream/test/flush-worker.js +68 -0
  2897. package/node_modules/thread-stream/test/flush.test.js +112 -0
  2898. package/node_modules/thread-stream/test/get-context.js +22 -0
  2899. package/node_modules/thread-stream/test/helper.d.ts +1 -0
  2900. package/node_modules/thread-stream/test/helper.js +26 -0
  2901. package/node_modules/thread-stream/test/indexes.test.js +11 -0
  2902. package/node_modules/thread-stream/test/message-without-code.js +19 -0
  2903. package/node_modules/thread-stream/test/multibyte-chars.test.mjs +75 -0
  2904. package/node_modules/thread-stream/test/multibyte-overrun.test.mjs +33 -0
  2905. package/node_modules/thread-stream/test/on-message.js +18 -0
  2906. package/node_modules/thread-stream/test/pkg/index.js +37 -0
  2907. package/node_modules/thread-stream/test/pkg/pkg.config.json +14 -0
  2908. package/node_modules/thread-stream/test/pkg/pkg.test.js +45 -0
  2909. package/node_modules/thread-stream/test/port.js +16 -0
  2910. package/node_modules/thread-stream/test/post-message.test.js +23 -0
  2911. package/node_modules/thread-stream/test/report-thread-name.js +16 -0
  2912. package/node_modules/thread-stream/test/string-limit-2.test.js +35 -0
  2913. package/node_modules/thread-stream/test/string-limit.test.js +37 -0
  2914. package/node_modules/thread-stream/test/syntax-error.mjs +2 -0
  2915. package/node_modules/thread-stream/test/thread-management.test.js +150 -0
  2916. package/node_modules/thread-stream/test/to-file-on-destroy.js +23 -0
  2917. package/node_modules/thread-stream/test/to-file-on-final.js +24 -0
  2918. package/node_modules/thread-stream/test/to-file.js +12 -0
  2919. package/node_modules/thread-stream/test/to-file.mjs +8 -0
  2920. package/node_modules/thread-stream/test/to-next.js +9 -0
  2921. package/node_modules/thread-stream/test/transpiled.test.js +29 -0
  2922. package/node_modules/thread-stream/test/ts/to-file.ts +10 -0
  2923. package/node_modules/thread-stream/test/ts/transpile.sh +19 -0
  2924. package/node_modules/thread-stream/test/ts-commonjs-default-export.zip +0 -0
  2925. package/node_modules/thread-stream/test/ts-native.test.mjs +35 -0
  2926. package/node_modules/thread-stream/test/ts-node-fallback.test.js +35 -0
  2927. package/node_modules/thread-stream/test/uncaughtException.js +21 -0
  2928. package/node_modules/thread-stream/test/unhandledRejection.js +21 -0
  2929. package/node_modules/thread-stream/test/watch-mode.test.js +30 -0
  2930. package/node_modules/thread-stream/test/worker-name.test.js +43 -0
  2931. package/node_modules/thread-stream/test/yarnrc.yml +7 -0
  2932. package/node_modules/thread-stream/tsconfig.json +8 -0
  2933. package/node_modules/toad-cache/LICENSE +21 -0
  2934. package/node_modules/toad-cache/README.md +265 -0
  2935. package/node_modules/toad-cache/dist/toad-cache.cjs +878 -0
  2936. package/node_modules/toad-cache/dist/toad-cache.mjs +852 -0
  2937. package/node_modules/toad-cache/package.json +84 -0
  2938. package/node_modules/toad-cache/toad-cache.d.cts +138 -0
  2939. package/node_modules/toad-cache/toad-cache.d.ts +128 -0
  2940. package/node_modules/toidentifier/HISTORY.md +9 -0
  2941. package/node_modules/toidentifier/LICENSE +21 -0
  2942. package/node_modules/toidentifier/README.md +61 -0
  2943. package/node_modules/toidentifier/index.js +32 -0
  2944. package/node_modules/toidentifier/package.json +38 -0
  2945. package/package.json +43 -20
  2946. package/scripts/build-local.sh +10 -11
  2947. package/scripts/check-app-path-boundaries.mjs +121 -0
  2948. package/scripts/check-app-spec.mjs +127 -25
  2949. package/scripts/check-colima-launchd.mjs +26 -22
  2950. package/scripts/check-integration-isolation.ts +541 -0
  2951. package/scripts/check-new-file-tests.mjs +16 -47
  2952. package/scripts/check-open-core-boundaries.mjs +334 -0
  2953. package/scripts/check-test-layering.sh +86 -0
  2954. package/scripts/fixtures/instances/hermes-sample/instance.json +3 -2
  2955. package/scripts/fixtures/instances/legacy-openclaw-sample/instance.json +1 -1
  2956. package/scripts/local-web-upgrade-test.README +147 -0
  2957. package/scripts/local-web-upgrade-test.example.env +54 -0
  2958. package/scripts/local-web-upgrade-test.sh +894 -0
  2959. package/scripts/pack-gui-and-send-pi.sh +41 -0
  2960. package/scripts/pack-with-gui.mjs +391 -0
  2961. package/scripts/perf/instances.js +1 -1
  2962. package/scripts/prune-open-core-dist.mjs +91 -0
  2963. package/scripts/run.sh +24 -25
  2964. package/scripts/setup-pi.sh +2 -2
  2965. package/scripts/smoke/hermes-bootstrap.sh +7 -7
  2966. package/scripts/smoke-backend.mjs +33 -1
  2967. package/templates/hermes-entrypoint.sh +19 -29
  2968. package/apps/openwebui-container.yaml +0 -97
  2969. package/apps/playwright-container.yaml +0 -126
  2970. package/dist/cli/panel.d.ts +0 -27
  2971. package/dist/cli/panel.js +0 -805
  2972. package/dist/cli/panel.js.map +0 -1
  2973. package/dist/crypto-shim.d.ts +0 -1
  2974. package/dist/crypto-shim.js +0 -2
  2975. package/dist/crypto-shim.js.map +0 -1
  2976. package/dist/routes/agent-apps.d.ts +0 -15
  2977. package/dist/routes/agent-apps.js +0 -78
  2978. package/dist/routes/agent-apps.js.map +0 -1
  2979. package/dist/routes/internal.d.ts +0 -2
  2980. package/dist/routes/internal.js +0 -59
  2981. package/dist/routes/internal.js.map +0 -1
  2982. package/dist/routes/runtime.d.ts +0 -15
  2983. package/dist/routes/runtime.js +0 -69
  2984. package/dist/routes/runtime.js.map +0 -1
  2985. package/dist/services/agent-apps/catalog.d.ts +0 -33
  2986. package/dist/services/agent-apps/catalog.js +0 -88
  2987. package/dist/services/agent-apps/catalog.js.map +0 -1
  2988. package/dist/services/agent-apps/index.d.ts +0 -36
  2989. package/dist/services/agent-apps/index.js +0 -171
  2990. package/dist/services/agent-apps/index.js.map +0 -1
  2991. package/dist/services/agent-apps/installers/adapter-probes.d.ts +0 -49
  2992. package/dist/services/agent-apps/installers/adapter-probes.js +0 -223
  2993. package/dist/services/agent-apps/installers/adapter-probes.js.map +0 -1
  2994. package/dist/services/agent-apps/installers/adapter.d.ts +0 -30
  2995. package/dist/services/agent-apps/installers/adapter.js +0 -171
  2996. package/dist/services/agent-apps/installers/adapter.js.map +0 -1
  2997. package/dist/services/agent-apps/installers/registry-probe.js.map +0 -1
  2998. package/dist/services/agent-apps/installers/shell-script.d.ts +0 -47
  2999. package/dist/services/agent-apps/installers/shell-script.js +0 -488
  3000. package/dist/services/agent-apps/installers/shell-script.js.map +0 -1
  3001. package/dist/services/agent-apps/types.d.ts +0 -128
  3002. package/dist/services/agent-apps/types.js +0 -17
  3003. package/dist/services/agent-apps/types.js.map +0 -1
  3004. package/dist/services/app/app-compiler.js +0 -172
  3005. package/dist/services/app/app-compiler.js.map +0 -1
  3006. package/dist/services/app/app-manager.d.ts +0 -174
  3007. package/dist/services/app/app-manager.js +0 -2741
  3008. package/dist/services/app/app-manager.js.map +0 -1
  3009. package/dist/services/app/custom-manager.d.ts +0 -27
  3010. package/dist/services/app/custom-manager.js +0 -285
  3011. package/dist/services/app/custom-manager.js.map +0 -1
  3012. package/dist/services/app/hermes-agent-manager.d.ts +0 -20
  3013. package/dist/services/app/hermes-agent-manager.js +0 -292
  3014. package/dist/services/app/hermes-agent-manager.js.map +0 -1
  3015. package/dist/services/app/id-normalizer.d.ts +0 -27
  3016. package/dist/services/app/id-normalizer.js +0 -77
  3017. package/dist/services/app/id-normalizer.js.map +0 -1
  3018. package/dist/services/app/ollama-manager.d.ts +0 -18
  3019. package/dist/services/app/ollama-manager.js +0 -207
  3020. package/dist/services/app/ollama-manager.js.map +0 -1
  3021. package/dist/services/app/openclaw-manager.d.ts +0 -63
  3022. package/dist/services/app/openclaw-manager.js +0 -1210
  3023. package/dist/services/app/openclaw-manager.js.map +0 -1
  3024. package/dist/services/app/paths.d.ts +0 -47
  3025. package/dist/services/app/paths.js +0 -68
  3026. package/dist/services/app/paths.js.map +0 -1
  3027. package/dist/services/app/platform-transform.d.ts +0 -32
  3028. package/dist/services/app/platform-transform.js +0 -65
  3029. package/dist/services/app/platform-transform.js.map +0 -1
  3030. package/dist/services/app/provide-resolver.d.ts +0 -29
  3031. package/dist/services/app/provide-resolver.js +0 -112
  3032. package/dist/services/app/provide-resolver.js.map +0 -1
  3033. package/dist/services/app/registry.d.ts +0 -17
  3034. package/dist/services/app/registry.js +0 -31
  3035. package/dist/services/app/registry.js.map +0 -1
  3036. package/dist/services/app/remote-spec.d.ts +0 -14
  3037. package/dist/services/app/remote-spec.js +0 -58
  3038. package/dist/services/app/remote-spec.js.map +0 -1
  3039. package/dist/services/app/terminal-session-manager.js +0 -157
  3040. package/dist/services/app/terminal-session-manager.js.map +0 -1
  3041. package/dist/services/app/types.d.ts +0 -72
  3042. package/dist/services/app/types.js +0 -16
  3043. package/dist/services/app/types.js.map +0 -1
  3044. package/dist/services/app-passwords.js +0 -173
  3045. package/dist/services/app-passwords.js.map +0 -1
  3046. package/dist/services/backup-manager.d.ts +0 -264
  3047. package/dist/services/backup-manager.js +0 -2264
  3048. package/dist/services/backup-manager.js.map +0 -1
  3049. package/dist/services/backup-verify.js +0 -240
  3050. package/dist/services/backup-verify.js.map +0 -1
  3051. package/dist/services/capability-endpoint-validator.d.ts +0 -41
  3052. package/dist/services/capability-endpoint-validator.js +0 -123
  3053. package/dist/services/capability-endpoint-validator.js.map +0 -1
  3054. package/dist/services/capability-health.d.ts +0 -16
  3055. package/dist/services/capability-health.js +0 -121
  3056. package/dist/services/capability-health.js.map +0 -1
  3057. package/dist/services/capability-registry.d.ts +0 -106
  3058. package/dist/services/capability-registry.js +0 -313
  3059. package/dist/services/capability-registry.js.map +0 -1
  3060. package/dist/services/connection-apply.d.ts +0 -91
  3061. package/dist/services/connection-apply.js +0 -475
  3062. package/dist/services/connection-apply.js.map +0 -1
  3063. package/dist/services/connection-resolver.d.ts +0 -65
  3064. package/dist/services/connection-resolver.js +0 -281
  3065. package/dist/services/connection-resolver.js.map +0 -1
  3066. package/dist/services/connection-transactor.d.ts +0 -39
  3067. package/dist/services/connection-transactor.js +0 -351
  3068. package/dist/services/connection-transactor.js.map +0 -1
  3069. package/dist/services/external-mounts.js +0 -187
  3070. package/dist/services/external-mounts.js.map +0 -1
  3071. package/dist/services/files-manager.d.ts +0 -252
  3072. package/dist/services/files-manager.js +0 -1075
  3073. package/dist/services/files-manager.js.map +0 -1
  3074. package/dist/services/files-mounts.d.ts +0 -42
  3075. package/dist/services/files-mounts.js +0 -207
  3076. package/dist/services/files-mounts.js.map +0 -1
  3077. package/dist/services/instance-manager.d.ts +0 -191
  3078. package/dist/services/instance-manager.js +0 -1296
  3079. package/dist/services/instance-manager.js.map +0 -1
  3080. package/dist/services/macos-launchd.d.ts +0 -89
  3081. package/dist/services/macos-launchd.js +0 -273
  3082. package/dist/services/macos-launchd.js.map +0 -1
  3083. package/dist/services/nomad-manager.d.ts +0 -290
  3084. package/dist/services/nomad-manager.js +0 -3953
  3085. package/dist/services/nomad-manager.js.map +0 -1
  3086. package/dist/services/organize/applier.js +0 -218
  3087. package/dist/services/organize/applier.js.map +0 -1
  3088. package/dist/services/organize/rules.js +0 -286
  3089. package/dist/services/organize/rules.js.map +0 -1
  3090. package/dist/services/organize/scanner.js +0 -366
  3091. package/dist/services/organize/scanner.js.map +0 -1
  3092. package/dist/services/organize/store.js +0 -82
  3093. package/dist/services/organize/store.js.map +0 -1
  3094. package/dist/services/panel-manager.d.ts +0 -50
  3095. package/dist/services/panel-manager.js +0 -472
  3096. package/dist/services/panel-manager.js.map +0 -1
  3097. package/dist/services/plugin-installer.js +0 -128
  3098. package/dist/services/plugin-installer.js.map +0 -1
  3099. package/dist/services/process-manager.d.ts +0 -25
  3100. package/dist/services/process-manager.js +0 -568
  3101. package/dist/services/process-manager.js.map +0 -1
  3102. package/dist/services/runtime/adapters/custom.d.ts +0 -20
  3103. package/dist/services/runtime/adapters/custom.js +0 -146
  3104. package/dist/services/runtime/adapters/custom.js.map +0 -1
  3105. package/dist/services/runtime/adapters/hermes.d.ts +0 -204
  3106. package/dist/services/runtime/adapters/hermes.js +0 -1631
  3107. package/dist/services/runtime/adapters/hermes.js.map +0 -1
  3108. package/dist/services/runtime/adapters/openclaw-mcporter.d.ts +0 -45
  3109. package/dist/services/runtime/adapters/openclaw-mcporter.js +0 -108
  3110. package/dist/services/runtime/adapters/openclaw-mcporter.js.map +0 -1
  3111. package/dist/services/runtime/adapters/openclaw-routes.d.ts +0 -23
  3112. package/dist/services/runtime/adapters/openclaw-routes.js +0 -1014
  3113. package/dist/services/runtime/adapters/openclaw-routes.js.map +0 -1
  3114. package/dist/services/runtime/adapters/openclaw.d.ts +0 -393
  3115. package/dist/services/runtime/adapters/openclaw.js +0 -3853
  3116. package/dist/services/runtime/adapters/openclaw.js.map +0 -1
  3117. package/dist/services/runtime/index.d.ts +0 -34
  3118. package/dist/services/runtime/index.js +0 -51
  3119. package/dist/services/runtime/index.js.map +0 -1
  3120. package/dist/services/runtime/mcp-shims/anythingllm-shim.d.ts +0 -46
  3121. package/dist/services/runtime/mcp-shims/anythingllm-shim.js +0 -281
  3122. package/dist/services/runtime/mcp-shims/anythingllm-shim.js.map +0 -1
  3123. package/dist/services/runtime/mcp-shims/drive-shim.d.ts +0 -54
  3124. package/dist/services/runtime/mcp-shims/drive-shim.js +0 -489
  3125. package/dist/services/runtime/mcp-shims/drive-shim.js.map +0 -1
  3126. package/dist/services/runtime/migrations.d.ts +0 -23
  3127. package/dist/services/runtime/migrations.js +0 -125
  3128. package/dist/services/runtime/migrations.js.map +0 -1
  3129. package/dist/services/runtime/registry.d.ts +0 -13
  3130. package/dist/services/runtime/registry.js +0 -32
  3131. package/dist/services/runtime/registry.js.map +0 -1
  3132. package/dist/services/setup-manager.d.ts +0 -136
  3133. package/dist/services/setup-manager.js +0 -2149
  3134. package/dist/services/setup-manager.js.map +0 -1
  3135. package/dist/services/suggestions.d.ts +0 -27
  3136. package/dist/services/suggestions.js +0 -133
  3137. package/dist/services/suggestions.js.map +0 -1
  3138. package/dist/services/system-monitor.js +0 -79
  3139. package/dist/services/system-monitor.js.map +0 -1
  3140. package/dist/services/task-registry.d.ts +0 -44
  3141. package/dist/services/task-registry.js +0 -76
  3142. package/dist/services/task-registry.js.map +0 -1
  3143. package/dist/services/types-shim.d.ts +0 -16
  3144. package/dist/services/types-shim.js +0 -2
  3145. package/dist/services/types-shim.js.map +0 -1
  3146. package/dist/services/update-manager.d.ts +0 -47
  3147. package/dist/services/update-manager.js +0 -323
  3148. package/dist/services/update-manager.js.map +0 -1
  3149. package/dist/services/webdav/server.d.ts +0 -24
  3150. package/dist/services/webdav/server.js +0 -420
  3151. package/dist/services/webdav/server.js.map +0 -1
  3152. package/dist/services/webdav/xml-builder.js.map +0 -1
  3153. package/dist/services/workspace-builder.d.ts +0 -29
  3154. package/dist/services/workspace-builder.js +0 -188
  3155. package/dist/services/workspace-builder.js.map +0 -1
  3156. package/public/assets/ApiKeyField-CvyAOcJS.js +0 -1
  3157. package/public/assets/Dashboard-AuJESBlJ.js +0 -1
  3158. package/public/assets/HermesChatPanel-CByPREwb.js +0 -1
  3159. package/public/assets/HermesConfigForm-DRda8FKX.js +0 -4
  3160. package/public/assets/InitPassword-ka4wNpM5.js +0 -1
  3161. package/public/assets/InstanceDetail-Cg1nS8HX.js +0 -92
  3162. package/public/assets/Login-aPajuQzf.js +0 -1
  3163. package/public/assets/NewInstance-Dd1ebNIx.js +0 -1
  3164. package/public/assets/ProviderRecommendations-DFmADQ7V.js +0 -1
  3165. package/public/assets/Settings-BYQnbLYL.js +0 -1
  3166. package/public/assets/Setup-D05lwDOV.js +0 -1
  3167. package/public/assets/WeixinLoginPanel-D89kdhP4.js +0 -9
  3168. package/public/assets/index-HSXCsceK.css +0 -1
  3169. package/public/assets/index-bnBu0nlQ.js +0 -19
  3170. package/public/assets/registry-C_qeFTkZ.js +0 -2
  3171. package/public/assets/usePolling-Bn93fe7M.js +0 -1
  3172. package/public/assets/vendor-i18n-flxcMVeP.js +0 -9
  3173. package/public/assets/vendor-react-ZC5T_huj.js +0 -59
  3174. package/public/index.html +0 -20
  3175. package/scripts/build-image.sh +0 -55
  3176. package/scripts/check-adapter-isolation.ts +0 -293
  3177. package/scripts/check-i18n.mjs +0 -154
  3178. /package/dist/services/{app → app-common}/app-compiler.d.ts +0 -0
  3179. /package/dist/services/{app → app-common}/terminal-session-manager.d.ts +0 -0
  3180. /package/dist/services/{backup-verify.d.ts → backup/backup-verify.d.ts} +0 -0
  3181. /package/dist/services/{external-mounts.d.ts → files/external-mounts.d.ts} +0 -0
  3182. /package/dist/services/{organize → files/organize}/applier.d.ts +0 -0
  3183. /package/dist/services/{organize → files/organize}/rules.d.ts +0 -0
  3184. /package/dist/services/{organize → files/organize}/scanner.d.ts +0 -0
  3185. /package/dist/services/{organize → files/organize}/store.d.ts +0 -0
  3186. /package/dist/services/{webdav → files/webdav}/xml-builder.d.ts +0 -0
  3187. /package/dist/services/{webdav → files/webdav}/xml-builder.js +0 -0
  3188. /package/dist/services/{app-passwords.d.ts → instances/passwords.d.ts} +0 -0
  3189. /package/dist/services/{agent-apps → integrations/installable}/installers/registry-probe.d.ts +0 -0
  3190. /package/dist/services/{agent-apps → integrations/installable}/installers/registry-probe.js +0 -0
  3191. /package/dist/services/{plugin-installer.d.ts → setup/plugin-installer.d.ts} +0 -0
  3192. /package/dist/services/{system-monitor.d.ts → system/system-monitor.d.ts} +0 -0
  3193. /package/{public → node_modules/jishushell-panel/output/public}/assets/logo-black-theme-DywLAtFy.png +0 -0
  3194. /package/{public → node_modules/jishushell-panel/output/public}/assets/logo-white-theme-DXffFAWw.png +0 -0
  3195. /package/{public → node_modules/jishushell-panel/output/public}/favicon.png +0 -0
  3196. /package/{public → node_modules/jishushell-panel/output/public}/logos/hermes.png +0 -0
  3197. /package/{public → node_modules/jishushell-panel/output/public}/logos/ollama.png +0 -0
  3198. /package/{public → node_modules/jishushell-panel/output/public}/logos/openclaw.svg +0 -0
@@ -1,3953 +0,0 @@
1
- /**
2
- * Nomad-based service manager — kind-agnostic scheduler layer.
3
- *
4
- * §32.2 / §32.8: this file contains ZERO knowledge of specific agent kinds.
5
- * Runtime-specific task assembly (`buildNomadTask`), pre-start patches
6
- * (`hooks.onBeforeStart`), and capability profiles live inside
7
- * `src/services/runtime/adapters/<agentType>.ts`. Framework dispatch is:
8
- *
9
- * const agentType = resolveAgentType(getInstance(id));
10
- * const adapter = getAdapter(agentType);
11
- * await adapter.hooks?.onBeforeStart?.({ instanceId });
12
- * const task = await adapter.buildNomadTask(instanceId);
13
- */
14
- import { execFile as execFileCb, spawn } from "child_process";
15
- import { existsSync, readFileSync } from "fs";
16
- import { createServer as netCreateServer } from "net";
17
- import { homedir, userInfo } from "os";
18
- import { basename, join } from "path";
19
- import { StringDecoder } from "string_decoder";
20
- import { promisify } from "util";
21
- import { parse } from "yaml";
22
- import * as config from "../config.js";
23
- import { extractGatewayPort, getGatewayPort, getInstance, getInstanceRuntime, instanceMetaPath, getRuntimeEnv, isPortInUse, reallocateGatewayPort, } from "./instance-manager.js";
24
- import { getAdapter, resolveAgentType } from "./runtime/index.js";
25
- function getConfigValue(name) {
26
- return name in config ? config[name] : undefined;
27
- }
28
- function resolveConfigPath(value, fallback) {
29
- return typeof value === "string" && value.trim() ? value : fallback;
30
- }
31
- const JISHUSHELL_HOME = resolveConfigPath(getConfigValue("JISHUSHELL_HOME"), join(process.env.HOME ?? homedir(), ".jishushell"));
32
- const APPS_DIR = resolveConfigPath(getConfigValue("APPS_DIR"), join(JISHUSHELL_HOME, "apps"));
33
- const _INSTANCES_DIR = resolveConfigPath(getConfigValue("INSTANCES_DIR"), join(JISHUSHELL_HOME, "instances"));
34
- const getNomadAddrValue = getConfigValue("getNomadAddr");
35
- const getNomadDriverValue = getConfigValue("getNomadDriver");
36
- const getNomadTokenValue = getConfigValue("getNomadToken");
37
- const getPanelConfigValue = getConfigValue("getPanelConfig");
38
- const getNomadAddr = typeof getNomadAddrValue === "function"
39
- ? getNomadAddrValue
40
- : () => "http://127.0.0.1:4646";
41
- const getNomadDriver = typeof getNomadDriverValue === "function"
42
- ? getNomadDriverValue
43
- : () => "docker";
44
- const getNomadToken = typeof getNomadTokenValue === "function"
45
- ? getNomadTokenValue
46
- : () => "";
47
- const getPanelConfig = typeof getPanelConfigValue === "function"
48
- ? getPanelConfigValue
49
- : () => ({});
50
- // Docker image names must match this pattern to prevent command injection.
51
- export const DOCKER_IMAGE_RE = /^[a-zA-Z0-9][a-zA-Z0-9\-_.:/@]*$/;
52
- /**
53
- * Linux username validation regex. Shared by adapter Nomad task builders
54
- * (OpenClaw / Hermes) and re-exported here as a neutral framework constant
55
- * so security-regression tests can assert on it without depending on a
56
- * specific adapter file.
57
- *
58
- * Strict form: lowercase letters/digits/dot/dash/underscore only, 1..32 chars.
59
- * Rejects uppercase, shell metacharacters, paths, and empty strings.
60
- */
61
- export const VALID_USER_RE = /^[a-z0-9._-]{1,32}$/;
62
- // Maximum allowed length for a Docker image reference.
63
- export const MAX_DOCKER_IMAGE_NAME_LEN = 256;
64
- /**
65
- * Nomad job name prefix. Dispatched via `adapter.nomadJobPrefix` so
66
- * every runtime owns its own namespace (`hermes-<id>`, `openclaw-<id>`,
67
- * …). New agent runtimes should declare their own prefix on the
68
- * adapter rather than re-using another kind's. Falls back to the
69
- * framework-generic `jishushell-` only when the adapter lookup fails —
70
- * that branch shouldn't fire for a registered agent type.
71
- */
72
- function jobPrefixFor(instanceId) {
73
- try {
74
- const agentType = getInstanceAgentType(instanceId);
75
- const adapter = getAdapter(agentType);
76
- return adapter.nomadJobPrefix ?? "jishushell-";
77
- }
78
- catch {
79
- return "jishushell-";
80
- }
81
- }
82
- /**
83
- * Per-instance Nomad Variable subpath. Returned without the leading
84
- * `nomad/jobs/<jid>/` prefix. `undefined` means this adapter does not
85
- * use Nomad Variables — writeInstanceVariables/purgeInstanceVariables
86
- * become no-ops.
87
- */
88
- function adapterVariableSubpath(instanceId) {
89
- try {
90
- const agentType = getInstanceAgentType(instanceId);
91
- const adapter = getAdapter(agentType);
92
- return adapter.nomadVariablePath;
93
- }
94
- catch {
95
- return undefined;
96
- }
97
- }
98
- /**
99
- * Resolve the Nomad task name for the given instance. Reads
100
- * `adapter.nomadTaskName` so framework code never hardcodes "gateway".
101
- * Falls back to "gateway" for backwards compat when the adapter leaves it
102
- * unset or the lookup fails.
103
- */
104
- function resolveTaskName(instanceId) {
105
- try {
106
- const agentType = getInstanceAgentType(instanceId);
107
- return getAdapter(agentType).nomadTaskName ?? "gateway";
108
- }
109
- catch {
110
- return "gateway";
111
- }
112
- }
113
- function getLegacyManagedAppType(instanceId) {
114
- const meta = getInstance(instanceId);
115
- const appType = typeof meta?.app_type === "string" ? meta.app_type.trim() : "";
116
- return appType === "custom" || appType === "ollama" ? appType : null;
117
- }
118
- async function getLegacyAppManager(instanceId) {
119
- const appType = getLegacyManagedAppType(instanceId);
120
- if (!appType)
121
- return null;
122
- const { getAppManager } = await import("./app/registry.js");
123
- return getAppManager(appType);
124
- }
125
- async function getInstanceBackedInstalledApp(instanceId) {
126
- const { getApp } = await import("./app/app-manager.js");
127
- const appData = getApp(instanceId);
128
- if (!appData || appData.manifest.install_mode !== "instance-dir")
129
- return null;
130
- return appData;
131
- }
132
- async function getAppDirInstalledApp(instanceId) {
133
- const { getApp } = await import("./app/app-manager.js");
134
- const appData = getApp(instanceId);
135
- if (!appData || appData.manifest.install_mode !== "app-dir")
136
- return null;
137
- return appData;
138
- }
139
- // Tracks the panel's listening port so bridge-mode containers can reach it via host.docker.internal.
140
- let _panelPort = 8090;
141
- export function setPanelPort(port) { _panelPort = port; }
142
- // §32.2 / §32.8: patchJsproxyBaseUrl / patchDockerBridgeGatewayBind /
143
- // ensureOpenclawUpdateSeed previously lived here (~140 lines). They are now
144
- // owned by `src/services/runtime/adapters/openclaw.ts` and invoked via
145
- // `adapter.hooks.onBeforeStart({ instanceId })` in startInstance below.
146
- export const VALID_LOG_TYPES = new Set(["stdout", "stderr"]);
147
- async function inspectDockerLogPath(command, args) {
148
- try {
149
- const { stdout } = await execFileAsync(command, args, { timeout: 5_000 });
150
- const logPath = stdout.trim();
151
- return logPath || null;
152
- }
153
- catch {
154
- return null;
155
- }
156
- }
157
- async function resolveDockerLogPath(containerName) {
158
- const direct = await inspectDockerLogPath("docker", [
159
- "inspect",
160
- "--format",
161
- "{{.LogPath}}",
162
- containerName,
163
- ]);
164
- if (direct)
165
- return direct;
166
- return inspectDockerLogPath("sudo", [
167
- "-n",
168
- "docker",
169
- "inspect",
170
- "--format",
171
- "{{.LogPath}}",
172
- containerName,
173
- ]);
174
- }
175
- async function readDockerLogText(logPath, lines) {
176
- try {
177
- return readFileSync(logPath, "utf-8");
178
- }
179
- catch {
180
- try {
181
- const tailLines = String(Math.max(lines * 50, 2_000));
182
- const { stdout } = await execFileAsync("sudo", ["-n", "tail", "-n", tailLines, logPath], {
183
- timeout: 5_000,
184
- });
185
- return stdout;
186
- }
187
- catch {
188
- return "";
189
- }
190
- }
191
- }
192
- async function readDockerCliLogs(containerName, lines) {
193
- const commands = [
194
- { command: "docker", args: ["logs", "--tail", String(lines), containerName] },
195
- { command: "sudo", args: ["-n", "docker", "logs", "--tail", String(lines), containerName] },
196
- ];
197
- for (const candidate of commands) {
198
- try {
199
- const { stdout, stderr } = await execFileAsync(candidate.command, candidate.args, { timeout: 10_000 });
200
- const combined = `${stdout}${stderr}`.trim();
201
- if (combined)
202
- return combined.split("\n").slice(-lines);
203
- }
204
- catch {
205
- continue;
206
- }
207
- }
208
- return [];
209
- }
210
- async function readDockerStreamLogs(containerName, lines = 200, logType = "stderr") {
211
- if (!VALID_LOG_TYPES.has(logType))
212
- logType = "stderr";
213
- const logPath = await resolveDockerLogPath(containerName);
214
- if (!logPath)
215
- return readDockerCliLogs(containerName, lines);
216
- const rawText = await readDockerLogText(logPath, lines);
217
- if (!rawText)
218
- return readDockerCliLogs(containerName, lines);
219
- const collected = [];
220
- const entries = rawText.split("\n");
221
- for (let index = entries.length - 1; index >= 0 && collected.length < lines; index--) {
222
- const line = entries[index]?.trim();
223
- if (!line)
224
- continue;
225
- try {
226
- const parsed = JSON.parse(line);
227
- if (parsed.stream !== logType)
228
- continue;
229
- const message = typeof parsed.log === "string"
230
- ? parsed.log.replace(/\n$/, "")
231
- : "";
232
- if (message)
233
- collected.push(message);
234
- }
235
- catch {
236
- continue;
237
- }
238
- }
239
- const streamLines = collected.reverse();
240
- if (streamLines.length > 0)
241
- return streamLines;
242
- return readDockerCliLogs(containerName, lines);
243
- }
244
- function nomadAuthHeaders() {
245
- const token = getNomadToken();
246
- return token ? { "X-Nomad-Token": token } : {};
247
- }
248
- // §32.2 / §32.8: scheduler-level defaults and resource ceilings. Runtime
249
- // command / args / env / resources now live inside each adapter's
250
- // `buildNomadTask` — nomad-manager never looks at them directly.
251
- function jobId(instanceId) {
252
- const prefix = jobPrefixFor(instanceId);
253
- if (!prefix)
254
- return instanceId;
255
- if (instanceId.startsWith(prefix))
256
- return instanceId;
257
- return `${prefix}${instanceId}`;
258
- }
259
- /** Exported only for unit tests — not part of the public API. */
260
- export function __jobIdForTests(instanceId) {
261
- return jobId(instanceId);
262
- }
263
- // Nomad Template metacharacters that must not appear in values interpolated
264
- // into EmbeddedTmpl. Defense-in-depth: instanceId is already validated by the
265
- // route layer, but this guard makes the template-building code self-contained.
266
- export const NOMAD_TEMPLATE_UNSAFE_RE = /[{}"\\]/;
267
- function assertSafeTemplateId(id) {
268
- if (NOMAD_TEMPLATE_UNSAFE_RE.test(id)) {
269
- throw new Error(`Job ID "${id}" contains characters unsafe for Nomad Template interpolation`);
270
- }
271
- }
272
- async function nomadGet(path) {
273
- const resp = await fetch(`${getNomadAddr()}${path}`, {
274
- headers: nomadAuthHeaders(),
275
- signal: AbortSignal.timeout(10000),
276
- });
277
- if (!resp.ok && resp.status !== 404)
278
- throw new Error(`Nomad ${path}: ${resp.status}`);
279
- return resp;
280
- }
281
- async function nomadPost(path, body) {
282
- return fetch(`${getNomadAddr()}${path}`, {
283
- method: "POST",
284
- headers: { "Content-Type": "application/json", ...nomadAuthHeaders() },
285
- body: JSON.stringify(body),
286
- signal: AbortSignal.timeout(10000),
287
- });
288
- }
289
- async function nomadDelete(path) {
290
- return fetch(`${getNomadAddr()}${path}`, {
291
- method: "DELETE",
292
- headers: nomadAuthHeaders(),
293
- signal: AbortSignal.timeout(10000),
294
- });
295
- }
296
- async function nomadPut(path, body) {
297
- return fetch(`${getNomadAddr()}${path}`, {
298
- method: "PUT",
299
- headers: { "Content-Type": "application/json", ...nomadAuthHeaders() },
300
- body: JSON.stringify(body),
301
- signal: AbortSignal.timeout(10000),
302
- });
303
- }
304
- // ── Nomad Variables (secrets) ──
305
- export async function writeInstanceVariables(instanceId) {
306
- const jid = jobId(instanceId);
307
- // (short-term mitigation): variable path follows Nomad's workload-identity
308
- // convention. Each job's workload identity has implicit read/write access only
309
- // to variables under its own nomad/jobs/<job-id>/ prefix, providing per-job
310
- // secret isolation within the shared "default" namespace. Per-instance Nomad
311
- // namespaces remain a planned future improvement.
312
- const ns = "default";
313
- const subpath = adapterVariableSubpath(instanceId);
314
- if (!subpath)
315
- return;
316
- const varPath = `nomad/jobs/${jid}/${subpath}`;
317
- const encodedPath = encodeURIComponent(varPath);
318
- // Read proxy token from env file
319
- const env = getRuntimeEnv(instanceId);
320
- const proxyToken = env.JSPROXY_API_KEY || "";
321
- // Nothing to store when proxy token is unconfigured.
322
- if (!proxyToken)
323
- return;
324
- const items = { JSPROXY_API_KEY: proxyToken };
325
- // retry with exponential back-off on CAS conflicts (409) so concurrent
326
- // startInstance calls do not silently discard the latest token. Throw after
327
- // MAX_ATTEMPTS so the caller can surface the error instead of continuing with
328
- // a missing proxy token.
329
- const MAX_ATTEMPTS = 3;
330
- for (let attempt = 0; attempt < MAX_ATTEMPTS; attempt++) {
331
- // Re-read ModifyIndex on every attempt to always CAS against the latest version.
332
- let cas = 0;
333
- try {
334
- const existing = await nomadGet(`/v1/var/${encodedPath}?namespace=${ns}`);
335
- if (existing.ok) {
336
- const data = await existing.json();
337
- cas = data.ModifyIndex || 0;
338
- }
339
- }
340
- catch { /* variable may not exist yet — cas=0 creates a new one */ }
341
- const resp = await nomadPut(`/v1/var/${encodedPath}?cas=${cas}&namespace=${ns}`, {
342
- Namespace: ns,
343
- Path: varPath,
344
- Items: items,
345
- });
346
- if (resp.ok)
347
- return;
348
- const text = await resp.text();
349
- // 409 Conflict = CAS mismatch; another writer won the race — retry.
350
- if (resp.status === 409 && attempt < MAX_ATTEMPTS - 1) {
351
- await new Promise(r => setTimeout(r, 100 * Math.pow(2, attempt)));
352
- continue;
353
- }
354
- throw new Error(`Failed to write Nomad Variables for ${instanceId}` +
355
- ` (attempt ${attempt + 1}/${MAX_ATTEMPTS}): HTTP ${resp.status} ${text}`);
356
- }
357
- }
358
- export async function purgeInstanceVariables(instanceId) {
359
- const jid = jobId(instanceId);
360
- const subpath = adapterVariableSubpath(instanceId);
361
- if (!subpath)
362
- return;
363
- const varPath = `nomad/jobs/${jid}/${subpath}`;
364
- const encodedPath = encodeURIComponent(varPath);
365
- try {
366
- // Match writeInstanceVariables symmetry: always pin the namespace on
367
- // every Variables API call so the delete cannot drift into a different
368
- // namespace if Nomad's default-namespace behaviour changes between
369
- // minor versions. Without this, a schema tweak in a future 1.6.x point
370
- // release could leave a stale secret behind after purge=true.
371
- const resp = await nomadDelete(`/v1/var/${encodedPath}?namespace=default`);
372
- if (!resp.ok && resp.status !== 404) {
373
- console.warn(`[nomad] Failed to purge variables for ${instanceId}: HTTP ${resp.status}`);
374
- }
375
- }
376
- catch (e) {
377
- console.warn(`[nomad] Failed to purge variables for ${instanceId}: ${e.message}`);
378
- }
379
- }
380
- /**
381
- * Resolve the numeric uid:gid for a given username by reading /etc/passwd.
382
- * Falls back to process.getuid!():process.getgid!() when the lookup fails.
383
- * Still used here by the kind-agnostic `exec()` helper below (for docker
384
- * exec user resolution); adapters carry their own copies for task build.
385
- */
386
- function resolveUidGid(username) {
387
- try {
388
- const passwd = readFileSync("/etc/passwd", "utf-8");
389
- const line = passwd.split("\n").find(l => l.startsWith(username + ":"));
390
- if (line) {
391
- const parts = line.split(":");
392
- const uid = parseInt(parts[2], 10);
393
- const gid = parseInt(parts[3], 10);
394
- if (!isNaN(uid) && !isNaN(gid))
395
- return `${uid}:${gid}`;
396
- }
397
- }
398
- catch { /* ignore */ }
399
- return `${process.getuid()}:${process.getgid()}`;
400
- }
401
- // §32.2 / §32.8:
402
- // The previous ~380 lines of OpenClaw / Hermes task assembly
403
- // (`buildRuntime`, `buildTaskDocker`, `buildHermesTaskDocker`, resource
404
- // normalizer, kind detector) have been physically migrated into
405
- // `src/services/runtime/adapters/{openclaw,hermes}.ts:buildNomadTask()`.
406
- // Framework code here is now a pure dispatcher: it asks the adapter for
407
- // a Nomad task definition and embeds it in the job spec below.
408
- function getInstanceAgentType(instanceId) {
409
- try {
410
- const meta = getInstance(instanceId);
411
- return resolveAgentType(meta);
412
- }
413
- catch {
414
- return "openclaw";
415
- }
416
- }
417
- function wrapNomadJob(jid, groupName, task) {
418
- // Adapters declare port reservations on `task.Resources.Networks` (legacy
419
- // schema). The docker driver's `Config.ports = [<label>]` lookup, however,
420
- // resolves labels against the TaskGroup-level `Networks` block. Move (not
421
- // copy) the network block so the docker driver can find the port and so
422
- // HostNetwork ("external") is honored — without this, ports publish to
423
- // 127.0.0.1 by default. Keeping it on both levels would make Nomad reject
424
- // the job with "port label already in use".
425
- const taskNetworks = Array.isArray(task?.Resources?.Networks)
426
- ? task.Resources.Networks
427
- : [];
428
- const groupNetworks = taskNetworks.length > 0 ? taskNetworks.map((n) => ({ ...n })) : undefined;
429
- if (groupNetworks && task?.Resources && typeof task.Resources === "object") {
430
- delete task.Resources.Networks;
431
- }
432
- return {
433
- Job: {
434
- ID: jid,
435
- Name: jid,
436
- Namespace: "default",
437
- Type: "service",
438
- Datacenters: ["*"],
439
- TaskGroups: [{
440
- Name: groupName,
441
- Count: 1,
442
- ...(groupNetworks ? { Networks: groupNetworks } : {}),
443
- RestartPolicy: {
444
- // 10 attempts × 15s delay = ~2.5min recovery window. Multi-task
445
- // groups (e.g. weknora-app racing paradedb cold-init) commonly
446
- // need 3-5 restarts before the dependency's external port-publish
447
- // settles. Previous 3-attempt cap caused alloc-fail cascades on
448
- // first-boot of stacks with DB sidecars.
449
- Attempts: 10,
450
- Interval: 600000000000,
451
- Delay: 15000000000,
452
- Mode: "fail",
453
- },
454
- Reschedule: {
455
- // Allow Nomad to reschedule the whole alloc up to 3 times if all
456
- // restarts fail (e.g. transient image pull or host reboot).
457
- // Unlimited stays false to keep alloc churn bounded.
458
- Attempts: 3,
459
- Interval: 3600000000000,
460
- Unlimited: false,
461
- },
462
- Update: {
463
- MaxParallel: 1,
464
- HealthCheck: "task_states",
465
- MinHealthyTime: 5000000000,
466
- HealthyDeadline: 60000000000,
467
- AutoRevert: false,
468
- },
469
- Tasks: [task],
470
- }],
471
- },
472
- };
473
- }
474
- async function buildJob(instanceId) {
475
- const jid = jobId(instanceId);
476
- const driver = getNomadDriver();
477
- if (driver !== "docker") {
478
- throw new Error(`Unsupported Nomad driver: ${driver}. Only "docker" is supported.`);
479
- }
480
- const legacyManager = await getLegacyAppManager(instanceId);
481
- if (legacyManager) {
482
- const runtime = legacyManager.buildRuntime(instanceId);
483
- const task = legacyManager.buildNomadTask(instanceId, runtime, jid);
484
- await injectConnectionsRuntimeEnv(instanceId, task);
485
- return wrapNomadJob(jid, legacyManager.nomadTaskGroupName(), task);
486
- }
487
- // Pure adapter dispatch — no more `isHermesInstance()` / kind literals.
488
- const agentType = getInstanceAgentType(instanceId);
489
- const adapter = getAdapter(agentType);
490
- if (!adapter.buildNomadTask) {
491
- throw new Error(`Runtime adapter "${agentType}" does not implement buildNomadTask(); cannot schedule Nomad job`);
492
- }
493
- const task = await adapter.buildNomadTask(instanceId);
494
- await injectConnectionsRuntimeEnv(instanceId, task);
495
- // Task group name mirrors the agentType. Log/status helpers resolve the
496
- // Nomad task name via resolveTaskName(instanceId) → adapter.nomadTaskName.
497
- const groupName = agentType;
498
- return wrapNomadJob(jid, groupName, task);
499
- }
500
- /**
501
- * Re-resolve `instance.connections` against the live capability registry
502
- * and merge the resulting env into the freshly-built Nomad task. Idempotent
503
- * — empty meta.connections short-circuits to a no-op.
504
- *
505
- * Resolving at start time (rather than reading the frozen
506
- * `instance.json["connections-env"]` written by PUT /connections) means
507
- * provider port / address changes in the registry propagate on next
508
- * restart without requiring the user to re-bind. Failures here are
509
- * logged but never block start: a missing required binding still surfaces
510
- * via the Connections UI status badge.
511
- */
512
- async function injectConnectionsRuntimeEnv(instanceId, task) {
513
- try {
514
- const meta = getInstance(instanceId);
515
- const connections = meta?.connections;
516
- if (!meta || !connections || Object.keys(connections).length === 0)
517
- return;
518
- const { loadCapabilitySpecForLegacyInstance } = await import("./runtime/migrations.js");
519
- const spec = loadCapabilitySpecForLegacyInstance(meta);
520
- if (!spec)
521
- return;
522
- const { resolveConnections } = await import("./connection-resolver.js");
523
- const { resolved } = resolveConnections(spec, { connections }, "preCreate");
524
- if (resolved.length === 0)
525
- return;
526
- const { RUNTIME_HOOKS } = await import("./connection-apply.js");
527
- const merged = {};
528
- for (const binding of resolved) {
529
- const hook = RUNTIME_HOOKS[binding.category];
530
- if (!hook)
531
- continue;
532
- Object.assign(merged, await hook(meta, binding));
533
- }
534
- if (Object.keys(merged).length === 0)
535
- return;
536
- task.Env = { ...(task.Env ?? {}), ...merged };
537
- }
538
- catch (e) {
539
- console.warn(`[nomad] connections runtime env merge failed for ${instanceId}: ${e?.message ?? e}`);
540
- }
541
- }
542
- async function getRunningAlloc(instanceId) {
543
- const allocs = await getAllocs(instanceId);
544
- if (!allocs)
545
- return null;
546
- for (const status of ["running", "pending"]) {
547
- for (const alloc of allocs) {
548
- if (alloc.ClientStatus === status)
549
- return alloc;
550
- }
551
- }
552
- return null;
553
- }
554
- async function getAllocs(instanceId) {
555
- const jid = jobId(instanceId);
556
- try {
557
- const resp = await nomadGet(`/v1/job/${jid}/allocations`);
558
- if (resp.status === 404)
559
- return [];
560
- const allocs = await resp.json();
561
- return Array.isArray(allocs) ? allocs : [];
562
- }
563
- catch {
564
- return null;
565
- }
566
- }
567
- function latestAlloc(allocs) {
568
- if (!allocs.length)
569
- return null;
570
- return [...allocs].sort((a, b) => ((b.ModifyIndex ?? b.CreateIndex ?? 0) - (a.ModifyIndex ?? a.CreateIndex ?? 0)))[0] ?? null;
571
- }
572
- // Returns true if the Nomad job exists and was NOT explicitly stopped by the user (Stop=false).
573
- // Used on jishushell startup to auto-restart instances that were running before a reboot.
574
- export async function shouldAutoStart(instanceId) {
575
- const jid = jobId(instanceId);
576
- try {
577
- const resp = await nomadGet(`/v1/job/${jid}`);
578
- // 404 = nomad has no record of this job. Two cases:
579
- // (a) Raft was wiped — e.g. Nomad 1.11.3 → 1.6.5 auto-migration
580
- // (install/jishu-install.sh:_migrate_nomad_to_target). The
581
- // on-disk instance config is still present and MUST be
582
- // resubmitted on the next jishushell startup, otherwise every
583
- // OpenClaw instance silently disappears after the upgrade.
584
- // (b) Brand-new instance created without a default_provider, never
585
- // started via /api/instances/.../service/start. Resubmitting it
586
- // here is a safe superset — the Nomad job is idempotent and the
587
- // container starts whether or not a provider is configured; the
588
- // user still needs to configure one to answer chat.
589
- // Returning true on 404 covers (a); (b) is an accepted side effect and
590
- // does not regress any user-facing behaviour.
591
- if (resp.status === 404)
592
- return true;
593
- if (!resp.ok)
594
- return false;
595
- const job = await resp.json();
596
- // Stop=true means user explicitly stopped it; Stop=false means it was running.
597
- // Also skip dead jobs — all allocs failed, resubmitting would fail again.
598
- return job.Stop === false && job.Status !== "dead";
599
- }
600
- catch {
601
- return false;
602
- }
603
- }
604
- export async function getStatus(instanceId) {
605
- const jid = jobId(instanceId);
606
- const stopped = { status: "stopped", pid: null, uptime: null, memory_mb: null, cpu_percent: null };
607
- try {
608
- const resp = await nomadGet(`/v1/job/${jid}`);
609
- if (resp.status === 404)
610
- return stopped;
611
- const job = await resp.json();
612
- if (job.Stop)
613
- return stopped;
614
- }
615
- catch {
616
- return { ...stopped, status: "unknown", error: "Nomad unreachable" };
617
- }
618
- const allocs = await getAllocs(instanceId);
619
- if (allocs == null || allocs.length === 0)
620
- return { ...stopped, status: "pending" };
621
- const alloc = allocs.find((entry) => entry.ClientStatus === "running")
622
- ?? allocs.find((entry) => entry.ClientStatus === "pending")
623
- ?? latestAlloc(allocs);
624
- if (!alloc)
625
- return { ...stopped, status: "pending" };
626
- const allocId = alloc.ID;
627
- const result = {
628
- status: alloc.ClientStatus || "unknown",
629
- alloc_id: allocId,
630
- pid: null,
631
- uptime: null,
632
- memory_mb: null,
633
- cpu_percent: null,
634
- restarts: 0,
635
- };
636
- const gwState = alloc.TaskStates?.[resolveTaskName(instanceId)] || {};
637
- result.restarts = gwState.Restarts || 0;
638
- const startedAt = gwState.StartedAt;
639
- if (startedAt) {
640
- try {
641
- const start = new Date(startedAt);
642
- result.uptime = Math.floor((Date.now() - start.getTime()) / 1000);
643
- }
644
- catch { /* ignore */ }
645
- }
646
- try {
647
- const statsResp = await nomadGet(`/v1/client/allocation/${allocId}/stats`);
648
- if (statsResp.ok) {
649
- const stats = await statsResp.json();
650
- // raw_exec: stats nested under Tasks.<taskName>; docker: top-level ResourceUsage
651
- const tn = resolveTaskName(instanceId);
652
- const taskStats = stats.Tasks?.[tn]?.ResourceUsage || stats.ResourceUsage || {};
653
- const memStats = taskStats.MemoryStats || {};
654
- const cpuStats = taskStats.CpuStats || {};
655
- const memBytes = memStats.RSS || memStats.Usage || 0;
656
- result.memory_mb = Math.round(memBytes / (1024 * 1024) * 10) / 10;
657
- result.cpu_percent = Math.round((cpuStats.Percent || 0) * 10) / 10;
658
- }
659
- }
660
- catch { /* ignore */ }
661
- // Fallback: Nomad cgroup stats are often zero on cgroup v2 (e.g. Raspberry
662
- // Pi / CIX). Read from the shared, cached, single-flight `docker stats`
663
- // snapshot instead of forking one `docker stats` per instance — see
664
- // getDockerMemSnapshot for why per-instance forking was the cold-path cost.
665
- if (!result.memory_mb && allocId && /^[a-f0-9-]+$/i.test(allocId)) {
666
- const containerName = `${resolveTaskName(instanceId)}-${allocId}`;
667
- const stat = (await getDockerMemSnapshot()).get(containerName);
668
- if (stat) {
669
- if (stat.memory_mb)
670
- result.memory_mb = stat.memory_mb;
671
- if (!result.cpu_percent && stat.cpu_percent)
672
- result.cpu_percent = stat.cpu_percent;
673
- }
674
- }
675
- return result;
676
- }
677
- /** Phase 1: reject if the instance's Nomad job is already running. */
678
- async function phaseRunningCheck(instanceId) {
679
- const status = await getStatus(instanceId);
680
- if (status.status === "running") {
681
- return { ok: false, error: "Instance is already running", code: "INSTANCE_ALREADY_RUNNING" };
682
- }
683
- return { ok: true };
684
- }
685
- async function phaseResetTerminalJobBeforeStart(instanceId) {
686
- const status = await getStatus(instanceId);
687
- if (!["failed", "dead", "complete"].includes(String(status.status)))
688
- return;
689
- try {
690
- const resp = await nomadDelete(`/v1/job/${jobId(instanceId)}?purge=false`);
691
- if (!resp.ok && resp.status !== 404) {
692
- console.warn(`[nomad] ${instanceId}: failed to stop terminal job before start (HTTP ${resp.status}): ${await resp.text()}`);
693
- }
694
- }
695
- catch (e) {
696
- console.warn(`[nomad] ${instanceId}: failed to stop terminal job before start: ${e?.message ?? e}`);
697
- }
698
- }
699
- /**
700
- * Phase 2: home-conflict check — dispatched through the adapter so
701
- * framework code carries no agentType-specific knowledge. Adapters that
702
- * do not share an agent-home directory across instances (e.g. Hermes,
703
- * each instance owns its own bind-mount) leave the hook unset and this
704
- * phase is a no-op.
705
- */
706
- async function phaseHomeConflict(_instanceId, sharedHomeIds) {
707
- const homeConflicts = [];
708
- for (const otherId of sharedHomeIds) {
709
- const otherStatus = await getStatus(otherId);
710
- if (otherStatus.status === "running")
711
- homeConflicts.push(otherId);
712
- }
713
- if (homeConflicts.length) {
714
- return {
715
- ok: false,
716
- error: `This instance shares its agent-home directory with running instance(s): ` +
717
- `${homeConflicts.join(", ")}. Move it to its own instance directory before starting it.`,
718
- };
719
- }
720
- return { ok: true };
721
- }
722
- /**
723
- * Phase 3: host port probe + self-heal. Returns the allocation record so
724
- * the caller can surface it in the API response, or null if the desired
725
- * port was already free.
726
- */
727
- async function phasePortAlloc(instanceId) {
728
- const desiredPort = getGatewayPort(instanceId);
729
- if (!(await isPortInUse(desiredPort)))
730
- return { ok: true, portAllocation: null };
731
- try {
732
- const re = await reallocateGatewayPort(instanceId);
733
- return { ok: true, portAllocation: { from: re.from, to: re.to, reason: "host_port_busy" } };
734
- }
735
- catch (e) {
736
- return {
737
- ok: false,
738
- error: `Gateway port ${desiredPort} is held by another process and reallocation failed: ${e?.message ?? e}`,
739
- };
740
- }
741
- }
742
- /**
743
- * Phase 4: adapter pre-start hook — kind-specific setup (config patches,
744
- * image validation, secret seeding, legacy process cleanup). A thrown
745
- * error with `.building` / `.taskId` signals an async background build;
746
- * we surface it to the caller so the UI can poll the task.
747
- */
748
- async function phasePreStartHook(adapter, instanceId) {
749
- if (!adapter.hooks?.onBeforeStart)
750
- return { ok: true };
751
- try {
752
- await adapter.hooks.onBeforeStart({ instanceId });
753
- return { ok: true };
754
- }
755
- catch (e) {
756
- if (e && typeof e === "object" && e.building && e.taskId) {
757
- return { ok: false, error: e.message, building: true, taskId: e.taskId };
758
- }
759
- return { ok: false, error: e?.message || String(e) };
760
- }
761
- }
762
- /**
763
- * §17 / PR 9 — re-render adapter-managed connection config from the
764
- * current capability registry before each instance start.
765
- *
766
- * Without this hook, env values (like `SEARCH_API_BASE_URL` =
767
- * `http://<host>:<port>/search`) are frozen into the adapter's config
768
- * files at PUT /connections time. When the host IP changes (DHCP
769
- * renewal, pi reboot picking up a new lease, network move) or a
770
- * provider gets re-deployed at a different host:port, the consumer
771
- * keeps trying the stale address and search/llm/etc. silently fail.
772
- *
773
- * What this does on every start:
774
- * 1. Read connections from instance.json
775
- * 2. Re-resolve them in `runtime` mode (tolerant: ambiguous/missing
776
- * becomes empty resolved instead of throwing — start should still
777
- * proceed even if one binding can't be re-rendered)
778
- * 3. Collect env via the same persist hooks PUT /connections uses
779
- * 4. Call adapter.applyConnectionEnv with the fresh env so the
780
- * adapter rewrites its config files (mcp_servers / openclaw.json /
781
- * etc.) with the current address
782
- *
783
- * Failures here are logged but never block start: a stale config is
784
- * better than no start. If something is genuinely wrong with the
785
- * registry, the user will see a connection error in the UI on next
786
- * use — at which point they can re-bind manually.
787
- */
788
- async function phaseRefreshConnections(adapter, instanceId) {
789
- if (!adapter.applyConnectionEnv)
790
- return;
791
- try {
792
- const meta = getInstance(instanceId);
793
- const connections = meta?.connections;
794
- if (!meta || !connections || Object.keys(connections).length === 0)
795
- return;
796
- const { loadCapabilitySpecForLegacyInstance } = await import("./runtime/migrations.js");
797
- const spec = loadCapabilitySpecForLegacyInstance(meta);
798
- if (!spec)
799
- return;
800
- const { resolveConnections } = await import("./connection-resolver.js");
801
- const { resolved } = resolveConnections(spec, { connections }, "preCreate");
802
- if (resolved.length === 0)
803
- return;
804
- const { PERSIST_HOOKS } = await import("./connection-apply.js");
805
- const merged = {};
806
- const seenEnvKeys = new Set();
807
- // Accumulate env across all resolved bindings via a stub
808
- // writeConnectionEnv that just collects into `merged`. We don't
809
- // run the real persist hooks here because those would re-write
810
- // generic-app `connections-env` (already handled by
811
- // injectConnectionsRuntimeEnv); we only want the env so we can
812
- // pass it to adapter.applyConnectionEnv below.
813
- const stubCtx = {
814
- registry: await import("./capability-registry.js"),
815
- adapter: { applyConnectionEnv: undefined },
816
- async writeConnectionEnv(_inst, env) {
817
- for (const [k, v] of Object.entries(env)) {
818
- merged[k] = v;
819
- seenEnvKeys.add(k);
820
- }
821
- },
822
- };
823
- for (const binding of resolved) {
824
- const hook = PERSIST_HOOKS[binding.category];
825
- if (!hook)
826
- continue;
827
- await hook(meta, binding, stubCtx);
828
- }
829
- if (seenEnvKeys.size === 0)
830
- return;
831
- await adapter.applyConnectionEnv(instanceId, merged);
832
- }
833
- catch (e) {
834
- console.warn(`[nomad] connections refresh failed for ${instanceId}: ${e?.message ?? e}`);
835
- }
836
- }
837
- /**
838
- * Phase 5: submit to Nomad with a single retry on port race. Between our
839
- * earlier host probe and Docker's actual bind another process could have
840
- * grabbed the port; on submit failure we re-probe, reallocate once if
841
- * busy, and retry. Otherwise we surface the original submit error.
842
- */
843
- async function phaseSubmit(instanceId, initialAllocation) {
844
- let portAllocation = initialAllocation;
845
- for (let attempt = 0; attempt < 2; attempt++) {
846
- const jobDef = await buildJob(instanceId);
847
- let submitError = null;
848
- let netErr = false;
849
- try {
850
- const resp = await nomadPost("/v1/jobs", jobDef);
851
- if (resp.ok) {
852
- const data = await resp.json();
853
- return { ok: true, evalId: data.EvalID, portAllocation };
854
- }
855
- submitError = await resp.text();
856
- }
857
- catch (e) {
858
- netErr = e?.message === "fetch failed" || e?.cause?.code === "ECONNREFUSED";
859
- submitError = netErr ? `Nomad 服务不可达 (${getNomadAddr()}),请先启动 Nomad` : e.message;
860
- }
861
- if (attempt === 0 && !netErr && (await isPortInUse(getGatewayPort(instanceId)))) {
862
- try {
863
- const re = await reallocateGatewayPort(instanceId);
864
- portAllocation = { from: re.from, to: re.to, reason: "docker_race" };
865
- console.log(`[nomad] ${instanceId}: retrying after docker port race (${re.from} -> ${re.to})`);
866
- continue;
867
- }
868
- catch { /* fall through to error return */ }
869
- }
870
- return { ok: false, error: submitError ?? "unknown error" };
871
- }
872
- return { ok: false, error: "start retry exhausted" };
873
- }
874
- /**
875
- * §32.2 / §32.8: pure adapter dispatch. Framework owns five generic
876
- * responsibilities delegated to `phase*` helpers above; every kind-
877
- * specific concern lives in `adapter.hooks.onBeforeStart()`.
878
- *
879
- * Phase ordering:
880
- * running_check → home_conflict → pre_start_hook → port_alloc → submit
881
- *
882
- * `pre_start_hook` intentionally runs BEFORE `port_alloc` so deterministic
883
- * errors (missing config, missing image, variables-write failure) surface
884
- * ahead of port-reallocation noise. A port reallocation failure after a
885
- * successful hook means the environment is genuinely contended; a hook
886
- * failure after a reallocation would waste the allocation and bury the
887
- * real cause under an incidental port change.
888
- *
889
- * Error returns carry a `phase` tag so callers and logs can distinguish
890
- * *where* the failure happened. The shape stays backward-compatible: old
891
- * callers that only read `ok`/`error` continue to work.
892
- */
893
- export async function startInstance(instanceId) {
894
- const appDirInstalledApp = await getAppDirInstalledApp(instanceId);
895
- if (appDirInstalledApp) {
896
- const { startApp } = await import("./app/app-manager.js");
897
- return startApp(instanceId);
898
- }
899
- const failed = (phase, rest) => {
900
- console.log(`[nomad] ${instanceId}: startInstance failed at phase=${phase}: ${rest.error ?? ""}`);
901
- return { ok: false, phase, ...rest };
902
- };
903
- const running = await phaseRunningCheck(instanceId);
904
- if (!running.ok) {
905
- const extra = { error: running.error };
906
- if (running.code)
907
- extra.code = running.code;
908
- return failed("running_check", extra);
909
- }
910
- await phaseResetTerminalJobBeforeStart(instanceId);
911
- const legacyManager = await getLegacyAppManager(instanceId);
912
- if (legacyManager) {
913
- const prep = await legacyManager.prepareStart(instanceId);
914
- if (!prep.ok) {
915
- const extra = { error: prep.error ?? "prepareStart failed" };
916
- if (prep.building)
917
- extra.building = true;
918
- if (prep.taskId)
919
- extra.taskId = prep.taskId;
920
- return failed("pre_start_hook", extra);
921
- }
922
- }
923
- else {
924
- const agentType = getInstanceAgentType(instanceId);
925
- const adapter = getAdapter(agentType);
926
- const home = await phaseHomeConflict(instanceId, adapter.findInstancesSharingHome?.(instanceId) ?? []);
927
- if (!home.ok)
928
- return failed("home_conflict", { error: home.error });
929
- // PR 9 — refresh adapter-managed connection config from current
930
- // capability registry before adapter pre-start. Best-effort: never
931
- // blocks start (any failure is logged and we proceed with the
932
- // existing on-disk config). See phaseRefreshConnections doc.
933
- await phaseRefreshConnections(adapter, instanceId);
934
- const hook = await phasePreStartHook(adapter, instanceId);
935
- if (!hook.ok) {
936
- const extra = { error: hook.error };
937
- if (hook.building)
938
- extra.building = true;
939
- if (hook.taskId)
940
- extra.taskId = hook.taskId;
941
- return failed("pre_start_hook", extra);
942
- }
943
- }
944
- const port = await phasePortAlloc(instanceId);
945
- if (!port.ok)
946
- return failed("port_alloc", { error: port.error });
947
- const submit = await phaseSubmit(instanceId, port.portAllocation);
948
- if (!submit.ok)
949
- return failed("submit", { error: submit.error });
950
- // Auto-register capability providers for legacy instances so they appear
951
- // in the Connections UI alongside app-installed apps. App-dir installed
952
- // apps short-circuit at the top of this function and don't reach here.
953
- await registerLegacyCapabilitiesTopLevel(instanceId);
954
- return {
955
- ok: true,
956
- eval_id: submit.evalId,
957
- ...(submit.portAllocation ? { port_allocation: submit.portAllocation } : {}),
958
- };
959
- }
960
- /**
961
- * Best-effort capability registration for legacy (non-app-installed)
962
- * hermes/openclaw instances. Loaded synthetic spec via the migrations
963
- * helper; failures are logged but never block start/stop.
964
- */
965
- async function registerLegacyCapabilitiesTopLevel(instanceId) {
966
- try {
967
- const meta = getInstance(instanceId);
968
- if (!meta)
969
- return;
970
- const { loadCapabilitySpecForLegacyInstance } = await import("./runtime/migrations.js");
971
- const synthSpec = loadCapabilitySpecForLegacyInstance(meta);
972
- if (!synthSpec?.provides?.length)
973
- return;
974
- // The synthetic spec's `name` is the yaml template's display name
975
- // ("Hermes Agent" / "OpenClaw Container"). For Connections-tab UX we
976
- // want the candidate to surface the user's instance name (e.g. "h",
977
- // "claw11"), so override before handing it to registerCapabilities.
978
- const instanceName = typeof meta.name === "string" && meta.name
979
- ? meta.name
980
- : instanceId;
981
- const namedSpec = { ...synthSpec, name: instanceName };
982
- // The synthetic spec has `tasks: []`, so `resolveProvideEndpoint`
983
- // can't compute the actual gateway port and falls back to the yaml's
984
- // declared port (e.g. openclaw default 18789). Legacy instances may
985
- // have been allocated a different port at creation time (port
986
- // collision avoidance). Pass the live `getGatewayPort` so the
987
- // capability registry advertises the port consumers can actually
988
- // reach.
989
- const portOverride = getGatewayPort(instanceId);
990
- const { registerCapabilities } = await import("./app/app-manager.js");
991
- registerCapabilities(instanceId, namedSpec, portOverride > 0 ? portOverride : undefined);
992
- }
993
- catch (e) {
994
- console.warn(`[legacy-capabilities] register failed for ${instanceId}: ${e?.message ?? e}`);
995
- }
996
- }
997
- async function unregisterLegacyCapabilitiesTopLevel(instanceId, purge) {
998
- try {
999
- const { markCapabilitiesStopped, unregisterCapabilities } = await import("./app/app-manager.js");
1000
- if (purge)
1001
- unregisterCapabilities(instanceId);
1002
- else
1003
- markCapabilitiesStopped(instanceId);
1004
- }
1005
- catch (e) {
1006
- console.warn(`[legacy-capabilities] unregister failed for ${instanceId}: ${e?.message ?? e}`);
1007
- }
1008
- }
1009
- export async function stopInstance(instanceId, purge = false) {
1010
- const jid = jobId(instanceId);
1011
- try {
1012
- const resp = await nomadDelete(`/v1/job/${jid}?purge=${purge}`);
1013
- if (resp.ok) {
1014
- if (purge) {
1015
- try {
1016
- await purgeInstanceVariables(instanceId);
1017
- }
1018
- catch { /* ignore */ }
1019
- }
1020
- await unregisterLegacyCapabilitiesTopLevel(instanceId, purge);
1021
- return { ok: true };
1022
- }
1023
- if (resp.status === 404) {
1024
- // Already stopped — still mark capabilities stopped so the UI reflects state.
1025
- await unregisterLegacyCapabilitiesTopLevel(instanceId, purge);
1026
- return { ok: false, error: "Instance is not running" };
1027
- }
1028
- return { ok: false, error: await resp.text() };
1029
- }
1030
- catch (e) {
1031
- const isNetErr = e?.message === "fetch failed" || e?.cause?.code === "ECONNREFUSED";
1032
- return { ok: false, error: isNetErr ? `Nomad 服务不可达 (${getNomadAddr()}),请先启动 Nomad` : e.message };
1033
- }
1034
- }
1035
- export async function restartInstance(instanceId) {
1036
- // Prefer the native Nomad allocation restart API over stop+start:
1037
- // PUT /v1/client/allocation/{allocID}/restart
1038
- // This preserves alloc history, EvalID, and avoids rescheduling.
1039
- // Only falls back to stop+start when no running/pending alloc exists.
1040
- const alloc = await getRunningAlloc(instanceId);
1041
- if (alloc) {
1042
- // Run the adapter's onBeforeStart even on native restart so pre-start
1043
- // migrations (e.g. Hermes's OPENAI_* env sync) still apply. The hook
1044
- // contract says it must be idempotent, so this is safe on every
1045
- // restart — including cases where the spec didn't change.
1046
- try {
1047
- const legacyManager = await getLegacyAppManager(instanceId);
1048
- if (legacyManager) {
1049
- const prep = await legacyManager.prepareStart(instanceId);
1050
- if (!prep.ok) {
1051
- console.warn(`[nomad] prepareStart on restart failed for ${instanceId}: ${prep.error}`);
1052
- }
1053
- }
1054
- else {
1055
- const meta = getInstance(instanceId);
1056
- const agentType = resolveAgentType(meta);
1057
- const adapter = getAdapter(agentType);
1058
- // PR 9 — refresh connection-derived config (mcp_servers /
1059
- // openclaw.json plugins) from current capability registry so
1060
- // host IP changes propagate on restart without manual re-bind.
1061
- // Symmetric with the same call in startInstance.
1062
- await phaseRefreshConnections(adapter, instanceId);
1063
- if (adapter.hooks?.onBeforeStart) {
1064
- await adapter.hooks.onBeforeStart({ instanceId });
1065
- }
1066
- }
1067
- }
1068
- catch (e) {
1069
- console.warn(`[nomad] onBeforeStart on restart failed for ${instanceId}: ${e.message}`);
1070
- }
1071
- try {
1072
- const resp = await nomadPut(`/v1/client/allocation/${alloc.ID}/restart`, {
1073
- TaskName: resolveTaskName(instanceId),
1074
- AllTasks: false,
1075
- });
1076
- if (resp.ok) {
1077
- // Re-register capabilities — yaml provides may have changed since
1078
- // the last start (e.g. a panel upgrade adding `llm-agent`).
1079
- await registerLegacyCapabilitiesTopLevel(instanceId);
1080
- return { ok: true, alloc_id: alloc.ID };
1081
- }
1082
- // Non-2xx from the restart endpoint falls through to stop+start
1083
- const errText = await resp.text();
1084
- console.warn(`[nomad] Native restart failed for ${instanceId} (HTTP ${resp.status}): ${errText} — falling back to stop+start`);
1085
- }
1086
- catch (e) {
1087
- console.warn(`[nomad] Native restart error for ${instanceId}: ${e.message} — falling back to stop+start`);
1088
- }
1089
- }
1090
- // Fallback: stop the job and re-submit it
1091
- await stopInstance(instanceId);
1092
- await new Promise((r) => setTimeout(r, 2000));
1093
- return startInstance(instanceId);
1094
- }
1095
- export async function getLogs(instanceId, lines = 200, logType = "stderr") {
1096
- // Defense-in-depth: only allow known log types to prevent path/query injection
1097
- if (!VALID_LOG_TYPES.has(logType))
1098
- logType = "stderr";
1099
- let alloc = await getRunningAlloc(instanceId);
1100
- if (!alloc) {
1101
- const jid = jobId(instanceId);
1102
- try {
1103
- const resp = await nomadGet(`/v1/job/${jid}/allocations`);
1104
- if (resp.ok) {
1105
- const allocs = await resp.json();
1106
- if (allocs.length) {
1107
- alloc = allocs.sort((a, b) => (b.CreateIndex || 0) - (a.CreateIndex || 0))[0];
1108
- }
1109
- }
1110
- }
1111
- catch { /* ignore */ }
1112
- }
1113
- if (!alloc)
1114
- return [];
1115
- const preferredTask = resolveTaskName(instanceId);
1116
- const resolvedTask = alloc.TaskStates?.[preferredTask]
1117
- ? preferredTask
1118
- : alloc.TaskStates?.gateway
1119
- ? "gateway"
1120
- : (Object.keys(alloc.TaskStates ?? {})[0] ?? preferredTask);
1121
- // Primary: Nomad log API
1122
- try {
1123
- const params = new URLSearchParams({
1124
- task: resolvedTask,
1125
- type: logType,
1126
- plain: "true",
1127
- origin: "end",
1128
- offset: String(Math.max(lines * 512, 100000)),
1129
- follow: "false",
1130
- });
1131
- const resp = await nomadGet(`/v1/client/fs/logs/${alloc.ID}?${params}`);
1132
- if (resp.ok) {
1133
- const text = await resp.text();
1134
- const trimmed = text.trim();
1135
- if (trimmed)
1136
- return trimmed.split("\n").slice(-lines);
1137
- }
1138
- }
1139
- catch { /* ignore */ }
1140
- // Fallback: read Docker's json-file log directly so stdout/stderr can still
1141
- // be separated when Nomad log collection is disabled.
1142
- const dockerLogLines = await readDockerStreamLogs(`${resolvedTask}-${alloc.ID}`, lines, logType);
1143
- if (dockerLogLines.length > 0)
1144
- return dockerLogLines;
1145
- return [];
1146
- }
1147
- const execFileAsync = promisify(execFileCb);
1148
- const DOCKER_STATS_TTL_MS = 30_000;
1149
- /** Field separator for the batched `docker stats --format` line. Exported so
1150
- * tests can construct mock output without hardcoding the literal. */
1151
- export const DOCKER_STATS_FIELD_SEP = "__JS__";
1152
- let _dockerStatsEntry = null;
1153
- let _dockerStatsInFlight = null;
1154
- /** Test-only: reset the shared docker-stats snapshot so each test starts from
1155
- * a cold cache (the 30s TTL + single-flight would otherwise leak one test's
1156
- * mocked snapshot into the next). Not used by production code paths. */
1157
- export function __resetDockerStatsCacheForTests() {
1158
- _dockerStatsEntry = null;
1159
- _dockerStatsInFlight = null;
1160
- }
1161
- function parseDockerMemUsageMb(memUsage) {
1162
- // Format: "499.6MiB / 3GiB" — the used side is everything before "/".
1163
- const used = (memUsage.split("/")[0] ?? "").trim();
1164
- const match = used.match(/^([\d.]+)\s*(MiB|GiB|MB|GB|KiB|KB|B)?/i);
1165
- if (!match)
1166
- return 0;
1167
- let mb = parseFloat(match[1]);
1168
- if (!Number.isFinite(mb))
1169
- return 0;
1170
- const unit = (match[2] ?? "MiB").toLowerCase();
1171
- if (unit === "gib" || unit === "gb")
1172
- mb *= 1024;
1173
- else if (unit === "kib" || unit === "kb")
1174
- mb /= 1024;
1175
- else if (unit === "b")
1176
- mb /= 1024 * 1024;
1177
- return Math.round(mb * 10) / 10;
1178
- }
1179
- async function loadDockerStatsSnapshot() {
1180
- const snapshot = new Map();
1181
- try {
1182
- const fmt = `{{.Name}}${DOCKER_STATS_FIELD_SEP}{{.MemUsage}}${DOCKER_STATS_FIELD_SEP}{{.CPUPerc}}`;
1183
- const { stdout } = await execFileAsync("docker", ["stats", "--no-stream", "--format", fmt], { timeout: 8_000 });
1184
- for (const line of stdout.split("\n")) {
1185
- const trimmed = line.trim();
1186
- if (!trimmed)
1187
- continue;
1188
- const [name, memUsage, cpuPerc] = trimmed.split(DOCKER_STATS_FIELD_SEP);
1189
- if (!name)
1190
- continue;
1191
- snapshot.set(name, {
1192
- memory_mb: parseDockerMemUsageMb(memUsage ?? ""),
1193
- cpu_percent: Math.round((parseFloat(cpuPerc ?? "") || 0) * 10) / 10,
1194
- });
1195
- }
1196
- }
1197
- catch {
1198
- /* docker missing / timeout / daemon down → empty map, caller degrades */
1199
- }
1200
- return snapshot;
1201
- }
1202
- /**
1203
- * Returns a per-container stats map, refreshing at most once per
1204
- * DOCKER_STATS_TTL_MS. Concurrent callers (the `Promise.all` over every
1205
- * instance in `GET /api/instances`) share a single in-flight docker call.
1206
- */
1207
- async function getDockerMemSnapshot() {
1208
- const now = Date.now();
1209
- if (_dockerStatsEntry && now - _dockerStatsEntry.ts < DOCKER_STATS_TTL_MS) {
1210
- return _dockerStatsEntry.data;
1211
- }
1212
- if (_dockerStatsInFlight)
1213
- return _dockerStatsInFlight;
1214
- _dockerStatsInFlight = loadDockerStatsSnapshot()
1215
- .then((data) => {
1216
- _dockerStatsEntry = { data, ts: Date.now() };
1217
- return data;
1218
- })
1219
- .finally(() => {
1220
- _dockerStatsInFlight = null;
1221
- });
1222
- return _dockerStatsInFlight;
1223
- }
1224
- export async function exec(instanceId, command, timeoutMs = 120_000) {
1225
- const alloc = await getRunningAlloc(instanceId);
1226
- if (!alloc || alloc.ClientStatus !== "running") {
1227
- throw new Error("Instance is not running");
1228
- }
1229
- const allocId = alloc.ID;
1230
- if (!/^[a-f0-9-]+$/i.test(allocId))
1231
- throw new Error("invalid allocId");
1232
- const containerName = `gateway-${allocId}`;
1233
- // Use the same user as the container's main process (runtime.user uid:gid)
1234
- const runtime = getInstanceRuntime(instanceId);
1235
- const userFlag = resolveUidGid(runtime.user);
1236
- try {
1237
- const { stdout, stderr } = await execFileAsync("docker", ["exec", "--user", userFlag, containerName, ...command], { timeout: timeoutMs });
1238
- return { stdout, stderr, exitCode: 0 };
1239
- }
1240
- catch (e) {
1241
- return {
1242
- stdout: e.stdout || "",
1243
- stderr: e.stderr || e.message,
1244
- exitCode: e.code ?? 1,
1245
- };
1246
- }
1247
- }
1248
- // ── Compatibility constants for app-type managers (src/services/app/) ───────
1249
- // The cli branch kept these in-file; HEAD shrunk nomad-manager.ts to a
1250
- // framework-generic layer, so the app-type managers would otherwise lose
1251
- // their imports. Keep them here as the single source of truth and re-export
1252
- // via the block below.
1253
- export const DEFAULT_PIDS_LIMIT = 512;
1254
- export const DEFAULT_ARGS = ["gateway", "run", "--port", "18789", "--allow-unconfigured"];
1255
- export const DEFAULT_USER = userInfo().username;
1256
- export const DEFAULT_CWD = homedir();
1257
- export const DEFAULT_ENV = {
1258
- HOME: homedir(),
1259
- TMPDIR: "/tmp",
1260
- PATH: `${homedir()}/.local/bin:${homedir()}/.npm-global/bin:${homedir()}/bin:${homedir()}/.volta/bin:`
1261
- + `${homedir()}/.asdf/shims:${homedir()}/.bun/bin:${homedir()}/.nvm/current/bin:${homedir()}/.fnm/current/bin:`
1262
- + `${homedir()}/.local/share/pnpm:/usr/local/bin:/usr/bin:/bin`,
1263
- };
1264
- export const DEFAULT_RESOURCES = { CPU: 500, MemoryMB: 512 };
1265
- export const MAX_CPU_MHZ = 4000; // 4 GHz per task
1266
- export const MAX_MEMORY_MB = 4096; // 4 GB reservation
1267
- export const MAX_MEMORY_MAX_MB = 4096; // 4 GB hard limit (memory_max)
1268
- /**
1269
- * Clamp container memory reservation/limit to the framework ceilings and
1270
- * ensure `MemoryMaxMB >= MemoryMB`. Shared by every container-runtime app
1271
- * manager (openclaw / custom / ollama / hermes) so they apply the same
1272
- * guard-rails before handing a task spec to Nomad.
1273
- */
1274
- export function normalizeDockerResources(instanceId, runtime) {
1275
- const requestedMemoryMB = Number(runtime.resources?.MemoryMB ?? DEFAULT_RESOURCES.MemoryMB);
1276
- let effectiveMemoryMB = Math.min(requestedMemoryMB, MAX_MEMORY_MB);
1277
- let effectiveMemoryMaxMB = Math.min(Number(runtime.resources?.MemoryMaxMB ?? requestedMemoryMB), MAX_MEMORY_MAX_MB);
1278
- if (effectiveMemoryMaxMB < effectiveMemoryMB) {
1279
- console.warn(`[nomad] ${instanceId}: MemoryMaxMB (${effectiveMemoryMaxMB}) is below MemoryMB (${effectiveMemoryMB}); clamping max to reservation.`);
1280
- effectiveMemoryMaxMB = effectiveMemoryMB;
1281
- }
1282
- return {
1283
- ...(runtime.resources ?? {}),
1284
- MemoryMB: effectiveMemoryMB,
1285
- MemoryMaxMB: effectiveMemoryMaxMB,
1286
- };
1287
- }
1288
- // ── Compatibility re-exports for app-type managers ─────────────────────────
1289
- // `jobId`/`resolveUidGid`/`nomadGet`/`nomadPut`/`assertSafeTemplateId` are
1290
- // internal helpers defined elsewhere in this file; re-exporting them keeps
1291
- // cli-branch imports (`../nomad-manager.js`) working.
1292
- export { jobId, resolveUidGid, nomadGet, nomadPut, assertSafeTemplateId, };
1293
- const instanceScheduler = {
1294
- getStatus,
1295
- startInstance,
1296
- stopInstance,
1297
- restartInstance,
1298
- getLogs,
1299
- exec,
1300
- };
1301
- var UnifiedNomadJobs;
1302
- (function (UnifiedNomadJobs) {
1303
- // ── Constants ─────────────────────────────────────────────────────────────
1304
- const OPENCLAW_PREFIX = "openclaw-";
1305
- // Docker image names must match this pattern to prevent command injection.
1306
- UnifiedNomadJobs.DOCKER_IMAGE_RE = /^[a-zA-Z0-9][a-zA-Z0-9\-_.:/@]*$/;
1307
- UnifiedNomadJobs.MAX_DOCKER_IMAGE_NAME_LEN = 256;
1308
- UnifiedNomadJobs.VALID_LOG_TYPES = new Set(["stdout", "stderr"]);
1309
- // Nomad Template metacharacters that must not appear in values interpolated
1310
- // into EmbeddedTmpl strings.
1311
- UnifiedNomadJobs.NOMAD_TEMPLATE_UNSAFE_RE = /[{}"\\]/;
1312
- const DEFAULT_CPU_MHZ = 500;
1313
- const DEFAULT_MEMORY_MB = 512;
1314
- // Hard upper bounds: prevents misconfigured specs from exhausting scheduler resources.
1315
- const MAX_CPU_MHZ = 4000; // 4 GHz
1316
- const MAX_MEMORY_MB = 4096; // 4 GB reservation
1317
- const MAX_MEMORY_MAX_MB = 4096; // 4 GB hard limit
1318
- const DEFAULT_PIDS_LIMIT = 512;
1319
- const NOMAD_CONFIG_PATH = join(JISHUSHELL_HOME, "nomad", "nomad.hcl");
1320
- const _DEFAULT_CWD = homedir();
1321
- function appDirForId(appId) {
1322
- return join(APPS_DIR, appId);
1323
- }
1324
- function isAppJob(id) {
1325
- const dir = appDirForId(id);
1326
- if (existsSync(join(dir, "manifest.json")) || existsSync(join(dir, "app-spec.yaml"))) {
1327
- return true;
1328
- }
1329
- if (id.startsWith(OPENCLAW_PREFIX))
1330
- return false;
1331
- return false;
1332
- }
1333
- UnifiedNomadJobs.isAppJob = isAppJob;
1334
- function resolveAppDir(appId) {
1335
- const dir = appDirForId(appId);
1336
- if (existsSync(join(dir, "manifest.json")) || existsSync(join(dir, "app-spec.yaml"))) {
1337
- return dir;
1338
- }
1339
- return null;
1340
- }
1341
- // ── Job ID ────────────────────────────────────────────────────────────────
1342
- function jobId(appId) {
1343
- return appId;
1344
- }
1345
- function assertSafeTemplateId(id) {
1346
- if (UnifiedNomadJobs.NOMAD_TEMPLATE_UNSAFE_RE.test(id)) {
1347
- throw new Error(`Job ID "${id}" contains characters unsafe for Nomad Template interpolation`);
1348
- }
1349
- }
1350
- // ── Nomad HTTP helpers ────────────────────────────────────────────────────
1351
- function nomadAuthHeaders() {
1352
- const token = getNomadToken();
1353
- return token ? { "X-Nomad-Token": token } : {};
1354
- }
1355
- async function nomadGet(path) {
1356
- const resp = await fetch(`${getNomadAddr()}${path}`, {
1357
- headers: nomadAuthHeaders(),
1358
- signal: AbortSignal.timeout(10_000),
1359
- });
1360
- if (!resp.ok && resp.status !== 404) {
1361
- throw new Error(`Nomad GET ${path}: HTTP ${resp.status}`);
1362
- }
1363
- return resp;
1364
- }
1365
- async function nomadPost(path, body) {
1366
- return fetch(`${getNomadAddr()}${path}`, {
1367
- method: "POST",
1368
- headers: { "Content-Type": "application/json", ...nomadAuthHeaders() },
1369
- body: JSON.stringify(body),
1370
- signal: AbortSignal.timeout(10_000),
1371
- });
1372
- }
1373
- async function nomadPut(path, body) {
1374
- return fetch(`${getNomadAddr()}${path}`, {
1375
- method: "PUT",
1376
- headers: { "Content-Type": "application/json", ...nomadAuthHeaders() },
1377
- body: JSON.stringify(body),
1378
- signal: AbortSignal.timeout(10_000),
1379
- });
1380
- }
1381
- async function nomadDelete(path) {
1382
- return fetch(`${getNomadAddr()}${path}`, {
1383
- method: "DELETE",
1384
- headers: nomadAuthHeaders(),
1385
- signal: AbortSignal.timeout(10_000),
1386
- });
1387
- }
1388
- async function listNomadNodes() {
1389
- try {
1390
- const resp = await nomadGet("/v1/nodes");
1391
- if (!resp.ok)
1392
- return [];
1393
- const nodes = await resp.json();
1394
- return Array.isArray(nodes) ? nodes : [];
1395
- }
1396
- catch {
1397
- return [];
1398
- }
1399
- }
1400
- function isSchedulableNode(node) {
1401
- return (node.Status ?? "ready") === "ready"
1402
- && (node.SchedulingEligibility ?? "eligible") === "eligible";
1403
- }
1404
- function rawExecDriverHealthy(node) {
1405
- const driver = node.Drivers?.raw_exec;
1406
- return driver?.Detected === true && driver?.Healthy === true;
1407
- }
1408
- function rawExecRestartHint() {
1409
- if (process.platform === "linux")
1410
- return "sudo systemctl restart nomad";
1411
- if (process.platform === "darwin")
1412
- return "重启 Nomad launchd agent";
1413
- return "重启 Nomad 服务";
1414
- }
1415
- function nomadConfigEnablesRawExec() {
1416
- try {
1417
- const config = readFileSync(NOMAD_CONFIG_PATH, "utf-8");
1418
- return /plugin\s+"raw_exec"\s*\{[\s\S]*?enabled\s*=\s*true\b/.test(config);
1419
- }
1420
- catch {
1421
- return false;
1422
- }
1423
- }
1424
- async function validateRawExecDriverAvailability() {
1425
- const nodes = (await listNomadNodes()).filter(isSchedulableNode);
1426
- if (nodes.length === 0)
1427
- return null;
1428
- if (nodes.some(rawExecDriverHealthy))
1429
- return null;
1430
- const detail = nodes
1431
- .map((node) => {
1432
- const driver = node.Drivers?.raw_exec;
1433
- const name = String(node.Name ?? node.ID ?? "unknown-node");
1434
- const description = String(driver?.HealthDescription
1435
- ?? (driver?.Detected === false ? "disabled" : "unavailable"));
1436
- return `${name}: ${description}`;
1437
- })
1438
- .join("; ");
1439
- if (nomadConfigEnablesRawExec()) {
1440
- return `Nomad client 当前未启用 raw_exec driver(${detail})。磁盘配置已启用 raw_exec,但运行中的 Nomad 仍在使用旧配置;请先执行 ${rawExecRestartHint()} 后重试。`;
1441
- }
1442
- return `Nomad client 当前未启用 raw_exec driver(${detail})。请先在 Nomad 配置中启用 plugin \"raw_exec\" { config { enabled = true } },然后重启 Nomad。`;
1443
- }
1444
- function allocTimestamp(alloc) {
1445
- const raw = alloc.ModifyTime ?? alloc.CreateTime ?? alloc.CreateIndex ?? 0;
1446
- return typeof raw === "number" ? raw : Number(raw) || 0;
1447
- }
1448
- // ── Resource unit parsers ─────────────────────────────────────────────────
1449
- /**
1450
- * Parse a CPU resource string to Nomad MHz integer.
1451
- * "500m" → 500 (millicores treated as MHz for simplicity)
1452
- * "1" → 1000 (1 core → 1000 MHz)
1453
- * "1000" → 1000 (bare integer treated as MHz already)
1454
- *
1455
- * Nomad doesn't have a concept of "cores"; it schedules by MHz.
1456
- * We treat 1 core = 1000 MHz as a reasonable proxy for a Pi-class host.
1457
- */
1458
- function parseCpuMHz(cpu) {
1459
- if (cpu == null)
1460
- return DEFAULT_CPU_MHZ;
1461
- const s = String(cpu).trim();
1462
- if (s.endsWith("m")) {
1463
- // millicores (K8s-style): "500m" → 500 MHz
1464
- const val = parseFloat(s.slice(0, -1));
1465
- return isNaN(val) ? DEFAULT_CPU_MHZ : Math.max(1, Math.min(Math.round(val), MAX_CPU_MHZ));
1466
- }
1467
- const val = parseFloat(s);
1468
- if (isNaN(val))
1469
- return DEFAULT_CPU_MHZ;
1470
- // Bare integer ≤ 16 likely means "cores" (e.g. "1", "2"); convert to MHz.
1471
- // Bare integer > 16 likely already MHz.
1472
- const mhz = val <= 16 ? Math.round(val * 1000) : Math.round(val);
1473
- return Math.max(1, Math.min(mhz, MAX_CPU_MHZ));
1474
- }
1475
- UnifiedNomadJobs.parseCpuMHz = parseCpuMHz;
1476
- /**
1477
- * Parse a memory resource string to Nomad MB integer.
1478
- * "512Mi" or "512MiB" → 512 MB
1479
- * "1Gi" or "1GiB" → 1024 MB
1480
- * "512M" or "512MB" → 512 MB
1481
- * "1G" or "1GB" → 1024 MB
1482
- * "1024" → 1024 MB (bare integer = MB)
1483
- */
1484
- function parseMemoryMB(memory) {
1485
- if (memory == null)
1486
- return DEFAULT_MEMORY_MB;
1487
- const s = String(memory).trim();
1488
- const match = s.match(/^([\d.]+)\s*(gi|gib|g|gb|mi|mib|m|mb|ki|kib|k|kb)?$/i);
1489
- if (!match)
1490
- return DEFAULT_MEMORY_MB;
1491
- const val = parseFloat(match[1]);
1492
- if (isNaN(val))
1493
- return DEFAULT_MEMORY_MB;
1494
- const unit = (match[2] || "").toLowerCase();
1495
- let mb;
1496
- if (unit === "gi" || unit === "gib" || unit === "g" || unit === "gb") {
1497
- mb = Math.round(val * 1024);
1498
- }
1499
- else if (unit === "ki" || unit === "kib" || unit === "k" || unit === "kb") {
1500
- mb = Math.round(val / 1024);
1501
- }
1502
- else {
1503
- // "mi"/"mib"/"m"/"mb" or bare integer
1504
- mb = Math.round(val);
1505
- }
1506
- return Math.max(1, Math.min(mb, MAX_MEMORY_MB));
1507
- }
1508
- UnifiedNomadJobs.parseMemoryMB = parseMemoryMB;
1509
- // ── Interval parser ───────────────────────────────────────────────────────
1510
- function parseIntervalNs(s, defaultNs) {
1511
- if (!s)
1512
- return defaultNs;
1513
- if (s.endsWith("ms"))
1514
- return parseInt(s, 10) * 1_000_000;
1515
- if (s.endsWith("s"))
1516
- return parseInt(s, 10) * 1_000_000_000;
1517
- if (s.endsWith("m"))
1518
- return parseInt(s, 10) * 60_000_000_000;
1519
- return parseInt(s, 10) * 1_000_000_000;
1520
- }
1521
- function portLabel(taskName, portName) {
1522
- const sanitize = (value) => value.replace(/[^a-zA-Z0-9_-]/g, "-");
1523
- return `${sanitize(taskName)}-${sanitize(portName)}`;
1524
- }
1525
- function nomadConfigDeclaresHostNetwork(name) {
1526
- if (!existsSync(NOMAD_CONFIG_PATH))
1527
- return false;
1528
- try {
1529
- const config = readFileSync(NOMAD_CONFIG_PATH, "utf-8");
1530
- const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1531
- return new RegExp(`host_network\\s+"${escaped}"\\s*\\{`).test(config);
1532
- }
1533
- catch {
1534
- return false;
1535
- }
1536
- }
1537
- function hostNetworkForPort(port) {
1538
- if ((port.visibility ?? "external") === "internal")
1539
- return undefined;
1540
- // Honor explicit host_network from spec (e.g. weknora's ports declare
1541
- // `host_network: docker_bridge` so peer tasks reach the published port
1542
- // via host.docker.internal). Verify the named network is actually
1543
- // declared in nomad.hcl — otherwise Nomad rejects job submission with
1544
- // "unknown host network". Falls back to "external" when unset.
1545
- const requested = (port.host_network ?? "").trim();
1546
- if (requested && nomadConfigDeclaresHostNetwork(requested))
1547
- return requested;
1548
- return nomadConfigDeclaresHostNetwork("external") ? "external" : undefined;
1549
- }
1550
- function specRequiresExternalHostNetwork(spec) {
1551
- return spec.tasks.some((task) => task.runtime !== "container"
1552
- && (task.ports ?? []).some((port) => (port.visibility ?? "external") !== "internal"));
1553
- }
1554
- async function validateRequiredHostNetworks(spec) {
1555
- if (!specRequiresExternalHostNetwork(spec))
1556
- return null;
1557
- if (!nomadConfigDeclaresHostNetwork("external"))
1558
- return null;
1559
- try {
1560
- const resp = await nomadGet("/v1/agent/self");
1561
- if (!resp.ok)
1562
- return null;
1563
- const self = await resp.json();
1564
- const hostNetworks = Array.isArray(self?.config?.Client?.HostNetworks)
1565
- ? self.config.Client.HostNetworks
1566
- : [];
1567
- const loadedNetworks = new Set(hostNetworks
1568
- .map((network) => String(network?.Name ?? "").trim())
1569
- .filter(Boolean));
1570
- if (!loadedNetworks.has("external")) {
1571
- return 'Nomad 运行中的 agent 尚未加载 host_network "external"。请先重启 Nomad,再启动该应用。';
1572
- }
1573
- }
1574
- catch {
1575
- // Let the later job submission path report Nomad unreachable when needed.
1576
- }
1577
- return null;
1578
- }
1579
- function reservedPortsForTask(task) {
1580
- // visibility=internal ports are intra-group only (e.g. SearXNG sidecar
1581
- // reachable from the gateway task via 127.0.0.1 inside the bridge
1582
- // network namespace). Reserving them on the host would occupy a host
1583
- // port slot AND, combined with docker publishing below, expose the
1584
- // endpoint externally. Skip them entirely — they stay inside the task
1585
- // group's network namespace.
1586
- return (task.ports ?? [])
1587
- .filter((port) => (port.visibility ?? "external") !== "internal")
1588
- .map((port) => ({
1589
- Label: portLabel(task.name, port.name),
1590
- Value: port.host_port ?? port.port,
1591
- ...(task.runtime === "container" ? { To: port.container_port ?? port.port } : {}),
1592
- // Attach the named host_network for any externally-visible port —
1593
- // including container tasks. Without it, Nomad falls back to
1594
- // HostNetwork="default" (loopback) and the docker driver publishes
1595
- // to 127.0.0.1, breaking cross-container consumers (e.g. OpenWebUI
1596
- // calling hermes / openclaw via the connections page). The earlier
1597
- // restriction to non-container tasks was overcautious — our task
1598
- // groups use host networking (Mode: "") rather than Nomad bridge
1599
- // mode, so attaching host_network is safe and is exactly what
1600
- // searxng-container has been doing in practice all along.
1601
- ...(hostNetworkForPort(port)
1602
- ? { HostNetwork: hostNetworkForPort(port) }
1603
- : {}),
1604
- }));
1605
- }
1606
- function isExternalAppTaskPort(port) {
1607
- return (port.visibility ?? "external") !== "internal";
1608
- }
1609
- function readDeclaredHostPort(port) {
1610
- const candidate = port.host_port ?? port.port;
1611
- return Number.isInteger(candidate) && candidate > 0 ? candidate : null;
1612
- }
1613
- function applyPersistedAppSpecPortOverrides(appId, spec) {
1614
- const meta = getInstance(appId);
1615
- if (!meta)
1616
- return spec;
1617
- const runtime = getInstanceRuntime(appId);
1618
- const runtimePorts = Array.isArray(runtime.ports) ? runtime.ports : [];
1619
- const persistedGatewayPort = extractGatewayPort(runtime, resolveAgentType(meta));
1620
- const totalExternalPorts = spec.tasks.reduce((count, task) => count + (task.ports ?? []).filter((port) => isExternalAppTaskPort(port)).length, 0);
1621
- let changed = false;
1622
- const tasks = spec.tasks.map((task) => {
1623
- if (!Array.isArray(task.ports) || task.ports.length === 0)
1624
- return task;
1625
- let taskChanged = false;
1626
- const ports = task.ports.map((port) => {
1627
- if (!isExternalAppTaskPort(port))
1628
- return port;
1629
- const currentHostPort = readDeclaredHostPort(port);
1630
- if (!currentHostPort)
1631
- return port;
1632
- let nextHostPort = null;
1633
- const namedRuntimePort = typeof port.name === "string" && port.name
1634
- ? runtimePorts.find((candidate) => candidate?.name === port.name
1635
- && Number.isInteger(candidate?.hostPort)
1636
- && candidate.hostPort > 0)
1637
- : null;
1638
- if (namedRuntimePort) {
1639
- nextHostPort = namedRuntimePort.hostPort;
1640
- }
1641
- else if (runtimePorts.length === 1
1642
- && totalExternalPorts === 1
1643
- && Number.isInteger(runtimePorts[0]?.hostPort)
1644
- && runtimePorts[0].hostPort > 0) {
1645
- nextHostPort = runtimePorts[0].hostPort;
1646
- }
1647
- else if (totalExternalPorts === 1
1648
- && persistedGatewayPort != null
1649
- && persistedGatewayPort > 0) {
1650
- nextHostPort = persistedGatewayPort;
1651
- }
1652
- if (!nextHostPort || nextHostPort === currentHostPort)
1653
- return port;
1654
- changed = true;
1655
- taskChanged = true;
1656
- return { ...port, host_port: nextHostPort };
1657
- });
1658
- return taskChanged ? { ...task, ports } : task;
1659
- });
1660
- return changed ? { ...spec, tasks } : spec;
1661
- }
1662
- async function maybeReallocateAppSpecHostPort(appId, spec, reason) {
1663
- if (!getInstance(appId))
1664
- return { spec, changed: false };
1665
- const effectiveSpec = applyPersistedAppSpecPortOverrides(appId, spec);
1666
- const currentGatewayPort = getGatewayPort(appId);
1667
- if (!Number.isInteger(currentGatewayPort) || currentGatewayPort <= 0) {
1668
- return { spec: effectiveSpec, changed: false };
1669
- }
1670
- const declaredPorts = effectiveSpec.tasks.flatMap((task) => (task.ports ?? [])
1671
- .filter((port) => isExternalAppTaskPort(port))
1672
- .map((port) => readDeclaredHostPort(port))
1673
- .filter((port) => port != null));
1674
- if (!declaredPorts.includes(currentGatewayPort)) {
1675
- return { spec: effectiveSpec, changed: false };
1676
- }
1677
- if (!(await isPortInUse(currentGatewayPort))) {
1678
- return { spec: effectiveSpec, changed: false };
1679
- }
1680
- try {
1681
- const reallocation = await reallocateGatewayPort(appId);
1682
- console.log(`[nomad] ${appId}: reallocated AppSpec host port ${reallocation.from} -> ${reallocation.to} (${reason})`);
1683
- return {
1684
- spec: applyPersistedAppSpecPortOverrides(appId, spec),
1685
- changed: true,
1686
- };
1687
- }
1688
- catch (e) {
1689
- return {
1690
- spec: effectiveSpec,
1691
- changed: false,
1692
- error: `AppSpec host port ${currentGatewayPort} is held by another process and reallocation failed: ${e?.message ?? e}`,
1693
- };
1694
- }
1695
- }
1696
- // ── Health check → Nomad service check builder ────────────────────────────
1697
- function buildServiceCheck(task, appId) {
1698
- const health = task.health;
1699
- if (!health?.http)
1700
- return null;
1701
- const portEntry = task.ports?.find((p) => p.port === health.http.port
1702
- || p.host_port === health.http.port
1703
- || p.container_port === health.http.port);
1704
- if (!portEntry)
1705
- return null;
1706
- // Internal ports are not reserved on host (see reservedPortsForTask),
1707
- // so a host-mode Nomad service check would reference an unknown port
1708
- // label. Skip the task-level health check; intra-group readiness for
1709
- // sidecars falls through to the `after:` ordering once that lands.
1710
- if ((portEntry.visibility ?? "external") === "internal")
1711
- return null;
1712
- const checkPortLabel = portLabel(task.name, portEntry.name);
1713
- // Task-level checks cannot use address_mode="alloc". raw_exec tasks also do
1714
- // not create an allocation network namespace, so host mode is the valid
1715
- // Nomad-compatible choice here.
1716
- const checkAddressMode = "host";
1717
- const check = {
1718
- Name: `${task.name}-health`,
1719
- Type: "http",
1720
- Path: health.http.path,
1721
- PortLabel: checkPortLabel,
1722
- AddressMode: checkAddressMode,
1723
- Header: {
1724
- "X-Real-IP": ["127.0.0.1"],
1725
- },
1726
- Interval: parseIntervalNs(health.interval, 15_000_000_000),
1727
- Timeout: parseIntervalNs(health.timeout, 5_000_000_000),
1728
- };
1729
- if (health.retries != null || health.start_period) {
1730
- check.CheckRestart = {
1731
- Limit: health.retries ?? 3,
1732
- Grace: health.start_period ? parseIntervalNs(health.start_period, 0) : 0,
1733
- IgnoreWarnings: false,
1734
- };
1735
- }
1736
- return {
1737
- Name: `${appId}-${task.name}`,
1738
- Provider: "nomad",
1739
- PortLabel: checkPortLabel,
1740
- AddressMode: "host",
1741
- Checks: [check],
1742
- };
1743
- }
1744
- // ── Deep merge utility ────────────────────────────────────────────────────
1745
- function deepMerge(target, source) {
1746
- const result = { ...target };
1747
- for (const key of Object.keys(source)) {
1748
- if (source[key] && typeof source[key] === "object" && !Array.isArray(source[key]) &&
1749
- result[key] && typeof result[key] === "object" && !Array.isArray(result[key])) {
1750
- result[key] = deepMerge(result[key], source[key]);
1751
- }
1752
- else {
1753
- result[key] = source[key];
1754
- }
1755
- }
1756
- return result;
1757
- }
1758
- function interpolateEnvRequires(taskEnv, extraEnv) {
1759
- if (Object.keys(extraEnv).length === 0)
1760
- return taskEnv;
1761
- const result = {};
1762
- for (const [k, v] of Object.entries(taskEnv)) {
1763
- result[k] = v.replace(/\$\{requires\.([^}]+)\}/g, (_, key) => extraEnv[key] ?? "");
1764
- }
1765
- return result;
1766
- }
1767
- function materializeAppIdTokens(value, appId) {
1768
- if (typeof value === "string") {
1769
- return value
1770
- .replace(/\$\{app_id\}/g, appId)
1771
- .replace(/\$\{app\.id\}/g, appId);
1772
- }
1773
- if (Array.isArray(value)) {
1774
- return value.map((entry) => materializeAppIdTokens(entry, appId));
1775
- }
1776
- if (value && typeof value === "object") {
1777
- const result = {};
1778
- for (const [key, entry] of Object.entries(value)) {
1779
- result[key] = materializeAppIdTokens(entry, appId);
1780
- }
1781
- return result;
1782
- }
1783
- return value;
1784
- }
1785
- // ── Task lifecycle mapping ────────────────────────────────────────────────
1786
- /**
1787
- * Map AppTask role to a Nomad task lifecycle block.
1788
- * Returns null for the default "service" role (no lifecycle block needed).
1789
- *
1790
- * Nomad lifecycle hooks:
1791
- * prestart - runs before main tasks; sidecar=false means it must complete
1792
- * poststart - runs after main tasks start; sidecar=true means it keeps running
1793
- * poststop - runs after all main tasks stop
1794
- *
1795
- * TODO: AppTask.after[] dependency ordering is not yet mapped.
1796
- */
1797
- function roleToLifecycle(role) {
1798
- switch (role) {
1799
- case "init":
1800
- return { Hook: "prestart", Sidecar: false };
1801
- case "sidecar":
1802
- return { Hook: "prestart", Sidecar: true };
1803
- case "cleanup":
1804
- return { Hook: "poststop", Sidecar: false };
1805
- case "service":
1806
- default:
1807
- return null;
1808
- }
1809
- }
1810
- // ── Process runtime helpers ──────────────────────────────────────────────
1811
- /**
1812
- * Check whether a binary process is already running on the host OS by
1813
- * matching its command path via pgrep -f.
1814
- *
1815
- * Used by startAppJob to skip Nomad submission when the binary is already
1816
- * running (e.g. started outside of Nomad or when raw_exec driver is unavailable).
1817
- */
1818
- async function isBinaryRunning(command) {
1819
- if (!command)
1820
- return false;
1821
- const expanded = command.replace(/^~(?=\/|$)/, homedir());
1822
- // Try full path first, then basename — covers symlinks & macOS App Translocation.
1823
- const patterns = [expanded];
1824
- const base = basename(expanded);
1825
- if (base !== expanded)
1826
- patterns.push(base);
1827
- for (const pattern of patterns) {
1828
- const found = await new Promise((resolve) => {
1829
- execFileCb("pgrep", ["-f", pattern], { timeout: 3_000 }, (_err, stdout) => {
1830
- resolve(stdout.trim().length > 0);
1831
- });
1832
- });
1833
- if (found)
1834
- return true;
1835
- }
1836
- return false;
1837
- }
1838
- UnifiedNomadJobs.isBinaryRunning = isBinaryRunning;
1839
- function tryBindPort(port, host) {
1840
- return new Promise((resolve) => {
1841
- const server = netCreateServer();
1842
- server.once("error", (error) => {
1843
- if (error?.code === "EADDRINUSE") {
1844
- resolve(true);
1845
- return;
1846
- }
1847
- console.warn(`[port-probe] bind ${host}:${port} failed with ${error?.code ?? "unknown"}: ${error?.message}; treating as free`);
1848
- resolve(false);
1849
- });
1850
- server.once("listening", () => {
1851
- server.close(() => resolve(false));
1852
- });
1853
- server.listen(port, host);
1854
- });
1855
- }
1856
- async function isPortInUse(port) {
1857
- if (!Number.isInteger(port) || port < 1 || port > 65535)
1858
- return false;
1859
- // Probe sequentially so the wildcard probe does not race with the loopback
1860
- // probe and falsely trigger EADDRINUSE against our own temporary socket.
1861
- if (await tryBindPort(port, "0.0.0.0"))
1862
- return true;
1863
- return tryBindPort(port, "127.0.0.1");
1864
- }
1865
- function loadInstalledAppSpec(appId) {
1866
- const appDir = resolveAppDir(appId);
1867
- if (!appDir)
1868
- return null;
1869
- try {
1870
- return parse(readFileSync(join(appDir, "app-spec.yaml"), "utf-8"));
1871
- }
1872
- catch {
1873
- return null;
1874
- }
1875
- }
1876
- function externalHealthProbeTimeoutMs(task) {
1877
- return Math.max(1_000, Math.floor(parseIntervalNs(task.health?.timeout, 5_000_000_000) / 1_000_000));
1878
- }
1879
- async function probeExternalTaskHealth(appId, task) {
1880
- const health = task.health?.http;
1881
- if (!health)
1882
- return null;
1883
- const url = `http://127.0.0.1:${health.port}${health.path}`;
1884
- try {
1885
- const resp = await fetch(url, { signal: AbortSignal.timeout(externalHealthProbeTimeoutMs(task)) });
1886
- return {
1887
- name: `${task.name}-health`,
1888
- status: resp.ok ? "success" : "failure",
1889
- service: `${appId}-${task.name}`,
1890
- output: `external probe: HTTP ${resp.status}`,
1891
- };
1892
- }
1893
- catch (e) {
1894
- return {
1895
- name: `${task.name}-health`,
1896
- status: "failure",
1897
- service: `${appId}-${task.name}`,
1898
- output: `external probe: ${e?.message ?? "request failed"}`,
1899
- };
1900
- }
1901
- }
1902
- const EXTERNAL_PROCESS_ADOPT_COMMAND = "/bin/sh";
1903
- const EXTERNAL_PROCESS_ADOPT_ARGS = [
1904
- "-c",
1905
- "echo 'jishushell adopting external service'; trap 'exit 0' TERM INT; while true; do sleep 3600; done",
1906
- ];
1907
- const EXTERNAL_STOP_POLL_INTERVAL_MS = 250;
1908
- const EXTERNAL_STOP_SETTLE_TIMEOUT_MS = 4_000;
1909
- function expandTaskCommand(command) {
1910
- if (!command)
1911
- return null;
1912
- return command.replace(/^~(?=\/|$)/, homedir());
1913
- }
1914
- function commandLineMatchesTask(commandLine, task) {
1915
- const normalized = commandLine.trim();
1916
- const command = expandTaskCommand(task.command);
1917
- if (!command)
1918
- return false;
1919
- const [actualCommand, ...actualArgs] = normalized.split(/\s+/);
1920
- const expectedArgs = (task.args ?? []).map(String);
1921
- const commandMatches = actualCommand === command || actualCommand === basename(command);
1922
- if (!commandMatches)
1923
- return false;
1924
- const actualTail = actualArgs.join(" ").trim();
1925
- const expectedTail = expectedArgs.join(" ").trim();
1926
- if (!expectedTail)
1927
- return true;
1928
- return actualTail === expectedTail || actualTail.startsWith(`${expectedTail} `);
1929
- }
1930
- function parseExecFileError(error) {
1931
- const stderr = typeof error?.stderr === "string" ? error.stderr.trim() : "";
1932
- if (stderr)
1933
- return stderr.split("\n")[0];
1934
- const stdout = typeof error?.stdout === "string" ? error.stdout.trim() : "";
1935
- if (stdout)
1936
- return stdout.split("\n")[0];
1937
- return String(error?.message ?? "command failed").trim();
1938
- }
1939
- async function listExternalTaskProcesses(task) {
1940
- const command = expandTaskCommand(task.command);
1941
- if (!command)
1942
- return [];
1943
- const execFileAsync = promisify(execFileCb);
1944
- try {
1945
- const { stdout } = await execFileAsync("ps", ["-eo", "pid=,user=,args="], { timeout: 5_000 });
1946
- return stdout
1947
- .split("\n")
1948
- .map((line) => line.match(/^\s*(\d+)\s+(\S+)\s+(.*)$/))
1949
- .filter((match) => Boolean(match))
1950
- .map((match) => ({
1951
- pid: Number(match[1]),
1952
- user: match[2] || null,
1953
- commandLine: match[3]?.trim() ?? "",
1954
- }))
1955
- .filter((entry) => entry.pid > 1 && commandLineMatchesTask(entry.commandLine, task));
1956
- }
1957
- catch {
1958
- return [];
1959
- }
1960
- }
1961
- async function listExternalTaskBusyPorts(task) {
1962
- const declaredPorts = (task.ports ?? [])
1963
- .map((port) => port.port)
1964
- .filter((port) => Number.isInteger(port) && port > 0 && port <= 65535);
1965
- const occupiedFlags = await Promise.all(declaredPorts.map((port) => isPortInUse(port)));
1966
- return declaredPorts.filter((_port, index) => occupiedFlags[index]);
1967
- }
1968
- function parseSsPortLine(line) {
1969
- const columns = line.trim().split(/\s+/);
1970
- const local = columns[3] ?? "";
1971
- if (!local)
1972
- return null;
1973
- if (local.startsWith("[")) {
1974
- const end = local.indexOf("]:");
1975
- if (end < 0)
1976
- return null;
1977
- const address = local.slice(1, end);
1978
- const port = Number(local.slice(end + 2));
1979
- return Number.isInteger(port) ? { address, port } : null;
1980
- }
1981
- const idx = local.lastIndexOf(":");
1982
- if (idx < 0)
1983
- return null;
1984
- const address = local.slice(0, idx);
1985
- const port = Number(local.slice(idx + 1));
1986
- return Number.isInteger(port) ? { address, port } : null;
1987
- }
1988
- async function listListeningAddressesForPorts(ports) {
1989
- const wanted = new Set(ports.filter((port) => Number.isInteger(port) && port > 0 && port <= 65535));
1990
- if (wanted.size === 0)
1991
- return {};
1992
- const execFileAsync = promisify(execFileCb);
1993
- try {
1994
- const { stdout } = await execFileAsync("ss", ["-ltnH"], { timeout: 5_000 });
1995
- const result = {};
1996
- for (const line of stdout.split("\n")) {
1997
- const parsed = parseSsPortLine(line);
1998
- if (!parsed || !wanted.has(parsed.port))
1999
- continue;
2000
- result[parsed.port] ??= [];
2001
- if (!result[parsed.port].includes(parsed.address)) {
2002
- result[parsed.port].push(parsed.address);
2003
- }
2004
- }
2005
- return result;
2006
- }
2007
- catch {
2008
- return {};
2009
- }
2010
- }
2011
- function portRequiresExternalBinding(task, port) {
2012
- const portEntry = (task.ports ?? []).find((entry) => entry.port === port);
2013
- return (portEntry?.visibility ?? "external") !== "internal";
2014
- }
2015
- function isNonLoopbackAddress(address) {
2016
- const normalized = address.trim().replace(/^\[|\]$/g, "");
2017
- if (!normalized || normalized === "*" || normalized === "0.0.0.0" || normalized === "::" || normalized === ":::") {
2018
- return true;
2019
- }
2020
- if (normalized === "localhost" || normalized === "::1")
2021
- return false;
2022
- if (/^127\./.test(normalized))
2023
- return false;
2024
- return true;
2025
- }
2026
- function loopbackOnlyConflictDetail(task, occupiedPorts, listeningAddresses) {
2027
- const invalidPorts = occupiedPorts.filter((port) => {
2028
- if (!portRequiresExternalBinding(task, port))
2029
- return false;
2030
- const addresses = listeningAddresses[port] ?? [];
2031
- return addresses.length > 0 && !addresses.some(isNonLoopbackAddress);
2032
- });
2033
- if (invalidPorts.length === 0)
2034
- return null;
2035
- const details = invalidPorts.map((port) => {
2036
- const bindings = (listeningAddresses[port] ?? []).join(", ") || "127.0.0.1";
2037
- return `${port} (${bindings})`;
2038
- });
2039
- return `Task "${task.name}" 端口 ${details.join(", ")} 当前仅监听在本地回环地址,无法作为可外部访问的应用接管`;
2040
- }
2041
- async function snapshotExternalTaskRuntime(task) {
2042
- const [processes, occupiedPorts, healthCheck] = await Promise.all([
2043
- listExternalTaskProcesses(task),
2044
- listExternalTaskBusyPorts(task),
2045
- probeExternalTaskHealth("external-stop", task),
2046
- ]);
2047
- const healthy = healthCheck?.status === "success";
2048
- return {
2049
- running: processes.length > 0 || (occupiedPorts.length > 0 && (healthy || !task.health?.http)),
2050
- processes,
2051
- occupiedPorts,
2052
- healthy,
2053
- };
2054
- }
2055
- async function waitForExternalTaskExit(task, timeoutMs = EXTERNAL_STOP_SETTLE_TIMEOUT_MS) {
2056
- const deadline = Date.now() + timeoutMs;
2057
- while (Date.now() < deadline) {
2058
- const snapshot = await snapshotExternalTaskRuntime(task);
2059
- if (!snapshot.running)
2060
- return true;
2061
- await new Promise((resolve) => setTimeout(resolve, EXTERNAL_STOP_POLL_INTERVAL_MS));
2062
- }
2063
- const finalSnapshot = await snapshotExternalTaskRuntime(task);
2064
- return !finalSnapshot.running;
2065
- }
2066
- async function detectSystemdUnitForTask(task, processes) {
2067
- if (process.platform !== "linux" || processes.length === 0)
2068
- return null;
2069
- const command = expandTaskCommand(task.command);
2070
- if (!command)
2071
- return null;
2072
- const candidate = `${basename(command).replace(/\.[^.]+$/, "")}.service`;
2073
- const execFileAsync = promisify(execFileCb);
2074
- try {
2075
- const { stdout } = await execFileAsync("systemctl", ["show", candidate, "--property=LoadState,ActiveState,MainPID,ExecStart"], { timeout: 5_000 });
2076
- const props = Object.fromEntries(stdout
2077
- .split("\n")
2078
- .map((line) => line.trim())
2079
- .filter(Boolean)
2080
- .map((line) => {
2081
- const idx = line.indexOf("=");
2082
- return idx >= 0 ? [line.slice(0, idx), line.slice(idx + 1)] : [line, ""];
2083
- }));
2084
- if (props.LoadState === "not-found")
2085
- return null;
2086
- if (!["active", "activating", "reloading"].includes(props.ActiveState ?? ""))
2087
- return null;
2088
- const mainPid = Number(props.MainPID ?? 0);
2089
- if (processes.some((entry) => entry.pid === mainPid)) {
2090
- return candidate;
2091
- }
2092
- return props.ExecStart?.includes(command) ? candidate : null;
2093
- }
2094
- catch {
2095
- return null;
2096
- }
2097
- }
2098
- async function stopSystemdUnit(unit) {
2099
- const execFileAsync = promisify(execFileCb);
2100
- let lastError = null;
2101
- try {
2102
- await execFileAsync("systemctl", ["--no-ask-password", "stop", unit], { timeout: 15_000 });
2103
- return null;
2104
- }
2105
- catch (error) {
2106
- lastError = parseExecFileError(error);
2107
- }
2108
- try {
2109
- await execFileAsync("sudo", ["-n", "systemctl", "stop", unit], { timeout: 15_000 });
2110
- return null;
2111
- }
2112
- catch (error) {
2113
- return parseExecFileError(error) || lastError;
2114
- }
2115
- }
2116
- function isProcessAlive(pid) {
2117
- try {
2118
- process.kill(pid, 0);
2119
- return true;
2120
- }
2121
- catch (error) {
2122
- return error?.code === "EPERM";
2123
- }
2124
- }
2125
- async function waitForPidExit(pid, timeoutMs) {
2126
- const deadline = Date.now() + timeoutMs;
2127
- while (Date.now() < deadline) {
2128
- if (!isProcessAlive(pid))
2129
- return true;
2130
- await new Promise((resolve) => setTimeout(resolve, EXTERNAL_STOP_POLL_INTERVAL_MS));
2131
- }
2132
- return !isProcessAlive(pid);
2133
- }
2134
- async function terminateExternalProcess(pid) {
2135
- try {
2136
- process.kill(pid, "SIGTERM");
2137
- }
2138
- catch (error) {
2139
- if (error?.code === "ESRCH")
2140
- return null;
2141
- return String(error?.message ?? error);
2142
- }
2143
- if (await waitForPidExit(pid, 2_500)) {
2144
- return null;
2145
- }
2146
- try {
2147
- process.kill(pid, "SIGKILL");
2148
- }
2149
- catch (error) {
2150
- if (error?.code === "ESRCH")
2151
- return null;
2152
- return String(error?.message ?? error);
2153
- }
2154
- return (await waitForPidExit(pid, 1_500)) ? null : `pid ${pid} 在 SIGKILL 后仍存活`;
2155
- }
2156
- async function stopExternalProcessTask(task) {
2157
- const initial = await snapshotExternalTaskRuntime(task);
2158
- if (!initial.running) {
2159
- return { detected: false, ok: true };
2160
- }
2161
- const errors = [];
2162
- const systemdUnit = await detectSystemdUnitForTask(task, initial.processes);
2163
- if (systemdUnit) {
2164
- const stopError = await stopSystemdUnit(systemdUnit);
2165
- if (stopError) {
2166
- errors.push(`systemd unit "${systemdUnit}" 停止失败: ${stopError}`);
2167
- }
2168
- if (await waitForExternalTaskExit(task)) {
2169
- return { detected: true, ok: true };
2170
- }
2171
- }
2172
- for (const proc of initial.processes) {
2173
- const stopError = await terminateExternalProcess(proc.pid);
2174
- if (stopError) {
2175
- const owner = proc.user ? ` (${proc.user})` : "";
2176
- errors.push(`无法停止进程 ${proc.pid}${owner}: ${stopError}`);
2177
- }
2178
- }
2179
- if (await waitForExternalTaskExit(task)) {
2180
- return { detected: true, ok: true };
2181
- }
2182
- const finalSnapshot = await snapshotExternalTaskRuntime(task);
2183
- const details = [];
2184
- if (finalSnapshot.processes.length > 0) {
2185
- details.push(`进程 ${finalSnapshot.processes.map((proc) => `${proc.pid}${proc.user ? `(${proc.user})` : ""}`).join(", ")} 仍在运行`);
2186
- }
2187
- if (finalSnapshot.occupiedPorts.length > 0) {
2188
- details.push(`端口 ${finalSnapshot.occupiedPorts.join(", ")} 仍被占用`);
2189
- }
2190
- if (systemdUnit) {
2191
- details.push(`可手动执行 sudo systemctl stop ${systemdUnit}`);
2192
- }
2193
- return {
2194
- detected: true,
2195
- ok: false,
2196
- error: `Task "${task.name}" 未能完全停止:${details.join(",")}${errors.length ? `;${errors.join("; ")}` : ""}`,
2197
- };
2198
- }
2199
- async function stopExternalProcessApp(appId) {
2200
- const spec = loadInstalledAppSpec(appId);
2201
- if (!spec) {
2202
- return { detected: false, ok: true };
2203
- }
2204
- const processTasks = spec.tasks.filter((task) => task.runtime === "process" && (task.role ?? "service") === "service");
2205
- if (processTasks.length === 0) {
2206
- return { detected: false, ok: true };
2207
- }
2208
- const errors = [];
2209
- let detected = false;
2210
- for (const task of processTasks) {
2211
- const result = await stopExternalProcessTask(task);
2212
- detected ||= result.detected;
2213
- if (!result.ok && result.error) {
2214
- errors.push(result.error);
2215
- }
2216
- }
2217
- return {
2218
- detected,
2219
- ok: errors.length === 0,
2220
- ...(errors.length ? { error: errors.join("; ") } : {}),
2221
- };
2222
- }
2223
- async function inspectExternalProcessTask(appId, task) {
2224
- const commandRunning = task.command ? await isBinaryRunning(task.command) : false;
2225
- const declaredPorts = (task.ports ?? [])
2226
- .map((port) => port.port)
2227
- .filter((port) => Number.isInteger(port) && port > 0 && port <= 65535);
2228
- const occupiedFlags = await Promise.all(declaredPorts.map((port) => isPortInUse(port)));
2229
- const busyPorts = declaredPorts.filter((_port, index) => occupiedFlags[index]);
2230
- const listeningAddresses = await listListeningAddressesForPorts(busyPorts);
2231
- const healthCheck = await probeExternalTaskHealth(appId, task);
2232
- const healthMatched = healthCheck?.status === "success";
2233
- const bindingConflict = loopbackOnlyConflictDetail(task, busyPorts, listeningAddresses);
2234
- const hasDeclaredPorts = declaredPorts.length > 0;
2235
- // External adoption must be conservative. A matching command name alone is
2236
- // not enough evidence for service readiness because unrelated host processes
2237
- // can share the same binary. When a health check exists, require it to pass.
2238
- // Without a health check, require the service to actually occupy its declared
2239
- // port(s); only port-less process tasks can fall back to command detection.
2240
- const detected = !bindingConflict && ((Boolean(task.health?.http) && healthMatched)
2241
- || (!task.health?.http && hasDeclaredPorts && busyPorts.length > 0)
2242
- || (!task.health?.http && !hasDeclaredPorts && commandRunning));
2243
- const conflict = Boolean(bindingConflict) || (busyPorts.length > 0 && !healthMatched && Boolean(task.health?.http));
2244
- const status = {
2245
- state: detected ? "running" : conflict ? "failed" : "stopped",
2246
- restarts: 0,
2247
- };
2248
- if (healthCheck) {
2249
- status.health_checks = [healthCheck];
2250
- status.health_status = aggregateHealthStatus(status.health_checks);
2251
- }
2252
- return {
2253
- detected,
2254
- conflict,
2255
- occupiedPorts: busyPorts,
2256
- ...(bindingConflict ? { conflictDetail: bindingConflict } : {}),
2257
- status,
2258
- };
2259
- }
2260
- async function inspectExternalProcessApp(appId, spec) {
2261
- if (!resolveAppDir(appId)) {
2262
- return { detected: false, conflicts: [], status: null };
2263
- }
2264
- const appSpec = spec ?? loadInstalledAppSpec(appId);
2265
- if (!appSpec)
2266
- return { detected: false, conflicts: [], status: null };
2267
- const serviceProcessTasks = appSpec.tasks.filter((task) => task.runtime === "process" && (task.role ?? "service") === "service");
2268
- if (serviceProcessTasks.length === 0) {
2269
- return { detected: false, conflicts: [], status: null };
2270
- }
2271
- const tasks = {};
2272
- const conflicts = [];
2273
- let detected = false;
2274
- for (const task of appSpec.tasks) {
2275
- if (task.runtime === "process" && (task.role ?? "service") === "service") {
2276
- const inspection = await inspectExternalProcessTask(appId, task);
2277
- tasks[task.name] = inspection.status;
2278
- detected ||= inspection.detected;
2279
- if (inspection.conflict) {
2280
- if (inspection.conflictDetail) {
2281
- conflicts.push(inspection.conflictDetail);
2282
- }
2283
- else {
2284
- const ports = inspection.occupiedPorts.join(", ");
2285
- const path = task.health?.http?.path ?? "/";
2286
- conflicts.push(`Task "${task.name}" 端口 ${ports} 已被占用,但现有服务未通过健康检查 ${path}`);
2287
- }
2288
- }
2289
- continue;
2290
- }
2291
- tasks[task.name] = {
2292
- state: (task.role ?? "service") === "init" ? "dead" : "unknown",
2293
- restarts: 0,
2294
- };
2295
- }
2296
- if (!detected) {
2297
- return { detected: false, conflicts, status: null };
2298
- }
2299
- const primaryTaskName = serviceProcessTasks[0]?.name ?? Object.keys(tasks)[0] ?? "";
2300
- return {
2301
- detected: true,
2302
- conflicts,
2303
- status: {
2304
- status: "running",
2305
- tasks,
2306
- pid: null,
2307
- uptime: null,
2308
- memory_mb: null,
2309
- cpu_percent: null,
2310
- restarts: tasks[primaryTaskName]?.restarts ?? 0,
2311
- },
2312
- };
2313
- }
2314
- async function buildExternalAdoptedSpec(appId, spec) {
2315
- if (!resolveAppDir(appId)) {
2316
- return { adopted: false, conflicts: [], spec };
2317
- }
2318
- const conflicts = [];
2319
- let adopted = false;
2320
- const tasks = await Promise.all(spec.tasks.map(async (task) => {
2321
- if (task.runtime !== "process" || (task.role ?? "service") !== "service") {
2322
- return task;
2323
- }
2324
- const inspection = await inspectExternalProcessTask(appId, task);
2325
- if (inspection.conflict) {
2326
- if (inspection.conflictDetail) {
2327
- conflicts.push(inspection.conflictDetail);
2328
- }
2329
- else {
2330
- const ports = inspection.occupiedPorts.join(", ");
2331
- const path = task.health?.http?.path ?? "/";
2332
- conflicts.push(`Task "${task.name}" 端口 ${ports} 已被占用,但现有服务未通过健康检查 ${path}`);
2333
- }
2334
- return task;
2335
- }
2336
- if (!inspection.detected) {
2337
- return task;
2338
- }
2339
- adopted = true;
2340
- return {
2341
- ...task,
2342
- command: EXTERNAL_PROCESS_ADOPT_COMMAND,
2343
- args: [...EXTERNAL_PROCESS_ADOPT_ARGS],
2344
- env: {
2345
- ...(task.env ?? {}),
2346
- JISHUSHELL_EXTERNAL_ADOPTED: "1",
2347
- },
2348
- };
2349
- }));
2350
- return {
2351
- adopted,
2352
- conflicts,
2353
- spec: adopted ? { ...spec, tasks } : spec,
2354
- };
2355
- }
2356
- // ── Nomad task builders ───────────────────────────────────────────────────
2357
- /**
2358
- * Build a Nomad raw_exec task from an AppTask with runtime="process".
2359
- *
2360
- * raw_exec runs the command directly on the host as the specified user.
2361
- * Ports declared in task.ports are registered with Nomad for discovery
2362
- * but do NOT require network mapping (process binds the host port directly).
2363
- */
2364
- function buildRawExecTask(task, appId, extraEnv) {
2365
- const command = (task.command ?? task.binary)
2366
- ?.replace(/^~(?=\/|$)/, homedir());
2367
- if (!command)
2368
- throw new Error(`raw_exec task "${task.name}" must specify command`);
2369
- const args = (task.args ?? []).map(String);
2370
- const cpu = parseCpuMHz(task.resources?.cpu);
2371
- const mem = parseMemoryMB(task.resources?.memory);
2372
- const env = {
2373
- ...extraEnv,
2374
- ...interpolateEnvRequires(task.env ?? {}, extraEnv),
2375
- };
2376
- const lifecycle = roleToLifecycle(task.role ?? "service");
2377
- const taskDef = {
2378
- Name: task.name,
2379
- Driver: "raw_exec",
2380
- Config: {
2381
- command,
2382
- args,
2383
- },
2384
- Env: env,
2385
- Resources: {
2386
- CPU: cpu,
2387
- MemoryMB: mem,
2388
- },
2389
- LogConfig: { MaxFiles: 3, MaxFileSizeMB: 10 },
2390
- };
2391
- if (lifecycle)
2392
- taskDef.Lifecycle = lifecycle;
2393
- const svcCheck = buildServiceCheck(task, appId);
2394
- if (svcCheck)
2395
- taskDef.Services = [svcCheck];
2396
- return taskDef;
2397
- }
2398
- /**
2399
- * Build a Nomad docker task from an AppTask with runtime="container".
2400
- *
2401
- * Uses bridge network mode. Each declared port in task.ports is published
2402
- * from the host to the container.
2403
- */
2404
- function buildDockerTask(task, appId, extraEnv) {
2405
- const image = task.image;
2406
- if (!image)
2407
- throw new Error(`docker task "${task.name}" must specify image`);
2408
- if (!UnifiedNomadJobs.DOCKER_IMAGE_RE.test(image) || image.length > UnifiedNomadJobs.MAX_DOCKER_IMAGE_NAME_LEN) {
2409
- throw new Error(`docker task "${task.name}": invalid image name "${image}"`);
2410
- }
2411
- const args = (task.args ?? []).map(String);
2412
- const cpu = parseCpuMHz(task.resources?.cpu);
2413
- const mem = parseMemoryMB(task.resources?.memory);
2414
- const memMax = Math.min(mem, MAX_MEMORY_MAX_MB);
2415
- const env = {
2416
- ...extraEnv,
2417
- ...interpolateEnvRequires(task.env ?? {}, extraEnv),
2418
- };
2419
- // Only externally-visible ports get published to the host. Internal
2420
- // ports (e.g. SearXNG sidecar at 8080) stay inside the container /
2421
- // task-group network and are reached from peer tasks via 127.0.0.1.
2422
- const publishedPorts = (task.ports ?? [])
2423
- .filter((p) => (p.visibility ?? "external") !== "internal")
2424
- .map((p) => portLabel(task.name, p.name));
2425
- const lifecycle = roleToLifecycle(task.role ?? "service");
2426
- const volumes = (task.volumes ?? []).map((v) => {
2427
- if (typeof v === "string")
2428
- return v.replace(/^~(?=\/|$)/, homedir());
2429
- const src = v.source.replace(/^~(?=\/|$)/, homedir());
2430
- return `${src}:${v.target}${v.readonly ? ":ro" : ":rw"}`;
2431
- });
2432
- // Resolve container task user. On Linux we default to the panel
2433
- // process's host uid:gid so bind-mounted data dirs (owned by the panel
2434
- // user, typically `pi`) are writable without forcing the container to
2435
- // run as root and without needing chown / DAC_OVERRIDE gymnastics.
2436
- // yaml override `user: "<uid>:<gid>"` wins; explicit `user: "root"` or
2437
- // `user: "0:0"` keeps the image's root default.
2438
- //
2439
- // On macOS we skip the host-uid default. Docker on Mac runs inside a
2440
- // Linux VM (Colima/Docker Desktop) with its own uid namespace — host
2441
- // uids like 501 (the standard macOS first-user) are virtualised away
2442
- // by virtiofs and almost never exist in the image's /etc/passwd. Some
2443
- // images crash hard when started as an unknown uid: e.g. browserless
2444
- // calls Node.js `os.userInfo()` very early, which throws
2445
- // `uv_os_get_passwd returned ENOENT` and the container exits before
2446
- // the port ever binds. Letting the image's default USER directive
2447
- // take effect is correct on Mac; users who do need bind-mount
2448
- // ownership control can still set yaml `user:` explicitly.
2449
- const containerUser = (() => {
2450
- if (task.runtime !== "container")
2451
- return undefined;
2452
- const declared = typeof task.user === "string" ? task.user.trim() : "";
2453
- if (declared === "host" || declared === "") {
2454
- if (process.platform === "darwin")
2455
- return undefined;
2456
- const uid = process.getuid?.() ?? 1000;
2457
- const gid = process.getgid?.() ?? 1000;
2458
- return `${uid}:${gid}`;
2459
- }
2460
- return declared;
2461
- })();
2462
- // Validate cap_add against a tight allowlist. The full Linux cap surface
2463
- // is large; we only honor capabilities image entrypoints actually need
2464
- // for the canonical "start as root + gosu to user" pattern. Anything
2465
- // outside this list is silently dropped — failing closed protects
2466
- // against typo'd / hostile specs widening the container's capability
2467
- // bounds beyond what the panel author signed off on.
2468
- const ALLOWED_CAPS = new Set([
2469
- "CHOWN", "DAC_OVERRIDE", "FOWNER",
2470
- "SETUID", "SETGID", "SETPCAP", "NET_BIND_SERVICE",
2471
- ]);
2472
- const capAdd = Array.isArray(task.cap_add)
2473
- ? task.cap_add
2474
- .map((c) => typeof c === "string" ? c.trim().toUpperCase().replace(/^CAP_/, "") : "")
2475
- .filter((c) => ALLOWED_CAPS.has(c))
2476
- : [];
2477
- const taskDef = {
2478
- Name: task.name,
2479
- Driver: "docker",
2480
- ...(containerUser ? { User: containerUser } : {}),
2481
- Config: {
2482
- image,
2483
- force_pull: false,
2484
- // Nomad's docker driver default `image_pull_timeout` is 5 minutes;
2485
- // on Raspberry Pi or other constrained networks a 1+ GiB image
2486
- // (Open WebUI, OpenClaw, Hermes) can exceed that and the alloc
2487
- // restart-loops with "Failed to pull: context deadline exceeded"
2488
- // before it ever starts. Raise to 15 minutes — long enough for
2489
- // realistic Pi-class pulls, short enough that a genuinely
2490
- // unreachable registry still surfaces as a failure within a
2491
- // bounded window.
2492
- image_pull_timeout: "15m",
2493
- ...(task.command ? { command: String(task.command) } : {}),
2494
- args,
2495
- ...(publishedPorts.length > 0 ? { ports: publishedPorts } : {}),
2496
- extra_hosts: ["host.docker.internal:host-gateway"],
2497
- cap_drop: ["ALL"],
2498
- ...(capAdd.length > 0 ? { cap_add: capAdd } : {}),
2499
- security_opt: ["no-new-privileges"],
2500
- pids_limit: DEFAULT_PIDS_LIMIT,
2501
- readonly_rootfs: false,
2502
- ...(volumes.length > 0 ? { volumes } : {}),
2503
- mounts: [
2504
- { type: "tmpfs", target: "/tmp", tmpfs_options: { size: 536_870_912 } },
2505
- { type: "tmpfs", target: "/var/tmp", tmpfs_options: { size: 67_108_864 } },
2506
- ],
2507
- },
2508
- Env: env,
2509
- Resources: {
2510
- CPU: cpu,
2511
- MemoryMB: mem,
2512
- MemoryMaxMB: memMax,
2513
- },
2514
- LogConfig: { MaxFiles: 3, MaxFileSizeMB: 10 },
2515
- };
2516
- if (lifecycle)
2517
- taskDef.Lifecycle = lifecycle;
2518
- const svcCheck = buildServiceCheck(task, appId);
2519
- if (svcCheck)
2520
- taskDef.Services = [svcCheck];
2521
- return taskDef;
2522
- }
2523
- // ── Job builder ───────────────────────────────────────────────────────────
2524
- /**
2525
- * Build a complete Nomad job payload from an AppSpec.
2526
- *
2527
- * @param spec The validated AppSpec.
2528
- * @param appId A unique instance/run ID (used as job suffix).
2529
- * @param driver "docker" | "raw_exec"
2530
- * @param extraEnv Additional env vars injected into every task (e.g. capability addresses).
2531
- */
2532
- function buildAppJob(spec, appId, driver, extraEnv) {
2533
- const materializedSpec = materializeAppIdTokens(spec, appId);
2534
- const jid = jobId(appId);
2535
- assertSafeTemplateId(jid);
2536
- const tasks = materializedSpec.tasks.map((task) => {
2537
- const actualDriver = task.runtime === "container" ? "docker" : "raw_exec";
2538
- // Validate driver availability
2539
- if (actualDriver !== driver) {
2540
- // Allow mixed task runtimes — build each task with its own driver.
2541
- // Nomad supports heterogeneous drivers within one group.
2542
- }
2543
- if (task.runtime === "container") {
2544
- return buildDockerTask(task, appId, extraEnv);
2545
- }
2546
- else if (task.runtime === "process") {
2547
- return buildRawExecTask(task, appId, extraEnv);
2548
- }
2549
- else {
2550
- throw new Error(`Unsupported task runtime "${task.runtime}" for task "${task.name}"`);
2551
- }
2552
- });
2553
- const groupReservedPorts = materializedSpec.tasks.flatMap((task) => reservedPortsForTask(task));
2554
- const jobDef = {
2555
- Job: {
2556
- ID: jid,
2557
- Name: jid,
2558
- Namespace: "default",
2559
- Type: "service",
2560
- Datacenters: ["*"],
2561
- TaskGroups: [{
2562
- Name: materializedSpec.id,
2563
- Count: 1,
2564
- ...(groupReservedPorts.length > 0
2565
- ? { Networks: [{ ReservedPorts: groupReservedPorts }] }
2566
- : {}),
2567
- RestartPolicy: {
2568
- // 10 attempts × 15s delay = ~2.5min recovery window. Multi-task
2569
- // app groups commonly need 3-5 restarts before sidecar
2570
- // dependencies' external port-publish settles.
2571
- Attempts: 10,
2572
- Interval: 600_000_000_000,
2573
- Delay: 15_000_000_000,
2574
- Mode: "fail",
2575
- },
2576
- Reschedule: {
2577
- Attempts: 3,
2578
- Interval: 3_600_000_000_000,
2579
- Unlimited: false,
2580
- },
2581
- Update: {
2582
- MaxParallel: 1,
2583
- HealthCheck: "task_states",
2584
- MinHealthyTime: 5_000_000_000,
2585
- HealthyDeadline: 120_000_000_000,
2586
- AutoRevert: false,
2587
- },
2588
- Tasks: tasks,
2589
- }],
2590
- },
2591
- };
2592
- if (materializedSpec._engine) {
2593
- jobDef.Job = deepMerge(jobDef.Job, materializedSpec._engine.Job ?? materializedSpec._engine);
2594
- }
2595
- return jobDef;
2596
- }
2597
- // ── Alloc helpers ─────────────────────────────────────────────────────────
2598
- async function getAllocs(appId) {
2599
- const jid = jobId(appId);
2600
- try {
2601
- const resp = await nomadGet(`/v1/job/${jid}/allocations`);
2602
- if (resp.status === 404)
2603
- return [];
2604
- const allocs = await resp.json();
2605
- return allocs;
2606
- }
2607
- catch {
2608
- return [];
2609
- }
2610
- }
2611
- function pickLiveAlloc(allocs) {
2612
- for (const clientStatus of ["running", "pending"]) {
2613
- for (const alloc of allocs) {
2614
- if (alloc.ClientStatus === clientStatus)
2615
- return alloc;
2616
- }
2617
- }
2618
- return null;
2619
- }
2620
- function pickLatestTerminalAlloc(allocs) {
2621
- const terminalAllocs = allocs
2622
- .filter((alloc) => alloc.ClientStatus !== "running" && alloc.ClientStatus !== "pending")
2623
- .sort((left, right) => allocTimestamp(right) - allocTimestamp(left));
2624
- return terminalAllocs[0] ?? null;
2625
- }
2626
- async function getAllocClientStatus(allocId) {
2627
- if (!/^[a-f0-9-]+$/i.test(allocId))
2628
- return null;
2629
- try {
2630
- const resp = await nomadGet(`/v1/allocation/${allocId}`);
2631
- if (resp.status === 404 || !resp.ok)
2632
- return null;
2633
- const alloc = await resp.json();
2634
- return typeof alloc?.ClientStatus === "string" ? alloc.ClientStatus : null;
2635
- }
2636
- catch {
2637
- return null;
2638
- }
2639
- }
2640
- async function waitForAllocationsToStop(allocIds, timeoutMs = 30_000, pollIntervalMs = 1_000) {
2641
- const pending = new Set(allocIds.filter((allocId) => /^[a-f0-9-]+$/i.test(allocId)));
2642
- if (pending.size === 0)
2643
- return true;
2644
- const deadline = Date.now() + timeoutMs;
2645
- while (Date.now() < deadline) {
2646
- for (const allocId of [...pending]) {
2647
- const status = await getAllocClientStatus(allocId);
2648
- if (status == null || (status !== "running" && status !== "pending")) {
2649
- pending.delete(allocId);
2650
- }
2651
- }
2652
- if (pending.size === 0)
2653
- return true;
2654
- await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
2655
- }
2656
- return pending.size === 0;
2657
- }
2658
- async function getAllocChecks(allocId) {
2659
- try {
2660
- const resp = await nomadGet(`/v1/allocation/${allocId}/checks`);
2661
- if (resp.status === 404 || !resp.ok)
2662
- return [];
2663
- const checks = await resp.json();
2664
- return Object.values(checks ?? {});
2665
- }
2666
- catch {
2667
- return [];
2668
- }
2669
- }
2670
- function taskNameForAllocCheck(check, taskNames, appId) {
2671
- const checkName = String(check.Check ?? "");
2672
- for (const taskName of taskNames) {
2673
- if (checkName === `${taskName}-health` || checkName.startsWith(`${taskName}-`)) {
2674
- return taskName;
2675
- }
2676
- }
2677
- const serviceName = String(check.Service ?? "");
2678
- if (taskNames.includes(serviceName))
2679
- return serviceName;
2680
- const appTaskPrefix = `${appId}-`;
2681
- if (serviceName.startsWith(appTaskPrefix)) {
2682
- const candidate = serviceName.slice(appTaskPrefix.length);
2683
- if (taskNames.includes(candidate))
2684
- return candidate;
2685
- }
2686
- return null;
2687
- }
2688
- function aggregateHealthStatus(checks) {
2689
- const statuses = checks.map((check) => String(check.status ?? "unknown").toLowerCase());
2690
- if (statuses.length === 0)
2691
- return "unknown";
2692
- const healthy = new Set(["success", "passing", "healthy"]);
2693
- const unhealthy = new Set(["failure", "critical", "warning", "unhealthy"]);
2694
- if (statuses.every((status) => healthy.has(status)))
2695
- return "healthy";
2696
- if (statuses.some((status) => unhealthy.has(status)))
2697
- return "unhealthy";
2698
- if (statuses.some((status) => status === "pending" || status === "unknown" || status === "")) {
2699
- return "unknown";
2700
- }
2701
- return statuses[0];
2702
- }
2703
- UnifiedNomadJobs.aggregateHealthStatus = aggregateHealthStatus;
2704
- async function getRunningAlloc(appId) {
2705
- return pickLiveAlloc(await getAllocs(appId));
2706
- }
2707
- // ── Public API ────────────────────────────────────────────────────────────
2708
- /**
2709
- * Returns true if this app job exists in Nomad and was NOT explicitly stopped.
2710
- * Used at JishuShell startup to auto-restart apps that were running before reboot.
2711
- */
2712
- async function shouldAutoStart(appId) {
2713
- const jid = jobId(appId);
2714
- try {
2715
- const resp = await nomadGet(`/v1/job/${jid}`);
2716
- if (!resp.ok || resp.status === 404)
2717
- return false;
2718
- const job = await resp.json();
2719
- return job.Stop === false && job.Status !== "dead";
2720
- }
2721
- catch {
2722
- return false;
2723
- }
2724
- }
2725
- UnifiedNomadJobs.shouldAutoStart = shouldAutoStart;
2726
- /**
2727
- * Get the aggregated status of an app job.
2728
- *
2729
- * @param appId App instance ID.
2730
- * @param primaryTask Task name to use for uptime/restarts summary.
2731
- * Defaults to the first service task in the spec.
2732
- * If omitted, the first task state found is used.
2733
- */
2734
- async function getAppStatus(appId, primaryTask) {
2735
- const jid = jobId(appId);
2736
- const stopped = {
2737
- status: "stopped",
2738
- tasks: {},
2739
- pid: null,
2740
- uptime: null,
2741
- memory_mb: null,
2742
- cpu_percent: null,
2743
- restarts: 0,
2744
- };
2745
- try {
2746
- const resp = await nomadGet(`/v1/job/${jid}`);
2747
- if (resp.status === 404)
2748
- return stopped;
2749
- const job = await resp.json();
2750
- if (job.Stop)
2751
- return stopped;
2752
- }
2753
- catch {
2754
- return { ...stopped, status: "unknown", error: "Nomad unreachable" };
2755
- }
2756
- const allocs = await getAllocs(appId);
2757
- const alloc = pickLiveAlloc(allocs) ?? pickLatestTerminalAlloc(allocs);
2758
- // When Nomad has no allocation (e.g. raw_exec driver disabled), fall back to
2759
- // external process detection for process-runtime apps.
2760
- if (!alloc || alloc.ClientStatus === "pending") {
2761
- const ext = await inspectExternalProcessApp(appId);
2762
- if (ext.detected && ext.status)
2763
- return ext.status;
2764
- if (!alloc)
2765
- return { ...stopped, status: "pending" };
2766
- }
2767
- const allocId = alloc.ID;
2768
- const taskStates = alloc.TaskStates ?? {};
2769
- // Build per-task summary
2770
- const tasks = {};
2771
- for (const [name, state] of Object.entries(taskStates)) {
2772
- const s = state;
2773
- tasks[name] = {
2774
- state: s.State ?? "unknown",
2775
- restarts: s.Restarts ?? 0,
2776
- started_at: s.StartedAt ?? undefined,
2777
- };
2778
- }
2779
- const allocChecks = await getAllocChecks(allocId);
2780
- const taskNames = Object.keys(tasks);
2781
- for (const check of allocChecks) {
2782
- const taskName = taskNameForAllocCheck(check, taskNames, appId);
2783
- if (!taskName || !tasks[taskName])
2784
- continue;
2785
- tasks[taskName].health_checks ??= [];
2786
- tasks[taskName].health_checks.push({
2787
- name: String(check.Check ?? "health"),
2788
- status: String(check.Status ?? "unknown"),
2789
- ...(typeof check.Service === "string" ? { service: check.Service } : {}),
2790
- ...(typeof check.Output === "string" && check.Output ? { output: check.Output } : {}),
2791
- });
2792
- }
2793
- for (const task of Object.values(tasks)) {
2794
- if (task.health_checks?.length) {
2795
- task.health_status = aggregateHealthStatus(task.health_checks);
2796
- }
2797
- }
2798
- // Determine primary task for aggregated stats
2799
- const ptName = primaryTask ?? Object.keys(tasks)[0] ?? "";
2800
- const pt = tasks[ptName] ?? {};
2801
- const result = {
2802
- status: alloc.ClientStatus ?? "unknown",
2803
- alloc_id: allocId,
2804
- tasks,
2805
- pid: null,
2806
- uptime: null,
2807
- memory_mb: null,
2808
- cpu_percent: null,
2809
- restarts: pt.restarts ?? 0,
2810
- };
2811
- // Uptime from primary task's StartedAt
2812
- if (pt.started_at) {
2813
- try {
2814
- result.uptime = Math.floor((Date.now() - new Date(pt.started_at).getTime()) / 1000);
2815
- }
2816
- catch { /* ignore */ }
2817
- }
2818
- // Resource stats from Nomad alloc stats API
2819
- try {
2820
- const statsResp = await nomadGet(`/v1/client/allocation/${allocId}/stats`);
2821
- if (statsResp.ok) {
2822
- const stats = await statsResp.json();
2823
- // raw_exec: stats nested under Tasks.<name>; docker: top-level ResourceUsage
2824
- const taskStats = (ptName ? stats.Tasks?.[ptName]?.ResourceUsage : null) ??
2825
- stats.ResourceUsage ??
2826
- {};
2827
- const memStats = taskStats.MemoryStats ?? {};
2828
- const cpuStats = taskStats.CpuStats ?? {};
2829
- const memBytes = memStats.RSS ?? memStats.Usage ?? 0;
2830
- result.memory_mb = Math.round((memBytes / (1024 * 1024)) * 10) / 10;
2831
- result.cpu_percent = Math.round((cpuStats.Percent ?? 0) * 10) / 10;
2832
- }
2833
- }
2834
- catch { /* ignore */ }
2835
- // Fallback: cgroup v2 (Pi / CIX) → Nomad alloc-stats are zero. Use the
2836
- // shared cached `docker stats` snapshot rather than forking per-instance.
2837
- if (!result.memory_mb && allocId && ptName && /^[a-f0-9-]+$/i.test(allocId)) {
2838
- const containerName = `${ptName}-${allocId}`;
2839
- const stat = (await getDockerMemSnapshot()).get(containerName);
2840
- if (stat) {
2841
- if (stat.memory_mb)
2842
- result.memory_mb = stat.memory_mb;
2843
- if (!result.cpu_percent && stat.cpu_percent)
2844
- result.cpu_percent = stat.cpu_percent;
2845
- }
2846
- }
2847
- return result;
2848
- }
2849
- UnifiedNomadJobs.getAppStatus = getAppStatus;
2850
- // ── Driver health check + auto-restart ────────────────────────────────────
2851
- /**
2852
- * Check whether a Nomad task driver is healthy on the local node.
2853
- * Returns true if the driver is both detected and healthy.
2854
- */
2855
- async function isNomadDriverHealthy(driverName) {
2856
- try {
2857
- const nodesResp = await nomadGet("/v1/nodes");
2858
- if (!nodesResp.ok)
2859
- return true; // assume healthy if we can't check
2860
- const nodes = await nodesResp.json();
2861
- if (nodes.length === 0)
2862
- return true;
2863
- const nodeId = nodes[0]?.ID;
2864
- if (!nodeId)
2865
- return true;
2866
- const nodeResp = await nomadGet(`/v1/node/${nodeId}`);
2867
- if (!nodeResp.ok)
2868
- return true;
2869
- const node = await nodeResp.json();
2870
- const driver = node.Drivers?.[driverName];
2871
- if (!driver)
2872
- return false;
2873
- return driver.Detected === true && driver.Healthy === true;
2874
- }
2875
- catch {
2876
- return true; // don't block on transient errors
2877
- }
2878
- }
2879
- /**
2880
- * If the required Nomad driver is not healthy, restart Nomad so it picks up
2881
- * the current config (e.g. raw_exec enabled = true). Driver plugin changes
2882
- * require a full Nomad agent restart — SIGHUP / reload API are insufficient.
2883
- *
2884
- * Returns true if the driver is healthy (possibly after restart), false if it
2885
- * could not be made healthy.
2886
- */
2887
- async function ensureNomadDriverHealthy(driverName) {
2888
- if (await isNomadDriverHealthy(driverName))
2889
- return true;
2890
- console.warn(`[nomad] Driver "${driverName}" is not healthy — restarting Nomad to apply config…`);
2891
- try {
2892
- const { stopNomad, startNomad } = await import("./setup-manager.js");
2893
- const stopResult = await stopNomad();
2894
- if (!stopResult.ok) {
2895
- console.warn(`[nomad] Nomad stop failed: ${stopResult.error}`);
2896
- }
2897
- const startResult = await startNomad();
2898
- if (!startResult.ok) {
2899
- console.warn(`[nomad] Nomad start failed: ${startResult.error}`);
2900
- return false;
2901
- }
2902
- // Wait up to 15s for the driver to become healthy after restart
2903
- for (let i = 0; i < 15; i++) {
2904
- await new Promise((r) => setTimeout(r, 1_000));
2905
- if (await isNomadDriverHealthy(driverName))
2906
- return true;
2907
- }
2908
- console.warn(`[nomad] Driver "${driverName}" still unhealthy after Nomad restart`);
2909
- return false;
2910
- }
2911
- catch (e) {
2912
- console.warn(`[nomad] Failed to restart Nomad: ${e.message}`);
2913
- return false;
2914
- }
2915
- }
2916
- /**
2917
- * Submit a Nomad job for an app.
2918
- *
2919
- * @param spec Validated AppSpec.
2920
- * @param appId Unique instance ID (job name suffix).
2921
- * @param extraEnv Env vars injected into every task (e.g. resolved capability addresses).
2922
- */
2923
- async function startAppJob(spec, appId, extraEnv = {}) {
2924
- const status = await getAppStatus(appId);
2925
- if (status.status === "running") {
2926
- // Already running is a success state — no need to resubmit.
2927
- return { ok: true };
2928
- }
2929
- const adoptedExternal = await buildExternalAdoptedSpec(appId, spec);
2930
- if (adoptedExternal.conflicts.length > 0) {
2931
- return { ok: false, error: adoptedExternal.conflicts.join("; ") };
2932
- }
2933
- let effectiveSpec = applyPersistedAppSpecPortOverrides(appId, adoptedExternal.spec);
2934
- // Validate all images before submitting
2935
- for (const task of effectiveSpec.tasks) {
2936
- if (task.runtime === "container") {
2937
- if (!task.image || !UnifiedNomadJobs.DOCKER_IMAGE_RE.test(task.image) || task.image.length > UnifiedNomadJobs.MAX_DOCKER_IMAGE_NAME_LEN) {
2938
- return { ok: false, error: `Task "${task.name}": invalid docker image "${task.image ?? ""}"` };
2939
- }
2940
- }
2941
- }
2942
- // Determine predominant driver (first service task wins)
2943
- const primaryTask = effectiveSpec.tasks.find((t) => (t.role ?? "service") === "service") ?? effectiveSpec.tasks[0];
2944
- const driver = primaryTask?.runtime === "container" ? "docker" : "raw_exec";
2945
- // Ensure the required Nomad driver is healthy; restart Nomad if needed.
2946
- const driverOk = await ensureNomadDriverHealthy(driver);
2947
- if (!driverOk) {
2948
- if (driver === "raw_exec") {
2949
- const rawExecError = await validateRawExecDriverAvailability();
2950
- if (rawExecError) {
2951
- return { ok: false, error: rawExecError };
2952
- }
2953
- }
2954
- return { ok: false, error: `Nomad driver "${driver}" is not available. Check Nomad configuration and restart Nomad.` };
2955
- }
2956
- const hostNetworkError = await validateRequiredHostNetworks(effectiveSpec);
2957
- if (hostNetworkError) {
2958
- return { ok: false, error: hostNetworkError };
2959
- }
2960
- if (driver === "docker") {
2961
- const preflight = await maybeReallocateAppSpecHostPort(appId, effectiveSpec, "host_port_busy");
2962
- if (preflight.error)
2963
- return { ok: false, error: preflight.error };
2964
- effectiveSpec = preflight.spec;
2965
- }
2966
- for (let attempt = 0; attempt < 2; attempt++) {
2967
- let jobDef;
2968
- try {
2969
- jobDef = buildAppJob(effectiveSpec, appId, driver, extraEnv);
2970
- }
2971
- catch (e) {
2972
- return { ok: false, error: `Job build failed: ${e.message}` };
2973
- }
2974
- let submitError = null;
2975
- let netErr = false;
2976
- try {
2977
- const resp = await nomadPost("/v1/jobs", jobDef);
2978
- if (resp.ok) {
2979
- const data = await resp.json();
2980
- // When the app was previously failed, verify it actually transitions
2981
- // away from the failed state rather than reporting false success.
2982
- if (status.status === "failed") {
2983
- const recovered = await waitForRecovery(appId, 15_000, 2_000);
2984
- if (!recovered) {
2985
- return { ok: false, error: "App start submitted but instance remains in failed state. Check app logs for details.", eval_id: data.EvalID };
2986
- }
2987
- }
2988
- return { ok: true, eval_id: data.EvalID };
2989
- }
2990
- submitError = await resp.text();
2991
- }
2992
- catch (e) {
2993
- netErr = e?.message === "fetch failed" || e?.cause?.code === "ECONNREFUSED";
2994
- submitError = netErr ? `Nomad 服务不可达 (${getNomadAddr()}),请先启动 Nomad` : e.message;
2995
- }
2996
- if (attempt === 0 && driver === "docker" && !netErr) {
2997
- const retry = await maybeReallocateAppSpecHostPort(appId, effectiveSpec, "docker_race");
2998
- if (retry.error)
2999
- return { ok: false, error: retry.error };
3000
- if (retry.changed) {
3001
- effectiveSpec = retry.spec;
3002
- continue;
3003
- }
3004
- }
3005
- return { ok: false, error: submitError ?? "unknown error" };
3006
- }
3007
- return { ok: false, error: "start retry exhausted" };
3008
- }
3009
- UnifiedNomadJobs.startAppJob = startAppJob;
3010
- /**
3011
- * Poll until the app job reaches "running" status or times out.
3012
- * Returns true if the job is running, false if timed out.
3013
- */
3014
- async function waitForRunning(appId, timeoutMs = 120_000, pollIntervalMs = 3_000) {
3015
- const deadline = Date.now() + timeoutMs;
3016
- while (Date.now() < deadline) {
3017
- const status = await getAppStatus(appId);
3018
- if (status.status === "running")
3019
- return true;
3020
- if (status.status === "dead" || status.status === "failed")
3021
- return false;
3022
- await new Promise((r) => setTimeout(r, pollIntervalMs));
3023
- }
3024
- return false;
3025
- }
3026
- UnifiedNomadJobs.waitForRunning = waitForRunning;
3027
- /**
3028
- * Poll until the app job leaves the "failed" state or times out.
3029
- * Used after start submission to verify actual recovery before reporting success.
3030
- * Returns true if the app transitions away from "failed" (to pending/running/etc).
3031
- */
3032
- async function waitForRecovery(appId, timeoutMs = 15_000, pollIntervalMs = 2_000) {
3033
- const deadline = Date.now() + timeoutMs;
3034
- while (Date.now() < deadline) {
3035
- await new Promise((r) => setTimeout(r, pollIntervalMs));
3036
- const status = await getAppStatus(appId);
3037
- if (status.status !== "failed")
3038
- return true;
3039
- }
3040
- return false;
3041
- }
3042
- async function checkDependencies(spec) {
3043
- if (!spec.depends_on || Object.keys(spec.depends_on).length === 0) {
3044
- return { ok: true, errors: [] };
3045
- }
3046
- const errors = [];
3047
- for (const [depId, dep] of Object.entries(spec.depends_on)) {
3048
- const status = await getAppStatus(depId);
3049
- const condition = dep.condition ?? "started";
3050
- const required = dep.required !== false;
3051
- let satisfied = false;
3052
- if (condition === "started") {
3053
- satisfied = status.status !== "stopped" && status.status !== "unknown";
3054
- }
3055
- else if (condition === "healthy") {
3056
- satisfied = status.status === "running";
3057
- }
3058
- else if (condition === "completed") {
3059
- satisfied = status.status === "dead";
3060
- }
3061
- if (!satisfied) {
3062
- const msg = `Dependency "${depId}" not satisfied (need: ${condition}, got: ${status.status})`;
3063
- if (required) {
3064
- errors.push(msg);
3065
- }
3066
- else {
3067
- console.warn(` [depends_on] ${msg} (optional, continuing)`);
3068
- }
3069
- }
3070
- }
3071
- return { ok: errors.length === 0, errors };
3072
- }
3073
- UnifiedNomadJobs.checkDependencies = checkDependencies;
3074
- /**
3075
- * Stop (and optionally purge) a Nomad app job.
3076
- */
3077
- async function stopAppJob(appId, purge = false) {
3078
- const jid = jobId(appId);
3079
- const liveAllocIds = (await getAllocs(appId))
3080
- .filter((alloc) => alloc?.ID && (alloc.ClientStatus === "running" || alloc.ClientStatus === "pending"))
3081
- .map((alloc) => String(alloc.ID));
3082
- let nomadStopped = false;
3083
- let appMissing = false;
3084
- let nomadError;
3085
- try {
3086
- const resp = await nomadDelete(`/v1/job/${jid}?purge=${purge}`);
3087
- nomadStopped = resp.ok;
3088
- appMissing = resp.status === 404;
3089
- if (!resp.ok && !appMissing) {
3090
- nomadError = await resp.text();
3091
- }
3092
- }
3093
- catch (e) {
3094
- const isNetErr = e?.message === "fetch failed" || e?.cause?.code === "ECONNREFUSED";
3095
- nomadError = isNetErr
3096
- ? `Nomad 服务不可达 (${getNomadAddr()}),请先启动 Nomad`
3097
- : e.message;
3098
- }
3099
- const externalStop = await stopExternalProcessApp(appId);
3100
- if (!externalStop.ok) {
3101
- return {
3102
- ok: false,
3103
- error: nomadError ? `${nomadError}; ${externalStop.error}` : externalStop.error,
3104
- };
3105
- }
3106
- if (nomadStopped) {
3107
- const allocsStopped = await waitForAllocationsToStop(liveAllocIds);
3108
- if (!allocsStopped) {
3109
- const lingeringAlloc = await getRunningAlloc(appId);
3110
- if (!lingeringAlloc) {
3111
- return { ok: true };
3112
- }
3113
- return { ok: false, error: `App '${appId}' allocations did not stop in time` };
3114
- }
3115
- return { ok: true };
3116
- }
3117
- if (nomadError)
3118
- return { ok: false, error: nomadError };
3119
- if (appMissing) {
3120
- return externalStop.detected ? { ok: true } : { ok: false, error: "App is not running" };
3121
- }
3122
- return { ok: true };
3123
- }
3124
- UnifiedNomadJobs.stopAppJob = stopAppJob;
3125
- /**
3126
- * Restart a running app job.
3127
- * Prefers native Nomad allocation restart to preserve alloc history.
3128
- * Falls back to stop + re-submit when no AppSpec is available for re-submit.
3129
- *
3130
- * @param appId App instance ID.
3131
- * @param primaryTask Task name to restart. Defaults to the first task.
3132
- */
3133
- async function restartAppJob(appId, primaryTask) {
3134
- const alloc = await getRunningAlloc(appId);
3135
- if (alloc) {
3136
- try {
3137
- // Native Nomad allocation restart — preserves alloc history.
3138
- const resp = await nomadPut(`/v1/client/allocation/${alloc.ID}/restart`, {
3139
- TaskName: primaryTask ?? "",
3140
- AllTasks: !primaryTask,
3141
- });
3142
- if (resp.ok)
3143
- return { ok: true, alloc_id: alloc.ID };
3144
- const errText = await resp.text();
3145
- console.warn(`[nomad] Native restart failed for app ${appId} (HTTP ${resp.status}): ${errText}` +
3146
- " — falling back to stop+start");
3147
- }
3148
- catch (e) {
3149
- console.warn(`[nomad] Native restart error for app ${appId}: ${e.message}` +
3150
- " — falling back to stop+start");
3151
- }
3152
- }
3153
- // Fallback: stop then re-start. Caller must re-call startAppJob with spec.
3154
- // This path is intentionally not self-contained because we don't cache the
3155
- // AppSpec here — app-manager owns the spec and should call startAppJob.
3156
- const stopResult = await stopAppJob(appId);
3157
- if (!stopResult.ok && stopResult.error !== "App is not running") {
3158
- return stopResult;
3159
- }
3160
- return { ok: false, error: "restart_requires_resubmit" };
3161
- }
3162
- UnifiedNomadJobs.restartAppJob = restartAppJob;
3163
- /**
3164
- * Fetch recent log lines for a task in an app job.
3165
- *
3166
- * @param appId App instance ID.
3167
- * @param taskName Nomad task name (task.name from AppSpec).
3168
- * @param lines Number of lines to return (default 200).
3169
- * @param logType "stdout" | "stderr" (default "stderr").
3170
- */
3171
- async function getAppLogs(appId, taskName = "", lines = 200, logType = "stderr") {
3172
- if (!UnifiedNomadJobs.VALID_LOG_TYPES.has(logType))
3173
- logType = "stderr";
3174
- let alloc = await getRunningAlloc(appId);
3175
- // If no running alloc, try the most recent alloc (for post-mortem logs).
3176
- if (!alloc) {
3177
- const jid = jobId(appId);
3178
- try {
3179
- const resp = await nomadGet(`/v1/job/${jid}/allocations`);
3180
- if (resp.ok) {
3181
- const allocs = await resp.json();
3182
- if (allocs.length) {
3183
- alloc = allocs.sort((a, b) => (b.CreateIndex ?? 0) - (a.CreateIndex ?? 0))[0];
3184
- }
3185
- }
3186
- }
3187
- catch { /* ignore */ }
3188
- }
3189
- if (!alloc)
3190
- return [];
3191
- const resolvedTask = taskName || (Object.keys(alloc.TaskStates ?? {})[0] ?? "");
3192
- if (!resolvedTask)
3193
- return [];
3194
- // Primary: Nomad log API (works for both docker and raw_exec).
3195
- try {
3196
- const params = new URLSearchParams({
3197
- task: resolvedTask,
3198
- type: logType,
3199
- plain: "true",
3200
- origin: "end",
3201
- offset: String(Math.max(lines * 512, 100_000)),
3202
- follow: "false",
3203
- });
3204
- const resp = await nomadGet(`/v1/client/fs/logs/${alloc.ID}?${params}`);
3205
- if (resp.ok) {
3206
- const text = await resp.text();
3207
- const trimmed = text.trim();
3208
- if (trimmed)
3209
- return trimmed.split("\n").slice(-lines);
3210
- }
3211
- }
3212
- catch { /* ignore */ }
3213
- if (!/^[a-f0-9-]+$/i.test(alloc.ID))
3214
- return [];
3215
- const dockerLogLines = await readDockerStreamLogs(`${resolvedTask}-${alloc.ID}`, lines, logType);
3216
- if (dockerLogLines.length > 0)
3217
- return dockerLogLines;
3218
- return [];
3219
- }
3220
- UnifiedNomadJobs.getAppLogs = getAppLogs;
3221
- // ── Nomad WebSocket exec ─────────────────────────────────────────────────
3222
- /**
3223
- * Execute a command inside a running task via Nomad's WebSocket exec API.
3224
- * Works for both `docker` and `raw_exec` tasks — Nomad proxies the exec
3225
- * through the allocation without requiring direct Docker socket access.
3226
- *
3227
- * Protocol (https://developer.hashicorp.com/nomad/api-docs/client#stream-file):
3228
- * - Upgrade: GET /v1/client/allocation/{id}/exec → 101 Switching Protocols
3229
- * - Send stdin frames: {"stdin":{"data":"<base64>"}}
3230
- * - Close stdin: {"stdin":{"close":true}}
3231
- * - Recv stdout frames: {"stdout":{"data":"<base64>"}}
3232
- * - Recv stderr frames: {"stderr":{"data":"<base64>"}}
3233
- * - Recv exit frame: {"exited":true,"result":{"exit_code":0}}
3234
- *
3235
- * Authentication: Nomad token is passed as a query parameter because the
3236
- * native WebSocket API (Node.js ≥21) does not support custom headers.
3237
- *
3238
- * @param allocId Nomad allocation UUID.
3239
- * @param taskName Task name within the allocation.
3240
- * @param command Command + args array.
3241
- * @param stdin Optional stdin data to pipe in.
3242
- * @param timeoutMs Execution timeout in ms (default 120 s).
3243
- */
3244
- async function nomadWsExec(allocId, taskName, command, stdin, timeoutMs = 120_000) {
3245
- return nomadWsExecStream(allocId, taskName, command, stdin, {}, timeoutMs);
3246
- }
3247
- function emitStreamChunk(handler, decoder, data) {
3248
- const chunk = typeof data === "string" ? data : decoder.write(data);
3249
- if (chunk)
3250
- handler?.(chunk);
3251
- return chunk;
3252
- }
3253
- function flushStreamChunk(handler, decoder) {
3254
- const chunk = decoder.end();
3255
- if (chunk)
3256
- handler?.(chunk);
3257
- return chunk;
3258
- }
3259
- async function streamSpawnedExec(file, args, handlers, timeoutMs, options) {
3260
- return new Promise((resolve) => {
3261
- const stdoutDecoder = new StringDecoder("utf8");
3262
- const stderrDecoder = new StringDecoder("utf8");
3263
- let stdoutBuf = "";
3264
- let stderrBuf = "";
3265
- let settled = false;
3266
- const settle = (exitCode) => {
3267
- if (settled)
3268
- return;
3269
- settled = true;
3270
- stdoutBuf += flushStreamChunk(handlers.onStdout, stdoutDecoder);
3271
- stderrBuf += flushStreamChunk(handlers.onStderr, stderrDecoder);
3272
- resolve({ stdout: stdoutBuf, stderr: stderrBuf, exitCode });
3273
- };
3274
- const child = spawn(file, args, {
3275
- ...options,
3276
- stdio: ["ignore", "pipe", "pipe"],
3277
- timeout: timeoutMs,
3278
- });
3279
- child.stdout?.on("data", (data) => {
3280
- stdoutBuf += emitStreamChunk(handlers.onStdout, stdoutDecoder, data);
3281
- });
3282
- child.stderr?.on("data", (data) => {
3283
- stderrBuf += emitStreamChunk(handlers.onStderr, stderrDecoder, data);
3284
- });
3285
- child.on("error", (error) => {
3286
- const message = error.message || String(error);
3287
- stderrBuf += message;
3288
- handlers.onStderr?.(message);
3289
- settle(error.code === "ENOENT" ? 127 : 1);
3290
- });
3291
- child.on("close", (code) => {
3292
- settle(code ?? 1);
3293
- });
3294
- });
3295
- }
3296
- async function nomadWsExecStream(allocId, taskName, command, stdin, handlers, timeoutMs = 120_000) {
3297
- const nomadAddr = getNomadAddr();
3298
- // Convert http(s) → ws(s) for the WebSocket URL.
3299
- const wsBase = nomadAddr.replace(/^http/, "ws");
3300
- const params = new URLSearchParams({
3301
- task: taskName,
3302
- command: JSON.stringify(command),
3303
- tty: "false",
3304
- });
3305
- // Native WebSocket does not support custom request headers;
3306
- // Nomad also accepts the token as a query parameter.
3307
- const token = getNomadToken();
3308
- if (token)
3309
- params.set("token", token);
3310
- const url = `${wsBase}/v1/client/allocation/${allocId}/exec?${params}`;
3311
- return new Promise((resolve, reject) => {
3312
- // Node.js ≥21 ships a global WebSocket; engines field requires ≥22.
3313
- const ws = new WebSocket(url);
3314
- let stdoutBuf = "";
3315
- let stderrBuf = "";
3316
- let exitCode = 1;
3317
- let settled = false;
3318
- const settle = (result) => {
3319
- if (settled)
3320
- return;
3321
- settled = true;
3322
- clearTimeout(timer);
3323
- ws.close();
3324
- resolve(result);
3325
- };
3326
- const timer = setTimeout(() => {
3327
- if (settled)
3328
- return;
3329
- settled = true;
3330
- ws.close();
3331
- reject(new Error(`nomad exec timed out after ${timeoutMs}ms`));
3332
- }, timeoutMs);
3333
- ws.onopen = () => {
3334
- if (stdin) {
3335
- ws.send(JSON.stringify({
3336
- stdin: { data: Buffer.from(stdin, "utf-8").toString("base64") },
3337
- }));
3338
- }
3339
- // Always close stdin so the remote process sees EOF.
3340
- ws.send(JSON.stringify({ stdin: { close: true } }));
3341
- };
3342
- ws.onmessage = (event) => {
3343
- try {
3344
- const msg = JSON.parse(event.data);
3345
- if (msg.stdout?.data) {
3346
- const chunk = Buffer.from(msg.stdout.data, "base64").toString("utf-8");
3347
- stdoutBuf += chunk;
3348
- if (chunk)
3349
- handlers.onStdout?.(chunk);
3350
- }
3351
- if (msg.stderr?.data) {
3352
- const chunk = Buffer.from(msg.stderr.data, "base64").toString("utf-8");
3353
- stderrBuf += chunk;
3354
- if (chunk)
3355
- handlers.onStderr?.(chunk);
3356
- }
3357
- if (msg.exited === true) {
3358
- exitCode = msg.result?.exit_code ?? 1;
3359
- settle({ stdout: stdoutBuf, stderr: stderrBuf, exitCode });
3360
- }
3361
- }
3362
- catch { /* ignore malformed frames */ }
3363
- };
3364
- ws.onerror = (event) => {
3365
- if (settled)
3366
- return;
3367
- settled = true;
3368
- clearTimeout(timer);
3369
- // ErrorEvent has a .message; plain Event does not.
3370
- const msg = event.message ?? "WebSocket error";
3371
- reject(new Error(`[nomad-ws-exec] ${msg}`));
3372
- };
3373
- ws.onclose = () => {
3374
- // Connection dropped before we received the exited frame.
3375
- // Resolve with whatever we collected so the caller sees partial output.
3376
- settle({ stdout: stdoutBuf, stderr: stderrBuf, exitCode });
3377
- };
3378
- });
3379
- }
3380
- /**
3381
- * Execute a command inside a running app task.
3382
- *
3383
- * Strategy:
3384
- * 1. Try `docker exec` (fast path for docker-driver tasks, no Nomad dependency).
3385
- * 2. If the container is not found, fall back to the Nomad WebSocket exec API
3386
- * which works for both `docker` and `raw_exec` tasks.
3387
- *
3388
- * @param appId App instance ID.
3389
- * @param taskName Task name from AppSpec.
3390
- * @param command Command + args array.
3391
- * @param timeoutMs Execution timeout in ms (default 120 s).
3392
- */
3393
- async function execInApp(appId, taskName = "", command, timeoutMs = 120_000) {
3394
- const alloc = await getRunningAlloc(appId);
3395
- if (!alloc || alloc.ClientStatus !== "running") {
3396
- throw new Error("App is not running");
3397
- }
3398
- const allocId = alloc.ID;
3399
- if (!/^[a-f0-9-]+$/i.test(allocId))
3400
- throw new Error("invalid allocId");
3401
- const resolvedTask = taskName || (Object.keys(alloc.TaskStates ?? {})[0] ?? "");
3402
- if (!resolvedTask)
3403
- throw new Error("No task found in alloc");
3404
- const taskState = alloc.TaskStates?.[resolvedTask];
3405
- if (!taskState)
3406
- throw new Error(`Task "${resolvedTask}" not found in alloc`);
3407
- // For process (raw_exec) apps, execute directly on the host — no container
3408
- // or Nomad WebSocket overhead needed since the binary runs natively.
3409
- const { getApp } = await import("./app/app-manager.js");
3410
- const appData = getApp(appId);
3411
- const matchedTask = appData?.spec.tasks.find((t) => t.name === resolvedTask);
3412
- if (matchedTask?.runtime === "process") {
3413
- const execFileAsync = promisify(execFileCb);
3414
- try {
3415
- const { stdout, stderr } = await execFileAsync(command[0], command.slice(1), {
3416
- timeout: timeoutMs,
3417
- env: { ...process.env, ...matchedTask.env },
3418
- });
3419
- return { stdout, stderr, exitCode: 0 };
3420
- }
3421
- catch (e) {
3422
- return {
3423
- stdout: e.stdout ?? "",
3424
- stderr: e.stderr ?? e.message,
3425
- exitCode: e.code ?? 1,
3426
- };
3427
- }
3428
- }
3429
- // Fast path: docker exec (avoids WebSocket overhead for container tasks).
3430
- const execFileAsync = promisify(execFileCb);
3431
- const containerName = `${resolvedTask}-${allocId}`;
3432
- try {
3433
- const { stdout, stderr } = await execFileAsync("docker", ["exec", containerName, ...command], { timeout: timeoutMs });
3434
- return { stdout, stderr, exitCode: 0 };
3435
- }
3436
- catch (e) {
3437
- const notFound = e?.stderr?.includes("No such container") ||
3438
- e?.message?.includes("No such container") ||
3439
- e?.code === 125; // docker CLI: container not found exit code
3440
- if (!notFound) {
3441
- // docker exec was found but the command itself failed — real error.
3442
- return {
3443
- stdout: e.stdout ?? "",
3444
- stderr: e.stderr ?? e.message,
3445
- exitCode: e.code ?? 1,
3446
- };
3447
- }
3448
- // Container not found → likely raw_exec; fall through to Nomad WS exec.
3449
- console.log(`[nomad] execInApp: container "${containerName}" not found, ` +
3450
- `falling back to Nomad WebSocket exec for task "${resolvedTask}"`);
3451
- }
3452
- // Nomad WebSocket exec — works for raw_exec and docker without docker socket.
3453
- return nomadWsExec(allocId, resolvedTask, command, undefined, timeoutMs);
3454
- }
3455
- UnifiedNomadJobs.execInApp = execInApp;
3456
- async function streamExecInApp(appId, taskName = "", command, handlers = {}, timeoutMs = 120_000) {
3457
- const alloc = await getRunningAlloc(appId);
3458
- if (!alloc || alloc.ClientStatus !== "running") {
3459
- throw new Error("App is not running");
3460
- }
3461
- const allocId = alloc.ID;
3462
- if (!/^[a-f0-9-]+$/i.test(allocId))
3463
- throw new Error("invalid allocId");
3464
- const resolvedTask = taskName || (Object.keys(alloc.TaskStates ?? {})[0] ?? "");
3465
- if (!resolvedTask)
3466
- throw new Error("No task found in alloc");
3467
- const taskState = alloc.TaskStates?.[resolvedTask];
3468
- if (!taskState)
3469
- throw new Error(`Task "${resolvedTask}" not found in alloc`);
3470
- const { getApp } = await import("./app/app-manager.js");
3471
- const appData = getApp(appId);
3472
- const matchedTask = appData?.spec.tasks.find((task) => task.name === resolvedTask);
3473
- if (matchedTask?.runtime === "process") {
3474
- return streamSpawnedExec(command[0], command.slice(1), handlers, timeoutMs, { env: { ...process.env, ...matchedTask.env } });
3475
- }
3476
- const containerName = `${resolvedTask}-${allocId}`;
3477
- const dockerResult = await streamSpawnedExec("docker", ["exec", containerName, ...command], handlers, timeoutMs);
3478
- const notFound = dockerResult.stderr.includes("No such container") ||
3479
- dockerResult.exitCode === 125;
3480
- if (!notFound) {
3481
- return dockerResult;
3482
- }
3483
- console.log(`[nomad] streamExecInApp: container "${containerName}" not found, ` +
3484
- `falling back to Nomad WebSocket exec for task "${resolvedTask}"`);
3485
- return nomadWsExecStream(allocId, resolvedTask, command, undefined, handlers, timeoutMs);
3486
- }
3487
- UnifiedNomadJobs.streamExecInApp = streamExecInApp;
3488
- async function listInstanceIds() {
3489
- try {
3490
- const resp = await nomadGet("/v1/jobs");
3491
- if (!resp.ok)
3492
- return [];
3493
- const jobs = await resp.json();
3494
- return [...new Set(jobs.map((job) => readInstanceMeta(job.ID)?.id || job.ID))];
3495
- }
3496
- catch {
3497
- return [];
3498
- }
3499
- }
3500
- UnifiedNomadJobs.listInstanceIds = listInstanceIds;
3501
- function readInstanceMeta(nomadJobId) {
3502
- const directMetaPath = instanceMetaPath(nomadJobId);
3503
- try {
3504
- if (existsSync(directMetaPath))
3505
- return JSON.parse(readFileSync(directMetaPath, "utf-8"));
3506
- }
3507
- catch { }
3508
- if (nomadJobId.startsWith(OPENCLAW_PREFIX)) {
3509
- const id = nomadJobId.slice(OPENCLAW_PREFIX.length);
3510
- const metaPath = instanceMetaPath(id);
3511
- try {
3512
- if (existsSync(metaPath))
3513
- return JSON.parse(readFileSync(metaPath, "utf-8"));
3514
- }
3515
- catch { }
3516
- return null;
3517
- }
3518
- if (isAppJob(nomadJobId)) {
3519
- const appDir = resolveAppDir(nomadJobId);
3520
- if (!appDir)
3521
- return null;
3522
- const manifestPath = join(appDir, "manifest.json");
3523
- const yamlPath = join(appDir, "app-spec.yaml");
3524
- try {
3525
- const manifest = existsSync(manifestPath)
3526
- ? JSON.parse(readFileSync(manifestPath, "utf-8"))
3527
- : {};
3528
- if (existsSync(yamlPath)) {
3529
- const m = readFileSync(yamlPath, "utf-8").match(/^name:\s*(.+)$/m);
3530
- if (m)
3531
- return { ...manifest, name: m[1].trim().replace(/^['"]|['"]$/g, "") };
3532
- }
3533
- return Object.keys(manifest).length > 0 ? manifest : null;
3534
- }
3535
- catch {
3536
- return null;
3537
- }
3538
- }
3539
- return null;
3540
- }
3541
- UnifiedNomadJobs.readInstanceMeta = readInstanceMeta;
3542
- async function resolveInstanceId(id) {
3543
- const ids = await listInstanceIds();
3544
- if (ids.length === 0)
3545
- throw new Error("No instances found.");
3546
- if (id) {
3547
- if (existsSync(instanceMetaPath(id))) {
3548
- return id;
3549
- }
3550
- if (!ids.includes(id)) {
3551
- throw new Error(`Instance "${id}" not found. Available: ${ids.join(", ")}`);
3552
- }
3553
- return id;
3554
- }
3555
- if (ids.length === 1)
3556
- return ids[0];
3557
- throw new Error(`Multiple instances exist. Specify an ID. Available: ${ids.join(", ")}`);
3558
- }
3559
- UnifiedNomadJobs.resolveInstanceId = resolveInstanceId;
3560
- async function resolveInstanceForPairing(instanceId) {
3561
- const ids = await listInstanceIds();
3562
- if (ids.length === 0)
3563
- throw new Error("No instances found.");
3564
- if (instanceId) {
3565
- if (existsSync(instanceMetaPath(instanceId)))
3566
- return instanceId;
3567
- if (!ids.includes(instanceId))
3568
- throw new Error(`Instance "${instanceId}" not found.`);
3569
- return instanceId;
3570
- }
3571
- if (ids.length === 1)
3572
- return ids[0];
3573
- const runningIds = [];
3574
- for (const id of ids) {
3575
- try {
3576
- const st = await getInstanceStatus(id);
3577
- if (st.status === "running")
3578
- runningIds.push(id);
3579
- }
3580
- catch { }
3581
- }
3582
- if (runningIds.length === 1)
3583
- return runningIds[0];
3584
- if (runningIds.length === 0)
3585
- throw new Error("No running instances found. Start an instance first.");
3586
- throw new Error(`Multiple running instances: ${runningIds.join(", ")}. Use --instance <id>.`);
3587
- }
3588
- UnifiedNomadJobs.resolveInstanceForPairing = resolveInstanceForPairing;
3589
- function ensureNomadToken() {
3590
- if (process.env.NOMAD_TOKEN)
3591
- return;
3592
- const candidates = [
3593
- join(homedir(), ".jishushell", "nomad.env"),
3594
- "/etc/jishushell/nomad.env",
3595
- ];
3596
- for (const f of candidates) {
3597
- if (!existsSync(f))
3598
- continue;
3599
- try {
3600
- const match = readFileSync(f, "utf-8").match(/^NOMAD_TOKEN=(.+)$/m);
3601
- if (match) {
3602
- process.env.NOMAD_TOKEN = match[1].trim();
3603
- return;
3604
- }
3605
- }
3606
- catch { }
3607
- }
3608
- const legacy = getPanelConfig().nomad_token;
3609
- if (legacy)
3610
- process.env.NOMAD_TOKEN = legacy;
3611
- }
3612
- UnifiedNomadJobs.ensureNomadToken = ensureNomadToken;
3613
- async function getGenericJobStatus(jobId) {
3614
- const stopped = { status: "stopped", pid: null, uptime: null, memory_mb: null, cpu_percent: null };
3615
- try {
3616
- const resp = await nomadGet(`/v1/job/${jobId}`);
3617
- if (!resp.ok)
3618
- return stopped;
3619
- const job = await resp.json();
3620
- if (job.Stop)
3621
- return stopped;
3622
- const allocResp = await nomadGet(`/v1/job/${jobId}/allocations`);
3623
- if (!allocResp.ok)
3624
- return { ...stopped, status: "unknown" };
3625
- const allocs = await allocResp.json();
3626
- if (!allocs.length)
3627
- return { ...stopped, status: "pending" };
3628
- const sorted = [...allocs].sort((a, b) => (b.CreateIndex ?? 0) - (a.CreateIndex ?? 0));
3629
- const running = sorted.find(a => a.ClientStatus === "running") ?? sorted[0];
3630
- return { ...stopped, status: running.ClientStatus ?? "unknown" };
3631
- }
3632
- catch {
3633
- return { ...stopped, status: "unknown" };
3634
- }
3635
- }
3636
- async function getInstanceStatus(nomadJobId) {
3637
- if (await getInstanceBackedInstalledApp(nomadJobId)) {
3638
- const st = await getAppStatus(nomadJobId);
3639
- return {
3640
- status: st.status,
3641
- pid: st.pid,
3642
- uptime: st.uptime,
3643
- memory_mb: st.memory_mb,
3644
- cpu_percent: st.cpu_percent,
3645
- };
3646
- }
3647
- if (isAppJob(nomadJobId)) {
3648
- const st = await getAppStatus(nomadJobId);
3649
- return {
3650
- status: st.status,
3651
- pid: st.pid,
3652
- uptime: st.uptime,
3653
- memory_mb: st.memory_mb,
3654
- cpu_percent: st.cpu_percent,
3655
- };
3656
- }
3657
- if (existsSync(instanceMetaPath(nomadJobId))) {
3658
- return instanceScheduler.getStatus(nomadJobId);
3659
- }
3660
- if (nomadJobId.startsWith(OPENCLAW_PREFIX)) {
3661
- return instanceScheduler.getStatus(nomadJobId.slice(OPENCLAW_PREFIX.length));
3662
- }
3663
- return getGenericJobStatus(nomadJobId);
3664
- }
3665
- UnifiedNomadJobs.getInstanceStatus = getInstanceStatus;
3666
- /**
3667
- * Capability registration shim for **legacy** (non-app-installed)
3668
- * hermes/openclaw instances. Loads the synthetic spec via
3669
- * loadCapabilitySpecForLegacyInstance and routes provides through the
3670
- * app-manager registry helpers, so legacy instances surface in
3671
- * Connections candidate lists like app-installed ones.
3672
- *
3673
- * Errors are swallowed and logged — capability registration is best-
3674
- * effort; a failure here must not block start/stop.
3675
- */
3676
- async function registerLegacyCapabilities(instanceId) {
3677
- try {
3678
- const meta = getInstance(instanceId);
3679
- if (!meta)
3680
- return;
3681
- const { loadCapabilitySpecForLegacyInstance } = await import("./runtime/migrations.js");
3682
- const synthSpec = loadCapabilitySpecForLegacyInstance(meta);
3683
- if (!synthSpec?.provides?.length)
3684
- return;
3685
- // Same instance-name override + portOverride passthrough as
3686
- // registerLegacyCapabilitiesTopLevel — Connections candidates should
3687
- // show the user's instance name and advertise the actually-allocated
3688
- // gateway port (not the yaml default).
3689
- const instanceName = typeof meta.name === "string" && meta.name
3690
- ? meta.name
3691
- : instanceId;
3692
- const namedSpec = { ...synthSpec, name: instanceName };
3693
- const portOverride = getGatewayPort(instanceId);
3694
- const { registerCapabilities } = await import("./app/app-manager.js");
3695
- registerCapabilities(instanceId, namedSpec, portOverride > 0 ? portOverride : undefined);
3696
- }
3697
- catch (e) {
3698
- console.warn(`[legacy-capabilities] register failed for ${instanceId}: ${e?.message ?? e}`);
3699
- }
3700
- }
3701
- async function unregisterLegacyCapabilities(instanceId, purge) {
3702
- try {
3703
- const { markCapabilitiesStopped, unregisterCapabilities } = await import("./app/app-manager.js");
3704
- if (purge) {
3705
- unregisterCapabilities(instanceId);
3706
- }
3707
- else {
3708
- markCapabilitiesStopped(instanceId);
3709
- }
3710
- }
3711
- catch (e) {
3712
- console.warn(`[legacy-capabilities] unregister failed for ${instanceId}: ${e?.message ?? e}`);
3713
- }
3714
- }
3715
- async function startInstance(nomadJobId) {
3716
- const instanceBackedApp = await getInstanceBackedInstalledApp(nomadJobId);
3717
- if (instanceBackedApp) {
3718
- // PR 3 sub-step 3d: switch to resolveConnections in runtime mode so
3719
- // missing required producers / ambiguous prefix candidates throw with
3720
- // structured codes (412 / 409 / 400). Read the live instance.json so
3721
- // UI bindings persisted via PUT /connections (PR 4) drive the
3722
- // resolution; fall back to a stub `{ connections: {} }` when the
3723
- // instance file isn't readable yet.
3724
- let extraEnv = {};
3725
- try {
3726
- const { resolveConnections, resolvedToLegacyEnv } = await import("./connection-resolver.js");
3727
- const legacyInstanceManager = await import("./instance-manager.js");
3728
- const meta = legacyInstanceManager.getInstance(nomadJobId);
3729
- const instance = { connections: meta?.connections ?? {} };
3730
- // Validate in runtime mode so missing required / ambiguous still throws
3731
- // with structured error codes (412 / 409 / 400) before we touch Nomad.
3732
- const { resolved } = resolveConnections(instanceBackedApp.spec, instance, "runtime");
3733
- // Render the full RUNTIME_HOOKS env (covers llm/search/browser/mcp)
3734
- // rather than just the default-category subset, so apply: openai-env
3735
- // consumers (e.g. OpenWebUI) self-heal across provider port changes.
3736
- const { renderRuntimeConnectionsEnv } = await import("./connection-apply.js");
3737
- const runtimeEnv = await renderRuntimeConnectionsEnv(instanceBackedApp.spec, { id: nomadJobId, connections: instance.connections });
3738
- extraEnv = { ...resolvedToLegacyEnv(resolved), ...runtimeEnv };
3739
- }
3740
- catch (e) {
3741
- return {
3742
- ok: false,
3743
- error: e.message,
3744
- ...(e.code ? { code: e.code } : {}),
3745
- ...(typeof e.statusCode === "number" ? { statusCode: e.statusCode } : {}),
3746
- };
3747
- }
3748
- const depCheck = await checkDependencies(instanceBackedApp.spec);
3749
- if (!depCheck.ok) {
3750
- return { ok: false, error: depCheck.errors.join("; ") };
3751
- }
3752
- const result = await startAppJob(instanceBackedApp.spec, nomadJobId, extraEnv);
3753
- if (!result.ok)
3754
- return result;
3755
- const { registerCapabilities, runPostStartSteps } = await import("./app/app-manager.js");
3756
- if (instanceBackedApp.spec.provides?.length) {
3757
- registerCapabilities(nomadJobId, instanceBackedApp.spec);
3758
- }
3759
- if (instanceBackedApp.spec.lifecycle?.post_start?.length) {
3760
- const running = await waitForRunning(nomadJobId);
3761
- if (running) {
3762
- await runPostStartSteps(instanceBackedApp.spec);
3763
- }
3764
- }
3765
- return result;
3766
- }
3767
- if (isAppJob(nomadJobId)) {
3768
- return { ok: false, error: `App '${nomadJobId}' 必须通过 app-manager 启动` };
3769
- }
3770
- if (existsSync(instanceMetaPath(nomadJobId))) {
3771
- const result = await instanceScheduler.startInstance(nomadJobId);
3772
- if (result.ok)
3773
- await registerLegacyCapabilities(nomadJobId);
3774
- return result;
3775
- }
3776
- if (nomadJobId.startsWith(OPENCLAW_PREFIX)) {
3777
- const inner = nomadJobId.slice(OPENCLAW_PREFIX.length);
3778
- const result = await instanceScheduler.startInstance(inner);
3779
- if (result.ok)
3780
- await registerLegacyCapabilities(inner);
3781
- return result;
3782
- }
3783
- if (!isAppJob(nomadJobId)) {
3784
- return { ok: false, error: `Cannot start unmanaged job "${nomadJobId}"` };
3785
- }
3786
- return { ok: false, error: `Cannot start unmanaged job "${nomadJobId}"` };
3787
- }
3788
- UnifiedNomadJobs.startInstance = startInstance;
3789
- async function stopInstance(nomadJobId, purge = false) {
3790
- if (await getInstanceBackedInstalledApp(nomadJobId)) {
3791
- const result = await stopAppJob(nomadJobId, purge);
3792
- if (result.ok || result.error?.includes("not running") || result.error?.includes("not found")) {
3793
- const { unregisterCapabilities } = await import("./app/app-manager.js");
3794
- unregisterCapabilities(nomadJobId);
3795
- }
3796
- return result;
3797
- }
3798
- if (isAppJob(nomadJobId)) {
3799
- return { ok: false, error: `App '${nomadJobId}' 必须通过 app-manager 停止` };
3800
- }
3801
- if (existsSync(instanceMetaPath(nomadJobId))) {
3802
- const result = await instanceScheduler.stopInstance(nomadJobId, purge);
3803
- if (result.ok || result.error?.includes("not running") || result.error?.includes("not found")) {
3804
- await unregisterLegacyCapabilities(nomadJobId, purge);
3805
- }
3806
- return result;
3807
- }
3808
- if (nomadJobId.startsWith(OPENCLAW_PREFIX)) {
3809
- const inner = nomadJobId.slice(OPENCLAW_PREFIX.length);
3810
- const result = await instanceScheduler.stopInstance(inner, purge);
3811
- if (result.ok || result.error?.includes("not running") || result.error?.includes("not found")) {
3812
- await unregisterLegacyCapabilities(inner, purge);
3813
- }
3814
- return result;
3815
- }
3816
- try {
3817
- const resp = await nomadDelete(`/v1/job/${nomadJobId}?purge=${purge}`);
3818
- return resp.ok ? { ok: true } : { ok: false, error: `HTTP ${resp.status}` };
3819
- }
3820
- catch (e) {
3821
- return { ok: false, error: e.message };
3822
- }
3823
- }
3824
- UnifiedNomadJobs.stopInstance = stopInstance;
3825
- async function restartInstance(nomadJobId) {
3826
- if (await getInstanceBackedInstalledApp(nomadJobId)) {
3827
- const stopResult = await stopInstance(nomadJobId);
3828
- if (!stopResult.ok && !stopResult.error?.includes("not running") && !stopResult.error?.includes("not found")) {
3829
- return stopResult;
3830
- }
3831
- return startInstance(nomadJobId);
3832
- }
3833
- if (isAppJob(nomadJobId)) {
3834
- return { ok: false, error: `App '${nomadJobId}' 必须通过 app-manager 重启` };
3835
- }
3836
- if (existsSync(instanceMetaPath(nomadJobId))) {
3837
- const result = await instanceScheduler.restartInstance(nomadJobId);
3838
- if (result.ok)
3839
- await registerLegacyCapabilities(nomadJobId);
3840
- return result;
3841
- }
3842
- if (nomadJobId.startsWith(OPENCLAW_PREFIX)) {
3843
- const inner = nomadJobId.slice(OPENCLAW_PREFIX.length);
3844
- const result = await instanceScheduler.restartInstance(inner);
3845
- if (result.ok)
3846
- await registerLegacyCapabilities(inner);
3847
- return result;
3848
- }
3849
- if (!isAppJob(nomadJobId)) {
3850
- return { ok: false, error: `Cannot restart unmanaged job "${nomadJobId}"` };
3851
- }
3852
- return { ok: false, error: `Cannot restart unmanaged job "${nomadJobId}"` };
3853
- }
3854
- UnifiedNomadJobs.restartInstance = restartInstance;
3855
- async function getInstanceLogs(nomadJobId, lines = 200, logType = "stderr") {
3856
- if (await getInstanceBackedInstalledApp(nomadJobId)) {
3857
- return getAppLogs(nomadJobId, "", lines, logType);
3858
- }
3859
- if (isAppJob(nomadJobId))
3860
- return getAppLogs(nomadJobId, "", lines, logType);
3861
- if (existsSync(instanceMetaPath(nomadJobId))) {
3862
- return instanceScheduler.getLogs(nomadJobId, lines, logType);
3863
- }
3864
- if (nomadJobId.startsWith(OPENCLAW_PREFIX)) {
3865
- return instanceScheduler.getLogs(nomadJobId.slice(OPENCLAW_PREFIX.length), lines, logType);
3866
- }
3867
- if (!isAppJob(nomadJobId))
3868
- return [];
3869
- return [];
3870
- }
3871
- UnifiedNomadJobs.getInstanceLogs = getInstanceLogs;
3872
- async function execInInstance(nomadJobId, command, timeoutMs) {
3873
- if (await getInstanceBackedInstalledApp(nomadJobId)) {
3874
- return execInApp(nomadJobId, "", command, timeoutMs ?? 120_000);
3875
- }
3876
- if (isAppJob(nomadJobId)) {
3877
- return execInApp(nomadJobId, "", command, timeoutMs ?? 120_000);
3878
- }
3879
- if (existsSync(instanceMetaPath(nomadJobId))) {
3880
- return instanceScheduler.exec(nomadJobId, command, timeoutMs);
3881
- }
3882
- if (nomadJobId.startsWith(OPENCLAW_PREFIX)) {
3883
- return instanceScheduler.exec(nomadJobId.slice(OPENCLAW_PREFIX.length), command, timeoutMs);
3884
- }
3885
- if (!isAppJob(nomadJobId)) {
3886
- return { stdout: "", stderr: `Cannot exec into unmanaged job "${nomadJobId}"`, exitCode: 1 };
3887
- }
3888
- return { stdout: "", stderr: `Cannot exec into unmanaged job "${nomadJobId}"`, exitCode: 1 };
3889
- }
3890
- UnifiedNomadJobs.execInInstance = execInInstance;
3891
- async function streamExecInInstance(nomadJobId, command, handlers = {}, timeoutMs, taskName = "") {
3892
- if (await getInstanceBackedInstalledApp(nomadJobId)) {
3893
- return streamExecInApp(nomadJobId, taskName, command, handlers, timeoutMs ?? 120_000);
3894
- }
3895
- if (isAppJob(nomadJobId)) {
3896
- return streamExecInApp(nomadJobId, taskName, command, handlers, timeoutMs ?? 120_000);
3897
- }
3898
- if (existsSync(instanceMetaPath(nomadJobId))) {
3899
- const result = await instanceScheduler.exec(nomadJobId, command, timeoutMs);
3900
- if (result.stdout)
3901
- handlers.onStdout?.(result.stdout);
3902
- if (result.stderr)
3903
- handlers.onStderr?.(result.stderr);
3904
- return result;
3905
- }
3906
- if (nomadJobId.startsWith(OPENCLAW_PREFIX)) {
3907
- const result = await instanceScheduler.exec(nomadJobId.slice(OPENCLAW_PREFIX.length), command, timeoutMs);
3908
- if (result.stdout)
3909
- handlers.onStdout?.(result.stdout);
3910
- if (result.stderr)
3911
- handlers.onStderr?.(result.stderr);
3912
- return result;
3913
- }
3914
- if (!isAppJob(nomadJobId)) {
3915
- const stderr = `Cannot exec into unmanaged job "${nomadJobId}"`;
3916
- handlers.onStderr?.(stderr);
3917
- return { stdout: "", stderr, exitCode: 1 };
3918
- }
3919
- const stderr = `Cannot exec into unmanaged job "${nomadJobId}"`;
3920
- handlers.onStderr?.(stderr);
3921
- return { stdout: "", stderr, exitCode: 1 };
3922
- }
3923
- UnifiedNomadJobs.streamExecInInstance = streamExecInInstance;
3924
- })(UnifiedNomadJobs || (UnifiedNomadJobs = {}));
3925
- export const isAppJob = UnifiedNomadJobs.isAppJob;
3926
- export const parseCpuMHz = UnifiedNomadJobs.parseCpuMHz;
3927
- export const parseMemoryMB = UnifiedNomadJobs.parseMemoryMB;
3928
- export const isBinaryRunning = UnifiedNomadJobs.isBinaryRunning;
3929
- export const getAppStatus = UnifiedNomadJobs.getAppStatus;
3930
- export const startAppJob = UnifiedNomadJobs.startAppJob;
3931
- export const waitForRunning = UnifiedNomadJobs.waitForRunning;
3932
- export const checkDependencies = UnifiedNomadJobs.checkDependencies;
3933
- export const stopAppJob = UnifiedNomadJobs.stopAppJob;
3934
- export const restartAppJob = UnifiedNomadJobs.restartAppJob;
3935
- export const getAppLogs = UnifiedNomadJobs.getAppLogs;
3936
- export const execInApp = UnifiedNomadJobs.execInApp;
3937
- export const streamExecInApp = UnifiedNomadJobs.streamExecInApp;
3938
- export const listInstanceIds = UnifiedNomadJobs.listInstanceIds;
3939
- export const readInstanceMeta = UnifiedNomadJobs.readInstanceMeta;
3940
- export const resolveInstanceId = UnifiedNomadJobs.resolveInstanceId;
3941
- export const resolveInstanceForPairing = UnifiedNomadJobs.resolveInstanceForPairing;
3942
- export const ensureNomadToken = UnifiedNomadJobs.ensureNomadToken;
3943
- export const getInstanceStatus = UnifiedNomadJobs.getInstanceStatus;
3944
- export const getInstanceLogs = UnifiedNomadJobs.getInstanceLogs;
3945
- export const execInInstance = UnifiedNomadJobs.execInInstance;
3946
- export const streamExecInInstance = UnifiedNomadJobs.streamExecInInstance;
3947
- export const shouldAutoStartNomadJob = UnifiedNomadJobs.shouldAutoStart;
3948
- export const startNomadJobInstance = UnifiedNomadJobs.startInstance;
3949
- export const stopNomadJobInstance = UnifiedNomadJobs.stopInstance;
3950
- export const restartNomadJobInstance = UnifiedNomadJobs.restartInstance;
3951
- // @internal — exposed for Phase 10.4 unit testing only.
3952
- export const __aggregateHealthStatusForTests = UnifiedNomadJobs.aggregateHealthStatus;
3953
- //# sourceMappingURL=nomad-manager.js.map