@vibe-cafe/vibe-usage 0.7.1 → 0.7.2
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 +1 -1
- package/package.json +1 -1
- package/src/parsers/openclaw.js +22 -8
- package/src/tools.js +24 -2
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ npx @vibe-cafe/vibe-usage status # Show config & detected tools
|
|
|
41
41
|
| GitHub Copilot CLI | `~/.copilot/session-state/*/events.jsonl` |
|
|
42
42
|
| Gemini CLI | `~/.gemini/tmp/` |
|
|
43
43
|
| OpenCode | `~/.local/share/opencode/opencode.db` (SQLite, `json_extract` query) |
|
|
44
|
-
| OpenClaw | `~/.openclaw/agents/` |
|
|
44
|
+
| OpenClaw | `~/.openclaw/agents/`, `~/.openclaw-<profile>/agents/` (profile deployments) |
|
|
45
45
|
| pi | `~/.pi/agent/sessions/` |
|
|
46
46
|
| Qwen Code | `~/.qwen/tmp/` |
|
|
47
47
|
| Kimi Code | `~/.kimi/sessions/` |
|
package/package.json
CHANGED
package/src/parsers/openclaw.js
CHANGED
|
@@ -1,16 +1,30 @@
|
|
|
1
|
-
import { readdirSync, readFileSync,
|
|
1
|
+
import { readdirSync, readFileSync, existsSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { homedir } from 'node:os';
|
|
4
4
|
import { aggregateToBuckets, extractSessions } from './index.js';
|
|
5
5
|
|
|
6
6
|
// OpenClaw stores data at ~/.openclaw/agents/<agentId>/sessions/*.jsonl
|
|
7
|
+
// Profile deployments use ~/.openclaw-<profile>/agents/...
|
|
7
8
|
// Legacy paths: ~/.clawdbot, ~/.moltbot, ~/.moldbot
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
function getPossibleRoots() {
|
|
10
|
+
const home = homedir();
|
|
11
|
+
const roots = [
|
|
12
|
+
join(home, '.clawdbot'),
|
|
13
|
+
join(home, '.moltbot'),
|
|
14
|
+
join(home, '.moldbot'),
|
|
15
|
+
];
|
|
16
|
+
try {
|
|
17
|
+
for (const entry of readdirSync(home, { withFileTypes: true })) {
|
|
18
|
+
if (!entry.isDirectory()) continue;
|
|
19
|
+
if (entry.name === '.openclaw' || /^\.openclaw-.+/.test(entry.name)) {
|
|
20
|
+
roots.push(join(home, entry.name));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
} catch {
|
|
24
|
+
// ignore read errors
|
|
25
|
+
}
|
|
26
|
+
return roots;
|
|
27
|
+
}
|
|
14
28
|
|
|
15
29
|
/** Normalize usage fields — OpenClaw supports multiple naming conventions */
|
|
16
30
|
function getTokens(usage, ...keys) {
|
|
@@ -24,7 +38,7 @@ export async function parse() {
|
|
|
24
38
|
const entries = [];
|
|
25
39
|
const sessionEvents = [];
|
|
26
40
|
|
|
27
|
-
for (const root of
|
|
41
|
+
for (const root of getPossibleRoots()) {
|
|
28
42
|
const agentsDir = join(root, 'agents');
|
|
29
43
|
if (!existsSync(agentsDir)) continue;
|
|
30
44
|
|
package/src/tools.js
CHANGED
|
@@ -1,7 +1,25 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs';
|
|
1
|
+
import { existsSync, readdirSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { homedir } from 'node:os';
|
|
4
4
|
|
|
5
|
+
/** Find all OpenClaw data roots: ~/.openclaw and ~/.openclaw-<profile> */
|
|
6
|
+
function findOpenclawDataDirs() {
|
|
7
|
+
const home = homedir();
|
|
8
|
+
const dirs = [];
|
|
9
|
+
try {
|
|
10
|
+
for (const entry of readdirSync(home, { withFileTypes: true })) {
|
|
11
|
+
if (!entry.isDirectory()) continue;
|
|
12
|
+
if (entry.name === '.openclaw' || /^\.openclaw-.+/.test(entry.name)) {
|
|
13
|
+
const agentsDir = join(home, entry.name, 'agents');
|
|
14
|
+
if (existsSync(agentsDir)) dirs.push(agentsDir);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
} catch {
|
|
18
|
+
// ignore read errors
|
|
19
|
+
}
|
|
20
|
+
return dirs;
|
|
21
|
+
}
|
|
22
|
+
|
|
5
23
|
export const TOOLS = [
|
|
6
24
|
{
|
|
7
25
|
name: 'Antigravity',
|
|
@@ -37,6 +55,7 @@ export const TOOLS = [
|
|
|
37
55
|
name: 'OpenClaw',
|
|
38
56
|
id: 'openclaw',
|
|
39
57
|
dataDir: join(homedir(), '.openclaw', 'agents'),
|
|
58
|
+
detectDataDirs: findOpenclawDataDirs,
|
|
40
59
|
},
|
|
41
60
|
{
|
|
42
61
|
name: 'pi',
|
|
@@ -66,5 +85,8 @@ export const TOOLS = [
|
|
|
66
85
|
];
|
|
67
86
|
|
|
68
87
|
export function detectInstalledTools() {
|
|
69
|
-
return TOOLS.filter(t =>
|
|
88
|
+
return TOOLS.filter(t => {
|
|
89
|
+
if (t.detectDataDirs) return t.detectDataDirs().length > 0;
|
|
90
|
+
return existsSync(t.dataDir);
|
|
91
|
+
});
|
|
70
92
|
}
|