gm-skill 2.0.1765 → 2.0.1767
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/bin/plugkit.version +1 -1
- package/bin/plugkit.wasm.sha256 +1 -1
- package/gm-plugkit/package.json +1 -1
- package/gm-plugkit/plugkit-wasm-wrapper.js +249 -13
- package/gm-plugkit/plugkit.version +1 -1
- package/gm.json +2 -2
- package/package.json +1 -1
package/bin/plugkit.version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.796
|
package/bin/plugkit.wasm.sha256
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
895fc9512ecbacb7b4528128ae2c7ab0cbfc21e2acd1f5515f32c7fdba3c3d13 plugkit.wasm
|
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.1767",
|
|
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": {
|
|
@@ -1558,6 +1558,20 @@ function cosineSim(a, b) {
|
|
|
1558
1558
|
}
|
|
1559
1559
|
|
|
1560
1560
|
let __wasmAbortFlag = { aborted: false, code: 0 };
|
|
1561
|
+
const WASI_FILESYSTEM_ROOT = path.join(GM_TOOLS_ROOT, 'wasi-fs');
|
|
1562
|
+
const wasiOpenFiles = new Map();
|
|
1563
|
+
let wasiNextFd = 100;
|
|
1564
|
+
|
|
1565
|
+
function wasiResolvePath(relPath) {
|
|
1566
|
+
const rel = String(relPath || '').replace(/\\/g, '/').replace(/^\/+/, '');
|
|
1567
|
+
const resolved = path.resolve(WASI_FILESYSTEM_ROOT, rel);
|
|
1568
|
+
const rootResolved = path.resolve(WASI_FILESYSTEM_ROOT) + path.sep;
|
|
1569
|
+
if (resolved !== path.resolve(WASI_FILESYSTEM_ROOT) && !resolved.startsWith(rootResolved)) {
|
|
1570
|
+
throw new Error(`wasi-path-traversal-refused: ${relPath} escapes ${WASI_FILESYSTEM_ROOT}`);
|
|
1571
|
+
}
|
|
1572
|
+
return resolved;
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1561
1575
|
function createWasiShim(instanceRef) {
|
|
1562
1576
|
const getMemory = () => instanceRef.value.exports.memory.buffer;
|
|
1563
1577
|
const shim = {
|
|
@@ -1623,25 +1637,247 @@ function createWasiShim(instanceRef) {
|
|
|
1623
1637
|
},
|
|
1624
1638
|
environ_get: () => 0,
|
|
1625
1639
|
environ_sizes_get: () => 0,
|
|
1626
|
-
fd_prestat_get: () =>
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1640
|
+
fd_prestat_get: (fd, buf_ptr) => {
|
|
1641
|
+
if (fd !== 3) return 8;
|
|
1642
|
+
try {
|
|
1643
|
+
const dv = new DataView(getMemory());
|
|
1644
|
+
dv.setUint8(buf_ptr, 0);
|
|
1645
|
+
dv.setUint32(buf_ptr + 4, 1, true);
|
|
1646
|
+
return 0;
|
|
1647
|
+
} catch (e) { return 8; }
|
|
1648
|
+
},
|
|
1649
|
+
fd_prestat_dir_name: (fd, path_ptr, path_len) => {
|
|
1650
|
+
if (fd !== 3) return 8;
|
|
1651
|
+
try {
|
|
1652
|
+
const buf = getMemory();
|
|
1653
|
+
new Uint8Array(buf, path_ptr >>> 0, Math.min(path_len, 1)).set([0x2e]);
|
|
1654
|
+
return 0;
|
|
1655
|
+
} catch (e) { return 8; }
|
|
1635
1656
|
},
|
|
1636
|
-
|
|
1637
|
-
|
|
1657
|
+
fd_close: (fd) => {
|
|
1658
|
+
const entry = wasiOpenFiles.get(fd);
|
|
1659
|
+
if (!entry) return 0;
|
|
1660
|
+
try { fs.closeSync(entry.nodeFd); } catch (_) {}
|
|
1661
|
+
wasiOpenFiles.delete(fd);
|
|
1638
1662
|
return 0;
|
|
1639
1663
|
},
|
|
1640
|
-
|
|
1641
|
-
|
|
1664
|
+
fd_fdstat_get: (fd, stat_ptr) => {
|
|
1665
|
+
try {
|
|
1666
|
+
const dv = new DataView(getMemory());
|
|
1667
|
+
const entry = wasiOpenFiles.get(fd);
|
|
1668
|
+
dv.setUint8(stat_ptr, entry ? 4 : 0);
|
|
1669
|
+
dv.setUint8(stat_ptr + 1, 0);
|
|
1670
|
+
dv.setBigUint64(stat_ptr + 8, 0xffffffffffffffffn, true);
|
|
1671
|
+
dv.setBigUint64(stat_ptr + 16, 0xffffffffffffffffn, true);
|
|
1672
|
+
return 0;
|
|
1673
|
+
} catch (e) { return 8; }
|
|
1674
|
+
},
|
|
1675
|
+
fd_fdstat_set_flags: () => 0,
|
|
1676
|
+
fd_filestat_get: (fd, buf_ptr) => {
|
|
1677
|
+
const entry = wasiOpenFiles.get(fd);
|
|
1678
|
+
if (!entry) { if (process.env.PLUGKIT_DEBUG) console.error(`[plugkit-wasm] fd_filestat_get FAILED: no entry for fd=${fd}`); return 8; }
|
|
1679
|
+
try {
|
|
1680
|
+
const st = fs.fstatSync(entry.nodeFd);
|
|
1681
|
+
const dv = new DataView(getMemory());
|
|
1682
|
+
dv.setBigUint64(buf_ptr, 0n, true);
|
|
1683
|
+
dv.setBigUint64(buf_ptr + 8, 0n, true);
|
|
1684
|
+
dv.setUint8(buf_ptr + 16, 4);
|
|
1685
|
+
dv.setBigUint64(buf_ptr + 24, 1n, true);
|
|
1686
|
+
dv.setBigUint64(buf_ptr + 32, BigInt(st.size), true);
|
|
1687
|
+
dv.setBigUint64(buf_ptr + 40, BigInt(Math.floor(st.atimeMs * 1e6)), true);
|
|
1688
|
+
dv.setBigUint64(buf_ptr + 48, BigInt(Math.floor(st.mtimeMs * 1e6)), true);
|
|
1689
|
+
dv.setBigUint64(buf_ptr + 56, BigInt(Math.floor(st.ctimeMs * 1e6)), true);
|
|
1690
|
+
return 0;
|
|
1691
|
+
} catch (e) { if (process.env.PLUGKIT_DEBUG) console.error(`[plugkit-wasm] fd_filestat_get FAILED: ${e && e.message}`); return 8; }
|
|
1692
|
+
},
|
|
1693
|
+
fd_seek: (fd, offset64, whence, newoffset_ptr) => {
|
|
1694
|
+
const entry = wasiOpenFiles.get(fd);
|
|
1695
|
+
if (!entry) { try { new DataView(getMemory()).setBigUint64(newoffset_ptr, 0n, true); } catch (_) {} return 8; }
|
|
1696
|
+
try {
|
|
1697
|
+
const offset = BigInt.asIntN(64, BigInt(offset64));
|
|
1698
|
+
let base;
|
|
1699
|
+
if (whence === 0) base = 0n;
|
|
1700
|
+
else if (whence === 1) base = BigInt(entry.pos);
|
|
1701
|
+
else base = BigInt(fs.fstatSync(entry.nodeFd).size);
|
|
1702
|
+
const next = base + offset;
|
|
1703
|
+
entry.pos = Number(next < 0n ? 0n : next);
|
|
1704
|
+
new DataView(getMemory()).setBigUint64(newoffset_ptr, BigInt(entry.pos), true);
|
|
1705
|
+
return 0;
|
|
1706
|
+
} catch (e) { if (process.env.PLUGKIT_DEBUG) console.error(`[plugkit-wasm] fd_seek FAILED: ${e && e.message}`); return 8; }
|
|
1707
|
+
},
|
|
1708
|
+
fd_read: (fd, iovs_ptr, iovs_len, nread_ptr) => {
|
|
1709
|
+
const entry = wasiOpenFiles.get(fd);
|
|
1710
|
+
if (!entry) { try { new DataView(getMemory()).setUint32(nread_ptr, 0, true); } catch (_) {} return 8; }
|
|
1711
|
+
try {
|
|
1712
|
+
const buf = getMemory();
|
|
1713
|
+
const dv = new DataView(buf);
|
|
1714
|
+
let total = 0;
|
|
1715
|
+
const iovsBase = iovs_ptr >>> 0;
|
|
1716
|
+
for (let i = 0; i < iovs_len; i++) {
|
|
1717
|
+
const base = iovsBase + i * 8;
|
|
1718
|
+
const ptr = dv.getUint32(base, true) >>> 0;
|
|
1719
|
+
const len = dv.getUint32(base + 4, true) >>> 0;
|
|
1720
|
+
if (len === 0) continue;
|
|
1721
|
+
const dest = Buffer.from(buf, ptr, len);
|
|
1722
|
+
const n = fs.readSync(entry.nodeFd, dest, 0, len, entry.pos);
|
|
1723
|
+
entry.pos += n;
|
|
1724
|
+
total += n;
|
|
1725
|
+
if (n < len) break;
|
|
1726
|
+
}
|
|
1727
|
+
dv.setUint32(nread_ptr, total, true);
|
|
1728
|
+
return 0;
|
|
1729
|
+
} catch (e) { return 8; }
|
|
1730
|
+
},
|
|
1731
|
+
fd_pread: (fd, iovs_ptr, iovs_len, offset64, nread_ptr) => {
|
|
1732
|
+
const entry = wasiOpenFiles.get(fd);
|
|
1733
|
+
if (!entry) { try { new DataView(getMemory()).setUint32(nread_ptr, 0, true); } catch (_) {} return 8; }
|
|
1734
|
+
try {
|
|
1735
|
+
const offset = Number(BigInt.asUintN(64, BigInt(offset64)));
|
|
1736
|
+
const buf = getMemory();
|
|
1737
|
+
const dv = new DataView(buf);
|
|
1738
|
+
let total = 0;
|
|
1739
|
+
const iovsBase = iovs_ptr >>> 0;
|
|
1740
|
+
let pos = offset;
|
|
1741
|
+
for (let i = 0; i < iovs_len; i++) {
|
|
1742
|
+
const base = iovsBase + i * 8;
|
|
1743
|
+
const ptr = dv.getUint32(base, true) >>> 0;
|
|
1744
|
+
const len = dv.getUint32(base + 4, true) >>> 0;
|
|
1745
|
+
if (len === 0) continue;
|
|
1746
|
+
const dest = Buffer.from(buf, ptr, len);
|
|
1747
|
+
const n = fs.readSync(entry.nodeFd, dest, 0, len, pos);
|
|
1748
|
+
pos += n;
|
|
1749
|
+
total += n;
|
|
1750
|
+
if (n < len) break;
|
|
1751
|
+
}
|
|
1752
|
+
dv.setUint32(nread_ptr, total, true);
|
|
1753
|
+
return 0;
|
|
1754
|
+
} catch (e) { if (process.env.PLUGKIT_DEBUG) console.error(`[plugkit-wasm] fd_pread FAILED: ${e && e.message}`); return 8; }
|
|
1755
|
+
},
|
|
1756
|
+
fd_pwrite: (fd, iovs_ptr, iovs_len, offset64, nwritten_ptr) => {
|
|
1757
|
+
const entry = wasiOpenFiles.get(fd);
|
|
1758
|
+
if (!entry) { try { new DataView(getMemory()).setUint32(nwritten_ptr, 0, true); } catch (_) {} return 8; }
|
|
1759
|
+
try {
|
|
1760
|
+
const offset = Number(BigInt.asUintN(64, BigInt(offset64)));
|
|
1761
|
+
const buf = getMemory();
|
|
1762
|
+
const dv = new DataView(buf);
|
|
1763
|
+
let total = 0;
|
|
1764
|
+
const iovsBase = iovs_ptr >>> 0;
|
|
1765
|
+
let pos = offset;
|
|
1766
|
+
for (let i = 0; i < iovs_len; i++) {
|
|
1767
|
+
const base = iovsBase + i * 8;
|
|
1768
|
+
const ptr = dv.getUint32(base, true) >>> 0;
|
|
1769
|
+
const len = dv.getUint32(base + 4, true) >>> 0;
|
|
1770
|
+
if (len === 0) continue;
|
|
1771
|
+
const src = Buffer.from(buf, ptr, len);
|
|
1772
|
+
const n = fs.writeSync(entry.nodeFd, src, 0, len, pos);
|
|
1773
|
+
pos += n;
|
|
1774
|
+
total += n;
|
|
1775
|
+
}
|
|
1776
|
+
dv.setUint32(nwritten_ptr, total, true);
|
|
1777
|
+
return 0;
|
|
1778
|
+
} catch (e) { if (process.env.PLUGKIT_DEBUG) console.error(`[plugkit-wasm] fd_pwrite FAILED: ${e && e.message}`); return 8; }
|
|
1779
|
+
},
|
|
1780
|
+
fd_sync: (fd) => {
|
|
1781
|
+
const entry = wasiOpenFiles.get(fd);
|
|
1782
|
+
if (!entry) return 8;
|
|
1783
|
+
try { fs.fsyncSync(entry.nodeFd); return 0; } catch (e) { if (process.env.PLUGKIT_DEBUG) console.error(`[plugkit-wasm] fd_sync FAILED: ${e && e.message}`); return 8; }
|
|
1784
|
+
},
|
|
1785
|
+
fd_datasync: (fd) => {
|
|
1786
|
+
const entry = wasiOpenFiles.get(fd);
|
|
1787
|
+
if (!entry) return 8;
|
|
1788
|
+
try { fs.fdatasyncSync(entry.nodeFd); return 0; } catch (e) { return 8; }
|
|
1789
|
+
},
|
|
1790
|
+
fd_filestat_set_size: (fd, size64) => {
|
|
1791
|
+
const entry = wasiOpenFiles.get(fd);
|
|
1792
|
+
if (!entry) return 8;
|
|
1793
|
+
try {
|
|
1794
|
+
const size = Number(BigInt.asUintN(64, BigInt(size64)));
|
|
1795
|
+
fs.ftruncateSync(entry.nodeFd, size);
|
|
1796
|
+
return 0;
|
|
1797
|
+
} catch (e) { if (process.env.PLUGKIT_DEBUG) console.error(`[plugkit-wasm] fd_filestat_set_size FAILED: ${e && e.message}`); return 8; }
|
|
1798
|
+
},
|
|
1799
|
+
path_create_directory: (_dirfd, path_ptr, path_len) => {
|
|
1800
|
+
try {
|
|
1801
|
+
const buf = getMemory();
|
|
1802
|
+
const relPath = new TextDecoder('utf-8').decode(new Uint8Array(buf, path_ptr >>> 0, path_len >>> 0));
|
|
1803
|
+
const absPath = wasiResolvePath(relPath);
|
|
1804
|
+
fs.mkdirSync(absPath, { recursive: true });
|
|
1805
|
+
return 0;
|
|
1806
|
+
} catch (e) {
|
|
1807
|
+
if (process.env.PLUGKIT_DEBUG) console.error(`[plugkit-wasm] path_create_directory FAILED: ${e && e.message}`);
|
|
1808
|
+
return e && e.code === 'EEXIST' ? 0 : 8;
|
|
1809
|
+
}
|
|
1810
|
+
},
|
|
1811
|
+
path_unlink_file: (_dirfd, path_ptr, path_len) => {
|
|
1812
|
+
try {
|
|
1813
|
+
const buf = getMemory();
|
|
1814
|
+
const relPath = new TextDecoder('utf-8').decode(new Uint8Array(buf, path_ptr >>> 0, path_len >>> 0));
|
|
1815
|
+
const absPath = wasiResolvePath(relPath);
|
|
1816
|
+
fs.unlinkSync(absPath);
|
|
1817
|
+
return 0;
|
|
1818
|
+
} catch (e) {
|
|
1819
|
+
return e && e.code === 'ENOENT' ? 44 : 8;
|
|
1820
|
+
}
|
|
1821
|
+
},
|
|
1822
|
+
path_open: (_dirfd, _dirflags, path_ptr, path_len, oflags, _rights_base, _rights_inherit, fdflags, opened_fd_ptr) => {
|
|
1823
|
+
try {
|
|
1824
|
+
const buf = getMemory();
|
|
1825
|
+
const relPath = new TextDecoder('utf-8').decode(new Uint8Array(buf, path_ptr >>> 0, path_len >>> 0));
|
|
1826
|
+
const absPath = wasiResolvePath(relPath);
|
|
1827
|
+
fs.mkdirSync(path.dirname(absPath), { recursive: true });
|
|
1828
|
+
const OFLAGS_CREAT = 1, OFLAGS_EXCL = 2, OFLAGS_TRUNC = 8;
|
|
1829
|
+
let nodeFlags = 'r+';
|
|
1830
|
+
const creat = (oflags & OFLAGS_CREAT) !== 0;
|
|
1831
|
+
const excl = (oflags & OFLAGS_EXCL) !== 0;
|
|
1832
|
+
const trunc = (oflags & OFLAGS_TRUNC) !== 0;
|
|
1833
|
+
if (excl && creat) nodeFlags = 'wx+';
|
|
1834
|
+
else if (trunc) nodeFlags = 'w+';
|
|
1835
|
+
else if (creat) nodeFlags = fs.existsSync(absPath) ? 'r+' : 'w+';
|
|
1836
|
+
else nodeFlags = 'r+';
|
|
1837
|
+
if (process.env.PLUGKIT_DEBUG) console.error(`[plugkit-wasm] path_open: rel=${relPath} abs=${absPath} oflags=${oflags} nodeFlags=${nodeFlags}`);
|
|
1838
|
+
const nodeFd = fs.openSync(absPath, nodeFlags);
|
|
1839
|
+
const wasiFd = wasiNextFd++;
|
|
1840
|
+
wasiOpenFiles.set(wasiFd, { nodeFd, pos: 0, path: absPath });
|
|
1841
|
+
new DataView(buf).setUint32(opened_fd_ptr, wasiFd, true);
|
|
1842
|
+
return 0;
|
|
1843
|
+
} catch (e) {
|
|
1844
|
+
if (process.env.PLUGKIT_DEBUG) console.error(`[plugkit-wasm] path_open FAILED: ${e && e.message}`);
|
|
1845
|
+
return e && /ENOENT/.test(e.code || '') ? 44 : 8;
|
|
1846
|
+
}
|
|
1847
|
+
},
|
|
1848
|
+
path_filestat_get: (_dirfd, _flags, path_ptr, path_len, buf_ptr) => {
|
|
1849
|
+
try {
|
|
1850
|
+
const buf = getMemory();
|
|
1851
|
+
const relPath = new TextDecoder('utf-8').decode(new Uint8Array(buf, path_ptr >>> 0, path_len >>> 0));
|
|
1852
|
+
const absPath = wasiResolvePath(relPath);
|
|
1853
|
+
const st = fs.statSync(absPath);
|
|
1854
|
+
const dv = new DataView(buf);
|
|
1855
|
+
dv.setBigUint64(buf_ptr, 0n, true);
|
|
1856
|
+
dv.setBigUint64(buf_ptr + 8, 0n, true);
|
|
1857
|
+
dv.setUint8(buf_ptr + 16, st.isDirectory() ? 3 : 4);
|
|
1858
|
+
dv.setBigUint64(buf_ptr + 24, 1n, true);
|
|
1859
|
+
dv.setBigUint64(buf_ptr + 32, BigInt(st.size), true);
|
|
1860
|
+
dv.setBigUint64(buf_ptr + 40, BigInt(Math.floor(st.atimeMs * 1e6)), true);
|
|
1861
|
+
dv.setBigUint64(buf_ptr + 48, BigInt(Math.floor(st.mtimeMs * 1e6)), true);
|
|
1862
|
+
dv.setBigUint64(buf_ptr + 56, BigInt(Math.floor(st.ctimeMs * 1e6)), true);
|
|
1863
|
+
return 0;
|
|
1864
|
+
} catch (e) {
|
|
1865
|
+
return e && /ENOENT/.test(e.code || '') ? 44 : 8;
|
|
1866
|
+
}
|
|
1867
|
+
},
|
|
1642
1868
|
poll_oneoff: () => 0,
|
|
1643
1869
|
sched_yield: () => 0,
|
|
1644
1870
|
};
|
|
1871
|
+
if (process.env.PLUGKIT_DEBUG_WASI) {
|
|
1872
|
+
for (const k of Object.keys(shim)) {
|
|
1873
|
+
const orig = shim[k];
|
|
1874
|
+
shim[k] = (...args) => {
|
|
1875
|
+
const r = orig(...args);
|
|
1876
|
+
try { console.error(`[plugkit-wasm] wasi.${k}(${args.map(a => typeof a === 'bigint' ? a.toString() : a).join(',')}) -> ${r}`); } catch (_) {}
|
|
1877
|
+
return r;
|
|
1878
|
+
};
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1645
1881
|
return new Proxy(shim, {
|
|
1646
1882
|
get(target, prop) {
|
|
1647
1883
|
if (prop in target) return target[prop];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.796
|
package/gm.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gm",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1767",
|
|
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.
|
|
20
|
+
"plugkitVersion": "0.1.796"
|
|
21
21
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gm-skill",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1767",
|
|
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",
|