@nextclaw/service 0.2.13 → 0.2.14

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 (846) hide show
  1. package/dist/app/nextclaw-service-runtime.d.ts +41 -0
  2. package/dist/app/nextclaw-service-runtime.d.ts.map +1 -0
  3. package/dist/app/nextclaw-service-runtime.js +136 -0
  4. package/dist/app/nextclaw-service-runtime.js.map +1 -0
  5. package/dist/controllers/commands/agent-command.controller.d.ts +3 -0
  6. package/dist/controllers/commands/agent-command.controller.js +3 -0
  7. package/dist/controllers/commands/channel-command.controller.d.ts +21 -0
  8. package/dist/controllers/commands/channel-command.controller.d.ts.map +1 -0
  9. package/dist/controllers/commands/channel-command.controller.js +115 -0
  10. package/dist/controllers/commands/channel-command.controller.js.map +1 -0
  11. package/dist/controllers/commands/config-command.controller.d.ts +2 -0
  12. package/dist/controllers/commands/config-command.controller.js +2 -0
  13. package/dist/controllers/commands/cron-command.controller.d.ts +2 -0
  14. package/dist/controllers/commands/cron-command.controller.js +2 -0
  15. package/dist/controllers/commands/diagnostics-command.controller.d.ts +2 -0
  16. package/dist/controllers/commands/diagnostics-command.controller.js +2 -0
  17. package/dist/controllers/commands/gateway-command.controller.d.ts +15 -0
  18. package/dist/controllers/commands/gateway-command.controller.d.ts.map +1 -0
  19. package/dist/controllers/commands/gateway-command.controller.js +17 -0
  20. package/dist/controllers/commands/gateway-command.controller.js.map +1 -0
  21. package/dist/controllers/commands/logs-command.controller.d.ts +13 -0
  22. package/dist/controllers/commands/logs-command.controller.d.ts.map +1 -0
  23. package/dist/controllers/commands/logs-command.controller.js +31 -0
  24. package/dist/controllers/commands/logs-command.controller.js.map +1 -0
  25. package/dist/controllers/commands/marketplace-skill-command.controller.d.ts +28 -0
  26. package/dist/controllers/commands/marketplace-skill-command.controller.d.ts.map +1 -0
  27. package/dist/controllers/commands/marketplace-skill-command.controller.js +170 -0
  28. package/dist/controllers/commands/marketplace-skill-command.controller.js.map +1 -0
  29. package/dist/controllers/commands/mcp-command.controller.d.ts +15 -0
  30. package/dist/controllers/commands/mcp-command.controller.d.ts.map +1 -0
  31. package/dist/controllers/commands/mcp-command.controller.js +195 -0
  32. package/dist/controllers/commands/mcp-command.controller.js.map +1 -0
  33. package/dist/controllers/commands/platform-auth-command.controller.d.ts +2 -0
  34. package/dist/controllers/commands/platform-auth-command.controller.js +2 -0
  35. package/dist/controllers/commands/remote-command.controller.d.ts +48 -0
  36. package/dist/controllers/commands/remote-command.controller.d.ts.map +1 -0
  37. package/dist/controllers/commands/remote-command.controller.js +176 -0
  38. package/dist/controllers/commands/remote-command.controller.js.map +1 -0
  39. package/dist/controllers/commands/restart-command.controller.d.ts +21 -0
  40. package/dist/controllers/commands/restart-command.controller.d.ts.map +1 -0
  41. package/dist/controllers/commands/restart-command.controller.js +90 -0
  42. package/dist/controllers/commands/restart-command.controller.js.map +1 -0
  43. package/dist/controllers/commands/secrets-command.controller.d.ts +23 -0
  44. package/dist/controllers/commands/secrets-command.controller.d.ts.map +1 -0
  45. package/dist/controllers/commands/secrets-command.controller.js +282 -0
  46. package/dist/controllers/commands/secrets-command.controller.js.map +1 -0
  47. package/dist/controllers/commands/serve-command.controller.d.ts +15 -0
  48. package/dist/controllers/commands/serve-command.controller.d.ts.map +1 -0
  49. package/dist/controllers/commands/serve-command.controller.js +21 -0
  50. package/dist/controllers/commands/serve-command.controller.js.map +1 -0
  51. package/dist/controllers/commands/service-command.controller.d.ts +17 -0
  52. package/dist/controllers/commands/service-command.controller.d.ts.map +1 -0
  53. package/dist/controllers/commands/service-command.controller.js +33 -0
  54. package/dist/controllers/commands/service-command.controller.js.map +1 -0
  55. package/dist/controllers/commands/start-command.controller.d.ts +19 -0
  56. package/dist/controllers/commands/start-command.controller.d.ts.map +1 -0
  57. package/dist/controllers/commands/start-command.controller.js +27 -0
  58. package/dist/controllers/commands/start-command.controller.js.map +1 -0
  59. package/dist/controllers/commands/stop-command.controller.d.ts +13 -0
  60. package/dist/controllers/commands/stop-command.controller.d.ts.map +1 -0
  61. package/dist/controllers/commands/stop-command.controller.js +13 -0
  62. package/dist/controllers/commands/stop-command.controller.js.map +1 -0
  63. package/dist/controllers/commands/ui-command.controller.d.ts +15 -0
  64. package/dist/controllers/commands/ui-command.controller.d.ts.map +1 -0
  65. package/dist/controllers/commands/ui-command.controller.js +19 -0
  66. package/dist/controllers/commands/ui-command.controller.js.map +1 -0
  67. package/dist/controllers/commands/usage-command.controller.d.ts +2 -0
  68. package/dist/controllers/commands/usage-command.controller.js +2 -0
  69. package/dist/controllers/gateway.controller.d.ts +54 -0
  70. package/dist/controllers/gateway.controller.d.ts.map +1 -0
  71. package/dist/controllers/gateway.controller.js +162 -0
  72. package/dist/controllers/gateway.controller.js.map +1 -0
  73. package/dist/index.d.ts +4 -4
  74. package/dist/index.js +2 -2
  75. package/dist/launcher/npm-runtime-launcher.service.d.ts +1 -1
  76. package/dist/launcher/npm-runtime-launcher.service.js +6 -6
  77. package/dist/launcher/npm-runtime-launcher.service.js.map +1 -1
  78. package/dist/managers/gateway-extension.manager.d.ts +29 -0
  79. package/dist/managers/gateway-extension.manager.d.ts.map +1 -0
  80. package/dist/managers/gateway-extension.manager.js +78 -0
  81. package/dist/managers/gateway-extension.manager.js.map +1 -0
  82. package/dist/managers/gateway-remote.manager.d.ts +23 -0
  83. package/dist/managers/gateway-remote.manager.d.ts.map +1 -0
  84. package/dist/managers/gateway-remote.manager.js +28 -0
  85. package/dist/managers/gateway-remote.manager.js.map +1 -0
  86. package/dist/managers/managed-service.manager.d.ts +42 -0
  87. package/dist/managers/managed-service.manager.d.ts.map +1 -0
  88. package/dist/managers/managed-service.manager.js +195 -0
  89. package/dist/managers/managed-service.manager.js.map +1 -0
  90. package/dist/managers/runtime-update.manager.d.ts +43 -0
  91. package/dist/managers/runtime-update.manager.d.ts.map +1 -0
  92. package/dist/managers/runtime-update.manager.js +185 -0
  93. package/dist/managers/runtime-update.manager.js.map +1 -0
  94. package/dist/managers/service-command.manager.d.ts +67 -0
  95. package/dist/managers/service-command.manager.d.ts.map +1 -0
  96. package/dist/managers/service-command.manager.js +94 -0
  97. package/dist/managers/service-command.manager.js.map +1 -0
  98. package/dist/managers/service-gateway.manager.d.ts +85 -0
  99. package/dist/managers/service-gateway.manager.d.ts.map +1 -0
  100. package/dist/managers/service-gateway.manager.js +278 -0
  101. package/dist/managers/service-gateway.manager.js.map +1 -0
  102. package/dist/managers/service-restart.manager.d.ts +22 -0
  103. package/dist/managers/service-restart.manager.d.ts.map +1 -0
  104. package/dist/managers/service-restart.manager.js +183 -0
  105. package/dist/managers/service-restart.manager.js.map +1 -0
  106. package/dist/managers/service-workspace.manager.d.ts +14 -0
  107. package/dist/managers/service-workspace.manager.d.ts.map +1 -0
  108. package/dist/managers/service-workspace.manager.js +86 -0
  109. package/dist/managers/service-workspace.manager.js.map +1 -0
  110. package/dist/services/agent/agent-commands.service.d.ts +17 -0
  111. package/dist/services/agent/agent-commands.service.d.ts.map +1 -0
  112. package/dist/services/agent/agent-commands.service.js +111 -0
  113. package/dist/services/agent/agent-commands.service.js.map +1 -0
  114. package/dist/services/autostart/host-autostart-command.service.d.ts +30 -0
  115. package/dist/services/autostart/host-autostart-command.service.d.ts.map +1 -0
  116. package/dist/services/autostart/host-autostart-command.service.js +160 -0
  117. package/dist/services/autostart/host-autostart-command.service.js.map +1 -0
  118. package/dist/services/autostart/host-autostart-runtime.service.d.ts +24 -0
  119. package/dist/services/autostart/host-autostart-runtime.service.d.ts.map +1 -0
  120. package/dist/services/autostart/host-autostart-runtime.service.js +55 -0
  121. package/dist/services/autostart/host-autostart-runtime.service.js.map +1 -0
  122. package/dist/services/autostart/host-autostart.service.d.ts +42 -0
  123. package/dist/services/autostart/host-autostart.service.d.ts.map +1 -0
  124. package/dist/services/autostart/host-autostart.service.js +50 -0
  125. package/dist/services/autostart/host-autostart.service.js.map +1 -0
  126. package/dist/services/autostart/linux-systemd-autostart.service.d.ts +49 -0
  127. package/dist/services/autostart/linux-systemd-autostart.service.d.ts.map +1 -0
  128. package/dist/services/autostart/linux-systemd-autostart.service.js +435 -0
  129. package/dist/services/autostart/linux-systemd-autostart.service.js.map +1 -0
  130. package/dist/services/autostart/macos-launch-agent-autostart.service.d.ts +55 -0
  131. package/dist/services/autostart/macos-launch-agent-autostart.service.d.ts.map +1 -0
  132. package/dist/services/autostart/macos-launch-agent-autostart.service.js +407 -0
  133. package/dist/services/autostart/macos-launch-agent-autostart.service.js.map +1 -0
  134. package/dist/services/autostart/windows-task-autostart.service.d.ts +55 -0
  135. package/dist/services/autostart/windows-task-autostart.service.d.ts.map +1 -0
  136. package/dist/services/autostart/windows-task-autostart.service.js +406 -0
  137. package/dist/services/autostart/windows-task-autostart.service.js.map +1 -0
  138. package/dist/services/channel/channel-list-view.service.d.ts +29 -0
  139. package/dist/services/channel/channel-list-view.service.d.ts.map +1 -0
  140. package/dist/services/channel/channel-list-view.service.js +53 -0
  141. package/dist/services/channel/channel-list-view.service.js.map +1 -0
  142. package/dist/services/config/config-commands.service.d.ts +17 -0
  143. package/dist/services/config/config-commands.service.d.ts.map +1 -0
  144. package/dist/services/config/config-commands.service.js +117 -0
  145. package/dist/services/config/config-commands.service.js.map +1 -0
  146. package/dist/services/cron/cron-commands.service.d.ts +23 -0
  147. package/dist/services/cron/cron-commands.service.d.ts.map +1 -0
  148. package/dist/services/cron/cron-commands.service.js +109 -0
  149. package/dist/services/cron/cron-commands.service.js.map +1 -0
  150. package/dist/services/cron/cron-local.service.d.ts +26 -0
  151. package/dist/services/cron/cron-local.service.d.ts.map +1 -0
  152. package/dist/services/cron/cron-local.service.js +89 -0
  153. package/dist/services/cron/cron-local.service.js.map +1 -0
  154. package/dist/services/diagnostics/diagnostics-commands.service.d.ts +25 -0
  155. package/dist/services/diagnostics/diagnostics-commands.service.d.ts.map +1 -0
  156. package/dist/services/diagnostics/diagnostics-commands.service.js +345 -0
  157. package/dist/services/diagnostics/diagnostics-commands.service.js.map +1 -0
  158. package/dist/services/gateway/gateway-restart-wake.service.d.ts +13 -0
  159. package/dist/services/gateway/gateway-restart-wake.service.d.ts.map +1 -0
  160. package/dist/services/gateway/gateway-restart-wake.service.js +99 -0
  161. package/dist/services/gateway/gateway-restart-wake.service.js.map +1 -0
  162. package/dist/services/gateway/nextclaw-app.service.d.ts +18 -0
  163. package/dist/services/gateway/nextclaw-app.service.d.ts.map +1 -0
  164. package/dist/services/gateway/nextclaw-app.service.js +44 -0
  165. package/dist/services/gateway/nextclaw-app.service.js.map +1 -0
  166. package/dist/services/gateway/service-bootstrap-status.service.d.ts +33 -0
  167. package/dist/services/gateway/service-bootstrap-status.service.d.ts.map +1 -0
  168. package/dist/services/gateway/service-bootstrap-status.service.js +144 -0
  169. package/dist/services/gateway/service-bootstrap-status.service.js.map +1 -0
  170. package/dist/services/gateway/service-startup-support.service.d.ts +35 -0
  171. package/dist/services/gateway/service-startup-support.service.d.ts.map +1 -0
  172. package/dist/services/gateway/service-startup-support.service.js +83 -0
  173. package/dist/services/gateway/service-startup-support.service.js.map +1 -0
  174. package/dist/services/marketplace/service-marketplace-installer.service.d.ts +29 -0
  175. package/dist/services/marketplace/service-marketplace-installer.service.d.ts.map +1 -0
  176. package/dist/services/marketplace/service-marketplace-installer.service.js +87 -0
  177. package/dist/services/marketplace/service-marketplace-installer.service.js.map +1 -0
  178. package/dist/services/marketplace/service-mcp-marketplace-ops.service.d.ts +40 -0
  179. package/dist/services/marketplace/service-mcp-marketplace-ops.service.d.ts.map +1 -0
  180. package/dist/services/marketplace/service-mcp-marketplace-ops.service.js +69 -0
  181. package/dist/services/marketplace/service-mcp-marketplace-ops.service.js.map +1 -0
  182. package/dist/services/marketplace/skills-query.service.d.ts +110 -0
  183. package/dist/services/marketplace/skills-query.service.d.ts.map +1 -0
  184. package/dist/services/marketplace/skills-query.service.js +132 -0
  185. package/dist/services/marketplace/skills-query.service.js.map +1 -0
  186. package/dist/services/platform-auth/account-status.service.d.ts +20 -0
  187. package/dist/services/platform-auth/account-status.service.d.ts.map +1 -0
  188. package/dist/services/platform-auth/account-status.service.js +36 -0
  189. package/dist/services/platform-auth/account-status.service.js.map +1 -0
  190. package/dist/services/platform-auth/platform-auth-commands.service.d.ts +78 -0
  191. package/dist/services/platform-auth/platform-auth-commands.service.d.ts.map +1 -0
  192. package/dist/services/platform-auth/platform-auth-commands.service.js +297 -0
  193. package/dist/services/platform-auth/platform-auth-commands.service.js.map +1 -0
  194. package/dist/services/remote/remote-access-host.service.d.ts +42 -0
  195. package/dist/services/remote/remote-access-host.service.d.ts.map +1 -0
  196. package/dist/services/remote/remote-access-host.service.js +128 -0
  197. package/dist/services/remote/remote-access-host.service.js.map +1 -0
  198. package/dist/services/remote/remote-service-control.service.d.ts +34 -0
  199. package/dist/services/remote/remote-service-control.service.d.ts.map +1 -0
  200. package/dist/services/remote/remote-service-control.service.js +247 -0
  201. package/dist/services/remote/remote-service-control.service.js.map +1 -0
  202. package/dist/services/restart/restart-coordinator.service.d.ts +31 -0
  203. package/dist/services/restart/restart-coordinator.service.d.ts.map +1 -0
  204. package/dist/services/restart/restart-coordinator.service.js +53 -0
  205. package/dist/services/restart/restart-coordinator.service.js.map +1 -0
  206. package/dist/services/runtime/managed-service-supervisor.service.d.ts +85 -0
  207. package/dist/services/runtime/managed-service-supervisor.service.d.ts.map +1 -0
  208. package/dist/services/runtime/managed-service-supervisor.service.js +271 -0
  209. package/dist/services/runtime/managed-service-supervisor.service.js.map +1 -0
  210. package/dist/services/runtime/nextclaw-distribution.service.d.ts +11 -0
  211. package/dist/services/runtime/nextclaw-distribution.service.d.ts.map +1 -0
  212. package/dist/services/runtime/nextclaw-distribution.service.js +15 -0
  213. package/dist/services/runtime/nextclaw-distribution.service.js.map +1 -0
  214. package/dist/services/runtime/npm-runtime-bundle-manifest.service.d.ts +10 -0
  215. package/dist/services/runtime/npm-runtime-bundle-manifest.service.d.ts.map +1 -0
  216. package/dist/services/runtime/npm-runtime-bundle-manifest.service.js +41 -0
  217. package/dist/services/runtime/npm-runtime-bundle-manifest.service.js.map +1 -0
  218. package/dist/services/runtime/npm-runtime-bundle.service.d.ts +48 -0
  219. package/dist/services/runtime/npm-runtime-bundle.service.d.ts.map +1 -0
  220. package/dist/services/runtime/npm-runtime-bundle.service.js +152 -0
  221. package/dist/services/runtime/npm-runtime-bundle.service.js.map +1 -0
  222. package/dist/services/runtime/npm-runtime-update-command.service.d.ts +16 -0
  223. package/dist/services/runtime/npm-runtime-update-command.service.d.ts.map +1 -0
  224. package/dist/services/runtime/npm-runtime-update-command.service.js +120 -0
  225. package/dist/services/runtime/npm-runtime-update-command.service.js.map +1 -0
  226. package/dist/services/runtime/npm-runtime-update-host.service.d.ts +41 -0
  227. package/dist/services/runtime/npm-runtime-update-host.service.d.ts.map +1 -0
  228. package/dist/services/runtime/npm-runtime-update-host.service.js +189 -0
  229. package/dist/services/runtime/npm-runtime-update-host.service.js.map +1 -0
  230. package/dist/services/runtime/npm-runtime-update-source.service.d.ts +22 -0
  231. package/dist/services/runtime/npm-runtime-update-source.service.d.ts.map +1 -0
  232. package/dist/services/runtime/npm-runtime-update-source.service.js +61 -0
  233. package/dist/services/runtime/npm-runtime-update-source.service.js.map +1 -0
  234. package/dist/services/runtime/npm-runtime-update.service.d.ts +55 -0
  235. package/dist/services/runtime/npm-runtime-update.service.d.ts.map +1 -0
  236. package/dist/services/runtime/npm-runtime-update.service.js +185 -0
  237. package/dist/services/runtime/npm-runtime-update.service.js.map +1 -0
  238. package/dist/services/runtime/runtime-config-init.service.d.ts +5 -0
  239. package/dist/services/runtime/runtime-config-init.service.d.ts.map +1 -0
  240. package/dist/services/runtime/runtime-config-init.service.js +12 -0
  241. package/dist/services/runtime/runtime-config-init.service.js.map +1 -0
  242. package/dist/services/runtime/service-managed-startup.service.d.ts +95 -0
  243. package/dist/services/runtime/service-managed-startup.service.d.ts.map +1 -0
  244. package/dist/services/runtime/service-managed-startup.service.js +341 -0
  245. package/dist/services/runtime/service-managed-startup.service.js.map +1 -0
  246. package/dist/services/ui/companion-runtime.service.d.ts +36 -0
  247. package/dist/services/ui/companion-runtime.service.d.ts.map +1 -0
  248. package/dist/services/ui/companion-runtime.service.js +180 -0
  249. package/dist/services/ui/companion-runtime.service.js.map +1 -0
  250. package/dist/services/ui/local-ui-discovery.service.d.ts +20 -0
  251. package/dist/services/ui/local-ui-discovery.service.d.ts.map +1 -0
  252. package/dist/services/ui/local-ui-discovery.service.js +43 -0
  253. package/dist/services/ui/local-ui-discovery.service.js.map +1 -0
  254. package/dist/services/ui/runtime-control-host.service.d.ts +29 -0
  255. package/dist/services/ui/runtime-control-host.service.d.ts.map +1 -0
  256. package/dist/services/ui/runtime-control-host.service.js +91 -0
  257. package/dist/services/ui/runtime-control-host.service.js.map +1 -0
  258. package/dist/services/ui/service-remote-access.service.d.ts +26 -0
  259. package/dist/services/ui/service-remote-access.service.d.ts.map +1 -0
  260. package/dist/services/ui/service-remote-access.service.js +40 -0
  261. package/dist/services/ui/service-remote-access.service.js.map +1 -0
  262. package/dist/services/ui/ui-bridge-api.service.d.ts +17 -0
  263. package/dist/services/ui/ui-bridge-api.service.d.ts.map +1 -0
  264. package/dist/services/ui/ui-bridge-api.service.js +45 -0
  265. package/dist/services/ui/ui-bridge-api.service.js.map +1 -0
  266. package/dist/services/usage/llm-usage-command.service.d.ts +21 -0
  267. package/dist/services/usage/llm-usage-command.service.d.ts.map +1 -0
  268. package/dist/services/usage/llm-usage-command.service.js +152 -0
  269. package/dist/services/usage/llm-usage-command.service.js.map +1 -0
  270. package/dist/stores/companion-runtime.store.d.ts +16 -0
  271. package/dist/stores/companion-runtime.store.d.ts.map +1 -0
  272. package/dist/stores/companion-runtime.store.js +29 -0
  273. package/dist/stores/companion-runtime.store.js.map +1 -0
  274. package/dist/stores/local-ui-runtime.store.d.ts +26 -0
  275. package/dist/stores/local-ui-runtime.store.d.ts.map +1 -0
  276. package/dist/stores/local-ui-runtime.store.js +56 -0
  277. package/dist/stores/local-ui-runtime.store.js.map +1 -0
  278. package/dist/stores/managed-service-state.store.d.ts +46 -0
  279. package/dist/stores/managed-service-state.store.d.ts.map +1 -0
  280. package/dist/stores/managed-service-state.store.js +40 -0
  281. package/dist/stores/managed-service-state.store.js.map +1 -0
  282. package/dist/stores/marketplace-install-state.store.d.ts +39 -0
  283. package/dist/stores/marketplace-install-state.store.d.ts.map +1 -0
  284. package/dist/stores/marketplace-install-state.store.js +58 -0
  285. package/dist/stores/marketplace-install-state.store.js.map +1 -0
  286. package/dist/stores/npm-runtime-bundle-layout.store.d.ts +24 -0
  287. package/dist/stores/npm-runtime-bundle-layout.store.d.ts.map +1 -0
  288. package/dist/stores/npm-runtime-bundle-layout.store.js +39 -0
  289. package/dist/stores/npm-runtime-bundle-layout.store.js.map +1 -0
  290. package/dist/stores/npm-runtime-update-state.store.d.ts +18 -0
  291. package/dist/stores/npm-runtime-update-state.store.d.ts.map +1 -0
  292. package/dist/stores/npm-runtime-update-state.store.js +94 -0
  293. package/dist/stores/npm-runtime-update-state.store.js.map +1 -0
  294. package/dist/stores/pending-restart.store.d.ts +22 -0
  295. package/dist/stores/pending-restart.store.d.ts.map +1 -0
  296. package/dist/stores/pending-restart.store.js +37 -0
  297. package/dist/stores/pending-restart.store.js.map +1 -0
  298. package/dist/types/cli.types.d.ts +304 -0
  299. package/dist/types/cli.types.d.ts.map +1 -0
  300. package/dist/types/distribution.types.d.ts +11 -0
  301. package/dist/types/distribution.types.d.ts.map +1 -0
  302. package/dist/types/host-autostart.types.d.ts +65 -0
  303. package/dist/types/host-autostart.types.d.ts.map +1 -0
  304. package/dist/types/npm-runtime-bundle.types.d.ts +50 -0
  305. package/dist/types/npm-runtime-bundle.types.d.ts.map +1 -0
  306. package/dist/utils/agent-runtime.utils.d.ts +15 -0
  307. package/dist/utils/agent-runtime.utils.d.ts.map +1 -0
  308. package/dist/utils/agent-runtime.utils.js +40 -0
  309. package/dist/utils/agent-runtime.utils.js.map +1 -0
  310. package/dist/utils/channel-config-view.utils.d.ts +7 -0
  311. package/dist/utils/channel-config-view.utils.d.ts.map +1 -0
  312. package/dist/utils/channel-config-view.utils.js +9 -0
  313. package/dist/utils/channel-config-view.utils.js.map +1 -0
  314. package/dist/utils/cli-agent-runner.utils.d.ts +14 -0
  315. package/dist/utils/cli-agent-runner.utils.d.ts.map +1 -0
  316. package/dist/utils/cli-agent-runner.utils.js +94 -0
  317. package/dist/utils/cli-agent-runner.utils.js.map +1 -0
  318. package/dist/utils/cli.utils.d.ts +32 -0
  319. package/dist/utils/cli.utils.d.ts.map +1 -0
  320. package/dist/utils/cli.utils.js +254 -0
  321. package/dist/utils/cli.utils.js.map +1 -0
  322. package/dist/utils/config-path.utils.d.ts +16 -0
  323. package/dist/utils/config-path.utils.d.ts.map +1 -0
  324. package/dist/utils/config-path.utils.js +169 -0
  325. package/dist/utils/config-path.utils.js.map +1 -0
  326. package/dist/utils/cron/cron-job.utils.d.ts +28 -0
  327. package/dist/utils/cron/cron-job.utils.d.ts.map +1 -0
  328. package/dist/utils/cron/cron-job.utils.js +17 -0
  329. package/dist/utils/cron/cron-job.utils.js.map +1 -0
  330. package/dist/utils/diagnostics/diagnostics-render.utils.d.ts +24 -0
  331. package/dist/utils/diagnostics/diagnostics-render.utils.d.ts.map +1 -0
  332. package/dist/utils/diagnostics/diagnostics-render.utils.js +74 -0
  333. package/dist/utils/diagnostics/diagnostics-render.utils.js.map +1 -0
  334. package/dist/utils/gateway-cron-job-handler.utils.d.ts +18 -0
  335. package/dist/utils/gateway-cron-job-handler.utils.d.ts.map +1 -0
  336. package/dist/utils/gateway-cron-job-handler.utils.js +56 -0
  337. package/dist/utils/gateway-cron-job-handler.utils.js.map +1 -0
  338. package/dist/utils/gateway-runtime-lifecycle.utils.d.ts +10 -0
  339. package/dist/utils/gateway-runtime-lifecycle.utils.d.ts.map +1 -0
  340. package/dist/utils/gateway-runtime-lifecycle.utils.js +12 -0
  341. package/dist/utils/gateway-runtime-lifecycle.utils.js.map +1 -0
  342. package/dist/utils/marketplace/cli-subcommand-launch.utils.d.ts +17 -0
  343. package/dist/utils/marketplace/cli-subcommand-launch.utils.d.ts.map +1 -0
  344. package/dist/utils/marketplace/cli-subcommand-launch.utils.js +48 -0
  345. package/dist/utils/marketplace/cli-subcommand-launch.utils.js.map +1 -0
  346. package/dist/utils/marketplace/marketplace-client.utils.d.ts +46 -0
  347. package/dist/utils/marketplace/marketplace-client.utils.d.ts.map +1 -0
  348. package/dist/utils/marketplace/marketplace-client.utils.js +137 -0
  349. package/dist/utils/marketplace/marketplace-client.utils.js.map +1 -0
  350. package/dist/utils/marketplace/marketplace-command-options.utils.d.ts +26 -0
  351. package/dist/utils/marketplace/marketplace-command-options.utils.d.ts.map +1 -0
  352. package/dist/utils/marketplace/marketplace-command-options.utils.js +33 -0
  353. package/dist/utils/marketplace/marketplace-command-options.utils.js.map +1 -0
  354. package/dist/utils/marketplace/marketplace-identity.utils.d.ts +15 -0
  355. package/dist/utils/marketplace/marketplace-identity.utils.d.ts.map +1 -0
  356. package/dist/utils/marketplace/marketplace-identity.utils.js +79 -0
  357. package/dist/utils/marketplace/marketplace-identity.utils.js.map +1 -0
  358. package/dist/utils/marketplace/marketplace-metadata.utils.d.ts +21 -0
  359. package/dist/utils/marketplace/marketplace-metadata.utils.d.ts.map +1 -0
  360. package/dist/utils/marketplace/marketplace-metadata.utils.js +74 -0
  361. package/dist/utils/marketplace/marketplace-metadata.utils.js.map +1 -0
  362. package/dist/utils/marketplace/marketplace-network-retry.utils.d.ts +5 -0
  363. package/dist/utils/marketplace/marketplace-network-retry.utils.d.ts.map +1 -0
  364. package/dist/utils/marketplace/marketplace-network-retry.utils.js +34 -0
  365. package/dist/utils/marketplace/marketplace-network-retry.utils.js.map +1 -0
  366. package/dist/utils/marketplace/marketplace-skill-lifecycle.utils.d.ts +27 -0
  367. package/dist/utils/marketplace/marketplace-skill-lifecycle.utils.d.ts.map +1 -0
  368. package/dist/utils/marketplace/marketplace-skill-lifecycle.utils.js +206 -0
  369. package/dist/utils/marketplace/marketplace-skill-lifecycle.utils.js.map +1 -0
  370. package/dist/utils/marketplace/marketplace.utils.d.ts +34 -0
  371. package/dist/utils/marketplace/marketplace.utils.d.ts.map +1 -0
  372. package/dist/utils/marketplace/marketplace.utils.js +77 -0
  373. package/dist/utils/marketplace/marketplace.utils.js.map +1 -0
  374. package/dist/utils/marketplace/service-marketplace-helpers.utils.d.ts +15 -0
  375. package/dist/utils/marketplace/service-marketplace-helpers.utils.d.ts.map +1 -0
  376. package/dist/utils/marketplace/service-marketplace-helpers.utils.js +47 -0
  377. package/dist/utils/marketplace/service-marketplace-helpers.utils.js.map +1 -0
  378. package/dist/utils/package/package-manifest.utils.d.ts +5 -0
  379. package/dist/utils/package/package-manifest.utils.d.ts.map +1 -0
  380. package/dist/utils/package/package-manifest.utils.js +40 -0
  381. package/dist/utils/package/package-manifest.utils.js.map +1 -0
  382. package/dist/utils/panel-app-client-sdk/panel-app-client-sdk-script.utils.d.ts +5 -0
  383. package/dist/utils/panel-app-client-sdk/panel-app-client-sdk-script.utils.d.ts.map +1 -0
  384. package/dist/utils/panel-app-client-sdk/panel-app-client-sdk-script.utils.js +37 -0
  385. package/dist/utils/panel-app-client-sdk/panel-app-client-sdk-script.utils.js.map +1 -0
  386. package/dist/utils/platform-auth/payload.utils.d.ts +30 -0
  387. package/dist/utils/platform-auth/payload.utils.d.ts.map +1 -0
  388. package/dist/utils/platform-auth/payload.utils.js +89 -0
  389. package/dist/utils/platform-auth/payload.utils.js.map +1 -0
  390. package/dist/utils/remote/platform-api-base.utils.d.ts +15 -0
  391. package/dist/utils/remote/platform-api-base.utils.d.ts.map +1 -0
  392. package/dist/utils/remote/platform-api-base.utils.js +41 -0
  393. package/dist/utils/remote/platform-api-base.utils.js.map +1 -0
  394. package/dist/utils/remote/remote-runtime-support.utils.d.ts +16 -0
  395. package/dist/utils/remote/remote-runtime-support.utils.d.ts.map +1 -0
  396. package/dist/utils/remote/remote-runtime-support.utils.js +82 -0
  397. package/dist/utils/remote/remote-runtime-support.utils.js.map +1 -0
  398. package/dist/utils/restart-sentinel.utils.d.ts +37 -0
  399. package/dist/utils/restart-sentinel.utils.d.ts.map +1 -0
  400. package/dist/utils/restart-sentinel.utils.js +76 -0
  401. package/dist/utils/restart-sentinel.utils.js.map +1 -0
  402. package/dist/utils/runtime/managed-service-routing.utils.d.ts +31 -0
  403. package/dist/utils/runtime/managed-service-routing.utils.d.ts.map +1 -0
  404. package/dist/utils/runtime/managed-service-routing.utils.js +64 -0
  405. package/dist/utils/runtime/managed-service-routing.utils.js.map +1 -0
  406. package/dist/utils/runtime/service-remote-runtime.utils.d.ts +58 -0
  407. package/dist/utils/runtime/service-remote-runtime.utils.d.ts.map +1 -0
  408. package/dist/utils/runtime/service-remote-runtime.utils.js +184 -0
  409. package/dist/utils/runtime/service-remote-runtime.utils.js.map +1 -0
  410. package/dist/utils/runtime-helpers.utils.d.ts +15 -0
  411. package/dist/utils/runtime-helpers.utils.d.ts.map +1 -0
  412. package/dist/utils/runtime-helpers.utils.js +28 -0
  413. package/dist/utils/runtime-helpers.utils.js.map +1 -0
  414. package/dist/utils/service-port-probe.utils.d.ts +42 -0
  415. package/dist/utils/service-port-probe.utils.d.ts.map +1 -0
  416. package/dist/utils/service-port-probe.utils.js +166 -0
  417. package/dist/utils/service-port-probe.utils.js.map +1 -0
  418. package/dist/utils/startup-trace.utils.d.ts +8 -0
  419. package/dist/utils/startup-trace.utils.d.ts.map +1 -0
  420. package/dist/utils/startup-trace.utils.js +39 -0
  421. package/dist/utils/startup-trace.utils.js.map +1 -0
  422. package/dist/utils/top-level-nextclaw-command-env.utils.d.ts +5 -0
  423. package/dist/utils/top-level-nextclaw-command-env.utils.d.ts.map +1 -0
  424. package/dist/utils/top-level-nextclaw-command-env.utils.js +12 -0
  425. package/dist/utils/top-level-nextclaw-command-env.utils.js.map +1 -0
  426. package/package.json +26 -26
  427. package/dist/cli/commands/agent/agent-runtime.utils.d.ts +0 -15
  428. package/dist/cli/commands/agent/agent-runtime.utils.d.ts.map +0 -1
  429. package/dist/cli/commands/agent/agent-runtime.utils.js +0 -43
  430. package/dist/cli/commands/agent/agent-runtime.utils.js.map +0 -1
  431. package/dist/cli/commands/agent/cli-agent-runner.utils.d.ts +0 -14
  432. package/dist/cli/commands/agent/cli-agent-runner.utils.d.ts.map +0 -1
  433. package/dist/cli/commands/agent/cli-agent-runner.utils.js +0 -94
  434. package/dist/cli/commands/agent/cli-agent-runner.utils.js.map +0 -1
  435. package/dist/cli/commands/agent/index.d.ts +0 -3
  436. package/dist/cli/commands/agent/index.js +0 -3
  437. package/dist/cli/commands/agent/services/agent-commands.service.d.ts +0 -18
  438. package/dist/cli/commands/agent/services/agent-commands.service.d.ts.map +0 -1
  439. package/dist/cli/commands/agent/services/agent-commands.service.js +0 -113
  440. package/dist/cli/commands/agent/services/agent-commands.service.js.map +0 -1
  441. package/dist/cli/commands/config/index.d.ts +0 -2
  442. package/dist/cli/commands/config/index.js +0 -2
  443. package/dist/cli/commands/config/services/config-commands.service.d.ts +0 -17
  444. package/dist/cli/commands/config/services/config-commands.service.d.ts.map +0 -1
  445. package/dist/cli/commands/config/services/config-commands.service.js +0 -117
  446. package/dist/cli/commands/config/services/config-commands.service.js.map +0 -1
  447. package/dist/cli/commands/cron/index.d.ts +0 -2
  448. package/dist/cli/commands/cron/index.js +0 -2
  449. package/dist/cli/commands/cron/services/cron-commands.service.d.ts +0 -23
  450. package/dist/cli/commands/cron/services/cron-commands.service.d.ts.map +0 -1
  451. package/dist/cli/commands/cron/services/cron-commands.service.js +0 -109
  452. package/dist/cli/commands/cron/services/cron-commands.service.js.map +0 -1
  453. package/dist/cli/commands/cron/services/cron-local.service.d.ts +0 -26
  454. package/dist/cli/commands/cron/services/cron-local.service.d.ts.map +0 -1
  455. package/dist/cli/commands/cron/services/cron-local.service.js +0 -89
  456. package/dist/cli/commands/cron/services/cron-local.service.js.map +0 -1
  457. package/dist/cli/commands/cron/utils/cron-job.utils.d.ts +0 -28
  458. package/dist/cli/commands/cron/utils/cron-job.utils.d.ts.map +0 -1
  459. package/dist/cli/commands/cron/utils/cron-job.utils.js +0 -17
  460. package/dist/cli/commands/cron/utils/cron-job.utils.js.map +0 -1
  461. package/dist/cli/commands/diagnostics/index.d.ts +0 -2
  462. package/dist/cli/commands/diagnostics/index.js +0 -2
  463. package/dist/cli/commands/diagnostics/services/diagnostics-commands.service.d.ts +0 -25
  464. package/dist/cli/commands/diagnostics/services/diagnostics-commands.service.d.ts.map +0 -1
  465. package/dist/cli/commands/diagnostics/services/diagnostics-commands.service.js +0 -345
  466. package/dist/cli/commands/diagnostics/services/diagnostics-commands.service.js.map +0 -1
  467. package/dist/cli/commands/diagnostics/utils/diagnostics-render.utils.d.ts +0 -24
  468. package/dist/cli/commands/diagnostics/utils/diagnostics-render.utils.d.ts.map +0 -1
  469. package/dist/cli/commands/diagnostics/utils/diagnostics-render.utils.js +0 -74
  470. package/dist/cli/commands/diagnostics/utils/diagnostics-render.utils.js.map +0 -1
  471. package/dist/cli/commands/gateway/index.d.ts +0 -15
  472. package/dist/cli/commands/gateway/index.d.ts.map +0 -1
  473. package/dist/cli/commands/gateway/index.js +0 -17
  474. package/dist/cli/commands/gateway/index.js.map +0 -1
  475. package/dist/cli/commands/logs/index.d.ts +0 -13
  476. package/dist/cli/commands/logs/index.d.ts.map +0 -1
  477. package/dist/cli/commands/logs/index.js +0 -31
  478. package/dist/cli/commands/logs/index.js.map +0 -1
  479. package/dist/cli/commands/mcp/index.d.ts +0 -15
  480. package/dist/cli/commands/mcp/index.d.ts.map +0 -1
  481. package/dist/cli/commands/mcp/index.js +0 -195
  482. package/dist/cli/commands/mcp/index.js.map +0 -1
  483. package/dist/cli/commands/restart/index.d.ts +0 -21
  484. package/dist/cli/commands/restart/index.d.ts.map +0 -1
  485. package/dist/cli/commands/restart/index.js +0 -90
  486. package/dist/cli/commands/restart/index.js.map +0 -1
  487. package/dist/cli/commands/secrets/index.d.ts +0 -23
  488. package/dist/cli/commands/secrets/index.d.ts.map +0 -1
  489. package/dist/cli/commands/secrets/index.js +0 -282
  490. package/dist/cli/commands/secrets/index.js.map +0 -1
  491. package/dist/cli/commands/serve/index.d.ts +0 -15
  492. package/dist/cli/commands/serve/index.d.ts.map +0 -1
  493. package/dist/cli/commands/serve/index.js +0 -21
  494. package/dist/cli/commands/serve/index.js.map +0 -1
  495. package/dist/cli/commands/skills/index.d.ts +0 -28
  496. package/dist/cli/commands/skills/index.d.ts.map +0 -1
  497. package/dist/cli/commands/skills/index.js +0 -170
  498. package/dist/cli/commands/skills/index.js.map +0 -1
  499. package/dist/cli/commands/skills/marketplace-client.d.ts +0 -46
  500. package/dist/cli/commands/skills/marketplace-client.d.ts.map +0 -1
  501. package/dist/cli/commands/skills/marketplace-client.js +0 -137
  502. package/dist/cli/commands/skills/marketplace-client.js.map +0 -1
  503. package/dist/cli/commands/skills/marketplace-command-options.utils.d.ts +0 -26
  504. package/dist/cli/commands/skills/marketplace-command-options.utils.d.ts.map +0 -1
  505. package/dist/cli/commands/skills/marketplace-command-options.utils.js +0 -33
  506. package/dist/cli/commands/skills/marketplace-command-options.utils.js.map +0 -1
  507. package/dist/cli/commands/skills/marketplace-identity.utils.d.ts +0 -15
  508. package/dist/cli/commands/skills/marketplace-identity.utils.d.ts.map +0 -1
  509. package/dist/cli/commands/skills/marketplace-identity.utils.js +0 -79
  510. package/dist/cli/commands/skills/marketplace-identity.utils.js.map +0 -1
  511. package/dist/cli/commands/skills/marketplace-network-retry.d.ts +0 -5
  512. package/dist/cli/commands/skills/marketplace-network-retry.d.ts.map +0 -1
  513. package/dist/cli/commands/skills/marketplace-network-retry.js +0 -34
  514. package/dist/cli/commands/skills/marketplace-network-retry.js.map +0 -1
  515. package/dist/cli/commands/skills/marketplace.metadata.d.ts +0 -21
  516. package/dist/cli/commands/skills/marketplace.metadata.d.ts.map +0 -1
  517. package/dist/cli/commands/skills/marketplace.metadata.js +0 -74
  518. package/dist/cli/commands/skills/marketplace.metadata.js.map +0 -1
  519. package/dist/cli/commands/skills/marketplace.utils.d.ts +0 -34
  520. package/dist/cli/commands/skills/marketplace.utils.d.ts.map +0 -1
  521. package/dist/cli/commands/skills/marketplace.utils.js +0 -77
  522. package/dist/cli/commands/skills/marketplace.utils.js.map +0 -1
  523. package/dist/cli/commands/skills/skills-query.service.d.ts +0 -110
  524. package/dist/cli/commands/skills/skills-query.service.d.ts.map +0 -1
  525. package/dist/cli/commands/skills/skills-query.service.js +0 -132
  526. package/dist/cli/commands/skills/skills-query.service.js.map +0 -1
  527. package/dist/cli/commands/skills/stores/marketplace-install-state.store.d.ts +0 -39
  528. package/dist/cli/commands/skills/stores/marketplace-install-state.store.d.ts.map +0 -1
  529. package/dist/cli/commands/skills/stores/marketplace-install-state.store.js +0 -58
  530. package/dist/cli/commands/skills/stores/marketplace-install-state.store.js.map +0 -1
  531. package/dist/cli/commands/skills/utils/marketplace-skill-lifecycle.utils.d.ts +0 -27
  532. package/dist/cli/commands/skills/utils/marketplace-skill-lifecycle.utils.d.ts.map +0 -1
  533. package/dist/cli/commands/skills/utils/marketplace-skill-lifecycle.utils.js +0 -206
  534. package/dist/cli/commands/skills/utils/marketplace-skill-lifecycle.utils.js.map +0 -1
  535. package/dist/cli/commands/start/index.d.ts +0 -19
  536. package/dist/cli/commands/start/index.d.ts.map +0 -1
  537. package/dist/cli/commands/start/index.js +0 -27
  538. package/dist/cli/commands/start/index.js.map +0 -1
  539. package/dist/cli/commands/stop/index.d.ts +0 -13
  540. package/dist/cli/commands/stop/index.d.ts.map +0 -1
  541. package/dist/cli/commands/stop/index.js +0 -13
  542. package/dist/cli/commands/stop/index.js.map +0 -1
  543. package/dist/cli/commands/ui/index.d.ts +0 -15
  544. package/dist/cli/commands/ui/index.d.ts.map +0 -1
  545. package/dist/cli/commands/ui/index.js +0 -19
  546. package/dist/cli/commands/ui/index.js.map +0 -1
  547. package/dist/cli/commands/usage/index.d.ts +0 -2
  548. package/dist/cli/commands/usage/index.js +0 -2
  549. package/dist/cli/commands/usage/services/llm-usage-command.service.d.ts +0 -21
  550. package/dist/cli/commands/usage/services/llm-usage-command.service.d.ts.map +0 -1
  551. package/dist/cli/commands/usage/services/llm-usage-command.service.js +0 -152
  552. package/dist/cli/commands/usage/services/llm-usage-command.service.js.map +0 -1
  553. package/dist/commands/channel/channel-config-view.utils.d.ts +0 -7
  554. package/dist/commands/channel/channel-config-view.utils.d.ts.map +0 -1
  555. package/dist/commands/channel/channel-config-view.utils.js +0 -9
  556. package/dist/commands/channel/channel-config-view.utils.js.map +0 -1
  557. package/dist/commands/channel/channel-list-view.service.d.ts +0 -29
  558. package/dist/commands/channel/channel-list-view.service.d.ts.map +0 -1
  559. package/dist/commands/channel/channel-list-view.service.js +0 -53
  560. package/dist/commands/channel/channel-list-view.service.js.map +0 -1
  561. package/dist/commands/channel/index.d.ts +0 -21
  562. package/dist/commands/channel/index.d.ts.map +0 -1
  563. package/dist/commands/channel/index.js +0 -115
  564. package/dist/commands/channel/index.js.map +0 -1
  565. package/dist/commands/platform-auth/index.d.ts +0 -2
  566. package/dist/commands/platform-auth/index.js +0 -2
  567. package/dist/commands/platform-auth/services/account-status.service.d.ts +0 -19
  568. package/dist/commands/platform-auth/services/account-status.service.d.ts.map +0 -1
  569. package/dist/commands/platform-auth/services/account-status.service.js +0 -36
  570. package/dist/commands/platform-auth/services/account-status.service.js.map +0 -1
  571. package/dist/commands/platform-auth/services/platform-auth-commands.service.d.ts +0 -78
  572. package/dist/commands/platform-auth/services/platform-auth-commands.service.d.ts.map +0 -1
  573. package/dist/commands/platform-auth/services/platform-auth-commands.service.js +0 -297
  574. package/dist/commands/platform-auth/services/platform-auth-commands.service.js.map +0 -1
  575. package/dist/commands/platform-auth/utils/payload.utils.d.ts +0 -29
  576. package/dist/commands/platform-auth/utils/payload.utils.d.ts.map +0 -1
  577. package/dist/commands/platform-auth/utils/payload.utils.js +0 -89
  578. package/dist/commands/platform-auth/utils/payload.utils.js.map +0 -1
  579. package/dist/commands/remote/index.d.ts +0 -48
  580. package/dist/commands/remote/index.d.ts.map +0 -1
  581. package/dist/commands/remote/index.js +0 -176
  582. package/dist/commands/remote/index.js.map +0 -1
  583. package/dist/commands/remote/services/remote-access-host.service.d.ts +0 -42
  584. package/dist/commands/remote/services/remote-access-host.service.d.ts.map +0 -1
  585. package/dist/commands/remote/services/remote-access-host.service.js +0 -128
  586. package/dist/commands/remote/services/remote-access-host.service.js.map +0 -1
  587. package/dist/commands/remote/services/remote-service-control.service.d.ts +0 -34
  588. package/dist/commands/remote/services/remote-service-control.service.d.ts.map +0 -1
  589. package/dist/commands/remote/services/remote-service-control.service.js +0 -247
  590. package/dist/commands/remote/services/remote-service-control.service.js.map +0 -1
  591. package/dist/commands/remote/utils/platform-api-base.utils.d.ts +0 -15
  592. package/dist/commands/remote/utils/platform-api-base.utils.d.ts.map +0 -1
  593. package/dist/commands/remote/utils/platform-api-base.utils.js +0 -41
  594. package/dist/commands/remote/utils/platform-api-base.utils.js.map +0 -1
  595. package/dist/commands/remote/utils/remote-runtime-support.utils.d.ts +0 -16
  596. package/dist/commands/remote/utils/remote-runtime-support.utils.d.ts.map +0 -1
  597. package/dist/commands/remote/utils/remote-runtime-support.utils.js +0 -82
  598. package/dist/commands/remote/utils/remote-runtime-support.utils.js.map +0 -1
  599. package/dist/commands/service/index.d.ts +0 -17
  600. package/dist/commands/service/index.d.ts.map +0 -1
  601. package/dist/commands/service/index.js +0 -33
  602. package/dist/commands/service/index.js.map +0 -1
  603. package/dist/commands/service/services/autostart/host-autostart-command.service.d.ts +0 -30
  604. package/dist/commands/service/services/autostart/host-autostart-command.service.d.ts.map +0 -1
  605. package/dist/commands/service/services/autostart/host-autostart-command.service.js +0 -160
  606. package/dist/commands/service/services/autostart/host-autostart-command.service.js.map +0 -1
  607. package/dist/commands/service/services/autostart/host-autostart-runtime.service.d.ts +0 -24
  608. package/dist/commands/service/services/autostart/host-autostart-runtime.service.d.ts.map +0 -1
  609. package/dist/commands/service/services/autostart/host-autostart-runtime.service.js +0 -55
  610. package/dist/commands/service/services/autostart/host-autostart-runtime.service.js.map +0 -1
  611. package/dist/commands/service/services/autostart/host-autostart.service.d.ts +0 -42
  612. package/dist/commands/service/services/autostart/host-autostart.service.d.ts.map +0 -1
  613. package/dist/commands/service/services/autostart/host-autostart.service.js +0 -50
  614. package/dist/commands/service/services/autostart/host-autostart.service.js.map +0 -1
  615. package/dist/commands/service/services/autostart/linux-systemd-autostart.service.d.ts +0 -49
  616. package/dist/commands/service/services/autostart/linux-systemd-autostart.service.d.ts.map +0 -1
  617. package/dist/commands/service/services/autostart/linux-systemd-autostart.service.js +0 -435
  618. package/dist/commands/service/services/autostart/linux-systemd-autostart.service.js.map +0 -1
  619. package/dist/commands/service/services/autostart/macos-launch-agent-autostart.service.d.ts +0 -55
  620. package/dist/commands/service/services/autostart/macos-launch-agent-autostart.service.d.ts.map +0 -1
  621. package/dist/commands/service/services/autostart/macos-launch-agent-autostart.service.js +0 -407
  622. package/dist/commands/service/services/autostart/macos-launch-agent-autostart.service.js.map +0 -1
  623. package/dist/commands/service/services/autostart/windows-task-autostart.service.d.ts +0 -55
  624. package/dist/commands/service/services/autostart/windows-task-autostart.service.d.ts.map +0 -1
  625. package/dist/commands/service/services/autostart/windows-task-autostart.service.js +0 -406
  626. package/dist/commands/service/services/autostart/windows-task-autostart.service.js.map +0 -1
  627. package/dist/commands/service/types/autostart/host-autostart.types.d.ts +0 -65
  628. package/dist/commands/service/types/autostart/host-autostart.types.d.ts.map +0 -1
  629. package/dist/launcher/npm-runtime-bundle-layout.store.d.ts +0 -24
  630. package/dist/launcher/npm-runtime-bundle-layout.store.d.ts.map +0 -1
  631. package/dist/launcher/npm-runtime-bundle-layout.store.js +0 -39
  632. package/dist/launcher/npm-runtime-bundle-layout.store.js.map +0 -1
  633. package/dist/launcher/npm-runtime-bundle-manifest.service.d.ts +0 -10
  634. package/dist/launcher/npm-runtime-bundle-manifest.service.d.ts.map +0 -1
  635. package/dist/launcher/npm-runtime-bundle-manifest.service.js +0 -41
  636. package/dist/launcher/npm-runtime-bundle-manifest.service.js.map +0 -1
  637. package/dist/launcher/npm-runtime-bundle.service.d.ts +0 -48
  638. package/dist/launcher/npm-runtime-bundle.service.d.ts.map +0 -1
  639. package/dist/launcher/npm-runtime-bundle.service.js +0 -152
  640. package/dist/launcher/npm-runtime-bundle.service.js.map +0 -1
  641. package/dist/launcher/npm-runtime-bundle.types.d.ts +0 -50
  642. package/dist/launcher/npm-runtime-bundle.types.d.ts.map +0 -1
  643. package/dist/launcher/npm-runtime-update-command.service.d.ts +0 -16
  644. package/dist/launcher/npm-runtime-update-command.service.d.ts.map +0 -1
  645. package/dist/launcher/npm-runtime-update-command.service.js +0 -120
  646. package/dist/launcher/npm-runtime-update-command.service.js.map +0 -1
  647. package/dist/launcher/npm-runtime-update-source.service.d.ts +0 -22
  648. package/dist/launcher/npm-runtime-update-source.service.d.ts.map +0 -1
  649. package/dist/launcher/npm-runtime-update-source.service.js +0 -61
  650. package/dist/launcher/npm-runtime-update-source.service.js.map +0 -1
  651. package/dist/launcher/npm-runtime-update-state.store.d.ts +0 -18
  652. package/dist/launcher/npm-runtime-update-state.store.d.ts.map +0 -1
  653. package/dist/launcher/npm-runtime-update-state.store.js +0 -94
  654. package/dist/launcher/npm-runtime-update-state.store.js.map +0 -1
  655. package/dist/launcher/npm-runtime-update.manager.d.ts +0 -43
  656. package/dist/launcher/npm-runtime-update.manager.d.ts.map +0 -1
  657. package/dist/launcher/npm-runtime-update.manager.js +0 -185
  658. package/dist/launcher/npm-runtime-update.manager.js.map +0 -1
  659. package/dist/launcher/npm-runtime-update.service.d.ts +0 -55
  660. package/dist/launcher/npm-runtime-update.service.d.ts.map +0 -1
  661. package/dist/launcher/npm-runtime-update.service.js +0 -185
  662. package/dist/launcher/npm-runtime-update.service.js.map +0 -1
  663. package/dist/service-runtime.service.d.ts +0 -88
  664. package/dist/service-runtime.service.d.ts.map +0 -1
  665. package/dist/service-runtime.service.js +0 -366
  666. package/dist/service-runtime.service.js.map +0 -1
  667. package/dist/shared/controllers/gateway.controller.d.ts +0 -54
  668. package/dist/shared/controllers/gateway.controller.d.ts.map +0 -1
  669. package/dist/shared/controllers/gateway.controller.js +0 -162
  670. package/dist/shared/controllers/gateway.controller.js.map +0 -1
  671. package/dist/shared/services/gateway/gateway-restart-wake.service.d.ts +0 -13
  672. package/dist/shared/services/gateway/gateway-restart-wake.service.d.ts.map +0 -1
  673. package/dist/shared/services/gateway/gateway-restart-wake.service.js +0 -99
  674. package/dist/shared/services/gateway/gateway-restart-wake.service.js.map +0 -1
  675. package/dist/shared/services/gateway/managers/gateway-extension.manager.d.ts +0 -29
  676. package/dist/shared/services/gateway/managers/gateway-extension.manager.d.ts.map +0 -1
  677. package/dist/shared/services/gateway/managers/gateway-extension.manager.js +0 -78
  678. package/dist/shared/services/gateway/managers/gateway-extension.manager.js.map +0 -1
  679. package/dist/shared/services/gateway/managers/gateway-remote.manager.d.ts +0 -23
  680. package/dist/shared/services/gateway/managers/gateway-remote.manager.d.ts.map +0 -1
  681. package/dist/shared/services/gateway/managers/gateway-remote.manager.js +0 -28
  682. package/dist/shared/services/gateway/managers/gateway-remote.manager.js.map +0 -1
  683. package/dist/shared/services/gateway/nextclaw-app.service.d.ts +0 -18
  684. package/dist/shared/services/gateway/nextclaw-app.service.d.ts.map +0 -1
  685. package/dist/shared/services/gateway/nextclaw-app.service.js +0 -44
  686. package/dist/shared/services/gateway/nextclaw-app.service.js.map +0 -1
  687. package/dist/shared/services/gateway/nextclaw-gateway-runtime.service.d.ts +0 -85
  688. package/dist/shared/services/gateway/nextclaw-gateway-runtime.service.d.ts.map +0 -1
  689. package/dist/shared/services/gateway/nextclaw-gateway-runtime.service.js +0 -278
  690. package/dist/shared/services/gateway/nextclaw-gateway-runtime.service.js.map +0 -1
  691. package/dist/shared/services/gateway/service-bootstrap-status.service.d.ts +0 -33
  692. package/dist/shared/services/gateway/service-bootstrap-status.service.d.ts.map +0 -1
  693. package/dist/shared/services/gateway/service-bootstrap-status.service.js +0 -144
  694. package/dist/shared/services/gateway/service-bootstrap-status.service.js.map +0 -1
  695. package/dist/shared/services/gateway/service-startup-support.service.d.ts +0 -35
  696. package/dist/shared/services/gateway/service-startup-support.service.d.ts.map +0 -1
  697. package/dist/shared/services/gateway/service-startup-support.service.js +0 -85
  698. package/dist/shared/services/gateway/service-startup-support.service.js.map +0 -1
  699. package/dist/shared/services/gateway/utils/cron-job-handler.utils.d.ts +0 -18
  700. package/dist/shared/services/gateway/utils/cron-job-handler.utils.d.ts.map +0 -1
  701. package/dist/shared/services/gateway/utils/cron-job-handler.utils.js +0 -56
  702. package/dist/shared/services/gateway/utils/cron-job-handler.utils.js.map +0 -1
  703. package/dist/shared/services/gateway/utils/gateway-runtime-lifecycle.utils.d.ts +0 -10
  704. package/dist/shared/services/gateway/utils/gateway-runtime-lifecycle.utils.d.ts.map +0 -1
  705. package/dist/shared/services/gateway/utils/gateway-runtime-lifecycle.utils.js +0 -12
  706. package/dist/shared/services/gateway/utils/gateway-runtime-lifecycle.utils.js.map +0 -1
  707. package/dist/shared/services/marketplace/service-marketplace-installer.service.d.ts +0 -29
  708. package/dist/shared/services/marketplace/service-marketplace-installer.service.d.ts.map +0 -1
  709. package/dist/shared/services/marketplace/service-marketplace-installer.service.js +0 -87
  710. package/dist/shared/services/marketplace/service-marketplace-installer.service.js.map +0 -1
  711. package/dist/shared/services/marketplace/service-mcp-marketplace-ops.d.ts +0 -40
  712. package/dist/shared/services/marketplace/service-mcp-marketplace-ops.d.ts.map +0 -1
  713. package/dist/shared/services/marketplace/service-mcp-marketplace-ops.js +0 -69
  714. package/dist/shared/services/marketplace/service-mcp-marketplace-ops.js.map +0 -1
  715. package/dist/shared/services/restart/restart-coordinator.service.d.ts +0 -31
  716. package/dist/shared/services/restart/restart-coordinator.service.d.ts.map +0 -1
  717. package/dist/shared/services/restart/restart-coordinator.service.js +0 -53
  718. package/dist/shared/services/restart/restart-coordinator.service.js.map +0 -1
  719. package/dist/shared/services/restart/runtime-restart-request.service.d.ts +0 -25
  720. package/dist/shared/services/restart/runtime-restart-request.service.d.ts.map +0 -1
  721. package/dist/shared/services/restart/runtime-restart-request.service.js +0 -44
  722. package/dist/shared/services/restart/runtime-restart-request.service.js.map +0 -1
  723. package/dist/shared/services/runtime/managed-service-supervisor.service.d.ts +0 -85
  724. package/dist/shared/services/runtime/managed-service-supervisor.service.d.ts.map +0 -1
  725. package/dist/shared/services/runtime/managed-service-supervisor.service.js +0 -271
  726. package/dist/shared/services/runtime/managed-service-supervisor.service.js.map +0 -1
  727. package/dist/shared/services/runtime/nextclaw-distribution.service.d.ts +0 -11
  728. package/dist/shared/services/runtime/nextclaw-distribution.service.d.ts.map +0 -1
  729. package/dist/shared/services/runtime/nextclaw-distribution.service.js +0 -15
  730. package/dist/shared/services/runtime/nextclaw-distribution.service.js.map +0 -1
  731. package/dist/shared/services/runtime/runtime-command.service.d.ts +0 -42
  732. package/dist/shared/services/runtime/runtime-command.service.d.ts.map +0 -1
  733. package/dist/shared/services/runtime/runtime-command.service.js +0 -195
  734. package/dist/shared/services/runtime/runtime-command.service.js.map +0 -1
  735. package/dist/shared/services/runtime/runtime-config-init.service.d.ts +0 -5
  736. package/dist/shared/services/runtime/runtime-config-init.service.d.ts.map +0 -1
  737. package/dist/shared/services/runtime/runtime-config-init.service.js +0 -12
  738. package/dist/shared/services/runtime/runtime-config-init.service.js.map +0 -1
  739. package/dist/shared/services/runtime/service-managed-startup.service.d.ts +0 -95
  740. package/dist/shared/services/runtime/service-managed-startup.service.d.ts.map +0 -1
  741. package/dist/shared/services/runtime/service-managed-startup.service.js +0 -341
  742. package/dist/shared/services/runtime/service-managed-startup.service.js.map +0 -1
  743. package/dist/shared/services/runtime/utils/managed-service-routing.utils.d.ts +0 -31
  744. package/dist/shared/services/runtime/utils/managed-service-routing.utils.d.ts.map +0 -1
  745. package/dist/shared/services/runtime/utils/managed-service-routing.utils.js +0 -64
  746. package/dist/shared/services/runtime/utils/managed-service-routing.utils.js.map +0 -1
  747. package/dist/shared/services/runtime/utils/service-remote-runtime.utils.d.ts +0 -58
  748. package/dist/shared/services/runtime/utils/service-remote-runtime.utils.d.ts.map +0 -1
  749. package/dist/shared/services/runtime/utils/service-remote-runtime.utils.js +0 -184
  750. package/dist/shared/services/runtime/utils/service-remote-runtime.utils.js.map +0 -1
  751. package/dist/shared/services/ui/companion-runtime.service.d.ts +0 -36
  752. package/dist/shared/services/ui/companion-runtime.service.d.ts.map +0 -1
  753. package/dist/shared/services/ui/companion-runtime.service.js +0 -180
  754. package/dist/shared/services/ui/companion-runtime.service.js.map +0 -1
  755. package/dist/shared/services/ui/local-ui-discovery.service.d.ts +0 -20
  756. package/dist/shared/services/ui/local-ui-discovery.service.d.ts.map +0 -1
  757. package/dist/shared/services/ui/local-ui-discovery.service.js +0 -43
  758. package/dist/shared/services/ui/local-ui-discovery.service.js.map +0 -1
  759. package/dist/shared/services/ui/npm-runtime-update-host.service.d.ts +0 -41
  760. package/dist/shared/services/ui/npm-runtime-update-host.service.d.ts.map +0 -1
  761. package/dist/shared/services/ui/npm-runtime-update-host.service.js +0 -189
  762. package/dist/shared/services/ui/npm-runtime-update-host.service.js.map +0 -1
  763. package/dist/shared/services/ui/runtime-control-host.service.d.ts +0 -29
  764. package/dist/shared/services/ui/runtime-control-host.service.d.ts.map +0 -1
  765. package/dist/shared/services/ui/runtime-control-host.service.js +0 -91
  766. package/dist/shared/services/ui/runtime-control-host.service.js.map +0 -1
  767. package/dist/shared/services/ui/service-remote-access.service.d.ts +0 -26
  768. package/dist/shared/services/ui/service-remote-access.service.d.ts.map +0 -1
  769. package/dist/shared/services/ui/service-remote-access.service.js +0 -40
  770. package/dist/shared/services/ui/service-remote-access.service.js.map +0 -1
  771. package/dist/shared/services/ui/ui-bridge-api.service.d.ts +0 -17
  772. package/dist/shared/services/ui/ui-bridge-api.service.d.ts.map +0 -1
  773. package/dist/shared/services/ui/ui-bridge-api.service.js +0 -45
  774. package/dist/shared/services/ui/ui-bridge-api.service.js.map +0 -1
  775. package/dist/shared/services/workspace/workspace-manager.service.d.ts +0 -14
  776. package/dist/shared/services/workspace/workspace-manager.service.d.ts.map +0 -1
  777. package/dist/shared/services/workspace/workspace-manager.service.js +0 -86
  778. package/dist/shared/services/workspace/workspace-manager.service.js.map +0 -1
  779. package/dist/shared/stores/companion-runtime.store.d.ts +0 -16
  780. package/dist/shared/stores/companion-runtime.store.d.ts.map +0 -1
  781. package/dist/shared/stores/companion-runtime.store.js +0 -29
  782. package/dist/shared/stores/companion-runtime.store.js.map +0 -1
  783. package/dist/shared/stores/local-ui-runtime.store.d.ts +0 -26
  784. package/dist/shared/stores/local-ui-runtime.store.d.ts.map +0 -1
  785. package/dist/shared/stores/local-ui-runtime.store.js +0 -56
  786. package/dist/shared/stores/local-ui-runtime.store.js.map +0 -1
  787. package/dist/shared/stores/managed-service-state.store.d.ts +0 -46
  788. package/dist/shared/stores/managed-service-state.store.d.ts.map +0 -1
  789. package/dist/shared/stores/managed-service-state.store.js +0 -40
  790. package/dist/shared/stores/managed-service-state.store.js.map +0 -1
  791. package/dist/shared/stores/pending-restart.store.d.ts +0 -22
  792. package/dist/shared/stores/pending-restart.store.d.ts.map +0 -1
  793. package/dist/shared/stores/pending-restart.store.js +0 -37
  794. package/dist/shared/stores/pending-restart.store.js.map +0 -1
  795. package/dist/shared/types/cli.types.d.ts +0 -304
  796. package/dist/shared/types/cli.types.d.ts.map +0 -1
  797. package/dist/shared/types/distribution.types.d.ts +0 -11
  798. package/dist/shared/types/distribution.types.d.ts.map +0 -1
  799. package/dist/shared/utils/cli.utils.d.ts +0 -32
  800. package/dist/shared/utils/cli.utils.d.ts.map +0 -1
  801. package/dist/shared/utils/cli.utils.js +0 -254
  802. package/dist/shared/utils/cli.utils.js.map +0 -1
  803. package/dist/shared/utils/config-path.d.ts +0 -16
  804. package/dist/shared/utils/config-path.d.ts.map +0 -1
  805. package/dist/shared/utils/config-path.js +0 -169
  806. package/dist/shared/utils/config-path.js.map +0 -1
  807. package/dist/shared/utils/marketplace/cli-subcommand-launch.utils.d.ts +0 -17
  808. package/dist/shared/utils/marketplace/cli-subcommand-launch.utils.d.ts.map +0 -1
  809. package/dist/shared/utils/marketplace/cli-subcommand-launch.utils.js +0 -48
  810. package/dist/shared/utils/marketplace/cli-subcommand-launch.utils.js.map +0 -1
  811. package/dist/shared/utils/marketplace/service-marketplace-helpers.utils.d.ts +0 -15
  812. package/dist/shared/utils/marketplace/service-marketplace-helpers.utils.d.ts.map +0 -1
  813. package/dist/shared/utils/marketplace/service-marketplace-helpers.utils.js +0 -47
  814. package/dist/shared/utils/marketplace/service-marketplace-helpers.utils.js.map +0 -1
  815. package/dist/shared/utils/package/package-manifest.utils.d.ts +0 -5
  816. package/dist/shared/utils/package/package-manifest.utils.d.ts.map +0 -1
  817. package/dist/shared/utils/package/package-manifest.utils.js +0 -40
  818. package/dist/shared/utils/package/package-manifest.utils.js.map +0 -1
  819. package/dist/shared/utils/panel-app-client-sdk/panel-app-client-sdk-script.utils.d.ts +0 -5
  820. package/dist/shared/utils/panel-app-client-sdk/panel-app-client-sdk-script.utils.d.ts.map +0 -1
  821. package/dist/shared/utils/panel-app-client-sdk/panel-app-client-sdk-script.utils.js +0 -37
  822. package/dist/shared/utils/panel-app-client-sdk/panel-app-client-sdk-script.utils.js.map +0 -1
  823. package/dist/shared/utils/restart/restart-sentinel.utils.d.ts +0 -37
  824. package/dist/shared/utils/restart/restart-sentinel.utils.d.ts.map +0 -1
  825. package/dist/shared/utils/restart/restart-sentinel.utils.js +0 -76
  826. package/dist/shared/utils/restart/restart-sentinel.utils.js.map +0 -1
  827. package/dist/shared/utils/runtime-helpers.d.ts +0 -15
  828. package/dist/shared/utils/runtime-helpers.d.ts.map +0 -1
  829. package/dist/shared/utils/runtime-helpers.js +0 -28
  830. package/dist/shared/utils/runtime-helpers.js.map +0 -1
  831. package/dist/shared/utils/service-port-probe.utils.d.ts +0 -42
  832. package/dist/shared/utils/service-port-probe.utils.d.ts.map +0 -1
  833. package/dist/shared/utils/service-port-probe.utils.js +0 -166
  834. package/dist/shared/utils/service-port-probe.utils.js.map +0 -1
  835. package/dist/shared/utils/startup-trace.d.ts +0 -8
  836. package/dist/shared/utils/startup-trace.d.ts.map +0 -1
  837. package/dist/shared/utils/startup-trace.js +0 -39
  838. package/dist/shared/utils/startup-trace.js.map +0 -1
  839. package/dist/shared/utils/top-level-nextclaw-command-env.utils.d.ts +0 -5
  840. package/dist/shared/utils/top-level-nextclaw-command-env.utils.d.ts.map +0 -1
  841. package/dist/shared/utils/top-level-nextclaw-command-env.utils.js +0 -12
  842. package/dist/shared/utils/top-level-nextclaw-command-env.utils.js.map +0 -1
  843. /package/dist/{shared/types → types}/cli.types.js +0 -0
  844. /package/dist/{shared/types → types}/distribution.types.js +0 -0
  845. /package/dist/{commands/service/types/autostart → types}/host-autostart.types.js +0 -0
  846. /package/dist/{launcher → types}/npm-runtime-bundle.types.js +0 -0
