charness 3.9.1 → 3.11.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 (449) hide show
  1. package/CHANGELOG.md +155 -0
  2. package/DEVELOPMENT.md +4 -1
  3. package/README.md +2 -1
  4. package/SETUP.md +6 -4
  5. package/agent-plugin/README.md +2 -2
  6. package/agent-plugin/skills/charness-delegate-opencode/SKILL.md +1 -1
  7. package/agent-plugin/skills/charness-manager/SKILL.md +11 -6
  8. package/dist/bot.d.ts +27 -18
  9. package/dist/bot.d.ts.map +1 -1
  10. package/dist/bot.js +390 -231
  11. package/dist/bot.js.map +1 -1
  12. package/dist/connectors/jira/adf.d.ts.map +1 -1
  13. package/dist/connectors/jira/adf.js +2 -3
  14. package/dist/connectors/jira/adf.js.map +1 -1
  15. package/dist/connectors/telegram/commands/botCore.d.ts +17 -0
  16. package/dist/connectors/telegram/commands/botCore.d.ts.map +1 -1
  17. package/dist/connectors/telegram/commands/claudeAccounts.js +3 -3
  18. package/dist/connectors/telegram/commands/claudeAccounts.js.map +1 -1
  19. package/dist/connectors/telegram/commands/runners.d.ts +10 -1
  20. package/dist/connectors/telegram/commands/runners.d.ts.map +1 -1
  21. package/dist/connectors/telegram/commands/runners.js +85 -17
  22. package/dist/connectors/telegram/commands/runners.js.map +1 -1
  23. package/dist/connectors/telegram/foldedMessage.d.ts +24 -0
  24. package/dist/connectors/telegram/foldedMessage.d.ts.map +1 -0
  25. package/dist/connectors/telegram/foldedMessage.js +39 -0
  26. package/dist/connectors/telegram/foldedMessage.js.map +1 -0
  27. package/dist/connectors/telegram/inbound.d.ts +24 -1
  28. package/dist/connectors/telegram/inbound.d.ts.map +1 -1
  29. package/dist/connectors/telegram/inbound.js +77 -1
  30. package/dist/connectors/telegram/inbound.js.map +1 -1
  31. package/dist/connectors/telegram/renderAgentHtml.d.ts +15 -0
  32. package/dist/connectors/telegram/renderAgentHtml.d.ts.map +1 -1
  33. package/dist/connectors/telegram/renderAgentHtml.js +11 -1
  34. package/dist/connectors/telegram/renderAgentHtml.js.map +1 -1
  35. package/dist/connectors/telegram/runnerLinkNotices.d.ts +24 -0
  36. package/dist/connectors/telegram/runnerLinkNotices.d.ts.map +1 -0
  37. package/dist/connectors/telegram/runnerLinkNotices.js +95 -0
  38. package/dist/connectors/telegram/runnerLinkNotices.js.map +1 -0
  39. package/dist/connectors/telegram/runnerPairingMessages.d.ts +9 -0
  40. package/dist/connectors/telegram/runnerPairingMessages.d.ts.map +1 -1
  41. package/dist/connectors/telegram/runnerPairingMessages.js +17 -1
  42. package/dist/connectors/telegram/runnerPairingMessages.js.map +1 -1
  43. package/dist/connectors/telegram/unpinMessages.d.ts +12 -0
  44. package/dist/connectors/telegram/unpinMessages.d.ts.map +1 -0
  45. package/dist/connectors/telegram/unpinMessages.js +44 -0
  46. package/dist/connectors/telegram/unpinMessages.js.map +1 -0
  47. package/dist/i18n/de.d.ts.map +1 -1
  48. package/dist/i18n/de.js +30 -3
  49. package/dist/i18n/de.js.map +1 -1
  50. package/dist/i18n/en.d.ts.map +1 -1
  51. package/dist/i18n/en.js +30 -3
  52. package/dist/i18n/en.js.map +1 -1
  53. package/dist/i18n/es.d.ts.map +1 -1
  54. package/dist/i18n/es.js +30 -3
  55. package/dist/i18n/es.js.map +1 -1
  56. package/dist/i18n/fr.d.ts.map +1 -1
  57. package/dist/i18n/fr.js +30 -3
  58. package/dist/i18n/fr.js.map +1 -1
  59. package/dist/i18n/hi.d.ts.map +1 -1
  60. package/dist/i18n/hi.js +30 -3
  61. package/dist/i18n/hi.js.map +1 -1
  62. package/dist/i18n/ja.d.ts.map +1 -1
  63. package/dist/i18n/ja.js +30 -3
  64. package/dist/i18n/ja.js.map +1 -1
  65. package/dist/i18n/ka.d.ts.map +1 -1
  66. package/dist/i18n/ka.js +30 -3
  67. package/dist/i18n/ka.js.map +1 -1
  68. package/dist/i18n/pt.d.ts.map +1 -1
  69. package/dist/i18n/pt.js +30 -3
  70. package/dist/i18n/pt.js.map +1 -1
  71. package/dist/i18n/ru.d.ts.map +1 -1
  72. package/dist/i18n/ru.js +30 -3
  73. package/dist/i18n/ru.js.map +1 -1
  74. package/dist/i18n/uk.d.ts.map +1 -1
  75. package/dist/i18n/uk.js +30 -3
  76. package/dist/i18n/uk.js.map +1 -1
  77. package/dist/i18n/uz.d.ts.map +1 -1
  78. package/dist/i18n/uz.js +30 -3
  79. package/dist/i18n/uz.js.map +1 -1
  80. package/dist/i18n/zh.d.ts.map +1 -1
  81. package/dist/i18n/zh.js +30 -3
  82. package/dist/i18n/zh.js.map +1 -1
  83. package/dist/outputTrace.d.ts +6 -0
  84. package/dist/outputTrace.d.ts.map +1 -1
  85. package/dist/outputTrace.js +15 -9
  86. package/dist/outputTrace.js.map +1 -1
  87. package/dist/rateLimiter.d.ts +3 -1
  88. package/dist/rateLimiter.d.ts.map +1 -1
  89. package/dist/rateLimiter.js +3 -1
  90. package/dist/rateLimiter.js.map +1 -1
  91. package/dist/remoteRun/cliArgs.d.ts +6 -1
  92. package/dist/remoteRun/cliArgs.d.ts.map +1 -1
  93. package/dist/remoteRun/cliArgs.js +39 -2
  94. package/dist/remoteRun/cliArgs.js.map +1 -1
  95. package/dist/remoteRun/exitCodes.d.ts +12 -2
  96. package/dist/remoteRun/exitCodes.d.ts.map +1 -1
  97. package/dist/remoteRun/exitCodes.js +3 -0
  98. package/dist/remoteRun/exitCodes.js.map +1 -1
  99. package/dist/remoteRun/foreground.d.ts +13 -0
  100. package/dist/remoteRun/foreground.d.ts.map +1 -1
  101. package/dist/remoteRun/foreground.js +15 -2
  102. package/dist/remoteRun/foreground.js.map +1 -1
  103. package/dist/remoteRun/heldBackNotice.d.ts +7 -0
  104. package/dist/remoteRun/heldBackNotice.d.ts.map +1 -0
  105. package/dist/remoteRun/heldBackNotice.js +92 -0
  106. package/dist/remoteRun/heldBackNotice.js.map +1 -0
  107. package/dist/remoteRun/interrupts.d.ts +6 -2
  108. package/dist/remoteRun/interrupts.d.ts.map +1 -1
  109. package/dist/remoteRun/interrupts.js +18 -3
  110. package/dist/remoteRun/interrupts.js.map +1 -1
  111. package/dist/remoteRun/leaseTiming.d.ts +1 -2
  112. package/dist/remoteRun/leaseTiming.d.ts.map +1 -1
  113. package/dist/remoteRun/leaseTiming.js +3 -17
  114. package/dist/remoteRun/leaseTiming.js.map +1 -1
  115. package/dist/remoteRun/output.d.ts +16 -1
  116. package/dist/remoteRun/output.d.ts.map +1 -1
  117. package/dist/remoteRun/output.js +28 -2
  118. package/dist/remoteRun/output.js.map +1 -1
  119. package/dist/remoteRun/probe.d.ts +40 -2
  120. package/dist/remoteRun/probe.d.ts.map +1 -1
  121. package/dist/remoteRun/probe.js +58 -2
  122. package/dist/remoteRun/probe.js.map +1 -1
  123. package/dist/remoteRun/project.d.ts +2 -2
  124. package/dist/remoteRun/project.d.ts.map +1 -1
  125. package/dist/remoteRun/project.js +5 -4
  126. package/dist/remoteRun/project.js.map +1 -1
  127. package/dist/remoteRun/remoteRunCli.d.ts +1 -1
  128. package/dist/remoteRun/remoteRunCli.d.ts.map +1 -1
  129. package/dist/remoteRun/remoteRunCli.js +6 -3
  130. package/dist/remoteRun/remoteRunCli.js.map +1 -1
  131. package/dist/remoteRun/runnerWait.d.ts +3 -3
  132. package/dist/remoteRun/runnerWait.d.ts.map +1 -1
  133. package/dist/remoteRun/runnerWait.js +12 -6
  134. package/dist/remoteRun/runnerWait.js.map +1 -1
  135. package/dist/remoteRun/runnerWaitTiming.d.ts +1 -1
  136. package/dist/remoteRun/runnerWaitTiming.d.ts.map +1 -1
  137. package/dist/remoteRun/runnerWaitTiming.js +3 -16
  138. package/dist/remoteRun/runnerWaitTiming.js.map +1 -1
  139. package/dist/remoteRun/runners.d.ts +16 -3
  140. package/dist/remoteRun/runners.d.ts.map +1 -1
  141. package/dist/remoteRun/runners.js +42 -4
  142. package/dist/remoteRun/runners.js.map +1 -1
  143. package/dist/remoteRun/sendPlan.d.ts +11 -1
  144. package/dist/remoteRun/sendPlan.d.ts.map +1 -1
  145. package/dist/remoteRun/sendPlan.js +29 -5
  146. package/dist/remoteRun/sendPlan.js.map +1 -1
  147. package/dist/remoteRun/submit.d.ts.map +1 -1
  148. package/dist/remoteRun/submit.js +13 -3
  149. package/dist/remoteRun/submit.js.map +1 -1
  150. package/dist/runnerUtility/adminService.d.ts +30 -2
  151. package/dist/runnerUtility/adminService.d.ts.map +1 -1
  152. package/dist/runnerUtility/adminService.js +104 -6
  153. package/dist/runnerUtility/adminService.js.map +1 -1
  154. package/dist/runnerUtility/appInstall.d.ts +13 -4
  155. package/dist/runnerUtility/appInstall.d.ts.map +1 -1
  156. package/dist/runnerUtility/appInstall.js +46 -19
  157. package/dist/runnerUtility/appInstall.js.map +1 -1
  158. package/dist/runnerUtility/appUpdate.js +1 -1
  159. package/dist/runnerUtility/appUpdate.js.map +1 -1
  160. package/dist/runnerUtility/execEnv.d.ts +2 -0
  161. package/dist/runnerUtility/execEnv.d.ts.map +1 -1
  162. package/dist/runnerUtility/execEnv.js +6 -2
  163. package/dist/runnerUtility/execEnv.js.map +1 -1
  164. package/dist/runnerUtility/guiAgent.d.ts +126 -0
  165. package/dist/runnerUtility/guiAgent.d.ts.map +1 -0
  166. package/dist/runnerUtility/guiAgent.js +591 -0
  167. package/dist/runnerUtility/guiAgent.js.map +1 -0
  168. package/dist/runnerUtility/guiAgentHeal.d.ts +128 -0
  169. package/dist/runnerUtility/guiAgentHeal.d.ts.map +1 -0
  170. package/dist/runnerUtility/guiAgentHeal.js +284 -0
  171. package/dist/runnerUtility/guiAgentHeal.js.map +1 -0
  172. package/dist/runnerUtility/homeFolders.d.ts +33 -0
  173. package/dist/runnerUtility/homeFolders.d.ts.map +1 -0
  174. package/dist/runnerUtility/homeFolders.js +158 -0
  175. package/dist/runnerUtility/homeFolders.js.map +1 -0
  176. package/dist/runnerUtility/hubClient.d.ts +12 -2
  177. package/dist/runnerUtility/hubClient.d.ts.map +1 -1
  178. package/dist/runnerUtility/hubClient.js +24 -3
  179. package/dist/runnerUtility/hubClient.js.map +1 -1
  180. package/dist/runnerUtility/iosCheck.d.ts +7 -1
  181. package/dist/runnerUtility/iosCheck.d.ts.map +1 -1
  182. package/dist/runnerUtility/iosCheck.js +14 -5
  183. package/dist/runnerUtility/iosCheck.js.map +1 -1
  184. package/dist/runnerUtility/isolatedCommand.d.ts +31 -0
  185. package/dist/runnerUtility/isolatedCommand.d.ts.map +1 -0
  186. package/dist/runnerUtility/isolatedCommand.js +132 -0
  187. package/dist/runnerUtility/isolatedCommand.js.map +1 -0
  188. package/dist/runnerUtility/keepAwake.d.ts +67 -0
  189. package/dist/runnerUtility/keepAwake.d.ts.map +1 -0
  190. package/dist/runnerUtility/keepAwake.js +211 -0
  191. package/dist/runnerUtility/keepAwake.js.map +1 -0
  192. package/dist/runnerUtility/lidPollTiming.d.ts +11 -0
  193. package/dist/runnerUtility/lidPollTiming.d.ts.map +1 -0
  194. package/dist/runnerUtility/lidPollTiming.js +18 -0
  195. package/dist/runnerUtility/lidPollTiming.js.map +1 -0
  196. package/dist/runnerUtility/lidState.d.ts +57 -0
  197. package/dist/runnerUtility/lidState.d.ts.map +1 -0
  198. package/dist/runnerUtility/lidState.js +195 -0
  199. package/dist/runnerUtility/lidState.js.map +1 -0
  200. package/dist/runnerUtility/linkLoop.d.ts +5 -0
  201. package/dist/runnerUtility/linkLoop.d.ts.map +1 -1
  202. package/dist/runnerUtility/linkLoop.js +37 -1
  203. package/dist/runnerUtility/linkLoop.js.map +1 -1
  204. package/dist/runnerUtility/packageManagerShims.d.ts +44 -0
  205. package/dist/runnerUtility/packageManagerShims.d.ts.map +1 -0
  206. package/dist/runnerUtility/packageManagerShims.js +130 -0
  207. package/dist/runnerUtility/packageManagerShims.js.map +1 -0
  208. package/dist/runnerUtility/progress.d.ts +43 -0
  209. package/dist/runnerUtility/progress.d.ts.map +1 -0
  210. package/dist/runnerUtility/progress.js +78 -0
  211. package/dist/runnerUtility/progress.js.map +1 -0
  212. package/dist/runnerUtility/pueueDaemon.d.ts +8 -4
  213. package/dist/runnerUtility/pueueDaemon.d.ts.map +1 -1
  214. package/dist/runnerUtility/pueueDaemon.js +12 -7
  215. package/dist/runnerUtility/pueueDaemon.js.map +1 -1
  216. package/dist/runnerUtility/rootServiceCli.d.ts +23 -3
  217. package/dist/runnerUtility/rootServiceCli.d.ts.map +1 -1
  218. package/dist/runnerUtility/rootServiceCli.js +56 -10
  219. package/dist/runnerUtility/rootServiceCli.js.map +1 -1
  220. package/dist/runnerUtility/runnerCli.d.ts +1 -0
  221. package/dist/runnerUtility/runnerCli.d.ts.map +1 -1
  222. package/dist/runnerUtility/runnerCli.js +14 -7
  223. package/dist/runnerUtility/runnerCli.js.map +1 -1
  224. package/dist/runnerUtility/runnerCommands.d.ts +45 -0
  225. package/dist/runnerUtility/runnerCommands.d.ts.map +1 -1
  226. package/dist/runnerUtility/runnerCommands.js +188 -21
  227. package/dist/runnerUtility/runnerCommands.js.map +1 -1
  228. package/dist/runnerUtility/runnerHome.d.ts +8 -0
  229. package/dist/runnerUtility/runnerHome.d.ts.map +1 -1
  230. package/dist/runnerUtility/runnerHome.js +7 -0
  231. package/dist/runnerUtility/runnerHome.js.map +1 -1
  232. package/dist/runnerUtility/serviceCommon.d.ts +4 -0
  233. package/dist/runnerUtility/serviceCommon.d.ts.map +1 -1
  234. package/dist/runnerUtility/serviceCommon.js +8 -1
  235. package/dist/runnerUtility/serviceCommon.js.map +1 -1
  236. package/dist/runnerUtility/serviceManager.d.ts +5 -2
  237. package/dist/runnerUtility/serviceManager.d.ts.map +1 -1
  238. package/dist/runnerUtility/serviceManager.js +40 -17
  239. package/dist/runnerUtility/serviceManager.js.map +1 -1
  240. package/dist/runnerUtility/serviceUnits.d.ts +11 -0
  241. package/dist/runnerUtility/serviceUnits.d.ts.map +1 -1
  242. package/dist/runnerUtility/serviceUnits.js +8 -2
  243. package/dist/runnerUtility/serviceUnits.js.map +1 -1
  244. package/dist/runnerUtility/simulatorSilencer.d.ts +55 -0
  245. package/dist/runnerUtility/simulatorSilencer.d.ts.map +1 -0
  246. package/dist/runnerUtility/simulatorSilencer.js +203 -0
  247. package/dist/runnerUtility/simulatorSilencer.js.map +1 -0
  248. package/dist/runnerUtility/stopSignals.d.ts +10 -0
  249. package/dist/runnerUtility/stopSignals.d.ts.map +1 -0
  250. package/dist/runnerUtility/stopSignals.js +27 -0
  251. package/dist/runnerUtility/stopSignals.js.map +1 -0
  252. package/dist/runnerUtility/versionPollTiming.d.ts +2 -3
  253. package/dist/runnerUtility/versionPollTiming.d.ts.map +1 -1
  254. package/dist/runnerUtility/versionPollTiming.js +4 -18
  255. package/dist/runnerUtility/versionPollTiming.js.map +1 -1
  256. package/dist/runners/bootstrapLine.d.ts.map +1 -1
  257. package/dist/runners/bootstrapLine.js +35 -19
  258. package/dist/runners/bootstrapLine.js.map +1 -1
  259. package/dist/runners/gate.d.ts.map +1 -1
  260. package/dist/runners/gate.js +28 -1
  261. package/dist/runners/gate.js.map +1 -1
  262. package/dist/runners/gateLink.d.ts +7 -0
  263. package/dist/runners/gateLink.d.ts.map +1 -1
  264. package/dist/runners/gateLink.js +36 -3
  265. package/dist/runners/gateLink.js.map +1 -1
  266. package/dist/runners/gateProtocol.d.ts +37 -2
  267. package/dist/runners/gateProtocol.d.ts.map +1 -1
  268. package/dist/runners/gateProtocol.js +45 -4
  269. package/dist/runners/gateProtocol.js.map +1 -1
  270. package/dist/runners/hubPackage.d.ts +2 -1
  271. package/dist/runners/hubPackage.d.ts.map +1 -1
  272. package/dist/runners/hubPackage.js +32 -11
  273. package/dist/runners/hubPackage.js.map +1 -1
  274. package/dist/runners/hubPairing.d.ts +1 -1
  275. package/dist/runners/hubPairing.d.ts.map +1 -1
  276. package/dist/runners/hubPairing.js +8 -1
  277. package/dist/runners/hubPairing.js.map +1 -1
  278. package/dist/runners/hubPaths.d.ts +2 -0
  279. package/dist/runners/hubPaths.d.ts.map +1 -1
  280. package/dist/runners/hubPaths.js +1 -1
  281. package/dist/runners/hubPaths.js.map +1 -1
  282. package/dist/runners/linkConcern.d.ts +75 -0
  283. package/dist/runners/linkConcern.d.ts.map +1 -0
  284. package/dist/runners/linkConcern.js +85 -0
  285. package/dist/runners/linkConcern.js.map +1 -0
  286. package/dist/runners/linkControl.d.ts +25 -1
  287. package/dist/runners/linkControl.d.ts.map +1 -1
  288. package/dist/runners/linkControl.js +46 -4
  289. package/dist/runners/linkControl.js.map +1 -1
  290. package/dist/runners/pairingTiming.d.ts +2 -3
  291. package/dist/runners/pairingTiming.d.ts.map +1 -1
  292. package/dist/runners/pairingTiming.js +4 -18
  293. package/dist/runners/pairingTiming.js.map +1 -1
  294. package/dist/runners/runnerLock.d.ts +112 -0
  295. package/dist/runners/runnerLock.d.ts.map +1 -0
  296. package/dist/runners/runnerLock.js +292 -0
  297. package/dist/runners/runnerLock.js.map +1 -0
  298. package/dist/runners/runnersCli.d.ts +6 -3
  299. package/dist/runners/runnersCli.d.ts.map +1 -1
  300. package/dist/runners/runnersCli.js +33 -6
  301. package/dist/runners/runnersCli.js.map +1 -1
  302. package/dist/runners/runnersList.d.ts +3 -3
  303. package/dist/runners/runnersList.d.ts.map +1 -1
  304. package/dist/runners/runnersList.js +9 -2
  305. package/dist/runners/runnersList.js.map +1 -1
  306. package/dist/runners/runnersOverview.d.ts +29 -3
  307. package/dist/runners/runnersOverview.d.ts.map +1 -1
  308. package/dist/runners/runnersOverview.js +71 -6
  309. package/dist/runners/runnersOverview.js.map +1 -1
  310. package/dist/runners/serviceRemoval.d.ts +43 -0
  311. package/dist/runners/serviceRemoval.d.ts.map +1 -0
  312. package/dist/runners/serviceRemoval.js +114 -0
  313. package/dist/runners/serviceRemoval.js.map +1 -0
  314. package/dist/scheduler/checkRun.d.ts +9 -10
  315. package/dist/scheduler/checkRun.d.ts.map +1 -1
  316. package/dist/scheduler/checkRun.js +8 -16
  317. package/dist/scheduler/checkRun.js.map +1 -1
  318. package/dist/scheduler/checkStatus.d.ts +75 -0
  319. package/dist/scheduler/checkStatus.d.ts.map +1 -0
  320. package/dist/scheduler/checkStatus.js +117 -0
  321. package/dist/scheduler/checkStatus.js.map +1 -0
  322. package/dist/scheduler/delivery.d.ts +106 -38
  323. package/dist/scheduler/delivery.d.ts.map +1 -1
  324. package/dist/scheduler/delivery.js +199 -73
  325. package/dist/scheduler/delivery.js.map +1 -1
  326. package/dist/scheduler/mcpSurface.d.ts +8 -2
  327. package/dist/scheduler/mcpSurface.d.ts.map +1 -1
  328. package/dist/scheduler/mcpSurface.js +96 -20
  329. package/dist/scheduler/mcpSurface.js.map +1 -1
  330. package/dist/scheduler/recurrence.d.ts +32 -0
  331. package/dist/scheduler/recurrence.d.ts.map +1 -1
  332. package/dist/scheduler/recurrence.js +56 -18
  333. package/dist/scheduler/recurrence.js.map +1 -1
  334. package/dist/scheduler/scheduleText.d.ts +7 -0
  335. package/dist/scheduler/scheduleText.d.ts.map +1 -0
  336. package/dist/scheduler/scheduleText.js +55 -0
  337. package/dist/scheduler/scheduleText.js.map +1 -0
  338. package/dist/scheduler/store.d.ts +23 -2
  339. package/dist/scheduler/store.d.ts.map +1 -1
  340. package/dist/scheduler/store.js +57 -3
  341. package/dist/scheduler/store.js.map +1 -1
  342. package/dist/scheduler/types.d.ts +26 -10
  343. package/dist/scheduler/types.d.ts.map +1 -1
  344. package/dist/scheduler/unbindPause.d.ts +27 -0
  345. package/dist/scheduler/unbindPause.d.ts.map +1 -0
  346. package/dist/scheduler/unbindPause.js +21 -0
  347. package/dist/scheduler/unbindPause.js.map +1 -0
  348. package/dist/scheduler/workerActivity.d.ts +25 -0
  349. package/dist/scheduler/workerActivity.d.ts.map +1 -0
  350. package/dist/scheduler/workerActivity.js +195 -0
  351. package/dist/scheduler/workerActivity.js.map +1 -0
  352. package/dist/scheduler/workerWatch.d.ts +36 -9
  353. package/dist/scheduler/workerWatch.d.ts.map +1 -1
  354. package/dist/scheduler/workerWatch.js +41 -11
  355. package/dist/scheduler/workerWatch.js.map +1 -1
  356. package/dist/state.d.ts +8 -0
  357. package/dist/state.d.ts.map +1 -1
  358. package/dist/state.js +30 -0
  359. package/dist/state.js.map +1 -1
  360. package/dist/stt/sttRuntime.d.ts.map +1 -1
  361. package/dist/stt/sttRuntime.js +8 -1
  362. package/dist/stt/sttRuntime.js.map +1 -1
  363. package/dist/stt/sttSettings.d.ts +56 -6
  364. package/dist/stt/sttSettings.d.ts.map +1 -1
  365. package/dist/stt/sttSettings.js +128 -7
  366. package/dist/stt/sttSettings.js.map +1 -1
  367. package/dist/stt/sttSidecarOwner.d.ts +13 -5
  368. package/dist/stt/sttSidecarOwner.d.ts.map +1 -1
  369. package/dist/stt/sttSidecarOwner.js +72 -31
  370. package/dist/stt/sttSidecarOwner.js.map +1 -1
  371. package/dist/stt/transcribeChain.d.ts +23 -1
  372. package/dist/stt/transcribeChain.d.ts.map +1 -1
  373. package/dist/stt/transcribeChain.js +59 -4
  374. package/dist/stt/transcribeChain.js.map +1 -1
  375. package/dist/testTimings.d.ts +4 -2
  376. package/dist/testTimings.d.ts.map +1 -1
  377. package/dist/testTimings.js +7 -1
  378. package/dist/testTimings.js.map +1 -1
  379. package/dist/testTimingsSeam.d.ts +10 -0
  380. package/dist/testTimingsSeam.d.ts.map +1 -0
  381. package/dist/testTimingsSeam.js +29 -0
  382. package/dist/testTimingsSeam.js.map +1 -0
  383. package/dist/utils/claudeUsage.d.ts +3 -0
  384. package/dist/utils/claudeUsage.d.ts.map +1 -1
  385. package/dist/utils/claudeUsage.js +8 -1
  386. package/dist/utils/claudeUsage.js.map +1 -1
  387. package/dist/utils/claudeUsageRefresher.d.ts +27 -3
  388. package/dist/utils/claudeUsageRefresher.d.ts.map +1 -1
  389. package/dist/utils/claudeUsageRefresher.js +113 -14
  390. package/dist/utils/claudeUsageRefresher.js.map +1 -1
  391. package/dist/utils/forwardedMark.d.ts +54 -0
  392. package/dist/utils/forwardedMark.d.ts.map +1 -0
  393. package/dist/utils/forwardedMark.js +80 -0
  394. package/dist/utils/forwardedMark.js.map +1 -0
  395. package/dist/utils/limitHeldPrompts.d.ts +8 -2
  396. package/dist/utils/limitHeldPrompts.d.ts.map +1 -1
  397. package/dist/utils/limitHeldPrompts.js +11 -4
  398. package/dist/utils/limitHeldPrompts.js.map +1 -1
  399. package/dist/utils/messageContext.d.ts +54 -0
  400. package/dist/utils/messageContext.d.ts.map +1 -0
  401. package/dist/utils/messageContext.js +58 -0
  402. package/dist/utils/messageContext.js.map +1 -0
  403. package/dist/utils/openCodeUsage.d.ts +10 -3
  404. package/dist/utils/openCodeUsage.d.ts.map +1 -1
  405. package/dist/utils/openCodeUsage.js +19 -5
  406. package/dist/utils/openCodeUsage.js.map +1 -1
  407. package/dist/utils/replyQuote.d.ts +11 -26
  408. package/dist/utils/replyQuote.d.ts.map +1 -1
  409. package/dist/utils/replyQuote.js +9 -31
  410. package/dist/utils/replyQuote.js.map +1 -1
  411. package/dist/utils/runnersScreenPlan.d.ts +14 -0
  412. package/dist/utils/runnersScreenPlan.d.ts.map +1 -1
  413. package/dist/utils/runnersScreenPlan.js +49 -5
  414. package/dist/utils/runnersScreenPlan.js.map +1 -1
  415. package/dist/utils/stripControlCharacters.d.ts +8 -0
  416. package/dist/utils/stripControlCharacters.d.ts.map +1 -0
  417. package/dist/utils/stripControlCharacters.js +16 -0
  418. package/dist/utils/stripControlCharacters.js.map +1 -0
  419. package/dist/utils/surrogateSafeCut.d.ts +14 -0
  420. package/dist/utils/surrogateSafeCut.d.ts.map +1 -0
  421. package/dist/utils/surrogateSafeCut.js +30 -0
  422. package/dist/utils/surrogateSafeCut.js.map +1 -0
  423. package/dist/utils/telegramError.d.ts +13 -0
  424. package/dist/utils/telegramError.d.ts.map +1 -1
  425. package/dist/utils/telegramError.js +45 -0
  426. package/dist/utils/telegramError.js.map +1 -1
  427. package/dist/utils/topicRequest.d.ts +13 -0
  428. package/dist/utils/topicRequest.d.ts.map +1 -1
  429. package/dist/utils/topicRequest.js +10 -0
  430. package/dist/utils/topicRequest.js.map +1 -1
  431. package/dist/utils/transientFrames.d.ts +51 -6
  432. package/dist/utils/transientFrames.d.ts.map +1 -1
  433. package/dist/utils/transientFrames.js +52 -2
  434. package/dist/utils/transientFrames.js.map +1 -1
  435. package/dist/utils/usageRefreshBudget.d.ts.map +1 -1
  436. package/dist/utils/usageRefreshBudget.js +4 -10
  437. package/dist/utils/usageRefreshBudget.js.map +1 -1
  438. package/dist/utils/waitUpTo.d.ts +8 -0
  439. package/dist/utils/waitUpTo.d.ts.map +1 -0
  440. package/dist/utils/waitUpTo.js +20 -0
  441. package/dist/utils/waitUpTo.js.map +1 -0
  442. package/dist/voiceProgressNote.d.ts +73 -0
  443. package/dist/voiceProgressNote.d.ts.map +1 -0
  444. package/dist/voiceProgressNote.js +142 -0
  445. package/dist/voiceProgressNote.js.map +1 -0
  446. package/package.json +4 -1
  447. package/remoteRun/pickNode.sh +65 -0
  448. package/remoteRun/runner-package-lock.json +59 -0
  449. package/remoteRun/runner.sh +304 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "charness",
