ai-agent-command-center 1.0.0 → 1.0.1

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/README.md CHANGED
@@ -14,6 +14,8 @@
14
14
 
15
15
  ### *Next-Generation Spatial 3D/2D Orchestration Bridge & Autonomous Multi-Agent Swarm OS*
16
16
 
17
+ [![NPM Version](https://img.shields.io/npm/v/ai-agent-command-center.svg?style=for-the-badge&logo=npm&logoColor=white&color=CB3837)](https://www.npmjs.com/package/ai-agent-command-center)
18
+ [![NPM Unpacked Size](https://img.shields.io/badge/unpacked%20size-2.2%20MB-blue?style=for-the-badge&logo=npm&logoColor=white)](https://www.npmjs.com/package/ai-agent-command-center)
17
19
  [![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
20
  [![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
21
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.4.5-3178C6?style=for-the-badge&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
@@ -203,9 +205,60 @@ Security is not an afterthought in AI Command Center — it is baked into every
203
205
 
204
206
  ---
205
207
 
206
- ## 🚀 Quickstart & Local Development
208
+ ## 🚀 Quickstart
207
209
 
208
- ### Prerequisites
210
+ ### Method 1: Instant Zero-Install Run (Recommended)
211
+ Run the complete Command Bridge in seconds without manually cloning or configuring dependencies:
212
+
213
+ ```bash
214
+ # Instant launch (auto-provisions & opens browser on local machine)
215
+ npx ai-agent-command-center
216
+
217
+ # With custom port and database connection
218
+ npx ai-agent-command-center --port 8080 --db "postgres://user:pass@localhost:5432/ai_center"
219
+ ```
220
+
221
+ ### Method 2: Global CLI Installation
222
+ ```bash
223
+ # Install globally
224
+ npm install -g ai-agent-command-center
225
+
226
+ # Launch the Command Center
227
+ ai-center start
228
+
229
+ # View all CLI options
230
+ ai-center --help
231
+ ```
232
+
233
+ ### 🧭 Intelligent Deployment Environment Auto-Detection
234
+ `ai-agent-command-center` features built-in environment perception to seamlessly adapt between local workstations and headless cloud servers:
235
+
236
+ | Target Environment | Detection Criteria | Startup Behavior |
237
+ | :--- | :--- | :--- |
238
+ | **Local Desktop / Laptop** | Windows, macOS, or Linux with active `$DISPLAY` / `$WAYLAND_DISPLAY` | Prints `http://localhost:3000` and **automatically opens default browser** within 1.5s. |
239
+ | **Remote Server / Headless VPS** | Headless Linux (AWS EC2, DigitalOcean, VPS, Docker container) | **Suppresses browser invocation** (prevents X11 errors), binds Express to `0.0.0.0`, and outputs LAN & Public access URLs. |
240
+
241
+ ```text
242
+ ✔ AI Agent Command Center aktif & siap melayani:
243
+ ➜ Local: http://localhost:3000
244
+ ➜ Network: http://192.168.1.50:3000
245
+ ➜ Mode: Remote Server / VPS (Headless — browser lokal dinonaktifkan)
246
+ ```
247
+
248
+ ### CLI Command & Flags Reference
249
+ | Flag | Alias | Description | Default |
250
+ | :--- | :---: | :--- | :--- |
251
+ | `--port <num>` | `-p` | Port for the backend API and frontend static server | `3000` or `$PORT` |
252
+ | `--db <url>` | `-d` | PostgreSQL connection URL with pgvector support | `$DATABASE_URL` |
253
+ | `--no-open` | | Do not launch the browser automatically on local desktop | `false` |
254
+ | `--version` | `-v` | Print the current installed CLI version | `1.0.0` |
255
+ | `--help` | `-h` | Display help guidelines and usage examples | |
256
+
257
+ ---
258
+
259
+ ### Method 3: Monorepo Developer Setup (From Source)
260
+
261
+ #### Prerequisites
209
262
  - **Node.js**: `v20.x` or higher
210
263
  - **PostgreSQL**: `v16.x` with `pgvector` extension
211
264
  - **npm**: `v10.x` or higher
@@ -226,7 +279,7 @@ npm run dev:server
226
279
  # In a separate terminal:
227
280
  npm run dev:client
228
281
  ```
229
- Visit `http://localhost:5173` to access the Command Bridge.
282
+ Visit `http://localhost:5173` to access the Vite HMR development server.
230
283
 
231
284
  ---
232
285
 
package/bin/ai-center.js CHANGED
@@ -125,6 +125,22 @@ if (!process.env.DATABASE_URL) {
125
125
  console.log(` npx ai-agent-command-center --db "postgres://user:pass@localhost:5432/ai_center"\x1b[0m\n`);
126
126
  }
127
127
 
128
+ // Resolves external Public IP asynchronously for cloud VPS
129
+ async function getPublicIp() {
130
+ try {
131
+ const res = await fetch('https://api.ipify.org?format=json', {
132
+ signal: AbortSignal.timeout(1200)
133
+ });
134
+ if (res.ok) {
135
+ const data = await res.json();
136
+ return data.ip;
137
+ }
138
+ } catch {
139
+ // Graceful silent fallback if offline or timeout
140
+ }
141
+ return null;
142
+ }
143
+
128
144
  // Function to auto-open browser (strictly on local desktop with GUI display)
129
145
  function openBrowser(targetUrl) {
130
146
  if (noOpen || envInfo.isRemoteVPS) return;
@@ -157,25 +173,44 @@ async function launch() {
157
173
  await import(serverModulePath);
158
174
 
159
175
  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`);
176
+ console.log(` \x1b[36m➜\x1b[0m \x1b[1mLocal:\x1b[0m \x1b[4m${localUrl}\x1b[0m`);
161
177
 
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
178
  if (envInfo.isRemoteVPS) {
169
- console.log(` \x1b[33m➜\x1b[0m \x1b[1mMode:\x1b[0m Remote Server / VPS (Headless — browser lokal dinonaktifkan)`);
179
+ const publicIp = await getPublicIp();
180
+ if (publicIp) {
181
+ console.log(` \x1b[36m➜\x1b[0m \x1b[1mPublic:\x1b[0m \x1b[4mhttp://${publicIp}:${port}\x1b[0m (Cloud VPS / Remote)`);
182
+ }
183
+ if (envInfo.networkIps.length > 0) {
184
+ envInfo.networkIps.forEach(ip => {
185
+ if (ip !== publicIp) {
186
+ console.log(` \x1b[36m➜\x1b[0m \x1b[1mInternal:\x1b[0m \x1b[4mhttp://${ip}:${port}\x1b[0m (VPC / LAN)`);
187
+ }
188
+ });
189
+ }
190
+ console.log(` \x1b[33m➜\x1b[0m \x1b[1mMode:\x1b[0m Remote Server / VPS (Headless — browser lokal dinonaktifkan)`);
170
191
  } else {
171
- console.log(` \x1b[35m➜\x1b[0m \x1b[1mMode:\x1b[0m Local Desktop (Membuka browser otomatis...)`);
192
+ if (envInfo.networkIps.length > 0) {
193
+ envInfo.networkIps.forEach(ip => {
194
+ console.log(` \x1b[36m➜\x1b[0m \x1b[1mNetwork:\x1b[0m \x1b[4mhttp://${ip}:${port}\x1b[0m`);
195
+ });
196
+ }
197
+ console.log(` \x1b[35m➜\x1b[0m \x1b[1mMode:\x1b[0m Local Desktop (Membuka browser otomatis...)`);
172
198
  setTimeout(() => {
173
199
  openBrowser(localUrl);
174
200
  }, 1500);
175
201
  }
176
202
  console.log('');
177
203
  } catch (err) {
178
- console.error(`\x1b[31m[AI Center Startup Error]\x1b[0m`, err);
204
+ if (err && (err.code === '28P01' || err.code === 'ECONNREFUSED' || err.message?.includes('password authentication failed'))) {
205
+ console.error(`\n\x1b[31m[AI Center Database Error] Gagal terhubung ke database PostgreSQL:\x1b[0m`);
206
+ console.error(`\x1b[33mDetail:\x1b[0m ${err.message}`);
207
+ console.error(`\n\x1b[36mPanduan Solusi:\x1b[0m`);
208
+ console.error(` 1. Pastikan PostgreSQL berjalan dan database sudah dibuat.`);
209
+ console.error(` 2. Pastikan username dan password di parameter --db atau DATABASE_URL benar.`);
210
+ console.error(` 3. Contoh: ai-center start --db "postgres://user:password@localhost:5432/ai_center"\n`);
211
+ } else {
212
+ console.error(`\x1b[31m[AI Center Startup Error]\x1b[0m`, err);
213
+ }
179
214
  process.exit(1);
180
215
  }
181
216
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-agent-command-center",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Next-Generation Spatial 3D/2D Orchestration Bridge & Autonomous Multi-Agent Swarm OS",
5
5
  "main": "server/dist/server/src/index.js",
6
6
  "type": "module",
@@ -37,7 +37,7 @@
37
37
  "dotenv": "^16.4.5",
38
38
  "express": "^4.19.2",
39
39
  "pg": "^8.13.0",
40
- "uuid": "^9.0.1"
40
+ "uuid": "^14.0.3"
41
41
  },
42
42
  "repository": {
43
43
  "type": "git",
@@ -235,7 +235,17 @@ process.on('unhandledRejection', (reason) => {
235
235
  // Auto-start if executed directly
236
236
  if (process.env.NODE_ENV !== 'test') {
237
237
  startServer().catch(err => {
238
- console.error('Failed to start server:', err);
238
+ if (err && (err.code === '28P01' || err.code === 'ECONNREFUSED' || err.message?.includes('password authentication failed'))) {
239
+ console.error(`\n\x1b[31m[AI Center Error] Gagal terhubung ke basis data PostgreSQL:\x1b[0m`);
240
+ console.error(`\x1b[33mRincian:\x1b[0m ${err.message}`);
241
+ console.error(`\n\x1b[36mPanduan Perbaikan:\x1b[0m`);
242
+ console.error(` 1. Pastikan PostgreSQL berjalan dan database sudah dibuat.`);
243
+ console.error(` 2. Pastikan username dan password di DATABASE_URL sudah sesuai.`);
244
+ console.error(` 3. Contoh: DATABASE_URL="postgres://user:password@localhost:5432/ai_center" npx ai-agent-command-center\n`);
245
+ }
246
+ else {
247
+ console.error('Failed to start server:', err);
248
+ }
239
249
  process.exit(1);
240
250
  });
241
251
  }