@monoes/monomindcli 2.9.11 → 2.9.12

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.
@@ -277,10 +277,23 @@ async function main() {
277
277
  // pid matches our child. A foreign server answering on DEFAULT_PORT must
278
278
  // NOT be mistaken for ours — that lie misroutes every event emitter in
279
279
  // this project (root cause of orgs running invisibly).
280
+ // Absolute safety net so a wedged-but-still-alive process can't hang this
281
+ // hook forever — CONFIRM_ATTEMPTS below is a minimum grace period, not a
282
+ // hard budget (#142 follow-up).
283
+ const HARD_CEILING_ATTEMPTS = 600; // 500ms/attempt: 5 min
280
284
  async function confirmPort() {
281
285
  let sawForeignOnDefault = false;
282
- for (let attempt = 0; attempt < CONFIRM_ATTEMPTS; attempt++) {
286
+ let attempt = 0;
287
+ for (; attempt < HARD_CEILING_ATTEMPTS; attempt++) {
283
288
  await new Promise(r => setTimeout(r, 500));
289
+ // Past the minimum grace period, a dead child means it's not coming
290
+ // back — stop waiting immediately instead of burning the rest of the
291
+ // budget. A LIVE child that simply hasn't reported yet (npm/AV
292
+ // contention on a freshly-written node_modules right after install,
293
+ // measured once at ~142s vs the normal ~5-9s — #142 follow-up) keeps
294
+ // getting the benefit of the doubt up to HARD_CEILING_ATTEMPTS instead
295
+ // of being killed on a fixed guess.
296
+ if (attempt >= CONFIRM_ATTEMPTS && !isPidAlive(child.pid)) break;
284
297
  // 1) Authoritative: child self-reported its bound port. Identity comes
285
298
  // from BOUND_REPORT's own per-invocation-unique path (nothing else on
286
299
  // the machine knows it, since it's only handed to this child via env),
@@ -370,7 +383,7 @@ async function main() {
370
383
  // The next session-start simply retries.
371
384
  try { process.kill(child.pid, 'SIGTERM'); } catch { /* already gone */ }
372
385
  try { fs.unlinkSync(STATUS_FILE); } catch { /* ignore */ }
373
- process.stdout.write(`[control] server did not respond within ${CONFIRM_ATTEMPTS / 2} s — killed orphan, will retry next session\n`);
386
+ process.stdout.write(`[control] server did not respond within ${((attempt + 1) * 500 / 1000).toFixed(1)} s — killed orphan, will retry next session\n`);
374
387
  }
375
388
 
376
389
  confirmPort().catch(() => {}).finally(() => { releaseSpawnLock(); process.exit(0); });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monoes/monomindcli",
3
- "version": "2.9.11",
3
+ "version": "2.9.12",
4
4
  "type": "module",
5
5
  "description": "CLI engine for Monomind — an open-source MCP server that extends Claude Code with a codebase knowledge graph (tree-sitter + SQLite), persistent memory, multi-agent task coordination, and session hooks. Apache 2.0 licensed, fully local.",
6
6
  "main": "dist/src/index.js",
@@ -119,8 +119,8 @@
119
119
  "@opencode-ai/sdk": "^1.18.15",
120
120
  "monofence-ai": "^1.0.2",
121
121
  "sql.js": "^1.14.1",
122
- "@monoes/hooks": "1.0.5",
123
122
  "@monoes/mcp": "1.0.3",
123
+ "@monoes/hooks": "1.0.5",
124
124
  "@monoes/memory": "1.0.15",
125
125
  "@monoes/routing": "1.0.4"
126
126
  },