monomind 2.0.2 → 2.0.3
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": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "Monomind - Power toolkit for Claude Code. Autonomous agent orgs, codebase knowledge graph, keyword-routed specialist prompts, and 80+ slash commands. One init, then walk away.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
<!-- Start a saved org as a persistent autonomous agent organization. The boss agent coordinates all roles; agents pick up tasks from a shared board and run until stopped. -->
|
|
2
2
|
|
|
3
|
+
> **DEPRECATED (2026-07): superseded by `monomind org run <name>` (SDK org runtime v2).**
|
|
4
|
+
> This prompt-orchestrated path has no delivery guarantees and no ground-truth event stream.
|
|
5
|
+
> It remains only for orgs not yet migrated. New orgs MUST use the daemon.
|
|
6
|
+
|
|
3
7
|
**If $ARGUMENTS is empty:** List saved orgs and display the following.
|
|
4
8
|
|
|
5
9
|
---
|
|
@@ -105,6 +105,39 @@ function probeStatus(p) {
|
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
const LOCK_FILE = path.join(CWD, '.monomind', 'control.lock');
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Atomically claim the spawn lock. Concurrent hook events (a busy session can
|
|
112
|
+
* fire dozens of control-starts at once) must not each spawn a server — the
|
|
113
|
+
* loser processes exit and let the winner's server come up. A stale lock
|
|
114
|
+
* (dead pid or older than 30s) is broken and re-claimed.
|
|
115
|
+
*/
|
|
116
|
+
function claimSpawnLock() {
|
|
117
|
+
try { fs.mkdirSync(path.dirname(LOCK_FILE), { recursive: true }); } catch { /* ignore */ }
|
|
118
|
+
try {
|
|
119
|
+
fs.writeFileSync(LOCK_FILE, String(process.pid), { flag: 'wx' });
|
|
120
|
+
return true;
|
|
121
|
+
} catch {
|
|
122
|
+
try {
|
|
123
|
+
const stat = fs.statSync(LOCK_FILE);
|
|
124
|
+
const holder = Number(fs.readFileSync(LOCK_FILE, 'utf-8'));
|
|
125
|
+
if (Date.now() - stat.mtimeMs < 30_000 && isPidAlive(holder)) return false;
|
|
126
|
+
fs.unlinkSync(LOCK_FILE);
|
|
127
|
+
fs.writeFileSync(LOCK_FILE, String(process.pid), { flag: 'wx' });
|
|
128
|
+
return true;
|
|
129
|
+
} catch {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function releaseSpawnLock() {
|
|
136
|
+
try {
|
|
137
|
+
if (Number(fs.readFileSync(LOCK_FILE, 'utf-8')) === process.pid) fs.unlinkSync(LOCK_FILE);
|
|
138
|
+
} catch { /* ignore */ }
|
|
139
|
+
}
|
|
140
|
+
|
|
108
141
|
async function main() {
|
|
109
142
|
// If already running, do nothing
|
|
110
143
|
const status = readStatus();
|
|
@@ -125,6 +158,21 @@ async function main() {
|
|
|
125
158
|
}
|
|
126
159
|
}
|
|
127
160
|
|
|
161
|
+
if (!claimSpawnLock()) {
|
|
162
|
+
process.stdout.write('[control] another control-start is already spawning the server — skipping\n');
|
|
163
|
+
process.exit(0);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Test hook: exercise the full flow without leaving a real detached server
|
|
167
|
+
// behind (the test suite spawns this script dozens of times per run — real
|
|
168
|
+
// spawns leaked hundreds of orphan servers on isolated ports).
|
|
169
|
+
if (process.env.MONOMIND_CONTROL_NO_SPAWN === '1') {
|
|
170
|
+
writeStatus(process.pid, DEFAULT_PORT);
|
|
171
|
+
process.stdout.write(`[control] started Neural Control Room on port ${DEFAULT_PORT} (pid ${process.pid}) [no-spawn]\n`);
|
|
172
|
+
releaseSpawnLock();
|
|
173
|
+
process.exit(0);
|
|
174
|
+
}
|
|
175
|
+
|
|
128
176
|
const { cmd, args, usePort } = findCliPath();
|
|
129
177
|
// server.mjs accepts port as second positional arg; CLI uses 'ui --no-open --port N'
|
|
130
178
|
const allArgs = usePort
|
|
@@ -159,9 +207,9 @@ async function main() {
|
|
|
159
207
|
});
|
|
160
208
|
}
|
|
161
209
|
|
|
162
|
-
// Give the server up to ~
|
|
210
|
+
// Give the server up to ~10 s to start, then confirm the actual port.
|
|
163
211
|
async function confirmPort() {
|
|
164
|
-
for (let attempt = 0; attempt <
|
|
212
|
+
for (let attempt = 0; attempt < 20; attempt++) {
|
|
165
213
|
await new Promise(r => setTimeout(r, 500));
|
|
166
214
|
for (let delta = 0; delta <= 10; delta++) {
|
|
167
215
|
const p = DEFAULT_PORT + delta;
|
|
@@ -174,11 +222,15 @@ async function main() {
|
|
|
174
222
|
}
|
|
175
223
|
}
|
|
176
224
|
}
|
|
177
|
-
// Server
|
|
178
|
-
|
|
225
|
+
// Server never became reachable on any expected port — kill the child
|
|
226
|
+
// rather than leave an orphan bound to some port nothing will ever read.
|
|
227
|
+
// The next session-start simply retries.
|
|
228
|
+
try { process.kill(child.pid, 'SIGTERM'); } catch { /* already gone */ }
|
|
229
|
+
try { fs.unlinkSync(STATUS_FILE); } catch { /* ignore */ }
|
|
230
|
+
process.stdout.write('[control] server did not respond within 10 s — killed orphan, will retry next session\n');
|
|
179
231
|
}
|
|
180
232
|
|
|
181
|
-
confirmPort().catch(() => {}).finally(() => process.exit(0));
|
|
233
|
+
confirmPort().catch(() => {}).finally(() => { releaseSpawnLock(); process.exit(0); });
|
|
182
234
|
}
|
|
183
235
|
|
|
184
236
|
main().catch(() => process.exit(0));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monoes/monomindcli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
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",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"README.md"
|
|
81
81
|
],
|
|
82
82
|
"scripts": {
|
|
83
|
-
"build": "tsc --noEmitOnError false || true && mkdir -p dist/src/browser/dashboard && cp src/browser/dashboard/ui.html dist/src/browser/dashboard/ui.html",
|
|
83
|
+
"build": "tsc --noEmitOnError false || true && mkdir -p dist/src/browser/dashboard && cp src/browser/dashboard/ui.html dist/src/browser/dashboard/ui.html && mkdir -p dist/src/orgrt && cp src/orgrt/live.html dist/src/orgrt/",
|
|
84
84
|
"test": "vitest run",
|
|
85
85
|
"test:pattern-store": "npx tsx src/transfer/store/tests/standalone-test.ts",
|
|
86
86
|
"prepublishOnly": "cp ../../../README.md ./README.md",
|