codex-multi-auth 0.1.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 (327) hide show
  1. package/LICENSE +1 -0
  2. package/README.md +162 -0
  3. package/assets/opencode-logo-ornate-dark.svg +18 -0
  4. package/assets/readme-hero.svg +31 -0
  5. package/config/README.md +87 -0
  6. package/config/minimal-opencode.json +13 -0
  7. package/config/opencode-legacy.json +571 -0
  8. package/config/opencode-modern.json +239 -0
  9. package/dist/index.d.ts +45 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +3160 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/lib/accounts/rate-limits.d.ts +22 -0
  14. package/dist/lib/accounts/rate-limits.d.ts.map +1 -0
  15. package/dist/lib/accounts/rate-limits.js +63 -0
  16. package/dist/lib/accounts/rate-limits.js.map +1 -0
  17. package/dist/lib/accounts.d.ts +95 -0
  18. package/dist/lib/accounts.d.ts.map +1 -0
  19. package/dist/lib/accounts.js +668 -0
  20. package/dist/lib/accounts.js.map +1 -0
  21. package/dist/lib/audit.d.ts +45 -0
  22. package/dist/lib/audit.d.ts.map +1 -0
  23. package/dist/lib/audit.js +131 -0
  24. package/dist/lib/audit.js.map +1 -0
  25. package/dist/lib/auth/auth.d.ts +56 -0
  26. package/dist/lib/auth/auth.d.ts.map +1 -0
  27. package/dist/lib/auth/auth.js +214 -0
  28. package/dist/lib/auth/auth.js.map +1 -0
  29. package/dist/lib/auth/browser.d.ts +34 -0
  30. package/dist/lib/auth/browser.d.ts.map +1 -0
  31. package/dist/lib/auth/browser.js +185 -0
  32. package/dist/lib/auth/browser.js.map +1 -0
  33. package/dist/lib/auth/server.d.ts +24 -0
  34. package/dist/lib/auth/server.d.ts.map +1 -0
  35. package/dist/lib/auth/server.js +116 -0
  36. package/dist/lib/auth/server.js.map +1 -0
  37. package/dist/lib/auth/token-utils.d.ts +59 -0
  38. package/dist/lib/auth/token-utils.d.ts.map +1 -0
  39. package/dist/lib/auth/token-utils.js +331 -0
  40. package/dist/lib/auth/token-utils.js.map +1 -0
  41. package/dist/lib/auth-rate-limit.d.ts +20 -0
  42. package/dist/lib/auth-rate-limit.d.ts.map +1 -0
  43. package/dist/lib/auth-rate-limit.js +91 -0
  44. package/dist/lib/auth-rate-limit.js.map +1 -0
  45. package/dist/lib/auto-update-checker.d.ts +10 -0
  46. package/dist/lib/auto-update-checker.d.ts.map +1 -0
  47. package/dist/lib/auto-update-checker.js +216 -0
  48. package/dist/lib/auto-update-checker.js.map +1 -0
  49. package/dist/lib/capability-policy.d.ts +18 -0
  50. package/dist/lib/capability-policy.d.ts.map +1 -0
  51. package/dist/lib/capability-policy.js +150 -0
  52. package/dist/lib/capability-policy.js.map +1 -0
  53. package/dist/lib/circuit-breaker.d.ts +34 -0
  54. package/dist/lib/circuit-breaker.d.ts.map +1 -0
  55. package/dist/lib/circuit-breaker.js +124 -0
  56. package/dist/lib/circuit-breaker.js.map +1 -0
  57. package/dist/lib/cli.d.ts +64 -0
  58. package/dist/lib/cli.d.ts.map +1 -0
  59. package/dist/lib/cli.js +274 -0
  60. package/dist/lib/cli.js.map +1 -0
  61. package/dist/lib/codex-cli/observability.d.ts +22 -0
  62. package/dist/lib/codex-cli/observability.d.ts.map +1 -0
  63. package/dist/lib/codex-cli/observability.js +36 -0
  64. package/dist/lib/codex-cli/observability.js.map +1 -0
  65. package/dist/lib/codex-cli/state.d.ts +86 -0
  66. package/dist/lib/codex-cli/state.d.ts.map +1 -0
  67. package/dist/lib/codex-cli/state.js +470 -0
  68. package/dist/lib/codex-cli/state.js.map +1 -0
  69. package/dist/lib/codex-cli/sync.d.ts +27 -0
  70. package/dist/lib/codex-cli/sync.d.ts.map +1 -0
  71. package/dist/lib/codex-cli/sync.js +325 -0
  72. package/dist/lib/codex-cli/sync.js.map +1 -0
  73. package/dist/lib/codex-cli/writer.d.ts +12 -0
  74. package/dist/lib/codex-cli/writer.d.ts.map +1 -0
  75. package/dist/lib/codex-cli/writer.js +388 -0
  76. package/dist/lib/codex-cli/writer.js.map +1 -0
  77. package/dist/lib/codex-manager.d.ts +2 -0
  78. package/dist/lib/codex-manager.d.ts.map +1 -0
  79. package/dist/lib/codex-manager.js +4841 -0
  80. package/dist/lib/codex-manager.js.map +1 -0
  81. package/dist/lib/config.d.ts +269 -0
  82. package/dist/lib/config.d.ts.map +1 -0
  83. package/dist/lib/config.js +789 -0
  84. package/dist/lib/config.js.map +1 -0
  85. package/dist/lib/constants.d.ts +78 -0
  86. package/dist/lib/constants.d.ts.map +1 -0
  87. package/dist/lib/constants.js +78 -0
  88. package/dist/lib/constants.js.map +1 -0
  89. package/dist/lib/context-overflow.d.ts +27 -0
  90. package/dist/lib/context-overflow.d.ts.map +1 -0
  91. package/dist/lib/context-overflow.js +124 -0
  92. package/dist/lib/context-overflow.js.map +1 -0
  93. package/dist/lib/dashboard-settings.d.ts +90 -0
  94. package/dist/lib/dashboard-settings.d.ts.map +1 -0
  95. package/dist/lib/dashboard-settings.js +327 -0
  96. package/dist/lib/dashboard-settings.js.map +1 -0
  97. package/dist/lib/entitlement-cache.d.ts +41 -0
  98. package/dist/lib/entitlement-cache.d.ts.map +1 -0
  99. package/dist/lib/entitlement-cache.js +137 -0
  100. package/dist/lib/entitlement-cache.js.map +1 -0
  101. package/dist/lib/errors.d.ts +113 -0
  102. package/dist/lib/errors.d.ts.map +1 -0
  103. package/dist/lib/errors.js +103 -0
  104. package/dist/lib/errors.js.map +1 -0
  105. package/dist/lib/forecast.d.ts +42 -0
  106. package/dist/lib/forecast.d.ts.map +1 -0
  107. package/dist/lib/forecast.js +256 -0
  108. package/dist/lib/forecast.js.map +1 -0
  109. package/dist/lib/health.d.ts +33 -0
  110. package/dist/lib/health.d.ts.map +1 -0
  111. package/dist/lib/health.js +70 -0
  112. package/dist/lib/health.js.map +1 -0
  113. package/dist/lib/index.d.ts +32 -0
  114. package/dist/lib/index.d.ts.map +1 -0
  115. package/dist/lib/index.js +32 -0
  116. package/dist/lib/index.js.map +1 -0
  117. package/dist/lib/live-account-sync.d.ts +39 -0
  118. package/dist/lib/live-account-sync.d.ts.map +1 -0
  119. package/dist/lib/live-account-sync.js +196 -0
  120. package/dist/lib/live-account-sync.js.map +1 -0
  121. package/dist/lib/logger.d.ts +40 -0
  122. package/dist/lib/logger.d.ts.map +1 -0
  123. package/dist/lib/logger.js +364 -0
  124. package/dist/lib/logger.js.map +1 -0
  125. package/dist/lib/oauth-success.html +338 -0
  126. package/dist/lib/parallel-probe.d.ts +28 -0
  127. package/dist/lib/parallel-probe.d.ts.map +1 -0
  128. package/dist/lib/parallel-probe.js +97 -0
  129. package/dist/lib/parallel-probe.js.map +1 -0
  130. package/dist/lib/preemptive-quota-scheduler.d.ts +53 -0
  131. package/dist/lib/preemptive-quota-scheduler.d.ts.map +1 -0
  132. package/dist/lib/preemptive-quota-scheduler.js +220 -0
  133. package/dist/lib/preemptive-quota-scheduler.js.map +1 -0
  134. package/dist/lib/proactive-refresh.d.ts +66 -0
  135. package/dist/lib/proactive-refresh.d.ts.map +1 -0
  136. package/dist/lib/proactive-refresh.js +143 -0
  137. package/dist/lib/proactive-refresh.js.map +1 -0
  138. package/dist/lib/prompts/codex-opencode-bridge.d.ts +19 -0
  139. package/dist/lib/prompts/codex-opencode-bridge.d.ts.map +1 -0
  140. package/dist/lib/prompts/codex-opencode-bridge.js +169 -0
  141. package/dist/lib/prompts/codex-opencode-bridge.js.map +1 -0
  142. package/dist/lib/prompts/codex.d.ts +41 -0
  143. package/dist/lib/prompts/codex.d.ts.map +1 -0
  144. package/dist/lib/prompts/codex.js +383 -0
  145. package/dist/lib/prompts/codex.js.map +1 -0
  146. package/dist/lib/prompts/opencode-codex.d.ts +25 -0
  147. package/dist/lib/prompts/opencode-codex.d.ts.map +1 -0
  148. package/dist/lib/prompts/opencode-codex.js +270 -0
  149. package/dist/lib/prompts/opencode-codex.js.map +1 -0
  150. package/dist/lib/quota-cache.d.ts +68 -0
  151. package/dist/lib/quota-cache.d.ts.map +1 -0
  152. package/dist/lib/quota-cache.js +224 -0
  153. package/dist/lib/quota-cache.js.map +1 -0
  154. package/dist/lib/quota-probe.d.ts +49 -0
  155. package/dist/lib/quota-probe.d.ts.map +1 -0
  156. package/dist/lib/quota-probe.js +368 -0
  157. package/dist/lib/quota-probe.js.map +1 -0
  158. package/dist/lib/recovery/constants.d.ts +12 -0
  159. package/dist/lib/recovery/constants.d.ts.map +1 -0
  160. package/dist/lib/recovery/constants.js +31 -0
  161. package/dist/lib/recovery/constants.js.map +1 -0
  162. package/dist/lib/recovery/index.d.ts +12 -0
  163. package/dist/lib/recovery/index.d.ts.map +1 -0
  164. package/dist/lib/recovery/index.js +12 -0
  165. package/dist/lib/recovery/index.js.map +1 -0
  166. package/dist/lib/recovery/storage.d.ts +24 -0
  167. package/dist/lib/recovery/storage.d.ts.map +1 -0
  168. package/dist/lib/recovery/storage.js +362 -0
  169. package/dist/lib/recovery/storage.js.map +1 -0
  170. package/dist/lib/recovery/types.d.ts +116 -0
  171. package/dist/lib/recovery/types.d.ts.map +1 -0
  172. package/dist/lib/recovery/types.js +7 -0
  173. package/dist/lib/recovery/types.js.map +1 -0
  174. package/dist/lib/recovery.d.ts +31 -0
  175. package/dist/lib/recovery.d.ts.map +1 -0
  176. package/dist/lib/recovery.js +313 -0
  177. package/dist/lib/recovery.js.map +1 -0
  178. package/dist/lib/refresh-guardian.d.ts +31 -0
  179. package/dist/lib/refresh-guardian.d.ts.map +1 -0
  180. package/dist/lib/refresh-guardian.js +151 -0
  181. package/dist/lib/refresh-guardian.js.map +1 -0
  182. package/dist/lib/refresh-lease.d.ts +37 -0
  183. package/dist/lib/refresh-lease.d.ts.map +1 -0
  184. package/dist/lib/refresh-lease.js +335 -0
  185. package/dist/lib/refresh-lease.js.map +1 -0
  186. package/dist/lib/refresh-queue.d.ts +117 -0
  187. package/dist/lib/refresh-queue.d.ts.map +1 -0
  188. package/dist/lib/refresh-queue.js +297 -0
  189. package/dist/lib/refresh-queue.js.map +1 -0
  190. package/dist/lib/request/failure-policy.d.ts +42 -0
  191. package/dist/lib/request/failure-policy.d.ts.map +1 -0
  192. package/dist/lib/request/failure-policy.js +133 -0
  193. package/dist/lib/request/failure-policy.js.map +1 -0
  194. package/dist/lib/request/fetch-helpers.d.ts +152 -0
  195. package/dist/lib/request/fetch-helpers.d.ts.map +1 -0
  196. package/dist/lib/request/fetch-helpers.js +704 -0
  197. package/dist/lib/request/fetch-helpers.js.map +1 -0
  198. package/dist/lib/request/helpers/input-utils.d.ts +7 -0
  199. package/dist/lib/request/helpers/input-utils.d.ts.map +1 -0
  200. package/dist/lib/request/helpers/input-utils.js +214 -0
  201. package/dist/lib/request/helpers/input-utils.js.map +1 -0
  202. package/dist/lib/request/helpers/model-map.d.ts +28 -0
  203. package/dist/lib/request/helpers/model-map.d.ts.map +1 -0
  204. package/dist/lib/request/helpers/model-map.js +133 -0
  205. package/dist/lib/request/helpers/model-map.js.map +1 -0
  206. package/dist/lib/request/helpers/tool-utils.d.ts +29 -0
  207. package/dist/lib/request/helpers/tool-utils.d.ts.map +1 -0
  208. package/dist/lib/request/helpers/tool-utils.js +117 -0
  209. package/dist/lib/request/helpers/tool-utils.js.map +1 -0
  210. package/dist/lib/request/rate-limit-backoff.d.ts +17 -0
  211. package/dist/lib/request/rate-limit-backoff.d.ts.map +1 -0
  212. package/dist/lib/request/rate-limit-backoff.js +83 -0
  213. package/dist/lib/request/rate-limit-backoff.js.map +1 -0
  214. package/dist/lib/request/request-transformer.d.ts +107 -0
  215. package/dist/lib/request/request-transformer.d.ts.map +1 -0
  216. package/dist/lib/request/request-transformer.js +814 -0
  217. package/dist/lib/request/request-transformer.js.map +1 -0
  218. package/dist/lib/request/response-handler.d.ts +23 -0
  219. package/dist/lib/request/response-handler.d.ts.map +1 -0
  220. package/dist/lib/request/response-handler.js +155 -0
  221. package/dist/lib/request/response-handler.js.map +1 -0
  222. package/dist/lib/request/stream-failover.d.ts +21 -0
  223. package/dist/lib/request/stream-failover.d.ts.map +1 -0
  224. package/dist/lib/request/stream-failover.js +204 -0
  225. package/dist/lib/request/stream-failover.js.map +1 -0
  226. package/dist/lib/rotation.d.ts +146 -0
  227. package/dist/lib/rotation.d.ts.map +1 -0
  228. package/dist/lib/rotation.js +321 -0
  229. package/dist/lib/rotation.js.map +1 -0
  230. package/dist/lib/runtime-paths.d.ts +58 -0
  231. package/dist/lib/runtime-paths.d.ts.map +1 -0
  232. package/dist/lib/runtime-paths.js +164 -0
  233. package/dist/lib/runtime-paths.js.map +1 -0
  234. package/dist/lib/schemas.d.ts +435 -0
  235. package/dist/lib/schemas.d.ts.map +1 -0
  236. package/dist/lib/schemas.js +268 -0
  237. package/dist/lib/schemas.js.map +1 -0
  238. package/dist/lib/session-affinity.d.ts +23 -0
  239. package/dist/lib/session-affinity.d.ts.map +1 -0
  240. package/dist/lib/session-affinity.js +127 -0
  241. package/dist/lib/session-affinity.js.map +1 -0
  242. package/dist/lib/shutdown.d.ts +7 -0
  243. package/dist/lib/shutdown.d.ts.map +1 -0
  244. package/dist/lib/shutdown.js +43 -0
  245. package/dist/lib/shutdown.js.map +1 -0
  246. package/dist/lib/storage/migrations.d.ts +59 -0
  247. package/dist/lib/storage/migrations.d.ts.map +1 -0
  248. package/dist/lib/storage/migrations.js +41 -0
  249. package/dist/lib/storage/migrations.js.map +1 -0
  250. package/dist/lib/storage/paths.d.ts +51 -0
  251. package/dist/lib/storage/paths.d.ts.map +1 -0
  252. package/dist/lib/storage/paths.js +152 -0
  253. package/dist/lib/storage/paths.js.map +1 -0
  254. package/dist/lib/storage.d.ts +106 -0
  255. package/dist/lib/storage.d.ts.map +1 -0
  256. package/dist/lib/storage.js +896 -0
  257. package/dist/lib/storage.js.map +1 -0
  258. package/dist/lib/table-formatter.d.ts +32 -0
  259. package/dist/lib/table-formatter.d.ts.map +1 -0
  260. package/dist/lib/table-formatter.js +44 -0
  261. package/dist/lib/table-formatter.js.map +1 -0
  262. package/dist/lib/tools/hashline-tools.d.ts +51 -0
  263. package/dist/lib/tools/hashline-tools.d.ts.map +1 -0
  264. package/dist/lib/tools/hashline-tools.js +456 -0
  265. package/dist/lib/tools/hashline-tools.js.map +1 -0
  266. package/dist/lib/types.d.ts +130 -0
  267. package/dist/lib/types.d.ts.map +1 -0
  268. package/dist/lib/types.js +2 -0
  269. package/dist/lib/types.js.map +1 -0
  270. package/dist/lib/ui/ansi.d.ts +40 -0
  271. package/dist/lib/ui/ansi.d.ts.map +1 -0
  272. package/dist/lib/ui/ansi.js +68 -0
  273. package/dist/lib/ui/ansi.js.map +1 -0
  274. package/dist/lib/ui/auth-menu.d.ts +76 -0
  275. package/dist/lib/ui/auth-menu.d.ts.map +1 -0
  276. package/dist/lib/ui/auth-menu.js +590 -0
  277. package/dist/lib/ui/auth-menu.js.map +1 -0
  278. package/dist/lib/ui/confirm.d.ts +11 -0
  279. package/dist/lib/ui/confirm.d.ts.map +1 -0
  280. package/dist/lib/ui/confirm.js +29 -0
  281. package/dist/lib/ui/confirm.js.map +1 -0
  282. package/dist/lib/ui/copy.d.ts +123 -0
  283. package/dist/lib/ui/copy.d.ts.map +1 -0
  284. package/dist/lib/ui/copy.js +127 -0
  285. package/dist/lib/ui/copy.js.map +1 -0
  286. package/dist/lib/ui/format.d.ts +62 -0
  287. package/dist/lib/ui/format.d.ts.map +1 -0
  288. package/dist/lib/ui/format.js +205 -0
  289. package/dist/lib/ui/format.js.map +1 -0
  290. package/dist/lib/ui/runtime.d.ts +43 -0
  291. package/dist/lib/ui/runtime.d.ts.map +1 -0
  292. package/dist/lib/ui/runtime.js +69 -0
  293. package/dist/lib/ui/runtime.js.map +1 -0
  294. package/dist/lib/ui/select.d.ts +60 -0
  295. package/dist/lib/ui/select.d.ts.map +1 -0
  296. package/dist/lib/ui/select.js +467 -0
  297. package/dist/lib/ui/select.js.map +1 -0
  298. package/dist/lib/ui/theme.d.ts +56 -0
  299. package/dist/lib/ui/theme.d.ts.map +1 -0
  300. package/dist/lib/ui/theme.js +186 -0
  301. package/dist/lib/ui/theme.js.map +1 -0
  302. package/dist/lib/unified-settings.d.ts +71 -0
  303. package/dist/lib/unified-settings.d.ts.map +1 -0
  304. package/dist/lib/unified-settings.js +299 -0
  305. package/dist/lib/unified-settings.js.map +1 -0
  306. package/dist/lib/utils.d.ts +29 -0
  307. package/dist/lib/utils.d.ts.map +1 -0
  308. package/dist/lib/utils.js +54 -0
  309. package/dist/lib/utils.js.map +1 -0
  310. package/package.json +115 -0
  311. package/scripts/audit-dev-allowlist.js +128 -0
  312. package/scripts/bench-format/hashline-v2.mjs +642 -0
  313. package/scripts/bench-format/models.mjs +105 -0
  314. package/scripts/bench-format/opencode.mjs +205 -0
  315. package/scripts/bench-format/render.mjs +496 -0
  316. package/scripts/bench-format/stats.mjs +54 -0
  317. package/scripts/bench-format/tasks.mjs +151 -0
  318. package/scripts/benchmark-edit-formats.mjs +1161 -0
  319. package/scripts/benchmark-render-dashboard.mjs +49 -0
  320. package/scripts/codex-multi-auth.js +6 -0
  321. package/scripts/codex-routing.js +34 -0
  322. package/scripts/codex.js +122 -0
  323. package/scripts/copy-oauth-success.js +37 -0
  324. package/scripts/install-opencode-codex-auth.js +193 -0
  325. package/scripts/test-all-models.sh +7 -0
  326. package/scripts/test-model-matrix.js +424 -0
  327. package/scripts/validate-model-map.sh +7 -0
