gm-plugkit 2.0.1167 → 2.0.1168
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/package.json +1 -1
- package/plugkit-wasm-wrapper.js +18 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gm-plugkit",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1168",
|
|
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": {
|
package/plugkit-wasm-wrapper.js
CHANGED
|
@@ -56,10 +56,11 @@ function turnTick(sess, verb, taskBase, phase) {
|
|
|
56
56
|
if (phase) { t.phases.add(phase); t.lastPhase = phase; }
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
let __sessCache = { value: '', mtimeMs: 0, readAt: 0 };
|
|
59
|
+
let __sessCache = { value: '', mtimeMs: 0, readAt: 0, srcMtimeMs: 0 };
|
|
60
60
|
function readCurrentSess() {
|
|
61
61
|
const now = Date.now();
|
|
62
62
|
if (now - __sessCache.readAt < 1000) return __sessCache.value;
|
|
63
|
+
let found = '';
|
|
63
64
|
try {
|
|
64
65
|
const p = path.join(process.cwd(), '.gm', 'exec-spool', '.session-current');
|
|
65
66
|
const st = fs.statSync(p);
|
|
@@ -67,9 +68,24 @@ function readCurrentSess() {
|
|
|
67
68
|
__sessCache.value = fs.readFileSync(p, 'utf8').trim();
|
|
68
69
|
__sessCache.mtimeMs = st.mtimeMs;
|
|
69
70
|
}
|
|
71
|
+
found = __sessCache.value;
|
|
70
72
|
} catch (_) {}
|
|
73
|
+
if (!found) {
|
|
74
|
+
try {
|
|
75
|
+
const sp = path.join(process.cwd(), '.gm', 'turn-state.json');
|
|
76
|
+
const st = fs.statSync(sp);
|
|
77
|
+
if (st.mtimeMs !== __sessCache.srcMtimeMs) {
|
|
78
|
+
const obj = JSON.parse(fs.readFileSync(sp, 'utf8'));
|
|
79
|
+
if (obj && typeof obj.session_id === 'string') found = obj.session_id;
|
|
80
|
+
__sessCache.srcMtimeMs = st.mtimeMs;
|
|
81
|
+
} else if (__sessCache.value) {
|
|
82
|
+
found = __sessCache.value;
|
|
83
|
+
}
|
|
84
|
+
} catch (_) {}
|
|
85
|
+
}
|
|
71
86
|
__sessCache.readAt = now;
|
|
72
|
-
|
|
87
|
+
__sessCache.value = found || process.env.CLAUDE_SESSION_ID || process.env.GM_SESSION_ID || '';
|
|
88
|
+
return __sessCache.value;
|
|
73
89
|
}
|
|
74
90
|
|
|
75
91
|
function logEvent(sub, event, fields) {
|