gm-qwen 2.0.975 → 2.0.976

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/bootstrap.js CHANGED
@@ -10,7 +10,7 @@ const { URL } = require('url');
10
10
 
11
11
  const RELEASE_REPO = 'AnEntrypoint/plugkit-bin';
12
12
  const ATTEMPT_TIMEOUT_MS = 5 * 60 * 1000;
13
- const STALL_TIMEOUT_MS = 60 * 1000;
13
+ const STALL_TIMEOUT_MS = 15 * 1000;
14
14
  const MAX_ATTEMPTS = 5;
15
15
  const BACKOFF_MS = [2000, 5000, 15000, 30000];
16
16
  // Worst case: a slow link downloading 140MB at 1MB/s = ~140s. Allow 30 minutes
package/bin/plugkit.js CHANGED
@@ -47,6 +47,13 @@ async function resolveBinary() {
47
47
 
48
48
  async function main() {
49
49
  const args = process.argv.slice(2);
50
+ // Detached bootstrap entry: just run bootstrap() and exit. Used by session-start
51
+ // to avoid blocking CC startup on a slow GitHub download.
52
+ if (args[0] === '__rtk_only__') {
53
+ try { await bootstrap({ wrapperDir: dir, silent: false }); }
54
+ catch (e) { try { process.stderr.write(`[plugkit-bootstrap-detached] ${e.message}\n`); } catch (_) {} }
55
+ process.exit(0);
56
+ }
50
57
  const isHook = args[0] === 'hook';
51
58
  const startedAt = Date.now();
52
59
  obsEvent('plugkit_wrapper', 'invoke', { argv: args.slice(0, 4), is_hook: isHook });
@@ -63,15 +70,30 @@ async function main() {
63
70
  // currently has — the hook itself isn't blocking, just refreshing.
64
71
  if (isHook && hookSubcmd === 'session-start') {
65
72
  obsEvent('plugkit_wrapper', 'hook_bootstrap_session_start', { argv: args.slice(0, 4) });
73
+ // Bootstrap can stall 60s+ on a slow GitHub mirror — never block CC startup
74
+ // on it. Detach into a background child; this hook returns immediately
75
+ // with whatever cached binary exists. Subsequent hooks pick up the new
76
+ // binary once the detached bootstrap completes.
77
+ bin = resolveCachedBinary({ wrapperDir: dir }) || legacyFallback();
66
78
  try {
67
- bin = await bootstrap({ wrapperDir: dir, silent: true });
79
+ const child = spawn(process.execPath, [__filename, '__rtk_only__'], {
80
+ detached: true,
81
+ stdio: 'ignore',
82
+ windowsHide: true,
83
+ env: { ...process.env, PLUGKIT_BOOTSTRAP_DETACHED: '1' },
84
+ });
85
+ child.unref();
86
+ obsEvent('plugkit_wrapper', 'session_start_bootstrap_detached', { pid: child.pid });
68
87
  } catch (e) {
69
- process.stderr.write(`[plugkit] session-start bootstrap failed: ${e.message}\n`);
70
- bin = resolveCachedBinary({ wrapperDir: dir }) || legacyFallback();
88
+ process.stderr.write(`[plugkit] detached bootstrap spawn failed: ${e.message}\n`);
89
+ }
90
+ // If no cached binary yet (fresh install with bootstrap still downloading),
91
+ // skip running the session-start handler this turn — it will fire next
92
+ // session-start once binary is in place.
93
+ if (!bin) {
94
+ process.stderr.write(`[plugkit] session-start skipped: binary not yet installed (bootstrap running in background).\n`);
95
+ process.exit(0);
71
96
  }
72
- // session-start hook itself runs in the freshly-bootstrapped binary
73
- // below — fall through to the spawn path so the actual handler runs.
74
- if (!bin) process.exit(0);
75
97
  } else if (isHook) {
76
98
  bin = (await resolveBinaryWithPinCheck()) || legacyFallback();
77
99
  if (!bin) {
package/gm.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm",
3
- "version": "2.0.975",
3
+ "version": "2.0.976",
4
4
  "description": "State machine agent with hooks, skills, and automated git enforcement",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-qwen",
3
- "version": "2.0.975",
3
+ "version": "2.0.976",
4
4
  "description": "State machine agent with hooks, skills, and automated git enforcement",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",