@kaitranntt/ccs 8.4.0-dev.10 → 8.4.0-dev.12

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 (528) hide show
  1. package/README.md +4 -1
  2. package/dist/auth/profile-registry.d.ts.map +1 -1
  3. package/dist/auth/profile-registry.js +13 -12
  4. package/dist/auth/profile-registry.js.map +1 -1
  5. package/dist/cliproxy/accounts/account-safety.d.ts.map +1 -1
  6. package/dist/cliproxy/accounts/account-safety.js +56 -56
  7. package/dist/cliproxy/accounts/account-safety.js.map +1 -1
  8. package/dist/cliproxy/auth/antigravity-responsibility.d.ts.map +1 -1
  9. package/dist/cliproxy/auth/antigravity-responsibility.js +15 -15
  10. package/dist/cliproxy/auth/antigravity-responsibility.js.map +1 -1
  11. package/dist/cliproxy/auth/auth-token-manager.d.ts.map +1 -1
  12. package/dist/cliproxy/auth/auth-token-manager.js +2 -1
  13. package/dist/cliproxy/auth/auth-token-manager.js.map +1 -1
  14. package/dist/cliproxy/auth/auth-types.d.ts.map +1 -1
  15. package/dist/cliproxy/auth/auth-types.js +3 -2
  16. package/dist/cliproxy/auth/auth-types.js.map +1 -1
  17. package/dist/cliproxy/auth/oauth-handler.d.ts.map +1 -1
  18. package/dist/cliproxy/auth/oauth-handler.js +16 -5
  19. package/dist/cliproxy/auth/oauth-handler.js.map +1 -1
  20. package/dist/cliproxy/auth/provider-refreshers/index.d.ts +2 -1
  21. package/dist/cliproxy/auth/provider-refreshers/index.d.ts.map +1 -1
  22. package/dist/cliproxy/auth/provider-refreshers/index.js +4 -2
  23. package/dist/cliproxy/auth/provider-refreshers/index.js.map +1 -1
  24. package/dist/cliproxy/auth/token-manager.d.ts +2 -1
  25. package/dist/cliproxy/auth/token-manager.d.ts.map +1 -1
  26. package/dist/cliproxy/auth/token-manager.js +2 -1
  27. package/dist/cliproxy/auth/token-manager.js.map +1 -1
  28. package/dist/cliproxy/config/model-config.d.ts.map +1 -1
  29. package/dist/cliproxy/config/model-config.js +32 -32
  30. package/dist/cliproxy/config/model-config.js.map +1 -1
  31. package/dist/cliproxy/executor/arg-parser.d.ts.map +1 -1
  32. package/dist/cliproxy/executor/arg-parser.js +26 -26
  33. package/dist/cliproxy/executor/arg-parser.js.map +1 -1
  34. package/dist/cliproxy/executor/auth-coordinator.d.ts.map +1 -1
  35. package/dist/cliproxy/executor/auth-coordinator.js +15 -14
  36. package/dist/cliproxy/executor/auth-coordinator.js.map +1 -1
  37. package/dist/cliproxy/executor/index.d.ts.map +1 -1
  38. package/dist/cliproxy/executor/index.js +17 -13
  39. package/dist/cliproxy/executor/index.js.map +1 -1
  40. package/dist/cliproxy/executor/lifecycle-manager.d.ts.map +1 -1
  41. package/dist/cliproxy/executor/lifecycle-manager.js +18 -16
  42. package/dist/cliproxy/executor/lifecycle-manager.js.map +1 -1
  43. package/dist/cliproxy/executor/model-warnings.d.ts.map +1 -1
  44. package/dist/cliproxy/executor/model-warnings.js +24 -13
  45. package/dist/cliproxy/executor/model-warnings.js.map +1 -1
  46. package/dist/cliproxy/executor/retry-handler.d.ts.map +1 -1
  47. package/dist/cliproxy/executor/retry-handler.js +13 -11
  48. package/dist/cliproxy/executor/retry-handler.js.map +1 -1
  49. package/dist/cliproxy/executor/session-bridge.d.ts.map +1 -1
  50. package/dist/cliproxy/executor/session-bridge.js +18 -10
  51. package/dist/cliproxy/executor/session-bridge.js.map +1 -1
  52. package/dist/cliproxy/management/remote-token-uploader.d.ts.map +1 -1
  53. package/dist/cliproxy/management/remote-token-uploader.js +11 -11
  54. package/dist/cliproxy/management/remote-token-uploader.js.map +1 -1
  55. package/dist/cliproxy/provider-capabilities.d.ts +6 -0
  56. package/dist/cliproxy/provider-capabilities.d.ts.map +1 -1
  57. package/dist/cliproxy/provider-capabilities.js +28 -3
  58. package/dist/cliproxy/provider-capabilities.js.map +1 -1
  59. package/dist/cliproxy/proxy/https-tunnel-proxy.d.ts +5 -1
  60. package/dist/cliproxy/proxy/https-tunnel-proxy.d.ts.map +1 -1
  61. package/dist/cliproxy/proxy/https-tunnel-proxy.js +22 -10
  62. package/dist/cliproxy/proxy/https-tunnel-proxy.js.map +1 -1
  63. package/dist/cliproxy/proxy/tool-sanitization-proxy.d.ts +0 -12
  64. package/dist/cliproxy/proxy/tool-sanitization-proxy.d.ts.map +1 -1
  65. package/dist/cliproxy/proxy/tool-sanitization-proxy.js +42 -72
  66. package/dist/cliproxy/proxy/tool-sanitization-proxy.js.map +1 -1
  67. package/dist/cliproxy/quota/quota-fetcher/account-quota-fetcher.d.ts +21 -0
  68. package/dist/cliproxy/quota/quota-fetcher/account-quota-fetcher.d.ts.map +1 -0
  69. package/dist/cliproxy/quota/quota-fetcher/account-quota-fetcher.js +154 -0
  70. package/dist/cliproxy/quota/quota-fetcher/account-quota-fetcher.js.map +1 -0
  71. package/dist/cliproxy/quota/quota-fetcher/all-accounts-fetcher.d.ts +35 -0
  72. package/dist/cliproxy/quota/quota-fetcher/all-accounts-fetcher.d.ts.map +1 -0
  73. package/dist/cliproxy/quota/quota-fetcher/all-accounts-fetcher.js +98 -0
  74. package/dist/cliproxy/quota/quota-fetcher/all-accounts-fetcher.js.map +1 -0
  75. package/dist/cliproxy/quota/quota-fetcher/auth-file-reader.d.ts +22 -0
  76. package/dist/cliproxy/quota/quota-fetcher/auth-file-reader.d.ts.map +1 -0
  77. package/dist/cliproxy/quota/quota-fetcher/auth-file-reader.js +111 -0
  78. package/dist/cliproxy/quota/quota-fetcher/auth-file-reader.js.map +1 -0
  79. package/dist/cliproxy/quota/quota-fetcher/available-models-fetcher.d.ts +17 -0
  80. package/dist/cliproxy/quota/quota-fetcher/available-models-fetcher.d.ts.map +1 -0
  81. package/dist/cliproxy/quota/quota-fetcher/available-models-fetcher.js +85 -0
  82. package/dist/cliproxy/quota/quota-fetcher/available-models-fetcher.js.map +1 -0
  83. package/dist/cliproxy/quota/quota-fetcher/constants.d.ts +25 -0
  84. package/dist/cliproxy/quota/quota-fetcher/constants.d.ts.map +1 -0
  85. package/dist/cliproxy/quota/quota-fetcher/constants.js +31 -0
  86. package/dist/cliproxy/quota/quota-fetcher/constants.js.map +1 -0
  87. package/dist/cliproxy/quota/quota-fetcher/http-client.d.ts +29 -0
  88. package/dist/cliproxy/quota/quota-fetcher/http-client.d.ts.map +1 -0
  89. package/dist/cliproxy/quota/quota-fetcher/http-client.js +199 -0
  90. package/dist/cliproxy/quota/quota-fetcher/http-client.js.map +1 -0
  91. package/dist/cliproxy/quota/quota-fetcher/project-lookup.d.ts +16 -0
  92. package/dist/cliproxy/quota/quota-fetcher/project-lookup.d.ts.map +1 -0
  93. package/dist/cliproxy/quota/quota-fetcher/project-lookup.js +89 -0
  94. package/dist/cliproxy/quota/quota-fetcher/project-lookup.js.map +1 -0
  95. package/dist/cliproxy/quota/quota-fetcher/status-classifier.d.ts +29 -0
  96. package/dist/cliproxy/quota/quota-fetcher/status-classifier.d.ts.map +1 -0
  97. package/dist/cliproxy/quota/quota-fetcher/status-classifier.js +168 -0
  98. package/dist/cliproxy/quota/quota-fetcher/status-classifier.js.map +1 -0
  99. package/dist/cliproxy/quota/quota-fetcher/types.d.ts +165 -0
  100. package/dist/cliproxy/quota/quota-fetcher/types.d.ts.map +1 -0
  101. package/dist/cliproxy/quota/quota-fetcher/types.js +9 -0
  102. package/dist/cliproxy/quota/quota-fetcher/types.js.map +1 -0
  103. package/dist/cliproxy/quota/quota-fetcher-claude.d.ts.map +1 -1
  104. package/dist/cliproxy/quota/quota-fetcher-claude.js +14 -3
  105. package/dist/cliproxy/quota/quota-fetcher-claude.js.map +1 -1
  106. package/dist/cliproxy/quota/quota-fetcher-codex.d.ts.map +1 -1
  107. package/dist/cliproxy/quota/quota-fetcher-codex.js +36 -9
  108. package/dist/cliproxy/quota/quota-fetcher-codex.js.map +1 -1
  109. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/auth-file-discovery.d.ts +26 -0
  110. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/auth-file-discovery.d.ts.map +1 -0
  111. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/auth-file-discovery.js +132 -0
  112. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/auth-file-discovery.js.map +1 -0
  113. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/bucket-building.d.ts +23 -0
  114. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/bucket-building.d.ts.map +1 -0
  115. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/bucket-building.js +54 -0
  116. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/bucket-building.js.map +1 -0
  117. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/constants.d.ts +26 -0
  118. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/constants.d.ts.map +1 -0
  119. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/constants.js +29 -0
  120. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/constants.js.map +1 -0
  121. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/error-parsing.d.ts +61 -0
  122. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/error-parsing.d.ts.map +1 -0
  123. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/error-parsing.js +259 -0
  124. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/error-parsing.js.map +1 -0
  125. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/index.d.ts +20 -0
  126. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/index.d.ts.map +1 -0
  127. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/index.js +38 -0
  128. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/index.js.map +1 -0
  129. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/managed-request.d.ts +82 -0
  130. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/managed-request.d.ts.map +1 -0
  131. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/managed-request.js +263 -0
  132. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/managed-request.js.map +1 -0
  133. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/quota-fetcher.d.ts +46 -0
  134. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/quota-fetcher.d.ts.map +1 -0
  135. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/quota-fetcher.js +188 -0
  136. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/quota-fetcher.js.map +1 -0
  137. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/shared-utils.d.ts +35 -0
  138. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/shared-utils.d.ts.map +1 -0
  139. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/shared-utils.js +65 -0
  140. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/shared-utils.js.map +1 -0
  141. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/supplementary-metadata.d.ts +37 -0
  142. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/supplementary-metadata.d.ts.map +1 -0
  143. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/supplementary-metadata.js +117 -0
  144. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/supplementary-metadata.js.map +1 -0
  145. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/token-parsing.d.ts +31 -0
  146. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/token-parsing.d.ts.map +1 -0
  147. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/token-parsing.js +77 -0
  148. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/token-parsing.js.map +1 -0
  149. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/types.d.ts +114 -0
  150. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/types.d.ts.map +1 -0
  151. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/types.js +10 -0
  152. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/types.js.map +1 -0
  153. package/dist/cliproxy/quota/quota-fetcher-gemini-cli.d.ts +13 -58
  154. package/dist/cliproxy/quota/quota-fetcher-gemini-cli.d.ts.map +1 -1
  155. package/dist/cliproxy/quota/quota-fetcher-gemini-cli.js +20 -819
  156. package/dist/cliproxy/quota/quota-fetcher-gemini-cli.js.map +1 -1
  157. package/dist/cliproxy/quota/quota-fetcher-ghcp.d.ts.map +1 -1
  158. package/dist/cliproxy/quota/quota-fetcher-ghcp.js +19 -4
  159. package/dist/cliproxy/quota/quota-fetcher-ghcp.js.map +1 -1
  160. package/dist/cliproxy/quota/quota-fetcher.d.ts +12 -108
  161. package/dist/cliproxy/quota/quota-fetcher.d.ts.map +1 -1
  162. package/dist/cliproxy/quota/quota-fetcher.js +23 -766
  163. package/dist/cliproxy/quota/quota-fetcher.js.map +1 -1
  164. package/dist/cliproxy/routing/routing-strategy.d.ts.map +1 -1
  165. package/dist/cliproxy/routing/routing-strategy.js +11 -3
  166. package/dist/cliproxy/routing/routing-strategy.js.map +1 -1
  167. package/dist/commands/cliproxy/quota-subcommand/claude-window-helpers.d.ts +26 -0
  168. package/dist/commands/cliproxy/quota-subcommand/claude-window-helpers.d.ts.map +1 -0
  169. package/dist/commands/cliproxy/quota-subcommand/claude-window-helpers.js +82 -0
  170. package/dist/commands/cliproxy/quota-subcommand/claude-window-helpers.js.map +1 -0
  171. package/dist/commands/cliproxy/quota-subcommand/codex-window-helpers.d.ts +41 -0
  172. package/dist/commands/cliproxy/quota-subcommand/codex-window-helpers.d.ts.map +1 -0
  173. package/dist/commands/cliproxy/quota-subcommand/codex-window-helpers.js +202 -0
  174. package/dist/commands/cliproxy/quota-subcommand/codex-window-helpers.js.map +1 -0
  175. package/dist/commands/cliproxy/quota-subcommand/format-helpers.d.ts +32 -0
  176. package/dist/commands/cliproxy/quota-subcommand/format-helpers.d.ts.map +1 -0
  177. package/dist/commands/cliproxy/quota-subcommand/format-helpers.js +90 -0
  178. package/dist/commands/cliproxy/quota-subcommand/format-helpers.js.map +1 -0
  179. package/dist/commands/cliproxy/quota-subcommand/handlers.d.ts +25 -0
  180. package/dist/commands/cliproxy/quota-subcommand/handlers.d.ts.map +1 -0
  181. package/dist/commands/cliproxy/quota-subcommand/handlers.js +245 -0
  182. package/dist/commands/cliproxy/quota-subcommand/handlers.js.map +1 -0
  183. package/dist/commands/cliproxy/quota-subcommand/profile-args.d.ts +10 -0
  184. package/dist/commands/cliproxy/quota-subcommand/profile-args.d.ts.map +1 -0
  185. package/dist/commands/cliproxy/quota-subcommand/profile-args.js +37 -0
  186. package/dist/commands/cliproxy/quota-subcommand/profile-args.js.map +1 -0
  187. package/dist/commands/cliproxy/quota-subcommand/provider-runtime.d.ts +12 -0
  188. package/dist/commands/cliproxy/quota-subcommand/provider-runtime.d.ts.map +1 -0
  189. package/dist/commands/cliproxy/quota-subcommand/provider-runtime.js +64 -0
  190. package/dist/commands/cliproxy/quota-subcommand/provider-runtime.js.map +1 -0
  191. package/dist/commands/cliproxy/quota-subcommand/quota-failure-display.d.ts +27 -0
  192. package/dist/commands/cliproxy/quota-subcommand/quota-failure-display.d.ts.map +1 -0
  193. package/dist/commands/cliproxy/quota-subcommand/quota-failure-display.js +74 -0
  194. package/dist/commands/cliproxy/quota-subcommand/quota-failure-display.js.map +1 -0
  195. package/dist/commands/cliproxy/quota-subcommand/sections/antigravity.d.ts +10 -0
  196. package/dist/commands/cliproxy/quota-subcommand/sections/antigravity.d.ts.map +1 -0
  197. package/dist/commands/cliproxy/quota-subcommand/sections/antigravity.js +46 -0
  198. package/dist/commands/cliproxy/quota-subcommand/sections/antigravity.js.map +1 -0
  199. package/dist/commands/cliproxy/quota-subcommand/sections/claude.d.ts +14 -0
  200. package/dist/commands/cliproxy/quota-subcommand/sections/claude.d.ts.map +1 -0
  201. package/dist/commands/cliproxy/quota-subcommand/sections/claude.js +68 -0
  202. package/dist/commands/cliproxy/quota-subcommand/sections/claude.js.map +1 -0
  203. package/dist/commands/cliproxy/quota-subcommand/sections/codex.d.ts +14 -0
  204. package/dist/commands/cliproxy/quota-subcommand/sections/codex.d.ts.map +1 -0
  205. package/dist/commands/cliproxy/quota-subcommand/sections/codex.js +82 -0
  206. package/dist/commands/cliproxy/quota-subcommand/sections/codex.js.map +1 -0
  207. package/dist/commands/cliproxy/quota-subcommand/sections/gemini-cli.d.ts +14 -0
  208. package/dist/commands/cliproxy/quota-subcommand/sections/gemini-cli.d.ts.map +1 -0
  209. package/dist/commands/cliproxy/quota-subcommand/sections/gemini-cli.js +61 -0
  210. package/dist/commands/cliproxy/quota-subcommand/sections/gemini-cli.js.map +1 -0
  211. package/dist/commands/cliproxy/quota-subcommand/sections/ghcp.d.ts +13 -0
  212. package/dist/commands/cliproxy/quota-subcommand/sections/ghcp.d.ts.map +1 -0
  213. package/dist/commands/cliproxy/quota-subcommand/sections/ghcp.js +63 -0
  214. package/dist/commands/cliproxy/quota-subcommand/sections/ghcp.js.map +1 -0
  215. package/dist/commands/cliproxy/quota-subcommand/test-exports.d.ts +19 -0
  216. package/dist/commands/cliproxy/quota-subcommand/test-exports.d.ts.map +1 -0
  217. package/dist/commands/cliproxy/quota-subcommand/test-exports.js +22 -0
  218. package/dist/commands/cliproxy/quota-subcommand/test-exports.js.map +1 -0
  219. package/dist/commands/cliproxy/quota-subcommand/types.d.ts +42 -0
  220. package/dist/commands/cliproxy/quota-subcommand/types.d.ts.map +1 -0
  221. package/dist/commands/cliproxy/quota-subcommand/types.js +9 -0
  222. package/dist/commands/cliproxy/quota-subcommand/types.js.map +1 -0
  223. package/dist/commands/cliproxy/quota-subcommand.d.ts +14 -36
  224. package/dist/commands/cliproxy/quota-subcommand.d.ts.map +1 -1
  225. package/dist/commands/cliproxy/quota-subcommand.js +21 -872
  226. package/dist/commands/cliproxy/quota-subcommand.js.map +1 -1
  227. package/dist/commands/command-catalog.js +1 -1
  228. package/dist/commands/command-catalog.js.map +1 -1
  229. package/dist/commands/persist-command/arg-parsing.d.ts +14 -0
  230. package/dist/commands/persist-command/arg-parsing.d.ts.map +1 -0
  231. package/dist/commands/persist-command/arg-parsing.js +84 -0
  232. package/dist/commands/persist-command/arg-parsing.js.map +1 -0
  233. package/dist/commands/persist-command/backup-rotation.d.ts +23 -0
  234. package/dist/commands/persist-command/backup-rotation.d.ts.map +1 -0
  235. package/dist/commands/persist-command/backup-rotation.js +260 -0
  236. package/dist/commands/persist-command/backup-rotation.js.map +1 -0
  237. package/dist/commands/persist-command/handler.d.ts +10 -0
  238. package/dist/commands/persist-command/handler.d.ts.map +1 -0
  239. package/dist/commands/persist-command/handler.js +267 -0
  240. package/dist/commands/persist-command/handler.js.map +1 -0
  241. package/dist/commands/persist-command/help.d.ts +9 -0
  242. package/dist/commands/persist-command/help.d.ts.map +1 -0
  243. package/dist/commands/persist-command/help.js +86 -0
  244. package/dist/commands/persist-command/help.js.map +1 -0
  245. package/dist/commands/persist-command/receipt.d.ts +13 -0
  246. package/dist/commands/persist-command/receipt.d.ts.map +1 -0
  247. package/dist/commands/persist-command/receipt.js +102 -0
  248. package/dist/commands/persist-command/receipt.js.map +1 -0
  249. package/dist/commands/persist-command/secret-detection.d.ts +11 -0
  250. package/dist/commands/persist-command/secret-detection.d.ts.map +1 -0
  251. package/dist/commands/persist-command/secret-detection.js +54 -0
  252. package/dist/commands/persist-command/secret-detection.js.map +1 -0
  253. package/dist/commands/persist-command/secure-file.d.ts +21 -0
  254. package/dist/commands/persist-command/secure-file.d.ts.map +1 -0
  255. package/dist/commands/persist-command/secure-file.js +231 -0
  256. package/dist/commands/persist-command/secure-file.js.map +1 -0
  257. package/dist/commands/persist-command/types.d.ts +42 -0
  258. package/dist/commands/persist-command/types.d.ts.map +1 -0
  259. package/dist/commands/persist-command/types.js +34 -0
  260. package/dist/commands/persist-command/types.js.map +1 -0
  261. package/dist/commands/persist-command.d.ts +7 -2
  262. package/dist/commands/persist-command.d.ts.map +1 -1
  263. package/dist/commands/persist-command.js +17 -933
  264. package/dist/commands/persist-command.js.map +1 -1
  265. package/dist/copilot/copilot-executor.js +25 -25
  266. package/dist/copilot/copilot-executor.js.map +1 -1
  267. package/dist/cursor/cursor-daemon-entry.d.ts.map +1 -1
  268. package/dist/cursor/cursor-daemon-entry.js +34 -9
  269. package/dist/cursor/cursor-daemon-entry.js.map +1 -1
  270. package/dist/cursor/cursor-daemon.d.ts.map +1 -1
  271. package/dist/cursor/cursor-daemon.js +1 -0
  272. package/dist/cursor/cursor-daemon.js.map +1 -1
  273. package/dist/cursor/cursor-profile-executor.d.ts.map +1 -1
  274. package/dist/cursor/cursor-profile-executor.js +18 -17
  275. package/dist/cursor/cursor-profile-executor.js.map +1 -1
  276. package/dist/delegation/delegation-handler.d.ts.map +1 -1
  277. package/dist/delegation/delegation-handler.js +29 -23
  278. package/dist/delegation/delegation-handler.js.map +1 -1
  279. package/dist/delegation/headless-executor.d.ts +1 -0
  280. package/dist/delegation/headless-executor.d.ts.map +1 -1
  281. package/dist/delegation/headless-executor.js +35 -14
  282. package/dist/delegation/headless-executor.js.map +1 -1
  283. package/dist/delegation/session-manager.d.ts.map +1 -1
  284. package/dist/delegation/session-manager.js +12 -4
  285. package/dist/delegation/session-manager.js.map +1 -1
  286. package/dist/dispatcher/cli-argument-parser.d.ts +1 -1
  287. package/dist/dispatcher/cli-argument-parser.d.ts.map +1 -1
  288. package/dist/dispatcher/cli-argument-parser.js +24 -23
  289. package/dist/dispatcher/cli-argument-parser.js.map +1 -1
  290. package/dist/dispatcher/flows/cliproxy-flow.d.ts.map +1 -1
  291. package/dist/dispatcher/flows/cliproxy-flow.js +12 -11
  292. package/dist/dispatcher/flows/cliproxy-flow.js.map +1 -1
  293. package/dist/dispatcher/flows/settings-flow.d.ts.map +1 -1
  294. package/dist/dispatcher/flows/settings-flow.js +27 -27
  295. package/dist/dispatcher/flows/settings-flow.js.map +1 -1
  296. package/dist/dispatcher/profile-resolver.d.ts.map +1 -1
  297. package/dist/dispatcher/profile-resolver.js +16 -16
  298. package/dist/dispatcher/profile-resolver.js.map +1 -1
  299. package/dist/docker/supervisord-lifecycle.d.ts.map +1 -1
  300. package/dist/docker/supervisord-lifecycle.js +5 -1
  301. package/dist/docker/supervisord-lifecycle.js.map +1 -1
  302. package/dist/errors/error-types.d.ts +26 -22
  303. package/dist/errors/error-types.d.ts.map +1 -1
  304. package/dist/errors/error-types.js +15 -12
  305. package/dist/errors/error-types.js.map +1 -1
  306. package/dist/errors/exit-codes.d.ts +20 -13
  307. package/dist/errors/exit-codes.d.ts.map +1 -1
  308. package/dist/errors/exit-codes.js +32 -28
  309. package/dist/errors/exit-codes.js.map +1 -1
  310. package/dist/glmt/delta-accumulator.d.ts +1 -0
  311. package/dist/glmt/delta-accumulator.d.ts.map +1 -1
  312. package/dist/glmt/delta-accumulator.js +12 -4
  313. package/dist/glmt/delta-accumulator.js.map +1 -1
  314. package/dist/glmt/glmt-proxy.d.ts.map +1 -1
  315. package/dist/glmt/glmt-proxy.js +39 -10
  316. package/dist/glmt/glmt-proxy.js.map +1 -1
  317. package/dist/glmt/glmt-transformer.d.ts.map +1 -1
  318. package/dist/glmt/glmt-transformer.js +1 -4
  319. package/dist/glmt/glmt-transformer.js.map +1 -1
  320. package/dist/glmt/pipeline/request-transformer.d.ts.map +1 -1
  321. package/dist/glmt/pipeline/request-transformer.js +5 -1
  322. package/dist/glmt/pipeline/request-transformer.js.map +1 -1
  323. package/dist/glmt/pipeline/response-builder.d.ts.map +1 -1
  324. package/dist/glmt/pipeline/response-builder.js +7 -3
  325. package/dist/glmt/pipeline/response-builder.js.map +1 -1
  326. package/dist/glmt/pipeline/stream-parser.d.ts.map +1 -1
  327. package/dist/glmt/pipeline/stream-parser.js +11 -5
  328. package/dist/glmt/pipeline/stream-parser.js.map +1 -1
  329. package/dist/glmt/pipeline/tool-call-handler.d.ts.map +1 -1
  330. package/dist/glmt/pipeline/tool-call-handler.js +7 -1
  331. package/dist/glmt/pipeline/tool-call-handler.js.map +1 -1
  332. package/dist/glmt/sse-parser.d.ts +1 -0
  333. package/dist/glmt/sse-parser.d.ts.map +1 -1
  334. package/dist/glmt/sse-parser.js +7 -3
  335. package/dist/glmt/sse-parser.js.map +1 -1
  336. package/dist/management/shared-manager/fs-helpers.d.ts +69 -0
  337. package/dist/management/shared-manager/fs-helpers.d.ts.map +1 -0
  338. package/dist/management/shared-manager/fs-helpers.js +241 -0
  339. package/dist/management/shared-manager/fs-helpers.js.map +1 -0
  340. package/dist/management/shared-manager/migrations.d.ts +21 -0
  341. package/dist/management/shared-manager/migrations.d.ts.map +1 -0
  342. package/dist/management/shared-manager/migrations.js +187 -0
  343. package/dist/management/shared-manager/migrations.js.map +1 -0
  344. package/dist/management/shared-manager/orchestrator.d.ts +87 -0
  345. package/dist/management/shared-manager/orchestrator.d.ts.map +1 -0
  346. package/dist/management/shared-manager/orchestrator.js +161 -0
  347. package/dist/management/shared-manager/orchestrator.js.map +1 -0
  348. package/dist/management/shared-manager/plugin-layout-internals.d.ts +42 -0
  349. package/dist/management/shared-manager/plugin-layout-internals.d.ts.map +1 -0
  350. package/dist/management/shared-manager/plugin-layout-internals.js +192 -0
  351. package/dist/management/shared-manager/plugin-layout-internals.js.map +1 -0
  352. package/dist/management/shared-manager/plugin-metadata-normalizer.d.ts +53 -0
  353. package/dist/management/shared-manager/plugin-metadata-normalizer.d.ts.map +1 -0
  354. package/dist/management/shared-manager/plugin-metadata-normalizer.js +253 -0
  355. package/dist/management/shared-manager/plugin-metadata-normalizer.js.map +1 -0
  356. package/dist/management/shared-manager/project-context-sync.d.ts +36 -0
  357. package/dist/management/shared-manager/project-context-sync.d.ts.map +1 -0
  358. package/dist/management/shared-manager/project-context-sync.js +204 -0
  359. package/dist/management/shared-manager/project-context-sync.js.map +1 -0
  360. package/dist/management/shared-manager/project-memory-sync.d.ts +21 -0
  361. package/dist/management/shared-manager/project-memory-sync.d.ts.map +1 -0
  362. package/dist/management/shared-manager/project-memory-sync.js +113 -0
  363. package/dist/management/shared-manager/project-memory-sync.js.map +1 -0
  364. package/dist/management/shared-manager/shared-dir-linker.d.ts +41 -0
  365. package/dist/management/shared-manager/shared-dir-linker.d.ts.map +1 -0
  366. package/dist/management/shared-manager/shared-dir-linker.js +227 -0
  367. package/dist/management/shared-manager/shared-dir-linker.js.map +1 -0
  368. package/dist/management/shared-manager/symlink-helpers.d.ts +61 -0
  369. package/dist/management/shared-manager/symlink-helpers.d.ts.map +1 -0
  370. package/dist/management/shared-manager/symlink-helpers.js +243 -0
  371. package/dist/management/shared-manager/symlink-helpers.js.map +1 -0
  372. package/dist/management/shared-manager/types.d.ts +45 -0
  373. package/dist/management/shared-manager/types.d.ts.map +1 -0
  374. package/dist/management/shared-manager/types.js +57 -0
  375. package/dist/management/shared-manager/types.js.map +1 -0
  376. package/dist/management/shared-manager.d.ts +13 -160
  377. package/dist/management/shared-manager.d.ts.map +1 -1
  378. package/dist/management/shared-manager.js +18 -1294
  379. package/dist/management/shared-manager.js.map +1 -1
  380. package/dist/proxy/proxy-daemon-entry.js +1 -1
  381. package/dist/proxy/proxy-daemon-entry.js.map +1 -1
  382. package/dist/proxy/transformers/sse-stream-transformer.d.ts.map +1 -1
  383. package/dist/proxy/transformers/sse-stream-transformer.js +12 -17
  384. package/dist/proxy/transformers/sse-stream-transformer.js.map +1 -1
  385. package/dist/services/logging/index.d.ts +1 -1
  386. package/dist/services/logging/index.d.ts.map +1 -1
  387. package/dist/services/logging/index.js +6 -1
  388. package/dist/services/logging/index.js.map +1 -1
  389. package/dist/services/logging/log-context.d.ts +27 -2
  390. package/dist/services/logging/log-context.d.ts.map +1 -1
  391. package/dist/services/logging/log-context.js +43 -4
  392. package/dist/services/logging/log-context.js.map +1 -1
  393. package/dist/services/logging/log-redaction.d.ts +9 -0
  394. package/dist/services/logging/log-redaction.d.ts.map +1 -1
  395. package/dist/services/logging/log-redaction.js +31 -3
  396. package/dist/services/logging/log-redaction.js.map +1 -1
  397. package/dist/services/logging/logger.js +2 -2
  398. package/dist/services/logging/logger.js.map +1 -1
  399. package/dist/targets/codex-adapter.d.ts.map +1 -1
  400. package/dist/targets/codex-adapter.js +11 -10
  401. package/dist/targets/codex-adapter.js.map +1 -1
  402. package/dist/targets/droid-adapter.d.ts.map +1 -1
  403. package/dist/targets/droid-adapter.js +12 -12
  404. package/dist/targets/droid-adapter.js.map +1 -1
  405. package/dist/ui/assets/{Trans-BXjW_Rw3.js → Trans-BwpUiqvP.js} +1 -1
  406. package/dist/ui/assets/{accounts-C7JMc-UL.js → accounts-CDeA-kae.js} +1 -1
  407. package/dist/ui/assets/{alert-dialog-BSSHnWG_.js → alert-dialog-BRkyiRHQ.js} +1 -1
  408. package/dist/ui/assets/{api-GzEZNvOJ.js → api-BRWfSjSD.js} +1 -1
  409. package/dist/ui/assets/{auth-section-B6k7LWIq.js → auth-section-Dld8SmBW.js} +1 -1
  410. package/dist/ui/assets/{backups-section-Cr3g01YN.js → backups-section-BjxUn_e_.js} +1 -1
  411. package/dist/ui/assets/{channels-CMyh1yhN.js → channels-DNygT5ch.js} +1 -1
  412. package/dist/ui/assets/{checkbox-BkqYXiER.js → checkbox-BJ0-bsxD.js} +1 -1
  413. package/dist/ui/assets/{claude-extension-BzYl3zcz.js → claude-extension-CC-wTNix.js} +1 -1
  414. package/dist/ui/assets/{cliproxy-DwzKzuZI.js → cliproxy-DetLHcry.js} +1 -1
  415. package/dist/ui/assets/{cliproxy-ai-providers-DL95SYNa.js → cliproxy-ai-providers-Bff5bWqv.js} +1 -1
  416. package/dist/ui/assets/{cliproxy-control-panel-Ba2Rgzdo.js → cliproxy-control-panel-Bn8hX4VV.js} +1 -1
  417. package/dist/ui/assets/{codex-ClTEGCnr.js → codex-CNpaciGy.js} +1 -1
  418. package/dist/ui/assets/{confirm-dialog-BPAO4ILr.js → confirm-dialog-COJMNkgP.js} +1 -1
  419. package/dist/ui/assets/{copilot-CymHD4gl.js → copilot-DEBijivg.js} +1 -1
  420. package/dist/ui/assets/{cursor-DAiPXs8h.js → cursor-C-dhAZ4z.js} +1 -1
  421. package/dist/ui/assets/{droid-CAhLWDOj.js → droid-BqDBIX3T.js} +1 -1
  422. package/dist/ui/assets/{globalenv-section-BK5x_uXG.js → globalenv-section-BgosEOku.js} +1 -1
  423. package/dist/ui/assets/{health-D_ErMvYv.js → health-7mnaGWzH.js} +1 -1
  424. package/dist/ui/assets/{index-BZMyk4bI.js → index-6pgCCA-E.js} +1 -1
  425. package/dist/ui/assets/{index-BcfwoMDm.js → index-8KxHfBTG.js} +36 -36
  426. package/dist/ui/assets/{index-BmbKPprT.js → index-C6UKtunR.js} +1 -1
  427. package/dist/ui/assets/{index-B4cUkPwc.js → index-fDjN779H.js} +1 -1
  428. package/dist/ui/assets/{index-CEjVNSjg.js → index-pqVnLYqm.js} +1 -1
  429. package/dist/ui/assets/{index-CFDjAXOB.js → index-qCqsxM4P.js} +1 -1
  430. package/dist/ui/assets/{index-DCC80SZ0.js → index-yHxwc_u3.js} +1 -1
  431. package/dist/ui/assets/{logs-DwhXr-9Y.js → logs-i-F9qaEH.js} +1 -1
  432. package/dist/ui/assets/{masked-input-DWJTe7jh.js → masked-input-D9UchwhD.js} +1 -1
  433. package/dist/ui/assets/{proxy-status-widget-CJXi8yui.js → proxy-status-widget-BaFIW7Op.js} +1 -1
  434. package/dist/ui/assets/{raw-json-settings-editor-panel-DWhAi0kI.js → raw-json-settings-editor-panel-sC8qxIaf.js} +1 -1
  435. package/dist/ui/assets/{searchable-select-CYC4Y8pS.js → searchable-select-C_x7EmF6.js} +1 -1
  436. package/dist/ui/assets/{separator-JhuNwVKE.js → separator-mNegtV2Z.js} +1 -1
  437. package/dist/ui/assets/{shared-Hpgs7l5G.js → shared-DpJUlkXs.js} +1 -1
  438. package/dist/ui/assets/{table-DDJTZfyL.js → table-CtEViMua.js} +1 -1
  439. package/dist/ui/assets/{updates-CtygOHUO.js → updates-RohG3ly8.js} +1 -1
  440. package/dist/ui/assets/{use-accounts-CaptC8AS.js → use-accounts-CVjvVzVy.js} +1 -1
  441. package/dist/ui/index.html +1 -1
  442. package/dist/utils/image-analysis/mcp-installer.d.ts.map +1 -1
  443. package/dist/utils/image-analysis/mcp-installer.js +16 -13
  444. package/dist/utils/image-analysis/mcp-installer.js.map +1 -1
  445. package/dist/utils/websearch/mcp-installer.d.ts.map +1 -1
  446. package/dist/utils/websearch/mcp-installer.js +14 -12
  447. package/dist/utils/websearch/mcp-installer.js.map +1 -1
  448. package/dist/web-server/middleware/request-logging-middleware.d.ts.map +1 -1
  449. package/dist/web-server/middleware/request-logging-middleware.js +14 -9
  450. package/dist/web-server/middleware/request-logging-middleware.js.map +1 -1
  451. package/dist/web-server/routes/bar-routes.d.ts.map +1 -1
  452. package/dist/web-server/routes/bar-routes.js +11 -2
  453. package/dist/web-server/routes/bar-routes.js.map +1 -1
  454. package/dist/web-server/routes/claude-extension-routes.d.ts.map +1 -1
  455. package/dist/web-server/routes/claude-extension-routes.js +3 -2
  456. package/dist/web-server/routes/claude-extension-routes.js.map +1 -1
  457. package/dist/web-server/routes/cliproxy-auth-routes.d.ts +1 -0
  458. package/dist/web-server/routes/cliproxy-auth-routes.d.ts.map +1 -1
  459. package/dist/web-server/routes/cliproxy-auth-routes.js +20 -5
  460. package/dist/web-server/routes/cliproxy-auth-routes.js.map +1 -1
  461. package/dist/web-server/routes/cliproxy-stats-routes/config-routes.d.ts +16 -0
  462. package/dist/web-server/routes/cliproxy-stats-routes/config-routes.d.ts.map +1 -0
  463. package/dist/web-server/routes/cliproxy-stats-routes/config-routes.js +219 -0
  464. package/dist/web-server/routes/cliproxy-stats-routes/config-routes.js.map +1 -0
  465. package/dist/web-server/routes/cliproxy-stats-routes/error-log-routes.d.ts +12 -0
  466. package/dist/web-server/routes/cliproxy-stats-routes/error-log-routes.d.ts.map +1 -0
  467. package/dist/web-server/routes/cliproxy-stats-routes/error-log-routes.js +153 -0
  468. package/dist/web-server/routes/cliproxy-stats-routes/error-log-routes.js.map +1 -0
  469. package/dist/web-server/routes/cliproxy-stats-routes/quota-helpers.d.ts +19 -0
  470. package/dist/web-server/routes/cliproxy-stats-routes/quota-helpers.d.ts.map +1 -0
  471. package/dist/web-server/routes/cliproxy-stats-routes/quota-helpers.js +38 -0
  472. package/dist/web-server/routes/cliproxy-stats-routes/quota-helpers.js.map +1 -0
  473. package/dist/web-server/routes/cliproxy-stats-routes/quota-routes.d.ts +13 -0
  474. package/dist/web-server/routes/cliproxy-stats-routes/quota-routes.d.ts.map +1 -0
  475. package/dist/web-server/routes/cliproxy-stats-routes/quota-routes.js +195 -0
  476. package/dist/web-server/routes/cliproxy-stats-routes/quota-routes.js.map +1 -0
  477. package/dist/web-server/routes/cliproxy-stats-routes/restart-route.d.ts +17 -0
  478. package/dist/web-server/routes/cliproxy-stats-routes/restart-route.d.ts.map +1 -0
  479. package/dist/web-server/routes/cliproxy-stats-routes/restart-route.js +34 -0
  480. package/dist/web-server/routes/cliproxy-stats-routes/restart-route.js.map +1 -0
  481. package/dist/web-server/routes/cliproxy-stats-routes/router.d.ts +10 -0
  482. package/dist/web-server/routes/cliproxy-stats-routes/router.d.ts.map +1 -0
  483. package/dist/web-server/routes/cliproxy-stats-routes/router.js +245 -0
  484. package/dist/web-server/routes/cliproxy-stats-routes/router.js.map +1 -0
  485. package/dist/web-server/routes/cliproxy-stats-routes/shared.d.ts +35 -0
  486. package/dist/web-server/routes/cliproxy-stats-routes/shared.d.ts.map +1 -0
  487. package/dist/web-server/routes/cliproxy-stats-routes/shared.js +59 -0
  488. package/dist/web-server/routes/cliproxy-stats-routes/shared.js.map +1 -0
  489. package/dist/web-server/routes/cliproxy-stats-routes/version-helpers.d.ts +44 -0
  490. package/dist/web-server/routes/cliproxy-stats-routes/version-helpers.d.ts.map +1 -0
  491. package/dist/web-server/routes/cliproxy-stats-routes/version-helpers.js +66 -0
  492. package/dist/web-server/routes/cliproxy-stats-routes/version-helpers.js.map +1 -0
  493. package/dist/web-server/routes/cliproxy-stats-routes.d.ts +16 -57
  494. package/dist/web-server/routes/cliproxy-stats-routes.d.ts.map +1 -1
  495. package/dist/web-server/routes/cliproxy-stats-routes.js +25 -926
  496. package/dist/web-server/routes/cliproxy-stats-routes.js.map +1 -1
  497. package/dist/web-server/routes/cliproxy-sync-routes.d.ts.map +1 -1
  498. package/dist/web-server/routes/cliproxy-sync-routes.js +9 -2
  499. package/dist/web-server/routes/cliproxy-sync-routes.js.map +1 -1
  500. package/dist/web-server/routes/copilot-settings-routes.d.ts.map +1 -1
  501. package/dist/web-server/routes/copilot-settings-routes.js +2 -1
  502. package/dist/web-server/routes/copilot-settings-routes.js.map +1 -1
  503. package/dist/web-server/routes/image-analysis-routes.d.ts.map +1 -1
  504. package/dist/web-server/routes/image-analysis-routes.js +2 -1
  505. package/dist/web-server/routes/image-analysis-routes.js.map +1 -1
  506. package/dist/web-server/routes/persist-routes.d.ts.map +1 -1
  507. package/dist/web-server/routes/persist-routes.js +8 -1
  508. package/dist/web-server/routes/persist-routes.js.map +1 -1
  509. package/dist/web-server/routes/proxy-routes.d.ts.map +1 -1
  510. package/dist/web-server/routes/proxy-routes.js +33 -5
  511. package/dist/web-server/routes/proxy-routes.js.map +1 -1
  512. package/dist/web-server/routes/route-helpers.d.ts.map +1 -1
  513. package/dist/web-server/routes/route-helpers.js +10 -6
  514. package/dist/web-server/routes/route-helpers.js.map +1 -1
  515. package/dist/web-server/routes/settings-routes.d.ts.map +1 -1
  516. package/dist/web-server/routes/settings-routes.js +7 -6
  517. package/dist/web-server/routes/settings-routes.js.map +1 -1
  518. package/dist/web-server/usage/aggregator.d.ts.map +1 -1
  519. package/dist/web-server/usage/aggregator.js +8 -8
  520. package/dist/web-server/usage/aggregator.js.map +1 -1
  521. package/dist/web-server/usage/handlers.d.ts.map +1 -1
  522. package/dist/web-server/usage/handlers.js +1 -1
  523. package/dist/web-server/usage/handlers.js.map +1 -1
  524. package/package.json +1 -1
  525. package/scripts/ci-parity-gate.sh +31 -0
  526. package/scripts/generate-throw-error-baseline.js +103 -0
  527. package/scripts/hardening-inventory.js +62 -4
  528. package/scripts/maintainability-metrics.js +356 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quota-helpers.d.ts","sourceRoot":"","sources":["../../../../src/web-server/routes/cliproxy-stats-routes/quota-helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE;IAC7C,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAiBV"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ /**
