charness 4.1.0 → 4.2.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 (312) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/DEVELOPMENT.md +11 -5
  3. package/{COMMERCIAL-LICENSE.md → LICENSE-COMMERCIAL.md} +1 -1
  4. package/MIGRATION_3_TO_4.md +1 -1
  5. package/README.md +4 -1
  6. package/SETUP.md +37 -9
  7. package/agent-plugin/skills/charness-delegate-claude/SKILL.md +1 -0
  8. package/agent-plugin/skills/charness-orchestration/SKILL.md +1 -0
  9. package/dist/adapters/adapterNames.d.ts +2 -0
  10. package/dist/adapters/adapterNames.d.ts.map +1 -1
  11. package/dist/adapters/adapterNames.js +3 -1
  12. package/dist/adapters/adapterNames.js.map +1 -1
  13. package/dist/adapters/claudeJsonStreamAdapter.d.ts +74 -5
  14. package/dist/adapters/claudeJsonStreamAdapter.d.ts.map +1 -1
  15. package/dist/adapters/claudeJsonStreamAdapter.js +164 -20
  16. package/dist/adapters/claudeJsonStreamAdapter.js.map +1 -1
  17. package/dist/adapters/openCodeAdapter.d.ts +31 -2
  18. package/dist/adapters/openCodeAdapter.d.ts.map +1 -1
  19. package/dist/adapters/openCodeAdapter.js +84 -8
  20. package/dist/adapters/openCodeAdapter.js.map +1 -1
  21. package/dist/adapters/terminalAdapter.d.ts.map +1 -1
  22. package/dist/adapters/terminalAdapter.js +2 -1
  23. package/dist/adapters/terminalAdapter.js.map +1 -1
  24. package/dist/bot.d.ts.map +1 -1
  25. package/dist/bot.js +769 -118
  26. package/dist/bot.js.map +1 -1
  27. package/dist/cli/claudeProfiles.d.ts +3 -0
  28. package/dist/cli/claudeProfiles.d.ts.map +1 -1
  29. package/dist/cli/claudeProfiles.js +8 -0
  30. package/dist/cli/claudeProfiles.js.map +1 -1
  31. package/dist/connectors/jira/answerSink.d.ts +8 -0
  32. package/dist/connectors/jira/answerSink.d.ts.map +1 -1
  33. package/dist/connectors/jira/answerSink.js +15 -0
  34. package/dist/connectors/jira/answerSink.js.map +1 -1
  35. package/dist/connectors/jira/config.d.ts +16 -0
  36. package/dist/connectors/jira/config.d.ts.map +1 -1
  37. package/dist/connectors/jira/config.js +21 -2
  38. package/dist/connectors/jira/config.js.map +1 -1
  39. package/dist/connectors/jira/connector.d.ts +10 -3
  40. package/dist/connectors/jira/connector.d.ts.map +1 -1
  41. package/dist/connectors/jira/connector.js +21 -3
  42. package/dist/connectors/jira/connector.js.map +1 -1
  43. package/dist/connectors/jira/inbound.d.ts +200 -18
  44. package/dist/connectors/jira/inbound.d.ts.map +1 -1
  45. package/dist/connectors/jira/inbound.js +814 -43
  46. package/dist/connectors/jira/inbound.js.map +1 -1
  47. package/dist/connectors/jira/prompt.d.ts +46 -0
  48. package/dist/connectors/jira/prompt.d.ts.map +1 -1
  49. package/dist/connectors/jira/prompt.js +123 -15
  50. package/dist/connectors/jira/prompt.js.map +1 -1
  51. package/dist/connectors/jira/trigger.d.ts +27 -4
  52. package/dist/connectors/jira/trigger.d.ts.map +1 -1
  53. package/dist/connectors/jira/trigger.js +35 -1
  54. package/dist/connectors/jira/trigger.js.map +1 -1
  55. package/dist/connectors/jira/triggerLog.d.ts +60 -5
  56. package/dist/connectors/jira/triggerLog.d.ts.map +1 -1
  57. package/dist/connectors/jira/triggerLog.js +116 -7
  58. package/dist/connectors/jira/triggerLog.js.map +1 -1
  59. package/dist/connectors/telegram/commands/botCore.d.ts +5 -2
  60. package/dist/connectors/telegram/commands/botCore.d.ts.map +1 -1
  61. package/dist/connectors/telegram/commands/claudeAccounts.d.ts +5 -0
  62. package/dist/connectors/telegram/commands/claudeAccounts.d.ts.map +1 -1
  63. package/dist/connectors/telegram/commands/claudeAccounts.js +15 -39
  64. package/dist/connectors/telegram/commands/claudeAccounts.js.map +1 -1
  65. package/dist/connectors/telegram/commands/compaction.d.ts +6 -0
  66. package/dist/connectors/telegram/commands/compaction.d.ts.map +1 -1
  67. package/dist/connectors/telegram/commands/compaction.js +8 -1
  68. package/dist/connectors/telegram/commands/compaction.js.map +1 -1
  69. package/dist/connectors/telegram/commands/questionSetAside.d.ts +111 -0
  70. package/dist/connectors/telegram/commands/questionSetAside.d.ts.map +1 -0
  71. package/dist/connectors/telegram/commands/questionSetAside.js +637 -0
  72. package/dist/connectors/telegram/commands/questionSetAside.js.map +1 -0
  73. package/dist/connectors/telegram/commands/questionWait.d.ts +21 -0
  74. package/dist/connectors/telegram/commands/questionWait.d.ts.map +1 -0
  75. package/dist/connectors/telegram/commands/questionWait.js +109 -0
  76. package/dist/connectors/telegram/commands/questionWait.js.map +1 -0
  77. package/dist/connectors/telegram/commands/runners.d.ts +28 -1
  78. package/dist/connectors/telegram/commands/runners.d.ts.map +1 -1
  79. package/dist/connectors/telegram/commands/runners.js +75 -40
  80. package/dist/connectors/telegram/commands/runners.js.map +1 -1
  81. package/dist/connectors/telegram/commands/topicAccess.js +1 -1
  82. package/dist/connectors/telegram/commands/topicAccess.js.map +1 -1
  83. package/dist/connectors/telegram/commands/topicCommand.d.ts +0 -2
  84. package/dist/connectors/telegram/commands/topicCommand.d.ts.map +1 -1
  85. package/dist/connectors/telegram/commands/topicCommand.js +4 -5
  86. package/dist/connectors/telegram/commands/topicCommand.js.map +1 -1
  87. package/dist/connectors/telegram/commands/topicStatus.d.ts +24 -0
  88. package/dist/connectors/telegram/commands/topicStatus.d.ts.map +1 -0
  89. package/dist/connectors/telegram/commands/topicStatus.js +148 -0
  90. package/dist/connectors/telegram/commands/topicStatus.js.map +1 -0
  91. package/dist/connectors/telegram/firstUpdateBatchNote.d.ts +30 -0
  92. package/dist/connectors/telegram/firstUpdateBatchNote.d.ts.map +1 -0
  93. package/dist/connectors/telegram/firstUpdateBatchNote.js +39 -0
  94. package/dist/connectors/telegram/firstUpdateBatchNote.js.map +1 -0
  95. package/dist/connectors/telegram/inbound.d.ts +12 -0
  96. package/dist/connectors/telegram/inbound.d.ts.map +1 -1
  97. package/dist/connectors/telegram/inbound.js +31 -3
  98. package/dist/connectors/telegram/inbound.js.map +1 -1
  99. package/dist/connectors/telegram/sendOutcome.d.ts +3 -1
  100. package/dist/connectors/telegram/sendOutcome.d.ts.map +1 -1
  101. package/dist/connectors/telegram/sendOutcome.js.map +1 -1
  102. package/dist/connectors/telegram/telegramFailureRetry.d.ts +8 -0
  103. package/dist/connectors/telegram/telegramFailureRetry.d.ts.map +1 -1
  104. package/dist/connectors/telegram/telegramFailureRetry.js +8 -0
  105. package/dist/connectors/telegram/telegramFailureRetry.js.map +1 -1
  106. package/dist/connectors/telegram/topicIndicator.d.ts +86 -0
  107. package/dist/connectors/telegram/topicIndicator.d.ts.map +1 -0
  108. package/dist/connectors/telegram/topicIndicator.js +490 -0
  109. package/dist/connectors/telegram/topicIndicator.js.map +1 -0
  110. package/dist/connectors/telegram/waitingTopicRenames.d.ts +39 -0
  111. package/dist/connectors/telegram/waitingTopicRenames.d.ts.map +1 -0
  112. package/dist/connectors/telegram/waitingTopicRenames.js +48 -0
  113. package/dist/connectors/telegram/waitingTopicRenames.js.map +1 -0
  114. package/dist/i18n/de.d.ts.map +1 -1
  115. package/dist/i18n/de.js +51 -0
  116. package/dist/i18n/de.js.map +1 -1
  117. package/dist/i18n/en.d.ts.map +1 -1
  118. package/dist/i18n/en.js +51 -0
  119. package/dist/i18n/en.js.map +1 -1
  120. package/dist/i18n/es.d.ts.map +1 -1
  121. package/dist/i18n/es.js +51 -0
  122. package/dist/i18n/es.js.map +1 -1
  123. package/dist/i18n/fr.d.ts.map +1 -1
  124. package/dist/i18n/fr.js +51 -0
  125. package/dist/i18n/fr.js.map +1 -1
  126. package/dist/i18n/hi.d.ts.map +1 -1
  127. package/dist/i18n/hi.js +51 -0
  128. package/dist/i18n/hi.js.map +1 -1
  129. package/dist/i18n/ja.d.ts.map +1 -1
  130. package/dist/i18n/ja.js +51 -0
  131. package/dist/i18n/ja.js.map +1 -1
  132. package/dist/i18n/ka.d.ts.map +1 -1
  133. package/dist/i18n/ka.js +51 -0
  134. package/dist/i18n/ka.js.map +1 -1
  135. package/dist/i18n/pt.d.ts.map +1 -1
  136. package/dist/i18n/pt.js +51 -0
  137. package/dist/i18n/pt.js.map +1 -1
  138. package/dist/i18n/ru.d.ts.map +1 -1
  139. package/dist/i18n/ru.js +51 -0
  140. package/dist/i18n/ru.js.map +1 -1
  141. package/dist/i18n/uk.d.ts.map +1 -1
  142. package/dist/i18n/uk.js +51 -0
  143. package/dist/i18n/uk.js.map +1 -1
  144. package/dist/i18n/uz.d.ts.map +1 -1
  145. package/dist/i18n/uz.js +51 -0
  146. package/dist/i18n/uz.js.map +1 -1
  147. package/dist/i18n/zh.d.ts.map +1 -1
  148. package/dist/i18n/zh.js +51 -0
  149. package/dist/i18n/zh.js.map +1 -1
  150. package/dist/i18n.d.ts.map +1 -1
  151. package/dist/i18n.js +2 -1
  152. package/dist/i18n.js.map +1 -1
  153. package/dist/instanceSettings.d.ts +19 -1
  154. package/dist/instanceSettings.d.ts.map +1 -1
  155. package/dist/instanceSettings.js +35 -2
  156. package/dist/instanceSettings.js.map +1 -1
  157. package/dist/openCodeOpenQuestion.d.ts +12 -4
  158. package/dist/openCodeOpenQuestion.d.ts.map +1 -1
  159. package/dist/openCodeOpenQuestion.js +16 -7
  160. package/dist/openCodeOpenQuestion.js.map +1 -1
  161. package/dist/openCodeQuestionFlow.d.ts +10 -2
  162. package/dist/openCodeQuestionFlow.d.ts.map +1 -1
  163. package/dist/openCodeQuestionFlow.js +27 -5
  164. package/dist/openCodeQuestionFlow.js.map +1 -1
  165. package/dist/postToSession.d.ts +9 -0
  166. package/dist/postToSession.d.ts.map +1 -1
  167. package/dist/postToSession.js +15 -2
  168. package/dist/postToSession.js.map +1 -1
  169. package/dist/requests/requestHeader.d.ts.map +1 -1
  170. package/dist/requests/requestHeader.js +1 -0
  171. package/dist/requests/requestHeader.js.map +1 -1
  172. package/dist/requests/types.d.ts +4 -1
  173. package/dist/requests/types.d.ts.map +1 -1
  174. package/dist/requests/wakeUpEngine.d.ts +31 -1
  175. package/dist/requests/wakeUpEngine.d.ts.map +1 -1
  176. package/dist/requests/wakeUpEngine.js +94 -2
  177. package/dist/requests/wakeUpEngine.js.map +1 -1
  178. package/dist/requests/wakeUpRules.d.ts +7 -0
  179. package/dist/requests/wakeUpRules.d.ts.map +1 -1
  180. package/dist/requests/wakeUpRules.js +14 -0
  181. package/dist/requests/wakeUpRules.js.map +1 -1
  182. package/dist/scheduler/engine.d.ts +17 -4
  183. package/dist/scheduler/engine.d.ts.map +1 -1
  184. package/dist/scheduler/engine.js +55 -10
  185. package/dist/scheduler/engine.js.map +1 -1
  186. package/dist/scheduler/mcpBoot.d.ts +6 -2
  187. package/dist/scheduler/mcpBoot.d.ts.map +1 -1
  188. package/dist/scheduler/mcpBoot.js +7 -1
  189. package/dist/scheduler/mcpBoot.js.map +1 -1
  190. package/dist/scheduler/mcpSurface.d.ts.map +1 -1
  191. package/dist/scheduler/mcpSurface.js +18 -9
  192. package/dist/scheduler/mcpSurface.js.map +1 -1
  193. package/dist/sendErrorClassifier.d.ts +6 -0
  194. package/dist/sendErrorClassifier.d.ts.map +1 -1
  195. package/dist/sendErrorClassifier.js +9 -0
  196. package/dist/sendErrorClassifier.js.map +1 -1
  197. package/dist/startupPromptBuffer.d.ts +8 -8
  198. package/dist/startupPromptBuffer.d.ts.map +1 -1
  199. package/dist/startupPromptBuffer.js +7 -5
  200. package/dist/startupPromptBuffer.js.map +1 -1
  201. package/dist/state.d.ts +98 -6
  202. package/dist/state.d.ts.map +1 -1
  203. package/dist/state.js +149 -7
  204. package/dist/state.js.map +1 -1
  205. package/dist/testTimings.d.ts +12 -3
  206. package/dist/testTimings.d.ts.map +1 -1
  207. package/dist/testTimings.js +23 -2
  208. package/dist/testTimings.js.map +1 -1
  209. package/dist/threadRouting.d.ts +23 -0
  210. package/dist/threadRouting.d.ts.map +1 -1
  211. package/dist/threadRouting.js +28 -0
  212. package/dist/threadRouting.js.map +1 -1
  213. package/dist/todos/registry.d.ts +2 -0
  214. package/dist/todos/registry.d.ts.map +1 -1
  215. package/dist/todos/registry.js +3 -1
  216. package/dist/todos/registry.js.map +1 -1
  217. package/dist/trackers/taskAgentSlots.d.ts +42 -3
  218. package/dist/trackers/taskAgentSlots.d.ts.map +1 -1
  219. package/dist/trackers/taskAgentSlots.js +31 -11
  220. package/dist/trackers/taskAgentSlots.js.map +1 -1
  221. package/dist/types.d.ts +95 -0
  222. package/dist/types.d.ts.map +1 -1
  223. package/dist/utils/claudeCompactHook.d.ts +3 -1
  224. package/dist/utils/claudeCompactHook.d.ts.map +1 -1
  225. package/dist/utils/claudeCompactHook.js +3 -1
  226. package/dist/utils/claudeCompactHook.js.map +1 -1
  227. package/dist/utils/claudeLimitSwitch.d.ts +1 -1
  228. package/dist/utils/claudeLimitSwitch.d.ts.map +1 -1
  229. package/dist/utils/claudeLimitSwitch.js +1 -1
  230. package/dist/utils/claudeLimitSwitch.js.map +1 -1
  231. package/dist/utils/claudeProfileSync.d.ts +88 -0
  232. package/dist/utils/claudeProfileSync.d.ts.map +1 -0
  233. package/dist/utils/claudeProfileSync.js +198 -0
  234. package/dist/utils/claudeProfileSync.js.map +1 -0
  235. package/dist/utils/claudeProfiles.d.ts +101 -6
  236. package/dist/utils/claudeProfiles.d.ts.map +1 -1
  237. package/dist/utils/claudeProfiles.js +288 -23
  238. package/dist/utils/claudeProfiles.js.map +1 -1
  239. package/dist/utils/claudeUsageRefresher.d.ts +8 -1
  240. package/dist/utils/claudeUsageRefresher.d.ts.map +1 -1
  241. package/dist/utils/claudeUsageRefresher.js +11 -1
  242. package/dist/utils/claudeUsageRefresher.js.map +1 -1
  243. package/dist/utils/cutButtonLabel.d.ts +7 -0
  244. package/dist/utils/cutButtonLabel.d.ts.map +1 -0
  245. package/dist/utils/cutButtonLabel.js +17 -0
  246. package/dist/utils/cutButtonLabel.js.map +1 -0
  247. package/dist/utils/fileSendPlan.d.ts +30 -8
  248. package/dist/utils/fileSendPlan.d.ts.map +1 -1
  249. package/dist/utils/fileSendPlan.js +37 -12
  250. package/dist/utils/fileSendPlan.js.map +1 -1
  251. package/dist/utils/fileSendService.d.ts +1 -1
  252. package/dist/utils/fileSendService.d.ts.map +1 -1
  253. package/dist/utils/fileSendService.js +9 -1
  254. package/dist/utils/fileSendService.js.map +1 -1
  255. package/dist/utils/imageDimensions.d.ts +32 -0
  256. package/dist/utils/imageDimensions.d.ts.map +1 -0
  257. package/dist/utils/imageDimensions.js +181 -0
  258. package/dist/utils/imageDimensions.js.map +1 -0
  259. package/dist/utils/jsonStreamHost.d.ts +35 -9
  260. package/dist/utils/jsonStreamHost.d.ts.map +1 -1
  261. package/dist/utils/jsonStreamHost.js +59 -16
  262. package/dist/utils/jsonStreamHost.js.map +1 -1
  263. package/dist/utils/limitSwitchPlan.d.ts +44 -0
  264. package/dist/utils/limitSwitchPlan.d.ts.map +1 -0
  265. package/dist/utils/limitSwitchPlan.js +54 -0
  266. package/dist/utils/limitSwitchPlan.js.map +1 -0
  267. package/dist/utils/lostWork.d.ts +8 -2
  268. package/dist/utils/lostWork.d.ts.map +1 -1
  269. package/dist/utils/lostWork.js +9 -5
  270. package/dist/utils/lostWork.js.map +1 -1
  271. package/dist/utils/promptDelivery.d.ts +11 -2
  272. package/dist/utils/promptDelivery.d.ts.map +1 -1
  273. package/dist/utils/promptDelivery.js +3 -3
  274. package/dist/utils/promptDelivery.js.map +1 -1
  275. package/dist/utils/questionWaitChoices.d.ts +20 -0
  276. package/dist/utils/questionWaitChoices.d.ts.map +1 -0
  277. package/dist/utils/questionWaitChoices.js +31 -0
  278. package/dist/utils/questionWaitChoices.js.map +1 -0
  279. package/dist/utils/questionWaitPlan.d.ts +166 -0
  280. package/dist/utils/questionWaitPlan.d.ts.map +1 -0
  281. package/dist/utils/questionWaitPlan.js +237 -0
  282. package/dist/utils/questionWaitPlan.js.map +1 -0
  283. package/dist/utils/replyQuote.d.ts +10 -0
  284. package/dist/utils/replyQuote.d.ts.map +1 -1
  285. package/dist/utils/replyQuote.js +18 -7
  286. package/dist/utils/replyQuote.js.map +1 -1
  287. package/dist/utils/talkerAccess.d.ts +2 -2
  288. package/dist/utils/talkerAccess.d.ts.map +1 -1
  289. package/dist/utils/talkerAccess.js +5 -4
  290. package/dist/utils/talkerAccess.js.map +1 -1
  291. package/dist/utils/telegramError.d.ts +6 -0
  292. package/dist/utils/telegramError.d.ts.map +1 -1
  293. package/dist/utils/telegramError.js +12 -0
  294. package/dist/utils/telegramError.js.map +1 -1
  295. package/dist/utils/topicAccessScreenPlan.d.ts +1 -1
  296. package/dist/utils/topicAccessScreenPlan.d.ts.map +1 -1
  297. package/dist/utils/topicAccessScreenPlan.js +3 -7
  298. package/dist/utils/topicAccessScreenPlan.js.map +1 -1
  299. package/dist/utils/topicIndicatorPlan.d.ts +143 -0
  300. package/dist/utils/topicIndicatorPlan.d.ts.map +1 -0
  301. package/dist/utils/topicIndicatorPlan.js +202 -0
  302. package/dist/utils/topicIndicatorPlan.js.map +1 -0
  303. package/dist/utils/topicIndicatorSources.d.ts +40 -0
  304. package/dist/utils/topicIndicatorSources.d.ts.map +1 -0
  305. package/dist/utils/topicIndicatorSources.js +31 -0
  306. package/dist/utils/topicIndicatorSources.js.map +1 -0
  307. package/dist/utils/topicStatusPlan.d.ts +90 -0
  308. package/dist/utils/topicStatusPlan.d.ts.map +1 -0
  309. package/dist/utils/topicStatusPlan.js +160 -0
  310. package/dist/utils/topicStatusPlan.js.map +1 -0
  311. package/npm-shrinkwrap.json +2 -2
  312. package/package.json +2 -2
