@celljs/ta-usage 0.0.0-stage → 4.17.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/README.en.md +6 -0
- package/README.md +5 -2
- package/host/index.mjs +220 -0
- package/package.json +59 -4
- package/web/index.js +471 -0
package/README.en.md
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Cell - Ta Usage
|
|
2
|
+
|
|
3
|
+
A pi package that comes with Ta (on by default; turned off in Settings → Extensions of the web client): Usage.
|
|
4
|
+
|
|
5
|
+
- **The Usage page**: under Discover and in Quick open (loaded when opened). The tokens (input, output, read from the cache) and the cost of the last 7, 30 or 90 days, a bar a day; each model with its tokens, cost and calls; and the conversations that used the most, each opening as it is clicked.
|
|
6
|
+
- Read from the conversations of Ta on this computer (`~/.ta/agent/sessions`) by the server side of the package, kept by the time each file changed, never written. The cost is the price the model's provider gives; a model without one counts its tokens only.
|
package/README.md
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Cell - Ta Usage
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Ta 自带的 pi 包(默认开启,可在 Web 客户端的 设置 → 扩展 关闭):用量。
|
|
4
|
+
|
|
5
|
+
- **"用量"页**:在"发现"和快捷打开里(按需启动:点开才加载)。最近 7 天、30 天或 90 天的 tokens(输入、输出、缓存命中)和花费,每天一根柱子;按模型列出各自的 tokens、花费和调用次数;用得最多的对话列在最后,点一下就打开。
|
|
6
|
+
- 数据来自这台电脑上 Ta 的对话记录(`~/.ta/agent/sessions`),由包的服务端读取,按文件的修改时间缓存,只读不写。花费是模型服务给出的价格,没有价格的模型只计 tokens。
|
package/host/index.mjs
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
// web-src/usage-host.ts
|
|
2
|
+
import { readdir, readFile, stat } from "node:fs/promises";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
|
|
5
|
+
// web-src/usage-protocol.ts
|
|
6
|
+
var USAGE_DAYS = [7, 30, 90];
|
|
7
|
+
var TOP_CONVERSATIONS = 8;
|
|
8
|
+
|
|
9
|
+
// web-src/usage-util.ts
|
|
10
|
+
var DAY = 86400000;
|
|
11
|
+
function number(value) {
|
|
12
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : 0;
|
|
13
|
+
}
|
|
14
|
+
function text(content) {
|
|
15
|
+
if (typeof content === "string") {
|
|
16
|
+
return content;
|
|
17
|
+
}
|
|
18
|
+
if (Array.isArray(content)) {
|
|
19
|
+
return content.filter((block) => block && typeof block === "object" && block.type === "text").map((block) => String(block.text ?? "")).join(" ");
|
|
20
|
+
}
|
|
21
|
+
return "";
|
|
22
|
+
}
|
|
23
|
+
var UsageUtil;
|
|
24
|
+
((UsageUtil) => {
|
|
25
|
+
function parse(file, content) {
|
|
26
|
+
let cwd = "";
|
|
27
|
+
let name = "";
|
|
28
|
+
let first = "";
|
|
29
|
+
const calls = [];
|
|
30
|
+
for (const line of content.split(`
|
|
31
|
+
`)) {
|
|
32
|
+
if (!line.trim()) {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
let entry;
|
|
36
|
+
try {
|
|
37
|
+
entry = JSON.parse(line);
|
|
38
|
+
} catch {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
if (entry.type === "session") {
|
|
42
|
+
cwd = typeof entry.cwd === "string" ? entry.cwd : cwd;
|
|
43
|
+
} else if (entry.type === "session_info" && typeof entry.name === "string") {
|
|
44
|
+
name = entry.name;
|
|
45
|
+
} else if (entry.type === "message" && entry.message && typeof entry.message === "object") {
|
|
46
|
+
const message = entry.message;
|
|
47
|
+
if (message.role === "user" && !first) {
|
|
48
|
+
first = text(message.content).trim().split(`
|
|
49
|
+
`)[0].slice(0, 80);
|
|
50
|
+
} else if (message.role === "assistant" && message.usage && typeof message.usage === "object") {
|
|
51
|
+
const usage = message.usage;
|
|
52
|
+
const call = {
|
|
53
|
+
at: number(message.timestamp) || Date.parse(String(entry.timestamp)) || 0,
|
|
54
|
+
model: [message.provider, message.model].filter((part) => typeof part === "string" && part).join("/"),
|
|
55
|
+
input: number(usage.input),
|
|
56
|
+
output: number(usage.output),
|
|
57
|
+
cacheRead: number(usage.cacheRead),
|
|
58
|
+
cacheWrite: number(usage.cacheWrite),
|
|
59
|
+
cost: number(usage.cost?.total)
|
|
60
|
+
};
|
|
61
|
+
if (call.input || call.output || call.cacheRead || call.cost) {
|
|
62
|
+
calls.push(call);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return { file, title: name || first, cwd, calls };
|
|
68
|
+
}
|
|
69
|
+
UsageUtil.parse = parse;
|
|
70
|
+
function empty() {
|
|
71
|
+
return { input: 0, output: 0, cacheRead: 0, cost: 0, calls: 0 };
|
|
72
|
+
}
|
|
73
|
+
UsageUtil.empty = empty;
|
|
74
|
+
function add(totals, call) {
|
|
75
|
+
totals.input += call.input + call.cacheWrite;
|
|
76
|
+
totals.output += call.output;
|
|
77
|
+
totals.cacheRead += call.cacheRead;
|
|
78
|
+
totals.cost += call.cost;
|
|
79
|
+
totals.calls++;
|
|
80
|
+
}
|
|
81
|
+
UsageUtil.add = add;
|
|
82
|
+
function day(time) {
|
|
83
|
+
const date = new Date(time);
|
|
84
|
+
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
|
|
85
|
+
}
|
|
86
|
+
UsageUtil.day = day;
|
|
87
|
+
function tokens(totals) {
|
|
88
|
+
return totals.input + totals.output + totals.cacheRead;
|
|
89
|
+
}
|
|
90
|
+
UsageUtil.tokens = tokens;
|
|
91
|
+
function report(files, days, now) {
|
|
92
|
+
const start = new Date(now);
|
|
93
|
+
start.setHours(0, 0, 0, 0);
|
|
94
|
+
const from = start.getTime() - (days - 1) * DAY;
|
|
95
|
+
const daily = Array.from({ length: days }, (_, index) => ({ day: day(from + index * DAY + DAY / 2), ...empty() }));
|
|
96
|
+
const byDay = new Map(daily.map((entry) => [entry.day, entry]));
|
|
97
|
+
const totals = empty();
|
|
98
|
+
const models = new Map;
|
|
99
|
+
const conversations = [];
|
|
100
|
+
for (const file of files) {
|
|
101
|
+
const of = { file: file.file, title: file.title, cwd: file.cwd, last: 0, ...empty() };
|
|
102
|
+
for (const call of file.calls) {
|
|
103
|
+
if (call.at < from || call.at > now + DAY) {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
add(totals, call);
|
|
107
|
+
const today = byDay.get(day(call.at));
|
|
108
|
+
if (today) {
|
|
109
|
+
add(today, call);
|
|
110
|
+
}
|
|
111
|
+
const model = call.model || "?";
|
|
112
|
+
let byModel = models.get(model);
|
|
113
|
+
if (!byModel) {
|
|
114
|
+
byModel = { model, ...empty() };
|
|
115
|
+
models.set(model, byModel);
|
|
116
|
+
}
|
|
117
|
+
add(byModel, call);
|
|
118
|
+
add(of, call);
|
|
119
|
+
of.last = Math.max(of.last, call.at);
|
|
120
|
+
}
|
|
121
|
+
if (of.calls) {
|
|
122
|
+
conversations.push(of);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
const most = (a, b) => b.cost - a.cost || tokens(b) - tokens(a);
|
|
126
|
+
return {
|
|
127
|
+
days,
|
|
128
|
+
totals,
|
|
129
|
+
daily,
|
|
130
|
+
models: [...models.values()].sort(most),
|
|
131
|
+
conversations: conversations.sort(most).slice(0, TOP_CONVERSATIONS)
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
UsageUtil.report = report;
|
|
135
|
+
function compact(value) {
|
|
136
|
+
if (value < 1000) {
|
|
137
|
+
return String(Math.round(value));
|
|
138
|
+
}
|
|
139
|
+
const [scale, unit] = value >= 1e9 ? [1e9, "B"] : value >= 1e6 ? [1e6, "M"] : [1000, "K"];
|
|
140
|
+
const scaled = value / scale;
|
|
141
|
+
return `${scaled >= 100 ? Math.round(scaled) : Number(scaled.toFixed(1))}${unit}`;
|
|
142
|
+
}
|
|
143
|
+
UsageUtil.compact = compact;
|
|
144
|
+
function dollars(value) {
|
|
145
|
+
if (value <= 0) {
|
|
146
|
+
return "$0";
|
|
147
|
+
}
|
|
148
|
+
return value < 0.01 ? "<$0.01" : value < 100 ? `$${value.toFixed(2)}` : `$${Math.round(value)}`;
|
|
149
|
+
}
|
|
150
|
+
UsageUtil.dollars = dollars;
|
|
151
|
+
})(UsageUtil ||= {});
|
|
152
|
+
|
|
153
|
+
// web-src/usage-host.ts
|
|
154
|
+
class UsageHost {
|
|
155
|
+
agentDir;
|
|
156
|
+
now;
|
|
157
|
+
kept = new Map;
|
|
158
|
+
reading;
|
|
159
|
+
constructor(agentDir, now = Date.now) {
|
|
160
|
+
this.agentDir = agentDir;
|
|
161
|
+
this.now = now;
|
|
162
|
+
}
|
|
163
|
+
dispose() {
|
|
164
|
+
this.kept.clear();
|
|
165
|
+
}
|
|
166
|
+
static of(host) {
|
|
167
|
+
return new UsageHost(host.agentDir);
|
|
168
|
+
}
|
|
169
|
+
async report(days) {
|
|
170
|
+
const span = USAGE_DAYS.includes(days) ? days : USAGE_DAYS[0];
|
|
171
|
+
return UsageUtil.report(await this.files(), span, this.now());
|
|
172
|
+
}
|
|
173
|
+
files() {
|
|
174
|
+
this.reading ??= this.read().finally(() => {
|
|
175
|
+
this.reading = undefined;
|
|
176
|
+
});
|
|
177
|
+
return this.reading;
|
|
178
|
+
}
|
|
179
|
+
async read() {
|
|
180
|
+
const root = join(this.agentDir, "sessions");
|
|
181
|
+
const dirs = await readdir(root, { withFileTypes: true }).catch(() => []);
|
|
182
|
+
const names = (await Promise.all(dirs.filter((entry) => entry.isDirectory()).map(async (entry) => (await readdir(join(root, entry.name)).catch(() => [])).filter((name) => name.endsWith(".jsonl")).map((name) => join(root, entry.name, name))))).flat();
|
|
183
|
+
const seen = new Set(names);
|
|
184
|
+
const files = await Promise.all(names.map(async (file) => {
|
|
185
|
+
const info = await stat(file).catch(() => {
|
|
186
|
+
return;
|
|
187
|
+
});
|
|
188
|
+
if (!info) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
const kept = this.kept.get(file);
|
|
192
|
+
if (kept && kept.mtimeMs === info.mtimeMs && kept.size === info.size) {
|
|
193
|
+
return kept.usage;
|
|
194
|
+
}
|
|
195
|
+
const content = await readFile(file, "utf8").catch(() => {
|
|
196
|
+
return;
|
|
197
|
+
});
|
|
198
|
+
if (content === undefined) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
const usage = UsageUtil.parse(file, content);
|
|
202
|
+
this.kept.set(file, { mtimeMs: info.mtimeMs, size: info.size, usage });
|
|
203
|
+
return usage;
|
|
204
|
+
}));
|
|
205
|
+
for (const file of this.kept.keys()) {
|
|
206
|
+
if (!seen.has(file)) {
|
|
207
|
+
this.kept.delete(file);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return files.filter((file) => !!file);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// web-src/host.ts
|
|
215
|
+
function activate(host) {
|
|
216
|
+
return UsageHost.of(host);
|
|
217
|
+
}
|
|
218
|
+
export {
|
|
219
|
+
activate as default
|
|
220
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,61 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-usage",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "4.17.0",
|
|
4
|
+
"description": "A pi package for Ta: the Usage page, the tokens and the cost of the conversations of Ta by day, by model and by conversation",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"pi-package"
|
|
7
|
+
],
|
|
8
|
+
"homepage": "https://github.com/cellbang/ta",
|
|
9
|
+
"bugs": {
|
|
10
|
+
"url": "https://github.com/cellbang/ta/issues"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/cellbang/cell.git"
|
|
15
|
+
},
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"files": [
|
|
18
|
+
"web",
|
|
19
|
+
"host",
|
|
20
|
+
"!**/*.map"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsc -b && bun build web-src/index.tsx --format esm --target browser --outfile web/index.js && bun build web-src/host.ts --format esm --target node --outfile host/index.mjs",
|
|
24
|
+
"clean": "rm -rf lib web host *.tsbuildinfo",
|
|
25
|
+
"test": "bun test ./lib",
|
|
26
|
+
"watch": "tsc -b -w --preserveWatchOutput"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@celljs/ta-protocol": "4.17.0",
|
|
30
|
+
"@celljs/ta-web": "4.17.0",
|
|
31
|
+
"@types/react": "^19.3.0"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"pi": {
|
|
37
|
+
"title": {
|
|
38
|
+
"en": "Usage",
|
|
39
|
+
"zh-CN": "用量",
|
|
40
|
+
"zh-TW": "用量",
|
|
41
|
+
"ja-JP": "使用量"
|
|
42
|
+
},
|
|
43
|
+
"summary": {
|
|
44
|
+
"en": "The Usage page under Discover: the tokens and the cost of your conversations by day, by model and by conversation, read from the conversations on this computer.",
|
|
45
|
+
"zh-CN": "\"用量\"页,在\"发现\"里:按天、按模型、按对话看 tokens 和花费,从这台电脑上的对话记录统计。",
|
|
46
|
+
"zh-TW": "「用量」頁,在「發現」裡:按天、按模型、按對話看 tokens 和花費,從這台電腦上的對話紀錄統計。",
|
|
47
|
+
"ja-JP": "「見つける」の「使用量」ページ:日別・モデル別・会話別のトークン数と費用を、このコンピューターの会話記録から集計します。"
|
|
48
|
+
},
|
|
49
|
+
"icon": "Gauge",
|
|
50
|
+
"webActivation": "open",
|
|
51
|
+
"web": [
|
|
52
|
+
"./web/index.js"
|
|
53
|
+
],
|
|
54
|
+
"host": "./host/index.mjs",
|
|
55
|
+
"permissions": {
|
|
56
|
+
"host": {
|
|
57
|
+
"*": "chat.view"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
package/web/index.js
ADDED
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
// ../ta-protocol/esm/common/language.js
|
|
2
|
+
var TaLanguageUtil;
|
|
3
|
+
(function(TaLanguageUtil2) {
|
|
4
|
+
TaLanguageUtil2.ALL = ["zh-CN", "zh-TW", "en-US", "ja-JP"];
|
|
5
|
+
TaLanguageUtil2.NAMES = { "zh-CN": "简体中文", "zh-TW": "繁體中文", "en-US": "English", "ja-JP": "日本語" };
|
|
6
|
+
function of(tag) {
|
|
7
|
+
const said = (tag !== null && tag !== undefined ? tag : "").toLowerCase().replace(/_/g, "-");
|
|
8
|
+
if (/^zh(\b|-)/.test(said)) {
|
|
9
|
+
return /-hant\b/.test(said) || !/-hans\b/.test(said) && /-(tw|hk|mo)\b/.test(said) ? "zh-TW" : "zh-CN";
|
|
10
|
+
}
|
|
11
|
+
return /^ja(\b|-)/.test(said) ? "ja-JP" : "en-US";
|
|
12
|
+
}
|
|
13
|
+
TaLanguageUtil2.of = of;
|
|
14
|
+
function server(env = typeof process === "undefined" ? {} : process.env) {
|
|
15
|
+
return of(env.TA_LANGUAGE || env.LC_ALL || env.LC_MESSAGES || env.LANG);
|
|
16
|
+
}
|
|
17
|
+
TaLanguageUtil2.server = server;
|
|
18
|
+
function pick(language, words) {
|
|
19
|
+
return words[of(language)];
|
|
20
|
+
}
|
|
21
|
+
TaLanguageUtil2.pick = pick;
|
|
22
|
+
function say(words) {
|
|
23
|
+
return words[server()];
|
|
24
|
+
}
|
|
25
|
+
TaLanguageUtil2.say = say;
|
|
26
|
+
function chinese(language) {
|
|
27
|
+
return of(language).startsWith("zh");
|
|
28
|
+
}
|
|
29
|
+
TaLanguageUtil2.chinese = chinese;
|
|
30
|
+
function cjk(language) {
|
|
31
|
+
return of(language) !== "en-US";
|
|
32
|
+
}
|
|
33
|
+
TaLanguageUtil2.cjk = cjk;
|
|
34
|
+
function list(language, items) {
|
|
35
|
+
return items.join(cjk(language) ? "、" : ", ");
|
|
36
|
+
}
|
|
37
|
+
TaLanguageUtil2.list = list;
|
|
38
|
+
})(TaLanguageUtil || (TaLanguageUtil = {}));
|
|
39
|
+
|
|
40
|
+
// web-src/i18n.ts
|
|
41
|
+
var EN = {
|
|
42
|
+
title: "Usage",
|
|
43
|
+
intro: "Tokens and cost of your conversations on this computer",
|
|
44
|
+
days: "{n} days",
|
|
45
|
+
cost: "Cost",
|
|
46
|
+
tokens: "Tokens",
|
|
47
|
+
input: "Input",
|
|
48
|
+
output: "Output",
|
|
49
|
+
cached: "From cache",
|
|
50
|
+
calls: "Calls",
|
|
51
|
+
daily: "By day",
|
|
52
|
+
models: "By model",
|
|
53
|
+
conversations: "Used the most",
|
|
54
|
+
none: "Nothing used in these days yet",
|
|
55
|
+
loading: "Reading the conversations…",
|
|
56
|
+
failed: "Could not read the usage",
|
|
57
|
+
model: "Model",
|
|
58
|
+
untitled: "Untitled",
|
|
59
|
+
costNote: "The cost is the price the model service gives; a model without one counts its tokens only."
|
|
60
|
+
};
|
|
61
|
+
var ZH = {
|
|
62
|
+
title: "用量",
|
|
63
|
+
intro: "这台电脑上各个对话用了多少 tokens、花了多少钱",
|
|
64
|
+
days: "{n} 天",
|
|
65
|
+
cost: "花费",
|
|
66
|
+
tokens: "Tokens",
|
|
67
|
+
input: "输入",
|
|
68
|
+
output: "输出",
|
|
69
|
+
cached: "缓存命中",
|
|
70
|
+
calls: "调用",
|
|
71
|
+
daily: "按天",
|
|
72
|
+
models: "按模型",
|
|
73
|
+
conversations: "用得最多的对话",
|
|
74
|
+
none: "这几天还没有用量",
|
|
75
|
+
loading: "正在读取对话记录…",
|
|
76
|
+
failed: "读取用量失败",
|
|
77
|
+
model: "模型",
|
|
78
|
+
untitled: "未命名",
|
|
79
|
+
costNote: "花费按模型服务给出的价格计算,没有价格的模型只计 tokens。"
|
|
80
|
+
};
|
|
81
|
+
var ZH_TW = {
|
|
82
|
+
title: "用量",
|
|
83
|
+
intro: "這台電腦上各個對話用了多少 tokens、花了多少錢",
|
|
84
|
+
days: "{n} 天",
|
|
85
|
+
cost: "花費",
|
|
86
|
+
tokens: "Tokens",
|
|
87
|
+
input: "輸入",
|
|
88
|
+
output: "輸出",
|
|
89
|
+
cached: "快取命中",
|
|
90
|
+
calls: "呼叫",
|
|
91
|
+
daily: "按天",
|
|
92
|
+
models: "按模型",
|
|
93
|
+
conversations: "用得最多的對話",
|
|
94
|
+
none: "這幾天還沒有用量",
|
|
95
|
+
loading: "正在讀取對話紀錄…",
|
|
96
|
+
failed: "讀取用量失敗",
|
|
97
|
+
model: "模型",
|
|
98
|
+
untitled: "未命名",
|
|
99
|
+
costNote: "花費按模型服務給出的價格計算,沒有價格的模型只計 tokens。"
|
|
100
|
+
};
|
|
101
|
+
var JA = {
|
|
102
|
+
title: "使用量",
|
|
103
|
+
intro: "このコンピューターの会話が使ったトークン数と費用",
|
|
104
|
+
days: "{n} 日",
|
|
105
|
+
cost: "費用",
|
|
106
|
+
tokens: "トークン",
|
|
107
|
+
input: "入力",
|
|
108
|
+
output: "出力",
|
|
109
|
+
cached: "キャッシュ",
|
|
110
|
+
calls: "呼び出し",
|
|
111
|
+
daily: "日別",
|
|
112
|
+
models: "モデル別",
|
|
113
|
+
conversations: "よく使った会話",
|
|
114
|
+
none: "この期間の使用量はまだありません",
|
|
115
|
+
loading: "会話記録を読み込み中…",
|
|
116
|
+
failed: "使用量を読み込めませんでした",
|
|
117
|
+
model: "モデル",
|
|
118
|
+
untitled: "無題",
|
|
119
|
+
costNote: "費用はモデルサービスの価格で計算します。価格のないモデルはトークン数のみ数えます。"
|
|
120
|
+
};
|
|
121
|
+
var WORDS = { "zh-CN": ZH, "zh-TW": ZH_TW, "en-US": EN, "ja-JP": JA };
|
|
122
|
+
var UsageWordsUtil;
|
|
123
|
+
((UsageWordsUtil) => {
|
|
124
|
+
function of(language) {
|
|
125
|
+
return TaLanguageUtil.pick(language, WORDS);
|
|
126
|
+
}
|
|
127
|
+
UsageWordsUtil.of = of;
|
|
128
|
+
function format(text, values) {
|
|
129
|
+
return text.replace(/\{(\w+)\}/g, (whole, key) => (key in values) ? String(values[key]) : whole);
|
|
130
|
+
}
|
|
131
|
+
UsageWordsUtil.format = format;
|
|
132
|
+
})(UsageWordsUtil ||= {});
|
|
133
|
+
|
|
134
|
+
// web-src/react.ts
|
|
135
|
+
var React;
|
|
136
|
+
function bind(react) {
|
|
137
|
+
React = react;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// web-src/style.ts
|
|
141
|
+
var STYLE = `
|
|
142
|
+
.tus-scroll { flex: 1; min-height: 0; height: 100%; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-gutter: stable; }
|
|
143
|
+
.tus { display: flex; flex-direction: column; gap: 16px; width: 100%; min-height: 100%; max-width: var(--ta-page-wide); margin: 0 auto; padding: 28px 24px 48px; box-sizing: border-box; }
|
|
144
|
+
.tus-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 0 2px 4px; }
|
|
145
|
+
.tus-title { margin: 0; color: var(--ta-text); font-size: calc(20px * var(--ta-font-scale)); line-height: calc(28px * var(--ta-font-scale)); font-weight: 600; }
|
|
146
|
+
.tus-intro { margin: 4px 0 0; color: var(--ta-muted); font-size: calc(13.5px * var(--ta-font-scale)); }
|
|
147
|
+
.tus-loading { display: flex; align-items: center; gap: 8px; margin: 32px 2px; color: var(--ta-muted); font-size: calc(13.5px * var(--ta-font-scale)); }
|
|
148
|
+
.tus { container-type: inline-size; }
|
|
149
|
+
.tus-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
|
|
150
|
+
@container (max-width: 720px) { .tus-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
|
|
151
|
+
.tus-stat { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 12px; background: var(--ta-card); border: 1px solid var(--ta-border-muted); min-width: 0; }
|
|
152
|
+
.tus-stat span { color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
|
|
153
|
+
.tus-stat b { color: var(--ta-text); font-size: calc(19px * var(--ta-font-scale)); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
154
|
+
.tus-card { padding: 14px 16px; border-radius: 12px; background: var(--ta-card); border: 1px solid var(--ta-border-muted); }
|
|
155
|
+
.tus-card h2 { margin: 0 0 12px; color: var(--ta-text); font-size: calc(13.5px * var(--ta-font-scale)); font-weight: 600; }
|
|
156
|
+
.tus-bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; }
|
|
157
|
+
.tus-bars-dense { gap: 1px; }
|
|
158
|
+
.tus-bar { flex: 1; min-width: 0; height: 100%; display: flex; align-items: flex-end; border-radius: 3px; }
|
|
159
|
+
.tus-bar:hover { background: var(--ta-hover); }
|
|
160
|
+
.tus-bar span { display: block; width: 100%; border-radius: 3px 3px 1px 1px; background: var(--ta-accent); opacity: 0.85; transition: height 240ms var(--ta-ease); }
|
|
161
|
+
.tus-bar:hover span { opacity: 1; }
|
|
162
|
+
.tus-axis { display: flex; justify-content: space-between; margin-top: 6px; color: var(--ta-muted); font-size: calc(11.5px * var(--ta-font-scale)); font-variant-numeric: tabular-nums; }
|
|
163
|
+
.tus-table { width: 100%; border-collapse: collapse; font-size: calc(13px * var(--ta-font-scale)); font-variant-numeric: tabular-nums; }
|
|
164
|
+
.tus-table th { color: var(--ta-muted); font-weight: 500; text-align: right; padding: 0 0 6px 12px; white-space: nowrap; }
|
|
165
|
+
.tus-table td { color: var(--ta-body, var(--ta-text)); text-align: right; padding: 7px 0 7px 12px; border-top: 1px solid var(--ta-border-muted); white-space: nowrap; }
|
|
166
|
+
.tus-table th:first-child, .tus-table td:first-child { text-align: left; padding-left: 0; }
|
|
167
|
+
.tus-name { max-width: 0; width: 100%; overflow: hidden; text-overflow: ellipsis; }
|
|
168
|
+
.tus-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; }
|
|
169
|
+
.tus-list button { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--ta-text); font: inherit; font-size: calc(13px * var(--ta-font-scale)); text-align: left; cursor: pointer; overflow: hidden; }
|
|
170
|
+
.tus-list button:hover { background: var(--ta-hover); }
|
|
171
|
+
.tus-list-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
172
|
+
.tus-list-place { color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
173
|
+
.tus-list-value { font-variant-numeric: tabular-nums; min-width: 52px; text-align: right; }
|
|
174
|
+
.tus-meter { position: absolute; left: 10px; bottom: 3px; height: 2px; max-width: calc(100% - 20px); border-radius: 1px; background: color-mix(in srgb, var(--ta-accent) 55%, transparent); }
|
|
175
|
+
.tus-note { margin: 0 2px; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
|
|
176
|
+
@media (max-width: 640px) {
|
|
177
|
+
.tus { padding: 18px 14px 40px; }
|
|
178
|
+
.tus-list-place { display: none; }
|
|
179
|
+
}
|
|
180
|
+
`;
|
|
181
|
+
function injectStyle() {
|
|
182
|
+
const style = document.createElement("style");
|
|
183
|
+
style.dataset.taUsage = "";
|
|
184
|
+
style.textContent = STYLE;
|
|
185
|
+
document.head.appendChild(style);
|
|
186
|
+
return () => style.remove();
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// web-src/usage-protocol.ts
|
|
190
|
+
var USAGE_DAYS = [7, 30, 90];
|
|
191
|
+
var TOP_CONVERSATIONS = 8;
|
|
192
|
+
|
|
193
|
+
// web-src/usage-util.ts
|
|
194
|
+
var DAY = 86400000;
|
|
195
|
+
function number(value) {
|
|
196
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : 0;
|
|
197
|
+
}
|
|
198
|
+
function text(content) {
|
|
199
|
+
if (typeof content === "string") {
|
|
200
|
+
return content;
|
|
201
|
+
}
|
|
202
|
+
if (Array.isArray(content)) {
|
|
203
|
+
return content.filter((block) => block && typeof block === "object" && block.type === "text").map((block) => String(block.text ?? "")).join(" ");
|
|
204
|
+
}
|
|
205
|
+
return "";
|
|
206
|
+
}
|
|
207
|
+
var UsageUtil;
|
|
208
|
+
((UsageUtil) => {
|
|
209
|
+
function parse(file, content) {
|
|
210
|
+
let cwd = "";
|
|
211
|
+
let name = "";
|
|
212
|
+
let first = "";
|
|
213
|
+
const calls = [];
|
|
214
|
+
for (const line of content.split(`
|
|
215
|
+
`)) {
|
|
216
|
+
if (!line.trim()) {
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
let entry;
|
|
220
|
+
try {
|
|
221
|
+
entry = JSON.parse(line);
|
|
222
|
+
} catch {
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
if (entry.type === "session") {
|
|
226
|
+
cwd = typeof entry.cwd === "string" ? entry.cwd : cwd;
|
|
227
|
+
} else if (entry.type === "session_info" && typeof entry.name === "string") {
|
|
228
|
+
name = entry.name;
|
|
229
|
+
} else if (entry.type === "message" && entry.message && typeof entry.message === "object") {
|
|
230
|
+
const message = entry.message;
|
|
231
|
+
if (message.role === "user" && !first) {
|
|
232
|
+
first = text(message.content).trim().split(`
|
|
233
|
+
`)[0].slice(0, 80);
|
|
234
|
+
} else if (message.role === "assistant" && message.usage && typeof message.usage === "object") {
|
|
235
|
+
const usage = message.usage;
|
|
236
|
+
const call = {
|
|
237
|
+
at: number(message.timestamp) || Date.parse(String(entry.timestamp)) || 0,
|
|
238
|
+
model: [message.provider, message.model].filter((part) => typeof part === "string" && part).join("/"),
|
|
239
|
+
input: number(usage.input),
|
|
240
|
+
output: number(usage.output),
|
|
241
|
+
cacheRead: number(usage.cacheRead),
|
|
242
|
+
cacheWrite: number(usage.cacheWrite),
|
|
243
|
+
cost: number(usage.cost?.total)
|
|
244
|
+
};
|
|
245
|
+
if (call.input || call.output || call.cacheRead || call.cost) {
|
|
246
|
+
calls.push(call);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return { file, title: name || first, cwd, calls };
|
|
252
|
+
}
|
|
253
|
+
UsageUtil.parse = parse;
|
|
254
|
+
function empty() {
|
|
255
|
+
return { input: 0, output: 0, cacheRead: 0, cost: 0, calls: 0 };
|
|
256
|
+
}
|
|
257
|
+
UsageUtil.empty = empty;
|
|
258
|
+
function add(totals, call) {
|
|
259
|
+
totals.input += call.input + call.cacheWrite;
|
|
260
|
+
totals.output += call.output;
|
|
261
|
+
totals.cacheRead += call.cacheRead;
|
|
262
|
+
totals.cost += call.cost;
|
|
263
|
+
totals.calls++;
|
|
264
|
+
}
|
|
265
|
+
UsageUtil.add = add;
|
|
266
|
+
function day(time) {
|
|
267
|
+
const date = new Date(time);
|
|
268
|
+
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
|
|
269
|
+
}
|
|
270
|
+
UsageUtil.day = day;
|
|
271
|
+
function tokens(totals) {
|
|
272
|
+
return totals.input + totals.output + totals.cacheRead;
|
|
273
|
+
}
|
|
274
|
+
UsageUtil.tokens = tokens;
|
|
275
|
+
function report(files, days, now) {
|
|
276
|
+
const start = new Date(now);
|
|
277
|
+
start.setHours(0, 0, 0, 0);
|
|
278
|
+
const from = start.getTime() - (days - 1) * DAY;
|
|
279
|
+
const daily = Array.from({ length: days }, (_, index) => ({ day: day(from + index * DAY + DAY / 2), ...empty() }));
|
|
280
|
+
const byDay = new Map(daily.map((entry) => [entry.day, entry]));
|
|
281
|
+
const totals = empty();
|
|
282
|
+
const models = new Map;
|
|
283
|
+
const conversations = [];
|
|
284
|
+
for (const file of files) {
|
|
285
|
+
const of = { file: file.file, title: file.title, cwd: file.cwd, last: 0, ...empty() };
|
|
286
|
+
for (const call of file.calls) {
|
|
287
|
+
if (call.at < from || call.at > now + DAY) {
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
add(totals, call);
|
|
291
|
+
const today = byDay.get(day(call.at));
|
|
292
|
+
if (today) {
|
|
293
|
+
add(today, call);
|
|
294
|
+
}
|
|
295
|
+
const model = call.model || "?";
|
|
296
|
+
let byModel = models.get(model);
|
|
297
|
+
if (!byModel) {
|
|
298
|
+
byModel = { model, ...empty() };
|
|
299
|
+
models.set(model, byModel);
|
|
300
|
+
}
|
|
301
|
+
add(byModel, call);
|
|
302
|
+
add(of, call);
|
|
303
|
+
of.last = Math.max(of.last, call.at);
|
|
304
|
+
}
|
|
305
|
+
if (of.calls) {
|
|
306
|
+
conversations.push(of);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
const most = (a, b) => b.cost - a.cost || tokens(b) - tokens(a);
|
|
310
|
+
return {
|
|
311
|
+
days,
|
|
312
|
+
totals,
|
|
313
|
+
daily,
|
|
314
|
+
models: [...models.values()].sort(most),
|
|
315
|
+
conversations: conversations.sort(most).slice(0, TOP_CONVERSATIONS)
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
UsageUtil.report = report;
|
|
319
|
+
function compact(value) {
|
|
320
|
+
if (value < 1000) {
|
|
321
|
+
return String(Math.round(value));
|
|
322
|
+
}
|
|
323
|
+
const [scale, unit] = value >= 1e9 ? [1e9, "B"] : value >= 1e6 ? [1e6, "M"] : [1000, "K"];
|
|
324
|
+
const scaled = value / scale;
|
|
325
|
+
return `${scaled >= 100 ? Math.round(scaled) : Number(scaled.toFixed(1))}${unit}`;
|
|
326
|
+
}
|
|
327
|
+
UsageUtil.compact = compact;
|
|
328
|
+
function dollars(value) {
|
|
329
|
+
if (value <= 0) {
|
|
330
|
+
return "$0";
|
|
331
|
+
}
|
|
332
|
+
return value < 0.01 ? "<$0.01" : value < 100 ? `$${value.toFixed(2)}` : `$${Math.round(value)}`;
|
|
333
|
+
}
|
|
334
|
+
UsageUtil.dollars = dollars;
|
|
335
|
+
})(UsageUtil ||= {});
|
|
336
|
+
|
|
337
|
+
// web-src/usage-view.tsx
|
|
338
|
+
function place(cwd) {
|
|
339
|
+
return cwd.split(/[\\/]/).filter(Boolean).pop() ?? cwd;
|
|
340
|
+
}
|
|
341
|
+
function UsageView({ pi }) {
|
|
342
|
+
const words = UsageWordsUtil.of(pi.ui.language);
|
|
343
|
+
const [days, setDays] = React.useState(7);
|
|
344
|
+
const [report, setReport] = React.useState();
|
|
345
|
+
const [failed, setFailed] = React.useState(false);
|
|
346
|
+
React.useEffect(() => {
|
|
347
|
+
let current = true;
|
|
348
|
+
setFailed(false);
|
|
349
|
+
pi.callHost("report", days).then((next) => current && setReport(next), () => current && setFailed(true));
|
|
350
|
+
return () => {
|
|
351
|
+
current = false;
|
|
352
|
+
};
|
|
353
|
+
}, [pi, days]);
|
|
354
|
+
const shown = report?.days === days ? report : undefined;
|
|
355
|
+
const priced = !!shown && shown.totals.cost > 0;
|
|
356
|
+
const measure = (totals) => priced ? totals.cost : UsageUtil.tokens(totals);
|
|
357
|
+
const peak = shown ? Math.max(...shown.daily.map(measure), 0) : 0;
|
|
358
|
+
const label = (totals) => priced ? UsageUtil.dollars(totals.cost) : UsageUtil.compact(UsageUtil.tokens(totals));
|
|
359
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
360
|
+
className: "tus-scroll"
|
|
361
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
362
|
+
className: "tus"
|
|
363
|
+
}, /* @__PURE__ */ React.createElement("header", {
|
|
364
|
+
className: "tus-head"
|
|
365
|
+
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("h1", {
|
|
366
|
+
className: "tus-title"
|
|
367
|
+
}, words.title), /* @__PURE__ */ React.createElement("p", {
|
|
368
|
+
className: "tus-intro"
|
|
369
|
+
}, words.intro)), /* @__PURE__ */ React.createElement("fieldset", {
|
|
370
|
+
className: "ta-segmented",
|
|
371
|
+
"aria-label": words.title
|
|
372
|
+
}, USAGE_DAYS.map((choice) => /* @__PURE__ */ React.createElement("button", {
|
|
373
|
+
key: choice,
|
|
374
|
+
type: "button",
|
|
375
|
+
"aria-pressed": choice === days,
|
|
376
|
+
className: choice === days ? "ta-on" : "",
|
|
377
|
+
onClick: () => setDays(choice)
|
|
378
|
+
}, UsageWordsUtil.format(words.days, { n: choice }))))), failed ? /* @__PURE__ */ React.createElement(pi.ui.Empty, {
|
|
379
|
+
title: words.failed,
|
|
380
|
+
tone: "error"
|
|
381
|
+
}) : !shown ? /* @__PURE__ */ React.createElement("p", {
|
|
382
|
+
className: "tus-loading"
|
|
383
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
384
|
+
className: "ta-spinner"
|
|
385
|
+
}), " ", words.loading) : shown.totals.calls === 0 ? /* @__PURE__ */ React.createElement(pi.ui.Empty, {
|
|
386
|
+
title: words.none
|
|
387
|
+
}) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
388
|
+
className: "tus-stats"
|
|
389
|
+
}, /* @__PURE__ */ React.createElement(Stat, {
|
|
390
|
+
label: words.cost,
|
|
391
|
+
value: UsageUtil.dollars(shown.totals.cost)
|
|
392
|
+
}), /* @__PURE__ */ React.createElement(Stat, {
|
|
393
|
+
label: words.tokens,
|
|
394
|
+
value: UsageUtil.compact(UsageUtil.tokens(shown.totals))
|
|
395
|
+
}), /* @__PURE__ */ React.createElement(Stat, {
|
|
396
|
+
label: words.input,
|
|
397
|
+
value: UsageUtil.compact(shown.totals.input)
|
|
398
|
+
}), /* @__PURE__ */ React.createElement(Stat, {
|
|
399
|
+
label: words.output,
|
|
400
|
+
value: UsageUtil.compact(shown.totals.output)
|
|
401
|
+
}), /* @__PURE__ */ React.createElement(Stat, {
|
|
402
|
+
label: words.cached,
|
|
403
|
+
value: UsageUtil.compact(shown.totals.cacheRead)
|
|
404
|
+
}), /* @__PURE__ */ React.createElement(Stat, {
|
|
405
|
+
label: words.calls,
|
|
406
|
+
value: UsageUtil.compact(shown.totals.calls)
|
|
407
|
+
})), /* @__PURE__ */ React.createElement("section", {
|
|
408
|
+
className: "tus-card"
|
|
409
|
+
}, /* @__PURE__ */ React.createElement("h2", null, words.daily), /* @__PURE__ */ React.createElement("div", {
|
|
410
|
+
className: `tus-bars${days > 30 ? " tus-bars-dense" : ""}`
|
|
411
|
+
}, shown.daily.map((day) => /* @__PURE__ */ React.createElement("div", {
|
|
412
|
+
key: day.day,
|
|
413
|
+
className: "tus-bar",
|
|
414
|
+
title: `${day.day} · ${label(day)} · ${UsageUtil.compact(UsageUtil.tokens(day))} ${words.tokens}`
|
|
415
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
416
|
+
style: { height: `${peak ? Math.max(measure(day) ? 3 : 0, measure(day) / peak * 100) : 0}%` }
|
|
417
|
+
})))), /* @__PURE__ */ React.createElement("div", {
|
|
418
|
+
className: "tus-axis"
|
|
419
|
+
}, /* @__PURE__ */ React.createElement("span", null, shown.daily[0]?.day.slice(5)), /* @__PURE__ */ React.createElement("span", null, shown.daily[shown.daily.length - 1]?.day.slice(5)))), /* @__PURE__ */ React.createElement("section", {
|
|
420
|
+
className: "tus-card"
|
|
421
|
+
}, /* @__PURE__ */ React.createElement("h2", null, words.models), /* @__PURE__ */ React.createElement("table", {
|
|
422
|
+
className: "tus-table"
|
|
423
|
+
}, /* @__PURE__ */ React.createElement("thead", null, /* @__PURE__ */ React.createElement("tr", null, /* @__PURE__ */ React.createElement("th", null, words.model), /* @__PURE__ */ React.createElement("th", null, words.tokens), /* @__PURE__ */ React.createElement("th", null, words.calls), /* @__PURE__ */ React.createElement("th", null, words.cost))), /* @__PURE__ */ React.createElement("tbody", null, shown.models.map((model) => /* @__PURE__ */ React.createElement("tr", {
|
|
424
|
+
key: model.model
|
|
425
|
+
}, /* @__PURE__ */ React.createElement("td", {
|
|
426
|
+
className: "tus-name"
|
|
427
|
+
}, model.model), /* @__PURE__ */ React.createElement("td", null, UsageUtil.compact(UsageUtil.tokens(model))), /* @__PURE__ */ React.createElement("td", null, model.calls), /* @__PURE__ */ React.createElement("td", null, UsageUtil.dollars(model.cost))))))), /* @__PURE__ */ React.createElement("section", {
|
|
428
|
+
className: "tus-card"
|
|
429
|
+
}, /* @__PURE__ */ React.createElement("h2", null, words.conversations), /* @__PURE__ */ React.createElement("ul", {
|
|
430
|
+
className: "tus-list"
|
|
431
|
+
}, shown.conversations.map((conversation) => /* @__PURE__ */ React.createElement("li", {
|
|
432
|
+
key: conversation.file
|
|
433
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
434
|
+
type: "button",
|
|
435
|
+
onClick: () => void pi.openChat(conversation.file)
|
|
436
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
437
|
+
className: "tus-list-title"
|
|
438
|
+
}, conversation.title || words.untitled), /* @__PURE__ */ React.createElement("span", {
|
|
439
|
+
className: "tus-list-place"
|
|
440
|
+
}, place(conversation.cwd)), /* @__PURE__ */ React.createElement("span", {
|
|
441
|
+
className: "tus-list-value"
|
|
442
|
+
}, label(conversation)), /* @__PURE__ */ React.createElement("span", {
|
|
443
|
+
className: "tus-meter",
|
|
444
|
+
style: { width: `${measure(conversation) / (measure(shown.conversations[0]) || 1) * 100}%` }
|
|
445
|
+
})))))), /* @__PURE__ */ React.createElement("p", {
|
|
446
|
+
className: "tus-note"
|
|
447
|
+
}, words.costNote))));
|
|
448
|
+
}
|
|
449
|
+
function Stat({ label, value }) {
|
|
450
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
451
|
+
className: "tus-stat"
|
|
452
|
+
}, /* @__PURE__ */ React.createElement("span", null, label), /* @__PURE__ */ React.createElement("b", null, value));
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
// web-src/index.tsx
|
|
456
|
+
function activate(pi) {
|
|
457
|
+
bind(pi.React);
|
|
458
|
+
const removeStyle = injectStyle();
|
|
459
|
+
pi.registerView("usage", {
|
|
460
|
+
title: () => UsageWordsUtil.of(pi.ui.language).title,
|
|
461
|
+
icon: pi.ui.icons.Gauge,
|
|
462
|
+
location: "page",
|
|
463
|
+
render: () => /* @__PURE__ */ React.createElement(UsageView, {
|
|
464
|
+
pi
|
|
465
|
+
})
|
|
466
|
+
});
|
|
467
|
+
return removeStyle;
|
|
468
|
+
}
|
|
469
|
+
export {
|
|
470
|
+
activate as default
|
|
471
|
+
};
|