@kaitranntt/ccs 8.4.0-dev.9 → 8.5.0-dev.1

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 (650) hide show
  1. package/README.md +4 -1
  2. package/config/base-claude.settings.json +1 -1
  3. package/config/base-glm.settings.json +4 -4
  4. package/config/base-glmt.settings.json +4 -4
  5. package/config/base-km.settings.json +4 -4
  6. package/config/base-mm.settings.json +4 -4
  7. package/dist/api/services/cliproxy-profile-bridge.d.ts.map +1 -1
  8. package/dist/api/services/cliproxy-profile-bridge.js +20 -9
  9. package/dist/api/services/cliproxy-profile-bridge.js.map +1 -1
  10. package/dist/api/services/profile-lifecycle-validation.d.ts.map +1 -1
  11. package/dist/api/services/profile-lifecycle-validation.js +2 -0
  12. package/dist/api/services/profile-lifecycle-validation.js.map +1 -1
  13. package/dist/auth/commands/backup-command.d.ts.map +1 -1
  14. package/dist/auth/commands/backup-command.js +0 -1
  15. package/dist/auth/commands/backup-command.js.map +1 -1
  16. package/dist/auth/commands/create-command.d.ts.map +1 -1
  17. package/dist/auth/commands/create-command.js +4 -14
  18. package/dist/auth/commands/create-command.js.map +1 -1
  19. package/dist/auth/commands/default-command.d.ts.map +1 -1
  20. package/dist/auth/commands/default-command.js +0 -1
  21. package/dist/auth/commands/default-command.js.map +1 -1
  22. package/dist/auth/commands/index.d.ts +2 -1
  23. package/dist/auth/commands/index.d.ts.map +1 -1
  24. package/dist/auth/commands/index.js +0 -1
  25. package/dist/auth/commands/index.js.map +1 -1
  26. package/dist/auth/commands/remove-command.d.ts.map +1 -1
  27. package/dist/auth/commands/remove-command.js +0 -2
  28. package/dist/auth/commands/remove-command.js.map +1 -1
  29. package/dist/auth/commands/resources-command.d.ts.map +1 -1
  30. package/dist/auth/commands/resources-command.js +0 -1
  31. package/dist/auth/commands/resources-command.js.map +1 -1
  32. package/dist/auth/commands/show-command.d.ts.map +1 -1
  33. package/dist/auth/commands/show-command.js +0 -1
  34. package/dist/auth/commands/show-command.js.map +1 -1
  35. package/dist/auth/commands/types.d.ts.map +1 -1
  36. package/dist/auth/commands/types.js +0 -1
  37. package/dist/auth/commands/types.js.map +1 -1
  38. package/dist/auth/profile-registry.d.ts +3 -1
  39. package/dist/auth/profile-registry.d.ts.map +1 -1
  40. package/dist/auth/profile-registry.js +21 -15
  41. package/dist/auth/profile-registry.js.map +1 -1
  42. package/dist/ccs.js +27 -21
  43. package/dist/ccs.js.map +1 -1
  44. package/dist/cliproxy/accounts/account-safety.d.ts.map +1 -1
  45. package/dist/cliproxy/accounts/account-safety.js +56 -56
  46. package/dist/cliproxy/accounts/account-safety.js.map +1 -1
  47. package/dist/cliproxy/auth/antigravity-responsibility.d.ts.map +1 -1
  48. package/dist/cliproxy/auth/antigravity-responsibility.js +15 -15
  49. package/dist/cliproxy/auth/antigravity-responsibility.js.map +1 -1
  50. package/dist/cliproxy/auth/auth-token-manager.d.ts.map +1 -1
  51. package/dist/cliproxy/auth/auth-token-manager.js +2 -1
  52. package/dist/cliproxy/auth/auth-token-manager.js.map +1 -1
  53. package/dist/cliproxy/auth/auth-types.d.ts.map +1 -1
  54. package/dist/cliproxy/auth/auth-types.js +3 -2
  55. package/dist/cliproxy/auth/auth-types.js.map +1 -1
  56. package/dist/cliproxy/auth/oauth-handler.d.ts.map +1 -1
  57. package/dist/cliproxy/auth/oauth-handler.js +16 -5
  58. package/dist/cliproxy/auth/oauth-handler.js.map +1 -1
  59. package/dist/cliproxy/auth/provider-refreshers/index.d.ts +2 -1
  60. package/dist/cliproxy/auth/provider-refreshers/index.d.ts.map +1 -1
  61. package/dist/cliproxy/auth/provider-refreshers/index.js +4 -2
  62. package/dist/cliproxy/auth/provider-refreshers/index.js.map +1 -1
  63. package/dist/cliproxy/auth/token-manager.d.ts +2 -1
  64. package/dist/cliproxy/auth/token-manager.d.ts.map +1 -1
  65. package/dist/cliproxy/auth/token-manager.js +2 -1
  66. package/dist/cliproxy/auth/token-manager.js.map +1 -1
  67. package/dist/cliproxy/binary/lifecycle.d.ts.map +1 -1
  68. package/dist/cliproxy/binary/lifecycle.js +3 -2
  69. package/dist/cliproxy/binary/lifecycle.js.map +1 -1
  70. package/dist/cliproxy/config/env-builder.d.ts +19 -2
  71. package/dist/cliproxy/config/env-builder.d.ts.map +1 -1
  72. package/dist/cliproxy/config/env-builder.js +40 -5
  73. package/dist/cliproxy/config/env-builder.js.map +1 -1
  74. package/dist/cliproxy/config/model-config.d.ts.map +1 -1
  75. package/dist/cliproxy/config/model-config.js +32 -32
  76. package/dist/cliproxy/config/model-config.js.map +1 -1
  77. package/dist/cliproxy/executor/arg-parser.d.ts.map +1 -1
  78. package/dist/cliproxy/executor/arg-parser.js +26 -26
  79. package/dist/cliproxy/executor/arg-parser.js.map +1 -1
  80. package/dist/cliproxy/executor/auth-coordinator.d.ts.map +1 -1
  81. package/dist/cliproxy/executor/auth-coordinator.js +15 -14
  82. package/dist/cliproxy/executor/auth-coordinator.js.map +1 -1
  83. package/dist/cliproxy/executor/index.d.ts.map +1 -1
  84. package/dist/cliproxy/executor/index.js +27 -17
  85. package/dist/cliproxy/executor/index.js.map +1 -1
  86. package/dist/cliproxy/executor/lifecycle-manager.d.ts.map +1 -1
  87. package/dist/cliproxy/executor/lifecycle-manager.js +18 -16
  88. package/dist/cliproxy/executor/lifecycle-manager.js.map +1 -1
  89. package/dist/cliproxy/executor/model-warnings.d.ts.map +1 -1
  90. package/dist/cliproxy/executor/model-warnings.js +24 -13
  91. package/dist/cliproxy/executor/model-warnings.js.map +1 -1
  92. package/dist/cliproxy/executor/retry-handler.d.ts.map +1 -1
  93. package/dist/cliproxy/executor/retry-handler.js +13 -11
  94. package/dist/cliproxy/executor/retry-handler.js.map +1 -1
  95. package/dist/cliproxy/executor/session-bridge.d.ts.map +1 -1
  96. package/dist/cliproxy/executor/session-bridge.js +18 -10
  97. package/dist/cliproxy/executor/session-bridge.js.map +1 -1
  98. package/dist/cliproxy/management/remote-token-uploader.d.ts.map +1 -1
  99. package/dist/cliproxy/management/remote-token-uploader.js +11 -11
  100. package/dist/cliproxy/management/remote-token-uploader.js.map +1 -1
  101. package/dist/cliproxy/provider-capabilities.d.ts +6 -0
  102. package/dist/cliproxy/provider-capabilities.d.ts.map +1 -1
  103. package/dist/cliproxy/provider-capabilities.js +28 -3
  104. package/dist/cliproxy/provider-capabilities.js.map +1 -1
  105. package/dist/cliproxy/proxy/https-tunnel-proxy.d.ts +5 -1
  106. package/dist/cliproxy/proxy/https-tunnel-proxy.d.ts.map +1 -1
  107. package/dist/cliproxy/proxy/https-tunnel-proxy.js +22 -10
  108. package/dist/cliproxy/proxy/https-tunnel-proxy.js.map +1 -1
  109. package/dist/cliproxy/proxy/tool-sanitization-proxy.d.ts +0 -12
  110. package/dist/cliproxy/proxy/tool-sanitization-proxy.d.ts.map +1 -1
  111. package/dist/cliproxy/proxy/tool-sanitization-proxy.js +42 -72
  112. package/dist/cliproxy/proxy/tool-sanitization-proxy.js.map +1 -1
  113. package/dist/cliproxy/quota/quota-fetcher/account-quota-fetcher.d.ts +21 -0
  114. package/dist/cliproxy/quota/quota-fetcher/account-quota-fetcher.d.ts.map +1 -0
  115. package/dist/cliproxy/quota/quota-fetcher/account-quota-fetcher.js +154 -0
  116. package/dist/cliproxy/quota/quota-fetcher/account-quota-fetcher.js.map +1 -0
  117. package/dist/cliproxy/quota/quota-fetcher/all-accounts-fetcher.d.ts +35 -0
  118. package/dist/cliproxy/quota/quota-fetcher/all-accounts-fetcher.d.ts.map +1 -0
  119. package/dist/cliproxy/quota/quota-fetcher/all-accounts-fetcher.js +98 -0
  120. package/dist/cliproxy/quota/quota-fetcher/all-accounts-fetcher.js.map +1 -0
  121. package/dist/cliproxy/quota/quota-fetcher/auth-file-reader.d.ts +22 -0
  122. package/dist/cliproxy/quota/quota-fetcher/auth-file-reader.d.ts.map +1 -0
  123. package/dist/cliproxy/quota/quota-fetcher/auth-file-reader.js +111 -0
  124. package/dist/cliproxy/quota/quota-fetcher/auth-file-reader.js.map +1 -0
  125. package/dist/cliproxy/quota/quota-fetcher/available-models-fetcher.d.ts +17 -0
  126. package/dist/cliproxy/quota/quota-fetcher/available-models-fetcher.d.ts.map +1 -0
  127. package/dist/cliproxy/quota/quota-fetcher/available-models-fetcher.js +85 -0
  128. package/dist/cliproxy/quota/quota-fetcher/available-models-fetcher.js.map +1 -0
  129. package/dist/cliproxy/quota/quota-fetcher/constants.d.ts +25 -0
  130. package/dist/cliproxy/quota/quota-fetcher/constants.d.ts.map +1 -0
  131. package/dist/cliproxy/quota/quota-fetcher/constants.js +31 -0
  132. package/dist/cliproxy/quota/quota-fetcher/constants.js.map +1 -0
  133. package/dist/cliproxy/quota/quota-fetcher/http-client.d.ts +29 -0
  134. package/dist/cliproxy/quota/quota-fetcher/http-client.d.ts.map +1 -0
  135. package/dist/cliproxy/quota/quota-fetcher/http-client.js +199 -0
  136. package/dist/cliproxy/quota/quota-fetcher/http-client.js.map +1 -0
  137. package/dist/cliproxy/quota/quota-fetcher/project-lookup.d.ts +16 -0
  138. package/dist/cliproxy/quota/quota-fetcher/project-lookup.d.ts.map +1 -0
  139. package/dist/cliproxy/quota/quota-fetcher/project-lookup.js +89 -0
  140. package/dist/cliproxy/quota/quota-fetcher/project-lookup.js.map +1 -0
  141. package/dist/cliproxy/quota/quota-fetcher/status-classifier.d.ts +29 -0
  142. package/dist/cliproxy/quota/quota-fetcher/status-classifier.d.ts.map +1 -0
  143. package/dist/cliproxy/quota/quota-fetcher/status-classifier.js +168 -0
  144. package/dist/cliproxy/quota/quota-fetcher/status-classifier.js.map +1 -0
  145. package/dist/cliproxy/quota/quota-fetcher/types.d.ts +165 -0
  146. package/dist/cliproxy/quota/quota-fetcher/types.d.ts.map +1 -0
  147. package/dist/cliproxy/quota/quota-fetcher/types.js +9 -0
  148. package/dist/cliproxy/quota/quota-fetcher/types.js.map +1 -0
  149. package/dist/cliproxy/quota/quota-fetcher-claude.d.ts.map +1 -1
  150. package/dist/cliproxy/quota/quota-fetcher-claude.js +14 -3
  151. package/dist/cliproxy/quota/quota-fetcher-claude.js.map +1 -1
  152. package/dist/cliproxy/quota/quota-fetcher-codex.d.ts.map +1 -1
  153. package/dist/cliproxy/quota/quota-fetcher-codex.js +36 -9
  154. package/dist/cliproxy/quota/quota-fetcher-codex.js.map +1 -1
  155. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/auth-file-discovery.d.ts +26 -0
  156. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/auth-file-discovery.d.ts.map +1 -0
  157. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/auth-file-discovery.js +132 -0
  158. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/auth-file-discovery.js.map +1 -0
  159. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/bucket-building.d.ts +23 -0
  160. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/bucket-building.d.ts.map +1 -0
  161. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/bucket-building.js +54 -0
  162. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/bucket-building.js.map +1 -0
  163. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/constants.d.ts +26 -0
  164. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/constants.d.ts.map +1 -0
  165. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/constants.js +29 -0
  166. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/constants.js.map +1 -0
  167. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/error-parsing.d.ts +61 -0
  168. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/error-parsing.d.ts.map +1 -0
  169. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/error-parsing.js +259 -0
  170. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/error-parsing.js.map +1 -0
  171. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/index.d.ts +20 -0
  172. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/index.d.ts.map +1 -0
  173. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/index.js +38 -0
  174. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/index.js.map +1 -0
  175. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/managed-request.d.ts +82 -0
  176. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/managed-request.d.ts.map +1 -0
  177. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/managed-request.js +263 -0
  178. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/managed-request.js.map +1 -0
  179. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/quota-fetcher.d.ts +46 -0
  180. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/quota-fetcher.d.ts.map +1 -0
  181. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/quota-fetcher.js +188 -0
  182. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/quota-fetcher.js.map +1 -0
  183. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/shared-utils.d.ts +35 -0
  184. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/shared-utils.d.ts.map +1 -0
  185. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/shared-utils.js +65 -0
  186. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/shared-utils.js.map +1 -0
  187. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/supplementary-metadata.d.ts +37 -0
  188. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/supplementary-metadata.d.ts.map +1 -0
  189. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/supplementary-metadata.js +117 -0
  190. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/supplementary-metadata.js.map +1 -0
  191. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/token-parsing.d.ts +31 -0
  192. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/token-parsing.d.ts.map +1 -0
  193. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/token-parsing.js +77 -0
  194. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/token-parsing.js.map +1 -0
  195. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/types.d.ts +114 -0
  196. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/types.d.ts.map +1 -0
  197. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/types.js +10 -0
  198. package/dist/cliproxy/quota/quota-fetcher-gemini-cli/types.js.map +1 -0
  199. package/dist/cliproxy/quota/quota-fetcher-gemini-cli.d.ts +13 -58
  200. package/dist/cliproxy/quota/quota-fetcher-gemini-cli.d.ts.map +1 -1
  201. package/dist/cliproxy/quota/quota-fetcher-gemini-cli.js +20 -819
  202. package/dist/cliproxy/quota/quota-fetcher-gemini-cli.js.map +1 -1
  203. package/dist/cliproxy/quota/quota-fetcher-ghcp.d.ts.map +1 -1
  204. package/dist/cliproxy/quota/quota-fetcher-ghcp.js +19 -4
  205. package/dist/cliproxy/quota/quota-fetcher-ghcp.js.map +1 -1
  206. package/dist/cliproxy/quota/quota-fetcher.d.ts +12 -108
  207. package/dist/cliproxy/quota/quota-fetcher.d.ts.map +1 -1
  208. package/dist/cliproxy/quota/quota-fetcher.js +23 -766
  209. package/dist/cliproxy/quota/quota-fetcher.js.map +1 -1
  210. package/dist/cliproxy/routing/routing-strategy.d.ts.map +1 -1
  211. package/dist/cliproxy/routing/routing-strategy.js +11 -3
  212. package/dist/cliproxy/routing/routing-strategy.js.map +1 -1
  213. package/dist/commands/api-command/create-command.d.ts.map +1 -1
  214. package/dist/commands/api-command/create-command.js +17 -8
  215. package/dist/commands/api-command/create-command.js.map +1 -1
  216. package/dist/commands/bar/help-subcommand.d.ts.map +1 -1
  217. package/dist/commands/bar/help-subcommand.js +1 -0
  218. package/dist/commands/bar/help-subcommand.js.map +1 -1
  219. package/dist/commands/bar/index.d.ts.map +1 -1
  220. package/dist/commands/bar/index.js +1 -0
  221. package/dist/commands/bar/index.js.map +1 -1
  222. package/dist/commands/cliproxy/help-subcommand.js +5 -5
  223. package/dist/commands/cliproxy/help-subcommand.js.map +1 -1
  224. package/dist/commands/cliproxy/index.d.ts.map +1 -1
  225. package/dist/commands/cliproxy/index.js +7 -2
  226. package/dist/commands/cliproxy/index.js.map +1 -1
  227. package/dist/commands/cliproxy/pool-subcommand.d.ts.map +1 -1
  228. package/dist/commands/cliproxy/pool-subcommand.js +4 -2
  229. package/dist/commands/cliproxy/pool-subcommand.js.map +1 -1
  230. package/dist/commands/cliproxy/proxy-lifecycle-subcommand.d.ts +1 -1
  231. package/dist/commands/cliproxy/proxy-lifecycle-subcommand.d.ts.map +1 -1
  232. package/dist/commands/cliproxy/proxy-lifecycle-subcommand.js +13 -1
  233. package/dist/commands/cliproxy/proxy-lifecycle-subcommand.js.map +1 -1
  234. package/dist/commands/cliproxy/quota-subcommand/claude-window-helpers.d.ts +26 -0
  235. package/dist/commands/cliproxy/quota-subcommand/claude-window-helpers.d.ts.map +1 -0
  236. package/dist/commands/cliproxy/quota-subcommand/claude-window-helpers.js +82 -0
  237. package/dist/commands/cliproxy/quota-subcommand/claude-window-helpers.js.map +1 -0
  238. package/dist/commands/cliproxy/quota-subcommand/codex-window-helpers.d.ts +41 -0
  239. package/dist/commands/cliproxy/quota-subcommand/codex-window-helpers.d.ts.map +1 -0
  240. package/dist/commands/cliproxy/quota-subcommand/codex-window-helpers.js +202 -0
  241. package/dist/commands/cliproxy/quota-subcommand/codex-window-helpers.js.map +1 -0
  242. package/dist/commands/cliproxy/quota-subcommand/format-helpers.d.ts +32 -0
  243. package/dist/commands/cliproxy/quota-subcommand/format-helpers.d.ts.map +1 -0
  244. package/dist/commands/cliproxy/quota-subcommand/format-helpers.js +90 -0
  245. package/dist/commands/cliproxy/quota-subcommand/format-helpers.js.map +1 -0
  246. package/dist/commands/cliproxy/quota-subcommand/handlers.d.ts +25 -0
  247. package/dist/commands/cliproxy/quota-subcommand/handlers.d.ts.map +1 -0
  248. package/dist/commands/cliproxy/quota-subcommand/handlers.js +245 -0
  249. package/dist/commands/cliproxy/quota-subcommand/handlers.js.map +1 -0
  250. package/dist/commands/cliproxy/quota-subcommand/profile-args.d.ts +10 -0
  251. package/dist/commands/cliproxy/quota-subcommand/profile-args.d.ts.map +1 -0
  252. package/dist/commands/cliproxy/quota-subcommand/profile-args.js +37 -0
  253. package/dist/commands/cliproxy/quota-subcommand/profile-args.js.map +1 -0
  254. package/dist/commands/cliproxy/quota-subcommand/provider-runtime.d.ts +12 -0
  255. package/dist/commands/cliproxy/quota-subcommand/provider-runtime.d.ts.map +1 -0
  256. package/dist/commands/cliproxy/quota-subcommand/provider-runtime.js +64 -0
  257. package/dist/commands/cliproxy/quota-subcommand/provider-runtime.js.map +1 -0
  258. package/dist/commands/cliproxy/quota-subcommand/quota-failure-display.d.ts +27 -0
  259. package/dist/commands/cliproxy/quota-subcommand/quota-failure-display.d.ts.map +1 -0
  260. package/dist/commands/cliproxy/quota-subcommand/quota-failure-display.js +74 -0
  261. package/dist/commands/cliproxy/quota-subcommand/quota-failure-display.js.map +1 -0
  262. package/dist/commands/cliproxy/quota-subcommand/sections/antigravity.d.ts +10 -0
  263. package/dist/commands/cliproxy/quota-subcommand/sections/antigravity.d.ts.map +1 -0
  264. package/dist/commands/cliproxy/quota-subcommand/sections/antigravity.js +46 -0
  265. package/dist/commands/cliproxy/quota-subcommand/sections/antigravity.js.map +1 -0
  266. package/dist/commands/cliproxy/quota-subcommand/sections/claude.d.ts +14 -0
  267. package/dist/commands/cliproxy/quota-subcommand/sections/claude.d.ts.map +1 -0
  268. package/dist/commands/cliproxy/quota-subcommand/sections/claude.js +68 -0
  269. package/dist/commands/cliproxy/quota-subcommand/sections/claude.js.map +1 -0
  270. package/dist/commands/cliproxy/quota-subcommand/sections/codex.d.ts +14 -0
  271. package/dist/commands/cliproxy/quota-subcommand/sections/codex.d.ts.map +1 -0
  272. package/dist/commands/cliproxy/quota-subcommand/sections/codex.js +82 -0
  273. package/dist/commands/cliproxy/quota-subcommand/sections/codex.js.map +1 -0
  274. package/dist/commands/cliproxy/quota-subcommand/sections/gemini-cli.d.ts +14 -0
  275. package/dist/commands/cliproxy/quota-subcommand/sections/gemini-cli.d.ts.map +1 -0
  276. package/dist/commands/cliproxy/quota-subcommand/sections/gemini-cli.js +61 -0
  277. package/dist/commands/cliproxy/quota-subcommand/sections/gemini-cli.js.map +1 -0
  278. package/dist/commands/cliproxy/quota-subcommand/sections/ghcp.d.ts +13 -0
  279. package/dist/commands/cliproxy/quota-subcommand/sections/ghcp.d.ts.map +1 -0
  280. package/dist/commands/cliproxy/quota-subcommand/sections/ghcp.js +63 -0
  281. package/dist/commands/cliproxy/quota-subcommand/sections/ghcp.js.map +1 -0
  282. package/dist/commands/cliproxy/quota-subcommand/test-exports.d.ts +19 -0
  283. package/dist/commands/cliproxy/quota-subcommand/test-exports.d.ts.map +1 -0
  284. package/dist/commands/cliproxy/quota-subcommand/test-exports.js +22 -0
  285. package/dist/commands/cliproxy/quota-subcommand/test-exports.js.map +1 -0
  286. package/dist/commands/cliproxy/quota-subcommand/types.d.ts +42 -0
  287. package/dist/commands/cliproxy/quota-subcommand/types.d.ts.map +1 -0
  288. package/dist/commands/cliproxy/quota-subcommand/types.js +9 -0
  289. package/dist/commands/cliproxy/quota-subcommand/types.js.map +1 -0
  290. package/dist/commands/cliproxy/quota-subcommand.d.ts +14 -36
  291. package/dist/commands/cliproxy/quota-subcommand.d.ts.map +1 -1
  292. package/dist/commands/cliproxy/quota-subcommand.js +21 -872
  293. package/dist/commands/cliproxy/quota-subcommand.js.map +1 -1
  294. package/dist/commands/command-catalog.js +1 -1
  295. package/dist/commands/command-catalog.js.map +1 -1
  296. package/dist/commands/persist-command/arg-parsing.d.ts +14 -0
  297. package/dist/commands/persist-command/arg-parsing.d.ts.map +1 -0
  298. package/dist/commands/persist-command/arg-parsing.js +84 -0
  299. package/dist/commands/persist-command/arg-parsing.js.map +1 -0
  300. package/dist/commands/persist-command/backup-rotation.d.ts +23 -0
  301. package/dist/commands/persist-command/backup-rotation.d.ts.map +1 -0
  302. package/dist/commands/persist-command/backup-rotation.js +265 -0
  303. package/dist/commands/persist-command/backup-rotation.js.map +1 -0
  304. package/dist/commands/persist-command/handler.d.ts +10 -0
  305. package/dist/commands/persist-command/handler.d.ts.map +1 -0
  306. package/dist/commands/persist-command/handler.js +267 -0
  307. package/dist/commands/persist-command/handler.js.map +1 -0
  308. package/dist/commands/persist-command/help.d.ts +9 -0
  309. package/dist/commands/persist-command/help.d.ts.map +1 -0
  310. package/dist/commands/persist-command/help.js +86 -0
  311. package/dist/commands/persist-command/help.js.map +1 -0
  312. package/dist/commands/persist-command/receipt.d.ts +13 -0
  313. package/dist/commands/persist-command/receipt.d.ts.map +1 -0
  314. package/dist/commands/persist-command/receipt.js +102 -0
  315. package/dist/commands/persist-command/receipt.js.map +1 -0
  316. package/dist/commands/persist-command/secret-detection.d.ts +11 -0
  317. package/dist/commands/persist-command/secret-detection.d.ts.map +1 -0
  318. package/dist/commands/persist-command/secret-detection.js +54 -0
  319. package/dist/commands/persist-command/secret-detection.js.map +1 -0
  320. package/dist/commands/persist-command/secure-file.d.ts +21 -0
  321. package/dist/commands/persist-command/secure-file.d.ts.map +1 -0
  322. package/dist/commands/persist-command/secure-file.js +231 -0
  323. package/dist/commands/persist-command/secure-file.js.map +1 -0
  324. package/dist/commands/persist-command/types.d.ts +42 -0
  325. package/dist/commands/persist-command/types.d.ts.map +1 -0
  326. package/dist/commands/persist-command/types.js +34 -0
  327. package/dist/commands/persist-command/types.js.map +1 -0
  328. package/dist/commands/persist-command.d.ts +7 -2
  329. package/dist/commands/persist-command.d.ts.map +1 -1
  330. package/dist/commands/persist-command.js +17 -933
  331. package/dist/commands/persist-command.js.map +1 -1
  332. package/dist/commands/proxy-command.d.ts.map +1 -1
  333. package/dist/commands/proxy-command.js +7 -1
  334. package/dist/commands/proxy-command.js.map +1 -1
  335. package/dist/commands/setup-command.d.ts.map +1 -1
  336. package/dist/commands/setup-command.js +11 -1
  337. package/dist/commands/setup-command.js.map +1 -1
  338. package/dist/commands/tokens-command.d.ts.map +1 -1
  339. package/dist/commands/tokens-command.js +6 -0
  340. package/dist/commands/tokens-command.js.map +1 -1
  341. package/dist/config/unified-config-loader.d.ts.map +1 -1
  342. package/dist/config/unified-config-loader.js +22 -12
  343. package/dist/config/unified-config-loader.js.map +1 -1
  344. package/dist/copilot/copilot-executor.js +25 -25
  345. package/dist/copilot/copilot-executor.js.map +1 -1
  346. package/dist/cursor/cursor-daemon-entry.d.ts.map +1 -1
  347. package/dist/cursor/cursor-daemon-entry.js +34 -9
  348. package/dist/cursor/cursor-daemon-entry.js.map +1 -1
  349. package/dist/cursor/cursor-daemon.d.ts.map +1 -1
  350. package/dist/cursor/cursor-daemon.js +1 -0
  351. package/dist/cursor/cursor-daemon.js.map +1 -1
  352. package/dist/cursor/cursor-profile-executor.d.ts.map +1 -1
  353. package/dist/cursor/cursor-profile-executor.js +18 -17
  354. package/dist/cursor/cursor-profile-executor.js.map +1 -1
  355. package/dist/delegation/delegation-handler.d.ts.map +1 -1
  356. package/dist/delegation/delegation-handler.js +29 -23
  357. package/dist/delegation/delegation-handler.js.map +1 -1
  358. package/dist/delegation/headless-executor.d.ts +1 -0
  359. package/dist/delegation/headless-executor.d.ts.map +1 -1
  360. package/dist/delegation/headless-executor.js +36 -15
  361. package/dist/delegation/headless-executor.js.map +1 -1
  362. package/dist/delegation/session-manager.d.ts.map +1 -1
  363. package/dist/delegation/session-manager.js +12 -4
  364. package/dist/delegation/session-manager.js.map +1 -1
  365. package/dist/dispatcher/cli-argument-parser.d.ts +1 -1
  366. package/dist/dispatcher/cli-argument-parser.d.ts.map +1 -1
  367. package/dist/dispatcher/cli-argument-parser.js +24 -23
  368. package/dist/dispatcher/cli-argument-parser.js.map +1 -1
  369. package/dist/dispatcher/flows/cliproxy-flow.d.ts.map +1 -1
  370. package/dist/dispatcher/flows/cliproxy-flow.js +12 -15
  371. package/dist/dispatcher/flows/cliproxy-flow.js.map +1 -1
  372. package/dist/dispatcher/flows/copilot-flow.js +1 -1
  373. package/dist/dispatcher/flows/copilot-flow.js.map +1 -1
  374. package/dist/dispatcher/flows/cursor-flow.js +1 -1
  375. package/dist/dispatcher/flows/cursor-flow.js.map +1 -1
  376. package/dist/dispatcher/flows/settings-flow.d.ts.map +1 -1
  377. package/dist/dispatcher/flows/settings-flow.js +32 -29
  378. package/dist/dispatcher/flows/settings-flow.js.map +1 -1
  379. package/dist/dispatcher/pre-dispatch.d.ts.map +1 -1
  380. package/dist/dispatcher/pre-dispatch.js +26 -10
  381. package/dist/dispatcher/pre-dispatch.js.map +1 -1
  382. package/dist/dispatcher/profile-resolver.d.ts.map +1 -1
  383. package/dist/dispatcher/profile-resolver.js +16 -16
  384. package/dist/dispatcher/profile-resolver.js.map +1 -1
  385. package/dist/docker/supervisord-lifecycle.d.ts.map +1 -1
  386. package/dist/docker/supervisord-lifecycle.js +5 -1
  387. package/dist/docker/supervisord-lifecycle.js.map +1 -1
  388. package/dist/errors/error-types.d.ts +26 -22
  389. package/dist/errors/error-types.d.ts.map +1 -1
  390. package/dist/errors/error-types.js +15 -12
  391. package/dist/errors/error-types.js.map +1 -1
  392. package/dist/errors/exit-codes.d.ts +20 -13
  393. package/dist/errors/exit-codes.d.ts.map +1 -1
  394. package/dist/errors/exit-codes.js +32 -28
  395. package/dist/errors/exit-codes.js.map +1 -1
  396. package/dist/glmt/delta-accumulator.d.ts +1 -0
  397. package/dist/glmt/delta-accumulator.d.ts.map +1 -1
  398. package/dist/glmt/delta-accumulator.js +12 -4
  399. package/dist/glmt/delta-accumulator.js.map +1 -1
  400. package/dist/glmt/glmt-proxy.d.ts.map +1 -1
  401. package/dist/glmt/glmt-proxy.js +39 -10
  402. package/dist/glmt/glmt-proxy.js.map +1 -1
  403. package/dist/glmt/glmt-transformer.d.ts.map +1 -1
  404. package/dist/glmt/glmt-transformer.js +1 -4
  405. package/dist/glmt/glmt-transformer.js.map +1 -1
  406. package/dist/glmt/pipeline/request-transformer.d.ts.map +1 -1
  407. package/dist/glmt/pipeline/request-transformer.js +5 -1
  408. package/dist/glmt/pipeline/request-transformer.js.map +1 -1
  409. package/dist/glmt/pipeline/response-builder.d.ts.map +1 -1
  410. package/dist/glmt/pipeline/response-builder.js +7 -3
  411. package/dist/glmt/pipeline/response-builder.js.map +1 -1
  412. package/dist/glmt/pipeline/stream-parser.d.ts.map +1 -1
  413. package/dist/glmt/pipeline/stream-parser.js +11 -5
  414. package/dist/glmt/pipeline/stream-parser.js.map +1 -1
  415. package/dist/glmt/pipeline/tool-call-handler.d.ts.map +1 -1
  416. package/dist/glmt/pipeline/tool-call-handler.js +7 -1
  417. package/dist/glmt/pipeline/tool-call-handler.js.map +1 -1
  418. package/dist/glmt/sse-parser.d.ts +1 -0
  419. package/dist/glmt/sse-parser.d.ts.map +1 -1
  420. package/dist/glmt/sse-parser.js +7 -3
  421. package/dist/glmt/sse-parser.js.map +1 -1
  422. package/dist/management/checks/cliproxy-check.d.ts.map +1 -1
  423. package/dist/management/checks/cliproxy-check.js +15 -1
  424. package/dist/management/checks/cliproxy-check.js.map +1 -1
  425. package/dist/management/checks/config-check.d.ts.map +1 -1
  426. package/dist/management/checks/config-check.js +4 -1
  427. package/dist/management/checks/config-check.js.map +1 -1
  428. package/dist/management/checks/profile-check.d.ts.map +1 -1
  429. package/dist/management/checks/profile-check.js +10 -6
  430. package/dist/management/checks/profile-check.js.map +1 -1
  431. package/dist/management/doctor.d.ts +7 -0
  432. package/dist/management/doctor.d.ts.map +1 -1
  433. package/dist/management/doctor.js +31 -9
  434. package/dist/management/doctor.js.map +1 -1
  435. package/dist/management/shared-manager/fs-helpers.d.ts +69 -0
  436. package/dist/management/shared-manager/fs-helpers.d.ts.map +1 -0
  437. package/dist/management/shared-manager/fs-helpers.js +241 -0
  438. package/dist/management/shared-manager/fs-helpers.js.map +1 -0
  439. package/dist/management/shared-manager/migrations.d.ts +21 -0
  440. package/dist/management/shared-manager/migrations.d.ts.map +1 -0
  441. package/dist/management/shared-manager/migrations.js +187 -0
  442. package/dist/management/shared-manager/migrations.js.map +1 -0
  443. package/dist/management/shared-manager/orchestrator.d.ts +87 -0
  444. package/dist/management/shared-manager/orchestrator.d.ts.map +1 -0
  445. package/dist/management/shared-manager/orchestrator.js +161 -0
  446. package/dist/management/shared-manager/orchestrator.js.map +1 -0
  447. package/dist/management/shared-manager/plugin-layout-internals.d.ts +42 -0
  448. package/dist/management/shared-manager/plugin-layout-internals.d.ts.map +1 -0
  449. package/dist/management/shared-manager/plugin-layout-internals.js +192 -0
  450. package/dist/management/shared-manager/plugin-layout-internals.js.map +1 -0
  451. package/dist/management/shared-manager/plugin-metadata-normalizer.d.ts +53 -0
  452. package/dist/management/shared-manager/plugin-metadata-normalizer.d.ts.map +1 -0
  453. package/dist/management/shared-manager/plugin-metadata-normalizer.js +253 -0
  454. package/dist/management/shared-manager/plugin-metadata-normalizer.js.map +1 -0
  455. package/dist/management/shared-manager/project-context-sync.d.ts +36 -0
  456. package/dist/management/shared-manager/project-context-sync.d.ts.map +1 -0
  457. package/dist/management/shared-manager/project-context-sync.js +204 -0
  458. package/dist/management/shared-manager/project-context-sync.js.map +1 -0
  459. package/dist/management/shared-manager/project-memory-sync.d.ts +21 -0
  460. package/dist/management/shared-manager/project-memory-sync.d.ts.map +1 -0
  461. package/dist/management/shared-manager/project-memory-sync.js +113 -0
  462. package/dist/management/shared-manager/project-memory-sync.js.map +1 -0
  463. package/dist/management/shared-manager/shared-dir-linker.d.ts +41 -0
  464. package/dist/management/shared-manager/shared-dir-linker.d.ts.map +1 -0
  465. package/dist/management/shared-manager/shared-dir-linker.js +227 -0
  466. package/dist/management/shared-manager/shared-dir-linker.js.map +1 -0
  467. package/dist/management/shared-manager/symlink-helpers.d.ts +61 -0
  468. package/dist/management/shared-manager/symlink-helpers.d.ts.map +1 -0
  469. package/dist/management/shared-manager/symlink-helpers.js +243 -0
  470. package/dist/management/shared-manager/symlink-helpers.js.map +1 -0
  471. package/dist/management/shared-manager/types.d.ts +45 -0
  472. package/dist/management/shared-manager/types.d.ts.map +1 -0
  473. package/dist/management/shared-manager/types.js +57 -0
  474. package/dist/management/shared-manager/types.js.map +1 -0
  475. package/dist/management/shared-manager.d.ts +13 -160
  476. package/dist/management/shared-manager.d.ts.map +1 -1
  477. package/dist/management/shared-manager.js +18 -1294
  478. package/dist/management/shared-manager.js.map +1 -1
  479. package/dist/proxy/proxy-daemon-entry.js +1 -1
  480. package/dist/proxy/proxy-daemon-entry.js.map +1 -1
  481. package/dist/proxy/transformers/sse-stream-transformer.d.ts.map +1 -1
  482. package/dist/proxy/transformers/sse-stream-transformer.js +12 -17
  483. package/dist/proxy/transformers/sse-stream-transformer.js.map +1 -1
  484. package/dist/services/logging/index.d.ts +1 -1
  485. package/dist/services/logging/index.d.ts.map +1 -1
  486. package/dist/services/logging/index.js +6 -1
  487. package/dist/services/logging/index.js.map +1 -1
  488. package/dist/services/logging/log-context.d.ts +27 -2
  489. package/dist/services/logging/log-context.d.ts.map +1 -1
  490. package/dist/services/logging/log-context.js +43 -4
  491. package/dist/services/logging/log-context.js.map +1 -1
  492. package/dist/services/logging/log-redaction.d.ts +9 -0
  493. package/dist/services/logging/log-redaction.d.ts.map +1 -1
  494. package/dist/services/logging/log-redaction.js +31 -3
  495. package/dist/services/logging/log-redaction.js.map +1 -1
  496. package/dist/services/logging/logger.js +2 -2
  497. package/dist/services/logging/logger.js.map +1 -1
  498. package/dist/shared/provider-preset-catalog.js +7 -7
  499. package/dist/shared/provider-preset-catalog.js.map +1 -1
  500. package/dist/targets/codex-adapter.d.ts.map +1 -1
  501. package/dist/targets/codex-adapter.js +11 -10
  502. package/dist/targets/codex-adapter.js.map +1 -1
  503. package/dist/targets/droid-adapter.d.ts.map +1 -1
  504. package/dist/targets/droid-adapter.js +12 -12
  505. package/dist/targets/droid-adapter.js.map +1 -1
  506. package/dist/ui/assets/{Trans-BXjW_Rw3.js → Trans-GYzYLs2D.js} +1 -1
  507. package/dist/ui/assets/{accounts-C7JMc-UL.js → accounts-DC1QuyI9.js} +1 -1
  508. package/dist/ui/assets/{alert-dialog-BSSHnWG_.js → alert-dialog-6SiedqmE.js} +1 -1
  509. package/dist/ui/assets/{api-GzEZNvOJ.js → api-3s21dbNJ.js} +1 -1
  510. package/dist/ui/assets/{auth-section-B6k7LWIq.js → auth-section-XBfNgVN4.js} +1 -1
  511. package/dist/ui/assets/{backups-section-Cr3g01YN.js → backups-section-BidiiVlq.js} +1 -1
  512. package/dist/ui/assets/{channels-CMyh1yhN.js → channels-pfgPUDGt.js} +1 -1
  513. package/dist/ui/assets/{checkbox-BkqYXiER.js → checkbox-CJw_-nvC.js} +1 -1
  514. package/dist/ui/assets/{claude-extension-BzYl3zcz.js → claude-extension-BIIUOvTJ.js} +1 -1
  515. package/dist/ui/assets/{cliproxy-DwzKzuZI.js → cliproxy-Cq8OX0Pu.js} +1 -1
  516. package/dist/ui/assets/{cliproxy-ai-providers-DL95SYNa.js → cliproxy-ai-providers-DI760ZF0.js} +1 -1
  517. package/dist/ui/assets/{cliproxy-control-panel-Ba2Rgzdo.js → cliproxy-control-panel-CBqvpOqj.js} +1 -1
  518. package/dist/ui/assets/{codex-ClTEGCnr.js → codex-DL4OLBUu.js} +1 -1
  519. package/dist/ui/assets/{confirm-dialog-BPAO4ILr.js → confirm-dialog-CC_Cc3EO.js} +1 -1
  520. package/dist/ui/assets/{copilot-CymHD4gl.js → copilot-D2kEhTXR.js} +1 -1
  521. package/dist/ui/assets/{cursor-DAiPXs8h.js → cursor-BashLrYk.js} +1 -1
  522. package/dist/ui/assets/{droid-CAhLWDOj.js → droid-DaKTINFL.js} +1 -1
  523. package/dist/ui/assets/{globalenv-section-BK5x_uXG.js → globalenv-section-BQicL8L0.js} +1 -1
  524. package/dist/ui/assets/{health-D_ErMvYv.js → health-bRbE_ADg.js} +1 -1
  525. package/dist/ui/assets/{index-BcfwoMDm.js → index-B2JEyN3d.js} +36 -36
  526. package/dist/ui/assets/{index-B4cUkPwc.js → index-BwZdl1HU.js} +1 -1
  527. package/dist/ui/assets/{index-BZMyk4bI.js → index-CgeAb1-K.js} +1 -1
  528. package/dist/ui/assets/{index-BmbKPprT.js → index-DAQ0qIQ_.js} +1 -1
  529. package/dist/ui/assets/{index-CEjVNSjg.js → index-O2x1grGh.js} +1 -1
  530. package/dist/ui/assets/{index-DCC80SZ0.js → index-WA7tK6np.js} +1 -1
  531. package/dist/ui/assets/{index-CFDjAXOB.js → index-mf2X1GwS.js} +1 -1
  532. package/dist/ui/assets/{logs-DwhXr-9Y.js → logs-qrBHUJ0H.js} +1 -1
  533. package/dist/ui/assets/{masked-input-DWJTe7jh.js → masked-input-CXwQ4E-g.js} +1 -1
  534. package/dist/ui/assets/{proxy-status-widget-CJXi8yui.js → proxy-status-widget-DPz4nCzR.js} +1 -1
  535. package/dist/ui/assets/{raw-json-settings-editor-panel-DWhAi0kI.js → raw-json-settings-editor-panel-CcvsWVh1.js} +1 -1
  536. package/dist/ui/assets/{searchable-select-CYC4Y8pS.js → searchable-select-EXSjNCRu.js} +1 -1
  537. package/dist/ui/assets/{separator-JhuNwVKE.js → separator-D2CTfWBQ.js} +1 -1
  538. package/dist/ui/assets/{shared-Hpgs7l5G.js → shared-DpgzhFqe.js} +1 -1
  539. package/dist/ui/assets/{table-DDJTZfyL.js → table-DwbiGRYk.js} +1 -1
  540. package/dist/ui/assets/{updates-CtygOHUO.js → updates-D8jfIb2y.js} +1 -1
  541. package/dist/ui/assets/{use-accounts-CaptC8AS.js → use-accounts-Bwtpnx-x.js} +1 -1
  542. package/dist/ui/index.html +1 -1
  543. package/dist/utils/image-analysis/mcp-installer.d.ts.map +1 -1
  544. package/dist/utils/image-analysis/mcp-installer.js +16 -13
  545. package/dist/utils/image-analysis/mcp-installer.js.map +1 -1
  546. package/dist/utils/websearch/index.d.ts +1 -1
  547. package/dist/utils/websearch/index.d.ts.map +1 -1
  548. package/dist/utils/websearch/index.js +2 -1
  549. package/dist/utils/websearch/index.js.map +1 -1
  550. package/dist/utils/websearch/mcp-installer.d.ts +8 -0
  551. package/dist/utils/websearch/mcp-installer.d.ts.map +1 -1
  552. package/dist/utils/websearch/mcp-installer.js +34 -13
  553. package/dist/utils/websearch/mcp-installer.js.map +1 -1
  554. package/dist/utils/websearch-manager.d.ts +1 -1
  555. package/dist/utils/websearch-manager.d.ts.map +1 -1
  556. package/dist/utils/websearch-manager.js +2 -1
  557. package/dist/utils/websearch-manager.js.map +1 -1
  558. package/dist/web-server/middleware/request-logging-middleware.d.ts.map +1 -1
  559. package/dist/web-server/middleware/request-logging-middleware.js +14 -9
  560. package/dist/web-server/middleware/request-logging-middleware.js.map +1 -1
  561. package/dist/web-server/model-pricing.d.ts.map +1 -1
  562. package/dist/web-server/model-pricing.js +22 -2
  563. package/dist/web-server/model-pricing.js.map +1 -1
  564. package/dist/web-server/routes/bar-routes.d.ts +12 -1
  565. package/dist/web-server/routes/bar-routes.d.ts.map +1 -1
  566. package/dist/web-server/routes/bar-routes.js +22 -6
  567. package/dist/web-server/routes/bar-routes.js.map +1 -1
  568. package/dist/web-server/routes/claude-extension-routes.d.ts.map +1 -1
  569. package/dist/web-server/routes/claude-extension-routes.js +3 -2
  570. package/dist/web-server/routes/claude-extension-routes.js.map +1 -1
  571. package/dist/web-server/routes/cliproxy-auth-routes.d.ts +1 -0
  572. package/dist/web-server/routes/cliproxy-auth-routes.d.ts.map +1 -1
  573. package/dist/web-server/routes/cliproxy-auth-routes.js +20 -5
  574. package/dist/web-server/routes/cliproxy-auth-routes.js.map +1 -1
  575. package/dist/web-server/routes/cliproxy-stats-routes/config-routes.d.ts +16 -0
  576. package/dist/web-server/routes/cliproxy-stats-routes/config-routes.d.ts.map +1 -0
  577. package/dist/web-server/routes/cliproxy-stats-routes/config-routes.js +219 -0
  578. package/dist/web-server/routes/cliproxy-stats-routes/config-routes.js.map +1 -0
  579. package/dist/web-server/routes/cliproxy-stats-routes/error-log-routes.d.ts +12 -0
  580. package/dist/web-server/routes/cliproxy-stats-routes/error-log-routes.d.ts.map +1 -0
  581. package/dist/web-server/routes/cliproxy-stats-routes/error-log-routes.js +153 -0
  582. package/dist/web-server/routes/cliproxy-stats-routes/error-log-routes.js.map +1 -0
  583. package/dist/web-server/routes/cliproxy-stats-routes/quota-helpers.d.ts +19 -0
  584. package/dist/web-server/routes/cliproxy-stats-routes/quota-helpers.d.ts.map +1 -0
  585. package/dist/web-server/routes/cliproxy-stats-routes/quota-helpers.js +38 -0
  586. package/dist/web-server/routes/cliproxy-stats-routes/quota-helpers.js.map +1 -0
  587. package/dist/web-server/routes/cliproxy-stats-routes/quota-routes.d.ts +13 -0
  588. package/dist/web-server/routes/cliproxy-stats-routes/quota-routes.d.ts.map +1 -0
  589. package/dist/web-server/routes/cliproxy-stats-routes/quota-routes.js +195 -0
  590. package/dist/web-server/routes/cliproxy-stats-routes/quota-routes.js.map +1 -0
  591. package/dist/web-server/routes/cliproxy-stats-routes/restart-route.d.ts +17 -0
  592. package/dist/web-server/routes/cliproxy-stats-routes/restart-route.d.ts.map +1 -0
  593. package/dist/web-server/routes/cliproxy-stats-routes/restart-route.js +34 -0
  594. package/dist/web-server/routes/cliproxy-stats-routes/restart-route.js.map +1 -0
  595. package/dist/web-server/routes/cliproxy-stats-routes/router.d.ts +10 -0
  596. package/dist/web-server/routes/cliproxy-stats-routes/router.d.ts.map +1 -0
  597. package/dist/web-server/routes/cliproxy-stats-routes/router.js +245 -0
  598. package/dist/web-server/routes/cliproxy-stats-routes/router.js.map +1 -0
  599. package/dist/web-server/routes/cliproxy-stats-routes/shared.d.ts +35 -0
  600. package/dist/web-server/routes/cliproxy-stats-routes/shared.d.ts.map +1 -0
  601. package/dist/web-server/routes/cliproxy-stats-routes/shared.js +59 -0
  602. package/dist/web-server/routes/cliproxy-stats-routes/shared.js.map +1 -0
  603. package/dist/web-server/routes/cliproxy-stats-routes/version-helpers.d.ts +44 -0
  604. package/dist/web-server/routes/cliproxy-stats-routes/version-helpers.d.ts.map +1 -0
  605. package/dist/web-server/routes/cliproxy-stats-routes/version-helpers.js +66 -0
  606. package/dist/web-server/routes/cliproxy-stats-routes/version-helpers.js.map +1 -0
  607. package/dist/web-server/routes/cliproxy-stats-routes.d.ts +16 -57
  608. package/dist/web-server/routes/cliproxy-stats-routes.d.ts.map +1 -1
  609. package/dist/web-server/routes/cliproxy-stats-routes.js +25 -926
  610. package/dist/web-server/routes/cliproxy-stats-routes.js.map +1 -1
  611. package/dist/web-server/routes/cliproxy-sync-routes.d.ts.map +1 -1
  612. package/dist/web-server/routes/cliproxy-sync-routes.js +9 -2
  613. package/dist/web-server/routes/cliproxy-sync-routes.js.map +1 -1
  614. package/dist/web-server/routes/copilot-settings-routes.d.ts.map +1 -1
  615. package/dist/web-server/routes/copilot-settings-routes.js +2 -1
  616. package/dist/web-server/routes/copilot-settings-routes.js.map +1 -1
  617. package/dist/web-server/routes/image-analysis-routes.d.ts.map +1 -1
  618. package/dist/web-server/routes/image-analysis-routes.js +2 -1
  619. package/dist/web-server/routes/image-analysis-routes.js.map +1 -1
  620. package/dist/web-server/routes/persist-routes.d.ts.map +1 -1
  621. package/dist/web-server/routes/persist-routes.js +8 -1
  622. package/dist/web-server/routes/persist-routes.js.map +1 -1
  623. package/dist/web-server/routes/proxy-routes.d.ts.map +1 -1
  624. package/dist/web-server/routes/proxy-routes.js +33 -5
  625. package/dist/web-server/routes/proxy-routes.js.map +1 -1
  626. package/dist/web-server/routes/route-helpers.d.ts.map +1 -1
  627. package/dist/web-server/routes/route-helpers.js +10 -6
  628. package/dist/web-server/routes/route-helpers.js.map +1 -1
  629. package/dist/web-server/routes/settings-routes.d.ts.map +1 -1
  630. package/dist/web-server/routes/settings-routes.js +7 -6
  631. package/dist/web-server/routes/settings-routes.js.map +1 -1
  632. package/dist/web-server/usage/aggregator.d.ts.map +1 -1
  633. package/dist/web-server/usage/aggregator.js +8 -8
  634. package/dist/web-server/usage/aggregator.js.map +1 -1
  635. package/dist/web-server/usage/bar-analytics.d.ts +21 -0
  636. package/dist/web-server/usage/bar-analytics.d.ts.map +1 -1
  637. package/dist/web-server/usage/bar-analytics.js +78 -9
  638. package/dist/web-server/usage/bar-analytics.js.map +1 -1
  639. package/dist/web-server/usage/handlers.d.ts.map +1 -1
  640. package/dist/web-server/usage/handlers.js +1 -1
  641. package/dist/web-server/usage/handlers.js.map +1 -1
  642. package/dist/web-server/usage/native-quota-collector.d.ts +37 -9
  643. package/dist/web-server/usage/native-quota-collector.d.ts.map +1 -1
  644. package/dist/web-server/usage/native-quota-collector.js +226 -23
  645. package/dist/web-server/usage/native-quota-collector.js.map +1 -1
  646. package/package.json +1 -1
  647. package/scripts/ci-parity-gate.sh +31 -0
  648. package/scripts/generate-throw-error-baseline.js +103 -0
  649. package/scripts/hardening-inventory.js +62 -4
  650. package/scripts/maintainability-metrics.js +356 -0
