@kaitranntt/ccs 8.1.2-dev.1 → 8.1.2

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 (158) hide show
  1. package/dist/channels/official-channels-runtime.js +1 -1
  2. package/dist/channels/official-channels-runtime.js.map +1 -1
  3. package/dist/cliproxy/ai-providers/codex-reasoning-proxy.d.ts.map +1 -1
  4. package/dist/cliproxy/ai-providers/codex-reasoning-proxy.js +11 -88
  5. package/dist/cliproxy/ai-providers/codex-reasoning-proxy.js.map +1 -1
  6. package/dist/cliproxy/auth/auth-types.d.ts +0 -2
  7. package/dist/cliproxy/auth/auth-types.d.ts.map +1 -1
  8. package/dist/cliproxy/auth/oauth-handler.d.ts.map +1 -1
  9. package/dist/cliproxy/auth/oauth-handler.js +6 -12
  10. package/dist/cliproxy/auth/oauth-handler.js.map +1 -1
  11. package/dist/cliproxy/auth/oauth-trace/redactor.d.ts.map +1 -1
  12. package/dist/cliproxy/auth/oauth-trace/redactor.js +0 -1
  13. package/dist/cliproxy/auth/oauth-trace/redactor.js.map +1 -1
  14. package/dist/cliproxy/proxy/proxy-config-resolver.d.ts.map +1 -1
  15. package/dist/cliproxy/proxy/proxy-config-resolver.js +1 -11
  16. package/dist/cliproxy/proxy/proxy-config-resolver.js.map +1 -1
  17. package/dist/cliproxy/proxy/tool-sanitization-proxy.d.ts.map +1 -1
  18. package/dist/cliproxy/proxy/tool-sanitization-proxy.js +8 -160
  19. package/dist/cliproxy/proxy/tool-sanitization-proxy.js.map +1 -1
  20. package/dist/codex-auth/codex-config-symlink.js +4 -21
  21. package/dist/codex-auth/codex-config-symlink.js.map +1 -1
  22. package/dist/commands/config-channels-command.d.ts +4 -1
  23. package/dist/commands/config-channels-command.d.ts.map +1 -1
  24. package/dist/commands/config-channels-command.js +24 -20
  25. package/dist/commands/config-channels-command.js.map +1 -1
  26. package/dist/cursor/cursor-daemon-entry.d.ts.map +1 -1
  27. package/dist/cursor/cursor-daemon-entry.js +0 -44
  28. package/dist/cursor/cursor-daemon-entry.js.map +1 -1
  29. package/dist/cursor/cursor-daemon.d.ts +1 -2
  30. package/dist/cursor/cursor-daemon.d.ts.map +1 -1
  31. package/dist/cursor/cursor-daemon.js +5 -21
  32. package/dist/cursor/cursor-daemon.js.map +1 -1
  33. package/dist/cursor/cursor-models.d.ts.map +1 -1
  34. package/dist/cursor/cursor-models.js +1 -2
  35. package/dist/cursor/cursor-models.js.map +1 -1
  36. package/dist/cursor/cursor-profile-executor.d.ts +1 -1
  37. package/dist/cursor/cursor-profile-executor.d.ts.map +1 -1
  38. package/dist/cursor/cursor-profile-executor.js +4 -7
  39. package/dist/cursor/cursor-profile-executor.js.map +1 -1
  40. package/dist/cursor/cursor-runtime-probe.d.ts.map +1 -1
  41. package/dist/cursor/cursor-runtime-probe.js +2 -4
  42. package/dist/cursor/cursor-runtime-probe.js.map +1 -1
  43. package/dist/cursor/types.d.ts +0 -1
  44. package/dist/cursor/types.d.ts.map +1 -1
  45. package/dist/dispatcher/profile-resolver.d.ts +0 -16
  46. package/dist/dispatcher/profile-resolver.d.ts.map +1 -1
  47. package/dist/dispatcher/profile-resolver.js +3 -49
  48. package/dist/dispatcher/profile-resolver.js.map +1 -1
  49. package/dist/docker/docker-key-rotation.d.ts +0 -2
  50. package/dist/docker/docker-key-rotation.d.ts.map +1 -1
  51. package/dist/docker/docker-key-rotation.js +1 -9
  52. package/dist/docker/docker-key-rotation.js.map +1 -1
  53. package/dist/glmt/sse-parser.d.ts +0 -1
  54. package/dist/glmt/sse-parser.d.ts.map +1 -1
  55. package/dist/glmt/sse-parser.js +1 -13
  56. package/dist/glmt/sse-parser.js.map +1 -1
  57. package/dist/proxy/server/messages-route.d.ts.map +1 -1
  58. package/dist/proxy/server/messages-route.js +3 -69
  59. package/dist/proxy/server/messages-route.js.map +1 -1
  60. package/dist/proxy/transformers/request-transformer.d.ts.map +1 -1
  61. package/dist/proxy/transformers/request-transformer.js +2 -9
  62. package/dist/proxy/transformers/request-transformer.js.map +1 -1
  63. package/dist/shared/claude-extension-setup.d.ts.map +1 -1
  64. package/dist/shared/claude-extension-setup.js +1 -2
  65. package/dist/shared/claude-extension-setup.js.map +1 -1
  66. package/dist/targets/codex-adapter.js +1 -1
  67. package/dist/targets/codex-adapter.js.map +1 -1
  68. package/dist/ui/assets/{Trans-BIQ-yfAc.js → Trans-DyZQZ3e2.js} +1 -1
  69. package/dist/ui/assets/accounts-BPJltru3.js +1 -0
  70. package/dist/ui/assets/{alert-dialog-D0yey0YJ.js → alert-dialog-DWHL-dqd.js} +1 -1
  71. package/dist/ui/assets/api-BxPN-zy4.js +4 -0
  72. package/dist/ui/assets/{auth-section-BHZUn2Hv.js → auth-section-B4o90dwz.js} +1 -1
  73. package/dist/ui/assets/{backups-section-BNVlJSV3.js → backups-section-1AsdSIJO.js} +1 -1
  74. package/dist/ui/assets/{channels-BOB1P4Kt.js → channels-CU4Zdsc_.js} +1 -1
  75. package/dist/ui/assets/{checkbox-Bt-F3GmI.js → checkbox-CbCKGH8I.js} +1 -1
  76. package/dist/ui/assets/claude-extension-CWpjmIGt.js +1 -0
  77. package/dist/ui/assets/cliproxy-K6eBb5VO.js +4 -0
  78. package/dist/ui/assets/{cliproxy-ai-providers-CzyaYfYI.js → cliproxy-ai-providers-Dr4L5NRY.js} +6 -6
  79. package/dist/ui/assets/cliproxy-control-panel-Cz5r7kHP.js +1 -0
  80. package/dist/ui/assets/codex-0HdbW8NR.js +30 -0
  81. package/dist/ui/assets/{confirm-dialog-CYvBJC0z.js → confirm-dialog-b5Dahgnk.js} +1 -1
  82. package/dist/ui/assets/{copilot-Csab21fh.js → copilot-B1Ojakbt.js} +2 -2
  83. package/dist/ui/assets/{cursor-fOpftodW.js → cursor-PUtNVPx1.js} +1 -1
  84. package/dist/ui/assets/{droid-FIcjtOf-.js → droid-S2gclncb.js} +1 -1
  85. package/dist/ui/assets/{globalenv-section-CpIAk36Y.js → globalenv-section-7wKSmNSG.js} +1 -1
  86. package/dist/ui/assets/{health-D0HvHNud.js → health-hMLN_gyw.js} +1 -1
  87. package/dist/ui/assets/index-BMoGhs28.css +1 -0
  88. package/dist/ui/assets/{index-D0VoBTF3.js → index-BWboJia4.js} +1 -1
  89. package/dist/ui/assets/index-COt1pbk-.js +1 -0
  90. package/dist/ui/assets/{index-sIfjKy42.js → index-CcGVqYOy.js} +18 -18
  91. package/dist/ui/assets/{index-Cr4G276q.js → index-Coc3_ABK.js} +1 -1
  92. package/dist/ui/assets/{index-BTPa3KEN.js → index-Cx0dmbiQ.js} +1 -1
  93. package/dist/ui/assets/{index-D5G9mVmP.js → index-CxvNNHgE.js} +1 -1
  94. package/dist/ui/assets/{index-Dm_QojrJ.js → index-DkR2KVhF.js} +1 -1
  95. package/dist/ui/assets/{logs-B33n-VaM.js → logs-BRFVfyLc.js} +1 -1
  96. package/dist/ui/assets/{masked-input-BrUE6z_f.js → masked-input-4L9CIZGb.js} +1 -1
  97. package/dist/ui/assets/proxy-status-widget-s1UWOE23.js +1 -0
  98. package/dist/ui/assets/{raw-json-settings-editor-panel-DZRtQXbD.js → raw-json-settings-editor-panel-DXh8c8rA.js} +1 -1
  99. package/dist/ui/assets/{searchable-select-D2smFEI5.js → searchable-select-CtvEQrMo.js} +1 -1
  100. package/dist/ui/assets/{separator-BvoSJCHW.js → separator-E0ISp1SN.js} +1 -1
  101. package/dist/ui/assets/{shared-qKNFwLmT.js → shared-BeYwHeNS.js} +2 -2
  102. package/dist/ui/assets/{table-DYyc1gJc.js → table-BBslZvNP.js} +1 -1
  103. package/dist/ui/assets/updates-CDrm903n.js +1 -0
  104. package/dist/ui/assets/{use-accounts-BR64_yUk.js → use-accounts-BdalFsdY.js} +1 -1
  105. package/dist/ui/index.html +2 -2
  106. package/dist/utils/browser/browser-settings.d.ts.map +1 -1
  107. package/dist/utils/browser/browser-settings.js +3 -13
  108. package/dist/utils/browser/browser-settings.js.map +1 -1
  109. package/dist/utils/glmt-deprecation.d.ts.map +1 -1
  110. package/dist/utils/glmt-deprecation.js +3 -1
  111. package/dist/utils/glmt-deprecation.js.map +1 -1
  112. package/dist/web-server/index.d.ts.map +1 -1
  113. package/dist/web-server/index.js +9 -0
  114. package/dist/web-server/index.js.map +1 -1
  115. package/dist/web-server/middleware/auth-middleware.d.ts.map +1 -1
  116. package/dist/web-server/middleware/auth-middleware.js +4 -26
  117. package/dist/web-server/middleware/auth-middleware.js.map +1 -1
  118. package/dist/web-server/routes/cliproxy-auth-routes.d.ts +0 -10
  119. package/dist/web-server/routes/cliproxy-auth-routes.d.ts.map +1 -1
  120. package/dist/web-server/routes/cliproxy-auth-routes.js +13 -45
  121. package/dist/web-server/routes/cliproxy-auth-routes.js.map +1 -1
  122. package/dist/web-server/routes/cliproxy-local-proxy.d.ts.map +1 -1
  123. package/dist/web-server/routes/cliproxy-local-proxy.js +8 -25
  124. package/dist/web-server/routes/cliproxy-local-proxy.js.map +1 -1
  125. package/dist/web-server/routes/cursor-routes.d.ts.map +1 -1
  126. package/dist/web-server/routes/cursor-routes.js +1 -6
  127. package/dist/web-server/routes/cursor-routes.js.map +1 -1
  128. package/dist/web-server/routes/image-analysis-routes.d.ts.map +1 -1
  129. package/dist/web-server/routes/image-analysis-routes.js +0 -7
  130. package/dist/web-server/routes/image-analysis-routes.js.map +1 -1
  131. package/dist/web-server/routes/settings-routes.d.ts.map +1 -1
  132. package/dist/web-server/routes/settings-routes.js +1 -10
  133. package/dist/web-server/routes/settings-routes.js.map +1 -1
  134. package/dist/web-server/services/claude-extension-settings-service.d.ts.map +1 -1
  135. package/dist/web-server/services/claude-extension-settings-service.js +1 -5
  136. package/dist/web-server/services/claude-extension-settings-service.js.map +1 -1
  137. package/lib/mcp/ccs-browser-server.cjs +13 -24
  138. package/package.json +1 -1
  139. package/dist/cliproxy/proxy/upstream-response-timeout.d.ts +0 -14
  140. package/dist/cliproxy/proxy/upstream-response-timeout.d.ts.map +0 -1
  141. package/dist/cliproxy/proxy/upstream-response-timeout.js +0 -72
  142. package/dist/cliproxy/proxy/upstream-response-timeout.js.map +0 -1
  143. package/dist/cursor/cursor-daemon-auth.d.ts +0 -2
  144. package/dist/cursor/cursor-daemon-auth.d.ts.map +0 -1
  145. package/dist/cursor/cursor-daemon-auth.js +0 -49
  146. package/dist/cursor/cursor-daemon-auth.js.map +0 -1
  147. package/dist/ui/assets/accounts-bN7DnjXo.js +0 -1
  148. package/dist/ui/assets/api-CEtMc2bM.js +0 -4
  149. package/dist/ui/assets/claude-extension-AzKgsH0H.js +0 -1
  150. package/dist/ui/assets/cliproxy-C1liaQi8.js +0 -4
  151. package/dist/ui/assets/cliproxy-control-panel-DmkEW68l.js +0 -1
  152. package/dist/ui/assets/codex-B2FLnjZI.js +0 -30
  153. package/dist/ui/assets/index-G3mgTfgR.css +0 -1
  154. package/dist/ui/assets/index-N35Xkk8N.js +0 -1
  155. package/dist/ui/assets/proxy-status-widget-Dm2ziI5D.js +0 -1
  156. package/dist/ui/assets/updates-XXi3TQNZ.js +0 -1
  157. package/scripts/github/stable-release-issue-cleanup-lib.mjs +0 -113
  158. package/scripts/github/stable-release-issue-cleanup.mjs +0 -134
