charness 3.11.0 → 3.12.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 (390) hide show
  1. package/CHANGELOG.md +142 -0
  2. package/DEVELOPMENT.md +3 -3
  3. package/README.md +1 -1
  4. package/SETUP.md +6 -5
  5. package/agent-plugin/README.md +15 -6
  6. package/agent-plugin/skills/charness-delegate-claude/SKILL.md +23 -13
  7. package/agent-plugin/skills/charness-delegate-opencode/SKILL.md +10 -6
  8. package/agent-plugin/skills/charness-delivery-loop/SKILL.md +92 -0
  9. package/agent-plugin/skills/charness-orchestration/SKILL.md +116 -0
  10. package/dist/adapters/openCodeAdapter.d.ts +15 -0
  11. package/dist/adapters/openCodeAdapter.d.ts.map +1 -1
  12. package/dist/adapters/openCodeAdapter.js +48 -4
  13. package/dist/adapters/openCodeAdapter.js.map +1 -1
  14. package/dist/agentLogin/agentLogin.d.ts +11 -0
  15. package/dist/agentLogin/agentLogin.d.ts.map +1 -1
  16. package/dist/agentLogin/agentLogin.js +18 -6
  17. package/dist/agentLogin/agentLogin.js.map +1 -1
  18. package/dist/apiErrorRetry.d.ts +5 -0
  19. package/dist/apiErrorRetry.d.ts.map +1 -1
  20. package/dist/apiErrorRetry.js +3 -3
  21. package/dist/apiErrorRetry.js.map +1 -1
  22. package/dist/bot.d.ts.map +1 -1
  23. package/dist/bot.js +158 -20
  24. package/dist/bot.js.map +1 -1
  25. package/dist/cli/claudeProfiles.d.ts +5 -2
  26. package/dist/cli/claudeProfiles.d.ts.map +1 -1
  27. package/dist/cli/claudeProfiles.js +43 -20
  28. package/dist/cli/claudeProfiles.js.map +1 -1
  29. package/dist/cli/claudeProfilesCredit.d.ts +49 -0
  30. package/dist/cli/claudeProfilesCredit.d.ts.map +1 -0
  31. package/dist/cli/claudeProfilesCredit.js +160 -0
  32. package/dist/cli/claudeProfilesCredit.js.map +1 -0
  33. package/dist/cli/flagValue.d.ts +10 -0
  34. package/dist/cli/flagValue.d.ts.map +1 -0
  35. package/dist/cli/flagValue.js +17 -0
  36. package/dist/cli/flagValue.js.map +1 -0
  37. package/dist/connectors/telegram/commands/botSkills.js +1 -1
  38. package/dist/connectors/telegram/commands/claudeAccounts.d.ts +6 -1
  39. package/dist/connectors/telegram/commands/claudeAccounts.d.ts.map +1 -1
  40. package/dist/connectors/telegram/commands/claudeAccounts.js +9 -6
  41. package/dist/connectors/telegram/commands/claudeAccounts.js.map +1 -1
  42. package/dist/connectors/telegram/commands/compaction.d.ts +11 -0
  43. package/dist/connectors/telegram/commands/compaction.d.ts.map +1 -1
  44. package/dist/connectors/telegram/commands/compaction.js +208 -22
  45. package/dist/connectors/telegram/commands/compaction.js.map +1 -1
  46. package/dist/connectors/telegram/commands/runners.d.ts +5 -1
  47. package/dist/connectors/telegram/commands/runners.d.ts.map +1 -1
  48. package/dist/connectors/telegram/commands/runners.js +146 -31
  49. package/dist/connectors/telegram/commands/runners.js.map +1 -1
  50. package/dist/connectors/telegram/runnerPairingMessages.d.ts +2 -7
  51. package/dist/connectors/telegram/runnerPairingMessages.d.ts.map +1 -1
  52. package/dist/connectors/telegram/runnerPairingMessages.js +5 -19
  53. package/dist/connectors/telegram/runnerPairingMessages.js.map +1 -1
  54. package/dist/i18n/de.d.ts.map +1 -1
  55. package/dist/i18n/de.js +52 -8
  56. package/dist/i18n/de.js.map +1 -1
  57. package/dist/i18n/en.d.ts.map +1 -1
  58. package/dist/i18n/en.js +52 -8
  59. package/dist/i18n/en.js.map +1 -1
  60. package/dist/i18n/es.d.ts.map +1 -1
  61. package/dist/i18n/es.js +52 -8
  62. package/dist/i18n/es.js.map +1 -1
  63. package/dist/i18n/fr.d.ts.map +1 -1
  64. package/dist/i18n/fr.js +52 -8
  65. package/dist/i18n/fr.js.map +1 -1
  66. package/dist/i18n/hi.d.ts.map +1 -1
  67. package/dist/i18n/hi.js +52 -8
  68. package/dist/i18n/hi.js.map +1 -1
  69. package/dist/i18n/ja.d.ts.map +1 -1
  70. package/dist/i18n/ja.js +52 -8
  71. package/dist/i18n/ja.js.map +1 -1
  72. package/dist/i18n/ka.d.ts.map +1 -1
  73. package/dist/i18n/ka.js +52 -8
  74. package/dist/i18n/ka.js.map +1 -1
  75. package/dist/i18n/pt.d.ts.map +1 -1
  76. package/dist/i18n/pt.js +52 -8
  77. package/dist/i18n/pt.js.map +1 -1
  78. package/dist/i18n/ru.d.ts.map +1 -1
  79. package/dist/i18n/ru.js +52 -8
  80. package/dist/i18n/ru.js.map +1 -1
  81. package/dist/i18n/uk.d.ts.map +1 -1
  82. package/dist/i18n/uk.js +52 -8
  83. package/dist/i18n/uk.js.map +1 -1
  84. package/dist/i18n/uz.d.ts.map +1 -1
  85. package/dist/i18n/uz.js +52 -8
  86. package/dist/i18n/uz.js.map +1 -1
  87. package/dist/i18n/zh.d.ts.map +1 -1
  88. package/dist/i18n/zh.js +52 -8
  89. package/dist/i18n/zh.js.map +1 -1
  90. package/dist/installManager.d.ts.map +1 -1
  91. package/dist/installManager.js +3 -0
  92. package/dist/installManager.js.map +1 -1
  93. package/dist/instanceLock.d.ts.map +1 -1
  94. package/dist/instanceLock.js +2 -1
  95. package/dist/instanceLock.js.map +1 -1
  96. package/dist/platform/outbound.d.ts +14 -1
  97. package/dist/platform/outbound.d.ts.map +1 -1
  98. package/dist/platform/outbound.js.map +1 -1
  99. package/dist/remoteRun/cleanReport.d.ts +45 -0
  100. package/dist/remoteRun/cleanReport.d.ts.map +1 -0
  101. package/dist/remoteRun/cleanReport.js +84 -0
  102. package/dist/remoteRun/cleanReport.js.map +1 -0
  103. package/dist/remoteRun/cliArgs.d.ts +18 -0
  104. package/dist/remoteRun/cliArgs.d.ts.map +1 -1
  105. package/dist/remoteRun/cliArgs.js +100 -4
  106. package/dist/remoteRun/cliArgs.js.map +1 -1
  107. package/dist/remoteRun/commands.d.ts +30 -1
  108. package/dist/remoteRun/commands.d.ts.map +1 -1
  109. package/dist/remoteRun/commands.js +84 -9
  110. package/dist/remoteRun/commands.js.map +1 -1
  111. package/dist/remoteRun/exitCodes.d.ts +5 -0
  112. package/dist/remoteRun/exitCodes.d.ts.map +1 -1
  113. package/dist/remoteRun/exitCodes.js +6 -1
  114. package/dist/remoteRun/exitCodes.js.map +1 -1
  115. package/dist/remoteRun/foreground.d.ts +6 -0
  116. package/dist/remoteRun/foreground.d.ts.map +1 -1
  117. package/dist/remoteRun/foreground.js +13 -1
  118. package/dist/remoteRun/foreground.js.map +1 -1
  119. package/dist/remoteRun/interrupts.d.ts.map +1 -1
  120. package/dist/remoteRun/interrupts.js +2 -2
  121. package/dist/remoteRun/interrupts.js.map +1 -1
  122. package/dist/remoteRun/jobFiles.d.ts +6 -1
  123. package/dist/remoteRun/jobFiles.d.ts.map +1 -1
  124. package/dist/remoteRun/jobFiles.js +14 -0
  125. package/dist/remoteRun/jobFiles.js.map +1 -1
  126. package/dist/remoteRun/jobId.d.ts +5 -0
  127. package/dist/remoteRun/jobId.d.ts.map +1 -1
  128. package/dist/remoteRun/jobId.js +10 -0
  129. package/dist/remoteRun/jobId.js.map +1 -1
  130. package/dist/remoteRun/jobState.d.ts.map +1 -1
  131. package/dist/remoteRun/jobState.js +3 -2
  132. package/dist/remoteRun/jobState.js.map +1 -1
  133. package/dist/remoteRun/pairedRunners.d.ts +1 -1
  134. package/dist/remoteRun/pairedRunners.d.ts.map +1 -1
  135. package/dist/remoteRun/pairedRunners.js +4 -0
  136. package/dist/remoteRun/pairedRunners.js.map +1 -1
  137. package/dist/remoteRun/pathPatterns.d.ts +1 -1
  138. package/dist/remoteRun/pathPatterns.js +1 -1
  139. package/dist/remoteRun/probe.d.ts +58 -5
  140. package/dist/remoteRun/probe.d.ts.map +1 -1
  141. package/dist/remoteRun/probe.js +107 -11
  142. package/dist/remoteRun/probe.js.map +1 -1
  143. package/dist/remoteRun/probeTiming.d.ts +15 -0
  144. package/dist/remoteRun/probeTiming.d.ts.map +1 -0
  145. package/dist/remoteRun/probeTiming.js +23 -0
  146. package/dist/remoteRun/probeTiming.js.map +1 -0
  147. package/dist/remoteRun/project.d.ts +5 -0
  148. package/dist/remoteRun/project.d.ts.map +1 -1
  149. package/dist/remoteRun/project.js +10 -0
  150. package/dist/remoteRun/project.js.map +1 -1
  151. package/dist/remoteRun/projectConfig.d.ts +8 -1
  152. package/dist/remoteRun/projectConfig.d.ts.map +1 -1
  153. package/dist/remoteRun/projectConfig.js +18 -5
  154. package/dist/remoteRun/projectConfig.js.map +1 -1
  155. package/dist/remoteRun/pruneReport.d.ts +48 -0
  156. package/dist/remoteRun/pruneReport.d.ts.map +1 -0
  157. package/dist/remoteRun/pruneReport.js +80 -0
  158. package/dist/remoteRun/pruneReport.js.map +1 -0
  159. package/dist/remoteRun/remoteRunCli.d.ts +1 -1
  160. package/dist/remoteRun/remoteRunCli.d.ts.map +1 -1
  161. package/dist/remoteRun/remoteRunCli.js +20 -0
  162. package/dist/remoteRun/remoteRunCli.js.map +1 -1
  163. package/dist/remoteRun/runnerClient.d.ts +10 -0
  164. package/dist/remoteRun/runnerClient.d.ts.map +1 -1
  165. package/dist/remoteRun/runnerClient.js +19 -5
  166. package/dist/remoteRun/runnerClient.js.map +1 -1
  167. package/dist/remoteRun/runnerWait.d.ts.map +1 -1
  168. package/dist/remoteRun/runnerWait.js +2 -1
  169. package/dist/remoteRun/runnerWait.js.map +1 -1
  170. package/dist/remoteRun/runners.d.ts +48 -7
  171. package/dist/remoteRun/runners.d.ts.map +1 -1
  172. package/dist/remoteRun/runners.js +105 -40
  173. package/dist/remoteRun/runners.js.map +1 -1
  174. package/dist/remoteRun/runnersConfig.d.ts +24 -0
  175. package/dist/remoteRun/runnersConfig.d.ts.map +1 -1
  176. package/dist/remoteRun/runnersConfig.js +29 -2
  177. package/dist/remoteRun/runnersConfig.js.map +1 -1
  178. package/dist/remoteRun/ssh.d.ts +3 -3
  179. package/dist/remoteRun/ssh.d.ts.map +1 -1
  180. package/dist/remoteRun/ssh.js +19 -5
  181. package/dist/remoteRun/ssh.js.map +1 -1
  182. package/dist/remoteRun/submit.d.ts +1 -1
  183. package/dist/remoteRun/submit.d.ts.map +1 -1
  184. package/dist/remoteRun/submit.js +30 -2
  185. package/dist/remoteRun/submit.js.map +1 -1
  186. package/dist/runnerUtility/adminService.d.ts.map +1 -1
  187. package/dist/runnerUtility/adminService.js +5 -5
  188. package/dist/runnerUtility/adminService.js.map +1 -1
  189. package/dist/runnerUtility/appInstall.d.ts +9 -0
  190. package/dist/runnerUtility/appInstall.d.ts.map +1 -1
  191. package/dist/runnerUtility/appInstall.js +12 -2
  192. package/dist/runnerUtility/appInstall.js.map +1 -1
  193. package/dist/runnerUtility/execEnv.d.ts +1 -1
  194. package/dist/runnerUtility/execEnv.d.ts.map +1 -1
  195. package/dist/runnerUtility/execEnv.js +23 -5
  196. package/dist/runnerUtility/execEnv.js.map +1 -1
  197. package/dist/runnerUtility/guiAgentHeal.d.ts +3 -3
  198. package/dist/runnerUtility/guiAgentHeal.d.ts.map +1 -1
  199. package/dist/runnerUtility/guiAgentHeal.js +4 -2
  200. package/dist/runnerUtility/guiAgentHeal.js.map +1 -1
  201. package/dist/runnerUtility/homeFolders.d.ts +1 -0
  202. package/dist/runnerUtility/homeFolders.d.ts.map +1 -1
  203. package/dist/runnerUtility/homeFolders.js +2 -1
  204. package/dist/runnerUtility/homeFolders.js.map +1 -1
  205. package/dist/runnerUtility/iosCheck.d.ts +2 -0
  206. package/dist/runnerUtility/iosCheck.d.ts.map +1 -1
  207. package/dist/runnerUtility/iosCheck.js +12 -3
  208. package/dist/runnerUtility/iosCheck.js.map +1 -1
  209. package/dist/runnerUtility/keepAwake.d.ts +47 -10
  210. package/dist/runnerUtility/keepAwake.d.ts.map +1 -1
  211. package/dist/runnerUtility/keepAwake.js +108 -31
  212. package/dist/runnerUtility/keepAwake.js.map +1 -1
  213. package/dist/runnerUtility/launcher.d.ts +4 -0
  214. package/dist/runnerUtility/launcher.d.ts.map +1 -1
  215. package/dist/runnerUtility/launcher.js +31 -13
  216. package/dist/runnerUtility/launcher.js.map +1 -1
  217. package/dist/runnerUtility/linkLoop.d.ts +4 -0
  218. package/dist/runnerUtility/linkLoop.d.ts.map +1 -1
  219. package/dist/runnerUtility/linkLoop.js +15 -6
  220. package/dist/runnerUtility/linkLoop.js.map +1 -1
  221. package/dist/runnerUtility/managedNode.d.ts +84 -0
  222. package/dist/runnerUtility/managedNode.d.ts.map +1 -0
  223. package/dist/runnerUtility/managedNode.js +165 -0
  224. package/dist/runnerUtility/managedNode.js.map +1 -0
  225. package/dist/runnerUtility/nodeOnPath.d.ts +10 -0
  226. package/dist/runnerUtility/nodeOnPath.d.ts.map +1 -0
  227. package/dist/runnerUtility/nodeOnPath.js +49 -0
  228. package/dist/runnerUtility/nodeOnPath.js.map +1 -0
  229. package/dist/runnerUtility/nodeUpkeep.d.ts +140 -0
  230. package/dist/runnerUtility/nodeUpkeep.d.ts.map +1 -0
  231. package/dist/runnerUtility/nodeUpkeep.js +348 -0
  232. package/dist/runnerUtility/nodeUpkeep.js.map +1 -0
  233. package/dist/runnerUtility/nodeUpkeepTiming.d.ts +14 -0
  234. package/dist/runnerUtility/nodeUpkeepTiming.d.ts.map +1 -0
  235. package/dist/runnerUtility/nodeUpkeepTiming.js +21 -0
  236. package/dist/runnerUtility/nodeUpkeepTiming.js.map +1 -0
  237. package/dist/runnerUtility/packageManagerShims.d.ts +10 -0
  238. package/dist/runnerUtility/packageManagerShims.d.ts.map +1 -1
  239. package/dist/runnerUtility/packageManagerShims.js +67 -3
  240. package/dist/runnerUtility/packageManagerShims.js.map +1 -1
  241. package/dist/runnerUtility/pueueDaemon.d.ts +73 -8
  242. package/dist/runnerUtility/pueueDaemon.d.ts.map +1 -1
  243. package/dist/runnerUtility/pueueDaemon.js +90 -15
  244. package/dist/runnerUtility/pueueDaemon.js.map +1 -1
  245. package/dist/runnerUtility/runnerCommands.d.ts +7 -1
  246. package/dist/runnerUtility/runnerCommands.d.ts.map +1 -1
  247. package/dist/runnerUtility/runnerCommands.js +119 -16
  248. package/dist/runnerUtility/runnerCommands.js.map +1 -1
  249. package/dist/runnerUtility/runnerHome.d.ts +34 -0
  250. package/dist/runnerUtility/runnerHome.d.ts.map +1 -1
  251. package/dist/runnerUtility/runnerHome.js +17 -3
  252. package/dist/runnerUtility/runnerHome.js.map +1 -1
  253. package/dist/runnerUtility/serviceCommon.d.ts +2 -0
  254. package/dist/runnerUtility/serviceCommon.d.ts.map +1 -1
  255. package/dist/runnerUtility/serviceCommon.js +3 -1
  256. package/dist/runnerUtility/serviceCommon.js.map +1 -1
  257. package/dist/runnerUtility/serviceManager.d.ts.map +1 -1
  258. package/dist/runnerUtility/serviceManager.js +7 -2
  259. package/dist/runnerUtility/serviceManager.js.map +1 -1
  260. package/dist/runnerUtility/simctlGuard.d.ts +38 -0
  261. package/dist/runnerUtility/simctlGuard.d.ts.map +1 -0
  262. package/dist/runnerUtility/simctlGuard.js +166 -0
  263. package/dist/runnerUtility/simctlGuard.js.map +1 -0
  264. package/dist/runners/bootstrapLine.d.ts +3 -4
  265. package/dist/runners/bootstrapLine.d.ts.map +1 -1
  266. package/dist/runners/bootstrapLine.js +108 -83
  267. package/dist/runners/bootstrapLine.js.map +1 -1
  268. package/dist/runners/hubPackage.d.ts +1 -1
  269. package/dist/runners/hubPackage.d.ts.map +1 -1
  270. package/dist/runners/hubPackage.js +5 -6
  271. package/dist/runners/hubPackage.js.map +1 -1
  272. package/dist/runners/hubPairing.d.ts +19 -0
  273. package/dist/runners/hubPairing.d.ts.map +1 -1
  274. package/dist/runners/hubPairing.js +38 -0
  275. package/dist/runners/hubPairing.js.map +1 -1
  276. package/dist/runners/hubRegistry.d.ts +8 -0
  277. package/dist/runners/hubRegistry.d.ts.map +1 -1
  278. package/dist/runners/hubRegistry.js +6 -0
  279. package/dist/runners/hubRegistry.js.map +1 -1
  280. package/dist/runners/pairCode.d.ts +34 -3
  281. package/dist/runners/pairCode.d.ts.map +1 -1
  282. package/dist/runners/pairCode.js +65 -13
  283. package/dist/runners/pairCode.js.map +1 -1
  284. package/dist/runners/runnerGroups.d.ts +22 -0
  285. package/dist/runners/runnerGroups.d.ts.map +1 -0
  286. package/dist/runners/runnerGroups.js +41 -0
  287. package/dist/runners/runnerGroups.js.map +1 -0
  288. package/dist/runners/runnersCli.d.ts +5 -2
  289. package/dist/runners/runnersCli.d.ts.map +1 -1
  290. package/dist/runners/runnersCli.js +59 -9
  291. package/dist/runners/runnersCli.js.map +1 -1
  292. package/dist/runners/runnersList.d.ts +1 -1
  293. package/dist/runners/runnersList.d.ts.map +1 -1
  294. package/dist/runners/runnersList.js +3 -1
  295. package/dist/runners/runnersList.js.map +1 -1
  296. package/dist/runners/runnersOverview.d.ts.map +1 -1
  297. package/dist/runners/runnersOverview.js +8 -4
  298. package/dist/runners/runnersOverview.js.map +1 -1
  299. package/dist/scheduler/checkStatus.d.ts +2 -0
  300. package/dist/scheduler/checkStatus.d.ts.map +1 -1
  301. package/dist/scheduler/checkStatus.js +5 -4
  302. package/dist/scheduler/checkStatus.js.map +1 -1
  303. package/dist/scheduler/delivery.d.ts +2 -1
  304. package/dist/scheduler/delivery.d.ts.map +1 -1
  305. package/dist/scheduler/delivery.js +5 -1
  306. package/dist/scheduler/delivery.js.map +1 -1
  307. package/dist/scheduler/mcpSurface.d.ts +7 -3
  308. package/dist/scheduler/mcpSurface.d.ts.map +1 -1
  309. package/dist/scheduler/mcpSurface.js +48 -22
  310. package/dist/scheduler/mcpSurface.js.map +1 -1
  311. package/dist/scheduler/workerWatch.d.ts +33 -10
  312. package/dist/scheduler/workerWatch.d.ts.map +1 -1
  313. package/dist/scheduler/workerWatch.js +37 -11
  314. package/dist/scheduler/workerWatch.js.map +1 -1
  315. package/dist/state.d.ts +95 -2
  316. package/dist/state.d.ts.map +1 -1
  317. package/dist/state.js +145 -7
  318. package/dist/state.js.map +1 -1
  319. package/dist/testTimings.d.ts +6 -2
  320. package/dist/testTimings.d.ts.map +1 -1
  321. package/dist/testTimings.js +12 -1
  322. package/dist/testTimings.js.map +1 -1
  323. package/dist/types.d.ts +2 -1
  324. package/dist/types.d.ts.map +1 -1
  325. package/dist/utils/agentPlugin.d.ts +2 -1
  326. package/dist/utils/agentPlugin.d.ts.map +1 -1
  327. package/dist/utils/agentPlugin.js +2 -1
  328. package/dist/utils/agentPlugin.js.map +1 -1
  329. package/dist/utils/botSkills.d.ts +1 -1
  330. package/dist/utils/claudeApiAgentStop.d.ts +64 -0
  331. package/dist/utils/claudeApiAgentStop.d.ts.map +1 -0
  332. package/dist/utils/claudeApiAgentStop.js +85 -0
  333. package/dist/utils/claudeApiAgentStop.js.map +1 -0
  334. package/dist/utils/claudeApiCredit.d.ts +168 -0
  335. package/dist/utils/claudeApiCredit.d.ts.map +1 -0
  336. package/dist/utils/claudeApiCredit.js +260 -0
  337. package/dist/utils/claudeApiCredit.js.map +1 -0
  338. package/dist/utils/claudeApiCreditRecheck.d.ts +120 -0
  339. package/dist/utils/claudeApiCreditRecheck.d.ts.map +1 -0
  340. package/dist/utils/claudeApiCreditRecheck.js +173 -0
  341. package/dist/utils/claudeApiCreditRecheck.js.map +1 -0
  342. package/dist/utils/claudeCompactHook.d.ts +18 -10
  343. package/dist/utils/claudeCompactHook.d.ts.map +1 -1
  344. package/dist/utils/claudeCompactHook.js +35 -14
  345. package/dist/utils/claudeCompactHook.js.map +1 -1
  346. package/dist/utils/claudeProfileUsageLines.d.ts +13 -1
  347. package/dist/utils/claudeProfileUsageLines.d.ts.map +1 -1
  348. package/dist/utils/claudeProfileUsageLines.js +75 -4
  349. package/dist/utils/claudeProfileUsageLines.js.map +1 -1
  350. package/dist/utils/claudeProfileUsageViews.d.ts +46 -0
  351. package/dist/utils/claudeProfileUsageViews.d.ts.map +1 -0
  352. package/dist/utils/claudeProfileUsageViews.js +114 -0
  353. package/dist/utils/claudeProfileUsageViews.js.map +1 -0
  354. package/dist/utils/claudeProfiles.d.ts +15 -0
  355. package/dist/utils/claudeProfiles.d.ts.map +1 -1
  356. package/dist/utils/claudeProfiles.js +54 -0
  357. package/dist/utils/claudeProfiles.js.map +1 -1
  358. package/dist/utils/claudeUsage.d.ts +94 -36
  359. package/dist/utils/claudeUsage.d.ts.map +1 -1
  360. package/dist/utils/claudeUsage.js +134 -60
  361. package/dist/utils/claudeUsage.js.map +1 -1
  362. package/dist/utils/compactOnIdle.d.ts +140 -15
  363. package/dist/utils/compactOnIdle.d.ts.map +1 -1
  364. package/dist/utils/compactOnIdle.js +209 -23
  365. package/dist/utils/compactOnIdle.js.map +1 -1
  366. package/dist/utils/compactSelfReviewFlags.d.ts +50 -0
  367. package/dist/utils/compactSelfReviewFlags.d.ts.map +1 -0
  368. package/dist/utils/compactSelfReviewFlags.js +120 -0
  369. package/dist/utils/compactSelfReviewFlags.js.map +1 -0
  370. package/dist/utils/fallbackChain.d.ts +18 -7
  371. package/dist/utils/fallbackChain.d.ts.map +1 -1
  372. package/dist/utils/fallbackChain.js +28 -12
  373. package/dist/utils/fallbackChain.js.map +1 -1
  374. package/dist/utils/openCodeCompactPlugin.d.ts +28 -7
  375. package/dist/utils/openCodeCompactPlugin.d.ts.map +1 -1
  376. package/dist/utils/openCodeCompactPlugin.js +80 -15
  377. package/dist/utils/openCodeCompactPlugin.js.map +1 -1
  378. package/dist/utils/runnersScreenPlan.d.ts +51 -20
  379. package/dist/utils/runnersScreenPlan.d.ts.map +1 -1
  380. package/dist/utils/runnersScreenPlan.js +143 -28
  381. package/dist/utils/runnersScreenPlan.js.map +1 -1
  382. package/dist/utils/streamedCompactionSummary.d.ts +65 -0
  383. package/dist/utils/streamedCompactionSummary.d.ts.map +1 -0
  384. package/dist/utils/streamedCompactionSummary.js +108 -0
  385. package/dist/utils/streamedCompactionSummary.js.map +1 -0
  386. package/package.json +2 -2
  387. package/remoteRun/ensureNode.sh +288 -0
  388. package/remoteRun/runner.sh +2252 -115
  389. package/agent-plugin/skills/charness-manager/SKILL.md +0 -157
  390. package/remoteRun/pickNode.sh +0 -65