@@ -1,2 +1,2 @@
1
- import{j as e}from"./radix-ui-nu4wz29m.js";import{r as q}from"./react-vendor-Bjx91N7w.js";import{t as j}from"./notifications-B4_o8bcr.js";import{bf as X,bg as Ne,a as Z,C as y,s as b,t as v,B as E,b as N,j as H,k as Q,l as W,m as Y,n as k,I as le,bm as we,bn as ae,bo as ke,U as Se,V as Pe,W as U,X as V,x as A,bh as Ee,c as Ce}from"./index-BcfwoMDm.js";import{a as Te,u as ie,b as Ae}from"./tanstack-bhJxV1h8.js";import{a as Re}from"./raw-json-settings-editor-panel-DWhAi0kI.js";import{az as _e,aD as De,O as Oe,L as Me,S as Be,aZ as Fe,y as Le,J as Ie,T as Ke,af as Ue,aj as Ve,q as oe}from"./icons-DSLG1YsC.js";import{S as R}from"./separator-JhuNwVKE.js";import"./utils-CzKF5WmX.js";import"./form-utils-CuHzLhJZ.js";import"./charts-eIPy2oG6.js";function $e(s){try{const r=JSON.parse(s);return!r||typeof r!="object"||Array.isArray(r)?{settings:null,parseError:"JSON root must be an object."}:{settings:r,parseError:null}}catch(r){return{settings:null,parseError:r.message}}}async function ze(){const s=await fetch(X("/droid/diagnostics"));if(!s.ok)throw new Error("Failed to fetch Droid diagnostics");return s.json()}async function Je(){const s=await fetch(X("/droid/settings/raw"));if(!s.ok)throw new Error("Failed to fetch Droid raw settings");return s.json()}async function qe(s){const r=await fetch(X("/droid/settings/raw"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(r.status===409)throw new Ne("Droid raw settings changed externally");if(!r.ok){const n=await r.json().catch(()=>null);throw new Error(n?.error||"Failed to save Droid raw settings")}return r.json()}function He(){const s=Te(),r=ie({queryKey:["droid-diagnostics"],queryFn:ze,refetchInterval:1e4}),n=ie({queryKey:["droid-raw-settings"],queryFn:Je}),i=Ae({mutationFn:qe,onSuccess:(l,d)=>{s.setQueryData(["droid-raw-settings"],o=>{const t=o?.path??"~/.factory/settings.json",c=o?.resolvedPath??t,m=$e(d.rawText);return{path:t,resolvedPath:c,exists:!0,mtime:l.mtime,rawText:d.rawText,settings:m.settings,parseError:m.parseError}}),s.invalidateQueries({queryKey:["droid-diagnostics"]})}});return q.useMemo(()=>({diagnostics:r.data,diagnosticsLoading:r.isLoading,diagnosticsError:r.error,refetchDiagnostics:r.refetch,rawSettings:n.data,rawSettingsLoading:n.isLoading,rawSettingsError:n.error,refetchRawSettings:n.refetch,saveRawSettings:i.mutate,saveRawSettingsAsync:i.mutateAsync,isSavingRawSettings:i.isPending}),[r.data,r.isLoading,r.error,r.refetch,n.data,n.isLoading,n.error,n.refetch,i.mutate,i.mutateAsync,i.isPending])}const Qe=["customModels","custom_models"],We={low:4e3,medium:12e3,high:3e4,max:5e4,xhigh:64e3},Ye=["low","medium","high","max","xhigh"];function h(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}function p(s){return typeof s=="string"&&s.trim()?s.trim():null}function D(s){return typeof s=="number"&&Number.isFinite(s)?s:null}function G(s){if(!s)return"unknown";const r=s.toLowerCase();return r==="anthropic"?"anthropic":r==="openai"?"openai":r==="generic-chat-completion-api"?"generic-chat-completion-api":"unknown"}function Ge(s,r,n){return`${s}:${r}:${encodeURIComponent(String(n))}`}function Xe(s){const r=s.indexOf(":"),n=s.indexOf(":",r+1);if(r<=0||n<=r+1)return null;const i=s.slice(0,r),l=s.slice(r+1,n),d=s.slice(n+1);if(i!=="customModels"&&i!=="custom_models"||l!=="array"&&l!=="object")return null;const o=decodeURIComponent(d);if(l==="array"){const t=Number.parseInt(o,10);return!Number.isInteger(t)||t<0?null:{rootKey:i,locationType:l,locationKey:t}}return{rootKey:i,locationType:l,locationKey:o}}function Ze(s){return!s||s<=0?null:s<=4e3?"low":s<=12e3?"medium":s<=3e4?"high":s<=5e4?"max":"xhigh"}function es(s){return Object.prototype.hasOwnProperty.call(s,"extraArgs")?"extraArgs":Object.prototype.hasOwnProperty.call(s,"extra_args")?"extra_args":"extraArgs"}function de(s){return JSON.parse(JSON.stringify(s))}function ss(s){const r=[];for(const n of Qe){const i=s[n];if(Array.isArray(i)){i.forEach((l,d)=>{h(l)&&r.push({rootKey:n,locationType:"array",locationKey:d,entry:l})});continue}if(h(i))for(const[l,d]of Object.entries(i))h(d)&&r.push({rootKey:n,locationType:"object",locationKey:l,entry:d})}return r}function ce(s,r){const n=Xe(r);if(!n)return null;const i=s[n.rootKey];if(n.locationType==="array"){if(!Array.isArray(i))return null;const o=i[n.locationKey];if(!h(o))return null;const t=p(o.provider);return{entry:o,providerKind:G(t)}}if(!h(i))return null;const l=i[n.locationKey];if(!h(l))return null;const d=p(l.provider);return{entry:l,providerKind:G(d)}}function rs(s,r){const n=r.extraArgs??r.extra_args,i=h(n)?n:null;if(!i)return{effort:null,anthropicBudgetTokens:null};const l=p(i.reasoning_effort)??p(i.reasoningEffort),d=h(i.reasoning)?i.reasoning:null,o=d?p(d.effort):null,t=h(i.thinking)?i.thinking:null,c=t?p(t.type):null,m=t?D(t.budget_tokens)??D(t.budgetTokens):null;return s==="openai"?{effort:o??l,anthropicBudgetTokens:null}:s==="anthropic"?c==="enabled"?{effort:Ze(m)??"high",anthropicBudgetTokens:m}:{effort:o??l,anthropicBudgetTokens:m}:{effort:l??o,anthropicBudgetTokens:null}}function ts(s){if(!s)return null;const r=s.trim().toLowerCase();return!r||r==="default"||r==="unset"||r==="off"||r==="none"||r==="disabled"?null:r}function ue(s){const r=es(s),n=s[r],i=h(n)?{...n}:{};return{extraArgsKey:r,extraArgs:i}}function me(s,r,n){if(Object.keys(n).length===0){delete s[r];return}s[r]=n}function ns(s){return ss(s).map(({rootKey:r,locationType:n,locationKey:i,entry:l})=>{const d=p(l.displayName)??p(l.model_display_name)??"Unnamed model",o=p(l.model)??"",t=p(l.provider)??"unknown",c=G(t),m=rs(c,l);return{id:Ge(r,n,i),rootKey:r,locationType:n,locationKey:i,displayName:d,model:o,provider:t,providerKind:c,effort:m.effort,anthropicBudgetTokens:m.anthropicBudgetTokens}})}function as(s,r,n){const i=de(s),l=ce(i,r);if(!l)return null;const d=ts(n),{extraArgsKey:o,extraArgs:t}=ue(l.entry);if(l.providerKind==="openai")if(delete t.reasoning_effort,delete t.reasoningEffort,!d)delete t.reasoning;else{const c=h(t.reasoning)?t.reasoning:{};t.reasoning={...c,effort:d}}else if(l.providerKind==="anthropic")if(delete t.reasoning_effort,delete t.reasoningEffort,delete t.reasoning,!d)delete t.thinking;else{const c=h(t.thinking)?{...t.thinking}:{},m=D(c.budget_tokens)??D(c.budgetTokens);delete c.budgetTokens,t.thinking={...c,type:"enabled",budget_tokens:m??We[d]??3e4}}else delete t.reasoning,delete t.reasoningEffort,d?t.reasoning_effort=d:delete t.reasoning_effort;return me(l.entry,o,t),i}function is(s,r,n){const i=de(s),l=ce(i,r);if(!l||l.providerKind!=="anthropic")return null;const{extraArgsKey:d,extraArgs:o}=ue(l.entry),t=h(o.thinking)?{...o.thinking}:{};if(t.type="enabled",n===null)delete t.budget_tokens,delete t.budgetTokens;else{const c=Math.max(1024,Math.floor(n));t.budget_tokens=c,delete t.budgetTokens}return o.thinking=t,me(l.entry,d,o),i}const $="__unset__";function os(s){return s.providerKind==="openai"?"Writes: extraArgs.reasoning.effort":s.providerKind==="anthropic"?"Writes: extraArgs.thinking.{type,budget_tokens}":"Writes: extraArgs.reasoning_effort"}function ls({models:s,disabled:r,disabledReason:n,onEffortChange:i,onAnthropicBudgetChange:l}){const{t:d}=Z();return e.jsxs(y,{children:[e.jsx(b,{className:"pb-2",children:e.jsxs(v,{className:"text-base flex items-center gap-2",children:[e.jsx(_e,{className:"h-4 w-4"}),d("droidSettings.reasoningControls"),e.jsx(E,{variant:"outline",className:"text-[10px] font-normal",children:"customModels"})]})}),e.jsxs(N,{className:"space-y-3",children:[n&&e.jsx("p",{className:"text-xs text-amber-600",children:n}),s.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:"No BYOK custom models found in settings.json (`customModels` or `custom_models`)."}):e.jsx("div",{className:"space-y-2",children:s.map(o=>e.jsxs("div",{className:"rounded-md border p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-xs font-medium truncate",children:o.displayName}),e.jsx("p",{className:"text-[11px] font-mono text-muted-foreground truncate",children:o.model||"(missing model id)"})]}),e.jsx(E,{variant:"outline",className:"font-mono text-[10px] shrink-0",children:o.provider})]}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[11px] font-medium",children:d("codex.reasoningEffortCapitalized")}),e.jsxs(H,{value:o.effort??$,onValueChange:t=>i(o.id,t===$?null:t),disabled:r,children:[e.jsx(Q,{className:"h-8 text-xs",children:e.jsx(W,{placeholder:"Use provider default"})}),e.jsxs(Y,{children:[e.jsx(k,{value:$,children:"Use provider default"}),Ye.map(t=>e.jsx(k,{value:t,children:t},t))]})]})]}),o.providerKind==="anthropic"&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[11px] font-medium",children:d("codex.thinkingBudgetTokens")}),e.jsx(le,{type:"number",min:1024,step:1024,value:o.anthropicBudgetTokens??"",placeholder:"auto",className:"h-8 text-xs",disabled:r,onChange:t=>{const c=t.target.value.trim();if(!c){l(o.id,null);return}const m=Number.parseInt(c,10);Number.isFinite(m)&&l(o.id,Math.max(1024,m))}})]})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:os(o)})]},o.id))})]})]})}const T="__unset__",ds=[{key:"reasoningEffort",label:"Reasoning Effort",description:"none | medium | high | max",options:[{value:"none",label:"none"},{value:"medium",label:"medium"},{value:"high",label:"high"},{value:"max",label:"max"}]},{key:"autonomyLevel",label:"Autonomy Level",description:"suggest | aggressive | full",options:[{value:"suggest",label:"suggest"},{value:"aggressive",label:"aggressive"},{value:"full",label:"full"}]},{key:"diffMode",label:"Diff Mode",description:"auto | none | inline | split",options:[{value:"auto",label:"auto"},{value:"none",label:"none"},{value:"inline",label:"inline"},{value:"split",label:"split"}]}],cs=[{key:"todoEnabled",label:"Todo Enabled"},{key:"todoAutoRefresh",label:"Todo Auto Refresh"},{key:"autoCompactEnabled",label:"Auto Compact Enabled"},{key:"soundEnabled",label:"Sound Enabled"}],us=[{key:"maxTurns",label:"Max Turns",min:1,step:1},{key:"maxToolCalls",label:"Max Tool Calls",min:1,step:1},{key:"autoCompactThreshold",label:"Auto Compact Threshold",min:1e3,step:1e3}];function ms(s){return s===!0?"true":s===!1?"false":T}function xs(s){return s==="true"?!0:s==="false"?!1:null}function gs({values:s,disabled:r,disabledReason:n,onEnumSettingChange:i,onBooleanSettingChange:l,onNumberSettingChange:d}){const{t:o}=Z();return e.jsxs(y,{children:[e.jsx(b,{className:"pb-2",children:e.jsxs(v,{className:"text-base flex items-center gap-2",children:[e.jsx(De,{className:"h-4 w-4"}),o("droidSettings.quickControls"),e.jsx(E,{variant:"outline",className:"text-[10px] font-normal",children:"settings.json"})]})}),e.jsxs(N,{className:"space-y-4",children:[n&&e.jsx("p",{className:"text-xs text-amber-600",children:n}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[ds.map(t=>e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:t.label}),e.jsxs(H,{value:s[t.key]??T,onValueChange:c=>i(t.key,c===T?null:c),disabled:r,children:[e.jsx(Q,{className:"h-8 text-xs",children:e.jsx(W,{placeholder:o("codex.useDefault")})}),e.jsxs(Y,{children:[e.jsx(k,{value:T,children:o("codex.useDefault")}),t.options.map(c=>e.jsx(k,{value:c.value,children:c.label},c.value))]})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.description})]},t.key)),us.map(t=>e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:t.label}),e.jsx(le,{type:"number",min:t.min,step:t.step,value:s[t.key]??"",onChange:c=>{const m=c.target.value.trim();if(!m){d(t.key,null);return}const S=Number.parseInt(m,10);Number.isFinite(S)&&d(t.key,Math.max(t.min,S))},className:"h-8 text-xs",disabled:r})]},t.key)),cs.map(t=>e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:t.label}),e.jsxs(H,{value:ms(s[t.key]),onValueChange:c=>l(t.key,xs(c)),disabled:r,children:[e.jsx(Q,{className:"h-8 text-xs",children:e.jsx(W,{placeholder:o("codex.useDefault")})}),e.jsxs(Y,{children:[e.jsx(k,{value:T,children:o("codex.useDefault")}),e.jsx(k,{value:"true",children:"true"}),e.jsx(k,{value:"false",children:"false"})]})]})]},t.key))]})]})]})}const fs=[{id:"droid-cli-overview",label:"Droid CLI Overview",url:"https://docs.factory.ai/cli/",description:"Primary entry docs for setup, auth, and core CLI usage."},{id:"droid-byok-overview",label:"BYOK Overview",url:"https://docs.factory.ai/cli/byok/overview/",description:"BYOK model/provider shape, provider values, and migration notes."},{id:"droid-settings-reference",label:"settings.json Reference",url:"https://docs.factory.ai/cli/configuration/settings/",description:"Supported settings keys, defaults, and allowed values."}],hs=[{provider:"anthropic",label:"Anthropic Messages API",apiFormat:"Messages API",url:"https://docs.anthropic.com/en/api/messages"},{provider:"openai",label:"OpenAI Responses API",apiFormat:"Responses API",url:"https://platform.openai.com/docs/api-reference/responses"},{provider:"generic-chat-completion-api",label:"OpenAI Chat Completions Spec",apiFormat:"Chat Completions API",url:"https://platform.openai.com/docs/api-reference/chat"}];function ps(s){const r=/https?:\/\/[^\s)]+/g,n=[];let i=0,l;for(;(l=r.exec(s))!==null;){const[d]=l,o=l.index;o>i&&n.push(s.slice(i,o)),n.push(e.jsx("a",{href:d,target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:d},`${d}-${o}`)),i=o+d.length}return i<s.length&&n.push(s.slice(i)),n.length>0?n:[s]}function js(s){return!s||!Number.isFinite(s)?"N/A":new Date(s).toLocaleString()}function ys(s){return!s||s<=0?"0 B":s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(2)} MB`}function bs(s){try{const r=JSON.parse(s);return!r||typeof r!="object"||Array.isArray(r)?{valid:!1,error:"JSON root must be an object."}:{valid:!0,value:r}}catch(r){return{valid:!1,error:r.message}}}function z(s){return typeof s=="string"?s:null}function J(s){return typeof s=="number"&&Number.isFinite(s)?s:null}function _(s){return typeof s=="boolean"?s:null}function g({label:s,value:r,mono:n=!1}){return e.jsxs("div",{className:"flex items-start justify-between gap-3 text-sm",children:[e.jsx("span",{className:"text-muted-foreground shrink-0",children:s}),e.jsx("span",{className:Ce("text-right break-all",n&&"font-mono text-xs"),children:r})]})}function _s(){const{t:s}=Z(),{diagnostics:r,diagnosticsLoading:n,diagnosticsError:i,refetchDiagnostics:l,rawSettings:d,rawSettingsLoading:o,refetchRawSettings:t,saveRawSettingsAsync:c,isSavingRawSettings:m}=He(),[S,O]=q.useState(null),M=d?.rawText??"{}",B=S??M,ee=S!==null&&S!==M,u=bs(B),F=u.valid?{valid:!0}:{valid:!1,error:u.error},se=x=>{if(x===M){O(null);return}O(x)},L=x=>{se(JSON.stringify(x,null,2)+`
1
+ import{j as e}from"./radix-ui-nu4wz29m.js";import{r as q}from"./react-vendor-Bjx91N7w.js";import{t as j}from"./notifications-B4_o8bcr.js";import{bf as X,bg as Ne,a as Z,C as y,s as b,t as v,B as E,b as N,j as H,k as Q,l as W,m as Y,n as k,I as le,bm as we,bn as ae,bo as ke,U as Se,V as Pe,W as U,X as V,x as A,bh as Ee,c as Ce}from"./index-B2JEyN3d.js";import{a as Te,u as ie,b as Ae}from"./tanstack-bhJxV1h8.js";import{a as Re}from"./raw-json-settings-editor-panel-CcvsWVh1.js";import{az as _e,aD as De,O as Oe,L as Me,S as Be,aZ as Fe,y as Le,J as Ie,T as Ke,af as Ue,aj as Ve,q as oe}from"./icons-DSLG1YsC.js";import{S as R}from"./separator-D2CTfWBQ.js";import"./utils-CzKF5WmX.js";import"./form-utils-CuHzLhJZ.js";import"./charts-eIPy2oG6.js";function $e(s){try{const r=JSON.parse(s);return!r||typeof r!="object"||Array.isArray(r)?{settings:null,parseError:"JSON root must be an object."}:{settings:r,parseError:null}}catch(r){return{settings:null,parseError:r.message}}}async function ze(){const s=await fetch(X("/droid/diagnostics"));if(!s.ok)throw new Error("Failed to fetch Droid diagnostics");return s.json()}async function Je(){const s=await fetch(X("/droid/settings/raw"));if(!s.ok)throw new Error("Failed to fetch Droid raw settings");return s.json()}async function qe(s){const r=await fetch(X("/droid/settings/raw"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(r.status===409)throw new Ne("Droid raw settings changed externally");if(!r.ok){const n=await r.json().catch(()=>null);throw new Error(n?.error||"Failed to save Droid raw settings")}return r.json()}function He(){const s=Te(),r=ie({queryKey:["droid-diagnostics"],queryFn:ze,refetchInterval:1e4}),n=ie({queryKey:["droid-raw-settings"],queryFn:Je}),i=Ae({mutationFn:qe,onSuccess:(l,d)=>{s.setQueryData(["droid-raw-settings"],o=>{const t=o?.path??"~/.factory/settings.json",c=o?.resolvedPath??t,m=$e(d.rawText);return{path:t,resolvedPath:c,exists:!0,mtime:l.mtime,rawText:d.rawText,settings:m.settings,parseError:m.parseError}}),s.invalidateQueries({queryKey:["droid-diagnostics"]})}});return q.useMemo(()=>({diagnostics:r.data,diagnosticsLoading:r.isLoading,diagnosticsError:r.error,refetchDiagnostics:r.refetch,rawSettings:n.data,rawSettingsLoading:n.isLoading,rawSettingsError:n.error,refetchRawSettings:n.refetch,saveRawSettings:i.mutate,saveRawSettingsAsync:i.mutateAsync,isSavingRawSettings:i.isPending}),[r.data,r.isLoading,r.error,r.refetch,n.data,n.isLoading,n.error,n.refetch,i.mutate,i.mutateAsync,i.isPending])}const Qe=["customModels","custom_models"],We={low:4e3,medium:12e3,high:3e4,max:5e4,xhigh:64e3},Ye=["low","medium","high","max","xhigh"];function h(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}function p(s){return typeof s=="string"&&s.trim()?s.trim():null}function D(s){return typeof s=="number"&&Number.isFinite(s)?s:null}function G(s){if(!s)return"unknown";const r=s.toLowerCase();return r==="anthropic"?"anthropic":r==="openai"?"openai":r==="generic-chat-completion-api"?"generic-chat-completion-api":"unknown"}function Ge(s,r,n){return`${s}:${r}:${encodeURIComponent(String(n))}`}function Xe(s){const r=s.indexOf(":"),n=s.indexOf(":",r+1);if(r<=0||n<=r+1)return null;const i=s.slice(0,r),l=s.slice(r+1,n),d=s.slice(n+1);if(i!=="customModels"&&i!=="custom_models"||l!=="array"&&l!=="object")return null;const o=decodeURIComponent(d);if(l==="array"){const t=Number.parseInt(o,10);return!Number.isInteger(t)||t<0?null:{rootKey:i,locationType:l,locationKey:t}}return{rootKey:i,locationType:l,locationKey:o}}function Ze(s){return!s||s<=0?null:s<=4e3?"low":s<=12e3?"medium":s<=3e4?"high":s<=5e4?"max":"xhigh"}function es(s){return Object.prototype.hasOwnProperty.call(s,"extraArgs")?"extraArgs":Object.prototype.hasOwnProperty.call(s,"extra_args")?"extra_args":"extraArgs"}function de(s){return JSON.parse(JSON.stringify(s))}function ss(s){const r=[];for(const n of Qe){const i=s[n];if(Array.isArray(i)){i.forEach((l,d)=>{h(l)&&r.push({rootKey:n,locationType:"array",locationKey:d,entry:l})});continue}if(h(i))for(const[l,d]of Object.entries(i))h(d)&&r.push({rootKey:n,locationType:"object",locationKey:l,entry:d})}return r}function ce(s,r){const n=Xe(r);if(!n)return null;const i=s[n.rootKey];if(n.locationType==="array"){if(!Array.isArray(i))return null;const o=i[n.locationKey];if(!h(o))return null;const t=p(o.provider);return{entry:o,providerKind:G(t)}}if(!h(i))return null;const l=i[n.locationKey];if(!h(l))return null;const d=p(l.provider);return{entry:l,providerKind:G(d)}}function rs(s,r){const n=r.extraArgs??r.extra_args,i=h(n)?n:null;if(!i)return{effort:null,anthropicBudgetTokens:null};const l=p(i.reasoning_effort)??p(i.reasoningEffort),d=h(i.reasoning)?i.reasoning:null,o=d?p(d.effort):null,t=h(i.thinking)?i.thinking:null,c=t?p(t.type):null,m=t?D(t.budget_tokens)??D(t.budgetTokens):null;return s==="openai"?{effort:o??l,anthropicBudgetTokens:null}:s==="anthropic"?c==="enabled"?{effort:Ze(m)??"high",anthropicBudgetTokens:m}:{effort:o??l,anthropicBudgetTokens:m}:{effort:l??o,anthropicBudgetTokens:null}}function ts(s){if(!s)return null;const r=s.trim().toLowerCase();return!r||r==="default"||r==="unset"||r==="off"||r==="none"||r==="disabled"?null:r}function ue(s){const r=es(s),n=s[r],i=h(n)?{...n}:{};return{extraArgsKey:r,extraArgs:i}}function me(s,r,n){if(Object.keys(n).length===0){delete s[r];return}s[r]=n}function ns(s){return ss(s).map(({rootKey:r,locationType:n,locationKey:i,entry:l})=>{const d=p(l.displayName)??p(l.model_display_name)??"Unnamed model",o=p(l.model)??"",t=p(l.provider)??"unknown",c=G(t),m=rs(c,l);return{id:Ge(r,n,i),rootKey:r,locationType:n,locationKey:i,displayName:d,model:o,provider:t,providerKind:c,effort:m.effort,anthropicBudgetTokens:m.anthropicBudgetTokens}})}function as(s,r,n){const i=de(s),l=ce(i,r);if(!l)return null;const d=ts(n),{extraArgsKey:o,extraArgs:t}=ue(l.entry);if(l.providerKind==="openai")if(delete t.reasoning_effort,delete t.reasoningEffort,!d)delete t.reasoning;else{const c=h(t.reasoning)?t.reasoning:{};t.reasoning={...c,effort:d}}else if(l.providerKind==="anthropic")if(delete t.reasoning_effort,delete t.reasoningEffort,delete t.reasoning,!d)delete t.thinking;else{const c=h(t.thinking)?{...t.thinking}:{},m=D(c.budget_tokens)??D(c.budgetTokens);delete c.budgetTokens,t.thinking={...c,type:"enabled",budget_tokens:m??We[d]??3e4}}else delete t.reasoning,delete t.reasoningEffort,d?t.reasoning_effort=d:delete t.reasoning_effort;return me(l.entry,o,t),i}function is(s,r,n){const i=de(s),l=ce(i,r);if(!l||l.providerKind!=="anthropic")return null;const{extraArgsKey:d,extraArgs:o}=ue(l.entry),t=h(o.thinking)?{...o.thinking}:{};if(t.type="enabled",n===null)delete t.budget_tokens,delete t.budgetTokens;else{const c=Math.max(1024,Math.floor(n));t.budget_tokens=c,delete t.budgetTokens}return o.thinking=t,me(l.entry,d,o),i}const $="__unset__";function os(s){return s.providerKind==="openai"?"Writes: extraArgs.reasoning.effort":s.providerKind==="anthropic"?"Writes: extraArgs.thinking.{type,budget_tokens}":"Writes: extraArgs.reasoning_effort"}function ls({models:s,disabled:r,disabledReason:n,onEffortChange:i,onAnthropicBudgetChange:l}){const{t:d}=Z();return e.jsxs(y,{children:[e.jsx(b,{className:"pb-2",children:e.jsxs(v,{className:"text-base flex items-center gap-2",children:[e.jsx(_e,{className:"h-4 w-4"}),d("droidSettings.reasoningControls"),e.jsx(E,{variant:"outline",className:"text-[10px] font-normal",children:"customModels"})]})}),e.jsxs(N,{className:"space-y-3",children:[n&&e.jsx("p",{className:"text-xs text-amber-600",children:n}),s.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:"No BYOK custom models found in settings.json (`customModels` or `custom_models`)."}):e.jsx("div",{className:"space-y-2",children:s.map(o=>e.jsxs("div",{className:"rounded-md border p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-xs font-medium truncate",children:o.displayName}),e.jsx("p",{className:"text-[11px] font-mono text-muted-foreground truncate",children:o.model||"(missing model id)"})]}),e.jsx(E,{variant:"outline",className:"font-mono text-[10px] shrink-0",children:o.provider})]}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[11px] font-medium",children:d("codex.reasoningEffortCapitalized")}),e.jsxs(H,{value:o.effort??$,onValueChange:t=>i(o.id,t===$?null:t),disabled:r,children:[e.jsx(Q,{className:"h-8 text-xs",children:e.jsx(W,{placeholder:"Use provider default"})}),e.jsxs(Y,{children:[e.jsx(k,{value:$,children:"Use provider default"}),Ye.map(t=>e.jsx(k,{value:t,children:t},t))]})]})]}),o.providerKind==="anthropic"&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[11px] font-medium",children:d("codex.thinkingBudgetTokens")}),e.jsx(le,{type:"number",min:1024,step:1024,value:o.anthropicBudgetTokens??"",placeholder:"auto",className:"h-8 text-xs",disabled:r,onChange:t=>{const c=t.target.value.trim();if(!c){l(o.id,null);return}const m=Number.parseInt(c,10);Number.isFinite(m)&&l(o.id,Math.max(1024,m))}})]})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:os(o)})]},o.id))})]})]})}const T="__unset__",ds=[{key:"reasoningEffort",label:"Reasoning Effort",description:"none | medium | high | max",options:[{value:"none",label:"none"},{value:"medium",label:"medium"},{value:"high",label:"high"},{value:"max",label:"max"}]},{key:"autonomyLevel",label:"Autonomy Level",description:"suggest | aggressive | full",options:[{value:"suggest",label:"suggest"},{value:"aggressive",label:"aggressive"},{value:"full",label:"full"}]},{key:"diffMode",label:"Diff Mode",description:"auto | none | inline | split",options:[{value:"auto",label:"auto"},{value:"none",label:"none"},{value:"inline",label:"inline"},{value:"split",label:"split"}]}],cs=[{key:"todoEnabled",label:"Todo Enabled"},{key:"todoAutoRefresh",label:"Todo Auto Refresh"},{key:"autoCompactEnabled",label:"Auto Compact Enabled"},{key:"soundEnabled",label:"Sound Enabled"}],us=[{key:"maxTurns",label:"Max Turns",min:1,step:1},{key:"maxToolCalls",label:"Max Tool Calls",min:1,step:1},{key:"autoCompactThreshold",label:"Auto Compact Threshold",min:1e3,step:1e3}];function ms(s){return s===!0?"true":s===!1?"false":T}function xs(s){return s==="true"?!0:s==="false"?!1:null}function gs({values:s,disabled:r,disabledReason:n,onEnumSettingChange:i,onBooleanSettingChange:l,onNumberSettingChange:d}){const{t:o}=Z();return e.jsxs(y,{children:[e.jsx(b,{className:"pb-2",children:e.jsxs(v,{className:"text-base flex items-center gap-2",children:[e.jsx(De,{className:"h-4 w-4"}),o("droidSettings.quickControls"),e.jsx(E,{variant:"outline",className:"text-[10px] font-normal",children:"settings.json"})]})}),e.jsxs(N,{className:"space-y-4",children:[n&&e.jsx("p",{className:"text-xs text-amber-600",children:n}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[ds.map(t=>e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:t.label}),e.jsxs(H,{value:s[t.key]??T,onValueChange:c=>i(t.key,c===T?null:c),disabled:r,children:[e.jsx(Q,{className:"h-8 text-xs",children:e.jsx(W,{placeholder:o("codex.useDefault")})}),e.jsxs(Y,{children:[e.jsx(k,{value:T,children:o("codex.useDefault")}),t.options.map(c=>e.jsx(k,{value:c.value,children:c.label},c.value))]})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.description})]},t.key)),us.map(t=>e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:t.label}),e.jsx(le,{type:"number",min:t.min,step:t.step,value:s[t.key]??"",onChange:c=>{const m=c.target.value.trim();if(!m){d(t.key,null);return}const S=Number.parseInt(m,10);Number.isFinite(S)&&d(t.key,Math.max(t.min,S))},className:"h-8 text-xs",disabled:r})]},t.key)),cs.map(t=>e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:t.label}),e.jsxs(H,{value:ms(s[t.key]),onValueChange:c=>l(t.key,xs(c)),disabled:r,children:[e.jsx(Q,{className:"h-8 text-xs",children:e.jsx(W,{placeholder:o("codex.useDefault")})}),e.jsxs(Y,{children:[e.jsx(k,{value:T,children:o("codex.useDefault")}),e.jsx(k,{value:"true",children:"true"}),e.jsx(k,{value:"false",children:"false"})]})]})]},t.key))]})]})]})}const fs=[{id:"droid-cli-overview",label:"Droid CLI Overview",url:"https://docs.factory.ai/cli/",description:"Primary entry docs for setup, auth, and core CLI usage."},{id:"droid-byok-overview",label:"BYOK Overview",url:"https://docs.factory.ai/cli/byok/overview/",description:"BYOK model/provider shape, provider values, and migration notes."},{id:"droid-settings-reference",label:"settings.json Reference",url:"https://docs.factory.ai/cli/configuration/settings/",description:"Supported settings keys, defaults, and allowed values."}],hs=[{provider:"anthropic",label:"Anthropic Messages API",apiFormat:"Messages API",url:"https://docs.anthropic.com/en/api/messages"},{provider:"openai",label:"OpenAI Responses API",apiFormat:"Responses API",url:"https://platform.openai.com/docs/api-reference/responses"},{provider:"generic-chat-completion-api",label:"OpenAI Chat Completions Spec",apiFormat:"Chat Completions API",url:"https://platform.openai.com/docs/api-reference/chat"}];function ps(s){const r=/https?:\/\/[^\s)]+/g,n=[];let i=0,l;for(;(l=r.exec(s))!==null;){const[d]=l,o=l.index;o>i&&n.push(s.slice(i,o)),n.push(e.jsx("a",{href:d,target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:d},`${d}-${o}`)),i=o+d.length}return i<s.length&&n.push(s.slice(i)),n.length>0?n:[s]}function js(s){return!s||!Number.isFinite(s)?"N/A":new Date(s).toLocaleString()}function ys(s){return!s||s<=0?"0 B":s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(2)} MB`}function bs(s){try{const r=JSON.parse(s);return!r||typeof r!="object"||Array.isArray(r)?{valid:!1,error:"JSON root must be an object."}:{valid:!0,value:r}}catch(r){return{valid:!1,error:r.message}}}function z(s){return typeof s=="string"?s:null}function J(s){return typeof s=="number"&&Number.isFinite(s)?s:null}function _(s){return typeof s=="boolean"?s:null}function g({label:s,value:r,mono:n=!1}){return e.jsxs("div",{className:"flex items-start justify-between gap-3 text-sm",children:[e.jsx("span",{className:"text-muted-foreground shrink-0",children:s}),e.jsx("span",{className:Ce("text-right break-all",n&&"font-mono text-xs"),children:r})]})}function _s(){const{t:s}=Z(),{diagnostics:r,diagnosticsLoading:n,diagnosticsError:i,refetchDiagnostics:l,rawSettings:d,rawSettingsLoading:o,refetchRawSettings:t,saveRawSettingsAsync:c,isSavingRawSettings:m}=He(),[S,O]=q.useState(null),M=d?.rawText??"{}",B=S??M,ee=S!==null&&S!==M,u=bs(B),F=u.valid?{valid:!0}:{valid:!1,error:u.error},se=x=>{if(x===M){O(null);return}O(x)},L=x=>{se(JSON.stringify(x,null,2)+`
2
2
  `)},I=(x,w)=>{if(!u.valid){j.error(s("droidPage.fixJsonBeforeQuickSettings"));return}const P={...u.value};w==null?delete P[x]:P[x]=w,L(P)},xe=u.valid?{reasoningEffort:z(u.value.reasoningEffort),autonomyLevel:z(u.value.autonomyLevel),diffMode:z(u.value.diffMode),maxTurns:J(u.value.maxTurns),maxToolCalls:J(u.value.maxToolCalls),autoCompactThreshold:J(u.value.autoCompactThreshold),todoEnabled:_(u.value.todoEnabled),todoAutoRefresh:_(u.value.todoAutoRefresh),autoCompactEnabled:_(u.value.autoCompactEnabled),soundEnabled:_(u.value.soundEnabled)}:{reasoningEffort:null,autonomyLevel:null,diffMode:null,maxTurns:null,maxToolCalls:null,autoCompactThreshold:null,todoEnabled:null,todoAutoRefresh:null,autoCompactEnabled:null,soundEnabled:null},ge=u.valid?ns(u.value):[],fe=async()=>{await Promise.all([l(),t()])},he=async()=>{if(!F.valid){j.error(s("droidPage.invalidJson",{value:F.error}));return}try{await c({rawText:B,expectedMtime:d?.exists?d.mtime:void 0}),O(null),j.success(s("droidPage.saved"))}catch(x){Ee(x)?j.error(s("droidPage.changedExternally")):j.error(x.message||s("droidPage.failedSave"))}},re=r?.byok.customModels??[],te=q.useMemo(()=>Object.entries(r?.byok.providerBreakdown??{}).sort((x,w)=>w[1]-x[1]),[r?.byok.providerBreakdown]),pe=()=>{if(n)return e.jsxs("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:[e.jsx(Me,{className:"h-5 w-5 animate-spin mr-2"}),s("droidPage.loadingDiagnostics")]});if(i||!r)return e.jsx("div",{className:"flex h-full items-center justify-center text-destructive px-6 text-center",children:s("droidPage.failedDiagnostics")});const x=r.docsReference??{notes:[],links:[],providerDocs:[],providerValues:[],settingsHierarchy:[]},w=x.notes??[],P=x.links??[],ne=x.providerDocs??[],je=P.length>0?P:fs,ye=ne.length>0?ne:hs,be=x.providerValues??[],ve=x.settingsHierarchy??[],K="mt-0 h-full border-0 p-0 data-[state=inactive]:hidden";return e.jsxs(Se,{defaultValue:"byok",className:"h-full flex flex-col",children:[e.jsx("div",{className:"px-4 pt-4 shrink-0",children:e.jsxs(Pe,{className:"grid w-full grid-cols-3",children:[e.jsx(U,{value:"overview",children:s("droidPage.overview")}),e.jsx(U,{value:"byok",children:s("droidPage.byok")}),e.jsx(U,{value:"docs",children:s("droidPage.docs")})]})}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden px-4 pb-4 pt-3",children:[e.jsx(V,{value:"overview",className:K,children:e.jsx(A,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 pr-1",children:[e.jsxs(y,{children:[e.jsx(b,{className:"pb-2",children:e.jsxs(v,{className:"text-base flex items-center gap-2",children:[e.jsx(Be,{className:"h-4 w-4"}),s("droidPage.runtimeInstall")]})}),e.jsxs(N,{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:s("droidPage.status")}),e.jsx(E,{variant:r.binary.installed?"default":"secondary",children:r.binary.installed?s("droidPage.detected"):s("droidPage.notFound")})]}),e.jsx(g,{label:s("droidPage.detectionSource"),value:r.binary.source,mono:!0}),e.jsx(g,{label:s("droidPage.binaryPath"),value:r.binary.path||s("droidPage.notFound"),mono:!0}),e.jsx(g,{label:s("droidPage.installDirectory"),value:r.binary.installDir||"N/A",mono:!0}),e.jsx(g,{label:s("droidPage.version"),value:r.binary.version||"Unknown",mono:!0}),e.jsx(g,{label:s("droidPage.overridePath"),value:r.binary.overridePath||"Not set",mono:!0})]})]}),e.jsxs(y,{children:[e.jsx(b,{className:"pb-2",children:e.jsxs(v,{className:"text-base flex items-center gap-2",children:[e.jsx(Fe,{className:"h-4 w-4"}),s("droidPage.configFiles")]})}),e.jsx(N,{className:"space-y-3",children:[r.files.settings,r.files.legacyConfig].map(a=>e.jsxs("div",{className:"rounded-md border p-3 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"font-medium text-sm",children:a.label}),a.exists?e.jsx(Le,{className:"h-4 w-4 text-green-600"}):e.jsx(Ie,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(g,{label:s("droidPage.path"),value:a.path,mono:!0}),e.jsx(g,{label:s("droidPage.resolved"),value:a.resolvedPath,mono:!0}),e.jsx(g,{label:s("droidPage.size"),value:ys(a.sizeBytes)}),e.jsx(g,{label:s("droidPage.lastModified"),value:js(a.mtimeMs)}),a.parseError&&e.jsx("p",{className:"text-xs text-amber-600",children:s("droidPage.parseWarning",{value:a.parseError})}),a.readError&&e.jsx("p",{className:"text-xs text-destructive",children:s("droidPage.readWarning",{value:a.readError})})]},a.label))})]}),r.warnings.length>0&&e.jsxs(y,{className:"border-amber-200 bg-amber-50/50 dark:bg-amber-950/20",children:[e.jsx(b,{className:"pb-2",children:e.jsxs(v,{className:"text-base flex items-center gap-2",children:[e.jsx(Ke,{className:"h-4 w-4 text-amber-600"}),s("droidPage.warnings")]})}),e.jsx(N,{className:"space-y-1.5",children:r.warnings.map(a=>e.jsxs("p",{className:"text-sm text-amber-800 dark:text-amber-300",children:["- ",a]},a))})]})]})})}),e.jsx(V,{value:"byok",className:K,children:e.jsx(A,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 pr-1",children:[e.jsx(gs,{values:xe,disabled:o||!u.valid,disabledReason:u.valid?null:`Quick settings disabled: ${u.error}`,onEnumSettingChange:(a,f)=>{I(a,f)},onBooleanSettingChange:(a,f)=>{I(a,f)},onNumberSettingChange:(a,f)=>{I(a,f)}}),e.jsx(ls,{models:ge,disabled:o||!u.valid,disabledReason:u.valid?null:`${s("droidPage.byok")}: ${u.error}`,onEffortChange:(a,f)=>{if(!u.valid){j.error(s("droidPage.fixJsonBeforeReasoning"));return}const C=as(u.value,a,f);if(!C){j.error(s("droidPage.unableUpdateReasoning"));return}L(C)},onAnthropicBudgetChange:(a,f)=>{if(!u.valid){j.error(s("droidPage.fixJsonBeforeBudget"));return}const C=is(u.value,a,f);if(!C){j.error(s("droidPage.anthropicOnlyBudget"));return}L(C)}}),e.jsxs(y,{children:[e.jsx(b,{className:"pb-2",children:e.jsxs(v,{className:"text-base flex items-center gap-2",children:[e.jsx(Ue,{className:"h-4 w-4"}),s("droidPage.byokSummary")]})}),e.jsxs(N,{className:"space-y-2",children:[e.jsx(g,{label:s("droidPage.activeModelSelector"),value:r.byok.activeModelSelector||"Not set",mono:!0}),e.jsx(g,{label:s("droidPage.customModels"),value:String(r.byok.customModelCount)}),e.jsx(g,{label:s("droidPage.ccsManaged"),value:String(r.byok.ccsManagedCount)}),e.jsx(g,{label:s("droidPage.userManaged"),value:String(r.byok.userManagedCount)}),e.jsx(g,{label:s("droidPage.malformedEntries"),value:String(r.byok.invalidModelEntryCount)}),e.jsx(R,{}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s("droidPage.providers")}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[te.length===0&&e.jsx(E,{variant:"secondary",className:"font-mono",children:s("droidPage.none")}),te.map(([a,f])=>e.jsxs(E,{variant:"outline",className:"font-mono text-xs",children:[a,": ",f]},a))]})]})]})]}),e.jsxs(y,{children:[e.jsx(b,{className:"pb-2",children:e.jsx(v,{className:"text-base",children:s("droidPage.customModelsTitle")})}),e.jsx(N,{children:e.jsxs("div",{className:"rounded-md border overflow-hidden",children:[e.jsxs("div",{className:"grid grid-cols-[2fr_1fr_2fr] bg-muted/40 px-3 py-2 text-xs font-medium",children:[e.jsx("span",{children:s("droidPage.modelName")}),e.jsx("span",{children:s("droidPage.provider")}),e.jsx("span",{children:s("droidPage.baseUrl")})]}),e.jsx(A,{className:"h-52",children:e.jsxs("div",{className:"divide-y",children:[re.length===0&&e.jsx("div",{className:"px-3 py-4 text-xs text-muted-foreground",children:s("droidPage.noCustomModels")}),re.map(a=>e.jsxs("div",{className:"grid grid-cols-[2fr_1fr_2fr] gap-2 px-3 py-2 text-xs",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:a.displayName}),e.jsx("p",{className:"text-muted-foreground font-mono truncate",children:a.model})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate",children:a.provider}),e.jsx("p",{className:"text-muted-foreground",children:a.apiKeyPreview||"no-key"})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate",title:a.baseUrl,children:a.host||a.baseUrl}),e.jsx("p",{className:"text-muted-foreground font-mono truncate",children:a.baseUrl})]})]},`${a.displayName}-${a.model}-${a.baseUrl}`))]})})]})})]})]})})}),e.jsx(V,{value:"docs",className:K,children:e.jsx(A,{className:"h-full",children:e.jsx("div",{className:"space-y-4 pr-1",children:e.jsxs(y,{children:[e.jsx(b,{className:"pb-2",children:e.jsxs(v,{className:"text-base flex items-center gap-2",children:[e.jsx(Ve,{className:"h-4 w-4"}),s("droidPage.docsAlignedNotes")]})}),e.jsxs(N,{className:"space-y-2 text-sm",children:[w.map((a,f)=>e.jsxs("p",{className:"text-muted-foreground",children:["- ",ps(a)]},`${f}-${a}`)),e.jsx(R,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:s("droidPage.factoryDocs")}),e.jsx("div",{className:"space-y-1.5",children:je.map(a=>e.jsxs("a",{href:a.url,target:"_blank",rel:"noreferrer",className:"block rounded-md border px-2.5 py-2 transition-colors hover:bg-muted/50",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-xs font-medium",children:a.label}),e.jsx(oe,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),e.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:a.description}),e.jsx("p",{className:"mt-1 break-all font-mono text-[11px] text-muted-foreground/90 underline underline-offset-2",children:a.url})]},a.id))})]}),e.jsx(R,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:s("droidPage.providerFactCheckDocs")}),e.jsx("div",{className:"space-y-1.5",children:ye.map(a=>e.jsxs("a",{href:a.url,target:"_blank",rel:"noreferrer",className:"block rounded-md border px-2.5 py-2 transition-colors hover:bg-muted/50",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-xs font-medium",children:a.label}),e.jsx(oe,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),e.jsxs("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:["provider: ",a.provider," | format: ",a.apiFormat]}),e.jsx("p",{className:"mt-1 break-all font-mono text-[11px] text-muted-foreground/90 underline underline-offset-2",children:a.url})]},`${a.provider}-${a.url}`))})]}),e.jsx(R,{}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("droidPage.providerValues",{value:be.join(", ")})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("droidPage.settingsHierarchy",{value:ve.join(" -> ")})})]})]})})})})]})]})};return e.jsx("div",{className:"h-full min-h-0 overflow-hidden",children:e.jsxs(we,{direction:"horizontal",className:"h-full",children:[e.jsx(ae,{defaultSize:45,minSize:35,children:e.jsx("div",{className:"h-full border-r bg-muted/20",children:pe()})}),e.jsx(ke,{className:"w-2 bg-border hover:bg-primary/20 transition-colors cursor-col-resize flex items-center justify-center group",children:e.jsx(Oe,{className:"w-3 h-3 text-muted-foreground group-hover:text-primary"})}),e.jsx(ae,{defaultSize:55,minSize:35,children:e.jsx(Re,{title:s("droidPage.settingsTitle"),pathLabel:d?.path||"~/.factory/settings.json",loading:o,parseWarning:d?.parseError,value:B,dirty:ee,saving:m,saveDisabled:!ee||m||o||!F.valid,onChange:x=>{se(x)},onSave:he,onRefresh:fe})})]})})}export{_s as DroidPage};
@@ -1 +1 @@
1
- import{j as e}from"./radix-ui-nu4wz29m.js";import{r as g}from"./react-vendor-Bjx91N7w.js";import{by as C,bz as w,a as G,bA as y,bi as k,bk as S,x as R,aJ as A,e as f,I as j}from"./index-BcfwoMDm.js";import{R as N,x as D,y as L,au as T,aa as I}from"./icons-DSLG1YsC.js";import"./tanstack-bhJxV1h8.js";import"./notifications-B4_o8bcr.js";import"./utils-CzKF5WmX.js";import"./form-utils-CuHzLhJZ.js";import"./charts-eIPy2oG6.js";function _(){const{state:s}=C(),n=w(),[o,r]=g.useState(""),[c,m]=g.useState(""),u=g.useCallback(async()=>{try{n.setGlobalEnvLoading(!0),n.setGlobalEnvError(null);const a=await fetch("/api/global-env");if(!a.ok)throw new Error("Failed to load Global Env config");const l=await a.json();n.setGlobalEnvConfig(l)}catch(a){n.setGlobalEnvError(a.message)}finally{n.setGlobalEnvLoading(!1)}},[n]),i=g.useCallback(async a=>{const l=s.globalEnvConfig;if(!l)return;const x={...l,...a};n.setGlobalEnvConfig(x);try{n.setGlobalEnvSaving(!0),n.setGlobalEnvError(null);const d=await fetch("/api/global-env",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)});if(!d.ok){const h=await d.json();throw new Error(h.error||"Failed to save")}const v=await d.json();n.setGlobalEnvConfig(v.config),n.setGlobalEnvSuccess(!0),setTimeout(()=>n.setGlobalEnvSuccess(!1),1500)}catch(d){n.setGlobalEnvConfig(l),n.setGlobalEnvError(d.message)}finally{n.setGlobalEnvSaving(!1)}},[s.globalEnvConfig,n]),E=g.useCallback(()=>{if(!o.trim()||!s.globalEnvConfig)return;const a={...s.globalEnvConfig.env,[o.trim()]:c};i({env:a}),r(""),m("")},[o,c,s.globalEnvConfig,i]),b=g.useCallback(a=>{if(!s.globalEnvConfig)return;const l={...s.globalEnvConfig.env};delete l[a],i({env:l})},[s.globalEnvConfig,i]);return{config:s.globalEnvConfig,loading:s.globalEnvLoading,saving:s.globalEnvSaving,error:s.globalEnvError,success:s.globalEnvSuccess,newEnvKey:o,setNewEnvKey:r,newEnvValue:c,setNewEnvValue:m,fetchConfig:u,saveConfig:i,addEnvVar:E,removeEnvVar:b}}function J(){const{t:s}=G(),{config:n,loading:o,saving:r,error:c,success:m,newEnvKey:u,setNewEnvKey:i,newEnvValue:E,setNewEnvValue:b,fetchConfig:a,saveConfig:l,addEnvVar:x,removeEnvVar:d}=_(),{fetchRawConfig:v}=y();g.useEffect(()=>{a(),v()},[a,v]);const h=()=>{l({enabled:!n?.enabled})};return o?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx(N,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:s("settings.loading")})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`absolute left-5 right-5 top-20 z-10 transition-all duration-200 ease-out ${c||m?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[c&&e.jsxs(k,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(D,{className:"h-4 w-4"}),e.jsx(S,{children:c})]}),m&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-md border border-green-200 bg-green-50 text-green-700 shadow-lg dark:border-green-900/50 dark:bg-green-900/90 dark:text-green-300",children:[e.jsx(L,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:s("settings.saved")})]})]}),e.jsx(R,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("settingsGlobalEnv.description")}),e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:n?.enabled?s("settingsGlobalEnv.enabled"):s("settingsGlobalEnv.disabled")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:n?.enabled?s("settingsGlobalEnv.enabledDesc"):s("settingsGlobalEnv.disabledDesc")})]}),e.jsx(A,{checked:n?.enabled??!0,onCheckedChange:h})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:s("settingsGlobalEnv.envVars")}),n?.env&&Object.keys(n.env).length>0?e.jsx("div",{className:"space-y-2",children:Object.entries(n.env).map(([t,p])=>e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg border bg-background",children:[e.jsx("code",{className:"flex-1 font-mono text-sm truncate",children:t}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("code",{className:"font-mono text-sm px-2 py-1 bg-muted rounded",children:p}),e.jsx(f,{variant:"ghost",size:"sm",onClick:()=>d(t),disabled:r,className:"h-8 w-8 p-0 text-destructive hover:text-destructive hover:bg-destructive/10",children:e.jsx(T,{className:"w-4 h-4"})})]},t))}):e.jsx("div",{className:"p-4 rounded-lg border border-dashed text-center text-muted-foreground",children:e.jsx("p",{children:s("settingsGlobalEnv.noneConfigured")})}),e.jsxs("div",{className:"p-4 rounded-lg border bg-muted/30",children:[e.jsx("h4",{className:"text-sm font-medium mb-3",children:s("settingsGlobalEnv.addNew")}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(j,{value:u,onChange:t=>i(t.target.value.toUpperCase()),placeholder:s("settingsGlobalEnv.keyName"),className:"flex-1 font-mono text-sm h-9",disabled:r}),e.jsx("span",{className:"flex items-center text-muted-foreground",children:"="}),e.jsx(j,{value:E,onChange:t=>b(t.target.value),placeholder:s("settingsGlobalEnv.value"),className:"flex-1 font-mono text-sm h-9",disabled:r}),e.jsxs(f,{size:"sm",onClick:x,disabled:r||!u.trim(),className:"h-9",children:[e.jsx(I,{className:"w-4 h-4 mr-1"}),s("settingsGlobalEnv.add")]})]})]}),e.jsxs("div",{className:"p-4 rounded-lg border bg-muted/30",children:[e.jsx("h4",{className:"text-sm font-medium mb-3",children:s("settingsGlobalEnv.quickAdd")}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[[{key:"DISABLE_BUG_COMMAND",value:"1"},{key:"DISABLE_ERROR_REPORTING",value:"1"},{key:"DISABLE_TELEMETRY",value:"1"}].map(({key:t,value:p})=>!n?.env?.[t]&&e.jsxs(f,{variant:"outline",size:"sm",onClick:()=>{i(t),b(p)},className:"text-xs font-mono",children:["+ ",t]},t)),n?.env&&["DISABLE_BUG_COMMAND","DISABLE_ERROR_REPORTING","DISABLE_TELEMETRY"].every(t=>n.env[t])&&e.jsx("span",{className:"text-sm text-muted-foreground",children:s("settingsGlobalEnv.allConfigured")})]})]})]})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(f,{variant:"outline",size:"sm",onClick:()=>{a(),v()},disabled:o||r,className:"w-full",children:[e.jsx(N,{className:`w-4 h-4 mr-2 ${o?"animate-spin":""}`}),s("settings.refresh")]})})]})}export{J as default};
1
+ import{j as e}from"./radix-ui-nu4wz29m.js";import{r as g}from"./react-vendor-Bjx91N7w.js";import{by as C,bz as w,a as G,bA as y,bi as k,bk as S,x as R,aJ as A,e as f,I as j}from"./index-B2JEyN3d.js";import{R as N,x as D,y as L,au as T,aa as I}from"./icons-DSLG1YsC.js";import"./tanstack-bhJxV1h8.js";import"./notifications-B4_o8bcr.js";import"./utils-CzKF5WmX.js";import"./form-utils-CuHzLhJZ.js";import"./charts-eIPy2oG6.js";function _(){const{state:s}=C(),n=w(),[o,r]=g.useState(""),[c,m]=g.useState(""),u=g.useCallback(async()=>{try{n.setGlobalEnvLoading(!0),n.setGlobalEnvError(null);const a=await fetch("/api/global-env");if(!a.ok)throw new Error("Failed to load Global Env config");const l=await a.json();n.setGlobalEnvConfig(l)}catch(a){n.setGlobalEnvError(a.message)}finally{n.setGlobalEnvLoading(!1)}},[n]),i=g.useCallback(async a=>{const l=s.globalEnvConfig;if(!l)return;const x={...l,...a};n.setGlobalEnvConfig(x);try{n.setGlobalEnvSaving(!0),n.setGlobalEnvError(null);const d=await fetch("/api/global-env",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)});if(!d.ok){const h=await d.json();throw new Error(h.error||"Failed to save")}const v=await d.json();n.setGlobalEnvConfig(v.config),n.setGlobalEnvSuccess(!0),setTimeout(()=>n.setGlobalEnvSuccess(!1),1500)}catch(d){n.setGlobalEnvConfig(l),n.setGlobalEnvError(d.message)}finally{n.setGlobalEnvSaving(!1)}},[s.globalEnvConfig,n]),E=g.useCallback(()=>{if(!o.trim()||!s.globalEnvConfig)return;const a={...s.globalEnvConfig.env,[o.trim()]:c};i({env:a}),r(""),m("")},[o,c,s.globalEnvConfig,i]),b=g.useCallback(a=>{if(!s.globalEnvConfig)return;const l={...s.globalEnvConfig.env};delete l[a],i({env:l})},[s.globalEnvConfig,i]);return{config:s.globalEnvConfig,loading:s.globalEnvLoading,saving:s.globalEnvSaving,error:s.globalEnvError,success:s.globalEnvSuccess,newEnvKey:o,setNewEnvKey:r,newEnvValue:c,setNewEnvValue:m,fetchConfig:u,saveConfig:i,addEnvVar:E,removeEnvVar:b}}function J(){const{t:s}=G(),{config:n,loading:o,saving:r,error:c,success:m,newEnvKey:u,setNewEnvKey:i,newEnvValue:E,setNewEnvValue:b,fetchConfig:a,saveConfig:l,addEnvVar:x,removeEnvVar:d}=_(),{fetchRawConfig:v}=y();g.useEffect(()=>{a(),v()},[a,v]);const h=()=>{l({enabled:!n?.enabled})};return o?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx(N,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:s("settings.loading")})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`absolute left-5 right-5 top-20 z-10 transition-all duration-200 ease-out ${c||m?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[c&&e.jsxs(k,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(D,{className:"h-4 w-4"}),e.jsx(S,{children:c})]}),m&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-md border border-green-200 bg-green-50 text-green-700 shadow-lg dark:border-green-900/50 dark:bg-green-900/90 dark:text-green-300",children:[e.jsx(L,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:s("settings.saved")})]})]}),e.jsx(R,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("settingsGlobalEnv.description")}),e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:n?.enabled?s("settingsGlobalEnv.enabled"):s("settingsGlobalEnv.disabled")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:n?.enabled?s("settingsGlobalEnv.enabledDesc"):s("settingsGlobalEnv.disabledDesc")})]}),e.jsx(A,{checked:n?.enabled??!0,onCheckedChange:h})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:s("settingsGlobalEnv.envVars")}),n?.env&&Object.keys(n.env).length>0?e.jsx("div",{className:"space-y-2",children:Object.entries(n.env).map(([t,p])=>e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg border bg-background",children:[e.jsx("code",{className:"flex-1 font-mono text-sm truncate",children:t}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("code",{className:"font-mono text-sm px-2 py-1 bg-muted rounded",children:p}),e.jsx(f,{variant:"ghost",size:"sm",onClick:()=>d(t),disabled:r,className:"h-8 w-8 p-0 text-destructive hover:text-destructive hover:bg-destructive/10",children:e.jsx(T,{className:"w-4 h-4"})})]},t))}):e.jsx("div",{className:"p-4 rounded-lg border border-dashed text-center text-muted-foreground",children:e.jsx("p",{children:s("settingsGlobalEnv.noneConfigured")})}),e.jsxs("div",{className:"p-4 rounded-lg border bg-muted/30",children:[e.jsx("h4",{className:"text-sm font-medium mb-3",children:s("settingsGlobalEnv.addNew")}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(j,{value:u,onChange:t=>i(t.target.value.toUpperCase()),placeholder:s("settingsGlobalEnv.keyName"),className:"flex-1 font-mono text-sm h-9",disabled:r}),e.jsx("span",{className:"flex items-center text-muted-foreground",children:"="}),e.jsx(j,{value:E,onChange:t=>b(t.target.value),placeholder:s("settingsGlobalEnv.value"),className:"flex-1 font-mono text-sm h-9",disabled:r}),e.jsxs(f,{size:"sm",onClick:x,disabled:r||!u.trim(),className:"h-9",children:[e.jsx(I,{className:"w-4 h-4 mr-1"}),s("settingsGlobalEnv.add")]})]})]}),e.jsxs("div",{className:"p-4 rounded-lg border bg-muted/30",children:[e.jsx("h4",{className:"text-sm font-medium mb-3",children:s("settingsGlobalEnv.quickAdd")}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[[{key:"DISABLE_BUG_COMMAND",value:"1"},{key:"DISABLE_ERROR_REPORTING",value:"1"},{key:"DISABLE_TELEMETRY",value:"1"}].map(({key:t,value:p})=>!n?.env?.[t]&&e.jsxs(f,{variant:"outline",size:"sm",onClick:()=>{i(t),b(p)},className:"text-xs font-mono",children:["+ ",t]},t)),n?.env&&["DISABLE_BUG_COMMAND","DISABLE_ERROR_REPORTING","DISABLE_TELEMETRY"].every(t=>n.env[t])&&e.jsx("span",{className:"text-sm text-muted-foreground",children:s("settingsGlobalEnv.allConfigured")})]})]})]})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(f,{variant:"outline",size:"sm",onClick:()=>{a(),v()},disabled:o||r,className:"w-full",children:[e.jsx(N,{className:`w-4 h-4 mr-2 ${o?"animate-spin":""}`}),s("settings.refresh")]})})]})}export{J as default};
@@ -1 +1 @@
1
- import{j as e}from"./radix-ui-nu4wz29m.js";import{a as u,c as l,e as x,O as C,Q as E,R as k,S as m}from"./index-BcfwoMDm.js";import{r as h}from"./react-vendor-Bjx91N7w.js";import{u as _,a as A,b as O}from"./tanstack-bhJxV1h8.js";import{t as p}from"./notifications-B4_o8bcr.js";import{b9 as g,C as N,a0 as v,p as w,R as b,_ as R,x as F,T as P,aj as y,$ as H}from"./icons-DSLG1YsC.js";import{m as j,A as I}from"./proxy-C4-M_9kB.js";import"./utils-CzKF5WmX.js";import"./form-utils-CuHzLhJZ.js";import"./charts-eIPy2oG6.js";function M(){return _({queryKey:["health"],queryFn:async()=>(await fetch("/api/health")).json(),refetchInterval:3e4})}function S(){const s=A();return O({mutationFn:async a=>{const t=await fetch(`/api/health/fix/${a}`,{method:"POST"}),r=await t.json();if(!t.ok)throw new Error(r.message);return r},onSuccess:a=>{s.invalidateQueries({queryKey:["health"]}),p.success(a.message)},onError:a=>{p.error(a.message)}})}const q={ok:{dot:"bg-green-500",label:"OK",labelColor:"text-green-500"},warning:{dot:"bg-yellow-500",label:"WARN",labelColor:"text-yellow-500"},error:{dot:"bg-red-500",label:"ERR",labelColor:"text-red-500"},info:{dot:"bg-blue-500",label:"INFO",labelColor:"text-blue-500"}};function z({check:s}){const{t:a}=u(),t=S(),r=q[s.status],[n,i]=h.useState(!1),o=s.details||s.fix,c=d=>{navigator.clipboard.writeText(d),p.success(a("health.copied"))};return o?e.jsx(C,{open:n,onOpenChange:i,children:e.jsxs("div",{className:l("group rounded-lg border transition-all duration-150",n?"border-border bg-muted/30":"border-transparent hover:border-border/50 hover:bg-muted/50"),children:[e.jsx(E,{asChild:!0,children:e.jsxs("button",{className:"w-full flex items-center gap-3 px-3 py-2 text-left",children:[e.jsxs("div",{className:"relative flex items-center justify-center w-4 h-4",children:[e.jsx("div",{className:l("w-2 h-2 rounded-full",r.dot)}),s.status!=="ok"&&e.jsx("div",{className:l("absolute w-2 h-2 rounded-full animate-ping opacity-75",r.dot)})]}),e.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:s.name}),e.jsxs("span",{className:l("font-mono text-xs font-semibold",r.labelColor),children:["[",r.label,"]"]}),e.jsx(N,{className:l("w-4 h-4 text-muted-foreground transition-transform duration-200",n&&"rotate-90")})]})}),e.jsx(k,{children:e.jsxs("div",{className:"px-3 pb-3 pt-1 space-y-2 ml-7",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s.message}),s.details&&e.jsx("pre",{className:"text-xs font-mono text-muted-foreground bg-background/50 rounded p-2 overflow-x-auto border border-border/50",children:s.details}),s.fix&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex-1 flex items-center gap-2 bg-background/50 rounded px-2 py-1.5 border border-border/50",children:[e.jsx(v,{className:"w-3 h-3 text-muted-foreground shrink-0"}),e.jsx("code",{className:"text-xs font-mono flex-1 truncate",children:s.fix}),e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>s.fix&&c(s.fix),className:"h-5 w-5 p-0",children:e.jsx(w,{className:"w-3 h-3"})})]}),s.fixable&&s.status!=="ok"&&e.jsxs(x,{size:"sm",onClick:()=>t.mutate(s.id),disabled:t.isPending,className:"h-7 px-3 text-xs",children:[e.jsx(g,{className:"w-3 h-3 mr-1"}),a("health.applyFix")]})]})]})})]})}):e.jsxs("div",{className:l("group flex items-center gap-3 px-3 py-2 rounded-lg","hover:bg-muted/50 transition-colors duration-150","border border-transparent hover:border-border/50"),children:[e.jsxs("div",{className:"relative flex items-center justify-center w-4 h-4",children:[e.jsx("div",{className:l("w-2 h-2 rounded-full",r.dot)}),s.status!=="ok"&&e.jsx("div",{className:l("absolute w-2 h-2 rounded-full animate-ping opacity-75",r.dot)})]}),e.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:s.name}),e.jsxs("span",{className:l("font-mono text-xs font-semibold",r.labelColor),children:["[",r.label,"]"]}),s.fixable&&s.status!=="ok"&&e.jsxs(x,{size:"sm",variant:"ghost",onClick:()=>t.mutate(s.id),disabled:t.isPending,className:"h-6 px-2 text-xs opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsx(g,{className:"w-3 h-3 mr-1"}),a("health.fix")]})]})}function D(s,a){const t=Math.floor((Date.now()-s)/1e3);if(t<5)return a("health.justNow");if(t<60)return a("health.secondsAgo",{count:t});const r=Math.floor(t/60);if(r<60)return a("health.minutesAgo",{count:r});const n=Math.floor(r/60);return a("health.hoursAgo",{count:n})}function Q({summary:s,version:a,lastScan:t,isLoading:r,onRefresh:n}){const{t:i}=u(),[,o]=h.useState(0);h.useEffect(()=>{const f=setInterval(()=>o(T=>T+1),1e3);return()=>clearInterval(f)},[]);const c=()=>{navigator.clipboard.writeText("ccs doctor"),p.success(i("health.copied"))},d=s.errors>0||s.warnings>0;return e.jsxs("div",{className:l("group relative overflow-hidden rounded-2xl border transition-all duration-500",d?"bg-rose-500/5 border-rose-500/20 shadow-[0_0_20px_-12px_rgba(244,63,94,0.3)]":"bg-emerald-500/5 border-emerald-500/20 shadow-[0_0_20px_-12px_rgba(16,185,129,0.3)]"),children:[e.jsx("div",{className:l("absolute inset-0 opacity-[0.05] blur-3xl pointer-events-none transition-colors duration-1000",d?"bg-rose-500":"bg-emerald-500")}),e.jsxs("div",{className:"relative flex flex-col md:flex-row items-center gap-4 px-6 py-4",children:[e.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:l("w-2.5 h-2.5 rounded-full",d?"bg-rose-500":"bg-emerald-500")}),e.jsx("div",{className:l("absolute inset-0 rounded-full animate-ping opacity-40",d?"bg-rose-500":"bg-emerald-500")})]}),e.jsx("h1",{className:"font-mono text-sm font-bold tracking-tight uppercase",children:i(d?"health.issuesDetected":"health.systemOptimal")})]}),e.jsx("div",{className:"hidden md:block h-4 w-px bg-border/50"}),e.jsxs("div",{className:"flex items-center gap-6 text-xs font-mono",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-muted-foreground uppercase text-[10px] tracking-widest",children:"Checks"}),e.jsx("span",{children:s.total})]}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-muted-foreground uppercase text-[10px] tracking-widest",children:"Passed"}),e.jsx("span",{className:"text-emerald-500",children:s.passed})]}),s.warnings>0&&e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-muted-foreground uppercase text-[10px] tracking-widest",children:"Warnings"}),e.jsx("span",{className:"text-amber-500 font-bold",children:s.warnings})]}),s.errors>0&&e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-muted-foreground uppercase text-[10px] tracking-widest",children:"Errors"}),e.jsx("span",{className:"text-rose-500 font-bold underline decoration-rose-500/30",children:s.errors})]})]}),e.jsx("div",{className:"flex-1"}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex flex-col items-end text-[10px] font-mono text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(b,{className:l("w-2.5 h-2.5",r&&"animate-spin")}),e.jsx("span",{children:t?D(t,i):"--"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 opacity-60",children:[e.jsx(R,{className:"w-2.5 h-2.5"}),e.jsx("span",{children:a})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(x,{variant:"ghost",size:"sm",onClick:c,className:"h-8 px-3 gap-2 font-mono text-[10px] bg-background/40 hover:bg-background/60 border border-border/40 rounded-full",children:[e.jsx(v,{className:"w-3 h-3"}),e.jsx("span",{className:"hidden sm:inline",children:"ccs doctor"}),e.jsx(w,{className:"w-3 h-3 opacity-40"})]}),e.jsx(x,{variant:"ghost",size:"icon",onClick:n,disabled:r,className:"h-8 w-8 rounded-full bg-background/40 hover:bg-background/60 border border-border/40",children:e.jsx(b,{className:l("w-3.5 h-3.5",r&&"animate-spin")})})]})]})]})]})}function $({check:s}){const{t:a}=u(),t=S(),r=!!(s.details||s.fix||s.fixable),[n,i]=h.useState(!1),o=s.status==="error",c=o?F:P,d=()=>{s.fix&&(navigator.clipboard.writeText(s.fix),p.success(a("health.copied")))},f=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:l("flex items-center justify-center w-12 h-12 rounded-2xl shrink-0",o?"bg-rose-500/10 text-rose-500":"bg-amber-500/10 text-amber-500"),children:e.jsx(c,{className:"w-6 h-6"})}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-bold tracking-tight",children:s.name}),r&&e.jsx("div",{className:"p-1 hover:bg-muted rounded-full transition-colors",children:e.jsx(N,{className:l("w-5 h-5 text-muted-foreground transition-transform",n&&"rotate-90")})})]}),e.jsx("p",{className:"text-sm font-medium leading-relaxed text-muted-foreground/80",children:s.message})]})]});return e.jsx(j.div,{layout:!0,initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,scale:.95},className:l("group relative overflow-hidden rounded-[2rem] p-px transition-all duration-300",o?"bg-gradient-to-br from-rose-500/20 via-rose-500/5 to-transparent":"bg-gradient-to-br from-amber-500/20 via-amber-500/5 to-transparent"),children:e.jsxs("div",{className:"relative h-full rounded-[calc(2rem-1px)] bg-background/80 backdrop-blur-md overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 rounded-[calc(2rem-1px)] shadow-[inset_0_1px_1px_rgba(255,255,255,0.1)] pointer-events-none"}),e.jsxs("div",{className:"p-6",children:[r?e.jsx("button",{type:"button",onClick:()=>i(!n),"aria-expanded":n,"aria-label":n?`Collapse ${s.name} details`:`Expand ${s.name} details`,className:"flex w-full select-none items-start gap-4 rounded-2xl text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",children:f}):e.jsx("div",{className:"flex w-full items-start gap-4",children:f}),e.jsx(I,{children:n&&e.jsx(j.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.3,ease:[.32,.72,0,1]},className:"overflow-hidden",children:e.jsxs("div",{className:"mt-4 pt-4 border-t border-border/40 space-y-4",children:[s.details&&e.jsx("div",{className:"rounded-xl bg-muted/30 p-3 font-mono text-[11px] leading-relaxed text-muted-foreground break-all",children:s.details}),(s.fix||s.fixable)&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-3",children:[s.fix&&e.jsxs("div",{className:"flex-1 flex items-center gap-2 h-10 px-3 rounded-full bg-background/50 border border-border/40",children:[e.jsx(v,{className:"w-3.5 h-3.5 text-muted-foreground"}),e.jsx("code",{className:"text-xs font-mono flex-1 truncate",children:s.fix}),e.jsx(x,{variant:"ghost",size:"icon",onClick:d,"aria-label":a("health.copy")??"Copy fix command",className:"h-6 w-6 rounded-full text-muted-foreground hover:text-foreground",children:e.jsx(w,{className:"w-3 h-3"})})]}),s.fixable&&e.jsxs(x,{onClick:()=>t.mutate(s.id),disabled:t.isPending,className:l("h-10 px-6 rounded-full font-bold shadow-lg shadow-primary/20 transition-all active:scale-95",o?"bg-rose-500 hover:bg-rose-600":"bg-amber-500 hover:bg-amber-600"),children:[t.isPending?e.jsx(b,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(g,{className:"w-4 h-4 mr-2"}),a("health.applyFix")]})]})]})})})]})]})})}function B({checks:s}){const{t:a}=u();return s.length===0?null:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3 px-1",children:[e.jsx("h2",{className:"text-sm font-bold tracking-widest uppercase text-muted-foreground/60",children:a("health.attentionRequired")}),e.jsx("div",{className:"h-px flex-1 bg-border/40"}),e.jsx("span",{className:"font-mono text-xs text-rose-500 font-bold",children:s.length})]}),e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:e.jsx(I,{mode:"popLayout",children:s.map(t=>e.jsx($,{check:t},t.id))})})]})}function K({groups:s}){const{t:a}=u();return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3 px-1",children:[e.jsx("h2",{className:"text-sm font-bold tracking-widest uppercase text-muted-foreground/60",children:a("health.environmentAudit")}),e.jsx("div",{className:"h-px flex-1 bg-border/40"}),e.jsx(y,{className:"w-4 h-4 text-emerald-500/60"})]}),e.jsx("div",{className:"space-y-4",children:s.map(t=>e.jsx(W,{group:t},t.id))})]})}function W({group:s}){const[a,t]=h.useState(!1),r=s.checks.filter(i=>i.status==="error"||i.status==="warning").length,n=r>0;return e.jsx(C,{open:a,onOpenChange:t,className:"group/audit",children:e.jsxs("div",{className:l("rounded-2xl border transition-all duration-300",a?"bg-muted/30 border-border/60":"bg-background hover:border-border/60"),children:[e.jsx(E,{asChild:!0,children:e.jsxs("button",{className:"w-full flex items-center gap-4 px-5 py-4 text-left",children:[e.jsx("div",{className:l("flex items-center justify-center w-8 h-8 rounded-full transition-colors",n?"bg-rose-500/10 text-rose-500":"bg-muted text-muted-foreground"),children:n?e.jsx(H,{className:"w-4 h-4"}):e.jsx(y,{className:"w-4 h-4"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-sm font-bold tracking-tight",children:s.name}),e.jsxs("p",{className:"text-[10px] text-muted-foreground uppercase tracking-widest font-mono",children:[s.checks.length," Checks"]})]}),n&&e.jsx("div",{className:"px-2 py-0.5 rounded-full bg-rose-500/10 text-rose-500 text-[10px] font-bold font-mono",children:r}),e.jsx(N,{className:l("w-4 h-4 text-muted-foreground transition-transform duration-300",a&&"rotate-90")})]})}),e.jsx(k,{children:e.jsx("div",{className:"px-5 pb-5 space-y-1",children:s.checks.map(i=>e.jsx(z,{check:i},i.id))})})]})})}function L(){return e.jsxs("div",{className:"p-6 max-w-6xl mx-auto space-y-12",children:[e.jsx(m,{className:"h-20 w-full rounded-2xl"}),e.jsxs("div",{className:"space-y-16",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsx(m,{className:"h-4 w-48"}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsx(m,{className:"h-40 rounded-[2rem]"}),e.jsx(m,{className:"h-40 rounded-[2rem]"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(m,{className:"h-4 w-48"}),[1,2,3].map(s=>e.jsx(m,{className:"h-16 rounded-2xl"},s))]})]})]})}function te(){const{t:s}=u(),{data:a,isLoading:t,refetch:r,dataUpdatedAt:n}=M();if(t&&!a)return e.jsx(L,{});const i=a?.checks.filter(c=>c.status==="error"||c.status==="warning")??[],o=i.length>0;return e.jsxs("div",{className:"relative pb-20 overflow-hidden",children:[e.jsxs("div",{className:"absolute inset-0 pointer-events-none",children:[e.jsx("div",{className:l("absolute top-[5%] -left-[5%] w-[60%] h-[60%] blur-[100px] rounded-full opacity-[0.08] transition-colors duration-1000",o?"bg-rose-500":"bg-emerald-500")}),e.jsx("div",{className:l("absolute -bottom-[5%] -right-[5%] w-[50%] h-[50%] blur-[100px] rounded-full opacity-[0.06] transition-colors duration-1000",o?"bg-amber-500":"bg-blue-500")}),e.jsx("div",{className:"absolute inset-0 opacity-[0.03] mix-blend-overlay",style:{backgroundImage:`url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E")`}})]}),e.jsxs("div",{className:"relative p-6 max-w-6xl mx-auto space-y-12",children:[a&&e.jsx(Q,{summary:a.summary,version:a.version,lastScan:n,isLoading:t,onRefresh:r}),e.jsxs("div",{className:"space-y-16",children:[o?e.jsx(B,{checks:i}):e.jsxs(j.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},className:"py-20 flex flex-col items-center text-center space-y-6",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-24 h-24 rounded-[2.5rem] bg-emerald-500/10 flex items-center justify-center",children:e.jsx(y,{className:"w-12 h-12 text-emerald-500"})}),e.jsx("div",{className:"absolute inset-0 w-24 h-24 rounded-[2.5rem] bg-emerald-500/20 animate-ping opacity-20"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h2",{className:"text-3xl font-bold tracking-tight",children:s("health.allSystemsClear")}),e.jsx("p",{className:"text-muted-foreground max-w-[40ch] mx-auto",children:s("health.optimalStateDesc")})]})]}),a?.groups&&e.jsx(K,{groups:a.groups})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 text-[10px] uppercase tracking-widest font-mono text-muted-foreground/60 border-t border-border/40 pt-8",children:[e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"opacity-50",children:"Build"}),e.jsx("span",{className:"text-foreground",children:a?.version??"--"})]}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"opacity-50",children:"Platform"}),e.jsx("span",{className:"text-foreground",children:typeof navigator<"u"?navigator.platform:"linux"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1 rounded-full bg-muted/30 border border-border/40",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse"}),e.jsx("span",{children:s("health.liveMonitoring")})]})]})]})]})}export{te as HealthPage};
1
+ import{j as e}from"./radix-ui-nu4wz29m.js";import{a as u,c as l,e as x,O as C,Q as E,R as k,S as m}from"./index-B2JEyN3d.js";import{r as h}from"./react-vendor-Bjx91N7w.js";import{u as _,a as A,b as O}from"./tanstack-bhJxV1h8.js";import{t as p}from"./notifications-B4_o8bcr.js";import{b9 as g,C as N,a0 as v,p as w,R as b,_ as R,x as F,T as P,aj as y,$ as H}from"./icons-DSLG1YsC.js";import{m as j,A as I}from"./proxy-C4-M_9kB.js";import"./utils-CzKF5WmX.js";import"./form-utils-CuHzLhJZ.js";import"./charts-eIPy2oG6.js";function M(){return _({queryKey:["health"],queryFn:async()=>(await fetch("/api/health")).json(),refetchInterval:3e4})}function S(){const s=A();return O({mutationFn:async a=>{const t=await fetch(`/api/health/fix/${a}`,{method:"POST"}),r=await t.json();if(!t.ok)throw new Error(r.message);return r},onSuccess:a=>{s.invalidateQueries({queryKey:["health"]}),p.success(a.message)},onError:a=>{p.error(a.message)}})}const q={ok:{dot:"bg-green-500",label:"OK",labelColor:"text-green-500"},warning:{dot:"bg-yellow-500",label:"WARN",labelColor:"text-yellow-500"},error:{dot:"bg-red-500",label:"ERR",labelColor:"text-red-500"},info:{dot:"bg-blue-500",label:"INFO",labelColor:"text-blue-500"}};function z({check:s}){const{t:a}=u(),t=S(),r=q[s.status],[n,i]=h.useState(!1),o=s.details||s.fix,c=d=>{navigator.clipboard.writeText(d),p.success(a("health.copied"))};return o?e.jsx(C,{open:n,onOpenChange:i,children:e.jsxs("div",{className:l("group rounded-lg border transition-all duration-150",n?"border-border bg-muted/30":"border-transparent hover:border-border/50 hover:bg-muted/50"),children:[e.jsx(E,{asChild:!0,children:e.jsxs("button",{className:"w-full flex items-center gap-3 px-3 py-2 text-left",children:[e.jsxs("div",{className:"relative flex items-center justify-center w-4 h-4",children:[e.jsx("div",{className:l("w-2 h-2 rounded-full",r.dot)}),s.status!=="ok"&&e.jsx("div",{className:l("absolute w-2 h-2 rounded-full animate-ping opacity-75",r.dot)})]}),e.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:s.name}),e.jsxs("span",{className:l("font-mono text-xs font-semibold",r.labelColor),children:["[",r.label,"]"]}),e.jsx(N,{className:l("w-4 h-4 text-muted-foreground transition-transform duration-200",n&&"rotate-90")})]})}),e.jsx(k,{children:e.jsxs("div",{className:"px-3 pb-3 pt-1 space-y-2 ml-7",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s.message}),s.details&&e.jsx("pre",{className:"text-xs font-mono text-muted-foreground bg-background/50 rounded p-2 overflow-x-auto border border-border/50",children:s.details}),s.fix&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex-1 flex items-center gap-2 bg-background/50 rounded px-2 py-1.5 border border-border/50",children:[e.jsx(v,{className:"w-3 h-3 text-muted-foreground shrink-0"}),e.jsx("code",{className:"text-xs font-mono flex-1 truncate",children:s.fix}),e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>s.fix&&c(s.fix),className:"h-5 w-5 p-0",children:e.jsx(w,{className:"w-3 h-3"})})]}),s.fixable&&s.status!=="ok"&&e.jsxs(x,{size:"sm",onClick:()=>t.mutate(s.id),disabled:t.isPending,className:"h-7 px-3 text-xs",children:[e.jsx(g,{className:"w-3 h-3 mr-1"}),a("health.applyFix")]})]})]})})]})}):e.jsxs("div",{className:l("group flex items-center gap-3 px-3 py-2 rounded-lg","hover:bg-muted/50 transition-colors duration-150","border border-transparent hover:border-border/50"),children:[e.jsxs("div",{className:"relative flex items-center justify-center w-4 h-4",children:[e.jsx("div",{className:l("w-2 h-2 rounded-full",r.dot)}),s.status!=="ok"&&e.jsx("div",{className:l("absolute w-2 h-2 rounded-full animate-ping opacity-75",r.dot)})]}),e.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:s.name}),e.jsxs("span",{className:l("font-mono text-xs font-semibold",r.labelColor),children:["[",r.label,"]"]}),s.fixable&&s.status!=="ok"&&e.jsxs(x,{size:"sm",variant:"ghost",onClick:()=>t.mutate(s.id),disabled:t.isPending,className:"h-6 px-2 text-xs opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsx(g,{className:"w-3 h-3 mr-1"}),a("health.fix")]})]})}function D(s,a){const t=Math.floor((Date.now()-s)/1e3);if(t<5)return a("health.justNow");if(t<60)return a("health.secondsAgo",{count:t});const r=Math.floor(t/60);if(r<60)return a("health.minutesAgo",{count:r});const n=Math.floor(r/60);return a("health.hoursAgo",{count:n})}function Q({summary:s,version:a,lastScan:t,isLoading:r,onRefresh:n}){const{t:i}=u(),[,o]=h.useState(0);h.useEffect(()=>{const f=setInterval(()=>o(T=>T+1),1e3);return()=>clearInterval(f)},[]);const c=()=>{navigator.clipboard.writeText("ccs doctor"),p.success(i("health.copied"))},d=s.errors>0||s.warnings>0;return e.jsxs("div",{className:l("group relative overflow-hidden rounded-2xl border transition-all duration-500",d?"bg-rose-500/5 border-rose-500/20 shadow-[0_0_20px_-12px_rgba(244,63,94,0.3)]":"bg-emerald-500/5 border-emerald-500/20 shadow-[0_0_20px_-12px_rgba(16,185,129,0.3)]"),children:[e.jsx("div",{className:l("absolute inset-0 opacity-[0.05] blur-3xl pointer-events-none transition-colors duration-1000",d?"bg-rose-500":"bg-emerald-500")}),e.jsxs("div",{className:"relative flex flex-col md:flex-row items-center gap-4 px-6 py-4",children:[e.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:l("w-2.5 h-2.5 rounded-full",d?"bg-rose-500":"bg-emerald-500")}),e.jsx("div",{className:l("absolute inset-0 rounded-full animate-ping opacity-40",d?"bg-rose-500":"bg-emerald-500")})]}),e.jsx("h1",{className:"font-mono text-sm font-bold tracking-tight uppercase",children:i(d?"health.issuesDetected":"health.systemOptimal")})]}),e.jsx("div",{className:"hidden md:block h-4 w-px bg-border/50"}),e.jsxs("div",{className:"flex items-center gap-6 text-xs font-mono",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-muted-foreground uppercase text-[10px] tracking-widest",children:"Checks"}),e.jsx("span",{children:s.total})]}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-muted-foreground uppercase text-[10px] tracking-widest",children:"Passed"}),e.jsx("span",{className:"text-emerald-500",children:s.passed})]}),s.warnings>0&&e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-muted-foreground uppercase text-[10px] tracking-widest",children:"Warnings"}),e.jsx("span",{className:"text-amber-500 font-bold",children:s.warnings})]}),s.errors>0&&e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-muted-foreground uppercase text-[10px] tracking-widest",children:"Errors"}),e.jsx("span",{className:"text-rose-500 font-bold underline decoration-rose-500/30",children:s.errors})]})]}),e.jsx("div",{className:"flex-1"}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex flex-col items-end text-[10px] font-mono text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(b,{className:l("w-2.5 h-2.5",r&&"animate-spin")}),e.jsx("span",{children:t?D(t,i):"--"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 opacity-60",children:[e.jsx(R,{className:"w-2.5 h-2.5"}),e.jsx("span",{children:a})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(x,{variant:"ghost",size:"sm",onClick:c,className:"h-8 px-3 gap-2 font-mono text-[10px] bg-background/40 hover:bg-background/60 border border-border/40 rounded-full",children:[e.jsx(v,{className:"w-3 h-3"}),e.jsx("span",{className:"hidden sm:inline",children:"ccs doctor"}),e.jsx(w,{className:"w-3 h-3 opacity-40"})]}),e.jsx(x,{variant:"ghost",size:"icon",onClick:n,disabled:r,className:"h-8 w-8 rounded-full bg-background/40 hover:bg-background/60 border border-border/40",children:e.jsx(b,{className:l("w-3.5 h-3.5",r&&"animate-spin")})})]})]})]})]})}function $({check:s}){const{t:a}=u(),t=S(),r=!!(s.details||s.fix||s.fixable),[n,i]=h.useState(!1),o=s.status==="error",c=o?F:P,d=()=>{s.fix&&(navigator.clipboard.writeText(s.fix),p.success(a("health.copied")))},f=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:l("flex items-center justify-center w-12 h-12 rounded-2xl shrink-0",o?"bg-rose-500/10 text-rose-500":"bg-amber-500/10 text-amber-500"),children:e.jsx(c,{className:"w-6 h-6"})}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-bold tracking-tight",children:s.name}),r&&e.jsx("div",{className:"p-1 hover:bg-muted rounded-full transition-colors",children:e.jsx(N,{className:l("w-5 h-5 text-muted-foreground transition-transform",n&&"rotate-90")})})]}),e.jsx("p",{className:"text-sm font-medium leading-relaxed text-muted-foreground/80",children:s.message})]})]});return e.jsx(j.div,{layout:!0,initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,scale:.95},className:l("group relative overflow-hidden rounded-[2rem] p-px transition-all duration-300",o?"bg-gradient-to-br from-rose-500/20 via-rose-500/5 to-transparent":"bg-gradient-to-br from-amber-500/20 via-amber-500/5 to-transparent"),children:e.jsxs("div",{className:"relative h-full rounded-[calc(2rem-1px)] bg-background/80 backdrop-blur-md overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 rounded-[calc(2rem-1px)] shadow-[inset_0_1px_1px_rgba(255,255,255,0.1)] pointer-events-none"}),e.jsxs("div",{className:"p-6",children:[r?e.jsx("button",{type:"button",onClick:()=>i(!n),"aria-expanded":n,"aria-label":n?`Collapse ${s.name} details`:`Expand ${s.name} details`,className:"flex w-full select-none items-start gap-4 rounded-2xl text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",children:f}):e.jsx("div",{className:"flex w-full items-start gap-4",children:f}),e.jsx(I,{children:n&&e.jsx(j.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.3,ease:[.32,.72,0,1]},className:"overflow-hidden",children:e.jsxs("div",{className:"mt-4 pt-4 border-t border-border/40 space-y-4",children:[s.details&&e.jsx("div",{className:"rounded-xl bg-muted/30 p-3 font-mono text-[11px] leading-relaxed text-muted-foreground break-all",children:s.details}),(s.fix||s.fixable)&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-3",children:[s.fix&&e.jsxs("div",{className:"flex-1 flex items-center gap-2 h-10 px-3 rounded-full bg-background/50 border border-border/40",children:[e.jsx(v,{className:"w-3.5 h-3.5 text-muted-foreground"}),e.jsx("code",{className:"text-xs font-mono flex-1 truncate",children:s.fix}),e.jsx(x,{variant:"ghost",size:"icon",onClick:d,"aria-label":a("health.copy")??"Copy fix command",className:"h-6 w-6 rounded-full text-muted-foreground hover:text-foreground",children:e.jsx(w,{className:"w-3 h-3"})})]}),s.fixable&&e.jsxs(x,{onClick:()=>t.mutate(s.id),disabled:t.isPending,className:l("h-10 px-6 rounded-full font-bold shadow-lg shadow-primary/20 transition-all active:scale-95",o?"bg-rose-500 hover:bg-rose-600":"bg-amber-500 hover:bg-amber-600"),children:[t.isPending?e.jsx(b,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(g,{className:"w-4 h-4 mr-2"}),a("health.applyFix")]})]})]})})})]})]})})}function B({checks:s}){const{t:a}=u();return s.length===0?null:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3 px-1",children:[e.jsx("h2",{className:"text-sm font-bold tracking-widest uppercase text-muted-foreground/60",children:a("health.attentionRequired")}),e.jsx("div",{className:"h-px flex-1 bg-border/40"}),e.jsx("span",{className:"font-mono text-xs text-rose-500 font-bold",children:s.length})]}),e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:e.jsx(I,{mode:"popLayout",children:s.map(t=>e.jsx($,{check:t},t.id))})})]})}function K({groups:s}){const{t:a}=u();return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3 px-1",children:[e.jsx("h2",{className:"text-sm font-bold tracking-widest uppercase text-muted-foreground/60",children:a("health.environmentAudit")}),e.jsx("div",{className:"h-px flex-1 bg-border/40"}),e.jsx(y,{className:"w-4 h-4 text-emerald-500/60"})]}),e.jsx("div",{className:"space-y-4",children:s.map(t=>e.jsx(W,{group:t},t.id))})]})}function W({group:s}){const[a,t]=h.useState(!1),r=s.checks.filter(i=>i.status==="error"||i.status==="warning").length,n=r>0;return e.jsx(C,{open:a,onOpenChange:t,className:"group/audit",children:e.jsxs("div",{className:l("rounded-2xl border transition-all duration-300",a?"bg-muted/30 border-border/60":"bg-background hover:border-border/60"),children:[e.jsx(E,{asChild:!0,children:e.jsxs("button",{className:"w-full flex items-center gap-4 px-5 py-4 text-left",children:[e.jsx("div",{className:l("flex items-center justify-center w-8 h-8 rounded-full transition-colors",n?"bg-rose-500/10 text-rose-500":"bg-muted text-muted-foreground"),children:n?e.jsx(H,{className:"w-4 h-4"}):e.jsx(y,{className:"w-4 h-4"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-sm font-bold tracking-tight",children:s.name}),e.jsxs("p",{className:"text-[10px] text-muted-foreground uppercase tracking-widest font-mono",children:[s.checks.length," Checks"]})]}),n&&e.jsx("div",{className:"px-2 py-0.5 rounded-full bg-rose-500/10 text-rose-500 text-[10px] font-bold font-mono",children:r}),e.jsx(N,{className:l("w-4 h-4 text-muted-foreground transition-transform duration-300",a&&"rotate-90")})]})}),e.jsx(k,{children:e.jsx("div",{className:"px-5 pb-5 space-y-1",children:s.checks.map(i=>e.jsx(z,{check:i},i.id))})})]})})}function L(){return e.jsxs("div",{className:"p-6 max-w-6xl mx-auto space-y-12",children:[e.jsx(m,{className:"h-20 w-full rounded-2xl"}),e.jsxs("div",{className:"space-y-16",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsx(m,{className:"h-4 w-48"}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsx(m,{className:"h-40 rounded-[2rem]"}),e.jsx(m,{className:"h-40 rounded-[2rem]"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(m,{className:"h-4 w-48"}),[1,2,3].map(s=>e.jsx(m,{className:"h-16 rounded-2xl"},s))]})]})]})}function te(){const{t:s}=u(),{data:a,isLoading:t,refetch:r,dataUpdatedAt:n}=M();if(t&&!a)return e.jsx(L,{});const i=a?.checks.filter(c=>c.status==="error"||c.status==="warning")??[],o=i.length>0;return e.jsxs("div",{className:"relative pb-20 overflow-hidden",children:[e.jsxs("div",{className:"absolute inset-0 pointer-events-none",children:[e.jsx("div",{className:l("absolute top-[5%] -left-[5%] w-[60%] h-[60%] blur-[100px] rounded-full opacity-[0.08] transition-colors duration-1000",o?"bg-rose-500":"bg-emerald-500")}),e.jsx("div",{className:l("absolute -bottom-[5%] -right-[5%] w-[50%] h-[50%] blur-[100px] rounded-full opacity-[0.06] transition-colors duration-1000",o?"bg-amber-500":"bg-blue-500")}),e.jsx("div",{className:"absolute inset-0 opacity-[0.03] mix-blend-overlay",style:{backgroundImage:`url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E")`}})]}),e.jsxs("div",{className:"relative p-6 max-w-6xl mx-auto space-y-12",children:[a&&e.jsx(Q,{summary:a.summary,version:a.version,lastScan:n,isLoading:t,onRefresh:r}),e.jsxs("div",{className:"space-y-16",children:[o?e.jsx(B,{checks:i}):e.jsxs(j.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},className:"py-20 flex flex-col items-center text-center space-y-6",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-24 h-24 rounded-[2.5rem] bg-emerald-500/10 flex items-center justify-center",children:e.jsx(y,{className:"w-12 h-12 text-emerald-500"})}),e.jsx("div",{className:"absolute inset-0 w-24 h-24 rounded-[2.5rem] bg-emerald-500/20 animate-ping opacity-20"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h2",{className:"text-3xl font-bold tracking-tight",children:s("health.allSystemsClear")}),e.jsx("p",{className:"text-muted-foreground max-w-[40ch] mx-auto",children:s("health.optimalStateDesc")})]})]}),a?.groups&&e.jsx(K,{groups:a.groups})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 text-[10px] uppercase tracking-widest font-mono text-muted-foreground/60 border-t border-border/40 pt-8",children:[e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"opacity-50",children:"Build"}),e.jsx("span",{className:"text-foreground",children:a?.version??"--"})]}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"opacity-50",children:"Platform"}),e.jsx("span",{className:"text-foreground",children:typeof navigator<"u"?navigator.platform:"linux"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1 rounded-full bg-muted/30 border border-border/40",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse"}),e.jsx("span",{children:s("health.liveMonitoring")})]})]})]})]})}export{te as HealthPage};