gm-qwen 2.0.1003 → 2.0.1005
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/bin/bootstrap.js +75 -21
- package/bin/plugkit.sha256 +6 -6
- package/bin/plugkit.version +1 -1
- package/bin/rtk.sha256 +2 -2
- package/gm.json +2 -2
- package/package.json +1 -1
package/bin/bootstrap.js
CHANGED
|
@@ -117,29 +117,70 @@ function gmToolsDir() {
|
|
|
117
117
|
// through node. Self-update inside the Rust binary keeps gm-tools fresh from
|
|
118
118
|
// here on. Skipped silently on any error — the next session-start hook will
|
|
119
119
|
// retry via ensure_tools_current.
|
|
120
|
-
function
|
|
120
|
+
function killHoldersOfPath(targetPath) {
|
|
121
|
+
if (process.platform !== 'win32') return 0;
|
|
121
122
|
try {
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
} else { throw err; }
|
|
123
|
+
const { spawnSync } = require('child_process');
|
|
124
|
+
const norm = path.resolve(targetPath).replace(/\//g, '\\');
|
|
125
|
+
const r = spawnSync('wmic', ['process', 'where', `ExecutablePath='${norm.replace(/\\/g, '\\\\')}'`, 'get', 'ProcessId', '/format:value'], { encoding: 'utf8', windowsHide: true, timeout: 5000 });
|
|
126
|
+
if (r.status !== 0 || !r.stdout) return 0;
|
|
127
|
+
const pids = [];
|
|
128
|
+
for (const line of r.stdout.split(/\r?\n/)) {
|
|
129
|
+
const m = line.match(/ProcessId=(\d+)/);
|
|
130
|
+
if (m) {
|
|
131
|
+
const pid = parseInt(m[1], 10);
|
|
132
|
+
if (Number.isFinite(pid) && pid !== process.pid) pids.push(pid);
|
|
133
|
+
}
|
|
134
134
|
}
|
|
135
|
-
|
|
136
|
-
try {
|
|
135
|
+
for (const pid of pids) {
|
|
136
|
+
try { spawnSync('taskkill', ['/F', '/PID', String(pid)], { windowsHide: true, timeout: 3000 }); } catch (_) {}
|
|
137
|
+
}
|
|
138
|
+
return pids.length;
|
|
139
|
+
} catch (_) { return 0; }
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function cleanOrphanNewFiles(dst, exeName) {
|
|
143
|
+
try {
|
|
144
|
+
for (const name of fs.readdirSync(dst)) {
|
|
145
|
+
if (name === exeName + '.new') continue;
|
|
146
|
+
if (/^plugkit(\.\d+\.\d+\.\d+)?\.new$/i.test(name)) {
|
|
147
|
+
try { fs.unlinkSync(path.join(dst, name)); } catch (_) {}
|
|
148
|
+
}
|
|
137
149
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
150
|
+
} catch (_) {}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function renameWithRetry(src, dst, attempts) {
|
|
154
|
+
for (let i = 0; i < attempts; i++) {
|
|
155
|
+
try { fs.renameSync(src, dst); return true; }
|
|
156
|
+
catch (err) {
|
|
157
|
+
if (err.code !== 'EEXIST' && err.code !== 'EPERM' && err.code !== 'EBUSY' && err.code !== 'EACCES') throw err;
|
|
158
|
+
if (i === Math.floor(attempts / 2)) killHoldersOfPath(dst);
|
|
159
|
+
try { const { spawnSync } = require('child_process'); spawnSync(process.execPath, ['-e', 'setTimeout(()=>{}, 200)'], { timeout: 400, killSignal: 'SIGKILL', stdio: 'ignore', windowsHide: true }); } catch (_) {}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function copyToGmTools(finalPath, wrapperDir, version) {
|
|
166
|
+
const dst = gmToolsDir();
|
|
167
|
+
fs.mkdirSync(dst, { recursive: true });
|
|
168
|
+
const exeName = process.platform === 'win32' ? 'plugkit.exe' : 'plugkit';
|
|
169
|
+
const target = path.join(dst, exeName);
|
|
170
|
+
const targetTmp = target + '.new';
|
|
171
|
+
cleanOrphanNewFiles(dst, exeName);
|
|
172
|
+
fs.copyFileSync(finalPath, targetTmp);
|
|
173
|
+
if (!renameWithRetry(targetTmp, target, 8)) {
|
|
174
|
+
obsEvent('bootstrap', 'gmtools.rename.failed', { target });
|
|
175
|
+
throw new Error(`gm-tools update blocked: cannot replace ${target} (held open by running plugkit and kill-retry exhausted)`);
|
|
176
|
+
}
|
|
177
|
+
if (process.platform !== 'win32') {
|
|
178
|
+
try { fs.chmodSync(target, 0o755); } catch (_) {}
|
|
179
|
+
}
|
|
180
|
+
fs.writeFileSync(path.join(dst, 'plugkit.version'), version);
|
|
181
|
+
try {
|
|
182
|
+
const srcSha = path.join(wrapperDir, 'plugkit.sha256');
|
|
183
|
+
if (fs.existsSync(srcSha)) fs.copyFileSync(srcSha, path.join(dst, 'plugkit.sha256'));
|
|
143
184
|
} catch (_) {}
|
|
144
185
|
}
|
|
145
186
|
|
|
@@ -804,6 +845,19 @@ if (require.main === module) {
|
|
|
804
845
|
} else {
|
|
805
846
|
bootstrap({ silent: false })
|
|
806
847
|
.then(p => { process.stdout.write(p + '\n'); process.exit(0); })
|
|
807
|
-
.catch(err => {
|
|
848
|
+
.catch(err => {
|
|
849
|
+
log(`FATAL: ${err.message}`);
|
|
850
|
+
obsEvent('bootstrap', 'fatal', { err: String(err.message || err) });
|
|
851
|
+
try {
|
|
852
|
+
const pinned = (() => { try { return readVersionFile(__dirname); } catch (_) { return null; } })();
|
|
853
|
+
writeBootstrapError({
|
|
854
|
+
expected_version: pinned,
|
|
855
|
+
cached_version: null,
|
|
856
|
+
error_phase: 'fatal',
|
|
857
|
+
error_message: String(err && err.message || err),
|
|
858
|
+
});
|
|
859
|
+
} catch (_) {}
|
|
860
|
+
process.exit(1);
|
|
861
|
+
});
|
|
808
862
|
}
|
|
809
863
|
}
|
package/bin/plugkit.sha256
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
16e6db40c8c253d7e6e6130070f0c1bcc4ae9566b2a12f18214f2284d0a50ba1 plugkit-win32-x64.exe
|
|
2
|
+
cc876baabd7de371c494f8ba2b4d29f20974e31f65dcf1f8303c20e3753187ab plugkit-win32-arm64.exe
|
|
3
|
+
a8dbdb919381a80c1087cb4f3c7ed4fc61fc82a2b501cb55dc8a51caf97d5eab plugkit-darwin-x64
|
|
4
|
+
5df1ad1f15bbe90c40c8f8897e595812f30253f655a01865cfc1b4a86cd223a8 plugkit-darwin-arm64
|
|
5
|
+
5c695dc8a51617ad0dfb66c14a6f393de63e53725d637c056a1af891a0a42505 plugkit-linux-x64
|
|
6
|
+
089c39c517a095a050df5c27ab053ccf4045064557d9e484e2948f46e05e37ea plugkit-linux-arm64
|
package/bin/plugkit.version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.350
|
package/bin/rtk.sha256
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
945cb97379ce6df270f31cb4a9ff8e27af8671b187929edcd6892770a13e8467 rtk-win32-x64.exe
|
|
2
|
+
7e848a986e8638ee005fe6f3b767eeca922d2fe09f5e28f024a729214e2266d6 rtk-win32-arm64.exe
|
|
3
3
|
1b1e792767ed0e1e6ca0e2f0a8de02e77b06dea2f5ae667278b94baf239fcdc3 rtk-darwin-x64
|
|
4
4
|
9717978d9d6216ea50c94444e00e359479b6315a17bd48c16064b267c8b0b60d rtk-darwin-arm64
|
|
5
5
|
a100d3defac54194144e5723aec57e6f286b42298c67145c8428815246c9ee56 rtk-linux-x64
|
package/gm.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gm",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1005",
|
|
4
4
|
"description": "State machine agent with hooks, skills, and automated git enforcement",
|
|
5
5
|
"author": "AnEntrypoint",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,5 +23,5 @@
|
|
|
23
23
|
"publishConfig": {
|
|
24
24
|
"access": "public"
|
|
25
25
|
},
|
|
26
|
-
"plugkitVersion": "0.1.
|
|
26
|
+
"plugkitVersion": "0.1.350"
|
|
27
27
|
}
|