agent-limit 0.4.0 → 0.4.1
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 +2 -4
- package/package.json +1 -2
- package/src/App.tsx +0 -1
- package/src/components/ProviderCard.tsx +0 -1
- package/src/providers/index.ts +2 -5
- package/src/providers/types.ts +1 -1
- package/src/utils/colors.ts +0 -1
- package/src/utils/keychain.ts +0 -22
- package/src/providers/gemini.ts +0 -63
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# agent-limit
|
|
2
2
|
|
|
3
|
-
Terminal dashboard to monitor Claude Code
|
|
3
|
+
Terminal dashboard to monitor Claude Code and Codex usage limits.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -46,7 +46,7 @@ agent-limit usage
|
|
|
46
46
|
|
|
47
47
|
## Features
|
|
48
48
|
|
|
49
|
-
- Real-time usage tracking for Claude Code
|
|
49
|
+
- Real-time usage tracking for Claude Code and Codex
|
|
50
50
|
- Trajectory markers showing if you're ahead or behind your usage pace
|
|
51
51
|
- Auto-refresh every 60 seconds
|
|
52
52
|
- Color-coded usage indicators
|
|
@@ -57,7 +57,6 @@ agent-limit usage
|
|
|
57
57
|
|----------|--------|-------------|
|
|
58
58
|
| Claude Code | Full support | macOS Keychain + Anthropic API |
|
|
59
59
|
| Codex | Full support | `~/.codex/auth.json` + OpenAI API |
|
|
60
|
-
| Gemini CLI | Static limits | `~/.gemini/settings.json` |
|
|
61
60
|
|
|
62
61
|
## Development
|
|
63
62
|
|
|
@@ -102,7 +101,6 @@ agent-limit reads credentials from standard locations:
|
|
|
102
101
|
|
|
103
102
|
- **Claude Code**: macOS Keychain (`Claude Code-credentials`)
|
|
104
103
|
- **Codex**: `~/.codex/auth.json`
|
|
105
|
-
- **Gemini**: `~/.gemini/settings.json`
|
|
106
104
|
|
|
107
105
|
It then fetches usage data from each provider's API and displays it in a unified dashboard.
|
|
108
106
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-limit",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Terminal dashboard to monitor Claude Code, Codex, and other agent usage limits",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.tsx",
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
"dashboard",
|
|
25
25
|
"claude",
|
|
26
26
|
"codex",
|
|
27
|
-
"gemini",
|
|
28
27
|
"ai",
|
|
29
28
|
"agent",
|
|
30
29
|
"usage",
|
package/src/App.tsx
CHANGED
|
@@ -13,7 +13,6 @@ export function App({ onExit }: AppProps) {
|
|
|
13
13
|
const [providers, setProviders] = useState<ProviderStatus[]>([
|
|
14
14
|
{ provider: "claude", status: "loading", metrics: [] },
|
|
15
15
|
{ provider: "codex", status: "loading", metrics: [] },
|
|
16
|
-
{ provider: "gemini", status: "loading", metrics: [] },
|
|
17
16
|
]);
|
|
18
17
|
const [lastRefresh, setLastRefresh] = useState<Date | null>(null);
|
|
19
18
|
const [isLoading, setIsLoading] = useState(true);
|
package/src/providers/index.ts
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
export * from "./types";
|
|
2
2
|
export { fetchClaudeUsage } from "./claude";
|
|
3
3
|
export { fetchCodexUsage } from "./codex";
|
|
4
|
-
export { fetchGeminiUsage } from "./gemini";
|
|
5
4
|
|
|
6
5
|
import { fetchClaudeUsage } from "./claude";
|
|
7
6
|
import { fetchCodexUsage } from "./codex";
|
|
8
|
-
import { fetchGeminiUsage } from "./gemini";
|
|
9
7
|
import type { ProviderStatus } from "./types";
|
|
10
8
|
|
|
11
9
|
export async function fetchAllProviders(): Promise<ProviderStatus[]> {
|
|
12
|
-
const [claude, codex
|
|
10
|
+
const [claude, codex] = await Promise.all([
|
|
13
11
|
fetchClaudeUsage(),
|
|
14
12
|
fetchCodexUsage(),
|
|
15
|
-
fetchGeminiUsage(),
|
|
16
13
|
]);
|
|
17
14
|
|
|
18
|
-
return [claude, codex
|
|
15
|
+
return [claude, codex];
|
|
19
16
|
}
|
package/src/providers/types.ts
CHANGED
package/src/utils/colors.ts
CHANGED
package/src/utils/keychain.ts
CHANGED
|
@@ -82,25 +82,3 @@ export async function getCodexCredentials(): Promise<CodexCredentials | null> {
|
|
|
82
82
|
return null;
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
|
|
86
|
-
export interface GeminiSettings {
|
|
87
|
-
authType?: "google" | "api_key" | "vertex";
|
|
88
|
-
apiKey?: string;
|
|
89
|
-
project?: string;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export async function getGeminiSettings(): Promise<GeminiSettings | null> {
|
|
93
|
-
try {
|
|
94
|
-
const homedir = process.env.HOME || "~";
|
|
95
|
-
const file = Bun.file(`${homedir}/.gemini/settings.json`);
|
|
96
|
-
|
|
97
|
-
if (!(await file.exists())) {
|
|
98
|
-
return null;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const content = await file.json();
|
|
102
|
-
return content;
|
|
103
|
-
} catch {
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
}
|
package/src/providers/gemini.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { getGeminiSettings } from "../utils/keychain";
|
|
2
|
-
import type { ProviderStatus, UsageMetric } from "./types";
|
|
3
|
-
|
|
4
|
-
interface GeminiLimits {
|
|
5
|
-
requestsPerDay: number;
|
|
6
|
-
requestsPerMinute: number;
|
|
7
|
-
plan: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function getLimitsForAuthType(authType?: string): GeminiLimits {
|
|
11
|
-
switch (authType) {
|
|
12
|
-
case "google":
|
|
13
|
-
return { requestsPerDay: 1000, requestsPerMinute: 60, plan: "Google (Free)" };
|
|
14
|
-
case "api_key":
|
|
15
|
-
return { requestsPerDay: 250, requestsPerMinute: 10, plan: "API Key (Free)" };
|
|
16
|
-
case "vertex":
|
|
17
|
-
return { requestsPerDay: -1, requestsPerMinute: -1, plan: "Vertex AI" };
|
|
18
|
-
default:
|
|
19
|
-
return { requestsPerDay: 1000, requestsPerMinute: 60, plan: "Unknown" };
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export async function fetchGeminiUsage(): Promise<ProviderStatus> {
|
|
24
|
-
const settings = await getGeminiSettings();
|
|
25
|
-
|
|
26
|
-
if (!settings) {
|
|
27
|
-
return {
|
|
28
|
-
provider: "gemini",
|
|
29
|
-
status: "unavailable",
|
|
30
|
-
metrics: [],
|
|
31
|
-
message: "Not configured. Run 'gemini' to set up.",
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const limits = getLimitsForAuthType(settings.authType);
|
|
36
|
-
const metrics: UsageMetric[] = [];
|
|
37
|
-
|
|
38
|
-
if (limits.requestsPerDay > 0) {
|
|
39
|
-
metrics.push({
|
|
40
|
-
name: "Daily Limit",
|
|
41
|
-
percentage: -1,
|
|
42
|
-
resetsAt: null,
|
|
43
|
-
resetsIn: `${limits.requestsPerDay} req/day`,
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (limits.requestsPerMinute > 0) {
|
|
48
|
-
metrics.push({
|
|
49
|
-
name: "Per-Minute",
|
|
50
|
-
percentage: -1,
|
|
51
|
-
resetsAt: null,
|
|
52
|
-
resetsIn: `${limits.requestsPerMinute} req/min`,
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return {
|
|
57
|
-
provider: "gemini",
|
|
58
|
-
status: "limited",
|
|
59
|
-
plan: limits.plan,
|
|
60
|
-
metrics,
|
|
61
|
-
message: "Live usage not available. Run /stats in Gemini CLI.",
|
|
62
|
-
};
|
|
63
|
-
}
|