-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathecosystem.config.js
More file actions
235 lines (221 loc) · 6.65 KB
/
ecosystem.config.js
File metadata and controls
235 lines (221 loc) · 6.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
/**
* PM2 Ecosystem Configuration for CODEC
*
* Usage:
* pm2 start ecosystem.config.js # Start all services
* pm2 start ecosystem.config.js --only codec-dashboard # Start one service
* pm2 stop ecosystem.config.js # Stop all
* pm2 restart ecosystem.config.js # Restart all
*
* Requires: Python 3.10+, mlx-lm, whisper, kokoro installed
*/
module.exports = {
apps: [
// ── Core CODEC (voice + text agent) ──
{
name: "codec",
script: "python3",
args: "codec.py",
cwd: __dirname,
max_memory_restart: "512M",
restart_delay: 3000,
max_restarts: 10,
autorestart: true,
},
// ── Dashboard API (FastAPI on :8090) ──
{
name: "codec-dashboard",
script: "python3",
args: "-m uvicorn codec_dashboard:app --host 0.0.0.0 --port 8090",
cwd: __dirname,
max_memory_restart: "256M",
restart_delay: 2000,
max_restarts: 15,
autorestart: true,
},
// ── CODEC MCP HTTP bridge (remote Claude access via Cloudflare) ──
{
name: "codec-mcp-http",
script: "/usr/local/bin/python3.13",
args: "codec_mcp_http.py",
cwd: __dirname,
env: {
CODEC_MCP_HTTP_HOST: "127.0.0.1",
CODEC_MCP_HTTP_PORT: "8091",
},
max_memory_restart: "512M",
restart_delay: 3000,
max_restarts: 10,
autorestart: true,
},
// ── Dictation & hotkey listener (keyboard shortcuts, wake word) ──
// NOTE: codec-heartbeat and codec-scheduler are unified into codec-dashboard
{
name: "codec-dictate",
script: "/usr/local/bin/python3.13",
args: "-u codec_dictate.py",
cwd: __dirname,
max_memory_restart: "768M",
restart_delay: 2000,
max_restarts: 10,
autorestart: true,
},
// ── MCP Server (tool integration) ──
{
name: "codec-mcp",
script: "python3",
args: "codec_mcp.py",
cwd: __dirname,
max_memory_restart: "128M",
restart_delay: 3000,
max_restarts: 10,
autorestart: true,
},
// ── LLM Server (Qwen via mlx_lm) ──
{
name: "qwen35b",
script: "bash",
args: "-c 'python3 -m mlx_lm.server --model mlx-community/Qwen3.5-35B-A3B-4bit --port 8081'",
cwd: __dirname,
max_memory_restart: "8G",
restart_delay: 10000,
max_restarts: 5,
autorestart: true,
},
// ── Vision Model Server ──
{
name: "qwen-vision",
script: "bash",
args: "-c 'python3 -m mlx_lm.server --model mlx-community/Qwen2.5-VL-7B-Instruct-4bit --port 8082'",
cwd: __dirname,
max_memory_restart: "4G",
restart_delay: 10000,
max_restarts: 5,
autorestart: true,
},
// ── Whisper STT Server ──
{
name: "whisper-stt",
script: "python3",
args: "whisper_server.py",
cwd: __dirname,
max_memory_restart: "1G",
restart_delay: 5000,
max_restarts: 5,
autorestart: true,
},
// ── Kokoro TTS Server ──
{
name: "kokoro-82m",
script: "python3",
args: "kokoro_server.py",
cwd: __dirname,
max_memory_restart: "512M",
restart_delay: 5000,
max_restarts: 5,
autorestart: true,
},
// ── iMessage Integration (polls Messages DB, replies via CODEC) ──
{
name: "codec-imessage",
script: "bash",
args: "-c 'python3 codec_imessage.py'",
cwd: __dirname,
max_memory_restart: "128M",
restart_delay: 5000,
max_restarts: 10,
autorestart: true,
},
// ── Telegram Bot (CODEC via Telegram) ──
{
name: "codec-telegram",
script: "bash",
args: "-c 'python3 codec_telegram.py'",
cwd: __dirname,
max_memory_restart: "128M",
restart_delay: 5000,
max_restarts: 10,
autorestart: true,
},
// ── Autopilot (ambient scheduler — fires skills at configured times) ──
{
name: "codec-autopilot",
script: "/usr/local/bin/python3.13",
args: "-u codec_autopilot.py",
cwd: __dirname,
max_memory_restart: "128M",
restart_delay: 5000,
max_restarts: 10,
autorestart: true,
},
// ── Watchdog (kills stuck/zombie processes hogging RAM) ──
{
name: "codec-watchdog",
script: "python3",
args: "codec_watchdog.py",
cwd: __dirname,
max_memory_restart: "64M",
restart_delay: 5000,
max_restarts: 10,
autorestart: true,
},
// ── Observer (Phase 2 Step 5 — continuous observation loop) ──
// Polls active_window + screenshot OCR + clipboard delta + recent
// files into a 10-min RAM-only ring buffer. Cadence: 60s active /
// 5min idle (per Q1 + Q4). Kill switch: OBSERVER_ENABLED=false.
// METADATA-ONLY audit emits — no titles, no OCR text, no clipboard
// content, no file paths leaked to ~/.codec/audit.log.
{
name: "codec-observer",
script: "/usr/local/bin/python3.13",
args: "-u codec_observer.py",
cwd: __dirname,
max_memory_restart: "128M",
restart_delay: 5000,
max_restarts: 10,
autorestart: true,
env: {
OBSERVER_ENABLED: "true",
},
},
// ── Pilot Runner (browser automation HTTP API on :8094) ──
// Headless Chromium on CDP port 9223, indexed-DOM snapshots,
// screencast recording. Cloudflare: pilot.lucyvpa.com → :8094
{
name: "pilot-runner",
script: "/usr/local/bin/python3.13",
args: "-m pilot.pilot_runner",
cwd: "/Users/mickaelfarina/codec",
max_memory_restart: "512M",
restart_delay: 5000,
max_restarts: 10,
autorestart: true,
env: {
HEADLESS: "1",
PYTHONUNBUFFERED: "1",
},
},
// ── Agent Runner (Phase 3 Step 9 — autonomous plan execution) ──
// PM2 daemon picks up status=approved plans (from Step 8), executes
// their checkpoints autonomously via Qwen-3.6 ↔ skill loops with
// permission gate enforcement. Resume after PM2 restart from last
// atomic checkpoint (Q5). Multi-agent cap = 3 concurrent (Q6, Q8).
// Plan-hash tamper detection at run start (Q13).
// Kill switch: AGENT_RUNNER_ENABLED=false (daemon idles).
{
name: "codec-agent-runner",
script: "/usr/local/bin/python3.13",
args: "-u codec_agent_runner.py",
cwd: __dirname,
max_memory_restart: "256M",
restart_delay: 5000,
max_restarts: 10,
autorestart: true,
env: {
AGENT_RUNNER_ENABLED: "true",
AGENT_RUNNER_MAX_CONCURRENT: "3",
PYTHONUNBUFFERED: "1",
},
},
],
};