nyxora 26.7.3 → 26.7.5
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/CHANGELOG.md +49 -1
- package/README.md +50 -11
- package/dist/launcher.js +29 -1
- package/dist/packages/core/src/agent/bridgeWatcher.js +1 -1
- package/dist/packages/core/src/agent/cronManager.js +1 -1
- package/dist/packages/core/src/agent/llmProvider.js +33 -4
- package/dist/packages/core/src/agent/nyxDaemon.js +2 -2
- package/dist/packages/core/src/agent/osAgent.js +159 -107
- package/dist/packages/core/src/agent/promptBuilder.js +452 -0
- package/dist/packages/core/src/agent/reasoning.js +66 -184
- package/dist/packages/core/src/agent/reasoningScratchpad.js +19 -2
- package/dist/packages/core/src/agent/threatPatterns.js +106 -0
- package/dist/packages/core/src/agent/web3Agent.js +26 -114
- package/dist/packages/core/src/agent/workspaceUtils.js +56 -0
- package/dist/packages/core/src/channels/ChannelManager.js +36 -0
- package/dist/packages/core/src/channels/discordAdapter.js +81 -0
- package/dist/packages/core/src/channels/googlechatAdapter.js +45 -0
- package/dist/packages/core/src/channels/imessageAdapter.js +34 -0
- package/dist/packages/core/src/channels/index.js +39 -0
- package/dist/packages/core/src/channels/ircAdapter.js +34 -0
- package/dist/packages/core/src/channels/lineAdapter.js +125 -0
- package/dist/packages/core/src/channels/matrixAdapter.js +34 -0
- package/dist/packages/core/src/channels/mattermostAdapter.js +45 -0
- package/dist/packages/core/src/channels/msteamsAdapter.js +45 -0
- package/dist/packages/core/src/channels/nextcloudtalkAdapter.js +45 -0
- package/dist/packages/core/src/channels/nostrAdapter.js +34 -0
- package/dist/packages/core/src/channels/qqbotAdapter.js +34 -0
- package/dist/packages/core/src/channels/slackAdapter.js +74 -0
- package/dist/packages/core/src/channels/smsAdapter.js +45 -0
- package/dist/packages/core/src/channels/synologychatAdapter.js +45 -0
- package/dist/packages/core/src/channels/telegram.js +362 -0
- package/dist/packages/core/src/channels/twitchAdapter.js +34 -0
- package/dist/packages/core/src/channels/voicecallAdapter.js +45 -0
- package/dist/packages/core/src/channels/whatsappAdapter.js +126 -0
- package/dist/packages/core/src/channels/zaloAdapter.js +45 -0
- package/dist/packages/core/src/config/parser.js +2 -1
- package/dist/packages/core/src/gateway/chat.js +10 -2
- package/dist/packages/core/src/gateway/cli.js +2 -0
- package/dist/packages/core/src/gateway/googleAuthModule.js +112 -12
- package/dist/packages/core/src/gateway/server.js +134 -3
- package/dist/packages/core/src/gateway/setup-ml.js +65 -2
- package/dist/packages/core/src/gateway/setup.js +61 -22
- package/dist/packages/core/src/gateway/telegram.js +26 -53
- package/dist/packages/core/src/memory/episodic.js +20 -5
- package/dist/packages/core/src/memory/logger.js +27 -9
- package/dist/packages/core/src/plugin/PluginManager.js +46 -16
- package/dist/packages/core/src/system/plugins/GoogleWorkspacePlugin.js +69 -22
- package/dist/packages/core/src/system/plugins/SystemNotesPlugin.js +148 -0
- package/dist/packages/core/src/system/plugins/SystemSocialPlugin.js +2 -14
- package/dist/packages/core/src/system/plugins/SystemWebPlugin.js +0 -5
- package/dist/packages/core/src/system/plugins/SystemWorkspacePlugin.js +25 -6
- package/dist/packages/core/src/system/skills/analyzeImage.js +82 -0
- package/dist/packages/core/src/system/skills/executeShell.js +31 -4
- package/dist/packages/core/src/system/skills/fileDownloader.js +45 -0
- package/dist/packages/core/src/system/skills/generateExcel.js +1 -1
- package/dist/packages/core/src/system/skills/googleWorkspace.js +278 -166
- package/dist/packages/core/src/system/skills/playbookManager.js +269 -0
- package/dist/packages/core/src/system/skills/searchWeb.js +13 -6
- package/dist/packages/core/src/system/skills/telegramUpload.js +25 -0
- package/dist/packages/core/src/utils/fileLinker.js +57 -0
- package/dist/packages/core/src/utils/historySanitizer.js +5 -1
- package/dist/packages/core/src/utils/llmUtils.js +5 -4
- package/dist/packages/core/src/utils/skillManager.js +8 -4
- package/dist/packages/core/src/utils/streamSimulator.js +14 -8
- package/dist/packages/core/src/web3/skills/checkPortfolio.js +7 -1
- package/dist/packages/core/src/web3/skills/getPrice.js +1 -1
- package/dist/packages/core/src/web3/skills/getTxHistory.js +44 -7
- package/dist/packages/core/src/web3/skills/marketAnalysis.js +1 -1
- package/launcher.ts +26 -1
- package/package.json +5 -8
- package/packages/core/package.json +27 -9
- package/packages/core/src/agent/bridgeWatcher.ts +1 -1
- package/packages/core/src/agent/cronManager.ts +1 -1
- package/packages/core/src/agent/llmProvider.ts +34 -5
- package/packages/core/src/agent/nyxDaemon.ts +3 -3
- package/packages/core/src/agent/osAgent.ts +170 -109
- package/packages/core/src/agent/promptBuilder.ts +476 -0
- package/packages/core/src/agent/reasoning.ts +60 -189
- package/packages/core/src/agent/reasoningScratchpad.ts +21 -2
- package/packages/core/src/agent/threatPatterns.ts +115 -0
- package/packages/core/src/agent/web3Agent.ts +23 -113
- package/packages/core/src/agent/workspaceUtils.ts +53 -0
- package/packages/core/src/channels/ChannelManager.ts +45 -0
- package/packages/core/src/channels/googlechatAdapter.ts +48 -0
- package/packages/core/src/channels/imessageAdapter.ts +37 -0
- package/packages/core/src/channels/index.ts +40 -0
- package/packages/core/src/channels/ircAdapter.ts +37 -0
- package/packages/core/src/channels/lineAdapter.ts +101 -0
- package/packages/core/src/channels/matrixAdapter.ts +37 -0
- package/packages/core/src/channels/mattermostAdapter.ts +48 -0
- package/packages/core/src/channels/msteamsAdapter.ts +48 -0
- package/packages/core/src/channels/nextcloudtalkAdapter.ts +48 -0
- package/packages/core/src/channels/nostrAdapter.ts +37 -0
- package/packages/core/src/channels/qqbotAdapter.ts +37 -0
- package/packages/core/src/channels/slackAdapter.ts +83 -0
- package/packages/core/src/channels/smsAdapter.ts +48 -0
- package/packages/core/src/channels/synologychatAdapter.ts +48 -0
- package/packages/core/src/{gateway → channels}/telegram.ts +113 -54
- package/packages/core/src/channels/twitchAdapter.ts +37 -0
- package/packages/core/src/channels/voicecallAdapter.ts +48 -0
- package/packages/core/src/channels/whatsappAdapter.ts +103 -0
- package/packages/core/src/channels/zaloAdapter.ts +48 -0
- package/packages/core/src/config/parser.ts +7 -1
- package/packages/core/src/gateway/chat.ts +10 -2
- package/packages/core/src/gateway/cli.ts +2 -0
- package/packages/core/src/gateway/googleAuthModule.ts +114 -10
- package/packages/core/src/gateway/server.ts +139 -3
- package/packages/core/src/gateway/setup-ml.ts +65 -4
- package/packages/core/src/gateway/setup.ts +60 -22
- package/packages/core/src/memory/episodic.ts +25 -9
- package/packages/core/src/memory/logger.ts +26 -9
- package/packages/core/src/plugin/PluginManager.ts +78 -16
- package/packages/core/src/system/plugins/GoogleWorkspacePlugin.ts +36 -33
- package/packages/core/src/system/plugins/SystemNotesPlugin.ts +141 -0
- package/packages/core/src/system/plugins/SystemSocialPlugin.ts +2 -14
- package/packages/core/src/system/plugins/SystemWebPlugin.ts +0 -5
- package/packages/core/src/system/plugins/SystemWorkspacePlugin.ts +25 -6
- package/packages/core/src/system/skills/analyzeImage.ts +79 -0
- package/packages/core/src/system/skills/executeShell.ts +38 -7
- package/packages/core/src/system/skills/fileDownloader.ts +43 -0
- package/packages/core/src/system/skills/generateExcel.ts +1 -1
- package/packages/core/src/system/skills/googleWorkspace.ts +262 -174
- package/packages/core/src/system/skills/playbookManager.ts +285 -0
- package/packages/core/src/system/skills/searchWeb.ts +12 -6
- package/packages/core/src/system/skills/telegramUpload.ts +23 -0
- package/packages/core/src/utils/fileLinker.ts +48 -0
- package/packages/core/src/utils/historySanitizer.ts +7 -1
- package/packages/core/src/utils/llmUtils.ts +5 -4
- package/packages/core/src/utils/skillManager.ts +9 -4
- package/packages/core/src/utils/streamSimulator.ts +15 -8
- package/packages/core/src/web3/skills/checkPortfolio.ts +8 -1
- package/packages/core/src/web3/skills/getPrice.ts +1 -1
- package/packages/core/src/web3/skills/getTxHistory.ts +42 -8
- package/packages/core/src/web3/skills/marketAnalysis.ts +1 -1
- package/packages/dashboard/dist/assets/index-BIXV2TNp.js +26 -0
- package/packages/dashboard/dist/assets/index-C2sWcvod.css +1 -0
- package/packages/dashboard/dist/index.html +2 -2
- package/packages/dashboard/package.json +1 -1
- package/packages/mcp-server/package.json +1 -1
- package/packages/ml-engine/__pycache__/config.cpython-313.pyc +0 -0
- package/packages/ml-engine/__pycache__/main.cpython-313.pyc +0 -0
- package/packages/ml-engine/config.py +59 -0
- package/packages/ml-engine/main.py +37 -0
- package/packages/ml-engine/requirements.txt +22 -0
- package/packages/ml-engine/routers/__init__.py +1 -0
- package/packages/ml-engine/routers/__pycache__/__init__.cpython-313.pyc +0 -0
- package/packages/ml-engine/routers/__pycache__/background_review.cpython-313.pyc +0 -0
- package/packages/ml-engine/routers/__pycache__/cognitive.cpython-313.pyc +0 -0
- package/packages/ml-engine/routers/__pycache__/critic.cpython-313.pyc +0 -0
- package/packages/ml-engine/routers/__pycache__/llm.cpython-313.pyc +0 -0
- package/packages/ml-engine/routers/__pycache__/market.cpython-313.pyc +0 -0
- package/packages/ml-engine/routers/__pycache__/memory.cpython-313.pyc +0 -0
- package/packages/ml-engine/routers/__pycache__/memory_writer.cpython-313.pyc +0 -0
- package/packages/ml-engine/routers/__pycache__/skill_manager.cpython-313.pyc +0 -0
- package/packages/ml-engine/routers/background_review.py +121 -0
- package/packages/ml-engine/routers/cognitive.py +98 -0
- package/packages/ml-engine/routers/critic.py +111 -0
- package/packages/ml-engine/routers/llm.py +38 -0
- package/packages/ml-engine/routers/market.py +332 -0
- package/packages/ml-engine/routers/memory.py +125 -0
- package/packages/ml-engine/routers/memory_writer.py +72 -0
- package/packages/ml-engine/routers/skill_manager.py +123 -0
- package/packages/policy/package.json +1 -1
- package/packages/signer/package.json +1 -1
- package/packages/core/src/system/skills/analyzeDocument.ts +0 -117
- package/packages/core/src/system/skills/gitManager.ts +0 -84
- package/packages/core/src/system/skills/notionWorkspace.ts +0 -78
- package/packages/core/src/system/skills/xManager.ts +0 -76
- package/packages/dashboard/dist/assets/index-BTfp141V.js +0 -18
- package/packages/dashboard/dist/assets/index-DK2sTU47.css +0 -1
- /package/packages/core/src/{gateway → channels}/discordAdapter.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,11 +4,59 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepashangelog.com/en/1.0.0/),
|
|
6
6
|
|
|
7
|
+
## [26.7.5]
|
|
8
|
+
### Reasoning & Agent Engine Architecture
|
|
9
|
+
- **Event-Driven Tool Execution**: Fully refactored the core agent loop (`osAgent.ts`) from a linear synchronous executor to a highly scalable, event-driven architecture using Lifecycle Hooks (`beforeToolCall`, `afterToolCall`). This completely decouples security guardrails and domain-specific logic from the core loop.
|
|
10
|
+
- **Parallel Execution Concurrency**: Supercharged the agent's data gathering capabilities by upgrading the execution engine to support parallel processing (`Promise.all`), allowing multiple safe tools to run concurrently for massive speed improvements.
|
|
11
|
+
- **Deferred Tool Resolution (MCP Ready)**: Built-in support for dynamic tool resolution, allowing the agent to request and execute external tools (e.g., via Model Context Protocol servers) on-the-fly even if they aren't loaded in the initial context.
|
|
12
|
+
- **Partial Streaming Feedback**: Long-running tools can now stream partial updates (`"⏳ Processing..."`) to the user interface (Telegram/Dashboard) before the execution is fully complete, significantly enhancing UX and transparency.
|
|
13
|
+
- **Advanced Guardrails**: The strict `Reasoning Gate` and `Web3 Fast Return` logic have been cleanly migrated into standalone middleware hooks, ensuring the main executor remains agnostic and maintainable.
|
|
14
|
+
- **Dynamic Reasoning Mapper**: Injected seamless support for `reasoning_effort` across the entire Unified Mapper API, making it universally compatible with both OpenAI and OpenRouter native reasoning models.
|
|
15
|
+
- **UX Sanitizer**: Implemented intelligent regex filtering to intercept and strip raw LLM `<think>` tags before they are broadcast to user-facing channels, keeping chat interfaces clean and elegant.
|
|
16
|
+
|
|
17
|
+
### UI/UX & Design System Overhaul
|
|
18
|
+
- **Modern UI Aesthetic**: Executed a comprehensive overhaul of the dashboard interface. Introduced advanced glassmorphism (`backdrop-filter: blur(20px)`) to the sidebar, softened structural corners (`border-radius: 18px`), and applied modern micro-animations and subtle drop-shadows across chat bubbles and input forms.
|
|
19
|
+
- **Color Harmony & Contrast**: Refined the Dark Mode palette by shifting the primary accent color to a sleek Cyan (`#32ADE6`). Adjusted typography across UI pills (Network Selectors, Trending Tokens) from harsh contrast to a harmonious, translucent off-white (`rgba(255, 255, 255, 0.85)`) for optimal readability without eye strain.
|
|
20
|
+
- **Chat Experience**: Redesigned the chat bubbles to distinctly separate user and agent messages using vibrant colored backgrounds for the user and elegant dark-glass styling for the agent, significantly improving spatial distinction.
|
|
21
|
+
|
|
22
|
+
### Native Channel Engine (Omni-Channel Integration)
|
|
23
|
+
- **Massive Architecture Overhaul**: Replaced the legacy hardcoded Telegram/Discord gateway with a highly scalable `ChannelManager`. Nyxora now natively and dynamically supports 19 distinct messaging platforms without requiring external sidecars.
|
|
24
|
+
- **Dynamic CLI Configuration**: Overhauled `setup.ts` to dynamically detect and register available channels, allowing users to select and configure credentials seamlessly via `nyxora start`.
|
|
25
|
+
- **19 Native SDK Implementations**: Successfully integrated and compiled native event listeners, Webhooks, and Socket Modes for WhatsApp (Baileys), Slack (Bolt Socket Mode), LINE, Microsoft Teams, Mattermost, Matrix, Google Chat, Synology, Nextcloud, Zalo, Twitch, iMessage, IRC, QQ Bot, Nostr, SMS, and Voice.
|
|
26
|
+
|
|
27
|
+
### Playbook Ecosystem & Automation
|
|
28
|
+
- **Playbook Recorder (Auto-Learn)**: Introduced a powerful Auto-Learn capability (CRITICAL RULE 7) allowing the OS Agent to dynamically record terminal workflows, abstract them into markdown instructions, and autonomously generate new reusable SOPs (Playbooks) based on chat history.
|
|
29
|
+
- **Skill Store Dashboard (Split-Pane UI)**: Built a brand-new native Skill Store interface in the dashboard (`Playbooks.tsx`), enabling users to browse, edit, and manage their local AI playbooks seamlessly via a modern split-pane editor without touching the terminal.
|
|
30
|
+
|
|
31
|
+
### Features & Architecture
|
|
32
|
+
- **Self-Learning & Continuous Improvement**: Transformed Nyxora into a continuously evolving AI. The OS Agent (`osAgent.ts`) now natively injects narrative profiles (`MEMORY.md` and `USER.md`) directly into the system prompt at the start of every session.
|
|
33
|
+
- **Asynchronous Background Review**: Engineered a non-blocking background auditor (`triggerBackgroundReview`) that executes silently after every interaction. The agent uses LangChain to evaluate recent conversations, autonomously identifying user preferences, extracting reusable workflows, and dynamically creating or patching its own skills (`skill_manager.py`) without user intervention.
|
|
34
|
+
|
|
35
|
+
### Bug Fixes & Improvements
|
|
36
|
+
- **Streaming UI Text Duplication & Glitch Fix**: Resolved a critical issue in the multi-turn streaming architecture where LLM "thought process" text (generated before a tool call) would leak and concatenate with the final answer on Telegram. Implemented a robust `[CLEAR_STREAM]` control signal that gracefully resets the message draft and displays a universal `⏳ Processing...` placeholder, completely eradicating message bubble collapse and visual jitter during tool execution.
|
|
37
|
+
|
|
38
|
+
## [26.7.4]
|
|
39
|
+
### Features & Architecture
|
|
40
|
+
- **Cognitive Critic Engine Enhancements (Staleness Detection)**: Added a multilingual time-sensitive detection rule to the Critic Engine (`critic.py`). By injecting the current UTC datetime, the Critic now explicitly flags answers containing time-sensitive keywords (e.g., "today", "kemarin", "now") if they rely on stale training memory rather than fresh tool execution.
|
|
41
|
+
- **Multilingual Scolding Detection (Teguran-Aware Mechanism)**: Nyxora now detects if the user scolds or corrects its output (e.g., "salah", "ngawur", "wrong") across multiple languages. It automatically injects an internal system prompt to force the LLM to discard stale assumptions and immediately trigger a fresh `search_web` or relevant tool call to verify facts.
|
|
42
|
+
|
|
43
|
+
### Bug Fixes & Improvements
|
|
44
|
+
- **Nyx Daemon SQLite Constraints**: Fixed a `UNIQUE constraint failed` crash in the background persona auditor (`episodicDB.upsertPersonaByCategory`). It now gracefully catches the constraint collision and shifts existing persona traits to their new dedicated categories without interrupting the daemon cycle.
|
|
45
|
+
- **Critic Engine LangChain Parsing**: Escaped raw JSON curly braces in `critic.py`'s system prompt example to prevent LangChain from misinterpreting them as missing template variables (`INVALID_PROMPT_INPUT`).
|
|
46
|
+
- **Documentation**: Replaced the "Alpha" status badge with "Prototype" and removed the "Built on Base" badge in `README.md`.
|
|
47
|
+
|
|
48
|
+
### Features & Google Workspace
|
|
49
|
+
- **Gmail Send Capability**: Extended the Google Workspace integration beyond read-only access. The AI agent can now natively compose and send emails via the Gmail API (`POST /gmail/v1/users/me/messages/send`) using RFC 2822 base64url-encoded payloads. The new `send_email` tool accepts `to`, `subject`, and `body` parameters.
|
|
50
|
+
- **Google Calendar Write Access**: Added the `add_calendar_event` tool, enabling the AI to autonomously create new events in the user's primary Google Calendar via the Calendar API. Accepts ISO 8601 `startTime`/`endTime` for precise scheduling.
|
|
51
|
+
- **OAuth Scope Expansion**: Added `gmail.send` and `calendar.events` scopes to `googleAuthModule.ts`. Users must re-authenticate to grant the new permissions.
|
|
52
|
+
- **Setup Wizard Accuracy Fix**: Updated the `GoogleAuthWizard.tsx` (Step 1) to include all required APIs: **Google Calendar API**, **Google Docs API**, and **Google Forms API**, which were previously missing from the setup instructions.
|
|
53
|
+
- **OAuth Consent Screen URL Fix**: Replaced unreachable `localhost:3001` Privacy Policy and Terms of Service placeholder URLs in the setup wizard with publicly accessible `nyxoraai.github.io` URLs, preventing `Error 400: unknownerror` during Google OAuth consent screen validation.
|
|
54
|
+
|
|
7
55
|
## [26.7.3]
|
|
8
56
|
### Bug Fixes & Improvements
|
|
9
57
|
- **Daemon Graceful Shutdown (Port 8000)**: Improved the `npm run stop` behavior by injecting a `forceKill` (`SIGKILL`) method within `launcher.ts`, explicitly terminating detached ML Engine processes (`uvicorn`) and `ts-node` instances that were previously hanging and preventing clean reboots.
|
|
10
58
|
- **Telegram Connectivity Timeout**: Resolved a persistent `Network request for 'getUpdates' failed!` issue in the Telegram integration. Enforced `dns.setDefaultResultOrder('ipv4first')` in `cli.ts` to bypass dual-stack IPv6 conflicts and ensure stable grammatical API fetching.
|
|
11
|
-
|
|
59
|
+
|
|
12
60
|
### Features & Architecture (Python ML Engine)
|
|
13
61
|
- **Local Python ML Engine Integration**: Successfully integrated a local Python-based Machine Learning Engine (FastAPI + LangChain + Pandas) alongside the core Node.js gateway. This massively enhances Nyxora's analytical and cognitive capabilities.
|
|
14
62
|
- **Cognitive Memory & RAG**: Shifted Persona Dialectic Reasoning and Episodic Memory Semantic Search (RAG) to the new Python Engine. Integrated `langchain_huggingface` using the local `all-MiniLM-L6-v2` embedding model for ultra-fast, offline vector processing without API costs.
|
package/README.md
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
**Your Personal Web3 Assistant.**
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
[](#)
|
|
6
|
+
|
|
7
7
|
[](#)
|
|
8
8
|
[](https://opensource.org/licenses/MIT)
|
|
9
9
|
[](#️-advanced-security-threat-model)
|
|
@@ -72,7 +72,7 @@ It operates under a **Zero-Trust, Defense-in-Depth Cryptographically Bound Human
|
|
|
72
72
|
|
|
73
73
|
### Advanced Security Architecture
|
|
74
74
|
* **🛡️ On-Chain AI Kill-Switch**: Nyxora is governed by a Base Smart Contract (`NyxoraAgentRegistry`). Users have absolute cryptographic power to instantly paralyze the AI's on-chain execution if compromised, solving the Web3 AI safety dilemma. [Read more about our Base Architecture](https://nyxoraai.github.io/Nyxora/smart-contract)
|
|
75
|
-
* **
|
|
75
|
+
* **6-Tier Hybrid Architecture**: Nyxora is split into isolated microservices: **Dashboard** (Port 5173), **MCP Server** (Port 3001), **Core LLM** (Port 3000), **ML Engine** (Python Sidecar on Port 8000), **Policy Engine** (Unix Socket), and **Signer Vault** (Unix Socket).
|
|
76
76
|
* **DeFi & Market Configuration BYOK & UI Masking**: All aggregator, provider, and oracle API keys are strictly isolated via a Bring Your Own Keys (BYOK) architecture into heavily guarded `~/.nyxora/defi_keys.yaml` and `~/.nyxora/market_keys.yaml` files. The local web Dashboard masks these injected secrets using `***********` and `IS_SET` censorship, completely neutralizing malicious browser extensions from exfiltrating your keys.
|
|
77
77
|
* **Approval Replay Protection (Nonce Guard)**: Transactions requested by the AI are drafted as hashes and signed with a randomized 16-byte Nonce. The `/api/transactions/:id/approve` endpoint strictly enforces Nonce matching to completely eliminate double-spending and Replay Attacks.
|
|
78
78
|
* **Native Asset Parameter Tampering Protection**: The internal cryptographic HMAC signature rigorously binds `toAddress`, `txData`, and `valueWei`, rendering the system mathematically immune to Native Token (ETH/BNB) destination or amount hijacking via Indirect Prompt Injections.
|
|
@@ -121,15 +121,54 @@ It operates under a **Zero-Trust, Defense-in-Depth Cryptographically Bound Human
|
|
|
121
121
|
|
|
122
122
|
## 📐 Architecture Workflow
|
|
123
123
|
|
|
124
|
-
The following diagram illustrates Nyxora's **
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
The following diagram illustrates Nyxora's **6-Tier Hybrid Architecture**, showing the isolated communication channels across the ecosystem.
|
|
125
|
+
|
|
126
|
+
```text
|
|
127
|
+
+-------------------------------------------------------------+
|
|
128
|
+
| Nyxora 6-Tier Architecture |
|
|
129
|
+
+-------------------------------------------------------------+
|
|
130
|
+
|
|
131
|
+
[ User / External Client ]
|
|
132
|
+
|
|
|
133
|
+
v
|
|
134
|
+
+-----------------------------+ +-------------------------+
|
|
135
|
+
| Dashboard (UI) | | MCP Server |
|
|
136
|
+
| Port 5173 | | Port 3001 |
|
|
137
|
+
+-----------------------------+ +-------------------------+
|
|
138
|
+
| |
|
|
139
|
+
+---------------+------------------+
|
|
140
|
+
|
|
|
141
|
+
v
|
|
142
|
+
+--------------------+
|
|
143
|
+
| Core LLM Runtime | <--- (NLP Parsing, Routing,
|
|
144
|
+
| Port 3000 | Agent Logic)
|
|
145
|
+
+--------------------+
|
|
146
|
+
^ |
|
|
147
|
+
(RAG & Math) | | (Draft Transaction)
|
|
148
|
+
v v
|
|
149
|
+
+-------------------------+ +-------------------------------+
|
|
150
|
+
| ML Engine | | Policy Engine (Guard) |
|
|
151
|
+
| Port 8000 | | Unix Socket (IPC) / Loopback |
|
|
152
|
+
+-------------------------+ +-------------------------------+
|
|
153
|
+
|
|
|
154
|
+
| (Approved Payload)
|
|
155
|
+
v
|
|
156
|
+
+-------------------------------+
|
|
157
|
+
| Signer Vault (Safe) |
|
|
158
|
+
| Unix Socket (IPC) |
|
|
159
|
+
+-------------------------------+
|
|
160
|
+
|
|
|
161
|
+
v
|
|
162
|
+
[ Blockchain RPC ]
|
|
163
|
+
```
|
|
127
164
|
|
|
128
|
-
*Nyxora separates its duties into
|
|
129
|
-
1.
|
|
130
|
-
2.
|
|
131
|
-
3.
|
|
132
|
-
4.
|
|
165
|
+
*Nyxora separates its duties into 6 independent layers for absolute security and cognitive depth:*
|
|
166
|
+
1. **🖥️ Dashboard (UI)**: A premium local React interface for real-time monitoring and conversational execution.
|
|
167
|
+
2. **🔌 MCP Server (Context Provider)**: An open standard interface to connect Nyxora with external AI environments like Claude Desktop natively.
|
|
168
|
+
3. **🧠 Core (The AI Brain)**: The Node.js intelligent assistant that strategizes and plans transactions, but **never** holds your funds.
|
|
169
|
+
4. **🧬 ML Engine (Cognitive Sidecar)**: A local Python/FastAPI sidecar running LangChain and HuggingFace models for hyper-fast Semantic RAG memory and Pandas-based technical market analysis.
|
|
170
|
+
5. **🛡️ Policy Engine (The Guard)**: The security guard that verifies the Brain's plans. If the AI attempts to send funds exceeding your set limits, this engine automatically blocks it.
|
|
171
|
+
6. **🔒 Signer Vault (The Safe)**: The offline vault where your Private Keys **and highly sensitive 3rd-party tokens (e.g., Google Workspace OAuth)** are securely locked natively in your OS Keyring. It only signs transactions after they pass all rigorous security checks.
|
|
133
172
|
|
|
134
173
|
### Web3 Separation of Concerns (Zero-Trust Routing)
|
|
135
174
|
Within the AI Brain, the Web3 codebase is strictly divided to prevent the LLM from hallucinating or maliciously manipulating low-level routing paths:
|
package/dist/launcher.js
CHANGED
|
@@ -141,7 +141,9 @@ setTimeout(() => {
|
|
|
141
141
|
// Spawn ML Engine (Python Sidecar)
|
|
142
142
|
const pythonPath = path_1.default.join(process.env.HOME || process.env.USERPROFILE || '', '.nyxora', 'ml-engine', 'venv', 'bin', 'python');
|
|
143
143
|
if (fs_1.default.existsSync(pythonPath)) {
|
|
144
|
-
|
|
144
|
+
let mlDir = path_1.default.join(__dirnameResolved, 'packages', 'ml-engine');
|
|
145
|
+
if (!fs_1.default.existsSync(mlDir))
|
|
146
|
+
mlDir = path_1.default.join(__dirnameResolved, '..', 'packages', 'ml-engine');
|
|
145
147
|
const mlArgs = ['-m', 'uvicorn', 'main:app', '--host', '127.0.0.1', '--port', '8000'];
|
|
146
148
|
const mlEngine = spawnService('ML Engine', pythonPath, mlArgs, env, false, mlDir);
|
|
147
149
|
children.push(mlEngine);
|
|
@@ -154,6 +156,32 @@ setTimeout(() => {
|
|
|
154
156
|
const args = process.argv.slice(2);
|
|
155
157
|
const core = spawnService('Core', cmd, [...baseArgs, corePath, ...args], env, true);
|
|
156
158
|
children.push(core);
|
|
159
|
+
// --- AUTO-TUNNEL (Cloudflare) ---
|
|
160
|
+
setTimeout(() => {
|
|
161
|
+
console.log('[Launcher] Starting Auto-Tunnel (Cloudflare) on port 3000...');
|
|
162
|
+
const cf = (0, child_process_1.spawn)('npx', ['cloudflared', 'tunnel', '--url', 'http://localhost:3000'], { env, shell: true });
|
|
163
|
+
children.push({
|
|
164
|
+
kill: () => { try {
|
|
165
|
+
process.kill(cf.pid, 'SIGTERM');
|
|
166
|
+
}
|
|
167
|
+
catch (e) { } },
|
|
168
|
+
forceKill: () => { try {
|
|
169
|
+
process.kill(cf.pid, 'SIGKILL');
|
|
170
|
+
}
|
|
171
|
+
catch (e) { } }
|
|
172
|
+
});
|
|
173
|
+
cf.stderr.on('data', (data) => {
|
|
174
|
+
const msg = data.toString();
|
|
175
|
+
// Extract the Cloudflare URL (e.g., https://xyz.trycloudflare.com)
|
|
176
|
+
const match = msg.match(/https:\/\/[a-zA-Z0-9-]+\.trycloudflare\.com/);
|
|
177
|
+
if (match) {
|
|
178
|
+
const url = match[0];
|
|
179
|
+
console.log(`\n[Auto-Tunnel] Secure Public URL generated: ${url}\n`);
|
|
180
|
+
fs_1.default.writeFileSync(path_1.default.join(nyxoraDir, 'public_url.txt'), url, 'utf8');
|
|
181
|
+
}
|
|
182
|
+
// Optionally print errors if they are real errors, but cloudflared logs everything to stderr
|
|
183
|
+
});
|
|
184
|
+
}, 3000);
|
|
157
185
|
}, 1000);
|
|
158
186
|
}, 1000);
|
|
159
187
|
}, 1000);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.startBridgeWatcher = startBridgeWatcher;
|
|
4
4
|
const transactionManager_1 = require("./transactionManager");
|
|
5
|
-
const telegram_1 = require("../
|
|
5
|
+
const telegram_1 = require("../channels/telegram");
|
|
6
6
|
const parser_1 = require("../config/parser");
|
|
7
7
|
// In a real production environment, this would use the @eth-optimism/sdk
|
|
8
8
|
// to fetch the Merkle Proof and call proveWithdrawalTransaction on L1.
|
|
@@ -39,7 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.cronManager = void 0;
|
|
40
40
|
const croner_1 = require("croner");
|
|
41
41
|
const parser_1 = require("../config/parser");
|
|
42
|
-
const telegram_1 = require("../
|
|
42
|
+
const telegram_1 = require("../channels/telegram");
|
|
43
43
|
const crypto_1 = require("crypto");
|
|
44
44
|
const picocolors_1 = __importDefault(require("picocolors"));
|
|
45
45
|
class CronManager {
|
|
@@ -11,6 +11,7 @@ class OpenAIAdapter {
|
|
|
11
11
|
return {
|
|
12
12
|
message: {
|
|
13
13
|
content: response.choices[0].message.content,
|
|
14
|
+
reasoning_content: response.choices[0].message.reasoning_content || null,
|
|
14
15
|
tool_calls: response.choices[0].message.tool_calls
|
|
15
16
|
},
|
|
16
17
|
usage: response.usage ? { total_tokens: response.usage.total_tokens } : undefined
|
|
@@ -20,6 +21,7 @@ class OpenAIAdapter {
|
|
|
20
21
|
try {
|
|
21
22
|
const streamRes = await this.client.chat.completions.create({ ...request, stream: true });
|
|
22
23
|
let fullContent = '';
|
|
24
|
+
let reasoningContent = '';
|
|
23
25
|
const toolCallsMap = {};
|
|
24
26
|
for await (const chunk of streamRes) {
|
|
25
27
|
const delta = chunk.choices[0]?.delta;
|
|
@@ -27,6 +29,9 @@ class OpenAIAdapter {
|
|
|
27
29
|
fullContent += delta.content;
|
|
28
30
|
onChunk(delta.content);
|
|
29
31
|
}
|
|
32
|
+
if (delta?.reasoning_content) {
|
|
33
|
+
reasoningContent += delta.reasoning_content;
|
|
34
|
+
}
|
|
30
35
|
if (delta?.tool_calls) {
|
|
31
36
|
for (const tc of delta.tool_calls) {
|
|
32
37
|
if (!toolCallsMap[tc.index]) {
|
|
@@ -47,6 +52,7 @@ class OpenAIAdapter {
|
|
|
47
52
|
return {
|
|
48
53
|
message: {
|
|
49
54
|
content: fullContent || null,
|
|
55
|
+
reasoning_content: reasoningContent || null,
|
|
50
56
|
tool_calls: toolCalls.length > 0 ? toolCalls : undefined
|
|
51
57
|
}
|
|
52
58
|
};
|
|
@@ -55,6 +61,7 @@ class OpenAIAdapter {
|
|
|
55
61
|
// Fallback to non-streaming if streaming fails
|
|
56
62
|
const chatRes = await this.chat(request);
|
|
57
63
|
if (chatRes.message.content) {
|
|
64
|
+
onChunk('[CLEAR_STREAM]');
|
|
58
65
|
onChunk(chatRes.message.content);
|
|
59
66
|
}
|
|
60
67
|
return chatRes;
|
|
@@ -149,11 +156,15 @@ class AnthropicAdapter {
|
|
|
149
156
|
max_tokens: request.max_tokens || 4096
|
|
150
157
|
});
|
|
151
158
|
let contentStr = null;
|
|
159
|
+
let reasoningStr = null;
|
|
152
160
|
let toolCalls = [];
|
|
153
161
|
for (const block of response.content) {
|
|
154
162
|
if (block.type === 'text') {
|
|
155
163
|
contentStr = (contentStr || '') + block.text;
|
|
156
164
|
}
|
|
165
|
+
else if (block.type === 'thinking') {
|
|
166
|
+
reasoningStr = (reasoningStr || '') + block.thinking;
|
|
167
|
+
}
|
|
157
168
|
else if (block.type === 'tool_use') {
|
|
158
169
|
toolCalls.push({
|
|
159
170
|
id: block.id,
|
|
@@ -168,6 +179,7 @@ class AnthropicAdapter {
|
|
|
168
179
|
return {
|
|
169
180
|
message: {
|
|
170
181
|
content: contentStr,
|
|
182
|
+
reasoning_content: reasoningStr,
|
|
171
183
|
tool_calls: toolCalls.length > 0 ? toolCalls : undefined
|
|
172
184
|
},
|
|
173
185
|
usage: response.usage ? { total_tokens: response.usage.input_tokens + response.usage.output_tokens } : undefined
|
|
@@ -220,7 +232,10 @@ class AnthropicAdapter {
|
|
|
220
232
|
mergedAnthropic.push(m);
|
|
221
233
|
}
|
|
222
234
|
}
|
|
223
|
-
|
|
235
|
+
let anthropicTools = undefined;
|
|
236
|
+
if (request.tools && request.tools.length > 0) {
|
|
237
|
+
anthropicTools = request.tools.map(t => ({ name: t.function.name, description: t.function.description, input_schema: t.function.parameters }));
|
|
238
|
+
}
|
|
224
239
|
const stream = this.client.messages.stream({
|
|
225
240
|
model: request.model,
|
|
226
241
|
system: systemPrompt,
|
|
@@ -230,12 +245,16 @@ class AnthropicAdapter {
|
|
|
230
245
|
max_tokens: request.max_tokens || 4096
|
|
231
246
|
});
|
|
232
247
|
let fullContent = '';
|
|
248
|
+
let reasoningContent = '';
|
|
233
249
|
const toolCalls = [];
|
|
234
250
|
for await (const event of stream) {
|
|
235
251
|
if (event.type === 'content_block_delta' && event.delta.type === 'text_delta') {
|
|
236
252
|
fullContent += event.delta.text;
|
|
237
253
|
onChunk(event.delta.text);
|
|
238
254
|
}
|
|
255
|
+
if (event.type === 'content_block_delta' && event.delta.type === 'thinking_delta') {
|
|
256
|
+
reasoningContent += event.delta.thinking;
|
|
257
|
+
}
|
|
239
258
|
if (event.type === 'content_block_start' && event.content_block.type === 'tool_use') {
|
|
240
259
|
toolCalls.push({ id: event.content_block.id, type: 'function', function: { name: event.content_block.name, arguments: '' } });
|
|
241
260
|
}
|
|
@@ -245,10 +264,15 @@ class AnthropicAdapter {
|
|
|
245
264
|
last.function.arguments += event.delta.partial_json;
|
|
246
265
|
}
|
|
247
266
|
}
|
|
248
|
-
return { message: { content: fullContent || null, tool_calls: toolCalls.length > 0 ? toolCalls : undefined } };
|
|
267
|
+
return { message: { content: fullContent || null, reasoning_content: reasoningContent || null, tool_calls: toolCalls.length > 0 ? toolCalls : undefined } };
|
|
249
268
|
}
|
|
250
269
|
catch {
|
|
251
|
-
|
|
270
|
+
const chatRes = await this.chat(request);
|
|
271
|
+
if (chatRes.message.content) {
|
|
272
|
+
onChunk('[CLEAR_STREAM]');
|
|
273
|
+
onChunk(chatRes.message.content);
|
|
274
|
+
}
|
|
275
|
+
return chatRes;
|
|
252
276
|
}
|
|
253
277
|
}
|
|
254
278
|
}
|
|
@@ -507,7 +531,12 @@ class GeminiAdapter {
|
|
|
507
531
|
};
|
|
508
532
|
}
|
|
509
533
|
catch {
|
|
510
|
-
|
|
534
|
+
const chatRes = await this.chat(request);
|
|
535
|
+
if (chatRes.message.content) {
|
|
536
|
+
onChunk('[CLEAR_STREAM]');
|
|
537
|
+
onChunk(chatRes.message.content);
|
|
538
|
+
}
|
|
539
|
+
return chatRes;
|
|
511
540
|
}
|
|
512
541
|
}
|
|
513
542
|
}
|
|
@@ -56,7 +56,7 @@ class NyxDaemon {
|
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
// Kirim riwayat percakapan ke Python ML Engine untuk diproses oleh LangChain
|
|
59
|
-
const res = await fetch('http://
|
|
59
|
+
const res = await fetch('http://127.0.0.1:8000/cognitive/reason', {
|
|
60
60
|
method: 'POST',
|
|
61
61
|
headers: { 'Content-Type': 'application/json' },
|
|
62
62
|
body: JSON.stringify({ messages: conversationOnly })
|
|
@@ -82,7 +82,7 @@ class NyxDaemon {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
catch (e) {
|
|
85
|
-
console.error(picocolors_1.default.red('[Nyx] Failed to process traits from Python'), traits);
|
|
85
|
+
console.error(picocolors_1.default.red('[Nyx] Failed to process traits from Python: ' + e.message), traits);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
catch (e) {
|