deepflow 0.1.15 → 0.1.16

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.
@@ -97,17 +97,53 @@ function buildContextMeter(contextWindow) {
97
97
  return `${color}${bar}${colors.reset} ${percentage}%`;
98
98
  }
99
99
 
100
+ const TRIGGER_THROTTLE = 60 * 1000; // 60 seconds between triggers
101
+
100
102
  function checkForUpdate() {
103
+ const cacheDir = path.join(os.homedir(), '.claude', 'cache');
104
+ const cachePath = path.join(cacheDir, 'df-update-check.json');
105
+ const triggerPath = path.join(cacheDir, 'df-trigger-time');
106
+
107
+ // Trigger background check if not triggered recently (throttle rapid refreshes)
101
108
  try {
102
- const cacheDir = path.join(os.homedir(), '.claude', 'cache');
103
- const cachePath = path.join(cacheDir, 'df-update-check.json');
109
+ let shouldTrigger = true;
110
+ if (fs.existsSync(triggerPath)) {
111
+ const lastTrigger = parseInt(fs.readFileSync(triggerPath, 'utf8'), 10);
112
+ shouldTrigger = Date.now() - lastTrigger > TRIGGER_THROTTLE;
113
+ }
114
+ if (shouldTrigger) {
115
+ fs.mkdirSync(cacheDir, { recursive: true });
116
+ fs.writeFileSync(triggerPath, String(Date.now()));
117
+ triggerUpdateCheck();
118
+ }
119
+ } catch (e) {
120
+ // Fail silently
121
+ }
104
122
 
105
- if (!fs.existsSync(cachePath)) return null;
123
+ // Return cached result
124
+ try {
125
+ if (fs.existsSync(cachePath)) {
126
+ return JSON.parse(fs.readFileSync(cachePath, 'utf8'));
127
+ }
128
+ } catch (e) {
129
+ // Fail silently
130
+ }
131
+ return null;
132
+ }
106
133
 
107
- const cache = JSON.parse(fs.readFileSync(cachePath, 'utf8'));
108
- return cache;
134
+ function triggerUpdateCheck() {
135
+ try {
136
+ const checkerPath = path.join(os.homedir(), '.claude', 'hooks', 'df-check-update.js');
137
+ if (fs.existsSync(checkerPath)) {
138
+ const { spawn } = require('child_process');
139
+ const child = spawn(process.execPath, [checkerPath], {
140
+ detached: true,
141
+ stdio: 'ignore'
142
+ });
143
+ child.unref();
144
+ }
109
145
  } catch (e) {
110
- return null;
146
+ // Fail silently
111
147
  }
112
148
  }
113
149
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepflow",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "Stay in flow state - lightweight spec-driven task orchestration for Claude Code",
5
5
  "keywords": [
6
6
  "claude",