@@ -1,94 +0,0 @@
1
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
- import { dirname } from "node:path";
3
- //#region src/launcher/npm-runtime-update-state.store.ts
4
- function createDefaultState(channel) {
5
- return {
6
- channel,
7
- currentVersion: null,
8
- previousVersion: null,
9
- candidateVersion: null,
10
- candidateLaunchCount: 0,
11
- lastKnownGoodVersion: null,
12
- badVersions: [],
13
- lastUpdateCheckAt: null,
14
- downloadedVersion: null,
15
- downloadedReleaseNotesUrl: null,
16
- updatePreferences: {
17
- automaticChecks: true,
18
- autoDownload: true
19
- }
20
- };
21
- }
22
- function normalizeOptionalString(value) {
23
- if (typeof value !== "string") return null;
24
- const trimmed = value.trim();
25
- return trimmed ? trimmed : null;
26
- }
27
- function normalizeChannel(value, fallback) {
28
- if (typeof value !== "string") return fallback;
29
- const trimmed = value.trim().toLowerCase();
30
- if (trimmed === "beta") return "beta";
31
- if (trimmed === "stable") return "stable";
32
- return fallback;
33
- }
34
- function normalizeStringArray(value) {
35
- if (!Array.isArray(value)) return [];
36
- return [...new Set(value.filter((entry) => typeof entry === "string").map((entry) => entry.trim()).filter(Boolean))];
37
- }
38
- function normalizeUpdatePreferences(value) {
39
- const defaultState = createDefaultState("stable");
40
- if (!value || typeof value !== "object" || Array.isArray(value)) return { ...defaultState.updatePreferences };
41
- const record = value;
42
- return {
43
- automaticChecks: typeof record.automaticChecks === "boolean" ? record.automaticChecks : defaultState.updatePreferences.automaticChecks,
44
- autoDownload: typeof record.autoDownload === "boolean" ? record.autoDownload : defaultState.updatePreferences.autoDownload
45
- };
46
- }
47
- function normalizeState(input, defaultChannel) {
48
- if (!input || typeof input !== "object" || Array.isArray(input)) throw new Error("npm runtime update state must be an object");
49
- const record = input;
50
- const candidateLaunchCount = Number(record.candidateLaunchCount);
51
- return {
52
- channel: normalizeChannel(record.channel, defaultChannel),
53
- currentVersion: normalizeOptionalString(record.currentVersion),
54
- previousVersion: normalizeOptionalString(record.previousVersion),
55
- candidateVersion: normalizeOptionalString(record.candidateVersion),
56
- candidateLaunchCount: Number.isInteger(candidateLaunchCount) && candidateLaunchCount >= 0 ? candidateLaunchCount : 0,
57
- lastKnownGoodVersion: normalizeOptionalString(record.lastKnownGoodVersion),
58
- badVersions: normalizeStringArray(record.badVersions),
59
- lastUpdateCheckAt: normalizeOptionalString(record.lastUpdateCheckAt),
60
- downloadedVersion: normalizeOptionalString(record.downloadedVersion),
61
- downloadedReleaseNotesUrl: normalizeOptionalString(record.downloadedReleaseNotesUrl),
62
- updatePreferences: normalizeUpdatePreferences(record.updatePreferences)
63
- };
64
- }
65
- var NpmRuntimeUpdateStateStore = class {
66
- defaultChannel;
67
- constructor(statePath, options = {}) {
68
- this.statePath = statePath;
69
- this.defaultChannel = options.defaultChannel ?? "stable";
70
- }
71
- read = () => {
72
- if (!existsSync(this.statePath)) {
73
- const defaultState = createDefaultState(this.defaultChannel);
74
- return {
75
- ...defaultState,
76
- updatePreferences: { ...defaultState.updatePreferences }
77
- };
78
- }
79
- return normalizeState(JSON.parse(readFileSync(this.statePath, "utf8")), this.defaultChannel);
80
- };
81
- write = (state) => {
82
- mkdirSync(dirname(this.statePath), { recursive: true });
83
- writeFileSync(this.statePath, `${JSON.stringify(state, null, 2)}\n`, "utf8");
84
- };
85
- update = (updater) => {
86
- const nextState = updater(this.read());
87
- this.write(nextState);
88
- return nextState;
89
- };
90
- };
91
- //#endregion
92
- export { NpmRuntimeUpdateStateStore };
93
-
94
- //# sourceMappingURL=npm-runtime-update-state.store.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"npm-runtime-update-state.store.js","names":[],"sources":["../../src/launcher/npm-runtime-update-state.store.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { dirname } from \"node:path\";\nimport type { NpmRuntimeUpdateState } from \"./npm-runtime-bundle.types.js\";\nimport type { NpmRuntimeReleaseChannel } from \"./npm-runtime-update-source.service.js\";\n\nfunction createDefaultState(channel: NpmRuntimeReleaseChannel): NpmRuntimeUpdateState {\n return {\n channel,\n currentVersion: null,\n previousVersion: null,\n candidateVersion: null,\n candidateLaunchCount: 0,\n lastKnownGoodVersion: null,\n badVersions: [],\n lastUpdateCheckAt: null,\n downloadedVersion: null,\n downloadedReleaseNotesUrl: null,\n updatePreferences: {\n automaticChecks: true,\n autoDownload: true\n }\n };\n}\n\nfunction normalizeOptionalString(value: unknown): string | null {\n if (typeof value !== \"string\") {\n return null;\n }\n const trimmed = value.trim();\n return trimmed ? trimmed : null;\n}\n\nfunction normalizeChannel(value: unknown, fallback: NpmRuntimeReleaseChannel): NpmRuntimeReleaseChannel {\n if (typeof value !== \"string\") {\n return fallback;\n }\n const trimmed = value.trim().toLowerCase();\n if (trimmed === \"beta\") {\n return \"beta\";\n }\n if (trimmed === \"stable\") {\n return \"stable\";\n }\n return fallback;\n}\n\nfunction normalizeStringArray(value: unknown): string[] {\n if (!Array.isArray(value)) {\n return [];\n }\n return [...new Set(value.filter((entry): entry is string => typeof entry === \"string\").map((entry) => entry.trim()).filter(Boolean))];\n}\n\nfunction normalizeUpdatePreferences(value: unknown): NpmRuntimeUpdateState[\"updatePreferences\"] {\n const defaultState = createDefaultState(\"stable\");\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n return { ...defaultState.updatePreferences };\n }\n const record = value as Record<string, unknown>;\n return {\n automaticChecks:\n typeof record.automaticChecks === \"boolean\"\n ? record.automaticChecks\n : defaultState.updatePreferences.automaticChecks,\n autoDownload:\n typeof record.autoDownload === \"boolean\"\n ? record.autoDownload\n : defaultState.updatePreferences.autoDownload\n };\n}\n\nfunction normalizeState(input: unknown, defaultChannel: NpmRuntimeReleaseChannel): NpmRuntimeUpdateState {\n if (!input || typeof input !== \"object\" || Array.isArray(input)) {\n throw new Error(\"npm runtime update state must be an object\");\n }\n const record = input as Record<string, unknown>;\n const candidateLaunchCount = Number(record.candidateLaunchCount);\n return {\n channel: normalizeChannel(record.channel, defaultChannel),\n currentVersion: normalizeOptionalString(record.currentVersion),\n previousVersion: normalizeOptionalString(record.previousVersion),\n candidateVersion: normalizeOptionalString(record.candidateVersion),\n candidateLaunchCount: Number.isInteger(candidateLaunchCount) && candidateLaunchCount >= 0 ? candidateLaunchCount : 0,\n lastKnownGoodVersion: normalizeOptionalString(record.lastKnownGoodVersion),\n badVersions: normalizeStringArray(record.badVersions),\n lastUpdateCheckAt: normalizeOptionalString(record.lastUpdateCheckAt),\n downloadedVersion: normalizeOptionalString(record.downloadedVersion),\n downloadedReleaseNotesUrl: normalizeOptionalString(record.downloadedReleaseNotesUrl),\n updatePreferences: normalizeUpdatePreferences(record.updatePreferences)\n };\n}\n\ntype NpmRuntimeUpdateStateStoreOptions = {\n defaultChannel?: NpmRuntimeReleaseChannel;\n};\n\nexport class NpmRuntimeUpdateStateStore {\n private readonly defaultChannel: NpmRuntimeReleaseChannel;\n\n constructor(\n private readonly statePath: string,\n options: NpmRuntimeUpdateStateStoreOptions = {}\n ) {\n this.defaultChannel = options.defaultChannel ?? \"stable\";\n }\n\n read = (): NpmRuntimeUpdateState => {\n if (!existsSync(this.statePath)) {\n const defaultState = createDefaultState(this.defaultChannel);\n return { ...defaultState, updatePreferences: { ...defaultState.updatePreferences } };\n }\n return normalizeState(JSON.parse(readFileSync(this.statePath, \"utf8\")), this.defaultChannel);\n };\n\n write = (state: NpmRuntimeUpdateState): void => {\n mkdirSync(dirname(this.statePath), { recursive: true });\n writeFileSync(this.statePath, `${JSON.stringify(state, null, 2)}\\n`, \"utf8\");\n };\n\n update = (updater: (state: NpmRuntimeUpdateState) => NpmRuntimeUpdateState): NpmRuntimeUpdateState => {\n const nextState = updater(this.read());\n this.write(nextState);\n return nextState;\n };\n}\n"],"mappings":"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"}
@@ -1,43 +0,0 @@
1
- import { NpmRuntimeBundleLayoutStore } from "./npm-runtime-bundle-layout.store.js";
2
- import { NpmRuntimeReleaseChannel } from "./npm-runtime-update-source.service.js";
3
- import { NpmRuntimeUpdateStateStore } from "./npm-runtime-update-state.store.js";
4
- import { NpmRuntimeBundleService } from "./npm-runtime-bundle.service.js";
5
- import { NpmRuntimeUpdateService } from "./npm-runtime-update.service.js";
6
- import { UpdateProgress, UpdateSnapshot } from "@nextclaw/kernel";
7
-
8
- //#region src/launcher/npm-runtime-update.manager.d.ts
9
- type NpmRuntimeUpdateManagerOptions = {
10
- layout: NpmRuntimeBundleLayoutStore;
11
- stateStore: NpmRuntimeUpdateStateStore;
12
- bundleService: NpmRuntimeBundleService;
13
- updateService: NpmRuntimeUpdateService;
14
- resolveManifestUrl: (channel: NpmRuntimeReleaseChannel) => string | null;
15
- launcherVersion?: string;
16
- channel: NpmRuntimeReleaseChannel;
17
- now?: () => Date;
18
- };
19
- type NpmRuntimeUpdateActionOptions = {
20
- apply?: boolean;
21
- applyAfterDownload?: boolean;
22
- checkOnly?: boolean;
23
- onProgress?: (progress: UpdateProgress) => void;
24
- };
25
- declare class NpmRuntimeUpdateManager {
26
- private readonly options;
27
- private readonly launcherVersion;
28
- private readonly now;
29
- private availableManifest;
30
- constructor(options: NpmRuntimeUpdateManagerOptions);
31
- getSnapshot: () => UpdateSnapshot;
32
- run: (options?: NpmRuntimeUpdateActionOptions) => Promise<UpdateSnapshot>;
33
- checkForUpdate: () => Promise<UpdateSnapshot>;
34
- downloadUpdate: (onProgress?: (progress: UpdateProgress) => void) => Promise<UpdateSnapshot>;
35
- applyDownloadedUpdate: () => UpdateSnapshot;
36
- private ensureAvailableManifest;
37
- private toSnapshotAfterCheck;
38
- private syncStateFromCurrentPointer;
39
- private toSnapshotFromState;
40
- }
41
- //#endregion
42
- export { NpmRuntimeUpdateManager };
43
- //# sourceMappingURL=npm-runtime-update.manager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"npm-runtime-update.manager.d.ts","names":[],"sources":["../../src/launcher/npm-runtime-update.manager.ts"],"mappings":";;;;;;;;KAUK,8BAAA;EACH,MAAA,EAAQ,2BAAA;EACR,UAAA,EAAY,0BAAA;EACZ,aAAA,EAAe,uBAAA;EACf,aAAA,EAAe,uBAAA;EACf,kBAAA,GAAqB,OAAA,EAAS,wBAAA;EAC9B,eAAA;EACA,OAAA,EAAS,wBAAA;EACT,GAAA,SAAY,IAAA;AAAA;AAAA,KAGT,6BAAA;EACH,KAAA;EACA,kBAAA;EACA,SAAA;EACA,UAAA,IAAc,QAAA,EAAU,cAAA;AAAA;AAAA,cAGb,uBAAA;EAAA,iBAKkB,OAAA;EAAA,iBAJZ,eAAA;EAAA,iBACA,GAAA;EAAA,QACT,iBAAA;cAEqB,OAAA,EAAS,8BAAA;EAOtC,WAAA,QAAkB,cAAA;EAIlB,GAAA,GAAa,OAAA,GAAS,6BAAA,KAAqC,OAAA,CAAQ,cAAA;EAuBnE,cAAA,QAA2B,OAAA,CAAQ,cAAA;EA+BnC,cAAA,GAAwB,UAAA,IAAc,QAAA,EAAU,cAAA,cAA0B,OAAA,CAAQ,cAAA;EAoBlF,qBAAA,QAA4B,cAAA;EAAA,QAiBpB,uBAAA;EAAA,QAWA,oBAAA;EAAA,QAsDA,2BAAA;EAAA,QAeA,mBAAA;AAAA"}
@@ -1,185 +0,0 @@
1
- import { getPackageVersion } from "../shared/utils/package/package-manifest.utils.js";
2
- import "../shared/utils/cli.utils.js";
3
- import { resolveEffectiveNpmRuntimeVersion } from "./npm-runtime-bundle.service.js";
4
- //#region src/launcher/npm-runtime-update.manager.ts
5
- var NpmRuntimeUpdateManager = class {
6
- launcherVersion;
7
- now;
8
- availableManifest = null;
9
- constructor(options) {
10
- this.options = options;
11
- this.launcherVersion = options.launcherVersion ?? getPackageVersion();
12
- this.now = options.now ?? (() => /* @__PURE__ */ new Date());
13
- this.options.layout.ensureLauncherDirs();
14
- this.syncStateFromCurrentPointer();
15
- }
16
- getSnapshot = () => this.toSnapshotFromState(this.options.stateStore.read(), { status: this.options.stateStore.read().downloadedVersion ? "downloaded" : "idle" });
17
- run = async (options = {}) => {
18
- if (options.apply) return this.applyDownloadedUpdate();
19
- const applyAfterDownload = options.applyAfterDownload ?? true;
20
- const checkedSnapshot = await this.checkForUpdate();
21
- if (options.checkOnly) return checkedSnapshot;
22
- if (applyAfterDownload && checkedSnapshot.status === "downloaded") return this.applyDownloadedUpdate();
23
- if (checkedSnapshot.status !== "update-available") return checkedSnapshot;
24
- const downloadedSnapshot = await this.downloadUpdate(options.onProgress);
25
- if (!applyAfterDownload || downloadedSnapshot.status !== "downloaded") return downloadedSnapshot;
26
- return this.applyDownloadedUpdate();
27
- };
28
- checkForUpdate = async () => {
29
- const manifestUrl = this.options.resolveManifestUrl(this.options.channel);
30
- if (!this.options.updateService.hasSignatureVerifier()) return this.toSnapshotFromState(this.options.stateStore.read(), {
31
- status: "blocked",
32
- installationKind: "npm-runtime-bundle",
33
- blockReason: "signature-verification-unavailable",
34
- recoveryCommand: "Set NEXTCLAW_UPDATE_BUNDLE_PUBLIC_KEY or NEXTCLAW_UPDATE_BUNDLE_PUBLIC_KEY_PATH",
35
- errorMessage: "Runtime bundle updates require a configured update public key."
36
- });
37
- if (!manifestUrl) return this.toSnapshotFromState(this.options.stateStore.read(), {
38
- status: "blocked",
39
- installationKind: "npm-runtime-bundle",
40
- blockReason: "unsupported-installation",
41
- recoveryCommand: "Set NEXTCLAW_UPDATE_MANIFEST_URL or NEXTCLAW_UPDATE_MANIFEST_BASE_URL",
42
- errorMessage: "Runtime bundle update manifest URL is not configured."
43
- });
44
- const checkedAt = this.now().toISOString();
45
- const state = this.options.stateStore.update((current) => ({
46
- ...current,
47
- channel: this.options.channel,
48
- lastUpdateCheckAt: checkedAt
49
- }));
50
- const availableUpdate = await this.options.updateService.checkForUpdate(manifestUrl, state.currentVersion, state.badVersions);
51
- return this.toSnapshotAfterCheck(availableUpdate, this.options.stateStore.read());
52
- };
53
- downloadUpdate = async (onProgress) => {
54
- const manifest = this.availableManifest ?? await this.ensureAvailableManifest();
55
- const downloaded = await this.options.updateService.downloadAndInstallUpdate(manifest, onProgress);
56
- const state = this.options.stateStore.update((current) => ({
57
- ...current,
58
- downloadedVersion: downloaded.downloadedVersion,
59
- downloadedReleaseNotesUrl: downloaded.manifest.releaseNotesUrl
60
- }));
61
- await this.options.bundleService.pruneRetainedArtifacts();
62
- return this.toSnapshotFromState(state, {
63
- status: "downloaded",
64
- availableVersion: downloaded.downloadedVersion,
65
- downloadedVersion: downloaded.downloadedVersion,
66
- minimumHostVersion: downloaded.manifest.minimumLauncherVersion,
67
- releaseNotesUrl: downloaded.manifest.releaseNotesUrl,
68
- canApplyInApp: true,
69
- requiresRestart: false
70
- });
71
- };
72
- applyDownloadedUpdate = () => {
73
- const downloadedVersion = this.options.stateStore.read().downloadedVersion?.trim();
74
- if (!downloadedVersion) throw new Error("No downloaded npm runtime update is ready to apply.");
75
- this.options.bundleService.activateVersion(downloadedVersion);
76
- this.availableManifest = null;
77
- return this.toSnapshotFromState(this.options.stateStore.read(), {
78
- status: "restart-required",
79
- availableVersion: null,
80
- downloadedVersion: null,
81
- releaseNotesUrl: null,
82
- canApplyInApp: false,
83
- requiresRestart: true
84
- });
85
- };
86
- ensureAvailableManifest = async () => {
87
- const snapshot = await this.checkForUpdate();
88
- if (!this.availableManifest) {
89
- if (snapshot.downloadedVersion) throw new Error(`Version ${snapshot.downloadedVersion} has already been downloaded and is ready to apply.`);
90
- throw new Error("No npm runtime update is currently available.");
91
- }
92
- return this.availableManifest;
93
- };
94
- toSnapshotAfterCheck = (availableUpdate, state) => {
95
- if (state.downloadedVersion) {
96
- this.availableManifest = availableUpdate?.kind === "runtime-bundle-update" ? availableUpdate.manifest : this.availableManifest;
97
- return this.toSnapshotFromState(state, {
98
- status: "downloaded",
99
- availableVersion: availableUpdate?.kind === "runtime-bundle-update" ? availableUpdate.manifest.latestVersion : state.downloadedVersion,
100
- minimumHostVersion: availableUpdate?.kind === "runtime-bundle-update" ? availableUpdate.manifest.minimumLauncherVersion : null,
101
- canApplyInApp: true,
102
- requiresRestart: false
103
- });
104
- }
105
- if (!availableUpdate) {
106
- this.availableManifest = null;
107
- return this.toSnapshotFromState(state, {
108
- status: "up-to-date",
109
- availableVersion: null,
110
- downloadedVersion: null,
111
- releaseNotesUrl: null
112
- });
113
- }
114
- if (availableUpdate.kind === "host-update-required") {
115
- this.availableManifest = null;
116
- return this.toSnapshotFromState(state, {
117
- status: "blocked",
118
- availableVersion: availableUpdate.manifest.latestVersion,
119
- minimumHostVersion: availableUpdate.manifest.minimumLauncherVersion,
120
- releaseNotesUrl: availableUpdate.manifest.releaseNotesUrl,
121
- blockReason: "host-too-old",
122
- recoveryCommand: "npm install -g nextclaw@latest",
123
- errorMessage: `NextClaw npm launcher ${this.launcherVersion} is too old for runtime bundle ${availableUpdate.manifest.latestVersion}.`
124
- });
125
- }
126
- if (availableUpdate.kind === "quarantined-bad-version") {
127
- this.availableManifest = null;
128
- return this.toSnapshotFromState(state, {
129
- status: "failed",
130
- availableVersion: availableUpdate.manifest.latestVersion,
131
- minimumHostVersion: availableUpdate.manifest.minimumLauncherVersion,
132
- releaseNotesUrl: availableUpdate.manifest.releaseNotesUrl,
133
- errorMessage: `Version ${availableUpdate.manifest.latestVersion} was quarantined after a failed launch.`
134
- });
135
- }
136
- this.availableManifest = availableUpdate.manifest;
137
- return this.toSnapshotFromState(state, {
138
- status: "update-available",
139
- availableVersion: availableUpdate.manifest.latestVersion,
140
- minimumHostVersion: availableUpdate.manifest.minimumLauncherVersion,
141
- releaseNotesUrl: availableUpdate.manifest.releaseNotesUrl
142
- });
143
- };
144
- syncStateFromCurrentPointer = () => {
145
- const currentPointer = this.options.layout.readCurrentPointer();
146
- const effectiveCurrentVersion = resolveEffectiveNpmRuntimeVersion({
147
- launcherVersion: this.launcherVersion,
148
- currentBundleVersion: currentPointer?.version ?? null
149
- });
150
- if (!effectiveCurrentVersion) return;
151
- this.options.stateStore.update((state) => ({
152
- ...state,
153
- currentVersion: effectiveCurrentVersion
154
- }));
155
- };
156
- toSnapshotFromState = (state, patch) => {
157
- const hasDownloadedVersion = Boolean(state.downloadedVersion);
158
- const { status } = patch;
159
- return {
160
- installationKind: "npm-runtime-bundle",
161
- channel: state.channel,
162
- hostVersion: this.launcherVersion,
163
- currentVersion: state.currentVersion,
164
- availableVersion: null,
165
- downloadedVersion: state.downloadedVersion,
166
- minimumHostVersion: null,
167
- releaseNotesUrl: state.downloadedReleaseNotesUrl,
168
- lastCheckedAt: state.lastUpdateCheckAt,
169
- progress: null,
170
- canAutoDownload: state.updatePreferences.autoDownload,
171
- canApplyInApp: hasDownloadedVersion,
172
- requiresRestart: false,
173
- blockReason: null,
174
- recoveryCommand: null,
175
- errorMessage: null,
176
- preferences: { ...state.updatePreferences },
177
- ...patch,
178
- status
179
- };
180
- };
181
- };
182
- //#endregion
183
- export { NpmRuntimeUpdateManager };
184
-
185
- //# sourceMappingURL=npm-runtime-update.manager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"npm-runtime-update.manager.js","names":[],"sources":["../../src/launcher/npm-runtime-update.manager.ts"],"sourcesContent":["import type { UpdateManifest, UpdateProgress, UpdateSnapshot } from \"@nextclaw/kernel\";\nimport { getPackageVersion } from \"@nextclaw-service/shared/utils/cli.utils.js\";\nimport { resolveEffectiveNpmRuntimeVersion } from \"./npm-runtime-bundle.service.js\";\nimport type { NpmRuntimeBundleService } from \"./npm-runtime-bundle.service.js\";\nimport type { NpmRuntimeBundleLayoutStore } from \"./npm-runtime-bundle-layout.store.js\";\nimport type { NpmRuntimeUpdateService, NpmRuntimeAvailableUpdate } from \"./npm-runtime-update.service.js\";\nimport type { NpmRuntimeUpdateStateStore } from \"./npm-runtime-update-state.store.js\";\nimport type { NpmRuntimeReleaseChannel } from \"./npm-runtime-update-source.service.js\";\nimport type { NpmRuntimeUpdateState } from \"./npm-runtime-bundle.types.js\";\n\ntype NpmRuntimeUpdateManagerOptions = {\n layout: NpmRuntimeBundleLayoutStore;\n stateStore: NpmRuntimeUpdateStateStore;\n bundleService: NpmRuntimeBundleService;\n updateService: NpmRuntimeUpdateService;\n resolveManifestUrl: (channel: NpmRuntimeReleaseChannel) => string | null;\n launcherVersion?: string;\n channel: NpmRuntimeReleaseChannel;\n now?: () => Date;\n};\n\ntype NpmRuntimeUpdateActionOptions = {\n apply?: boolean;\n applyAfterDownload?: boolean;\n checkOnly?: boolean;\n onProgress?: (progress: UpdateProgress) => void;\n};\n\nexport class NpmRuntimeUpdateManager {\n private readonly launcherVersion: string;\n private readonly now: () => Date;\n private availableManifest: UpdateManifest | null = null;\n\n constructor(private readonly options: NpmRuntimeUpdateManagerOptions) {\n this.launcherVersion = options.launcherVersion ?? getPackageVersion();\n this.now = options.now ?? (() => new Date());\n this.options.layout.ensureLauncherDirs();\n this.syncStateFromCurrentPointer();\n }\n\n getSnapshot = (): UpdateSnapshot => this.toSnapshotFromState(this.options.stateStore.read(), {\n status: this.options.stateStore.read().downloadedVersion ? \"downloaded\" : \"idle\"\n });\n\n run = async (options: NpmRuntimeUpdateActionOptions = {}): Promise<UpdateSnapshot> => {\n if (options.apply) {\n return this.applyDownloadedUpdate();\n }\n\n const applyAfterDownload = options.applyAfterDownload ?? true;\n const checkedSnapshot = await this.checkForUpdate();\n if (options.checkOnly) {\n return checkedSnapshot;\n }\n if (applyAfterDownload && checkedSnapshot.status === \"downloaded\") {\n return this.applyDownloadedUpdate();\n }\n if (checkedSnapshot.status !== \"update-available\") {\n return checkedSnapshot;\n }\n const downloadedSnapshot = await this.downloadUpdate(options.onProgress);\n if (!applyAfterDownload || downloadedSnapshot.status !== \"downloaded\") {\n return downloadedSnapshot;\n }\n return this.applyDownloadedUpdate();\n };\n\n checkForUpdate = async (): Promise<UpdateSnapshot> => {\n const manifestUrl = this.options.resolveManifestUrl(this.options.channel);\n if (!this.options.updateService.hasSignatureVerifier()) {\n return this.toSnapshotFromState(this.options.stateStore.read(), {\n status: \"blocked\",\n installationKind: \"npm-runtime-bundle\",\n blockReason: \"signature-verification-unavailable\",\n recoveryCommand: \"Set NEXTCLAW_UPDATE_BUNDLE_PUBLIC_KEY or NEXTCLAW_UPDATE_BUNDLE_PUBLIC_KEY_PATH\",\n errorMessage: \"Runtime bundle updates require a configured update public key.\"\n });\n }\n if (!manifestUrl) {\n return this.toSnapshotFromState(this.options.stateStore.read(), {\n status: \"blocked\",\n installationKind: \"npm-runtime-bundle\",\n blockReason: \"unsupported-installation\",\n recoveryCommand: \"Set NEXTCLAW_UPDATE_MANIFEST_URL or NEXTCLAW_UPDATE_MANIFEST_BASE_URL\",\n errorMessage: \"Runtime bundle update manifest URL is not configured.\"\n });\n }\n\n const checkedAt = this.now().toISOString();\n const state = this.options.stateStore.update((current) => ({\n ...current,\n channel: this.options.channel,\n lastUpdateCheckAt: checkedAt\n }));\n const availableUpdate = await this.options.updateService.checkForUpdate(manifestUrl, state.currentVersion, state.badVersions);\n return this.toSnapshotAfterCheck(availableUpdate, this.options.stateStore.read());\n };\n\n downloadUpdate = async (onProgress?: (progress: UpdateProgress) => void): Promise<UpdateSnapshot> => {\n const manifest = this.availableManifest ?? await this.ensureAvailableManifest();\n const downloaded = await this.options.updateService.downloadAndInstallUpdate(manifest, onProgress);\n const state = this.options.stateStore.update((current) => ({\n ...current,\n downloadedVersion: downloaded.downloadedVersion,\n downloadedReleaseNotesUrl: downloaded.manifest.releaseNotesUrl\n }));\n await this.options.bundleService.pruneRetainedArtifacts();\n return this.toSnapshotFromState(state, {\n status: \"downloaded\",\n availableVersion: downloaded.downloadedVersion,\n downloadedVersion: downloaded.downloadedVersion,\n minimumHostVersion: downloaded.manifest.minimumLauncherVersion,\n releaseNotesUrl: downloaded.manifest.releaseNotesUrl,\n canApplyInApp: true,\n requiresRestart: false\n });\n };\n\n applyDownloadedUpdate = (): UpdateSnapshot => {\n const downloadedVersion = this.options.stateStore.read().downloadedVersion?.trim();\n if (!downloadedVersion) {\n throw new Error(\"No downloaded npm runtime update is ready to apply.\");\n }\n this.options.bundleService.activateVersion(downloadedVersion);\n this.availableManifest = null;\n return this.toSnapshotFromState(this.options.stateStore.read(), {\n status: \"restart-required\",\n availableVersion: null,\n downloadedVersion: null,\n releaseNotesUrl: null,\n canApplyInApp: false,\n requiresRestart: true\n });\n };\n\n private ensureAvailableManifest = async (): Promise<UpdateManifest> => {\n const snapshot = await this.checkForUpdate();\n if (!this.availableManifest) {\n if (snapshot.downloadedVersion) {\n throw new Error(`Version ${snapshot.downloadedVersion} has already been downloaded and is ready to apply.`);\n }\n throw new Error(\"No npm runtime update is currently available.\");\n }\n return this.availableManifest;\n };\n\n private toSnapshotAfterCheck = (\n availableUpdate: NpmRuntimeAvailableUpdate | null,\n state: NpmRuntimeUpdateState\n ): UpdateSnapshot => {\n if (state.downloadedVersion) {\n this.availableManifest = availableUpdate?.kind === \"runtime-bundle-update\" ? availableUpdate.manifest : this.availableManifest;\n return this.toSnapshotFromState(state, {\n status: \"downloaded\",\n availableVersion: availableUpdate?.kind === \"runtime-bundle-update\" ? availableUpdate.manifest.latestVersion : state.downloadedVersion,\n minimumHostVersion: availableUpdate?.kind === \"runtime-bundle-update\" ? availableUpdate.manifest.minimumLauncherVersion : null,\n canApplyInApp: true,\n requiresRestart: false\n });\n }\n if (!availableUpdate) {\n this.availableManifest = null;\n return this.toSnapshotFromState(state, {\n status: \"up-to-date\",\n availableVersion: null,\n downloadedVersion: null,\n releaseNotesUrl: null\n });\n }\n if (availableUpdate.kind === \"host-update-required\") {\n this.availableManifest = null;\n return this.toSnapshotFromState(state, {\n status: \"blocked\",\n availableVersion: availableUpdate.manifest.latestVersion,\n minimumHostVersion: availableUpdate.manifest.minimumLauncherVersion,\n releaseNotesUrl: availableUpdate.manifest.releaseNotesUrl,\n blockReason: \"host-too-old\",\n recoveryCommand: \"npm install -g nextclaw@latest\",\n errorMessage: `NextClaw npm launcher ${this.launcherVersion} is too old for runtime bundle ${availableUpdate.manifest.latestVersion}.`\n });\n }\n if (availableUpdate.kind === \"quarantined-bad-version\") {\n this.availableManifest = null;\n return this.toSnapshotFromState(state, {\n status: \"failed\",\n availableVersion: availableUpdate.manifest.latestVersion,\n minimumHostVersion: availableUpdate.manifest.minimumLauncherVersion,\n releaseNotesUrl: availableUpdate.manifest.releaseNotesUrl,\n errorMessage: `Version ${availableUpdate.manifest.latestVersion} was quarantined after a failed launch.`\n });\n }\n this.availableManifest = availableUpdate.manifest;\n return this.toSnapshotFromState(state, {\n status: \"update-available\",\n availableVersion: availableUpdate.manifest.latestVersion,\n minimumHostVersion: availableUpdate.manifest.minimumLauncherVersion,\n releaseNotesUrl: availableUpdate.manifest.releaseNotesUrl\n });\n };\n\n private syncStateFromCurrentPointer = (): void => {\n const currentPointer = this.options.layout.readCurrentPointer();\n const effectiveCurrentVersion = resolveEffectiveNpmRuntimeVersion({\n launcherVersion: this.launcherVersion,\n currentBundleVersion: currentPointer?.version ?? null\n });\n if (!effectiveCurrentVersion) {\n return;\n }\n this.options.stateStore.update((state) => ({\n ...state,\n currentVersion: effectiveCurrentVersion\n }));\n };\n\n private toSnapshotFromState = (\n state: NpmRuntimeUpdateState,\n patch: Partial<UpdateSnapshot> & Pick<UpdateSnapshot, \"status\">\n ): UpdateSnapshot => {\n const hasDownloadedVersion = Boolean(state.downloadedVersion);\n const { status } = patch;\n return {\n installationKind: \"npm-runtime-bundle\",\n channel: state.channel,\n hostVersion: this.launcherVersion,\n currentVersion: state.currentVersion,\n availableVersion: null,\n downloadedVersion: state.downloadedVersion,\n minimumHostVersion: null,\n releaseNotesUrl: state.downloadedReleaseNotesUrl,\n lastCheckedAt: state.lastUpdateCheckAt,\n progress: null,\n canAutoDownload: state.updatePreferences.autoDownload,\n canApplyInApp: hasDownloadedVersion,\n requiresRestart: false,\n blockReason: null,\n recoveryCommand: null,\n errorMessage: null,\n preferences: { ...state.updatePreferences },\n ...patch,\n status\n };\n };\n}\n"],"mappings":"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"}
@@ -1,55 +0,0 @@
1
- import { NpmRuntimeDownloadedUpdate, NpmRuntimeUpdateProgressReporter } from "./npm-runtime-bundle.types.js";
2
- import { NpmRuntimeBundleLayoutStore } from "./npm-runtime-bundle-layout.store.js";
3
- import { NpmRuntimeBundleService } from "./npm-runtime-bundle.service.js";
4
- import { UpdateManifest, UpdateManifestReader } from "@nextclaw/kernel";
5
-
6
- //#region src/launcher/npm-runtime-update.service.d.ts
7
- type FetchLike = typeof fetch;
8
- type NpmRuntimeUpdateServiceOptions = {
9
- layout: NpmRuntimeBundleLayoutStore;
10
- bundleService: NpmRuntimeBundleService;
11
- launcherVersion: string;
12
- bundlePublicKey?: string;
13
- fetchImpl?: FetchLike;
14
- platform?: NodeJS.Platform;
15
- arch?: string;
16
- manifestReader?: UpdateManifestReader;
17
- now?: () => number;
18
- };
19
- type NpmRuntimeAvailableUpdate = {
20
- kind: "runtime-bundle-update";
21
- manifest: UpdateManifest;
22
- } | {
23
- kind: "host-update-required";
24
- manifest: UpdateManifest;
25
- } | {
26
- kind: "quarantined-bad-version";
27
- manifest: UpdateManifest;
28
- };
29
- declare class NpmRuntimeUpdateService {
30
- private readonly options;
31
- private readonly platform;
32
- private readonly arch;
33
- private readonly fetchImpl;
34
- private readonly manifestReader;
35
- private readonly bundlePublicKey;
36
- private readonly now;
37
- constructor(options: NpmRuntimeUpdateServiceOptions);
38
- hasSignatureVerifier: () => boolean;
39
- checkForUpdate: (manifestUrl: string, currentVersion: string | null, badVersions?: string[]) => Promise<NpmRuntimeAvailableUpdate | null>;
40
- downloadAndInstallUpdate: (manifest: UpdateManifest, reportProgress?: NpmRuntimeUpdateProgressReporter) => Promise<NpmRuntimeDownloadedUpdate>;
41
- private downloadBundleBytes;
42
- private fetchManifest;
43
- private verifyManifest;
44
- private fetchBundle;
45
- private readResponseBytes;
46
- private readContentLength;
47
- private reportDownloadProgress;
48
- private findBundleRoot;
49
- private parseBundlePublicKey;
50
- private assertManifestSignature;
51
- private assertBundleSignature;
52
- }
53
- //#endregion
54
- export { NpmRuntimeAvailableUpdate, NpmRuntimeUpdateService };
55
- //# sourceMappingURL=npm-runtime-update.service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"npm-runtime-update.service.d.ts","names":[],"sources":["../../src/launcher/npm-runtime-update.service.ts"],"mappings":";;;;;;KAkBK,SAAA,UAAmB,KAAA;AAAA,KAEnB,8BAAA;EACH,MAAA,EAAQ,2BAAA;EACR,aAAA,EAAe,uBAAA;EACf,eAAA;EACA,eAAA;EACA,SAAA,GAAY,SAAA;EACZ,QAAA,GAAW,MAAA,CAAO,QAAA;EAClB,IAAA;EACA,cAAA,GAAiB,oBAAA;EACjB,GAAA;AAAA;AAAA,KAGU,yBAAA;EACN,IAAA;EAA+B,QAAA,EAAU,cAAA;AAAA;EACzC,IAAA;EAA8B,QAAA,EAAU,cAAA;AAAA;EACxC,IAAA;EAAiC,QAAA,EAAU,cAAA;AAAA;AAAA,cAEpC,uBAAA;EAAA,iBAQkB,OAAA;EAAA,iBAPZ,QAAA;EAAA,iBACA,IAAA;EAAA,iBACA,SAAA;EAAA,iBACA,cAAA;EAAA,iBACA,eAAA;EAAA,iBACA,GAAA;cAEY,OAAA,EAAS,8BAAA;EAStC,oBAAA;EAEA,cAAA,GAAwB,WAAA,UAAqB,cAAA,iBAA+B,WAAA,gBAA6B,OAAA,CAAQ,yBAAA;EAcjH,wBAAA,GACE,QAAA,EAAU,cAAA,EACV,cAAA,GAAiB,gCAAA,KAChB,OAAA,CAAQ,0BAAA;EAAA,QAmCH,mBAAA;EAAA,QAcA,aAAA;EAAA,QAaA,cAAA;EAAA,QAiBA,WAAA;EAAA,QAiBA,iBAAA;EAAA,QA0BA,iBAAA;EAAA,QASA,sBAAA;EAAA,QAYA,cAAA;EAAA,QAYA,oBAAA;EAAA,QAgBA,uBAAA;EAAA,QAWA,qBAAA;AAAA"}
@@ -1,185 +0,0 @@
1
- import { compareNpmRuntimeVersions } from "./npm-runtime-bundle.service.js";
2
- import { UpdateManifestReader, serializeUnsignedUpdateManifest } from "@nextclaw/kernel";
3
- import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
4
- import { dirname, join, resolve, sep } from "node:path";
5
- import { fileURLToPath } from "node:url";
6
- import { rm } from "node:fs/promises";
7
- import { createHash, createPublicKey, verify } from "node:crypto";
8
- import JSZip from "jszip";
9
- //#region src/launcher/npm-runtime-update.service.ts
10
- var NpmRuntimeUpdateService = class {
11
- platform;
12
- arch;
13
- fetchImpl;
14
- manifestReader;
15
- bundlePublicKey;
16
- now;
17
- constructor(options) {
18
- this.options = options;
19
- this.platform = options.platform ?? process.platform;
20
- this.arch = options.arch ?? process.arch;
21
- this.fetchImpl = options.fetchImpl ?? fetch;
22
- this.manifestReader = options.manifestReader ?? new UpdateManifestReader();
23
- this.bundlePublicKey = this.parseBundlePublicKey(options.bundlePublicKey);
24
- this.now = options.now ?? Date.now;
25
- }
26
- hasSignatureVerifier = () => Boolean(this.bundlePublicKey);
27
- checkForUpdate = async (manifestUrl, currentVersion, badVersions = []) => {
28
- const manifest = await this.fetchManifest(manifestUrl);
29
- if (currentVersion && compareNpmRuntimeVersions(manifest.latestVersion, currentVersion) <= 0) return null;
30
- if (compareNpmRuntimeVersions(this.options.launcherVersion, manifest.minimumLauncherVersion) < 0) return {
31
- kind: "host-update-required",
32
- manifest
33
- };
34
- if (badVersions.includes(manifest.latestVersion)) return {
35
- kind: "quarantined-bad-version",
36
- manifest
37
- };
38
- return {
39
- kind: "runtime-bundle-update",
40
- manifest
41
- };
42
- };
43
- downloadAndInstallUpdate = async (manifest, reportProgress) => {
44
- const bytes = await this.downloadBundleBytes(manifest, reportProgress);
45
- const stagingRoot = join(this.options.layout.getStagingDir(), `download-${manifest.latestVersion}-${this.now()}`);
46
- await rm(stagingRoot, {
47
- recursive: true,
48
- force: true
49
- });
50
- mkdirSync(stagingRoot, { recursive: true });
51
- try {
52
- const zip = await JSZip.loadAsync(bytes);
53
- const entries = Object.values(zip.files);
54
- await Promise.all(entries.map(async (entry) => {
55
- const targetPath = resolve(stagingRoot, entry.name);
56
- const resolvedStagingRoot = resolve(stagingRoot);
57
- if (targetPath !== resolvedStagingRoot && !targetPath.startsWith(`${resolvedStagingRoot}${sep}`)) throw new Error(`runtime bundle archive contains invalid path: ${entry.name}`);
58
- if (entry.dir) {
59
- mkdirSync(targetPath, { recursive: true });
60
- return;
61
- }
62
- mkdirSync(dirname(targetPath), { recursive: true });
63
- writeFileSync(targetPath, Buffer.from(await entry.async("uint8array")));
64
- }));
65
- const bundleRoot = this.findBundleRoot(stagingRoot);
66
- const installedBundle = await this.options.bundleService.installFromDirectory(bundleRoot);
67
- return {
68
- manifest,
69
- downloadedVersion: installedBundle.manifest.bundleVersion,
70
- bundleDirectory: installedBundle.bundleDirectory
71
- };
72
- } catch (error) {
73
- await rm(stagingRoot, {
74
- recursive: true,
75
- force: true
76
- });
77
- throw error;
78
- }
79
- };
80
- downloadBundleBytes = async (manifest, reportProgress) => {
81
- const response = await this.fetchBundle(manifest.bundleUrl);
82
- const bytes = await this.readResponseBytes(response, reportProgress);
83
- const sha256 = createHash("sha256").update(bytes).digest("hex");
84
- if (sha256 !== manifest.bundleSha256) throw new Error(`runtime bundle sha256 mismatch: expected ${manifest.bundleSha256} but got ${sha256}`);
85
- this.assertBundleSignature(manifest, bytes);
86
- return bytes;
87
- };
88
- fetchManifest = async (manifestUrl) => {
89
- if (manifestUrl.startsWith("file://")) {
90
- const manifest = this.manifestReader.parse(JSON.parse(readFileSync(fileURLToPath(manifestUrl), "utf8")), manifestUrl);
91
- return this.verifyManifest(manifest, manifestUrl);
92
- }
93
- const response = await this.fetchImpl(manifestUrl);
94
- if (!response.ok) throw new Error(`runtime update manifest request failed with status ${response.status}`);
95
- const manifest = this.manifestReader.parse(await response.json(), manifestUrl);
96
- return this.verifyManifest(manifest, manifestUrl);
97
- };
98
- verifyManifest = (manifest, _manifestUrl) => {
99
- if (manifest.hostKind && manifest.hostKind !== "npm-runtime-bundle") throw new Error(`runtime update manifest hostKind mismatch: expected npm-runtime-bundle but got ${manifest.hostKind}`);
100
- if (manifest.channel !== "stable" && manifest.channel !== "beta") throw new Error(`runtime update manifest channel is unsupported: ${manifest.channel}`);
101
- if (manifest.platform !== this.platform) throw new Error(`runtime update manifest platform mismatch: expected ${this.platform} but got ${manifest.platform}`);
102
- if (manifest.arch !== this.arch) throw new Error(`runtime update manifest arch mismatch: expected ${this.arch} but got ${manifest.arch}`);
103
- this.assertManifestSignature(manifest);
104
- return manifest;
105
- };
106
- fetchBundle = async (bundleUrl) => {
107
- if (bundleUrl.startsWith("file://")) {
108
- const bytes = readFileSync(fileURLToPath(bundleUrl));
109
- return new Response(bytes, {
110
- status: 200,
111
- headers: { "content-length": String(bytes.byteLength) }
112
- });
113
- }
114
- const response = await this.fetchImpl(bundleUrl);
115
- if (!response.ok) throw new Error(`runtime bundle download failed with status ${response.status}`);
116
- return response;
117
- };
118
- readResponseBytes = async (response, reportProgress) => {
119
- const totalBytes = this.readContentLength(response);
120
- if (!response.body) {
121
- const bytes = Buffer.from(await response.arrayBuffer());
122
- this.reportDownloadProgress(reportProgress, bytes.byteLength, totalBytes ?? bytes.byteLength);
123
- return bytes;
124
- }
125
- const reader = response.body.getReader();
126
- const chunks = [];
127
- let downloadedBytes = 0;
128
- this.reportDownloadProgress(reportProgress, downloadedBytes, totalBytes);
129
- while (true) {
130
- const next = await reader.read();
131
- if (next.done) break;
132
- chunks.push(next.value);
133
- downloadedBytes += next.value.byteLength;
134
- this.reportDownloadProgress(reportProgress, downloadedBytes, totalBytes);
135
- }
136
- return Buffer.concat(chunks.map((chunk) => Buffer.from(chunk)));
137
- };
138
- readContentLength = (response) => {
139
- const raw = response.headers.get("content-length");
140
- if (!raw) return null;
141
- const parsed = Number(raw);
142
- return Number.isFinite(parsed) && parsed >= 0 ? parsed : null;
143
- };
144
- reportDownloadProgress = (reportProgress, downloadedBytes, totalBytes) => {
145
- reportProgress?.({
146
- downloadedBytes,
147
- totalBytes,
148
- percent: totalBytes && totalBytes > 0 ? Math.min(100, Math.round(downloadedBytes / totalBytes * 100)) : null
149
- });
150
- };
151
- findBundleRoot = (stagingRoot) => {
152
- if (existsSync(join(stagingRoot, "manifest.json"))) return stagingRoot;
153
- const entries = readDirectoryNames(stagingRoot).filter((entry) => existsSync(join(stagingRoot, entry, "manifest.json")));
154
- if (entries.length === 1) return join(stagingRoot, entries[0]);
155
- throw new Error(`runtime bundle archive does not contain exactly one manifest root under ${stagingRoot}`);
156
- };
157
- parseBundlePublicKey = (publicKey) => {
158
- const normalizedKey = publicKey?.trim();
159
- if (!normalizedKey) return null;
160
- const pemOrEscapedPem = normalizedKey.replaceAll("\\n", "\n");
161
- if (pemOrEscapedPem.includes("BEGIN PUBLIC KEY")) return createPublicKey(pemOrEscapedPem);
162
- return createPublicKey({
163
- key: Buffer.from(normalizedKey, "base64"),
164
- format: "der",
165
- type: "spki"
166
- });
167
- };
168
- assertManifestSignature = (manifest) => {
169
- if (!this.bundlePublicKey) throw new Error("runtime update manifest signature verification requires bundlePublicKey");
170
- const signature = Buffer.from(manifest.manifestSignature, "base64");
171
- if (!verify(null, Buffer.from(serializeUnsignedUpdateManifest(manifest)), this.bundlePublicKey, signature)) throw new Error(`runtime update manifest signature verification failed for ${manifest.latestVersion}`);
172
- };
173
- assertBundleSignature = (manifest, bytes) => {
174
- if (!this.bundlePublicKey) throw new Error("runtime bundle signature verification requires bundlePublicKey");
175
- const signature = Buffer.from(manifest.bundleSignature, "base64");
176
- if (!verify(null, bytes, this.bundlePublicKey, signature)) throw new Error(`runtime bundle signature verification failed for ${manifest.latestVersion}`);
177
- };
178
- };
179
- function readDirectoryNames(directory) {
180
- return readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
181
- }
182
- //#endregion
183
- export { NpmRuntimeUpdateService };
184
-
185
- //# sourceMappingURL=npm-runtime-update.service.js.map