agent-usage-all-in-one 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/BUNDLED_DEPENDENCIES.json +9 -0
  2. package/BUNDLED_LICENSES.md +76 -0
  3. package/CODE_OF_CONDUCT.md +11 -0
  4. package/CONTRIBUTING.md +41 -0
  5. package/LICENSE +21 -0
  6. package/README.md +144 -0
  7. package/README.zh-CN.md +128 -0
  8. package/SECURITY.md +26 -0
  9. package/THIRD_PARTY_LICENSES.md +271 -0
  10. package/THIRD_PARTY_NOTICES.md +28 -0
  11. package/dist/cli.js +9170 -0
  12. package/dist/cli.js.map +1 -0
  13. package/dist/web/_app/immutable/assets/2.DZPQZVH3.css +1 -0
  14. package/dist/web/_app/immutable/chunks/6sns41Ww.js +3 -0
  15. package/dist/web/_app/immutable/chunks/Bjy-W4x2.js +81 -0
  16. package/dist/web/_app/immutable/chunks/DM8a3me-.js +1 -0
  17. package/dist/web/_app/immutable/chunks/xihTtKlq.js +1 -0
  18. package/dist/web/_app/immutable/entry/app.B_JvzxA9.js +2 -0
  19. package/dist/web/_app/immutable/entry/start.R2dkufKZ.js +1 -0
  20. package/dist/web/_app/immutable/nodes/0.CXfTLDxk.js +1 -0
  21. package/dist/web/_app/immutable/nodes/1.BwsUxisa.js +1 -0
  22. package/dist/web/_app/immutable/nodes/2.BNUhkRJ5.js +31 -0
  23. package/dist/web/_app/version.json +1 -0
  24. package/dist/web/brand/agent-usage-banner.svg +27 -0
  25. package/dist/web/brand/agent-usage-logo.svg +23 -0
  26. package/dist/web/brands/README.md +32 -0
  27. package/dist/web/brands/claude.svg +4 -0
  28. package/dist/web/brands/grok-dark.svg +4 -0
  29. package/dist/web/brands/grok-light.svg +4 -0
  30. package/dist/web/brands/openai.svg +6 -0
  31. package/dist/web/brands/opencode-dark.svg +1 -0
  32. package/dist/web/brands/opencode-light.svg +1 -0
  33. package/dist/web/brands/opencode.svg +4 -0
  34. package/dist/web/index.html +34 -0
  35. package/docs/open-source.md +38 -0
  36. package/package.json +97 -0
  37. package/static/brand/agent-usage-banner.svg +27 -0
  38. package/static/brand/agent-usage-logo.svg +23 -0
  39. package/static/brands/README.md +32 -0
  40. package/static/brands/claude.svg +4 -0
  41. package/static/brands/grok-dark.svg +4 -0
  42. package/static/brands/grok-light.svg +4 -0
  43. package/static/brands/openai.svg +6 -0
  44. package/static/brands/opencode-dark.svg +1 -0
  45. package/static/brands/opencode-light.svg +1 -0
  46. package/static/brands/opencode.svg +4 -0
