gm-plugkit 2.0.1263 → 2.0.1265

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 CHANGED
@@ -205,6 +205,7 @@ async function extractNpmPackageWasm(destPath, version) {
205
205
 
206
206
  const cmd = resolveWindowsExe('npm');
207
207
  const args = ['install', '--no-audit', '--no-fund', '--no-save', NPM_PACKAGE + '@' + version];
208
+ const isCmdShim = process.platform === 'win32' && /\.(cmd|bat)$/i.test(cmd);
208
209
 
209
210
  const result = spawnSync(cmd, args, {
210
211
  cwd: tempDir,
@@ -212,8 +213,7 @@ async function extractNpmPackageWasm(destPath, version) {
212
213
  timeout: ATTEMPT_TIMEOUT_MS,
213
214
  encoding: 'utf8',
214
215
  windowsHide: true,
215
- // CREATE_NO_WINDOW inherited by .cmd shims npm spawns during
216
- // package install, so no conhost flash during the extract step.
216
+ ...(isCmdShim ? { shell: true } : {}),
217
217
  ...(process.platform === 'win32' ? { creationFlags: 0x08000000 } : {}),
218
218
  });
219
219
 
@@ -305,6 +305,10 @@ async function extractNpmPackageWithRetry(destPath, version) {
305
305
  log(`npm binary unresolvable (ENOENT); skipping retries, falling back`);
306
306
  throw err;
307
307
  }
308
+ if (err && (err.code === 'EINVAL' || /EINVAL/.test(String(err.message || '')))) {
309
+ log(`spawn EINVAL on npm shim; skipping retries, falling back`);
310
+ throw err;
311
+ }
308
312
  if (attempt < MAX_ATTEMPTS) {
309
313
  const wait = BACKOFF_MS[attempt - 1] || 120000;
310
314
  log(`backing off ${wait}ms`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-plugkit",
3
- "version": "2.0.1263",
3
+ "version": "2.0.1265",
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": {
@@ -299,6 +299,8 @@ function readCurrentSess() {
299
299
  return __sessCache.value;
300
300
  }
301
301
 
302
+ const __lockRejectedEmitAt = new Map();
303
+
302
304
  function logEvent(sub, event, fields) {
303
305
  if (process.env.GM_LOG_DISABLE) return;
304
306
  try {
@@ -1462,7 +1464,14 @@ async function runSpoolWatcher(instance, spoolDir) {
1462
1464
  const msg = JSON.stringify({ ok: false, reason: 'another-watcher-active', pid: pidStr, age_ms: age });
1463
1465
  console.error(`[plugkit-wasm] ${msg}; refusing to start`);
1464
1466
  try { fs.writeFileSync(path.join(spoolDir, '.lock-rejection.json'), msg); } catch (_) {}
1465
- try { logEvent('plugkit', 'watcher.lock-rejected', { holder_pid: pidStr, lock_age_ms: age }); } catch (_) {}
1467
+ try {
1468
+ const __now = Date.now();
1469
+ const __last = __lockRejectedEmitAt.get(pidStr) || 0;
1470
+ if (__now - __last > 60000) {
1471
+ __lockRejectedEmitAt.set(pidStr, __now);
1472
+ logEvent('plugkit', 'watcher.lock-rejected', { severity: 'info', holder_pid: pidStr, lock_age_ms: age });
1473
+ }
1474
+ } catch (_) {}
1466
1475
  process.exit(75);
1467
1476
  }
1468
1477
  } else {