3
+ * Quota caching helper. Determines whether a quota fetch result should be
4
+ * written to the shared in-memory cache.
5
+ *
6
+ * Public surface: `shouldCacheQuotaResult` is re-exported by the barrel.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.shouldCacheQuotaResult = void 0;
10
+ /**
11
+ * Cache only stable failures; skip transient network errors (timeouts, 429s, 5xx).
12
+ * Generic across all quota result types.
13
+ */
14
+ function shouldCacheQuotaResult(result) {
15
+ if (result.success)
16
+ return true;
17
+ if (result.needsReauth || result.isForbidden)
18
+ return true;
19
+ if (result.retryable === true)
20
+ return false;
21
+ if (result.retryable === false)
22
+ return true;
23
+ if (typeof result.httpStatus === 'number') {
24
+ if (result.httpStatus === 429 || result.httpStatus === 408 || result.httpStatus >= 500) {
25
+ return false;
26
+ }
27
+ if (result.httpStatus >= 400 && result.httpStatus < 500) {
28
+ return true;
29
+ }
30
+ }
31
+ const msg = (result.error || '').toLowerCase();
32
+ if (!msg)
33
+ return false;
34
+ const transientPatterns = ['timeout', 'rate limited', 'api error: 5', 'fetch failed'];
35
+ return !transientPatterns.some((p) => msg.includes(p));
36
+ }
37
+ exports.shouldCacheQuotaResult = shouldCacheQuotaResult;
38
+ //# sourceMappingURL=quota-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quota-helpers.js","sourceRoot":"","sources":["../../../../src/web-server/routes/cliproxy-stats-routes/quota-helpers.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,MAOtC;IACC,IAAI,MAAM,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAChC,IAAI,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,WAAW;QAAE,OAAO,IAAI,CAAC;IAC1D,IAAI,MAAM,CAAC,SAAS,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC5C,IAAI,MAAM,CAAC,SAAS,KAAK,KAAK;QAAE,OAAO,IAAI,CAAC;IAC5C,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;QAC1C,IAAI,MAAM,CAAC,UAAU,KAAK,GAAG,IAAI,MAAM,CAAC,UAAU,KAAK,GAAG,IAAI,MAAM,CAAC,UAAU,IAAI,GAAG,EAAE,CAAC;YACvF,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,MAAM,CAAC,UAAU,IAAI,GAAG,IAAI,MAAM,CAAC,UAAU,GAAG,GAAG,EAAE,CAAC;YACxD,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IAC/C,IAAI,CAAC,GAAG;QAAE,OAAO,KAAK,CAAC;IACvB,MAAM,iBAAiB,GAAG,CAAC,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC;IACtF,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AACzD,CAAC;AAxBD,wDAwBC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * CLIProxy account-quota routes: codex, claude, gemini, ghcp, and the generic
3
+ * `/:provider/:accountId` fallback.
4
+ *
5
+ * Specific routes MUST be registered before the generic one for Express
6
+ * routing to match correctly.
7
+ */
8
+ import { Router } from 'express';
9
+ /**
10
+ * Registers all `/quota/*` routes on the given router.
11
+ */
12
+ export declare function registerQuotaRoutes(router: Router): void;
13
+ //# sourceMappingURL=quota-routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quota-routes.d.ts","sourceRoot":"","sources":["../../../../src/web-server/routes/cliproxy-stats-routes/quota-routes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAqB,MAAM,SAAS,CAAC;AA6BpD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CA8LxD"}
@@ -0,0 +1,195 @@
1
+ "use strict";
2
+ /**
3
+ * CLIProxy account-quota routes: codex, claude, gemini, ghcp, and the generic
4
+ * `/:provider/:accountId` fallback.
5
+ *
6
+ * Specific routes MUST be registered before the generic one for Express
7
+ * routing to match correctly.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.registerQuotaRoutes = void 0;
11
+ const quota_fetcher_1 = require("../../../cliproxy/quota/quota-fetcher");
12
+ const quota_fetcher_codex_1 = require("../../../cliproxy/quota/quota-fetcher-codex");
13
+ const quota_fetcher_claude_1 = require("../../../cliproxy/quota/quota-fetcher-claude");
14
+ const quota_fetcher_gemini_cli_1 = require("../../../cliproxy/quota/quota-fetcher-gemini-cli");
15
+ const quota_fetcher_ghcp_1 = require("../../../cliproxy/quota/quota-fetcher-ghcp");
16
+ const quota_response_cache_1 = require("../../../cliproxy/quota/quota-response-cache");
17
+ const profile_detector_1 = require("../../../auth/profile-detector");
18
+ const shared_1 = require("./shared");
19
+ const quota_helpers_1 = require("./quota-helpers");
20
+ function replyRateLimited(res) {
21
+ res.status(429).json({ error: 'Too many quota requests', message: 'Retry after a short delay' });
22
+ }
23
+ function isInvalidAccountId(accountId) {
24
+ return (!accountId || accountId.includes('..') || accountId.includes('/') || accountId.includes('\\'));
25
+ }
26
+ /**
27
+ * Registers all `/quota/*` routes on the given router.
28
+ */
29
+ function registerQuotaRoutes(router) {
30
+ router.get('/quota/codex/:accountId', async (req, res) => {
31
+ const { accountId } = req.params;
32
+ if ((0, shared_1.isQuotaRouteRateLimited)(req, 'codex')) {
33
+ replyRateLimited(res);
34
+ return;
35
+ }
36
+ if (isInvalidAccountId(accountId)) {
37
+ res.status(400).json({ error: 'Invalid account ID' });
38
+ return;
39
+ }
40
+ try {
41
+ const cached = (0, quota_response_cache_1.getCachedQuota)('codex', accountId);
42
+ if (cached) {
43
+ res.json({ ...cached, cached: true });
44
+ return;
45
+ }
46
+ const result = await (0, quota_fetcher_codex_1.fetchCodexQuota)(accountId);
47
+ if ((0, quota_helpers_1.shouldCacheQuotaResult)(result)) {
48
+ (0, quota_response_cache_1.setCachedQuota)('codex', accountId, result);
49
+ }
50
+ res.json(result);
51
+ }
52
+ catch (error) {
53
+ shared_1.logger.error('stats.route.error', 'CLIProxy stats route failed to handle request', {
54
+ err: error instanceof Error
55
+ ? { name: error.name, message: error.message }
56
+ : { message: String(error) },
57
+ });
58
+ res.status(500).json({ error: 'Internal server error' });
59
+ }
60
+ });
61
+ router.get('/quota/claude/:accountId', async (req, res) => {
62
+ const { accountId } = req.params;
63
+ if ((0, shared_1.isQuotaRouteRateLimited)(req, 'claude')) {
64
+ replyRateLimited(res);
65
+ return;
66
+ }
67
+ if (isInvalidAccountId(accountId)) {
68
+ res.status(400).json({ error: 'Invalid account ID' });
69
+ return;
70
+ }
71
+ try {
72
+ const cached = (0, quota_response_cache_1.getCachedQuota)('claude', accountId);
73
+ if (cached) {
74
+ res.json({ ...cached, cached: true });
75
+ return;
76
+ }
77
+ const result = await (0, quota_fetcher_claude_1.fetchClaudeQuota)(accountId);
78
+ if ((0, quota_helpers_1.shouldCacheQuotaResult)(result)) {
79
+ (0, quota_response_cache_1.setCachedQuota)('claude', accountId, result);
80
+ }
81
+ res.json(result);
82
+ }
83
+ catch (error) {
84
+ shared_1.logger.error('stats.route.error', 'CLIProxy stats route failed to handle request', {
85
+ err: error instanceof Error
86
+ ? { name: error.name, message: error.message }
87
+ : { message: String(error) },
88
+ });
89
+ res.status(500).json({ error: 'Internal server error' });
90
+ }
91
+ });
92
+ router.get('/quota/gemini/:accountId', async (req, res) => {
93
+ const { accountId } = req.params;
94
+ if ((0, shared_1.isQuotaRouteRateLimited)(req, 'gemini')) {
95
+ replyRateLimited(res);
96
+ return;
97
+ }
98
+ if (isInvalidAccountId(accountId)) {
99
+ res.status(400).json({ error: 'Invalid account ID' });
100
+ return;
101
+ }
102
+ try {
103
+ const cached = (0, quota_response_cache_1.getCachedQuota)('gemini', accountId);
104
+ if (cached) {
105
+ res.json({ ...cached, cached: true });
106
+ return;
107
+ }
108
+ const result = await (0, quota_fetcher_gemini_cli_1.fetchGeminiCliQuota)(accountId);
109
+ if ((0, quota_helpers_1.shouldCacheQuotaResult)(result)) {
110
+ (0, quota_response_cache_1.setCachedQuota)('gemini', accountId, result);
111
+ }
112
+ res.json(result);
113
+ }
114
+ catch (error) {
115
+ shared_1.logger.error('stats.route.error', 'CLIProxy stats route failed to handle request', {
116
+ err: error instanceof Error
117
+ ? { name: error.name, message: error.message }
118
+ : { message: String(error) },
119
+ });
120
+ res.status(500).json({ error: 'Internal server error' });
121
+ }
122
+ });
123
+ router.get('/quota/ghcp/:accountId', async (req, res) => {
124
+ const { accountId } = req.params;
125
+ if ((0, shared_1.isQuotaRouteRateLimited)(req, 'ghcp')) {
126
+ replyRateLimited(res);
127
+ return;
128
+ }
129
+ if (isInvalidAccountId(accountId)) {
130
+ res.status(400).json({ error: 'Invalid account ID' });
131
+ return;
132
+ }
133
+ try {
134
+ const cached = (0, quota_response_cache_1.getCachedQuota)('ghcp', accountId);
135
+ if (cached) {
136
+ res.json({ ...cached, cached: true });
137
+ return;
138
+ }
139
+ const result = await (0, quota_fetcher_ghcp_1.fetchGhcpQuota)(accountId);
140
+ if ((0, quota_helpers_1.shouldCacheQuotaResult)(result)) {
141
+ (0, quota_response_cache_1.setCachedQuota)('ghcp', accountId, result);
142
+ }
143
+ res.json(result);
144
+ }
145
+ catch (error) {
146
+ shared_1.logger.error('stats.route.error', 'CLIProxy stats route failed to handle request', {
147
+ err: error instanceof Error
148
+ ? { name: error.name, message: error.message }
149
+ : { message: String(error) },
150
+ });
151
+ res.status(500).json({ error: 'Internal server error' });
152
+ }
153
+ });
154
+ router.get('/quota/:provider/:accountId', async (req, res) => {
155
+ const { provider, accountId } = req.params;
156
+ if ((0, shared_1.isQuotaRouteRateLimited)(req, provider)) {
157
+ replyRateLimited(res);
158
+ return;
159
+ }
160
+ const validProviders = [...profile_detector_1.CLIPROXY_PROFILES];
161
+ if (!validProviders.includes(provider)) {
162
+ res.status(400).json({
163
+ error: 'Invalid provider',
164
+ message: `Provider must be one of: ${validProviders.join(', ')}`,
165
+ });
166
+ return;
167
+ }
168
+ if (isInvalidAccountId(accountId)) {
169
+ res.status(400).json({ error: 'Invalid account ID' });
170
+ return;
171
+ }
172
+ try {
173
+ const cached = (0, quota_response_cache_1.getCachedQuota)(provider, accountId);
174
+ if (cached) {
175
+ res.json({ ...cached, cached: true });
176
+ return;
177
+ }
178
+ const result = await (0, quota_fetcher_1.fetchAccountQuota)(provider, accountId);
179
+ if (result.success) {
180
+ (0, quota_response_cache_1.setCachedQuota)(provider, accountId, result);
181
+ }
182
+ res.json(result);
183
+ }
184
+ catch (error) {
185
+ shared_1.logger.error('stats.route.error', 'CLIProxy stats route failed to handle request', {
186
+ err: error instanceof Error
187
+ ? { name: error.name, message: error.message }
188
+ : { message: String(error) },
189
+ });
190
+ res.status(500).json({ error: 'Internal server error' });
191
+ }
192
+ });
193
+ }
194
+ exports.registerQuotaRoutes = registerQuotaRoutes;
195
+ //# sourceMappingURL=quota-routes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quota-routes.js","sourceRoot":"","sources":["../../../../src/web-server/routes/cliproxy-stats-routes/quota-routes.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAGH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EAAE,MAAM,CAAC,CAAC;YAC9C,CAAC;YAED,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,eAAM,CAAC,KAAK,CAAC,mBAAmB,EAAE,+CAA+C,EAAE;gBACjF,GAAG,EACD,KAAK,YAAY,KAAK;oBACpB,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE;oBAC9C,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE;aACjC,CAAC,CAAC;YACH,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,uBAAuB,EAAE,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AA9LD,kDA8LC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * POST /api/cliproxy/restart route registration.
3
+ *
4
+ * Public surface: `registerCliproxyRestartRoute` is re-exported by the barrel.
5
+ */
6
+ import { Router } from 'express';
7
+ import { restartDashboardCliproxy } from '../../services/cliproxy-dashboard-restart-service';
8
+ type RestartDashboardCliproxyHandler = typeof restartDashboardCliproxy;
9
+ /**
10
+ * Registers POST `/restart` on the given router.
11
+ *
12
+ * Handler shape and logger.error('stats.route.error', ...) conversion are
13
+ * preserved verbatim from the pre-split implementation.
14
+ */
15
+ export declare function registerCliproxyRestartRoute(targetRouter: Router, restartHandler?: RestartDashboardCliproxyHandler): void;
16
+ export {};
17
+ //# sourceMappingURL=restart-route.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restart-route.d.ts","sourceRoot":"","sources":["../../../../src/web-server/routes/cliproxy-stats-routes/restart-route.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAqB,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mDAAmD,CAAC;AAG7F,KAAK,+BAA+B,GAAG,OAAO,wBAAwB,CAAC;AAEvE;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,YAAY,EAAE,MAAM,EACpB,cAAc,GAAE,+BAA0D,GACzE,IAAI,CAeN"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ /**
3
+ * POST /api/cliproxy/restart route registration.
4
+ *
5
+ * Public surface: `registerCliproxyRestartRoute` is re-exported by the barrel.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.registerCliproxyRestartRoute = void 0;
9
+ const cliproxy_dashboard_restart_service_1 = require("../../services/cliproxy-dashboard-restart-service");
10
+ const shared_1 = require("./shared");
11
+ /**
12
+ * Registers POST `/restart` on the given router.
13
+ *
14
+ * Handler shape and logger.error('stats.route.error', ...) conversion are
15
+ * preserved verbatim from the pre-split implementation.
16
+ */
17
+ function registerCliproxyRestartRoute(targetRouter, restartHandler = cliproxy_dashboard_restart_service_1.restartDashboardCliproxy) {
18
+ targetRouter.post('/restart', async (_req, res) => {
19
+ try {
20
+ const result = await restartHandler();
21
+ res.json(result);
22
+ }
23
+ catch (error) {
24
+ shared_1.logger.error('stats.route.error', 'CLIProxy stats route failed to handle request', {
25
+ err: error instanceof Error
26
+ ? { name: error.name, message: error.message }
27
+ : { message: String(error) },
28
+ });
29
+ res.status(500).json({ error: 'Internal server error' });
30
+ }
31
+ });
32
+ }
33
+ exports.registerCliproxyRestartRoute = registerCliproxyRestartRoute;
34
+ //# sourceMappingURL=restart-route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restart-route.js","sourceRoot":"","sources":["../../../../src/web-server/routes/cliproxy-stats-routes/restart-route.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAGH,0GAA6F;AAC7F,qCAAkC;AAIlC;;;;;GAKG;AACH,SAAgB,4BAA4B,CAC1C,YAAoB,EACpB,iBAAkD,6DAAwB;IAE1E,YAAY,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,IAAa,EAAE,GAAa,EAAiB,EAAE;QAClF,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,cAAc,EAAE,CAAC;YACtC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,eAAM,CAAC,KAAK,CAAC,mBAAmB,EAAE,+CAA+C,EAAE;gBACjF,GAAG,EACD,KAAK,YAAY,KAAK;oBACpB,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE;oBAC9C,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE;aACjC,CAAC,CAAC;YACH,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,uBAAuB,EAAE,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAlBD,oEAkBC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * CLIProxy stats router: stats, status, proxy lifecycle, models, versions, and
3
+ * install endpoints. Delegates quota, error-log, config/auth-files/model-update,
4
+ * and restart routes to focused submodules.
5
+ *
6
+ * Default export is the Express Router. Re-exported as the barrel default.
7
+ */
8
+ declare const router: import("express-serve-static-core").Router;
9
+ export default router;
10
+ //# sourceMappingURL=router.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../../src/web-server/routes/cliproxy-stats-routes/router.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAgCH,QAAA,MAAM,MAAM,4CAAW,CAAC;AA2PxB,eAAe,MAAM,CAAC"}
@@ -0,0 +1,245 @@
1
+ "use strict";
2
+ /**
3
+ * CLIProxy stats router: stats, status, proxy lifecycle, models, versions, and
4
+ * install endpoints. Delegates quota, error-log, config/auth-files/model-update,
5
+ * and restart routes to focused submodules.
6
+ *
7
+ * Default export is the Express Router. Re-exported as the barrel default.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ const express_1 = require("express");
11
+ const stats_fetcher_1 = require("../../../cliproxy/services/stats-fetcher");
12
+ const session_tracker_1 = require("../../../cliproxy/session-tracker");
13
+ const service_manager_1 = require("../../../cliproxy/service-manager");
14
+ const binary_manager_1 = require("../../../cliproxy/binary-manager");
15
+ const version_checker_1 = require("../../../cliproxy/binary/version-checker");
16
+ const platform_detector_1 = require("../../../cliproxy/binary/platform-detector");
17
+ const port_manager_1 = require("../../../cliproxy/config/port-manager");
18
+ const cliproxy_dashboard_install_service_1 = require("../../services/cliproxy-dashboard-install-service");
19
+ const auth_middleware_1 = require("../../middleware/auth-middleware");
20
+ const shared_1 = require("./shared");
21
+ const version_helpers_1 = require("./version-helpers");
22
+ const quota_routes_1 = require("./quota-routes");
23
+ const error_log_routes_1 = require("./error-log-routes");
24
+ const config_routes_1 = require("./config-routes");
25
+ const restart_route_1 = require("./restart-route");
26
+ const router = (0, express_1.Router)();
27
+ router.use((req, res, next) => {
28
+ if ((0, auth_middleware_1.requireLocalAccessWhenAuthDisabled)(req, res, 'CLIProxy management endpoints require localhost access when dashboard auth is disabled.')) {
29
+ next();
30
+ }
31
+ });
32
+ /**
33
+ * Shared handler for /stats and /usage endpoints.
34
+ */
35
+ const handleStatsRequest = async (_req, res) => {
36
+ try {
37
+ const running = await (0, stats_fetcher_1.isCliproxyRunning)();
38
+ if (!running) {
39
+ res.status(503).json({
40
+ error: 'CLIProxy Plus not running',
41
+ message: 'Start a CLIProxy session (gemini, codex, claude, agy, ghcp) to collect stats',
42
+ });
43
+ return;
44
+ }
45
+ const stats = await (0, stats_fetcher_1.fetchCliproxyStats)();
46
+ if (!stats) {
47
+ res.status(503).json({
48
+ error: 'Stats unavailable',
49
+ message: 'CLIProxy Plus is running but stats endpoint not responding',
50
+ });
51
+ return;
52
+ }
53
+ res.json(stats);
54
+ }
55
+ catch (error) {
56
+ shared_1.logger.error('stats.route.error', 'CLIProxy stats route failed to handle request', {
57
+ err: error instanceof Error
58
+ ? { name: error.name, message: error.message }
59
+ : { message: String(error) },
60
+ });
61
+ res.status(500).json({ error: 'Internal server error' });
62
+ }
63
+ };
64
+ router.get('/stats', handleStatsRequest);
65
+ router.get('/usage', handleStatsRequest);
66
+ router.get('/status', async (_req, res) => {
67
+ try {
68
+ const running = await (0, stats_fetcher_1.isCliproxyRunning)((0, port_manager_1.resolveLifecyclePort)());
69
+ res.json({ running });
70
+ }
71
+ catch (error) {
72
+ shared_1.logger.error('stats.route.error', 'CLIProxy stats route failed to handle request', {
73
+ err: error instanceof Error
74
+ ? { name: error.name, message: error.message }
75
+ : { message: String(error) },
76
+ });
77
+ res.status(500).json({ error: 'Internal server error' });
78
+ }
79
+ });
80
+ router.get('/proxy-status', async (_req, res) => {
81
+ try {
82
+ const port = (0, port_manager_1.resolveLifecyclePort)();
83
+ const sessionStatus = (0, session_tracker_1.getProxyStatus)(port);
84
+ if (sessionStatus.running) {
85
+ res.json(sessionStatus);
86
+ return;
87
+ }
88
+ const actuallyRunning = await (0, stats_fetcher_1.isCliproxyRunning)(port);
89
+ if (actuallyRunning) {
90
+ res.json({ running: true, port, sessionCount: 0 });
91
+ }
92
+ else {
93
+ res.json(sessionStatus);
94
+ }
95
+ }
96
+ catch (error) {
97
+ shared_1.logger.error('stats.route.error', 'CLIProxy stats route failed to handle request', {
98
+ err: error instanceof Error
99
+ ? { name: error.name, message: error.message }
100
+ : { message: String(error) },
101
+ });
102
+ res.status(500).json({ error: 'Internal server error' });
103
+ }
104
+ });
105
+ router.post('/proxy-start', async (_req, res) => {
106
+ try {
107
+ const result = await (0, service_manager_1.ensureCliproxyService)((0, port_manager_1.resolveLifecyclePort)());
108
+ res.json(result);
109
+ }
110
+ catch (error) {
111
+ shared_1.logger.error('stats.route.error', 'CLIProxy stats route failed to handle request', {
112
+ err: error instanceof Error
113
+ ? { name: error.name, message: error.message }
114
+ : { message: String(error) },
115
+ });
116
+ res.status(500).json({ error: 'Internal server error' });
117
+ }
118
+ });
119
+ router.post('/proxy-stop', async (_req, res) => {
120
+ try {
121
+ const result = await (0, session_tracker_1.stopProxy)((0, port_manager_1.resolveLifecyclePort)());
122
+ res.json(result);
123
+ }
124
+ catch (error) {
125
+ shared_1.logger.error('stats.route.error', 'CLIProxy stats route failed to handle request', {
126
+ err: error instanceof Error
127
+ ? { name: error.name, message: error.message }
128
+ : { message: String(error) },
129
+ });
130
+ res.status(500).json({ error: 'Internal server error' });
131
+ }
132
+ });
133
+ router.get('/update-check', async (_req, res) => {
134
+ try {
135
+ const backend = (0, binary_manager_1.getStoredConfiguredBackend)();
136
+ const result = await (0, version_helpers_1.resolveCliproxyUpdateCheckPayload)(backend);
137
+ res.json(result);
138
+ }
139
+ catch (error) {
140
+ shared_1.logger.error('stats.route.error', 'CLIProxy stats route failed to handle request', {
141
+ err: error instanceof Error
142
+ ? { name: error.name, message: error.message }
143
+ : { message: String(error) },
144
+ });
145
+ res.status(500).json({ error: 'Internal server error' });
146
+ }
147
+ });
148
+ router.get('/models', async (_req, res) => {
149
+ try {
150
+ const running = await (0, stats_fetcher_1.isCliproxyRunning)();
151
+ if (!running) {
152
+ res.status(503).json({
153
+ error: 'CLIProxy Plus not running',
154
+ message: 'Start a CLIProxy session (gemini, codex, claude, agy) to fetch available models',
155
+ });
156
+ return;
157
+ }
158
+ const modelsResponse = await (0, stats_fetcher_1.fetchCliproxyModels)();
159
+ if (!modelsResponse) {
160
+ res.status(503).json({
161
+ error: 'Models unavailable',
162
+ message: 'CLIProxy Plus is running but /v1/models endpoint not responding',
163
+ });
164
+ return;
165
+ }
166
+ res.json(modelsResponse);
167
+ }
168
+ catch (error) {
169
+ shared_1.logger.error('stats.route.error', 'CLIProxy stats route failed to handle request', {
170
+ err: error instanceof Error
171
+ ? { name: error.name, message: error.message }
172
+ : { message: String(error) },
173
+ });
174
+ res.status(500).json({ error: 'Internal server error' });
175
+ }
176
+ });
177
+ // Delegated route groups. Registration order is preserved from the pre-split
178
+ // god file: error-logs, config/auth-files/model-update, quota, versions,
179
+ // install, restart.
180
+ (0, error_log_routes_1.registerErrorLogRoutes)(router);
181
+ (0, config_routes_1.registerConfigRoutes)(router);
182
+ (0, quota_routes_1.registerQuotaRoutes)(router);
183
+ router.get('/versions', async (_req, res) => {
184
+ try {
185
+ const backend = (0, binary_manager_1.getStoredConfiguredBackend)();
186
+ res.json(await (0, version_helpers_1.resolveCliproxyVersionsPayload)(backend));
187
+ }
188
+ catch (error) {
189
+ shared_1.logger.error('stats.route.error', 'CLIProxy stats route failed to handle request', {
190
+ err: error instanceof Error
191
+ ? { name: error.name, message: error.message }
192
+ : { message: String(error) },
193
+ });
194
+ res.status(500).json({ error: 'Internal server error' });
195
+ }
196
+ });
197
+ router.post('/install', async (req, res) => {
198
+ try {
199
+ const { version, force } = req.body;
200
+ if (!version || typeof version !== 'string') {
201
+ res.status(400).json({ error: 'Missing required field: version' });
202
+ return;
203
+ }
204
+ if (!/^\d+\.\d+\.\d+(-\d+)?$/.test(version)) {
205
+ res.status(400).json({ error: 'Invalid version format. Expected: X.Y.Z or X.Y.Z-N' });
206
+ return;
207
+ }
208
+ const isFaulty = (0, version_checker_1.isVersionFaulty)(version);
209
+ const isExperimental = (0, version_checker_1.isNewerVersion)(version, platform_detector_1.CLIPROXY_MAX_STABLE_VERSION);
210
+ if (isFaulty && !force) {
211
+ res.json({
212
+ success: false,
213
+ isFaulty,
214
+ isExperimental,
215
+ requiresConfirmation: true,
216
+ message: `Version ${version} has known bugs (v${platform_detector_1.CLIPROXY_FAULTY_RANGE.min.replace(/-\d+$/, '')}-${platform_detector_1.CLIPROXY_FAULTY_RANGE.max.replace(/-\d+$/, '')}). Set force=true to proceed.`,
217
+ });
218
+ return;
219
+ }
220
+ if (isExperimental && !force) {
221
+ res.json({
222
+ success: false,
223
+ isFaulty,
224
+ isExperimental,
225
+ requiresConfirmation: true,
226
+ message: `Version ${version} is experimental (above stable ${platform_detector_1.CLIPROXY_MAX_STABLE_VERSION.replace(/-\d+$/, '')}). Set force=true to proceed.`,
227
+ });
228
+ return;
229
+ }
230
+ const backend = (0, binary_manager_1.getStoredConfiguredBackend)();
231
+ const installResult = await (0, cliproxy_dashboard_install_service_1.installDashboardCliproxyVersion)(version, backend);
232
+ res.json({ version, isFaulty, isExperimental, ...installResult });
233
+ }
234
+ catch (error) {
235
+ shared_1.logger.error('stats.route.error', 'CLIProxy stats route failed to handle request', {
236
+ err: error instanceof Error
237
+ ? { name: error.name, message: error.message }
238
+ : { message: String(error) },
239
+ });
240
+ res.status(500).json({ error: 'Internal server error' });
241
+ }
242
+ });
243
+ (0, restart_route_1.registerCliproxyRestartRoute)(router);
244
+ exports.default = router;
245
+ //# sourceMappingURL=router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.js","sourceRoot":"","sources":["../../../../src/web-server/routes/cliproxy-stats-routes/router.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAEH,qCAAoD;AACpD,4EAIkD;AAClD,uEAG2C;AAC3C,uEAA0E;AAC1E,qEAA8E;AAC9E,8EAA2F;AAC3F,kFAGoD;AACpD,wEAA6E;AAC7E,0GAAoG;AACpG,sEAAsF;AACtF,qCAAkC;AAClC,uDAG2B;AAC3B,iDAAqD;AACrD,yDAA4D;AAC5D,mDAAuD;AACvD,mDAA+D;AAE/D,MAAM,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;AAExB,MAAM,CAAC,GAAG,CAAC,CAAC,GAAY,EAAE,GAAa,EAAE,IAAI,EAAE,EAAE;IAC/C,IACE,IAAA,oDAAkC,EAChC,GAAG,EACH,GAAG,EACH,yFAAyF,CAC1F,EACD,CAAC;QACD,IAAI,EAAE,CAAC;IACT,CAAC;AACH,CAAC,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,kBAAkB,GAAG,KAAK,EAAE,IAAa,EAAE,GAAa,EAAiB,EAAE;IAC/E,IAAI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IACpE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,eAAM,CAAC,KAAK,CAAC,mBAAmB,EAAE,+CAA+C,EAAE;YACjF,GAAG,EACD,KAAK,YAAY,KAAK;gBACpB,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE;gBAC9C,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE;SACjC,CAAC,CAAC;QACH,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,uBAAuB,EAAE,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,IAAA,4CAA4B,EAAC,MAAM,CAAC,CAAC;AAErC,kBAAe,MAAM,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Shared internals for cliproxy-stats-routes: logger and rate-limit helpers.
3
+ *
4
+ * These are NOT part of the public barrel surface; they exist so the sibling
5
+ * submodules (quota helpers, version helpers, route handlers) can share the
6
+ * same logger instance and rate-limit state without re-declaring them.
7
+ */
8
+ import type { Request } from 'express';
9
+ /**
10
+ * Shared logger for every cliproxy-stats submodule. Preserves the
11
+ * `web-server:routes:cliproxy-stats` channel used by P3 error conversions
12
+ * (`logger.error('stats.route.error', ...)`).
13
+ */
14
+ export declare const logger: import("../../../services/logging").Logger;
15
+ export declare const QUOTA_RATE_LIMIT_WINDOW_MS = 60000;
16
+ export declare const QUOTA_RATE_LIMIT_MAX_REQUESTS = 120;
17
+ export interface QuotaRateLimitEntry {
18
+ windowStart: number;
19
+ count: number;
20
+ }
21
+ /**
22
+ * In-memory rate limit state. Shared across all quota route handlers so that
23
+ * the same IP+provider key is throttled regardless of which handler runs.
24
+ */
25
+ export declare const quotaRateLimits: Map<string, QuotaRateLimitEntry>;
26
+ /**
27
+ * Build the rate-limit key for a request + provider pair.
28
+ */
29
+ export declare function buildQuotaRateLimitKey(req: Request, provider: string): string;
30
+ /**
31
+ * Returns true when the caller should be rejected with 429.
32
+ * Evicts stale entries to prevent unbounded memory growth.
33
+ */
34
+ export declare function isQuotaRouteRateLimited(req: Request, provider: string): boolean;
35
+ //# sourceMappingURL=shared.d.ts.map