package/dist/bot.js CHANGED
@@ -157,6 +157,8 @@ const adoptedToolList_1 = require("./utils/adoptedToolList");
157
157
  const lostWork_1 = require("./utils/lostWork");
158
158
  const jsonStreamPendingWork_1 = require("./utils/jsonStreamPendingWork");
159
159
  const compactOnIdle_1 = require("./utils/compactOnIdle");
160
+ const compactSelfReviewFlags_1 = require("./utils/compactSelfReviewFlags");
161
+ const openCodeCompactPlugin_1 = require("./utils/openCodeCompactPlugin");
160
162
  const fileSendService_1 = require("./utils/fileSendService");
161
163
  const messageSendService_1 = require("./utils/messageSendService");
162
164
  const fileSendGateway_1 = require("./connectors/telegram/fileSendGateway");
@@ -251,6 +253,7 @@ const hubAddress_1 = require("./runners/hubAddress");
251
253
  const hubAddressCandidates_1 = require("./runners/hubAddressCandidates");
252
254
  const hubPaths_1 = require("./runners/hubPaths");
253
255
  const hubPairing_1 = require("./runners/hubPairing");
256
+ const runnerGroups_1 = require("./runners/runnerGroups");
254
257
  const runnersOverview_1 = require("./runners/runnersOverview");
