@ekkos/cli 1.0.19 → 1.0.20
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.
|
@@ -999,12 +999,20 @@ async function launchDashboard(initialSessionName, jsonlPath, refreshMs) {
|
|
|
999
999
|
*/
|
|
1000
1000
|
async function fetchAnthropicUsage() {
|
|
1001
1001
|
try {
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1002
|
+
let token = null;
|
|
1003
|
+
if (process.platform === 'darwin') {
|
|
1004
|
+
const { execSync } = require('child_process');
|
|
1005
|
+
const credsJson = execSync('security find-generic-password -s "Claude Code-credentials" -w', { encoding: 'utf-8', timeout: 5000 }).trim();
|
|
1006
|
+
token = JSON.parse(credsJson)?.claudeAiOauth?.accessToken ?? null;
|
|
1007
|
+
}
|
|
1008
|
+
else if (process.platform === 'win32') {
|
|
1009
|
+
// Windows: Claude Code stores credentials in ~/.claude/.credentials.json
|
|
1010
|
+
const credsPath = path.join(os.homedir(), '.claude', '.credentials.json');
|
|
1011
|
+
if (fs.existsSync(credsPath)) {
|
|
1012
|
+
const creds = JSON.parse(fs.readFileSync(credsPath, 'utf-8'));
|
|
1013
|
+
token = creds?.claudeAiOauth?.accessToken ?? null;
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1008
1016
|
if (!token)
|
|
1009
1017
|
return null;
|
|
1010
1018
|
const resp = await fetch('https://api.anthropic.com/api/oauth/usage', {
|
|
@@ -582,12 +582,19 @@ async function launchSwarmDashboard(launchTs, refreshMs) {
|
|
|
582
582
|
// ── Usage window (Anthropic OAuth) ──
|
|
583
583
|
async function fetchAnthropicUsage() {
|
|
584
584
|
try {
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
585
|
+
let token = null;
|
|
586
|
+
if (process.platform === 'darwin') {
|
|
587
|
+
const { execSync } = require('child_process');
|
|
588
|
+
const credsJson = execSync('security find-generic-password -s "Claude Code-credentials" -w', { encoding: 'utf-8', timeout: 5000 }).trim();
|
|
589
|
+
token = JSON.parse(credsJson)?.claudeAiOauth?.accessToken ?? null;
|
|
590
|
+
}
|
|
591
|
+
else if (process.platform === 'win32') {
|
|
592
|
+
const credsPath = path.join(os.homedir(), '.claude', '.credentials.json');
|
|
593
|
+
if (require('fs').existsSync(credsPath)) {
|
|
594
|
+
const creds = JSON.parse(require('fs').readFileSync(credsPath, 'utf-8'));
|
|
595
|
+
token = creds?.claudeAiOauth?.accessToken ?? null;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
591
598
|
if (!token)
|
|
592
599
|
return null;
|
|
593
600
|
const resp = await fetch('https://api.anthropic.com/api/oauth/usage', {
|