@@ -0,0 +1,88 @@
1
+ /**
2
+ * @description The Claude profile registry (`state.claudeProfiles`) kept in step with the DISK and with the CLI's own word, with no
3
+ * Telegram in the way — the one place both the `/accounts` screen and the bot's usage poll go through, so an instance that serves only
4
+ * a tracker (`CONNECTORS=jira`) sees every signed-in account too:
5
+ *
6
+ * - **adopt**: a folder under `DATA_DIR/claude-profiles/` with a valid profile name and no record gets one (`createdAt` from the
7
+ * folder, `loggedIn: false` until the probe says otherwise) — an account signed in by hand with
8
+ * `CLAUDE_CONFIG_DIR=<that folder> claude auth login` is picked up like one added from `/accounts` (and given the links back into
9
+ * `~/.claude` it may lack — `projects/` above all, or a conversation could not resume under it). A removal leaves no
10
+ * folder behind (`removeClaudeProfileLayout`), so it is never adopted back; the hidden `default` record of a signed-out
11
+ * `~/.claude` (`isRemoved`) is never probed by the scan — only a sign-in through `/accounts` or an operator's screen brings it back.
12
+ * - **probe**: `claude auth status --json` under each profile's directory (`readStatus`) and the answer on its record
13
+ * ({@link recordClaudeProfileStatus}). A scan probes only what is DUE: a profile never probed, one that was not signed in (a
14
+ * sign-in by hand must show up), or a signed-in one whose status is older than {@link claudeAuthStatusMaxAgeMs}; and no profile
15
+ * more than once per {@link claudeAuthStatusRetryMs}, whatever the outcome (a CLI that does not answer is not asked again at
16
+ * every poll). The `/accounts` screen forces a probe of everything, as it always did.
17
+ *
18
+ * Every dependency is injected, so the unit test drives it over a temp folder and a fake store.
19
+ */
20
+ import type { ClaudeProfileRecord } from '../state';
21
+ import { type ClaudeAuthStatus } from './claudeProfiles';
22
+ /** A signed-in profile's status is read again after this long (a sign-out or a plan change made outside the bot shows up within it). */
23
+ export declare const claudeAuthStatusMaxAgeMs: number;
24
+ /** The least time between two probes of the same profile by a scan that is not forced (an unanswered or signed-out one is asked again no sooner). */
25
+ export declare const claudeAuthStatusRetryMs: number;
26
+ /** The part of `StateStore` the sync reads and writes. */
27
+ export interface ClaudeProfileSyncStore {
28
+ /** The added profiles by name (`default` is never among them). */
29
+ getClaudeProfileRecords(): Readonly<Record<string, ClaudeProfileRecord>>;
30
+ /** An ADDED profile's record; `undefined` for an unknown name and for `default`. */
31
+ getClaudeProfileRecord(name: string): ClaudeProfileRecord | undefined;
32
+ /** What is known about ANY profile, `default`'s hidden record included. */
33
+ getClaudeProfileInfo(name: string): ClaudeProfileRecord | undefined;
34
+ upsertClaudeProfileRecord(name: string, patch: Partial<ClaudeProfileRecord>): Promise<void>;
35
+ }
36
+ /**
37
+ * @description Persist a probe's answer on the profile's record (nothing for a failed probe). `default` gets its hidden record, so
38
+ * the usage ranking and the CLI twin know whether it is signed in and as whom; an added profile removed meanwhile gets none.
39
+ */
40
+ export declare function recordClaudeProfileStatus(store: Pick<ClaudeProfileSyncStore, 'getClaudeProfileRecord' | 'upsertClaudeProfileRecord'>, name: string, status: ClaudeAuthStatus | null, nowMs?: number): Promise<void>;
41
+ /** A profile folder on disk: its name and when it was created (the folder's own birth, else its last change). */
42
+ export interface ClaudeProfileFolder {
43
+ name: string;
44
+ createdAt: string;
45
+ }
46
+ /**
47
+ * @description The folders under `DATA_DIR/claude-profiles/` that can be profiles, by name: a valid profile name
48
+ * (`checkIsValidClaudeProfileName` — never `default`, no dotfile, no upper case) naming a directory (a link to one counts). An
49
+ * unreadable root is no folders.
50
+ */
51
+ export declare function listClaudeProfileFolders(dataDir: string): ClaudeProfileFolder[];
52
+ export interface ClaudeProfileSyncDeps {
53
+ store: ClaudeProfileSyncStore;
54
+ getDataDir: () => string;
55
+ /** `claude auth status --json` under `configDir` (`null` = `~/.claude`); `null` when the probe gives no answer. */
56
+ readStatus: (configDir: string | null) => Promise<ClaudeAuthStatus | null>;
57
+ /**
58
+ * Called for a folder about to be adopted: give it the links back into `~/.claude` that a profile needs (`createClaudeProfileLayout` —
59
+ * idempotent: the login and the account's state stay, an entry of the folder's own that stands in a link's place is moved aside). Without `projects/` linked a conversation could not be resumed under
60
+ * the account. A throw is logged and the folder adopted all the same.
61
+ */
62
+ ensureLayout?: (name: string) => void;
63
+ /** {@link claudeAuthStatusMaxAgeMs} unless a test sets it. */
64
+ statusMaxAgeMs?: number;
65
+ /** {@link claudeAuthStatusRetryMs} unless a test sets it. */
66
+ retryMs?: number;
67
+ now?: () => number;
68
+ log?: (line: string) => void;
69
+ }
70
+ export interface ClaudeProfileSyncResult {
71
+ /** The names given a record by this scan, in order. */
72
+ adopted: string[];
73
+ /** The names whose status was probed by this scan (`default` included), in order. */
74
+ probed: string[];
75
+ /** The probe of `default` — `null` when it was not probed or gave no answer. */
76
+ defaultStatus: ClaudeAuthStatus | null;
77
+ }
78
+ export interface ClaudeProfileSync {
79
+ /**
80
+ * Adopt the folders without a record, then probe the profiles that are due (`isForced`: every profile, the removed `default`
81
+ * included — the `/accounts` screen). A scan already under way is joined by one that is not forced. Never throws.
82
+ */
83
+ sync: (options?: {
84
+ isForced?: boolean;
85
+ }) => Promise<ClaudeProfileSyncResult>;
86
+ }
87
+ export declare function createClaudeProfileSync(deps: ClaudeProfileSyncDeps): ClaudeProfileSync;
88
+ //# sourceMappingURL=claudeProfileSync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claudeProfileSync.d.ts","sourceRoot":"","sources":["../../src/utils/claudeProfileSync.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAOL,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAC;AAE1B,wIAAwI;AACxI,eAAO,MAAM,wBAAwB,QAAc,CAAC;AAEpD,qJAAqJ;AACrJ,eAAO,MAAM,uBAAuB,QAAa,CAAC;AAElD,0DAA0D;AAC1D,MAAM,WAAW,sBAAsB;IACrC,kEAAkE;IAClE,uBAAuB,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAC;IACzE,oFAAoF;IACpF,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAAC;IACtE,2EAA2E;IAC3E,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAAC;IACpE,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7F;AAED;;;GAGG;AACH,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,IAA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AC,CAAC;CAC9E;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,qBAAqB,GAAG,iBAAiB,CAyEtF"}
@@ -0,0 +1,198 @@
1
+ "use strict";
2
+ /**
3
+ * @description The Claude profile registry (`state.claudeProfiles`) kept in step with the DISK and with the CLI's own word, with no
4
+ * Telegram in the way — the one place both the `/accounts` screen and the bot's usage poll go through, so an instance that serves only
5
+ * a tracker (`CONNECTORS=jira`) sees every signed-in account too:
6
+ *
7
+ * - **adopt**: a folder under `DATA_DIR/claude-profiles/` with a valid profile name and no record gets one (`createdAt` from the
8
+ * folder, `loggedIn: false` until the probe says otherwise) — an account signed in by hand with
9
+ * `CLAUDE_CONFIG_DIR=<that folder> claude auth login` is picked up like one added from `/accounts` (and given the links back into
10
+ * `~/.claude` it may lack — `projects/` above all, or a conversation could not resume under it). A removal leaves no
11
+ * folder behind (`removeClaudeProfileLayout`), so it is never adopted back; the hidden `default` record of a signed-out
12
+ * `~/.claude` (`isRemoved`) is never probed by the scan — only a sign-in through `/accounts` or an operator's screen brings it back.
13
+ * - **probe**: `claude auth status --json` under each profile's directory (`readStatus`) and the answer on its record
14
+ * ({@link recordClaudeProfileStatus}). A scan probes only what is DUE: a profile never probed, one that was not signed in (a
15
+ * sign-in by hand must show up), or a signed-in one whose status is older than {@link claudeAuthStatusMaxAgeMs}; and no profile
16
+ * more than once per {@link claudeAuthStatusRetryMs}, whatever the outcome (a CLI that does not answer is not asked again at
17
+ * every poll). The `/accounts` screen forces a probe of everything, as it always did.
18
+ *
19
+ * Every dependency is injected, so the unit test drives it over a temp folder and a fake store.
20
+ */
21
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
22
+ if (k2 === undefined) k2 = k;
23
+ var desc = Object.getOwnPropertyDescriptor(m, k);
24
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
25
+ desc = { enumerable: true, get: function() { return m[k]; } };
26
+ }
27
+ Object.defineProperty(o, k2, desc);
28
+ }) : (function(o, m, k, k2) {
29
+ if (k2 === undefined) k2 = k;
30
+ o[k2] = m[k];
31
+ }));
32
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
33
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
34
+ }) : function(o, v) {
35
+ o["default"] = v;
36
+ });
37
+ var __importStar = (this && this.__importStar) || (function () {
38
+ var ownKeys = function(o) {
39
+ ownKeys = Object.getOwnPropertyNames || function (o) {
40
+ var ar = [];
41
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
42
+ return ar;
43
+ };
44
+ return ownKeys(o);
45
+ };
46
+ return function (mod) {
47
+ if (mod && mod.__esModule) return mod;
48
+ var result = {};
49
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
50
+ __setModuleDefault(result, mod);
51
+ return result;
52
+ };
53
+ })();
54
+ Object.defineProperty(exports, "__esModule", { value: true });
55
+ exports.claudeAuthStatusRetryMs = exports.claudeAuthStatusMaxAgeMs = void 0;
56
+ exports.recordClaudeProfileStatus = recordClaudeProfileStatus;
57
+ exports.listClaudeProfileFolders = listClaudeProfileFolders;
58
+ exports.createClaudeProfileSync = createClaudeProfileSync;
59
+ const fs = __importStar(require("fs"));
60
+ const path = __importStar(require("path"));
61
+ const claudeProfiles_1 = require("./claudeProfiles");
62
+ /** A signed-in profile's status is read again after this long (a sign-out or a plan change made outside the bot shows up within it). */
63
+ exports.claudeAuthStatusMaxAgeMs = 60 * 60_000;
64
+ /** The least time between two probes of the same profile by a scan that is not forced (an unanswered or signed-out one is asked again no sooner). */
65
+ exports.claudeAuthStatusRetryMs = 5 * 60_000;
66
+ /**
67
+ * @description Persist a probe's answer on the profile's record (nothing for a failed probe). `default` gets its hidden record, so
68
+ * the usage ranking and the CLI twin know whether it is signed in and as whom; an added profile removed meanwhile gets none.
69
+ */
70
+ async function recordClaudeProfileStatus(store, name, status, nowMs = Date.now()) {
71
+ if (status === null)
72
+ return;
73
+ if (name !== claudeProfiles_1.defaultClaudeProfileName && store.getClaudeProfileRecord(name) === undefined)
74
+ return; // removed meanwhile
75
+ await store.upsertClaudeProfileRecord(name, {
76
+ // A removed `default` comes back by itself the moment it is signed in again.
77
+ ...(name === claudeProfiles_1.defaultClaudeProfileName && status.loggedIn ? { isRemoved: undefined } : {}),
78
+ // The CLI's word on how the account pays wins over the kind it was added as, both ways.
79
+ ...(status.billing !== null ? { billing: status.billing } : {}),
80
+ // Which key the sessions use decides whether the stored one may be asked on (the daily credit recheck of `default`).
81
+ isConsoleLoginKey: status.apiKeySource === claudeProfiles_1.claudeConsoleLoginKeySource,
82
+ loggedIn: status.loggedIn,
83
+ email: status.email ?? undefined,
84
+ subscriptionType: status.subscriptionType ?? undefined,
85
+ orgName: status.orgName ?? undefined,
86
+ statusCheckedAt: new Date(nowMs).toISOString(),
87
+ });
88
+ }
89
+ /**
90
+ * @description The folders under `DATA_DIR/claude-profiles/` that can be profiles, by name: a valid profile name
91
+ * (`checkIsValidClaudeProfileName` — never `default`, no dotfile, no upper case) naming a directory (a link to one counts). An
92
+ * unreadable root is no folders.
93
+ */
94
+ function listClaudeProfileFolders(dataDir) {
95
+ const root = (0, claudeProfiles_1.resolveClaudeProfilesRoot)(dataDir);
96
+ let names;
97
+ try {
98
+ names = fs.readdirSync(root).sort();
99
+ }
100
+ catch {
101
+ return [];
102
+ }
103
+ const folders = [];
104
+ for (const name of names) {
105
+ if (!(0, claudeProfiles_1.checkIsValidClaudeProfileName)(name))
106
+ continue;
107
+ let stat;
108
+ try {
109
+ stat = fs.statSync(path.join(root, name));
110
+ }
111
+ catch {
112
+ continue;
113
+ }
114
+ if (!stat.isDirectory())
115
+ continue;
116
+ folders.push({ name, createdAt: new Date(stat.birthtimeMs > 0 ? stat.birthtimeMs : stat.mtimeMs).toISOString() });
117
+ }
118
+ return folders;
119
+ }
120
+ function createClaudeProfileSync(deps) {
121
+ const { store, readStatus } = deps;
122
+ const now = deps.now ?? (() => Date.now());
123
+ const log = deps.log ?? ((line) => console.log(line));
124
+ const statusMaxAgeMs = deps.statusMaxAgeMs ?? exports.claudeAuthStatusMaxAgeMs;
125
+ const retryMs = deps.retryMs ?? exports.claudeAuthStatusRetryMs;
126
+ const lastAttemptMsByName = new Map();
127
+ let inFlight = null;
128
+ /** Give every folder without a record one — the check and the write in one tick, so a profile `/accounts` is adding right now is never adopted twice. */
129
+ async function adoptFolders() {
130
+ const adopted = [];
131
+ for (const folder of listClaudeProfileFolders(deps.getDataDir())) {
132
+ if (store.getClaudeProfileRecord(folder.name) !== undefined)
133
+ continue;
134
+ if (!(0, claudeProfiles_1.checkClaudeProfileDirExists)(deps.getDataDir(), folder.name))
135
+ continue; // removed since the listing
136
+ try {
137
+ deps.ensureLayout?.(folder.name);
138
+ }
139
+ catch (e) {
140
+ log(`[accounts] profile ${folder.name}: its links into ~/.claude could not be made: ${e instanceof Error ? e.message : String(e)}`);
141
+ }
142
+ // Not signed in until the probe below says so: a folder the CLI cannot vouch for is never offered.
143
+ await store.upsertClaudeProfileRecord(folder.name, { createdAt: folder.createdAt, loggedIn: false });
144
+ adopted.push(folder.name);
145
+ log(`[accounts] profile ${folder.name}: its folder had no record — adopted`);
146
+ }
147
+ return adopted;
148
+ }
149
+ function checkIsProbeDue(name, nowMs) {
150
+ const lastAttemptMs = lastAttemptMsByName.get(name);
151
+ if (lastAttemptMs !== undefined && nowMs - lastAttemptMs < retryMs)
152
+ return false;
153
+ const record = store.getClaudeProfileInfo(name);
154
+ // A `default` the operator signed out through `/accounts` stays out until a screen or a sign-in of the operator's brings it back.
155
+ if (name === claudeProfiles_1.defaultClaudeProfileName && record?.isRemoved === true)
156
+ return false;
157
+ if (record?.statusCheckedAt === undefined || record.loggedIn !== true)
158
+ return true;
159
+ const checkedAtMs = Date.parse(record.statusCheckedAt);
160
+ return !Number.isFinite(checkedAtMs) || nowMs - checkedAtMs >= statusMaxAgeMs;
161
+ }
162
+ async function probe(name) {
163
+ try {
164
+ return await readStatus((0, claudeProfiles_1.resolveClaudeProfileDir)(deps.getDataDir(), name));
165
+ }
166
+ catch (e) {
167
+ log(`[accounts] profile ${name}: the auth status probe threw: ${e instanceof Error ? e.message : String(e)}`);
168
+ return null;
169
+ }
170
+ }
171
+ async function run(isForced) {
172
+ const adopted = await adoptFolders();
173
+ const nowMs = now();
174
+ const names = [claudeProfiles_1.defaultClaudeProfileName, ...Object.keys(store.getClaudeProfileRecords())]
175
+ .filter((name) => isForced || checkIsProbeDue(name, nowMs));
176
+ for (const name of names)
177
+ lastAttemptMsByName.set(name, nowMs);
178
+ const statuses = await Promise.all(names.map(probe));
179
+ await Promise.all(names.map((name, index) => recordClaudeProfileStatus(store, name, statuses[index], now())));
180
+ const defaultIndex = names.indexOf(claudeProfiles_1.defaultClaudeProfileName);
181
+ return { adopted, probed: names, defaultStatus: defaultIndex === -1 ? null : statuses[defaultIndex] };
182
+ }
183
+ async function sync(options = {}) {
184
+ const isForced = options.isForced === true;
185
+ if (!isForced && inFlight)
186
+ return inFlight;
187
+ const scan = run(isForced).catch((e) => {
188
+ log(`[accounts] the profile scan failed: ${e instanceof Error ? e.message : String(e)}`);
189
+ return { adopted: [], probed: [], defaultStatus: null };
190
+ });
191
+ if (isForced)
192
+ return scan;
193
+ inFlight = scan.finally(() => { inFlight = null; });
194
+ return inFlight;
195
+ }
196
+ return { sync };
197
+ }
198
+ //# sourceMappingURL=claudeProfileSync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claudeProfileSync.js","sourceRoot":"","sources":["../../src/utils/claudeProfileSync.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCH,8DAqBC;AAaD,4DAqBC;AAsCD,0DAyEC;AAxMD,uCAAyB;AACzB,2CAA6B;AAE7B,qDAQ0B;AAE1B,wIAAwI;AAC3H,QAAA,wBAAwB,GAAG,EAA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E,aAAa,EAAE,IAAI,EAAE,CAAC;QAC1D,CAAC,CAAC,CAAC;QACH,IAAI,QAAQ;YAAE,OAAO,IAAI,CAAC;QAC1B,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACpD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,CAAC;AAClB,CAAC"}
@@ -9,12 +9,19 @@
9
9
  * `~/.claude`, so a conversation started under one account resumes under another and every account sees
