charness 3.9.1 → 3.10.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 (374) hide show
  1. package/CHANGELOG.md +126 -0
  2. package/DEVELOPMENT.md +4 -1
  3. package/SETUP.md +6 -4
  4. package/agent-plugin/README.md +2 -2
  5. package/agent-plugin/skills/charness-delegate-opencode/SKILL.md +1 -1
  6. package/agent-plugin/skills/charness-manager/SKILL.md +8 -4
  7. package/dist/bot.d.ts +27 -18
  8. package/dist/bot.d.ts.map +1 -1
  9. package/dist/bot.js +217 -99
  10. package/dist/bot.js.map +1 -1
  11. package/dist/connectors/jira/adf.d.ts.map +1 -1
  12. package/dist/connectors/jira/adf.js +2 -3
  13. package/dist/connectors/jira/adf.js.map +1 -1
  14. package/dist/connectors/telegram/commands/botCore.d.ts +16 -0
  15. package/dist/connectors/telegram/commands/botCore.d.ts.map +1 -1
  16. package/dist/connectors/telegram/commands/runners.d.ts +10 -1
  17. package/dist/connectors/telegram/commands/runners.d.ts.map +1 -1
  18. package/dist/connectors/telegram/commands/runners.js +75 -13
  19. package/dist/connectors/telegram/commands/runners.js.map +1 -1
  20. package/dist/connectors/telegram/runnerLinkNotices.d.ts +24 -0
  21. package/dist/connectors/telegram/runnerLinkNotices.d.ts.map +1 -0
  22. package/dist/connectors/telegram/runnerLinkNotices.js +95 -0
  23. package/dist/connectors/telegram/runnerLinkNotices.js.map +1 -0
  24. package/dist/connectors/telegram/runnerPairingMessages.d.ts +9 -0
  25. package/dist/connectors/telegram/runnerPairingMessages.d.ts.map +1 -1
  26. package/dist/connectors/telegram/runnerPairingMessages.js +17 -1
  27. package/dist/connectors/telegram/runnerPairingMessages.js.map +1 -1
  28. package/dist/i18n/de.d.ts.map +1 -1
  29. package/dist/i18n/de.js +19 -0
  30. package/dist/i18n/de.js.map +1 -1
  31. package/dist/i18n/en.d.ts.map +1 -1
  32. package/dist/i18n/en.js +19 -0
  33. package/dist/i18n/en.js.map +1 -1
  34. package/dist/i18n/es.d.ts.map +1 -1
  35. package/dist/i18n/es.js +19 -0
  36. package/dist/i18n/es.js.map +1 -1
  37. package/dist/i18n/fr.d.ts.map +1 -1
  38. package/dist/i18n/fr.js +19 -0
  39. package/dist/i18n/fr.js.map +1 -1
  40. package/dist/i18n/hi.d.ts.map +1 -1
  41. package/dist/i18n/hi.js +19 -0
  42. package/dist/i18n/hi.js.map +1 -1
  43. package/dist/i18n/ja.d.ts.map +1 -1
  44. package/dist/i18n/ja.js +19 -0
  45. package/dist/i18n/ja.js.map +1 -1
  46. package/dist/i18n/ka.d.ts.map +1 -1
  47. package/dist/i18n/ka.js +19 -0
  48. package/dist/i18n/ka.js.map +1 -1
  49. package/dist/i18n/pt.d.ts.map +1 -1
  50. package/dist/i18n/pt.js +19 -0
  51. package/dist/i18n/pt.js.map +1 -1
  52. package/dist/i18n/ru.d.ts.map +1 -1
  53. package/dist/i18n/ru.js +19 -0
  54. package/dist/i18n/ru.js.map +1 -1
  55. package/dist/i18n/uk.d.ts.map +1 -1
  56. package/dist/i18n/uk.js +19 -0
  57. package/dist/i18n/uk.js.map +1 -1
  58. package/dist/i18n/uz.d.ts.map +1 -1
  59. package/dist/i18n/uz.js +19 -0
  60. package/dist/i18n/uz.js.map +1 -1
  61. package/dist/i18n/zh.d.ts.map +1 -1
  62. package/dist/i18n/zh.js +19 -0
  63. package/dist/i18n/zh.js.map +1 -1
  64. package/dist/outputTrace.d.ts.map +1 -1
  65. package/dist/outputTrace.js +2 -9
  66. package/dist/outputTrace.js.map +1 -1
  67. package/dist/rateLimiter.d.ts +3 -1
  68. package/dist/rateLimiter.d.ts.map +1 -1
  69. package/dist/rateLimiter.js +3 -1
  70. package/dist/rateLimiter.js.map +1 -1
  71. package/dist/remoteRun/cliArgs.d.ts +6 -1
  72. package/dist/remoteRun/cliArgs.d.ts.map +1 -1
  73. package/dist/remoteRun/cliArgs.js +39 -2
  74. package/dist/remoteRun/cliArgs.js.map +1 -1
  75. package/dist/remoteRun/exitCodes.d.ts +12 -2
  76. package/dist/remoteRun/exitCodes.d.ts.map +1 -1
  77. package/dist/remoteRun/exitCodes.js +3 -0
  78. package/dist/remoteRun/exitCodes.js.map +1 -1
  79. package/dist/remoteRun/foreground.d.ts +13 -0
  80. package/dist/remoteRun/foreground.d.ts.map +1 -1
  81. package/dist/remoteRun/foreground.js +15 -2
  82. package/dist/remoteRun/foreground.js.map +1 -1
  83. package/dist/remoteRun/heldBackNotice.d.ts +7 -0
  84. package/dist/remoteRun/heldBackNotice.d.ts.map +1 -0
  85. package/dist/remoteRun/heldBackNotice.js +92 -0
  86. package/dist/remoteRun/heldBackNotice.js.map +1 -0
  87. package/dist/remoteRun/interrupts.d.ts +6 -2
  88. package/dist/remoteRun/interrupts.d.ts.map +1 -1
  89. package/dist/remoteRun/interrupts.js +18 -3
  90. package/dist/remoteRun/interrupts.js.map +1 -1
  91. package/dist/remoteRun/leaseTiming.d.ts +1 -2
  92. package/dist/remoteRun/leaseTiming.d.ts.map +1 -1
  93. package/dist/remoteRun/leaseTiming.js +3 -17
  94. package/dist/remoteRun/leaseTiming.js.map +1 -1
  95. package/dist/remoteRun/output.d.ts +16 -1
  96. package/dist/remoteRun/output.d.ts.map +1 -1
  97. package/dist/remoteRun/output.js +28 -2
  98. package/dist/remoteRun/output.js.map +1 -1
  99. package/dist/remoteRun/probe.d.ts +40 -2
  100. package/dist/remoteRun/probe.d.ts.map +1 -1
  101. package/dist/remoteRun/probe.js +58 -2
  102. package/dist/remoteRun/probe.js.map +1 -1
  103. package/dist/remoteRun/project.d.ts +2 -2
  104. package/dist/remoteRun/project.d.ts.map +1 -1
  105. package/dist/remoteRun/project.js +5 -4
  106. package/dist/remoteRun/project.js.map +1 -1
  107. package/dist/remoteRun/remoteRunCli.d.ts +1 -1
  108. package/dist/remoteRun/remoteRunCli.d.ts.map +1 -1
  109. package/dist/remoteRun/remoteRunCli.js +6 -3
  110. package/dist/remoteRun/remoteRunCli.js.map +1 -1
  111. package/dist/remoteRun/runnerWait.d.ts +3 -3
  112. package/dist/remoteRun/runnerWait.d.ts.map +1 -1
  113. package/dist/remoteRun/runnerWait.js +12 -6
  114. package/dist/remoteRun/runnerWait.js.map +1 -1
  115. package/dist/remoteRun/runnerWaitTiming.d.ts +1 -1
  116. package/dist/remoteRun/runnerWaitTiming.d.ts.map +1 -1
  117. package/dist/remoteRun/runnerWaitTiming.js +3 -16
  118. package/dist/remoteRun/runnerWaitTiming.js.map +1 -1
  119. package/dist/remoteRun/runners.d.ts +16 -3
  120. package/dist/remoteRun/runners.d.ts.map +1 -1
  121. package/dist/remoteRun/runners.js +42 -4
  122. package/dist/remoteRun/runners.js.map +1 -1
  123. package/dist/remoteRun/sendPlan.d.ts +11 -1
  124. package/dist/remoteRun/sendPlan.d.ts.map +1 -1
  125. package/dist/remoteRun/sendPlan.js +29 -5
  126. package/dist/remoteRun/sendPlan.js.map +1 -1
  127. package/dist/remoteRun/submit.d.ts.map +1 -1
  128. package/dist/remoteRun/submit.js +13 -3
  129. package/dist/remoteRun/submit.js.map +1 -1
  130. package/dist/runnerUtility/adminService.d.ts +30 -2
  131. package/dist/runnerUtility/adminService.d.ts.map +1 -1
  132. package/dist/runnerUtility/adminService.js +104 -6
  133. package/dist/runnerUtility/adminService.js.map +1 -1
  134. package/dist/runnerUtility/appInstall.d.ts +13 -4
  135. package/dist/runnerUtility/appInstall.d.ts.map +1 -1
  136. package/dist/runnerUtility/appInstall.js +46 -19
  137. package/dist/runnerUtility/appInstall.js.map +1 -1
  138. package/dist/runnerUtility/appUpdate.js +1 -1
  139. package/dist/runnerUtility/appUpdate.js.map +1 -1
  140. package/dist/runnerUtility/execEnv.d.ts +2 -0
  141. package/dist/runnerUtility/execEnv.d.ts.map +1 -1
  142. package/dist/runnerUtility/execEnv.js +6 -2
  143. package/dist/runnerUtility/execEnv.js.map +1 -1
  144. package/dist/runnerUtility/guiAgent.d.ts +126 -0
  145. package/dist/runnerUtility/guiAgent.d.ts.map +1 -0
  146. package/dist/runnerUtility/guiAgent.js +591 -0
  147. package/dist/runnerUtility/guiAgent.js.map +1 -0
  148. package/dist/runnerUtility/guiAgentHeal.d.ts +128 -0
  149. package/dist/runnerUtility/guiAgentHeal.d.ts.map +1 -0
  150. package/dist/runnerUtility/guiAgentHeal.js +284 -0
  151. package/dist/runnerUtility/guiAgentHeal.js.map +1 -0
  152. package/dist/runnerUtility/homeFolders.d.ts +33 -0
  153. package/dist/runnerUtility/homeFolders.d.ts.map +1 -0
  154. package/dist/runnerUtility/homeFolders.js +158 -0
  155. package/dist/runnerUtility/homeFolders.js.map +1 -0
  156. package/dist/runnerUtility/hubClient.d.ts +12 -2
  157. package/dist/runnerUtility/hubClient.d.ts.map +1 -1
  158. package/dist/runnerUtility/hubClient.js +24 -3
  159. package/dist/runnerUtility/hubClient.js.map +1 -1
  160. package/dist/runnerUtility/iosCheck.d.ts +7 -1
  161. package/dist/runnerUtility/iosCheck.d.ts.map +1 -1
  162. package/dist/runnerUtility/iosCheck.js +14 -5
  163. package/dist/runnerUtility/iosCheck.js.map +1 -1
  164. package/dist/runnerUtility/isolatedCommand.d.ts +33 -0
  165. package/dist/runnerUtility/isolatedCommand.d.ts.map +1 -0
  166. package/dist/runnerUtility/isolatedCommand.js +139 -0
  167. package/dist/runnerUtility/isolatedCommand.js.map +1 -0
  168. package/dist/runnerUtility/keepAwake.d.ts +67 -0
  169. package/dist/runnerUtility/keepAwake.d.ts.map +1 -0
  170. package/dist/runnerUtility/keepAwake.js +211 -0
  171. package/dist/runnerUtility/keepAwake.js.map +1 -0
  172. package/dist/runnerUtility/lidPollTiming.d.ts +11 -0
  173. package/dist/runnerUtility/lidPollTiming.d.ts.map +1 -0
  174. package/dist/runnerUtility/lidPollTiming.js +18 -0
  175. package/dist/runnerUtility/lidPollTiming.js.map +1 -0
  176. package/dist/runnerUtility/lidState.d.ts +57 -0
  177. package/dist/runnerUtility/lidState.d.ts.map +1 -0
  178. package/dist/runnerUtility/lidState.js +195 -0
  179. package/dist/runnerUtility/lidState.js.map +1 -0
  180. package/dist/runnerUtility/linkLoop.d.ts +5 -0
  181. package/dist/runnerUtility/linkLoop.d.ts.map +1 -1
  182. package/dist/runnerUtility/linkLoop.js +37 -1
  183. package/dist/runnerUtility/linkLoop.js.map +1 -1
  184. package/dist/runnerUtility/packageManagerShims.d.ts +44 -0
  185. package/dist/runnerUtility/packageManagerShims.d.ts.map +1 -0
  186. package/dist/runnerUtility/packageManagerShims.js +130 -0
  187. package/dist/runnerUtility/packageManagerShims.js.map +1 -0
  188. package/dist/runnerUtility/progress.d.ts +43 -0
  189. package/dist/runnerUtility/progress.d.ts.map +1 -0
  190. package/dist/runnerUtility/progress.js +78 -0
  191. package/dist/runnerUtility/progress.js.map +1 -0
  192. package/dist/runnerUtility/pueueDaemon.d.ts +8 -4
  193. package/dist/runnerUtility/pueueDaemon.d.ts.map +1 -1
  194. package/dist/runnerUtility/pueueDaemon.js +12 -7
  195. package/dist/runnerUtility/pueueDaemon.js.map +1 -1
  196. package/dist/runnerUtility/rootServiceCli.d.ts +23 -3
  197. package/dist/runnerUtility/rootServiceCli.d.ts.map +1 -1
  198. package/dist/runnerUtility/rootServiceCli.js +56 -10
  199. package/dist/runnerUtility/rootServiceCli.js.map +1 -1
  200. package/dist/runnerUtility/runnerCli.d.ts +1 -0
  201. package/dist/runnerUtility/runnerCli.d.ts.map +1 -1
  202. package/dist/runnerUtility/runnerCli.js +14 -7
  203. package/dist/runnerUtility/runnerCli.js.map +1 -1
  204. package/dist/runnerUtility/runnerCommands.d.ts +45 -0
  205. package/dist/runnerUtility/runnerCommands.d.ts.map +1 -1
  206. package/dist/runnerUtility/runnerCommands.js +188 -21
  207. package/dist/runnerUtility/runnerCommands.js.map +1 -1
  208. package/dist/runnerUtility/runnerHome.d.ts +8 -0
  209. package/dist/runnerUtility/runnerHome.d.ts.map +1 -1
  210. package/dist/runnerUtility/runnerHome.js +7 -0
  211. package/dist/runnerUtility/runnerHome.js.map +1 -1
  212. package/dist/runnerUtility/serviceCommon.d.ts +4 -0
  213. package/dist/runnerUtility/serviceCommon.d.ts.map +1 -1
  214. package/dist/runnerUtility/serviceCommon.js +8 -1
  215. package/dist/runnerUtility/serviceCommon.js.map +1 -1
  216. package/dist/runnerUtility/serviceManager.d.ts +5 -2
  217. package/dist/runnerUtility/serviceManager.d.ts.map +1 -1
  218. package/dist/runnerUtility/serviceManager.js +40 -17
  219. package/dist/runnerUtility/serviceManager.js.map +1 -1
  220. package/dist/runnerUtility/serviceUnits.d.ts +11 -0
  221. package/dist/runnerUtility/serviceUnits.d.ts.map +1 -1
  222. package/dist/runnerUtility/serviceUnits.js +8 -2
  223. package/dist/runnerUtility/serviceUnits.js.map +1 -1
  224. package/dist/runnerUtility/simulatorSilencer.d.ts +55 -0
  225. package/dist/runnerUtility/simulatorSilencer.d.ts.map +1 -0
  226. package/dist/runnerUtility/simulatorSilencer.js +203 -0
  227. package/dist/runnerUtility/simulatorSilencer.js.map +1 -0
  228. package/dist/runnerUtility/stopSignals.d.ts +10 -0
  229. package/dist/runnerUtility/stopSignals.d.ts.map +1 -0
  230. package/dist/runnerUtility/stopSignals.js +27 -0
  231. package/dist/runnerUtility/stopSignals.js.map +1 -0
  232. package/dist/runnerUtility/versionPollTiming.d.ts +2 -3
  233. package/dist/runnerUtility/versionPollTiming.d.ts.map +1 -1
  234. package/dist/runnerUtility/versionPollTiming.js +4 -18
  235. package/dist/runnerUtility/versionPollTiming.js.map +1 -1
  236. package/dist/runners/bootstrapLine.d.ts.map +1 -1
  237. package/dist/runners/bootstrapLine.js +35 -19
  238. package/dist/runners/bootstrapLine.js.map +1 -1
  239. package/dist/runners/gate.d.ts.map +1 -1
  240. package/dist/runners/gate.js +28 -1
  241. package/dist/runners/gate.js.map +1 -1
  242. package/dist/runners/gateLink.d.ts +7 -0
  243. package/dist/runners/gateLink.d.ts.map +1 -1
  244. package/dist/runners/gateLink.js +36 -3
  245. package/dist/runners/gateLink.js.map +1 -1
  246. package/dist/runners/gateProtocol.d.ts +37 -2
  247. package/dist/runners/gateProtocol.d.ts.map +1 -1
  248. package/dist/runners/gateProtocol.js +45 -4
  249. package/dist/runners/gateProtocol.js.map +1 -1
  250. package/dist/runners/hubPackage.d.ts +2 -1
  251. package/dist/runners/hubPackage.d.ts.map +1 -1
  252. package/dist/runners/hubPackage.js +32 -11
  253. package/dist/runners/hubPackage.js.map +1 -1
  254. package/dist/runners/hubPairing.d.ts +1 -1
  255. package/dist/runners/hubPairing.d.ts.map +1 -1
  256. package/dist/runners/hubPairing.js +8 -1
  257. package/dist/runners/hubPairing.js.map +1 -1
  258. package/dist/runners/hubPaths.d.ts +2 -0
  259. package/dist/runners/hubPaths.d.ts.map +1 -1
  260. package/dist/runners/hubPaths.js +1 -1
  261. package/dist/runners/hubPaths.js.map +1 -1
  262. package/dist/runners/linkConcern.d.ts +75 -0
  263. package/dist/runners/linkConcern.d.ts.map +1 -0
  264. package/dist/runners/linkConcern.js +85 -0
  265. package/dist/runners/linkConcern.js.map +1 -0
  266. package/dist/runners/linkControl.d.ts +25 -1
  267. package/dist/runners/linkControl.d.ts.map +1 -1
  268. package/dist/runners/linkControl.js +46 -4
  269. package/dist/runners/linkControl.js.map +1 -1
  270. package/dist/runners/pairingTiming.d.ts +2 -3
  271. package/dist/runners/pairingTiming.d.ts.map +1 -1
  272. package/dist/runners/pairingTiming.js +4 -18
  273. package/dist/runners/pairingTiming.js.map +1 -1
  274. package/dist/runners/runnerLock.d.ts +112 -0
  275. package/dist/runners/runnerLock.d.ts.map +1 -0
  276. package/dist/runners/runnerLock.js +292 -0
  277. package/dist/runners/runnerLock.js.map +1 -0
  278. package/dist/runners/runnersCli.d.ts +6 -3
  279. package/dist/runners/runnersCli.d.ts.map +1 -1
  280. package/dist/runners/runnersCli.js +33 -6
  281. package/dist/runners/runnersCli.js.map +1 -1
  282. package/dist/runners/runnersList.d.ts +3 -3
  283. package/dist/runners/runnersList.d.ts.map +1 -1
  284. package/dist/runners/runnersList.js +9 -2
  285. package/dist/runners/runnersList.js.map +1 -1
  286. package/dist/runners/runnersOverview.d.ts +29 -3
  287. package/dist/runners/runnersOverview.d.ts.map +1 -1
  288. package/dist/runners/runnersOverview.js +71 -6
  289. package/dist/runners/runnersOverview.js.map +1 -1
  290. package/dist/runners/serviceRemoval.d.ts +43 -0
  291. package/dist/runners/serviceRemoval.d.ts.map +1 -0
  292. package/dist/runners/serviceRemoval.js +114 -0
  293. package/dist/runners/serviceRemoval.js.map +1 -0
  294. package/dist/scheduler/checkStatus.d.ts +78 -0
  295. package/dist/scheduler/checkStatus.d.ts.map +1 -0
  296. package/dist/scheduler/checkStatus.js +122 -0
  297. package/dist/scheduler/checkStatus.js.map +1 -0
  298. package/dist/scheduler/delivery.d.ts +27 -1
  299. package/dist/scheduler/delivery.d.ts.map +1 -1
  300. package/dist/scheduler/delivery.js +83 -6
  301. package/dist/scheduler/delivery.js.map +1 -1
  302. package/dist/scheduler/mcpSurface.d.ts +2 -0
  303. package/dist/scheduler/mcpSurface.d.ts.map +1 -1
  304. package/dist/scheduler/mcpSurface.js +62 -10
  305. package/dist/scheduler/mcpSurface.js.map +1 -1
  306. package/dist/scheduler/store.d.ts +16 -1
  307. package/dist/scheduler/store.d.ts.map +1 -1
  308. package/dist/scheduler/store.js +33 -0
  309. package/dist/scheduler/store.js.map +1 -1
  310. package/dist/scheduler/types.d.ts +22 -0
  311. package/dist/scheduler/types.d.ts.map +1 -1
  312. package/dist/scheduler/unbindPause.d.ts +27 -0
  313. package/dist/scheduler/unbindPause.d.ts.map +1 -0
  314. package/dist/scheduler/unbindPause.js +21 -0
  315. package/dist/scheduler/unbindPause.js.map +1 -0
  316. package/dist/scheduler/workerActivity.d.ts +25 -0
  317. package/dist/scheduler/workerActivity.d.ts.map +1 -0
  318. package/dist/scheduler/workerActivity.js +195 -0
  319. package/dist/scheduler/workerActivity.js.map +1 -0
  320. package/dist/scheduler/workerWatch.d.ts +14 -2
  321. package/dist/scheduler/workerWatch.d.ts.map +1 -1
  322. package/dist/scheduler/workerWatch.js +15 -3
  323. package/dist/scheduler/workerWatch.js.map +1 -1
  324. package/dist/state.d.ts +8 -0
  325. package/dist/state.d.ts.map +1 -1
  326. package/dist/state.js +30 -0
  327. package/dist/state.js.map +1 -1
  328. package/dist/stt/sttRuntime.d.ts.map +1 -1
  329. package/dist/stt/sttRuntime.js +8 -1
  330. package/dist/stt/sttRuntime.js.map +1 -1
  331. package/dist/stt/sttSettings.d.ts +56 -6
  332. package/dist/stt/sttSettings.d.ts.map +1 -1
  333. package/dist/stt/sttSettings.js +128 -7
  334. package/dist/stt/sttSettings.js.map +1 -1
  335. package/dist/stt/sttSidecarOwner.d.ts +13 -5
  336. package/dist/stt/sttSidecarOwner.d.ts.map +1 -1
  337. package/dist/stt/sttSidecarOwner.js +72 -31
  338. package/dist/stt/sttSidecarOwner.js.map +1 -1
  339. package/dist/stt/transcribeChain.d.ts +23 -1
  340. package/dist/stt/transcribeChain.d.ts.map +1 -1
  341. package/dist/stt/transcribeChain.js +59 -4
  342. package/dist/stt/transcribeChain.js.map +1 -1
  343. package/dist/testTimings.d.ts +4 -2
  344. package/dist/testTimings.d.ts.map +1 -1
  345. package/dist/testTimings.js +7 -1
  346. package/dist/testTimings.js.map +1 -1
  347. package/dist/testTimingsSeam.d.ts +10 -0
  348. package/dist/testTimingsSeam.d.ts.map +1 -0
  349. package/dist/testTimingsSeam.js +29 -0
  350. package/dist/testTimingsSeam.js.map +1 -0
  351. package/dist/utils/runnersScreenPlan.d.ts +14 -0
  352. package/dist/utils/runnersScreenPlan.d.ts.map +1 -1
  353. package/dist/utils/runnersScreenPlan.js +49 -5
  354. package/dist/utils/runnersScreenPlan.js.map +1 -1
  355. package/dist/utils/surrogateSafeCut.d.ts +14 -0
  356. package/dist/utils/surrogateSafeCut.d.ts.map +1 -0
  357. package/dist/utils/surrogateSafeCut.js +30 -0
  358. package/dist/utils/surrogateSafeCut.js.map +1 -0
  359. package/dist/utils/telegramError.d.ts +7 -0
  360. package/dist/utils/telegramError.d.ts.map +1 -1
  361. package/dist/utils/telegramError.js +15 -0
  362. package/dist/utils/telegramError.js.map +1 -1
  363. package/dist/utils/transientFrames.d.ts +51 -6
  364. package/dist/utils/transientFrames.d.ts.map +1 -1
  365. package/dist/utils/transientFrames.js +52 -2
  366. package/dist/utils/transientFrames.js.map +1 -1
  367. package/dist/voiceProgressNote.d.ts +73 -0
  368. package/dist/voiceProgressNote.d.ts.map +1 -0
  369. package/dist/voiceProgressNote.js +142 -0
  370. package/dist/voiceProgressNote.js.map +1 -0
  371. package/package.json +4 -1
  372. package/remoteRun/pickNode.sh +65 -0
  373. package/remoteRun/runner-package-lock.json +59 -0
  374. package/remoteRun/runner.sh +304 -6
