dsh-codex-credit-hub 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to, the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Li Shutong
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,8 @@
1
+ dsh-codex-credit-hub
2
+ Copyright 2026 Li Shutong
3
+
4
+ This package reads user-authorized Codex and OpenAI Platform quota endpoints
5
+ through public DeepSeek Harness extension APIs and the user's own browser session.
6
+ It is not affiliated with or endorsed by OpenAI, ChatGPT, Codex, or DeepSeek.
7
+
8
+ Distributed under the Apache License, Version 2.0 included in LICENSE.
package/README.md CHANGED
@@ -1,3 +1,69 @@
1
- # Temporary Holding Version
1
+ # dsh-codex-credit-hub
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ DeepSeek Harness 扩展插件,在左侧边栏底部、头像上方显示 **Codex** 与 **Codex API** 两个只读额度入口。
4
+
5
+ ## 功能说明
6
+
7
+ ### Codex
8
+
9
+ - 自动只读读取 `~/.codex/auth.json` 中的 OAuth token,请求 `https://chatgpt.com/backend-api/wham/usage`。
10
+ - 若 token 过期或本机没有明文 token,自动回退到 `codex app-server` 的 `account/read` 与 `account/rateLimits/read`,不修改 `~/.codex/`。
11
+ - 展示主/次限额窗口剩余百分比、重置时间、附加 Credits 余额和 Reset Credits 次数。
12
+
13
+ ### Codex API
14
+
15
+ - **只使用 OpenAI Platform 登录态,不接受、不读取、不保存 API Key。**
16
+ - 插件通过本机 `ego-browser` 复用已登录的 `platform.openai.com` 页面,从页面自身的 `POST /v1/dashboard/onboarding/login` 响应中自动获取临时会话,再请求 `GET /v1/dashboard/billing/credit_grants`。
17
+ - 展示与 `https://platform.openai.com/home` 一致的真实余额、总额度、已用额度、剩余百分比和最近 grant 到期时间。
18
+ - 会话过期或失效时自动重新同步;网络异常时保留错误状态,用户可点击「同步 OpenAI 登录态」主动恢复。
19
+ - 临时会话只保存到 DSH 加密凭证库,不返回给界面或 Agent 工具;清除/卸载插件会取消同步并丢弃内存状态。
20
+
21
+ ### Agent 工具
22
+
23
+ - `codex_cli_quota`:`status` / `refresh`,查询或刷新 Codex 订阅限额。
24
+ - `codex_api_quota`:`status` / `refresh` / `sync_browser`,查询余额、强制刷新或同步 OpenAI 登录态。
25
+
26
+ ## 安装方式
27
+
28
+ ### 通过 GitHub 安装
29
+
30
+ 在 DeepSeek Harness 中打开 **插件 → 添加插件**,输入:
31
+
32
+ ```text
33
+ https://github.com/AI-Cloud-Clow/dsh-codex-credit-hub
34
+ ```
35
+
36
+ 或:
37
+
38
+ ```text
39
+ github:AI-Cloud-Clow/dsh-codex-credit-hub
40
+ ```
41
+
42
+ ### 通过公共 npm 安装
43
+
44
+ ```text
45
+ dsh-codex-credit-hub
46
+ ```
47
+
48
+ 指定版本安装(避免包管理器的最新版本观察期影响):
49
+
50
+ ```text
51
+ dsh-codex-credit-hub@1.0.0
52
+ ```
53
+
54
+ ### 本地目录安装
55
+
56
+ 将本仓库克隆到本地后,在 **插件 → 添加插件** 中输入仓库目录的绝对路径。
57
+
58
+ ## 配置项
59
+
60
+ 支持在 `cordis.patch.yml` 中覆盖:
61
+
62
+ - `refreshIntervalSec`:自动刷新间隔,15–3600 秒,默认 `60`。
63
+ - `displayFormat`:紧凑栏显示格式,`both` | `remaining` | `percent`,默认 `both`。
64
+
65
+ ## 运行前提与限制
66
+
67
+ - Codex API 自动同步需要本机安装 `ego-browser`,并且浏览器中已登录 `platform.openai.com`。
68
+ - OpenAI Platform 的 `onboarding/login` 和 `credit_grants` 属于网页端接口,不是 OpenAI 面向普通 API Key 的公开余额 API;如果 OpenAI 调整接口,插件会显示同步失败并保留手动重试入口。
69
+ - Codex 订阅额度与 OpenAI API 预付/赠送余额是不同账户体系,插件分别展示,不互相推算。
package/client.js ADDED
@@ -0,0 +1,268 @@
1
+ window.__ModuleLoader__.load({
2
+ id: 'dsh-codex-credit-hub',
3
+ factory(require) {
4
+ const React = require('react')
5
+ const { createPortal } = require('react-dom')
6
+ const h = React.createElement
7
+ const NS = 'codex-credit-hub'
8
+ const API_PATH = 'api/codex-credit-hub'
9
+ const CODEX_WEB_URL = 'https://chatgpt.com/codex/settings/usage'
10
+ const OPENAI_WEB_URL = 'https://platform.openai.com/home'
11
+
12
+ async function callApi(endpoint, payload) {
13
+ const response = await fetch(API_PATH, {
14
+ method: 'POST',
15
+ headers: { 'content-type': 'application/json' },
16
+ body: JSON.stringify({ endpoint, payload }),
17
+ })
18
+ if (!response.ok) throw new Error(`Codex Credit request failed: HTTP ${response.status}`)
19
+ return await response.json()
20
+ }
21
+
22
+ const en = {
23
+ loading: 'Loading…', unavailable: 'Unavailable', notConfigured: 'Not connected',
24
+ cliLabel: 'Codex', cliTitle: 'Codex', cliSubtitle: 'Codex Subscription Rate Limits',
25
+ apiLabel: 'Codex API', apiTitle: 'Codex API', apiSubtitle: 'OpenAI Platform Credit Balance',
26
+ remaining: 'remaining', used: 'used', primaryWindow: 'Primary Window', secondaryWindow: 'Secondary Window',
27
+ resetsAt: 'Resets', resetCredits: 'Reset Credits', creditsBalance: 'Credits Balance', unlimited: 'Unlimited',
28
+ totalGranted: 'Total Granted', totalUsed: 'Total Used', remainingCredit: 'Credit Remaining',
29
+ nextExpiry: 'Next Expiry', updated: 'Updated', refresh: 'Refresh', refreshing: 'Refreshing…',
30
+ manage: 'Manage usage', close: 'Close quota details', error: 'Unable to load Codex quota', retry: 'Try again',
31
+ syncBrowser: 'Sync OpenAI login', syncingBrowser: 'Syncing…',
32
+ apiHint: 'Reads your existing platform.openai.com login session automatically. No API key is required.',
33
+ cliHint: 'Reads ~/.codex/auth.json (read-only) or `codex app-server`. Run `codex login` in terminal to sign in.',
34
+ }
35
+ const zh = {
36
+ loading: '读取中…', unavailable: '暂不可用', notConfigured: '未连接',
37
+ cliLabel: 'Codex', cliTitle: 'Codex', cliSubtitle: 'Codex 订阅额度与限流窗口',
38
+ apiLabel: 'Codex API', apiTitle: 'Codex API', apiSubtitle: 'OpenAI 平台真实余额',
39
+ remaining: '剩余', used: '已用', primaryWindow: '主限额窗口', secondaryWindow: '次级限额窗口',
40
+ resetsAt: '重置时间', resetCredits: '重置次数券', creditsBalance: '附加积分余额', unlimited: '无限制',
41
+ totalGranted: '总额度', totalUsed: '已用额度', remainingCredit: '剩余余额',
42
+ nextExpiry: '最近到期', updated: '更新于', refresh: '刷新', refreshing: '刷新中…',
43
+ manage: '管理用量', close: '关闭额度详情', error: '暂时无法读取 Codex 额度', retry: '重试',
44
+ syncBrowser: '同步 OpenAI 登录态', syncingBrowser: '同步中…',
45
+ apiHint: '自动复用本机 platform.openai.com 登录态获取真实余额,无需输入 API Key。',
46
+ cliHint: '自动只读读取 ~/.codex/auth.json 或 codex app-server;若未登录请在终端执行 `codex login`。',
47
+ }
48
+
49
+ const CSS = `
50
+ .cxh-hubs{display:flex;flex-direction:column;width:100%;gap:2px}.cxh-hubsRail{width:36px;gap:8px}.cxh-root{position:relative;display:flex;min-width:0;font-size:var(--dsh-content-font-size-secondary,13px);line-height:20px}.cxh-rootWide{width:100%}.cxh-rootRail{width:36px;justify-content:center}.cxh-trigger{display:flex;align-items:center;gap:8px;box-sizing:border-box;border:0;color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;background:transparent}.cxh-triggerWide{width:100%;min-height:36px;padding:6px calc(var(--dsh-sidebar-row-padding,12px) - var(--dsh-sidebar-paint-inset,3px));border-inline:var(--dsh-sidebar-paint-inset,3px) solid transparent;border-radius:var(--dsw-radius-md);background-clip:padding-box}.cxh-triggerRail{width:36px;height:36px;justify-content:center;padding:0;border-radius:var(--dsw-radius-md)}.cxh-trigger:hover,.cxh-trigger[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.cxh-trigger:focus-visible,.cxh-close:focus-visible,.cxh-refresh:focus-visible,.cxh-manage:focus-visible,.cxh-retry:focus-visible,.cxh-linkBtn:focus-visible,.cxh-primary:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:-2px}.cxh-ring{flex:none;width:16px;height:16px}.cxh-triggerRail .cxh-ring{width:18px;height:18px}.cxh-track{fill:none;stroke:var(--dsw-alias-border-l3);stroke-width:1.8}.cxh-fill{fill:none;stroke:var(--cxh-color,var(--dsw-alias-state-business-primary));stroke-width:1.8;stroke-linecap:round}.cxh-name{flex:none;color:var(--dsw-alias-label-secondary);font-size:12px}.cxh-values{display:flex;align-items:baseline;gap:6px;min-width:0;margin-left:auto;font-variant-numeric:tabular-nums;white-space:nowrap}.cxh-amountCompact{overflow:hidden;text-overflow:ellipsis;color:var(--dsw-alias-label-primary);font-size:12px;font-weight:500}.cxh-percentCompact{flex:none;color:var(--cxh-color,var(--dsw-alias-state-business-primary));font-size:11px}.cxh-panel{box-sizing:border-box;width:min(312px,calc(100vw - 24px));max-height:calc(100dvh - 24px);overflow-y:auto;padding:16px;border:0;border-radius:var(--dsw-radius-lg);background:var(--dsw-specific-menu);backdrop-filter:var(--dsw-menu-backdrop-filter);box-shadow:var(--dsw-elevation-prominent);color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px;--dsw-elevation-stroke-color:var(--dsw-alias-border-l1)}.cxh-panel:focus{outline:none}.cxh-header{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.cxh-title{color:var(--dsw-alias-label-primary);font-size:13px;font-weight:600}.cxh-subtitle{margin-top:2px;color:var(--dsw-alias-label-tertiary);font-size:11px;overflow-wrap:anywhere}.cxh-close{display:grid;place-items:center;flex:none;width:24px;height:24px;margin:-4px -4px 0 0;padding:0;border:0;border-radius:var(--dsw-radius-sm);background:transparent;color:var(--dsw-alias-label-tertiary);cursor:pointer}.cxh-close:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.cxh-hero{display:flex;align-items:flex-end;justify-content:space-between;gap:12px;margin-top:20px}.cxh-bigAmount{color:var(--dsw-alias-label-primary);font-size:28px;font-weight:600;line-height:32px;letter-spacing:-.5px;font-variant-numeric:tabular-nums}.cxh-available{margin-top:3px;color:var(--dsw-alias-label-tertiary);font-size:11px}.cxh-percentBadge{flex:none;margin-bottom:4px;padding:2px 7px;border-radius:999px;background:var(--dsw-alias-interactive-bg-hover);color:var(--cxh-color,var(--dsw-alias-state-business-primary));font-size:11px;font-weight:500;font-variant-numeric:tabular-nums}.cxh-progress{display:flex;gap:2px;height:4px;margin:14px 0 16px;border-radius:999px;background:var(--dsw-alias-interactive-bg-hover);overflow:hidden}.cxh-progressUsed{background:var(--dsw-alias-border-l4)}.cxh-progressLeft{background:var(--cxh-color,var(--dsw-alias-state-business-primary))}.cxh-facts{display:grid;grid-template-columns:1fr 1fr;gap:12px 16px;padding-top:12px;border-top:.5px solid var(--dsw-alias-border-l2)}.cxh-factLabel{color:var(--dsw-alias-label-tertiary);font-size:11px}.cxh-factValue{margin-top:3px;color:var(--dsw-alias-label-primary);font-size:12.5px;font-weight:500;font-variant-numeric:tabular-nums}.cxh-factSub{margin-top:2px;color:var(--dsw-alias-label-tertiary);font-size:10.5px;font-variant-numeric:tabular-nums}.cxh-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:14px}.cxh-updated{color:var(--dsw-alias-label-tertiary);font-size:10px;font-variant-numeric:tabular-nums}.cxh-footerActions{display:flex;align-items:center;gap:8px}.cxh-refresh,.cxh-linkBtn{display:inline-flex;align-items:center;gap:4px;padding:2px 5px;border:0;border-radius:var(--dsw-radius-sm);background:transparent;color:var(--dsw-alias-label-tertiary);font:inherit;font-size:11px;cursor:pointer}.cxh-refresh:hover:not(:disabled),.cxh-linkBtn:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.cxh-refresh:disabled,.cxh-linkBtn:disabled{opacity:.45;cursor:default}.cxh-manage{display:flex;align-items:center;justify-content:space-between;width:100%;margin-top:12px;padding:8px 10px;border:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-md);background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:12px;font-weight:500;cursor:pointer}.cxh-manage:hover{background:var(--dsw-alias-interactive-bg-hover);border-color:var(--dsw-alias-label-dimmed)}.cxh-error{margin:12px 0 0;color:var(--dsw-alias-state-error-primary);font-size:11px;line-height:17px;overflow-wrap:anywhere}.cxh-errorActions{display:flex;gap:8px;margin-top:12px}.cxh-retry{padding:5px 10px;border:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-sm);background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:11px;cursor:pointer}.cxh-retry:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.cxh-retry:disabled{opacity:.45;cursor:default}.cxh-loading{margin:22px 0 8px;color:var(--dsw-alias-label-tertiary);text-align:center}.cxh-help{margin:12px 0 0;color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px}.cxh-primary{box-sizing:border-box;width:100%;min-height:30px;margin-top:12px;padding:6px 12px;border:1px solid transparent;border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-state-business-primary);color:var(--dsw-alias-label-inverse,#fff);font:inherit;font-size:12px;font-weight:500;cursor:pointer}.cxh-primary:hover:not(:disabled){opacity:.9}.cxh-primary:disabled{opacity:.45;cursor:default}
51
+ `
52
+
53
+ function createStore(ctx, endpoint) {
54
+ let snapshot = { status: 'loading' }
55
+ let disposed = false
56
+ let timer = null
57
+ let generation = 0
58
+ const listeners = new Set()
59
+ const emit = (next) => { snapshot = next; for (const listener of [...listeners]) listener() }
60
+ const schedule = (state) => {
61
+ if (disposed) return
62
+ if (timer !== null) clearTimeout(timer)
63
+ const seconds = state?.preferences?.refreshIntervalSec ?? 60
64
+ timer = setTimeout(() => { void load(false) }, Math.max(15, seconds) * 1000)
65
+ }
66
+ const load = async (force = false) => {
67
+ const current = ++generation
68
+ if (snapshot.status === 'ok') emit({ ...snapshot, error: undefined })
69
+ else emit({ ...snapshot, status: 'loading', error: undefined })
70
+ try {
71
+ const result = await callApi(endpoint, { force })
72
+ if (disposed || current !== generation) return
73
+ if (result.ok) { emit(result.value); schedule(result.value) }
74
+ else {
75
+ const next = snapshot.status === 'ok' ? { ...snapshot, error: result.error.message } : { status: 'error', error: result.error.message }
76
+ emit(next); schedule(next)
77
+ }
78
+ } catch (error) {
79
+ if (disposed || current !== generation) return
80
+ const message = error instanceof Error ? error.message : String(error)
81
+ const next = snapshot.status === 'ok' ? { ...snapshot, error: message } : { status: 'error', error: message }
82
+ emit(next); schedule(next)
83
+ }
84
+ }
85
+ const mutate = async (mutEndpoint, payload) => {
86
+ const current = ++generation
87
+ const result = await callApi(mutEndpoint, payload)
88
+ if (!result.ok) throw new Error(result.error.message)
89
+ if (disposed || current !== generation) return result.value
90
+ emit(result.value); schedule(result.value)
91
+ return result.value
92
+ }
93
+ const initializedAt = Date.now()
94
+ const offReset = ctx.on('connection/reset', () => { if (Date.now() - initializedAt > 3000) void load(true) })
95
+ return {
96
+ getSnapshot: () => snapshot,
97
+ subscribe: (listener) => { listeners.add(listener); return () => listeners.delete(listener) },
98
+ refresh: () => load(true), mutate,
99
+ dispose: () => { disposed = true; if (timer !== null) clearTimeout(timer); offReset(); listeners.clear() },
100
+ }
101
+ }
102
+
103
+ function formatUsd(value) {
104
+ const n = Number(value ?? 0)
105
+ return Number.isFinite(n) ? `$${n.toFixed(2)}` : '$0.00'
106
+ }
107
+ function formatResetTime(resetAtMs) {
108
+ if (!resetAtMs) return '—'
109
+ const d = new Date(resetAtMs)
110
+ return Number.isNaN(d.getTime()) ? '—' : d.toLocaleString([], { month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' })
111
+ }
112
+ function Ring({ percent }) {
113
+ const radius = 5.7, circumference = 2 * Math.PI * radius
114
+ const safe = Math.max(0, Math.min(100, Number(percent ?? 0)))
115
+ return h('svg', { className: 'cxh-ring', viewBox: '0 0 16 16', 'aria-hidden': true },
116
+ h('circle', { className: 'cxh-track', cx: 8, cy: 8, r: radius }),
117
+ h('circle', { className: 'cxh-fill', cx: 8, cy: 8, r: radius, strokeDasharray: `${circumference * safe / 100} ${circumference}`, transform: 'rotate(-90 8 8)' }))
118
+ }
119
+ function RefreshIcon() {
120
+ return h('svg', { width: 12, height: 12, viewBox: '0 0 16 16', fill: 'none', 'aria-hidden': true },
121
+ h('path', { d: 'M13.2 5.2A5.5 5.5 0 1 0 13 11M13.2 5.2V1.8m0 3.4H9.8', stroke: 'currentColor', strokeWidth: 1.4, strokeLinecap: 'round', strokeLinejoin: 'round' }))
122
+ }
123
+
124
+ function CodexPill({ store, kind, t, wide, label, title, subtitle, open, onOpenChange, fallbackUrl }) {
125
+ const state = React.useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot)
126
+ const [busy, setBusy] = React.useState('')
127
+ const [actionError, setActionError] = React.useState('')
128
+ const [position, setPosition] = React.useState({ left: 12, top: 12 })
129
+ const rootRef = React.useRef(null), triggerRef = React.useRef(null), panelRef = React.useRef(null)
130
+ const quota = state.status === 'ok' ? state.quota : null
131
+ const isCli = kind === 'cli'
132
+ const percent = quota ? Number(quota.remainingPercent ?? 0) : 0
133
+ const low = quota && percent <= 20
134
+ const format = state.preferences?.displayFormat ?? 'both'
135
+ let amountText = state.status === 'loading' ? t('loading') : (state.status === 'unauthorized' ? t('notConfigured') : t('unavailable'))
136
+ let percentText = ''
137
+ if (quota) {
138
+ if (isCli) {
139
+ amountText = format === 'percent' ? `${percent.toFixed(0)}%` : (quota.planType ? quota.planType.toUpperCase() : 'Codex')
140
+ percentText = format === 'remaining' || format === 'percent' ? '' : `${percent.toFixed(0)}%`
141
+ } else {
142
+ amountText = format === 'percent' ? `${percent.toFixed(0)}%` : formatUsd(quota.remainingUsd)
143
+ percentText = format === 'remaining' || format === 'percent' ? '' : `${percent.toFixed(0)}%`
144
+ }
145
+ }
146
+ const fullLabel = quota ? `${title}: ${isCli ? `${percent.toFixed(1)}% ${t('remaining')}` : `${formatUsd(quota.remainingUsd)} (${percent.toFixed(1)}%)`}` : `${title}: ${amountText}`
147
+
148
+ React.useLayoutEffect(() => {
149
+ if (!open) return
150
+ const update = () => {
151
+ if (!rootRef.current) return
152
+ const rect = rootRef.current.getBoundingClientRect(), width = panelRef.current?.offsetWidth ?? 312, height = panelRef.current?.offsetHeight ?? 320
153
+ const left = Math.max(12, Math.min(rect.left, window.innerWidth - width - 12))
154
+ let top
155
+ if (rect.top - height - 8 >= 12) top = rect.top - height - 8
156
+ else if (rect.bottom + height + 8 <= window.innerHeight - 12) top = rect.bottom + 8
157
+ else top = Math.max(12, Math.min(rect.top - height - 8, window.innerHeight - height - 12))
158
+ setPosition({ left, top })
159
+ }
160
+ update()
161
+ const observer = typeof ResizeObserver === 'undefined' || !panelRef.current ? null : new ResizeObserver(update)
162
+ observer?.observe(panelRef.current)
163
+ if (rootRef.current) observer?.observe(rootRef.current)
164
+ window.addEventListener('resize', update); window.addEventListener('scroll', update, true)
165
+ return () => { observer?.disconnect(); window.removeEventListener('resize', update); window.removeEventListener('scroll', update, true) }
166
+ }, [open, state, actionError, wide])
167
+
168
+ React.useEffect(() => {
169
+ if (!open) return
170
+ const previous = document.activeElement, panel = panelRef.current
171
+ panel?.focus()
172
+ const onKey = (event) => {
173
+ if (event.key === 'Escape') { onOpenChange(false); return }
174
+ if (event.key !== 'Tab' || !panel) return
175
+ const focusable = [...panel.querySelectorAll('button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])')]
176
+ if (!focusable.length) { event.preventDefault(); panel.focus(); return }
177
+ const first = focusable[0], last = focusable[focusable.length - 1]
178
+ const activeElement = document.activeElement
179
+ if (event.shiftKey && (activeElement === first || activeElement === panel || !panel.contains(activeElement))) {
180
+ event.preventDefault(); last.focus()
181
+ } else if (!event.shiftKey && (activeElement === last || !panel.contains(activeElement))) {
182
+ event.preventDefault(); first.focus()
183
+ }
184
+ }
185
+ const onPointer = (event) => { if (!rootRef.current?.contains(event.target) && !panelRef.current?.contains(event.target)) onOpenChange(false) }
186
+ document.addEventListener('keydown', onKey); document.addEventListener('pointerdown', onPointer, true)
187
+ return () => {
188
+ document.removeEventListener('keydown', onKey); document.removeEventListener('pointerdown', onPointer, true)
189
+ if (previous instanceof HTMLElement && previous.isConnected && !panel?.contains(previous)) previous.focus()
190
+ else triggerRef.current?.focus()
191
+ }
192
+ }, [open])
193
+
194
+ const refresh = async () => {
195
+ setBusy('refresh'); setActionError('')
196
+ try { await store.refresh() } catch (cause) { setActionError(cause instanceof Error ? cause.message : String(cause)) } finally { setBusy('') }
197
+ }
198
+ const sync = async () => {
199
+ setBusy('sync'); setActionError('')
200
+ try { await store.mutate('api/session/sync', {}) } catch (cause) { setActionError(cause instanceof Error ? cause.message : String(cause)) } finally { setBusy('') }
201
+ }
202
+ const manage = () => { window.open(quota?.webUrl || state.webUrl || fallbackUrl, '_blank', 'noopener,noreferrer'); onOpenChange(false) }
203
+ const updated = quota ? new Date(quota.fetchedAt).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) : ''
204
+ const dynamicSubtitle = quota && isCli ? [quota.email, quota.planType?.toUpperCase()].filter(Boolean).join(' · ') || subtitle : subtitle
205
+ const nextExpiry = !isCli && quota?.grants?.filter(g => g.expiresAtMs && g.remainingAmount > 0).sort((a, b) => a.expiresAtMs - b.expiresAtMs)[0]
206
+ const syncButton = h('button', { type: 'button', className: 'cxh-linkBtn', disabled: busy !== '', onClick: sync }, busy === 'sync' ? t('syncingBrowser') : t('syncBrowser'))
207
+
208
+ return h('span', { ref: rootRef, className: `cxh-root ${wide ? 'cxh-rootWide' : 'cxh-rootRail'}`, style: { '--cxh-color': low ? 'var(--dsw-alias-state-error-primary)' : 'var(--dsw-alias-state-business-primary)' }, 'data-codex-credit-hub': kind },
209
+ h('button', { ref: triggerRef, type: 'button', className: `cxh-trigger ${wide ? 'cxh-triggerWide' : 'cxh-triggerRail'}`, title: fullLabel, 'aria-label': fullLabel, 'aria-haspopup': 'dialog', 'aria-expanded': open, onClick: () => onOpenChange(!open) },
210
+ h(Ring, { percent }), wide && h(React.Fragment, null, h('span', { className: 'cxh-name' }, label), h('span', { className: 'cxh-values' }, h('span', { className: 'cxh-amountCompact' }, amountText), percentText && h('span', { className: 'cxh-percentCompact' }, percentText)))),
211
+ open && createPortal(h('div', { ref: panelRef, className: 'cxh-panel', role: 'dialog', 'aria-label': title, tabIndex: -1, style: { position: 'fixed', left: position.left, top: position.top, zIndex: 1100 } },
212
+ h('div', { className: 'cxh-header' }, h('div', null, h('div', { className: 'cxh-title' }, title), h('div', { className: 'cxh-subtitle' }, dynamicSubtitle)), h('button', { type: 'button', className: 'cxh-close', 'aria-label': t('close'), onClick: () => onOpenChange(false) }, h('svg', { width: 14, height: 14, viewBox: '0 0 16 16', 'aria-hidden': true }, h('path', { d: 'm4 4 8 8m0-8-8 8', stroke: 'currentColor', strokeWidth: 1.4, strokeLinecap: 'round' })))),
213
+ quota && isCli && h(React.Fragment, null,
214
+ h('div', { className: 'cxh-hero' }, h('div', null, h('div', { className: 'cxh-bigAmount' }, `${percent.toFixed(1)}%`), h('div', { className: 'cxh-available' }, `${quota.primaryWindow?.windowLabel || ''} ${t('remaining')}`.trim())), h('span', { className: 'cxh-percentBadge' }, `${t('used')} ${quota.usedPercent.toFixed(1)}%`)),
215
+ h('div', { className: 'cxh-progress', role: 'progressbar', 'aria-label': quota.primaryWindow ? t('primaryWindow') : t('secondaryWindow'), 'aria-valuemin': 0, 'aria-valuemax': 100, 'aria-valuenow': percent, 'aria-valuetext': `${t('remaining')} ${percent.toFixed(1)}%` }, h('div', { className: 'cxh-progressUsed', style: { width: `${quota.usedPercent}%` } }), h('div', { className: 'cxh-progressLeft', style: { width: `${percent}%` } })),
216
+ h('div', { className: 'cxh-facts' },
217
+ h('div', null, h('div', { className: 'cxh-factLabel' }, t('primaryWindow')), h('div', { className: 'cxh-factValue' }, quota.primaryWindow ? `${quota.primaryWindow.remainingPercent.toFixed(1)}% (${quota.primaryWindow.windowLabel || '—'})` : '—'), quota.primaryWindow?.resetAtMs && h('div', { className: 'cxh-factSub' }, `${t('resetsAt')} ${formatResetTime(quota.primaryWindow.resetAtMs)}`)),
218
+ h('div', null, h('div', { className: 'cxh-factLabel' }, t('secondaryWindow')), h('div', { className: 'cxh-factValue' }, quota.secondaryWindow ? `${quota.secondaryWindow.remainingPercent.toFixed(1)}% (${quota.secondaryWindow.windowLabel || '—'})` : '—'), quota.secondaryWindow?.resetAtMs && h('div', { className: 'cxh-factSub' }, `${t('resetsAt')} ${formatResetTime(quota.secondaryWindow.resetAtMs)}`)),
219
+ h('div', null, h('div', { className: 'cxh-factLabel' }, t('creditsBalance')), h('div', { className: 'cxh-factValue' }, quota.unlimitedCredits ? t('unlimited') : (quota.creditBalance !== null ? formatUsd(quota.creditBalance) : '—'))),
220
+ h('div', null, h('div', { className: 'cxh-factLabel' }, t('resetCredits')), h('div', { className: 'cxh-factValue' }, String(quota.resetCreditsCount ?? 0)))),
221
+ h('div', { className: 'cxh-footer' }, h('span', { className: 'cxh-updated' }, `${t('updated')} ${updated}`), h('button', { type: 'button', className: 'cxh-refresh', disabled: busy !== '', onClick: refresh }, h(RefreshIcon), busy === 'refresh' ? t('refreshing') : t('refresh')))),
222
+ quota && !isCli && h(React.Fragment, null,
223
+ h('div', { className: 'cxh-hero' }, h('div', null, h('div', { className: 'cxh-bigAmount' }, formatUsd(quota.remainingUsd)), h('div', { className: 'cxh-available' }, t('remainingCredit'))), h('span', { className: 'cxh-percentBadge' }, `${t('remaining')} ${percent.toFixed(1)}%`)),
224
+ h('div', { className: 'cxh-progress', role: 'progressbar', 'aria-label': t('remainingCredit'), 'aria-valuemin': 0, 'aria-valuemax': 100, 'aria-valuenow': percent, 'aria-valuetext': `${t('remaining')} ${percent.toFixed(1)}%` }, h('div', { className: 'cxh-progressUsed', style: { width: `${quota.usedPercent}%` } }), h('div', { className: 'cxh-progressLeft', style: { width: `${percent}%` } })),
225
+ h('div', { className: 'cxh-facts' },
226
+ h('div', null, h('div', { className: 'cxh-factLabel' }, t('totalGranted')), h('div', { className: 'cxh-factValue' }, formatUsd(quota.totalGrantedUsd))),
227
+ h('div', null, h('div', { className: 'cxh-factLabel' }, t('totalUsed')), h('div', { className: 'cxh-factValue' }, formatUsd(quota.totalUsedUsd))),
228
+ nextExpiry && h('div', null, h('div', { className: 'cxh-factLabel' }, t('nextExpiry')), h('div', { className: 'cxh-factValue' }, formatResetTime(nextExpiry.expiresAtMs)))),
229
+ h('div', { className: 'cxh-footer' }, h('span', { className: 'cxh-updated' }, `${t('updated')} ${updated}`), h('div', { className: 'cxh-footerActions' }, syncButton, h('button', { type: 'button', className: 'cxh-refresh', disabled: busy !== '', onClick: refresh }, h(RefreshIcon), busy === 'refresh' ? t('refreshing') : t('refresh'))))),
230
+ quota && state.error && h('p', { className: 'cxh-error', role: 'status' }, state.error),
231
+ !quota && state.status === 'loading' && h('div', { className: 'cxh-loading' }, t('loading')),
232
+ !quota && state.status !== 'loading' && h('p', { className: state.status === 'unauthorized' ? 'cxh-help' : 'cxh-error', role: 'status' }, state.error || t('error')),
233
+ actionError && h('p', { className: 'cxh-error', role: 'status' }, actionError),
234
+ !quota && state.status !== 'loading' && h('p', { className: 'cxh-help' }, isCli ? t('cliHint') : t('apiHint')),
235
+ !quota && state.status !== 'loading' && h('div', { className: 'cxh-errorActions' }, isCli
236
+ ? h('button', { type: 'button', className: 'cxh-retry', disabled: busy !== '', onClick: refresh }, busy === 'refresh' ? t('refreshing') : t('retry'))
237
+ : h('button', { type: 'button', className: 'cxh-primary', disabled: busy !== '', onClick: sync }, busy === 'sync' ? t('syncingBrowser') : t('syncBrowser'))),
238
+ h('button', { type: 'button', className: 'cxh-manage', onClick: manage }, h('span', null, t('manage')), h('span', { 'aria-hidden': true }, '↗')),
239
+ ), document.body),
240
+ )
241
+ }
242
+
243
+ function CodexHubs({ cliStore, apiStore, t, wide }) {
244
+ const [active, setActive] = React.useState(null)
245
+ return h('div', { className: `cxh-hubs ${wide ? '' : 'cxh-hubsRail'}` },
246
+ h(CodexPill, { store: cliStore, kind: 'cli', t, wide, label: t('cliLabel'), title: t('cliTitle'), subtitle: t('cliSubtitle'), open: active === 'cli', onOpenChange: value => setActive(value ? 'cli' : null), fallbackUrl: CODEX_WEB_URL }),
247
+ h(CodexPill, { store: apiStore, kind: 'api', t, wide, label: t('apiLabel'), title: t('apiTitle'), subtitle: t('apiSubtitle'), open: active === 'api', onOpenChange: value => setActive(value ? 'api' : null), fallbackUrl: OPENAI_WEB_URL }),
248
+ )
249
+ }
250
+
251
+ return {
252
+ inject: ['slots', 'locale', 'connection'],
253
+ apply(ctx) {
254
+ ctx.effect(() => ctx.locale.register(NS, { en, zh }), 'codex-credit-hub: locale')
255
+ ctx.effect(() => {
256
+ const tag = document.createElement('style'); tag.dataset.plugin = 'codex-credit-hub'; tag.textContent = CSS; document.head.appendChild(tag)
257
+ const footerTag = document.createElement('style'); footerTag.dataset.plugin = 'codex-credit-hub-footer'; footerTag.textContent = '[data-slot="sidebar.footer.action"],div[class*="footerActions"]:has([data-codex-credit-hub]),div[class*="footerActions"]:has([data-catpaw-credit-hub]){flex-direction:column!important;align-items:stretch}'; document.head.appendChild(footerTag)
258
+ return () => { tag.remove(); footerTag.remove() }
259
+ }, 'codex-credit-hub: styles')
260
+ const t = ctx.locale.bind(NS), cliStore = createStore(ctx, 'cli/quota/get'), apiStore = createStore(ctx, 'api/quota/get')
261
+ void cliStore.refresh(); void apiStore.refresh()
262
+ ctx.effect(() => () => { cliStore.dispose(); apiStore.dispose() }, 'codex-credit-hub: polling')
263
+ const Component = (props) => h(CodexHubs, { ...props, cliStore, apiStore, t })
264
+ ctx.slots.inject('sidebar.footer.action', () => ctx.slots.register({ name: 'sidebar.footer.action', id: 'codex-credit-hub', order: 1, locale: NS }, Component))
265
+ },
266
+ }
267
+ },
268
+ })
@@ -0,0 +1,3 @@
1
+ - insert:
2
+ - id: codex-credit-hub
3
+ name: 'dsh-codex-credit-hub'
package/docs/DETAIL.md ADDED
@@ -0,0 +1 @@
1
+ ![Codex and Codex API quota entries above the account avatar with compact usage popovers](preview.svg)
@@ -0,0 +1 @@
1
+ ![头像上方显示 Codex 与 Codex API 额度入口及紧凑详情浮层](preview.svg)
@@ -0,0 +1,53 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="640" height="300" viewBox="0 0 640 300" fill="none">
2
+ <defs>
3
+ <linearGradient id="cx-bg" x1="0" y1="0" x2="640" y2="300" gradientUnits="userSpaceOnUse">
4
+ <stop stop-color="#F2F7F5" />
5
+ <stop offset="1" stop-color="#E7F0EC" />
6
+ </linearGradient>
7
+ </defs>
8
+ <rect width="640" height="300" rx="20" fill="url(#cx-bg)" />
9
+ <!-- Left sidebar -->
10
+ <rect x="38" y="28" width="190" height="244" rx="16" fill="#EBF2EF" />
11
+ <circle cx="66" cy="56" r="12" fill="#BDD2C9" />
12
+ <rect x="88" y="51" width="86" height="10" rx="5" fill="#99B7AA" />
13
+ <rect x="56" y="86" width="112" height="28" rx="7" fill="#FFFFFF" />
14
+ <rect x="56" y="124" width="140" height="8" rx="4" fill="#CBDCD5" />
15
+ <rect x="56" y="142" width="118" height="8" rx="4" fill="#D7E5DF" />
16
+ <rect x="56" y="160" width="130" height="8" rx="4" fill="#D7E5DF" />
17
+ <!-- Codex CLI entry -->
18
+ <rect x="52" y="190" width="162" height="28" rx="8" fill="#FFFFFF" stroke="#10A37F" stroke-width="1.2" />
19
+ <circle cx="68" cy="204" r="6" stroke="#D1E4DC" stroke-width="1.8" />
20
+ <path d="M68 198a6 6 0 1 1-5 9" stroke="#10A37F" stroke-width="1.8" stroke-linecap="round" />
21
+ <rect x="80" y="200" width="52" height="8" rx="4" fill="#6F8A7F" />
22
+ <rect x="154" y="200" width="42" height="8" rx="4" fill="#10A37F" />
23
+ <!-- Codex API entry -->
24
+ <rect x="52" y="224" width="162" height="28" rx="8" fill="#FFFFFF" stroke="#C6D9D1" stroke-width="1" />
25
+ <circle cx="68" cy="238" r="6" stroke="#D1E4DC" stroke-width="1.8" />
26
+ <path d="M68 232a6 6 0 1 1-5 9" stroke="#10A37F" stroke-width="1.8" stroke-linecap="round" />
27
+ <rect x="80" y="234" width="54" height="8" rx="4" fill="#6F8A7F" />
28
+ <rect x="154" y="234" width="42" height="8" rx="4" fill="#10A37F" />
29
+ <circle cx="68" cy="260" r="8" fill="#BDD2C9" />
30
+ <rect x="84" y="256" width="68" height="8" rx="4" fill="#99B7AA" />
31
+ <!-- Compact quota popover -->
32
+ <rect x="252" y="28" width="334" height="244" rx="16" fill="#FFFFFF" stroke="#C9DCD4" stroke-width="1.5" />
33
+ <rect x="274" y="48" width="104" height="10" rx="5" fill="#1F332B" />
34
+ <rect x="274" y="66" width="84" height="6" rx="3" fill="#9FB6AC" />
35
+ <circle cx="556" cy="54" r="8" stroke="#9BB2A8" stroke-width="1.4" />
36
+ <path d="m552 50 8 8m0-8-8 8" stroke="#6F8A7F" stroke-width="1.2" />
37
+ <rect x="274" y="94" width="110" height="24" rx="6" fill="#1A352B" />
38
+ <rect x="274" y="126" width="90" height="7" rx="3.5" fill="#9FB6AC" />
39
+ <rect x="478" y="100" width="84" height="20" rx="10" fill="#E6F7F1" />
40
+ <rect x="490" y="106" width="60" height="8" rx="4" fill="#10A37F" />
41
+ <rect x="274" y="148" width="288" height="5" rx="2.5" fill="#E4EFEA" />
42
+ <rect x="274" y="148" width="64" height="5" rx="2.5" fill="#7D988C" />
43
+ <rect x="338" y="148" width="224" height="5" rx="2.5" fill="#10A37F" />
44
+ <path d="M274 168h288" stroke="#DCE9E3" />
45
+ <rect x="274" y="182" width="70" height="7" rx="3.5" fill="#9FB6AC" />
46
+ <rect x="274" y="197" width="92" height="10" rx="5" fill="#3B594D" />
47
+ <rect x="424" y="182" width="70" height="7" rx="3.5" fill="#9FB6AC" />
48
+ <rect x="424" y="197" width="92" height="10" rx="5" fill="#3B594D" />
49
+ <rect x="274" y="222" width="288" height="1" fill="#E0ECE7" />
50
+ <rect x="274" y="232" width="82" height="7" rx="3.5" fill="#9FB6AC" />
51
+ <rect x="512" y="229" width="50" height="10" rx="5" fill="#6F8A7F" />
52
+ <rect x="274" y="248" width="288" height="16" rx="6" fill="#F2F8F5" stroke="#D5E6DF" />
53
+ </svg>