10
10
  * the same hooks and skills.
11
11
  *
12
+ * Everything Claude Code loads as USER-level configuration from that directory (instructions, rules, skills, subagents, commands,
13
+ * output styles, workflows, mods, plugins, the settings with their hooks) is therefore kept a link into `~/.claude`: a profile folder is
14
+ * writable by the user the bot and every agent run as, so an agent on the account could otherwise plant files there that every later
15
+ * session on it would follow. {@link repairClaudeProfileLayout} restores the links right before a launch under the folder and moves
16
+ * whatever stood in their place aside; the account's own state (login, `.claude.json`, history, caches) is never touched.
17
+ *
12
18
  * The profile `default` IS `~/.claude` itself: nothing is set for it and nothing is migrated. A process is
13
19
  * never switched by swapping files under `~/.claude` (the CLI re-reads its credentials live and EVERY running
14
20
  * session would change account at once); the variable is per process, set at spawn.
15
21
  *
16
22
  * Pure helpers (layout, name gate, resolution, parsers) — the registry and the selection live in
17
- * `state.json` (`StateStore`), the spawn-side use in the adapters, the UI in
23
+ * `state.json` (`StateStore`), kept in step with the disk and the CLI by `utils/claudeProfileSync.ts` (a folder signed in by hand is
24
+ * adopted without Telegram), the spawn-side use in the adapters, the UI in
18
25
  * `connectors/telegram/commands/claudeAccounts.ts`. Shaped for the later phases: a record carries room for a