@@ -0,0 +1,128 @@
1
+ import { type CommandRunner } from '../selfUpdate/commandRunner';
2
+ import type { PueueState } from './pueueDaemon';
3
+ import type { RunnerHomePaths } from './runnerHome';
4
+ /**
5
+ * @description The link puts the login session's agent (`guiAgent.ts`) of an always-on Mac in place ITSELF, so a Mac paired before the agent existed — or
6
+ * one whose agent definition changed in a newer version — does not need an admin to paste the pairing line again just for that. The agent is a
7
+ * LaunchAgent whose definition is the ACCOUNT's own file (`~/Library/LaunchAgents/com.charness.runner.gui.<hash>.plist`) and which runs in the account's
8
+ * own `gui/<uid>` domain, so writing and loading it needs no root — the admin line only does it for a fresh install, as root, from outside.
9
+ *
10
+ * What the link does when it starts (an update restarts it too) and then once an hour, for a runner kept running as a `system-service` (nothing for any other
11
+ * kind — that kind is written on macOS only):
12
+ *
13
+ * definition missing or not what this version writes write it; then, if the account has a login session, load it there (a loaded old one is replaced
14
+ * only while no job is running or queued: replacing it cuts the steps it runs — otherwise it
15
+ * waits for the next look, and the old file is put back if a job appears while it is being replaced)
16
+ * definition current, session there, agent not loaded load it
17
+ * no login session the file stays (launchd loads it at the account's next login); `runners` keeps saying a login is needed
18
+ * anything fails the reason is kept in `gui/install-failure` with the way out (`login`: the definition is in place,
19
+ * so logging out and in loads it; `admin`: it is not, only a fresh admin line puts it there) and
20
+ * `runners` says so instead of «needs a login»
21
+ *
22
+ * MEASURED (2026-11-05, macOS 26.7.1, the owner's always-on Mac, `remote-run exec` = this link's own context: `launchctl managername` → `System`, uid of the account,
23
+ * not root; the account was logged in through Fast User Switching, a background session):
24
+ * `launchctl print gui/<uid>` exit 0 — `type = login`, `session = Aqua`, `creator = loginwindow[<pid>]`, `asid = …`: a System-session process
25
+ * of the account CAN ask about its own GUI domain
26
+ * `launchctl print gui/<uid>/<agent label>` exit 0 — `type = LaunchAgent`, `path = ~/Library/LaunchAgents/<label>.plist`, `state = running`
27
+ * `launchctl print gui/<uid>/no.such.label` exit 113 — «Bad request.» / «Could not find service "no.such.label" in domain for user gui: <uid>»
28
+ * `launchctl print gui/99999` (no such domain) exit 112 — «Bad request.» / «Could not find domain for user gui: 99999»
29
+ * `launchctl print gui/<another account's uid>` exit 1 — «Could not print domain: 1: Operation not permitted»
30
+ * `launchctl print user/<uid>` exit 0 — `session = Background`, `gui asid = <asid of the GUI domain>`
31
+ * `pgrep -u <uid> -lx 'loginwindow|Dock|Finder'` exit 0 with one line per process (nothing: exit 1)
32
+ * `launchctl bootstrap gui/<uid> <plist>` exit 0, no output — a THROWAWAY agent (another label, `LimitLoadToSessionType` Aqua, `RunAtLoad` false, `/usr/bin/true`) whose plist
33
+ * was in a temporary folder outside `~/Library/LaunchAgents`, loaded from this very context (`managername` `System`, the account's uid)
34
+ * `launchctl print gui/<uid>/<throwaway label>` exit 0 — `type = LaunchAgent`, `state = not running`, `path = <that plist>`, `program = /usr/bin/true`
35
+ * `launchctl bootout gui/<uid>/<throwaway label>` exit 0, no output; `print` of it right after → exit 113 («Could not find service … in domain for user gui: <uid>»)
36
+ * So the service CAN load an agent into the account's own login session, and take it out again. NOT measured: any answer for an account that is LOGGED OUT (the logged-out run is
37
+ * a live check with the owner). So «no session» is never read off launchd's answer alone: launchd must say «Could not find domain for user gui: <uid>» AND
38
+ * the account must run none of the processes a login session consists of (`loginwindow`, `Dock`, `Finder`). Anything else — another text, a refusal, a domain that is
39
+ * gone while those processes run, an answer that cannot be got — is a FAILURE with the text, never «no session». A `bootstrap` that is refused is a failure whose
40
+ * definition is in place, so logging out and in loads it; a `bootout` that does not stop the old agent puts the old definition back and leaves the admin line as the way out.
41
+ */
42
+ /** The agent looks for its own definition again this often after the first look at the link's start. */
43
+ export declare const guiAgentHealIntervalMs: number;
44
+ /** What the look at the agent found out; the decision is {@link planGuiAgentHeal}'s alone. */
45
+ export interface GuiAgentFacts {
46
+ /** The runner is an always-on service (`system-service`): the only kind that has a login session's agent. */
47
+ isAlwaysOnService: boolean;
48
+ /** The definition on disk is exactly what this version would write. */
49
+ isDefinitionCurrent: boolean;
50
+ /** The account has a login session (`gui/<uid>` exists). */
51
+ hasSession: boolean;
52
+ /** The agent is loaded in that session. */
53
+ isLoaded: boolean;
54
+ /** Pueue holds a job that runs or waits to run (or its state cannot be read): the steps of a job go through the agent, and replacing it would cut them. */
55
+ isQueueBusy: boolean;
56
+ }
57
+ /** @name GuiAgentHealPlan @description What to do: nothing; write the file only; write and load it; load the current file; write and replace the loaded one; or wait for an idle moment. */
58
+ export type GuiAgentHealPlan = 'none' | 'write' | 'write-and-load' | 'load' | 'replace' | 'wait-for-idle';
59
+ /** @description The one decision of the look; pure. */
60
+ export declare function planGuiAgentHeal(facts: GuiAgentFacts): GuiAgentHealPlan;
61
+ /**
62
+ * @name GuiAgentCure @description What gets the agent running after a failure. `login`: the definition is in place, so the account logging out and in again loads it
63
+ * (an admin line does too); `admin`: it is not, only a fresh admin line writes and loads it.
64
+ */
65
+ export type GuiAgentCure = 'login' | 'admin';
66
+ /** @name GuiAgentHealOutcome @description What a look came to (what the link logs, and what a test reads). */
67
+ export type GuiAgentHealOutcome = {
68
+ kind: 'not-applicable';
69
+ } | {
70
+ kind: 'in-place';
71
+ } | {
72
+ kind: 'written-without-session';
73
+ } | {
74
+ kind: 'loaded';
75
+ wasReplaced: boolean;
76
+ } | {
77
+ kind: 'waiting-for-idle';
78
+ } | {
79
+ kind: 'failed';
80
+ reason: string;
81
+ cure: GuiAgentCure;
82
+ };
83
+ export interface GuiAgentHealDeps {
84
+ /** Runs `launchctl` and `pgrep`. */
85
+ runner: CommandRunner;
86
+ /** The uid of this process: the account's own `gui/<uid>` domain. */
87
+ uid: number;
88
+ accountName: string;
89
+ /** The folder of the Node that runs the link: the agent's `PATH` starts with it, like the account's own services. */
90
+ nodeDir: string;
91
+ /** `system-service` when an admin's line installed the always-on service (`readServiceKind`); asked at every look, an admin may install it while the link runs. */
92
+ getServiceKind: () => string | null;
93
+ /** What Pueue holds: asked with the queued jobs counted (they start the moment the old agent is gone), and asked again right before the old agent is stopped. */
94
+ readQueue: () => Promise<PueueState>;
95
+ }
96
+ /** @description One line for `gui/install-failure`: no control characters, no line break, bounded. */
97
+ export declare function formatInstallFailureReason(text: string): string;
98
+ /** @name GuiAgentInstallFailure @description What `gui/install-failure` holds: the way out and why the link could not put the agent in place. */
99
+ export interface GuiAgentInstallFailure {
100
+ cure: GuiAgentCure;
101
+ reason: string;
102
+ }
103
+ /** @description The failure the link recorded (`<cure> <reason>`, one line), or `null` when nothing is wrong. A record without a cure word reads as one that needs the admin line. */
104
+ export declare function readGuiAgentInstallFailure(paths: RunnerHomePaths): GuiAgentInstallFailure | null;
105
+ /** @description Keep (`failure`) or forget (`null`) the failure `runner.sh` reads. Never throws: a record that cannot be written is the lesser problem. */
106
+ export declare function writeGuiAgentInstallFailure(paths: RunnerHomePaths, failure: GuiAgentInstallFailure | null): void;
107
+ /**
108
+ * @description One look at the login session's agent, and what it takes to put it in place (see the head of the file). Changes nothing for a runner that is
109
+ * not an always-on service. Writes the definition into the account's own folder only; a failure comes back as {@link GuiAgentHealOutcome} `failed`, never thrown.
110
+ *
111
+ * Replacing a LOADED agent must not cut a job: the queue is looked at (queued jobs count: they start the moment a slot frees) to decide, and again right
112
+ * before the old agent is stopped — if a job turned up, the old definition is put back (the next look sees the difference again) and nothing is stopped. What
113
+ * is left is the second or so between the stop and the new agent's first heartbeat: a job that STARTS then is refused («needs a login») or runs in the daemon,
114
+ * as without a session, and is told so — never cut in the middle of a step, because no step runs through the old agent (the queue was empty).
115
+ */
116
+ export declare function healGuiAgent(paths: RunnerHomePaths, deps: GuiAgentHealDeps): Promise<GuiAgentHealOutcome>;
117
+ /** @description The line the link logs for an outcome; `null` for one that says nothing new ({@link GuiAgentHealOutcome} `not-applicable` / `in-place`). */
118
+ export declare function describeGuiAgentHealOutcome(outcome: GuiAgentHealOutcome): string | null;
119
+ export interface GuiAgentHealer {
120
+ /** One look at the agent, its record and, when something new happened, its line. Never throws. */
121
+ look: () => Promise<GuiAgentHealOutcome>;
122
+ }
123
+ /**
124
+ * @description The link's looker: each look is recorded for `runners` — a failure in `gui/install-failure`, anything else forgets it, so a login that is still missing
125
+ * reads «needs a login» again and not a stale failure — and `log` hears an outcome once, not at every look that finds the same.
126
+ */
127
+ export declare function createGuiAgentHealer(paths: RunnerHomePaths, deps: GuiAgentHealDeps, log: (line: string) => void): GuiAgentHealer;
128
+ //# sourceMappingURL=guiAgentHeal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guiAgentHeal.d.ts","sourceRoot":"","sources":["../../src/runnerUtility/guiAgentHeal.ts"],"names":[],"mappings":"AAGA,OAAO,EAAqC,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEpG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAIpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,wGAAwG;AACxG,eAAO,MAAM,sBAAsB,QAAiB,CAAC;AAQrD,8FAA8F;AAC9F,MAAM,WAAW,aAAa;IAC5B,6GAA6G;IAC7G,iBAAiB,EAAE,OAAO,CAAC;IAC3B,uEAAuE;IACvE,mBAAmB,EAAE,OAAO,CAAC;IAC7B,4DAA4D;IAC5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,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,sLAAsL;AACtL,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,eAAe,GAAG,sBAAsB,GAAG,IAAI,CAMhG;AAED,2JAA2J;AAC3J,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,sBAAsB,GAAG,IAAI,GAAG,IAAI,CAWhH;AAwDD;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAAC,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAoC/G;AAED,4JAA4J;AAC5J,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,GAAG,IAAI,CAcvF;AAED,MAAM,WAAW,cAAc;IAC7B,kGAAkG;IAClG,IAAI,EAAE,MAAM,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC1C;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,gBAAgB,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,cAAc,CAiBhI"}
@@ -0,0 +1,284 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, 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.guiAgentHealIntervalMs = void 0;
37
+ exports.planGuiAgentHeal = planGuiAgentHeal;
38
+ exports.formatInstallFailureReason = formatInstallFailureReason;
39
+ exports.readGuiAgentInstallFailure = readGuiAgentInstallFailure;
40
+ exports.writeGuiAgentInstallFailure = writeGuiAgentInstallFailure;
41
+ exports.healGuiAgent = healGuiAgent;
42
+ exports.describeGuiAgentHealOutcome = describeGuiAgentHealOutcome;
43
+ exports.createGuiAgentHealer = createGuiAgentHealer;
44
+ const fs = __importStar(require("fs"));
45
+ const path = __importStar(require("path"));
46
+ const configDirFile_1 = require("../configDirFile");
47
+ const commandRunner_1 = require("../selfUpdate/commandRunner");
48
+ const isolatedCommand_1 = require("./isolatedCommand");
49
+ const serviceCommon_1 = require("./serviceCommon");
50
+ const serviceUnits_1 = require("./serviceUnits");
51
+ /**
52
+ * @description The link puts the login session's agent (`guiAgent.ts`) of an always-on Mac in place ITSELF, so a Mac paired before the agent existed — or
53
+ * one whose agent definition changed in a newer version — does not need an admin to paste the pairing line again just for that. The agent is a
54
+ * LaunchAgent whose definition is the ACCOUNT's own file (`~/Library/LaunchAgents/com.charness.runner.gui.<hash>.plist`) and which runs in the account's
55
+ * own `gui/<uid>` domain, so writing and loading it needs no root — the admin line only does it for a fresh install, as root, from outside.
56
+ *
57
+ * What the link does when it starts (an update restarts it too) and then once an hour, for a runner kept running as a `system-service` (nothing for any other
58
+ * kind — that kind is written on macOS only):
59
+ *
60
+ * definition missing or not what this version writes write it; then, if the account has a login session, load it there (a loaded old one is replaced
61
+ * only while no job is running or queued: replacing it cuts the steps it runs — otherwise it
62
+ * waits for the next look, and the old file is put back if a job appears while it is being replaced)
63
+ * definition current, session there, agent not loaded load it
64
+ * no login session the file stays (launchd loads it at the account's next login); `runners` keeps saying a login is needed
65
+ * anything fails the reason is kept in `gui/install-failure` with the way out (`login`: the definition is in place,
66
+ * so logging out and in loads it; `admin`: it is not, only a fresh admin line puts it there) and
67
+ * `runners` says so instead of «needs a login»
68
+ *
69
+ * MEASURED (2026-11-05, macOS 26.7.1, the owner's always-on Mac, `remote-run exec` = this link's own context: `launchctl managername` → `System`, uid of the account,
70
+ * not root; the account was logged in through Fast User Switching, a background session):
71
+ * `launchctl print gui/<uid>` exit 0 — `type = login`, `session = Aqua`, `creator = loginwindow[<pid>]`, `asid = …`: a System-session process
72
+ * of the account CAN ask about its own GUI domain
73
+ * `launchctl print gui/<uid>/<agent label>` exit 0 — `type = LaunchAgent`, `path = ~/Library/LaunchAgents/<label>.plist`, `state = running`
74
+ * `launchctl print gui/<uid>/no.such.label` exit 113 — «Bad request.» / «Could not find service "no.such.label" in domain for user gui: <uid>»
75
+ * `launchctl print gui/99999` (no such domain) exit 112 — «Bad request.» / «Could not find domain for user gui: 99999»
76
+ * `launchctl print gui/<another account's uid>` exit 1 — «Could not print domain: 1: Operation not permitted»
77
+ * `launchctl print user/<uid>` exit 0 — `session = Background`, `gui asid = <asid of the GUI domain>`
78
+ * `pgrep -u <uid> -lx 'loginwindow|Dock|Finder'` exit 0 with one line per process (nothing: exit 1)
79
+ * `launchctl bootstrap gui/<uid> <plist>` exit 0, no output — a THROWAWAY agent (another label, `LimitLoadToSessionType` Aqua, `RunAtLoad` false, `/usr/bin/true`) whose plist
80
+ * was in a temporary folder outside `~/Library/LaunchAgents`, loaded from this very context (`managername` `System`, the account's uid)
81
+ * `launchctl print gui/<uid>/<throwaway label>` exit 0 — `type = LaunchAgent`, `state = not running`, `path = <that plist>`, `program = /usr/bin/true`
82
+ * `launchctl bootout gui/<uid>/<throwaway label>` exit 0, no output; `print` of it right after → exit 113 («Could not find service … in domain for user gui: <uid>»)
83
+ * So the service CAN load an agent into the account's own login session, and take it out again. NOT measured: any answer for an account that is LOGGED OUT (the logged-out run is
84
+ * a live check with the owner). So «no session» is never read off launchd's answer alone: launchd must say «Could not find domain for user gui: <uid>» AND
85
+ * the account must run none of the processes a login session consists of (`loginwindow`, `Dock`, `Finder`). Anything else — another text, a refusal, a domain that is
86
+ * gone while those processes run, an answer that cannot be got — is a FAILURE with the text, never «no session». A `bootstrap` that is refused is a failure whose
87
+ * definition is in place, so logging out and in loads it; a `bootout` that does not stop the old agent puts the old definition back and leaves the admin line as the way out.
88
+ */
89
+ /** The agent looks for its own definition again this often after the first look at the link's start. */
90
+ exports.guiAgentHealIntervalMs = 60 * 60 * 1000;
91
+ const maxFailureReasonChars = 160;
92
+ const failureFileMode = 0o644;
93
+ /** The processes a GUI login session consists of (measured: all three run as the account while it is logged in, a background session included). */
94
+ const loginSessionProcessPattern = 'loginwindow|Dock|Finder';
95
+ /** `pgrep` finds nothing: its documented exit code. */
96
+ const pgrepNoMatchExitCode = 1;
97
+ /** @description The one decision of the look; pure. */
98
+ function planGuiAgentHeal(facts) {
99
+ if (!facts.isAlwaysOnService)
100
+ return 'none';
101
+ if (facts.isDefinitionCurrent)
102
+ return facts.hasSession && !facts.isLoaded ? 'load' : 'none';
103
+ if (!facts.hasSession)
104
+ return 'write';
105
+ if (!facts.isLoaded)
106
+ return 'write-and-load';
107
+ return facts.isQueueBusy ? 'wait-for-idle' : 'replace';
108
+ }
109
+ function readFileOrNull(filePath) {
110
+ try {
111
+ return fs.readFileSync(filePath, 'utf8');
112
+ }
113
+ catch {
114
+ return null;
115
+ }
116
+ }
117
+ /** @description One line for `gui/install-failure`: no control characters, no line break, bounded. */
118
+ function formatInstallFailureReason(text) {
119
+ const flat = (0, isolatedCommand_1.stripControlCharacters)(text).replace(/\s+/g, ' ').trim();
120
+ return flat.length <= maxFailureReasonChars ? flat : `${flat.slice(0, maxFailureReasonChars - 1)}…`;
121
+ }
122
+ /** @description The failure the link recorded (`<cure> <reason>`, one line), or `null` when nothing is wrong. A record without a cure word reads as one that needs the admin line. */
123
+ function readGuiAgentInstallFailure(paths) {
124
+ const text = readFileOrNull(paths.guiInstallFailure)?.trim() ?? '';
125
+ if (text === '')
126
+ return null;
127
+ const [word, ...rest] = text.split(' ');
128
+ if (word === 'login' || word === 'admin')
129
+ return { cure: word, reason: rest.join(' ') };
130
+ return { cure: 'admin', reason: text };
131
+ }
132
+ /** @description Keep (`failure`) or forget (`null`) the failure `runner.sh` reads. Never throws: a record that cannot be written is the lesser problem. */
133
+ function writeGuiAgentInstallFailure(paths, failure) {
134
+ try {
135
+ if (failure === null) {
136
+ fs.rmSync(paths.guiInstallFailure, { force: true });
137
+ return;
138
+ }
139
+ fs.mkdirSync(path.dirname(paths.guiInstallFailure), { recursive: true, mode: 0o700 });
140
+ (0, configDirFile_1.writeTextFileAtomically)(paths.guiInstallFailure, `${failure.cure} ${formatInstallFailureReason(failure.reason)}\n`, failureFileMode);
141
+ }
142
+ catch {
143
+ // Without the record `runners` says «needs a login», as it did before this existed.
144
+ }
145
+ }
146
+ async function askLaunchctl(deps, args) {
147
+ return deps.runner('launchctl', args, { timeoutMs: serviceCommon_1.commandTimeoutMs });
148
+ }
149
+ function describeCommandFailure(result) {
150
+ return (0, commandRunner_1.getOutputTail)(result, 1) || (result.isTimedOut ? 'no answer in time' : 'no answer');
151
+ }
152
+ /** Independent of launchd's own word about the domain: does the account run what a GUI login session consists of? */
153
+ async function readLoginEvidence(deps) {
154
+ const found = await deps.runner('pgrep', ['-u', deps.uid.toString(), '-lx', loginSessionProcessPattern], { timeoutMs: serviceCommon_1.commandTimeoutMs });
155
+ if (found.ok) {
156
+ const processes = found.stdout.split('\n').map((line) => line.trim().replace(/^\d+\s+/, '')).filter((name) => name !== '').join(', ');
157
+ return processes === '' ? { kind: 'unknown', reason: 'pgrep answered with nothing it could name' } : { kind: 'present', processes };
158
+ }
159
+ return found.exitCode === pgrepNoMatchExitCode && found.stdout.trim() === '' ? { kind: 'none' } : { kind: 'unknown', reason: `pgrep: ${describeCommandFailure(found)}` };
160
+ }
161
+ /** The state of the account's GUI domain: a session with or without the agent loaded, no session (only on launchd's measured answer AND no sign of a login), or why it cannot be told. */
162
+ async function lookAtSession(deps, label) {
163
+ const domain = `gui/${deps.uid}`;
164
+ const session = await askLaunchctl(deps, ['print', domain]);
165
+ if (session.ok)
166
+ return { hasSession: true, isLoaded: (await askLaunchctl(deps, ['print', `${domain}/${label}`])).ok };
167
+ const launchdWord = describeCommandFailure(session);
168
+ if (!new RegExp(`Could not find domain for user gui: ${deps.uid}\\b`, 'i').test(`${session.stderr}\n${session.stdout}`)) {
169
+ return { failure: `launchctl cannot be asked about ${domain} (${launchdWord})` };
170
+ }
171
+ const evidence = await readLoginEvidence(deps);
172
+ if (evidence.kind === 'none')
173
+ return { hasSession: false, isLoaded: false };
174
+ if (evidence.kind === 'present')
175
+ return { failure: `launchd says ${domain} does not exist (${launchdWord}), yet the account runs ${evidence.processes}: its login session cannot be reached from here` };
176
+ return { failure: `launchd says ${domain} does not exist (${launchdWord}), and whether the account is logged in could not be confirmed (${evidence.reason})` };
177
+ }
178
+ function checkIsQueueBusy(queue) {
179
+ return queue.kind === 'busy' || queue.kind === 'unreadable';
180
+ }
181
+ /** The agent is booted out (when it is replaced) and bootstrapped; `null` when it is loaded, else why not. */
182
+ async function loadAgent(deps, label, file, isReplacing) {
183
+ const domain = `gui/${deps.uid}`;
184
+ if (isReplacing && !(await (0, serviceCommon_1.bootOutAndWaitUntilGone)(label, domain, deps.runner)))
185
+ return { step: 'bootout', reason: `the old agent (${label}) is still loaded in ${domain} after being asked to stop` };
186
+ const loaded = await askLaunchctl(deps, ['bootstrap', domain, file]);
187
+ return loaded.ok ? null : { step: 'bootstrap', reason: `launchctl bootstrap ${domain} failed (${describeCommandFailure(loaded)})` };
188
+ }
189
+ /**
190
+ * @description One look at the login session's agent, and what it takes to put it in place (see the head of the file). Changes nothing for a runner that is
191
+ * not an always-on service. Writes the definition into the account's own folder only; a failure comes back as {@link GuiAgentHealOutcome} `failed`, never thrown.
192
+ *
193
+ * Replacing a LOADED agent must not cut a job: the queue is looked at (queued jobs count: they start the moment a slot frees) to decide, and again right
194
+ * before the old agent is stopped — if a job turned up, the old definition is put back (the next look sees the difference again) and nothing is stopped. What
195
+ * is left is the second or so between the stop and the new agent's first heartbeat: a job that STARTS then is refused («needs a login») or runs in the daemon,
196
+ * as without a session, and is told so — never cut in the middle of a step, because no step runs through the old agent (the queue was empty).
197
+ */
198
+ async function healGuiAgent(paths, deps) {
199
+ if (deps.getServiceKind() !== 'system-service')
200
+ return { kind: 'not-applicable' };
201
+ const names = (0, serviceUnits_1.getServiceNames)(paths.root);
202
+ const file = (0, serviceCommon_1.getGuiAgentFile)(paths.homeDir, names);
203
+ const definition = (0, serviceUnits_1.renderLaunchdPlist)((0, serviceUnits_1.planGuiAgentJob)(paths, names, deps.accountName, deps.nodeDir));
204
+ const previousDefinition = readFileOrNull(file);
205
+ const isDefinitionCurrent = previousDefinition === definition;
206
+ const session = await lookAtSession(deps, names.launchdGui);
207
+ // Nothing was written yet: the way out is the login only when a current definition is there to load.
208
+ if ('failure' in session)
209
+ return { kind: 'failed', reason: session.failure, cure: isDefinitionCurrent ? 'login' : 'admin' };
210
+ const queueAtPlan = !isDefinitionCurrent && session.isLoaded ? await deps.readQueue() : { kind: 'idle' };
211
+ const plan = planGuiAgentHeal({ isAlwaysOnService: true, isDefinitionCurrent, hasSession: session.hasSession, isLoaded: session.isLoaded, isQueueBusy: checkIsQueueBusy(queueAtPlan) });
212
+ if (plan === 'none')
213
+ return { kind: 'in-place' };
214
+ if (plan === 'wait-for-idle')
215
+ return { kind: 'waiting-for-idle' };
216
+ try {
217
+ // The agent's log goes to the logs folder, which launchd does not make.
218
+ fs.mkdirSync(paths.logsDir, { recursive: true, mode: 0o700 });
219
+ if (plan !== 'load')
220
+ (0, serviceCommon_1.writeDefinition)(file, definition);
221
+ }
222
+ catch (error) {
223
+ return { kind: 'failed', reason: `the agent's definition ${file} could not be written (${(0, configDirFile_1.getCaughtErrnoCode)(error)})`, cure: 'admin' };
224
+ }
225
+ if (plan === 'write')
226
+ return { kind: 'written-without-session' };
227
+ if (plan === 'replace' && checkIsQueueBusy(await deps.readQueue())) {
228
+ (0, serviceCommon_1.restorePreviousDefinitions)([{ file, content: previousDefinition }]);
229
+ return { kind: 'waiting-for-idle' };
230
+ }
231
+ const failure = await loadAgent(deps, names.launchdGui, file, plan === 'replace');
232
+ if (failure === null)
233
+ return { kind: 'loaded', wasReplaced: plan === 'replace' };
234
+ if (failure.step === 'bootout') {
235
+ // The old agent is still running, and a current file beside a loaded agent would read as «in place» at the next look: the record would be cleared and nothing would ever say that
236
+ // the old version's agent runs on. So the old definition goes back (the next look sees the difference and replaces again), and the way out is the admin line, which stops it as root.
237
+ (0, serviceCommon_1.restorePreviousDefinitions)([{ file, content: previousDefinition }]);
238
+ return { kind: 'failed', reason: failure.reason, cure: 'admin' };
239
+ }
240
+ // The old agent is gone and the new definition is in place, so logging out and in loads it, and the next look (current file, nothing loaded) tries `bootstrap` again.
241
+ return { kind: 'failed', reason: failure.reason, cure: 'login' };
242
+ }
243
+ /** @description The line the link logs for an outcome; `null` for one that says nothing new ({@link GuiAgentHealOutcome} `not-applicable` / `in-place`). */
244
+ function describeGuiAgentHealOutcome(outcome) {
245
+ switch (outcome.kind) {
246
+ case 'not-applicable':
247
+ case 'in-place':
248
+ return null;
249
+ case 'written-without-session':
250
+ return 'the login session\'s agent is written; the account has no login session, so launchd loads it at the next login';
251
+ case 'loaded':
252
+ return outcome.wasReplaced ? 'the login session\'s agent was replaced by the one of this version and loaded again' : 'the login session\'s agent is installed and loaded into the account\'s login session';
253
+ case 'waiting-for-idle':
254
+ return 'the login session\'s agent differs from this version\'s, but jobs are running or queued: it is replaced at a look when none is';
255
+ case 'failed':
256
+ return `the login session's agent could not be put in place: ${outcome.reason}`;
257
+ }
258
+ }
259
+ /**
260
+ * @description The link's looker: each look is recorded for `runners` — a failure in `gui/install-failure`, anything else forgets it, so a login that is still missing
261
+ * reads «needs a login» again and not a stale failure — and `log` hears an outcome once, not at every look that finds the same.
262
+ */
263
+ function createGuiAgentHealer(paths, deps, log) {
264
+ let lastKind = null;
265
+ return {
266
+ look: async () => {
267
+ let outcome;
268
+ try {
269
+ outcome = await healGuiAgent(paths, deps);
270
+ }
271
+ catch (error) {
272
+ outcome = { kind: 'failed', reason: error instanceof Error ? error.message : 'unknown error', cure: 'admin' };
273
+ }
274
+ if (outcome.kind !== 'not-applicable')
275
+ writeGuiAgentInstallFailure(paths, outcome.kind === 'failed' ? { cure: outcome.cure, reason: outcome.reason } : null);
276
+ const line = describeGuiAgentHealOutcome(outcome);
277
+ if (line !== null && (outcome.kind !== lastKind || outcome.kind === 'loaded'))
278
+ log(line);
279
+ lastKind = outcome.kind;
280
+ return outcome;
281
+ },
282
+ };
283
+ }
284
+ //# sourceMappingURL=guiAgentHeal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guiAgentHeal.js","sourceRoot":"","sources":["../../src/runnerUtility/guiAgentHeal.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4EA,4CAMC;AAwCD,gEAGC;AASD,gEAMC;AAGD,kEAWC;AAiED,oCAoCC;AAGD,kEAcC;AAWD,oDAiBC;AA5SD,uCAAyB;AACzB,2CAA6B;AAC7B,oDAA+E;AAC/E,+DAAoG;AACpG,uDAA2D;AAG3D,mDAA0I;AAC1I,iDAAsF;AAEtF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAE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,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YAC7J,MAAM,IAAI,GAAG,2BAA2B,CAAC,OAAO,CAAC,CAAC;YAClD,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ,CAAC;gBAAE,GAAG,CAAC,IAAI,CAAC,CAAC;YACzF,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;YACxB,OAAO,OAAO,CAAC;QACjB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @description The home folder that `programPath` is inside, or `null` when it is outside every home: `/Users/<name>`, `/home/<name>`, `/root`,
3
+ * `/var/root` (and `/Users/Shared`). The path is judged as given — pass the real path (symlinks followed), as `process.execPath` is.
4
+ */
5
+ export declare function findHomeContaining(programPath: string): string | null;
6
+ /** @description The home of ANOTHER user that `programPath` is inside — `null` when it is outside every home or inside `ownHome`. */
7
+ export declare function findForeignHome(programPath: string, ownHome: string): string | null;
8
+ /** What a scan needs from the machine; a test's own. */
9
+ export interface HomeScanDeps {
10
+ /** The names inside `parent`, or `[]` when it is not a folder. */
11
+ listFolders: (parent: string) => string[];
12
+ /** Can the account whose homes are judged list and enter `folder`? */
13
+ checkCanRead: (folder: string) => Promise<boolean>;
14
+ }
15
+ /** @description The real folder listing: the sub-folders of `parent` (no files, no links to elsewhere). */
16
+ export declare function listSubfolders(parent: string): string[];
17
+ /** @description Can the CURRENT user list and enter `folder`? */
18
+ export declare function checkCanReadAsSelf(folder: string): Promise<boolean>;
19
+ /**
20
+ * @description The homes of other users that the account can read, sorted: every folder under `/Users` and `/home` except the account's own
21
+ * (`accountName`, or `ownHome`) and the entries that are no person's home. A folder that cannot be judged counts as closed.
22
+ */
23
+ export declare function findReadableHomes(accountName: string, ownHome: string | null, deps: HomeScanDeps): Promise<string[]>;
24
+ /**
25
+ * @description The warning for a runner account that can read `homes` of other users — what it means, the folders by name, and the one-line fix for
26
+ * each (`sudo chmod 700 <home>`) — as lines to print; `[]` when it can read none.
27
+ */
28
+ export declare function formatReadableHomesWarning(accountName: string, homes: readonly string[]): string[];
29
+ /** What is wrong with a runner that uses the Node.js at `nodePath`, which lives in `home` (another user's), and the way out. */
30
+ export declare function describeForeignNode(nodePath: string, home: string): string;
31
+ /** @description The warning for a runner that uses a Node.js in another user's home; `[]` when it is outside every home or in `ownHome`. */
32
+ export declare function formatForeignNodeWarning(nodePath: string, ownHome: string): string[];
33
+ //# sourceMappingURL=homeFolders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"homeFolders.d.ts","sourceRoot":"","sources":["../../src/runnerUtility/homeFolders.ts"],"names":[],"mappings":"AA8BA;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAWrE;AAED,qIAAqI;AACrI,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGnF;AAED,wDAAwD;AACxD,MAAM,WAAW,YAAY;IAC3B,kEAAkE;IAClE,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,EAAE,CAAC;IAC1C,sEAAsE;IACtE,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACpD;AAED,2GAA2G;AAC3G,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAMvD;AAED,iEAAiE;AACjE,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOzE;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CA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