gm-plugkit 2.0.1112 → 2.0.1114

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-plugkit",
3
- "version": "2.0.1112",
3
+ "version": "2.0.1114",
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": {
@@ -21,9 +21,6 @@ function cosineSim(a, b) {
21
21
  return dot / (Math.sqrt(na) * Math.sqrt(nb));
22
22
  }
23
23
 
24
- const browserSessions = new Map();
25
- let nextBrowserSessionId = 1;
26
-
27
24
  function createWasiShim(instanceRef) {
28
25
  const getMemory = () => instanceRef.value.exports.memory.buffer;
29
26
  const shim = {
@@ -317,36 +314,6 @@ function makeHostFunctions(instanceRef) {
317
314
  }
318
315
  },
319
316
 
320
- host_browser_spawn: (urlPtr, urlLen) => {
321
- try {
322
- const url = readWasmStr(instanceRef.value, urlPtr, urlLen);
323
- const id = BigInt(nextBrowserSessionId++);
324
- browserSessions.set(id, { url, opened_at: Date.now() });
325
- return id;
326
- } catch (e) {
327
- return 0n;
328
- }
329
- },
330
-
331
- host_browser_eval: (sessionId, codePtr, codeLen) => {
332
- try {
333
- const code = readWasmStr(instanceRef.value, codePtr, codeLen);
334
- const session = browserSessions.get(BigInt(sessionId));
335
- if (!session) return writeWasmJson(instanceRef.value, { error: 'session not found' });
336
- return writeWasmJson(instanceRef.value, { ok: false, error: 'browser eval not implemented in JS host; route via spool browser verb' });
337
- } catch (e) {
338
- return writeWasmJson(instanceRef.value, { error: e.message });
339
- }
340
- },
341
-
342
- host_browser_close: (sessionId) => {
343
- try {
344
- return browserSessions.delete(BigInt(sessionId)) ? 1 : 0;
345
- } catch (e) {
346
- return 0;
347
- }
348
- },
349
-
350
317
  host_exec_js: (codePtr, codeLen, optsPtr, optsLen) => {
351
318
  try {
352
319
  const code = readWasmStr(instanceRef.value, codePtr, codeLen);
@@ -549,10 +516,18 @@ async function runSpoolWatcher(instance, spoolDir) {
549
516
  return files;
550
517
  }
551
518
 
552
- const heartbeatPath = path.join(spoolDir, '.watcher.heartbeat');
553
- setInterval(() => {
554
- try { fs.writeFileSync(heartbeatPath, String(Date.now())); } catch (_) {}
555
- }, 5000);
519
+ const STATUS_PATH = path.join(spoolDir, '.status.json');
520
+ function writeStatus() {
521
+ try {
522
+ fs.writeFileSync(STATUS_PATH, JSON.stringify({
523
+ pid: process.pid,
524
+ ts: Date.now(),
525
+ version: resolveVersion(instance),
526
+ }));
527
+ } catch (_) {}
528
+ }
529
+ setInterval(writeStatus, 5000);
530
+ writeStatus();
556
531
 
557
532
  const pollInterval = setInterval(async () => {
558
533
  const existing = walkDir(inDir);