gm-skill 2.0.1190 → 2.0.1192

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/README.md CHANGED
@@ -35,7 +35,7 @@ An earlier generation fanned out fifteen per-platform downstream repos (gm-cc, g
35
35
 
36
36
  ## Version
37
37
 
38
- `2.0.1190` — auto-bumped from the canonical `gm` repo. Every push to `AnEntrypoint/gm` (or any cascading sibling crate) republishes this package.
38
+ `2.0.1192` — auto-bumped from the canonical `gm` repo. Every push to `AnEntrypoint/gm` (or any cascading sibling crate) republishes this package.
39
39
 
40
40
  ## Source of truth
41
41
 
@@ -1 +1 @@
1
- 0.1.432
1
+ 0.1.433
package/bin/plugkit.wasm CHANGED
Binary file
@@ -1 +1 @@
1
- 050833026344535a3fb991bd49de3a11d0fce8ef21b192f2b1c40e9660723e01 plugkit.wasm
1
+ c033cf56c5e9ef65c0bfbebbcb37e4ab2413432b8fa912213901fb15ccbb2a5f plugkit.wasm
@@ -476,12 +476,38 @@ function writeWasmJson(instance, value) {
476
476
  return writeWasmStr(instance, JSON.stringify(value));
477
477
  }
478
478
 
479
+ function safeName(s) { return String(s).replace(/[^A-Za-z0-9._-]/g, '_'); }
480
+
481
+ function projectKvDir(ns) {
482
+ const projectRoot = process.env.CLAUDE_PROJECT_DIR || process.cwd();
483
+ return path.join(projectRoot, '.gm', 'disciplines', safeName(ns));
484
+ }
485
+
486
+ function legacyKvDir(ns) {
487
+ return path.join(KV_DIR, safeName(ns));
488
+ }
489
+
479
490
  function kvFilePath(ns, key) {
480
- const safeNs = String(ns).replace(/[^A-Za-z0-9._-]/g, '_');
481
- const safeKey = String(key).replace(/[^A-Za-z0-9._-]/g, '_');
482
- const dir = path.join(KV_DIR, safeNs);
491
+ const dir = projectKvDir(ns);
483
492
  fs.mkdirSync(dir, { recursive: true });
484
- return path.join(dir, safeKey + '.json');
493
+ return path.join(dir, safeName(key) + '.json');
494
+ }
495
+
496
+ function kvReadResolve(ns, key) {
497
+ const fp = kvFilePath(ns, key);
498
+ if (fs.existsSync(fp)) return fp;
499
+ const legacy = path.join(legacyKvDir(ns), safeName(key) + '.json');
500
+ if (fs.existsSync(legacy)) return legacy;
501
+ return null;
502
+ }
503
+
504
+ function kvNamespaceDirs(ns) {
505
+ const out = [];
506
+ const proj = projectKvDir(ns);
507
+ if (fs.existsSync(proj)) out.push(proj);
508
+ const legacy = legacyKvDir(ns);
509
+ if (fs.existsSync(legacy)) out.push(legacy);
510
+ return out;
485
511
  }
486
512
 
487
513
  const __tasks = new Map();
@@ -751,8 +777,8 @@ function makeHostFunctions(instanceRef) {
751
777
  const ns = readWasmStr(instanceRef.value, nsPtr, nsLen);
752
778
  const key = readWasmStr(instanceRef.value, keyPtr, keyLen);
753
779
  if (!ns || !key) return 0n;
754
- const fp = kvFilePath(ns, key);
755
- if (!fs.existsSync(fp)) return 0n;
780
+ const fp = kvReadResolve(ns, key);
781
+ if (!fp) return 0n;
756
782
  const data = fs.readFileSync(fp, 'utf-8');
757
783
  return writeWasmStr(instanceRef.value, data);
758
784
  } catch (e) {
@@ -778,15 +804,21 @@ function makeHostFunctions(instanceRef) {
778
804
  const ns = readWasmStr(instanceRef.value, nsPtr, nsLen);
779
805
  const q = readWasmStr(instanceRef.value, qPtr, qLen);
780
806
  if (!ns) return 0n;
781
- const dir = path.join(KV_DIR, String(ns).replace(/[^A-Za-z0-9._-]/g, '_'));
782
- if (!fs.existsSync(dir)) return writeWasmJson(instanceRef.value, []);
807
+ const dirs = kvNamespaceDirs(ns);
808
+ if (dirs.length === 0) return writeWasmJson(instanceRef.value, []);
783
809
  const ql = q ? String(q).toLowerCase() : '';
810
+ const seen = new Set();
784
811
  const results = [];
785
- for (const f of fs.readdirSync(dir)) {
786
- if (!f.endsWith('.json')) continue;
787
- const value = fs.readFileSync(path.join(dir, f), 'utf-8');
788
- if (ql && !value.toLowerCase().includes(ql) && !f.toLowerCase().includes(ql)) continue;
789
- results.push({ key: f.replace(/\.json$/, ''), value });
812
+ for (const dir of dirs) {
813
+ for (const f of fs.readdirSync(dir)) {
814
+ if (!f.endsWith('.json')) continue;
815
+ const key = f.replace(/\.json$/, '');
816
+ if (seen.has(key)) continue;
817
+ seen.add(key);
818
+ const value = fs.readFileSync(path.join(dir, f), 'utf-8');
819
+ if (ql && !value.toLowerCase().includes(ql) && !f.toLowerCase().includes(ql)) continue;
820
+ results.push({ key, value });
821
+ }
790
822
  }
791
823
  return writeWasmJson(instanceRef.value, results);
792
824
  } catch (e) {
@@ -814,26 +846,34 @@ function makeHostFunctions(instanceRef) {
814
846
  if (process.env.PLUGKIT_DEBUG) console.error('[plugkit-wasm] host_vec_search: no embedding in query, raw=', raw.slice(0, 200));
815
847
  return writeWasmJson(instanceRef.value, []);
816
848
  }
817
- const vecDir = path.join(KV_DIR, `${namespace}-vec`.replace(/[^A-Za-z0-9._-]/g, '_'));
818
- const dataDir = path.join(KV_DIR, namespace.replace(/[^A-Za-z0-9._-]/g, '_'));
819
- if (!fs.existsSync(vecDir) || !fs.existsSync(dataDir)) {
849
+ const vecDirs = kvNamespaceDirs(`${namespace}-vec`);
850
+ const dataDirs = kvNamespaceDirs(namespace);
851
+ if (vecDirs.length === 0 || dataDirs.length === 0) {
820
852
  return writeWasmJson(instanceRef.value, []);
821
853
  }
822
854
  const scored = [];
823
- for (const f of fs.readdirSync(vecDir)) {
824
- if (!f.endsWith('.json')) continue;
825
- let emb;
826
- try { emb = JSON.parse(fs.readFileSync(path.join(vecDir, f), 'utf-8')); }
827
- catch (_) { continue; }
828
- const vector = Array.isArray(emb?.data?.[0]?.embedding) ? emb.data[0].embedding
829
- : Array.isArray(emb?.embedding) ? emb.embedding
830
- : Array.isArray(emb) ? emb : null;
831
- if (!vector) continue;
832
- const score = cosineSim(queryEmbedding, vector);
833
- const key = f.replace(/\.json$/, '');
834
- const valuePath = path.join(dataDir, `${key}.json`);
835
- const text = fs.existsSync(valuePath) ? fs.readFileSync(valuePath, 'utf-8') : '';
836
- scored.push({ key, text, score });
855
+ const seen = new Set();
856
+ for (const vecDir of vecDirs) {
857
+ for (const f of fs.readdirSync(vecDir)) {
858
+ if (!f.endsWith('.json')) continue;
859
+ const key = f.replace(/\.json$/, '');
860
+ if (seen.has(key)) continue;
861
+ seen.add(key);
862
+ let emb;
863
+ try { emb = JSON.parse(fs.readFileSync(path.join(vecDir, f), 'utf-8')); }
864
+ catch (_) { continue; }
865
+ const vector = Array.isArray(emb?.data?.[0]?.embedding) ? emb.data[0].embedding
866
+ : Array.isArray(emb?.embedding) ? emb.embedding
867
+ : Array.isArray(emb) ? emb : null;
868
+ if (!vector) continue;
869
+ const score = cosineSim(queryEmbedding, vector);
870
+ let text = '';
871
+ for (const dataDir of dataDirs) {
872
+ const valuePath = path.join(dataDir, `${key}.json`);
873
+ if (fs.existsSync(valuePath)) { text = fs.readFileSync(valuePath, 'utf-8'); break; }
874
+ }
875
+ scored.push({ key, text, score });
876
+ }
837
877
  }
838
878
  scored.sort((a, b) => b.score - a.score);
839
879
  return writeWasmJson(instanceRef.value, scored.slice(0, k_));
package/gm.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm",
3
- "version": "2.0.1190",
3
+ "version": "2.0.1192",
4
4
  "description": "Spool-dispatch orchestration engine with unified state machine, skills, and automated git enforcement",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",
@@ -17,5 +17,5 @@
17
17
  "publishConfig": {
18
18
  "access": "public"
19
19
  },
20
- "plugkitVersion": "0.1.432"
20
+ "plugkitVersion": "0.1.433"
21
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-skill",
3
- "version": "2.0.1190",
3
+ "version": "2.0.1192",
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",
@@ -39,7 +39,7 @@
39
39
  "gm.json"
40
40
  ],
41
41
  "dependencies": {
42
- "gm-plugkit": "^2.0.1190"
42
+ "gm-plugkit": "^2.0.1192"
43
43
  },
44
44
  "engines": {
45
45
  "node": ">=16.0.0"