19
26
  * `limitedUntil` mark and a cached usage snapshot, and the resolver takes the known names so a selection that
20
27
  * names a removed profile falls back instead of launching a dead directory.
@@ -30,7 +37,18 @@ export declare const claudeProfilesDirName = "claude-profiles";
30
37
  * file the CLI tries to read on every start).
31
38
  */
32
39
  export declare const claudeProfileSharedEntries: readonly ["projects", "settings.json", "skills", "plugins"];
33
- export declare const claudeProfileOptionalSharedEntries: readonly ["CLAUDE.md"];
40
+ /**
41
+ * The other user-level entries Claude Code loads from its config directory (code.claude.com/docs, «Explore the .claude directory»,
42
+ * «Create a mod»): `CLAUDE.md` and `rules/` (instructions, loaded at session start), `agents/` (subagent prompts, with their hooks and
43
+ * MCP servers in the frontmatter), `commands/` and `output-styles/` (prompts and instruction sets), `workflows/` (scripts the runtime
44
+ * runs), and `dev-mods/<session id>/` (mods Claude wrote — loaded again when that session is RESUMED, which is what the bot does).
45
+ * They mirror `~/.claude` the way the four above do, but only while `~/.claude` HAS the entry (a link to nothing would be read at every
46
+ * start for nothing): where it has none, a profile must hold none either, so anything found there is moved aside.
47
+ * Not in the list, on purpose: `keybindings.json` and `themes/` (the docs give them no instruction or executable role),
48
+ * `settings.local.json` (the docs scope it to a project's `.claude/`, not the user directory) and `agent-memory/` (subagent memory —
49
+ * the account's own state, loaded only by a subagent that opts in).
50
+ */
51
+ export declare const claudeProfileOptionalSharedEntries: readonly ["CLAUDE.md", "rules", "agents", "commands", "output-styles", "workflows", "dev-mods"];
34
52
  /** Profile names are safe slugs: they become a directory name and a button's `callback_data`. */
