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
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * @description Per-profile Claude USAGE — how much of each subscription window an account profile
3
- * (`utils/claudeProfiles.ts`) has used, and which profile a process should run on: a NEW agent goes to the
4
- * account whose weekly window resets soonest (spend first what burns soonest), a WARM session stays on the
3
+ * (`utils/claudeProfiles.ts`) has used, and which profile a process should run on: only the accounts the operator's
4
+ * `/limits` list holds (when it holds any Claude account); a NEW agent goes to an API-credit account of the list first, then
5
+ * to the subscription whose weekly window resets soonest (spend first what burns soonest), a WARM session stays on the
5
6
  * account it worked on ({@link getClaudeLaunchPick}).
6
7
  *
7
8
  * Two sources feed one snapshot per profile (`ClaudeProfileRecord.usage`):
@@ -22,6 +23,7 @@
22
23
  import type { ClaudeProfileRecord } from '../state';
23
24
  import { type ClaudeAccountKind, type ClaudeProfileBilling } from './claudeProfiles';
24
25
  import type { ClaudeApiSpend } from './claudeApiSpend';
26
+ import type { ClaudeApiCreditAnchor, ClaudeApiCreditSpend } from './claudeApiCredit';
25
27
  export declare const claudeUsageEndpoint = "https://api.anthropic.com/api/oauth/usage";
26
28
  export declare const claudeUsageFetchTimeoutMs = 15000;
27
29
  /** The one usage window kind set, named by what it bounds rather than by the API's spelling. */
@@ -174,10 +176,20 @@ export interface ClaudeProfileUsageView {
174
176
  limitedUntil: string | null;
175
177
  /** How the account pays; `null` when never recorded (a subscription account added before billing was). */
176
178
  billing: ClaudeProfileBilling | null;
179
+ /** Until when agents are not pointed at it (a worker's stop report not proven by the API, `claudeApiAgentStop.ts`); absent = no hold. Read by the agent pick ONLY — topics read `limitedUntil`. */
180
+ agentHoldUntil?: string | null;
177
181
  /** When its prepaid API credits were found used up; `null` while they are not (or the operator acted since). */
178
182
  creditExhaustedAt: string | null;
179
183
  /** What an account billed to API credits spent through the bot; absent before its first counted turn. */
180
184
  apiSpend?: ClaudeApiSpend;
185
+ /** The figure the operator read on the Console's Billing page (`utils/claudeApiCredit.ts`); absent = none given. */
186
+ creditAnchor?: ClaudeApiCreditAnchor;
187
+ /** What the account spent through the bot since its credit period began (that figure, or the last renewal); absent before its first counted turn after it. */
188
+ creditSpend?: ClaudeApiCreditSpend;
189
+ /** When the bot detected that the account's used-up credit was back; absent = never. */
190
+ creditRenewedAt?: string;
191
+ /** The refusal the operator acted on (picked the account again): not excluded any more, the renewal still awaited; absent = none. */
192
+ creditUnconfirmedSince?: string;
181
193
  }
182
194
  /** One profile in the report the MCP tool and the CLI hand to an agent. */
