gm-skill 2.0.1235 → 2.0.1237

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.1235` — auto-bumped from the canonical `gm` repo. Every push to `AnEntrypoint/gm` (or any cascading sibling crate) republishes this package.
38
+ `2.0.1237` — 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.452
1
+ 0.1.453
package/bin/plugkit.wasm CHANGED
Binary file
@@ -1 +1 @@
1
- a08cdb6a4e75093eed0e73b38fcc6097bfe1ce862420210a00ab7dfb78fd1337 plugkit.wasm
1
+ 3fc7db4a001a0830b446b812e543cea1c86e160c35ad744ddf47de2574023142 plugkit.wasm
@@ -482,6 +482,26 @@ function readCurrentSess() {
482
482
  // embed call.
483
483
  const _hostVecEmbedFailKeys = new Set();
484
484
 
485
+ let _rsLearnEmbedPath = undefined;
486
+ function resolveRsLearnEmbedPath() {
487
+ if (_rsLearnEmbedPath !== undefined) return _rsLearnEmbedPath;
488
+ const isWin = process.platform === 'win32';
489
+ const exe = isWin ? 'rs-learn-embed.exe' : 'rs-learn-embed';
490
+ const candidates = [];
491
+ if (process.env.RS_LEARN_EMBED_PATH) candidates.push(process.env.RS_LEARN_EMBED_PATH);
492
+ const home = os.homedir();
493
+ if (home) candidates.push(path.join(home, '.cargo', 'bin', exe));
494
+ if (process.env.RS_LEARN_DEV_ROOT) candidates.push(path.join(process.env.RS_LEARN_DEV_ROOT, 'target', 'release', exe));
495
+ const devRoot = path.resolve(__dirname, '..', '..', '..', 'rs-learn');
496
+ candidates.push(path.join(devRoot, 'target', 'release', exe));
497
+ if (isWin) candidates.push(path.join('C:\\dev\\rs-learn\\target\\release', exe));
498
+ for (const c of candidates) {
499
+ try { if (c && fs.existsSync(c)) { _rsLearnEmbedPath = c; return c; } } catch (_) {}
500
+ }
501
+ _rsLearnEmbedPath = null;
502
+ return null;
503
+ }
504
+
485
505
  function logEvent(sub, event, fields) {
486
506
  if (process.env.GM_LOG_DISABLE) return;
487
507
  try {
@@ -1474,31 +1494,31 @@ function makeHostFunctions(instanceRef) {
1474
1494
  try {
1475
1495
  const text = readWasmStr(instanceRef.value, textPtr, textLen);
1476
1496
  if (!text) return 0n;
1477
- const body = JSON.stringify({ model: EMBED_MODEL_DEFAULT, input: text });
1478
- const result = spawnSync(process.execPath, ['-e', `
1479
- (async () => {
1497
+ const binPath = resolveRsLearnEmbedPath();
1498
+ if (!binPath) {
1499
+ const key = 'no-binary';
1500
+ if (!_hostVecEmbedFailKeys.has(key)) {
1501
+ _hostVecEmbedFailKeys.add(key);
1480
1502
  try {
1481
- const r = await fetch('${ACPTOAPI_URL}/v1/embeddings', { method: 'POST', headers: { 'content-type': 'application/json' }, body: ${JSON.stringify(body)} });
1482
- if (!r.ok) {
1483
- const errBody = await r.text();
1484
- throw new Error('HTTP ' + r.status + ': ' + errBody.slice(0, 300));
1485
- }
1486
- const t = await r.text();
1487
- process.stdout.write(t);
1488
- } catch (e) {
1489
- process.stderr.write('embed-error: ' + e.message);
1490
- process.exit(2);
1491
- }
1492
- })();
1493
- `], { encoding: 'utf-8', timeout: 30000, windowsHide: true });
1494
- if (result.status !== 0 || !result.stdout) {
1495
- // iter13: failures here had been silently returning 0n which surfaced
1496
- // as auto_recall.count=0 with no diagnostic. acptoapi 1.0.102+
1497
- // returns 410 Gone on /v1/embeddings (embeddings now live in
1498
- // rs-learn natively). Log a structured event so the failure is
1499
- // visible in gmsniff. Dedup on the (status, reason) key so we
1500
- // don't spam — only the first occurrence per process per reason.
1501
- const reason = (result.stderr || 'no response').slice(0, 300);
1503
+ logEvent('plugkit', 'host_vec_embed.no-binary', {
1504
+ hint: 'rs-learn-embed sidecar not found. Set RS_LEARN_EMBED_PATH or cargo install --path C:\\dev\\rs-learn\\crates\\embed.',
1505
+ });
1506
+ } catch (_) {}
1507
+ }
1508
+ return 0n;
1509
+ }
1510
+ const reqLine = JSON.stringify({ id: 1, text }) + '\n';
1511
+ const cacheDir = path.join(process.cwd(), '.gm', 'embed-cache');
1512
+ try { fs.mkdirSync(cacheDir, { recursive: true }); } catch (_) {}
1513
+ const result = spawnSync(binPath, [], {
1514
+ input: reqLine,
1515
+ encoding: 'utf-8',
1516
+ timeout: 300000,
1517
+ windowsHide: true,
1518
+ env: { ...process.env, RS_LEARN_EMBED_CACHE: cacheDir },
1519
+ });
1520
+ if (result.status !== 0) {
1521
+ const reason = (result.stderr || 'unknown').slice(0, 300);
1502
1522
  const key = String(result.status) + '|' + reason;
1503
1523
  if (!_hostVecEmbedFailKeys.has(key)) {
1504
1524
  _hostVecEmbedFailKeys.add(key);
@@ -1507,16 +1527,43 @@ function makeHostFunctions(instanceRef) {
1507
1527
  status: result.status,
1508
1528
  reason,
1509
1529
  text_len: text.length,
1510
- hint: 'acptoapi 1.0.102+ returns 410 on /v1/embeddings — embeddings are served by rs-learn natively. Once rs-learn-embed sidecar is wired into host_vec_embed, this event will stop firing.',
1530
+ via: 'rs-learn-embed sidecar',
1511
1531
  });
1512
1532
  } catch (_) {}
1513
1533
  }
1514
- console.error('[plugkit-wasm] host_vec_embed FAILED:', reason);
1515
1534
  return 0n;
1516
1535
  }
1517
- return writeWasmStr(instanceRef.value, result.stdout);
1536
+ const lines = (result.stdout || '').split('\n').filter(l => l.trim());
1537
+ for (let i = lines.length - 1; i >= 0; i--) {
1538
+ try {
1539
+ const j = JSON.parse(lines[i]);
1540
+ if (Array.isArray(j.embedding)) {
1541
+ return writeWasmStr(instanceRef.value, JSON.stringify(j.embedding));
1542
+ }
1543
+ if (j.error) {
1544
+ const key = 'sidecar-error|' + j.error;
1545
+ if (!_hostVecEmbedFailKeys.has(key)) {
1546
+ _hostVecEmbedFailKeys.add(key);
1547
+ try { logEvent('plugkit', 'host_vec_embed.failed', { reason: j.error, via: 'rs-learn-embed sidecar' }); } catch (_) {}
1548
+ }
1549
+ return 0n;
1550
+ }
1551
+ } catch (_) {}
1552
+ }
1553
+ const key = 'no-embedding';
1554
+ if (!_hostVecEmbedFailKeys.has(key)) {
1555
+ _hostVecEmbedFailKeys.add(key);
1556
+ try {
1557
+ logEvent('plugkit', 'host_vec_embed.failed', {
1558
+ reason: 'no embedding in sidecar response',
1559
+ stdout_excerpt: (result.stdout || '').slice(0, 300),
1560
+ via: 'rs-learn-embed sidecar',
1561
+ });
1562
+ } catch (_) {}
1563
+ }
1564
+ return 0n;
1518
1565
  } catch (e) {
1519
- console.error('[plugkit-wasm] host_vec_embed exception:', e.message);
1566
+ try { logEvent('plugkit', 'host_vec_embed.exception', { message: e.message }); } catch (_) {}
1520
1567
  return 0n;
1521
1568
  }
1522
1569
  },
package/gm.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm",
3
- "version": "2.0.1235",
3
+ "version": "2.0.1237",
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.452"
20
+ "plugkitVersion": "0.1.453"
21
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-skill",
3
- "version": "2.0.1235",
3
+ "version": "2.0.1237",
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.1235"
42
+ "gm-plugkit": "^2.0.1237"
43
43
  },
44
44
  "engines": {
45
45
  "node": ">=16.0.0"