@monoes/monomindcli 1.14.0 → 1.14.2

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.
@@ -112,3 +112,20 @@ Follow _protocol.md Brain Write Procedure for domain `ops`.
112
112
 
113
113
 
114
114
  Invoke `Skill("mastermind:_repeat")` now to execute the REPEAT POSTAMBLE. This is a required tool call — do not skip it.
115
+
116
+ After the REPEAT POSTAMBLE completes, if a loop was started or continued (LOOP_ID is set), write the org name into the loop state file so the dashboard can detect running status:
117
+ ```bash
118
+ if [ -n "${LOOP_ID:-}" ]; then
119
+ LOOP_FILE=".monomind/loops/${LOOP_ID}.json"
120
+ if [ -f "$LOOP_FILE" ]; then
121
+ python3 -c "
122
+ import json, sys
123
+ f = sys.argv[1]; org = sys.argv[2]
124
+ d = json.load(open(f))
125
+ if 'orgName' not in d:
126
+ d['orgName'] = org
127
+ open(f, 'w').write(json.dumps(d, indent=2))
128
+ " "$LOOP_FILE" "${org_name}" 2>/dev/null || true
129
+ fi
130
+ fi
131
+ ```
@@ -7291,7 +7291,7 @@ function _odtPopulateChatSel() {
7291
7291
  });
7292
7292
 
7293
7293
  // Render [S] groups (collapsed loop reps)
7294
- groups.forEach(g => {
7294
+ sessGroups.forEach(g => {
7295
7295
  const d = new Date(g.ts || 0);
7296
7296
  const ts = d.toLocaleTimeString([],{hour:'2-digit',minute:'2-digit',second:'2-digit'});
7297
7297
  const date = d.toLocaleDateString([],{month:'short',day:'numeric'});
@@ -3519,9 +3519,45 @@ export async function startServer({ port = 4242, projectDir, openBrowser = true
3519
3519
  const routinesData = readJsonSafe(path.join(orgsDir, `${orgName}-routines.json`)) || { routines: [] };
3520
3520
  const approvalsData = readJsonSafe(path.join(orgsDir, `${orgName}-approvals.json`)) || { approvals: [] };
3521
3521
 
3522
- // Check running status: stop file absence AND (in-memory activeOrgRuns OR state-file agents)
3522
+ // Check running status: stop file absence AND (in-memory activeOrgRuns OR state-file agents OR active loop file)
3523
3523
  const stopFile = path.join(orgsDir, '.stops', `${orgName}.stop`);
3524
- const running = !fs.existsSync(stopFile) && (activeOrgRuns.has(orgName) || Object.values(state.agents || {}).some(a => a.status === 'running'));
3524
+ const _loopsDir = path.join(d, '.monomind', 'loops');
3525
+ const _loopRunning = (() => {
3526
+ try {
3527
+ if (!fs.existsSync(_loopsDir)) return false;
3528
+ // Get the org's state file mtime to correlate with loop activity
3529
+ const orgStateMtime = (() => {
3530
+ try { return fs.statSync(path.join(orgsDir, `${orgName}-state.json`)).mtimeMs; } catch { return 0; }
3531
+ })();
3532
+ // Also check org's most recent run file mtime
3533
+ const orgRunsDir = path.join(d, '.monomind', 'orgs', orgName, 'runs');
3534
+ const orgLastRunMtime = (() => {
3535
+ try {
3536
+ if (!fs.existsSync(orgRunsDir)) return 0;
3537
+ const runFiles = fs.readdirSync(orgRunsDir).filter(f => f.endsWith('.jsonl'));
3538
+ if (!runFiles.length) return 0;
3539
+ return Math.max(...runFiles.map(f => { try { return fs.statSync(path.join(orgRunsDir, f)).mtimeMs; } catch { return 0; } }));
3540
+ } catch { return 0; }
3541
+ })();
3542
+ const orgLastActivity = Math.max(orgStateMtime, orgLastRunMtime);
3543
+ return fs.readdirSync(_loopsDir).some(f => {
3544
+ if (!f.endsWith('.json') || f.endsWith('.stop')) return false;
3545
+ try {
3546
+ const lp = JSON.parse(fs.readFileSync(path.join(_loopsDir, f), 'utf8'));
3547
+ if (!lp.command || !lp.command.includes('runorg')) return false;
3548
+ if (!['running', 'paused'].includes(lp.status)) return false;
3549
+ // Primary match: explicit orgName field (written by runorg command since v1.14.2)
3550
+ if (lp.orgName === orgName) return true;
3551
+ // Fallback: org name in prompt (early loop files that preserved --org flag)
3552
+ if ((lp.prompt || '').includes(orgName)) return true;
3553
+ // Heuristic: if loop's lastRunAt is within 3x wait interval of org's last activity
3554
+ const waitMs = (lp.wait || 60) * 3 * 1000;
3555
+ return orgLastActivity > 0 && Math.abs(orgLastActivity - (lp.lastRunAt || 0)) < waitMs;
3556
+ } catch { return false; }
3557
+ });
3558
+ } catch { return false; }
3559
+ })();
3560
+ const running = !fs.existsSync(stopFile) && (activeOrgRuns.has(orgName) || ['running','active'].includes(state.status) || Object.values(state.agents || {}).some(a => a.status === 'running') || _loopRunning);
3525
3561
 
3526
3562
  // Read real tasks from the task store and group by status column
3527
3563
  const taskStoreData = readJsonSafe(path.join(d, '.monomind', 'tasks', 'store.json'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monoes/monomindcli",
3
- "version": "1.14.0",
3
+ "version": "1.14.2",
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",