183
195
  export interface ClaudeProfileReportEntry {
@@ -188,9 +200,9 @@ export interface ClaudeProfileReportEntry {
188
200
  kind: ClaudeAccountKind;
189
201
  subscriptionType: string | null;
190
202
  /**
191
- * `api`: billed per request to a Claude Console organization's API credits — no windows, so no headroom figure, and
192
- * NEVER picked for a NEW agent (it would look inexhaustible and spend money); only a warm session already on it stays.
193
- * `null`: a subscription not recorded as such.
203
+ * `api`: billed per request to a Claude Console organization's API credits — no windows, so no headroom figure. It is
204
+ * recommended to a NEW agent only when the operator's `/limits` list holds it as an enabled rung (then FIRST, while its
205
+ * credit lasts); with no such rung only a warm session already on it stays. `null`: a subscription not recorded as such.
194
206
  */
195
207
  billing: ClaudeProfileBilling | null;
196
208
  /** `null` when never probed. */
@@ -201,8 +213,20 @@ export interface ClaudeProfileReportEntry {
201
213
  limitedUntil: string | null;
202
214
  /** When its prepaid API credits were found used up (`null`: not marked). */
203
215
  creditExhaustedAt: string | null;
204
- /** Signed in, not limited, its API credits not used up, and not at 100 % on a window the model drains — by the figures AS RECORDED. */
216
+ /** What the account spent through the bot in its current credit period (the operator's last figure, the last renewal, else since its first counted turn). */
217
+ spentUsd: number | null;
218
+ /** The operator's figure (or, after a renewal, the last grant they gave) minus the spend; `null` when no figure was ever given. */
219
+ remainingEstimateUsd: number | null;
220
+ /** The last day (`YYYY-MM-DD`, UTC) the operator said the credit is usable; `null` when none was given or after a renewal (unknown: the Console's Billing page shows it). */
221
+ expiresOn: string | null;
222
+ /** A refusal for a used-up balance came after the period began and nothing has answered since: the bot cannot be sure. */
223
+ probablyUsedUp: boolean;
224
+ /** When the bot detected the credit was back (the current period starts there); `null` = never or superseded by a newer figure. */
225
+ renewedAt: string | null;
226
+ /** Signed in, not limited, its API credits not used up, not at 100 % on a window the model drains — by the figures AS RECORDED — and not kept off agents by the `/limits` list (`chainExclusion`). */
205
227
  isEligible: boolean;
228
+ /** Why the operator's `/limits` list keeps agents off this account ({@link ClaudeChainExclusion}); `null` = no objection (it has an enabled rung there, or the list names no Claude account at all). */
229
+ chainExclusion: ClaudeChainExclusion | null;
206
230
  /** `100 − max(relevant percent)`; `null` when the usage is unknown. Informational: the pick ranks by reset, not by headroom. */
207
231
  headroomPercent: number | null;
208
232
  /** The profile {@link getClaudeLaunchPick} chose (the figures read as of now). */
@@ -228,10 +252,12 @@ export declare const claudeWeeklyWindowMs: number;
228
252
  export declare const claudeSessionWindowMs: number;
229
253
  /**
230
254
  * `warm`: the session stays on its account; `movedFromLimited`: it was stopped by a limit and goes elsewhere;
231
- * `movedFromUnavailable`: its account can no longer run (signed out, marked limited, out of credits, a window full) and it
232
- * goes elsewhere; `soonestWeeklyReset`: a new agent; `none`: nothing is usable.
255
+ * `movedFromUnavailable`: its account can no longer run (signed out, marked limited, out of credits, a window full, or
256
+ * taken out of the `/limits` list) and it goes elsewhere; `soonestWeeklyReset`: a new agent on the subscription whose weekly
257
+ * window resets soonest; `apiCreditFirst`: a new agent on an account billed to API credits the `/limits` list holds (it goes
258
+ * before every subscription while its credit lasts); `none`: nothing is usable.
233
259
  */
234
- export type ClaudeLaunchPickReason = 'warm' | 'movedFromLimited' | 'movedFromUnavailable' | 'soonestWeeklyReset' | 'none';
260
+ export type ClaudeLaunchPickReason = 'warm' | 'movedFromLimited' | 'movedFromUnavailable' | 'soonestWeeklyReset' | 'apiCreditFirst' | 'none';
235
261
  /** The account that frees up first and the ISO instant it does. */
236
262
  export interface ClaudeNextAvailable {
237
263
  profile: string;
@@ -248,9 +274,30 @@ export interface ClaudeLaunchPickOptions {
248
274
  currentProfile?: string | null;
249
275
  /** The session broke off on a usage limit of `currentProfile`: it is left out of this answer whatever the figures say. */
250
276
  isStoppedByLimit?: boolean;
251
- /** Accounts the operator switched off in the `/limits` list (every rung disabled): never picked for a new agent. */
252
- excludedNames?: ReadonlySet<string>;
277
+ /** What the operator's `/limits` list says about the accounts agents may use; absent / `null` = the list names no Claude account (every signed-in subscription account is open). */
278
+ chainScope?: ClaudeLaunchChainScope | null;
279
+ /** API accounts whose credit has run out by the operator's own expiry day: not sent a NEW agent first (the credit module is out of this file's reach, the caller works it out). */
280
+ expiredApiNames?: ReadonlySet<string>;
253
281
  }
282
+ /**
283
+ * What the operator's `/limits` auto-switch list (the fallback chain) says about the Claude accounts an AGENT may be pointed
284
+ * at: once the list names any Claude account, only the accounts with an ENABLED rung are recommended — to a new agent and
285
+ * to a resumed one alike. `fallbackChain.ts` builds it (`getClaudeLaunchChainScope`); `null` stands for a list with no Claude rung.
286
+ */
287
+ export interface ClaudeLaunchChainScope {
288
+ /** Accounts with at least one enabled Claude rung, in the list's order (several API accounts go first-listed-first). */
289
+ enabledNames: ReadonlySet<string>;
290
+ /** Accounts the list names only with switched-off rungs (🚫). */
291
+ disabledNames: ReadonlySet<string>;
292
+ }
293
+ /** Why the `/limits` list keeps agents off an account: `switchedOff` = every rung of it is switched off, `notListed` = the list names the account nowhere. */
294
+ export type ClaudeChainExclusion = 'switchedOff' | 'notListed';
295
+ /** Every exclusion, in the order an answer names them. */
296
+ export declare const claudeChainExclusions: readonly ClaudeChainExclusion[];
297
+ /** The words of an exclusion for the first line of an answer and the command line. */
298
+ export declare const claudeChainExclusionWords: Readonly<Record<ClaudeChainExclusion, string>>;
299
+ /** Why `scope` keeps agents off the account `name`; `null` when it does not (no Claude account listed, or an enabled rung of it). */
300
+ export declare function getClaudeChainExclusion(name: string, scope: ClaudeLaunchChainScope | null | undefined): ClaudeChainExclusion | null;
254
301
  /**
255
302
  * @description Whether a NEW agent of `model` may start on the profile now: a subscription account that is eligible by the
256
303
  * figures as of `nowMs` and whose five-hour window is below {@link claudeLaunchSessionCeilingPercent}. Switching it off
@@ -268,17 +315,27 @@ export declare function sortClaudeProfilesByLaunchRank<T extends ClaudeProfileUs
268
315
  /**
269
316
  * @description The account a process of `model` should run on.
270
317
  *
271
- * NEW agent (no `currentProfile`): of the USABLE accounts — subscription, signed in, not marked limited, not out of API
272
- * credits, not switched off (`excludedNames`), every weekly window the model drains below 100 % and the five-hour window
273
- * below {@link claudeLaunchSessionCeilingPercent} — the one whose weekly window resets soonest
274
- * ({@link sortClaudeProfilesByLaunchRank}): spend first what burns first, and move to a farther reset only when the
275
- * five-hour window is exhausted. Fable's own window at 100 % takes only Fable out.
318
+ * The operator's `/limits` list rules who may be named at all (`chainScope`): once it names any Claude account, only an account
319
+ * with an ENABLED rung there is recommended — one the list leaves out or switches off never is, for a new agent or a resumed one.
320
+ * A list with no Claude rung restricts nothing.
276
321
  *
277
- * WARM session (`currentProfile` known): it stays on that account unless the account is signed out, marked limited, out
278
- * of API credits or at 100 % on a window the model drains — the ceiling does not apply, and an API-billed account the
279
- * session already works on is kept (the spend was approved). `isStoppedByLimit` takes `currentProfile` out of the answer
280
- * whatever the figures say (they may lag the limit); the rest follows the new-agent rule, and the reason says the
281
- * session moved (`movedFromLimited`, or `movedFromUnavailable` when the account could no longer run by its own figures).
322
+ * NEW agent (no `currentProfile`): first an account billed to API credits the list holds (the operator's choice: spend the
323
+ * bonus credit before any subscription), as long as it is signed in, not marked limited, not held off agents (`agentHoldUntil`),
324
+ * its credits are not marked used up and the expiry day the operator gave (`expiredApiNames`) has not passed;
325
+ * then, of the USABLE subscription accounts — signed in, not marked limited, not out of API credits, every weekly window the
326
+ * model drains below 100 % and the five-hour window below {@link claudeLaunchSessionCeilingPercent} — the one whose weekly
327
+ * window resets soonest ({@link sortClaudeProfilesByLaunchRank}): spend first what burns first, and move to a farther reset only
328
+ * when the five-hour window is exhausted. Fable's own window at 100 % takes only Fable out. The list's ORDER ranks nothing but
329
+ * several API accounts among themselves: it was written for a topic's fallback, the agents' order is "API credit, then what
330
+ * burns soonest".
331
+ *
332
+ * WARM session (`currentProfile` known): it stays on that account unless the account is signed out, marked limited, held off
333
+ * agents (`agentHoldUntil`), out of API credits, at 100 % on a window the model drains, or no longer allowed by the list — the
334
+ * ceiling does not apply, and an
335
+ * API-billed account the session already works on is kept (the spend was approved) while the list does not take it out.
336
+ * `isStoppedByLimit` takes `currentProfile` out of the answer whatever the figures say (they may lag the limit); the rest
337
+ * follows the new-agent rule, and the reason says the session moved (`movedFromLimited`, or `movedFromUnavailable` when the
338
+ * account could no longer run by its own figures or the list).
282
339
  *
283
340
  * Nothing usable → `pick: null` and {@link ClaudeLaunchPick.nextAvailable}.
284
341
  */
@@ -289,28 +346,29 @@ export declare function getClaudeLaunchPick(input: ClaudeLaunchPickOptions & {
289
346
  }): ClaudeLaunchPick;
290
347
  /**
291
348
  * @description The pick in words, for the first line of the `claude_profiles` answer and the CLI: why the account was chosen
292
- * (`stays on the warm account`, `moved: <name> stopped on a limit` / `can no longer run`, `soonest weekly reset`), or that nothing is usable
349
+ * (`stays on the warm account`, `moved: <name> stopped on a limit` / `can no longer run`, `soonest weekly reset`, `API credit first`), or that nothing is usable
293
350
  * and which account frees up when. `currentProfile` is the account the caller passed for a resumed session.
294
351
  */
295
352
  export declare function describeClaudeLaunchOutcome(report: Pick<ClaudeProfilesReport, 'pickReason' | 'nextAvailable'>, currentProfile: string | null): string;
296
353
  /**
297
- * @description The report of every profile for a launch of `model`, with the pick of {@link getClaudeLaunchPick}
298
- * (`options`: the warm account, the limit stop, the switched-off accounts). `isEligible` is the strict reading — signed in,
299
- * not marked limited, its API credits not used up, not at 100 % on a relevant window as recorded — which the explicit
300
- * fallback chain's availability reads; `recommended` is the pick, an account billed to API credits only when a warm
301
- * session already runs on it. The entries keep the input order.
354
+ * @description The accounts the `/limits` list keeps agents off, one clause per reason (`not offered — not in the /limits list:
355
+ * a, b; switched off in the /limits list: c`), or `null` when there are none. The first lines of the `claude_profiles` answer
356
+ * and the CLI add it, so an agent that sees a signed-in account missing from `recommended` is told why.
302
357
  */
303
- export declare function buildClaudeProfilesReport(profiles: readonly ClaudeProfileUsageView[], model: string | null, nowMs: number, options?: ClaudeLaunchPickOptions): ClaudeProfilesReport;
358
+ export declare function describeClaudeChainExclusions(report: Pick<ClaudeProfilesReport, 'profiles'>): string | null;
304
359
  /**
305
- * @description The ranking's view of every profile off the registry: `default` (its hidden record, when the
306
- * bot has written one) first, then the added profiles in creation order. Shared by the bot (live state) and
307
- * the CLI (`state.json` read directly).
360
+ * @description The report of every profile for a launch of `model`, with the pick of {@link getClaudeLaunchPick}
361
+ * (`options`: the warm account, the limit stop, the `/limits` list). `isEligible` is the strict reading — signed in,
362
+ * not marked limited, its API credits not used up, not at 100 % on a relevant window as recorded, not kept off agents by the
363
+ * list (`chainExclusion`) — which the explicit fallback chain's availability reads (it passes no list); `recommended` is the
364
+ * pick. The entries keep the input order.
365
+ *
366
+ * The credit fields of the entries (`spentUsd`, `remainingEstimateUsd`, `expiresOn`, `probablyUsedUp`, `renewedAt`) are left
367
+ * EMPTY here: this module is loaded by the connector guards, which may not reach the credit module. Anything that is shown to
368
+ * an agent or an operator — the `claude_profiles` tool, `charness claude-profiles` — uses `buildClaudeProfilesCreditReport`
369
+ * (`utils/claudeProfileUsageViews.ts`) instead; this builder is for the ranking (`fallbackChain.ts` reads `isEligible`).
308
370
  */
309
- export declare function buildClaudeProfileUsageViews(input: {
310
- dataDir: string;
311
- /** Every record, the hidden `default` one included (`StateStore.getClaudeProfileInfo` / the raw file). */
312
- records: Readonly<Record<string, ClaudeProfileRecord>>;
313
- }): ClaudeProfileUsageView[];
371
+ export declare function buildClaudeProfilesReport(profiles: readonly ClaudeProfileUsageView[], model: string | null, nowMs: number, options?: ClaudeLaunchPickOptions): ClaudeProfilesReport;
314
372
  /** The profile registry out of a `state.json` already read (`stateFile.ts`): entries without a creation time are dropped. */
315
373
  export declare function getClaudeProfileRecordsFromState(stateFile: Readonly<Record<string, unknown>>): Readonly<Record<string, ClaudeProfileRecord>>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AAM,GAAG,IAAI,CAAC;IAAC,KAAK,CAAC,EAAE,wBAAwB,CAAA;CAAO,GACnF,MAAM,CAMR"}
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  /**
3
3
  * @description Per-profile Claude USAGE — how much of each subscription window an account profile
4
- * (`utils/claudeProfiles.ts`) has used, and which profile a process should run on: a NEW agent goes to the
5
- * account whose weekly window resets soonest (spend first what burns soonest), a WARM session stays on the
4
+ * (`utils/claudeProfiles.ts`) has used, and which profile a process should run on: only the accounts the operator's
5
+ * `/limits` list holds (when it holds any Claude account); a NEW agent goes to an API-credit account of the list first, then
6
+ * to the subscription whose weekly window resets soonest (spend first what burns soonest), a WARM session stays on the
6
7
  * account it worked on ({@link getClaudeLaunchPick}).
7
8
  *
8
9
  * Two sources feed one snapshot per profile (`ClaudeProfileRecord.usage`):
@@ -54,7 +55,7 @@ var __importStar = (this && this.__importStar) || (function () {
54
55
  };
55
56
  })();
56
57
  Object.defineProperty(exports, "__esModule", { value: true });
57
- exports.englishRelativeResetWords = exports.claudeSessionWindowMs = exports.claudeWeeklyWindowMs = exports.claudeLaunchResetTieMs = exports.claudeLaunchSessionCeilingPercent = exports.claudeUsageBucketKinds = exports.claudeUsageFetchTimeoutMs = exports.claudeUsageEndpoint = void 0;
58
+ exports.englishRelativeResetWords = exports.claudeChainExclusionWords = exports.claudeChainExclusions = exports.claudeSessionWindowMs = exports.claudeWeeklyWindowMs = exports.claudeLaunchResetTieMs = exports.claudeLaunchSessionCeilingPercent = exports.claudeUsageBucketKinds = exports.claudeUsageFetchTimeoutMs = exports.claudeUsageEndpoint = void 0;
58
59
  exports.readClaudeOAuthToken = readClaudeOAuthToken;
59
60
  exports.checkIsClaudeTokenExpired = checkIsClaudeTokenExpired;
60
61
  exports.fetchUsageBuckets = fetchUsageBuckets;
@@ -70,12 +71,13 @@ exports.getRelevantClaudeUsageKinds = getRelevantClaudeUsageKinds;
70
71
  exports.checkHasHeadroomForClaudeModel = checkHasHeadroomForClaudeModel;
71
72
  exports.checkIsClaudeUsageExhausted = checkIsClaudeUsageExhausted;
72
73
  exports.checkIsClaudeModelClearOfLimit = checkIsClaudeModelClearOfLimit;
74
+ exports.getClaudeChainExclusion = getClaudeChainExclusion;
73
75
  exports.checkIsClaudeProfileLaunchable = checkIsClaudeProfileLaunchable;
74
76
  exports.sortClaudeProfilesByLaunchRank = sortClaudeProfilesByLaunchRank;
75
77
  exports.getClaudeLaunchPick = getClaudeLaunchPick;
76
78
  exports.describeClaudeLaunchOutcome = describeClaudeLaunchOutcome;
79
+ exports.describeClaudeChainExclusions = describeClaudeChainExclusions;
77
80
  exports.buildClaudeProfilesReport = buildClaudeProfilesReport;
78
- exports.buildClaudeProfileUsageViews = buildClaudeProfileUsageViews;
79
81
  exports.getClaudeProfileRecordsFromState = getClaudeProfileRecordsFromState;
80
82
  exports.formatClaudeUsageResetAt = formatClaudeUsageResetAt;
81
83
  exports.formatClaudeUsageRelativeReset = formatClaudeUsageRelativeReset;
@@ -319,6 +321,19 @@ exports.claudeLaunchSessionCeilingPercent = 90;
319
321
  exports.claudeLaunchResetTieMs = 60_000;
320
322
  exports.claudeWeeklyWindowMs = 7 * 24 * 3_600_000;
321
323
  exports.claudeSessionWindowMs = 5 * 3_600_000;
324
+ /** Every exclusion, in the order an answer names them. */
325
+ exports.claudeChainExclusions = ['notListed', 'switchedOff'];
326
+ /** The words of an exclusion for the first line of an answer and the command line. */
327
+ exports.claudeChainExclusionWords = {
328
+ notListed: 'not in the /limits list',
329
+ switchedOff: 'switched off in the /limits list',
330
+ };
331
+ /** Why `scope` keeps agents off the account `name`; `null` when it does not (no Claude account listed, or an enabled rung of it). */
332
+ function getClaudeChainExclusion(name, scope) {
333
+ if (!scope || scope.enabledNames.has(name))
334
+ return null;
335
+ return scope.disabledNames.has(name) ? 'switchedOff' : 'notListed';
336
+ }
322
337
  /**
323
338
  * The account itself can run: signed in, not marked limited, its API credits not used up, and none of the windows
324
339
  * the model drains (`relevantBuckets`, read by the caller) at 100 %. The one hard-eligibility rule of the report's
@@ -449,17 +464,32 @@ function getSessionResetMs(profile, nowMs) {
449
464
  return Number.isFinite(resetMs) ? resetMs : null;
450
465
  }
451
466
  /**
452
- * The subscription account that frees up first, when nothing is usable now; `null` when no account names a time. The
453
- * account a limit just stopped (`stoppedName`) may show no blocker at all — its figures lag the limit — and is then
454
- * taken to free up when its five-hour window resets, so a single account is never left without a time to come back.
467
+ * The instant the API-billed account `profile` the list holds becomes usable for a new agent: the later of its limited mark and
468
+ * its agents-only hold (`agentHoldUntil`). `nowMs` when nothing blocks it; `null` for an account that never comes back at a
469
+ * known time — not held by the list, past its expiry day, or with no hold or mark ahead to name.
470
+ */
471
+ function getClaudeApiProfileFreeAtMs(profile, chainScope, expiredApiNames, nowMs) {
472
+ if (chainScope === null || !chainScope.enabledNames.has(profile.name) || expiredApiNames.has(profile.name))
473
+ return null;
474
+ const aheadMs = [profile.limitedUntil, profile.agentHoldUntil]
475
+ .map((instant) => (instant ? Date.parse(instant) : Number.NaN))
476
+ .filter((instantMs) => Number.isFinite(instantMs) && instantMs > nowMs);
477
+ return aheadMs.length === 0 ? nowMs : Math.max(...aheadMs);
478
+ }
479
+ /**
480
+ * The account that frees up first, when nothing is usable now; `null` when no account names a time. The account a limit just
481
+ * stopped (`stoppedName`) may show no blocker at all — its figures lag the limit — and is then taken to free up when its
482
+ * five-hour window resets, so a single account is never left without a time to come back. An API-billed account the list holds
483
+ * is named only at the end of a hold or limited mark it carries.
455
484
  */
456
- function getClaudeNextAvailable(profiles, model, nowMs, excludedNames, stoppedName) {
485
+ function getClaudeNextAvailable(input) {
486
+ const { model, nowMs, chainScope, expiredApiNames, stoppedName } = input;
457
487
  let next = null;
458
- for (const profile of profiles) {
459
- // These never come back at a known time: switched off, signed out, API-billed, out of credits.
460
- if (excludedNames.has(profile.name) || profile.loggedIn === false || profile.billing === 'api' || profile.creditExhaustedAt !== null)
488
+ for (const profile of input.profiles) {
489
+ // These never come back at a known time: kept off agents by the /limits list, signed out, out of credits.
490
+ if (getClaudeChainExclusion(profile.name, chainScope) !== null || profile.loggedIn === false || profile.creditExhaustedAt !== null)
461
491
  continue;
462
- let freeAtMs = getClaudeProfileFreeAtMs(profile, model, nowMs);
492
+ let freeAtMs = profile.billing === 'api' ? getClaudeApiProfileFreeAtMs(profile, chainScope, expiredApiNames, nowMs) : getClaudeProfileFreeAtMs(profile, model, nowMs);
463
493
  // The limit stopped this account, yet its figures show no blocker, so nothing says WHICH limit it was (a weekly window
464
494
  // the usage endpoint has not caught up with, or the five-hour one). The five-hour reset is a guess — the earliest it
465
495
  // could be free. A wrong guess just hits the limit again on the resume and asks again: at most about one try per five hours.
@@ -472,45 +502,80 @@ function getClaudeNextAvailable(profiles, model, nowMs, excludedNames, stoppedNa
472
502
  }
473
503
  return next === null ? null : { profile: next.profile, at: new Date(next.atMs).toISOString() };
474
504
  }
505
+ /** Whether `profile` is held off agents at `nowMs` (`agentHoldUntil` ahead). Never read by the topics' fallback. */
506
+ function checkIsClaudeProfileHeldFromAgents(profile, nowMs) {
507
+ const heldUntilMs = profile.agentHoldUntil ? Date.parse(profile.agentHoldUntil) : Number.NaN;
508
+ return Number.isFinite(heldUntilMs) && heldUntilMs > nowMs;
509
+ }
510
+ /**
511
+ * Whether a NEW agent may start on the account billed to API credits `profile` now: the operator's `/limits` list holds it as an
512
+ * enabled rung (without such a list an API account is never picked: it would look inexhaustible and spend money unasked), it is
513
+ * signed in, not marked limited, not held off agents (`agentHoldUntil`), its credits not marked used up and not past the expiry
514
+ * day the operator gave. No window to read: the balance is its only limit.
515
+ */
516
+ function checkIsClaudeApiProfileLaunchable(profile, chainScope, expiredApiNames, nowMs) {
517
+ return chainScope !== null && chainScope.enabledNames.has(profile.name) && !expiredApiNames.has(profile.name)
518
+ && !checkIsClaudeProfileHeldFromAgents(profile, nowMs) && checkIsClaudeProfileEligible(profile, [], nowMs);
519
+ }
475
520
  /**
476
521
  * @description The account a process of `model` should run on.
477
522
  *
478
- * NEW agent (no `currentProfile`): of the USABLE accounts — subscription, signed in, not marked limited, not out of API
479
- * credits, not switched off (`excludedNames`), every weekly window the model drains below 100 % and the five-hour window
480
- * below {@link claudeLaunchSessionCeilingPercent} — the one whose weekly window resets soonest
481
- * ({@link sortClaudeProfilesByLaunchRank}): spend first what burns first, and move to a farther reset only when the
482
- * five-hour window is exhausted. Fable's own window at 100 % takes only Fable out.
523
+ * The operator's `/limits` list rules who may be named at all (`chainScope`): once it names any Claude account, only an account
524
+ * with an ENABLED rung there is recommended — one the list leaves out or switches off never is, for a new agent or a resumed one.
525
+ * A list with no Claude rung restricts nothing.
526
+ *
527
+ * NEW agent (no `currentProfile`): first an account billed to API credits the list holds (the operator's choice: spend the
528
+ * bonus credit before any subscription), as long as it is signed in, not marked limited, not held off agents (`agentHoldUntil`),
529
+ * its credits are not marked used up and the expiry day the operator gave (`expiredApiNames`) has not passed;
530
+ * then, of the USABLE subscription accounts — signed in, not marked limited, not out of API credits, every weekly window the
531
+ * model drains below 100 % and the five-hour window below {@link claudeLaunchSessionCeilingPercent} — the one whose weekly
532
+ * window resets soonest ({@link sortClaudeProfilesByLaunchRank}): spend first what burns first, and move to a farther reset only
533
+ * when the five-hour window is exhausted. Fable's own window at 100 % takes only Fable out. The list's ORDER ranks nothing but
534
+ * several API accounts among themselves: it was written for a topic's fallback, the agents' order is "API credit, then what
535
+ * burns soonest".
483
536
  *
484
- * WARM session (`currentProfile` known): it stays on that account unless the account is signed out, marked limited, out
485
- * of API credits or at 100 % on a window the model drains — the ceiling does not apply, and an API-billed account the
486
- * session already works on is kept (the spend was approved). `isStoppedByLimit` takes `currentProfile` out of the answer
487
- * whatever the figures say (they may lag the limit); the rest follows the new-agent rule, and the reason says the
488
- * session moved (`movedFromLimited`, or `movedFromUnavailable` when the account could no longer run by its own figures).
537
+ * WARM session (`currentProfile` known): it stays on that account unless the account is signed out, marked limited, held off
538
+ * agents (`agentHoldUntil`), out of API credits, at 100 % on a window the model drains, or no longer allowed by the list — the
539
+ * ceiling does not apply, and an
540
+ * API-billed account the session already works on is kept (the spend was approved) while the list does not take it out.
541
+ * `isStoppedByLimit` takes `currentProfile` out of the answer whatever the figures say (they may lag the limit); the rest
542
+ * follows the new-agent rule, and the reason says the session moved (`movedFromLimited`, or `movedFromUnavailable` when the
543
+ * account could no longer run by its own figures or the list).
489
544
  *
490
545
  * Nothing usable → `pick: null` and {@link ClaudeLaunchPick.nextAvailable}.
491
546
  */
492
547
  function getClaudeLaunchPick(input) {
493
- const excludedNames = input.excludedNames ?? new Set();
548
+ const chainScope = input.chainScope ?? null;
549
+ const expiredApiNames = input.expiredApiNames ?? new Set();
494
550
  const current = input.currentProfile ? input.profiles.find((profile) => profile.name === input.currentProfile) : undefined;
495
551
  const isStopped = current !== undefined && input.isStoppedByLimit === true;
496
552
  if (current && !isStopped
553
+ && getClaudeChainExclusion(current.name, chainScope) === null
554
+ && !checkIsClaudeProfileHeldFromAgents(current, input.nowMs)
497
555
  && checkIsClaudeProfileEligible(current, getRelevantClaudeBucketsAsOf(current, input.model, input.nowMs), input.nowMs)) {
498
556
  return { pick: current.name, reason: 'warm', nextAvailable: null };
499
557
  }
500
558
  const movedFrom = current?.name ?? null;
501
- const usable = input.profiles.filter((profile) => profile.name !== movedFrom
502
- && !excludedNames.has(profile.name)
503
- && checkIsClaudeProfileLaunchable(profile, input.model, input.nowMs));
504
- const [first] = sortClaudeProfilesByLaunchRank(usable, input.model, input.nowMs);
559
+ const allowed = input.profiles.filter((profile) => profile.name !== movedFrom && getClaudeChainExclusion(profile.name, chainScope) === null);
560
+ const chainOrder = chainScope === null ? [] : [...chainScope.enabledNames];
561
+ const apiFirst = allowed
562
+ .filter((profile) => profile.billing === 'api' && checkIsClaudeApiProfileLaunchable(profile, chainScope, expiredApiNames, input.nowMs))
563
+ .sort((a, b) => chainOrder.indexOf(a.name) - chainOrder.indexOf(b.name));
564
+ const subscriptions = sortClaudeProfilesByLaunchRank(allowed.filter((profile) => profile.billing !== 'api' && checkIsClaudeProfileLaunchable(profile, input.model, input.nowMs)), input.model, input.nowMs);
565
+ const [first] = [...apiFirst, ...subscriptions];
505
566
  if (first) {
506
- const reason = movedFrom === null ? 'soonestWeeklyReset' : isStopped ? 'movedFromLimited' : 'movedFromUnavailable';
567
+ const reason = movedFrom !== null ? (isStopped ? 'movedFromLimited' : 'movedFromUnavailable') : first.billing === 'api' ? 'apiCreditFirst' : 'soonestWeeklyReset';
507
568
  return { pick: first.name, reason, nextAvailable: null };
508
569
  }
509
- return { pick: null, reason: 'none', nextAvailable: getClaudeNextAvailable(input.profiles, input.model, input.nowMs, excludedNames, isStopped ? movedFrom : null) };
570
+ return {
571
+ pick: null,
572
+ reason: 'none',
573
+ nextAvailable: getClaudeNextAvailable({ profiles: input.profiles, model: input.model, nowMs: input.nowMs, chainScope, expiredApiNames, stoppedName: isStopped ? movedFrom : null }),
574
+ };
510
575
  }
511
576
  /**
512
577
  * @description The pick in words, for the first line of the `claude_profiles` answer and the CLI: why the account was chosen
513
- * (`stays on the warm account`, `moved: <name> stopped on a limit` / `can no longer run`, `soonest weekly reset`), or that nothing is usable
578
+ * (`stays on the warm account`, `moved: <name> stopped on a limit` / `can no longer run`, `soonest weekly reset`, `API credit first`), or that nothing is usable
514
579
  * and which account frees up when. `currentProfile` is the account the caller passed for a resumed session.
515
580
  */
516
581
  function describeClaudeLaunchOutcome(report, currentProfile) {
@@ -523,24 +588,56 @@ function describeClaudeLaunchOutcome(report, currentProfile) {
523
588
  return `moved: ${currentProfile ?? 'the warm account'} can no longer run`;
524
589
  case 'soonestWeeklyReset':
525
590
  return 'soonest weekly reset';
591
+ case 'apiCreditFirst':
592
+ return 'API credit first, as the /limits list allows';
526
593
  case 'none':
527
594
  return report.nextAvailable === null
528
595
  ? 'none usable — no account names a time it frees up'
529
596
  : `none usable — next: ${report.nextAvailable.profile} at ${report.nextAvailable.at}`;
530
597
  }
531
598
  }
599
+ /**
600
+ * @description The accounts the `/limits` list keeps agents off, one clause per reason (`not offered — not in the /limits list:
601
+ * a, b; switched off in the /limits list: c`), or `null` when there are none. The first lines of the `claude_profiles` answer
602
+ * and the CLI add it, so an agent that sees a signed-in account missing from `recommended` is told why.
603
+ */
604
+ function describeClaudeChainExclusions(report) {
605
+ const clauses = exports.claudeChainExclusions
606
+ .map((exclusion) => ({ exclusion, names: report.profiles.filter((entry) => entry.chainExclusion === exclusion).map((entry) => entry.name) }))
607
+ .filter(({ names }) => names.length > 0)
608
+ .map(({ exclusion, names }) => `${exports.claudeChainExclusionWords[exclusion]}: ${names.join(', ')}`);
609
+ return clauses.length === 0 ? null : `not offered — ${clauses.join('; ')}`;
610
+ }
611
+ /**
612
+ * The credit fields of a report entry before the bot's estimate is added (`utils/claudeProfileUsageViews.ts` fills them for an
613
+ * API account): this module is loaded by the connector guards, before any env file is read, and must not reach the credit
614
+ * module (its file store, zod).
615
+ */
616
+ const emptyClaudeProfileReportCredit = {
617
+ spentUsd: null,
618
+ remainingEstimateUsd: null,
619
+ expiresOn: null,
620
+ probablyUsedUp: false,
621
+ renewedAt: null,
622
+ };
532
623
  /**
533
624
  * @description The report of every profile for a launch of `model`, with the pick of {@link getClaudeLaunchPick}
534
- * (`options`: the warm account, the limit stop, the switched-off accounts). `isEligible` is the strict reading — signed in,
535
- * not marked limited, its API credits not used up, not at 100 % on a relevant window as recorded — which the explicit
536
- * fallback chain's availability reads; `recommended` is the pick, an account billed to API credits only when a warm
537
- * session already runs on it. The entries keep the input order.
625
+ * (`options`: the warm account, the limit stop, the `/limits` list). `isEligible` is the strict reading — signed in,
626
+ * not marked limited, its API credits not used up, not at 100 % on a relevant window as recorded, not kept off agents by the
627
+ * list (`chainExclusion`) — which the explicit fallback chain's availability reads (it passes no list); `recommended` is the
628
+ * pick. The entries keep the input order.
629
+ *
630
+ * The credit fields of the entries (`spentUsd`, `remainingEstimateUsd`, `expiresOn`, `probablyUsedUp`, `renewedAt`) are left
631
+ * EMPTY here: this module is loaded by the connector guards, which may not reach the credit module. Anything that is shown to
632
+ * an agent or an operator — the `claude_profiles` tool, `charness claude-profiles` — uses `buildClaudeProfilesCreditReport`
633
+ * (`utils/claudeProfileUsageViews.ts`) instead; this builder is for the ranking (`fallbackChain.ts` reads `isEligible`).
538
634
  */
539
635
  function buildClaudeProfilesReport(profiles, model, nowMs, options = {}) {
540
636
  const relevantBuckets = getRelevantClaudeUsageKinds(model);
541
637
  const entries = profiles.map((profile) => {
542
638
  const relevant = getRelevantClaudeUsageBuckets(profile.usage, model);
543
639
  const maxPercent = relevant.length === 0 ? null : Math.max(...relevant.map((bucket) => bucket.percent));
640
+ const chainExclusion = getClaudeChainExclusion(profile.name, options.chainScope);
544
641
  return {
545
642
  name: profile.name,
546
643
  configDir: profile.configDir,
@@ -554,7 +651,9 @@ function buildClaudeProfilesReport(profiles, model, nowMs, options = {}) {
554
651
  isUsageStale: profile.usage?.isStale === true,
555
652
  limitedUntil: profile.limitedUntil,
556
653
  creditExhaustedAt: profile.creditExhaustedAt,
557
- isEligible: checkIsClaudeProfileEligible(profile, relevant, nowMs),
654
+ ...emptyClaudeProfileReportCredit,
655
+ isEligible: chainExclusion === null && checkIsClaudeProfileEligible(profile, relevant, nowMs),
656
+ chainExclusion,
558
657
  headroomPercent: maxPercent === null ? null : 100 - maxPercent,
559
658
  isRecommended: false,
560
659
  };
@@ -565,31 +664,6 @@ function buildClaudeProfilesReport(profiles, model, nowMs, options = {}) {
565
664
  recommended.isRecommended = true;
566
665
  return { model, relevantBuckets, recommended: launch.pick, pickReason: launch.reason, nextAvailable: launch.nextAvailable, profiles: entries };
567
666
  }
568
- /**
569
- * @description The ranking's view of every profile off the registry: `default` (its hidden record, when the
570
- * bot has written one) first, then the added profiles in creation order. Shared by the bot (live state) and
571
- * the CLI (`state.json` read directly).
572
- */
573
- function buildClaudeProfileUsageViews(input) {
574
- // A `default` the operator signed out through /accounts stays out of every ranking until it is signed in again.
575
- const isDefaultRemoved = input.records.default?.isRemoved === true;
576
- const toView = (name, record) => ({
577
- name,
578
- configDir: (0, claudeProfiles_1.resolveClaudeProfileDir)(input.dataDir, name),
579
- loggedIn: record?.loggedIn,
580
- email: record?.email ?? null,
581
- subscriptionType: record?.subscriptionType ?? null,
582
- usage: record?.usage,
583
- limitedUntil: record?.limitedUntil ?? null,
584
- billing: record?.billing ?? null,
585
- creditExhaustedAt: record?.creditExhaustedAt ?? null,
586
- ...(record?.apiSpend ? { apiSpend: record.apiSpend } : {}),
587
- });
588
- const added = Object.entries(input.records)
589
- .filter(([name]) => name !== 'default')
590
- .sort(([, a], [, b]) => a.createdAt.localeCompare(b.createdAt));
591
- return [...(isDefaultRemoved ? [] : [toView('default', input.records.default)]), ...added.map(([name, record]) => toView(name, record))];
592
- }
593
667
  /** The profile registry out of a `state.json` already read (`stateFile.ts`): entries without a creation time are dropped. */
594
668
  function getClaudeProfileRecordsFromState(stateFile) {
595
669
  const registry = stateFile.claudeProfiles;