tledger 0.1.4 → 0.2.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.md +122 -80
- package/bin/token-ledger-rates.mjs +62 -0
- package/bin/token-ledger-terminal.mjs +133 -257
- package/bin/token-ledger-trend-image.mjs +945 -0
- package/bin/token-ledger-trend-terminal.mjs +609 -0
- package/bin/token-ledger-trend.mjs +745 -0
- package/bin/token-ledger-tui.mjs +15 -21
- package/bin/token-ledger.mjs +408 -248
- package/lib/{token-ledger-collector.mjs → token-ledger-importer.mjs} +256 -409
- package/package.json +18 -14
- package/lib/token-ledger-models.mjs +0 -113
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tledger",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "A local-only terminal dashboard for Codex token usage",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -19,13 +19,15 @@
|
|
|
19
19
|
"type": "git",
|
|
20
20
|
"url": "git+https://github.com/jskoiz/token-ledger.git"
|
|
21
21
|
},
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
22
25
|
"engines": {
|
|
23
26
|
"node": ">=22.13.0"
|
|
24
27
|
},
|
|
25
28
|
"files": [
|
|
26
|
-
"bin
|
|
27
|
-
"lib
|
|
28
|
-
"LICENSE",
|
|
29
|
+
"bin",
|
|
30
|
+
"lib",
|
|
29
31
|
"README.md"
|
|
30
32
|
],
|
|
31
33
|
"bin": {
|
|
@@ -33,16 +35,18 @@
|
|
|
33
35
|
},
|
|
34
36
|
"scripts": {
|
|
35
37
|
"test": "node --test tests/*.test.mjs",
|
|
36
|
-
"test
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"prepublishOnly": "npm run verify:release"
|
|
38
|
+
"cli:test": "node --test tests/token-ledger-cli.test.mjs",
|
|
39
|
+
"lint": "eslint .",
|
|
40
|
+
"usage:snapshot": "node lib/token-ledger-importer.mjs --output outputs/token-ledger-snapshot.json",
|
|
41
|
+
"usage:day": "node bin/token-ledger.mjs day",
|
|
42
|
+
"usage:week": "node bin/token-ledger.mjs week",
|
|
43
|
+
"prepublishOnly": "npm test"
|
|
43
44
|
},
|
|
44
|
-
"
|
|
45
|
-
"
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"eslint": "9.39.4"
|
|
46
47
|
},
|
|
47
|
-
"type": "module"
|
|
48
|
+
"type": "module",
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"sharp": "^0.35.3"
|
|
51
|
+
}
|
|
48
52
|
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
const MODEL_PRESENTATIONS = [
|
|
2
|
-
{
|
|
3
|
-
canonical: "codex-auto-review",
|
|
4
|
-
families: ["auto-review", "codex-auto-review"],
|
|
5
|
-
label: "Auto Review",
|
|
6
|
-
colorKey: "autoReview",
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
canonical: "gpt-daybreak-blue",
|
|
10
|
-
families: ["daybreak-blue", "gpt-daybreak-blue"],
|
|
11
|
-
label: "Daybreak Blue",
|
|
12
|
-
colorKey: "daybreakBlue",
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
canonical: "gpt-5.6-sol",
|
|
16
|
-
families: ["sol", "gpt-5.6-sol"],
|
|
17
|
-
label: "Sol",
|
|
18
|
-
colorKey: "sol",
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
canonical: "gpt-5.6-luna",
|
|
22
|
-
families: ["luna", "gpt-5.6-luna"],
|
|
23
|
-
label: "Luna",
|
|
24
|
-
colorKey: "luna",
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
canonical: "gpt-5.6-terra",
|
|
28
|
-
families: ["terra", "gpt-5.6-terra"],
|
|
29
|
-
label: "Terra",
|
|
30
|
-
colorKey: "terra",
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
canonical: "gpt-5.5-cyber",
|
|
34
|
-
families: ["gpt-5.5-cyber"],
|
|
35
|
-
label: "GPT-5.5 Cyber",
|
|
36
|
-
colorKey: "gpt",
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
canonical: "gpt-5.5",
|
|
40
|
-
families: ["gpt-5.5"],
|
|
41
|
-
label: "GPT-5.5",
|
|
42
|
-
colorKey: "gpt",
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
canonical: "gpt-5.4-mini",
|
|
46
|
-
families: ["gpt-5.4-mini"],
|
|
47
|
-
label: "GPT-5.4 Mini",
|
|
48
|
-
colorKey: "gpt",
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
canonical: "gpt-5.4",
|
|
52
|
-
families: ["gpt-5.4"],
|
|
53
|
-
label: "GPT-5.4",
|
|
54
|
-
colorKey: "gpt",
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
canonical: "gpt-5.3-codex",
|
|
58
|
-
families: ["gpt-5.3-codex"],
|
|
59
|
-
label: "GPT-5.3 Codex",
|
|
60
|
-
colorKey: "gpt",
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
canonical: "gpt-5.2",
|
|
64
|
-
families: ["gpt-5.2"],
|
|
65
|
-
label: "GPT-5.2",
|
|
66
|
-
colorKey: "gpt",
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
canonical: "gpt",
|
|
70
|
-
families: ["gpt"],
|
|
71
|
-
label: "GPT",
|
|
72
|
-
colorKey: "gpt",
|
|
73
|
-
exact: true,
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
canonical: "unknown",
|
|
77
|
-
families: ["unknown", "unknown-model"],
|
|
78
|
-
label: "Unknown model",
|
|
79
|
-
colorKey: "other",
|
|
80
|
-
exact: true,
|
|
81
|
-
},
|
|
82
|
-
];
|
|
83
|
-
|
|
84
|
-
function normalizedModel(value) {
|
|
85
|
-
return String(value || "")
|
|
86
|
-
.trim()
|
|
87
|
-
.toLowerCase()
|
|
88
|
-
.replaceAll("_", "-")
|
|
89
|
-
.replace(/\s+/g, "-");
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function presentationFor(value) {
|
|
93
|
-
const normalized = normalizedModel(value);
|
|
94
|
-
return MODEL_PRESENTATIONS.find((presentation) => presentation.families.some(
|
|
95
|
-
(family) => normalized === family || (
|
|
96
|
-
presentation.exact !== true && normalized.startsWith(`${family}-`)
|
|
97
|
-
),
|
|
98
|
-
));
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export function normalizeModelIdentifier(value) {
|
|
102
|
-
const normalized = normalizedModel(value) || "unknown";
|
|
103
|
-
return presentationFor(normalized)?.canonical || normalized;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export function modelDisplayName(value) {
|
|
107
|
-
const model = String(value || "").trim();
|
|
108
|
-
return presentationFor(model)?.label || model || "Unknown model";
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export function modelColorKey(value) {
|
|
112
|
-
return presentationFor(value)?.colorKey || "other";
|
|
113
|
-
}
|