charness 3.4.0 → 3.6.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 (231) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/DEVELOPMENT.md +12 -1
  3. package/README.md +89 -6
  4. package/SETUP.md +199 -1
  5. package/dist/adapters/adapterEventRouting.d.ts +2 -2
  6. package/dist/adapters/adapterEventRouting.d.ts.map +1 -1
  7. package/dist/adapters/adapterEventRouting.js +4 -3
  8. package/dist/adapters/adapterEventRouting.js.map +1 -1
  9. package/dist/adapters/claudeCliAdapter.js +2 -2
  10. package/dist/adapters/claudeCliAdapter.js.map +1 -1
  11. package/dist/adapters/claudeConfigDir.d.ts +18 -0
  12. package/dist/adapters/claudeConfigDir.d.ts.map +1 -1
  13. package/dist/adapters/claudeJsonStreamAdapter.d.ts +82 -6
  14. package/dist/adapters/claudeJsonStreamAdapter.d.ts.map +1 -1
  15. package/dist/adapters/claudeJsonStreamAdapter.js +211 -14
  16. package/dist/adapters/claudeJsonStreamAdapter.js.map +1 -1
  17. package/dist/adapters/createAdapter.d.ts +14 -1
  18. package/dist/adapters/createAdapter.d.ts.map +1 -1
  19. package/dist/adapters/createAdapter.js +54 -2
  20. package/dist/adapters/createAdapter.js.map +1 -1
  21. package/dist/adapters/openCodeAdapter.d.ts +5 -0
  22. package/dist/adapters/openCodeAdapter.d.ts.map +1 -1
  23. package/dist/adapters/openCodeAdapter.js +7 -0
  24. package/dist/adapters/openCodeAdapter.js.map +1 -1
  25. package/dist/agentLogin/agentLogin.d.ts +18 -1
  26. package/dist/agentLogin/agentLogin.d.ts.map +1 -1
  27. package/dist/agentLogin/agentLogin.js +59 -18
  28. package/dist/agentLogin/agentLogin.js.map +1 -1
  29. package/dist/apiErrorRetry.d.ts +3 -1
  30. package/dist/apiErrorRetry.d.ts.map +1 -1
  31. package/dist/apiErrorRetry.js +11 -1
  32. package/dist/apiErrorRetry.js.map +1 -1
  33. package/dist/bot.d.ts.map +1 -1
  34. package/dist/bot.js +475 -105
  35. package/dist/bot.js.map +1 -1
  36. package/dist/cli/claudeProfiles.d.ts +1 -1
  37. package/dist/cli/claudeProfiles.d.ts.map +1 -1
  38. package/dist/cli/claudeProfiles.js +11 -6
  39. package/dist/cli/claudeProfiles.js.map +1 -1
  40. package/dist/connectors/jira/connector.d.ts +2 -0
  41. package/dist/connectors/jira/connector.d.ts.map +1 -1
  42. package/dist/connectors/jira/connector.js +5 -4
  43. package/dist/connectors/jira/connector.js.map +1 -1
  44. package/dist/connectors/telegram/commands/claudeAccounts.d.ts +6 -2
  45. package/dist/connectors/telegram/commands/claudeAccounts.d.ts.map +1 -1
  46. package/dist/connectors/telegram/commands/claudeAccounts.js +127 -28
  47. package/dist/connectors/telegram/commands/claudeAccounts.js.map +1 -1
  48. package/dist/connectors/telegram/commands/compaction.d.ts.map +1 -1
  49. package/dist/connectors/telegram/commands/compaction.js +39 -8
  50. package/dist/connectors/telegram/commands/compaction.js.map +1 -1
  51. package/dist/connectors/telegram/commands/fallbackChain.d.ts.map +1 -1
  52. package/dist/connectors/telegram/commands/fallbackChain.js +6 -2
  53. package/dist/connectors/telegram/commands/fallbackChain.js.map +1 -1
  54. package/dist/connectors/telegram/forumTopicCreated.d.ts +20 -0
  55. package/dist/connectors/telegram/forumTopicCreated.d.ts.map +1 -0
  56. package/dist/connectors/telegram/forumTopicCreated.js +16 -0
  57. package/dist/connectors/telegram/forumTopicCreated.js.map +1 -0
  58. package/dist/i18n/de.d.ts.map +1 -1
  59. package/dist/i18n/de.js +42 -1
  60. package/dist/i18n/de.js.map +1 -1
  61. package/dist/i18n/en.d.ts.map +1 -1
  62. package/dist/i18n/en.js +42 -1
  63. package/dist/i18n/en.js.map +1 -1
  64. package/dist/i18n/es.d.ts.map +1 -1
  65. package/dist/i18n/es.js +42 -1
  66. package/dist/i18n/es.js.map +1 -1
  67. package/dist/i18n/fr.d.ts.map +1 -1
  68. package/dist/i18n/fr.js +42 -1
  69. package/dist/i18n/fr.js.map +1 -1
  70. package/dist/i18n/hi.d.ts.map +1 -1
  71. package/dist/i18n/hi.js +42 -1
  72. package/dist/i18n/hi.js.map +1 -1
  73. package/dist/i18n/ja.d.ts.map +1 -1
  74. package/dist/i18n/ja.js +42 -1
  75. package/dist/i18n/ja.js.map +1 -1
  76. package/dist/i18n/ka.d.ts.map +1 -1
  77. package/dist/i18n/ka.js +42 -1
  78. package/dist/i18n/ka.js.map +1 -1
  79. package/dist/i18n/pt.d.ts.map +1 -1
  80. package/dist/i18n/pt.js +42 -1
  81. package/dist/i18n/pt.js.map +1 -1
  82. package/dist/i18n/ru.d.ts.map +1 -1
  83. package/dist/i18n/ru.js +42 -1
  84. package/dist/i18n/ru.js.map +1 -1
  85. package/dist/i18n/uk.d.ts.map +1 -1
  86. package/dist/i18n/uk.js +42 -1
  87. package/dist/i18n/uk.js.map +1 -1
  88. package/dist/i18n/uz.d.ts.map +1 -1
  89. package/dist/i18n/uz.js +42 -1
  90. package/dist/i18n/uz.js.map +1 -1
  91. package/dist/i18n/zh.d.ts.map +1 -1
  92. package/dist/i18n/zh.js +42 -1
  93. package/dist/i18n/zh.js.map +1 -1
  94. package/dist/i18n.d.ts +2 -0
  95. package/dist/i18n.d.ts.map +1 -1
  96. package/dist/i18n.js.map +1 -1
  97. package/dist/rateLimiter.d.ts +6 -0
  98. package/dist/rateLimiter.d.ts.map +1 -1
  99. package/dist/rateLimiter.js +9 -0
  100. package/dist/rateLimiter.js.map +1 -1
  101. package/dist/requests/wakeUpEngine.d.ts +4 -0
  102. package/dist/requests/wakeUpEngine.d.ts.map +1 -1
  103. package/dist/requests/wakeUpEngine.js +3 -3
  104. package/dist/requests/wakeUpEngine.js.map +1 -1
  105. package/dist/requests/wakeUpRules.d.ts +2 -1
  106. package/dist/requests/wakeUpRules.d.ts.map +1 -1
  107. package/dist/requests/wakeUpRules.js +3 -2
  108. package/dist/requests/wakeUpRules.js.map +1 -1
  109. package/dist/scheduler/mcpSurface.d.ts.map +1 -1
  110. package/dist/scheduler/mcpSurface.js +5 -3
  111. package/dist/scheduler/mcpSurface.js.map +1 -1
  112. package/dist/selfUpdate/updateMessages.d.ts +1 -1
  113. package/dist/selfUpdate/updateMessages.d.ts.map +1 -1
  114. package/dist/selfUpdate/updateMessages.js.map +1 -1
  115. package/dist/state.d.ts +67 -5
  116. package/dist/state.d.ts.map +1 -1
  117. package/dist/state.js +76 -7
  118. package/dist/state.js.map +1 -1
  119. package/dist/testTimings.d.ts +45 -0
  120. package/dist/testTimings.d.ts.map +1 -0
  121. package/dist/testTimings.js +89 -0
  122. package/dist/testTimings.js.map +1 -0
  123. package/dist/types.d.ts +49 -0
  124. package/dist/types.d.ts.map +1 -1
  125. package/dist/utils/adapterSwitchSessionIds.d.ts +5 -1
  126. package/dist/utils/adapterSwitchSessionIds.d.ts.map +1 -1
  127. package/dist/utils/adapterSwitchSessionIds.js +1 -1
  128. package/dist/utils/adapterSwitchSessionIds.js.map +1 -1
  129. package/dist/utils/adoptedToolList.d.ts +16 -21
  130. package/dist/utils/adoptedToolList.d.ts.map +1 -1
  131. package/dist/utils/adoptedToolList.js +18 -17
  132. package/dist/utils/adoptedToolList.js.map +1 -1
  133. package/dist/utils/anthropicApiKeyCheck.d.ts +19 -0
  134. package/dist/utils/anthropicApiKeyCheck.d.ts.map +1 -0
  135. package/dist/utils/anthropicApiKeyCheck.js +41 -0
  136. package/dist/utils/anthropicApiKeyCheck.js.map +1 -0
  137. package/dist/utils/claudeAccountPickerPlan.d.ts +6 -1
  138. package/dist/utils/claudeAccountPickerPlan.d.ts.map +1 -1
  139. package/dist/utils/claudeAccountPickerPlan.js +5 -1
  140. package/dist/utils/claudeAccountPickerPlan.js.map +1 -1
  141. package/dist/utils/claudeApiKeyHelper.d.ts +19 -0
  142. package/dist/utils/claudeApiKeyHelper.d.ts.map +1 -0
  143. package/dist/utils/claudeApiKeyHelper.js +32 -0
  144. package/dist/utils/claudeApiKeyHelper.js.map +1 -0
  145. package/dist/utils/claudeApiSpend.d.ts +73 -0
  146. package/dist/utils/claudeApiSpend.d.ts.map +1 -0
  147. package/dist/utils/claudeApiSpend.js +82 -0
  148. package/dist/utils/claudeApiSpend.js.map +1 -0
  149. package/dist/utils/claudeCompactHook.d.ts +11 -6
  150. package/dist/utils/claudeCompactHook.d.ts.map +1 -1
  151. package/dist/utils/claudeCompactHook.js +28 -11
  152. package/dist/utils/claudeCompactHook.js.map +1 -1
  153. package/dist/utils/claudeLimitSwitch.d.ts +2 -1
  154. package/dist/utils/claudeLimitSwitch.d.ts.map +1 -1
  155. package/dist/utils/claudeLimitSwitch.js +3 -2
  156. package/dist/utils/claudeLimitSwitch.js.map +1 -1
  157. package/dist/utils/claudeProfileUsageLines.d.ts +18 -3
  158. package/dist/utils/claudeProfileUsageLines.d.ts.map +1 -1
  159. package/dist/utils/claudeProfileUsageLines.js +23 -2
  160. package/dist/utils/claudeProfileUsageLines.js.map +1 -1
  161. package/dist/utils/claudeProfiles.d.ts +57 -2
  162. package/dist/utils/claudeProfiles.d.ts.map +1 -1
  163. package/dist/utils/claudeProfiles.js +96 -3
  164. package/dist/utils/claudeProfiles.js.map +1 -1
  165. package/dist/utils/claudeScheduledJobs.d.ts +49 -0
  166. package/dist/utils/claudeScheduledJobs.d.ts.map +1 -0
  167. package/dist/utils/claudeScheduledJobs.js +62 -0
  168. package/dist/utils/claudeScheduledJobs.js.map +1 -0
  169. package/dist/utils/claudeStreamJson.d.ts +35 -2
  170. package/dist/utils/claudeStreamJson.d.ts.map +1 -1
  171. package/dist/utils/claudeStreamJson.js +31 -8
  172. package/dist/utils/claudeStreamJson.js.map +1 -1
  173. package/dist/utils/claudeTranscriptContent.d.ts +8 -0
  174. package/dist/utils/claudeTranscriptContent.d.ts.map +1 -1
  175. package/dist/utils/claudeTranscriptContent.js +44 -0
  176. package/dist/utils/claudeTranscriptContent.js.map +1 -1
  177. package/dist/utils/claudeUsage.d.ts +22 -6
  178. package/dist/utils/claudeUsage.d.ts.map +1 -1
  179. package/dist/utils/claudeUsage.js +12 -5
  180. package/dist/utils/claudeUsage.js.map +1 -1
  181. package/dist/utils/claudeUsageRefresher.d.ts +6 -0
  182. package/dist/utils/claudeUsageRefresher.d.ts.map +1 -1
  183. package/dist/utils/claudeUsageRefresher.js +2 -2
  184. package/dist/utils/claudeUsageRefresher.js.map +1 -1
  185. package/dist/utils/compactOnIdle.d.ts +12 -0
  186. package/dist/utils/compactOnIdle.d.ts.map +1 -1
  187. package/dist/utils/compactOnIdle.js +15 -1
  188. package/dist/utils/compactOnIdle.js.map +1 -1
  189. package/dist/utils/doctorLine.d.ts +13 -0
  190. package/dist/utils/doctorLine.d.ts.map +1 -0
  191. package/dist/utils/doctorLine.js +18 -0
  192. package/dist/utils/doctorLine.js.map +1 -0
  193. package/dist/utils/effortPickerPlan.d.ts +1 -2
  194. package/dist/utils/effortPickerPlan.d.ts.map +1 -1
  195. package/dist/utils/effortPickerPlan.js.map +1 -1
  196. package/dist/utils/fallbackChain.d.ts +15 -8
  197. package/dist/utils/fallbackChain.d.ts.map +1 -1
  198. package/dist/utils/fallbackChain.js +30 -13
  199. package/dist/utils/fallbackChain.js.map +1 -1
  200. package/dist/utils/jsonStreamHost.d.ts +19 -7
  201. package/dist/utils/jsonStreamHost.d.ts.map +1 -1
  202. package/dist/utils/jsonStreamHost.js +25 -11
  203. package/dist/utils/jsonStreamHost.js.map +1 -1
  204. package/dist/utils/jsonStreamPendingWork.d.ts +44 -0
  205. package/dist/utils/jsonStreamPendingWork.d.ts.map +1 -0
  206. package/dist/utils/jsonStreamPendingWork.js +48 -0
  207. package/dist/utils/jsonStreamPendingWork.js.map +1 -0
  208. package/dist/utils/limitsBoardPlan.d.ts +4 -2
  209. package/dist/utils/limitsBoardPlan.d.ts.map +1 -1
  210. package/dist/utils/limitsBoardPlan.js +12 -5
  211. package/dist/utils/limitsBoardPlan.js.map +1 -1
  212. package/dist/utils/lostWork.d.ts +117 -0
  213. package/dist/utils/lostWork.d.ts.map +1 -0
  214. package/dist/utils/lostWork.js +187 -0
  215. package/dist/utils/lostWork.js.map +1 -0
  216. package/dist/utils/nativeWindows.d.ts +29 -0
  217. package/dist/utils/nativeWindows.d.ts.map +1 -0
  218. package/dist/utils/nativeWindows.js +50 -0
  219. package/dist/utils/nativeWindows.js.map +1 -0
  220. package/dist/utils/recvPreviewRedaction.d.ts +7 -2
  221. package/dist/utils/recvPreviewRedaction.d.ts.map +1 -1
  222. package/dist/utils/recvPreviewRedaction.js +10 -4
  223. package/dist/utils/recvPreviewRedaction.js.map +1 -1
  224. package/dist/utils/threadStatusReport.d.ts +12 -1
  225. package/dist/utils/threadStatusReport.d.ts.map +1 -1
  226. package/dist/utils/threadStatusReport.js +13 -4
  227. package/dist/utils/threadStatusReport.js.map +1 -1
  228. package/dist/utils/updateScreenPlan.d.ts +1 -1
  229. package/dist/utils/updateScreenPlan.d.ts.map +1 -1
  230. package/dist/utils/updateScreenPlan.js.map +1 -1
  231. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"claudeCompactHook.js","sourceRoot":"","sources":["../../src/utils/claudeCompactHook.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;AAuBH,oEAOC;AASD,gEAKC;AAGD,wEAIC;AASD,sEAiBC;AA3ED,4CAAoB;AACpB,gDAAwB;AACxB,mDAIyB;AACzB,yCAA8C;AAE9C;;;;GAIG;AACU,QAAA,iCAAiC,GAAG,0BAA0B,CAAC;AAE5E;;;;GAIG;AACH,SAAgB,4BAA4B;IAC1C,OAAO,IAAA,0CAA0B,EAAC;QAChC,oBAAoB,EAAE,KAAK;QAC3B,eAAe,EAAE,yCAAyB;QAC1C,mBAAmB,EAAE,KAAK;QAC1B,cAAc,EAAE,wCAAwB;KACzC,CAAC,IAAI,EAAE,CAAC;AACX,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,0BAA0B,CAAC,KAG1C;IACC,OAAO,eAAe,IAAA,2BAAgB,EAAC,KAAK,CAA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AAE,CAAC,CAAC,CAAC;QAChE,IAAI,CAAC;YAAC,YAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC,CAAC,mBAAmB,CAAC,CAAC;QAC7D,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC"}
