@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.
- package/README.md +12 -0
- package/README.ru.md +12 -0
- package/README.zh.md +12 -0
- package/lib/client.js +47 -37
- package/lib/diagnose-service.js +4 -3
- package/lib/docker-service.js +5 -2
- package/lib/index.js +41 -14
- package/lib/mirror-sync-service.js +1 -1
- package/lib/remote-fs-service.js +7 -2
- package/lib/routes/docker.js +9 -9
- package/lib/routes/env.js +27 -14
- package/lib/routes/files.js +11 -11
- package/lib/routes/helpers.js +99 -11
- package/lib/routes/profiles.js +18 -18
- package/lib/routes/sync.js +5 -5
- package/lib/routes/terminal.js +10 -10
- package/lib/routes/tunnels.js +7 -7
- package/lib/routes.js +2 -2
- package/lib/ssh-service.js +21 -1
- package/lib/tar-sync-service.js +25 -4
- package/lib/tunnel-service.js +5 -0
- package/lib/watcher-service.js +19 -2
- package/package.json +1 -1
package/lib/watcher-service.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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.
|
|
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",
|