@@ -0,0 +1,321 @@
1
+ /**
2
+ * Rotation Strategy Module
3
+ *
4
+ * Implements health-based account selection with token bucket rate limiting.
5
+ * Ported from antigravity-auth rotation logic for optimal account rotation
6
+ * when rate limits are encountered.
7
+ */
8
+ import { createLogger } from "./logger.js";
9
+ const log = createLogger("rotation");
10
+ export const DEFAULT_HEALTH_SCORE_CONFIG = {
11
+ successDelta: 1,
12
+ rateLimitDelta: -10,
13
+ failureDelta: -20,
14
+ maxScore: 100,
15
+ minScore: 0,
16
+ passiveRecoveryPerHour: 2,
17
+ };
18
+ /**
19
+ * Tracks health scores for accounts to prioritize healthy accounts.
20
+ * Accounts with higher health scores are preferred for selection.
21
+ */
22
+ export class HealthScoreTracker {
23
+ entries = new Map();
24
+ config;
25
+ constructor(config = {}) {
26
+ this.config = { ...DEFAULT_HEALTH_SCORE_CONFIG, ...config };
27
+ }
28
+ getKey(accountIndex, quotaKey) {
29
+ return quotaKey ? `${accountIndex}:${quotaKey}` : `${accountIndex}`;
30
+ }
31
+ applyPassiveRecovery(entry) {
32
+ const now = Date.now();
33
+ const hoursSinceUpdate = (now - entry.lastUpdated) / (1000 * 60 * 60);
34
+ const recovery = hoursSinceUpdate * this.config.passiveRecoveryPerHour;
35
+ return Math.min(entry.score + recovery, this.config.maxScore);
36
+ }
37
+ getScore(accountIndex, quotaKey) {
38
+ const key = this.getKey(accountIndex, quotaKey);
39
+ const entry = this.entries.get(key);
40
+ if (!entry)
41
+ return this.config.maxScore;
42
+ return this.applyPassiveRecovery(entry);
43
+ }
44
+ getConsecutiveFailures(accountIndex, quotaKey) {
45
+ const key = this.getKey(accountIndex, quotaKey);
46
+ const entry = this.entries.get(key);
47
+ return entry?.consecutiveFailures ?? 0;
48
+ }
49
+ recordSuccess(accountIndex, quotaKey) {
50
+ const key = this.getKey(accountIndex, quotaKey);
51
+ const entry = this.entries.get(key);
52
+ const baseScore = entry ? this.applyPassiveRecovery(entry) : this.config.maxScore;
53
+ const newScore = Math.min(baseScore + this.config.successDelta, this.config.maxScore);
54
+ this.entries.set(key, {
55
+ score: newScore,
56
+ lastUpdated: Date.now(),
57
+ consecutiveFailures: 0,
58
+ });
59
+ }
60
+ recordRateLimit(accountIndex, quotaKey) {
61
+ const key = this.getKey(accountIndex, quotaKey);
62
+ const entry = this.entries.get(key);
63
+ const baseScore = entry ? this.applyPassiveRecovery(entry) : this.config.maxScore;
64
+ const newScore = Math.max(baseScore + this.config.rateLimitDelta, this.config.minScore);
65
+ this.entries.set(key, {
66
+ score: newScore,
67
+ lastUpdated: Date.now(),
68
+ consecutiveFailures: (entry?.consecutiveFailures ?? 0) + 1,
69
+ });
70
+ }
71
+ recordFailure(accountIndex, quotaKey) {
72
+ const key = this.getKey(accountIndex, quotaKey);
73
+ const entry = this.entries.get(key);
74
+ const baseScore = entry ? this.applyPassiveRecovery(entry) : this.config.maxScore;
75
+ const newScore = Math.max(baseScore + this.config.failureDelta, this.config.minScore);
76
+ this.entries.set(key, {
77
+ score: newScore,
78
+ lastUpdated: Date.now(),
79
+ consecutiveFailures: (entry?.consecutiveFailures ?? 0) + 1,
80
+ });
81
+ }
82
+ reset(accountIndex, quotaKey) {
83
+ const key = this.getKey(accountIndex, quotaKey);
84
+ this.entries.delete(key);
85
+ }
86
+ clear() {
87
+ this.entries.clear();
88
+ }
89
+ }
90
+ export const DEFAULT_TOKEN_BUCKET_CONFIG = {
91
+ maxTokens: 50,
92
+ tokensPerMinute: 6,
93
+ };
94
+ const TOKEN_REFUND_WINDOW_MS = 30_000;
95
+ /**
96
+ * Client-side token bucket for rate limiting requests per account.
97
+ * Prevents sending requests to accounts that are likely to be rate-limited.
98
+ */
99
+ export class TokenBucketTracker {
100
+ buckets = new Map();
101
+ config;
102
+ constructor(config = {}) {
103
+ this.config = { ...DEFAULT_TOKEN_BUCKET_CONFIG, ...config };
104
+ }
105
+ getKey(accountIndex, quotaKey) {
106
+ return quotaKey ? `${accountIndex}:${quotaKey}` : `${accountIndex}`;
107
+ }
108
+ refillTokens(entry) {
109
+ const now = Date.now();
110
+ const minutesSinceRefill = (now - entry.lastRefill) / (1000 * 60);
111
+ const tokensToAdd = minutesSinceRefill * this.config.tokensPerMinute;
112
+ return Math.min(entry.tokens + tokensToAdd, this.config.maxTokens);
113
+ }
114
+ getTokens(accountIndex, quotaKey) {
115
+ const key = this.getKey(accountIndex, quotaKey);
116
+ const entry = this.buckets.get(key);
117
+ if (!entry)
118
+ return this.config.maxTokens;
119
+ return this.refillTokens(entry);
120
+ }
121
+ /**
122
+ * Attempt to consume a token. Returns true if successful, false if bucket is empty.
123
+ */
124
+ tryConsume(accountIndex, quotaKey) {
125
+ const key = this.getKey(accountIndex, quotaKey);
126
+ const entry = this.buckets.get(key);
127
+ const currentTokens = entry ? this.refillTokens(entry) : this.config.maxTokens;
128
+ if (currentTokens < 1) {
129
+ return false;
130
+ }
131
+ const now = Date.now();
132
+ const cutoff = now - TOKEN_REFUND_WINDOW_MS;
133
+ const consumptions = (entry?.consumptions ?? []).filter((timestamp) => timestamp >= cutoff);
134
+ consumptions.push(now);
135
+ this.buckets.set(key, {
136
+ tokens: currentTokens - 1,
137
+ lastRefill: now,
138
+ consumptions,
139
+ });
140
+ return true;
141
+ }
142
+ /**
143
+ * Attempt to refund a token consumed within the refund window.
144
+ * Use this when a request fails due to network errors (not rate limits).
145
+ * @returns true if refund was successful, false if no valid consumption found
146
+ */
147
+ refundToken(accountIndex, quotaKey) {
148
+ const key = this.getKey(accountIndex, quotaKey);
149
+ const entry = this.buckets.get(key);
150
+ if (!entry || entry.consumptions.length === 0)
151
+ return false;
152
+ const now = Date.now();
153
+ const cutoff = now - TOKEN_REFUND_WINDOW_MS;
154
+ const validIndex = entry.consumptions.findIndex((timestamp) => timestamp >= cutoff);
155
+ if (validIndex === -1)
156
+ return false;
157
+ entry.consumptions.splice(validIndex, 1);
158
+ const currentTokens = this.refillTokens(entry);
159
+ this.buckets.set(key, {
160
+ tokens: Math.min(currentTokens + 1, this.config.maxTokens),
161
+ lastRefill: now,
162
+ consumptions: entry.consumptions,
163
+ });
164
+ return true;
165
+ }
166
+ /**
167
+ * Drain tokens on rate limit to prevent immediate retries.
168
+ */
169
+ drain(accountIndex, quotaKey, drainAmount = 10) {
170
+ const key = this.getKey(accountIndex, quotaKey);
171
+ const entry = this.buckets.get(key);
172
+ const currentTokens = entry ? this.refillTokens(entry) : this.config.maxTokens;
173
+ this.buckets.set(key, {
174
+ tokens: Math.max(0, currentTokens - drainAmount),
175
+ lastRefill: Date.now(),
176
+ consumptions: entry?.consumptions ?? [],
177
+ });
178
+ }
179
+ reset(accountIndex, quotaKey) {
180
+ const key = this.getKey(accountIndex, quotaKey);
181
+ this.buckets.delete(key);
182
+ }
183
+ clear() {
184
+ this.buckets.clear();
185
+ }
186
+ }
187
+ export const DEFAULT_HYBRID_SELECTION_CONFIG = {
188
+ healthWeight: 2,
189
+ tokenWeight: 5,
190
+ freshnessWeight: 2.0,
191
+ };
192
+ /**
193
+ * Selects the best account from a set using a weighted hybrid score composed of health, token availability, and freshness.
194
+ *
195
+ * @param accounts - Candidate accounts with availability (`isAvailable`) and last-used timestamp (`lastUsed`); when none are available the least-recently-used account is returned.
196
+ * @param healthTracker - Tracker used to obtain per-account health scores (scoped by `quotaKey` when provided).
197
+ * @param tokenTracker - Tracker used to obtain per-account token counts (scoped by `quotaKey` when provided). Logged token values are rounded for telemetry and sensitive tokens are not emitted.
198
+ * @param quotaKey - Optional quota key to scope health and token lookups.
199
+ * @param config - Partial selection weights that override defaults (healthWeight, tokenWeight, freshnessWeight).
200
+ * @param options - Selection options. `pidOffsetEnabled` adds a small PID-based deterministic offset to distribute selection across processes. `scoreBoostByAccount` is an optional per-account numeric boost keyed by account index.
201
+ * @returns The chosen AccountWithMetrics for the next request, or `null` if no accounts exist.
202
+ *
203
+ * Concurrency & environment notes:
204
+ * - Selection is deterministic given the same inputs except when `pidOffsetEnabled` is used to bias selection per-process.
205
+ * - The function is purely in-memory and performs no filesystem operations (no Windows filesystem considerations).
206
+ */
207
+ export function selectHybridAccount(accounts, healthTracker, tokenTracker, quotaKey, config = {}, options = {}) {
208
+ const cfg = { ...DEFAULT_HYBRID_SELECTION_CONFIG, ...config };
209
+ const available = accounts.filter((a) => a.isAvailable);
210
+ if (available.length === 0) {
211
+ if (accounts.length === 0)
212
+ return null;
213
+ let leastRecentlyUsed = null;
214
+ let oldestTime = Infinity;
215
+ for (const account of accounts) {
216
+ if (account.lastUsed < oldestTime) {
217
+ oldestTime = account.lastUsed;
218
+ leastRecentlyUsed = account;
219
+ }
220
+ }
221
+ return leastRecentlyUsed;
222
+ }
223
+ // istanbul ignore next -- defensive: available[0] always exists when length === 1
224
+ if (available.length === 1)
225
+ return available[0] ?? null;
226
+ const now = Date.now();
227
+ let bestAccount = null;
228
+ let bestScore = -Infinity;
229
+ // PID offset: distribute account selection across parallel processes
230
+ // Each process gets a small deterministic bonus based on its PID
231
+ const pidBonus = options.pidOffsetEnabled ? (process.pid % 100) * 0.01 : 0;
232
+ for (const account of available) {
233
+ const health = healthTracker.getScore(account.index, quotaKey);
234
+ const tokens = tokenTracker.getTokens(account.index, quotaKey);
235
+ const hoursSinceUsed = (now - account.lastUsed) / (1000 * 60 * 60);
236
+ const capabilityBoost = typeof options.scoreBoostByAccount?.[account.index] === "number"
237
+ ? options.scoreBoostByAccount[account.index] ?? 0
238
+ : 0;
239
+ const safeCapabilityBoost = Number.isFinite(capabilityBoost) ? capabilityBoost : 0;
240
+ let score = health * cfg.healthWeight +
241
+ tokens * cfg.tokenWeight +
242
+ hoursSinceUsed * cfg.freshnessWeight +
243
+ safeCapabilityBoost;
244
+ // PID-based offset distributes selection across parallel agents
245
+ if (options.pidOffsetEnabled) {
246
+ score += ((account.index * 0.131 + pidBonus) % 1) * cfg.freshnessWeight * 0.1;
247
+ }
248
+ if (score > bestScore) {
249
+ bestScore = score;
250
+ bestAccount = account;
251
+ }
252
+ }
253
+ if (bestAccount && available.length > 1) {
254
+ const health = healthTracker.getScore(bestAccount.index, quotaKey);
255
+ const tokens = tokenTracker.getTokens(bestAccount.index, quotaKey);
256
+ log.debug("Selected account", {
257
+ index: bestAccount.index,
258
+ health: Math.round(health),
259
+ tokens: Math.round(tokens),
260
+ score: Math.round(bestScore),
261
+ candidateCount: available.length,
262
+ });
263
+ }
264
+ return bestAccount;
265
+ }
266
+ // ============================================================================
267
+ // Utility Functions
268
+ // ============================================================================
269
+ /**
270
+ * Adds random jitter to a delay value.
271
+ * @param baseMs - Base delay in milliseconds
272
+ * @param jitterFactor - Jitter factor (0-1), default 0.1 (10%)
273
+ * @returns Delay with jitter applied
274
+ */
275
+ export function addJitter(baseMs, jitterFactor = 0.1) {
276
+ const jitter = baseMs * jitterFactor * (Math.random() * 2 - 1);
277
+ return Math.max(0, Math.floor(baseMs + jitter));
278
+ }
279
+ /**
280
+ * Returns a random delay within a range.
281
+ * @param minMs - Minimum delay in milliseconds
282
+ * @param maxMs - Maximum delay in milliseconds
283
+ * @returns Random delay within range
284
+ */
285
+ export function randomDelay(minMs, maxMs) {
286
+ return Math.floor(minMs + Math.random() * (maxMs - minMs));
287
+ }
288
+ /**
289
+ * Calculates exponential backoff with jitter.
290
+ * @param attempt - Attempt number (1-based)
291
+ * @param baseMs - Base delay in milliseconds
292
+ * @param maxMs - Maximum delay in milliseconds
293
+ * @param jitterFactor - Jitter factor (0-1)
294
+ * @returns Backoff delay with jitter
295
+ */
296
+ export function exponentialBackoff(attempt, baseMs = 1000, maxMs = 60000, jitterFactor = 0.1) {
297
+ const delay = Math.min(baseMs * Math.pow(2, attempt - 1), maxMs);
298
+ return addJitter(delay, jitterFactor);
299
+ }
300
+ // ============================================================================
301
+ // Singleton Instances
302
+ // ============================================================================
303
+ let healthTrackerInstance = null;
304
+ let tokenTrackerInstance = null;
305
+ export function getHealthTracker(config) {
306
+ if (!healthTrackerInstance) {
307
+ healthTrackerInstance = new HealthScoreTracker(config);
308
+ }
309
+ return healthTrackerInstance;
310
+ }
311
+ export function getTokenTracker(config) {
312
+ if (!tokenTrackerInstance) {
313
+ tokenTrackerInstance = new TokenBucketTracker(config);
314
+ }
315
+ return tokenTrackerInstance;
316
+ }
317
+ export function resetTrackers() {
318
+ healthTrackerInstance?.clear();
319
+ tokenTrackerInstance?.clear();
320
+ }
321
+ //# sourceMappingURL=rotation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rotation.js","sourceRoot":"","sources":["../../lib/rotation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,GAAG,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;AAqBrC,MAAM,CAAC,MAAM,2BAA2B,G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,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,oBAAoB,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,qBAAqB,EAAE,KAAK,EAAE,CAAC;IAC/B,oBAAoB,EAAE,KAAK,EAAE,CAAC;AAChC,CAAC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Resolve the Codex home directory path used by the CLI, honoring an environment override or a sensible default.
3
+ *
4
+ * This function is safe to call concurrently and returns a filesystem path string as-is; on Windows the underlying filesystem is case-insensitive so callers should avoid relying on case for equality. The returned path may contain sensitive identifiers; redact or avoid logging it in plaintext.
5
+ *
6
+ * @returns The resolved Codex home directory path: the value of `CODEX_HOME` when set and non-empty, otherwise the user's home directory joined with `.codex`.
7
+ */
8
+ export declare function getCodexHomeDir(): string;
9
+ /**
10
+ * Determine the directory to use for Codex multi-auth data, preferring an explicit override
11
+ * or existing storage locations and falling back to the primary Codex location.
12
+ *
13
+ * @returns The resolved multi-auth directory path.
14
+ *
15
+ * @remarks
16
+ * Concurrency: safe to call concurrently; the function only inspects filesystem state and does not create or mutate directories.
17
+ *
18
+ * Windows: deduplication and existence checks treat paths case-insensitively on Windows; returned paths preserve platform-native casing.
19
+ *
20
+ * Security: returned paths may contain user-specific or sensitive data; callers should redact or avoid logging full paths.
21
+ */
22
+ export declare function getCodexMultiAuthDir(): string;
23
+ /**
24
+ * Resolves the Codex cache directory used for storing cached multi-auth artifacts.
25
+ *
26
+ * The returned path is derived from the resolved multi-auth directory. Callers should avoid concurrent
27
+ * mutations to the returned directory path (concurrent reads are safe). On Windows, path comparison
28
+ * is case-insensitive elsewhere in this module; the returned path itself preserves platform casing.
29
+ *
30
+ * Token or secret redaction is not performed on the path; do not log paths that may contain secrets.
31
+ *
32
+ * @returns The filesystem path to the Codex cache directory.
33
+ */
34
+ export declare function getCodexCacheDir(): string;
35
+ /**
36
+ * Resolve the filesystem path for Codex log files.
37
+ *
38
+ * Returns the `logs` subdirectory within the resolved multi-auth directory.
39
+ * Concurrency: safe to call concurrently; this function performs no I/O or directory creation.
40
+ * Windows: path comparisons elsewhere are case-insensitive on Windows; this function returns a path using the platform separator.
41
+ * Security: the returned path may contain sensitive artifacts (tokens/credentials); redact before logging or diagnostics.
42
+ *
43
+ * @returns The path to the Codex `logs` directory (i.e., `<multi-auth-dir>/logs`)
44
+ */
45
+ export declare function getCodexLogDir(): string;
46
+ /**
47
+ * Resolve the legacy OpenCode home directory path.
48
+ *
49
+ * The returned path points to the per-user legacy OpenCode folder (typically `<home>/.opencode`).
50
+ *
51
+ * Concurrency: no atomicity guarantees — callers must handle concurrent filesystem access.
52
+ * Windows: path comparisons may be case-insensitive on Windows filesystems.
53
+ * Security: do not embed or log secrets/tokens in this path; redact any tokens before logging or telemetry.
54
+ *
55
+ * @returns The filesystem path for the legacy OpenCode directory (e.g. `/home/alice/.opencode`).
56
+ */
57
+ export declare function getLegacyOpenCodeDir(): string;
58
+ //# sourceMappingURL=runtime-paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-paths.d.ts","sourceRoot":"","sources":["../../lib/runtime-paths.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AAEH,wBAAgB,eAAe,IAAI,MAAM,CAGxC;AA4ED;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAwB7C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C"}
@@ -0,0 +1,164 @@
1
+ import { homedir } from "node:os";
2
+ import { join } from "node:path";
3
+ import { existsSync } from "node:fs";
4
+ /**
5
+ * Resolve the Codex home directory path used by the CLI, honoring an environment override or a sensible default.
6
+ *
7
+ * This function is safe to call concurrently and returns a filesystem path string as-is; on Windows the underlying filesystem is case-insensitive so callers should avoid relying on case for equality. The returned path may contain sensitive identifiers; redact or avoid logging it in plaintext.
8
+ *
9
+ * @returns The resolved Codex home directory path: the value of `CODEX_HOME` when set and non-empty, otherwise the user's home directory joined with `.codex`.
10
+ */
11
+ export function getCodexHomeDir() {
12
+ const fromEnv = (process.env.CODEX_HOME ?? "").trim();
13
+ return fromEnv.length > 0 ? fromEnv : join(homedir(), ".codex");
14
+ }
15
+ /**
16
+ * Returns a deduplicated list of path strings preserving the first occurrence order.
17
+ *
18
+ * Trims each input entry and ignores empty results; comparison for uniqueness is
19
+ * case-insensitive on Windows and case-sensitive on other platforms. This function
20
+ * performs no I/O and is safe to call concurrently.
21
+ *
22
+ * Note: entries are preserved as trimmed strings and are not modified for token
23
+ * redaction or normalization beyond trimming and optional lowercasing on Windows.
24
+ *
25
+ * @param paths - Array of path strings to deduplicate
26
+ * @returns An array of unique, trimmed path strings in their original first-seen order
27
+ */
28
+ function deduplicatePaths(paths) {
29
+ const seen = new Set();
30
+ const result = [];
31
+ for (const candidate of paths) {
32
+ const trimmed = candidate.trim();
33
+ if (trimmed.length === 0)
34
+ continue;
35
+ const key = process.platform === "win32" ? trimmed.toLowerCase() : trimmed;
36
+ if (seen.has(key))
37
+ continue;
38
+ seen.add(key);
39
+ result.push(trimmed);
40
+ }
41
+ return result;
42
+ }
43
+ /**
44
+ * Detects whether a directory contains known Codex storage indicators.
45
+ *
46
+ * Checks for the presence of known signal files (for example: openai-codex-accounts.json, settings.json, config.json, dashboard-settings.json)
47
+ * or a "projects" subdirectory to determine if the directory appears to hold Codex data.
48
+ *
49
+ * Notes:
50
+ * - The check only tests filesystem existence; it does not read file contents (no token or secret inspection/redaction is performed).
51
+ * - Results can change if other processes modify the filesystem concurrently; callers should tolerate races.
52
+ * - On Windows, filesystem case-insensitivity affects existence checks.
53
+ *
54
+ * @param dir - Filesystem path of the directory to probe
55
+ * @returns `true` if any known signal file or a "projects" subdirectory exists, `false` otherwise.
56
+ */
57
+ function hasStorageSignals(dir) {
58
+ const signals = [
59
+ "openai-codex-accounts.json",
60
+ "settings.json",
61
+ "config.json",
62
+ "dashboard-settings.json",
63
+ ];
64
+ for (const signal of signals) {
65
+ if (existsSync(join(dir, signal))) {
66
+ return true;
67
+ }
68
+ }
69
+ return existsSync(join(dir, "projects"));
70
+ }
71
+ /**
72
+ * Builds a deduplicated list of fallback candidate directories that may contain Codex runtime data.
73
+ *
74
+ * The returned list preserves evaluation order (primary Codex home first, then DevTools config, then legacy ~/.codex).
75
+ * Comparison is normalized for case-insensitive filesystems (Windows) during deduplication. Callers should treat
76
+ * these paths as suggestions only; concurrent callers may observe different filesystem states and should handle
77
+ * races. Paths may contain sensitive tokens; callers must redact or avoid logging them.
78
+ *
79
+ * @returns An array of unique, trimmed directory paths to probe for Codex home data, in prioritized order.
80
+ */
81
+ function getFallbackCodexHomeDirs() {
82
+ return deduplicatePaths([
83
+ getCodexHomeDir(),
84
+ join(homedir(), "DevTools", "config", "codex"),
85
+ join(homedir(), ".codex"),
86
+ ]);
87
+ }
88
+ /**
89
+ * Determine the directory to use for Codex multi-auth data, preferring an explicit override
90
+ * or existing storage locations and falling back to the primary Codex location.
91
+ *
92
+ * @returns The resolved multi-auth directory path.
93
+ *
94
+ * @remarks
95
+ * Concurrency: safe to call concurrently; the function only inspects filesystem state and does not create or mutate directories.
96
+ *
97
+ * Windows: deduplication and existence checks treat paths case-insensitively on Windows; returned paths preserve platform-native casing.
98
+ *
99
+ * Security: returned paths may contain user-specific or sensitive data; callers should redact or avoid logging full paths.
100
+ */
101
+ export function getCodexMultiAuthDir() {
102
+ const fromEnv = (process.env.CODEX_MULTI_AUTH_DIR ?? "").trim();
103
+ if (fromEnv.length > 0) {
104
+ return fromEnv;
105
+ }
106
+ const primary = join(getCodexHomeDir(), "multi-auth");
107
+ if (hasStorageSignals(primary)) {
108
+ return primary;
109
+ }
110
+ const fallbackCandidates = deduplicatePaths([
111
+ ...getFallbackCodexHomeDirs().map((dir) => join(dir, "multi-auth")),
112
+ getLegacyOpenCodeDir(),
113
+ ]);
114
+ for (const candidate of fallbackCandidates) {
115
+ if (candidate === primary)
116
+ continue;
117
+ if (hasStorageSignals(candidate)) {
118
+ return candidate;
119
+ }
120
+ }
121
+ return primary;
122
+ }
123
+ /**
124
+ * Resolves the Codex cache directory used for storing cached multi-auth artifacts.
125
+ *
126
+ * The returned path is derived from the resolved multi-auth directory. Callers should avoid concurrent
127
+ * mutations to the returned directory path (concurrent reads are safe). On Windows, path comparison
128
+ * is case-insensitive elsewhere in this module; the returned path itself preserves platform casing.
129
+ *
130
+ * Token or secret redaction is not performed on the path; do not log paths that may contain secrets.
131
+ *
132
+ * @returns The filesystem path to the Codex cache directory.
133
+ */
134
+ export function getCodexCacheDir() {
135
+ return join(getCodexMultiAuthDir(), "cache");
136
+ }
137
+ /**
138
+ * Resolve the filesystem path for Codex log files.
139
+ *
140
+ * Returns the `logs` subdirectory within the resolved multi-auth directory.
141
+ * Concurrency: safe to call concurrently; this function performs no I/O or directory creation.
142
+ * Windows: path comparisons elsewhere are case-insensitive on Windows; this function returns a path using the platform separator.
143
+ * Security: the returned path may contain sensitive artifacts (tokens/credentials); redact before logging or diagnostics.
144
+ *
145
+ * @returns The path to the Codex `logs` directory (i.e., `<multi-auth-dir>/logs`)
146
+ */
147
+ export function getCodexLogDir() {
148
+ return join(getCodexMultiAuthDir(), "logs");
149
+ }
150
+ /**
151
+ * Resolve the legacy OpenCode home directory path.
152
+ *
153
+ * The returned path points to the per-user legacy OpenCode folder (typically `<home>/.opencode`).
154
+ *
155
+ * Concurrency: no atomicity guarantees — callers must handle concurrent filesystem access.
156
+ * Windows: path comparisons may be case-insensitive on Windows filesystems.
157
+ * Security: do not embed or log secrets/tokens in this path; redact any tokens before logging or telemetry.
158
+ *
159
+ * @returns The filesystem path for the legacy OpenCode directory (e.g. `/home/alice/.opencode`).
160
+ */
161
+ export function getLegacyOpenCodeDir() {
162
+ return join(homedir(), ".opencode");
163
+ }
164
+ //# sourceMappingURL=runt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