35
53
  export declare const claudeProfileNameMaxLength = 32;
36
54
  /** Longest `callback_data` prefix the account picker uses; with the name cap it stays far under Telegram's 64 bytes. */
@@ -51,16 +69,93 @@ export declare function resolveClaudeProfileDir(dataDir: string, name: string):
51
69
  /** `~/.claude` — the directory the shared entries link back into. */
52
70
  export declare function resolveHomeClaudeDir(homeDir?: string): string;
53
71
  /**
54
- * @description Create a profile's config directory: `0700`, with the shared entries symlinked into `~/.claude`.
55
- * Idempotent — an existing directory keeps its login and only gains a missing link, so a re-run after a crash is
56
- * safe. Refuses `default` and an invalid name (defence in depth: the command gate already rejected them).
57
- * `~/.claude/projects` is created when absent so the link never dangles into the one entry the bot reads.
72
+ * @description Create a profile's config directory: `0700`, with the entries it mirrors from `~/.claude` linked
73
+ * ({@link repairClaudeProfileLayout}). Idempotent — an existing directory keeps its login and its state, gains a missing link, and has
74
+ * anything that stands in a link's place moved aside; so a re-run after a crash is safe. Refuses `default` and an invalid name
75
+ * (defence in depth: the command gate already rejected them). `~/.claude/projects` is created when absent so the link never dangles
76
+ * into the one entry the bot reads. A folder another user owns (an operator locked it) is not chmod'ed, and one this user cannot write is not written to.
58
77
  */
