@monoes/monomindcli 1.18.12 → 1.18.15

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": "@monoes/monomindcli",
3
- "version": "1.18.12",
3
+ "version": "1.18.15",
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",
@@ -1,79 +0,0 @@
1
- # server.mjs Modularization Plan
2
-
3
- ## Current State
4
- - server.mjs: 5,185 lines (target: <500 per module)
5
- - dashboard.html: 12,558 lines
6
- - No tests; monolithic structure
7
- - Location: `packages/@monomind/cli/dist/src/ui/`
8
-
9
- ## Why This File (Not `src/browser/dashboard/server.ts`)
10
- `server.mjs` is a hand-written source (not a TypeScript build output).
11
- `src/browser/dashboard/server.ts` (206 lines) is a separate, smaller monobrowse
12
- dashboard — already within size limits. The modularization target is exclusively
13
- `dist/src/ui/server.mjs`.
14
-
15
- ## Proposed Module Boundaries
16
-
17
- ### Module 1: `sse-manager.mjs` — SSE client registries + broadcasting **[EXTRACTED]**
18
- - Owns: `sseClients` Set, `mmSseClients` Set
19
- - Exports: `addSseClient`, `removeSseClient`, `broadcast`, `addMmClient`,
20
- `removeMmClient`, `broadcastMm`, `closeSseClients`, `getSseClientCount`,
21
- `getMmClientCount`
22
- - Dependencies: none (pure state + HTTP response objects)
23
- - Estimated size: ~60 lines
24
- - Callers in server.mjs: 15 call-sites across broadcast, add, delete, size
25
-
26
- ### Module 2: `org-routes.mjs` (org CRUD API handlers)
27
- - Extracts: `GET /api/orgs`, `GET /api/orgs/:name`, `POST /api/orgs`,
28
- `POST /api/orgs/:name/import`, plus the 30+ `GET /api/org/:name/*` sub-routes
29
- (activity, projects, members, adapters, skills, agents, health, budgets, etc.)
30
- - Dependencies: fs, path, os, sse-manager (broadcastMm), activeOrgRuns,
31
- activeSessionsByOrg
32
- - Estimated size: ~900 lines (could be split further into org-crud.mjs +
33
- org-detail.mjs if needed)
34
-
35
- ### Module 3: `mastermind-routes.mjs` (mastermind session management)
36
- - Extracts: `POST /api/mastermind/event` handler (`handleMastermindEvent`),
37
- `GET /api/mastermind-stream` SSE endpoint, `GET /api/mastermind/sessions`,
38
- `GET /api/mastermind/session/:id`, session JSONL parser
39
- - Dependencies: fs, path, os, sse-manager (addMmClient, removeMmClient,
40
- broadcastMm), activeOrgRuns, activeSessionsByOrg
41
- - Estimated size: ~350 lines
42
-
43
- ### Module 4: `data-routes.mjs` (data collection API handlers)
44
- - Extracts: `GET /api/stream` (main SSE), `GET /api/data`, `GET /api/graph`,
45
- `GET /api/events-stream`, `GET /api/monograph`, file watcher setup
46
- - Dependencies: collector.mjs, sse-manager (addSseClient, removeSseClient,
47
- broadcast), fs, path
48
- - Estimated size: ~250 lines
49
-
50
- ### Module 5: `static-handler.mjs` (static file serving + HTML responses)
51
- - Extracts: dashboard HTML serving at `/`, MASTERMIND_DIAGRAM_HTML constant,
52
- `GET /api/mastermind` static route, favicon
53
- - Dependencies: fs, path
54
- - Estimated size: ~60 lines
55
-
56
- ## Migration Sequence
57
- 1. Extract sse-manager.mjs — no breaking changes, just moves state ownership
58
- 2. Update server.mjs to import from sse-manager.mjs (15 call-sites)
59
- 3. Extract mastermind-routes.mjs (natural boundary around mastermind feature)
60
- 4. Extract org-routes.mjs (largest chunk; may split into org-crud + org-detail)
61
- 5. Extract data-routes.mjs (collector.mjs integration)
62
- 6. Extract static-handler.mjs (trivial, last)
63
- 7. server.mjs becomes: imports, server setup, watcher, shutdown, startServer()
64
- (~300 lines remaining)
65
-
66
- ## Safety Rules
67
- - Never change exported function signatures: `startServer()`, `getServerStatus()`
68
- - Never change API route paths or response shapes
69
- - Each extraction: `node --check <file.mjs>` syntax gate before committing
70
- - Keep activeOrgRuns and activeSessionsByOrg in server.mjs until org-routes
71
- and mastermind-routes are extracted (they are co-dependencies)
72
- - Maintain backward-compat: dashboard.html SSE reconnect uses `/api/stream`
73
-
74
- ## Progress
75
- - [x] Module 1: sse-manager.mjs extracted (commit: TBD)
76
- - [ ] Module 2: org-routes.mjs
77
- - [ ] Module 3: mastermind-routes.mjs
78
- - [ ] Module 4: data-routes.mjs
79
- - [ ] Module 5: static-handler.mjs