agent-fuel 0.1.0 → 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 +21 -12
- package/dist/adapters/agy.js +13 -17
- package/dist/render.js +14 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,20 +4,30 @@ A sleek, unified CLI dashboard to monitor your AI coding assistant quotas, credi
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
## 🚀
|
|
7
|
+
## 🚀 Installation & Running
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Install **Agent Fuel** globally on your system in one step:
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
npm install
|
|
12
|
+
npm install -g agent-fuel
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
Once
|
|
15
|
+
Once installed, you can run the dashboard at any time from **any directory** on your machine by simply typing:
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
18
|
agent-fuel
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
+
### Development Setup
|
|
22
|
+
If you want to run or contribute to `agent-fuel` locally:
|
|
23
|
+
```bash
|
|
24
|
+
git clone https://github.com/jperod/agent-fuel.git
|
|
25
|
+
cd agent-fuel
|
|
26
|
+
npm install
|
|
27
|
+
npm run build
|
|
28
|
+
npm link
|
|
29
|
+
```
|
|
30
|
+
|
|
21
31
|
---
|
|
22
32
|
|
|
23
33
|
## 💡 The Motivation
|
|
@@ -39,7 +49,7 @@ Because each CLI exposes quota information differently (some via strict JSON, ot
|
|
|
39
49
|
2. **Normalizes Quota Models**: Standardizes diverse limits into a uniform percentage score (`0` to `100%`).
|
|
40
50
|
3. **Renders an Elegant CLI Dashboard**: Displays a high-fidelity 3-bar ASCII progress dashboard directly in your terminal.
|
|
41
51
|
|
|
42
|
-
###
|
|
52
|
+
### Project Architecture
|
|
43
53
|
|
|
44
54
|
```text
|
|
45
55
|
agent-fuel/
|
|
@@ -47,10 +57,9 @@ agent-fuel/
|
|
|
47
57
|
│ ├── index.ts # CLI entry point
|
|
48
58
|
│ ├── render.ts # Beautiful 3-bar dashboard renderer
|
|
49
59
|
│ └── adapters/
|
|
50
|
-
│ ├── claude.ts # Adapter for Claude Code (ccusage
|
|
51
|
-
│ ├── codex.ts # Adapter for Codex (
|
|
52
|
-
│
|
|
53
|
-
│ └── ccusage.ts # Shared JSON parser helper
|
|
60
|
+
│ ├── claude.ts # Adapter for Claude Code (ccusage blocks)
|
|
61
|
+
│ ├── codex.ts # Adapter for Codex (ccusage codex session)
|
|
62
|
+
│ └── agy.ts # Adapter for AGY (Antigravity history & model config parser)
|
|
54
63
|
├── package.json
|
|
55
64
|
└── README.md
|
|
56
65
|
```
|
|
@@ -77,9 +86,9 @@ Running `agent-fuel` will immediately output a clean, colored visual summary of
|
|
|
77
86
|
```text
|
|
78
87
|
⚡️ Agent Fuel - CLI Quota Monitor
|
|
79
88
|
|
|
80
|
-
Codex [
|
|
81
|
-
Claude Code [
|
|
82
|
-
AGY [
|
|
89
|
+
Codex [██████████████████████████████] 99% remaining (resets 01:49 PM)
|
|
90
|
+
Claude Code [█████████████████████████░░░░░] 83% remaining (resets 01:00 PM)
|
|
91
|
+
AGY [██████████████████░░░░░░░░░░░░] 60% remaining (resets 01:57 PM) [Gemini 3.5 Flash (High)]
|
|
83
92
|
```
|
|
84
93
|
|
|
85
94
|
|
package/dist/adapters/agy.js
CHANGED
|
@@ -23,15 +23,10 @@ export class AgyQuotaAdapter {
|
|
|
23
23
|
catch {
|
|
24
24
|
// Fallback to default model name if reading or parsing settings failed
|
|
25
25
|
}
|
|
26
|
-
// 2. Read history.jsonl to detect active prompts
|
|
26
|
+
// 2. Read history.jsonl to detect active prompts within the rolling 5-hour window
|
|
27
27
|
let todayPromptsCount = 0;
|
|
28
28
|
let latestPromptTimestamp = null;
|
|
29
|
-
|
|
30
|
-
const now = new Date();
|
|
31
|
-
const year = now.getFullYear();
|
|
32
|
-
const month = String(now.getMonth() + 1).padStart(2, '0');
|
|
33
|
-
const day = String(now.getDate()).padStart(2, '0');
|
|
34
|
-
const todayPrefix = `${year}-${month}-${day}`;
|
|
29
|
+
const fiveHoursAgo = Date.now() - 5 * 60 * 60 * 1000;
|
|
35
30
|
try {
|
|
36
31
|
const historyContent = await fs.readFile(historyPath, 'utf-8');
|
|
37
32
|
const historyLines = historyContent.trim().split('\n');
|
|
@@ -40,13 +35,8 @@ export class AgyQuotaAdapter {
|
|
|
40
35
|
continue;
|
|
41
36
|
const entry = JSON.parse(line);
|
|
42
37
|
if (entry && entry.timestamp) {
|
|
43
|
-
//
|
|
44
|
-
|
|
45
|
-
const eYear = entryDateObj.getFullYear();
|
|
46
|
-
const eMonth = String(entryDateObj.getMonth() + 1).padStart(2, '0');
|
|
47
|
-
const eDay = String(entryDateObj.getDate()).padStart(2, '0');
|
|
48
|
-
const entryDate = `${eYear}-${eMonth}-${eDay}`;
|
|
49
|
-
if (entryDate === todayPrefix) {
|
|
38
|
+
// Check if the prompt falls within the 5-hour rolling window
|
|
39
|
+
if (entry.timestamp >= fiveHoursAgo) {
|
|
50
40
|
todayPromptsCount++;
|
|
51
41
|
if (!latestPromptTimestamp || entry.timestamp > latestPromptTimestamp) {
|
|
52
42
|
latestPromptTimestamp = entry.timestamp;
|
|
@@ -62,9 +52,15 @@ export class AgyQuotaAdapter {
|
|
|
62
52
|
// Support dynamic overrides using AGENT_FUEL_AGY_PERCENT environment variable
|
|
63
53
|
let remainingPercent = 100;
|
|
64
54
|
const isProModel = activeModel.toLowerCase().includes('pro');
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
55
|
+
let calculatedPercent = 100;
|
|
56
|
+
if (isProModel) {
|
|
57
|
+
// Pro models: limit is 10 prompts, steps of 2 prompts (each step is 20%)
|
|
58
|
+
calculatedPercent = Math.max(0, 100 - (Math.floor(todayPromptsCount / 2) * 20));
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
// Flash models: limit is 25 prompts, steps of 5 prompts (each step is 20%)
|
|
62
|
+
calculatedPercent = Math.max(0, 100 - (Math.floor(todayPromptsCount / 5) * 20));
|
|
63
|
+
}
|
|
68
64
|
if (process.env.AGENT_FUEL_AGY_PERCENT) {
|
|
69
65
|
const envVal = Number(process.env.AGENT_FUEL_AGY_PERCENT);
|
|
70
66
|
remainingPercent = !isNaN(envVal) ? Math.max(0, Math.min(100, envVal)) : calculatedPercent;
|
package/dist/render.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
1
4
|
export function renderDashboard(snapshots) {
|
|
2
5
|
const reset = '\x1b[0m';
|
|
3
6
|
const bold = '\x1b[1m';
|
|
@@ -7,6 +10,16 @@ export function renderDashboard(snapshots) {
|
|
|
7
10
|
const yellow = '\x1b[33m';
|
|
8
11
|
const red = '\x1b[31m';
|
|
9
12
|
const gray = '\x1b[90m';
|
|
13
|
+
// Load version from package.json dynamically
|
|
14
|
+
let versionStr = '';
|
|
15
|
+
try {
|
|
16
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
17
|
+
const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, '../package.json'), 'utf8'));
|
|
18
|
+
versionStr = ` v${packageJson.version}`;
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
// Fallback if reading package.json fails
|
|
22
|
+
}
|
|
10
23
|
console.log(`\n${bold}${cyan}⚡️ Agent Fuel - CLI Quota Monitor${reset}\n`);
|
|
11
24
|
for (const snap of snapshots) {
|
|
12
25
|
const displayName = getDisplayName(snap.tool);
|
|
@@ -45,7 +58,7 @@ export function renderDashboard(snapshots) {
|
|
|
45
58
|
}
|
|
46
59
|
console.log(`${bold}${displayName.padEnd(12)}${reset} [${barStr}] ${percentStr}${detailStr}`);
|
|
47
60
|
}
|
|
48
|
-
console.log(
|
|
61
|
+
console.log(`\n${dim}${gray}agent-fuel${versionStr}${reset}\n`);
|
|
49
62
|
}
|
|
50
63
|
function getDisplayName(tool) {
|
|
51
64
|
switch (tool) {
|