@@ -1 +0,0 @@
1
- import{j as e}from"./radix-ui-nu4wz29m.js";import{r as f,E as Te}from"./react-vendor-Bjx91N7w.js";import{u as U,a as P,C as N,b,S as p,c as x,P as k,B as _,d as Le,e as X,f as de,g as $e,h as ue,i as Re,j as Pe,k as Fe,l as Me,m as De,n as Ae,T as Be,o as Ie,p as Oe,q as Ue,r as xe,s as v,t as R,v as qe,w as Ee,x as Ke,y as _e}from"./index-sIfjKy42.js";import{a3 as We,am as me,an as se,ao as he,a1 as fe,aa as Ge,G as He,ap as ze,_ as Ve,R as Ye,$ as ne,U as Qe,Z as pe,v as Ze,ae as Q,aq as Xe,Y as Je,C as es,ar as ss,as as ts}from"./icons-DzKUh8vG.js";import{a as as,u as q}from"./tanstack-bhJxV1h8.js";import{u as ns}from"./use-accounts-BR64_yUk.js";import{K as B,f as L,H as rs,L as ls}from"./utils-CzKF5WmX.js";import{R as ge,A as os,C as is,X as cs,Y as re,T as je,b as le,P as ds,c as us,d as xs}from"./charts-eIPy2oG6.js";import"./notifications-B4_o8bcr.js";import"./form-utils-CuHzLhJZ.js";function ms({data:s,isLoading:t}){const{privacyMode:a}=U(),{t:n}=P(),i=s?.totalTokens??0,r=s?.totalInputTokens??0,o=s?.totalOutputTokens??0,u=s?.totalCacheTokens??0,l=r+o;if(t)return e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-4",children:[1,2,3,4,5].map(h=>e.jsx(N,{children:e.jsx(b,{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(p,{className:"h-4 w-[100px]"}),e.jsx(p,{className:"h-8 w-[80px]"})]}),e.jsx(p,{className:"h-8 w-8 rounded-lg"})]})})},h))});const c=(s?.tokenBreakdown?.cacheCreation?.cost??0)+(s?.tokenBreakdown?.cacheRead?.cost??0),m=s?.totalCost?Math.round(c/s.totalCost*100):0,d=u>0&&i>l,g=u>0&&!d?"Total Tokens (I/O)":n("analyticsSummary.totalTokens"),S=d?`${$(r)} in / ${$(o)} out / ${$(u)} cache`:n("analyticsSummary.totalTokensSubtitle",{input:$(r),output:$(o)}),C=[{title:g,value:i,icon:We,format:h=>$(h),color:"text-blue-600",bgColor:"bg-blue-100 dark:bg-blue-900/20",subtitle:S},{title:n("analyticsSummary.totalCost"),value:s?.totalCost??0,icon:me,format:h=>`$${h.toFixed(2)}`,color:"text-green-600",bgColor:"bg-green-100 dark:bg-green-900/20",subtitle:n("analyticsSummary.totalCostSubtitle",{value:s?.averageCostPerDay?.toFixed(2)??"0.00"})},{title:n("analyticsSummary.cacheTokens"),value:s?.totalCacheTokens??0,icon:se,format:h=>$(h),color:"text-cyan-600",bgColor:"bg-cyan-100 dark:bg-cyan-900/20",subtitle:n("analyticsSummary.cacheTokensSubtitle",{cost:c.toFixed(2),percent:m})},{title:n("analyticsSummary.inputCost"),value:s?.tokenBreakdown?.input?.cost??0,icon:he,format:h=>`$${h.toFixed(2)}`,color:"text-purple-600",bgColor:"bg-purple-100 dark:bg-purple-900/20",subtitle:n("analyticsSummary.tokensSubtitle",{value:$(s?.tokenBreakdown?.input?.tokens??0)})},{title:n("analyticsSummary.outputCost"),value:s?.tokenBreakdown?.output?.cost??0,icon:fe,format:h=>`$${h.toFixed(2)}`,color:"text-orange-600",bgColor:"bg-orange-100 dark:bg-orange-900/20",subtitle:n("analyticsSummary.tokensSubtitle",{value:$(s?.tokenBreakdown?.output?.tokens??0)})}];return e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-4",children:C.map((h,y)=>{const T=h.icon;return e.jsx(N,{className:"hover:shadow-md transition-shadow",children:e.jsx(b,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between space-x-2",children:[e.jsxs("div",{className:"space-y-1 min-w-0",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground truncate",children:h.title}),e.jsx("p",{className:x("text-xl font-bold truncate",a&&k),children:h.format(h.value)}),h.subtitle&&e.jsx("p",{className:x("text-[10px] text-muted-foreground truncate",a&&k),children:h.subtitle})]}),e.jsx("div",{className:x("p-2 rounded-lg shrink-0",h.bgColor),children:e.jsx(T,{className:x("h-4 w-4",h.color)})})]})})},y)})})}function $(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function hs({model:s}){const{privacyMode:t}=U(),{t:a}=P(),n=fs(s.ioRatio),r=s.cacheCreationTokens+s.cacheReadTokens>0?"All Tokens":a("analyticsCards.totalTokens");return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ge,{className:"h-4 w-4 text-primary shrink-0"}),e.jsx("h4",{className:"font-semibold leading-none truncate",title:s.model,children:s.model})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(_,{variant:"secondary",className:"text-[10px] h-5 px-1.5",children:[s.percentage.toFixed(1),"% usage"]}),e.jsxs(_,{variant:n.variant,className:"text-[10px] h-5 px-1.5",children:[s.ioRatio.toFixed(0),":1 I/O"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"p-2 rounded-md bg-muted/50 border text-center",children:[e.jsxs("p",{className:x("text-lg font-bold",t&&k),children:["$",s.cost.toFixed(2)]}),e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:a("analyticsCards.totalCost")})]}),e.jsxs("div",{className:"p-2 rounded-md bg-muted/50 border text-center",children:[e.jsx("p",{className:x("text-lg font-bold",t&&k),children:gs(s.tokens)}),e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:r})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h5",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:"Token Breakdown"}),e.jsxs("div",{className:x("space-y-1",t&&k),children:[e.jsx(Z,{label:"Input",tokens:s.inputTokens,cost:s.costBreakdown.input.cost,color:"#335c67",icon:he}),e.jsx(Z,{label:"Output",tokens:s.outputTokens,cost:s.costBreakdown.output.cost,color:"#fff3b0",icon:fe}),e.jsx(Z,{label:"Cache Write",tokens:s.cacheCreationTokens,cost:s.costBreakdown.cacheCreation.cost,color:"#e09f3e",icon:se}),e.jsx(Z,{label:"Cache Read",tokens:s.cacheReadTokens,cost:s.costBreakdown.cacheRead.cost,color:"#9e2a2b",icon:se})]})]}),e.jsxs("div",{className:"p-2.5 rounded-md border bg-muted/20 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(He,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("span",{className:"text-xs font-medium",children:a("analyticsCards.inputOutputRatio")})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground leading-snug",children:n.description})]})]})}function Z({label:s,tokens:t,cost:a,color:n,icon:i}){return t===0?null:e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("div",{className:"w-1 h-6 rounded-full shrink-0",style:{backgroundColor:n}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium truncate",children:s}),e.jsxs("span",{className:"font-mono text-muted-foreground",children:["$",a.toFixed(3)]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[e.jsx(i,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{children:ps(t)})]})]})]})}function fs(s){return s>=200?{variant:"destructive",description:"Extended thinking or large context loading. Expected for reasoning models."}:s>=50?{variant:"secondary",description:"More input than output. Typical for analysis tasks."}:s>=5?{variant:"outline",description:"Balanced input/output ratio for typical coding tasks."}:{variant:"default",description:"More output than input. Generation-heavy workload."}}function ps(s){return s.toLocaleString()}function gs(s){return s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toString()}const js="/api";function oe(s){const t=s.getFullYear(),a=String(s.getMonth()+1).padStart(2,"0"),n=String(s.getDate()).padStart(2,"0");return`${t}${a}${n}`}function M(s,t){const a=t.toString();return a?`${s}?${a}`:s}function D(s,t){t?.startDate&&s.append("since",oe(t.startDate)),t?.endDate&&s.append("until",oe(t.endDate))}function A(s,t){t?.profile&&s.append("profile",t.profile)}const I={summary:s=>{const t=new URLSearchParams;return D(t,s),A(t,s),F(M("/usage/summary",t))},trends:s=>{const t=new URLSearchParams;return D(t,s),A(t,s),F(M("/usage/daily",t))},hourly:s=>{const t=new URLSearchParams;return D(t,s),A(t,s),F(M("/usage/hourly",t))},models:s=>{const t=new URLSearchParams;return D(t,s),A(t,s),F(M("/usage/models",t))},sessions:s=>{const t=new URLSearchParams;return D(t,s),s?.limit&&t.append("limit",s.limit.toString()),s?.offset&&t.append("offset",s.offset.toString()),A(t,s),F(M("/usage/sessions",t))},monthly:s=>{const t=new URLSearchParams;return D(t,s),A(t,s),F(M("/usage/monthly",t))},refresh:async()=>{if(!(await fetch(`${js}/usage/refresh`,{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw new Error("Failed to refresh usage cache")},status:()=>F("/usage/status"),insights:s=>{const t=new URLSearchParams;return D(t,s),A(t,s),F(M("/usage/insights",t))}};async function F(s){const a=await fetch(`/api${s}`,{headers:{"Content-Type":"application/json"}});if(!a.ok){const i=await a.json().catch(()=>({error:"Unknown error"}));throw new Error(i.error||a.statusText)}const n=await a.json();return n.data||n}function ys(s){return q({queryKey:["usage","summary",s],queryFn:()=>I.summary(s),staleTime:60*1e3})}function Ns(s){return q({queryKey:["usage","trends",s],queryFn:()=>I.trends(s),staleTime:60*1e3})}function bs(s){return q({queryKey:["usage","hourly",s],queryFn:()=>I.hourly(s),staleTime:60*1e3})}function ws(s){return q({queryKey:["usage","models",s],queryFn:()=>I.models(s),staleTime:60*1e3})}function vs(){const s=as();return f.useCallback(async()=>{await I.refresh(),await s.invalidateQueries({queryKey:["usage"]})},[s])}function ks(){return q({queryKey:["usage","status"],queryFn:()=>I.status(),staleTime:10*1e3,refetchInterval:30*1e3})}function Cs(s){return q({queryKey:["usage","sessions",s],queryFn:()=>I.sessions(s),staleTime:60*1e3})}function Ss(s){const t=Math.max(1,Math.floor((Date.now()-s.getTime())/1e3));if(t<60)return`${t}s ago`;const a=Math.floor(t/60);if(a<60)return`${a}m ago`;const n=Math.floor(a/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}const Ts=50,te="ccs.analytics.selectedProfile",W="all";function Ls(){if(typeof globalThis.localStorage>"u")return W;const s=globalThis.localStorage.getItem(te);return!s||s.startsWith("unsupported:")?W:s}function $s(s){if(!(typeof globalThis.localStorage>"u")){if(s===W){globalThis.localStorage.removeItem(te);return}globalThis.localStorage.setItem(te,s)}}function Rs(){const[s,t]=f.useState({from:B(new Date,30),to:new Date}),[a,n]=f.useState(!1),[i,r]=f.useState(null),[o,u]=f.useState(Ls),[l,c]=f.useState(null),[m,d]=f.useState("daily"),{data:g}=ns(),{data:S}=Le(),C=vs(),h=f.useCallback(async()=>{n(!0);try{await C()}finally{n(!1)}},[C]),y=f.useMemo(()=>({startDate:s?.from,endDate:s?.to,profile:o===W?void 0:o}),[s?.from,s?.to,o]),T=f.useMemo(()=>{const w=new Set(g?.accounts.map(j=>j.name)??[]),Y=[{value:W,label:"All profiles",description:"Includes all analytics sources.",supported:!0},{value:"default",label:"Default Claude",description:"Profile-scoped Claude JSONL data.",supported:!0},...Array.from(w).sort((j,Se)=>j.localeCompare(Se)).map(j=>({value:j,label:j,description:"Profile-scoped account data.",supported:!0}))];for(const j of S?.profiles??[])w.has(j.name)||j.name==="default"||Y.push({value:`unsupported:${j.name}`,label:j.name,description:"API profile usage is not yet attributed by stable profile.",supported:!1});return Y},[g?.accounts,S?.profiles]),{data:E,isLoading:O}=ys(y),{data:J,isLoading:G}=Ns(y),{data:K,isLoading:H}=bs(y),{data:ee,isLoading:z}=ws(y),{data:ye,isLoading:ae}=Cs({...y,limit:Ts}),{data:V}=ks(),Ne=f.useCallback(()=>{const w=new Date;t({from:B(w,1),to:w}),d("hourly")},[]),be=f.useCallback(w=>{t(w),d("daily")},[]),we=f.useCallback(w=>{w.startsWith("unsupported:")||(u(w),$s(w))},[]),ve=f.useMemo(()=>V?.lastFetch?Ss(new Date(V.lastFetch)):null,[V?.lastFetch]),ke=f.useCallback((w,Y)=>{const j=Y.currentTarget.getBoundingClientRect();c({x:j.left+j.width/2,y:j.top+j.height/2}),r(w)},[]),Ce=f.useCallback(()=>{r(null),c(null)},[]);return{dateRange:s,isRefreshing:a,viewMode:m,selectedProfile:o,profileOptions:T,selectedModel:i,popoverPosition:l,summary:E,trends:J,hourlyData:K,models:ee,sessions:ye,status:V,isSummaryLoading:O,isTrendsLoading:G,isHourlyLoading:H,isModelsLoading:z,isSessionsLoading:ae,isLoading:O||G||z||ae,handleRefresh:h,handleTodayClick:Ne,handleDateRangeChange:be,handleProfileChange:we,handleModelClick:ke,handlePopoverClose:Ce,lastUpdatedText:ve}}function Ps({value:s,onChange:t,presets:a=[{label:"Last 7 days",range:{from:B(new Date,7),to:new Date}},{label:"Last 30 days",range:{from:B(new Date,30),to:new Date}},{label:"Last 90 days",range:{from:B(new Date,90),to:new Date}}],className:n}){const[i,r]=Te.useState(!1),{t:o}=P(),u=l=>!s||!s.from||!s.to||!l.from||!l.to?!1:L(s.from,"yyyy-MM-dd")===L(l.from,"yyyy-MM-dd")&&L(s.to,"yyyy-MM-dd")===L(l.to,"yyyy-MM-dd");return e.jsxs("div",{className:x("flex flex-wrap items-center gap-2",n),children:[a.map(l=>e.jsx(X,{variant:u(l.range)?"default":"outline",size:"sm",onClick:()=>t(l.range),children:l.label},l.label)),e.jsxs(de,{open:i,onOpenChange:r,children:[e.jsx($e,{asChild:!0,children:e.jsxs(X,{id:"date",variant:"outline",className:x("w-auto min-w-[200px] sm:min-w-[240px] justify-start text-left font-normal",!s&&"text-muted-foreground"),children:[e.jsx(ze,{className:"mr-2 h-4 w-4"}),s?.from?s.to?e.jsxs(e.Fragment,{children:[L(s.from,"LLL dd, y")," - ",L(s.to,"LLL dd, y")]}):L(s.from,"LLL dd, y"):e.jsx("span",{children:o("dateRangeFilter.pickADate")})]})}),e.jsx(ue,{className:"w-auto p-0",align:"end",children:e.jsx(Re,{initialFocus:!0,mode:"range",defaultMonth:s?.from,selected:s,onSelect:t,numberOfMonths:2})})]})]})}function Fs({dateRange:s,onDateRangeChange:t,onTodayClick:a,onRefresh:n,isRefreshing:i,lastUpdatedText:r,viewMode:o,selectedProfile:u,profileOptions:l,onProfileChange:c}){const{t:m}=P();return e.jsxs("div",{className:"flex flex-col gap-3 shrink-0 xl:flex-row xl:items-center xl:justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold",children:m("analytics.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:m("analytics.subtitle")})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 xl:justify-end",children:[e.jsxs("div",{className:"inline-flex items-center gap-1 shrink-0",children:[e.jsxs(Pe,{value:u,onValueChange:c,children:[e.jsx(Fe,{className:"h-8 w-[170px]","aria-label":"Analytics profile",children:e.jsx(Me,{placeholder:"All profiles",children:l.find(d=>d.value===u)?.label??"All profiles"})}),e.jsx(De,{children:l.map(d=>e.jsx(Ae,{value:d.value,disabled:!d.supported,children:e.jsxs("span",{className:"flex flex-col",children:[e.jsx("span",{children:d.label}),e.jsx("span",{className:"text-xs text-muted-foreground",children:d.description})]})},d.value))})]}),u!=="all"&&e.jsx(Be,{delayDuration:150,children:e.jsxs(Ie,{children:[e.jsx(Oe,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":"Selected-profile analytics scope",className:"inline-flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground",children:e.jsx(Ve,{className:"size-4","aria-hidden":"true"})})}),e.jsx(Ue,{side:"bottom",align:"start",className:"max-w-xs text-xs",children:"Selected-profile analytics include only default/account data with stable profile attribution. CLIProxy and native runtime snapshots remain in All profiles."})]})})]}),e.jsx(X,{variant:o==="hourly"?"default":"outline",size:"sm",className:"h-8",onClick:a,children:"24H"}),e.jsx(Ps,{className:"flex-wrap",value:s,onChange:t,presets:[{label:"7D",range:{from:B(new Date,7),to:new Date}},{label:"30D",range:{from:B(new Date,30),to:new Date}},{label:m("analytics.month"),range:{from:rs(new Date),to:new Date}},{label:m("analytics.allTime"),range:{from:void 0,to:new Date}}]}),r&&e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap font-mono",title:m("analytics.updated",{value:r}),children:r}),e.jsx(X,{variant:"outline",size:"sm",className:"gap-2 h-8",onClick:n,disabled:i,children:e.jsx(Ye,{className:`w-3.5 h-3.5 ${i?"animate-spin":""}`})})]})]})}function Ms({data:s,isLoading:t,granularity:a="daily",className:n}){const{privacyMode:i}=U(),{t:r}=P(),o=f.useMemo(()=>!s||s.length===0?[]:s.map(c=>{const m="hour"in c?c.hour:c.date;return{...c,dateFormatted:Ds(m,a),costRounded:Number(c.cost.toFixed(4))}}),[s,a]);if(t)return e.jsx(p,{className:x("h-full w-full",n)});if(!s||s.length===0)return e.jsx("div",{className:x("h-full flex items-center justify-center",n),children:e.jsx("p",{className:"text-muted-foreground",children:r(a==="hourly"?"analytics.noDailyUsage":"analytics.noUsageData")})});const u=({x:l,y:c,payload:m,isRight:d})=>{const g=d?`$${m.value}`:ie(Number(m.value));return e.jsx("text",{x:l,y:c,dy:4,textAnchor:d?"start":"end",fontSize:12,fill:"currentColor",className:x("fill-muted-foreground",i&&"blur-[4px]"),children:g})};return e.jsx("div",{className:x("w-full h-full",n),children:e.jsx(ge,{width:"100%",height:"100%",children:e.jsxs(os,{data:o,margin:{top:5,right:30,left:20,bottom:5},children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"tokenGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#0080FF",stopOpacity:.8}),e.jsx("stop",{offset:"95%",stopColor:"#0080FF",stopOpacity:.1})]}),e.jsxs("linearGradient",{id:"costGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#00C49F",stopOpacity:.8}),e.jsx("stop",{offset:"95%",stopColor:"#00C49F",stopOpacity:.1})]})]}),e.jsx(is,{strokeDasharray:"3 3",className:"stroke-muted"}),e.jsx(cs,{dataKey:"dateFormatted",tick:{fontSize:12},tickLine:!1,axisLine:{className:"stroke-muted"}}),e.jsx(re,{yAxisId:"left",orientation:"left",tick:l=>e.jsx(u,{...l,isRight:!1}),tickLine:!1,axisLine:{className:"stroke-muted"}}),e.jsx(re,{yAxisId:"right",orientation:"right",tick:l=>e.jsx(u,{...l,isRight:!0}),tickLine:!1,axisLine:{className:"stroke-muted"}}),e.jsx(je,{content:({active:l,payload:c,label:m})=>!l||!c||!c.length?null:e.jsxs("div",{className:"rounded-lg border bg-background p-3 shadow-lg",children:[e.jsx("p",{className:"font-medium mb-2",children:m}),c.map((d,g)=>e.jsxs("p",{className:x("text-sm",i&&k),style:{color:d.color},children:[d.name,":"," ",d.name==="Tokens"?ie(Number(d.value)||0):`$${d.value}`]},g))]})}),e.jsx(le,{yAxisId:"left",type:"monotone",dataKey:"tokens",stroke:"#0080FF",strokeWidth:2,fillOpacity:1,fill:"url(#tokenGradient)",name:"Tokens"}),e.jsx(le,{yAxisId:"right",type:"monotone",dataKey:"costRounded",stroke:"#00C49F",strokeWidth:2,fillOpacity:1,fill:"url(#costGradient)",name:"Cost"})]})})})}function Ds(s,t){if(t==="hourly"){const[n,i]=s.split(" ");if(n&&i){const r=new Date(`${n}T${i}:00Z`);return L(r,"HH:mm")}return s}const a=new Date(s);return t==="monthly"?L(a,"MMM yyyy"):L(a,"MMM dd")}function ie(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function As({data:s,isLoading:t,className:a}){const{privacyMode:n}=U(),{t:i}=P(),r=f.useMemo(()=>!s||s.length===0?[]:s.map(l=>({name:l.model,value:l.tokens,cost:l.cost,percentage:l.percentage,fill:xe(l.model)})),[s]);if(t)return e.jsx(p,{className:x("h-full min-h-[100px] w-full",a)});if(!s||s.length===0)return e.jsx("div",{className:x("h-full min-h-[100px] flex items-center justify-center",a),children:e.jsx("p",{className:"text-muted-foreground",children:i("analyticsCards.noModelData")})});const o=({active:l,payload:c})=>{if(!l||!c)return null;const m=c;if(!m.length)return null;const d=m[0].payload;return e.jsxs("div",{className:"rounded-lg border bg-background p-2 shadow-lg text-xs",children:[e.jsx("p",{className:"font-medium mb-1",children:d.name}),e.jsxs("p",{className:x("text-muted-foreground",n&&k),children:[Bs(d.value)," (",d.percentage.toFixed(1),"%)"]}),e.jsxs("p",{className:x("text-muted-foreground",n&&k),children:["$",d.cost.toFixed(4)]})]})},u=l=>l.percentage>5?`${l.percentage.toFixed(1)}%`:"";return e.jsx("div",{className:x("w-full h-full min-h-[100px]",a),children:e.jsx(ge,{width:"100%",height:"100%",children:e.jsxs(ds,{children:[e.jsx(us,{data:r,cx:"50%",cy:"50%",labelLine:!1,label:u,innerRadius:50,outerRadius:70,paddingAngle:2,dataKey:"value",children:r.map((l,c)=>e.jsx(xs,{fill:l.fill,strokeWidth:1},`cell-${c}`))}),e.jsx(je,{content:o})]})})})}function Bs(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function Is(s){if(!s)return"";const a=s.replace(/^\/|\/$/g,"").split("/").filter(n=>n.length>0);return a[a.length-1]||""}function Os({data:s,isLoading:t,className:a}){const{privacyMode:n}=U(),{t:i}=P(),r=f.useMemo(()=>{if(!s?.sessions||s.sessions.length===0)return null;const o=s.sessions,u=s.total,l=o.length,c=s.hasMore||s.offset>0,d=o.reduce((g,S)=>g+S.cost,0)/o.length;return{displayedSessions:c?l:u,totalSessions:u,avgCost:d,hasPartialSample:c,recentSessions:o.slice(0,3)}},[s]);return t?e.jsxs(N,{className:x("flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0",a),children:[e.jsx(v,{className:"px-3 py-2",children:e.jsx(p,{className:"h-5 w-32"})}),e.jsx(b,{className:"px-3 pb-3 pt-0 flex-1",children:e.jsx(p,{className:"h-full w-full"})})]}):r?e.jsxs(N,{className:x("flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0 shadow-sm",a),children:[e.jsx(v,{className:"px-3 py-2",children:e.jsxs(R,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(ne,{className:"w-4 h-4"}),"Session Stats"]})}),e.jsxs(b,{className:"px-3 pb-3 pt-0 flex-1 min-h-0 flex flex-col gap-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"p-2 rounded-md bg-muted/50 border text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-blue-600 dark:text-blue-400",children:[e.jsx(Qe,{className:"w-4 h-4"}),e.jsx("span",{className:"text-xl font-bold",children:r.displayedSessions})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mt-0.5",children:r.hasPartialSample?"Sampled Sessions":"Total Sessions"}),r.hasPartialSample&&e.jsxs("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:[r.totalSessions," total"]})]}),e.jsxs("div",{className:"p-2 rounded-md bg-muted/50 border text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-green-600 dark:text-green-400",children:[e.jsx(pe,{className:"w-4 h-4"}),e.jsxs("span",{className:x("text-xl font-bold",n&&k),children:["$",r.avgCost.toFixed(2)]})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mt-0.5",children:r.hasPartialSample?"Recent Avg Cost":"Avg Cost/Session"})]})]}),e.jsxs("div",{className:"flex-1 min-h-0 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground font-medium mb-1",children:[e.jsx(Ze,{className:"w-3 h-3"}),"Recent Activity"]}),e.jsx("div",{className:"space-y-1.5 max-h-full overflow-y-auto pr-1",children:r.recentSessions.map(o=>e.jsxs("div",{className:"flex items-center justify-between text-xs p-1.5 rounded bg-muted/30 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-medium truncate",title:o.projectPath,children:Is(o.projectPath)}),(o.target??"claude")!=="claude"&&e.jsx("span",{className:"shrink-0 px-1 py-0 text-[9px] font-medium rounded bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-300 uppercase",children:o.target})]}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:ls(new Date(o.lastActivity),{addSuffix:!0})})]}),e.jsxs("div",{className:x("text-right shrink-0 ml-2",n&&k),children:[e.jsxs("div",{className:"font-mono",children:["$",o.cost.toFixed(2)]}),e.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[Us(o.tokens??o.inputTokens+o.outputTokens)," ","toks"]})]})]},o.sessionId))})]})]})]}):e.jsxs(N,{className:x("flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0",a),children:[e.jsx(v,{className:"px-3 py-2",children:e.jsxs(R,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(ne,{className:"w-4 h-4"}),"Session Stats"]})}),e.jsx(b,{className:"px-3 pb-3 pt-0 flex-1 flex items-center justify-center",children:e.jsx("p",{className:"text-sm text-muted-foreground text-center",children:i("analyticsCards.noSessionData")})})]})}function Us(s){return s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toString()}function qs({className:s,isLoading:t}){const{data:a,isLoading:n}=qe(),{data:i,isLoading:r,error:o}=Ee(a?.running),{t:u}=P();if(t||n||a?.running&&r)return e.jsxs(N,{className:x("flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0",s),children:[e.jsx(v,{className:"px-3 py-2",children:e.jsxs(R,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(Q,{className:"h-4 w-4"}),"CLIProxy Stats"]})}),e.jsx(b,{className:"px-3 pb-3 pt-0 flex-1",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx(p,{className:"h-4 w-[100px]"}),e.jsx(p,{className:"h-16 w-full"})]})})]});if(!a?.running)return e.jsxs(N,{className:x("flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0 border-dashed",s),children:[e.jsx(v,{className:"px-3 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(R,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(Q,{className:"h-4 w-4 text-muted-foreground"}),"CLIProxy Stats"]}),e.jsx(_,{variant:"secondary",className:"text-[10px] h-5",children:u("cliproxyStatsOverview.offline")})]})}),e.jsx(b,{className:"px-3 pb-3 pt-0 flex-1 flex items-center justify-center",children:e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:u("cliproxyStatsOverview.noActiveSessionHint")})})]});if(o)return e.jsxs(N,{className:x("flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0 border-destructive/50",s),children:[e.jsx(v,{className:"px-3 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(R,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(Q,{className:"h-4 w-4"}),"CLIProxy Stats"]}),e.jsx(_,{variant:"destructive",className:"text-[10px] h-5",children:"Error"})]})}),e.jsx(b,{className:"px-3 pb-3 pt-0 flex-1",children:e.jsx("p",{className:"text-xs text-destructive",children:o.message})})]});const c=i?.totalRequests??0,m=i?.quotaExceededCount??0,d=c-m,g=c>0?Math.round(d/c*100):100,S=i?.tokens?.total??0,C=Object.entries(i?.requestsByModel??{}).sort((y,T)=>T[1]-y[1]).slice(0,4),h=C.length>0?C[0][1]:1;return e.jsxs(N,{className:x("flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0",s),children:[e.jsx(v,{className:"px-3 py-2 border-b bg-muted/5",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(R,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(Q,{className:"h-4 w-4"}),"CLIProxy Stats"]}),e.jsxs(_,{variant:"outline",className:"text-[10px] h-5 text-green-600 border-green-200 bg-green-50 dark:bg-green-900/10 dark:border-green-800",children:[e.jsx(pe,{className:"h-3 w-3 mr-0.5"}),u("cliproxyStatsOverview.running")]})]})}),e.jsx(b,{className:"p-0 flex-1 min-h-0",children:e.jsx(Ke,{className:"h-full",children:e.jsxs("div",{className:"p-3 space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg bg-muted/30",children:[e.jsxs("div",{className:"relative",children:[e.jsxs("svg",{className:"w-10 h-10 -rotate-90",viewBox:"0 0 36 36",children:[e.jsx("circle",{cx:"18",cy:"18",r:"14",fill:"none",stroke:"currentColor",strokeWidth:"3",className:"text-muted/30"}),e.jsx("circle",{cx:"18",cy:"18",r:"14",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeDasharray:`${g*.88} 88`,strokeLinecap:"round",className:g>=90?"text-green-500":"text-amber-500"})]}),e.jsxs("span",{className:"absolute inset-0 flex items-center justify-center text-[8px] font-bold",children:[g,"%"]})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-lg font-bold leading-none",children:ce(c)}),e.jsx("div",{className:"text-[9px] text-muted-foreground mt-0.5",children:m>0?`${m} failed`:"All success"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg bg-muted/30",children:[e.jsx("div",{className:"p-1.5 rounded-md bg-purple-100 dark:bg-purple-900/20",children:e.jsx(Xe,{className:"h-4 w-4 text-purple-600"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-lg font-bold leading-none",children:ce(S)}),e.jsx("div",{className:"text-[9px] text-muted-foreground mt-0.5",children:u("cliproxyStatsOverview.totalTokens")})]})]})]}),C.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-medium text-muted-foreground",children:[e.jsx(Je,{className:"h-3 w-3"}),u("cliproxyStatsOverview.modelsUsed")]}),e.jsx("div",{className:"space-y-1",children:C.map(([y,T])=>{const E=Math.round(T/h*100),O=Es(y);return e.jsxs("div",{className:"group",children:[e.jsxs("div",{className:"flex items-center justify-between text-[10px] mb-0.5",children:[e.jsx("span",{className:"truncate font-medium",title:y,children:O}),e.jsx("span",{className:"text-muted-foreground shrink-0 ml-2",children:T})]}),e.jsx("div",{className:"h-1 bg-muted/50 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-accent/70 rounded-full transition-all",style:{width:`${E}%`}})})]},y)})})]})]})})})]})}function ce(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function Es(s){let t=s.replace(/^gemini-claude-/,"").replace(/^gemini-/,"").replace(/^claude-/,"").replace(/^anthropic\./,"").replace(/-thinking$/," Thinking");return t=t.split(/[-_]/).map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" "),t.length>20&&(t=t.slice(0,18)+"..."),t}function Ks(s){return s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(0)}K`:s.toString()}function _s({models:s,isLoading:t,onModelClick:a,privacyMode:n}){const{t:i}=P();return e.jsxs(N,{className:"flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0 shadow-sm lg:col-span-4",children:[e.jsx(v,{className:"px-3 py-2",children:e.jsxs(R,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(me,{className:"w-4 h-4"}),i("analyticsPages.costByModel")]})}),e.jsx(b,{className:"px-2 pb-2 pt-0 flex-1 min-h-0 overflow-y-auto",children:t?e.jsx(p,{className:"h-full w-full"}):e.jsxs("div",{className:"space-y-0.5",children:[[...s||[]].sort((r,o)=>o.cost-r.cost).map(r=>e.jsxs("button",{className:"group flex items-center text-xs w-full hover:bg-muted/50 rounded px-2 py-1.5 transition-colors cursor-pointer gap-3",onClick:o=>a(r,o),title:"Click for details",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-[180px] shrink-0",children:[e.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:xe(r.model)}}),e.jsx("span",{className:"font-medium truncate group-hover:underline underline-offset-2",children:r.model})]}),e.jsx(Ws,{model:r}),e.jsx("span",{className:x("text-[10px] text-muted-foreground w-14 text-right shrink-0",n&&k),children:Ks(r.tokens)}),e.jsxs("span",{className:x("font-mono font-medium w-16 text-right shrink-0",n&&k),children:["$",r.cost.toFixed(2)]}),e.jsx(es,{className:"w-3 h-3 opacity-0 group-hover:opacity-50 transition-opacity shrink-0"})]},r.model)),e.jsx(Gs,{})]})})]})}function Ws({model:s}){const t={input:"#335c67",output:"#fff3b0",cacheWrite:"#e09f3e",cacheRead:"#9e2a2b"},a=n=>s.cost>0?n/s.cost*100:0;return e.jsx("div",{className:"flex-1 flex items-center gap-1 min-w-0",children:e.jsxs("div",{className:"flex-1 h-2 bg-muted rounded-full overflow-hidden flex",children:[e.jsx("div",{className:"h-full",style:{backgroundColor:t.input,width:`${a(s.costBreakdown.input.cost)}%`},title:`Input: $${s.costBreakdown.input.cost.toFixed(2)}`}),e.jsx("div",{className:"h-full",style:{backgroundColor:t.output,width:`${a(s.costBreakdown.output.cost)}%`},title:`Output: $${s.costBreakdown.output.cost.toFixed(2)}`}),e.jsx("div",{className:"h-full",style:{backgroundColor:t.cacheWrite,width:`${a(s.costBreakdown.cacheCreation.cost)}%`},title:`Cache Write: $${s.costBreakdown.cacheCreation.cost.toFixed(2)}`}),e.jsx("div",{className:"h-full",style:{backgroundColor:t.cacheRead,width:`${a(s.costBreakdown.cacheRead.cost)}%`},title:`Cache Read: $${s.costBreakdown.cacheRead.cost.toFixed(2)}`})]})})}function Gs(){const s=[{color:"#335c67",label:"Input"},{color:"#fff3b0",label:"Output",hasBorder:!0},{color:"#e09f3e",label:"Cache Write"},{color:"#9e2a2b",label:"Cache Read"}];return e.jsx("div",{className:"flex items-center gap-3 pt-2 px-2 text-[10px] text-muted-foreground border-t mt-2",children:s.map(({color:t,label:a,hasBorder:n})=>e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("div",{className:x("w-2 h-2 rounded-full",n&&"border border-muted-foreground/30"),style:{backgroundColor:t}}),a]},a))})}function Hs({viewMode:s,trends:t,hourlyData:a,models:n,sessions:i,isTrendsLoading:r,isHourlyLoading:o,isModelsLoading:u,isSessionsLoading:l,isSummaryLoading:c,onModelClick:m}){const{privacyMode:d}=U();return e.jsxs("div",{className:"min-h-0 grid gap-4 lg:grid-rows-[minmax(260px,1.2fr)_minmax(220px,0.9fr)]",children:[e.jsxs(N,{className:"flex flex-col h-full min-h-[220px] lg:min-h-[240px] overflow-hidden gap-0 py-0 shadow-sm",children:[e.jsx(v,{className:"px-3 py-2 shrink-0",children:e.jsxs(R,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(ss,{className:"w-4 h-4"}),s==="hourly"?"Last 24 Hours":"Usage Trends"]})}),e.jsx(b,{className:"px-3 pb-3 pt-0 flex-1 min-h-0",children:e.jsx(Ms,{data:s==="hourly"?a||[]:t||[],isLoading:s==="hourly"?o:r,granularity:s==="hourly"?"hourly":"daily"})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-10 gap-4 h-auto min-h-[220px] lg:h-full lg:min-h-[220px] lg:grid-rows-[minmax(0,1fr)] lg:[&>*]:min-h-0",children:[e.jsx(_s,{models:n,isLoading:u,onModelClick:m,privacyMode:d}),e.jsxs(N,{className:"flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0 shadow-sm lg:col-span-2",children:[e.jsx(v,{className:"px-3 py-2",children:e.jsxs(R,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(ts,{className:"w-4 h-4"}),"Model Usage"]})}),e.jsx(b,{className:"px-2 pb-2 pt-0 flex-1 min-h-0 flex items-center justify-center",children:e.jsx(As,{data:n||[],isLoading:u,className:"h-full w-full"})})]}),e.jsx(Os,{data:i,isLoading:l,className:"lg:col-span-2"}),e.jsx(qs,{isLoading:c,className:"lg:col-span-2"})]})]})}function at(){return e.jsxs("div",{className:"space-y-4 h-full overflow-hidden",children:[e.jsxs(N,{className:"flex flex-col min-h-[300px]",children:[e.jsx(v,{className:"p-4 pb-2",children:e.jsx(p,{className:"h-4 w-32"})}),e.jsx(b,{className:"p-4 pt-0 flex-1",children:e.jsx(p,{className:"h-full w-full"})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[e.jsxs(N,{className:"flex flex-col min-h-[250px]",children:[e.jsx(v,{className:"p-4 pb-2",children:e.jsx(p,{className:"h-4 w-28"})}),e.jsx(b,{className:"p-4 pt-2",children:e.jsx("div",{className:"space-y-3",children:[1,2,3,4,5].map(s=>e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p,{className:"w-2.5 h-2.5 rounded-full"}),e.jsx(p,{className:"h-3 w-24"})]}),e.jsx(p,{className:"h-3 w-16"})]},s))})})]}),e.jsxs(N,{className:"flex flex-col min-h-[250px]",children:[e.jsx(v,{className:"p-4 pb-2",children:e.jsx(p,{className:"h-4 w-28"})}),e.jsx(b,{className:"p-4 pt-0 flex-1",children:e.jsxs("div",{className:"flex w-full h-full items-center",children:[e.jsx("div",{className:"flex-1 flex justify-center",children:e.jsx(p,{className:"h-[180px] w-[180px] rounded-full"})}),e.jsx("div",{className:"w-[140px] shrink-0 pl-2 space-y-2",children:[1,2,3,4].map(s=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p,{className:"w-2 h-2 rounded-full"}),e.jsx(p,{className:"h-3 w-20"})]},s))})]})})]})]})]})}function nt(){const s=f.useRef(null),{dateRange:t,handleDateRangeChange:a,handleTodayClick:n,handleRefresh:i,isRefreshing:r,lastUpdatedText:o,viewMode:u,selectedProfile:l,profileOptions:c,summary:m,isSummaryLoading:d,trends:g,hourlyData:S,models:C,sessions:h,isTrendsLoading:y,isHourlyLoading:T,isModelsLoading:E,isSessionsLoading:O,handleModelClick:J,handleProfileChange:G,selectedModel:K,popoverPosition:H,handlePopoverClose:ee}=Rs();return e.jsxs("div",{className:"grid h-full min-h-0 grid-rows-[auto_auto_minmax(0,1fr)] gap-4 overflow-y-auto px-4 py-4",children:[e.jsx(Fs,{dateRange:t,onDateRangeChange:a,onTodayClick:n,onRefresh:i,isRefreshing:r,lastUpdatedText:o,viewMode:u,selectedProfile:l,profileOptions:c,onProfileChange:G}),e.jsx(ms,{data:m,isLoading:d}),e.jsx(Hs,{viewMode:u,trends:g,hourlyData:S,models:C,sessions:h,isTrendsLoading:y,isHourlyLoading:T,isModelsLoading:E,isSessionsLoading:O,isSummaryLoading:d,onModelClick:J}),e.jsxs(de,{open:!!K,onOpenChange:z=>!z&&ee(),children:[e.jsx(_e,{asChild:!0,children:e.jsx("div",{ref:s,className:"fixed pointer-events-none",style:{left:H?.x??0,top:H?.y??0,width:1,height:1}})}),e.jsx(ue,{className:"w-80 p-3",side:"top",align:"center",children:K&&e.jsx(hs,{model:K})})]})]})}export{nt as AnalyticsPage,at as AnalyticsSkeleton};
@@ -1 +0,0 @@
1
- import{j as e}from"./radix-ui-nu4wz29m.js";import{r as x}from"./react-vendor-Bjx91N7w.js";import{a as oe,c as p,B as w,e as I,bC as Se,aZ as we,bG as Ce,bH as ke,bI as Ae,bJ as Pe,bK as Te,bL as Re,bM as We,bN as De,bO as Ve,T as _e,O as Ee,R as Ge,j as Ue,k as Ie,l as $e,m as Fe,n as Le,o as Oe,p as qe,q as Me,_ as Be}from"./index-sIfjKy42.js";import{A as ze,a as Ke,b as He,c as Qe,d as Ye,e as Je,f as Xe,g as Ze}from"./alert-dialog-D0yey0YJ.js";import{u as fe,a as et,b as tt,h as st}from"./tanstack-bhJxV1h8.js";import{t as te}from"./notifications-B4_o8bcr.js";import{bf as xe,R as U,t as nt,s as rt,u as at,A as it,bg as ot,bh as lt,bi as dt,X as ct,e as ut,bj as xt,bk as mt,U as gt,v as pt,m as ft,w as ht,aF as bt,T as se,aP as yt}from"./icons-DzKUh8vG.js";import{T as me}from"./Trans-BIQ-yfAc.js";async function jt(){const t=await fetch("/api/cliproxy/sync/status");if(!t.ok){let a="Failed to fetch sync status";try{const s=await t.json();a=s.error||s.message||a}catch{}throw new Error(a)}return t.json()}async function vt(){const t=new AbortController,a=setTimeout(()=>t.abort(),3e4);try{const s=await fetch("/api/cliproxy/sync",{method:"POST",headers:{"Content-Type":"application/json"},signal:t.signal});if(!s.ok){let r="Sync failed";try{const n=await s.json();r=n.error||n.message||r}catch{}throw new Error(r)}return s.json()}catch(s){throw s instanceof Error&&s.name==="AbortError"?new Error("Sync request timed out after 30 seconds"):s}finally{clearTimeout(a)}}function Nt(){return fe({queryKey:["cliproxy-sync-status"],queryFn:jt,refetchInterval:3e4,retry:1,staleTime:1e4})}function St(){const t=et(),{t:a}=oe();return tt({mutationFn:vt,onSuccess:s=>{t.invalidateQueries({queryKey:["cliproxy-sync-status"]}),t.invalidateQueries({queryKey:["cliproxy-sync-preview"]}),s.syncedCount===0?te.info(a("toasts.noProfilesToSync")):te.success(`Synced ${s.syncedCount} profile${s.syncedCount===1?"":"s"} to CLIProxy`)},onError:s=>{te.error(a("toasts.syncFailed",{error:s.message}))}})}function ge(t){return t.replace(/-\d+$/,"").split(".").map(Number)}function ie(t,a){const s=ge(t),r=ge(a);for(let n=0;n<3;n+=1){const u=s[n]||0,c=r[n]||0;if(u>c)return 1;if(u<c)return-1}return 0}function ne(t,a){return ie(t,a)>0}function re(t,a,s){return ie(t,a)>=0&&ie(t,s)<=0}const ae={"round-robin":{title:"Round Robin",description:"Spread requests across matching accounts for even usage."},"fill-first":{title:"Fill First",description:"Drain one healthy account first and keep backups untouched until needed."}};function pe({className:t,compact:a=!1,state:s,sessionAffinityState:r,isLoading:n,isSaving:u,error:c,onApply:$,onApplyAffinity:F}){const{t:l}=oe(),y=s?.strategy??"round-robin",j=r?.enabled??!1,f=r?.ttl??"1h",m=r?.manageable??!0,[v,D]=x.useState(y),[h,P]=x.useState(j),[C,b]=x.useState(f),[L,H]=x.useState(!1),O=s?.source==="live"?"Live CLIProxy":"Saved startup default",T=n||u||!s||v===y,B=L?"Hide details":"Show details",g=n||u||!!c||!m,q=l(m?h?"routingGuidance.disableSessionAffinity":"routingGuidance.enableSessionAffinity":"routingGuidance.sessionAffinityUnavailable"),R=x.useRef(null),N=x.useRef(!1);x.useEffect(()=>{D(y)},[y]),x.useEffect(()=>{P(j),b(f)},[j,f]),x.useEffect(()=>{if(u||!R.current)return;const o=R.current;o.enabled===j&&o.ttl===f||(P(j),b(f)),R.current=null},[u,j,f]);const W=()=>{if(!m)return;const o=!h,d=C.trim()||"1h";R.current={enabled:o,ttl:d},P(o),F({enabled:o,ttl:d})},V=()=>{if(!m||c)return;if(N.current){N.current=!1;return}const o=C.trim()||"1h";o!==f&&(R.current={enabled:h,ttl:o},F({enabled:h,ttl:o}))};if(a){const o=d=>{D(d),d!==y&&$(d)};return e.jsxs("div",{className:p("group/routing mt-1 space-y-2 -mx-1 rounded-lg p-1",t),children:[e.jsxs("div",{className:"flex items-center justify-between rounded-lg transition-colors hover:bg-primary/5",children:[e.jsxs("div",{className:"flex items-center gap-2 px-1 text-xs font-medium text-foreground",children:[e.jsxs("div",{className:"relative flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-background border border-border/60 text-muted-foreground shadow-sm overflow-hidden transition-all duration-300 group-hover/routing:border-primary/40 group-hover/routing:text-primary group-hover/routing:shadow-[0_0_12px_rgba(59,130,246,0.15)] dark:group-hover/routing:shadow-[0_0_12px_rgba(59,130,246,0.1)]",children:[e.jsx("div",{className:"absolute inset-0 bg-primary/10 translate-y-full group-hover/routing:translate-y-0 transition-transform duration-300 ease-out"}),e.jsx(xe,{className:"relative z-10 h-3.5 w-3.5 transition-transform duration-300 group-hover/routing:scale-110"})]}),e.jsx("span",{className:"tracking-tight transition-colors duration-300 group-hover/routing:text-primary group-hover/routing:font-semibold",children:"Routing"}),u&&e.jsx(U,{className:"ml-1 h-3 w-3 shrink-0 animate-spin text-primary"})]}),e.jsxs("div",{className:"relative grid grid-cols-2 p-0.5 gap-0.5 rounded-lg border border-border/60 bg-muted/30 shadow-[inset_0_1px_2px_rgba(0,0,0,0.05)] dark:shadow-[inset_0_1px_3px_rgba(0,0,0,0.2)] transition-colors duration-300 group-hover/routing:border-primary/20 group-hover/routing:bg-primary/5",children:[e.jsx("div",{className:p("absolute inset-y-0.5 left-0.5 w-[calc(50%-0.1875rem)] rounded bg-background shadow-[0_1px_3px_rgba(0,0,0,0.1),0_1px_2px_rgba(0,0,0,0.06)] ring-1 ring-black/5 dark:ring-white/10 transition-all duration-300",v==="fill-first"?"translate-x-[calc(100%+0.125rem)]":"translate-x-0","group-hover/routing:shadow-[0_0_8px_rgba(59,130,246,0.15)] dark:group-hover/routing:shadow-[0_0_8px_rgba(59,130,246,0.1)] group-hover/routing:ring-primary/30"),style:{transitionTimingFunction:"cubic-bezier(0.175, 0.885, 0.32, 1.275)"}}),Object.entries(ae).map(([d,k])=>{const Q=v===d;return e.jsx("button",{type:"button",className:p("relative z-10 flex items-center justify-center rounded px-2.5 py-0.5 text-[10px] font-medium whitespace-nowrap transition-colors duration-200",Q?"text-foreground group-hover/routing:text-primary":"text-muted-foreground/70 hover:text-foreground/90 group-hover/routing:text-muted-foreground/90"),onClick:()=>o(d),disabled:n||u||!!c,title:k.description,children:k.title},d)})]})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg border border-border/60 bg-muted/20 px-2 py-1.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[10px] font-medium text-foreground",children:l("routingGuidance.sessionAffinity")}),e.jsx("div",{className:"text-[10px] text-muted-foreground",children:m?l("routingGuidance.ttlBadge",{ttl:f}):l("routingGuidance.localOnlySetting")})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[m?e.jsx("input",{"aria-label":"Session affinity TTL",className:"h-6 w-14 rounded border border-border/70 bg-background px-2 text-[10px] text-foreground",value:C,onChange:d=>b(d.target.value),onBlur:V,disabled:g}):null,e.jsx("button",{type:"button","aria-label":q,className:p("rounded border px-2 py-1 text-[10px] font-medium transition-colors",m?"border-border/70 bg-background text-foreground hover:border-primary/40 hover:text-primary":"border-border/60 bg-muted/40 text-muted-foreground"),onMouseDown:()=>{N.current=!0},onClick:W,disabled:g,title:r?.message,children:l(m?h?"routingGuidance.sessionAffinityOn":"routingGuidance.sessionAffinityOff":"routingGuidance.sessionAffinityUnavailable")})]})]}),r?.message?e.jsx("div",{className:"rounded-lg border border-border/60 bg-muted/20 px-2 py-1.5 text-[10px] text-muted-foreground",children:r.message}):null]})}return e.jsx("section",{className:p("rounded-xl border border-border/70 bg-background",t),children:e.jsxs("div",{className:"grid gap-3 px-4 py-3 xl:grid-cols-[minmax(0,1fr)_auto] xl:items-start",children:[e.jsxs("div",{className:"min-w-0 space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"inline-flex h-7 w-7 items-center justify-center rounded-lg bg-muted text-primary",children:e.jsx(xe,{className:"h-4 w-4"})}),e.jsx("div",{className:"text-sm font-medium",children:l("routingGuidance.routingStrategy")}),e.jsx(w,{variant:"secondary",children:y}),s?e.jsx(w,{variant:"outline",children:O}):null,s?e.jsx(w,{variant:"outline",children:s.target}):null]}),e.jsx("p",{className:"max-w-3xl text-xs leading-5 text-muted-foreground",children:"Proxy-wide account rotation. CCS keeps round-robin as the default until you explicitly change it."})]}),e.jsxs("div",{className:"flex flex-col gap-2 xl:items-end",children:[e.jsx("div",{className:"inline-flex flex-wrap rounded-lg border border-border/70 bg-muted/35 p-1",children:Object.entries(ae).map(([o,d])=>{const k=v===o;return e.jsx("button",{type:"button",className:p("rounded-md px-3 py-1.5 text-sm font-medium transition-colors",k?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),onClick:()=>D(o),disabled:n||u||!!c,children:d.title},o)})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(I,{type:"button",variant:"ghost",size:"sm",className:"h-8 px-2 text-xs text-muted-foreground",onClick:()=>H(o=>!o),children:[L?e.jsx(nt,{className:"mr-1 h-3.5 w-3.5"}):e.jsx(rt,{className:"mr-1 h-3.5 w-3.5"}),B]}),e.jsx(I,{size:"sm",onClick:()=>$(v),disabled:T||!!c,children:u?"Saving...":`Use ${v}`})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground xl:col-span-2",children:[e.jsx("span",{children:l("routingGuidance.roundRobin")}),e.jsx("span",{className:"hidden text-border sm:inline",children:"•"}),e.jsx("span",{children:l("routingGuidance.fillFirst")})]}),e.jsxs("div",{className:"grid gap-3 rounded-lg border border-border/70 bg-muted/20 px-3 py-3 xl:col-span-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"text-sm font-medium",children:l("routingGuidance.sessionAffinity")}),e.jsx(w,{variant:"secondary",children:l(h?"routingGuidance.sessionAffinityOn":"routingGuidance.sessionAffinityOff")}),r?.ttl?e.jsx(w,{variant:"outline",children:l("routingGuidance.ttlBadge",{ttl:f})}):null,m?null:e.jsx(w,{variant:"outline",children:l("routingGuidance.localOnly")})]}),e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:l("routingGuidance.sessionAffinityDescription")}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("input",{"aria-label":"Session affinity TTL",className:"h-9 w-24 rounded-md border border-border/70 bg-background px-3 text-sm text-foreground",value:C,onChange:o=>b(o.target.value),onBlur:V,disabled:g}),e.jsx(I,{type:"button",variant:"outline",onMouseDown:()=>{N.current=!0},onClick:W,disabled:g,"aria-label":q,children:q})]}),r?.message?e.jsx("div",{className:"rounded-lg border border-border/70 bg-background/70 px-3 py-2 text-xs text-muted-foreground",children:r.message}):null]}),c?e.jsx("div",{className:"rounded-lg border border-destructive/25 bg-destructive/5 px-3 py-2 text-sm xl:col-span-2",children:c.message}):null,!c&&s?.message?e.jsx("div",{className:"rounded-lg border border-border/70 bg-muted/35 px-3 py-2 text-xs text-muted-foreground xl:col-span-2",children:s.message}):null,L?e.jsxs("div",{className:"grid gap-4 border-t border-border/60 pt-3 md:grid-cols-2 xl:col-span-2",children:[Object.entries(ae).map(([o,d])=>{const k=y===o;return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"text-sm font-medium",children:d.title}),k?e.jsx(w,{variant:"secondary",children:"Current"}):null]}),e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:d.description})]},o)}),e.jsxs("div",{className:"space-y-1 md:col-span-2",children:[e.jsx("div",{className:"text-sm font-medium",children:l("routingGuidance.sessionRecognitionTitle")}),e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:l("routingGuidance.sessionRecognitionDescription")})]})]}):null]})})}function wt(t){if(!t)return"";const a=new Date(t).getTime(),r=Date.now()-a,n=Math.floor(r/(1e3*60*60)),u=Math.floor(r%(1e3*60*60)/(1e3*60));return n>0?`${n}h ${u}m`:`${u}m`}function Ct(t,a){if(!t)return"";const s=Date.now()-t,r=Math.floor(s/(1e3*60)),n=Math.floor(s/(1e3*60*60));return r<1?a("proxyStatusWidget.justNow"):r<60?a("proxyStatusWidget.minutesAgo",{count:r}):a("proxyStatusWidget.hoursAgo",{count:n})}function K({icon:t,tooltip:a,onClick:s,disabled:r,isPending:n,className:u,variant:c="ghost"}){return e.jsxs(Oe,{children:[e.jsx(qe,{asChild:!0,children:e.jsx(I,{variant:c==="destructive-ghost"?"ghost":c,size:"sm",className:p("h-7 w-7 p-0",c==="destructive-ghost"&&"hover:bg-destructive/10 hover:text-destructive hover:border-destructive/30",u),onClick:s,disabled:r,children:n?e.jsx(U,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(t,{className:"w-3.5 h-3.5"})})}),e.jsx(Me,{side:"bottom",className:"text-xs",children:a})]})}function _t(){const{t}=oe(),{data:a,isLoading:s}=Se(),{data:r}=we(),{data:n,isLoading:u}=Ce(),{data:c,isLoading:$,error:F}=ke(),l=Ae(),{data:y,isLoading:j,error:f}=Pe(),m=Te(),v=l.isPending||m.isPending,D=F instanceof Error?F:null,h=Re(),P=We(),C=De(),b=Ve(),{data:L}=Nt(),{mutate:H,isPending:O}=St(),[T,B]=x.useState(!1),[g,q]=x.useState(""),[R,N]=x.useState(!1),[W,V]=x.useState(null),[o,d]=x.useState(null),{data:k}=fe({queryKey:["cliproxy-server-config"],queryFn:()=>Be.cliproxyServer.get(),staleTime:3e4}),Q=st({mutationKey:["update-backend"]})>0,_=k?.remote,Y=_?.enabled&&_?.host,A=y??(f instanceof Error?{source:"unsupported",target:c?.target??(Y?"remote":"local"),reachable:!1,manageable:!1,message:f.message}:void 0),M=a?.running??!1,J=h.isPending||P.isPending||C.isPending||b.isPending||Q||O,he=r?.hasUpdate??!1,E=r?.isStable===!1,le=r?.currentVersion,z=L?.configured??!1,be=t(z?"proxyStatusWidget.syncReady":"proxyStatusWidget.noConfig"),X=E?r?.maxStableVersion||n?.latestStable:r?.latestVersion,de=n?.maxStableVersion||r?.maxStableVersion||"6.6.80",G=n?.faultyRange,ye=G&&`${G.min.replace(/-\d+$/,"")}-${G.max.replace(/-\d+$/,"")}`,Z=(i,S)=>{V(i),d(S),N(!0)},ce=async i=>{if(!i)return;const S=ne(i,de);if(G!==void 0&&re(i,G.min,G.max)){Z(i,"faulty");return}if(S){Z(i,"experimental");return}try{const ue=await b.mutateAsync({version:i});ue.requiresConfirmation&&Z(i,ue.isFaulty?"faulty":"experimental")}catch{}},je=()=>{W&&b.mutate({version:W,force:!0}),N(!1),V(null),d(null)},ve=()=>{N(!1),V(null),d(null)},Ne=Y?(()=>{const i=_.protocol||"http",S=_.port||(i==="https"?443:80);return i==="https"&&S===443||i==="http"&&S===80?_.host:`${_.host}:${S}`})():null;return Y?e.jsxs("div",{className:p("rounded-lg border p-3 transition-colors","border-blue-500/30 bg-blue-500/5"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(at,{className:"w-4 h-4 text-blue-500"}),e.jsx("span",{className:"text-sm font-medium",children:t("proxyStatusWidget.remoteProxy")}),e.jsx(w,{variant:"secondary",className:"text-[10px] h-4 px-1.5 bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",children:t("proxyStatusWidget.active")})]}),e.jsx(it,{className:"w-3 h-3 text-blue-600"})]}),e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[e.jsx("div",{className:"flex items-center gap-1 mb-1",children:e.jsx("span",{className:"font-mono",children:Ne})}),e.jsx("p",{className:"text-[10px] text-muted-foreground/70 leading-tight",children:t("proxyStatusWidget.trafficAutoRouted")})]}),e.jsx(pe,{compact:!0,className:"mt-3",state:c,sessionAffinityState:A,isLoading:$||j,isSaving:v,error:D,onApply:i=>l.mutate(i),onApplyAffinity:i=>m.mutate(i)},`remote:${c?.strategy??"round-robin"}:${A?.enabled??"na"}:${A?.ttl??"na"}:${A?.manageable??"na"}`)]}):e.jsx(_e,{delayDuration:300,children:e.jsxs("div",{className:p("rounded-lg border p-3 transition-colors",M?"border-green-500/30 bg-green-500/5":"border-muted bg-muted/30"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:p("w-2 h-2 rounded-full",M?"bg-green-500 animate-pulse":"bg-muted-foreground/30")}),e.jsx("span",{className:"text-sm font-medium",children:r?.backendLabel??"CLIProxy"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[s?e.jsx(U,{className:"w-3 h-3 animate-spin text-muted-foreground"}):M?e.jsxs(e.Fragment,{children:[e.jsx(K,{icon:O?U:ot,tooltip:t("proxyStatusWidget.tooltipSync"),onClick:()=>H(),disabled:!z||J,isPending:O}),e.jsx(K,{icon:lt,tooltip:t("proxyStatusWidget.tooltipRestart"),onClick:()=>C.mutate(),disabled:J,isPending:C.isPending}),e.jsx(K,{icon:dt,tooltip:t("proxyStatusWidget.tooltipStop"),onClick:()=>P.mutate(),disabled:J,isPending:P.isPending,variant:"destructive-ghost"})]}):null,e.jsx(K,{icon:T?ct:ut,tooltip:t(T?"proxyStatusWidget.tooltipClose":"proxyStatusWidget.tooltipVersionSettings"),onClick:()=>B(!T),className:T?"bg-muted":void 0})]})]}),le&&e.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[e.jsxs("span",{className:p("text-xs font-mono text-muted-foreground",E&&"text-amber-600 dark:text-amber-400"),children:["v",le]}),(he||E)&&X&&e.jsxs(w,{variant:"secondary",className:p("text-[10px] h-4 px-1.5 gap-0.5 cursor-pointer transition-colors",E?"bg-amber-100 text-amber-700 hover:bg-amber-200 dark:bg-amber-900/30 dark:text-amber-400 dark:hover:bg-amber-900/50":"bg-green-100 text-green-700 hover:bg-green-200 dark:bg-green-900/30 dark:text-green-400 dark:hover:bg-green-900/50"),onClick:()=>void ce(X),title:t(E?"proxyStatusWidget.clickToDowngrade":"proxyStatusWidget.clickToUpdate"),children:[E?e.jsx(xt,{className:"w-2.5 h-2.5"}):e.jsx(mt,{className:"w-2.5 h-2.5"}),X]})]}),M&&a&&e.jsxs("div",{className:"mt-2 flex items-center gap-4 text-xs text-muted-foreground",children:[e.jsx("span",{className:"flex items-center gap-1",children:t("proxyStatusWidget.port",{port:a.port})}),a.sessionCount!==void 0&&a.sessionCount>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(gt,{className:"w-3 h-3"}),t("proxyStatusWidget.sessionCount",{count:a.sessionCount})]}),a.startedAt&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(pt,{className:"w-3 h-3"}),wt(a.startedAt)]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs",children:[z?e.jsx(ft,{className:"w-3 h-3 text-green-600 dark:text-green-400"}):e.jsx(ht,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:p("text-xs",z?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:be})]}),e.jsx(pe,{compact:!0,className:"mt-3",state:c,sessionAffinityState:A,isLoading:$||j,isSaving:v,error:D,onApply:i=>l.mutate(i),onApplyAffinity:i=>m.mutate(i)},`local:${c?.strategy??"round-robin"}:${A?.enabled??"na"}:${A?.ttl??"na"}:${A?.manageable??"na"}`),e.jsx(Ee,{open:T,onOpenChange:B,children:e.jsxs(Ge,{className:"mt-3 pt-3 border-t border-muted",children:[e.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-3",children:t("proxyStatusWidget.versionManagement")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Ue,{value:g,onValueChange:q,disabled:u,children:[e.jsx(Ie,{className:"h-8 text-xs flex-1",children:e.jsx($e,{placeholder:t("proxyStatusWidget.selectVersionPlaceholder")})}),e.jsx(Fe,{children:n?.versions.slice(0,20).map(i=>{const S=n?.maxStableVersion&&ne(i,n.maxStableVersion),ee=n?.faultyRange&&re(i,n.faultyRange.min,n.faultyRange.max);return e.jsx(Le,{value:i,className:"text-xs",children:e.jsxs("span",{className:"flex items-center gap-2",children:["v",i,i===n.latestStable&&e.jsx("span",{className:"text-green-600 dark:text-green-400",children:t("proxyStatusWidget.stable")}),(ee||S)&&e.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:"⚠"})]})},i)})})]}),e.jsxs(I,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5 px-3",onClick:()=>void ce(g),disabled:b.isPending||!g,children:[b.isPending?e.jsx(U,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(bt,{className:"w-3.5 h-3.5"}),t("proxyStatusWidget.install")]})]}),g&&n?.maxStableVersion&&ne(g,n.maxStableVersion)&&e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[e.jsx(se,{className:"w-3.5 h-3.5 flex-shrink-0"}),e.jsx("span",{children:t("proxyStatusWidget.versionsAboveUnstable",{version:n.maxStableVersion})})]}),g&&n?.faultyRange&&re(g,n.faultyRange.min,n.faultyRange.max)&&e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[e.jsx(se,{className:"w-3.5 h-3.5 flex-shrink-0"}),e.jsx("span",{children:t("proxyStatusWidget.versionsKnownIssues",{version:g})})]}),r?.checkedAt&&e.jsx("div",{className:"mt-2 text-[10px] text-muted-foreground/60",children:t("proxyStatusWidget.lastChecked",{time:Ct(r.checkedAt,t)})})]})}),!M&&e.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:t("proxyStatusWidget.notRunning")}),e.jsxs(I,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>h.mutate(),disabled:h.isPending,children:[h.isPending?e.jsx(U,{className:"w-3 h-3 animate-spin"}):e.jsx(yt,{className:"w-3 h-3"}),t("proxyStatusWidget.start")]})]}),e.jsx(ze,{open:R,onOpenChange:N,children:e.jsxs(Ke,{children:[e.jsxs(He,{children:[e.jsxs(Qe,{className:"flex items-center gap-2",children:[e.jsx(se,{className:"w-5 h-5 text-amber-500"}),t(o==="faulty"?"proxyStatusWidget.installFaultyTitle":"proxyStatusWidget.installUnstableTitle")]}),e.jsxs(Ye,{className:"space-y-2",children:[o==="faulty"?e.jsx("p",{children:e.jsx(me,{i18nKey:"proxyStatusWidget.installFaultyDesc",values:{version:W??"",range:ye||""},components:{strong:e.jsx("strong",{})}})}):e.jsx("p",{children:e.jsx(me,{i18nKey:"proxyStatusWidget.installUnstableDesc",values:{version:W??"",maxStable:de},components:{strong:e.jsx("strong",{})}})}),e.jsx("p",{className:"text-amber-600 dark:text-amber-400",children:t(o==="faulty"?"proxyStatusWidget.installFaultyWarning":"proxyStatusWidget.installUnstableWarning")}),e.jsx("p",{children:t("proxyStatusWidget.installUnstableConfirm")})]})]}),e.jsxs(Je,{children:[e.jsx(Xe,{onClick:ve,children:t("proxyStatusWidget.cancel")}),e.jsx(Ze,{onClick:je,className:"bg-amber-500 hover:bg-amber-600 text-white",children:t("proxyStatusWidget.installAnyway")})]})]})})]})})}export{_t as P};
@@ -1 +0,0 @@
1
- import{j as e}from"./radix-ui-nu4wz29m.js";import{L,r as c}from"./react-vendor-Bjx91N7w.js";import{a as x,B as P,c as S,Y as M,e as u,z as U,C,s as v,t as N,a0 as w,b as j,x as b,I as B}from"./index-sIfjKy42.js";import{a1 as F,$ as z,ba as W,x as H,E as Q,Q as G,aa as K,C as Y,bb as q,av as J}from"./icons-DzKUh8vG.js";import"./tanstack-bhJxV1h8.js";import"./notifications-B4_o8bcr.js";import"./utils-CzKF5WmX.js";import"./form-utils-CuHzLhJZ.js";import"./charts-eIPy2oG6.js";const V={new:"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-900/50 dark:bg-blue-900/20 dark:text-blue-300",stable:"border-green-200 bg-green-50 text-green-700 dark:border-green-900/50 dark:bg-green-900/20 dark:text-green-300",planned:"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/50 dark:bg-amber-900/20 dark:text-amber-300"};function Z({status:s,className:t}){const{t:r}=x(),i={new:r("updates.statusNew"),stable:r("updates.statusStable"),planned:r("updates.statusPlanned")};return e.jsx(P,{variant:"outline",className:S("font-medium",V[s],t),children:i[s]})}const g={target:"Target CLI",cliproxy:"CLIProxy Provider","api-profiles":"API Profile",websearch:"WebSearch"},X=[{id:"codex-target-runtime-support",title:"Native Codex runtime support is live",summary:"Codex now participates as a first-class runtime target through ccs-codex, ccsx, ccsxp, or --target codex.",primaryAction:"Use Codex as a runtime target for native Codex sessions and Codex-routed CLIProxy flows.",publishedAt:"2026-03-28",status:"new",scopes:["target","cliproxy","api-profiles"],entryIds:["codex-target","codex-cliproxy"],highlights:["Use ccs-codex or ccsx for native Codex runs.","Use ccsxp for native Codex with the cliproxy provider shortcut.","Use ccs codex --target codex when you want the explicit CCS-managed Codex bridge.","Codex remains runtime-only for saved defaults; use runtime aliases or --target codex at launch time."],actions:[{id:"copy-codex-alias-command",label:"Open native Codex",description:"Launch Codex through the explicit CCS runtime alias.",type:"command",command:"ccs-codex"},{id:"copy-codex-provider-command",label:"Run native Codex with cliproxy",description:"Use the native Codex cliproxy shortcut through CCS.",type:"command",command:'ccsxp "your prompt"'},{id:"copy-codex-provider-command-explicit",label:"Run the managed Codex bridge explicitly",description:"Use the explicit CCS-managed Codex bridge on native Codex.",type:"command",command:'ccs codex --target codex "your prompt"'},{id:"open-codex-dashboard",label:"Open Codex dashboard",description:"Review Codex runtime support, config layers, and dashboard setup flows.",type:"route",path:"/codex"}],routes:[{label:"Codex CLI",path:"/codex"}],commands:["ccs-codex","ccsx",'ccsxp "your prompt"','ccs codex --target codex "your prompt"']},{id:"droid-target-support",title:"Factory Droid support is live",summary:"API Profiles and CLIProxy variants now support Droid as a first-class execution target.",primaryAction:"Set Droid as your default execution target for non-Claude workflows.",publishedAt:"2026-02-25",status:"new",scopes:["target","api-profiles","cliproxy"],entryIds:["droid-target","custom-api-profiles","codex-cliproxy","agy-cliproxy"],highlights:["Set default target to Droid when creating or editing API Profiles.","Set default target to Droid for CLIProxy variants, including Codex and Antigravity flows.","Use ccs-droid as the explicit alias, with ccsd kept as the legacy shortcut."],actions:[{id:"open-api-profiles",label:"Set default target in API Profiles",description:"Open API Profiles and set Default Target to Droid for profiles you run often.",type:"route",path:"/providers"},{id:"open-cliproxy",label:"Set default target in CLIProxy variants",description:"Open CLIProxy variants and set target to Droid for Codex/Antigravity or custom variants.",type:"route",path:"/cliproxy"},{id:"copy-ccs-droid-command",label:"Run once with explicit Droid alias",description:"Use ccs-droid to force the Droid target with your current profile.",type:"command",command:"ccs-droid glm"},{id:"copy-target-override",label:"Run once with --target override",description:"Keep your default profile but force Droid for a single command.",type:"command",command:'ccs codex --target droid "your prompt"'}],routes:[{label:"API Profiles",path:"/providers"},{label:"CLIProxy",path:"/cliproxy"}],commands:["ccs-droid glm",'ccs codex --target droid "your prompt"',"ccs cliproxy create mycodex --provider codex --target droid"]},{id:"updates-center-launch",title:"Updates Center is available for rollout tasks",summary:"A focused Updates Center exists for setup tasks and rollout guidance when you need it.",primaryAction:"Use this page only when needed for rollout tasks, then return to your normal workflow.",publishedAt:"2026-02-25",status:"new",scopes:["target","cliproxy","api-profiles","websearch"],entryIds:["droid-target","codex-cliproxy","custom-api-profiles","opencode-websearch"],highlights:["Single data source powers update content and integration mapping.","Notices can be tracked as new, seen, done, or dismissed.","Catalog covers target CLI, CLIProxy providers, and WebSearch integrations."],actions:[{id:"open-updates-page",label:"Open Updates Center when needed",description:"Review rollout tasks only when you want guided setup changes.",type:"route",path:"/updates"},{id:"copy-open-dashboard",label:"Open dashboard from terminal",description:"Re-open config dashboard anytime from CLI.",type:"command",command:"ccs config"}],routes:[{label:"Updates Center",path:"/updates"}],commands:["ccs config"]}],ee=[{id:"claude-target",name:"Claude Code",scope:"target",status:"stable",summary:"Default runtime target for all CCS profile types.",pillars:{baseUrl:"From profile settings (ANTHROPIC_BASE_URL)",auth:"From profile settings (ANTHROPIC_AUTH_TOKEN)",model:"From profile settings (ANTHROPIC_MODEL)"},routes:[{label:"API Profiles",path:"/providers"},{label:"CLIProxy",path:"/cliproxy"}],commands:["ccs",'ccs glm "your prompt"']},{id:"droid-target",name:"Factory Droid",scope:"target",status:"new",summary:"First-class target for API Profiles and CLIProxy variants.",pillars:{baseUrl:"From profile or variant settings",auth:"From profile or variant settings",model:"From profile or variant settings"},routes:[{label:"API Profiles",path:"/providers"},{label:"CLIProxy",path:"/cliproxy"}],commands:["ccs-droid glm","ccs km --target droid","ccs codex --target droid"],notes:"Use ccs-droid as the explicit runtime alias. Legacy ccsd still works."},{id:"codex-target",name:"Codex CLI",scope:"target",status:"new",summary:"First-class runtime target for native Codex sessions and Codex-routed CLIProxy flows.",pillars:{baseUrl:"Native ~/.codex config for default mode, transient -c overrides for CCS-backed routes",auth:"Native Codex auth for default mode, env_key injection for CCS-backed routes",model:"Native Codex config or routed Codex model mapping from CLIProxy"},routes:[{label:"Codex CLI",path:"/codex"}],commands:["ccs-codex","ccsx","ccs codex --target codex","ccs codex-api --target codex"],notes:"Codex is still runtime-only for saved defaults; use --target codex or the runtime aliases at launch time."},{id:"codex-cliproxy",name:"Codex via CLIProxy",scope:"cliproxy",status:"stable",summary:"OAuth-backed provider with configurable variant model and a native Codex shortcut.",pillars:{baseUrl:"Managed by CLIProxy backend",auth:"OAuth account via CLIProxy auth flow",model:"Selectable per provider or variant"},routes:[{label:"CLIProxy",path:"/cliproxy"},{label:"Control Panel",path:"/cliproxy/control-panel"}],commands:['ccsxp "your prompt"',"ccs codex --target codex","ccs codex","ccs cliproxy create mycodex --provider codex","ccs api create codex-api --cliproxy-provider codex"],notes:"Use ccsxp when you want native Codex with the cliproxy shortcut; use ccs codex --target codex for the explicit managed bridge."},{id:"gemini-cliproxy",name:"Gemini via CLIProxy",scope:"cliproxy",status:"stable",summary:"OAuth-backed Gemini provider with multi-account management.",pillars:{baseUrl:"Managed by CLIProxy backend",auth:"OAuth account via CLIProxy auth flow",model:"Selectable per provider or variant"},routes:[{label:"CLIProxy",path:"/cliproxy"},{label:"Control Panel",path:"/cliproxy/control-panel"}],commands:["ccs gemini","ccs cliproxy create mygem --provider gemini"]},{id:"agy-cliproxy",name:"Antigravity via CLIProxy",scope:"cliproxy",status:"stable",summary:"OAuth-backed Antigravity provider with variant target controls.",pillars:{baseUrl:"Managed by CLIProxy backend",auth:"OAuth account via CLIProxy auth flow",model:"Selectable per provider or variant"},routes:[{label:"CLIProxy",path:"/cliproxy"},{label:"Control Panel",path:"/cliproxy/control-panel"}],commands:["ccs agy","ccs cliproxy create myagy --provider agy --target droid"]},{id:"custom-api-profiles",name:"Custom API Profiles",scope:"api-profiles",status:"stable",summary:"Any Anthropic-compatible endpoint with per-profile target and model mapping.",pillars:{baseUrl:"User-defined endpoint",auth:"User-defined token/key",model:"User-defined model identifier"},routes:[{label:"API Profiles",path:"/providers"}],commands:["ccs api create myprofile",'ccs myprofile "your prompt"']},{id:"opencode-websearch",name:"OpenCode WebSearch",scope:"websearch",status:"stable",summary:"WebSearch provider surfaced in Settings for third-party profile workflows.",pillars:{baseUrl:"Managed by OpenCode CLI integration",auth:"Provider-specific (managed externally)",model:"Configurable in WebSearch settings"},routes:[{label:"Settings",path:"/settings"}],commands:["ccs config",'ccs codex "your prompt"'],notes:"Enable OpenCode in Settings > WebSearch to activate fallback search."}];function l(s,t,r){return M.t(s,{defaultValue:t,...r})}function se(){return{target:l("supportCatalog.scope.target",g.target),cliproxy:l("supportCatalog.scope.cliproxy",g.cliproxy),"api-profiles":l("supportCatalog.scope.apiProfiles",g["api-profiles"]),websearch:l("supportCatalog.scope.websearch",g.websearch)}}function te(s){return{...s,title:l(`supportCatalog.notice.${s.id}.title`,s.title),summary:l(`supportCatalog.notice.${s.id}.summary`,s.summary),primaryAction:l(`supportCatalog.notice.${s.id}.primaryAction`,s.primaryAction),highlights:s.highlights.map((t,r)=>l(`supportCatalog.notice.${s.id}.highlight.${r}`,t)),actions:s.actions.map(t=>({...t,label:l(`supportCatalog.notice.${s.id}.action.${t.id}.label`,t.label),description:l(`supportCatalog.notice.${s.id}.action.${t.id}.description`,t.description)})),routes:s.routes.map((t,r)=>({...t,label:l(`supportCatalog.notice.${s.id}.route.${r}.label`,t.label)}))}}function re(s){return{...s,name:l(`supportCatalog.entry.${s.id}.name`,s.name),summary:l(`supportCatalog.entry.${s.id}.summary`,s.summary),pillars:{baseUrl:l(`supportCatalog.entry.${s.id}.pillar.baseUrl`,s.pillars.baseUrl),auth:l(`supportCatalog.entry.${s.id}.pillar.auth`,s.pillars.auth),model:l(`supportCatalog.entry.${s.id}.pillar.model`,s.pillars.model)},routes:s.routes.map((t,r)=>({...t,label:l(`supportCatalog.entry.${s.id}.route.${r}.label`,t.label)})),notes:s.notes?l(`supportCatalog.entry.${s.id}.notes`,s.notes):s.notes}}function ae(){return X.map(te)}function oe(){return ee.map(re)}function ie(s){const t=new Map(oe().map(r=>[r.id,r]));return s.entryIds.map(r=>t.get(r)).filter(r=>!!r)}function O(s){const t=new Date(`${s}T00:00:00Z`);return Number.isNaN(t.getTime())?s:new Intl.DateTimeFormat(void 0,{year:"numeric",month:"short",day:"numeric",timeZone:"UTC"}).format(t)}const $="ccs:updates:notice-progress:v1";function de(s){return s==="new"?"new":"seen"}function m(s,t){return t[s.id]??de(s.status)}function A(s){return s!=="done"&&s!=="dismissed"}function le(){if(typeof window>"u")return{};try{const s=window.localStorage.getItem($);if(!s)return{};const t=JSON.parse(s);if(!t||typeof t!="object"||Array.isArray(t))return{};const r={};for(const[i,d]of Object.entries(t))typeof i=="string"&&(d==="new"||d==="seen"||d==="done"||d==="dismissed")&&(r[i]=d);return r}catch{return{}}}function ne(s){typeof window>"u"||window.localStorage.setItem($,JSON.stringify(s))}function D({state:s,className:t}){const{t:r}=x(),i={new:{label:r("updates.progressNeedsAction"),className:"border-amber-300/70 bg-amber-100/70 text-amber-800 dark:border-amber-500/40 dark:bg-amber-500/15 dark:text-amber-300",showDot:!0},seen:{label:r("updates.progressInReview"),className:"border-blue-300/70 bg-blue-100/70 text-blue-800 dark:border-blue-500/40 dark:bg-blue-500/15 dark:text-blue-300"},done:{label:r("updates.progressDone"),className:"border-emerald-300/70 bg-emerald-100/70 text-emerald-800 dark:border-emerald-500/40 dark:bg-emerald-500/15 dark:text-emerald-300"},dismissed:{label:r("updates.progressDismissed"),className:"border-muted-foreground/20 bg-muted text-muted-foreground dark:border-muted-foreground/30"}}[s];return e.jsxs(P,{variant:"outline",className:S("gap-1.5 border text-[10px] font-medium",i.className,t),children:[i.showDot&&e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current"}),i.label]})}function ce({action:s}){const{t}=x();return e.jsxs("div",{className:"rounded-md border bg-muted/20 p-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 space-y-0.5",children:[e.jsx("p",{className:"text-sm font-medium",children:s.label}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.description})]}),s.type==="route"&&s.path&&e.jsx(u,{size:"sm",asChild:!0,children:e.jsxs(L,{to:s.path,children:[t("updates.open"),e.jsx(F,{className:"h-3.5 w-3.5"})]})})]}),s.type==="command"&&s.command&&e.jsxs("div",{className:"mt-2 flex items-center gap-2 rounded-md border bg-background px-2 py-1.5",children:[e.jsx(z,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("code",{className:"min-w-0 flex-1 truncate text-[11px]",children:s.command}),e.jsx(U,{value:s.command})]})]})}function pe({notice:s,progress:t,relatedEntries:r,onUpdateProgress:i}){const{t:d}=x(),f=se();return s?e.jsxs("div",{className:"flex-1 min-w-0 bg-background grid grid-rows-[auto_minmax(0,1fr)] overflow-hidden",children:[e.jsxs("div",{className:"border-b bg-background px-4 py-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("h2",{className:"text-base font-semibold leading-tight",children:s.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.summary})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[t&&e.jsx(D,{state:t}),e.jsx(Z,{status:s.status})]})]}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(W,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:d("updates.published",{date:O(s.publishedAt)})})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs(u,{size:"sm",onClick:()=>i("done"),children:[e.jsx(H,{className:"h-4 w-4"}),d("updates.markDone")]}),e.jsxs(u,{size:"sm",variant:"outline",onClick:()=>i("dismissed"),children:[e.jsx(Q,{className:"h-4 w-4"}),d("updates.dismiss")]}),e.jsxs(u,{size:"sm",variant:"ghost",onClick:()=>i("new"),children:[e.jsx(G,{className:"h-4 w-4"}),d("updates.reopen")]})]})]}),e.jsx("div",{className:"min-h-0 p-4",children:e.jsxs("div",{className:"grid h-full gap-4 xl:grid-cols-[minmax(0,1.5fr)_minmax(320px,1fr)] overflow-hidden",children:[e.jsxs(C,{className:"h-full overflow-hidden",children:[e.jsxs(v,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(K,{className:"h-4 w-4 text-primary"}),e.jsx(N,{className:"text-base",children:d("updates.doNext")})]}),e.jsx(w,{children:s.primaryAction})]}),e.jsx(j,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-3",children:s.actions.map(o=>e.jsx(ce,{action:o},`${s.id}-${o.id}`))})})})]}),e.jsxs("div",{className:"grid h-full grid-rows-[minmax(0,1fr)_minmax(0,1fr)] gap-4 overflow-hidden",children:[e.jsxs(C,{className:"overflow-hidden",children:[e.jsxs(v,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:d("updates.impactedIntegrations")}),e.jsx(w,{children:d("updates.impactedDesc")})]}),e.jsx(j,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-2",children:r.map(o=>e.jsxs("div",{className:"rounded-md border bg-muted/20 p-2.5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("p",{className:"min-w-0 truncate text-sm font-medium",children:o.name}),e.jsx(P,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:f[o.scope]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[o.routes[0]&&e.jsx(u,{size:"sm",variant:"outline",asChild:!0,children:e.jsx(L,{to:o.routes[0].path,children:o.routes[0].label})}),o.commands[0]&&e.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-1.5",children:[e.jsx("code",{className:"truncate rounded bg-background px-1.5 py-0.5 text-[11px]",children:o.commands[0]}),e.jsx(U,{value:o.commands[0]})]})]})]},o.id))})})})]}),e.jsxs(C,{className:"overflow-hidden",children:[e.jsxs(v,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:d("updates.whyMatters")}),e.jsx(w,{children:d("updates.whyMattersDesc")})]}),e.jsx(j,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("ul",{className:"space-y-2 text-sm text-muted-foreground",children:s.highlights.map(o=>e.jsxs("li",{children:["- ",o]},`${s.id}-${o}`))})})})]})]})]})})]}):e.jsx("div",{className:"flex h-full items-center justify-center rounded-lg border border-dashed bg-muted/20 p-6",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:d("updates.noUpdates")})})}function me({notice:s,progress:t,selected:r,onSelect:i}){return e.jsxs("button",{type:"button",onClick:i,className:S("w-full rounded-lg border px-3 py-3 text-left transition-colors",r?"border-primary/30 bg-primary/10":"border-transparent bg-background/40 hover:border-border hover:bg-muted/70"),children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:s.title}),e.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",children:s.primaryAction})]}),e.jsx(Y,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"})]}),e.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-[11px] text-muted-foreground",children:O(s.publishedAt)}),e.jsx(D,{state:t})]})]})}function ue(s,t){return t?[s.title,s.summary,s.primaryAction,...s.highlights,...s.commands,...s.actions.map(i=>`${i.label} ${i.description} ${i.command||""}`),...s.routes.map(i=>i.label)].join(" ").toLowerCase().includes(t):!0}function je(){const{t:s}=x(),t=[...ae()].sort((a,n)=>n.publishedAt.localeCompare(a.publishedAt)),[r,i]=c.useState("inbox"),[d,f]=c.useState(""),[o,k]=c.useState(()=>le()),[I,E]=c.useState(null);c.useEffect(()=>{ne(o)},[o]);const h=c.useMemo(()=>{const a=d.trim().toLowerCase();return t.filter(n=>{const y=m(n,o);return ue(n,a)?r==="done"?y==="done":r==="inbox"?A(y):!0:!1})},[t,o,d,r]),p=c.useMemo(()=>{const a=r==="all"?t:h;return a.find(n=>n.id===I)??a[0]??null},[t,I,r,h]),R=a=>{E(a.id),k(n=>m(a,n)!=="new"?n:{...n,[a.id]:"seen"})},T=c.useMemo(()=>t.filter(a=>A(m(a,o))).length,[t,o]),_=c.useMemo(()=>t.filter(a=>m(a,o)==="done").length,[t,o]);return e.jsxs("div",{className:"flex h-full min-h-0 overflow-hidden",children:[e.jsxs("div",{className:"w-80 border-r bg-muted/30 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(q,{className:"h-5 w-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:s("updates.inboxTitle")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("updates.inboxSubtitle")})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5",children:[e.jsx("p",{className:"text-muted-foreground",children:s("updates.needsAction")}),e.jsx("p",{className:"text-base font-semibold",children:T})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5",children:[e.jsx("p",{className:"text-muted-foreground",children:s("updates.doneCount")}),e.jsx("p",{className:"text-base font-semibold",children:_})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(J,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(B,{value:d,onChange:a=>f(a.target.value),placeholder:s("updates.searchPlaceholder"),className:"h-9 pl-8"})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:[{id:"inbox",label:s("updates.actionRequired")},{id:"done",label:s("updates.done")},{id:"all",label:s("updates.all")}].map(a=>e.jsx(u,{size:"sm",variant:r===a.id?"default":"outline",onClick:()=>i(a.id),children:a.label},a.id))})]}),e.jsx(b,{className:"flex-1",children:e.jsx("div",{className:"space-y-2 p-2",children:h.length===0?e.jsx("div",{className:"rounded-md border border-dashed p-3 text-xs text-muted-foreground",children:s("updates.noNotices")}):h.map(a=>e.jsx(me,{notice:a,progress:m(a,o),selected:p?.id===a.id,onSelect:()=>R(a)},a.id))})})]}),e.jsx(pe,{notice:p,progress:p?m(p,o):null,relatedEntries:p?ie(p):[],onUpdateProgress:a=>{p&&k(n=>({...n,[p.id]:a}))}})]})}export{je as UpdatesPage};
@@ -1,113 +0,0 @@
1
- import { readFileSync } from 'node:fs';
2
- import { spawnSync } from 'node:child_process';
3
-
4
- const ISSUE_REF_PATTERN = /#([0-9]+)/g;
5
- const ACTION_VERB_PATTERN = /\b(fixes|closes|resolves|refs?)\b(.*)/gi;
6
- const RESOLVE_VERB_PATTERN = /\b(fixes|closes|resolves)\b(.*)/gi;
7
- const PR_REF_PATTERN = /(?:Merge pull request #|\(#)([0-9]+)/g;
8
- const STABLE_TAG_PATTERN = /^v[0-9]+\.[0-9]+\.[0-9]+$/;
9
-
10
- export function extractIssueNumbers(text, { includeRefs = true } = {}) {
11
- const pattern = includeRefs ? ACTION_VERB_PATTERN : RESOLVE_VERB_PATTERN;
12
- const issues = new Set();
13
- let actionMatch;
14
-
15
- pattern.lastIndex = 0;
16
- while ((actionMatch = pattern.exec(text || '')) !== null) {
17
- const tail = actionMatch[2] || '';
18
- let issueMatch;
19
- ISSUE_REF_PATTERN.lastIndex = 0;
20
- while ((issueMatch = ISSUE_REF_PATTERN.exec(tail)) !== null) {
21
- issues.add(Number(issueMatch[1]));
22
- }
23
- }
24
-
25
- return [...issues].sort((a, b) => a - b);
26
- }
27
-
28
- export function extractPrNumbers(text) {
29
- const prs = new Set();
30
- let match;
31
-
32
- PR_REF_PATTERN.lastIndex = 0;
33
- while ((match = PR_REF_PATTERN.exec(text || '')) !== null) {
34
- prs.add(Number(match[1]));
35
- }
36
-
37
- return [...prs].sort((a, b) => a - b);
38
- }
39
-
40
- export function planIssueCleanup({ releaseIssues, resolvedIssues, issueStates }) {
41
- const resolved = new Set(resolvedIssues);
42
- return releaseIssues.map((number) => {
43
- const state = issueStates.get(number) || { labels: [], state: 'UNKNOWN' };
44
- const labels = new Set(state.labels);
45
- const wasReleasedDev = labels.has('released-dev');
46
- const shouldClose = state.state === 'OPEN' && (wasReleasedDev || resolved.has(number));
47
-
48
- return {
49
- number,
50
- removeLabels: ['released-dev', 'pending-release'],
51
- addReleasedLabel: shouldClose,
52
- close: shouldClose,
53
- reason: wasReleasedDev ? 'promoted from dev to stable' : 'resolved by stable release',
54
- };
55
- });
56
- }
57
-
58
- export function getStableReleaseContext({ env = process.env, exec = runCommand } = {}) {
59
- const repo = env.GITHUB_REPOSITORY;
60
- if (!repo) throw new Error('GITHUB_REPOSITORY is required');
61
-
62
- const version = JSON.parse(readFileSync('package.json', 'utf8')).version;
63
- const currentTag = `v${version}`;
64
- const releaseBody = exec('gh', [
65
- 'release',
66
- 'view',
67
- currentTag,
68
- '--repo',
69
- repo,
70
- '--json',
71
- 'body',
72
- '--jq',
73
- '.body',
74
- ]);
75
- const tags = exec('git', ['tag', '-l', 'v[0-9]*.[0-9]*.[0-9]*', '--sort=-v:refname'])
76
- .split('\n')
77
- .map((tag) => tag.trim())
78
- .filter((tag) => STABLE_TAG_PATTERN.test(tag) && tag !== currentTag);
79
- const previousStableTag = tags[0] || '';
80
- const range = previousStableTag ? `${previousStableTag}..HEAD~1` : 'HEAD~50..HEAD~1';
81
- const commitText = exec('git', ['log', range, '--pretty=format:%s%n%b'], { optional: true });
82
-
83
- return { repo, version, currentTag, releaseBody, range, commitText };
84
- }
85
-
86
- export function buildReleaseIssueSet({ releaseBody, commitText, prText }) {
87
- const releaseIssues = new Set([
88
- ...extractIssueNumbers(releaseBody, { includeRefs: true }),
89
- ...extractIssueNumbers(commitText, { includeRefs: true }),
90
- ...extractIssueNumbers(prText, { includeRefs: true }),
91
- ]);
92
- const resolvedIssues = new Set([
93
- ...extractIssueNumbers(releaseBody, { includeRefs: false }),
94
- ...extractIssueNumbers(commitText, { includeRefs: false }),
95
- ...extractIssueNumbers(prText, { includeRefs: false }),
96
- ]);
97
-
98
- return {
99
- releaseIssues: [...releaseIssues].sort((a, b) => a - b),
100
- resolvedIssues: [...resolvedIssues].sort((a, b) => a - b),
101
- };
102
- }
103
-
104
- export function runCommand(command, args, { optional = false } = {}) {
105
- const result = spawnSync(command, args, { encoding: 'utf8' });
106
- if (result.status !== 0) {
107
- if (optional) return '';
108
- throw new Error(
109
- `${command} ${args.join(' ')} failed: ${(result.stderr || result.stdout || '').trim()}`
110
- );
111
- }
112
- return result.stdout.trim();
113
- }
@@ -1,134 +0,0 @@
1
- import {
2
- buildReleaseIssueSet,
3
- extractPrNumbers,
4
- getStableReleaseContext,
5
- planIssueCleanup,
6
- runCommand,
7
- } from './stable-release-issue-cleanup-lib.mjs';
8
-
9
- function gh(args, options) {
10
- return runCommand('gh', args, options);
11
- }
12
-
13
- function fetchPrText(repo, commitText) {
14
- let prText = '';
15
- for (const prNumber of extractPrNumbers(commitText)) {
16
- const details = gh(
17
- [
18
- 'pr',
19
- 'view',
20
- String(prNumber),
21
- '--repo',
22
- repo,
23
- '--json',
24
- 'title,body',
25
- '--jq',
26
- '.title + "\n" + (.body // "")',
27
- ],
28
- { optional: true }
29
- );
30
- if (details) prText += `\n${details}`;
31
- }
32
- return prText;
33
- }
34
-
35
- function fetchIssueStates(repo, issueNumbers) {
36
- const states = new Map();
37
- for (const number of issueNumbers) {
38
- const raw = gh(
39
- [
40
- 'issue',
41
- 'view',
42
- String(number),
43
- '--repo',
44
- repo,
45
- '--json',
46
- 'state,labels',
47
- '--jq',
48
- '{state:.state,labels:[.labels[].name]}',
49
- ],
50
- { optional: true }
51
- );
52
- if (!raw) continue;
53
- states.set(number, JSON.parse(raw));
54
- }
55
- return states;
56
- }
57
-
58
- function ensureReleasedLabel(repo) {
59
- gh(
60
- [
61
- 'label',
62
- 'create',
63
- 'released',
64
- '--color',
65
- 'ededed',
66
- '--description',
67
- 'Fix available in stable npm channel',
68
- '--repo',
69
- repo,
70
- ],
71
- { optional: true }
72
- );
73
- }
74
-
75
- function applyAction(repo, action) {
76
- console.log(`Cleaning release state on issue #${action.number}`);
77
- for (const label of action.removeLabels) {
78
- gh(['issue', 'edit', String(action.number), '--remove-label', label, '--repo', repo], {
79
- optional: true,
80
- });
81
- }
82
-
83
- if (!action.close) return;
84
-
85
- gh(['issue', 'edit', String(action.number), '--add-label', 'released', '--repo', repo], {
86
- optional: true,
87
- });
88
- gh(
89
- [
90
- 'issue',
91
- 'close',
92
- String(action.number),
93
- '--comment',
94
- '[bot] Closing issue because this fix/feature is now in stable release (@latest).',
95
- '--repo',
96
- repo,
97
- ],
98
- { optional: true }
99
- );
100
- console.log(`Closed issue #${action.number}: ${action.reason}`);
101
- }
102
-
103
- export function main() {
104
- const context = getStableReleaseContext();
105
- console.log(`Checking stable release issue lifecycle for ${context.currentTag}`);
106
- console.log(`Checking commits in range: ${context.range}`);
107
-
108
- const prText = fetchPrText(context.repo, context.commitText);
109
- const { releaseIssues, resolvedIssues } = buildReleaseIssueSet({
110
- releaseBody: context.releaseBody,
111
- commitText: context.commitText,
112
- prText,
113
- });
114
-
115
- if (releaseIssues.length === 0) {
116
- console.log(`No release-scoped issues found for ${context.currentTag}`);
117
- return;
118
- }
119
-
120
- ensureReleasedLabel(context.repo);
121
- const issueStates = fetchIssueStates(context.repo, releaseIssues);
122
- for (const action of planIssueCleanup({ releaseIssues, resolvedIssues, issueStates })) {
123
- applyAction(context.repo, action);
124
- }
125
- }
126
-
127
- if (import.meta.url === `file://${process.argv[1]}`) {
128
- try {
129
- main();
130
- } catch (error) {
131
- console.error(error);
132
- process.exit(1);
133
- }
134
- }