3
- "version": "3.9.1",
3
+ "version": "3.11.0",
4
4
  "license": "MIT",
5
5
  "author": "Sergei Solo",
6
6
  "description": "Harness for running Claude Code / OpenCode agents in the cloud or on your laptop, controlled from Telegram or Jira.",
@@ -32,6 +32,8 @@
32
32
  "dist/",
33
33
  "stt/gigaam_sidecar.py",
34
34
  "remoteRun/runner.sh",
35
+ "remoteRun/runner-package-lock.json",
36
+ "remoteRun/pickNode.sh",
35
37
  "agent-plugin/",
36
38
  "CHANGELOG.md",
37
39
  "README.md",
@@ -69,6 +71,7 @@
69
71
  "hot": "node dist/cli.js hot",
70
72
  "install-link": "yarn install && yarn build && npm link",
71
73
  "typecheck": "tsc -p tsconfig.typecheck.json",
74
+ "runner-lock": "tsx src/release/updateRunnerLock.ts",
72
75
  "prepublishOnly": "yarn typecheck && yarn build",
73
76
  "preversion": "yarn typecheck && yarn build && yarn test",
74
77
  "version": "tsx src/release/cli.ts changelog && git add CHANGELOG.md",
@@ -0,0 +1,65 @@
1
+ #!/bin/sh
2
+ # pickNode.sh <account> — run as ROOT by the admin pairing line, from its root-owned copy of the package (never from the account's folder), BEFORE
3
+ # anything is started under Node. Prints the real path of the Node.js that root and the runner's service will run under, or says why there is none
4
+ # (exit 1). A Node qualifies only when ALL of these hold:
5
+ # - its real path (links followed) is outside every home folder: /Users/<name>, /home/<name>, root's own. A program in a home is the other user's to
6
+ # change, and the runner's launcher and daemons would stop working the day that home is closed (chmod 700) or its version manager moves on;
7
+ # - the account can run it (`sudo -u <account> test -x`) and CANNOT write it, nor any folder above it (`test -w`): root runs it, and root must never
8
+ # execute anything the account — which runs the agents' code — can change;
9
+ # - it is Node.js 22.12 or newer.
10
+ # Candidates: the `node` of sudo's own PATH first, then Homebrew's (Apple Silicon, Intel).
11
+ #
12
+ # The account is judged with `sudo -u <account> test …` only: nothing of the account's is executed. `$1` is validated by the line (a plain account name).
13
+ # Test seam, used by the unit tests and not by the line: `$2` replaces the home patterns (space-separated `case` patterns), `$3` the system candidates.
14
+ set -u
15
+ a=$1
16
+ homes=${2:-"/Users/* /home/* */root/*"}
17
+ candidates=${3:-"/opt/homebrew/bin/node /usr/local/bin/node"}
18
+ min_major=22
19
+ min_minor=12
20
+
21
+ fail() { echo "charness-runner: $*" >&2; exit 1; }
22
+
23
+ # The real path of $1, links followed. Without `readlink -f` (macOS before 12.3) the links are followed by hand and the folder is resolved by `cd -P`.
24
+ real_path() {
25
+ readlink -f "$1" 2>/dev/null && return 0
26
+ p=$1; hops=0
27
+ while [ -L "$p" ] && [ "$hops" -lt 20 ]; do
28
+ l=$(readlink "$p") || return 1
29
+ case $l in /*) p=$l;; *) p=${p%/*}/$l;; esac
30
+ hops=$((hops + 1))
31
+ done
32
+ [ -e "$p" ] || return 1
33
+ d=$(cd -P "$(dirname "$p")" 2>/dev/null && pwd -P) || return 1
34
+ printf '%s/%s\n' "$d" "${p##*/}"
35
+ }
36
+
37
+ # Is $1, or a folder above it, writable by the account?
38
+ account_can_write() {
39
+ w=$1
40
+ while [ -n "$w" ] && [ "$w" != / ]; do
41
+ sudo -u "$a" test -w "$w" && return 0
42
+ w=${w%/*}
43
+ done
44
+ return 1
45
+ }
46
+
47
+ in_a_home() {
48
+ set -f
49
+ for pattern in $homes; do
50
+ case $1 in $pattern) set +f; return 0;; esac
51
+ done
52
+ set +f
53
+ return 1
54
+ }
55
+
56
+ for c in $(command -v node 2>/dev/null) $candidates; do
57
+ r=$(real_path "$c") || continue
58
+ in_a_home "$r" && continue
59
+ sudo -u "$a" test -x "$r" || continue
60
+ account_can_write "$r" && continue
61
+ "$r" -e "var v=process.versions.node.split(/[.]/);process.exit(v[0]>$min_major||v[0]==$min_major&&v[1]>=$min_minor?0:1)" || continue
62
+ printf '%s\n' "$r"
63
+ exit 0
64
+ done
65
+ fail "no Node.js $min_major.$min_minor+ outside home folders that $a cannot write: install one system-wide (macOS: brew install node), paste again"
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "charness",
3
+ "version": "0.0.0",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "charness",
9
+ "version": "0.0.0",
10
+ "dependencies": {
11
+ "ssh2": "^1.17.0",
12
+ "zod": "^4.4.3"
13
+ },
14
+ "engines": {
15
+ "node": ">=22.12"
16
+ }
17
+ },
18
+ "node_modules/asn1": {
19
+ "version": "0.2.6",
20
+ "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz",
21
+ "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==",
22
+ "dependencies": {
23
+ "safer-buffer": "~2.1.0"
24
+ }
25
+ },
26
+ "node_modules/bcrypt-pbkdf": {
27
+ "version": "1.0.2",
28
+ "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
29
+ "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==",
30
+ "dependencies": {
31
+ "tweetnacl": "^0.14.3"
32
+ }
33
+ },
34
+ "node_modules/safer-buffer": {
35
+ "version": "2.1.2",
36
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
37
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
38
+ },
39
+ "node_modules/ssh2": {
40
+ "version": "1.17.0",
41
+ "resolved": "https://registry.npmjs.org/ssh2/-/ssh2-1.17.0.tgz",
42
+ "integrity": "sha512-wPldCk3asibAjQ/kziWQQt1Wh3PgDFpC0XpwclzKcdT1vql6KeYxf5LIt4nlFkUeR8WuphYMKqUA56X4rjbfgQ==",
43
+ "dependencies": {
44
+ "asn1": "^0.2.6",
45
+ "bcrypt-pbkdf": "^1.0.2"
46
+ }
47
+ },
48
+ "node_modules/tweetnacl": {
49
+ "version": "0.14.5",
50
+ "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
51
+ "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA=="
52
+ },
53
+ "node_modules/zod": {
54
+ "version": "4.4.3",
55
+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz",
56
+ "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ=="
57
+ }
58
+ }
59
+ }
@@ -10,6 +10,8 @@
10
10
  # <state>/paused exists → paused=yes (written by `charness-runner pause`; the main box never sends a job to a paused runner)
11
11
  # <state>/service one word: user-service | system-service (no file = run by hand: service=foreground)
12
12
  # <state>/ios-check.json the runner's iOS Simulator boot check (one JSON line): "status": "pass"|"fail"|"skipped" and "reason": "…"|null
13
+ # <state>/gui/ the login session's agent of an always-on Mac (service=system-service): agent.json is its heartbeat, requests/<id>/ the steps
14
+ # it runs for a job that needs iOS (`needs-ios` in the job folder) — see «the login session» below
13
15
  # <state> counts only when it holds config.json and keys/ (a work dir that merely is called «work» is not one).
14
16
  #
15
17
  # bash 3.2-compatible on purpose (the stock bash of macOS): no associative arrays, no `wait -n`, no `mapfile`, no
@@ -34,6 +36,7 @@
34
36
  # prune remove old jobs, stale stage dirs and unused project copies
35
37
  # sync-tree the apply step alone (tests)
36
38
 
39
+ # The script's own tools (sort, sed, grep) run in the C locale: byte-wise and the same everywhere. The user's commands do NOT — see job_locale.
37
40
  LC_ALL=C
38
41
  export LC_ALL
39
42
  set -u
@@ -41,6 +44,8 @@ set -u
41
44
  # ─────────────────────────── constants ───────────────────────────
42
45
 
43
46
  kill_grace_sec=10
47
+ # After a SIGKILL of a step's group the script looks this many times (0.2 s apart) for a member that is still there before it goes on.
48
+ kill_settle_polls=10
44
49
  pueue_start_wait_sec=8
45
50
  default_timeout_sec=10800
46
51
  job_keep_days=3
@@ -53,9 +58,29 @@ task_id_wait_sec=5
53
58
  heartbeat_poll_sec=1
54
59
  # How long a job waiting for its project's lock sleeps between two attempts (a test shortens it to race many waiters quickly).
55
60
  lock_poll_sec=1
61
+ # A failed dependencies step names this many of its first error lines (and of its build log's) — few enough that `wait`'s last 50 lines hold them all.
62
+ failed_step_error_lines=8
63
+ # The login session's agent (`charness-runner gui-agent`) beats every 5 s; one that has not for this long is gone (or the session is).
64
+ gui_agent_stale_sec=20
65
+ # What makes a line of a tool's output an error line.
66
+ error_line_pattern='error|fatal|fail|exception|cannot|couldn|not found|no such|denied'
56
67
 
57
68
  # ─────────────────────────── helpers ───────────────────────────
58
69
 
70
+ # The locale a job's commands run in: a UTF-8 one, never `C`. Tools that read the locale refuse or crash on `C` (CocoaPods: «Unicode Normalization
71
+ # not appropriate for ASCII-8BIT»), and a job that wants another one says so with -e LC_ALL=… (the job's variables are applied after this). The first
72
+ # of C.UTF-8 (Linux) and en_US.UTF-8 (macOS) that this machine has — judged by the charmap it gives — else C: a machine with neither is no worse.
73
+ pick_job_locale() {
74
+ local candidate
75
+ for candidate in C.UTF-8 en_US.UTF-8 en_US.utf8; do
76
+ case $(LC_ALL=$candidate locale charmap 2> /dev/null) in
77
+ [Uu][Tt][Ff]-8 | [Uu][Tt][Ff]8) printf '%s\n' "$candidate"; return 0 ;;
78
+ esac
79
+ done
80
+ printf 'C\n'
81
+ }
82
+ job_locale=$(pick_job_locale)
83
+
59
84
  die() {
60
85
  printf 'remote-run-runner: %s\n' "$*" >&2
61
86
  exit 125
@@ -138,6 +163,176 @@ keep_awake_while() {
138
163
  caffeinate -i -w "$1" > /dev/null 2>&1 < /dev/null &
139
164
  }
140
165
 
166
+ # ─────────────────────────── the login session (always-on Mac) ───────────────────────────
167
+
168
+ # A Mac runner kept running by LaunchDaemons has no login session of its own, and Xcode's nested builds crash in the System session the daemons
169
+ # run in. The runner account's LaunchAgent (`charness-runner gui-agent`, runnerUtility/guiAgent.ts) runs in the account's GUI session while there
170
+ # is one; EVERY job's steps run THERE while it does (`gui_step_uses_agent`), through request folders under <state>/gui/requests/. A job that needs iOS
171
+ # (`needs-ios` in its folder, written for `--needs ios`) is refused with the reason when there is none, and `probe` says the same of `ios`; any other job
172
+ # then runs in the daemon as before. No auto-login, no guess.
173
+
174
+ # Does this runner's work go through a login session's agent: a paired runner that is kept running by an always-on service?
175
+ gui_session_expected() {
176
+ read_runner_state
177
+ [ -n "$runner_state" ] && [ "$(head -n 1 "$runner_state/service" 2> /dev/null)" = system-service ]
178
+ }
179
+
180
+ # A whole-number field of the agent's heartbeat file (one JSON line).
181
+ gui_agent_field() {
182
+ sed -n "s/.*\"$1\"[[:space:]]*:[[:space:]]*\([0-9][0-9]*\).*/\1/p" "$runner_state/gui/agent.json" 2> /dev/null | head -n 1
183
+ }
184
+
185
+ # Is the agent there: its process alive and its heartbeat fresh?
186
+ gui_agent_alive() {
187
+ local pid beat now
188
+ pid=$(gui_agent_field pid)
189
+ beat=$(gui_agent_field beatAtMs)
190
+ [ -n "$pid" ] && [ -n "$beat" ] || return 1
191
+ kill -0 "$pid" 2> /dev/null || return 1
192
+ now=$(($(date +%s) * 1000))
193
+ [ $((now - beat)) -le $((gui_agent_stale_sec * 1000)) ]
194
+ }
195
+
196
+ # What a job that needs iOS is told when there is no login session to run it in (also what `probe` says of `ios`). A link that tried to put the agent in place
197
+ # itself (runnerUtility/guiAgentHeal.ts) and could not leaves `<cure> <reason>` in <state>/gui/install-failure: `login` — the definition is in place, so the account
198
+ # logging out and in loads it — or `admin` — it is not, and only a fresh admin line writes and loads it. A record without a cure word reads as `admin`.
199
+ gui_refusal_text() {
200
+ local line cure reason
201
+ line=$(head -n 1 "${runner_state:-}/gui/install-failure" 2> /dev/null | tr -d '[:cntrl:]')
202
+ cure=${line%% *}
203
+ case $line in
204
+ *' '*) reason=${line#* } ;;
205
+ *) reason= ;;
206
+ esac
207
+ case $cure in
208
+ login) printf "ios build: the login session's agent could not be loaded (%s) - log out and back in as %s, or paste a fresh admin line from /runners in an admin account's terminal" "$reason" "$(id -un)" ;;
209
+ admin) printf "ios build: the login session's agent could not be installed (%s) - paste a fresh admin line from /runners in an admin account's terminal" "$reason" ;;
210
+ '') printf 'ios build: needs a login of %s' "$(id -un)" ;;
211
+ *) printf "ios build: the login session's agent could not be installed (%s) - paste a fresh admin line from /runners in an admin account's terminal" "$line" ;;
212
+ esac
213
+ }
214
+
215
+ # Does THIS job need the login session — it needs iOS (`needs-ios`), and the runner is an always-on service? Such a job is refused without one.
216
+ gui_job_needs_session() {
217
+ [ -n "${jd:-}" ] && [ -f "$jd/needs-ios" ] && gui_session_expected
218
+ }
219
+
220
+ # Does THIS step go through the agent? On an always-on Mac EVERY job's steps do, while the login session exists (an iOS build is not always marked, and
221
+ # the session is what the account's own jobs would see); a job that needs iOS does even when it cannot (its step is cut, never run in the System session);
222
+ # any other job, with no session, runs in the daemon as it always did.
223
+ gui_step_uses_agent() {
224
+ [ -n "${jd:-}" ] && gui_session_expected && { [ -f "$jd/needs-ios" ] || gui_agent_alive; }
225
+ }
226
+
227
+ # Refuse a job that needs iOS before it is queued when there is no session to run it in.
228
+ refuse_without_gui_session() {
229
+ gui_job_needs_session || return 0
230
+ gui_agent_alive || die "$(gui_refusal_text)"
231
+ }
232
+
233
+ # The start time of process $1 as `ps` says it, whitespace squeezed — the way runnerUtility/guiAgent.ts records and compares it (the C locale is this script's own).
234
+ gui_process_start() {
235
+ ps -o lstart= -p "$1" 2> /dev/null | tr -s ' \t' ' ' | sed 's/^ //; s/ $//'
236
+ }
237
+
238
+ # Is process group $1 the group of the step whose leader started at $2 (`pgid-start` of the request folder)? The folders live on disk and a pid is handed out again
239
+ # — after a reboot, after a wrap — to something unrelated of the account (the Dock, the agent itself). So a recorded id is signalled only while the process with
240
+ # that pid still has the recorded start; or while no process has it and the group still has members (a pid is not handed out while a group carries it).
241
+ # No recorded start, or no `ps` to ask: not a group to signal.
242
+ gui_group_is_recorded() {
243
+ local current
244
+ [ -n "$2" ] && command -v ps > /dev/null 2>&1 || return 1
245
+ current=$(gui_process_start "$1")
246
+ if [ -n "$current" ]; then
247
+ [ "$current" = "$2" ]
248
+ return
249
+ fi
250
+ kill -0 -- "-$1" 2> /dev/null
251
+ }
252
+
253
+ # End the process group of a step the agent started (its id is in the request folder's `pgid`, its leader's start beside it): TERM, and KILL after the grace if
254
+ # anything is left. A step is a process group of its own (`setsid`), so an agent that died did not take it down — and the job's lock is released next, to a job
255
+ # that would run in the same tree beside an `xcodebuild` still writing into it.
256
+ gui_end_step_group() {
257
+ local pgid recorded waited=0
258
+ pgid=$(cat "$1/pgid" 2> /dev/null)
259
+ # `cat`'s own stderr goes to /dev/null: a redirect of `tr`'s input from a file that is not there fails in the shell, before any `2>` of the command applies.
260
+ recorded=$(cat "$1/pgid-start" 2> /dev/null | tr -s ' \t' ' ' | sed 's/^ //; s/ $//')
261
+ case $pgid in '' | *[!0-9]*) return 0 ;; esac
262
+ [ "$pgid" -gt 1 ] || return 0
263
+ gui_group_is_recorded "$pgid" "$recorded" || return 0
264
+ kill -TERM -- "-$pgid" 2> /dev/null || return 0
265
+ while kill -0 -- "-$pgid" 2> /dev/null && [ "$waited" -lt $((kill_grace_sec * 5)) ]; do
266
+ nap 0.2
267
+ waited=$((waited + 1))
268
+ done
269
+ if gui_group_is_recorded "$pgid" "$recorded" && kill -KILL -- "-$pgid" 2> /dev/null; then
270
+ # SIGKILL lands when each process is next scheduled: on a busy machine the group is still there when `kill` returns. The script goes on to release the job's lock, so it
271
+ # waits (bounded) until no member is left — never beside one that is still dying.
272
+ waited=0
273
+ while kill -0 -- "-$pgid" 2> /dev/null && [ "$waited" -lt "$kill_settle_polls" ]; do
274
+ nap 0.2
275
+ waited=$((waited + 1))
276
+ done
277
+ # Past the bound the script cannot wait for ever, but it does not go on silently either: the job's output says a member of the group outlived SIGKILL.
278
+ if kill -0 -- "-$pgid" 2> /dev/null; then
279
+ say "the step's process group ($pgid) is still alive after SIGKILL: the job goes on, and its lock is released, beside it"
280
+ fi
281
+ fi
282
+ return 0
283
+ }
284
+
285
+ # One step of a job, run by the agent in the login session: a request folder it picks up (`go` last), the step's output appended to the job's log by the agent
286
+ # itself, the exit code in `exit`. A kill is a `kill` file; the agent kills a step whose job script (`owner`, its start in `owner-start`) is gone.
287
+ # A job that needs iOS with no agent beating is refused here — no request is written for an agent that may appear a moment later and start a step nobody
288
+ # waits for. The step is cut with 125 when the agent stops, or is another instance than the one asked — and its process group is ended HERE, before the folder
289
+ # goes and the job's lock with it, on that path and on the one where a restarted agent answered 125 itself (`cut`); see gui_end_step_group.
290
+ gui_run_step() {
291
+ local directory=$1
292
+ local command_text=$2
293
+ if [ -f "$jd/needs-ios" ] && ! gui_agent_alive; then
294
+ say "$(gui_refusal_text)"
295
+ step_code=125
296
+ return 0
297
+ fi
298
+ gui_step_count=$((${gui_step_count:-0} + 1))
299
+ local request="$runner_state/gui/requests/$job.$gui_step_count"
300
+ local started_at
301
+ started_at=$(gui_agent_field startedAtMs)
302
+ rm -rf "$request"
303
+ if ! mkdir -p "$request" 2> /dev/null; then
304
+ say "the login session's agent folder cannot be written ($request)"
305
+ step_code=125
306
+ return 0
307
+ fi
308
+ printf '%s' "$directory" > "$request/cwd"
309
+ printf '%s' "$command_text" > "$request/command"
310
+ printf '%s' "$job_locale" > "$request/locale"
311
+ printf '%s' "$jd/log" > "$request/log"
312
+ printf '%s' "$$" > "$request/owner"
313
+ gui_process_start "$$" > "$request/owner-start"
314
+ if [ -s "$jd/env" ]; then cp "$jd/env" "$request/env"; else : > "$request/env"; fi
315
+ : > "$request/go"
316
+ local looks=0
317
+ while [ ! -f "$request/exit" ]; do
318
+ [ "$killed" -eq 1 ] && [ ! -f "$request/kill" ] && : > "$request/kill"
319
+ looks=$((looks + 1))
320
+ if [ $((looks % 5)) -eq 0 ] && { ! gui_agent_alive || [ "$(gui_agent_field startedAtMs)" != "$started_at" ]; }; then
321
+ say "the login session's agent stopped while this step ran: the step was cut"
322
+ gui_end_step_group "$request"
323
+ step_code=125
324
+ rm -rf "$request"
325
+ return 0
326
+ fi
327
+ nap 0.2
328
+ done
329
+ step_code=$(cat "$request/exit")
330
+ case $step_code in '' | *[!0-9]*) step_code=125 ;; esac
331
+ # A restarted agent cut the step (and told us so): its group got a TERM and gets its KILL after the grace — the job must not go on before it is gone.
332
+ [ -f "$request/cut" ] && gui_end_step_group "$request"
333
+ rm -rf "$request"
334
+ }
335
+
141
336
  # ─────────────────────────── probe ───────────────────────────