@@ -16,7 +16,8 @@ export { resolveClaudeAutoSwitchOnLimitEnabled } from './autoContinueOnLimit';
16
16
  * @description The profiles that may take a topic's work over, best first: signed in, not marked limited, with
17
17
  * KNOWN and fresh usage that leaves headroom on the windows `model` drains, and not the profile that just hit
18
18
  * the limit. A profile whose usage is unknown or stale is left out on purpose — the switch is sold as "this
19
- * one has room", and a guess could land the topic in a second limit.
19
+ * one has room", and a guess could land the topic in a second limit. An account billed to API credits is never
20
+ * one of them: it has no windows to have room on, and only the operator decides to spend money (the chain's rung).
20
21
  */
21
22
  export declare function pickClaudeLimitSwitchCandidates(input: {
22
23
  profiles: readonly ClaudeProfileUsageView[];
@@ -1 +1 @@
1
- {"version":3,"file":"claudeLimitSwitch.d.ts","sourceRoot":"","sources":["../../src/utils/claudeLimitSwitch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAmD,KAAK,sBAAsB,EAAE,KAAK,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEvI,gHAAgH;AAChH,OAAO,EAAE,qCAAqC,EAAE,MAAM,uBAAuB,CAAC;AAE9E;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAAC,KAAK,EAAE;IACrD,QAAQ,EAAE,SAAS,sBAAsB,EAAE,CAAC;IAC5C,4DAA4D;IAC5D,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,MAAM,EAAE,CAQX;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE;IAC/C,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,KAAK,EAAE,mBAAmB,GAAG,SAAS,CAAC;IACvC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,MAAM,CAWT"}
1
+ {"version":3,"file":"claudeLimitSwitch.d.ts","sourceRoot":"","sources":["../../src/utils/claudeLimitSwitch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAmD,KAAK,sBAAsB,EAAE,KAAK,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEvI,gHAAgH;AAChH,OAAO,EAAE,qCAAqC,EAAE,MAAM,uBAAuB,CAAC;AAE9E;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAAC,KAAK,EAAE;IACrD,QAAQ,EAAE,SAAS,sBAAsB,EAAE,CAAC;IAC5C,4DAA4D;IAC5D,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,MAAM,EAAE,CAQX;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE;IAC/C,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,KAAK,EAAE,mBAAmB,GAAG,SAAS,CAAC;IACvC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,MAAM,CAWT"}
@@ -22,12 +22,13 @@ Object.defineProperty(exports, "resolveClaudeAutoSwitchOnLimitEnabled", { enumer
22
22
  * @description The profiles that may take a topic's work over, best first: signed in, not marked limited, with
23
23
  * KNOWN and fresh usage that leaves headroom on the windows `model` drains, and not the profile that just hit
24
24
  * the limit. A profile whose usage is unknown or stale is left out on purpose — the switch is sold as "this
25
- * one has room", and a guess could land the topic in a second limit.
25
+ * one has room", and a guess could land the topic in a second limit. An account billed to API credits is never
26
+ * one of them: it has no windows to have room on, and only the operator decides to spend money (the chain's rung).
26
27
  */
27
28
  function pickClaudeLimitSwitchCandidates(input) {
28
29
  const report = (0, claudeUsage_1.buildClaudeProfilesReport)(input.profiles, input.model, input.nowMs);
29
30
  return report.profiles
30
- .filter((entry) => entry.name !== input.currentName)
31
+ .filter((entry) => entry.name !== input.currentName && entry.billing !== 'api')
31
32
  .filter((entry) => entry.isEligible && entry.loggedIn === true && !entry.isUsageStale)
32
33
  .filter((entry) => entry.headroomPercent !== null && entry.headroomPercent > 0)
33
34
  .sort((a, b) => (b.headroomPercent ?? 0) - (a.headroomPercent ?? 0))
@@ -1 +1 @@
1
- {"version":3,"file":"claudeLimitSwitch.js","sourceRoot":"","sources":["../../src/utils/claudeLimitSwitch.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAaH,0EAcC;AAOD,8DAiBC;AAjDD,+CAAuI;AAEvI,gHAAgH;AAChH,6DAA8E;AAArE,4IAAA,qCAAqC,OAAA;AAE9C;;;;;GAKG;AACH,SAAgB,+BAA+B,CAAC,KAM/C;IACC,MAAM,MAAM,GAAG,IAAA,uCAAyB,EAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACnF,OAAO,MAAM,CAAC,QAAQ;SACnB,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,WAAW,CAAC;SACnD,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;SACrF,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,eAAe,KAAK,IAAI,IAAI,KAAK,CAAC,eAAe,GAAG,CAAC,CAAC;SAC9E,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,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACrF,IAAI,OAAO,GAAG,KAAK,CAAC,SAAS,KAAK,SAAS,IAAI,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,KAAK;QAC1E,CAAC,CAAC,KAAK,CAAC,SAAS;QACjB,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,cAAc,GAAG,KAAK,CAAC,KAAK;YAC/D,CAAC,CAAC,cAAc;YAChB,CAAC,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC;IACrC,MAAM,UAAU,GAAG,KAAK,CAAC,oBAAoB,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;IAC7G,IAAI,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,UAAU,GAAG,OAAO;QAAE,OAAO,GAAG,UAAU,CAAC;IAC9E,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;AACzC,CAAC"}
@@ -1,15 +1,30 @@
1
+ import type { ClaudeProfileBilling } from './claudeProfiles';
2
+ import { type ClaudeApiSpend } from './claudeApiSpend';
1
3
  import { type ClaudeUsageSnapshot } from './claudeUsage';
2
- /** What the lines read of a profile: its usage snapshot and limit mark (a state record and a usage view both fit). */
4
+ /**
5
+ * What the lines read of a profile: its usage snapshot, limit mark, billing and used-up-credits mark (a state record and
6
+ * a usage view both fit).
7
+ */
3
8
  export interface ClaudeProfileUsageSource {
4
9
  usage?: ClaudeUsageSnapshot;
5
10
  limitedUntil?: string | null;
11
+ billing?: ClaudeProfileBilling | null;
12
+ creditExhaustedAt?: string | null;
13
+ apiSpend?: ClaudeApiSpend;
6
14
  }
7
15
  /**
8
16
  * @description The profile's usage as display lines: the windows as `used% 🔄 reset` — 5h and weekly always (`—`
9
17
  * for one the snapshot lacks), Fable only when the account HAS that window (a corporate seat has none: nothing
10
18
  * is written about it) — `(stale)` when the last poll could not refresh, and the limit mark while it holds, the
11
- * reset instant in `timezone`. The lines carry the locale's own indentation (they hang under a row); empty for a
12
- * profile never polled and not limited.
19
+ * reset instant in `timezone`, and the used-up-credits mark while it holds. An account billed to API credits has no
20
+ * windows (its row already says it pays per use): what it spent through the bot, and that mark. The lines carry the
21
+ * locale's own indentation (they hang under a row); empty for an account with nothing to show.
13
22
  */
14
23
  export declare function formatClaudeProfileUsageLines(source: ClaudeProfileUsageSource | undefined, timezone: string, nowMs: number): string[];
24
+ /** The placeholders every spend text fills: `total`, `since` (the day, in `timezone`), `last` (the last turn's). */
25
+ export declare function formatClaudeApiSpendWords(spend: ClaudeApiSpend, timezone: string, nowMs: number): {
26
+ total: string;
27
+ since: string;
28
+ last: string;
29
+ };
15
30
  //# sourceMappingURL=claudeProfileUsageLines.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"claudeProfileUsageLines.d.ts","sourceRoot":"","sources":["../../src/utils/claudeProfileUsageLines.ts"],"names":[],"mappings":"AAKA,OAAO,EAML,KAAK,mBAAmB,EACzB,MAAM,eAAe,CAAC;AAEvB,sHAAsH;AACtH,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAOD;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,wBAAwB,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAoBrI"}
1
+ {"version":3,"file":"claudeProfileUsageLines.d.ts","sourceRoot":"","sources":["../../src/utils/claudeProfileUsageLines.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAkC,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAML,KAAK,mBAAmB,EACzB,MAAM,eAAe,CAAC;AAEvB;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACtC,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAOD;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,wBAAwB,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAuBrI;AAUD,oHAAoH;AACpH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAEhJ"}
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.formatClaudeProfileUsageLines = formatClaudeProfileUsageLines;
4
+ exports.formatClaudeApiSpendWords = formatClaudeApiSpendWords;
4
5
  /**
5
6
  * The usage lines of one Claude account profile — what `/accounts` prints under a profile row and `/limits`
6
7
  * prints at the top of its screen. ONE renderer for both, so the two screens can never word a window differently.
7
8
  */
8
9
  const i18n_1 = require("../i18n");
10
+ const claudeApiSpend_1 = require("./claudeApiSpend");
9
11
  const claudeUsage_1 = require("./claudeUsage");
10
12
  /** The localised words of a relative reset («🔄 in 2h»). */
11
13
  function getRelativeResetWords() {
@@ -15,10 +17,13 @@ function getRelativeResetWords() {
15
17
  * @description The profile's usage as display lines: the windows as `used% 🔄 reset` — 5h and weekly always (`—`
16
18
  * for one the snapshot lacks), Fable only when the account HAS that window (a corporate seat has none: nothing
17
19
  * is written about it) — `(stale)` when the last poll could not refresh, and the limit mark while it holds, the
18
- * reset instant in `timezone`. The lines carry the locale's own indentation (they hang under a row); empty for a
19
- * profile never polled and not limited.
20
+ * reset instant in `timezone`, and the used-up-credits mark while it holds. An account billed to API credits has no
21
+ * windows (its row already says it pays per use): what it spent through the bot, and that mark. The lines carry the
22
+ * locale's own indentation (they hang under a row); empty for an account with nothing to show.
20
23
  */
21
24
  function formatClaudeProfileUsageLines(source, timezone, nowMs) {
25
+ if (source?.billing === 'api')
26
+ return formatApiBillingLines(source, timezone, nowMs);
22
27
  const lines = [];
23
28
  const usage = source?.usage;
24
29
  if (usage && usage.buckets.length > 0) {
@@ -37,6 +42,22 @@ function formatClaudeProfileUsageLines(source, timezone, nowMs) {
37
42
  if (source?.limitedUntil && Date.parse(source.limitedUntil) > nowMs) {
38
43
  lines.push((0, i18n_1.t)('account.row.limited', { until: (0, claudeUsage_1.formatClaudeUsageResetAt)(source.limitedUntil, timezone, nowMs) }));
39
44
  }
45
+ // The refusal can come from any account (its billing unrecorded, extra usage): the mark keeps it out of the chain.
46
+ if (source?.creditExhaustedAt)
47
+ lines.push((0, i18n_1.t)('account.row.creditExhausted'));
40
48
  return lines;
41
49
  }
50
+ /** The lines of an account billed to API credits: its spend through the bot, and the used-up mark while it holds. */
51
+ function formatApiBillingLines(source, timezone, nowMs) {
52
+ const lines = [];
53
+ if (source.apiSpend)
54
+ lines.push((0, i18n_1.t)('account.row.apiSpend', formatClaudeApiSpendWords(source.apiSpend, timezone, nowMs)));
55
+ if (source.creditExhaustedAt)
56
+ lines.push((0, i18n_1.t)('account.row.creditExhausted'));
57
+ return lines;
58
+ }
59
+ /** The placeholders every spend text fills: `total`, `since` (the day, in `timezone`), `last` (the last turn's). */
60
+ function formatClaudeApiSpendWords(spend, timezone, nowMs) {
61
+ return { total: (0, claudeApiSpend_1.formatUsd)(spend.totalUsd), since: (0, claudeApiSpend_1.formatSpendSinceDay)(spend.since, timezone, nowMs), last: (0, claudeApiSpend_1.formatUsd)(spend.lastTurnUsd) };
62
+ }
42
63
  //# sourceMappingURL=claudeProfileUsageLines.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"claudeProfileUsageLines.js","sourceRoot":"","sources":["../../src/utils/claudeProfileUsageLines.ts"],"names":[],"mappings":";;AAgCA,sEAoBC;AApDD;;;GAGG;AACH,kCAA4B;AAC5B,+CAOuB;AAQvB,4DAA4D;AAC5D,SAAS,qBAAqB;IAC5B,OAAO,EAAE,OAAO,EAAE,IAAA,QAAC,EAAC,eAAe,CAAC,EAAE,GAAG,EAAE,IAAA,QAAC,EAAC,eAAe,CAAC,EAAE,IAAI,EAAE,IAAA,QAAC,EAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,IAAA,QAAC,EAAC,kBAAkB,CAAC,EAAE,CAAC;AAC5H,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,6BAA6B,CAAC,MAA4C,EAAE,QAAgB,EAAE,KAAa;IACzH,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,KAAK,GAAG,MAAM,EAAE,KAAK,CAAC;IAC5B,IAAI,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtC,MAAM,KAAK,GAAG,qBAAqB,EAAE,CAAC;QACtC,0FAA0F;QAC1F,MAAM,WAAW,GAAG,IAAA,kCAAoB,EAAC,KAAK,EAAE,YAAY,CAAC,EAAE,QAAQ,IAAI,IAAI,CAAC;QAChF,MAAM,IAAI,GAAG,CAAC,IAA2B,EAAE,EAAE,CAAC,IAAA,qCAAuB,EAAC,IAAA,kCAAoB,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,KAAK,EAAE;YAC9G,KAAK;YACL,gBAAgB,EAAE,IAAI,KAAK,SA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AAgB,yBAAyB,CAAC,KAAqB,EAAE,QAAgB,EAAE,KAAa;IAC9F,OAAO,EAAE,KAAK,EAAE,IAAA,0BAAS,EAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,IAAA,oCAAmB,EAAC,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,IAAA,0BAAS,EAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC;AAC5I,CAAC"}
@@ -1,6 +1,8 @@
1
1
  /**
2
- * @description Claude ACCOUNT PROFILES — several Claude subscription logins kept side by side, one picked per
3
- * topic (`/account`). A profile is a Claude Code config directory of its own under
2
+ * @description Claude ACCOUNT PROFILES — several Claude logins kept side by side, one picked per topic
3
+ * (`/account`): subscriptions, and accounts billed to a Claude Console organization's API credits (`billing: 'api'` —
4
+ * a console login's key in the profile's own `.claude.json`, or a pasted key the profile's `apiKeyHelper` reads; see
5
+ * the «pasted API key» helpers below). Nothing of an API account ever goes through `ANTHROPIC_API_KEY`. A profile is a Claude Code config directory of its own under
4
6
  * `DATA_DIR/claude-profiles/<name>/`, handed to the CLI through `CLAUDE_CONFIG_DIR`: the CLI keeps its
5
7
  * login (`.credentials.json`, `.claude.json`) there, while the entries that must stay ONE across accounts —
6
8
  * the transcripts (`projects/`), settings, skills, plugins and the user memory — are symlinks back into
@@ -83,6 +85,12 @@ export declare function resolveClaudeProfileName(input: {
83
85
  threadOverride: string | undefined;
84
86
  knownNames: ReadonlySet<string>;
85
87
  }): string;
88
+ /**
89
+ * How an account pays for its requests: a Claude `subscription` (claude.ai login: usage windows, no bill per request)
90
+ * or the `api` balance of a Claude Console organization (a console login's API key, or a pasted key: billed per token,
91
+ * no windows — the limit is the balance).
92
+ */
93
+ export type ClaudeProfileBilling = 'subscription' | 'api';
86
94
  /** What the account picker shows per profile, as the CLI reports it (`claude auth status --json`). */
87
95
  export interface ClaudeAuthStatus {
88
96
  loggedIn: boolean;
@@ -90,12 +98,59 @@ export interface ClaudeAuthStatus {
90
98
  /** `pro` / `max` (personal), `team` / `enterprise` (corporate), or whatever newer CLIs add. */
91
99
  subscriptionType: string | null;
92
100
  orgName: string | null;
101
+ /** The CLI's `authMethod`: `claude.ai`, `api_key`, `api_key_helper`, `oauth_token`, `third_party`, `none`; `null` on an older CLI. */
102
+ authMethod: string | null;
103
+ /** Where an API key comes from: `/login managed key` (a console login), `apiKeyHelper`, `ANTHROPIC_API_KEY`. */
104
+ apiKeySource: string | null;
105
+ /** {@link getClaudeAuthBilling} of the two above; `null` when the method says nothing about it (signed out, unknown). */
106
+ billing: ClaudeProfileBilling | null;
93
107
  }
108
+ /**
109
+ * @description The billing an auth method means: an API key in any form (`api_key` — a console login or the
110
+ * variable — and `api_key_helper`) bills the Console balance; `claude.ai` is the subscription. Anything else (signed
111
+ * out, a cloud provider, a long-lived OAuth token) is `null`: the caller keeps what it knew.
112
+ */
113
+ export declare function getClaudeAuthBilling(authMethod: string | null): ClaudeProfileBilling | null;
94
114
  /**
95
115
  * @description Parse the CLI's auth status. `null` for anything that is not the JSON object the CLI prints
96
116
  * (the probe failed, an older CLI) — the caller treats it as "unknown", never as "logged out".
97
117
  */
98
118
  export declare function parseClaudeAuthStatus(statusJson: string): ClaudeAuthStatus | null;
119
+ /** The `apiKeySource` of a key a `claude auth login --console` created and stored in the profile's own `.claude.json`. */
120
+ export declare const claudeConsoleLoginKeySource = "/login managed key";
121
+ /**
122
+ * The file a pasted Anthropic API key is kept in, inside the profile's own directory (`0600`): never in `state.json`,
123
+ * never in the environment. The CLI reads it through `apiKeyHelper` (`utils/claudeApiKeyHelper.ts`), which rides
124
+ * the profile's `--settings` only.
125
+ */
126
+ export declare const claudeProfileApiKeyFileName = "charness-api-key";
127
+ /** The launch settings of a profile that holds a pasted key: the PreCompact hook AND the `apiKeyHelper` (one file — only the last `--settings` counts). */
128
+ export declare const claudeProfileLaunchSettingsFileName = "charness-settings.json";
129
+ /** An Anthropic credential anywhere in a text (the trace preview redacts it). */
130
+ export declare const anthropicSecretInTextRe: RegExp;
131
+ /** Whether `text` (trimmed) is an Anthropic API key that can run Claude Code. */
132
+ export declare function checkIsPlausibleAnthropicApiKey(text: string): boolean;
133
+ /**
134
+ * Whether `text` carries an Anthropic credential of any kind — it starts like one, or holds one anywhere
135
+ * (`ANTHROPIC_API_KEY=sk-ant-…` copied from an env file, a key inside a sentence): it is a secret, whatever else it is.
136
+ */
137
+ export declare function checkIsAnthropicSecretLike(text: string): boolean;
138
+ /**
139
+ * The one API key a pasted text carries — the bare key, or the key inside `ANTHROPIC_API_KEY=…`, quotes or a
140
+ * sentence; `null` when it carries no API key (an admin key, an OAuth token) or more than one credential.
141
+ */
142
+ export declare function extractAnthropicApiKey(text: string): string | null;
143
+ /** The key file of a profile directory. */
144
+ export declare function resolveClaudeProfileApiKeyFile(configDir: string): string;
145
+ /** Whether the profile directory holds a pasted key (`null` = `~/.claude`, which never does: the bot writes none there). */
146
+ export declare function checkHasClaudeProfileApiKey(configDir: string | null): boolean;
147
+ /**
148
+ * @description Store a pasted key in the profile's directory: `0600`, written through a temp file and renamed, so a
149
+ * process reading it through the helper never sees half a key. The key is never logged.
150
+ */
151
+ export declare function writeClaudeProfileApiKey(configDir: string, apiKey: string): void;
152
+ /** Drop a profile's pasted key (and the launch settings that point at it); a missing file is fine. */
153
+ export declare function removeClaudeProfileApiKey(configDir: string): void;
99
154
  /**
100
155
  * @description The stdout a failed `execFile` carries, `''` for anything else. `claude auth status --json`
101
156
  * exits NON-ZERO for a logged-out directory while printing its JSON (probed on 2.1.296), so the probe's
@@ -1 +1 @@
1
- {"version":3,"file":"claudeProfiles.d.ts","sourceRoot":"","sources":["../../src/utils/claudeProfiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAMH,uEAAuE;AACvE,eAAO,MAAM,wBAAwB,YAAY,CAAC;AAElD,8EAA8E;AAC9E,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AAEvD;;;;;GA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AS,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAO7E;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAMhF;AAED,sGAAsG;AACtG,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAGjE;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAM7D;AAED,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,CAAC;AAErE,uHAAuH;AACvH,wBAAgB,oBAAoB,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAAG,iBAAiB,CAMvF;AAID,eAAO,MAAM,2BAA2B,sBAAsB,CAAC;AAE/D;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAQ7F;AAED;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM9E"}
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  /**
3
- * @description Claude ACCOUNT PROFILES — several Claude subscription logins kept side by side, one picked per
4
- * topic (`/account`). A profile is a Claude Code config directory of its own under
3
+ * @description Claude ACCOUNT PROFILES — several Claude logins kept side by side, one picked per topic
4
+ * (`/account`): subscriptions, and accounts billed to a Claude Console organization's API credits (`billing: 'api'` —
5
+ * a console login's key in the profile's own `.claude.json`, or a pasted key the profile's `apiKeyHelper` reads; see
6
+ * the «pasted API key» helpers below). Nothing of an API account ever goes through `ANTHROPIC_API_KEY`. A profile is a Claude Code config directory of its own under
5
7
  * `DATA_DIR/claude-profiles/<name>/`, handed to the CLI through `CLAUDE_CONFIG_DIR`: the CLI keeps its
6
8
  * login (`.credentials.json`, `.claude.json`) there, while the entries that must stay ONE across accounts —
7
9
  * the transcripts (`projects/`), settings, skills, plugins and the user memory — are symlinks back into
@@ -52,7 +54,7 @@ var __importStar = (this && this.__importStar) || (function () {
52
54
  };
53
55
  })();
54
56
  Object.defineProperty(exports, "__esModule", { value: true });
55
- exports.claudeConfigDirVariableName = exports.claudeAccountCallbackPrefix = exports.claudeProfileNameMaxLength = exports.claudeProfileOptionalSharedEntries = exports.claudeProfileSharedEntries = exports.claudeProfilesDirName = exports.defaultClaudeProfileName = void 0;
57
+ exports.claudeConfigDirVariableName = exports.anthropicSecretInTextRe = exports.claudeProfileLaunchSettingsFileName = exports.claudeProfileApiKeyFileName = exports.claudeConsoleLoginKeySource = exports.claudeAccountCallbackPrefix = exports.claudeProfileNameMaxLength = exports.claudeProfileOptionalSharedEntries = exports.claudeProfileSharedEntries = exports.claudeProfilesDirName = exports.defaultClaudeProfileName = void 0;
56
58
  exports.checkIsValidClaudeProfileName = checkIsValidClaudeProfileName;
57
59
  exports.normaliseClaudeProfileName = normaliseClaudeProfileName;
58
60
  exports.resolveClaudeProfilesRoot = resolveClaudeProfilesRoot;
@@ -63,7 +65,15 @@ exports.removeClaudeProfileLayout = removeClaudeProfileLayout;
63
65
  exports.signOutDefaultClaudeLogin = signOutDefaultClaudeLogin;
64
66
  exports.checkClaudeProfileDirExists = checkClaudeProfileDirExists;
65
67
  exports.resolveClaudeProfileName = resolveClaudeProfileName;
68
+ exports.getClaudeAuthBilling = getClaudeAuthBilling;
66
69
  exports.parseClaudeAuthStatus = parseClaudeAuthStatus;
70
+ exports.checkIsPlausibleAnthropicApiKey = checkIsPlausibleAnthropicApiKey;
71
+ exports.checkIsAnthropicSecretLike = checkIsAnthropicSecretLike;
72
+ exports.extractAnthropicApiKey = extractAnthropicApiKey;
73
+ exports.resolveClaudeProfileApiKeyFile = resolveClaudeProfileApiKeyFile;
74
+ exports.checkHasClaudeProfileApiKey = checkHasClaudeProfileApiKey;
75
+ exports.writeClaudeProfileApiKey = writeClaudeProfileApiKey;
76
+ exports.removeClaudeProfileApiKey = removeClaudeProfileApiKey;
67
77
  exports.readProcessErrorStdout = readProcessErrorStdout;
68
78
  exports.getClaudeAccountKind = getClaudeAccountKind;
69
79
  exports.checkIsSameClaudeConfigDir = checkIsSameClaudeConfigDir;
@@ -214,6 +224,18 @@ function resolveClaudeProfileName(input) {
214
224
  return input.globalDefault;
215
225
  return exports.defaultClaudeProfileName;
216
226
  }
227
+ /**
228
+ * @description The billing an auth method means: an API key in any form (`api_key` — a console login or the
229
+ * variable — and `api_key_helper`) bills the Console balance; `claude.ai` is the subscription. Anything else (signed
230
+ * out, a cloud provider, a long-lived OAuth token) is `null`: the caller keeps what it knew.
231
+ */
232
+ function getClaudeAuthBilling(authMethod) {
233
+ if (authMethod === 'api_key' || authMethod === 'api_key_helper')
234
+ return 'api';
235
+ if (authMethod === 'claude.ai')
236
+ return 'subscription';
237
+ return null;
238
+ }
217
239
  /**
218
240
  * @description Parse the CLI's auth status. `null` for anything that is not the JSON object the CLI prints
219
241
  * (the probe failed, an older CLI) — the caller treats it as "unknown", never as "logged out".
@@ -232,13 +254,84 @@ function parseClaudeAuthStatus(statusJson) {
232
254
  if (typeof record.loggedIn !== 'boolean')
233
255
  return null;
234
256
  const readString = (value) => (typeof value === 'string' && value.trim() !== '' ? value : null);
257
+ const authMethod = readString(record.authMethod);
235
258
  return {
236
259
  loggedIn: record.loggedIn,
237
260
  email: readString(record.email),
238
261
  subscriptionType: readString(record.subscriptionType),
239
262
  orgName: readString(record.orgName),
263
+ authMethod,
264
+ apiKeySource: readString(record.apiKeySource),
265
+ billing: record.loggedIn ? getClaudeAuthBilling(authMethod) : null,
240
266
  };
241
267
  }
268
+ /** The `apiKeySource` of a key a `claude auth login --console` created and stored in the profile's own `.claude.json`. */
269
+ exports.claudeConsoleLoginKeySource = '/login managed key';
270
+ // ── a pasted API key (`apiKeyHelper`) ──
271
+ /**
272
+ * The file a pasted Anthropic API key is kept in, inside the profile's own directory (`0600`): never in `state.json`,
273
+ * never in the environment. The CLI reads it through `apiKeyHelper` (`utils/claudeApiKeyHelper.ts`), which rides
274
+ * the profile's `--settings` only.
275
+ */
276
+ exports.claudeProfileApiKeyFileName = 'charness-api-key';
277
+ /** The launch settings of a profile that holds a pasted key: the PreCompact hook AND the `apiKeyHelper` (one file — only the last `--settings` counts). */
278
+ exports.claudeProfileLaunchSettingsFileName = 'charness-settings.json';
279
+ /** An Anthropic API key: `sk-ant-api03-…` (an admin key `sk-ant-admin…` or an OAuth token `sk-ant-oat…` cannot run Claude Code). */
280
+ const anthropicApiKeyRe = /^sk-ant-api\d{2}-[A-Za-z0-9_-]{20,250}$/;
281
+ /** Anything that starts like an Anthropic credential — deleted from the topic as a secret even when it is not a usable key. */
282
+ const anthropicSecretPrefixRe = /^sk-ant-/;
283
+ /** An Anthropic credential anywhere in a text (the trace preview redacts it). */
284
+ exports.anthropicSecretInTextRe = /sk-ant-[A-Za-z0-9_-]{8,}/g;
285
+ /** Whether `text` (trimmed) is an Anthropic API key that can run Claude Code. */
286
+ function checkIsPlausibleAnthropicApiKey(text) {
287
+ return anthropicApiKeyRe.test(text.trim());
288
+ }
289
+ /**
290
+ * Whether `text` carries an Anthropic credential of any kind — it starts like one, or holds one anywhere
291
+ * (`ANTHROPIC_API_KEY=sk-ant-…` copied from an env file, a key inside a sentence): it is a secret, whatever else it is.
292
+ */
293
+ function checkIsAnthropicSecretLike(text) {
294
+ return anthropicSecretPrefixRe.test(text.trim()) || (text.match(exports.anthropicSecretInTextRe)?.length ?? 0) > 0;
295
+ }
296
+ /**
297
+ * The one API key a pasted text carries — the bare key, or the key inside `ANTHROPIC_API_KEY=…`, quotes or a
298
+ * sentence; `null` when it carries no API key (an admin key, an OAuth token) or more than one credential.
299
+ */
300
+ function extractAnthropicApiKey(text) {
301
+ const credentials = text.match(exports.anthropicSecretInTextRe) ?? [];
302
+ return credentials.length === 1 && checkIsPlausibleAnthropicApiKey(credentials[0]) ? credentials[0] : null;
303
+ }
304
+ /** The key file of a profile directory. */
305
+ function resolveClaudeProfileApiKeyFile(configDir) {
306
+ return path.join(configDir, exports.claudeProfileApiKeyFileName);
307
+ }
308
+ /** Whether the profile directory holds a pasted key (`null` = `~/.claude`, which never does: the bot writes none there). */
309
+ function checkHasClaudeProfileApiKey(configDir) {
310
+ if (configDir === null)
311
+ return false;
312
+ try {
313
+ return fs.statSync(resolveClaudeProfileApiKeyFile(configDir)).isFile();
314
+ }
315
+ catch {
316
+ return false;
317
+ }
318
+ }
319
+ /**
320
+ * @description Store a pasted key in the profile's directory: `0600`, written through a temp file and renamed, so a
321
+ * process reading it through the helper never sees half a key. The key is never logged.
322
+ */
323
+ function writeClaudeProfileApiKey(configDir, apiKey) {
324
+ const file = resolveClaudeProfileApiKeyFile(configDir);
325
+ const tmp = `${file}.${process.pid}.tmp`;
326
+ fs.writeFileSync(tmp, `${apiKey.trim()}\n`, { mode: 0o600 });
327
+ fs.chmodSync(tmp, 0o600);
328
+ fs.renameSync(tmp, file);
329
+ }
330
+ /** Drop a profile's pasted key (and the launch settings that point at it); a missing file is fine. */
331
+ function removeClaudeProfileApiKey(configDir) {
332
+ fs.rmSync(resolveClaudeProfileApiKeyFile(configDir), { force: true });
333
+ fs.rmSync(path.join(configDir, exports.claudeProfileLaunchSettingsFileName), { force: true });
334
+ }
242
335
  /**
243
336
  * @description The stdout a failed `execFile` carries, `''` for anything else. `claude auth status --json`
244
337
  * exits NON-ZERO for a logged-out directory while printing its JSON (probed on 2.1.296), so the probe's
@@ -1 +1 @@
1
- {"version":3,"file":"claudeProfiles.js","sourceRoot":"","sources":["../../src/utils/claudeProfiles.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCH,sEAEC;AAGD,gEAEC;AAED,8DAEC;AAMD,0DAGC;AAGD,oDAEC;AAQD,8DA6BC;AAMD,8DAIC;AAQD,8DAoBC;AAGD,kEAGC;AAOD,4DAUC;AAiB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AAE,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IACnE,OAAO,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AACtC,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @description Session-only scheduled jobs of a Claude Code process, read off its tool results: `CronCreate` jobs and
3
+ * the `ScheduleWakeup` (`/loop`) wakeup. The CLI keeps them in memory only ("Session-only (not written to disk, dies
4
+ * when Claude exits)") and never lists them in `background_tasks_changed`, so the bot tracks them itself: a stop drops
5
+ * every one with the process.
6
+ *
7
+ * The wordings were probed live on Claude Code 2.1.310:
8
+ * CronCreate → `Scheduled one-shot task 59151bd3 (…). … It will fire once then auto-delete.`
9
+ * → `Scheduled recurring job 99a38c99 (Every 3 hours at :17). … Auto-expires after 7 days. …`
10
+ * CronDelete → `Cancelled job 99a38c99.`
11
+ * ScheduleWakeup → `Next wakeup scheduled for 15:05:00 (in 63s). …`
12
+ * A job firing starts a turn with a `command_lifecycle` frame naming its source, not the job: `schedule_wakeup` for a
13
+ * `CronCreate` job, `loop_wakeup` for the `ScheduleWakeup` one. An unrecognised wording tracks nothing — the process
14
+ * is then held exactly as before this tracking (a cancelled wakeup's wording is not known: it is held until the hold
15
+ * runs out).
16
+ */
17
+ export declare const cronCreateToolName = "CronCreate";
18
+ export declare const cronDeleteToolName = "CronDelete";
19
+ export declare const loopWakeupToolName = "ScheduleWakeup";
20
+ /**
21
+ * @name ScheduledJobKind
22
+ * @description `oneShot` / `recurring` — a `CronCreate` job (a one-shot job is gone once it fires, a recurring one stays
23
+ * until cancelled); `loopWakeup` — the one pending `ScheduleWakeup`, gone once it fires.
24
+ */
25
+ export type ScheduledJobKind = 'oneShot' | 'recurring' | 'loopWakeup';
26
+ /** @name ScheduledJob @description A session-only job the process holds. */
27
+ export interface ScheduledJob {
28
+ jobId: string;
29
+ kind: ScheduledJobKind;
30
+ }
31
+ /** The firing source of a `command_lifecycle` frame: a `CronCreate` job, or the `ScheduleWakeup` wakeup. */
32
+ export type ScheduledWakeupSource = 'cron' | 'loop';
33
+ /** The one `ScheduleWakeup` slot: a new wakeup replaces the pending one. */
34
+ export declare const loopWakeupJobId = "loop-wakeup";
35
+ /** @description The job a `CronCreate` result scheduled, `null` for any other text (an error, a new wording). */
36
+ export declare function getScheduledJobFromCronCreateResult(output: string): ScheduledJob | null;
37
+ /** @description The id a `CronDelete` result cancelled, `null` for any other text. */
38
+ export declare function getCancelledJobIdFromCronDeleteResult(output: string): string | null;
39
+ /** @description The wakeup a `ScheduleWakeup` result scheduled, `null` for any other text. */
40
+ export declare function getScheduledJobFromLoopWakeupResult(output: string): ScheduledJob | null;
41
+ /**
42
+ * @description The jobs left after a job of `source` fired. A `ScheduleWakeup` firing takes the wakeup off. A
43
+ * `CronCreate` firing does not name the job: with no recurring job it was a one-shot job's, and one is taken off — the
44
+ * OLDEST, whichever fired, keeps the count right. With a recurring job beside it the firing could be either, and nothing
45
+ * is taken off: a one-shot job still counted after it fired only holds the process within the hold, whereas one taken
46
+ * off while still pending would be lost at a stop without a word.
47
+ */
48
+ export declare function getScheduledJobsAfterFiring(jobs: ReadonlyMap<string, ScheduledJob>, source: ScheduledWakeupSource): Map<string, ScheduledJob>;
49
+ //# sourceMappingURL=claudeScheduledJobs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claudeScheduledJobs.d.ts","sourceRoot":"","sources":["../../src/utils/claudeScheduledJobs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,kBAAkB,eAAe,CAAC;AAC/C,eAAO,MAAM,kBAAkB,eAAe,CAAC;AAC/C,eAAO,MAAM,kBAAkB,mBAAmB,CAAC;AAEnD;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,WAAW,GAAG,YAAY,CAAC;AAEtE,4EAA4E;AAC5E,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,gBAAgB,CAAC;CACxB;AAED,4GAA4G;AAC5G,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,MAAM,CAAC;AAEpD,4EAA4E;AAC5E,eAAO,MAAM,eAAe,gBAAgB,CAAC;AAM7C,iHAAiH;AACjH,wBAAgB,mCAAmC,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAGvF;AAED,sFAAsF;AACtF,wBAAgB,qCAAqC,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEnF;AAED,8FAA8F;AAC9F,wBAAgB,mCAAmC,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAEvF;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,qBAAqB,GAAG,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAQ7I"}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ /**
3
+ * @description Session-only scheduled jobs of a Claude Code process, read off its tool results: `CronCreate` jobs and
4
+ * the `ScheduleWakeup` (`/loop`) wakeup. The CLI keeps them in memory only ("Session-only (not written to disk, dies
5
+ * when Claude exits)") and never lists them in `background_tasks_changed`, so the bot tracks them itself: a stop drops
6
+ * every one with the process.
7
+ *
8
+ * The wordings were probed live on Claude Code 2.1.310:
9
+ * CronCreate → `Scheduled one-shot task 59151bd3 (…). … It will fire once then auto-delete.`
10
+ * → `Scheduled recurring job 99a38c99 (Every 3 hours at :17). … Auto-expires after 7 days. …`
11
+ * CronDelete → `Cancelled job 99a38c99.`
12
+ * ScheduleWakeup → `Next wakeup scheduled for 15:05:00 (in 63s). …`
13
+ * A job firing starts a turn with a `command_lifecycle` frame naming its source, not the job: `schedule_wakeup` for a
14
+ * `CronCreate` job, `loop_wakeup` for the `ScheduleWakeup` one. An unrecognised wording tracks nothing — the process
15
+ * is then held exactly as before this tracking (a cancelled wakeup's wording is not known: it is held until the hold
16
+ * runs out).
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.loopWakeupJobId = exports.loopWakeupToolName = exports.cronDeleteToolName = exports.cronCreateToolName = void 0;
20
+ exports.getScheduledJobFromCronCreateResult = getScheduledJobFromCronCreateResult;
21
+ exports.getCancelledJobIdFromCronDeleteResult = getCancelledJobIdFromCronDeleteResult;
22
+ exports.getScheduledJobFromLoopWakeupResult = getScheduledJobFromLoopWakeupResult;
23
+ exports.getScheduledJobsAfterFiring = getScheduledJobsAfterFiring;
24
+ exports.cronCreateToolName = 'CronCreate';
25
+ exports.cronDeleteToolName = 'CronDelete';
26
+ exports.loopWakeupToolName = 'ScheduleWakeup';
27
+ /** The one `ScheduleWakeup` slot: a new wakeup replaces the pending one. */
28
+ exports.loopWakeupJobId = 'loop-wakeup';
29
+ const cronCreateResultRe = /^Scheduled (one-shot|recurring) (?:task|job) ([0-9a-z]+)\b/;
30
+ const cronDeleteResultRe = /^Cancelled job ([0-9a-z]+)\b/;
31
+ const loopWakeupResultRe = /^Next wakeup scheduled for /;
32
+ /** @description The job a `CronCreate` result scheduled, `null` for any other text (an error, a new wording). */
33
+ function getScheduledJobFromCronCreateResult(output) {
34
+ const match = cronCreateResultRe.exec(output.trim());
35
+ return match ? { jobId: match[2], kind: match[1] === 'recurring' ? 'recurring' : 'oneShot' } : null;
36
+ }
37
+ /** @description The id a `CronDelete` result cancelled, `null` for any other text. */
38
+ function getCancelledJobIdFromCronDeleteResult(output) {
39
+ return cronDeleteResultRe.exec(output.trim())?.[1] ?? null;
40
+ }
41
+ /** @description The wakeup a `ScheduleWakeup` result scheduled, `null` for any other text. */
42
+ function getScheduledJobFromLoopWakeupResult(output) {
43
+ return loopWakeupResultRe.test(output.trim()) ? { jobId: exports.loopWakeupJobId, kind: 'loopWakeup' } : null;
44
+ }
45
+ /**
46
+ * @description The jobs left after a job of `source` fired. A `ScheduleWakeup` firing takes the wakeup off. A
47
+ * `CronCreate` firing does not name the job: with no recurring job it was a one-shot job's, and one is taken off — the
48
+ * OLDEST, whichever fired, keeps the count right. With a recurring job beside it the firing could be either, and nothing
49
+ * is taken off: a one-shot job still counted after it fired only holds the process within the hold, whereas one taken
50
+ * off while still pending would be lost at a stop without a word.
51
+ */
52
+ function getScheduledJobsAfterFiring(jobs, source) {
53
+ const remaining = new Map(jobs);
54
+ const isRecurringBeside = [...remaining.values()].some((job) => job.kind === 'recurring');
55
+ const fired = source === 'loop'
56
+ ? remaining.get(exports.loopWakeupJobId)
57
+ : (isRecurringBeside ? undefined : [...remaining.values()].find((job) => job.kind === 'oneShot'));
58
+ if (fired)
59
+ remaining.delete(fired.jobId);
60
+ return remaining;
61
+ }
62
+ //# sourceMappingURL=claudeScheduledJobs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claudeScheduledJobs.js","sourceRoot":"","sources":["../../src/utils/claudeScheduledJobs.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AA8BH,kFAGC;AAGD,sFAEC;AAGD,kFAEC;AASD,kEAQC;AA1DY,QAAA,kBAAkB,GAAG,YAAY,CAAC;AAClC,QAAA,kBAAkB,GAAG,YAAY,CAAC;AAClC,QAAA,kBAAkB,GAAG,gBAAgB,CAAC;AAkBnD,4EAA4E;AAC/D,QAAA,eAAe,GAAG,aAAa,CAAC;AAE7C,MAAM,kBAAkB,GAAG,4DAA4D,CAAC;AACxF,MAAM,kBAAkB,GAAG,8BAA8B,CAAC;AAC1D,MAAM,kBAAkB,GAAG,6BAA6B,CAAC;AAEzD,iHAAiH;AACjH,SAAgB,mCAAmC,CAAC,MAAc;IAChE,MAAM,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IACrD,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,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