@creezio/electron-shell 0.22.0 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (417) hide show
  1. package/README.md +1 -1
  2. package/dist/.creezio-src-hash.json +2 -2
  3. package/dist/index.d.ts +2 -2
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +2 -2
  6. package/dist/index.js.map +1 -1
  7. package/dist/meili.d.ts +1 -1
  8. package/dist/meili.d.ts.map +1 -1
  9. package/dist/meili.js +1 -1
  10. package/dist/meili.js.map +1 -1
  11. package/dist-cjs/index.js +6 -8
  12. package/dist-cjs/index.js.map +1 -1
  13. package/dist-cjs/meili.js +1 -2
  14. package/dist-cjs/meili.js.map +1 -1
  15. package/package.json +9 -9
  16. package/dist/desktop/legacy-brand-compat.d.ts +0 -45
  17. package/dist/desktop/legacy-brand-compat.d.ts.map +0 -1
  18. package/dist/desktop/legacy-brand-compat.js +0 -49
  19. package/dist/desktop/legacy-brand-compat.js.map +0 -1
  20. package/dist/factory-reset-runtime.d.ts +0 -11
  21. package/dist/factory-reset-runtime.d.ts.map +0 -1
  22. package/dist/factory-reset-runtime.js +0 -77
  23. package/dist/factory-reset-runtime.js.map +0 -1
  24. package/dist/host/ai-workspace/actions.d.ts +0 -12
  25. package/dist/host/ai-workspace/actions.d.ts.map +0 -1
  26. package/dist/host/ai-workspace/actions.js +0 -243
  27. package/dist/host/ai-workspace/actions.js.map +0 -1
  28. package/dist/host/ai-workspace/bindings.d.ts +0 -51
  29. package/dist/host/ai-workspace/bindings.d.ts.map +0 -1
  30. package/dist/host/ai-workspace/bindings.js +0 -40
  31. package/dist/host/ai-workspace/bindings.js.map +0 -1
  32. package/dist/host/ai-workspace/index.d.ts +0 -11
  33. package/dist/host/ai-workspace/index.d.ts.map +0 -1
  34. package/dist/host/ai-workspace/index.js +0 -6
  35. package/dist/host/ai-workspace/index.js.map +0 -1
  36. package/dist/host/ai-workspace/manager.d.ts +0 -128
  37. package/dist/host/ai-workspace/manager.d.ts.map +0 -1
  38. package/dist/host/ai-workspace/manager.js +0 -519
  39. package/dist/host/ai-workspace/manager.js.map +0 -1
  40. package/dist/host/ai-workspace/profile-window.d.ts +0 -37
  41. package/dist/host/ai-workspace/profile-window.d.ts.map +0 -1
  42. package/dist/host/ai-workspace/profile-window.js +0 -121
  43. package/dist/host/ai-workspace/profile-window.js.map +0 -1
  44. package/dist/host/ai-workspace/screencast.d.ts +0 -56
  45. package/dist/host/ai-workspace/screencast.d.ts.map +0 -1
  46. package/dist/host/ai-workspace/screencast.js +0 -245
  47. package/dist/host/ai-workspace/screencast.js.map +0 -1
  48. package/dist/host/ai-workspace/types.d.ts +0 -40
  49. package/dist/host/ai-workspace/types.d.ts.map +0 -1
  50. package/dist/host/ai-workspace/types.js +0 -6
  51. package/dist/host/ai-workspace/types.js.map +0 -1
  52. package/dist/host/brand-host-runtime.d.ts +0 -107
  53. package/dist/host/brand-host-runtime.d.ts.map +0 -1
  54. package/dist/host/brand-host-runtime.js +0 -274
  55. package/dist/host/brand-host-runtime.js.map +0 -1
  56. package/dist/host/brand-host-stack.d.ts +0 -117
  57. package/dist/host/brand-host-stack.d.ts.map +0 -1
  58. package/dist/host/brand-host-stack.js +0 -253
  59. package/dist/host/brand-host-stack.js.map +0 -1
  60. package/dist/host/brand-kernel-http.d.ts +0 -34
  61. package/dist/host/brand-kernel-http.d.ts.map +0 -1
  62. package/dist/host/brand-kernel-http.js +0 -95
  63. package/dist/host/brand-kernel-http.js.map +0 -1
  64. package/dist/host/brand-meili-boot.d.ts +0 -67
  65. package/dist/host/brand-meili-boot.d.ts.map +0 -1
  66. package/dist/host/brand-meili-boot.js +0 -100
  67. package/dist/host/brand-meili-boot.js.map +0 -1
  68. package/dist/host/bridge-client.d.ts +0 -54
  69. package/dist/host/bridge-client.d.ts.map +0 -1
  70. package/dist/host/bridge-client.js +0 -187
  71. package/dist/host/bridge-client.js.map +0 -1
  72. package/dist/host/context.d.ts +0 -70
  73. package/dist/host/context.d.ts.map +0 -1
  74. package/dist/host/context.js +0 -16
  75. package/dist/host/context.js.map +0 -1
  76. package/dist/host/contracts.d.ts +0 -39
  77. package/dist/host/contracts.d.ts.map +0 -1
  78. package/dist/host/contracts.js +0 -26
  79. package/dist/host/contracts.js.map +0 -1
  80. package/dist/host/crash-reporter.d.ts +0 -65
  81. package/dist/host/crash-reporter.d.ts.map +0 -1
  82. package/dist/host/crash-reporter.js +0 -371
  83. package/dist/host/crash-reporter.js.map +0 -1
  84. package/dist/host/ensure-kit-binaries.d.ts +0 -17
  85. package/dist/host/ensure-kit-binaries.d.ts.map +0 -1
  86. package/dist/host/ensure-kit-binaries.js +0 -205
  87. package/dist/host/ensure-kit-binaries.js.map +0 -1
  88. package/dist/host/feature-off-host.d.ts +0 -130
  89. package/dist/host/feature-off-host.d.ts.map +0 -1
  90. package/dist/host/feature-off-host.js +0 -138
  91. package/dist/host/feature-off-host.js.map +0 -1
  92. package/dist/host/hermes/crm-key.d.ts +0 -49
  93. package/dist/host/hermes/crm-key.d.ts.map +0 -1
  94. package/dist/host/hermes/crm-key.js +0 -126
  95. package/dist/host/hermes/crm-key.js.map +0 -1
  96. package/dist/host/hermes/ensure-crm-key-db.d.ts +0 -7
  97. package/dist/host/hermes/ensure-crm-key-db.d.ts.map +0 -1
  98. package/dist/host/hermes/ensure-crm-key-db.js +0 -84
  99. package/dist/host/hermes/ensure-crm-key-db.js.map +0 -1
  100. package/dist/host/hermes/launcher.d.ts +0 -98
  101. package/dist/host/hermes/launcher.d.ts.map +0 -1
  102. package/dist/host/hermes/launcher.js +0 -972
  103. package/dist/host/hermes/launcher.js.map +0 -1
  104. package/dist/host/hermes/runtime-bootstrap.d.ts +0 -172
  105. package/dist/host/hermes/runtime-bootstrap.d.ts.map +0 -1
  106. package/dist/host/hermes/runtime-bootstrap.js +0 -789
  107. package/dist/host/hermes/runtime-bootstrap.js.map +0 -1
  108. package/dist/host/hermes/skills-seed.d.ts +0 -40
  109. package/dist/host/hermes/skills-seed.d.ts.map +0 -1
  110. package/dist/host/hermes/skills-seed.js +0 -100
  111. package/dist/host/hermes/skills-seed.js.map +0 -1
  112. package/dist/host/host-stack.d.ts +0 -35
  113. package/dist/host/host-stack.d.ts.map +0 -1
  114. package/dist/host/host-stack.js +0 -38
  115. package/dist/host/host-stack.js.map +0 -1
  116. package/dist/host/kit-os-resources.d.ts +0 -6
  117. package/dist/host/kit-os-resources.d.ts.map +0 -1
  118. package/dist/host/kit-os-resources.js +0 -88
  119. package/dist/host/kit-os-resources.js.map +0 -1
  120. package/dist/host/load-electron.d.ts +0 -2
  121. package/dist/host/load-electron.d.ts.map +0 -1
  122. package/dist/host/load-electron.js +0 -44
  123. package/dist/host/load-electron.js.map +0 -1
  124. package/dist/host/local-config.d.ts +0 -120
  125. package/dist/host/local-config.d.ts.map +0 -1
  126. package/dist/host/local-config.js +0 -633
  127. package/dist/host/local-config.js.map +0 -1
  128. package/dist/host/meili/browse.d.ts +0 -58
  129. package/dist/host/meili/browse.d.ts.map +0 -1
  130. package/dist/host/meili/browse.js +0 -98
  131. package/dist/host/meili/browse.js.map +0 -1
  132. package/dist/host/meili/coherence-db.d.ts +0 -35
  133. package/dist/host/meili/coherence-db.d.ts.map +0 -1
  134. package/dist/host/meili/coherence-db.js +0 -129
  135. package/dist/host/meili/coherence-db.js.map +0 -1
  136. package/dist/host/meili/coherence-query.d.ts +0 -10
  137. package/dist/host/meili/coherence-query.d.ts.map +0 -1
  138. package/dist/host/meili/coherence-query.js +0 -23
  139. package/dist/host/meili/coherence-query.js.map +0 -1
  140. package/dist/host/meili/coherence.d.ts +0 -53
  141. package/dist/host/meili/coherence.d.ts.map +0 -1
  142. package/dist/host/meili/coherence.js +0 -148
  143. package/dist/host/meili/coherence.js.map +0 -1
  144. package/dist/host/meili/feed.d.ts +0 -82
  145. package/dist/host/meili/feed.d.ts.map +0 -1
  146. package/dist/host/meili/feed.js +0 -100
  147. package/dist/host/meili/feed.js.map +0 -1
  148. package/dist/host/meili/generic-indexer.d.ts +0 -34
  149. package/dist/host/meili/generic-indexer.d.ts.map +0 -1
  150. package/dist/host/meili/generic-indexer.js +0 -333
  151. package/dist/host/meili/generic-indexer.js.map +0 -1
  152. package/dist/host/meili/index-schema.d.ts +0 -64
  153. package/dist/host/meili/index-schema.d.ts.map +0 -1
  154. package/dist/host/meili/index-schema.js +0 -70
  155. package/dist/host/meili/index-schema.js.map +0 -1
  156. package/dist/host/meili/index.d.ts +0 -13
  157. package/dist/host/meili/index.d.ts.map +0 -1
  158. package/dist/host/meili/index.js +0 -8
  159. package/dist/host/meili/index.js.map +0 -1
  160. package/dist/host/meili/indexer.d.ts +0 -31
  161. package/dist/host/meili/indexer.d.ts.map +0 -1
  162. package/dist/host/meili/indexer.js +0 -49
  163. package/dist/host/meili/indexer.js.map +0 -1
  164. package/dist/host/meili-launcher.d.ts +0 -30
  165. package/dist/host/meili-launcher.d.ts.map +0 -1
  166. package/dist/host/meili-launcher.js +0 -115
  167. package/dist/host/meili-launcher.js.map +0 -1
  168. package/dist/host/n8n/agent-isolation.d.ts +0 -55
  169. package/dist/host/n8n/agent-isolation.d.ts.map +0 -1
  170. package/dist/host/n8n/agent-isolation.js +0 -158
  171. package/dist/host/n8n/agent-isolation.js.map +0 -1
  172. package/dist/host/n8n/api-key.d.ts +0 -67
  173. package/dist/host/n8n/api-key.d.ts.map +0 -1
  174. package/dist/host/n8n/api-key.js +0 -297
  175. package/dist/host/n8n/api-key.js.map +0 -1
  176. package/dist/host/n8n/launcher.d.ts +0 -126
  177. package/dist/host/n8n/launcher.d.ts.map +0 -1
  178. package/dist/host/n8n/launcher.js +0 -1170
  179. package/dist/host/n8n/launcher.js.map +0 -1
  180. package/dist/host/n8n/runtime-bootstrap.d.ts +0 -44
  181. package/dist/host/n8n/runtime-bootstrap.d.ts.map +0 -1
  182. package/dist/host/n8n/runtime-bootstrap.js +0 -230
  183. package/dist/host/n8n/runtime-bootstrap.js.map +0 -1
  184. package/dist/host/node-runtime.d.ts +0 -52
  185. package/dist/host/node-runtime.d.ts.map +0 -1
  186. package/dist/host/node-runtime.js +0 -257
  187. package/dist/host/node-runtime.js.map +0 -1
  188. package/dist/host/npm-cli.d.ts +0 -43
  189. package/dist/host/npm-cli.d.ts.map +0 -1
  190. package/dist/host/npm-cli.js +0 -213
  191. package/dist/host/npm-cli.js.map +0 -1
  192. package/dist/host/plugins/accept-check.d.ts +0 -19
  193. package/dist/host/plugins/accept-check.d.ts.map +0 -1
  194. package/dist/host/plugins/accept-check.js +0 -172
  195. package/dist/host/plugins/accept-check.js.map +0 -1
  196. package/dist/host/plugins/brand-bindings.d.ts +0 -103
  197. package/dist/host/plugins/brand-bindings.d.ts.map +0 -1
  198. package/dist/host/plugins/brand-bindings.js +0 -65
  199. package/dist/host/plugins/brand-bindings.js.map +0 -1
  200. package/dist/host/plugins/control-adapters.d.ts +0 -11
  201. package/dist/host/plugins/control-adapters.d.ts.map +0 -1
  202. package/dist/host/plugins/control-adapters.js +0 -83
  203. package/dist/host/plugins/control-adapters.js.map +0 -1
  204. package/dist/host/plugins/control-extras.d.ts +0 -61
  205. package/dist/host/plugins/control-extras.d.ts.map +0 -1
  206. package/dist/host/plugins/control-extras.js +0 -382
  207. package/dist/host/plugins/control-extras.js.map +0 -1
  208. package/dist/host/plugins/control-plane.d.ts +0 -42
  209. package/dist/host/plugins/control-plane.d.ts.map +0 -1
  210. package/dist/host/plugins/control-plane.js +0 -124
  211. package/dist/host/plugins/control-plane.js.map +0 -1
  212. package/dist/host/plugins/control-token.d.ts +0 -24
  213. package/dist/host/plugins/control-token.d.ts.map +0 -1
  214. package/dist/host/plugins/control-token.js +0 -77
  215. package/dist/host/plugins/control-token.js.map +0 -1
  216. package/dist/host/plugins/crm-key.d.ts +0 -25
  217. package/dist/host/plugins/crm-key.d.ts.map +0 -1
  218. package/dist/host/plugins/crm-key.js +0 -126
  219. package/dist/host/plugins/crm-key.js.map +0 -1
  220. package/dist/host/plugins/data.d.ts +0 -21
  221. package/dist/host/plugins/data.d.ts.map +0 -1
  222. package/dist/host/plugins/data.js +0 -100
  223. package/dist/host/plugins/data.js.map +0 -1
  224. package/dist/host/plugins/events.d.ts +0 -6
  225. package/dist/host/plugins/events.d.ts.map +0 -1
  226. package/dist/host/plugins/events.js +0 -6
  227. package/dist/host/plugins/events.js.map +0 -1
  228. package/dist/host/plugins/execution-grant.d.ts +0 -6
  229. package/dist/host/plugins/execution-grant.d.ts.map +0 -1
  230. package/dist/host/plugins/execution-grant.js +0 -6
  231. package/dist/host/plugins/execution-grant.js.map +0 -1
  232. package/dist/host/plugins/git.d.ts +0 -56
  233. package/dist/host/plugins/git.d.ts.map +0 -1
  234. package/dist/host/plugins/git.js +0 -357
  235. package/dist/host/plugins/git.js.map +0 -1
  236. package/dist/host/plugins/host.d.ts +0 -68
  237. package/dist/host/plugins/host.d.ts.map +0 -1
  238. package/dist/host/plugins/host.js +0 -276
  239. package/dist/host/plugins/host.js.map +0 -1
  240. package/dist/host/plugins/launcher.d.ts +0 -146
  241. package/dist/host/plugins/launcher.d.ts.map +0 -1
  242. package/dist/host/plugins/launcher.js +0 -489
  243. package/dist/host/plugins/launcher.js.map +0 -1
  244. package/dist/host/plugins/runtime.d.ts +0 -28
  245. package/dist/host/plugins/runtime.d.ts.map +0 -1
  246. package/dist/host/plugins/runtime.js +0 -430
  247. package/dist/host/plugins/runtime.js.map +0 -1
  248. package/dist/host/plugins/test-runner.d.ts +0 -15
  249. package/dist/host/plugins/test-runner.d.ts.map +0 -1
  250. package/dist/host/plugins/test-runner.js +0 -106
  251. package/dist/host/plugins/test-runner.js.map +0 -1
  252. package/dist/host/safe-storage.d.ts +0 -21
  253. package/dist/host/safe-storage.d.ts.map +0 -1
  254. package/dist/host/safe-storage.js +0 -55
  255. package/dist/host/safe-storage.js.map +0 -1
  256. package/dist/host/sandbox/embed-sandbox.d.ts +0 -133
  257. package/dist/host/sandbox/embed-sandbox.d.ts.map +0 -1
  258. package/dist/host/sandbox/embed-sandbox.js +0 -378
  259. package/dist/host/sandbox/embed-sandbox.js.map +0 -1
  260. package/dist/host/sandbox/os-sandbox.d.ts +0 -41
  261. package/dist/host/sandbox/os-sandbox.d.ts.map +0 -1
  262. package/dist/host/sandbox/os-sandbox.js +0 -98
  263. package/dist/host/sandbox/os-sandbox.js.map +0 -1
  264. package/dist/host/server-env.d.ts +0 -50
  265. package/dist/host/server-env.d.ts.map +0 -1
  266. package/dist/host/server-env.js +0 -64
  267. package/dist/host/server-env.js.map +0 -1
  268. package/dist/host/server-launcher.d.ts +0 -49
  269. package/dist/host/server-launcher.d.ts.map +0 -1
  270. package/dist/host/server-launcher.js +0 -43
  271. package/dist/host/server-launcher.js.map +0 -1
  272. package/dist/host/tunnel/cloudflared-respawn.d.ts +0 -58
  273. package/dist/host/tunnel/cloudflared-respawn.d.ts.map +0 -1
  274. package/dist/host/tunnel/cloudflared-respawn.js +0 -73
  275. package/dist/host/tunnel/cloudflared-respawn.js.map +0 -1
  276. package/dist/host/tunnel/tunnel.d.ts +0 -72
  277. package/dist/host/tunnel/tunnel.d.ts.map +0 -1
  278. package/dist/host/tunnel/tunnel.js +0 -462
  279. package/dist/host/tunnel/tunnel.js.map +0 -1
  280. package/dist/logger.d.ts +0 -44
  281. package/dist/logger.d.ts.map +0 -1
  282. package/dist/logger.js +0 -252
  283. package/dist/logger.js.map +0 -1
  284. package/dist-cjs/desktop/legacy-brand-compat.js +0 -56
  285. package/dist-cjs/desktop/legacy-brand-compat.js.map +0 -1
  286. package/dist-cjs/factory-reset-runtime.js +0 -117
  287. package/dist-cjs/factory-reset-runtime.js.map +0 -1
  288. package/dist-cjs/host/ai-workspace/actions.js +0 -247
  289. package/dist-cjs/host/ai-workspace/actions.js.map +0 -1
  290. package/dist-cjs/host/ai-workspace/bindings.js +0 -49
  291. package/dist-cjs/host/ai-workspace/bindings.js.map +0 -1
  292. package/dist-cjs/host/ai-workspace/index.js +0 -21
  293. package/dist-cjs/host/ai-workspace/index.js.map +0 -1
  294. package/dist-cjs/host/ai-workspace/manager.js +0 -528
  295. package/dist-cjs/host/ai-workspace/manager.js.map +0 -1
  296. package/dist-cjs/host/ai-workspace/profile-window.js +0 -125
  297. package/dist-cjs/host/ai-workspace/profile-window.js.map +0 -1
  298. package/dist-cjs/host/ai-workspace/screencast.js +0 -249
  299. package/dist-cjs/host/ai-workspace/screencast.js.map +0 -1
  300. package/dist-cjs/host/ai-workspace/types.js +0 -7
  301. package/dist-cjs/host/ai-workspace/types.js.map +0 -1
  302. package/dist-cjs/host/brand-host-runtime.js +0 -286
  303. package/dist-cjs/host/brand-host-runtime.js.map +0 -1
  304. package/dist-cjs/host/brand-host-stack.js +0 -259
  305. package/dist-cjs/host/brand-host-stack.js.map +0 -1
  306. package/dist-cjs/host/brand-kernel-http.js +0 -101
  307. package/dist-cjs/host/brand-kernel-http.js.map +0 -1
  308. package/dist-cjs/host/brand-meili-boot.js +0 -106
  309. package/dist-cjs/host/brand-meili-boot.js.map +0 -1
  310. package/dist-cjs/host/bridge-client.js +0 -191
  311. package/dist-cjs/host/bridge-client.js.map +0 -1
  312. package/dist-cjs/host/context.js +0 -20
  313. package/dist-cjs/host/context.js.map +0 -1
  314. package/dist-cjs/host/contracts.js +0 -32
  315. package/dist-cjs/host/contracts.js.map +0 -1
  316. package/dist-cjs/host/crash-reporter.js +0 -422
  317. package/dist-cjs/host/crash-reporter.js.map +0 -1
  318. package/dist-cjs/host/ensure-kit-binaries.js +0 -212
  319. package/dist-cjs/host/ensure-kit-binaries.js.map +0 -1
  320. package/dist-cjs/host/feature-off-host.js +0 -144
  321. package/dist-cjs/host/feature-off-host.js.map +0 -1
  322. package/dist-cjs/host/hermes/crm-key.js +0 -137
  323. package/dist-cjs/host/hermes/crm-key.js.map +0 -1
  324. package/dist-cjs/host/hermes/ensure-crm-key-db.js +0 -89
  325. package/dist-cjs/host/hermes/ensure-crm-key-db.js.map +0 -1
  326. package/dist-cjs/host/hermes/launcher.js +0 -981
  327. package/dist-cjs/host/hermes/launcher.js.map +0 -1
  328. package/dist-cjs/host/hermes/runtime-bootstrap.js +0 -853
  329. package/dist-cjs/host/hermes/runtime-bootstrap.js.map +0 -1
  330. package/dist-cjs/host/hermes/skills-seed.js +0 -110
  331. package/dist-cjs/host/hermes/skills-seed.js.map +0 -1
  332. package/dist-cjs/host/host-stack.js +0 -42
  333. package/dist-cjs/host/host-stack.js.map +0 -1
  334. package/dist-cjs/host/kit-os-resources.js +0 -96
  335. package/dist-cjs/host/kit-os-resources.js.map +0 -1
  336. package/dist-cjs/host/load-electron.js +0 -47
  337. package/dist-cjs/host/load-electron.js.map +0 -1
  338. package/dist-cjs/host/local-config.js +0 -640
  339. package/dist-cjs/host/local-config.js.map +0 -1
  340. package/dist-cjs/host/meili/browse.js +0 -103
  341. package/dist-cjs/host/meili/browse.js.map +0 -1
  342. package/dist-cjs/host/meili/coherence-db.js +0 -139
  343. package/dist-cjs/host/meili/coherence-db.js.map +0 -1
  344. package/dist-cjs/host/meili/coherence-query.js +0 -25
  345. package/dist-cjs/host/meili/coherence-query.js.map +0 -1
  346. package/dist-cjs/host/meili/coherence.js +0 -158
  347. package/dist-cjs/host/meili/coherence.js.map +0 -1
  348. package/dist-cjs/host/meili/feed.js +0 -108
  349. package/dist-cjs/host/meili/feed.js.map +0 -1
  350. package/dist-cjs/host/meili/generic-indexer.js +0 -340
  351. package/dist-cjs/host/meili/generic-indexer.js.map +0 -1
  352. package/dist-cjs/host/meili/index-schema.js +0 -79
  353. package/dist-cjs/host/meili/index-schema.js.map +0 -1
  354. package/dist-cjs/host/meili/index.js +0 -45
  355. package/dist-cjs/host/meili/index.js.map +0 -1
  356. package/dist-cjs/host/meili/indexer.js +0 -85
  357. package/dist-cjs/host/meili/indexer.js.map +0 -1
  358. package/dist-cjs/host/meili-launcher.js +0 -121
  359. package/dist-cjs/host/meili-launcher.js.map +0 -1
  360. package/dist-cjs/host/n8n/agent-isolation.js +0 -173
  361. package/dist-cjs/host/n8n/agent-isolation.js.map +0 -1
  362. package/dist-cjs/host/n8n/api-key.js +0 -314
  363. package/dist-cjs/host/n8n/api-key.js.map +0 -1
  364. package/dist-cjs/host/n8n/launcher.js +0 -1209
  365. package/dist-cjs/host/n8n/launcher.js.map +0 -1
  366. package/dist-cjs/host/n8n/runtime-bootstrap.js +0 -244
  367. package/dist-cjs/host/n8n/runtime-bootstrap.js.map +0 -1
  368. package/dist-cjs/host/node-runtime.js +0 -274
  369. package/dist-cjs/host/node-runtime.js.map +0 -1
  370. package/dist-cjs/host/npm-cli.js +0 -224
  371. package/dist-cjs/host/npm-cli.js.map +0 -1
  372. package/dist-cjs/host/plugins/accept-check.js +0 -176
  373. package/dist-cjs/host/plugins/accept-check.js.map +0 -1
  374. package/dist-cjs/host/plugins/brand-bindings.js +0 -78
  375. package/dist-cjs/host/plugins/brand-bindings.js.map +0 -1
  376. package/dist-cjs/host/plugins/control-adapters.js +0 -89
  377. package/dist-cjs/host/plugins/control-adapters.js.map +0 -1
  378. package/dist-cjs/host/plugins/control-extras.js +0 -397
  379. package/dist-cjs/host/plugins/control-extras.js.map +0 -1
  380. package/dist-cjs/host/plugins/control-plane.js +0 -130
  381. package/dist-cjs/host/plugins/control-plane.js.map +0 -1
  382. package/dist-cjs/host/plugins/control-token.js +0 -90
  383. package/dist-cjs/host/plugins/control-token.js.map +0 -1
  384. package/dist-cjs/host/plugins/crm-key.js +0 -135
  385. package/dist-cjs/host/plugins/crm-key.js.map +0 -1
  386. package/dist-cjs/host/plugins/data.js +0 -107
  387. package/dist-cjs/host/plugins/data.js.map +0 -1
  388. package/dist-cjs/host/plugins/events.js +0 -19
  389. package/dist-cjs/host/plugins/events.js.map +0 -1
  390. package/dist-cjs/host/plugins/execution-grant.js +0 -11
  391. package/dist-cjs/host/plugins/execution-grant.js.map +0 -1
  392. package/dist-cjs/host/plugins/git.js +0 -371
  393. package/dist-cjs/host/plugins/git.js.map +0 -1
  394. package/dist-cjs/host/plugins/host.js +0 -283
  395. package/dist-cjs/host/plugins/host.js.map +0 -1
  396. package/dist-cjs/host/plugins/launcher.js +0 -514
  397. package/dist-cjs/host/plugins/launcher.js.map +0 -1
  398. package/dist-cjs/host/plugins/runtime.js +0 -446
  399. package/dist-cjs/host/plugins/runtime.js.map +0 -1
  400. package/dist-cjs/host/plugins/test-runner.js +0 -112
  401. package/dist-cjs/host/plugins/test-runner.js.map +0 -1
  402. package/dist-cjs/host/safe-storage.js +0 -95
  403. package/dist-cjs/host/safe-storage.js.map +0 -1
  404. package/dist-cjs/host/sandbox/embed-sandbox.js +0 -396
  405. package/dist-cjs/host/sandbox/embed-sandbox.js.map +0 -1
  406. package/dist-cjs/host/sandbox/os-sandbox.js +0 -106
  407. package/dist-cjs/host/sandbox/os-sandbox.js.map +0 -1
  408. package/dist-cjs/host/server-env.js +0 -69
  409. package/dist-cjs/host/server-env.js.map +0 -1
  410. package/dist-cjs/host/server-launcher.js +0 -52
  411. package/dist-cjs/host/server-launcher.js.map +0 -1
  412. package/dist-cjs/host/tunnel/cloudflared-respawn.js +0 -80
  413. package/dist-cjs/host/tunnel/cloudflared-respawn.js.map +0 -1
  414. package/dist-cjs/host/tunnel/tunnel.js +0 -470
  415. package/dist-cjs/host/tunnel/tunnel.js.map +0 -1
  416. package/dist-cjs/logger.js +0 -269
  417. package/dist-cjs/logger.js.map +0 -1
