gm-plugkit 2.0.1528 → 2.0.1530

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-plugkit",
3
- "version": "2.0.1528",
3
+ "version": "2.0.1530",
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": {
@@ -453,56 +453,6 @@ function readCurrentSess() {
453
453
 
454
454
  const __lockRejectedEmitAt = new Map();
455
455
 
456
- const UNAMBIGUOUS_CLIENT_EXT_RE = /\.(?:html?|jsx|tsx|vue|svelte|css|scss|sass)$/i;
457
- const AMBIGUOUS_JS_EXT_RE = /\.(?:m?js|cjs|ts)$/i;
458
- const BROWSER_REACHABLE_DIR_RE = /(?:^|\/)(?:site|public|web|www|client|frontend|ui|assets|static|dist|build|docs)\//i;
459
- const NODE_ONLY_DIR_RE = /(?:^|\/)(?:lib|bin|scripts?|gm-plugkit|node_modules|tests?|__tests__|\.gm)\//i;
460
-
461
- function isBrowserRelevantPath(rel, cwd) {
462
- if (UNAMBIGUOUS_CLIENT_EXT_RE.test(rel)) return true;
463
- if (!AMBIGUOUS_JS_EXT_RE.test(rel)) return false;
464
- if (NODE_ONLY_DIR_RE.test(rel)) return false;
465
- if (BROWSER_REACHABLE_DIR_RE.test(rel)) return true;
466
- try {
467
- const dir = path.dirname(path.isAbsolute(rel) ? rel : path.join(cwd, rel));
468
- const sibs = fs.readdirSync(dir);
469
- if (sibs.some(f => /\.html?$/i.test(f))) return true;
470
- } catch (_) {}
471
- return false;
472
- }
473
-
474
- function autoRecordBrowserEditsFromBody(body, cwd, taskBase, verb) {
475
- if (!body || typeof body !== 'string') return;
476
- const BROWSER_EXT_RE = /[\w.\-/\\]+\.(?:html?|tsx?|jsx?|mjs|cjs|vue|svelte|css|scss|sass)\b/gi;
477
- const matches = body.match(BROWSER_EXT_RE);
478
- if (!matches || matches.length === 0) return;
479
- const seen = new Set();
480
- const editsFile = path.join(cwd, '.gm', 'exec-spool', '.turn-browser-edits.json');
481
- let list = [];
482
- try { list = JSON.parse(fs.readFileSync(editsFile, 'utf8')); if (!Array.isArray(list)) list = []; } catch (_) {}
483
- let added = 0;
484
- for (const raw of matches) {
485
- let rel = String(raw).replace(/^["'`(]+|["'`)]+$/g, '').replace(/\\/g, '/');
486
- if (rel.startsWith('http://') || rel.startsWith('https://') || rel.startsWith('//')) continue;
487
- if (rel.includes('node_modules/') || rel.startsWith('.gm/') || rel.includes('/.gm/')) continue;
488
- if (!isBrowserRelevantPath(rel, cwd)) continue;
489
- if (seen.has(rel)) continue;
490
- seen.add(rel);
491
- const abs = path.isAbsolute(rel) ? rel : path.join(cwd, rel);
492
- let st;
493
- try { st = fs.statSync(abs); } catch (_) { continue; }
494
- if (!st.isFile()) continue;
495
- let hash = '';
496
- try { hash = crypto.createHash('sha256').update(fs.readFileSync(abs)).digest('hex').slice(0, 12); } catch (_) {}
497
- const idx = list.findIndex(e => e && e.file === rel);
498
- const entry = { file: rel, ts: Date.now(), hash, source_verb: verb, source_task: taskBase };
499
- if (idx === -1) { list.push(entry); added++; } else { list[idx] = entry; }
500
- }
501
- if (added > 0) {
502
- try { fs.mkdirSync(path.dirname(editsFile), { recursive: true }); fs.writeFileSync(editsFile, JSON.stringify(list)); } catch (_) {}
503
- logEvent('plugkit', 'browser.edits-autorecorded', { verb, task: taskBase, files: list.slice(-added).map(e => e.file), added });
504
- }
505
- }
506
456
 
507
457
  function logEvent(sub, event, fields) {
508
458
  if (process.env.GM_LOG_DISABLE) return;
@@ -3088,10 +3038,6 @@ async function runSpoolWatcher(instance, spoolDir) {
3088
3038
  try { _writeStatusBusy(180000); } catch (_) {}
3089
3039
  }
3090
3040
 
3091
- if (verb === 'memorize-fire' || verb === 'transition' || verb === 'prd-resolve' || verb === 'mutable-resolve') {
3092
- try { autoRecordBrowserEditsFromBody(body, process.cwd(), taskBase, verb); } catch (_) {}
3093
- }
3094
-
3095
3041
  let autoRecallPayload = null;
3096
3042
  if (verb === 'instruction') {
3097
3043
  const sessForRecall = readCurrentSess();
package/plugkit.version CHANGED
@@ -1 +1 @@
1
- 0.1.634
1
+ 0.1.635