charness 3.6.0 → 3.7.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 (582) hide show
  1. package/CHANGELOG.md +274 -0
  2. package/DEVELOPMENT.md +31 -5
  3. package/MIGRATION_RENAME_TO_CHARNESS.md +3 -2
  4. package/README.md +84 -782
  5. package/SETUP.md +37 -10
  6. package/agent-plugin/.claude-plugin/plugin.json +7 -0
  7. package/agent-plugin/README.md +35 -0
  8. package/agent-plugin/skills/charness-delegate-claude/SKILL.md +85 -0
  9. package/agent-plugin/skills/charness-delegate-claude/summarize-events.py +90 -0
  10. package/agent-plugin/skills/charness-delegate-opencode/SKILL.md +68 -0
  11. package/agent-plugin/skills/charness-manager/SKILL.md +152 -0
  12. package/dist/adapters/adapterNames.d.ts +6 -0
  13. package/dist/adapters/adapterNames.d.ts.map +1 -1
  14. package/dist/adapters/adapterNames.js +8 -2
  15. package/dist/adapters/adapterNames.js.map +1 -1
  16. package/dist/adapters/claudeCliAdapter.d.ts +8 -0
  17. package/dist/adapters/claudeCliAdapter.d.ts.map +1 -1
  18. package/dist/adapters/claudeCliAdapter.js +42 -5
  19. package/dist/adapters/claudeCliAdapter.js.map +1 -1
  20. package/dist/adapters/claudeJsonStreamAdapter.d.ts +10 -9
  21. package/dist/adapters/claudeJsonStreamAdapter.d.ts.map +1 -1
  22. package/dist/adapters/claudeJsonStreamAdapter.js +53 -55
  23. package/dist/adapters/claudeJsonStreamAdapter.js.map +1 -1
  24. package/dist/adapters/createAdapter.d.ts +8 -0
  25. package/dist/adapters/createAdapter.d.ts.map +1 -1
  26. package/dist/adapters/createAdapter.js +14 -2
  27. package/dist/adapters/createAdapter.js.map +1 -1
  28. package/dist/adapters/openCodeAdapter.d.ts +43 -6
  29. package/dist/adapters/openCodeAdapter.d.ts.map +1 -1
  30. package/dist/adapters/openCodeAdapter.js +95 -6
  31. package/dist/adapters/openCodeAdapter.js.map +1 -1
  32. package/dist/agentLogin/agentLogin.d.ts +1 -1
  33. package/dist/agentLogin/agentLogin.d.ts.map +1 -1
  34. package/dist/apiRetryKick.d.ts +4 -3
  35. package/dist/apiRetryKick.d.ts.map +1 -1
  36. package/dist/apiRetryKick.js +16 -9
  37. package/dist/apiRetryKick.js.map +1 -1
  38. package/dist/bot.d.ts.map +1 -1
  39. package/dist/bot.js +1313 -381
  40. package/dist/bot.js.map +1 -1
  41. package/dist/cli/claudeProfiles.d.ts +11 -6
  42. package/dist/cli/claudeProfiles.d.ts.map +1 -1
  43. package/dist/cli/claudeProfiles.js +50 -22
  44. package/dist/cli/claudeProfiles.js.map +1 -1
  45. package/dist/cli/hot.d.ts +5 -0
  46. package/dist/cli/hot.d.ts.map +1 -1
  47. package/dist/cli/hot.js +71 -25
  48. package/dist/cli/hot.js.map +1 -1
  49. package/dist/cli/tscWatchGuard.d.ts +95 -0
  50. package/dist/cli/tscWatchGuard.d.ts.map +1 -0
  51. package/dist/cli/tscWatchGuard.js +295 -0
  52. package/dist/cli/tscWatchGuard.js.map +1 -0
  53. package/dist/cli.js +12 -1
  54. package/dist/cli.js.map +1 -1
  55. package/dist/connectors/jira/answerSink.d.ts +10 -0
  56. package/dist/connectors/jira/answerSink.d.ts.map +1 -1
  57. package/dist/connectors/jira/answerSink.js +13 -0
  58. package/dist/connectors/jira/answerSink.js.map +1 -1
  59. package/dist/connectors/jira/config.d.ts +2 -0
  60. package/dist/connectors/jira/config.d.ts.map +1 -1
  61. package/dist/connectors/jira/config.js +9 -1
  62. package/dist/connectors/jira/config.js.map +1 -1
  63. package/dist/connectors/jira/connector.d.ts +11 -1
  64. package/dist/connectors/jira/connector.d.ts.map +1 -1
  65. package/dist/connectors/jira/connector.js +13 -1
  66. package/dist/connectors/jira/connector.js.map +1 -1
  67. package/dist/connectors/jira/inbound.d.ts +29 -4
  68. package/dist/connectors/jira/inbound.d.ts.map +1 -1
  69. package/dist/connectors/jira/inbound.js +71 -8
  70. package/dist/connectors/jira/inbound.js.map +1 -1
  71. package/dist/connectors/jira/issueBlocks.d.ts +5 -0
  72. package/dist/connectors/jira/issueBlocks.d.ts.map +1 -1
  73. package/dist/connectors/jira/issueBlocks.js +11 -0
  74. package/dist/connectors/jira/issueBlocks.js.map +1 -1
  75. package/dist/connectors/jira/prompt.d.ts +4 -0
  76. package/dist/connectors/jira/prompt.d.ts.map +1 -1
  77. package/dist/connectors/jira/prompt.js +11 -2
  78. package/dist/connectors/jira/prompt.js.map +1 -1
  79. package/dist/connectors/telegram/bindPicker.d.ts +5 -0
  80. package/dist/connectors/telegram/bindPicker.d.ts.map +1 -1
  81. package/dist/connectors/telegram/bindPicker.js +18 -1
  82. package/dist/connectors/telegram/bindPicker.js.map +1 -1
  83. package/dist/connectors/telegram/bindPickerClaims.d.ts +46 -0
  84. package/dist/connectors/telegram/bindPickerClaims.d.ts.map +1 -0
  85. package/dist/connectors/telegram/bindPickerClaims.js +83 -0
  86. package/dist/connectors/telegram/bindPickerClaims.js.map +1 -0
  87. package/dist/connectors/telegram/bindSweep.d.ts +32 -0
  88. package/dist/connectors/telegram/bindSweep.d.ts.map +1 -0
  89. package/dist/connectors/telegram/bindSweep.js +47 -0
  90. package/dist/connectors/telegram/bindSweep.js.map +1 -0
  91. package/dist/connectors/telegram/bindingWelcome.d.ts +23 -0
  92. package/dist/connectors/telegram/bindingWelcome.d.ts.map +1 -0
  93. package/dist/connectors/telegram/bindingWelcome.js +26 -0
  94. package/dist/connectors/telegram/bindingWelcome.js.map +1 -0
  95. package/dist/connectors/telegram/botApiConnection.d.ts +74 -0
  96. package/dist/connectors/telegram/botApiConnection.d.ts.map +1 -0
  97. package/dist/connectors/telegram/botApiConnection.js +201 -0
  98. package/dist/connectors/telegram/botApiConnection.js.map +1 -0
  99. package/dist/connectors/telegram/commands/botCore.d.ts +8 -2
  100. package/dist/connectors/telegram/commands/botCore.d.ts.map +1 -1
  101. package/dist/connectors/telegram/commands/botSkills.d.ts +21 -0
  102. package/dist/connectors/telegram/commands/botSkills.d.ts.map +1 -0
  103. package/dist/connectors/telegram/commands/botSkills.js +133 -0
  104. package/dist/connectors/telegram/commands/botSkills.js.map +1 -0
  105. package/dist/connectors/telegram/commands/callbackMessage.d.ts +5 -0
  106. package/dist/connectors/telegram/commands/callbackMessage.d.ts.map +1 -1
  107. package/dist/connectors/telegram/commands/callbackMessage.js +9 -0
  108. package/dist/connectors/telegram/commands/callbackMessage.js.map +1 -1
  109. package/dist/connectors/telegram/commands/compaction.d.ts +65 -3
  110. package/dist/connectors/telegram/commands/compaction.d.ts.map +1 -1
  111. package/dist/connectors/telegram/commands/compaction.js +512 -94
  112. package/dist/connectors/telegram/commands/compaction.js.map +1 -1
  113. package/dist/connectors/telegram/commands/displayModes.d.ts +1 -1
  114. package/dist/connectors/telegram/commands/displayModes.d.ts.map +1 -1
  115. package/dist/connectors/telegram/commands/displayModes.js +6 -18
  116. package/dist/connectors/telegram/commands/displayModes.js.map +1 -1
  117. package/dist/connectors/telegram/commands/fallbackChain.js +5 -5
  118. package/dist/connectors/telegram/commands/fallbackChain.js.map +1 -1
  119. package/dist/connectors/telegram/commands/reminders.d.ts +1 -1
  120. package/dist/connectors/telegram/commands/reminders.d.ts.map +1 -1
  121. package/dist/connectors/telegram/commands/reminders.js +4 -15
  122. package/dist/connectors/telegram/commands/reminders.js.map +1 -1
  123. package/dist/connectors/telegram/commands/selfUpdate.d.ts.map +1 -1
  124. package/dist/connectors/telegram/commands/selfUpdate.js +1 -11
  125. package/dist/connectors/telegram/commands/selfUpdate.js.map +1 -1
  126. package/dist/connectors/telegram/commands/taskAgents.d.ts +22 -0
  127. package/dist/connectors/telegram/commands/taskAgents.d.ts.map +1 -0
  128. package/dist/connectors/telegram/commands/taskAgents.js +104 -0
  129. package/dist/connectors/telegram/commands/taskAgents.js.map +1 -0
  130. package/dist/connectors/telegram/commands/todo.d.ts +82 -0
  131. package/dist/connectors/telegram/commands/todo.d.ts.map +1 -0
  132. package/dist/connectors/telegram/commands/todo.js +384 -0
  133. package/dist/connectors/telegram/commands/todo.js.map +1 -0
  134. package/dist/connectors/telegram/commands/topicCommand.d.ts +6 -2
  135. package/dist/connectors/telegram/commands/topicCommand.d.ts.map +1 -1
  136. package/dist/connectors/telegram/commands/topicCommand.js +6 -9
  137. package/dist/connectors/telegram/commands/topicCommand.js.map +1 -1
  138. package/dist/connectors/telegram/openBindMessages.d.ts +45 -0
  139. package/dist/connectors/telegram/openBindMessages.d.ts.map +1 -0
  140. package/dist/connectors/telegram/openBindMessages.js +67 -0
  141. package/dist/connectors/telegram/openBindMessages.js.map +1 -0
  142. package/dist/connectors/telegram/outputFlushPlan.d.ts +49 -0
  143. package/dist/connectors/telegram/outputFlushPlan.d.ts.map +1 -1
  144. package/dist/connectors/telegram/outputFlushPlan.js +46 -0
  145. package/dist/connectors/telegram/outputFlushPlan.js.map +1 -1
  146. package/dist/connectors/telegram/pendingTopicName.d.ts +26 -0
  147. package/dist/connectors/telegram/pendingTopicName.d.ts.map +1 -0
  148. package/dist/connectors/telegram/pendingTopicName.js +27 -0
  149. package/dist/connectors/telegram/pendingTopicName.js.map +1 -0
  150. package/dist/connectors/test/connector.d.ts.map +1 -1
  151. package/dist/connectors/test/connector.js +6 -1
  152. package/dist/connectors/test/connector.js.map +1 -1
  153. package/dist/i18n/de.d.ts.map +1 -1
  154. package/dist/i18n/de.js +90 -7
  155. package/dist/i18n/de.js.map +1 -1
  156. package/dist/i18n/en.d.ts.map +1 -1
  157. package/dist/i18n/en.js +90 -7
  158. package/dist/i18n/en.js.map +1 -1
  159. package/dist/i18n/es.d.ts.map +1 -1
  160. package/dist/i18n/es.js +90 -7
  161. package/dist/i18n/es.js.map +1 -1
  162. package/dist/i18n/fr.d.ts.map +1 -1
  163. package/dist/i18n/fr.js +90 -7
  164. package/dist/i18n/fr.js.map +1 -1
  165. package/dist/i18n/hi.d.ts.map +1 -1
  166. package/dist/i18n/hi.js +90 -7
  167. package/dist/i18n/hi.js.map +1 -1
  168. package/dist/i18n/ja.d.ts.map +1 -1
  169. package/dist/i18n/ja.js +90 -7
  170. package/dist/i18n/ja.js.map +1 -1
  171. package/dist/i18n/ka.d.ts.map +1 -1
  172. package/dist/i18n/ka.js +90 -7
  173. package/dist/i18n/ka.js.map +1 -1
  174. package/dist/i18n/pt.d.ts.map +1 -1
  175. package/dist/i18n/pt.js +90 -7
  176. package/dist/i18n/pt.js.map +1 -1
  177. package/dist/i18n/ru.d.ts.map +1 -1
  178. package/dist/i18n/ru.js +90 -7
  179. package/dist/i18n/ru.js.map +1 -1
  180. package/dist/i18n/uk.d.ts.map +1 -1
  181. package/dist/i18n/uk.js +90 -7
  182. package/dist/i18n/uk.js.map +1 -1
  183. package/dist/i18n/uz.d.ts.map +1 -1
  184. package/dist/i18n/uz.js +90 -7
  185. package/dist/i18n/uz.js.map +1 -1
  186. package/dist/i18n/zh.d.ts.map +1 -1
  187. package/dist/i18n/zh.js +90 -7
  188. package/dist/i18n/zh.js.map +1 -1
  189. package/dist/i18n.d.ts +1 -1
  190. package/dist/i18n.js +1 -1
  191. package/dist/installManager.d.ts +13 -0
  192. package/dist/installManager.d.ts.map +1 -1
  193. package/dist/installManager.js +38 -4
  194. package/dist/installManager.js.map +1 -1
  195. package/dist/instanceSettings.d.ts +40 -1
  196. package/dist/instanceSettings.d.ts.map +1 -1
  197. package/dist/instanceSettings.js +105 -26
  198. package/dist/instanceSettings.js.map +1 -1
  199. package/dist/openCodeQuestionFlow.d.ts +30 -0
  200. package/dist/openCodeQuestionFlow.d.ts.map +1 -1
  201. package/dist/openCodeQuestionFlow.js +43 -0
  202. package/dist/openCodeQuestionFlow.js.map +1 -1
  203. package/dist/postToSession.d.ts +20 -5
  204. package/dist/postToSession.d.ts.map +1 -1
  205. package/dist/postToSession.js +38 -7
  206. package/dist/postToSession.js.map +1 -1
  207. package/dist/remoteRun/cliArgs.d.ts +73 -0
  208. package/dist/remoteRun/cliArgs.d.ts.map +1 -0
  209. package/dist/remoteRun/cliArgs.js +197 -0
  210. package/dist/remoteRun/cliArgs.js.map +1 -0
  211. package/dist/remoteRun/commands.d.ts +56 -0
  212. package/dist/remoteRun/commands.d.ts.map +1 -0
  213. package/dist/remoteRun/commands.js +306 -0
  214. package/dist/remoteRun/commands.js.map +1 -0
  215. package/dist/remoteRun/depsPlan.d.ts +16 -0
  216. package/dist/remoteRun/depsPlan.d.ts.map +1 -0
  217. package/dist/remoteRun/depsPlan.js +82 -0
  218. package/dist/remoteRun/depsPlan.js.map +1 -0
  219. package/dist/remoteRun/exitCodes.d.ts +34 -0
  220. package/dist/remoteRun/exitCodes.d.ts.map +1 -0
  221. package/dist/remoteRun/exitCodes.js +38 -0
  222. package/dist/remoteRun/exitCodes.js.map +1 -0
  223. package/dist/remoteRun/foreground.d.ts +29 -0
  224. package/dist/remoteRun/foreground.d.ts.map +1 -0
  225. package/dist/remoteRun/foreground.js +159 -0
  226. package/dist/remoteRun/foreground.js.map +1 -0
  227. package/dist/remoteRun/interrupts.d.ts +17 -0
  228. package/dist/remoteRun/interrupts.d.ts.map +1 -0
  229. package/dist/remoteRun/interrupts.js +41 -0
  230. package/dist/remoteRun/interrupts.js.map +1 -0
  231. package/dist/remoteRun/jobFiles.d.ts +31 -0
  232. package/dist/remoteRun/jobFiles.d.ts.map +1 -0
  233. package/dist/remoteRun/jobFiles.js +84 -0
  234. package/dist/remoteRun/jobFiles.js.map +1 -0
  235. package/dist/remoteRun/jobFormat.d.ts +16 -0
  236. package/dist/remoteRun/jobFormat.d.ts.map +1 -0
  237. package/dist/remoteRun/jobFormat.js +130 -0
  238. package/dist/remoteRun/jobFormat.js.map +1 -0
  239. package/dist/remoteRun/jobId.d.ts +15 -0
  240. package/dist/remoteRun/jobId.d.ts.map +1 -0
  241. package/dist/remoteRun/jobId.js +85 -0
  242. package/dist/remoteRun/jobId.js.map +1 -0
  243. package/dist/remoteRun/jobMeta.d.ts +18 -0
  244. package/dist/remoteRun/jobMeta.d.ts.map +1 -0
  245. package/dist/remoteRun/jobMeta.js +33 -0
  246. package/dist/remoteRun/jobMeta.js.map +1 -0
  247. package/dist/remoteRun/jobQuery.d.ts +12 -0
  248. package/dist/remoteRun/jobQuery.d.ts.map +1 -0
  249. package/dist/remoteRun/jobQuery.js +22 -0
  250. package/dist/remoteRun/jobQuery.js.map +1 -0
  251. package/dist/remoteRun/jobRecords.d.ts +22 -0
  252. package/dist/remoteRun/jobRecords.d.ts.map +1 -0
  253. package/dist/remoteRun/jobRecords.js +145 -0
  254. package/dist/remoteRun/jobRecords.js.map +1 -0
  255. package/dist/remoteRun/jobState.d.ts +62 -0
  256. package/dist/remoteRun/jobState.d.ts.map +1 -0
  257. package/dist/remoteRun/jobState.js +132 -0
  258. package/dist/remoteRun/jobState.js.map +1 -0
  259. package/dist/remoteRun/leaseTiming.d.ts +18 -0
  260. package/dist/remoteRun/leaseTiming.d.ts.map +1 -0
  261. package/dist/remoteRun/leaseTiming.js +43 -0
  262. package/dist/remoteRun/leaseTiming.js.map +1 -0
  263. package/dist/remoteRun/output.d.ts +35 -0
  264. package/dist/remoteRun/output.d.ts.map +1 -0
  265. package/dist/remoteRun/output.js +82 -0
  266. package/dist/remoteRun/output.js.map +1 -0
  267. package/dist/remoteRun/pathPatterns.d.ts +33 -0
  268. package/dist/remoteRun/pathPatterns.d.ts.map +1 -0
  269. package/dist/remoteRun/pathPatterns.js +115 -0
  270. package/dist/remoteRun/pathPatterns.js.map +1 -0
  271. package/dist/remoteRun/probe.d.ts +56 -0
  272. package/dist/remoteRun/probe.d.ts.map +1 -0
  273. package/dist/remoteRun/probe.js +123 -0
  274. package/dist/remoteRun/probe.js.map +1 -0
  275. package/dist/remoteRun/project.d.ts +26 -0
  276. package/dist/remoteRun/project.d.ts.map +1 -0
  277. package/dist/remoteRun/project.js +159 -0
  278. package/dist/remoteRun/project.js.map +1 -0
  279. package/dist/remoteRun/projectConfig.d.ts +38 -0
  280. package/dist/remoteRun/projectConfig.d.ts.map +1 -0
  281. package/dist/remoteRun/projectConfig.js +87 -0
  282. package/dist/remoteRun/projectConfig.js.map +1 -0
  283. package/dist/remoteRun/remoteRunCli.d.ts +15 -0
  284. package/dist/remoteRun/remoteRunCli.d.ts.map +1 -0
  285. package/dist/remoteRun/remoteRunCli.js +144 -0
  286. package/dist/remoteRun/remoteRunCli.js.map +1 -0
  287. package/dist/remoteRun/remoteRunError.d.ts +14 -0
  288. package/dist/remoteRun/remoteRunError.d.ts.map +1 -0
  289. package/dist/remoteRun/remoteRunError.js +28 -0
  290. package/dist/remoteRun/remoteRunError.js.map +1 -0
  291. package/dist/remoteRun/rsync.d.ts +17 -0
  292. package/dist/remoteRun/rsync.d.ts.map +1 -0
  293. package/dist/remoteRun/rsync.js +39 -0
  294. package/dist/remoteRun/rsync.js.map +1 -0
  295. package/dist/remoteRun/runnerClient.d.ts +50 -0
  296. package/dist/remoteRun/runnerClient.d.ts.map +1 -0
  297. package/dist/remoteRun/runnerClient.js +139 -0
  298. package/dist/remoteRun/runnerClient.js.map +1 -0
  299. package/dist/remoteRun/runners.d.ts +57 -0
  300. package/dist/remoteRun/runners.d.ts.map +1 -0
  301. package/dist/remoteRun/runners.js +181 -0
  302. package/dist/remoteRun/runners.js.map +1 -0
  303. package/dist/remoteRun/runnersConfig.d.ts +44 -0
  304. package/dist/remoteRun/runnersConfig.d.ts.map +1 -0
  305. package/dist/remoteRun/runnersConfig.js +107 -0
  306. package/dist/remoteRun/runnersConfig.js.map +1 -0
  307. package/dist/remoteRun/safeCopy.d.ts +31 -0
  308. package/dist/remoteRun/safeCopy.d.ts.map +1 -0
  309. package/dist/remoteRun/safeCopy.js +137 -0
  310. package/dist/remoteRun/safeCopy.js.map +1 -0
  311. package/dist/remoteRun/sendPlan.d.ts +67 -0
  312. package/dist/remoteRun/sendPlan.d.ts.map +1 -0
  313. package/dist/remoteRun/sendPlan.js +139 -0
  314. package/dist/remoteRun/sendPlan.js.map +1 -0
  315. package/dist/remoteRun/ssh.d.ts +62 -0
  316. package/dist/remoteRun/ssh.d.ts.map +1 -0
  317. package/dist/remoteRun/ssh.js +202 -0
  318. package/dist/remoteRun/ssh.js.map +1 -0
  319. package/dist/remoteRun/submit.d.ts +29 -0
  320. package/dist/remoteRun/submit.d.ts.map +1 -0
  321. package/dist/remoteRun/submit.js +142 -0
  322. package/dist/remoteRun/submit.js.map +1 -0
  323. package/dist/requests/answerRequest.d.ts +5 -0
  324. package/dist/requests/answerRequest.d.ts.map +1 -1
  325. package/dist/requests/answerRequest.js +16 -1
  326. package/dist/requests/answerRequest.js.map +1 -1
  327. package/dist/requests/requestLedger.d.ts +13 -0
  328. package/dist/requests/requestLedger.d.ts.map +1 -1
  329. package/dist/requests/requestLedger.js +9 -0
  330. package/dist/requests/requestLedger.js.map +1 -1
  331. package/dist/requests/topicRequestSettle.d.ts +30 -0
  332. package/dist/requests/topicRequestSettle.d.ts.map +1 -0
  333. package/dist/requests/topicRequestSettle.js +23 -0
  334. package/dist/requests/topicRequestSettle.js.map +1 -0
  335. package/dist/requests/wakeUpEngine.d.ts +4 -0
  336. package/dist/requests/wakeUpEngine.d.ts.map +1 -1
  337. package/dist/requests/wakeUpEngine.js +5 -1
  338. package/dist/requests/wakeUpEngine.js.map +1 -1
  339. package/dist/scheduler/delivery.d.ts +2 -0
  340. package/dist/scheduler/delivery.d.ts.map +1 -1
  341. package/dist/scheduler/delivery.js +8 -4
  342. package/dist/scheduler/delivery.js.map +1 -1
  343. package/dist/scheduler/mcpSurface.d.ts +59 -10
  344. package/dist/scheduler/mcpSurface.d.ts.map +1 -1
  345. package/dist/scheduler/mcpSurface.js +276 -79
  346. package/dist/scheduler/mcpSurface.js.map +1 -1
  347. package/dist/scheduler/recurrence.d.ts +5 -0
  348. package/dist/scheduler/recurrence.d.ts.map +1 -1
  349. package/dist/scheduler/recurrence.js +12 -2
  350. package/dist/scheduler/recurrence.js.map +1 -1
  351. package/dist/scheduler/strictToolInput.d.ts +45 -0
  352. package/dist/scheduler/strictToolInput.d.ts.map +1 -0
  353. package/dist/scheduler/strictToolInput.js +155 -0
  354. package/dist/scheduler/strictToolInput.js.map +1 -0
  355. package/dist/scheduler/types.d.ts +5 -0
  356. package/dist/scheduler/types.d.ts.map +1 -1
  357. package/dist/scheduler/workerWatch.d.ts +23 -0
  358. package/dist/scheduler/workerWatch.d.ts.map +1 -0
  359. package/dist/scheduler/workerWatch.js +26 -0
  360. package/dist/scheduler/workerWatch.js.map +1 -0
  361. package/dist/selfUpdate/emittedSource.d.ts +11 -0
  362. package/dist/selfUpdate/emittedSource.d.ts.map +1 -0
  363. package/dist/selfUpdate/emittedSource.js +24 -0
  364. package/dist/selfUpdate/emittedSource.js.map +1 -0
  365. package/dist/selfUpdate/gitSource.d.ts +0 -6
  366. package/dist/selfUpdate/gitSource.d.ts.map +1 -1
  367. package/dist/selfUpdate/gitSource.js +2 -18
  368. package/dist/selfUpdate/gitSource.js.map +1 -1
  369. package/dist/selfUpdate/updatePending.d.ts +1 -1
  370. package/dist/sendErrorClassifier.d.ts +10 -0
  371. package/dist/sendErrorClassifier.d.ts.map +1 -1
  372. package/dist/sendErrorClassifier.js +22 -0
  373. package/dist/sendErrorClassifier.js.map +1 -1
  374. package/dist/state.d.ts +78 -7
  375. package/dist/state.d.ts.map +1 -1
  376. package/dist/state.js +125 -8
  377. package/dist/state.js.map +1 -1
  378. package/dist/stateFile.d.ts +9 -0
  379. package/dist/stateFile.d.ts.map +1 -0
  380. package/dist/stateFile.js +57 -0
  381. package/dist/stateFile.js.map +1 -0
  382. package/dist/stt/sttInstall.d.ts +7 -3
  383. package/dist/stt/sttInstall.d.ts.map +1 -1
  384. package/dist/stt/sttInstall.js +8 -4
  385. package/dist/stt/sttInstall.js.map +1 -1
  386. package/dist/stt/sttSettings.d.ts +2 -1
  387. package/dist/stt/sttSettings.d.ts.map +1 -1
  388. package/dist/stt/sttSettings.js +3 -2
  389. package/dist/stt/sttSettings.js.map +1 -1
  390. package/dist/stt/transcribeChain.js +2 -0
  391. package/dist/stt/transcribeChain.js.map +1 -1
  392. package/dist/testTimings.d.ts +13 -3
  393. package/dist/testTimings.d.ts.map +1 -1
  394. package/dist/testTimings.js +26 -2
  395. package/dist/testTimings.js.map +1 -1
  396. package/dist/todos/board.d.ts +83 -0
  397. package/dist/todos/board.d.ts.map +1 -0
  398. package/dist/todos/board.js +227 -0
  399. package/dist/todos/board.js.map +1 -0
  400. package/dist/todos/format.d.ts +33 -0
  401. package/dist/todos/format.d.ts.map +1 -0
  402. package/dist/todos/format.js +90 -0
  403. package/dist/todos/format.js.map +1 -0
  404. package/dist/todos/merge.d.ts +46 -0
  405. package/dist/todos/merge.d.ts.map +1 -0
  406. package/dist/todos/merge.js +137 -0
  407. package/dist/todos/merge.js.map +1 -0
  408. package/dist/todos/midTurn.d.ts +75 -0
  409. package/dist/todos/midTurn.d.ts.map +1 -0
  410. package/dist/todos/midTurn.js +214 -0
  411. package/dist/todos/midTurn.js.map +1 -0
  412. package/dist/todos/nag.d.ts +85 -0
  413. package/dist/todos/nag.d.ts.map +1 -0
  414. package/dist/todos/nag.js +103 -0
  415. package/dist/todos/nag.js.map +1 -0
  416. package/dist/todos/order.d.ts +25 -0
  417. package/dist/todos/order.d.ts.map +1 -0
  418. package/dist/todos/order.js +61 -0
  419. package/dist/todos/order.js.map +1 -0
  420. package/dist/todos/projects.d.ts +102 -0
  421. package/dist/todos/projects.d.ts.map +1 -0
  422. package/dist/todos/projects.js +342 -0
  423. package/dist/todos/projects.js.map +1 -0
  424. package/dist/todos/registry.d.ts +64 -0
  425. package/dist/todos/registry.d.ts.map +1 -0
  426. package/dist/todos/registry.js +116 -0
  427. package/dist/todos/registry.js.map +1 -0
  428. package/dist/todos/reminderEngine.d.ts +78 -0
  429. package/dist/todos/reminderEngine.d.ts.map +1 -0
  430. package/dist/todos/reminderEngine.js +162 -0
  431. package/dist/todos/reminderEngine.js.map +1 -0
  432. package/dist/todos/store.d.ts +34 -0
  433. package/dist/todos/store.d.ts.map +1 -0
  434. package/dist/todos/store.js +208 -0
  435. package/dist/todos/store.js.map +1 -0
  436. package/dist/todos/tools.d.ts +26 -0
  437. package/dist/todos/tools.d.ts.map +1 -0
  438. package/dist/todos/tools.js +25 -0
  439. package/dist/todos/tools.js.map +1 -0
  440. package/dist/todos/types.d.ts +85 -0
  441. package/dist/todos/types.d.ts.map +1 -0
  442. package/dist/todos/types.js +30 -0
  443. package/dist/todos/types.js.map +1 -0
  444. package/dist/trackers/taskAgentLimit.d.ts +58 -0
  445. package/dist/trackers/taskAgentLimit.d.ts.map +1 -0
  446. package/dist/trackers/taskAgentLimit.js +62 -0
  447. package/dist/trackers/taskAgentLimit.js.map +1 -0
  448. package/dist/trackers/taskAgentSlots.d.ts +109 -0
  449. package/dist/trackers/taskAgentSlots.d.ts.map +1 -0
  450. package/dist/trackers/taskAgentSlots.js +227 -0
  451. package/dist/trackers/taskAgentSlots.js.map +1 -0
  452. package/dist/trackers/types.d.ts +14 -0
  453. package/dist/trackers/types.d.ts.map +1 -0
  454. package/dist/trackers/types.js +3 -0
  455. package/dist/trackers/types.js.map +1 -0
  456. package/dist/types.d.ts +80 -4
  457. package/dist/types.d.ts.map +1 -1
  458. package/dist/utils/adoptReplayGate.d.ts +16 -0
  459. package/dist/utils/adoptReplayGate.d.ts.map +1 -0
  460. package/dist/utils/adoptReplayGate.js +35 -0
  461. package/dist/utils/adoptReplayGate.js.map +1 -0
  462. package/dist/utils/agentPlugin.d.ts +113 -0
  463. package/dist/utils/agentPlugin.d.ts.map +1 -0
  464. package/dist/utils/agentPlugin.js +192 -0
  465. package/dist/utils/agentPlugin.js.map +1 -0
  466. package/dist/utils/autoContinueOnLimit.d.ts +7 -4
  467. package/dist/utils/autoContinueOnLimit.d.ts.map +1 -1
  468. package/dist/utils/autoContinueOnLimit.js +8 -5
  469. package/dist/utils/autoContinueOnLimit.js.map +1 -1
  470. package/dist/utils/botSkills.d.ts +62 -0
  471. package/dist/utils/botSkills.d.ts.map +1 -0
  472. package/dist/utils/botSkills.js +53 -0
  473. package/dist/utils/botSkills.js.map +1 -0
  474. package/dist/utils/botSkillsSetting.d.ts +7 -0
  475. package/dist/utils/botSkillsSetting.d.ts.map +1 -0
  476. package/dist/utils/botSkillsSetting.js +9 -0
  477. package/dist/utils/botSkillsSetting.js.map +1 -0
  478. package/dist/utils/claudeCodeVersion.d.ts +7 -0
  479. package/dist/utils/claudeCodeVersion.d.ts.map +1 -1
  480. package/dist/utils/claudeCodeVersion.js +14 -1
  481. package/dist/utils/claudeCodeVersion.js.map +1 -1
  482. package/dist/utils/claudeCompactHook.d.ts +33 -15
  483. package/dist/utils/claudeCompactHook.d.ts.map +1 -1
  484. package/dist/utils/claudeCompactHook.js +36 -17
  485. package/dist/utils/claudeCompactHook.js.map +1 -1
  486. package/dist/utils/claudeCompactSummary.d.ts +15 -0
  487. package/dist/utils/claudeCompactSummary.d.ts.map +1 -0
  488. package/dist/utils/claudeCompactSummary.js +96 -0
  489. package/dist/utils/claudeCompactSummary.js.map +1 -0
  490. package/dist/utils/claudeLimitSwitch.d.ts +11 -9
  491. package/dist/utils/claudeLimitSwitch.d.ts.map +1 -1
  492. package/dist/utils/claudeLimitSwitch.js +18 -16
  493. package/dist/utils/claudeLimitSwitch.js.map +1 -1
  494. package/dist/utils/claudeProfiles.d.ts +5 -0
  495. package/dist/utils/claudeProfiles.d.ts.map +1 -1
  496. package/dist/utils/claudeProfiles.js +14 -0
  497. package/dist/utils/claudeProfiles.js.map +1 -1
  498. package/dist/utils/claudeSessionTitle.d.ts +2 -1
  499. package/dist/utils/claudeSessionTitle.d.ts.map +1 -1
  500. package/dist/utils/claudeSessionTitle.js +14 -14
  501. package/dist/utils/claudeSessionTitle.js.map +1 -1
  502. package/dist/utils/claudeUsage.d.ts +95 -15
  503. package/dist/utils/claudeUsage.d.ts.map +1 -1
  504. package/dist/utils/claudeUsage.js +241 -41
  505. package/dist/utils/claudeUsage.js.map +1 -1
  506. package/dist/utils/claudeUsageRefresher.d.ts +10 -0
  507. package/dist/utils/claudeUsageRefresher.d.ts.map +1 -1
  508. package/dist/utils/claudeUsageRefresher.js +11 -0
  509. package/dist/utils/claudeUsageRefresher.js.map +1 -1
  510. package/dist/utils/claudeUserEntry.d.ts +50 -0
  511. package/dist/utils/claudeUserEntry.d.ts.map +1 -0
  512. package/dist/utils/claudeUserEntry.js +120 -0
  513. package/dist/utils/claudeUserEntry.js.map +1 -0
  514. package/dist/utils/clearThreadOutputQueues.d.ts +4 -3
  515. package/dist/utils/clearThreadOutputQueues.d.ts.map +1 -1
  516. package/dist/utils/clearThreadOutputQueues.js +1 -1
  517. package/dist/utils/clearThreadOutputQueues.js.map +1 -1
  518. package/dist/utils/compactOnIdle.d.ts +33 -13
  519. package/dist/utils/compactOnIdle.d.ts.map +1 -1
  520. package/dist/utils/compactOnIdle.js +35 -15
  521. package/dist/utils/compactOnIdle.js.map +1 -1
  522. package/dist/utils/fallbackBridge.d.ts +5 -0
  523. package/dist/utils/fallbackBridge.d.ts.map +1 -1
  524. package/dist/utils/fallbackBridge.js +19 -3
  525. package/dist/utils/fallbackBridge.js.map +1 -1
  526. package/dist/utils/fallbackChain.d.ts +9 -3
  527. package/dist/utils/fallbackChain.d.ts.map +1 -1
  528. package/dist/utils/fallbackChain.js +21 -3
  529. package/dist/utils/fallbackChain.js.map +1 -1
  530. package/dist/utils/fileSendPlan.d.ts +6 -0
  531. package/dist/utils/fileSendPlan.d.ts.map +1 -1
  532. package/dist/utils/fileSendPlan.js +11 -0
  533. package/dist/utils/fileSendPlan.js.map +1 -1
  534. package/dist/utils/fileSendService.d.ts +7 -1
  535. package/dist/utils/fileSendService.d.ts.map +1 -1
  536. package/dist/utils/fileSendService.js +6 -2
  537. package/dist/utils/fileSendService.js.map +1 -1
  538. package/dist/utils/groupFinalizePlan.d.ts +8 -10
  539. package/dist/utils/groupFinalizePlan.d.ts.map +1 -1
  540. package/dist/utils/groupFinalizePlan.js +8 -12
  541. package/dist/utils/groupFinalizePlan.js.map +1 -1
  542. package/dist/utils/jsonStreamHost.d.ts +13 -0
  543. package/dist/utils/jsonStreamHost.d.ts.map +1 -1
  544. package/dist/utils/jsonStreamHost.js +13 -0
  545. package/dist/utils/jsonStreamHost.js.map +1 -1
  546. package/dist/utils/messageSendService.d.ts +5 -3
  547. package/dist/utils/messageSendService.d.ts.map +1 -1
  548. package/dist/utils/messageSendService.js +12 -5
  549. package/dist/utils/messageSendService.js.map +1 -1
  550. package/dist/utils/openCodeCompactPlugin.d.ts +39 -14
  551. package/dist/utils/openCodeCompactPlugin.d.ts.map +1 -1
  552. package/dist/utils/openCodeCompactPlugin.js +106 -38
  553. package/dist/utils/openCodeCompactPlugin.js.map +1 -1
  554. package/dist/utils/promptDelivery.d.ts +29 -12
  555. package/dist/utils/promptDelivery.d.ts.map +1 -1
  556. package/dist/utils/promptDelivery.js +13 -5
  557. package/dist/utils/promptDelivery.js.map +1 -1
  558. package/dist/utils/sentKindsSummary.d.ts +10 -0
  559. package/dist/utils/sentKindsSummary.d.ts.map +1 -0
  560. package/dist/utils/sentKindsSummary.js +18 -0
  561. package/dist/utils/sentKindsSummary.js.map +1 -0
  562. package/dist/utils/telegramError.d.ts +6 -0
  563. package/dist/utils/telegramError.d.ts.map +1 -1
  564. package/dist/utils/telegramError.js +12 -0
  565. package/dist/utils/telegramError.js.map +1 -1
  566. package/dist/utils/topicView.d.ts +1 -1
  567. package/dist/utils/topicView.js +1 -1
  568. package/dist/utils/transcribeAudio.d.ts +10 -0
  569. package/dist/utils/transcribeAudio.d.ts.map +1 -1
  570. package/dist/utils/transcribeAudio.js +22 -3
  571. package/dist/utils/transcribeAudio.js.map +1 -1
  572. package/dist/utils/transcriptErrorTime.d.ts +8 -0
  573. package/dist/utils/transcriptErrorTime.d.ts.map +1 -0
  574. package/dist/utils/transcriptErrorTime.js +56 -0
  575. package/dist/utils/transcriptErrorTime.js.map +1 -0
  576. package/dist/utils/wedgeRecovery.d.ts +2 -0
  577. package/dist/utils/wedgeRecovery.d.ts.map +1 -1
  578. package/dist/utils/wedgeRecovery.js +1 -1
  579. package/dist/utils/wedgeRecovery.js.map +1 -1
  580. package/package.json +11 -3
  581. package/remoteRun/runner.sh +1242 -0
  582. package/stt/gigaam_sidecar.py +555 -50
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jobId.js","sourceRoot":"","sources":["../../src/remoteRun/jobId.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,kCASC;AAGD,gCAGC;AAGD,kCAEC;AAGD,wCAIC;AAnDD,mCAAiD;AACjD,2CAA6B;AAE7B;;;;;;GAMG;AAEH,MAAM,cAAc,GAAG,kCAAkC,CAAC;AAC1D,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAM,cAAc,GAAG,EAAE,CAAC;AAC1B,MAAM,qBAAqB,GAAG,EAAE,CAAC;AACjC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,OAAO,GAAG,OAAO,CAAC;AACxB,MAAM,cAAc,GAAG,CAAC,CAAC;AAEZ,QAAA,gBAAgB,GAAG,KAAK,CAAC;AAEtC,MAAM,YAAY,GAAG,4CAA4C,CAAC;AAElE,yGAAyG;AACzG,SAAgB,WAAW,CAAC,UAAkB,EAAE,SAAmC,oBAAW;IAC5F,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;IACrC,IAAI,KAAK,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAClC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,eAAe,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACxD,MAAM,IAAI,cAAc,CAAC,KAAK,GAAG,OAAO,CAAC,CAAC;QAC1C,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,IAAI,kBAAkB,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,GAAG,UAAU,IAAI,MAAM,EAAE,CAAC;AACnC,CAAC;AAED,2FAA2F;AAC3F,SAAgB,UAAU,CAAC,IAAY;IACrC,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtC,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AAC1D,CAAC;AAED,sEAAsE;AACtE,SAAgB,WAAW,CAAC,KAAa;IACvC,OAAO,GAAG,wBAAgB,GAAG,KAAK,EAAE,CAAC;AACvC,CAAC;AAED,uGAAuG;AACvG,SAAgB,cAAc,CAAC,WAAmB,EAAE,KAAwC;IAC1F,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,qBAAqB,CAAC,IAAI,SAAS,CAAC;IAC/I,MAAM,IAAI,GAAG,IAAA,mBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,GAAG,IAAI,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;IACjI,OAAO,GAAG,QAAQ,IAAI,IAAI,EAAE,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,18 @@
1
+ export interface JobMeta {
2
+ id: string;
3
+ runner: string;
4
+ slug: string;
5
+ /** The project's root on the main box. */
6
+ projectRoot: string;
7
+ subfolder: string;
8
+ command: string;
9
+ submittedAtMs: number;
10
+ timeoutSeconds: number;
11
+ /** `<hostname>:<uid>` of the user who submitted: `ls --all` lists the jobs of THIS user only. */
12
+ owner: string;
13
+ group: string;
14
+ isBackground: boolean;
15
+ }
16
+ /** @description Parse a job's `meta.json`; `null` when it is not one. */
17
+ export declare function parseJobMeta(text: string): JobMeta | null;
18
+ //# sourceMappingURL=jobMeta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jobMeta.d.ts","sourceRoot":"","sources":["../../src/remoteRun/jobMeta.ts"],"names":[],"mappings":"AAsBA,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,iGAAiG;IACjG,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,yEAAyE;AACzE,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAOzD"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseJobMeta = parseJobMeta;
4
+ const zod_1 = require("zod");
5
+ /**
6
+ * @description What `meta.json` of a job holds: written by the main box at submit, kept on the runner next to the job, read back by `ls`
7
+ * and `status` — for DISPLAY only. The runner holds the file, so it can say anything in it: where a job's result files go is never read
8
+ * from here but from the main box's own record (`jobRecords.ts`).
9
+ */
10
+ const jobMetaSchema = zod_1.z.looseObject({
11
+ id: zod_1.z.string(),
12
+ runner: zod_1.z.string(),
13
+ slug: zod_1.z.string(),
14
+ projectRoot: zod_1.z.string(),
15
+ subfolder: zod_1.z.string(),
16
+ command: zod_1.z.string(),
17
+ submittedAtMs: zod_1.z.number(),
18
+ timeoutSeconds: zod_1.z.number(),
19
+ owner: zod_1.z.string(),
20
+ group: zod_1.z.string(),
21
+ isBackground: zod_1.z.boolean(),
22
+ });
23
+ /** @description Parse a job's `meta.json`; `null` when it is not one. */
24
+ function parseJobMeta(text) {
25
+ try {
26
+ const parsed = jobMetaSchema.safeParse(JSON.parse(text));
27
+ return parsed.success ? parsed.data : null;
28
+ }
29
+ catch {
30
+ return null;
31
+ }
32
+ }
33
+ //# sourceMappingURL=jobMeta.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jobMeta.js","sourceRoot":"","sources":["../../src/remoteRun/jobMeta.ts"],"names":[],"mappings":";;AAuCA,oCAOC;AA9CD,6BAAwB;AAExB;;;;GAIG;AAEH,MAAM,aAAa,GAAG,OAAC,CAAC,WAAW,CAAC;IAClC,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;IACd,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;IAClB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE;IACvB,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;IACnB,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE;IACzB,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE;IAC1B,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;IACjB,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;IACjB,YAAY,EAAE,OAAC,CAAC,OAAO,EAAE;CAC1B,CAAC,CAAC;AAkBH,yEAAyE;AACzE,SAAgB,YAAY,CAAC,IAAY;IACvC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QACzD,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAC7C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { type JobFacts, type JobOutcome } from './jobState';
2
+ import type { RunnerClient } from './runnerClient';
3
+ /**
4
+ * @description Ask a runner how a job is doing: its own files (`result`) first, Pueue's task list only when the job left no exit file
5
+ * (a hard kill) or has not started.
6
+ */
7
+ /** The job's facts and what they mean. `slug` may be `-` for "the project this job id belongs to"; the answer names it. */
8
+ export declare function readJobOutcome(client: RunnerClient, slug: string, jobId: string): Promise<{
9
+ facts: JobFacts;
10
+ outcome: JobOutcome;
11
+ }>;
12
+ //# sourceMappingURL=jobQuery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jobQuery.d.ts","sourceRoot":"","sources":["../../src/remoteRun/jobQuery.ts"],"names":[],"mappings":"AACA,OAAO,EAAuD,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAEjH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;;GAGG;AAEH,2HAA2H;AAC3H,wBAAsB,cAAc,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,KAAK,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,UAAU,CAAA;CAAE,CAAC,CAOzI"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.readJobOutcome = readJobOutcome;
4
+ const jobId_1 = require("./jobId");
5
+ const jobState_1 = require("./jobState");
6
+ const remoteRunError_1 = require("./remoteRunError");
7
+ /**
8
+ * @description Ask a runner how a job is doing: its own files (`result`) first, Pueue's task list only when the job left no exit file
9
+ * (a hard kill) or has not started.
10
+ */
11
+ /** The job's facts and what they mean. `slug` may be `-` for "the project this job id belongs to"; the answer names it. */
12
+ async function readJobOutcome(client, slug, jobId) {
13
+ const facts = (0, jobState_1.parseJobFacts)(await client.callOrThrow('result', [slug, jobId]));
14
+ if (facts.exit !== null)
15
+ return { facts, outcome: (0, jobState_1.describeJobOutcome)(facts, null) };
16
+ const pueue = await client.call('pueue', ['status', '--json']);
17
+ if (pueue.exitCode !== 0)
18
+ throw new remoteRunError_1.RemoteRunError(`runner "${client.runner.name}": Pueue did not answer — ${pueue.stderr.trim().split('\n')[0] || 'no output'}`);
19
+ const task = (0, jobState_1.parsePueueStatus)(pueue.stdout).find((candidate) => candidate.label === (0, jobId_1.getJobLabel)(jobId)) ?? null;
20
+ return { facts, outcome: (0, jobState_1.describeJobOutcome)(facts, task) };
21
+ }
22
+ //# sourceMappingURL=jobQuery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jobQuery.js","sourceRoot":"","sources":["../../src/remoteRun/jobQuery.ts"],"names":[],"mappings":";;AAWA,wCAOC;AAlBD,mCAAsC;AACtC,yCAAiH;AACjH,qDAAkD;AAGlD;;;GAGG;AAEH,2HAA2H;AACpH,KAAK,UAAU,cAAc,CAAC,MAAoB,EAAE,IAAY,EAAE,KAAa;IACpF,MAAM,KAAK,GAAG,IAAA,wBAAa,EAAC,MAAM,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAC/E,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI;QAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAA,6BAAkB,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC;IACpF,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC/D,IAAI,KAAK,CAAC,QAAQ,KAAK,CAAC;QAAE,MAAM,IAAI,+BAAc,CAAC,WAAW,MAAM,CAAC,MAAM,CAAC,IAAI,6BAA6B,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC;IAClK,MAAM,IAAI,GAAG,IAAA,2BAAgB,EAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,KAAK,IAAA,mBAAW,EAAC,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC;IAChH,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAA,6BAAkB,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod';
2
+ /** `timeoutSeconds` is absent in a record an earlier build wrote: the longest `--timeout` allowed stands in for it. */
3
+ declare const recordSchema: z.ZodObject<{
4
+ projectRoot: z.ZodString;
5
+ slug: z.ZodString;
6
+ submittedAtMs: z.ZodNumber;
7
+ timeoutSeconds: z.ZodOptional<z.ZodNumber>;
8
+ }, z.core.$loose>;
9
+ export type LocalJobRecord = z.infer<typeof recordSchema>;
10
+ /** @description Remember where `jobId` came from; also drops the records the runner has surely pruned. */
11
+ export declare function writeLocalJobRecord(cacheDir: string, jobId: string, record: LocalJobRecord, nowMs?: number): void;
12
+ /** @description The record of `jobId`, or `null` when this machine and user did not submit it (or it was pruned). */
13
+ export declare function readLocalJobRecord(cacheDir: string, jobId: string): LocalJobRecord | null;
14
+ /**
15
+ * @description The runner that holds the most recent job of the project at `projectRoot` — the one whose copy of it is the latest — from
16
+ * the newest local job record; `null` when this machine has submitted nothing from that project. The runner is the one the job id names.
17
+ */
18
+ export declare function readLastRunnerNameOfProject(cacheDir: string, projectRoot: string): string | null;
19
+ /** @description When a record has no use any more: the job's deadline, then the days the runner keeps a job that ended. */
20
+ export declare function getRecordExpiryMs(record: LocalJobRecord): number;
21
+ export {};
22
+ //# sourceMappingURL=jobRecords.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jobRecords.d.ts","sourceRoot":"","sources":["../../src/remoteRun/jobRecords.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAwBxB,uHAAuH;AACvH,QAAA,MAAM,YAAY;;;;;iBAA0J,CAAC;AAE7K,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAO1D,0GAA0G;AAC1G,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,GAAE,MAAmB,GAAG,IAAI,CAK7H;AAED,qHAAqH;AACrH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAOzF;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAkBhG;AAED,2HAA2H;AAC3H,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAEhE"}
@@ -0,0 +1,145 @@
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.writeLocalJobRecord = writeLocalJobRecord;
37
+ exports.readLocalJobRecord = readLocalJobRecord;
38
+ exports.readLastRunnerNameOfProject = readLastRunnerNameOfProject;
39
+ exports.getRecordExpiryMs = getRecordExpiryMs;
40
+ const fs = __importStar(require("fs"));
41
+ const path = __importStar(require("path"));
42
+ const zod_1 = require("zod");
43
+ const cliArgs_1 = require("./cliArgs");
44
+ const jobId_1 = require("./jobId");
45
+ /**
46
+ * @description The main box's own record of a job: which local project it was submitted from. `wait` and `fetch` bring result files back
47
+ * into THAT project — the runner is not trusted to say where its files go (its `meta.json` is only shown by `ls` and `status`; a
48
+ * hostile runner could name any folder of this user, and the slug of a root is a hash of public inputs it can compute). A job submitted
49
+ * from another user or machine has no record here, and its files are not fetched.
50
+ *
51
+ * Kept in the local cache (`<cache>/jobs/<id>.json`, mode 0600) for as long as the runner can still have the job: until its own deadline
52
+ * (`submittedAtMs` + its `--timeout`, up to 7 days) and then the days the runner keeps a finished one. Not by the age of the file: a job
53
+ * that runs or queues for days, or one fetched on the last day of the runner's retention, would find its record gone and its files
54
+ * silently left on the runner.
55
+ */
56
+ /** The runner removes a job this long after it ended (`runner.sh`: `job_keep_days`); the record has no use past it. */
57
+ const recordKeepDays = 3;
58
+ const millisecondsPerDay = 24 * 60 * 60 * 1000;
59
+ const recordsDirectoryName = 'jobs';
60
+ const recordFileMode = 0o600;
61
+ const recordsDirectoryMode = 0o700;
62
+ const recordSuffix = '.json';
63
+ /** `timeoutSeconds` is absent in a record an earlier build wrote: the longest `--timeout` allowed stands in for it. */
64
+ const recordSchema = zod_1.z.looseObject({ projectRoot: zod_1.z.string().min(1), slug: zod_1.z.string().min(1), submittedAtMs: zod_1.z.number(), timeoutSeconds: zod_1.z.number().positive().optional() });
65
+ function getRecordPath(cacheDir, jobId) {
66
+ if ((0, jobId_1.parseJobId)(jobId) === null)
67
+ throw new Error(`not a job id: ${jobId}`);
68
+ return path.join(cacheDir, recordsDirectoryName, `${jobId}${recordSuffix}`);
69
+ }
70
+ /** @description Remember where `jobId` came from; also drops the records the runner has surely pruned. */
71
+ function writeLocalJobRecord(cacheDir, jobId, record, nowMs = Date.now()) {
72
+ const recordPath = getRecordPath(cacheDir, jobId);
73
+ fs.mkdirSync(path.dirname(recordPath), { recursive: true, mode: recordsDirectoryMode });
74
+ fs.writeFileSync(recordPath, JSON.stringify(record), { mode: recordFileMode });
75
+ pruneLocalJobRecords(cacheDir, nowMs);
76
+ }
77
+ /** @description The record of `jobId`, or `null` when this machine and user did not submit it (or it was pruned). */
78
+ function readLocalJobRecord(cacheDir, jobId) {
79
+ try {
80
+ const parsed = recordSchema.safeParse(JSON.parse(fs.readFileSync(getRecordPath(cacheDir, jobId), 'utf8')));
81
+ return parsed.success ? parsed.data : null;
82
+ }
83
+ catch {
84
+ return null;
85
+ }
86
+ }
87
+ /**
88
+ * @description The runner that holds the most recent job of the project at `projectRoot` — the one whose copy of it is the latest — from
89
+ * the newest local job record; `null` when this machine has submitted nothing from that project. The runner is the one the job id names.
90
+ */
91
+ function readLastRunnerNameOfProject(cacheDir, projectRoot) {
92
+ const directory = path.join(cacheDir, recordsDirectoryName);
93
+ let names;
94
+ try {
95
+ names = fs.readdirSync(directory);
96
+ }
97
+ catch {
98
+ return null;
99
+ }
100
+ let newest = null;
101
+ for (const name of names) {
102
+ if (!name.endsWith(recordSuffix))
103
+ continue;
104
+ const jobId = name.slice(0, -recordSuffix.length);
105
+ const runnerName = (0, jobId_1.parseJobId)(jobId)?.runnerName;
106
+ const record = runnerName === undefined ? null : readLocalJobRecord(cacheDir, jobId);
107
+ if (runnerName === undefined || record === null || record.projectRoot !== projectRoot)
108
+ continue;
109
+ if (newest === null || record.submittedAtMs > newest.submittedAtMs)
110
+ newest = { runnerName, submittedAtMs: record.submittedAtMs };
111
+ }
112
+ return newest?.runnerName ?? null;
113
+ }
114
+ /** @description When a record has no use any more: the job's deadline, then the days the runner keeps a job that ended. */
115
+ function getRecordExpiryMs(record) {
116
+ return record.submittedAtMs + (record.timeoutSeconds ?? cliArgs_1.maxTimeoutSeconds) * 1000 + recordKeepDays * millisecondsPerDay;
117
+ }
118
+ /** When the file at `recordPath` expires: by its record, or — for a file that is not one — by its own age after the longest life a record can have. */
119
+ function readFileExpiryMs(recordPath) {
120
+ try {
121
+ const parsed = recordSchema.safeParse(JSON.parse(fs.readFileSync(recordPath, 'utf8')));
122
+ if (parsed.success)
123
+ return getRecordExpiryMs(parsed.data);
124
+ }
125
+ catch {
126
+ /* not JSON: judged by its age below */
127
+ }
128
+ return fs.statSync(recordPath).mtimeMs + cliArgs_1.maxTimeoutSeconds * 1000 + recordKeepDays * millisecondsPerDay;
129
+ }
130
+ function pruneLocalJobRecords(cacheDir, nowMs) {
131
+ const directory = path.join(cacheDir, recordsDirectoryName);
132
+ for (const name of fs.readdirSync(directory)) {
133
+ if (!name.endsWith(recordSuffix))
134
+ continue;
135
+ const recordPath = path.join(directory, name);
136
+ try {
137
+ if (nowMs > readFileExpiryMs(recordPath))
138
+ fs.rmSync(recordPath, { force: true });
139
+ }
140
+ catch {
141
+ /* gone already: nothing to prune */
142
+ }
143
+ }
144
+ }
145
+ //# sourceMappingURL=jobRecords.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jobRecords.js","sourceRoot":"","sources":["../../src/remoteRun/jobRecords.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,kDAKC;AAGD,gDAOC;AAMD,kEAkBC;AAGD,8CAEC;AAjFD,uCAAyB;AACzB,2CAA6B;AAC7B,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AE,KAAa;IAC3D,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;IAC5D,KAAK,MAAM,IAAI,IAAI,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC;QAC7C,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC;YAAE,SAAS;QAC3C,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAC9C,IAAI,CAAC;YACH,IAAI,KAAK,GAAG,gBAAgB,CAAC,UAAU,CAAC;gBAAE,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACnF,CAAC;QAAC,MAAM,CAAC;YACP,oCAAoC;QACtC,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * @description What a job is doing or how it ended, from the two witnesses: the job's own files (`runner.sh result`) and Pueue's task
3
+ * list. The job's own exit file is authoritative; a job that was SIGKILLed (a timeout whose command ignored SIGTERM, a kill after
4
+ * the grace time) wrote none, and then the markers it left and Pueue's verdict decide. Pueue alone is never trusted for the code:
5
+ * `pueue wait` exits 0 for a failed task, and a task Pueue calls `Killed` may have been a timeout.
6
+ */
7
+ export type PueueResult = {
8
+ kind: 'success';
9
+ } | {
10
+ kind: 'failed';
11
+ code: number;
12
+ } | {
13
+ kind: 'killed';
14
+ } | {
15
+ kind: 'other';
16
+ text: string;
17
+ };
18
+ export interface PueueTask {
19
+ id: number;
20
+ label: string | null;
21
+ state: 'queued' | 'running' | 'done' | 'other';
22
+ result: PueueResult | null;
23
+ }
24
+ /** @description The tasks of `pueue status --json` that are ours (label `rr-…`). A reply that is not Pueue's status is an error. */
25
+ export declare function parsePueueStatus(jsonText: string): PueueTask[];
26
+ /** @name JobFacts @description What `runner.sh result` prints. */
27
+ export interface JobFacts {
28
+ /** The project's folder name on the runner. */
29
+ slug: string;
30
+ /** The exit file's content; `null` while there is none. */
31
+ exit: number | null;
32
+ phase: string;
33
+ taskId: number | null;
34
+ startedAtSeconds: number | null;
35
+ finishedAtSeconds: number | null;
36
+ isTimedOut: boolean;
37
+ isKilled: boolean;
38
+ isStarted: boolean;
39
+ isWithArtifacts: boolean;
40
+ /** `deps` when the dependencies step failed. */
41
+ failedStep: string;
42
+ }
43
+ /** @description Parse the `key=value` lines of `runner.sh result`. */
44
+ export declare function parseJobFacts(text: string): JobFacts;
45
+ export type JobEndReason = 'exit' | 'timeout' | 'killed' | 'deps-failed' | 'lost';
46
+ export type JobOutcome = {
47
+ state: 'queued';
48
+ } | {
49
+ state: 'running';
50
+ phase: string;
51
+ } | {
52
+ state: 'done';
53
+ code: number;
54
+ reason: JobEndReason;
55
+ } | {
56
+ state: 'unknown';
57
+ };
58
+ /** @description The job's state and, once it ended, remote-run's exit code for it and why. */
59
+ export declare function describeJobOutcome(facts: JobFacts, task: PueueTask | null): JobOutcome;
60
+ /** @description One short word for a job's state in `ls` and `status`. */
61
+ export declare function describeJobState(outcome: JobOutcome): string;
62
+ //# sourceMappingURL=jobState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jobState.d.ts","sourceRoot":"","sources":["../../src/remoteRun/jobState.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AAEH,MAAM,MAAM,WAAW,GAAG;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAExI,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,QAAQ,GAAG,SAAS,G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AA0E;AAC1E,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,CAU5D"}
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parsePueueStatus = parsePueueStatus;
4
+ exports.parseJobFacts = parseJobFacts;
5
+ exports.describeJobOutcome = describeJobOutcome;
6
+ exports.describeJobState = describeJobState;
7
+ const zod_1 = require("zod");
8
+ const exitCodes_1 = require("./exitCodes");
9
+ const jobId_1 = require("./jobId");
10
+ const doneSchema = zod_1.z.looseObject({ result: zod_1.z.union([zod_1.z.string(), zod_1.z.record(zod_1.z.string(), zod_1.z.union([zod_1.z.number(), zod_1.z.string()]))]) });
11
+ const statusSchema = zod_1.z.union([
12
+ zod_1.z.string(),
13
+ zod_1.z.looseObject({ Running: zod_1.z.looseObject({}).optional(), Done: doneSchema.optional(), Paused: zod_1.z.looseObject({}).optional(), Queued: zod_1.z.looseObject({}).optional() }),
14
+ ]);
15
+ const pueueStatusSchema = zod_1.z.looseObject({
16
+ tasks: zod_1.z.record(zod_1.z.string(), zod_1.z.looseObject({ id: zod_1.z.number(), label: zod_1.z.string().nullable().optional(), status: statusSchema })),
17
+ });
18
+ function readPueueResult(raw) {
19
+ if (raw === 'Success')
20
+ return { kind: 'success' };
21
+ if (raw === 'Killed')
22
+ return { kind: 'killed' };
23
+ if (typeof raw === 'object' && typeof raw.Failed === 'number')
24
+ return { kind: 'failed', code: raw.Failed };
25
+ return { kind: 'other', text: typeof raw === 'string' ? raw : JSON.stringify(raw) };
26
+ }
27
+ /** @description The tasks of `pueue status --json` that are ours (label `rr-…`). A reply that is not Pueue's status is an error. */
28
+ function parsePueueStatus(jsonText) {
29
+ let parsed;
30
+ try {
31
+ parsed = pueueStatusSchema.safeParse(JSON.parse(jsonText));
32
+ }
33
+ catch {
34
+ throw new Error('pueue status did not return JSON');
35
+ }
36
+ if (!parsed.success)
37
+ throw new Error('pueue status returned something that is not its task list');
38
+ const tasks = [];
39
+ for (const task of Object.values(parsed.data.tasks)) {
40
+ const label = task.label ?? null;
41
+ if (label === null || !label.startsWith(jobId_1.pueueLabelPrefix))
42
+ continue;
43
+ const status = task.status;
44
+ if (typeof status === 'string') {
45
+ tasks.push({ id: task.id, label, state: status === 'Queued' ? 'queued' : 'other', result: null });
46
+ }
47
+ else if (status.Running !== undefined) {
48
+ tasks.push({ id: task.id, label, state: 'running', result: null });
49
+ }
50
+ else if (status.Done !== undefined) {
51
+ tasks.push({ id: task.id, label, state: 'done', result: readPueueResult(status.Done.result) });
52
+ }
53
+ else {
54
+ tasks.push({ id: task.id, label, state: status.Queued !== undefined ? 'queued' : 'other', result: null });
55
+ }
56
+ }
57
+ return tasks;
58
+ }
59
+ function readInteger(value) {
60
+ if (value === undefined || value.trim() === '')
61
+ return null;
62
+ const parsed = Number(value);
63
+ return Number.isInteger(parsed) ? parsed : null;
64
+ }
65
+ /** @description Parse the `key=value` lines of `runner.sh result`. */
66
+ function parseJobFacts(text) {
67
+ const fields = new Map();
68
+ for (const line of text.split('\n')) {
69
+ const separator = line.indexOf('=');
70
+ if (separator > 0)
71
+ fields.set(line.slice(0, separator), line.slice(separator + 1).trim());
72
+ }
73
+ return {
74
+ slug: fields.get('slug') ?? '',
75
+ exit: readInteger(fields.get('exit')),
76
+ phase: fields.get('phase') ?? '',
77
+ taskId: readInteger(fields.get('task')),
78
+ startedAtSeconds: readInteger(fields.get('started')),
79
+ finishedAtSeconds: readInteger(fields.get('finished')),
80
+ isTimedOut: fields.get('timeout') === '1',
81
+ isKilled: fields.get('killed') === '1',
82
+ isStarted: fields.get('has_pid') === '1',
83
+ isWithArtifacts: fields.get('artifacts') === '1',
84
+ failedStep: fields.get('failed_step') ?? '',
85
+ };
86
+ }
87
+ /** @description The job's state and, once it ended, remote-run's exit code for it and why. */
88
+ function describeJobOutcome(facts, task) {
89
+ if (facts.exit !== null) {
90
+ let reason = 'exit';
91
+ if (facts.exit === exitCodes_1.remoteRunExitCodes.timedOut && facts.isTimedOut)
92
+ reason = 'timeout';
93
+ else if (facts.exit === exitCodes_1.remoteRunExitCodes.killed && facts.isKilled)
94
+ reason = 'killed';
95
+ else if (facts.exit === exitCodes_1.remoteRunExitCodes.failed && facts.failedStep === 'deps')
96
+ reason = 'deps-failed';
97
+ return { state: 'done', code: facts.exit, reason };
98
+ }
99
+ if (task === null)
100
+ return facts.isStarted ? { state: 'done', code: exitCodes_1.remoteRunExitCodes.failed, reason: 'lost' } : { state: 'unknown' };
101
+ if (task.state === 'queued')
102
+ return { state: 'queued' };
103
+ if (task.state === 'running')
104
+ return facts.isStarted ? { state: 'running', phase: facts.phase } : { state: 'queued' };
105
+ if (task.state === 'done') {
106
+ // The job process was killed hard: no exit file, so the markers and Pueue's verdict say what it was.
107
+ if (facts.isTimedOut)
108
+ return { state: 'done', code: exitCodes_1.remoteRunExitCodes.timedOut, reason: 'timeout' };
109
+ if (task.result?.kind === 'killed' || facts.isKilled)
110
+ return { state: 'done', code: exitCodes_1.remoteRunExitCodes.killed, reason: 'killed' };
111
+ return { state: 'done', code: exitCodes_1.remoteRunExitCodes.failed, reason: 'lost' };
112
+ }
113
+ return { state: 'unknown' };
114
+ }
115
+ /** @description One short word for a job's state in `ls` and `status`. */
116
+ function describeJobState(outcome) {
117
+ if (outcome.state === 'done') {
118
+ if (outcome.reason === 'timeout')
119
+ return 'timed out';
120
+ if (outcome.reason === 'killed')
121
+ return 'killed';
122
+ if (outcome.reason === 'deps-failed')
123
+ return 'deps failed';
124
+ if (outcome.reason === 'lost')
125
+ return 'lost';
126
+ return outcome.code === 0 ? 'passed' : 'failed';
127
+ }
128
+ if (outcome.state === 'running')
129
+ return outcome.phase === '' || outcome.phase === 'running' ? 'running' : `running (${outcome.phase})`;
130
+ return outcome.state;
131
+ }
132
+ //# sourceMappingURL=jobState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jobState.js","sourceRoot":"","sources":["../../src/remoteRun/jobState.ts"],"names":[],"mappings":";;AAq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AAC;AACvB,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @description The heartbeat lease of a foreground run, in a module of its own so the CLI reads it without loading the bot: a
3
+ * runner kills a job whose caller stopped writing its heartbeat byte for this long — a stock sshd never notices a half-open
4
+ * connection, so this is the only thing that ends an orphaned job.
5
+ *
6
+ * The test seam `CHARNESS_TEST_TIMINGS` (`testTimings.ts`) may only SHORTEN it (key `remoteRunLeaseMs`). The CLI cannot import
7
+ * `testTimings.ts` (its graph reaches the bot), so it reads this one key tolerantly, as the hot supervisor reads its own two; the
8
+ * boot of an instance that carries a bad value is what refuses it by name.
9
+ */
10
+ /** Production lease: no heartbeat for this long → the job is killed. */
11
+ export declare const remoteRunLeaseMs: number;
12
+ /** A shorter lease than this would kill a healthy job on one slow second of the runner's. */
13
+ export declare const remoteRunLeaseMinMs = 3000;
14
+ /** @description The lease in force: the production one, or the test seam's shorter `remoteRunLeaseMs` when it is a whole number of ms within [min, production]. */
15
+ export declare function readRemoteRunLeaseMs(env: NodeJS.ProcessEnv): number;
16
+ /** @description How often the caller writes its heartbeat byte for a lease of `leaseMs`. */
17
+ export declare function getHeartbeatIntervalMs(leaseMs: number): number;
18
+ //# sourceMappingURL=leaseTiming.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"leaseTiming.d.ts","sourceRoot":"","sources":["../../src/remoteRun/leaseTiming.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,wEAAwE;AACxE,eAAO,MAAM,gBAAgB,QAAY,CAAC;AAG1C,6FAA6F;AAC7F,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAIxC,mKAAmK;AACnK,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAYnE;AAED,4FAA4F;AAC5F,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE9D"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ /**
3
+ * @description The heartbeat lease of a foreground run, in a module of its own so the CLI reads it without loading the bot: a
4
+ * runner kills a job whose caller stopped writing its heartbeat byte for this long — a stock sshd never notices a half-open
5
+ * connection, so this is the only thing that ends an orphaned job.
6
+ *
7
+ * The test seam `CHARNESS_TEST_TIMINGS` (`testTimings.ts`) may only SHORTEN it (key `remoteRunLeaseMs`). The CLI cannot import
8
+ * `testTimings.ts` (its graph reaches the bot), so it reads this one key tolerantly, as the hot supervisor reads its own two; the
9
+ * boot of an instance that carries a bad value is what refuses it by name.
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.remoteRunLeaseMinMs = exports.remoteRunLeaseMs = void 0;
13
+ exports.readRemoteRunLeaseMs = readRemoteRunLeaseMs;
14
+ exports.getHeartbeatIntervalMs = getHeartbeatIntervalMs;
15
+ /** Production lease: no heartbeat for this long → the job is killed. */
16
+ exports.remoteRunLeaseMs = 45 * 1000;
17
+ /** The caller beats nine times per lease, so a few lost beats never kill a healthy job (production: every 5 s). */
18
+ const beatsPerLease = 9;
19
+ /** A shorter lease than this would kill a healthy job on one slow second of the runner's. */
20
+ exports.remoteRunLeaseMinMs = 3000;
21
+ const testTimingsVariableName = 'CHARNESS_TEST_TIMINGS';
22
+ /** @description The lease in force: the production one, or the test seam's shorter `remoteRunLeaseMs` when it is a whole number of ms within [min, production]. */
23
+ function readRemoteRunLeaseMs(env) {
24
+ const rawTestTimings = env[testTimingsVariableName];
25
+ if (rawTestTimings === undefined || rawTestTimings.trim() === '')
26
+ return exports.remoteRunLeaseMs;
27
+ let overrides;
28
+ try {
29
+ overrides = JSON.parse(rawTestTimings);
30
+ }
31
+ catch {
32
+ return exports.remoteRunLeaseMs;
33
+ }
34
+ const overrideMs = overrides?.remoteRunLeaseMs;
35
+ if (overrideMs === undefined || !Number.isInteger(overrideMs))
36
+ return exports.remoteRunLeaseMs;
37
+ return overrideMs >= exports.remoteRunLeaseMinMs && overrideMs <= exports.remoteRunLeaseMs ? overrideMs : exports.remoteRunLeaseMs;
38
+ }
39
+ /** @description How often the caller writes its heartbeat byte for a lease of `leaseMs`. */
40
+ function getHeartbeatIntervalMs(leaseMs) {
41
+ return Math.floor(leaseMs / beatsPerLease);
42
+ }
43
+ //# sourceMappingURL=leaseTiming.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"leaseTiming.js","sourceRoot":"","sources":["../../src/remoteRun/leaseTiming.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAYH,oDAYC;AAGD,wDAEC;AA3BD,wEAAwE;AAC3D,QAAA,gBAAgB,GAAG,EAAE,GAAG,IAAI,CAAC;AAC1C,mHAAmH;AACnH,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,6FAA6F;AAChF,QAAA,mBAAmB,GAAG,IAAI,CAAC;AAExC,MAAM,uBAAuB,GAAG,uBAAuB,CAAC;AAExD,mKAAmK;AACnK,SAAgB,oBAAoB,CAAC,GAAsB;IACzD,MAAM,cAAc,GAAG,GAAG,CAAC,uBAAuB,CAAC,CAAC;IACpD,IAAI,cAAc,KAAK,SAAS,IAAI,cAAc,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,wBAAgB,CAAC;IAC1F,IAAI,SAA+C,CAAC;IACpD,IAAI,CAAC;QACH,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IACzC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,wBAAgB,CAAC;IAC1B,CAAC;IACD,MAAM,UAAU,GAAG,SAAS,EAAE,gBAAgB,CAAC;IAC/C,IAAI,UAAU,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC;QAAE,OAAO,wBAAgB,CAAC;IACvF,OAAO,UAAU,IAAI,2BAAmB,IAAI,UAAU,IAAI,wBAAgB,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,wBAAgB,CAAC;AAC7G,CAAC;AAED,4FAA4F;AAC5F,SAAgB,sBAAsB,CAAC,OAAe;IACpD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,aAAa,CAAC,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @description What the commands write and where: the job's output to stdout, remote-run's own lines to stderr prefixed `remote-run: `.
3
+ * The job script writes ITS progress lines (waiting for another job of the project, installing dependencies, a timeout) into the job's
4
+ * log with the same prefix, so the router sends every log line that starts with it to stderr — a command that prints such a line itself
5
+ * only moves it to the other stream.
6
+ */
7
+ export declare const ownLinePrefix = "remote-run: ";
8
+ export interface CliIo {
9
+ stdout: (text: string) => void;
10
+ stderr: (text: string) => void;
11
+ cwd: string;
12
+ env: NodeJS.ProcessEnv;
13
+ homeDir: string;
14
+ }
15
+ /** @description One of remote-run's own lines, to stderr. */
16
+ export declare function sayOwn(io: Pick<CliIo, 'stderr'>, line: string): void;
17
+ export interface JobOutputRouter {
18
+ write: (chunk: string) => void;
19
+ /** The last, unfinished line, if any (a stream that ended without a newline). */
20
+ flush: () => void;
21
+ }
22
+ export declare function createJobOutputRouter(io: Pick<CliIo, 'stdout' | 'stderr'>): JobOutputRouter;
23
+ export interface ExitMarkerFilter {
24
+ write: (chunk: string) => void;
25
+ /** Hand on what is still held back (a stream that ended). */
26
+ flush: () => void;
27
+ /** The code of the last marker seen, or `null` when none arrived. */
28
+ getExitCode: () => number | null;
29
+ }
30
+ /**
31
+ * @description Takes the exit marker `runner.sh exec` prints out of a stderr stream, however the stream is cut into chunks, and hands on
32
+ * everything else at once — a partial marker is held back only until the rest arrives or the stream ends.
33
+ */
34
+ export declare function createExitMarkerFilter(forward: (text: string) => void): ExitMarkerFilter;
35
+ //# sourceMappingURL=output.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/remoteRun/output.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,aAAa,iBAAiB,CAAC;AAE5C,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,6DAA6D;AAC7D,wBAAgB,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAEpE;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,iFAAiF;IACjF,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,GAAG,QAAQ,CAAC,GAAG,eAAe,CAqB3F;AAOD,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,6DAA6D;IAC7D,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,qEAAqE;IACrE,WAAW,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;CAClC;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,gBAAgB,CA2BxF"}