@@ -0,0 +1,9 @@
1
+ {
2
+ "packages": [
3
+ "@sveltejs/kit",
4
+ "clsx",
5
+ "devalue",
6
+ "esm-env",
7
+ "svelte"
8
+ ]
9
+ }
@@ -0,0 +1,76 @@
1
+ # Bundled dependency license texts
2
+
3
+ The following dependency code is bundled into the browser distribution shipped by this package.
4
+ This file is generated by `pnpm licenses:generate` from the locked dependency graph.
5
+
6
+ ## @sveltejs/kit 2.70.3
7
+
8
+ Declared license: MIT
9
+
10
+ ```text
11
+ Copyright (c) 2020 [these people](https://github.com/sveltejs/kit/graphs/contributors)
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18
+ ```
19
+
20
+ ## clsx 2.1.1
21
+
22
+ Declared license: MIT
23
+
24
+ ```text
25
+ MIT License
26
+
27
+ Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)
28
+
29
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
30
+
31
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
32
+
33
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34
+ ```
35
+
36
+ ## devalue 5.9.2
37
+
38
+ Declared license: MIT
39
+
40
+ ```text
41
+ Copyright (c) 2018-19 [these people](https://github.com/rich-harris/devalue/graphs/contributors)
42
+
43
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
44
+
45
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
46
+
47
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
48
+ ```
49
+
50
+ ## esm-env 1.2.2
51
+
52
+ Declared license: MIT
53
+
54
+ ```text
55
+ Copyright 2022 Benjamin McCann
56
+
57
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
58
+
59
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
60
+
61
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
62
+ ```
63
+
64
+ ## svelte 5.56.10
65
+
66
+ Declared license: MIT
67
+
68
+ ```text
69
+ Copyright (c) 2016-2025 [Svelte Contributors](https://github.com/sveltejs/svelte/graphs/contributors)
70
+
71
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
72
+
73
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
74
+
75
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
76
+ ```
@@ -0,0 +1,11 @@
1
+ # Community code of conduct
2
+
3
+ Be respectful, specific, and constructive. Harassment, discrimination, threats,
4
+ doxxing, and publishing another person's private usage data or credentials are
5
+ not accepted in project spaces. Discuss technical decisions with evidence and
6
+ criticize the work rather than the person.
7
+
8
+ Maintainers may edit or remove harmful content and restrict participation when
9
+ needed to protect the community. Report conduct concerns through GitHub's
10
+ content-reporting tools; for private security-related conduct, use the private
11
+ vulnerability form linked in `SECURITY.md`.
@@ -0,0 +1,41 @@
1
+ # Contributing
2
+
3
+ Thank you for improving Agent Usage. The project is local-first and handles
4
+ sensitive developer activity, so data authority, privacy, and non-overlapping
5
+ accounting are release requirements rather than optional polish.
6
+
7
+ ## Development
8
+
9
+ Use macOS, Node.js 24+, and pnpm 10.33.3.
10
+
11
+ ```bash
12
+ pnpm install
13
+ pnpm dev
14
+ ```
15
+
16
+ Before opening a pull request, run:
17
+
18
+ ```bash
19
+ pnpm format:check
20
+ pnpm lint
21
+ pnpm check
22
+ pnpm test
23
+ pnpm build
24
+ pnpm test:package
25
+ pnpm test:e2e
26
+ ```
27
+
28
+ Add a changeset for every user-visible change with `pnpm changeset`. Tests must
29
+ use synthetic fixtures and temporary homes; never commit transcripts, account
30
+ identifiers, tokens, cookies, API keys, or local database contents.
31
+
32
+ ## Issues and pull requests
33
+
34
+ Use GitHub Issues for new public work. Historical specifications and tickets in
35
+ `.scratch/` keep their stable local identifiers. Describe the observed behavior,
36
+ expected behavior, reproduction, affected Provider/billing domain, and whether
37
+ the evidence is account-wide or this-Mac.
38
+
39
+ Pull requests should be narrowly scoped, link the issue, explain authority and
40
+ cost-purpose decisions, and include verification evidence. Provider trademarks
41
+ must follow the audited asset rules in `static/brands/README.md`.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Agent Usage contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,144 @@
1
+ ![Agent Usage banner](static/brand/agent-usage-banner.svg)
2
+
3
+ # Agent Usage
4
+
5
+ [English](README.md) · [简体中文](README.zh-CN.md)
6
+
7
+ [![CI](https://github.com/Blackman99/agent-usage-all-in-one/actions/workflows/ci.yml/badge.svg)](https://github.com/Blackman99/agent-usage-all-in-one/actions/workflows/ci.yml)
8
+ [![npm](https://img.shields.io/npm/v/agent-usage-all-in-one.svg)](https://www.npmjs.com/package/agent-usage-all-in-one)
9
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
10
+
11
+ Agent Usage is a macOS-first, fully local usage center for Codex, Claude Code,
12
+ OpenCode Go, and Grok. One command opens a dashboard for native quota windows,
13
+ reset times, tokens, model rankings, equivalent API cost, history, and diagnostics.
14
+ It offers advice but never switches agents automatically.
15
+
16
+ ## Dashboard
17
+
18
+ The dashboard has two primary tabs:
19
+
20
+ - **Agent usage** preserves each provider's native five-hour, weekly, monthly,
21
+ All models, and Fable-only quota labels and reset times.
22
+ - **Tokens & model costs** supports 24-hour, 7-day, and 30-day ranges. It shows
23
+ token categories, provider totals, daily trends, model rankings, and the public
24
+ API retail equivalent of eligible token usage.
25
+
26
+ Actual charges, provider-reported estimates, fixed subscription fees, and API
27
+ retail equivalents are separate evidence. The API retail equivalent is not a bill
28
+ and is never presented as subscription spend. Unknown models or prices remain
29
+ unclassified or unpriced instead of being guessed or displayed as zero.
30
+
31
+ Grok Build/SuperGrok and xAI API are independent billing domains. Their quotas,
32
+ tokens, and costs are never added together.
33
+
34
+ ## Fast, progressive startup
35
+
36
+ The loopback web service starts before connector discovery or data processing.
37
+ Cached results are available immediately while discovery, provider usage, model
38
+ pricing, and retention run as independent background modules. Each dashboard tab
39
+ shows only its own update indicator and completed sections remain usable.
40
+
41
+ Transcript scans use a persistent, path-redacted file index. Historical retail
42
+ pricing is recalculated only when the pricing catalog version changes. SQLite
43
+ time/provider/model indexes and retention compaction run in a worker after
44
+ provider collection, while price backfill processes bounded pages. Settings
45
+ includes an explicitly confirmed
46
+ **Hard rebuild all data** action for troubleshooting. It ignores these caches, can
47
+ use substantial resources, and may take a long time without blocking the web UI.
48
+
49
+ ## Development
50
+
51
+ ```bash
52
+ pnpm install
53
+ pnpm dev
54
+ ```
55
+
56
+ This starts the source daemon, authenticated Vite proxy, hot reload, and dashboard.
57
+ Development state is isolated in the ignored `.agent-usage-dev/` directory. Use
58
+ `AGENT_USAGE_DEMO=1 pnpm dev` for demo data or `pnpm dev -- --no-open` to keep the
59
+ browser closed.
60
+
61
+ ## Install and run
62
+
63
+ Agent Usage requires macOS and Node.js 24 or newer.
64
+
65
+ ```bash
66
+ npm install --global agent-usage-all-in-one
67
+ agent-usage
68
+ ```
69
+
70
+ To build and install a package from source:
71
+
72
+ ```bash
73
+ pnpm install
74
+ pnpm build
75
+ archive=$(pnpm pack)
76
+ npm install --global "./$archive"
77
+ agent-usage
78
+ ```
79
+
80
+ The daemon binds only to `127.0.0.1`. Application data is stored under
81
+ `~/Library/Application Support/Agent Usage` by default.
82
+
83
+ Common commands:
84
+
85
+ ```bash
86
+ agent-usage status --window 7d
87
+ agent-usage doctor
88
+ agent-usage export --format json --window 30d
89
+ agent-usage export --format csv --window 7d
90
+ agent-usage retention --json
91
+ agent-usage retention --compact
92
+ agent-usage monitoring --json
93
+ agent-usage start-at-login enable
94
+ agent-usage clear --yes
95
+ ```
96
+
97
+ ## Provider coverage
98
+
99
+ | Provider / billing domain | Native quota | Token history | Cost evidence |
100
+ | ------------------------- | ----------------------------------------------------------------------- | --------------------------------------------------- | -------------------------------------------------------------------------------------- |
101
+ | Codex | Official account buckets when available | Local rollouts with account-day reconciliation | API retail equivalent |
102
+ | Claude Code | Experimental official-client usage, including All models and Fable only | Local session transcripts; optional OTLP supplement | Client estimate and API retail equivalent |
103
+ | OpenCode Go | Official account-wide five-hour, weekly, and monthly windows | Official CLI/session export | Provider-reported or explicitly estimated values |
104
+ | Grok Build / SuperGrok | Experimental shared subscription allowance | Local `updates.jsonl`; optional OTLP supplement | Client estimate and API retail equivalent, including recognized Grok 4.6 Build aliases |
105
+ | Grok · xAI API | No subscription quota | Official Management API aggregation | Actual USD amounts, balance, limit, and invoice when available |
106
+
107
+ Every value retains its authority and observation time. Account-wide and this-Mac
108
+ evidence remain visibly distinct.
109
+
110
+ ## Credentials and privacy
111
+
112
+ Official-client credentials stay in their owning clients and are neither copied
113
+ nor displayed. The optional xAI Management key is the only product-owned secret;
114
+ it is stored in macOS Keychain. The dashboard uses a one-time launch token,
115
+ HttpOnly session cookie, and same-origin mutation protection.
116
+
117
+ All usage data remains local. JSON and CSV exports omit account identifiers,
118
+ session IDs, cookies, OAuth tokens, and secret values by default. Raw observations
119
+ are retained for 90 days, then transactionally compacted into UTC daily aggregates.
120
+ Clearing local usage never deletes credentials owned by Codex, Claude Code,
121
+ OpenCode, or Grok.
122
+
123
+ ## Verification
124
+
125
+ ```bash
126
+ pnpm format:check
127
+ pnpm lint
128
+ pnpm check
129
+ pnpm test
130
+ pnpm build
131
+ pnpm test:package
132
+ pnpm test:e2e
133
+ ```
134
+
135
+ See the [official pricing evidence](docs/research/official-pricing-sources-2026-08-28.md),
136
+ [connector receipts](docs/release/connector-receipts-2026-08-28.md), and
137
+ [open-source notices](docs/open-source.md).
138
+
139
+ ## License and community
140
+
141
+ MIT — see [LICENSE](LICENSE). Also see [CONTRIBUTING.md](CONTRIBUTING.md),
142
+ [SECURITY.md](SECURITY.md), [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md),
143
+ [THIRD_PARTY_LICENSES.md](THIRD_PARTY_LICENSES.md), and
144
+ [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
@@ -0,0 +1,128 @@
1
+ ![Agent Usage 横幅](static/brand/agent-usage-banner.svg)
2
+
3
+ # Agent Usage
4
+
5
+ [English](README.md) · [简体中文](README.zh-CN.md)
6
+
7
+ [![CI](https://github.com/Blackman99/agent-usage-all-in-one/actions/workflows/ci.yml/badge.svg)](https://github.com/Blackman99/agent-usage-all-in-one/actions/workflows/ci.yml)
8
+ [![npm](https://img.shields.io/npm/v/agent-usage-all-in-one.svg)](https://www.npmjs.com/package/agent-usage-all-in-one)
9
+ [![许可证:MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
10
+
11
+ Agent Usage 是一个 macOS 优先、完全在本地运行的用量中心。一次启动即可统一查看
12
+ Codex、Claude Code、OpenCode Go 与 Grok 的原生额度窗口、刷新时间、Token、模型排行、
13
+ API 对等费用、历史与诊断。它只提供建议,不会自动切换 Agent。
14
+
15
+ ## 核心页面
16
+
17
+ 页面只有两个主要标签页:
18
+
19
+ - **Agent 用量**:保留各平台原生的 5 小时、周、月、All models 和 Fable only 等额度标签与刷新时间。
20
+ - **Token 与模型费用**:支持 24 小时、7 天和 30 天范围,展示 Token 分类、平台汇总、每日趋势、模型排行,以及符合条件的 Token 按公开 API 价格计算出的对等费用。
21
+
22
+ 实际账单、平台报告估算、固定订阅费和 API 对等零售价是四类互不混合的证据。
23
+ API 对等零售价不是账单,也不会被描述成订阅支出。模型或价格未知时保持未分类或未定价,
24
+ 不会猜测,更不会显示成 0。
25
+
26
+ Grok Build/SuperGrok 与 xAI API 是两个独立计费域,其额度、Token 和费用永远不会相加。
27
+
28
+ ## 快速渐进式启动
29
+
30
+ 本地 Web 服务会先启动,再在后台运行连接发现、平台用量、模型定价和保留整理四个独立模块。
31
+ 已有缓存会立即展示;每个标签页只在自己的数据区域显示更新状态,已经完成的内容始终可用。
32
+
33
+ 本地会话记录扫描使用跨进程持久化且不保存原始个人路径的文件索引。历史费用只在价格目录版本变化时
34
+ 重新计算,并按有限批次处理;时间、平台、模型和计费域索引及保留期整理会在平台采集完成后交给后台
35
+ 工作线程执行。设置里提供需要明确确认的
36
+ **硬重算全部数据**:它会忽略缓存、消耗较多资源,并且可能等待很久,但不会阻塞页面。
37
+
38
+ ## 开发调试
39
+
40
+ ```bash
41
+ pnpm install
42
+ pnpm dev
43
+ ```
44
+
45
+ 该命令会启动源码守护进程、带认证的 Vite 代理、热更新和页面。开发数据隔离在已忽略的
46
+ `.agent-usage-dev/` 目录。使用 `AGENT_USAGE_DEMO=1 pnpm dev` 加载演示数据;使用
47
+ `pnpm dev -- --no-open` 禁止自动打开浏览器。
48
+
49
+ ## 安装与启动
50
+
51
+ 要求 macOS 和 Node.js 24 或更高版本。
52
+
53
+ ```bash
54
+ npm install --global agent-usage-all-in-one
55
+ agent-usage
56
+ ```
57
+
58
+ 从源码构建并安装:
59
+
60
+ ```bash
61
+ pnpm install
62
+ pnpm build
63
+ archive=$(pnpm pack)
64
+ npm install --global "./$archive"
65
+ agent-usage
66
+ ```
67
+
68
+ 守护进程只绑定 `127.0.0.1`。应用数据默认保存在
69
+ `~/Library/Application Support/Agent Usage`。
70
+
71
+ 常用命令:
72
+
73
+ ```bash
74
+ agent-usage status --window 7d
75
+ agent-usage doctor
76
+ agent-usage export --format json --window 30d
77
+ agent-usage export --format csv --window 7d
78
+ agent-usage retention --json
79
+ agent-usage retention --compact
80
+ agent-usage monitoring --json
81
+ agent-usage start-at-login enable
82
+ agent-usage clear --yes
83
+ ```
84
+
85
+ ## 平台覆盖范围
86
+
87
+ | 平台 / 计费域 | 原生额度 | Token 历史 | 费用证据 |
88
+ | ---------------------- | --------------------------------------------------- | ------------------------------------ | ------------------------------------------------------------- |
89
+ | Codex | 可用时读取官方账户额度桶 | 本地 rollout,并与账户日汇总对账 | API 对等零售价 |
90
+ | Claude Code | 实验性官方客户端用量,包括 All models 与 Fable only | 本地会话记录;可选 OTLP 补充 | 客户端估算与 API 对等零售价 |
91
+ | OpenCode Go | 官方账户级 5 小时、周、月窗口 | 官方命令行或会话导出 | 平台报告值或明确标注的估算 |
92
+ | Grok Build / SuperGrok | 实验性共享订阅额度 | 本地 `updates.jsonl`;可选 OTLP 补充 | 客户端估算与 API 对等零售价,包括可识别的 Grok 4.6 Build 别名 |
93
+ | Grok · xAI API | 没有订阅额度 | 官方 Management API 聚合 | 可用时展示实际美元金额、余额、上限与账单 |
94
+
95
+ 每个数字都会保留来源权威等级和观测时间;账户全局与仅此 Mac 的证据始终明确区分。
96
+
97
+ ## 凭据与隐私
98
+
99
+ 官方客户端凭据始终留在原客户端中,不复制、不回显。可选的 xAI Management 密钥是唯一由
100
+ Agent Usage 管理的凭据,存储在 macOS 钥匙串。本地页面使用一次性启动令牌、HttpOnly
101
+ 会话 Cookie 和同源写操作保护。
102
+
103
+ 所有用量数据都留在本机。JSON/CSV 导出默认排除账户标识、会话 ID、Cookie、OAuth Token
104
+ 和密钥值。原始观测保留 90 天,之后在事务中压缩为 UTC 日汇总。清理本地用量永远不会删除
105
+ Codex、Claude Code、OpenCode 或 Grok 官方客户端拥有的凭据。
106
+
107
+ ## 验证
108
+
109
+ ```bash
110
+ pnpm format:check
111
+ pnpm lint
112
+ pnpm check
113
+ pnpm test
114
+ pnpm build
115
+ pnpm test:package
116
+ pnpm test:e2e
117
+ ```
118
+
119
+ 可查阅[官方定价证据](docs/research/official-pricing-sources-2026-08-28.md)、
120
+ [连接验证收据](docs/release/connector-receipts-2026-08-28.md)与
121
+ [开源说明](docs/open-source.md)。
122
+
123
+ ## 许可证与社区
124
+
125
+ MIT,详见 [LICENSE](LICENSE)。另请参阅 [CONTRIBUTING.md](CONTRIBUTING.md)、
126
+ [SECURITY.md](SECURITY.md)、[CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md)、
127
+ [THIRD_PARTY_LICENSES.md](THIRD_PARTY_LICENSES.md) 和
128
+ [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)。
package/SECURITY.md ADDED
@@ -0,0 +1,26 @@
1
+ # Security policy
2
+
3
+ ## Supported versions
4
+
5
+ Security fixes are provided for the latest published version.
6
+
7
+ ## Reporting a vulnerability
8
+
9
+ Do not open a public issue for credential exposure, local-auth bypass, unsafe
10
+ file access, or privacy leaks. Use the repository's **Security → Report a
11
+ vulnerability** private form at
12
+ `https://github.com/Blackman99/agent-usage-all-in-one/security/advisories/new`.
13
+ Include the affected version, impact, reproduction, and a
14
+ minimal synthetic proof of concept. Never attach real agent transcripts,
15
+ credentials, account identifiers, or the Agent Usage SQLite database.
16
+
17
+ If the private form is unavailable, open a GitHub issue containing no sensitive
18
+ details and ask a maintainer to establish a private channel. The maintainers
19
+ will acknowledge a complete report as soon as practical,
20
+ coordinate remediation privately, and credit reporters who request attribution.
21
+
22
+ ## Security boundary
23
+
24
+ Agent Usage binds its daemon to loopback, uses launch-token authentication, and
25
+ reads supported clients' local files and credentials without copying secrets into
26
+ its database. A vulnerability that crosses those boundaries is in scope.