nyxora 1.5.0 → 1.5.2

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 (38) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +53 -33
  3. package/SECURITY.md +58 -15
  4. package/bin/nyxora.js +3 -0
  5. package/dist/gateway/server.js +13 -1
  6. package/launcher.js +43 -0
  7. package/launcher.ts +51 -0
  8. package/nyxora-1.5.2.tgz +0 -0
  9. package/package.json +28 -57
  10. package/packages/core/package.json +18 -0
  11. package/packages/dashboard/dist/assets/index-BK4qmIy6.js +200 -0
  12. package/packages/dashboard/dist/assets/index-C1m4ohce.css +1 -0
  13. package/{dashboard → packages/dashboard}/dist/index.html +2 -2
  14. package/packages/dashboard/index.html +13 -0
  15. package/packages/dashboard/package-lock.json +2748 -0
  16. package/packages/dashboard/package.json +31 -0
  17. package/packages/dashboard/public/favicon.svg +1 -0
  18. package/packages/dashboard/public/icons.svg +24 -0
  19. package/packages/dashboard/tsconfig.app.json +25 -0
  20. package/packages/dashboard/tsconfig.json +7 -0
  21. package/packages/dashboard/tsconfig.node.json +24 -0
  22. package/packages/dashboard/vite.config.ts +7 -0
  23. package/packages/policy/package.json +12 -0
  24. package/packages/signer/package.json +11 -0
  25. package/security_policy.md +2 -0
  26. package/tsconfig.json +18 -0
  27. package/tsconfig.tsbuildinfo +1 -0
  28. package/dashboard/dist/assets/index-Cy7yprIz.css +0 -1
  29. package/dashboard/dist/assets/index-L20NVlIh.js +0 -9
  30. package/dist/src/agent/reasoning.js +0 -96
  31. package/dist/src/config/parser.js +0 -25
  32. package/dist/src/gateway/cli.js +0 -79
  33. package/dist/src/memory/logger.js +0 -50
  34. package/dist/src/web3/config.js +0 -80
  35. package/dist/src/web3/skills/getBalance.js +0 -43
  36. /package/{dashboard → packages/dashboard}/README.md +0 -0
  37. /package/{dashboard → packages/dashboard}/dist/favicon.svg +0 -0
  38. /package/{dashboard → packages/dashboard}/dist/icons.svg +0 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,43 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.4.5]
9
+
10
+ ### Fixed
11
+ - Re-rendered Architecture Workflow diagram as a solid-background PNG to fix dark mode visibility issues.
12
+ - Added `assets` directory to the NPM package `files` list so the diagram is included in published packages.
13
+ - Added `repository` field in `package.json` for proper GitHub link resolution on NPMJS.
14
+ - Updated `README.md` to use the absolute raw GitHub image URL for universal rendering compatibility.
15
+
16
+ ## [1.4.4]
17
+
18
+ ### Fixed
19
+ - Fixed Architecture Workflow diagram rendering issue on NPM by replacing the `mermaid` code block with a static SVG image.
20
+
21
+ ## [1.4.3]
22
+
23
+ ### Changed
24
+ - Completely rewrote `README.md` (English) to follow the structured, security-first Web3-Ops template.
25
+
26
+ ## [1.4.2]
27
+
28
+ ### Changed
29
+ - Updated `README.md` to highlight Web3-Ops capabilities (System Automation, NLP Security Policies, and Dynamic Plugins).
30
+
31
+ ## [1.4.0]
32
+
33
+ ### Added
34
+ - **System Automation Capabilities**: Allow Nyxora to execute shell commands, read/write local files, and browse the web autonomously.
35
+ - **NLP Security Policy**: Users can enforce rules (e.g. "do not touch partition E") in plain text via the chat, which Nyxora respects autonomously.
36
+ - **Plugin System**: Dynamically load third-party skills from the `src/external_skills` folder without modifying the core codebase.
37
+
38
+ ### Changed
39
+ - Moved AI initialization logic to support dynamic importing of external skills.
40
+ - UI Settings: Fixed a fatal rendering bug when the configuration lacks `api_keys` array formatting.
41
+
42
+ ### Fixed
43
+ - Fixed bug on rendering Settings menu due to incorrect `config.yaml` types.
package/README.md CHANGED
@@ -1,81 +1,101 @@
1
1
  # Nyxora Agent 🤖
