@goodandready/dsh-remote-workspace 0.3.9 → 0.3.11

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.
@@ -7,6 +7,7 @@ export class WatcherService {
7
7
  this.watchers = new Map();
8
8
  /** @type {Map<string, NodeJS.Timeout>} */
9
9
  this.debounceTimers = new Map();
10
+ this.inFlight = new Set();
10
11
  this.debounceMs = 350;
11
12
  this.onSyncCallback = null;
12
13
  }
@@ -52,19 +53,33 @@ export class WatcherService {
52
53
  clearTimeout(this.debounceTimers.get(profile.id));
53
54
  }
54
55
 
55
- const timer = setTimeout(async () => {
56
+ const runSync = async () => {
56
57
  this.debounceTimers.delete(profile.id);
58
+ if (this.inFlight.has(profile.id)) {
59
+ const nextTimer = setTimeout(runSync, this.debounceMs);
60
+ this.debounceTimers.set(profile.id, nextTimer);
61
+ return;
62
+ }
63
+ this.inFlight.add(profile.id);
57
64
  try {
58
65
  const syncRes = await mirrorSync.push(profile, profile.localMirrorPath, profile.remoteWorkspace);
59
66
  if (this.onSyncCallback) {
60
67
  this.onSyncCallback({ profileId: profile.id, syncRes });
61
68
  }
62
69
  } catch (err) { /* best-effort cleanup */ }
63
- }, this.debounceMs);
70
+ finally {
71
+ this.inFlight.delete(profile.id);
72
+ }
73
+ };
64
74
 
75
+ const timer = setTimeout(runSync, this.debounceMs);
65
76
  this.debounceTimers.set(profile.id, timer);
66
77
  });
67
78
 
79
+ watcher.on('error', () => {
80
+ this.stop(profile.id);
81
+ });
82
+
68
83
  this.watchers.set(profile.id, { watcher, profile, running: true });
69
84
  return { success: true };
70
85
  } catch (err) {
@@ -82,6 +97,7 @@ export class WatcherService {
82
97
  try {
83
98
  item.watcher.close();
84
99
  } catch (err) { /* best-effort cleanup */ }
100
+ this.inFlight.delete(profileId);
85
101
  this.watchers.delete(profileId);
86
102
  return true;
87
103
  }
@@ -107,5 +123,6 @@ export class WatcherService {
107
123
  }
108
124
  this.watchers.clear();
109
125
  this.debounceTimers.clear();
126
+ this.inFlight.clear();
110
127
  }
111
128
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-remote-workspace",
3
- "version": "0.3.9",
3
+ "version": "0.3.11",
4
4
  "description": "Enterprise Remote Workspace Plugin for DeepSeek Harness: SSH2 connection pool, SFTP operations, 3-way conflict-aware mirror sync, port forwarding, and native DSH UI.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",