ai-agent-command-center 0.0.0-stage → 1.0.0

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.
Files changed (86) hide show
  1. package/.env.example +20 -0
  2. package/LICENSE +21 -0
  3. package/README.md +402 -2
  4. package/bin/ai-center.js +183 -0
  5. package/client/dist/assets/index-BRl_ORtB.css +1 -0
  6. package/client/dist/assets/index-CLhAmxoi.js +4444 -0
  7. package/client/dist/icon-192.png +0 -0
  8. package/client/dist/icon-512.png +0 -0
  9. package/client/dist/icon.svg +43 -0
  10. package/client/dist/index.html +31 -0
  11. package/client/dist/manifest.webmanifest +30 -0
  12. package/client/dist/sw.js +75 -0
  13. package/package.json +66 -4
  14. package/server/.env.example +9 -0
  15. package/server/dist/server/src/adapters/base.js +4 -0
  16. package/server/dist/server/src/adapters/customApi.js +353 -0
  17. package/server/dist/server/src/adapters/hermes.js +82 -0
  18. package/server/dist/server/src/adapters/preset.js +221 -0
  19. package/server/dist/server/src/adapters/router.js +32 -0
  20. package/server/dist/server/src/config/index.js +9 -0
  21. package/server/dist/server/src/db/index.js +180 -0
  22. package/server/dist/server/src/db/schemaSql.js +522 -0
  23. package/server/dist/server/src/index.js +241 -0
  24. package/server/dist/server/src/middleware/rateLimiter.js +76 -0
  25. package/server/dist/server/src/middleware/securityHeaders.js +21 -0
  26. package/server/dist/server/src/routes/actions.js +79 -0
  27. package/server/dist/server/src/routes/activities.js +35 -0
  28. package/server/dist/server/src/routes/agents.js +354 -0
  29. package/server/dist/server/src/routes/alerts.js +174 -0
  30. package/server/dist/server/src/routes/auth.js +138 -0
  31. package/server/dist/server/src/routes/dashboard.js +41 -0
  32. package/server/dist/server/src/routes/dataAnalyst.js +90 -0
  33. package/server/dist/server/src/routes/documents.js +242 -0
  34. package/server/dist/server/src/routes/domain.js +58 -0
  35. package/server/dist/server/src/routes/evals.js +56 -0
  36. package/server/dist/server/src/routes/mcp.js +160 -0
  37. package/server/dist/server/src/routes/memoryGraph.js +91 -0
  38. package/server/dist/server/src/routes/monitoring.js +41 -0
  39. package/server/dist/server/src/routes/notifications.js +88 -0
  40. package/server/dist/server/src/routes/orchestrator.js +54 -0
  41. package/server/dist/server/src/routes/pipeline.js +261 -0
  42. package/server/dist/server/src/routes/playground.js +91 -0
  43. package/server/dist/server/src/routes/projects.js +183 -0
  44. package/server/dist/server/src/routes/providers.js +403 -0
  45. package/server/dist/server/src/routes/rag.js +118 -0
  46. package/server/dist/server/src/routes/reports.js +123 -0
  47. package/server/dist/server/src/routes/schedules.js +165 -0
  48. package/server/dist/server/src/routes/skills.js +102 -0
  49. package/server/dist/server/src/routes/sre.js +84 -0
  50. package/server/dist/server/src/routes/swarm.js +165 -0
  51. package/server/dist/server/src/routes/system.js +199 -0
  52. package/server/dist/server/src/routes/tasks.js +314 -0
  53. package/server/dist/server/src/routes/warRooms.js +113 -0
  54. package/server/dist/server/src/routes/webResearch.js +60 -0
  55. package/server/dist/server/src/routes/webhooks.js +102 -0
  56. package/server/dist/server/src/routes/workflows.js +168 -0
  57. package/server/dist/server/src/services/actionManager.js +246 -0
  58. package/server/dist/server/src/services/alertingService.js +289 -0
  59. package/server/dist/server/src/services/dataAnalystService.js +463 -0
  60. package/server/dist/server/src/services/documentParserService.js +205 -0
  61. package/server/dist/server/src/services/domainManagerService.js +286 -0
  62. package/server/dist/server/src/services/embedding.js +178 -0
  63. package/server/dist/server/src/services/evalService.js +359 -0
  64. package/server/dist/server/src/services/logger.js +61 -0
  65. package/server/dist/server/src/services/mcpClientService.js +518 -0
  66. package/server/dist/server/src/services/memoryGraphService.js +545 -0
  67. package/server/dist/server/src/services/monitoring.js +90 -0
  68. package/server/dist/server/src/services/orchestrator.js +463 -0
  69. package/server/dist/server/src/services/ragService.js +308 -0
  70. package/server/dist/server/src/services/realtime.js +74 -0
  71. package/server/dist/server/src/services/sandbox.js +673 -0
  72. package/server/dist/server/src/services/schedulerService.js +548 -0
  73. package/server/dist/server/src/services/skillStudioService.js +366 -0
  74. package/server/dist/server/src/services/sreAgentService.js +405 -0
  75. package/server/dist/server/src/services/swarmArtifactService.js +258 -0
  76. package/server/dist/server/src/services/swarmService.js +623 -0
  77. package/server/dist/server/src/services/warRoomService.js +461 -0
  78. package/server/dist/server/src/services/webResearchService.js +295 -0
  79. package/server/dist/server/src/services/workflowEngine.js +611 -0
  80. package/server/dist/server/src/utils/auth.js +33 -0
  81. package/server/dist/server/src/utils/crypto.js +55 -0
  82. package/server/dist/server/src/utils/ssrf.js +112 -0
  83. package/server/dist/shared/constants.js +113 -0
  84. package/server/dist/shared/types.js +5 -0
  85. package/shared/constants.ts +129 -0
  86. package/shared/types.ts +1360 -0
