deepflow 0.1.0 → 0.1.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/VERSION +1 -1
- package/hooks/df-statusline.js +24 -26
- package/package.json +1 -1
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.1
|
package/hooks/df-statusline.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* deepflow statusline for Claude Code
|
|
4
|
-
* Displays: model | project | context usage
|
|
4
|
+
* Displays: update | model | project | context usage
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
const fs = require('fs');
|
|
@@ -43,38 +43,36 @@ function buildStatusLine(data) {
|
|
|
43
43
|
parts.push(`${colors.yellow}⬆ /df:update${colors.reset}`);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
// Model name
|
|
47
|
-
const model =
|
|
46
|
+
// Model name (Claude Code format: data.model.display_name)
|
|
47
|
+
const model = data.model?.display_name || data.model?.id || 'unknown';
|
|
48
48
|
parts.push(model);
|
|
49
49
|
|
|
50
|
-
// Project name (
|
|
51
|
-
const
|
|
50
|
+
// Project name (Claude Code format: data.workspace.current_dir)
|
|
51
|
+
const currentDir = data.workspace?.current_dir || data.cwd || process.cwd();
|
|
52
|
+
const project = path.basename(currentDir);
|
|
52
53
|
parts.push(`${colors.cyan}${project}${colors.reset}`);
|
|
53
54
|
|
|
54
|
-
// Context window meter
|
|
55
|
-
const contextMeter = buildContextMeter(data.
|
|
55
|
+
// Context window meter (Claude Code format: data.context_window)
|
|
56
|
+
const contextMeter = buildContextMeter(data.context_window || {});
|
|
56
57
|
parts.push(contextMeter);
|
|
57
58
|
|
|
58
59
|
return parts.join(` ${colors.dim}│${colors.reset} `);
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
function
|
|
62
|
-
//
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const limit = tokenUsage.limit || 200000;
|
|
62
|
+
function buildContextMeter(contextWindow) {
|
|
63
|
+
// Use pre-calculated percentage if available
|
|
64
|
+
let percentage = contextWindow.used_percentage || 0;
|
|
65
|
+
|
|
66
|
+
// Fallback: calculate from current_usage if available
|
|
67
|
+
if (!percentage && contextWindow.current_usage && contextWindow.context_window_size) {
|
|
68
|
+
const usage = contextWindow.current_usage;
|
|
69
|
+
const totalTokens = (usage.input_tokens || 0) +
|
|
70
|
+
(usage.cache_creation_input_tokens || 0) +
|
|
71
|
+
(usage.cache_read_input_tokens || 0);
|
|
72
|
+
percentage = (totalTokens / contextWindow.context_window_size) * 100;
|
|
73
|
+
}
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
const effectiveLimit = limit * 0.8;
|
|
77
|
-
const percentage = Math.min(100, Math.round((used / effectiveLimit) * 100));
|
|
75
|
+
percentage = Math.min(100, Math.round(percentage));
|
|
78
76
|
|
|
79
77
|
// Build 10-segment bar
|
|
80
78
|
const segments = 10;
|
|
@@ -83,11 +81,11 @@ function buildContextMeter(tokenUsage) {
|
|
|
83
81
|
|
|
84
82
|
// Color based on usage
|
|
85
83
|
let color;
|
|
86
|
-
if (percentage <
|
|
84
|
+
if (percentage < 50) {
|
|
87
85
|
color = colors.green;
|
|
88
|
-
} else if (percentage <
|
|
86
|
+
} else if (percentage < 70) {
|
|
89
87
|
color = colors.yellow;
|
|
90
|
-
} else if (percentage <
|
|
88
|
+
} else if (percentage < 90) {
|
|
91
89
|
color = colors.orange;
|
|
92
90
|
} else {
|
|
93
91
|
color = colors.blink + colors.red;
|