monomind 1.9.5 → 1.9.7

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": "monomind",
3
- "version": "1.9.5",
3
+ "version": "1.9.7",
4
4
  "description": "Monomind - Enterprise AI agent orchestration for Claude Code. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -89,8 +89,9 @@ const initAction = async (ctx) => {
89
89
  return { success: false, exitCode: 1 };
90
90
  }
91
91
  spinner.succeed('Monomind initialized successfully!');
92
- // Trigger background monograph watch (includes initial build on start).
93
- // Only one spawnavoids SQLite BUSY from concurrent build + watch + session-start hook.
92
+ // Start monograph watch for ongoing file-change rebuilds.
93
+ // NOTE: watchAsync uses ignoreInitial:true it does NOT do an initial build.
94
+ // The initial build is handled by initKnowledgeGraph() above via a detached spawn.
94
95
  try {
95
96
  const { spawn } = await import('child_process');
96
97
  const proc = spawn(process.execPath, [process.argv[1], 'monograph', 'watch'], {
@@ -356,19 +356,18 @@ export async function executeInit(options) {
356
356
  * hook build is already running, we skip to avoid SQLITE_BUSY.
357
357
  */
358
358
  async function initKnowledgeGraph(targetDir, result) {
359
- const { mkdirSync, statSync, unlinkSync, writeFileSync, existsSync } = await import('fs');
360
359
  const outputDir = path.join(targetDir, '.monomind', 'graph');
361
- mkdirSync(outputDir, { recursive: true });
360
+ fs.mkdirSync(outputDir, { recursive: true });
362
361
  const lockPath = path.join(outputDir, 'build.lock');
363
362
  const now = Date.now();
364
363
  // If graphify-freshen.cjs (session-start hook) already holds a fresh lock, skip.
365
364
  try {
366
- const stat = statSync(lockPath);
365
+ const stat = fs.statSync(lockPath);
367
366
  if (now - stat.mtimeMs < 5 * 60 * 1000) {
368
367
  result.skipped.push('knowledge graph build: already in progress (session-start hook running)');
369
368
  return;
370
369
  }
371
- unlinkSync(lockPath);
370
+ fs.unlinkSync(lockPath);
372
371
  }
373
372
  catch { /* no lock — proceed */ }
374
373
  // Resolve @monoes/monograph from the CLI package's own node_modules first
@@ -380,7 +379,7 @@ async function initKnowledgeGraph(targetDir, result) {
380
379
  }
381
380
  catch {
382
381
  const fallback = path.join(targetDir, 'node_modules', '@monoes', 'monograph', 'dist', 'src', 'index.js');
383
- if (existsSync(fallback))
382
+ if (fs.existsSync(fallback))
384
383
  entryPoint = fallback;
385
384
  }
386
385
  if (!entryPoint) {
@@ -389,10 +388,16 @@ async function initKnowledgeGraph(targetDir, result) {
389
388
  }
390
389
  // Acquire lock before spawning so graphify-freshen.cjs sees it and skips
391
390
  try {
392
- writeFileSync(lockPath, String(process.pid));
391
+ fs.writeFileSync(lockPath, String(process.pid));
393
392
  }
394
393
  catch { /* non-fatal */ }
395
394
  const { spawn } = await import('child_process');
395
+ const logPath = path.join(outputDir, 'build.log');
396
+ let logFd = 'ignore';
397
+ try {
398
+ logFd = fs.openSync(logPath, 'a');
399
+ }
400
+ catch { /* non-fatal */ }
396
401
  const script = `
397
402
  import { buildAsync } from ${JSON.stringify('file://' + entryPoint)};
398
403
  import { unlinkSync } from 'fs';
@@ -401,10 +406,17 @@ try { await buildAsync(${JSON.stringify(targetDir)}); } finally {
401
406
  }`;
402
407
  const child = spawn(process.execPath, ['--input-type=module', '--eval', script], {
403
408
  detached: true,
404
- stdio: 'ignore',
409
+ stdio: ['ignore', logFd, logFd],
405
410
  cwd: targetDir,
406
411
  });
407
412
  child.unref();
413
+ // Close the parent's copy of the fd — the child has its own inherited copy
414
+ if (typeof logFd === 'number') {
415
+ try {
416
+ fs.closeSync(logFd);
417
+ }
418
+ catch { /* non-fatal */ }
419
+ }
408
420
  result.created.files.push('.monomind/graph/ (knowledge graph building in background)');
409
421
  }
410
422
  /**
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monoes/monomindcli",
3
- "version": "1.9.5",
3
+ "version": "1.9.7",
4
4
  "type": "module",
5
5
  "description": "Monomind CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
6
6
  "main": "dist/src/index.js",