gm-plugkit 2.0.2177 → 2.0.2178

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.
Files changed (2) hide show
  1. package/bootstrap.js +21 -2
  2. package/package.json +1 -1
package/bootstrap.js CHANGED
@@ -220,6 +220,17 @@ function readShaManifest() {
220
220
  return out;
221
221
  }
222
222
 
223
+ async function fetchRemoteSha(version, artifactName) {
224
+ const base = `https://github.com/AnEntrypoint/plugkit-bin/releases/download/v${version}`;
225
+ try {
226
+ const shaBuf = await httpGetBuffer(`${base}/${artifactName}.sha256`, 10000);
227
+ return shaBuf.toString('utf-8').trim().split(/\s+/)[0].toLowerCase();
228
+ } catch (e) {
229
+ log(`remote sha fetch failed for ${artifactName}@${version}: ${e.message}`);
230
+ return null;
231
+ }
232
+ }
233
+
223
234
  async function extractNpmPackageWasm(destPath, version) {
224
235
  const tempDir = path.join(path.dirname(destPath), '.npm-extract-' + Date.now());
225
236
  try {
@@ -394,11 +405,19 @@ function killStaleDaemonIfVersionChanged() {
394
405
  async function bootstrap(opts) {
395
406
  opts = opts || {};
396
407
  const version = readVersionFile();
397
- const shaManifest = readShaManifest();
398
408
  const useSlim = hasNativeEmbedRunner();
399
409
  const remoteArtifact = useSlim ? 'plugkit-slim.wasm' : 'plugkit.wasm';
400
410
  const wasmName = 'plugkit.wasm';
401
- const expectedSha = shaManifest ? (shaManifest[remoteArtifact] || (useSlim ? null : shaManifest[wasmName])) : null;
411
+
412
+ let expectedSha = await fetchRemoteSha(version, remoteArtifact);
413
+ if (!expectedSha) {
414
+ const shaManifest = readShaManifest();
415
+ const localManifestVersion = (() => { try { return readVersionFile(); } catch (_) { return null; } })();
416
+ if (shaManifest && localManifestVersion === version) {
417
+ expectedSha = shaManifest[remoteArtifact] || (useSlim ? null : shaManifest[wasmName]) || null;
418
+ if (expectedSha) log(`remote sha unreachable, falling back to committed manifest for matching version ${version}`);
419
+ }
420
+ }
402
421
 
403
422
  let root = cacheRoot();
404
423
  try { ensureDir(root); }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-plugkit",
3
- "version": "2.0.2177",
3
+ "version": "2.0.2178",
4
4
  "description": "Bootstrap and daemon-spawn tool for gm plugkit binary. Downloads the correct platform wasm, verifies SHA256, and launches agentplug-runner (the native wasm host) as the spool watcher daemon.",
5
5
  "main": "index.js",
6
6
  "bin": {