gm-plugkit 2.0.1975 → 2.0.1977
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/cli.js +27 -14
- package/package.json +1 -1
- package/plugkit-wasm-wrapper.js +19 -1
package/cli.js
CHANGED
|
@@ -248,21 +248,34 @@ function writeCliError(phase, err) {
|
|
|
248
248
|
// This is the actual code-level enforcement of what was previously only a
|
|
249
249
|
// documented convention (SKILL.md telling an LLM agent to manually prefer
|
|
250
250
|
// gm-runner) -- with this in place bun/node are only ever exercised on a
|
|
251
|
-
// platform
|
|
252
|
-
// one-time install before
|
|
253
|
-
|
|
251
|
+
// platform neither runner has a published binary for, or during the
|
|
252
|
+
// one-time install before either runner lands on disk.
|
|
253
|
+
//
|
|
254
|
+
// agentplug-runner is tried FIRST, gm-runner second -- agentplug-runner
|
|
255
|
+
// serves the identical spool ABI (same in/out layout, same verb names;
|
|
256
|
+
// gm.wasm is just one of its loadable plugins now) so it's a strict
|
|
257
|
+
// superset, not an alternative; gm-runner stays as the fallback for any
|
|
258
|
+
// install that has it but hasn't picked up agentplug-runner yet (installer
|
|
259
|
+
// re-run pending, or a platform agentplug-bin hasn't published for yet
|
|
260
|
+
// while gm-runner-bin already has).
|
|
261
|
+
function tryDelegateToRunner(args) {
|
|
254
262
|
if (process.env.GM_PLUGKIT_NO_RUNNER_DELEGATE === '1') return false;
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
const
|
|
260
|
-
if (
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
263
|
+
const candidates = process.platform === 'win32'
|
|
264
|
+
? ['agentplug-runner.exe', 'gm-runner.exe']
|
|
265
|
+
: ['agentplug-runner', 'gm-runner'];
|
|
266
|
+
for (const exeName of candidates) {
|
|
267
|
+
const runnerPath = path.join(gmToolsDir(), exeName);
|
|
268
|
+
if (!fs.existsSync(runnerPath)) continue;
|
|
269
|
+
try {
|
|
270
|
+
const result = cp.spawnSync(runnerPath, args, { stdio: 'inherit', windowsHide: true });
|
|
271
|
+
if (result.error) continue; // this candidate genuinely failed to start -- try the next one
|
|
272
|
+
process.exit(typeof result.status === 'number' ? result.status : 0);
|
|
273
|
+
} catch (_) {
|
|
274
|
+
continue;
|
|
275
|
+
}
|
|
276
|
+
return true;
|
|
264
277
|
}
|
|
265
|
-
return
|
|
278
|
+
return false;
|
|
266
279
|
}
|
|
267
280
|
|
|
268
281
|
(async () => {
|
|
@@ -273,7 +286,7 @@ function tryDelegateToGmRunner(args) {
|
|
|
273
286
|
process.exit(0);
|
|
274
287
|
}
|
|
275
288
|
|
|
276
|
-
|
|
289
|
+
tryDelegateToRunner(args);
|
|
277
290
|
|
|
278
291
|
if (args.includes('--kill-stale-watchers')) {
|
|
279
292
|
process.exit(killStaleWatchers());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gm-plugkit",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1977",
|
|
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": {
|
package/plugkit-wasm-wrapper.js
CHANGED
|
@@ -2573,11 +2573,29 @@ function hostPluginCallViaAgentplugRunner(plugin, verb, body) {
|
|
|
2573
2573
|
const bin = resolveAgentplugRunnerBin();
|
|
2574
2574
|
if (!bin) return null;
|
|
2575
2575
|
try {
|
|
2576
|
+
// agentplug-runner's `dispatch` one-shot resolves relative paths (e.g.
|
|
2577
|
+
// libsql's "path":"gm.db") against its OWN process cwd -- without an
|
|
2578
|
+
// explicit cwd here it inherits whatever directory spawned the watcher
|
|
2579
|
+
// process itself (which need not be the project root, e.g. a bunx temp
|
|
2580
|
+
// resolution dir), silently opening/creating the wrong gm.db instead of
|
|
2581
|
+
// the real one. Same CLAUDE_PROJECT_DIR-first resolution the rest of
|
|
2582
|
+
// this file already uses for the spool dir.
|
|
2583
|
+
const projectCwd = process.env.CLAUDE_PROJECT_DIR || process.cwd();
|
|
2584
|
+
// 90s, not 30s: `dispatch` now routes through agentplug-runner's shared
|
|
2585
|
+
// daemon when reachable (see agentplug's own daemon.rs) -- a COLD daemon
|
|
2586
|
+
// spawn (no daemon alive yet) plus a plugin that hasn't been downloaded
|
|
2587
|
+
// to this machine yet (first libsql/bert/treesitter call ever) can
|
|
2588
|
+
// genuinely exceed 30s combined, live-witnessed this session as a
|
|
2589
|
+
// real not_implemented_js_wrapper fallback on an otherwise-correct
|
|
2590
|
+
// call. A warm daemon with an already-cached plugin answers in
|
|
2591
|
+
// milliseconds regardless of this ceiling; the higher bound only
|
|
2592
|
+
// matters for the one-time cold path.
|
|
2576
2593
|
const r = spawnSync(bin, ['dispatch', plugin, verb, body], {
|
|
2577
2594
|
encoding: 'utf-8',
|
|
2578
2595
|
windowsHide: true,
|
|
2579
|
-
timeout:
|
|
2596
|
+
timeout: 90000,
|
|
2580
2597
|
maxBuffer: 64 * 1024 * 1024,
|
|
2598
|
+
cwd: projectCwd,
|
|
2581
2599
|
});
|
|
2582
2600
|
if (r.error || r.status !== 0) return null;
|
|
2583
2601
|
return r.stdout;
|