gm-skill 2.0.1432 → 2.0.1434
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/gm-plugkit/package.json +1 -1
- package/gm-plugkit/plugkit-wasm-wrapper.js +19 -0
- package/gm.json +1 -1
- package/lib/skill-bootstrap.js +42 -0
- package/package.json +1 -1
package/gm-plugkit/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gm-plugkit",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1434",
|
|
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": {
|
|
@@ -374,6 +374,24 @@ function readCurrentSess() {
|
|
|
374
374
|
|
|
375
375
|
const __lockRejectedEmitAt = new Map();
|
|
376
376
|
|
|
377
|
+
const UNAMBIGUOUS_CLIENT_EXT_RE = /\.(?:html?|jsx|tsx|vue|svelte|css|scss|sass)$/i;
|
|
378
|
+
const AMBIGUOUS_JS_EXT_RE = /\.(?:m?js|cjs|ts)$/i;
|
|
379
|
+
const BROWSER_REACHABLE_DIR_RE = /(?:^|\/)(?:site|public|web|www|client|frontend|ui|assets|static|dist|build|docs)\//i;
|
|
380
|
+
const NODE_ONLY_DIR_RE = /(?:^|\/)(?:lib|bin|scripts?|gm-plugkit|node_modules|tests?|__tests__|\.gm)\//i;
|
|
381
|
+
|
|
382
|
+
function isBrowserRelevantPath(rel, cwd) {
|
|
383
|
+
if (UNAMBIGUOUS_CLIENT_EXT_RE.test(rel)) return true;
|
|
384
|
+
if (!AMBIGUOUS_JS_EXT_RE.test(rel)) return false;
|
|
385
|
+
if (NODE_ONLY_DIR_RE.test(rel)) return false;
|
|
386
|
+
if (BROWSER_REACHABLE_DIR_RE.test(rel)) return true;
|
|
387
|
+
try {
|
|
388
|
+
const dir = path.dirname(path.isAbsolute(rel) ? rel : path.join(cwd, rel));
|
|
389
|
+
const sibs = fs.readdirSync(dir);
|
|
390
|
+
if (sibs.some(f => /\.html?$/i.test(f))) return true;
|
|
391
|
+
} catch (_) {}
|
|
392
|
+
return false;
|
|
393
|
+
}
|
|
394
|
+
|
|
377
395
|
function autoRecordBrowserEditsFromBody(body, cwd, taskBase, verb) {
|
|
378
396
|
if (!body || typeof body !== 'string') return;
|
|
379
397
|
const BROWSER_EXT_RE = /[\w.\-/\\]+\.(?:html?|tsx?|jsx?|mjs|cjs|vue|svelte|css|scss|sass)\b/gi;
|
|
@@ -388,6 +406,7 @@ function autoRecordBrowserEditsFromBody(body, cwd, taskBase, verb) {
|
|
|
388
406
|
let rel = String(raw).replace(/^["'`(]+|["'`)]+$/g, '').replace(/\\/g, '/');
|
|
389
407
|
if (rel.startsWith('http://') || rel.startsWith('https://') || rel.startsWith('//')) continue;
|
|
390
408
|
if (rel.includes('node_modules/') || rel.startsWith('.gm/') || rel.includes('/.gm/')) continue;
|
|
409
|
+
if (!isBrowserRelevantPath(rel, cwd)) continue;
|
|
391
410
|
if (seen.has(rel)) continue;
|
|
392
411
|
seen.add(rel);
|
|
393
412
|
const abs = path.isAbsolute(rel) ? rel : path.join(cwd, rel);
|
package/gm.json
CHANGED
package/lib/skill-bootstrap.js
CHANGED
|
@@ -533,6 +533,47 @@ function ensureSupervisorInstalled() {
|
|
|
533
533
|
}
|
|
534
534
|
}
|
|
535
535
|
|
|
536
|
+
function ensureWrapperInstalled() {
|
|
537
|
+
try {
|
|
538
|
+
let src = null;
|
|
539
|
+
try {
|
|
540
|
+
const gmPlugkit = require('gm-plugkit');
|
|
541
|
+
const base = path.dirname(gmPlugkit.getPath ? gmPlugkit.getPath() : require.resolve('gm-plugkit'));
|
|
542
|
+
const cand = path.join(base, 'plugkit-wasm-wrapper.js');
|
|
543
|
+
if (fs.existsSync(cand)) src = cand;
|
|
544
|
+
} catch (_) {}
|
|
545
|
+
if (!src) {
|
|
546
|
+
src = resolveFromCandidates([
|
|
547
|
+
path.join(__dirname, '..', 'gm-plugkit', 'plugkit-wasm-wrapper.js'),
|
|
548
|
+
path.join(__dirname, '..', '..', 'gm-plugkit', 'plugkit-wasm-wrapper.js'),
|
|
549
|
+
], 'gm-skill/gm-plugkit/plugkit-wasm-wrapper.js');
|
|
550
|
+
}
|
|
551
|
+
if (!src || !fs.existsSync(src)) {
|
|
552
|
+
emitBootstrapEvent('warn', 'bundled plugkit-wasm-wrapper.js not found; wrapper refresh skipped');
|
|
553
|
+
return null;
|
|
554
|
+
}
|
|
555
|
+
fs.mkdirSync(PLUGKIT_TOOLS_DIR, { recursive: true });
|
|
556
|
+
let needsWrite = true;
|
|
557
|
+
if (fs.existsSync(PLUGKIT_WASM_WRAPPER)) {
|
|
558
|
+
try {
|
|
559
|
+
const a = crypto.createHash('sha256').update(fs.readFileSync(src)).digest('hex');
|
|
560
|
+
const b = crypto.createHash('sha256').update(fs.readFileSync(PLUGKIT_WASM_WRAPPER)).digest('hex');
|
|
561
|
+
if (a === b) needsWrite = false;
|
|
562
|
+
} catch (_) {}
|
|
563
|
+
}
|
|
564
|
+
if (needsWrite) {
|
|
565
|
+
const tmp = PLUGKIT_WASM_WRAPPER + '.tmp';
|
|
566
|
+
fs.copyFileSync(src, tmp);
|
|
567
|
+
fs.renameSync(tmp, PLUGKIT_WASM_WRAPPER);
|
|
568
|
+
emitBootstrapEvent('info', 'plugkit-wasm-wrapper.js refreshed', { target: PLUGKIT_WASM_WRAPPER });
|
|
569
|
+
}
|
|
570
|
+
return PLUGKIT_WASM_WRAPPER;
|
|
571
|
+
} catch (e) {
|
|
572
|
+
emitBootstrapEvent('warn', 'ensureWrapperInstalled failed', { error: e.message });
|
|
573
|
+
return null;
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
|
|
536
577
|
function findSupervisorPid() {
|
|
537
578
|
try {
|
|
538
579
|
const supervisorPidFile = path.join(process.cwd(), '.gm', 'exec-spool', '.supervisor.pid');
|
|
@@ -561,6 +602,7 @@ async function spawnPlugkitWatcher(wasmPath) {
|
|
|
561
602
|
}
|
|
562
603
|
|
|
563
604
|
const supervisorPath = ensureSupervisorInstalled();
|
|
605
|
+
ensureWrapperInstalled();
|
|
564
606
|
const projectDir = process.cwd();
|
|
565
607
|
|
|
566
608
|
const existingSupervisor = findSupervisorPid();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gm-skill",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1434",
|
|
4
4
|
"description": "Canonical universal harness — AI-native software engineering via skill-driven orchestration; bootstraps plugkit for task execution and session isolation. Install in any AI coding agent host.",
|
|
5
5
|
"author": "AnEntrypoint",
|
|
6
6
|
"license": "MIT",
|