gm-plugkit 2.0.1161 → 2.0.1162
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/bootstrap.js +32 -0
- package/package.json +1 -1
package/bootstrap.js
CHANGED
|
@@ -811,6 +811,37 @@ function getBinaryPath() {
|
|
|
811
811
|
return getWasmPath();
|
|
812
812
|
}
|
|
813
813
|
|
|
814
|
+
function probeUnsupervisedWatcher(spoolDir) {
|
|
815
|
+
try {
|
|
816
|
+
const statusPath = path.join(spoolDir, '.status.json');
|
|
817
|
+
const supervisorPath = path.join(spoolDir, '.supervisor.json');
|
|
818
|
+
const markerPath = path.join(spoolDir, '.pre-supervised-watcher.json');
|
|
819
|
+
if (!fs.existsSync(statusPath)) {
|
|
820
|
+
try { fs.unlinkSync(markerPath); } catch (_) {}
|
|
821
|
+
return;
|
|
822
|
+
}
|
|
823
|
+
const status = JSON.parse(fs.readFileSync(statusPath, 'utf-8'));
|
|
824
|
+
const age = Date.now() - (status && status.ts || 0);
|
|
825
|
+
if (age > 30_000) {
|
|
826
|
+
try { fs.unlinkSync(markerPath); } catch (_) {}
|
|
827
|
+
return;
|
|
828
|
+
}
|
|
829
|
+
if (fs.existsSync(supervisorPath)) {
|
|
830
|
+
try { fs.unlinkSync(markerPath); } catch (_) {}
|
|
831
|
+
return;
|
|
832
|
+
}
|
|
833
|
+
const marker = {
|
|
834
|
+
ts: Date.now(),
|
|
835
|
+
reason: 'running-watcher-has-no-supervisor',
|
|
836
|
+
watcher_pid: status.pid,
|
|
837
|
+
watcher_version: status.version,
|
|
838
|
+
severity: 'warn',
|
|
839
|
+
instruction: 'A running watcher was started under an older bootstrap that did not spawn a supervisor. Unplanned-restart recovery and idle-teardown coordination are dormant. To migrate, stop the current watcher (taskkill /F /T /PID <watcher_pid> on Windows or kill <watcher_pid> on POSIX) and let the next bootstrap re-spawn it under supervisor.js.',
|
|
840
|
+
};
|
|
841
|
+
fs.writeFileSync(markerPath, JSON.stringify(marker, null, 2));
|
|
842
|
+
} catch (_) {}
|
|
843
|
+
}
|
|
844
|
+
|
|
814
845
|
function startSpoolDaemon() {
|
|
815
846
|
try {
|
|
816
847
|
const wrapper = path.join(gmToolsDir(), 'plugkit-wasm-wrapper.js');
|
|
@@ -821,6 +852,7 @@ function startSpoolDaemon() {
|
|
|
821
852
|
const projectDir = process.env.CLAUDE_PROJECT_DIR || process.cwd();
|
|
822
853
|
const spoolDir = path.join(projectDir, '.gm', 'exec-spool');
|
|
823
854
|
fs.mkdirSync(spoolDir, { recursive: true });
|
|
855
|
+
probeUnsupervisedWatcher(spoolDir);
|
|
824
856
|
const logPath = path.join(spoolDir, '.watcher.log');
|
|
825
857
|
try {
|
|
826
858
|
const stat = fs.statSync(logPath);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gm-plugkit",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1162",
|
|
4
4
|
"description": "Bootstrap and daemon-spawn tool for gm plugkit binary. Downloads the correct platform binary, verifies SHA256, and starts the spool watcher daemon. Includes plugkit-wasm-wrapper for WASM-based spool watching.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|