59
78
  export declare function createClaudeProfileLayout(input: {
60
79
  dataDir: string;
61
80
  name: string;
62
81
  homeClaudeDir?: string;
82
+ uid?: number | null;
63
83
  }): string;
84
+ /** What stood where a link into `~/.claude` belongs. */
85
+ export type ClaudeProfileEntryFinding = 'missing' | 'wrongLink' | 'file' | 'directory' | 'other';
86
+ /** One entry the repair found wrong and what it did (or would have done) about it. */
87
+ export interface ClaudeProfileRepairAction {
88
+ entry: string;
89
+ found: ClaudeProfileEntryFinding;
90
+ /** Where what stood there was moved aside to; `null` when nothing stood there. */
91
+ movedTo: string | null;
92
+ /** The target the link was restored to; `null` when `~/.claude` has no such entry and none belongs there. */
93
+ linkedTo: string | null;
94
+ }
95
+ export interface ClaudeProfileRepairResult {
96
+ /** The folder; `null` for `default`, an invalid name or an absent folder (nothing was looked at). */
97
+ dir: string | null;
98
+ /** `ok`: right already, or repaired; `notOwned`: wrong, in another user's folder this user cannot write — nothing was written; `failed`: a write failed. */
99
+ status: 'ok' | 'skipped' | 'notOwned' | 'failed';
100
+ /** What was repaired. */
101
+ actions: ClaudeProfileRepairAction[];
102
+ /** The entries still wrong afterwards (`notOwned`, `failed`). */
103
+ pending: string[];
104
+ }
105
+ /** For tests only: forget which profiles were warned about. */
106
+ export declare function resetClaudeProfileRepairWarningsForTests(): void;
107
+ /**
108
+ * @description Put a profile's folder back the way {@link createClaudeProfileLayout} made it, as far as the entries Claude Code loads
109
+ * as user-level configuration go ({@link claudeProfileSharedEntries} always, {@link claudeProfileOptionalSharedEntries} where
110
+ * `~/.claude` has them): each is a link to `~/.claude/<entry>`. Run right before every launch under the folder, so it is cheap — a few
111
+ * `lstat`s, and NOT ONE write when the layout is right (a link into `~/.claude` that dangles is right: it is the one the bot made).
112
+ * What stands in a link's place — a real file or directory, a link elsewhere, an entry `~/.claude` has no counterpart of — is MOVED
113
+ * ASIDE as `<entry>.moved-<UTC time>`, never deleted (it may hold the operator's data), one log line each, and the right link restored.
114
+ *
115
+ * Everything else in the folder is the account's own state — `.credentials.json`, `.claude.json`, backups, history, caches, the
116
+ * contents behind the `projects` link — and is never touched.
117
+ *
118
+ * A folder another user owns that this user cannot write (an operator locked it) is not written to: a wrong layout there is warned
119
+ * about ONCE per profile per process, and the launch goes ahead — the agent runs as the same user as the bot, so a folder the bot
120
+ * cannot write is one the agent could not plant in either. A locked folder this user CAN still write (its group or ACL lets the CLI
121
+ * save its own files there) is repaired like any other — an agent could add entries to it — as far as the operator's entries allow
122
+ * (with the sticky bit their links cannot be moved). A write that fails is warned about once the same way, unless `isStrict` (the
123
+ * creation path), which throws it.
124
+ */
125
+ export declare function repairClaudeProfileLayout(input: {
126
+ dataDir: string;
127
+ name: string;
128
+ homeClaudeDir?: string;
129
+ isStrict?: boolean;
130
+ /** The uid that decides ownership; the process's own unless a test says otherwise. `null`: no owner to ask. */
131
+ uid?: number | null;
132
+ now?: () => number;
133
+ log?: (line: string) => void;
134
+ }): ClaudeProfileRepairResult;
135
+ /**
136
+ * @description What a profile's `.claude.json` — the account's own state, which the repair never edits — holds that Claude Code treats
137
+ * as configuration with an effect: MCP servers (the docs keep them in `~/.claude.json`, per project under `projects.<path>.mcpServers`,
138
+ * and a profile's file carries them at the top level too), and, defensively, the settings-style keys `hooks`, `env`, `apiKeyHelper`
139
+ * and `statusLine` (the docs place those in `settings.json`; whether the CLI honours them in `.claude.json` is not documented, so a
140
+ * mention is a pointer, not a verdict). Names only — never a command, argument or value. `[]` for a file that is absent, too big or
141
+ * not JSON.
142
+ */
143
+ export declare function listClaudeProfileConfigRisks(configDir: string): string[];
144
+ /**
145
+ * @description THE call every launch under a profile folder makes first (a bot session, a sign-in or status probe, a worker the bot or
146
+ * the CLI points at an account): repair the folder's layout ({@link repairClaudeProfileLayout}), then say — once per distinct finding,
147
+ * not per launch — what its `.claude.json` configures ({@link listClaudeProfileConfigRisks}); the file is read only when its size or
148
+ * time moved. `configDir` is the directory a process is about to get as `CLAUDE_CONFIG_DIR`: `null` (the default account) and any
149
+ * directory that is not `<dataDir>/claude-profiles/<valid name>` are left alone. Never throws — a launch must not fail on a repair.
150
+ */
151
+ export declare function repairClaudeProfileFolderForLaunch(input: {
152
+ dataDir: string;
153
+ configDir: string | null;
154
+ homeClaudeDir?: string;
155
+ uid?: number | null;
156
+ now?: () => number;
157
+ log?: (line: string) => void;
158
+ }): ClaudeProfileRepairResult;
64
159
  /**
65
160
  * @description Remove a profile's directory — its login with it. `fs.rmSync` removes the symlinks AS LINKS, so
66
161
  * the shared `~/.claude` entries behind them are never touched. Refuses `default`.
@@ -1 +1 @@
1
- {"version":3,"file":"claudeProfiles.d.ts","sourceRoot":"","sources":["../../src/utils/claudeProfiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAOH,uEAAuE;AACvE,eAAO,MAAM,wBAAwB,YAAY,CAAC;AAElD,8EAA8E;AAC9E,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AAEvD;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,6DAA8D,CAAC;AACtG,eAAO,MAAM,kCAAkC,wBAAyB,CAAC;AAEzE,iGAAiG;AACjG,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAG7C,wHAAwH;AACxH,eAAO,MAAM,2BAA2B,UAAU,CAAC;AAEnD;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnE;AAED,2GAA2G;AAC3G,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED,wBAAgB,yBAAyB,CAAC,OAAO,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