255
258
  const ssh_1 = require("./remoteRun/ssh");
256
259
  const claudeAccounts_1 = require("./connectors/telegram/commands/claudeAccounts");
@@ -275,6 +278,10 @@ const backendSwitchPlan_1 = require("./utils/backendSwitchPlan");
275
278
  const selfUpdate_1 = require("./connectors/telegram/commands/selfUpdate");
276
279
  const stt_1 = require("./connectors/telegram/commands/stt");
277
280
  const claudeApiSpend_1 = require("./utils/claudeApiSpend");
281
+ const claudeProfileUsageViews_1 = require("./utils/claudeProfileUsageViews");
282
+ const claudeApiAgentStop_1 = require("./utils/claudeApiAgentStop");
283
+ const claudeApiCredit_1 = require("./utils/claudeApiCredit");
284
+ const claudeApiCreditRecheck_1 = require("./utils/claudeApiCreditRecheck");
278
285
  const claudeProfileUsageLines_1 = require("./utils/claudeProfileUsageLines");
279
286
  const resolveBinary_1 = require("./utils/resolveBinary");
280
287
  const runnerSummary_1 = require("./remoteRun/runnerSummary");
@@ -2202,6 +2209,7 @@ const { cancelPendingLogin, checkIsAuthLoginAwaitingCode, cancelClaudeAuthLogin,
2202
2209
  execFileAsync,
2203
2210
  onClaudeProfileAuthStatus: (key, profile, status) => claudeProfileAuthStatusSink?.(key, profile, status) ?? Promise.resolve(),
2204
2211
  onClaudeProfileApiKey: (key, profile, apiKey) => claudeProfileApiKeySink?.(key, profile, apiKey) ?? Promise.resolve((0, i18n_1.t)('account.apiKeyNoDirectory', { name: profile.name })),
2212
+ checkIsProfileMissingFromLimitsList: (name) => (0, fallbackChain_1.checkIsClaudeProfileMissingFromChain)(state.getFallbackChain(), name),
2205
2213
  });