142
337
 
143
338
  kb_to_mb() {
@@ -291,6 +486,18 @@ probe_step_output() {
291
486
  read_file "$probe_dir/$1.out"
292
487
  }
293
488
 
489
+ # What a tool answered to `--version` (its first line, cut short): `none` when it is not on this PATH — a job that calls it ends with exit 127 —
490
+ # and `unknown` when it is there but did not answer in time.
491
+ probe_tool_version() {
492
+ local name=$1
493
+ command -v "$name" > /dev/null 2>&1 || { echo none; return 0; }
494
+ if [ "$(probe_step_status "$name")" = 0 ]; then
495
+ probe_step_output "$name" | head -n 1 | cut -c1-40
496
+ else
497
+ echo unknown
498
+ fi
499
+ }
500
+
294
501
  probe_slow() {
295
502
  mkdir -p "$work/tmp"
296
503
  probe_dir="$work/tmp/probe.$$.$RANDOM"
@@ -306,9 +513,15 @@ probe_slow() {
306
513
  start_probe_step simctl "$probe_step_sec" xcrun simctl list devices available
307
514
  fi
308
515
  [ "$has_docker" -eq 1 ] && start_probe_step docker "$probe_step_sec" docker info
516
+ # The tools of a job as THIS call sees them: the PATH a job runs with is the one of the ssh command that queued it, and so is the probe's.
517
+ # `yarn` may be Corepack's shim, which would fetch a yarn on its first run — never ask it to wait for an answer from the user.
518
+ command -v node > /dev/null 2>&1 && start_probe_step node "$probe_step_sec" node --version
519
+ command -v yarn > /dev/null 2>&1 && start_probe_step yarn "$probe_step_sec" env COREPACK_ENABLE_DOWNLOAD_PROMPT=0 yarn --version
309
520
  wait
310
521
 
311
522
  echo "disk_free_mb=$(kb_to_mb "$(probe_step_output disk | awk 'NR == 2 { print $4 }')")"
523
+ echo "job_node=$(probe_tool_version node)"
524
+ echo "job_yarn=$(probe_tool_version yarn)"
312
525
  if [ "$(probe_step_status pueue)" = 0 ]; then
313
526
  echo "pueue=$(probe_step_output pueue | awk '{ print $NF }')"
314
527
  else
@@ -320,7 +533,11 @@ probe_slow() {
320
533
  elif [ "$(probe_step_status xcode)" = 0 ]; then
321
534
  local xcode_version
322
535
  xcode_version=$(probe_step_output xcode | head -n 1 | sed 's/^Xcode //')
323
- if [ "${ios_boot_status:-}" = failed ]; then
536
+ if gui_session_expected && ! gui_agent_alive; then
537
+ # An always-on Mac runs its iOS work in the account's login session: with none, builds crash (Xcode's nested builds) and the Simulator will not boot.
538
+ echo "cap_ios=no"
539
+ echo "cap_ios_detail=$(gui_refusal_text)"
540
+ elif [ "${ios_boot_status:-}" = failed ]; then
324
541
  # Xcode is there, but the runner's own check failed. The Simulator refusing to boot is Apple's rule (none is available outside a login
325
542
  # session); any other reason (no runtime installed, the device could not be created) is shown as it is — the login session would be a
326
543
  # wrong cure. «the Simulator did not» is `iosBootFailureReasonPrefix` in runnerUtility/iosCheck.ts.
@@ -387,7 +604,35 @@ read_runner_state() {
387
604
  ios_boot_detail=$(sed -n 's/.*"reason"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "$check" | head -n 1)
388
605
  }
389
606
 
390
- # paused= / service= / runner_version= / ios_boot= of a paired runner (nothing for a hand-made one).
607
+ # awake= (caffeinate | systemd-inhibit | no) and awake_detail= of a paired runner: how its link keeps the machine awake, from `<state>/awake` (one line,
608
+ # `<method> <holder pid>` or `none <reason>`; runnerUtility/keepAwake.ts). A holder that is gone is `no`, whatever the file says; no file (a link of an older
609
+ # version, or none ever started) says nothing.
610
+ probe_awake() {
611
+ local awake_file="$runner_state/awake" method detail
612
+ [ -f "$awake_file" ] || return 0
613
+ read -r method detail < "$awake_file"
614
+ case $method in
615
+ caffeinate | systemd-inhibit)
616
+ case $detail in
617
+ '' | *[!0-9]*) echo "awake=no"; echo "awake_detail=the state of the sleep assertion is unreadable" ;;
618
+ *)
619
+ if kill -0 "$detail" 2> /dev/null; then
620
+ echo "awake=$method"
621
+ else
622
+ echo "awake=no"
623
+ echo "awake_detail=the $method process of the link is gone"
624
+ fi
625
+ ;;
626
+ esac
627
+ ;;
628
+ none)
629
+ echo "awake=no"
630
+ echo "awake_detail=$detail"
631
+ ;;
632
+ esac
633
+ }
634
+
635
+ # paused= / service= / runner_version= / ios_boot= / awake= of a paired runner (nothing for a hand-made one).
391
636
  probe_runner_state() {
392
637
  [ -n "$runner_state" ] || return 0
393
638
  if [ -f "$runner_state/paused" ]; then echo "paused=yes"; else echo "paused=no"; fi
@@ -401,6 +646,7 @@ probe_runner_state() {
401
646
  echo "runner_version=$(sed -n 's/^[[:space:]]*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "$runner_state/current/package.json" 2> /dev/null | head -n 1)"
402
647
  [ -n "$ios_boot_status" ] && echo "ios_boot=$ios_boot_status"
403
648
  [ -n "$ios_boot_detail" ] && echo "ios_boot_detail=$ios_boot_detail"
649
+ probe_awake
404
650
  return 0
405
651
  }
406
652
 
@@ -543,6 +789,7 @@ add_job() {
543
789
 
544
790
  cmd_submit() {
545
791
  set_paths "$1" "$2" "$3"
792
+ refuse_without_gui_session
546
793
  add_job "${4:-default}" || die "pueue add failed (does the group \"${4:-default}\" exist on this runner?)"
547
794
  echo queued
548
795
  }
@@ -597,7 +844,13 @@ kill_job() {
597
844
  # SIGKILL of the whole group; Pueue's own kill follows only so that its task list agrees. Without a verifiable group, Pueue's kill
598
845
  # is all there is. A job that is SIGKILLed cannot write its own result, so the result is recorded FIRST: when the caller is the job's own
599
846
  # watchdog the group-wide SIGKILL takes the watchdog down with the job.
847
+ #
848
+ # TERM and HUP are ignored from here on: the record is what the lease's main flow (and a `kill` call) waits for, and the main flow ends the lease's
849
+ # watcher — this very process, when the watcher's kill is the one that got here first — the moment the record appears. A kill that still had its forks to do
850
+ # (`ps` and `tr` in `signal_job_group`: a second or more on a loaded machine) died between the record and its SIGKILL, and a command that ignores SIGTERM lived
851
+ # on in a job that was already "ended", with nobody left to stop it. HUP too: a caller's ssh session that closes must not take a kill half-way either.
600
852
  hard_kill_job() {
853
+ trap '' TERM HUP
601
854
  finish_killed_job
602
855
  signal_job_group KILL || pq kill "$1" > /dev/null 2>&1
603
856
  pq kill "$1" > /dev/null 2>&1
@@ -643,7 +896,7 @@ cmd_kill() {
643
896
  # Print what the log gained since $log_offset, and move the offset.
644
897
  drain_log() {
645
898
  local size
646
- size=$(wc -c < "$jd/log" 2> /dev/null | tr -d ' ')
899
+ size=$(wc -c 2> /dev/null < "$jd/log" | tr -d ' ')
647
900
  [ -n "$size" ] || return 0
648
901
  if [ "$size" -gt "$log_offset" ]; then
649
902
  tail -c +"$((log_offset + 1))" "$jd/log" | head -c "$((size - log_offset))"
@@ -704,7 +957,7 @@ follow_until_done() {
704
957
  # Where `follow` starts in the log: the beginning, the end, or the last N lines.
705
958
  resolve_follow_offset() {
706
959
  local size
707
- size=$(wc -c < "$jd/log" 2> /dev/null | tr -d ' ')
960
+ size=$(wc -c 2> /dev/null < "$jd/log" | tr -d ' ')
708
961
  size=${size:-0}
709
962
  case ${1:-start} in
710
963
  end) echo "$size" ;;
@@ -824,8 +1077,11 @@ watch_lease() {
824
1077
 
825
1078
  # The time of the latest heartbeat, replaced atomically: a plain `> beat` truncates the file first, and a watcher that read it in
826
1079
  # that instant got an empty string, whose arithmetic is a syntax error that ended the watcher without a verdict.
1080
+ # SILENT: the watcher's end removes the directory while the reader may be between its `date` and its `mv`, and that `mv: cannot stat …` came out on the
1081
+ # caller's stderr AFTER the exit marker of `exec` — the marker must be the last thing there (a flake of the exec test under load). A beat that cannot be
1082
+ # written for a directory that is gone is nothing to say.
827
1083
  write_lease_beat() {
828
- date +%s > "$lease_state_dir/beat.new" && mv -f "$lease_state_dir/beat.new" "$lease_state_dir/beat"
1084
+ { date +%s > "$lease_state_dir/beat.new" && mv -f "$lease_state_dir/beat.new" "$lease_state_dir/beat"; } 2> /dev/null
829
1085
  }
830
1086
 
831
1087
  end_lease_watch() {
@@ -842,6 +1098,7 @@ cmd_lease() {
842
1098
  local group=$4
843
1099
  local lease_sec
844
1100
  lease_sec=$(ms_to_sec "$5")
1101
+ refuse_without_gui_session
845
1102
  # A background job gets /dev/null as stdin unless job control is on: keep the caller's stream on fd 3 for the watcher.
846
1103
  exec 3<&0
847
1104
  add_job "$group" || die "pueue add failed (does the group \"$group\" exist on this runner?)"
@@ -1022,13 +1279,45 @@ cmd_sync_tree() {
1022
1279
  sync_tree || die "apply failed"
1023
1280
  }
1024
1281
 
1282
+ # The first lines of what is on stdin that look like an error, each cut short and none twice (this script's own lines excluded). The ROOT cause
1283
+ # comes first: what a tool prints last is its summary of the failure («couldn't be built successfully», «exit code 1»), and the last lines are
1284
+ # all `wait` shows.
1285
+ first_error_lines() {
1286
+ grep -a -v '^remote-run: ' | grep -a -i -E "$error_line_pattern" | tr -d '\033\r' | cut -c1-240 | awk '!seen[$0]++' | head -n "$failed_step_error_lines"
1287
+ }
1288
+
1289
+ # The dependencies step failed: say why in the job's log, from the step's own output (everything of the log after byte offset $1) — its first
1290
+ # error lines, and the first error lines of the build log the tool names (yarn: «logs can be found here: …/build.log»; yarn removes it with its
1291
+ # temp folder when it exits, then the way to get the build output into the log is said instead).
1292
+ describe_failed_step() {
1293
+ local first_errors build_log
1294
+ first_errors=$(tail -c +"$(($1 + 1))" "$jd/log" 2> /dev/null | first_error_lines)
1295
+ [ -n "$first_errors" ] || return 0
1296
+ say "the first errors of the dependencies step (all of its output is in the log):"
1297
+ printf '%s\n' "$first_errors" | sed 's/^/remote-run: /'
1298
+ for build_log in $(tail -c +"$(($1 + 1))" "$jd/log" 2> /dev/null | grep -a -o -E 'logs can be found here: [^[:space:])]+/build\.log' | sed 's/.*here: //' | awk '!seen[$0]++' | head -n 2); do
1299
+ if [ -f "$build_log" ]; then
1300
+ say "the build log the tool names, $build_log — its first errors:"
1301
+ first_error_lines < "$build_log" | sed 's/^/remote-run: /'
1302
+ else
1303
+ say "the build log the tool names, $build_log, is gone (the tool removes it when it exits): run the step again with -e YARN_ENABLE_INLINE_BUILDS=1 to get the build output into the log"
1304
+ fi
1305
+ done
1306
+ }
1307
+
1025
1308
  # bash -c <command> in <directory>, with the job's -e variables, output into the log; sets step_code. Runs as a child so a
1026
1309
  # SIGTERM to the job (the `killed` flag) does not abandon it half-way.
1027
1310
  run_step() {
1028
1311
  local directory=$1
1029
1312
  local command_text=$2
1313
+ if gui_step_uses_agent; then
1314
+ gui_run_step "$directory" "$command_text"
1315
+ return 0
1316
+ fi
1030
1317
  (
1031
1318
  cd "$directory" || exit 126
1319
+ LC_ALL=$job_locale
1320
+ export LC_ALL
1032
1321
  if [ -s "$jd/env" ]; then
1033
1322
  while IFS= read -r env_line; do export "$env_line"; done < "$jd/env"
1034
1323
  fi
@@ -1180,6 +1469,12 @@ cmd_job() {
1180
1469
  fi
1181
1470
  start_watchdog "$limit_sec"
1182
1471
 
1472
+ # The session may have ended while the job waited in the queue.
1473
+ if gui_job_needs_session && ! gui_agent_alive; then
1474
+ say "$(gui_refusal_text)"
1475
+ finish_job 125
1476
+ fi
1477
+
1183
1478
  set_phase waiting-lock
1184
1479
  acquire_lock || finish_job 137
1185
1480
 
@@ -1197,11 +1492,14 @@ cmd_job() {
1197
1492
  if [ -n "$install_command" ] && [ "$(read_file "$proj/deps.hash")" != "$install_key" ]; then
1198
1493
  set_phase deps
1199
1494
  say "installing dependencies: $install_command"
1495
+ local step_log_offset
1496
+ step_log_offset=$(wc -c < "$jd/log" | tr -d ' ')
1200
1497
  run_step "$tree" "$install_command"
1201
1498
  if [ "$step_code" -ne 0 ]; then
1202
1499
  rm -f "$proj/deps.hash"
1203
1500
  echo deps > "$jd/failed-step"
1204
1501
  say "the dependencies step failed with exit code $step_code"
1502
+ describe_failed_step "$step_log_offset"
1205
1503
  finish_job 125
1206
1504
  fi
1207
1505
  printf '%s\n' "$install_key" > "$proj/deps.hash"
@@ -1227,7 +1525,7 @@ cmd_exec() {
1227
1525
  exec 3<&0
1228
1526
  # Own process group, so the lease can stop the command and everything it started.
1229
1527
  set -m
1230
- ( cd "$tree/$subfolder" && exec bash -c "$*" ) < /dev/null &
1528
+ ( cd "$tree/$subfolder" && LC_ALL=$job_locale && export LC_ALL && exec bash -c "$*" ) < /dev/null &
1231
1529
  local exec_pid=$!
1232
1530
  keep_awake_while "$exec_pid"
1233
1531
  set +m