charness 3.7.0 → 3.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (393) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/DEVELOPMENT.md +8 -2
  3. package/README.md +5 -5
  4. package/SETUP.md +17 -5
  5. package/agent-plugin/skills/charness-manager/SKILL.md +3 -3
  6. package/dist/adapters/openCodeAdapter.d.ts.map +1 -1
  7. package/dist/adapters/openCodeAdapter.js +2 -1
  8. package/dist/adapters/openCodeAdapter.js.map +1 -1
  9. package/dist/bot.d.ts.map +1 -1
  10. package/dist/bot.js +50 -9
  11. package/dist/bot.js.map +1 -1
  12. package/dist/cli.d.ts +2 -0
  13. package/dist/cli.d.ts.map +1 -1
  14. package/dist/cli.js +56 -6
  15. package/dist/cli.js.map +1 -1
  16. package/dist/configDirFile.d.ts +7 -3
  17. package/dist/configDirFile.d.ts.map +1 -1
  18. package/dist/configDirFile.js +12 -5
  19. package/dist/configDirFile.js.map +1 -1
  20. package/dist/connectors/telegram/commands/botCore.d.ts +5 -1
  21. package/dist/connectors/telegram/commands/botCore.d.ts.map +1 -1
  22. package/dist/connectors/telegram/commands/runners.d.ts +52 -0
  23. package/dist/connectors/telegram/commands/runners.d.ts.map +1 -0
  24. package/dist/connectors/telegram/commands/runners.js +524 -0
  25. package/dist/connectors/telegram/commands/runners.js.map +1 -0
  26. package/dist/connectors/telegram/runnerPairingMessages.d.ts +29 -0
  27. package/dist/connectors/telegram/runnerPairingMessages.d.ts.map +1 -0
  28. package/dist/connectors/telegram/runnerPairingMessages.js +112 -0
  29. package/dist/connectors/telegram/runnerPairingMessages.js.map +1 -0
  30. package/dist/i18n/de.d.ts.map +1 -1
  31. package/dist/i18n/de.js +60 -0
  32. package/dist/i18n/de.js.map +1 -1
  33. package/dist/i18n/en.d.ts.map +1 -1
  34. package/dist/i18n/en.js +60 -0
  35. package/dist/i18n/en.js.map +1 -1
  36. package/dist/i18n/es.d.ts.map +1 -1
  37. package/dist/i18n/es.js +60 -0
  38. package/dist/i18n/es.js.map +1 -1
  39. package/dist/i18n/fr.d.ts.map +1 -1
  40. package/dist/i18n/fr.js +60 -0
  41. package/dist/i18n/fr.js.map +1 -1
  42. package/dist/i18n/hi.d.ts.map +1 -1
  43. package/dist/i18n/hi.js +60 -0
  44. package/dist/i18n/hi.js.map +1 -1
  45. package/dist/i18n/ja.d.ts.map +1 -1
  46. package/dist/i18n/ja.js +60 -0
  47. package/dist/i18n/ja.js.map +1 -1
  48. package/dist/i18n/ka.d.ts.map +1 -1
  49. package/dist/i18n/ka.js +60 -0
  50. package/dist/i18n/ka.js.map +1 -1
  51. package/dist/i18n/pt.d.ts.map +1 -1
  52. package/dist/i18n/pt.js +60 -0
  53. package/dist/i18n/pt.js.map +1 -1
  54. package/dist/i18n/ru.d.ts.map +1 -1
  55. package/dist/i18n/ru.js +60 -0
  56. package/dist/i18n/ru.js.map +1 -1
  57. package/dist/i18n/uk.d.ts.map +1 -1
  58. package/dist/i18n/uk.js +60 -0
  59. package/dist/i18n/uk.js.map +1 -1
  60. package/dist/i18n/uz.d.ts.map +1 -1
  61. package/dist/i18n/uz.js +60 -0
  62. package/dist/i18n/uz.js.map +1 -1
  63. package/dist/i18n/zh.d.ts.map +1 -1
  64. package/dist/i18n/zh.js +60 -0
  65. package/dist/i18n/zh.js.map +1 -1
  66. package/dist/index.d.ts +1 -1
  67. package/dist/index.d.ts.map +1 -1
  68. package/dist/index.js +3 -1
  69. package/dist/index.js.map +1 -1
  70. package/dist/installManager.d.ts +57 -1
  71. package/dist/installManager.d.ts.map +1 -1
  72. package/dist/installManager.js +88 -10
  73. package/dist/installManager.js.map +1 -1
  74. package/dist/instanceSettings.d.ts +12 -2
  75. package/dist/instanceSettings.d.ts.map +1 -1
  76. package/dist/instanceSettings.js +17 -3
  77. package/dist/instanceSettings.js.map +1 -1
  78. package/dist/outputTrace.d.ts +6 -0
  79. package/dist/outputTrace.d.ts.map +1 -1
  80. package/dist/outputTrace.js +24 -1
  81. package/dist/outputTrace.js.map +1 -1
  82. package/dist/remoteRun/cliArgs.d.ts +2 -0
  83. package/dist/remoteRun/cliArgs.d.ts.map +1 -1
  84. package/dist/remoteRun/cliArgs.js +11 -2
  85. package/dist/remoteRun/cliArgs.js.map +1 -1
  86. package/dist/remoteRun/commands.d.ts +21 -0
  87. package/dist/remoteRun/commands.d.ts.map +1 -1
  88. package/dist/remoteRun/commands.js +38 -17
  89. package/dist/remoteRun/commands.js.map +1 -1
  90. package/dist/remoteRun/interrupts.d.ts +10 -0
  91. package/dist/remoteRun/interrupts.d.ts.map +1 -1
  92. package/dist/remoteRun/interrupts.js +43 -6
  93. package/dist/remoteRun/interrupts.js.map +1 -1
  94. package/dist/remoteRun/output.d.ts +2 -0
  95. package/dist/remoteRun/output.d.ts.map +1 -1
  96. package/dist/remoteRun/output.js +45 -0
  97. package/dist/remoteRun/output.js.map +1 -1
  98. package/dist/remoteRun/pairedRunners.d.ts +51 -0
  99. package/dist/remoteRun/pairedRunners.d.ts.map +1 -0
  100. package/dist/remoteRun/pairedRunners.js +165 -0
  101. package/dist/remoteRun/pairedRunners.js.map +1 -0
  102. package/dist/remoteRun/probe.d.ts +23 -1
  103. package/dist/remoteRun/probe.d.ts.map +1 -1
  104. package/dist/remoteRun/probe.js +45 -11
  105. package/dist/remoteRun/probe.js.map +1 -1
  106. package/dist/remoteRun/remoteRunCli.d.ts +13 -6
  107. package/dist/remoteRun/remoteRunCli.d.ts.map +1 -1
  108. package/dist/remoteRun/remoteRunCli.js +34 -59
  109. package/dist/remoteRun/remoteRunCli.js.map +1 -1
  110. package/dist/remoteRun/runnerClient.d.ts +2 -0
  111. package/dist/remoteRun/runnerClient.d.ts.map +1 -1
  112. package/dist/remoteRun/runnerClient.js +5 -1
  113. package/dist/remoteRun/runnerClient.js.map +1 -1
  114. package/dist/remoteRun/runnerSummary.d.ts +24 -0
  115. package/dist/remoteRun/runnerSummary.d.ts.map +1 -0
  116. package/dist/remoteRun/runnerSummary.js +86 -0
  117. package/dist/remoteRun/runnerSummary.js.map +1 -0
  118. package/dist/remoteRun/runnerWait.d.ts +68 -0
  119. package/dist/remoteRun/runnerWait.d.ts.map +1 -0
  120. package/dist/remoteRun/runnerWait.js +137 -0
  121. package/dist/remoteRun/runnerWait.js.map +1 -0
  122. package/dist/remoteRun/runnerWaitTiming.d.ts +16 -0
  123. package/dist/remoteRun/runnerWaitTiming.d.ts.map +1 -0
  124. package/dist/remoteRun/runnerWaitTiming.js +37 -0
  125. package/dist/remoteRun/runnerWaitTiming.js.map +1 -0
  126. package/dist/remoteRun/runners.d.ts +15 -8
  127. package/dist/remoteRun/runners.d.ts.map +1 -1
  128. package/dist/remoteRun/runners.js +59 -19
  129. package/dist/remoteRun/runners.js.map +1 -1
  130. package/dist/remoteRun/runnersCatalog.d.ts +14 -0
  131. package/dist/remoteRun/runnersCatalog.d.ts.map +1 -0
  132. package/dist/remoteRun/runnersCatalog.js +68 -0
  133. package/dist/remoteRun/runnersCatalog.js.map +1 -0
  134. package/dist/remoteRun/runnersConfig.d.ts +31 -20
  135. package/dist/remoteRun/runnersConfig.d.ts.map +1 -1
  136. package/dist/remoteRun/runnersConfig.js +14 -12
  137. package/dist/remoteRun/runnersConfig.js.map +1 -1
  138. package/dist/remoteRun/ssh.d.ts +22 -2
  139. package/dist/remoteRun/ssh.d.ts.map +1 -1
  140. package/dist/remoteRun/ssh.js +41 -7
  141. package/dist/remoteRun/ssh.js.map +1 -1
  142. package/dist/runnerUtility/adminCheck.d.ts +18 -0
  143. package/dist/runnerUtility/adminCheck.d.ts.map +1 -0
  144. package/dist/runnerUtility/adminCheck.js +69 -0
  145. package/dist/runnerUtility/adminCheck.js.map +1 -0
  146. package/dist/runnerUtility/adminService.d.ts +22 -0
  147. package/dist/runnerUtility/adminService.d.ts.map +1 -0
  148. package/dist/runnerUtility/adminService.js +145 -0
  149. package/dist/runnerUtility/adminService.js.map +1 -0
  150. package/dist/runnerUtility/appInstall.d.ts +25 -0
  151. package/dist/runnerUtility/appInstall.d.ts.map +1 -0
  152. package/dist/runnerUtility/appInstall.js +147 -0
  153. package/dist/runnerUtility/appInstall.js.map +1 -0
  154. package/dist/runnerUtility/appUpdate.d.ts +39 -0
  155. package/dist/runnerUtility/appUpdate.d.ts.map +1 -0
  156. package/dist/runnerUtility/appUpdate.js +90 -0
  157. package/dist/runnerUtility/appUpdate.js.map +1 -0
  158. package/dist/runnerUtility/execEnv.d.ts +21 -0
  159. package/dist/runnerUtility/execEnv.d.ts.map +1 -0
  160. package/dist/runnerUtility/execEnv.js +109 -0
  161. package/dist/runnerUtility/execEnv.js.map +1 -0
  162. package/dist/runnerUtility/execSession.d.ts +13 -0
  163. package/dist/runnerUtility/execSession.d.ts.map +1 -0
  164. package/dist/runnerUtility/execSession.js +58 -0
  165. package/dist/runnerUtility/execSession.js.map +1 -0
  166. package/dist/runnerUtility/hubClient.d.ts +30 -0
  167. package/dist/runnerUtility/hubClient.d.ts.map +1 -0
  168. package/dist/runnerUtility/hubClient.js +127 -0
  169. package/dist/runnerUtility/hubClient.js.map +1 -0
  170. package/dist/runnerUtility/injectStream.d.ts +9 -0
  171. package/dist/runnerUtility/injectStream.d.ts.map +1 -0
  172. package/dist/runnerUtility/injectStream.js +12 -0
  173. package/dist/runnerUtility/injectStream.js.map +1 -0
  174. package/dist/runnerUtility/iosCheck.d.ts +62 -0
  175. package/dist/runnerUtility/iosCheck.d.ts.map +1 -0
  176. package/dist/runnerUtility/iosCheck.js +200 -0
  177. package/dist/runnerUtility/iosCheck.js.map +1 -0
  178. package/dist/runnerUtility/launcher.d.ts +5 -0
  179. package/dist/runnerUtility/launcher.d.ts.map +1 -0
  180. package/dist/runnerUtility/launcher.js +85 -0
  181. package/dist/runnerUtility/launcher.js.map +1 -0
  182. package/dist/runnerUtility/linkLoop.d.ts +39 -0
  183. package/dist/runnerUtility/linkLoop.d.ts.map +1 -0
  184. package/dist/runnerUtility/linkLoop.js +274 -0
  185. package/dist/runnerUtility/linkLoop.js.map +1 -0
  186. package/dist/runnerUtility/localLinkStop.d.ts +23 -0
  187. package/dist/runnerUtility/localLinkStop.d.ts.map +1 -0
  188. package/dist/runnerUtility/localLinkStop.js +79 -0
  189. package/dist/runnerUtility/localLinkStop.js.map +1 -0
  190. package/dist/runnerUtility/machineReport.d.ts +39 -0
  191. package/dist/runnerUtility/machineReport.d.ts.map +1 -0
  192. package/dist/runnerUtility/machineReport.js +161 -0
  193. package/dist/runnerUtility/machineReport.js.map +1 -0
  194. package/dist/runnerUtility/packageId.d.ts +5 -0
  195. package/dist/runnerUtility/packageId.d.ts.map +1 -0
  196. package/dist/runnerUtility/packageId.js +64 -0
  197. package/dist/runnerUtility/packageId.js.map +1 -0
  198. package/dist/runnerUtility/pairArgs.d.ts +16 -0
  199. package/dist/runnerUtility/pairArgs.d.ts.map +1 -0
  200. package/dist/runnerUtility/pairArgs.js +17 -0
  201. package/dist/runnerUtility/pairArgs.js.map +1 -0
  202. package/dist/runnerUtility/pairingRecovery.d.ts +31 -0
  203. package/dist/runnerUtility/pairingRecovery.d.ts.map +1 -0
  204. package/dist/runnerUtility/pairingRecovery.js +24 -0
  205. package/dist/runnerUtility/pairingRecovery.js.map +1 -0
  206. package/dist/runnerUtility/pueueDaemon.d.ts +36 -0
  207. package/dist/runnerUtility/pueueDaemon.d.ts.map +1 -0
  208. package/dist/runnerUtility/pueueDaemon.js +165 -0
  209. package/dist/runnerUtility/pueueDaemon.js.map +1 -0
  210. package/dist/runnerUtility/rootServiceCli.d.ts +8 -0
  211. package/dist/runnerUtility/rootServiceCli.d.ts.map +1 -0
  212. package/dist/runnerUtility/rootServiceCli.js +31 -0
  213. package/dist/runnerUtility/rootServiceCli.js.map +1 -0
  214. package/dist/runnerUtility/runnerCli.d.ts +18 -0
  215. package/dist/runnerUtility/runnerCli.d.ts.map +1 -0
  216. package/dist/runnerUtility/runnerCli.js +190 -0
  217. package/dist/runnerUtility/runnerCli.js.map +1 -0
  218. package/dist/runnerUtility/runnerCommands.d.ts +76 -0
  219. package/dist/runnerUtility/runnerCommands.d.ts.map +1 -0
  220. package/dist/runnerUtility/runnerCommands.js +464 -0
  221. package/dist/runnerUtility/runnerCommands.js.map +1 -0
  222. package/dist/runnerUtility/runnerConfig.d.ts +63 -0
  223. package/dist/runnerUtility/runnerConfig.d.ts.map +1 -0
  224. package/dist/runnerUtility/runnerConfig.js +153 -0
  225. package/dist/runnerUtility/runnerConfig.js.map +1 -0
  226. package/dist/runnerUtility/runnerFlags.d.ts +9 -0
  227. package/dist/runnerUtility/runnerFlags.d.ts.map +1 -0
  228. package/dist/runnerUtility/runnerFlags.js +53 -0
  229. package/dist/runnerUtility/runnerFlags.js.map +1 -0
  230. package/dist/runnerUtility/runnerHome.d.ts +30 -0
  231. package/dist/runnerUtility/runnerHome.d.ts.map +1 -0
  232. package/dist/runnerUtility/runnerHome.js +82 -0
  233. package/dist/runnerUtility/runnerHome.js.map +1 -0
  234. package/dist/runnerUtility/runnerKeys.d.ts +11 -0
  235. package/dist/runnerUtility/runnerKeys.d.ts.map +1 -0
  236. package/dist/runnerUtility/runnerKeys.js +80 -0
  237. package/dist/runnerUtility/runnerKeys.js.map +1 -0
  238. package/dist/runnerUtility/runnerServers.d.ts +40 -0
  239. package/dist/runnerUtility/runnerServers.d.ts.map +1 -0
  240. package/dist/runnerUtility/runnerServers.js +79 -0
  241. package/dist/runnerUtility/runnerServers.js.map +1 -0
  242. package/dist/runnerUtility/serviceCommon.d.ts +97 -0
  243. package/dist/runnerUtility/serviceCommon.d.ts.map +1 -0
  244. package/dist/runnerUtility/serviceCommon.js +209 -0
  245. package/dist/runnerUtility/serviceCommon.js.map +1 -0
  246. package/dist/runnerUtility/serviceManager.d.ts +51 -0
  247. package/dist/runnerUtility/serviceManager.d.ts.map +1 -0
  248. package/dist/runnerUtility/serviceManager.js +344 -0
  249. package/dist/runnerUtility/serviceManager.js.map +1 -0
  250. package/dist/runnerUtility/serviceUnits.d.ts +38 -0
  251. package/dist/runnerUtility/serviceUnits.d.ts.map +1 -0
  252. package/dist/runnerUtility/serviceUnits.js +189 -0
  253. package/dist/runnerUtility/serviceUnits.js.map +1 -0
  254. package/dist/runnerUtility/toolInstall.d.ts +95 -0
  255. package/dist/runnerUtility/toolInstall.d.ts.map +1 -0
  256. package/dist/runnerUtility/toolInstall.js +232 -0
  257. package/dist/runnerUtility/toolInstall.js.map +1 -0
  258. package/dist/runnerUtility/versionPollTiming.d.ts +16 -0
  259. package/dist/runnerUtility/versionPollTiming.d.ts.map +1 -0
  260. package/dist/runnerUtility/versionPollTiming.js +36 -0
  261. package/dist/runnerUtility/versionPollTiming.js.map +1 -0
  262. package/dist/runners/authorizedKeys.d.ts +52 -0
  263. package/dist/runners/authorizedKeys.d.ts.map +1 -0
  264. package/dist/runners/authorizedKeys.js +153 -0
  265. package/dist/runners/authorizedKeys.js.map +1 -0
  266. package/dist/runners/bootstrapLine.d.ts +13 -0
  267. package/dist/runners/bootstrapLine.d.ts.map +1 -0
  268. package/dist/runners/bootstrapLine.js +154 -0
  269. package/dist/runners/bootstrapLine.js.map +1 -0
  270. package/dist/runners/gate.d.ts +41 -0
  271. package/dist/runners/gate.d.ts.map +1 -0
  272. package/dist/runners/gate.js +225 -0
  273. package/dist/runners/gate.js.map +1 -0
  274. package/dist/runners/gateLink.d.ts +26 -0
  275. package/dist/runners/gateLink.d.ts.map +1 -0
  276. package/dist/runners/gateLink.js +240 -0
  277. package/dist/runners/gateLink.js.map +1 -0
  278. package/dist/runners/gateProtocol.d.ts +104 -0
  279. package/dist/runners/gateProtocol.d.ts.map +1 -0
  280. package/dist/runners/gateProtocol.js +151 -0
  281. package/dist/runners/gateProtocol.js.map +1 -0
  282. package/dist/runners/gateWrapper.d.ts +6 -0
  283. package/dist/runners/gateWrapper.d.ts.map +1 -0
  284. package/dist/runners/gateWrapper.js +70 -0
  285. package/dist/runners/gateWrapper.js.map +1 -0
  286. package/dist/runners/hubAddress.d.ts +33 -0
  287. package/dist/runners/hubAddress.d.ts.map +1 -0
  288. package/dist/runners/hubAddress.js +88 -0
  289. package/dist/runners/hubAddress.js.map +1 -0
  290. package/dist/runners/hubAddressCandidates.d.ts +16 -0
  291. package/dist/runners/hubAddressCandidates.d.ts.map +1 -0
  292. package/dist/runners/hubAddressCandidates.js +96 -0
  293. package/dist/runners/hubAddressCandidates.js.map +1 -0
  294. package/dist/runners/hubIds.d.ts +16 -0
  295. package/dist/runners/hubIds.d.ts.map +1 -0
  296. package/dist/runners/hubIds.js +25 -0
  297. package/dist/runners/hubIds.js.map +1 -0
  298. package/dist/runners/hubKey.d.ts +6 -0
  299. package/dist/runners/hubKey.d.ts.map +1 -0
  300. package/dist/runners/hubKey.js +78 -0
  301. package/dist/runners/hubKey.js.map +1 -0
  302. package/dist/runners/hubLock.d.ts +7 -0
  303. package/dist/runners/hubLock.d.ts.map +1 -0
  304. package/dist/runners/hubLock.js +230 -0
  305. package/dist/runners/hubLock.js.map +1 -0
  306. package/dist/runners/hubPackage.d.ts +23 -0
  307. package/dist/runners/hubPackage.d.ts.map +1 -0
  308. package/dist/runners/hubPackage.js +184 -0
  309. package/dist/runners/hubPackage.js.map +1 -0
  310. package/dist/runners/hubPairing.d.ts +70 -0
  311. package/dist/runners/hubPairing.d.ts.map +1 -0
  312. package/dist/runners/hubPairing.js +277 -0
  313. package/dist/runners/hubPairing.js.map +1 -0
  314. package/dist/runners/hubPaths.d.ts +42 -0
  315. package/dist/runners/hubPaths.d.ts.map +1 -0
  316. package/dist/runners/hubPaths.js +96 -0
  317. package/dist/runners/hubPaths.js.map +1 -0
  318. package/dist/runners/hubRegistry.d.ts +134 -0
  319. package/dist/runners/hubRegistry.d.ts.map +1 -0
  320. package/dist/runners/hubRegistry.js +256 -0
  321. package/dist/runners/hubRegistry.js.map +1 -0
  322. package/dist/runners/linkControl.d.ts +38 -0
  323. package/dist/runners/linkControl.d.ts.map +1 -0
  324. package/dist/runners/linkControl.js +171 -0
  325. package/dist/runners/linkControl.js.map +1 -0
  326. package/dist/runners/pairCode.d.ts +30 -0
  327. package/dist/runners/pairCode.d.ts.map +1 -0
  328. package/dist/runners/pairCode.js +46 -0
  329. package/dist/runners/pairCode.js.map +1 -0
  330. package/dist/runners/pairingTiming.d.ts +18 -0
  331. package/dist/runners/pairingTiming.d.ts.map +1 -0
  332. package/dist/runners/pairingTiming.js +42 -0
  333. package/dist/runners/pairingTiming.js.map +1 -0
  334. package/dist/runners/removalTiming.d.ts +13 -0
  335. package/dist/runners/removalTiming.d.ts.map +1 -0
  336. package/dist/runners/removalTiming.js +17 -0
  337. package/dist/runners/removalTiming.js.map +1 -0
  338. package/dist/runners/runnerProxy.d.ts +9 -0
  339. package/dist/runners/runnerProxy.d.ts.map +1 -0
  340. package/dist/runners/runnerProxy.js +67 -0
  341. package/dist/runners/runnerProxy.js.map +1 -0
  342. package/dist/runners/runnerRemoval.d.ts +21 -0
  343. package/dist/runners/runnerRemoval.d.ts.map +1 -0
  344. package/dist/runners/runnerRemoval.js +94 -0
  345. package/dist/runners/runnerRemoval.js.map +1 -0
  346. package/dist/runners/runnerServiceKind.d.ts +10 -0
  347. package/dist/runners/runnerServiceKind.d.ts.map +1 -0
  348. package/dist/runners/runnerServiceKind.js +13 -0
  349. package/dist/runners/runnerServiceKind.js.map +1 -0
  350. package/dist/runners/runnersCli.d.ts +25 -0
  351. package/dist/runners/runnersCli.d.ts.map +1 -0
  352. package/dist/runners/runnersCli.js +239 -0
  353. package/dist/runners/runnersCli.js.map +1 -0
  354. package/dist/runners/runnersList.d.ts +14 -0
  355. package/dist/runners/runnersList.d.ts.map +1 -0
  356. package/dist/runners/runnersList.js +51 -0
  357. package/dist/runners/runnersList.js.map +1 -0
  358. package/dist/runners/runnersOverview.d.ts +20 -0
  359. package/dist/runners/runnersOverview.d.ts.map +1 -0
  360. package/dist/runners/runnersOverview.js +56 -0
  361. package/dist/runners/runnersOverview.js.map +1 -0
  362. package/dist/runners/sshKeys.d.ts +26 -0
  363. package/dist/runners/sshKeys.d.ts.map +1 -0
  364. package/dist/runners/sshKeys.js +60 -0
  365. package/dist/runners/sshKeys.js.map +1 -0
  366. package/dist/runners/tarArchive.d.ts +20 -0
  367. package/dist/runners/tarArchive.d.ts.map +1 -0
  368. package/dist/runners/tarArchive.js +70 -0
  369. package/dist/runners/tarArchive.js.map +1 -0
  370. package/dist/scheduler/mcpSurface.d.ts +11 -5
  371. package/dist/scheduler/mcpSurface.d.ts.map +1 -1
  372. package/dist/scheduler/mcpSurface.js +59 -26
  373. package/dist/scheduler/mcpSurface.js.map +1 -1
  374. package/dist/selfUpdate/selfCheck.d.ts +13 -0
  375. package/dist/selfUpdate/selfCheck.d.ts.map +1 -1
  376. package/dist/selfUpdate/selfCheck.js +9 -3
  377. package/dist/selfUpdate/selfCheck.js.map +1 -1
  378. package/dist/stt/sttInstallEntry.js +7 -4
  379. package/dist/stt/sttInstallEntry.js.map +1 -1
  380. package/dist/testTimings.d.ts +5 -2
  381. package/dist/testTimings.d.ts.map +1 -1
  382. package/dist/testTimings.js +10 -1
  383. package/dist/testTimings.js.map +1 -1
  384. package/dist/utils/agentEnvironment.d.ts +6 -2
  385. package/dist/utils/agentEnvironment.d.ts.map +1 -1
  386. package/dist/utils/agentEnvironment.js +13 -2
  387. package/dist/utils/agentEnvironment.js.map +1 -1
  388. package/dist/utils/runnersScreenPlan.d.ts +141 -0
  389. package/dist/utils/runnersScreenPlan.d.ts.map +1 -0
  390. package/dist/utils/runnersScreenPlan.js +272 -0
  391. package/dist/utils/runnersScreenPlan.js.map +1 -0
  392. package/package.json +5 -2
  393. package/remoteRun/runner.sh +81 -6
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorizedKeys.js","sourceRoot":"","sources":["../../src/runners/authorizedKeys.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,kDAIC;AAMD,kDAUC;AAGD,4CAGC;AAoBD,4CAEC;AAWD,gDAEC;AAYD,4DAEC;AAOD,8CAOC;AAxID,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,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAC5F,MAAM,UAAU,GAAG,EAAE,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC;IAChH,MAAM,OAAO,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAC9C,MAAM,IAAI,GAAG,mBAAmB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IACtD,IAAI,IAAI,KAAK,OAAO;QAAE,OAAO;IAC7B,IAAA,uCAAuB,EAAC,UAAU,EAAE,IAAI,EAAE,kBAAkB,CAAC,CAAC;AAChE,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { type PairCodePayload } from './pairCode';
2
+ /** @description The account the admin line pairs unless the operator changes its last word. */
3
+ export declare const defaultRunnerAccount = "runner";
4
+ /** @description Is `name` a plain account name (letters, digits, `.`, `_`, `-`; no leading `-`)? The admin line refuses anything else. */
5
+ export declare function checkIsAccountName(name: string): boolean;
6
+ /** @description The command to paste on the runner machine, as the account that will run jobs, for the pairing `payload`. */
7
+ export declare function buildBootstrapLine(payload: PairCodePayload): string;
8
+ /**
9
+ * @description The command to paste in an ADMIN account's terminal on the runner machine: it checks `account`, pairs it, and installs its
10
+ * always-on service. `account` is the line's last word, so the operator can change it by hand.
11
+ */
12
+ export declare function buildAdminBootstrapLine(payload: PairCodePayload, account?: string): string;
13
+ //# sourceMappingURL=bootstrapLine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrapLine.d.ts","sourceRoot":"","sources":["../../src/runners/bootstrapLine.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkB,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAuDlE,+FAA+F;AAC/F,eAAO,MAAM,oBAAoB,WAAW,CAAC;AAK7C,0IAA0I;AAC1I,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAExD;AAkDD,6HAA6H;AAC7H,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAGnE;AA2BD;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,GAAE,MAA6B,GAAG,MAAM,CAGhH"}
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defaultRunnerAccount = void 0;
4
+ exports.checkIsAccountName = checkIsAccountName;
5
+ exports.buildBootstrapLine = buildBootstrapLine;
6
+ exports.buildAdminBootstrapLine = buildAdminBootstrapLine;
7
+ const adminCheck_1 = require("../runnerUtility/adminCheck");
8
+ const pairArgs_1 = require("../runnerUtility/pairArgs");
9
+ const gateProtocol_1 = require("./gateProtocol");
10
+ const pairCode_1 = require("./pairCode");
11
+ /**
12
+ * @description The lines the operator runs on the runner machine. They are plain `sh` (a runner has nothing of charness yet): they
13
+ * write the pairing's temporary key and the hub's host key into a private temp folder (removed on exit), download the hub's own
14
+ * charness package through the gate's `bootstrap` request, unpack it, and hand over to the runner utility's `pair` step with the
15
+ * pairing code and the id of the archive they downloaded (the hub announces it in the marker line; the first step checks the archive against it). What the hub's shell printed before the gate ran (a banner, a motd) is skipped: the answer opens with the marker line,
16
+ * which `grep -b` finds among the first {@link maxGateNoiseBytes} bytes, and the archive is cut out from the byte after it.
17
+ *
18
+ * Contract with the runner utility: `runnerCli.js pair --bootstrap <unpacked folder> --archive <file> --package-id <id> <code>` is started with a package that has NO
19
+ * `node_modules` yet, so it reaches its install step (`npm install --omit=dev --ignore-scripts` into its own app folder) using
20
+ * Node's built-ins only.
21
+ *
22
+ * Every value in the line passed a strict pattern (`pairCode.ts`) that has no quote, space, `$`, backtick or backslash; the line
23
+ * itself is wrapped in single quotes and so holds none.
24
+ *
25
+ * The PLAIN line ({@link buildBootstrapLine}) is run as the runner account itself: all of it is that account's.
26
+ *
27
+ * The ADMIN line ({@link buildAdminBootstrapLine}), `sudo sh -c '<script>' sh <account>`, is run from an admin account and does everything
28
+ * for the account named by its last word. The runner account runs the agents' code, so ROOT never executes, reads through or writes into
29
+ * anything that account can change. As root the script (1) checks the account (it exists; not root; not an admin; the OS is known),
30
+ * (2) downloads the package into a folder of ITS OWN in `/tmp` — root-owned, readable by the account, extracted with `--no-same-owner`
31
+ * — (3) has the account pair itself from that copy (`sudo -u <account> -H node …/runnerCli.js pair`: its files are the account's, never
32
+ * root's), and (4) runs the root step from the same root-owned copy (`rootServiceCli.js install <account>`: Node built-ins only, because
33
+ * the copy has no dependencies — it installs the always-on service, and touches the account's side only through `sudo -u`, see
34
+ * `runnerUtility/adminService.ts`). The pairing code stays single use, 10 minutes, a secret; sudo logs the command line, so a code that
35
+ * is neither used nor closed stays live in that log until it runs out: a refused line (no such account, an admin account) leaves it open ON
36
+ * PURPOSE — the operator fixes the last word and pastes the same line again — and an already-paired account's line closes its own code (the
37
+ * gate's `cancel`). Nothing creates an account. Run again for an account that is already paired, the line pairs nothing twice and installs
38
+ * the service — that is its way to retry.
39
+ *
40
+ * What the admin line trusts: the charness host. The line is text the host made, and the program root runs from it is the one in the host's
41
+ * own install, so whoever can change that install (its user, and the agents that run as that user) controls code that runs as root on the
42
+ * runner machine — and what it installs outlasts the paste. The plain line trusts the host only with the runner account. Every place that
43
+ * offers the line says so: the Telegram message (`runners.pairingAdminIntro`) and the CLI's text (`adminLineTrustSentence` in `runnersCli.ts`).
44
+ */
45
+ const minNodeMajor = 22;
46
+ const minNodeMinor = 12;
47
+ const hubHostAlias = 'charness-hub';
48
+ const privateKeyFoldWidth = 70;
49
+ const privateKeyHeader = '-----BEGIN OPENSSH PRIVATE KEY-----';
50
+ const privateKeyFooter = '-----END OPENSSH PRIVATE KEY-----';
51
+ const connectTimeoutSeconds = 20;
52
+ /** The marker line of a `bootstrap` answer as an extended regular expression: the marker, the request, optional `key=value` fields. */
53
+ const bootstrapMarkerPattern = `^${gateProtocol_1.gateMarker} bootstrap( [a-z]+=[A-Za-z0-9._:@/-]*)*$`;
54
+ const runnerCliInPackage = 'dist/runnerUtility/runnerCli.js';
55
+ const rootServiceCliInPackage = 'dist/runnerUtility/rootServiceCli.js';
56
+ /** Where the admin line's root-owned copy is made: a folder the account can read, which `$TMPDIR` (the admin's own, private) is not. */
57
+ const adminCopyBase = '/tmp';
58
+ function getPrivateKeyBody(privateKey) {
59
+ return privateKey.replace(privateKeyHeader, '').replace(privateKeyFooter, '').replace(/\s+/g, '');
60
+ }
61
+ /** @description The account the admin line pairs unless the operator changes its last word. */
62
+ exports.defaultRunnerAccount = 'runner';
63
+ /** The characters of an account name the admin line lets through (a character class body): none is special to a shell, and a name never starts with `-`. */
64
+ const accountNameChars = 'A-Za-z0-9._-';
65
+ const accountNamePattern = new RegExp(`^(?!-)[${accountNameChars}]+$`);
66
+ /** @description Is `name` a plain account name (letters, digits, `.`, `_`, `-`; no leading `-`)? The admin line refuses anything else. */
67
+ function checkIsAccountName(name) {
68
+ return accountNamePattern.test(name);
69
+ }
70
+ /**
71
+ * The steps that make the package ready in `$d/pkg` (and its archive in `$d/package.tgz`): `sh` that needs nothing of charness. `isForAccount`:
72
+ * the copy is made by ROOT for an account to read — its folder is world-readable (the key files in it stay 0600), the archive and the
73
+ * package are extracted readable, and without taking the owner from the archive, so root's copy stays root's.
74
+ */
75
+ function renderFetchSteps(payload, isForAccount) {
76
+ const sshOptions = [
77
+ '-T', '-F /dev/null', '-i "$d/key"',
78
+ '-o BatchMode=yes', '-o IdentitiesOnly=yes', '-o IdentityAgent=none',
79
+ '-o StrictHostKeyChecking=yes', '-o UserKnownHostsFile="$d/kh"', '-o GlobalKnownHostsFile=/dev/null',
80
+ `-o HostKeyAlias=${hubHostAlias}`, `-o ConnectTimeout=${connectTimeoutSeconds}`,
81
+ '-p "$p"',
82
+ ].join(' ');
83
+ return [
84
+ 'umask 077',
85
+ `d=$(mktemp -d "${isForAccount ? adminCopyBase : '${TMPDIR:-/tmp}'}/charness-runner.XXXXXXXX")`,
86
+ ...(isForAccount ? ['chmod 755 "$d"'] : []),
87
+ 'trap "rm -rf \\"$d\\"" EXIT',
88
+ 'trap "exit 1" INT TERM',
89
+ `u="${payload.user}"`,
90
+ `h="${payload.host}"`,
91
+ `p="${payload.port}"`,
92
+ `k="${payload.hostKey}"`,
93
+ `b="${getPrivateKeyBody(payload.privateKey)}"`,
94
+ `command -v node >/dev/null 2>&1 && node -e "var v=process.versions.node.split(/[.]/);process.exit(v[0]>${minNodeMajor}||v[0]==${minNodeMajor}&&v[1]>=${minNodeMinor}?0:1)" || { echo "charness-runner: ${isForAccount ? `sudo finds no Node.js ${minNodeMajor}.${minNodeMinor} or newer on its PATH (install it system-wide)` : `Node.js ${minNodeMajor}.${minNodeMinor} or newer is needed on this machine (https://nodejs.org)`}" >&2; exit 1; }`,
95
+ `{ printf "%s\\n" "${privateKeyHeader}"; printf "%s" "$b" | fold -w ${privateKeyFoldWidth}; printf "\\n%s\\n" "${privateKeyFooter}"; } > "$d/key"`,
96
+ `printf "%s %s\\n" ${hubHostAlias} "$k" > "$d/kh"`,
97
+ `ssh ${sshOptions} "$u@$h" bootstrap > "$d/answer" || { echo "charness-runner: the hub refused or did not answer (has the line expired or been used already? the ssh message above says which)" >&2; exit 1; }`,
98
+ `hit=$(head -c ${gateProtocol_1.maxGateNoiseBytes} "$d/answer" | LC_ALL=C grep -a -b -o -E -e "${bootstrapMarkerPattern}" | head -n 1)`,
99
+ '[ -n "$hit" ] || { echo "charness-runner: the hub did not send the package (has the line expired or been used already?)" >&2; exit 1; }',
100
+ 'o=${hit%%:*}; t=${hit#*:}',
101
+ ...(isForAccount ? ['umask 022'] : []),
102
+ 'tail -c +$((o + ${#t} + 2)) "$d/answer" > "$d/package.tgz"',
103
+ 'mkdir "$d/pkg"',
104
+ `tar ${isForAccount ? '--no-same-owner ' : ''}-xzf "$d/package.tgz" -C "$d/pkg"`,
105
+ ];
106
+ }
107
+ /** The `pair` command on the unpacked package, for the pairing `code`. */
108
+ function renderPairCommand(code, isServiceFollowing) {
109
+ return `"$d/pkg/${runnerCliInPackage}" pair --bootstrap "$d/pkg" --archive "$d/package.tgz" --package-id "\${t##*id=}"${isServiceFollowing ? ` ${pairArgs_1.serviceFollowsFlag}` : ''} ${code}`;
110
+ }
111
+ function checkScriptHasNoQuote(script, what) {
112
+ if (script.includes("'"))
113
+ throw new Error(`the ${what} script must not hold a single quote`);
114
+ return script;
115
+ }
116
+ /** @description The command to paste on the runner machine, as the account that will run jobs, for the pairing `payload`. */
117
+ function buildBootstrapLine(payload) {
118
+ const script = [...renderFetchSteps(payload, false), `node ${renderPairCommand((0, pairCode_1.encodePairCode)(payload), false)}`];
119
+ return `sh -c '${checkScriptHasNoQuote(['set -eu', ...script].join('; '), 'bootstrap')}'`;
120
+ }
121
+ /**
122
+ * The admin script. `$1` is the account. Messages are plain ASCII with no apostrophe (the whole line sits in single quotes) and short: the
123
+ * line plus its text must fit one Telegram message.
124
+ */
125
+ function renderAdminScript(payload) {
126
+ const checks = [
127
+ 'f() { echo "charness-runner: $*" >&2; exit 1; }',
128
+ 'a=$1',
129
+ '[ "$(id -u)" = 0 ] || f "run this line with sudo"',
130
+ `case $a in ""|-*|*[!${accountNameChars}]*) f "$a is not an account name";; esac`,
131
+ 'i=$(id -u "$a" 2>/dev/null) || f "no account $a here: create a standard user or fix the last word"',
132
+ '[ "$i" != 0 ] || f "$a is root: use a standard user"',
133
+ `case $(uname -s) in Darwin) g="${adminCheck_1.macAdminGroup}";; Linux) g="${adminCheck_1.linuxAdminGroups.join(' ')}";; *) f "only macOS and Linux";; esac`,
134
+ 'gs=$(id -Gn "$a") || f "no groups for $a"',
135
+ 'for x in $gs; do case " $g " in *" $x "*) f "$a is an admin: the agents code runs with its rights";; esac; done',
136
+ ];
137
+ const steps = [
138
+ ...renderFetchSteps(payload, true),
139
+ 'n=$(command -v node)',
140
+ `sudo -u "$a" -H "$n" ${renderPairCommand((0, pairCode_1.encodePairCode)(payload), true)}`,
141
+ `"$n" "$d/pkg/${rootServiceCliInPackage}" install "$a" || f "$a is paired, but has no service: fix the above and paste a fresh admin line"`,
142
+ ];
143
+ return checkScriptHasNoQuote(['set -eu', ...checks, ...steps].join('; '), 'admin');
144
+ }
145
+ /**
146
+ * @description The command to paste in an ADMIN account's terminal on the runner machine: it checks `account`, pairs it, and installs its
147
+ * always-on service. `account` is the line's last word, so the operator can change it by hand.
148
+ */
149
+ function buildAdminBootstrapLine(payload, account = exports.defaultRunnerAccount) {
150
+ if (!checkIsAccountName(account))
151
+ throw new Error('the runner account must be a plain account name');
152
+ return `sudo sh -c '${renderAdminScript(payload)}' sh ${account}`;
153
+ }
154
+ //# sourceMappingURL=bootstrapLine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrapLine.js","sourceRoot":"","sources":["../../src/runners/bootstrapLine.ts"],"names":[],"mappings":";;;AAiEA,gDAEC;AAmDD,gDAGC;AA+BD,0DAGC;AA3JD,4DAA8E;AAC9E,wDAA+D;AAC/D,iDAA+D;AAC/D,yCAAkE;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,YAAY,GAAG,cAAc,CAAC;AACpC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAC/B,MAAM,gBAAgB,GAAG,qCAAqC,CAAC;AAC/D,MAAM,gBAAgB,GAAG,mCAAmC,CAAC;AAC7D,MAAM,qBAAqB,GAAG,EAAE,CAAC;AACjC,uIAAuI;AACvI,MAAM,sBAAsB,GAAG,IAAI,yBAAU,0CAA0C,CAAC;AACxF,MAAM,kBAAkB,GAAG,iCAAiC,CAAC;AAC7D,MAAM,uBAAuB,GAAG,sCAAsC,CAAC;AACvE,wIAAwI;AACxI,MAAM,aAAa,GAAG,MAA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CAAC;IAClH,OAAO,UAAU,qBAAqB,CAAC,CAAC,SAAS,EAAE,GAAG,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC;AAC5F,CAAC;AAED;;;GAGG;AACH,SAAS,iBAAiB,CAAC,OAAwB;IACjD,MAAM,MAAM,GAAG;QACb,iDAAiD;QACjD,MAAM;QACN,mDAAmD;QACnD,uBAAuB,gBAAgB,0CAA0C;QACjF,oGAAoG;QACpG,sDAAsD;QACtD,kCAAkC,0BAAa,iBAAiB,6BAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,wCAAwC;QAClI,2CAA2C;QAC3C,iHAAiH;KAClH,CAAC;IACF,MAAM,KAAK,GAAG;QACZ,GAAG,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC;QAClC,sBAAsB;QACtB,wBAAwB,iBAAiB,CAAC,IAAA,yBAAc,EAAC,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE;QAC1E,gBAAgB,uBAAuB,oGAAoG;KAC5I,CAAC;IACF,OAAO,qBAAqB,CAAC,CAAC,SAAS,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;AACrF,CAAC;AAED;;;GAGG;AACH,SAAgB,uBAAuB,CAAC,OAAwB,EAAE,UAAkB,4BAAoB;IACtG,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrG,OAAO,eAAe,iBAAiB,CAAC,OAAO,CAAC,QAAQ,OAAO,EAAE,CAAC;AACpE,CAAC"}
@@ -0,0 +1,41 @@
1
+ import type { Readable, Writable } from 'stream';
2
+ import { type GateLinkTimings } from './gateLink';
3
+ import { type GateRequest } from './gateProtocol';
4
+ import { type HubContext } from './hubPaths';
5
+ export type GateInvocation = {
6
+ role: 'temporary';
7
+ dir: string;
8
+ keysPath: string;
9
+ pairId: string;
10
+ } | {
11
+ role: 'runner';
12
+ dir: string;
13
+ keysPath: string;
14
+ runnerId: string;
15
+ };
16
+ export type GateArgsParsing = {
17
+ ok: true;
18
+ invocation: GateInvocation;
19
+ } | {
20
+ ok: false;
21
+ error: string;
22
+ };
23
+ /** @description The arguments of the forced command: `--dir <abs> --keys <abs> redeem|runner <id>`, nothing else. */
24
+ export declare function parseGateArgs(argv: readonly string[]): GateArgsParsing;
25
+ /** @description The request the runner may make with a key of `role`: `originalCommand` as a whole must be one of the role's words. */
26
+ export declare function routeGateRequest(role: GateInvocation['role'], originalCommand: string | undefined): GateRequest | null;
27
+ export interface GateIo {
28
+ stdin: Readable;
29
+ stdout: Writable;
30
+ /** One line to the runner's side of stderr. */
31
+ log: (line: string) => void;
32
+ }
33
+ export interface GateOptions {
34
+ /** Override pieces of the context (tests); `dir` and `keysPath` always come from the arguments. */
35
+ context?: Partial<HubContext>;
36
+ now?: () => number;
37
+ linkTimings?: Partial<GateLinkTimings>;
38
+ }
39
+ /** @description Serve one request of one runner; resolves with the exit code of the gate process. */
40
+ export declare function runRunnerGate(argv: readonly string[], env: NodeJS.ProcessEnv, io: GateIo, options?: GateOptions): Promise<number>;
41
+ //# sourceMappingURL=gate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../src/runners/gate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAGjD,OAAO,EAAe,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAQL,KAAK,WAAW,EAGjB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAmB/D,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAA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, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.parseGateArgs = parseGateArgs;
37
+ exports.routeGateRequest = routeGateRequest;
38
+ exports.runRunnerGate = runRunnerGate;
39
+ const path = __importStar(require("path"));
40
+ const promises_1 = require("stream/promises");
41
+ const authorizedKeys_1 = require("./authorizedKeys");
42
+ const configDirFile_1 = require("../configDirFile");
43
+ const gateLink_1 = require("./gateLink");
44
+ const gateProtocol_1 = require("./gateProtocol");
45
+ const hubIds_1 = require("./hubIds");
46
+ const hubPaths_1 = require("./hubPaths");
47
+ const hubRegistry_1 = require("./hubRegistry");
48
+ const hubPackage_1 = require("./hubPackage");
49
+ const hubPairing_1 = require("./hubPairing");
50
+ const linkControl_1 = require("./linkControl");
51
+ /**
52
+ * @description `charness runner-gate` — what sshd starts for a runner's key (the forced command of its `authorized_keys` line, via
53
+ * the `gate` wrapper). It is NOT a child of the bot: it survives bot restarts, and a hot reload never cuts a runner's link.
54
+ *
55
+ * The line names the registry folder, the `authorized_keys` file and the role of the key — `--dir D --keys K redeem <pairId>` for a
56
+ * pairing's temporary key, `--dir D --keys K runner <runnerId>` for a paired runner's. What the runner asks for arrives in
57
+ * `SSH_ORIGINAL_COMMAND` and is matched, as a whole, against the few words its role allows; anything else — another word, arguments,
58
+ * no command at all (a shell login) — is refused. See `gateProtocol.ts` for what each request says.
59
+ */
60
+ const refusedExitCode = 2;
61
+ const failedExitCode = 1;
62
+ /** @description The arguments of the forced command: `--dir <abs> --keys <abs> redeem|runner <id>`, nothing else. */
63
+ function parseGateArgs(argv) {
64
+ const [dirFlag, dir, keysFlag, keysPath, mode, id, ...rest] = argv;
65
+ if (dirFlag !== '--dir' || keysFlag !== '--keys' || dir === undefined || keysPath === undefined || id === undefined || rest.length > 0) {
66
+ return { ok: false, error: 'usage: runner-gate --dir <folder> --keys <authorized_keys> redeem|runner <id>' };
67
+ }
68
+ if (!path.isAbsolute(dir) || !path.isAbsolute(keysPath))
69
+ return { ok: false, error: 'the folder and the keys file must be absolute paths' };
70
+ if (!hubIds_1.hubIdPattern.test(id))
71
+ return { ok: false, error: 'the id is not a valid id' };
72
+ if (mode === 'redeem')
73
+ return { ok: true, invocation: { role: 'temporary', dir, keysPath, pairId: id } };
74
+ if (mode === 'runner')
75
+ return { ok: true, invocation: { role: 'runner', dir, keysPath, runnerId: id } };
76
+ return { ok: false, error: 'the mode must be redeem or runner' };
77
+ }
78
+ /** @description The request the runner may make with a key of `role`: `originalCommand` as a whole must be one of the role's words. */
79
+ function routeGateRequest(role, originalCommand) {
80
+ const allowed = role === 'temporary' ? gateProtocol_1.temporaryKeyRequests : gateProtocol_1.runnerKeyRequests;
81
+ return allowed.find((request) => request === originalCommand) ?? null;
82
+ }
83
+ async function readLimitedText(stream, maxBytes) {
84
+ const chunks = [];
85
+ let total = 0;
86
+ for await (const chunk of stream) {
87
+ const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
88
+ total += buffer.length;
89
+ if (total > maxBytes)
90
+ return null;
91
+ chunks.push(buffer);
92
+ }
93
+ return Buffer.concat(chunks).toString('utf8');
94
+ }
95
+ /** Send the package: its marker (`request` says which answer it is), then the archive, read from a file opened BEFORE the marker is sent. */
96
+ async function writePackage(ctx, io, request) {
97
+ const opened = await (0, hubPackage_1.openHubPackage)(ctx);
98
+ io.stdout.write((0, gateProtocol_1.formatGateAnswerHead)(request, { id: opened.id }));
99
+ await (0, promises_1.pipeline)(opened.handle.createReadStream(), io.stdout, { end: false });
100
+ return 0;
101
+ }
102
+ async function handleRedeem(ctx, pairId, io, now) {
103
+ const body = await readLimitedText(io.stdin, gateProtocol_1.maxGateRequestBytes);
104
+ let reply;
105
+ const parsed = body === null ? null : safeParseJson(body);
106
+ if (parsed === null) {
107
+ reply = { ok: false, reason: 'the request is not valid JSON or is too large' };
108
+ }
109
+ else {
110
+ const request = gateProtocol_1.redeemRequestSchema.safeParse(parsed);
111
+ reply = request.success
112
+ ? await (0, hubPairing_1.redeemPairing)(ctx, pairId, request.data, now(), getPackageIdOrNull(ctx, io.log))
113
+ : { ok: false, reason: `the request is invalid: ${request.error.issues.map((issue) => `${issue.path.join('.') || '(root)'} ${issue.message}`).join('; ')}` };
114
+ }
115
+ io.stdout.write((0, gateProtocol_1.formatGateAnswerHead)('redeem'));
116
+ io.stdout.write(`${JSON.stringify(reply)}\n`);
117
+ return reply.ok ? 0 : failedExitCode;
118
+ }
119
+ function safeParseJson(text) {
120
+ try {
121
+ const parsed = JSON.parse(text);
122
+ return parsed !== null && typeof parsed === 'object' ? parsed : null;
123
+ }
124
+ catch {
125
+ return null;
126
+ }
127
+ }
128
+ /** `cancel`: the line that held this code is done without using it (an admin line pasted again for a machine that is already paired). Idempotent. */
129
+ async function handleCancel(ctx, pairId, io, now) {
130
+ const reply = { ok: await (0, hubPairing_1.cancelPairing)(ctx, pairId, now()) };
131
+ io.stdout.write((0, gateProtocol_1.formatGateAnswerHead)('cancel'));
132
+ io.stdout.write(`${JSON.stringify(reply)}\n`);
133
+ return 0;
134
+ }
135
+ async function handleUnpair(ctx, runnerId, io, now) {
136
+ const removed = await (0, hubPairing_1.removePairedRunner)(ctx, runnerId, now());
137
+ if (removed !== null)
138
+ (0, linkControl_1.cutRunnerLink)(ctx.dir, runnerId);
139
+ const reply = { ok: removed !== null };
140
+ io.stdout.write((0, gateProtocol_1.formatGateAnswerHead)('unpair'));
141
+ io.stdout.write(`${JSON.stringify(reply)}\n`);
142
+ return 0;
143
+ }
144
+ /** What the runner is told about a failure on the hub: our own registry messages, else only an error code — never a hub path. */
145
+ function describeFailure(error) {
146
+ if (error instanceof hubRegistry_1.HubRegistryError || error instanceof authorizedKeys_1.AuthorizedKeysBlockError)
147
+ return error.message;
148
+ return `internal error (${(0, configDirFile_1.getCaughtErrnoCode)(error)})`;
149
+ }
150
+ async function handleIdentity(ctx, runnerId, io) {
151
+ const reply = (0, hubPairing_1.describeRunnerIdentity)(ctx, runnerId, getPackageIdOrNull(ctx, io.log));
152
+ io.stdout.write((0, gateProtocol_1.formatGateAnswerHead)('identity'));
153
+ io.stdout.write(`${JSON.stringify(reply)}\n`);
154
+ return reply.ok ? 0 : failedExitCode;
155
+ }
156
+ async function handleVersion(ctx, io) {
157
+ io.stdout.write((0, gateProtocol_1.formatGateAnswerHead)('version', { package: getPackageIdOrNull(ctx, io.log) ?? gateProtocol_1.noPackageMarker }));
158
+ return 0;
159
+ }
160
+ function getPackageIdOrNull(ctx, log) {
161
+ try {
162
+ return (0, hubPackage_1.getHubPackage)(ctx).id;
163
+ }
164
+ catch (error) {
165
+ log(`the package cannot be packed (${describeFailure(error)}); the link goes up without one`);
166
+ return null;
167
+ }
168
+ }
169
+ /** @description Serve one request of one runner; resolves with the exit code of the gate process. */
170
+ async function runRunnerGate(argv, env, io, options = {}) {
171
+ const parsed = parseGateArgs(argv);
172
+ if (!parsed.ok) {
173
+ io.log(parsed.error);
174
+ return refusedExitCode;
175
+ }
176
+ const { invocation } = parsed;
177
+ const request = routeGateRequest(invocation.role, env.SSH_ORIGINAL_COMMAND);
178
+ if (request === null) {
179
+ io.log('refused: this key may only be used by charness-runner');
180
+ return refusedExitCode;
181
+ }
182
+ const ctx = (0, hubPaths_1.createHubContext)({ ...options.context, dir: invocation.dir, authorizedKeysPath: invocation.keysPath });
183
+ const now = options.now ?? Date.now;
184
+ try {
185
+ if (invocation.role === 'temporary') {
186
+ if (request === 'bootstrap') {
187
+ if (!(0, hubPairing_1.checkIsPairingOpen)(ctx, invocation.pairId, now())) {
188
+ io.log('refused: this pairing code is unknown, used or expired');
189
+ return refusedExitCode;
190
+ }
191
+ return await writePackage(ctx, io, 'bootstrap');
192
+ }
193
+ if (request === 'cancel')
194
+ return await handleCancel(ctx, invocation.pairId, io, now);
195
+ return await handleRedeem(ctx, invocation.pairId, io, now);
196
+ }
197
+ // The key line is only the way in: a runner that left the registry is refused whatever its line (or an ssh connection it already
198
+ // has open, which keeps the key's options) still allows. Two requests are answered anyway, because their answer IS «not paired»:
199
+ // `unpair` (idempotent) and `identity` (a removed runner asks it after a refused `link` to tell a removal from a failure — it
200
+ // answers `{ok:false}` and discloses nothing).
201
+ if (request !== 'unpair' && request !== 'identity' && !(0, hubPairing_1.checkIsRunnerPaired)(ctx, invocation.runnerId)) {
202
+ io.log('refused: this runner is not paired here');
203
+ return refusedExitCode;
204
+ }
205
+ switch (request) {
206
+ case 'link':
207
+ return await (0, gateLink_1.runGateLink)({ ctx, runnerId: invocation.runnerId, input: io.stdin, output: io.stdout, packageId: getPackageIdOrNull(ctx, io.log), log: io.log, timings: options.linkTimings, now });
208
+ case 'package':
209
+ return await writePackage(ctx, io, 'package');
210
+ case 'version':
211
+ return await handleVersion(ctx, io);
212
+ case 'identity':
213
+ return await handleIdentity(ctx, invocation.runnerId, io);
214
+ case 'unpair':
215
+ return await handleUnpair(ctx, invocation.runnerId, io, now);
216
+ default:
217
+ return refusedExitCode;
218
+ }
219
+ }
220
+ catch (error) {
221
+ io.log(`failed: ${describeFailure(error)}`);
222
+ return failedExitCode;
223
+ }
224
+ }
225
+ //# sourceMappingURL=gate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gate.js","sourceRoot":"","sources":["../../src/runners/gate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,sCAUC;AAGD,4CAGC;AA2GD,sCAoDC;AA5ND,2CAA6B;AAC7B,8CAA2C;AAE3C,qDAA4D;AAC5D,oDAAsD;AACtD,yCAA+D;AAC/D,iDAWwB;AACxB,qCAAwC;AACxC,yCAA+D;AAC/D,+CAAiD;AACjD,6CAA6D;AAC7D,6CAAiJ;AACjJ,+CAA8C;AAE9C;;;;;;;;GAQG;AAEH,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAM,cAAc,GAAG,CAAC,CAAC;AAQzB,qHAAqH;AACrH,SAAgB,aAAa,CAAC,IAAuB;IACnD,MAAM,CAAC,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IACnE,IAAI,OAAO,KAAK,OAAO,IAAI,QAAQ,KAAK,QAAQ,IAAI,GAAG,KAAK,SAAS,IAAI,QAAQ,KAAK,SAAS,IAAI,EAAE,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvI,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,+EAA+E,EAAE,CAAC;IAC/G,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAA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,EAAE,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YACrG,EAAE,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;YAClD,OAAO,eAAe,CAAC;QACzB,CAAC;QACD,QAAQ,OAAO,EAAE,CAAC;YAChB,KAAK,MAAM;gBACT,OAAO,MAAM,IAAA,sBAAW,EAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,UAAU,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,kBAAkB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC;YACnM,KAAK,SAAS;gBACZ,OAAO,MAAM,YAAY,CAAC,GAAG,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC;YAChD,KAAK,SAAS;gBACZ,OAAO,MAAM,aAAa,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YACtC,KAAK,UAAU;gBACb,OAAO,MAAM,cAAc,CAAC,GAAG,EAAE,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YAC5D,KAAK,QAAQ;gBACX,OAAO,MAAM,YAAY,CAAC,GAAG,EAAE,UAAU,CAAC,QAAQ,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;YAC/D;gBACE,OAAO,eAAe,CAAC;QAC3B,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,EAAE,CAAC,GAAG,CAAC,WAAW,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC5C,OAAO,cAAc,CAAC;IACxB,CAAC;AACH,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { Writable, type Readable } from 'stream';
2
+ import { type HubContext } from './hubPaths';
3
+ export interface GateLinkTimings {
4
+ /** How often the gate checks that it still holds the socket and that its runner is still paired. */
5
+ checkIntervalMs: number;
6
+ /** How often the ssh keepalive pings the runner. */
7
+ keepaliveIntervalMs: number;
8
+ /** How long the ssh handshake with the runner may take. */
9
+ readyTimeoutMs: number;
10
+ }
11
+ export declare const defaultGateLinkTimings: GateLinkTimings;
12
+ export interface GateLinkParams {
13
+ ctx: HubContext;
14
+ runnerId: string;
15
+ /** The channel from the runner (the gate's stdin) and to it (stdout). */
16
+ input: Readable;
17
+ output: Writable;
18
+ /** The id of the hub's current package, told to the runner in the marker line (`null` when it cannot be packed). */
19
+ packageId: string | null;
20
+ log: (line: string) => void;
21
+ timings?: Partial<GateLinkTimings>;
22
+ now?: () => number;
23
+ }
24
+ /** @description Run the link until it ends; resolves with the exit code of the gate (0: it held the link and it ended; 1: it never came up). */
25
+ export declare function runGateLink(params: GateLinkParams): Promise<number>;
26
+ //# sourceMappingURL=gateLink.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gateLink.d.ts","sourceRoot":"","sources":["../../src/runners/gateLink.ts"],"names":[],"mappings":"AAIA,OAAO,EAAU,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAIzD,OAAO,EAAsB,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAmCjE,MAAM,WAAW,eAAe;IAC9B,oGAAoG;IACpG,eAAe,EAAE,MAAM,CAAC;IACxB,oDAAoD;IACpD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,2DAA2D;IAC3D,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,sBAAsB,EAAE,eAA2G,CAAC;AAEjJ,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,UAAU,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,KAAK,EAAE,QAAQ,CAAC;IAChB,MAAM,EAAE,QAAQ,CAAC;IACjB,oHAAoH;IACpH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACnC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAcD,gJAAgJ;AAChJ,wBAAgB,WAAW,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAqJnE"}