2
- **Secure AI execution framework for Web3 agents.**
2
+ **Production-Grade Secure AI Execution Framework for Web3 Agents.**
3
3
 
4
+ [![Version](https://img.shields.io/badge/version-1.5.2-blue.svg)](https://github.com/perasyudha/Nyxora)
4
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
- [![Security: Security-First](https://img.shields.io/badge/Security-Security--First-blue.svg)](#️-security-threat-model--permission-boundary)
6
- [![Execution: Human-in-the-Loop](https://img.shields.io/badge/Execution-Human--in--the--Loop-orange.svg)](#📐-architecture-workflow)
7
- [![Privacy: Local-Only Keys](https://img.shields.io/badge/Privacy-Local--Only--Keys-success.svg)](#️-security-threat-model--permission-boundary)
6
+ [![Security: Production-Grade](https://img.shields.io/badge/Security-Production--Grade-blue.svg)](#️-advanced-security-threat-model)
7
+ [![Execution: Cryptographic Approval](https://img.shields.io/badge/Execution-Cryptographic--Approval-orange.svg)](#️-advanced-security-threat-model)
8
+ [![Privacy: Local-Only Keys](https://img.shields.io/badge/Privacy-Local--Only--Keys-success.svg)](#️-advanced-security-threat-model)
8
9
 
9
- Nyxora is a **secure, non-custodial runtime infrastructure for autonomous onchain agents** built with Node.js and React. Designed for autonomous workflows with a premium Glassmorphism UI dashboard and strict client-side key isolation. It operates under a strict **Human-in-the-Loop** execution model for financial transactions.
10
+ Nyxora (v1.5.2) is a **secure, non-custodial runtime infrastructure for autonomous onchain agents** built with a robust Monorepo architecture (Node.js & React). Designed for autonomous workflows with a premium Glassmorphism UI dashboard and strict client-side key isolation.
11
+
12
+ It operates under an institutional-grade **Cryptographically Bound Human-in-the-Loop** execution model, ensuring that Remote AIs (LLMs) never have unilateral access to your funds.
10
13
 
11
14
  ---
12
15
 
13
16
  ## 🔥 Key Features
14
17
 
15
- ### Advanced Trading, Security & Operations
18
+ ### Advanced Security Architecture (v1.5.2)
19
+ * **3-Tier IPC Architecture**: Nyxora is split into isolated processes: **Core** (LLM Runtime), **Policy Engine** (Guardrails on port 3001), and **Signer Vault** (Isolated Key Manager on Unix Sockets).
20
+ * **Cryptographically Bound Approval**: Policy changes and transactions requested by the AI are drafted as hashes (`sha256`). Approval via the UI requires a challenge nonce, preventing Man-in-the-Middle (MITM) attacks.
21
+ * **Immutable Policy Guardrails**: Transaction limits (e.g. `max_usd_per_tx`) are strictly enforced by the Policy Engine. The LLM has zero write-access to bypass these rules.
22
+
23
+ ### Core Operations & Web3 Execution
16
24
  * **System Automation & Full OS Access**: Instruct the agent to read/write local files, run terminal commands, and browse the web natively.
17
- * **NLP Security Policy**: Command Nyxora using natural language to set security boundaries (e.g., *"Never touch partition E"*). Nyxora autonomously enforces these rules.
18
- * **Dynamic Plugin Sandboxing**: Dynamically load community-built skills with restricted FS/Shell access to prevent supply chain attacks and malicious payloads.
19
25
  * **Anti-Rugpull & Security Scanner**: Nyxora can scan smart contracts via GoPlus Labs to detect Honeypots, Hidden Taxes, and malicious proxy upgrades before you buy.
20
- * **Automated Limit Orders**: Set natural language rules (e.g., "Sell my PEPE if price drops below $0.001"). Nyxora runs a background cron monitor and executes the swap while you sleep.
26
+ * **Automated Limit Orders**: Set natural language rules (e.g., "Sell my PEPE if price drops below $0.001"). Nyxora runs a background cron monitor and executes the swap while you sleep (Auto-Approve Bypass configured safely).
21
27
  * **PNL & Portfolio Tracking**: The AI scans your wallets and multiplies balances by live DEX prices to give you real-time Net Worth estimations.
22
28
 
23
- ### Core Features
29
+ ### AI & UI Customization
24
30
  * **Multi-LLM Support**: Seamlessly switch between Google Gemini, OpenAI, OpenRouter, or local Ollama models.
25
31
  * **Premium Glassmorphism UI**: A gorgeous, resizable split-pane interface with Pseudo-Generative UI widgets (`<BalanceWidget>`, `<MarketWidget>`, `<SwapWidget>`).
26
- * **Round-Robin API Rotation**: Add up to 10 API keys via the dashboard. The system will auto-rotate them to prevent rate-limiting and token drain.
27
32
  * **Deep Personalization**: Feed the agent custom rules via `user.md` and define its core persona via `IDENTITY.md`.
28
33
 
29
34
  ---
30
35
 
31
36
  ## 📐 Architecture Workflow
32
37
 
33
- This diagram shows how user interactions flow through the Nyxora Agent, from chat input to on-chain or OS execution:
34
-
35
- ![Architecture Workflow](https://raw.githubusercontent.com/perasyudha/Nyxora/main/assets/architecture.png)
38
+ The following diagram illustrates Nyxora's **3-Tier Monorepo Architecture**, showing the isolated communication channels (REST API and Unix Socket).
39
+
40
+ ```mermaid
41
+ flowchart TD
42
+ User([👨‍💻 Human Operator]) --> |Prompt / Dashboard| Core
43
+
44
+ subgraph Nyxora Architecture
45
+ Core[🤖 Core Agent\nLLM Runtime & Plugins\nPort: 3000]
46
+ Policy[🛡️ Policy Engine\nGuardrails & Enforcements\nPort: 3001]
47
+ Signer[🔒 Signer Vault\nPrivate Keys\nUnix Socket]
48
+ end
49
+
50
+ Core -->|1. Propose Tx / Policy| Policy
51
+ Policy -.->|2. Request Challenge Nonce| User
52
+ User -.->|3. Cryptographic Approval| Policy
53
+ Policy -->|4. If Valid, Pass to Signer| Signer
54
+ Signer -->|5. Sign & Broadcast| Blockchain[(Blockchain)]
55
+ ```
36
56
 
37
57
  ---
38
58
 
39
- ## 🛡️ Security, Threat Model & Permission Boundary
59
+ ## 🛡️ Advanced Security & Threat Model
60
+
61
+ This agent is designed with a **Zero-Knowledge to LLM** architectural pattern.
40
62
 
41
- This agent is designed with a **Zero-Knowledge to LLM** architectural pattern to ensure the highest levels of security for investors and users:
63
+ * **Zero-Knowledge LLM**: Remote AI Agents and Large Language Models (LLMs) **never** handle your private keys. The LLM only generates structured JSON tool calls.
64
+ * **Cryptographic Memory Isolation**: Transaction signing occurs strictly client-side within the `Signer Vault` (a separate process). It is communicated via a secure Unix Socket (`/tmp/nyxora-signer.sock`).
65
+ * **Immutable Policy Store & HMAC**: Security rules (`policy.yaml`) are treated as immutable configurations during runtime. Changes require explicit cryptographic human approval.
66
+ * **Plugin Sandboxing**: Built with future plugin ecosystems in mind. Third-party plugins are explicitly denied unrestricted `fs` (FileSystem) and `shell` access to prevent supply chain attacks.
42
67
 
43
- * **Zero-Knowledge to AI Agent (LLM)**: Remote AI Agents and Large Language Models (LLMs) **never** handle your private keys. The LLM only generates structured JSON tool calls.
44
- * **Cryptographic Memory Isolation**: Transaction signing occurs strictly client-side within the local Node.js process runtime using `viem`. `~/.nyxora/keystore.json` is encrypted with AES-256-GCM.
45
- * **Plugin Sandboxing**: Built with future plugin ecosystems in mind. Third-party plugins are explicitly denied unrestricted `fs` (FileSystem) and `shell` access to prevent supply chain attacks and malicious execution.
46
- * **Human-in-the-Loop**: Write actions (like transfers, swaps, bridges) require manual confirmation from the human operator before broadcasting.
68
+ *(Note: HMAC Signing & Challenge Nonce strict validations are part of the upcoming v1.6.0 Implementation Roadmap, currently documented as our official Security Blueprint in v1.5.2)*
47
69
 
48
70
  ---
49
71
 
50
72
  ## 🚀 Quick Start & Installation
51
73
 
52
- ### 1. General Users (CLI Install)
53
- Open your terminal (Command Prompt, PowerShell, or Linux Terminal) and run:
54
- ```bash
55
- npm install -g nyxora
56
- nyxora setup
57
- ```
58
- The Interactive Setup Wizard will securely generate a local vault, configure your LLM, and offer to Auto-Generate a Web3 Wallet for you.
74
+ ### Local Development & Execution
75
+ With the new v1.5.2 Monorepo architecture, launching Nyxora is completely automated via the internal `launcher.ts` orchestrator.
59
76
 
60
- ### 2. Local Development (For Contributors)
61
- If you want to modify Nyxora's code, build new skills, or contribute:
62
77
  ```bash
63
78
  git clone https://github.com/perasyudha/Nyxora.git
64
79
  cd Nyxora
65
80
  npm install
66
- cd dashboard && npm install && cd ..
67
- npm run build && npm run start
81
+
82
+ # Build all monorepo packages (Core, Policy, Signer, Dashboard)
83
+ npm run build --workspaces
84
+
85
+ # Start the Nyxora Orchestrator
86
+ npm start
68
87
  ```
88
+ *`npm start` will automatically boot the Core, Policy Engine, Signer Vault, and Local Dashboard UI.*
69
89
 
70
90
  ---
71
91
 
72
92
  ## 📖 Official Documentation
73
93
 
74
- For complete technical deep-dives, please visit our official VitePress Documentation Site!
94
+ For complete technical deep-dives into our Cryptographic Architecture, please visit our official VitePress Documentation Site!
75
95
 
76
96
  > **🔗 [Read the Full Nyxora Documentation Here](https://perasyudha.github.io/Nyxora/)**
77
97
 
78
- *(Includes guides on Secure Wallet Imports, API Key Rotations, Troubleshooting, and Custom Skill Development).*
98
+ *(Includes guides on Secure Wallet Imports, Architecture Blueprints, Troubleshooting, and Custom Skill Development).*
79
99
 
80
100
  ---
81
101
  **License:** MIT License
package/SECURITY.md CHANGED
@@ -1,22 +1,65 @@
1
- # Security Policy
1
+ # Nyxora Security Architecture & Threat Model
2
2
 
3
- ## Supported Versions
3
+ Nyxora (v1.5.2) employs an institutional-grade, **Cryptographically Bound Human-in-the-Loop** security model to protect user assets and private keys against compromised LLMs, supply chain attacks, and prompt injections.
4
4
 
5
- Currently, the Nyxora project is in active development. Only the latest commit on the `main` branch is supported with security updates.
5
+ ---
6
6
 
7
- ## Reporting a Vulnerability
7
+ ## 1. Zero-Knowledge LLM Architecture
8
8
 
9
- If you discover a security vulnerability within this project, please **do not** open a public issue. We take security very seriously.
9
+ The core philosophy of Nyxora is **Zero-Knowledge to the LLM**.
10
10
 
11
- Instead, please send an email to the repository owner or reach out privately. We will endeavor to respond and provide a patch as quickly as possible.
11
+ Large Language Models (LLMs) are incredibly powerful reasoning engines, but they are inherently vulnerable to Prompt Injection and hallucinations. Therefore, the LLM must *never* have unilateral access to private keys or the ability to bypass security guardrails.
12
12
 
13
- ## Best Practices for Users
14
- When using Nyxora, you are configuring an autonomous agent that has direct access to your injected Web3 Wallet's private key.
13
+ To achieve this, Nyxora uses a **3-Tier Monorepo IPC (Inter-Process Communication)** architecture:
14
+ 1. **Core Runtime (Port 3000):** Executes the LLM logic, handles the UI dashboard, and processes chat inputs.
15
+ 2. **Policy Engine (Port 3001):** A strict middleware that evaluates all transaction requests against hard limits (e.g., `max_usd_per_tx`).
16
+ 3. **Signer Vault (Unix Socket):** A completely isolated Node.js process that holds the decrypted private keys in memory. It listens exclusively on `/tmp/nyxora-signer.sock`.
15
17
 
16
- 1. **Protect Your Keystore**: Your private key is encrypted and stored in `~/.nyxora/keystore.json`. While it is encrypted using `AES-256-GCM`, you must still treat it and your **Master Password** as highly sensitive. NEVER share your `keystore.json` or your Master Password with anyone.
17
- 2. **Human-in-the-Loop Verification**: For standard actions, the agent is restricted from making unilateral transactions. Always review the exact details of the transaction when prompted to "Approve" or "Reject" on the Web Dashboard or Telegram Inline Keyboard before confirming.
18
- 3. **Limit Order Automation Risk**: If you use the AI to create a **Limit Order** (Take-profit or Cut-loss), the system WILL execute the transaction automatically in the background when the price condition is met. This intentionally bypasses the Human-in-the-Loop verification for speed. Use this feature with caution.
19
- 4. **Wallet Generation**: When you ask the AI to create a new wallet, it generates the Private Key and Seed Phrase locally and displays it once. It does NOT save it anywhere. You are responsible for immediately backing up this information.
20
- 5. **Use Testnets**: While getting started or testing new skills, ALWAYS use a testnet (e.g., Sepolia) and a wallet containing only testnet funds.
21
- 6. **Do Not Share Your `memory.json`**: The agent's memory may contain sensitive conversational data, generated seed phrases, or addresses you've interacted with. Be cautious before sharing the `memory.json` export.
22
- 7. **API Keys**: Treat your OpenAI, Gemini, and other LLM provider API keys as highly confidential. Rotate them immediately if you suspect a compromise.
18
+ ### The Security Flow
19
+ When the LLM decides to swap tokens:
20
+ 1. LLM generates a JSON tool call (`executeSwap`).
21
+ 2. Core Runtime forwards this payload to the **Policy Engine**.
22
+ 3. The Policy Engine evaluates the payload against immutable limits.
23
+ 4. If it exceeds limits, a proposal is created and sent to the Human Operator for approval.
24
+ 5. If approved, the Policy Engine forwards the signed JWT instruction to the **Signer Vault**.
25
+ 6. The Signer Vault signs the transaction locally via `viem` and broadcasts it to the RPC.
26
+
27
+ ---
28
+
29
+ ## 2. Advanced Cryptographic Security (v1.6.0 Roadmap / v1.5.2 Blueprint)
30
+
31
+ To prevent advanced Man-in-the-Middle (MITM) attacks and UI compromises, Nyxora is adopting the following cryptographic standards:
32
+
33
+ ### Immutable Policy Store & HMAC Verification
34
+ The `policy.yaml` file defines your risk tolerance (e.g., daily spend limits). In Nyxora, this is not a regular editable state file.
35
+ * **Immutable Loading:** The Policy Engine verifies the integrity of `policy.yaml` via checksums or HMAC / public-key signatures upon boot.
36
+ * **No Runtime Write-Access:** The LLM Agent process does not have write access to the policy directory.
37
+
38
+ ### Propose vs. Commit Separation
39
+ We enforce a strict separation of duties to prevent prompt injection manipulation:
40
+ * `propose_policy_change()`: The AI is restricted to drafting proposals. It cannot alter live security settings.
41
+ * `commit_policy_change()`: Only a Human Operator, authenticated via a backend Challenge Nonce, can commit the proposal to the Policy Engine.
42
+
43
+ ### Cryptographically Bound Approvals
44
+ When the UI asks you to approve a transaction or a policy change, you are not simply clicking "OK".
45
+ The backend requires a cryptographic hash:
46
+ ```javascript
47
+ approval_hash = sha256(policy_diff + timestamp + user_id)
48
+ ```
49
+ This ensures that what the human saw on the UI matches exactly what is being executed, preventing the LLM from secretly modifying the payload in transit.
50
+
51
+ ### Anti-Replay Challenge Nonce
52
+ Every approval UI prompt utilizes a **Single-Use Challenge Nonce** with a strict expiry time. This mitigates *XSS Token Leaks* and *Replay Attacks*, ensuring that an old approval token cannot be stolen and reused for a malicious transaction later.
53
+
54
+ ---
55
+
56
+ ## 3. Plugin Sandboxing
57
+
58
+ Community plugins and custom skills are executed inside a sandboxed environment.
59
+ * **Restricted FS Access:** Plugins cannot arbitrarily read your `~/.nyxora` keystore directory.
60
+ * **Restricted Shell Exec:** Arbitrary shell commands are disabled for third-party skills to prevent malicious `curl | bash` supply chain payloads.
61
+
62
+ ## 4. Reporting Vulnerabilities
63
+
64
+ If you discover a vulnerability in the Nyxora architecture, please DO NOT open a public issue.
65
+ Instead, email the core maintainer directly at **security@nyxora.ai**.
package/bin/nyxora.js ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ require('ts-node/register');
3
+ require('../launcher.ts');
@@ -20,6 +20,11 @@ const getBalance_1 = require("../web3/skills/getBalance");
20
20
  const checkAddress_1 = require("../web3/skills/checkAddress");
21
21
  const getMyAddress_1 = require("../web3/skills/getMyAddress");
22
22
  const getPrice_1 = require("../web3/skills/getPrice");
23
+ const checkSecurity_1 = require("../web3/skills/checkSecurity");
24
+ const checkPortfolio_1 = require("../web3/skills/checkPortfolio");
25
+ const marketAnalysis_1 = require("../web3/skills/marketAnalysis");
26
+ const createWallet_1 = require("../web3/skills/createWallet");
27
+ const limitOrderManager_2 = require("../agent/limitOrderManager");
23
28
  const bridgeToken_1 = require("../web3/skills/bridgeToken");
24
29
  const mintNft_1 = require("../web3/skills/mintNft");
25
30
  const customTx_1 = require("../web3/skills/customTx");
@@ -106,7 +111,14 @@ app.get('/api/skills', (req, res) => {
106
111
  mintNft_1.mintNftToolDefinition,
107
112
  customTx_1.customTxToolDefinition,
108
113
  checkAddress_1.checkAddressToolDefinition,
109
- getMyAddress_1.getMyAddressToolDefinition
114
+ getMyAddress_1.getMyAddressToolDefinition,
115
+ checkSecurity_1.checkSecurityToolDefinition,
116
+ checkPortfolio_1.checkPortfolioToolDefinition,
117
+ marketAnalysis_1.marketAnalysisToolDefinition,
118
+ createWallet_1.createWalletToolDefinition,
119
+ limitOrderManager_2.createLimitOrderToolDefinition,
120
+ limitOrderManager_2.listLimitOrdersToolDefinition,
121
+ limitOrderManager_2.cancelLimitOrderToolDefinition
110
122
  ]);
111
123
  });
112
124
  app.get('/api/transactions', (req, res) => {
package/launcher.js ADDED
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const child_process_1 = require("child_process");
7
+ const crypto_1 = __importDefault(require("crypto"));
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const INTERNAL_AUTH_TOKEN = crypto_1.default.randomBytes(64).toString('hex');
10
+ console.log(`[Launcher] Generated Internal Auth Token: ${INTERNAL_AUTH_TOKEN.substring(0, 8)}...`);
11
+ const env = {
12
+ ...process.env,
13
+ INTERNAL_AUTH_TOKEN,
14
+ SIGNER_SOCKET_PATH: '/tmp/nyxora-signer.sock'
15
+ };
16
+ const spawnService = (name, command, args, env, inheritStdio = false) => {
17
+ const child = (0, child_process_1.spawn)(command, args, { env, stdio: inheritStdio ? 'inherit' : 'pipe' });
18
+ if (!inheritStdio) {
19
+ child.stdout?.on('data', (data) => {
20
+ process.stdout.write(`[${name}] ${data}`);
21
+ });
22
+ child.stderr?.on('data', (data) => {
23
+ process.stderr.write(`[${name}] ERROR: ${data}`);
24
+ });
25
+ }
26
+ child.on('close', (code) => {
27
+ console.log(`[${name}] Exited with code ${code}`);
28
+ });
29
+ return child;
30
+ };
31
+ console.log('[Launcher] Starting Monorepo Services...');
32
+ const socketPath = env.SIGNER_SOCKET_PATH;
33
+ if (fs_1.default.existsSync(socketPath)) {
34
+ console.log(`[Launcher] Removing stale unix socket at ${socketPath}`);
35
+ fs_1.default.unlinkSync(socketPath);
36
+ }
37
+ const signer = spawnService('Signer', 'npx', ['ts-node', '-T', 'packages/signer/src/server.ts'], env);
38
+ setTimeout(() => {
39
+ const policy = spawnService('Policy', 'npx', ['ts-node', '-T', 'packages/policy/src/server.ts'], env);
40
+ setTimeout(() => {
41
+ const core = spawnService('Core', 'npx', ['ts-node', '-T', 'packages/core/src/gateway/cli.ts'], env, true);
42
+ }, 1000);
43
+ }, 1000);
package/launcher.ts ADDED
@@ -0,0 +1,51 @@
1
+ import { spawn } from 'child_process';
2
+ import crypto from 'crypto';
3
+ import fs from 'fs';
4
+ import path from 'path';
5
+
6
+ const INTERNAL_AUTH_TOKEN = crypto.randomBytes(64).toString('hex');
7
+ console.log(`[Launcher] Generated Internal Auth Token: ${INTERNAL_AUTH_TOKEN.substring(0, 8)}...`);
8
+
9
+ const env = {
10
+ ...process.env,
11
+ INTERNAL_AUTH_TOKEN,
12
+ SIGNER_SOCKET_PATH: '/tmp/nyxora-signer.sock'
13
+ };
14
+
15
+ const spawnService = (name: string, command: string, args: string[], env: any, inheritStdio: boolean = false) => {
16
+ const child = spawn(command, args, { env, stdio: inheritStdio ? 'inherit' : 'pipe' });
17
+
18
+ if (!inheritStdio) {
19
+ child.stdout?.on('data', (data) => {
20
+ process.stdout.write(`[${name}] ${data}`);
21
+ });
22
+
23
+ child.stderr?.on('data', (data) => {
24
+ process.stderr.write(`[${name}] ERROR: ${data}`);
25
+ });
26
+ }
27
+
28
+ child.on('close', (code) => {
29
+ console.log(`[${name}] Exited with code ${code}`);
30
+ });
31
+
32
+ return child;
33
+ };
34
+
35
+ console.log('[Launcher] Starting Monorepo Services...');
36
+
37
+ const socketPath = env.SIGNER_SOCKET_PATH;
38
+ if (fs.existsSync(socketPath)) {
39
+ console.log(`[Launcher] Removing stale unix socket at ${socketPath}`);
40
+ fs.unlinkSync(socketPath);
41
+ }
42
+
43
+ const signer = spawnService('Signer', 'npx', ['ts-node', '-T', 'packages/signer/src/server.ts'], env);
44
+
45
+ setTimeout(() => {
46
+ const policy = spawnService('Policy', 'npx', ['ts-node', '-T', 'packages/policy/src/server.ts'], env);
47
+
48
+ setTimeout(() => {
49
+ const core = spawnService('Core', 'npx', ['ts-node', '-T', 'packages/core/src/gateway/cli.ts'], env, true);
50
+ }, 1000);
51
+ }, 1000);
Binary file
package/package.json CHANGED
@@ -1,57 +1,28 @@
1
- {
2
- "name": "nyxora",
3
- "version": "1.5.0",
4
- "description": "",
5
- "main": "dist/gateway/cli.js",
6
- "files": [
7
- "dist",
8
- "dashboard/dist",
9
- "assets",
10
- "user.md",
11
- "IDENTITY.md",
12
- "SECURITY.md",
13
- "README.md"
14
- ],
15
- "repository": {
16
- "type": "git",
17
- "url": "https://github.com/perasyudha/Nyxora.git"
18
- },
19
- "bin": {
20
- "nyxora": "./dist/gateway/cli.js"
21
- },
22
- "scripts": {
23
- "build": "npm run build --prefix dashboard && tsc",
24
- "start": "node dist/gateway/cli.js",
25
- "dashboard": "npm run build && node dist/gateway/cli.js",
26
- "test": "echo \"Error: no test specified\" && exit 1",
27
- "deploy": "npm run build && git add . && git commit -m \"chore: auto-deploy new feature\" && git push && git push --tags && npm publish"
28
- },
29
- "keywords": [],
30
- "author": "",
31
- "license": "ISC",
32
- "type": "commonjs",
33
- "dependencies": {
34
- "@clack/prompts": "^1.4.0",
35
- "better-sqlite3": "^12.10.0",
36
- "concurrently": "^9.2.1",
37
- "cors": "^2.8.6",
38
- "express": "^5.2.1",
39
- "node-telegram-bot-api": "^0.67.0",
40
- "open": "^11.0.0",
41
- "openai": "^6.39.0",
42
- "picocolors": "^1.1.1",
43
- "viem": "^2.51.0",
44
- "yaml": "^2.9.0"
45
- },
46
- "devDependencies": {
47
- "@types/better-sqlite3": "^7.6.13",
48
- "@types/cors": "^2.8.19",
49
- "@types/express": "^5.0.6",
50
- "@types/node": "^25.9.1",
51
- "@types/node-telegram-bot-api": "^0.64.14",
52
- "ts-node": "^10.9.2",
53
- "typescript": "^6.0.3",
54
- "vitepress": "^1.6.4",
55
- "vue": "^3.5.35"
56
- }
57
- }
1
+ {
2
+ "name": "nyxora",
3
+ "version": "1.5.2",
4
+ "workspaces": [
5
+ "packages/*"
6
+ ],
7
+ "scripts": {
8
+ "start": "ts-node -T launcher.ts",
9
+ "build": "npm run build --workspaces",
10
+ "test": "echo \"Error: no test specified\" && exit 1"
11
+ },
12
+ "dependencies": {
13
+ "concurrently": "^9.2.1",
14
+ "dotenv": "^17.4.2",
15
+ "jsonwebtoken": "^9.0.2",
16
+ "picocolors": "^1.1.1",
17
+ "ts-node": "^10.9.2",
18
+ "typescript": "^6.0.3"
19
+ },
20
+ "devDependencies": {
21
+ "@types/jsonwebtoken": "^9.0.5",
22
+ "@types/node": "^25.9.1",
23
+ "vitepress": "^1.6.4"
24
+ },
25
+ "bin": {
26
+ "nyxora": "./bin/nyxora.js"
27
+ }
28
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "@nyxora/core",
3
+ "version": "1.5.2",
4
+ "private": true,
5
+ "main": "src/gateway/server.ts",
6
+ "dependencies": {
7
+ "@clack/prompts": "^1.4.0",
8
+ "better-sqlite3": "^12.10.0",
9
+ "cors": "^2.8.6",
10
+ "express": "^5.2.1",
11
+ "helmet": "^8.0.0",
12
+ "express-rate-limit": "^7.5.0",
13
+ "node-telegram-bot-api": "^0.67.0",
14
+ "open": "^11.0.0",
15
+ "openai": "^6.39.0",
16
+ "yaml": "^2.9.0"
17
+ }
18
+ }