@vibe-cafe/vibe-usage 0.10.25 → 0.10.26

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/README.md CHANGED
@@ -111,7 +111,7 @@ Cursor 用量需要从 `cursor.com` 下载 CSV。`Cursor usage export skipped (n
111
111
  - `ENOTFOUND` / `EAI_AGAIN`:检查 DNS 和终端网络。
112
112
  - `UND_ERR_CONNECT_TIMEOUT` / `ETIMEDOUT` / `ECONNRESET`:检查到 Cursor 的连接及终端代理。浏览器或 Cursor 应用能联网,不代表 Node.js 使用了相同代理。
113
113
  - `CERT_*` / `UNABLE_TO_VERIFY_LEAF_SIGNATURE` 等:检查系统时间和代理或公司网络的 CA 证书配置;自定义 CA 可通过 `NODE_EXTRA_CA_CERTS` 指定。
114
- - `timeout after …ms`:导出或下载超时,稍后重试;网络较慢时可设置 `VIBE_USAGE_CURSOR_FETCH_TIMEOUT_MS=60000`。
114
+ - `timeout after …ms`:导出超时。`cursor.com` 的导出是按整个账号现算的,**账号用量越大越慢**,所以重度用户会每次都超时、而不是偶尔。默认等待 120 秒;仍不够就调大,例如 `VIBE_USAGE_CURSOR_FETCH_TIMEOUT_MS=300000`,然后重跑一次 `sync` 补传历史。
115
115
  - `Cursor session rejected`:在 Cursor 的 Account 设置中重新登录,再同步。
116
116
 
117
117
  需要 HTTP/HTTPS 代理时,Node.js **22.21+ 或 24.5+** 可用 `NODE_USE_ENV_PROXY=1` 启用环境变量代理([Node.js 官方说明](https://nodejs.org/en/learn/http/enterprise-network-configuration))。以下为 macOS/Linux 终端示例,代理地址须替换为实际地址:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibe-cafe/vibe-usage",
3
- "version": "0.10.25",
3
+ "version": "0.10.26",
4
4
  "description": "Track your AI coding tool token usage and sync to vibecafe.ai",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -68,9 +68,15 @@ function decodeJwtSub(token) {
68
68
  }
69
69
  }
70
70
 
71
- // Under full sync many parsers hammer disk concurrently; cursor.com's CSV
72
- // export can still succeed but take >10s. A short timeout caused silent skips.
73
- const DEFAULT_FETCH_TIMEOUT_MS = 30_000;
71
+ // cursor.com's CSV export is computed over the whole account, so it gets
72
+ // slower the more usage the account has: heavy users time out on every run,
73
+ // not intermittently. 10s (v0.7.11) and then 30s (#72) were both still short
74
+ // enough to lock those accounts out permanently -- a user with ~13B tokens/30d
75
+ // needed 120s to complete a single export, and every default-timeout run of
76
+ // his silently uploaded nothing. Budget for the slow accounts; a healthy
77
+ // export returns in a second or two, so this ceiling only costs wall-clock
78
+ // time on the runs that were failing anyway.
79
+ const DEFAULT_FETCH_TIMEOUT_MS = 120_000;
74
80
  const MAX_FETCH_TIMEOUT_MS = 2_147_483_647;
75
81
 
76
82
  export function resolveCursorFetchTimeout(value) {
package/src/sync.js CHANGED
@@ -21,12 +21,6 @@ function formatBytes(bytes) {
21
21
  return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;
22
22
  }
23
23
 
24
- /** Hide only Cursor's intentional transient fetch soft-skip in quiet (daemon) syncs. */
25
- export function shouldSuppressParserWarning(source, message, quiet) {
26
- if (!quiet) return false;
27
- return source === 'cursor' && message.startsWith('cursor: Cursor usage export skipped (');
28
- }
29
-
30
24
  export function resolveUploadProjectSetting(settings) {
31
25
  if (typeof settings?.uploadProject !== 'boolean') {
32
26
  const error = new Error('SETTINGS_UNAVAILABLE');
@@ -184,13 +178,17 @@ export async function runSync({
184
178
  if (indexing) {
185
179
  parserProgress.push({ source, ...indexing });
186
180
  }
181
+ // Parser warnings always reach stderr, including quiet (daemon) runs: the
182
+ // daemon log is the only trail a background failure leaves. Cursor's fetch
183
+ // soft-skip used to be filtered out here to keep that log tidy, which made
184
+ // a permanently failing export indistinguishable from a healthy one -- the
185
+ // tool still listed as "installed" while it had never uploaded a byte.
187
186
  for (const message of warnings) {
188
- if (shouldSuppressParserWarning(source, message, quiet)) continue;
189
187
  process.stderr.write(`${dim(` ${message}`)}\n`);
190
188
  }
191
- // A parser may deliberately suppress a transient error (Cursor network
192
- // timeout) to keep daemon logs quiet. Its empty result is not proof that
193
- // its prior data disappeared, so it must not be pruned this run.
189
+ // A parser may downgrade a transient error (Cursor network timeout) to a
190
+ // warning instead of throwing. Its empty result is not proof that its prior
191
+ // data disappeared, so it must not be pruned this run.
194
192
  if (!skipped) okSources.add(source);
195
193
  for (const bucket of buckets) allBuckets.push(bucket);
196
194
  for (const session of sessions) allSessions.push(session);