package/.env.example ADDED
@@ -0,0 +1,20 @@
1
+ # ==============================================================================
2
+ # AI Agent Command Center — Environment Configuration Template
3
+ # Copy this file to .env and configure your local or production secrets.
4
+ # DO NOT commit real secrets or production passwords to version control!
5
+ # ==============================================================================
6
+
7
+ # Application Server Port
8
+ PORT=3000
9
+
10
+ # Runtime Environment (development | production | test)
11
+ NODE_ENV=production
12
+
13
+ # PostgreSQL Connection String (PostgreSQL 16 with pgvector extension)
14
+ DATABASE_URL=postgres://routex:your_db_password_here@127.0.0.1:5432/ai_center?sslmode=disable
15
+
16
+ # AES-256-GCM Encryption Key for Model Provider API Keys (Must be >= 32 characters)
17
+ ENCRYPTION_KEY=replace-with-your-secure-32-character-secret-key-here!
18
+
19
+ # Default HQ Workspace Identifier
20
+ DEFAULT_WORKSPACE_ID=ws-default-command-center
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 NexGen-X / Antigravity AI Center
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,403 @@
1
- # Temporary Holding Version
1
+ <div align="center">
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ ```text
4
+ _ ___ ____ _
5
+ / \ |_ _| / ___|___ _ __ ___ _ __ ___ __ _ _ __ __| |
6
+ / _ \ | | | | / _ \| '_ ` _ \| '_ ` _ \ / _` | '_ \ / _` |
7
+ / ___ \ | | | |__| (_) | | | | | | | | | | | (_| | | | | (_| |
8
+ /_/ \_\___| \____\___/|_| |_| |_|_| |_| |_|\__,_|_| |_|\__,_|
9
+
10
+ C E N T E R • A U T O N O M O U S S W A R M O S
11
+ ```
12
+
13
+ # 🪐 AI Agent Command Center
14
+
15
+ ### *Next-Generation Spatial 3D/2D Orchestration Bridge & Autonomous Multi-Agent Swarm OS*
16
+
17
+ [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/NexGen-X/Ai-Center-Workspace/ci.yml?branch=main&label=CI%20Quality%20Gate&logo=github&style=for-the-badge)](https://github.com/NexGen-X/Ai-Center-Workspace/actions)
18
+ [![Tests Passing](https://img.shields.io/badge/TESTS-209%20PASSED%20%2F%20100%25-00FF66?style=for-the-badge&logo=vitest&logoColor=white)](https://github.com/NexGen-X/Ai-Center-Workspace/actions)
19
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.4.5-3178C6?style=for-the-badge&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
20
+ [![Node.js](https://img.shields.io/badge/Node.js-20+-339933?style=for-the-badge&logo=node.js&logoColor=white)](https://nodejs.org/)
21
+ [![PostgreSQL](https://img.shields.io/badge/PostgreSQL%2016-pgvector%20HNSW-4169E1?style=for-the-badge&logo=postgresql&logoColor=white)](https://github.com/pgvector/pgvector)
22
+ [![Three.js](https://img.shields.io/badge/Three.js-WebGL%203D%20Spatial-black?style=for-the-badge&logo=three.js&logoColor=white)](https://threejs.org/)
23
+ [![License: MIT](https://img.shields.io/badge/License-MIT-9945FF?style=for-the-badge)](LICENSE)
24
+
25
+ <br/>
26
+
27
+ **AI Agent Command Center** is an enterprise-grade, cyberpunk-inspired operational bridge designed to coordinate, deliberate with, and observe autonomous multi-agent teams. Built with a fullstack reactive architecture, Three.js 3D spatial simulation, PostgreSQL 16 with native pgvector HNSW indexing, and an auto-provisioning Caddy reverse proxy, it transforms disjointed LLM chats into a cohesive, self-healing, mission-driven AI workforce.
28
+
29
+ [Explore Features](#-capabilities-matrix) • [Architecture](#-system-architecture) • [Security & Hardening](#-enterprise-hardening--zero-trust) • [Quickstart](#-quickstart--local-development) • [Production Runbook](#-production-deployment)
30
+
31
+ </div>
32
+
33
+ ---
34
+
35
+ ## ⚡ The Paradigm Shift: Why AI Command Center?
36
+
37
+ Most developer tools approach LLMs through fragmented chat windows or opaque command-line scripts. **AI Agent Command Center** introduces an operational operating system where agents function like a battle-tested engineering division:
38
+
39
+ | Dimension | Standard Chat UIs (ChatGPT, LibreChat) | Scripting Frameworks (CrewAI, AutoGen CLI) | 🪐 AI Agent Command Center |
40
+ | :--- | :---: | :---: | :---: |
41
+ | **Spatial Observation** | Single thread | Terminal output only | **Immersive 3D Bridge (WebGL) + 2D Resilient Canvas** |
42
+ | **Consensus Engine** | ❌ None | Basic linear routing | **War Room Formal Deliberations & Synthesis** |
43
+ | **Memory Subsystem** | Ephemeral context window | Simple key-value store | **Cognitive Vector Graph (pgvector HNSW Cosine Cluster)** |
44
+ | **Execution Safety** | ❌ No native sandbox | Raw host execution | **CWD-Confined Sandbox + Anti-SSRF + Clean Env** |
45
+ | **Infrastructure SRE** | ❌ None | ❌ None | **Autonomous SRE Sentinel & Self-Healing Loop** |
46
+ | **Data Analytics** | Raw code blocks | Textual tables | **Natural SQL Engine with Dynamic Recharts Visualizer** |
47
+ | **Automated Deliverables**| Copy-paste snippets | Local folder writes | **Automated Git Branching, Commits & PR Synthesis** |
48
+ | **Edge Domain & SSL** | Manual Nginx/Certbot | ❌ None | **Hostinger & Cloudflare Auto-Provisioning (Caddy)** |
49
+ | **Zero-Regression CI** | Variable | Partial | **100% Pass Rate (209/209 Tests on PostgreSQL Service)** |
50
+
51
+ ---
52
+
53
+ ## 🏛️ System Architecture
54
+
55
+ ```mermaid
56
+ flowchart TD
57
+ subgraph Edge ["🌐 Edge & Ingress Layer (Caddy Reverse Proxy)"]
58
+ CaddyIn["Ports :80, :443, :8088, :8443 (Zstandard / Brotli)"]
59
+ DNSAuto["Automated Domain Provisioner (/etc/caddy/custom_domains.caddy)"]
60
+ CFProxy["Cloudflare Orange Cloud & Hostinger Direct DNS Resolver"]
61
+ end
62
+
63
+ subgraph ClientLayer ["🖥️ Spatial Frontend Layer (React 18 + Vite + Three.js)"]
64
+ Canvas3D["3D Virtual Command Bridge (WebGL, Particle Telemetry, Orbit Controls)"]
65
+ Canvas2D["2D Resilient Grid Fallback (Touch-Optimized / Low-Spec Hardware)"]
66
+ SSEStream["Real-time Server-Sent Events (SSE) Listener (:25s Heartbeat)"]
67
+ Modals["Feature Studios (War Room, Memory Graph, SRE Sentinel, Data Analyst)"]
68
+ end
69
+
70
+ subgraph CoreBackend ["⚡ Backend Core (Node.js 20+ Express ESM)"]
71
+ SecMW["HTTP Hardening (HSTS, nosniff, SAMEORIGIN, no X-Powered-By)"]
72
+ RateLimiter["Adaptive Sliding-Window Rate Limiters (Auth: 15/m, Compute: 30/m, API: 300/m)"]
73
+ ProxyTrust["Reverse Proxy Real-IP Trust (X-Forwarded-For)"]
74
+
75
+ subgraph AutonomousEngines ["🧠 Autonomous Agent Engines"]
76
+ Orchestrator["Nexus Prime: Swarm DAG Decomposer & Task Runner"]
77
+ WarRoomEngine["Multi-Agent Deliberation & Counter-Argument Engine"]
78
+ SREAgent["Atlas Sentinel: Continuous Telemetry & Incident Remediation"]
79
+ DataAnalyst["Hypatia Engine: NL-to-SQL & Dynamic Analytical Synthesizer"]
80
+ SkillStudio["Skill Studio & Hot-Mounted MCP Tool Registry"]
81
+ end
82
+
83
+ subgraph SecurityJail ["🛡️ Zero-Trust Security Jail"]
84
+ SandboxCore["CWD Sandbox Isolation (Directory Escape Prevention)"]
85
+ EnvSanitizer["Subshell Environment Stripper (Zero Secret Leaking)"]
86
+ SSRFValidator["Canonical Anti-SSRF (Private Subnet & Cloud Metadata Blocker)"]
87
+ end
88
+ end
89
+
90
+ subgraph StorageLayer ["🗄️ Resilient Storage & Disaster Recovery"]
91
+ PGDB[("PostgreSQL 16 Database (Connection Pool max: 20, statement_timeout: 30s)")]
92
+ PGV["pgvector Extension (768-dim Embeddings, HNSW Cosine Indexing)"]
93
+ BackupDaemon["Automated Disaster Recovery (/var/backups/ai-center daily 02:30 UTC, gzip -9)"]
94
+ end
95
+
96
+ Edge <-->|Encrypted HTTPS / SSE Stream| ClientLayer
97
+ Edge <-->|Internal Proxy 127.0.0.1:3000| CoreBackend
98
+ CoreBackend --> SecurityJail
99
+ SecurityJail -->|Safe Tool Calling: bash_exec, file_read, http_fetch| CoreBackend
100
+ CoreBackend <-->|Optimized Relational Queries & Vector Similarities| StorageLayer
101
+ StorageLayer -.-> BackupDaemon
102
+ ```
103
+
104
+ ---
105
+
106
+ ## 🤖 The Autonomous AI Division (Core Agent Archetypes)
107
+
108
+ AI Command Center comes pre-configured with a specialized hierarchy of autonomous agents:
109
+
110
+ ```text
111
+ ╔═══════════════════════════════════════════════════════════════════════════════════╗
112
+ ║ NEXUS PRIME (Lead Orchestrator) ║
113
+ ║ Decomposes high-level objectives into topological DAG pipelines ║
114
+ ╚═══════════════════════════════════════════════════════════════════════════════════╝
115
+ │ │
116
+ ▼ ▼
117
+ ╔═════════════════════════════╗ ╔═════════════════════════════════════╗
118
+ ║ ATHENA STRATOS (Planner) ║ ║ VULCAN FORGE (Executor) ║
119
+ ║ Formulates dependency maps, ║ ║ Hardened tool execution, sandbox ║
120
+ ║ milestones, and criteria ║ ║ file ops, and automated pipelines ║
121
+ ╚═════════════════════════════╝ ╚═════════════════════════════════════╝
122
+ │ │
123
+ ▼ ▼
124
+ ╔═════════════════════════════╗ ╔═════════════════════════════════════╗
125
+ ║ AEGIS SENTINEL (QA Review) ║ ║ ATLAS DEVOPS (SRE Sentinel) ║
126
+ ║ "No Evidence = No Acceptance║ ║ Continuous host telemetry auditing, ║
127
+ ║ Independent empirical audit ║ ║ self-healing, and memory protection ║
128
+ ╚═════════════════════════════╝ ╚═════════════════════════════════════╝
129
+ ```
130
+
131
+ ---
132
+
133
+ ## 🔮 Capabilities Matrix
134
+
135
+ ### 1. 🪐 Spatial 3D Command Bridge & 2D Fallback
136
+ - **Holographic Workspace**: Real-time Three.js WebGL canvas displaying agents stationed at active terminals with glowing activity rings, pulsating particle connections, and status halos.
137
+ - **Fail-Safe Hardware Adaptability**: Automatically measures WebGL capability; seamlessly switches to a lightweight 2D interactive grid on mobile browsers or constrained headless environments.
138
+
139
+ ### 2. 🐝 Autonomous Swarm Orchestrator & DAG Execution
140
+ - **Multi-Stage Decomposition**: Breaks down broad objectives into Directed Acyclic Graphs (DAGs) executed sequentially or in parallel by role-assigned agents.
141
+ - **Automated Deliverables**: Compiles unified git diff patches, generates formatted Markdown reports, and automates Git branch creation and commits (`docs/swarm-reports/mission-{id}.md`).
142
+ - **Mission Crash Recovery**: State persistence guarantees that interrupted missions resume seamlessly upon server reboot without duplicated subtasks.
143
+
144
+ ### 3. ⚔️ War Room Multi-Perspective Deliberation Engine
145
+ - **Cross-Agent Socratic Debates**: Pit specialized agents against one another (e.g., Performance vs. Strict Security vs. Usability).
146
+ - **Consensus & Trade-off Synthesis**: Generates formal decision records documenting consensus recommendations, architectural compromises, and actionable checklists.
147
+
148
+ ### 4. 🧠 Cognitive Memory Graph (pgvector HNSW)
149
+ - **Semantic Vector Association**: Transforms agent thoughts, lessons learned, and execution outputs into 768-dimensional vector embeddings stored in PostgreSQL with pgvector.
150
+ - **Cosine Distance Clustering**: Connects disparate memories across projects and agents with dynamic cosine similarity thresholds (`<->`).
151
+ - **Institutional Memory Sharing**: Agents automatically retrieve relevant prior decisions before embarking on new tasks.
152
+
153
+ ### 5. 🛠️ Skill Studio & Model Context Protocol (MCP)
154
+ - **Hot-Mountable Capabilities**: Create, parameterize, and test specialized agent skills on the fly without server downtime.
155
+ - **Native MCP Ecosystem**: Integrates with Model Context Protocol servers to query file outlines, database schemas, and external tool registries.
156
+
157
+ ### 6. 🚨 Autonomous SRE Sentinel & Self-Healing Loop
158
+ - **Proactive Health Auditing**: Continuous host inspection monitoring CPU saturation, RAM thresholds, disk usage, and PostgreSQL query latencies.
159
+ - **Self-Healing Actions**: Automatically flushes lingering zombie processes, terminates orphaned worker sockets, and defragments storage.
160
+ - **Automated Post-Mortem Generation**: Synthesizes root-cause timelines and mitigation strategies following any system anomaly.
161
+
162
+ ### 7. 📊 Data Analyst Studio & Natural SQL Visualization
163
+ - **Natural Language to Parameterized SQL**: Translates human prompts into safe analytical SQL against internal metrics and databases.
164
+ - **Dynamic Charting Engine**: Automatically selects the best visual representation (Bar, Line, Area, Pie) and renders reactive charts.
165
+ - **Automated Statistical Insights**: Synthesizes anomalies, trends, and business takeaways from query results.
166
+
167
+ ### 8. 🌐 Automated Custom Domain & SSL Provisioning
168
+ - **Zero-Friction Ingress**: Support for Hostinger domains, Cloudflare Anycast CIDRs (Orange Cloud Proxy), and Direct DNS A-records.
169
+ - **Dynamic Caddy Sync**: In-app pre-flight DNS validation automates configuration of `/etc/caddy/custom_domains.caddy` with instant Let's Encrypt TLS provisioning.
170
+
171
+ ---
172
+
173
+ ## 🔒 Enterprise Hardening & Zero-Trust
174
+
175
+ Security is not an afterthought in AI Command Center — it is baked into every layer of execution:
176
+
177
+ ```text
178
+ ┌────────────────────────────────────────────────────────────────────────┐
179
+ │ DEFENSE-IN-DEPTH MATRIX │
180
+ ├─────────────────────────┬──────────────────────────────────────────────┤
181
+ │ Perimeter Security │ HSTS (31536000s), nosniff, SAMEORIGIN, │
182
+ │ │ no X-Powered-By fingerprint, trust proxy=1 │
183
+ ├─────────────────────────┼──────────────────────────────────────────────┤
184
+ │ Abuse & DoS Defense │ In-memory Token Sliding Window Limiter: │
185
+ │ │ • Auth: 15 req/min (Brute-force protection) │
186
+ │ │ • Compute: 30 req/min (LLM drain defense) │
187
+ │ │ • Global API: 300 req/min (Flood protection) │
188
+ ├─────────────────────────┼──────────────────────────────────────────────┤
189
+ │ Anti-SSRF Guardrails │ Canonical IP resolver strictly blocks: │
190
+ │ │ • Cloud metadata (169.254.169.254, hex/int) │
191
+ │ │ • RFC 1918 Private subnets (10/8, 172.16/12) │
192
+ │ │ • Loopback probing (127.0.0.1, ::1) │
193
+ ├─────────────────────────┼──────────────────────────────────────────────┤
194
+ │ Sandbox Execution Jail │ • file_read strictly confined to CWD sandbox │
195
+ │ │ • Blocked paths: /etc/, /proc/, .env, id_rsa │
196
+ │ │ • bash_exec env stripped of all secrets │
197
+ ├─────────────────────────┼──────────────────────────────────────────────┤
198
+ │ Cryptographic Standards │ • API Keys encrypted with AES-256-GCM │
199
+ │ │ • Passwords hashed via PBKDF2 + timingSafeEq │
200
+ │ │ • Secrets-Free Repository Guarantee (Scanned)│
201
+ └─────────────────────────┴──────────────────────────────────────────────┘
202
+ ```
203
+
204
+ ---
205
+
206
+ ## 🚀 Quickstart & Local Development
207
+
208
+ ### Prerequisites
209
+ - **Node.js**: `v20.x` or higher
210
+ - **PostgreSQL**: `v16.x` with `pgvector` extension
211
+ - **npm**: `v10.x` or higher
212
+
213
+ ```bash
214
+ # 1. Clone repository
215
+ git clone https://github.com/NexGen-X/Ai-Center-Workspace.git
216
+ cd Ai-Center-Workspace
217
+
218
+ # 2. Install all monorepo dependencies
219
+ npm install
220
+
221
+ # 3. Setup environment configuration
222
+ cp .env.example .env
223
+
224
+ # 4. Start local development (Server & Client concurrently)
225
+ npm run dev:server
226
+ # In a separate terminal:
227
+ npm run dev:client
228
+ ```
229
+ Visit `http://localhost:5173` to access the Command Bridge.
230
+
231
+ ---
232
+
233
+ ## 🚢 Production Deployment
234
+
235
+ ### 1. Build Optimized Production Bundles
236
+ ```bash
237
+ # Builds both TypeScript backend and Vite React frontend
238
+ npm run build
239
+ ```
240
+
241
+ ### 2. Systemd Service Deployment
242
+ Create `/etc/systemd/system/ai-center.service`:
243
+ ```ini
244
+ [Unit]
245
+ Description=AI Agent Command Center Service
246
+ After=network.target postgresql.service
247
+
248
+ [Service]
249
+ Type=simple
250
+ User=root
251
+ WorkingDirectory=/root/Ai-Center-Workspace
252
+ ExecStart=/usr/bin/node /root/Ai-Center-Workspace/server/dist/server/src/index.js
253
+ Restart=always
254
+ RestartSec=3
255
+
256
+ # Graceful termination management
257
+ KillSignal=SIGTERM
258
+ TimeoutStopSec=15
259
+ SendSIGKILL=yes
260
+
261
+ # Logging and identification
262
+ StandardOutput=journal
263
+ StandardError=journal
264
+ SyslogIdentifier=ai-center
265
+
266
+ Environment=PORT=3000
267
+ Environment=NODE_ENV=production
268
+ Environment=DATABASE_URL=postgres://user:password@127.0.0.1:5432/ai_center?sslmode=disable
269
+ Environment=ENCRYPTION_KEY=replace-with-your-secure-32-character-secret-key-here!
270
+ LimitNOFILE=65536
271
+
272
+ [Install]
273
+ WantedBy=multi-user.target
274
+ ```
275
+
276
+ ```bash
277
+ systemctl daemon-reload
278
+ systemctl enable --now ai-center.service
279
+ ```
280
+
281
+ ### 3. Edge Reverse Proxy (Caddy)
282
+ Add the reverse proxy block in `/etc/caddy/Caddyfile`:
283
+ ```caddy
284
+ :80, :443 {
285
+ encode zstd gzip
286
+
287
+ header {
288
+ Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
289
+ X-Frame-Options "SAMEORIGIN"
290
+ X-Content-Type-Options "nosniff"
291
+ Referrer-Policy "strict-origin-when-cross-origin"
292
+ -Server
293
+ }
294
+
295
+ handle {
296
+ reverse_proxy 127.0.0.1:3000 {
297
+ flush_interval -1
298
+ header_up X-Real-Ip {remote_host}
299
+ header_up X-Forwarded-Proto {scheme}
300
+ }
301
+ }
302
+ }
303
+
304
+ import /etc/caddy/custom_domains.caddy
305
+ ```
306
+
307
+ ---
308
+
309
+ ## 💾 Disaster Recovery & Automated Backups
310
+
311
+ AI Center features an automated disaster recovery engine executing daily at **02:30 UTC**:
312
+ - **Script**: `/usr/local/bin/ai-center-backup.sh`
313
+ - **Archive Path**: `/var/backups/ai-center/ai_center_prod_{timestamp}.sql.gz` (`chmod 700`)
314
+ - **Integrity Validation**: Automated `gzip -t` verification upon every dump
315
+ - **Retention**: 14-day rolling rotation with automatic cleanup of expired archives
316
+ - **Cron Definition**: `/etc/cron.d/ai-center-backup`
317
+
318
+ ### One-Command Manual Backup & Restore:
319
+ ```bash
320
+ # Execute manual backup now:
321
+ /usr/local/bin/ai-center-backup.sh
322
+
323
+ # Instant database restore:
324
+ gunzip -c /var/backups/ai-center/ai_center_prod_YYYYMMDD_HHMMSS.sql.gz | psql -U routex -d ai_center
325
+ ```
326
+
327
+ ---
328
+
329
+ ## 📡 REST & Telemetry API Reference
330
+
331
+ | Verb | Path | Purpose | Guardrails |
332
+ | :---: | :--- | :--- | :---: |
333
+ | `GET` | `/healthz` | System uptime & PostgreSQL query latency check | Public |
334
+ | `POST` | `/api/auth/login` | Human operator session authentication | Rate-limited (15/m) |
335
+ | `GET` | `/api/realtime` | Server-Sent Events (SSE) telemetry bus | Keep-Alive (:25s) |
336
+ | `GET` | `/api/agents` | List all active agents & status halos | Session Bearer |
337
+ | `POST` | `/api/swarm/missions` | Dispatch autonomous multi-agent swarm DAG | Rate-limited (30/m) |
338
+ | `POST` | `/api/war-rooms/:id/deliberate` | Trigger formal multi-agent deliberation round | Session Bearer |
339
+ | `GET` | `/api/memory-graph/nodes` | Retrieve cognitive semantic memory network | Session Bearer |
340
+ | `POST` | `/api/skills` | Create and hot-mount a new agent skill | Session Bearer |
341
+ | `GET` | `/api/sre/incidents` | Query autonomous SRE health audits | Session Bearer |
342
+ | `POST` | `/api/data-analyst/execute-sql` | Execute parameterized analytics query | Query Timeout (30s) |
343
+ | `POST` | `/api/system/domain/provision` | Provision custom domain with Caddy TLS | DNS Pre-flight |
344
+ | `GET` | `/api/monitoring/summary` | Live CPU, RAM, Disk, and runtime telemetry | Rate-limited (300/m) |
345
+
346
+ ---
347
+
348
+ ## 🧪 Verification & Quality Gate
349
+
350
+ Every release and commit is validated against a rigorous test suite covering unit contracts, integration pipelines, database resilience, and sandbox boundaries:
351
+
352
+ ```bash
353
+ # Run Vitest test suite across all workspaces
354
+ npm test
355
+ ```
356
+
357
+ ```text
358
+ ✓ tests/rag-memory.spec.ts (13)
359
+ ✓ tests/actions-sandbox.spec.ts (14)
360
+ ✓ tests/schedules.spec.ts (14)
361
+ ✓ tests/skill-studio.spec.ts (9)
362
+ ✓ tests/stability.spec.ts (11)
363
+ ✓ tests/war-room.spec.ts (8)
364
+ ✓ tests/memory-graph.spec.ts (9)
365
+ ✓ tests/workflow-dag.spec.ts (8)
366
+ ✓ tests/data-analyst.spec.ts (9)
367
+ ✓ tests/sre-agent.spec.ts (8)
368
+ ✓ tests/modal-interaction-contracts.spec.ts (6)
369
+ ✓ tests/mcp-client.spec.ts (8)
370
+ ✓ tests/alerting.spec.ts (6)
371
+ ✓ tests/document-parser.spec.ts (6)
372
+ ✓ tests/evals.spec.ts (5)
373
+ ✓ tests/streaming.spec.ts (4)
374
+ ✓ tests/web-research.spec.ts (7)
375
+ ✓ tests/domain-manager.spec.ts (8)
376
+ ✓ tests/ssrf.spec.ts (8)
377
+ ✓ tests/orchestrator-system.spec.ts (4)
378
+ ✓ tests/adapters.spec.ts (3)
379
+ ✓ tests/pipeline.spec.ts (4)
380
+ ✓ tests/playground-webhooks.spec.ts (3)
381
+ ✓ tests/crypto.spec.ts (3)
382
+ ✓ tests/auth.spec.ts (2)
383
+ ✓ tests/api.spec.ts (14)
384
+ ✓ tests/swarm.spec.ts (15)
385
+
386
+ Test Files 27 passed (27)
387
+ Tests 209 passed (209)
388
+ Duration 34.40s
389
+ ```
390
+
391
+ ---
392
+
393
+ ## 🤝 Community & Governance
394
+
395
+ - Review our [CONTRIBUTING.md](CONTRIBUTING.md) for branch strategies, coding standards, and testing expectations.
396
+ - Read our [SECURITY.md](SECURITY.md) for our vulnerability disclosure policy and security audit guarantees.
397
+
398
+ ---
399
+
400
+ ## 📄 License
401
+
402
+ This software is released under the **[MIT License](LICENSE)**.
403
+ Copyright © 2026 **NexGen-X / Antigravity AI Center**. All rights reserved.
@@ -0,0 +1,183 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * AI Agent Command Center — Executable CLI Launcher
5
+ * Autonomous Swarm OS & 3D Spatial Command Bridge
6
+ */
7
+
8
+ import path from 'path';
9
+ import fs from 'fs';
10
+ import os from 'os';
11
+ import { fileURLToPath } from 'url';
12
+ import { exec } from 'child_process';
13
+ import dotenv from 'dotenv';
14
+
15
+ const __filename = fileURLToPath(import.meta.url);
16
+ const __dirname = path.dirname(__filename);
17
+ const packageRoot = path.resolve(__dirname, '..');
18
+
19
+ // Load package metadata
20
+ const pkg = JSON.parse(fs.readFileSync(path.join(packageRoot, 'package.json'), 'utf-8'));
21
+
22
+ // CLI Arguments Parser
23
+ const args = process.argv.slice(2);
24
+
25
+ if (args.includes('-h') || args.includes('--help')) {
26
+ console.log(`
27
+ \x1b[36m _ ___ ____ _
28
+ / \\ |_ _| / ___|___ _ __ ___ _ __ | | ___ _ __
29
+ / _ \\ | | | | / _ \\| '_ \` _ \\| '_ \\| |/ _ \\ '__|
30
+ / ___ \\ | | | |__| (_) | | | | | | |_) | | __/ |
31
+ /_/ \\_\\___| \\____\\___/|_| |_| |_| .__/|_|\\___|_|
32
+ |_| \x1b[0m
33
+ \x1b[1m\x1b[35mAI Agent Command Center\x1b[0m • \x1b[32mv${pkg.version}\x1b[0m
34
+ Autonomous Multi-Agent Swarm OS & 3D Spatial Command Bridge
35
+
36
+ \x1b[1mPENGGUNAAN:\x1b[0m
37
+ npx ai-agent-command-center [command] [options]
38
+ ai-center [command] [options]
39
+
40
+ \x1b[1mPERINTAH:\x1b[0m
41
+ start Menjalankan AI Agent Command Center (default)
42
+
43
+ \x1b[1mOPSI:\x1b[0m
44
+ -p, --port <number> Menentukan port server (default: 3000 atau env PORT)
45
+ -d, --db <url> PostgreSQL connection string (env DATABASE_URL)
46
+ --no-open Jangan buka browser secara otomatis setelah server aktif
47
+ -v, --version Tampilkan versi aplikasi
48
+ -h, --help Tampilkan panduan bantuan ini
49
+
50
+ \x1b[1mCONTOH:\x1b[0m
51
+ $ npx ai-agent-command-center start
52
+ $ npx ai-agent-command-center --port 8080 --db "postgres://user:pass@localhost:5432/ai_center"
53
+ $ DATABASE_URL="postgres://user:pass@localhost:5432/ai_center" npx ai-agent-command-center
54
+ `);
55
+ process.exit(0);
56
+ }
57
+
58
+ if (args.includes('-v') || args.includes('--version')) {
59
+ console.log(`ai-agent-command-center v${pkg.version}`);
60
+ process.exit(0);
61
+ }
62
+
63
+ // Banner display
64
+ console.log(`
65
+ \x1b[36m _ ___ ____ _
66
+ / \\ |_ _| / ___|___ _ __ ___ _ __ | | ___ _ __
67
+ / _ \\ | | | | / _ \\| '_ \` _ \\| '_ \\| |/ _ \\ '__|
68
+ / ___ \\ | | | |__| (_) | | | | | | |_) | | __/ |
69
+ /_/ \\_\\___| \\____\\___/|_| |_| |_| .__/|_|\\___|_|
70
+ |_| \x1b[0m
71
+ \x1b[1m\x1b[35mAI Agent Command Center\x1b[0m • \x1b[32mv${pkg.version}\x1b[0m
72
+ \x1b[90mhttps://github.com/NexGen-X/Ai-Center-Workspace\x1b[0m
73
+ `);
74
+
75
+ // Parse options
76
+ const portIndex = args.findIndex(a => a === '-p' || a === '--port');
77
+ if (portIndex !== -1 && args[portIndex + 1]) {
78
+ process.env.PORT = args[portIndex + 1];
79
+ }
80
+
81
+ const dbIndex = args.findIndex(a => a === '-d' || a === '--db');
82
+ if (dbIndex !== -1 && args[dbIndex + 1]) {
83
+ process.env.DATABASE_URL = args[dbIndex + 1];
84
+ }
85
+
86
+ const noOpen = args.includes('--no-open');
87
+
88
+ // Auto-load .env if present in CWD
89
+ const cwdEnvPath = path.resolve(process.cwd(), '.env');
90
+ if (fs.existsSync(cwdEnvPath)) {
91
+ dotenv.config({ path: cwdEnvPath });
92
+ }
93
+
94
+ // Environment Detection: Local Machine (Laptop/PC) vs Remote Server (VPS/Cloud)
95
+ function detectDeploymentEnvironment() {
96
+ const isWindows = process.platform === 'win32';
97
+ const isMac = process.platform === 'darwin';
98
+ const hasDisplay = Boolean(process.env.DISPLAY || process.env.WAYLAND_DISPLAY);
99
+ const isLocalDesktop = isWindows || isMac || hasDisplay;
100
+
101
+ const interfaces = os.networkInterfaces();
102
+ const networkIps = [];
103
+ for (const name of Object.keys(interfaces)) {
104
+ for (const iface of interfaces[name] || []) {
105
+ if (iface.family === 'IPv4' && !iface.internal) {
106
+ networkIps.push(iface.address);
107
+ }
108
+ }
109
+ }
110
+
111
+ return {
112
+ isLocalDesktop,
113
+ isRemoteVPS: !isLocalDesktop,
114
+ networkIps
115
+ };
116
+ }
117
+
118
+ const envInfo = detectDeploymentEnvironment();
119
+
120
+ // Database URL verification & fallback guidance
121
+ if (!process.env.DATABASE_URL) {
122
+ console.warn(`\x1b[33m[AI Center] PERINGATAN: Variabel DATABASE_URL belum dikonfigurasi.\x1b[0m`);
123
+ console.log(`\x1b[90mSistem membutuhkan PostgreSQL 16 dengan ekstensi pgvector.`);
124
+ console.log(`Anda dapat menyediakannya melalui file .env atau parameter --db:`);
125
+ console.log(` npx ai-agent-command-center --db "postgres://user:pass@localhost:5432/ai_center"\x1b[0m\n`);
126
+ }
127
+
128
+ // Function to auto-open browser (strictly on local desktop with GUI display)
129
+ function openBrowser(targetUrl) {
130
+ if (noOpen || envInfo.isRemoteVPS) return;
131
+ const startCmd =
132
+ process.platform === 'darwin'
133
+ ? 'open'
134
+ : process.platform === 'win32'
135
+ ? 'start'
136
+ : 'xdg-open';
137
+
138
+ exec(`${startCmd} ${targetUrl}`, () => {
139
+ // Silently ignore failures on headless environments
140
+ });
141
+ }
142
+
143
+ // Launch backend server
144
+ const port = process.env.PORT || 3000;
145
+ const localUrl = `http://localhost:${port}`;
146
+
147
+ async function launch() {
148
+ try {
149
+ const serverModulePath = path.resolve(packageRoot, 'server/dist/server/src/index.js');
150
+ if (!fs.existsSync(serverModulePath)) {
151
+ console.error(`\x1b[31m[AI Center Error] Berkas kompilasi server tidak ditemukan pada: ${serverModulePath}\x1b[0m`);
152
+ console.error(`Silakan jalankan "npm run build" terlebih dahulu.`);
153
+ process.exit(1);
154
+ }
155
+
156
+ // Import compiled server (auto binds to 0.0.0.0)
157
+ await import(serverModulePath);
158
+
159
+ console.log(`\n\x1b[1m\x1b[32m✔ AI Agent Command Center aktif & siap melayani:\x1b[0m`);
160
+ console.log(` \x1b[36m➜\x1b[0m \x1b[1mLocal:\x1b[0m \x1b[4m${localUrl}\x1b[0m`);
161
+
162
+ if (envInfo.networkIps.length > 0) {
163
+ envInfo.networkIps.forEach(ip => {
164
+ console.log(` \x1b[36m➜\x1b[0m \x1b[1mNetwork:\x1b[0m \x1b[4mhttp://${ip}:${port}\x1b[0m`);
165
+ });
166
+ }
167
+
168
+ if (envInfo.isRemoteVPS) {
169
+ console.log(` \x1b[33m➜\x1b[0m \x1b[1mMode:\x1b[0m Remote Server / VPS (Headless — browser lokal dinonaktifkan)`);
170
+ } else {
171
+ console.log(` \x1b[35m➜\x1b[0m \x1b[1mMode:\x1b[0m Local Desktop (Membuka browser otomatis...)`);
172
+ setTimeout(() => {
173
+ openBrowser(localUrl);
174
+ }, 1500);
175
+ }
176
+ console.log('');
177
+ } catch (err) {
178
+ console.error(`\x1b[31m[AI Center Startup Error]\x1b[0m`, err);
179
+ process.exit(1);
180
+ }
181
+ }
182
+
183
+ launch();