@@ -1,789 +0,0 @@
1
- /**
2
- * Bootstrap runtime Hermes (agent CLI + WebUI) — download-on-first-run.
3
- *
4
- * Le full Python/venv n’est PAS dans l’exe (taille / remote-build). Au premier
5
- * Héberger sans CLI, on lance l’installeur officiel NousResearch, puis on
6
- * récupère l’archive WebUI pinée (checksum SHA-256) sous userData.
7
- * Chemins injectés via HostRuntimeContext (SoT kit — jumeau marque interdit).
8
- */
9
- import { spawn } from "node:child_process";
10
- import crypto from "node:crypto";
11
- import fs from "node:fs";
12
- import http from "node:http";
13
- import https from "node:https";
14
- import path from "node:path";
15
- import { hostLog, hostProductName } from "../context.js";
16
- import { kitOsVendorDir } from "../kit-os-resources.js";
17
- import { applyOsSandboxEnv, setSandboxEnvVar } from "../sandbox/embed-sandbox.js";
18
- import { resolveSystemBinary } from "../sandbox/os-sandbox.js";
19
- import { resolveDesktopNodeBinary } from "../node-runtime.js";
20
- /**
21
- * Browser tools Hermes (Playwright) opt-in : CREEZIO_HERMES_BROWSER=1 retire
22
- * `--skip-browser` de l'installeur (≈ +400 Mo Chromium Playwright + deps —
23
- * dimensionner le disque en conséquence). Défaut : skip (desktop léger ; le
24
- * pilotage web IA passe par le sidecar browser-host côté serveur).
25
- */
26
- export function hermesBrowserToolsEnabled() {
27
- return process.env.CREEZIO_HERMES_BROWSER === "1";
28
- }
29
- let phase = "idle";
30
- let lastBootstrapError = null;
31
- export function getBootstrapPhase() {
32
- return phase;
33
- }
34
- export function getBootstrapError() {
35
- return lastBootstrapError;
36
- }
37
- function setPhase(p) {
38
- phase = p;
39
- }
40
- export function hermesVendorDir(ctx) {
41
- // Marque d’abord (packaged resourcesPath/vendor), sinon kit OS Creezio.
42
- const candidates = [
43
- path.join(ctx.resourcesRoot, "vendor", "hermes-agent"),
44
- path.join(ctx.resourcesRoot, "resources", "vendor", "hermes-agent"),
45
- kitOsVendorDir("hermes-agent"),
46
- ];
47
- for (const p of candidates) {
48
- if (fs.existsSync(path.join(p, "runtime-manifest.json")))
49
- return p;
50
- }
51
- for (const p of candidates) {
52
- if (fs.existsSync(p))
53
- return p;
54
- }
55
- return candidates[0];
56
- }
57
- export function loadRuntimeManifest(ctx) {
58
- const candidates = [
59
- path.join(hermesVendorDir(ctx), "runtime-manifest.json"),
60
- ];
61
- for (const p of candidates) {
62
- if (fs.existsSync(p)) {
63
- return JSON.parse(fs.readFileSync(p, "utf8"));
64
- }
65
- }
66
- throw new Error("vendor/hermes-agent/runtime-manifest.json introuvable");
67
- }
68
- /**
69
- * Script d'install Hermes VENDORISÉ (embarqué dans les ressources).
70
- * Plus aucun téléchargement au first-run : un changement du script upstream
71
- * ne peut plus casser les installs (le checksum du manifest reste vérifié
72
- * comme garde d'intégrité du fichier packagé).
73
- */
74
- export function vendoredInstallScriptPath(ctx, name) {
75
- const candidates = [path.join(hermesVendorDir(ctx), name)];
76
- for (const p of candidates) {
77
- if (fs.existsSync(p))
78
- return p;
79
- }
80
- return null;
81
- }
82
- /**
83
- * Racine userData sans espaces pour les scripts shell tiers (install.sh).
84
- * Ex. `…/TempoFlow Server` → `…/TempoFlow-Server` — sinon `$UV_CMD --version`
85
- * non quoté dans l’installeur officiel sort en exit 126.
86
- */
87
- export function hermesSpaceSafeUserDataRoot(userDataDir) {
88
- if (!/\s/.test(userDataDir))
89
- return userDataDir;
90
- const parent = path.dirname(userDataDir);
91
- const base = path.basename(userDataDir).replace(/\s+/g, "-");
92
- return path.join(parent, base);
93
- }
94
- export function hermesRuntimeCacheDir(ctx) {
95
- // Install/bootstrap Hermes : jamais d’espace dans le chemin (install.sh).
96
- const root = hermesSpaceSafeUserDataRoot(ctx.userDataDir);
97
- const dir = path.join(root, "hermes-runtime");
98
- fs.mkdirSync(dir, { recursive: true });
99
- // Compat : garder un lien/miroir sous l’ancien chemin à espaces si différent.
100
- try {
101
- const legacy = path.join(ctx.userDataDir, "hermes-runtime");
102
- if (legacy !== dir && !fs.existsSync(legacy)) {
103
- try {
104
- fs.symlinkSync(dir, legacy, process.platform === "win32" ? "junction" : "dir");
105
- }
106
- catch {
107
- /* best-effort */
108
- }
109
- }
110
- }
111
- catch {
112
- /* ignore */
113
- }
114
- return dir;
115
- }
116
- /**
117
- * Verrou layout d'install Hermes : l'install.sh amont récent bascule en
118
- * layout FHS quand il tourne en root Linux (containers server-docker) —
119
- * code sous `/usr/local/lib/hermes-agent`, commande `/usr/local/bin/hermes`
120
- * — hors du sandbox où le launcher cherche le binaire (« CLI toujours
121
- * introuvable après install », vécu instance demo). `HERMES_INSTALL_DIR`
122
- * est honoré par l'installeur et force le layout sandbox historique.
123
- */
124
- export function hermesInstallLayoutEnv(profile, platform) {
125
- if (platform === "win32") {
126
- return {
127
- HERMES_HOME: path.join(profile, "AppData", "Local", "hermes"),
128
- };
129
- }
130
- const home = path.join(profile, ".hermes");
131
- return {
132
- HERMES_HOME: home,
133
- HERMES_INSTALL_DIR: path.join(home, "hermes-agent"),
134
- };
135
- }
136
- /**
137
- * Dossiers fallback FHS pour retrouver un CLI Hermes installé AVANT le
138
- * verrou `HERMES_INSTALL_DIR` (install root Linux → /usr/local). Réservé
139
- * aux processus root Linux (containers) — jamais sur un desktop utilisateur
140
- * (sandbox only).
141
- */
142
- export function hermesFhsFallbackDirs(platform, uid) {
143
- if (platform !== "linux" || uid !== 0)
144
- return [];
145
- return ["/usr/local/bin", "/usr/local/lib/hermes-agent"];
146
- }
147
- /** Corrige les invocations non quotées de $UV_CMD dans install.sh (espaces). */
148
- export function patchHermesInstallShForSpaces(scriptPath) {
149
- if (!fs.existsSync(scriptPath))
150
- return;
151
- const raw = fs.readFileSync(scriptPath, "utf8");
152
- const patched = raw
153
- .replace(/UV_VERSION=\$\(\$UV_CMD --version 2>\/dev\/null\)/g, 'UV_VERSION=$("$UV_CMD" --version 2>/dev/null)')
154
- .replace(/UV_VERSION=\$\(\$UV_CMD --version\)/g, 'UV_VERSION=$("$UV_CMD" --version)');
155
- if (patched !== raw) {
156
- fs.writeFileSync(scriptPath, patched, "utf8");
157
- }
158
- }
159
- /**
160
- * Profil OS faux pour l’installeur Hermes officiel.
161
- * Sous Windows l’install écrit typiquement `%USERPROFILE%\.hermes` /
162
- * `%LOCALAPPDATA%\hermes` — on pointe USERPROFILE + LOCALAPPDATA ici
163
- * pour rester dans le sandbox desktop.
164
- */
165
- export function hermesInstallOsProfileDir(ctx) {
166
- const dir = path.join(hermesRuntimeCacheDir(ctx), "os-profile");
167
- fs.mkdirSync(dir, { recursive: true });
168
- fs.mkdirSync(path.join(dir, "AppData", "Local"), { recursive: true });
169
- fs.mkdirSync(path.join(dir, "AppData", "Roaming"), { recursive: true });
170
- return dir;
171
- }
172
- export function hermesWebuiInstallDir(ctx) {
173
- return path.join(hermesRuntimeCacheDir(ctx), "webui");
174
- }
175
- /** Répertoires candidats pour le checkout hermes-agent (sandbox d’abord). */
176
- export function hermesAgentDirCandidates(ctx) {
177
- const profile = hermesInstallOsProfileDir(ctx);
178
- const local = path.join(profile, "AppData", "Local");
179
- return [
180
- path.join(hermesRuntimeCacheDir(ctx), "hermes-agent"),
181
- path.join(profile, ".hermes", "hermes-agent"),
182
- path.join(local, "hermes", "hermes-agent"),
183
- path.join(ctx.userDataDir, "hermes-home", "hermes-agent"),
184
- // Install FHS root Linux antérieure au verrou HERMES_INSTALL_DIR
185
- // (containers uniquement — voir hermesFhsFallbackDirs).
186
- ...(hermesFhsFallbackDirs(process.platform, typeof process.getuid === "function" ? process.getuid() : null).includes("/usr/local/lib/hermes-agent")
187
- ? ["/usr/local/lib/hermes-agent"]
188
- : []),
189
- ].filter(Boolean);
190
- }
191
- export function resolveHermesAgentDir(ctx, existsSync = fs.existsSync) {
192
- for (const dir of hermesAgentDirCandidates(ctx)) {
193
- const marker = path.join(dir, "cli.py");
194
- const marker2 = path.join(dir, "pyproject.toml");
195
- if (existsSync(marker) || existsSync(marker2))
196
- return dir;
197
- }
198
- return null;
199
- }
200
- /** Python du venv Hermes (pour spawner WebUI). */
201
- export function resolveHermesPython(agentDir) {
202
- if (!agentDir)
203
- return null;
204
- const candidates = process.platform === "win32"
205
- ? [
206
- path.join(agentDir, "venv", "Scripts", "python.exe"),
207
- path.join(agentDir, ".venv", "Scripts", "python.exe"),
208
- ]
209
- : [
210
- path.join(agentDir, "venv", "bin", "python"),
211
- path.join(agentDir, ".venv", "bin", "python"),
212
- path.join(agentDir, "venv", "bin", "python3"),
213
- ];
214
- for (const p of candidates) {
215
- if (fs.existsSync(p))
216
- return p;
217
- }
218
- return null;
219
- }
220
- function downloadToFile(url, dest, onLog) {
221
- return new Promise((resolve, reject) => {
222
- fs.mkdirSync(path.dirname(dest), { recursive: true });
223
- const tmp = `${dest}.part`;
224
- const file = fs.createWriteStream(tmp);
225
- const get = url.startsWith("https:") ? https.get : http.get;
226
- onLog(`download ${url}`);
227
- const req = get(url, { timeout: 120_000 }, (res) => {
228
- if (res.statusCode &&
229
- res.statusCode >= 300 &&
230
- res.statusCode < 400 &&
231
- res.headers.location) {
232
- file.close();
233
- try {
234
- fs.unlinkSync(tmp);
235
- }
236
- catch {
237
- /* ignore */
238
- }
239
- downloadToFile(res.headers.location, dest, onLog).then(resolve, reject);
240
- return;
241
- }
242
- if (res.statusCode !== 200) {
243
- file.close();
244
- reject(new Error(`HTTP ${res.statusCode} pour ${url}`));
245
- return;
246
- }
247
- res.pipe(file);
248
- file.on("finish", () => {
249
- file.close(() => {
250
- fs.renameSync(tmp, dest);
251
- resolve();
252
- });
253
- });
254
- });
255
- req.on("error", (e) => {
256
- try {
257
- file.close();
258
- fs.unlinkSync(tmp);
259
- }
260
- catch {
261
- /* ignore */
262
- }
263
- reject(e);
264
- });
265
- req.on("timeout", () => {
266
- req.destroy();
267
- reject(new Error("download timeout"));
268
- });
269
- });
270
- }
271
- function sha256File(filePath) {
272
- const hash = crypto.createHash("sha256");
273
- hash.update(fs.readFileSync(filePath));
274
- return hash.digest("hex");
275
- }
276
- /**
277
- * Supply-chain : le script d'install distant doit correspondre au pin sha256
278
- * du manifest. Mismatch = throw (jamais d'exécution d'un script inattendu).
279
- */
280
- function verifyInstallScriptChecksum(scriptPath, expectedSha256, onLog) {
281
- const digest = sha256File(scriptPath);
282
- if (!expectedSha256) {
283
- throw new Error(`script d'install sans pin sha256 dans le manifest (observé ${digest}) — exécution refusée`);
284
- }
285
- if (digest !== expectedSha256.toLowerCase()) {
286
- throw new Error(`checksum script d'install invalide (got ${digest}, want ${expectedSha256}) — exécution refusée`);
287
- }
288
- onLog(`checksum script install OK ${digest.slice(0, 12)}…`);
289
- }
290
- /** Marker écrit après pip OK / imports OK — skip pip aux boots suivants. */
291
- export const WEBUI_DEPS_MARKER = ".desktop-webui-deps";
292
- /** Legacy marque (upgrade) — lu si le marker desktop est absent. */
293
- export const WEBUI_DEPS_MARKER_LEGACY = ".tempoflow-webui-deps";
294
- /** Legacy Certivan (M6p) — installs ≤ cutover host. */
295
- export const WEBUI_DEPS_MARKER_LEGACY_CERTIVAN = ".certivan-webui-deps";
296
- /** Legacy Fidu (M6p) — installs ≤ cutover host. */
297
- export const WEBUI_DEPS_MARKER_LEGACY_FIDU = ".fidu-webui-deps";
298
- const WEBUI_PIN_FILE = ".desktop-webui-pin";
299
- const WEBUI_PIN_FILE_LEGACY = ".tempoflow-webui-pin";
300
- const WEBUI_PIN_FILE_LEGACY_CERTIVAN = ".certivan-webui-pin";
301
- const WEBUI_PIN_FILE_LEGACY_FIDU = ".fidu-webui-pin";
302
- const WEBUI_DEPS_MARKER_CANDIDATES = [
303
- WEBUI_DEPS_MARKER,
304
- WEBUI_DEPS_MARKER_LEGACY,
305
- WEBUI_DEPS_MARKER_LEGACY_CERTIVAN,
306
- WEBUI_DEPS_MARKER_LEGACY_FIDU,
307
- ];
308
- const WEBUI_PIN_CANDIDATES = [
309
- WEBUI_PIN_FILE,
310
- WEBUI_PIN_FILE_LEGACY,
311
- WEBUI_PIN_FILE_LEGACY_CERTIVAN,
312
- WEBUI_PIN_FILE_LEGACY_FIDU,
313
- ];
314
- export function webuiDepsMarkerPath(webuiDir) {
315
- return path.join(webuiDir, WEBUI_DEPS_MARKER);
316
- }
317
- export function readWebuiDepsMarker(webuiDir) {
318
- for (const name of WEBUI_DEPS_MARKER_CANDIDATES) {
319
- const p = path.join(webuiDir, name);
320
- try {
321
- if (!fs.existsSync(p))
322
- continue;
323
- const v = fs.readFileSync(p, "utf8").trim();
324
- if (v)
325
- return v;
326
- }
327
- catch {
328
- /* ignore */
329
- }
330
- }
331
- return null;
332
- }
333
- export function writeWebuiDepsMarker(webuiDir, digest) {
334
- fs.writeFileSync(webuiDepsMarkerPath(webuiDir), `${digest}\n`, "utf8");
335
- }
336
- /**
337
- * true si le marker correspond au hash de requirements.txt
338
- * (deps déjà validées pour ce pin WebUI).
339
- */
340
- export function isWebuiDepsMarkerCurrent(webuiDir, requirementsPath, existsSync = fs.existsSync) {
341
- if (!existsSync(requirementsPath))
342
- return false;
343
- const digest = sha256File(requirementsPath);
344
- return readWebuiDepsMarker(webuiDir) === digest;
345
- }
346
- /**
347
- * Check rapide (~ms) : imports WebUI requis.
348
- * Évite `pip install -r` à chaque Héberger quand le venv est déjà prêt.
349
- */
350
- export async function webuiPythonDepsReady(pythonPath, opts) {
351
- const silent = opts?.onLog || (() => undefined);
352
- try {
353
- const r = await runCommand(pythonPath, ["-c", "import yaml, cryptography"], {
354
- onLog: silent,
355
- timeoutMs: opts?.timeoutMs ?? 15_000,
356
- });
357
- return r.code === 0;
358
- }
359
- catch {
360
- return false;
361
- }
362
- }
363
- function runCommand(cmd, args, opts) {
364
- return new Promise((resolve, reject) => {
365
- opts.onLog(`$ ${cmd} ${args.join(" ")}`);
366
- const child = spawn(cmd, args, {
367
- cwd: opts.cwd,
368
- env: opts.env || process.env,
369
- stdio: ["ignore", "pipe", "pipe"],
370
- windowsHide: true,
371
- shell: false,
372
- });
373
- const onData = (buf) => {
374
- buf
375
- .toString("utf8")
376
- .split(/\r?\n/)
377
- .filter(Boolean)
378
- .forEach((l) => opts.onLog(l.slice(0, 400)));
379
- };
380
- child.stdout?.on("data", onData);
381
- child.stderr?.on("data", onData);
382
- const timer = setTimeout(() => {
383
- try {
384
- child.kill();
385
- }
386
- catch {
387
- /* ignore */
388
- }
389
- reject(new Error(`timeout ${opts.timeoutMs}ms: ${cmd}`));
390
- }, opts.timeoutMs);
391
- child.on("error", (e) => {
392
- clearTimeout(timer);
393
- reject(e);
394
- });
395
- child.on("exit", (code) => {
396
- clearTimeout(timer);
397
- resolve({ code });
398
- });
399
- });
400
- }
401
- /**
402
- * Installe Hermes Agent via l’installeur officiel (réseau requis).
403
- * Idempotent si le CLI est déjà présent ailleurs — le caller vérifie d’abord.
404
- */
405
- export async function installHermesAgent(ctx, opts) {
406
- const manifest = loadRuntimeManifest(ctx);
407
- const timeoutMs = opts.timeoutMs ?? 15 * 60 * 1000;
408
- setPhase("installing-agent");
409
- lastBootstrapError = null;
410
- const cache = hermesRuntimeCacheDir(ctx);
411
- const scriptsDir = path.join(cache, "install-scripts");
412
- fs.mkdirSync(scriptsDir, { recursive: true });
413
- const product = hostProductName(ctx);
414
- try {
415
- const profile = hermesInstallOsProfileDir(ctx);
416
- // Node desktop visible dans le PATH confiné : le stage `node` de
417
- // l'installeur le détecte et n'installe RIEN (ni zip portable, ni winget
418
- // machine-wide en fallback).
419
- const desktopNode = resolveDesktopNodeBinary(ctx);
420
- const installToolDirs = path.isAbsolute(desktopNode)
421
- ? [path.dirname(desktopNode)]
422
- : [];
423
- const installEnv = applyOsSandboxEnv({
424
- env: {
425
- ...process.env,
426
- LOCALAPPDATA: path.join(profile, "AppData", "Local"),
427
- APPDATA: path.join(profile, "AppData", "Roaming"),
428
- },
429
- profileHome: profile,
430
- userData: ctx.userDataDir,
431
- // PATH confiné : Node desktop + System32, rien du PC hôte.
432
- toolDirs: installToolDirs,
433
- });
434
- setSandboxEnvVar(installEnv, "LOCALAPPDATA", path.join(profile, "AppData", "Local"));
435
- setSandboxEnvVar(installEnv, "APPDATA", path.join(profile, "AppData", "Roaming"));
436
- // Verrou définitif : install.ps1/install.sh donnent à HERMES_HOME la
437
- // priorité sur %LOCALAPPDATA% / $HOME pour choisir HermesHome, et
438
- // HERMES_INSTALL_DIR neutralise le layout FHS root Linux (/usr/local)
439
- // de l'installeur récent — le launcher ne cherche que le sandbox.
440
- const layout = hermesInstallLayoutEnv(profile, process.platform);
441
- setSandboxEnvVar(installEnv, "HERMES_HOME", layout.HERMES_HOME);
442
- if (layout.HERMES_INSTALL_DIR) {
443
- setSandboxEnvVar(installEnv, "HERMES_INSTALL_DIR", layout.HERMES_INSTALL_DIR);
444
- }
445
- opts.onLog(`install Hermes dans sandbox ${product} (USERPROFILE=${profile}, HERMES_HOME=${installEnv.HERMES_HOME}${layout.HERMES_INSTALL_DIR ? `, HERMES_INSTALL_DIR=${layout.HERMES_INSTALL_DIR}` : ""})`);
446
- // Purge des checkouts mis de côté par install.ps1 après un échec
447
- // (« hermes-agent.broken-<ts> ») — sinon chaque retry laisse des
448
- // centaines de Mo morts dans le sandbox.
449
- try {
450
- const hermesHome = installEnv.HERMES_HOME;
451
- if (fs.existsSync(hermesHome)) {
452
- for (const entry of fs.readdirSync(hermesHome)) {
453
- if (entry.startsWith("hermes-agent.broken-")) {
454
- opts.onLog(`purge checkout cassé: ${entry}`);
455
- fs.rmSync(path.join(hermesHome, entry), {
456
- recursive: true,
457
- force: true,
458
- });
459
- }
460
- }
461
- }
462
- }
463
- catch {
464
- /* best-effort */
465
- }
466
- const commitPin = manifest.agentInstall.commitPin;
467
- if (process.platform === "win32") {
468
- const win = manifest.agentInstall.windows;
469
- const ps1 = path.join(scriptsDir, "install.ps1");
470
- const vendored = vendoredInstallScriptPath(ctx, "install.ps1");
471
- if (vendored) {
472
- fs.copyFileSync(vendored, ps1);
473
- opts.onLog("script install vendorisé (embarqué, aucun téléchargement)");
474
- }
475
- else {
476
- await downloadToFile(win.scriptUrl, ps1, opts.onLog);
477
- }
478
- verifyInstallScriptChecksum(ps1, win.scriptSha256, opts.onLog);
479
- const powershell = resolveSystemBinary("powershell");
480
- if (!powershell) {
481
- lastBootstrapError = "PowerShell système introuvable (System32)";
482
- setPhase("error");
483
- return { ok: false, detail: lastBootstrapError };
484
- }
485
- const baseArgs = [...win.args].filter((a) => !(hermesBrowserToolsEnabled() && a === "-SkipBrowser"));
486
- if (commitPin)
487
- baseArgs.push("-Commit", commitPin);
488
- if (win.stages && win.stages.length > 0) {
489
- for (const stage of win.stages) {
490
- opts.onLog(`install stage « ${stage} »…`);
491
- const r = await runCommand(powershell, [
492
- "-NoProfile",
493
- "-ExecutionPolicy",
494
- "Bypass",
495
- "-File",
496
- ps1,
497
- "-Stage",
498
- stage,
499
- ...baseArgs,
500
- ], { onLog: opts.onLog, timeoutMs, env: installEnv });
501
- if (r.code !== 0) {
502
- lastBootstrapError = `install.ps1 stage ${stage} exit ${r.code}`;
503
- setPhase("error");
504
- return { ok: false, detail: lastBootstrapError };
505
- }
506
- }
507
- }
508
- else {
509
- const result = await runCommand(powershell, ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", ps1, ...baseArgs], { onLog: opts.onLog, timeoutMs, env: installEnv });
510
- if (result.code !== 0) {
511
- lastBootstrapError = `install.ps1 exit ${result.code}`;
512
- setPhase("error");
513
- return { ok: false, detail: lastBootstrapError };
514
- }
515
- }
516
- }
517
- else {
518
- const posix = manifest.agentInstall.posix;
519
- const sh = path.join(scriptsDir, "install.sh");
520
- const vendored = vendoredInstallScriptPath(ctx, "install.sh");
521
- if (vendored) {
522
- fs.copyFileSync(vendored, sh);
523
- opts.onLog("script install vendorisé (embarqué, aucun téléchargement)");
524
- }
525
- else {
526
- await downloadToFile(posix.scriptUrl, sh, opts.onLog);
527
- }
528
- // Checksum AVANT patch local (le patch quote $UV_CMD — hors amont).
529
- verifyInstallScriptChecksum(sh, posix.scriptSha256, opts.onLog);
530
- patchHermesInstallShForSpaces(sh);
531
- fs.chmodSync(sh, 0o755);
532
- const bash = resolveSystemBinary("bash");
533
- if (!bash) {
534
- lastBootstrapError = "bash système introuvable (/bin, /usr/bin)";
535
- setPhase("error");
536
- return { ok: false, detail: lastBootstrapError };
537
- }
538
- const posixArgs = [...posix.args].filter((a) => !(hermesBrowserToolsEnabled() && a === "--skip-browser"));
539
- if (commitPin)
540
- posixArgs.push("--commit", commitPin);
541
- const result = await runCommand(bash, [sh, ...posixArgs], {
542
- onLog: opts.onLog,
543
- timeoutMs,
544
- env: installEnv,
545
- });
546
- if (result.code !== 0) {
547
- lastBootstrapError = `install.sh exit ${result.code}`;
548
- setPhase("error");
549
- return { ok: false, detail: lastBootstrapError };
550
- }
551
- }
552
- setPhase("ready");
553
- return { ok: true, detail: "Hermes Agent installé" };
554
- }
555
- catch (e) {
556
- lastBootstrapError = e instanceof Error ? e.message : String(e);
557
- setPhase("error");
558
- return { ok: false, detail: lastBootstrapError };
559
- }
560
- }
561
- async function extractTarGz(ctx, archive, destParent, onLog) {
562
- fs.mkdirSync(destParent, { recursive: true });
563
- const staging = path.join(destParent, "_extract");
564
- fs.rmSync(staging, { recursive: true, force: true });
565
- fs.mkdirSync(staging, { recursive: true });
566
- const tarBin = resolveSystemBinary("tar");
567
- if (!tarBin) {
568
- throw new Error("tar système introuvable (System32 / /usr/bin)");
569
- }
570
- {
571
- const r = await runCommand(tarBin, ["-xzf", archive, "-C", staging], {
572
- onLog,
573
- timeoutMs: 120_000,
574
- });
575
- if (r.code !== 0)
576
- throw new Error(`tar extraction failed (${tarBin})`);
577
- }
578
- const entries = fs.readdirSync(staging).filter((n) => !n.startsWith("."));
579
- if (entries.length !== 1) {
580
- throw new Error(`archive layout inattendu: ${entries.join(",")}`);
581
- }
582
- const extracted = path.join(staging, entries[0]);
583
- const finalDir = hermesWebuiInstallDir(ctx);
584
- fs.rmSync(finalDir, { recursive: true, force: true });
585
- fs.renameSync(extracted, finalDir);
586
- fs.rmSync(staging, { recursive: true, force: true });
587
- return finalDir;
588
- }
589
- function readWebuiPin(webuiDir) {
590
- for (const name of WEBUI_PIN_CANDIDATES) {
591
- const p = path.join(webuiDir, name);
592
- try {
593
- if (!fs.existsSync(p))
594
- continue;
595
- const v = fs.readFileSync(p, "utf8").trim();
596
- if (v)
597
- return v;
598
- }
599
- catch {
600
- /* ignore */
601
- }
602
- }
603
- return null;
604
- }
605
- /**
606
- * Télécharge + vérifie + extrait hermes-webui (pin + sha256 du manifest).
607
- * Installe les deps Python légères dans le venv Hermes **uniquement** si
608
- * absentes (premier run / repair). Boots suivants : marker ou import check.
609
- */
610
- export async function ensureHermesWebuiTree(ctx, opts) {
611
- const log = opts?.onLog || ((l) => hostLog(ctx, "hermes-bootstrap", l));
612
- setPhase("checking");
613
- lastBootstrapError = null;
614
- try {
615
- const manifest = loadRuntimeManifest(ctx);
616
- const finalDir = hermesWebuiInstallDir(ctx);
617
- const marker = path.join(finalDir, "server.py");
618
- const pinRef = readWebuiPin(finalDir);
619
- const needDownload = !fs.existsSync(marker) ||
620
- !pinRef ||
621
- pinRef !== manifest.webui.ref;
622
- if (needDownload) {
623
- setPhase("installing-webui");
624
- const cache = path.join(hermesRuntimeCacheDir(ctx), "downloads");
625
- fs.mkdirSync(cache, { recursive: true });
626
- const archive = path.join(cache, `hermes-webui-${manifest.webui.ref}.tar.gz`);
627
- if (!fs.existsSync(archive) ||
628
- sha256File(archive) !== manifest.webui.sha256) {
629
- await downloadToFile(manifest.webui.archiveUrl, archive, log);
630
- }
631
- const digest = sha256File(archive);
632
- if (digest !== manifest.webui.sha256) {
633
- throw new Error(`checksum WebUI invalide (got ${digest}, want ${manifest.webui.sha256})`);
634
- }
635
- log(`checksum OK ${digest.slice(0, 12)}…`);
636
- await extractTarGz(ctx, archive, hermesRuntimeCacheDir(ctx), log);
637
- fs.writeFileSync(path.join(finalDir, WEBUI_PIN_FILE), `${manifest.webui.ref}\n`, "utf8");
638
- }
639
- const pythonPath = opts?.pythonPath ||
640
- resolveHermesPython(resolveHermesAgentDir(ctx));
641
- const req = path.join(finalDir, "requirements.txt");
642
- if (fs.existsSync(req) && pythonPath) {
643
- if (isWebuiDepsMarkerCurrent(finalDir, req)) {
644
- log("démarrage…");
645
- }
646
- else {
647
- const already = await webuiPythonDepsReady(pythonPath);
648
- const reqDigest = sha256File(req);
649
- if (already) {
650
- writeWebuiDepsMarker(finalDir, reqDigest);
651
- log("démarrage…");
652
- }
653
- else {
654
- setPhase("installing-webui");
655
- log("pip install WebUI deps (pyyaml, cryptography)…");
656
- const pipEnv = applyOsSandboxEnv({
657
- env: { ...process.env },
658
- profileHome: hermesInstallOsProfileDir(ctx),
659
- userData: ctx.userDataDir,
660
- toolDirs: [path.dirname(pythonPath)],
661
- });
662
- const pip = await runCommand(pythonPath, ["-m", "pip", "install", "--disable-pip-version-check", "-r", req], { onLog: log, timeoutMs: 180_000, cwd: finalDir, env: pipEnv });
663
- if (pip.code === 0) {
664
- writeWebuiDepsMarker(finalDir, reqDigest);
665
- }
666
- else {
667
- const recovered = await webuiPythonDepsReady(pythonPath);
668
- if (recovered) {
669
- writeWebuiDepsMarker(finalDir, reqDigest);
670
- log("démarrage…");
671
- }
672
- else {
673
- log("deps WebUI manquantes après pip — WebUI peut échouer au spawn");
674
- }
675
- }
676
- }
677
- }
678
- }
679
- else if (!needDownload) {
680
- log("démarrage…");
681
- }
682
- setPhase("ready");
683
- return { ok: true, dir: finalDir, detail: "WebUI prêt" };
684
- }
685
- catch (e) {
686
- lastBootstrapError = e instanceof Error ? e.message : String(e);
687
- setPhase("error");
688
- return { ok: false, dir: null, detail: lastBootstrapError };
689
- }
690
- }
691
- /**
692
- * Si CLI absente → install agent. Puis assure l’arbre WebUI.
693
- * Appelé au boot Héberger (embedded) ou depuis l’UI « Installer runtime ».
694
- */
695
- export async function ensureHermesRuntime(ctx, opts) {
696
- const log = opts?.onLog || ((l) => hostLog(ctx, "hermes-bootstrap", l));
697
- const report = (p) => {
698
- setPhase(p);
699
- opts?.onPhase?.(p);
700
- };
701
- report("checking");
702
- lastBootstrapError = null;
703
- const { resolveHermesBinary } = await import("@creezio/platform-core");
704
- const profile = hermesInstallOsProfileDir(ctx);
705
- const defaultSearchDirs = [
706
- hermesRuntimeCacheDir(ctx),
707
- path.join(hermesRuntimeCacheDir(ctx), "bin"),
708
- path.join(profile, "AppData", "Local", "hermes", "bin"),
709
- path.join(profile, ".hermes", "bin"),
710
- process.platform === "win32"
711
- ? path.join(profile, "AppData", "Local", "hermes", "hermes-agent", "venv", "Scripts")
712
- : path.join(profile, ".hermes", "hermes-agent", "venv", "bin"),
713
- ...hermesAgentDirCandidates(ctx),
714
- path.join(ctx.userDataDir, "hermes-home", "bin"),
715
- ];
716
- const searchDirs = opts?.searchDirs || defaultSearchDirs;
717
- const findBinary = opts?.findBinary ||
718
- (() => resolveHermesBinary({
719
- platform: process.platform,
720
- env: process.env,
721
- searchDirs,
722
- allowEnvOverride: !ctx.isPackaged,
723
- envPrefix: ctx.manifest.envPrefix,
724
- existsSync: fs.existsSync,
725
- }));
726
- let binary = findBinary();
727
- if (!binary && opts?.installAgentIfMissing !== false) {
728
- log("CLI Hermes absente — bootstrap download-on-first-run…");
729
- const inst = await installHermesAgent(ctx, {
730
- onLog: log,
731
- timeoutMs: opts?.timeoutMs,
732
- });
733
- if (!inst.ok) {
734
- return {
735
- ok: false,
736
- binary: null,
737
- binaryPath: null,
738
- agentDir: null,
739
- webuiDir: null,
740
- detail: inst.detail,
741
- };
742
- }
743
- binary = findBinary();
744
- }
745
- if (!binary) {
746
- lastBootstrapError = "CLI toujours introuvable après install";
747
- report("error");
748
- return {
749
- ok: false,
750
- binary: null,
751
- binaryPath: null,
752
- agentDir: null,
753
- webuiDir: null,
754
- detail: lastBootstrapError,
755
- };
756
- }
757
- const agentDir = resolveHermesAgentDir(ctx);
758
- const python = resolveHermesPython(agentDir);
759
- if (!python) {
760
- lastBootstrapError = "Python venv Hermes introuvable (WebUI impossible)";
761
- report("error");
762
- return {
763
- ok: false,
764
- binary,
765
- binaryPath: binary,
766
- agentDir,
767
- webuiDir: null,
768
- detail: lastBootstrapError,
769
- };
770
- }
771
- const webui = await ensureHermesWebuiTree(ctx, {
772
- onLog: log,
773
- pythonPath: python,
774
- });
775
- report(webui.ok ? "ready" : "error");
776
- return {
777
- ok: Boolean(binary) && webui.ok,
778
- binary,
779
- binaryPath: binary,
780
- agentDir,
781
- webuiDir: webui.dir,
782
- detail: webui.ok ? "Runtime Hermes + WebUI prêts" : webui.detail,
783
- };
784
- }
785
- export function __resetBootstrapStateForTests() {
786
- phase = "idle";
787
- lastBootstrapError = null;
788
- }
789
- //# sourceMappingURL=runtime-bootstrap.js.map