@juejin-opensource/jusage 0.1.2 → 0.1.5
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/dist/daemon.d.ts +2 -4
- package/dist/daemon.js +2 -35
- package/dist/dashboard/assets/{ChevronDown-BMySI3-K.js → ChevronDown-B1JZ38iG.js} +1 -1
- package/dist/dashboard/assets/{dashboard-BT3j8KDK.js → dashboard-DEsQW6l5.js} +1 -1
- package/dist/dashboard/assets/{download-BJbOqei8.js → download-fVGp-2Z_.js} +1 -1
- package/dist/dashboard/assets/{env-C1SSlRgu.js → env-D3oFV59v.js} +1 -1
- package/dist/dashboard/assets/{index-CWecC3aA.js → index-DS0F5-Qw.js} +3 -3
- package/dist/dashboard/assets/{index-C0e96pRE.js → index-D_BPUazE.js} +1 -1
- package/dist/dashboard/assets/{pricing-D-4md3s8.js → pricing-CGKNWkYj.js} +1 -1
- package/dist/dashboard/assets/{rank-BYr_YPZj.js → rank-C8qrXGwQ.js} +1 -1
- package/dist/dashboard/assets/{settings-BRc-WOMv.js → settings-2-BTMWNp.js} +1 -1
- package/dist/dashboard/index.html +1 -1
- package/dist/index.js +18 -4
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as D,r as u,j as e,M as L,B as M,A as oe,C as ie,Q as le,a as ne,b as ce,e as de,f as Q,g as E,h as S,i as ue,T as I,P as V,k as C,u as X,l as me,m as _e,D as B,n as fe,S as he,d as pe,o as xe}from"./index-
|
|
1
|
+
import{c as D,r as u,j as e,M as L,B as M,A as oe,C as ie,Q as le,a as ne,b as ce,e as de,f as Q,g as E,h as S,i as ue,T as I,P as V,k as C,u as X,l as me,m as _e,D as B,n as fe,S as he,d as pe,o as xe}from"./index-DS0F5-Qw.js";import{C as z,T as G,a as we,S as R,i as ge}from"./env-D3oFV59v.js";import{S as b,a as v,L as Y,b as y}from"./index-D_BPUazE.js";/**
|
|
2
2
|
* @license lucide-react v1.24.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,d as n}from"./index-
|
|
1
|
+
import{r as t,d as n}from"./index-DS0F5-Qw.js";function e(){return t.useEffect(()=>{n()},[]),null}const s=e;export{s as component};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>AI Usage Dashboard</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-DS0F5-Qw.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-8rr_cXkj.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { dirname, join } from 'node:path';
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
|
-
import { appendJsonLog, BucketStore, createAggregateCache, createApplyAfterSync, createHttpServer, createLocalApiApp, createPollBackoff, DEFAULT_PORT, getHookStatus, getRunningOwner, listenServer, loadConfig, POLL_INTERVAL_MS, pollIntervalLabel, releaseRuntimeOwner, resolveLocalCollectSince, runtimeKindLabel, saveConfig, setupClaudeHook, setupCodexHook, syncAll, collectWrittenBuckets, syncLogPath, touchStatsSince, watchRuntimeSignals, watchSyncSignals, writeSyncDone, maybeUploadAfterSync, uploadToServer, kickBackfillDrain, stopBackfillDrain, drainBackfillUntilIdle, resolvePricingRefreshConfig, startPricingRefresh, } from '@juejin-opensource/jusage-core';
|
|
3
|
+
import { appendJsonLog, BucketStore, createAggregateCache, createApplyAfterSync, createHttpServer, createLocalApiApp, createPollBackoff, DEFAULT_PORT, getHookStatus, getRunningOwner, listenServer, loadConfig, POLL_INTERVAL_MS, pollIntervalLabel, releaseRuntimeOwner, resolveLocalCollectSince, runtimeKindLabel, saveConfig, setupClaudeHook, setupCodexHook, syncAll, collectWrittenBuckets, syncLogPath, touchStatsSince, watchRuntimeSignals, watchSyncSignals, writeSyncDone, maybeUploadAfterSync, uploadToServer, kickBackfillDrain, stopBackfillDrain, drainBackfillUntilIdle, resolvePricingRefreshConfig, DEFAULT_PRICING_FIRST_FETCH_TIMEOUT_MS, startPricingRefresh, } from '@juejin-opensource/jusage-core';
|
|
4
4
|
import { writePid } from './daemon.js';
|
|
5
5
|
import { cmdServiceStart, cmdServiceStatus, cmdServiceStop } from './service.js';
|
|
6
6
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
@@ -14,7 +14,7 @@ let runtimeDataDir = null;
|
|
|
14
14
|
/** True only when this process wrote `tud.pid` as sync/upload owner. */
|
|
15
15
|
let ownedPid = false;
|
|
16
16
|
let runtimeRole = 'owner';
|
|
17
|
-
function startPricingOverlayRefresh(config) {
|
|
17
|
+
async function startPricingOverlayRefresh(dir, config) {
|
|
18
18
|
pricingRefreshStop?.();
|
|
19
19
|
pricingRefreshStop = null;
|
|
20
20
|
const { url, ttlMs } = resolvePricingRefreshConfig({
|
|
@@ -23,14 +23,28 @@ function startPricingOverlayRefresh(config) {
|
|
|
23
23
|
});
|
|
24
24
|
if (!url)
|
|
25
25
|
return;
|
|
26
|
-
|
|
26
|
+
const handle = startPricingRefresh({
|
|
27
27
|
url,
|
|
28
28
|
ttlMs,
|
|
29
|
+
dataDir: dir,
|
|
30
|
+
firstFetchTimeoutMs: DEFAULT_PRICING_FIRST_FETCH_TIMEOUT_MS,
|
|
31
|
+
onUpdate: () => {
|
|
32
|
+
const current = runtime;
|
|
33
|
+
if (!current)
|
|
34
|
+
return;
|
|
35
|
+
void current.aggregateCache
|
|
36
|
+
.rebuildFromRows(current.bucketStore.getRows())
|
|
37
|
+
.catch((err) => {
|
|
38
|
+
console.warn('定价覆盖层刷新后重建缓存失败:', err instanceof Error ? err.message : err);
|
|
39
|
+
});
|
|
40
|
+
},
|
|
29
41
|
onError: (err) => {
|
|
30
42
|
console.warn('定价表远程刷新失败(继续用内置/上次覆盖):', err instanceof Error ? err.message : err);
|
|
31
43
|
},
|
|
32
44
|
});
|
|
45
|
+
pricingRefreshStop = handle;
|
|
33
46
|
console.log(`定价覆盖层: ${url}(TTL ${ttlMs}ms)`);
|
|
47
|
+
await handle.ready;
|
|
34
48
|
}
|
|
35
49
|
function resolveDashboardDir() {
|
|
36
50
|
return join(__dirname, 'dashboard');
|
|
@@ -195,7 +209,7 @@ async function cmdStart(port, daysAgo) {
|
|
|
195
209
|
}
|
|
196
210
|
}
|
|
197
211
|
const { config: refreshed } = await loadConfig(dir);
|
|
198
|
-
startPricingOverlayRefresh(refreshed);
|
|
212
|
+
await startPricingOverlayRefresh(dir, refreshed);
|
|
199
213
|
const bucketStore = new BucketStore();
|
|
200
214
|
await bucketStore.reload(dir, resolveLocalCollectSince(refreshed));
|
|
201
215
|
const aggregateCache = await createAggregateCache(dir, bucketStore.getRows());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juejin-opensource/jusage",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "本地优先的 AI Agent Token 用量看板 CLI(采集 + 本地面板 + 可选云端上报)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@juejin-opensource/jusage-core": "0.1.
|
|
33
|
+
"@juejin-opensource/jusage-core": "0.1.5"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^22.13.10",
|
|
37
37
|
"typescript": "^5.8.2",
|
|
38
|
-
"@juejin-opensource/jusage-dashboard": "0.1.
|
|
38
|
+
"@juejin-opensource/jusage-dashboard": "0.1.4"
|
|
39
39
|
},
|
|
40
40
|
"engines": {
|
|
41
41
|
"node": ">=20"
|