2206
2214
  /**
2207
2215
  * @description Buffers prompts typed while an agent session is still booting so
@@ -4418,6 +4426,8 @@ function getPerTurnRefusal(key) {
4418
4426
  */
4419
4427
  async function persistSessionStart(key, adapter) {
4420
4428
  await (0, persistAdapterSessionIds_1.persistAdapterSessionIds)(key, adapter, state);
4429
+ // The session id is new or changed: the hook's and the plugin's flags for it (`/compact_self_review`) are due.
4430
+ syncThreadCompactSelfReviewFlags(key);
4421
4431
  if ((0, adapterNames_1.checkIsJsonStreamBackend)(adapter.name) && botMcpToolDigestReader) {
4422
4432
  await state.setAgentMcpToolDigest(key, botMcpToolDigestReader(key));
4423
4433
  }
@@ -5175,7 +5185,7 @@ const botCore = {
5175
5185
  cancelConversationRequest,
5176
5186
  wakeSleepingSession,
5177
5187
  };
5178
- const { checkIsThreadCompacting, noteThreadActivity, noteThreadUserActivity, markThreadTurnProducedOutput, clearThreadCompaction, rearmThreadIdleTimer, armDeferredCompaction, checkIsDeferredCompactionArmed, threadsCompacting, answerReAskedQuestionByNumber, reAskInterruptedQuestion, restoreReAskedQuestion, closeSavedReAskedQuestion, closeReAskedQuestion, registerCompactionCommands, registerCompactionCallbacks, } = (0, compaction_1.createCompaction)({
5188
+ const { checkIsThreadCompacting, noteThreadActivity, noteThreadUserActivity, markThreadTurnProducedOutput, postOwnCompactionInstructionGaps, routeStreamedCompactionSummaryTail, clearThreadCompaction, rearmThreadIdleTimer, armDeferredCompaction, checkIsDeferredCompactionArmed, threadsCompacting, answerReAskedQuestionByNumber, reAskInterruptedQuestion, restoreReAskedQuestion, closeSavedReAskedQuestion, closeReAskedQuestion, syncThreadCompactSelfReviewFlags, syncAllCompactSelfReviewFlags, registerCompactionCommands, registerCompactionCallbacks, } = (0, compaction_1.createCompaction)({
5179
5189
  ...botCore,
5180
5190
  startTypingLoader,
5181
5191
  forwardPromptToAgent: async (key, adapter, text) => { await forwardPromptToAgent(key, adapter, text); },
@@ -5194,6 +5204,7 @@ const { checkIsThreadCompacting, noteThreadActivity, noteThreadUserActivity, mar
5194
5204
  checkIsStarting: (key) => startupPromptBuffer.checkIsStarting((0, sessionKey_1.keyToString)(key)),
5195
5205
  closeOrphanQuestionMessage,
5196
5206
  notePersonActivity,
5207
+ compactSelfReviewFlagDirs: (0, compactSelfReviewFlags_1.getCompactSelfReviewFlagDirs)((0, state_1.resolveDataDir)(), (0, openCodeCompactPlugin_1.resolveOpenCodeGlobalPluginDir)(process.env)),
5197
5208
  });
5198
5209
  /**
5199
5210
  * @description True iff the neutral router owns `name`, i.e. a `/name` message
@@ -6700,11 +6711,13 @@ const { registerRunnersCommands, registerRunnersCallbacks, handleRunnersAddressT
6700
6711
  getGeneralKey: () => getOperatorGeneralKey(),
6701
6712
  pinMessage: (key, messageId) => pinMessageQuiet(key, messageId, { disableNotification: false }),
6702
6713
  sweepExpiredCodes: async (nowMs) => { await (0, hubPairing_1.sweepExpiredPairings)(runnersHub, nowMs); },
6714
+ applyGroups: (runner) => (0, runnerGroups_1.applyRunnerGroups)(runnersHub, runner, runnersCacheDir),
6703
6715
  readRunnerHost: (0, instanceSettings_1.createRunnerHostReader)(() => (0, instanceSettings_1.getInstanceSettingsPath)(), (line) => console.error(line)),
6704
6716
  saveRunnerHost: (address) => (0, instanceSettings_1.saveInstanceSettingsChange)((0, instanceSettings_1.getInstanceSettingsPath)(), { runnerHost: address }),
6705
6717
  getBotLabel: () => (bot.botInfo?.username === undefined ? os.hostname() : `@${bot.botInfo.username}`),
6706
6718
  readOverview: (nowMs) => (0, runnersOverview_1.readRunnersOverview)(runnersHub, runnersCacheDir, nowMs),
6707
- probeOverview: (overview, nowMs) => (0, runnersOverview_1.probeRunnersOverview)(runnersHub, overview, runnersCacheDir, nowMs),
6719
+ // The 20 s deadline of the live probe, which the test seam may shorten (a flow that must see a BUSY machine cannot wait it out).
6720
+ probeOverview: (overview, nowMs) => (0, runnersOverview_1.probeRunnersOverview)(runnersHub, overview, runnersCacheDir, nowMs, ENV.testTimings.remoteRunProbeDeadlineMs),
6708
6721
  listAddressCandidates: () => (0, hubAddressCandidates_1.listPublicAddressCandidates)(),
6709
6722
  scanHostKey: hubAddress_1.scanHostKey,
6710
6723
  ensureGateWrapper: () => { (0, gateWrapper_1.ensureGateWrapper)(runnersHub); },
@@ -6822,6 +6835,56 @@ const claudeUsageRefresher = (0, claudeUsageRefresher_1.createClaudeUsageRefresh
6822
6835
  refreshOpenCode: (options) => openCodeUsagePoller.refreshAll(options),
6823
6836
  markOpenCodeStale: (reason) => openCodeUsagePoller.markAllStale(reason),
6824
6837
  });
6838
+ /**
6839
+ * What the daily recheck of a used-up API credit (`utils/claudeApiCreditRecheck.ts`) reads and does in the bot: the profiles
6840
+ * with their marks (after the operator's newer figures have ended the marks they supersede), their own keys, and the state it
6841
+ * writes — the attempt BEFORE the request, the renewal after an answer.
6842
+ */
6843
+ const claudeApiCreditRecheckPorts = {
6844
+ nowMs: () => Date.now(),
6845
+ intervalMs: ENV.testTimings.creditRecheckIntervalMs ?? claudeApiCreditRecheck_1.claudeApiCreditRecheckIntervalMs,
6846
+ listProfiles: () => {
6847
+ syncClaudeApiCreditAnchors();
6848
+ return Object.entries(state.getAllClaudeProfileInfos()).map(([name, record]) => ({
6849
+ name,
6850
+ billing: record.billing ?? null,
6851
+ // The refusal the operator acted on awaits its answer too: the account is in use again, but nothing has confirmed the credit.
6852
+ creditExhaustedAt: record.creditExhaustedAt ?? record.creditUnconfirmedSince ?? null,
6853
+ creditRecheckedAt: record.creditRecheckedAt ?? null,
6854
+ }));
6855
+ },
6856
+ readApiKey: (name) => {
6857
+ if (name === claudeProfiles_1.defaultClaudeProfileName)
6858
+ return (0, claudeProfiles_1.readDefaultClaudeProfileApiKey)(state.getClaudeProfileInfo(name)?.isConsoleLoginKey === true);
6859
+ const configDir = (0, claudeProfiles_1.resolveClaudeProfileDir)((0, state_1.resolveDataDir)(), name);
6860
+ return configDir === null ? null : (0, claudeProfiles_1.readClaudeProfileApiKey)(configDir);
6861
+ },
6862
+ probe: (apiKey) => (0, claudeApiCreditRecheck_1.probeClaudeApiCredit)(apiKey),
6863
+ markRechecked: (name, atIso) => state.setClaudeProfileCreditRechecked(name, atIso),
6864
+ onRenewed: (name, atIso) => {
6865
+ if (!state.setClaudeProfileCreditRenewed(name, atIso))
6866
+ console.log(`[credit] ${name}: a refusal came in while the recheck was running, so the credit is not marked renewed`);
6867
+ },
6868
+ log: (line) => console.log(line),
6869
+ warn: (line) => console.warn(line),
6870
+ };
6871
+ /**
6872
+ * What the check of an agent's stop report on an API account (`utils/claudeApiAgentStop.ts`) reads and does in the bot: the same
6873
+ * key, attempt record and probe as the daily recheck above, a probe with a timeout of its own, and — instead of an unverified
6874
+ * used-up mark — a mark only on a refusal for the balance, an hour off AGENTS (their own field, never the topics' limit mark) otherwise.
6875
+ */
6876
+ const claudeApiAgentStopPorts = {
6877
+ nowMs: () => Date.now(),
6878
+ readApiKey: (name) => claudeApiCreditRecheckPorts.readApiKey(name),
6879
+ probe: (apiKey, timeoutMs) => (0, claudeApiCreditRecheck_1.probeClaudeApiCredit)(apiKey, { timeoutMs }),
6880
+ markRechecked: (name, atIso) => state.setClaudeProfileCreditRechecked(name, atIso),
6881
+ markUsedUp: (name, atIso) => state.setClaudeProfileCreditExhausted(name, atIso),
6882
+ holdOff: (name, untilIso) => state.setClaudeProfileAgentHoldUntil(name, untilIso),
6883
+ checkIsRenewalAwaited: (name) => state.getClaudeProfileInfo(name)?.creditUnconfirmedSince !== undefined,
6884
+ onRenewed: (name, atIso) => claudeApiCreditRecheckPorts.onRenewed(name, atIso),
6885
+ log: (line) => console.log(line),
6886
+ warn: (line) => console.warn(line),
6887
+ };
6825
6888
  /** The profile that owns a config directory (`null` = default); `null` for a directory outside the profiles root. */
6826
6889
  function resolveClaudeProfileNameForDir(configDir) {
6827
6890
  if (configDir === null)
@@ -6861,14 +6924,52 @@ function onClaudeTurnCost(key, configDir, report) {
6861
6924
  const name = resolveClaudeProfileNameForDir(configDir);
6862
6925
  if (name === null)
6863
6926
  return;
6927
+ // Read first: a figure newer than the account's used-up evidence ends it before this turn is judged against it.
6928
+ const creditAnchors = syncClaudeApiCreditAnchors();
6864
6929
  const info = state.getClaudeProfileInfo(name);
6930
+ // The refusal the operator acted on (picked the account again) is still evidence: the turn that now goes through renews.
6865
6931
  const outcome = (0, claudeApiSpend_1.getClaudeTurnCostOutcome)({
6866
- billing: info?.billing ?? null, isCreditExhausted: info?.creditExhaustedAt !== undefined, isError: report.isError, turnCostUsd,
6932
+ billing: info?.billing ?? null,
6933
+ isCreditExhausted: info?.creditExhaustedAt !== undefined || info?.creditUnconfirmedSince !== undefined,
6934
+ isError: report.isError,
6935
+ turnCostUsd,
6867
6936
  });
6868
- if (outcome.isCreditMarkCleared)
6869
- state.setClaudeProfileCreditExhausted(name, null);
6870
- if (outcome.spendUsd !== null)
6871
- state.setClaudeProfileApiSpend(name, (0, claudeApiSpend_1.addClaudeApiSpend)(info?.apiSpend, outcome.spendUsd, new Date().toISOString()));
6937
+ const nowIso = new Date().toISOString();
6938
+ // A billed turn that goes through on an API account marked used up — or one the operator picked again after the refusal — is
6939
+ // the proof the daily recheck looks for: the credit is back, and the account's spend counter starts over from this turn.
6940
+ if (outcome.isCreditMarkCleared && info?.billing === 'api')
6941
+ state.setClaudeProfileCreditRenewed(name, nowIso);
6942
+ else if (outcome.isCreditMarkCleared)
6943
+ state.liftClaudeProfileCreditExhaustion(name);
6944
+ if (outcome.spendUsd === null)
6945
+ return;
6946
+ const apiSpend = (0, claudeApiSpend_1.addClaudeApiSpend)(info?.apiSpend, outcome.spendUsd, nowIso);
6947
+ state.setClaudeProfileApiSpend(name, apiSpend);
6948
+ // The same spend also counts in the account's credit period (`utils/claudeApiCredit.ts`), read AFTER a renewal above.
6949
+ const period = (0, claudeApiCredit_1.getClaudeApiCreditPeriod)({ anchor: creditAnchors[name], renewedAt: state.getClaudeProfileInfo(name)?.creditRenewedAt, apiSpend });
6950
+ const creditSpend = (0, claudeApiCredit_1.addClaudeApiCreditSpend)(state.getClaudeProfileInfo(name)?.creditSpend, period, outcome.spendUsd);
6951
+ if (creditSpend)
6952
+ state.setClaudeProfileCreditSpend(name, creditSpend);
6953
+ }
6954
+ /**
6955
+ * Read the operator's credit figures (`utils/claudeApiCredit.ts`) AND settle what they supersede: a figure newer than an
6956
+ * account's used-up evidence (the mark, or the refusal the operator acted on) ends that evidence — the operator saying there is
6957
+ * money is the signal a billed turn going through is — so the stored mark, the fallback chain and the screens never contradict
6958
+ * the figure. It writes state: a call whose result is dropped is meant (a read path that must see the settled marks).
6959
+ */
6960
+ function syncClaudeApiCreditAnchors() {
6961
+ const anchors = (0, claudeApiCredit_1.readClaudeApiCreditAnchors)((0, state_1.resolveDataDir)());
6962
+ for (const name of (0, claudeApiCredit_1.listProfilesWithSupersededCreditEvidence)(state.getAllClaudeProfileInfos(), anchors))
6963
+ state.clearClaudeProfileCreditEvidence(name);
6964
+ return anchors;
6965
+ }
6966
+ /** Every Claude profile's usage view as the bot knows it now: its record plus the operator's credit figures. */
6967
+ function getClaudeProfileUsageViews() {
6968
+ return (0, claudeProfileUsageViews_1.buildClaudeProfileUsageViews)({ dataDir: (0, state_1.resolveDataDir)(), records: state.getAllClaudeProfileInfos(), creditAnchors: syncClaudeApiCreditAnchors() });
6969
+ }
6970
+ /** One profile's usage view — the very one `/limits` renders, for the rows of `/accounts`. */
6971
+ function getClaudeProfileUsageView(name) {
6972
+ return (0, claudeProfileUsageViews_1.buildClaudeProfileUsageView)({ dataDir: (0, state_1.resolveDataDir)(), name, record: state.getClaudeProfileInfo(name), creditAnchor: syncClaudeApiCreditAnchors()[name] });
6872
6973
  }
6873
6974
  /** The model a topic's Claude session runs (or last ran), for the usage ranking's choice of windows. */
6874
6975
  function getThreadClaudeModel(key) {
@@ -6876,6 +6977,7 @@ function getThreadClaudeModel(key) {
6876
6977
  }
6877
6978
  /** What `/status` names of a Claude profile: its last probed sign-in and email, and its limit mark (none until probed). */
6878
6979
  function readStatusAccountSource(name) {
6980
+ syncClaudeApiCreditAnchors();
6879
6981
  const info = state.getClaudeProfileInfo(name);
6880
6982
  return {
6881
6983
  name, email: info?.email ?? null, loggedIn: info?.loggedIn, limitedUntil: info?.limitedUntil ?? null,
@@ -6907,7 +7009,7 @@ async function detectFallbackOptions() {
6907
7009
  console.warn('[fallback] the OpenCode catalog is unavailable:', e instanceof Error ? e.message : e);
6908
7010
  }
6909
7011
  return {
6910
- claudeProfiles: (0, claudeUsage_1.buildClaudeProfileUsageViews)({ dataDir: (0, state_1.resolveDataDir)(), records: state.getAllClaudeProfileInfos() }),
7012
+ claudeProfiles: getClaudeProfileUsageViews(),
6911
7013
  openCodeModels,
6912
7014
  recentOpenCodeModels: (0, openCodeAdapter_1.listSavedOpenCodeModelLabels)().reverse(),
6913
7015
  openCodeLimits: state.getOpenCodeModelLimits(),
@@ -6974,6 +7076,7 @@ function getConversationAccountState(key) {
6974
7076
  const checkIsFuture = (instant) => instant !== undefined && Date.parse(instant) > nowMs;
6975
7077
  if (position.backend === 'opencode')
6976
7078
  return { isLimited: checkIsFuture(state.getOpenCodeModelLimitedUntil((0, fallbackChain_1.buildOpenCodeModelLabel)(position))), isApiBilled: false };
7079
+ syncClaudeApiCreditAnchors();
6977
7080
  const info = state.getClaudeProfileInfo(position.profile);
6978
7081
  return { isLimited: checkIsFuture(info?.limitedUntil) || info?.creditExhaustedAt !== undefined, isApiBilled: info?.billing === 'api' };
6979
7082
  }
@@ -7403,9 +7506,10 @@ function buildBackendSwitchTargetOfRung(to) {
7403
7506
  */
7404
7507
  async function switchTopicByOperator(key, to) {
7405
7508
  // The operator's own pick of an account whose API credits were used up is the act that ends that mark (topped up, or
7406
- // trying anyway): a failing request marks it again.
7509
+ // trying anyway): a failing request marks it again. An API account keeps the refusal as unconfirmed, so the first turn that
7510
+ // goes through still records the renewal.
7407
7511
  if (to.backend === 'claude')
7408
- state.setClaudeProfileCreditExhausted(to.profile, null);
7512
+ state.liftClaudeProfileCreditExhaustion(to.profile);
7409
7513
  const currentFamily = getTopicBackendFamily(key);
7410
7514
  const from = getTopicFallbackPosition(key);
7411
7515
  const isUsageLimitWaitArmed = getArmedApiRetry(key)?.kind === 'usageLimit';
@@ -7486,13 +7590,23 @@ async function takeFallbackSwitchOffer(key, episodeId, index) {
7486
7590
  /**
7487
7591
  * The `claude_profiles` MCP tool's answer: snapshots refreshed on demand (a minute's cache; the account a resumed session
7488
7592
  * was stopped on is re-read at once), then the launch pick — a new agent, or the session's own account when it is warm.
7489
- * The accounts the operator switched off in the `/limits` list are never picked for a new agent. The refresh is waited for
7490
- * only up to `claudeLaunchRefreshBudgetMs`; past it the cached figures are answered (an agent that waits on a silent tool
7491
- * call is dropped by its own client after 300 s).
7593
+ * Only the accounts the operator's `/limits` list holds with an enabled rung are named once it lists any Claude account (an
7594
+ * account billed to API credits among them goes first, `getClaudeLaunchPick`). A resumed session reported stopped on an API
7595
+ * account is CHECKED, not believed (`verifyClaudeApiAgentStop`): one probe on its key marks the credit used up only if the API
7596
+ * refuses for the balance; otherwise the account is just kept off agents for an hour. The check runs beside the usage refresh
7597
+ * with a timeout of its own, so the answer is held for the longer of the two, never their sum. The refresh is waited for only
7598
+ * up to `claudeLaunchRefreshBudgetMs`; past it the cached figures are answered (an agent that waits on a silent tool call is
7599
+ * dropped by its own client after 300 s).
7492
7600
  */
7493
7601
  async function listClaudeProfilesForAgent(query) {
7494
- await (0, claudeUsageRefresher_1.refreshClaudeUsageForLaunch)(claudeUsageRefresher, { currentProfile: query.currentProfile, isStoppedByLimit: query.isStoppedByLimit, maxAgeMs: claudeUsageRefresher_1.claudeUsageOnDemandMaxAgeMs });
7495
- return (0, claudeUsage_1.buildClaudeProfilesReport)((0, claudeUsage_1.buildClaudeProfileUsageViews)({ dataDir: (0, state_1.resolveDataDir)(), records: state.getAllClaudeProfileInfos() }), query.model, Date.now(), { currentProfile: query.currentProfile, isStoppedByLimit: query.isStoppedByLimit, excludedNames: (0, fallbackChain_1.getDisabledClaudeProfileNames)(state.getFallbackChain()) });
7602
+ const stoppedApiProfile = (0, claudeApiAgentStop_1.getApiProfileStoppedByAgent)(getClaudeProfileUsageViews(), query, Date.now());
7603
+ await Promise.all([
7604
+ (0, claudeUsageRefresher_1.refreshClaudeUsageForLaunch)(claudeUsageRefresher, { currentProfile: query.currentProfile, isStoppedByLimit: query.isStoppedByLimit, maxAgeMs: claudeUsageRefresher_1.claudeUsageOnDemandMaxAgeMs }),
7605
+ stoppedApiProfile === null
7606
+ ? Promise.resolve()
7607
+ : (0, claudeApiAgentStop_1.verifyClaudeApiAgentStop)(stoppedApiProfile, claudeApiAgentStopPorts).then(() => undefined, (e) => console.warn(`[credit] ${stoppedApiProfile}: checking an agent's stop report failed:`, e instanceof Error ? e.message : e)),
7608
+ ]);
7609
+ return (0, claudeProfileUsageViews_1.buildClaudeProfilesCreditReport)(getClaudeProfileUsageViews(), query.model, Date.now(), { currentProfile: query.currentProfile, isStoppedByLimit: query.isStoppedByLimit, chainScope: (0, fallbackChain_1.getClaudeLaunchChainScope)(state.getFallbackChain()) });
7496
7610
  }
7497
7611
  const { registerFallbackChainCommands, registerFallbackChainCallbacks, openAutoSwitchView, runAutoSwitchCommand, applyAutoSwitch } = (0, fallbackChain_2.createFallbackChain)({
7498
7612
  ...botCore,
@@ -7542,6 +7656,8 @@ const { registerClaudeAccountCommands, registerClaudeAccountCallbacks, checkIsAw
7542
7656
  startOpenCodeConnect: showConnectMethodPicker,
7543
7657
  applyAutoSwitch,
7544
7658
  verifyAnthropicApiKey: (apiKey) => (0, anthropicApiKeyCheck_1.verifyAnthropicApiKey)(apiKey),
7659
+ getProfileUsageView: getClaudeProfileUsageView,
7660
+ checkIsProfileMissingFromLimitsList: (name) => (0, fallbackChain_1.checkIsClaudeProfileMissingFromChain)(state.getFallbackChain(), name),
7545
7661
  });
7546
7662
  claudeProfileAuthStatusSink = recordClaudeProfileAuthStatus;
7547
7663
  claudeProfileApiKeySink = storeClaudeProfileApiKey;
@@ -8184,7 +8300,7 @@ const botCommands = new Set([
8184
8300
  'start', 'claude', 'opencode', 'oc', 'terminal', 'agent', 'sessions', 'resume', 'cancel', 'model', 'connect',
8185
8301
  'disconnect', 'stop', 'stopall', 'stop-all', 'quit-all', 'status', 'c', 'y', 'n', 'enter', 'up', 'down', 'tab', 'esc', 'escape', 'interrupt', 'output', 'clear_messages',
8186
8302
  'bind', 'topic', 'unbind', 'where', 'ls', 'list', 'new', 'whoami', 'version', 'help', 'language', 'lang',
8187
- 'doctor', 'mcp', 'rename_session', 'compact', 'compact_on_idle', 'compact_summary', 'bot_skills', 'task_agents', 'runners', 'auto_continue_limits', 'limits', 'limits_autoswitch', 'trace', 'timestamps', 'timezone', 'schedule', 'reminders', 'todo', 'thinking', 'tool_results',
8303
+ 'doctor', 'mcp', 'rename_session', 'compact', 'compact_on_idle', 'compact_summary', 'compact_self_review', 'bot_skills', 'task_agents', 'runners', 'auto_continue_limits', 'limits', 'limits_autoswitch', 'trace', 'timestamps', 'timezone', 'schedule', 'reminders', 'todo', 'thinking', 'tool_results',
8188
8304
  'subagent', 'claude_mode', 'effort', 'verbosity', 'quit', 'q', 'quitall', 'pair', 'account', 'accounts', 'fallback', 'stt', 'voice', 'speech', 'update',
8189
8305
  ]);
8190
8306
  /**
@@ -9891,10 +10007,23 @@ function handleAgentOutput(key, output, meta) {
9891
10007
  // skip while THIS thread's own compaction streams (loop guard).
9892
10008
  markThreadTurnProducedOutput(key);
9893
10009
  noteThreadActivity(key);
9894
- // A backend's own streamed compaction summary (OpenCode) obeys `/compact_summary`, like the
9895
- // summary the bot posts for the other backends: off → the compaction ends in its short notices.
9896
- if (meta?.isCompactionSummary && !state.checkIsCompactSummaryEnabled(key))
10010
+ // A backend's own streamed compaction summary (OpenCode) obeys `/compact_summary`, like the summary the bot posts for the
10011
+ // other backends: off → the compaction ends in its short notices, plus the summary's self-review section, which is
10012
+ // shown in hide mode too; on → the summary is shown without the marker lines the agent was asked to write.
10013
+ if (meta?.isCompactionSummary) {
10014
+ const summaryTail = routeStreamedCompactionSummaryTail(key, output, meta);
10015
+ if (summaryTail === null)
10016
+ return;
10017
+ deliverAgentOutput(key, summaryTail.text, { ...meta, isContinuation: summaryTail.isContinuation });
9897
10018
  return;
10019
+ }
10020
+ deliverAgentOutput(key, output, meta);
10021
+ }
10022
+ /**
10023
+ * @description The rest of {@link handleAgentOutput} for the text that is going to the topic: the answers-only view, the
10024
+ * sub-agent chunks, the questions and the answer itself.
10025
+ */
10026
+ function deliverAgentOutput(key, output, meta) {
9898
10027
  // Answers-only view (S9): the agent's text — sub-agent chunks and progress
9899
10028
  // bursts included — never reaches the topic; a native question still does (it
9900
10029
  // falls through to its branch below). A real answer still retires a pinned
@@ -11284,6 +11413,7 @@ exports.COMMANDS_MENU = [
11284
11413
  { command: 'compact', description: '🧹 Compact agent context' },
11285
11414
  { command: 'compact_on_idle', description: '🧹 Auto-compact after idle (toggle)' },
11286
11415
  { command: 'compact_summary', description: '📄 Post the compaction summary (toggle)' },
11416
+ { command: 'compact_self_review', description: '💡 Agent self-review on compaction: its mistakes and what to change in its instructions' },
11287
11417
  { command: 'bot_skills', description: '🧰 The bot\'s own skills for agents (on/off)' },
11288
11418
  { command: 'task_agents', description: '🧵 How many tracker task agents work at once' },
11289
11419
  { command: 'runners', description: '🖥 Runners — machines for the agents\' tests and builds' },
@@ -12774,6 +12904,8 @@ async function startBot() {
12774
12904
  (0, createAdapter_1.registerClaudeConfigDirReader)(resolveThreadClaudeConfigDir);
12775
12905
  // The «Bot skills» switch (`/bot_skills`): every agent start, the OpenCode server's start and the bot MCP's instructions read it.
12776
12906
  (0, botSkills_1.setBotSkillsReader)(botSkillsReader);
12907
+ // The flags the CLI's and OpenCode's own compactions read for `/compact_self_review` follow the saved settings from the start.
12908
+ syncAllCompactSelfReviewFlags();
12777
12909
  (0, createAdapter_1.registerClaudeRateLimitSink)(onClaudeRateLimitEvent);
12778
12910
  (0, createAdapter_1.registerClaudeTurnCostSink)(onClaudeTurnCost);
12779
12911
  if (ENV.testTimings.openCodeServerUpBudgetMs !== undefined)
@@ -12781,6 +12913,8 @@ async function startBot() {
12781
12913
  // The usage cache: a first poll now (off the boot path), then the timer.
12782
12914
  claudeUsageRefresher.start();
12783
12915
  void claudeUsageRefresher.refreshAll();
12916
+ // The daily recheck of API accounts marked used up (`utils/claudeApiCreditRecheck.ts`): a pass now — a day may have passed while the bot was down — then the timer.
12917
+ (0, claudeApiCreditRecheck_1.startClaudeApiCreditRechecks)(claudeApiCreditRecheckPorts, ENV.testTimings.creditRecheckPollMs ?? claudeApiCreditRecheck_1.claudeApiCreditRecheckPollMs);
12784
12918
  const jiraConnector = ENV.servedPlatforms.has('jira') ? await prepareJiraConnectorOrExit() : null;
12785
12919
  todoJiraConversations = jiraConnector;
12786
12920
  if (jiraConnector) {
@@ -12963,7 +13097,11 @@ async function startBot() {
12963
13097
  void todoReminderEngine?.noteAdapterTurnEnd(key).catch((e) => console.warn(`[todos] the turn end of ${(0, sessionKey_1.keyToString)(key)} was not noted:`, e instanceof Error ? e.message : e));
12964
13098
  handleAgentTurnEnded(key);
12965
13099
  }),
12966
- onContextCompacted: (key, trigger) => (0, adapterEventRouting_1.dispatchAdapterEvent)(key, 'contextCompacted', () => noteConversationContextReset(key, `compaction (${trigger ?? 'bot'})`)),
13100
+ onContextCompacted: (key, trigger) => (0, adapterEventRouting_1.dispatchAdapterEvent)(key, 'contextCompacted', () => {
13101
+ noteConversationContextReset(key, `compaction (${trigger ?? 'bot'})`);
13102
+ // The CLI's own overflow compaction: nobody else posts its self-review section (a bot-issued one is its caller's).
13103
+ void postOwnCompactionInstructionGaps(key).catch((e) => console.warn(`[compact] ${(0, sessionKey_1.keyToString)(key)} the self-review section of the CLI's own compaction was not posted:`, e instanceof Error ? e.message : e));
13104
+ }),
12967
13105
  onConversationLost: (key) => (0, adapterEventRouting_1.dispatchAdapterEvent)(key, 'conversationLost', () => withThreadLocale(key, () => handleConversationLost(key)), () => { dropLostConversationWatermark(key); noteConversationContextReset(key, 'its transcript was lost'); }),
12968
13106
  onError: (key, error) => (0, adapterEventRouting_1.dispatchAdapterEvent)(key, 'error', () => withThreadLocale(key, () => handleAgentError(key, error)), () => {
12969
13107
  console.error(`[Bot] adapter error ${(0, sessionKey_1.keyToString)(key)}:`, error.message);