nyxora 26.7.10 → 26.7.23
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 +175 -1
- package/README.md +17 -4
- package/bin/nyxora.mjs +44 -1
- package/dist/launcher.js +9 -3
- package/dist/packages/core/src/agent/cronManager.js +55 -14
- package/dist/packages/core/src/agent/llmProvider.js +130 -17
- package/dist/packages/core/src/agent/nyxDaemon.js +1 -1
- package/dist/packages/core/src/agent/osAgent.js +459 -142
- package/dist/packages/core/src/agent/projectAnalyzer.js +282 -0
- package/dist/packages/core/src/agent/promptBuilder.js +504 -208
- package/dist/packages/core/src/agent/reasoning.js +136 -240
- package/dist/packages/core/src/agent/transactionManager.js +7 -0
- package/dist/packages/core/src/agent/web3Agent.js +256 -61
- package/dist/packages/core/src/channels/telegram.js +563 -404
- package/dist/packages/core/src/gateway/chat.js +2 -2
- package/dist/packages/core/src/gateway/cli.js +25 -4
- package/dist/packages/core/src/gateway/server.js +457 -36
- package/dist/packages/core/src/gateway/tracker.js +10 -4
- package/dist/packages/core/src/memory/logger.js +181 -25
- package/dist/packages/core/src/memory/reflection.js +33 -12
- package/dist/packages/core/src/memory/trajectoryLogger.js +89 -0
- package/dist/packages/core/src/system/agentskills.js +6 -0
- package/dist/packages/core/src/system/plugins/SystemWorkspacePlugin.js +74 -7
- package/dist/packages/core/src/system/plugins/createSkill.js +2 -2
- package/dist/packages/core/src/system/skillExtractor.js +24 -43
- package/dist/packages/core/src/system/skills/browseWeb.js +18 -6
- package/dist/packages/core/src/system/skills/computerUse.js +185 -0
- package/dist/packages/core/src/system/skills/createAgentSkill.js +12 -14
- package/dist/packages/core/src/system/skills/delegateSubagent.js +80 -0
- package/dist/packages/core/src/system/skills/editFile.js +1 -1
- package/dist/packages/core/src/system/skills/executeShell.js +72 -3
- package/dist/packages/core/src/system/skills/executeShellPTY.js +142 -0
- package/dist/packages/core/src/system/skills/generateImage.js +71 -21
- package/dist/packages/core/src/system/skills/readFile.js +1 -1
- package/dist/packages/core/src/system/skills/searchFiles.js +175 -0
- package/dist/packages/core/src/system/skills/searchWeb.js +319 -41
- package/dist/packages/core/src/system/skills/todoTool.js +160 -0
- package/dist/packages/core/src/system/skills/writeFile.js +1 -1
- package/dist/packages/core/src/utils/contextSummarizer.js +213 -57
- package/dist/packages/core/src/utils/dynamicTokenUpdater.js +14 -1
- package/dist/packages/core/src/utils/historySanitizer.js +198 -38
- package/dist/packages/core/src/utils/llmUtils.js +1 -0
- package/dist/packages/core/src/utils/streamSimulator.js +32 -4
- package/dist/packages/core/src/web3/aggregator/providers/ArbitrumBridgeProvider.js +35 -2
- package/dist/packages/core/src/web3/skills/checkPortfolio.js +42 -39
- package/dist/packages/core/src/web3/skills/checkSecurity.js +29 -9
- package/dist/packages/core/src/web3/skills/getBalance.js +1 -1
- package/dist/packages/core/src/web3/skills/getTrendingTokens.js +29 -2
- package/dist/packages/core/src/web3/skills/getTxHistory.js +28 -17
- package/dist/packages/core/src/web3/skills/marketAnalysis.js +43 -9
- package/dist/packages/core/src/web3/utils/vaultClient.js +2 -2
- package/dist/packages/signer/src/NyxoraSigner.js +4 -2
- package/launcher.ts +9 -4
- package/package.json +93 -11
- package/packages/core/package.json +8 -2
- package/packages/core/playbooks/autonomous-ai-agents/nyxora-agent/SKILL.md +0 -8
- package/packages/core/playbooks/productivity/notion/SKILL.md +9 -10
- package/packages/core/src/agent/cronManager.ts +65 -18
- package/packages/core/src/agent/llmProvider.ts +130 -18
- package/packages/core/src/agent/nyxDaemon.ts +1 -1
- package/packages/core/src/agent/osAgent.ts +497 -147
- package/packages/core/src/agent/projectAnalyzer.ts +310 -0
- package/packages/core/src/agent/promptBuilder.ts +516 -198
- package/packages/core/src/agent/reasoning.ts +136 -241
- package/packages/core/src/agent/transactionManager.ts +6 -0
- package/packages/core/src/agent/web3Agent.ts +281 -68
- package/packages/core/src/channels/telegram.ts +576 -443
- package/packages/core/src/channels/telegram.ts.bak +708 -0
- package/packages/core/src/config/parser.ts +7 -0
- package/packages/core/src/gateway/chat.ts +2 -2
- package/packages/core/src/gateway/cli.ts +27 -3
- package/packages/core/src/gateway/server.ts +457 -34
- package/packages/core/src/gateway/server.ts.bak +1480 -0
- package/packages/core/src/gateway/tracker.ts +10 -3
- package/packages/core/src/memory/logger.ts +185 -29
- package/packages/core/src/memory/logger.ts.bak +517 -0
- package/packages/core/src/memory/reflection.ts +37 -15
- package/packages/core/src/memory/trajectoryLogger.ts +56 -0
- package/packages/core/src/system/agentskills.ts +6 -0
- package/packages/core/src/system/plugins/SystemWorkspacePlugin.ts +76 -7
- package/packages/core/src/system/plugins/createSkill.ts +2 -2
- package/packages/core/src/system/skillExtractor.ts +24 -44
- package/packages/core/src/system/skills/browseWeb.ts +20 -6
- package/packages/core/src/system/skills/computerUse.ts +152 -0
- package/packages/core/src/system/skills/createAgentSkill.ts +12 -14
- package/packages/core/src/system/skills/delegateSubagent.ts +49 -0
- package/packages/core/src/system/skills/editFile.ts +1 -1
- package/packages/core/src/system/skills/executeShell.ts +72 -5
- package/packages/core/src/system/skills/executeShellPTY.ts +113 -0
- package/packages/core/src/system/skills/generateImage.ts +84 -27
- package/packages/core/src/system/skills/readFile.ts +1 -1
- package/packages/core/src/system/skills/searchFiles.ts +189 -0
- package/packages/core/src/system/skills/searchWeb.ts +326 -45
- package/packages/core/src/system/skills/todoTool.ts +191 -0
- package/packages/core/src/system/skills/writeFile.ts +1 -1
- package/packages/core/src/utils/contextSummarizer.ts +246 -54
- package/packages/core/src/utils/dynamicTokenUpdater.ts +16 -2
- package/packages/core/src/utils/historySanitizer.ts +202 -33
- package/packages/core/src/utils/llmUtils.ts +1 -0
- package/packages/core/src/utils/streamSimulator.ts +41 -4
- package/packages/core/src/web3/aggregator/providers/ArbitrumBridgeProvider.ts +2 -1
- package/packages/core/src/web3/skills/checkPortfolio.ts +46 -42
- package/packages/core/src/web3/skills/checkSecurity.ts +29 -10
- package/packages/core/src/web3/skills/getBalance.ts +1 -1
- package/packages/core/src/web3/skills/getTrendingTokens.ts +33 -2
- package/packages/core/src/web3/skills/getTxHistory.ts +33 -15
- package/packages/core/src/web3/skills/marketAnalysis.ts +46 -7
- package/packages/core/src/web3/utils/vaultClient.ts +2 -2
- package/packages/dashboard/dist/assets/index-Cxh73Rml.js +87 -0
- package/packages/dashboard/dist/assets/index-DLBxY6G0.css +1 -0
- package/packages/dashboard/dist/index.html +2 -2
- package/packages/dashboard/package.json +6 -1
- package/packages/mcp-server/package.json +3 -1
- package/packages/ml-engine/main.py +2 -1
- package/packages/ml-engine/requirements.txt +3 -0
- package/packages/ml-engine/routers/background_review.py +3 -3
- package/packages/ml-engine/routers/market.py +18 -0
- package/packages/ml-engine/routers/memory.py +50 -0
- package/packages/ml-engine/routers/memory_writer.py +4 -4
- package/packages/ml-engine/routers/os_agent.py +423 -0
- package/packages/policy/package.json +3 -1
- package/packages/signer/package.json +3 -1
- package/packages/signer/src/NyxoraSigner.ts +4 -2
- package/packages/tui/dist/app/App.js +28 -0
- package/packages/tui/dist/components/MainArea.js +110 -0
- package/packages/tui/dist/components/Sidebar.js +5 -0
- package/packages/tui/dist/components/logo.js +50 -0
- package/packages/tui/dist/index.js +13 -0
- package/packages/tui/package.json +17 -0
- package/scripts/install-ml-engine.mjs +72 -0
- package/dist/packages/core/src/gateway/discordAdapter.js +0 -81
- package/dist/packages/core/src/gateway/telegram.js +0 -282
- package/dist/packages/core/src/plugin/registry.test.js +0 -38
- package/dist/packages/core/src/system/skills/analyzeDocument.js +0 -145
- package/dist/packages/core/src/system/skills/gitManager.js +0 -91
- package/dist/packages/core/src/system/skills/notionWorkspace.js +0 -80
- package/dist/packages/core/src/system/skills/xManager.js +0 -78
- package/dist/packages/core/src/utils/formatter.test.js +0 -40
- package/packages/core/playbooks/web3/onchainkit/assets/templates/basic-app/.env.local.example +0 -20
- package/packages/core/src/config/parser.d.ts +0 -83
- package/packages/core/src/config/parser.js +0 -290
- package/packages/core/src/config/paths.d.ts +0 -2
- package/packages/core/src/config/paths.js +0 -68
- package/packages/core/src/utils/safeLogger.d.ts +0 -4
- package/packages/core/src/utils/safeLogger.js +0 -59
- package/packages/core/src/web3/config.d.ts +0 -3
- package/packages/core/src/web3/config.js +0 -20
- package/packages/core/src/web3/skills/checkRegistryStatus.d.ts +0 -21
- package/packages/core/src/web3/skills/checkRegistryStatus.js +0 -92
- package/packages/core/src/web3/utils/chains.d.ts +0 -1596
- package/packages/core/src/web3/utils/chains.js +0 -36
- package/packages/core/src/web3/utils/rpcEngine.d.ts +0 -4
- package/packages/core/src/web3/utils/rpcEngine.js +0 -138
- package/packages/core/src/web3/utils/vaultClient.d.ts +0 -2
- package/packages/core/src/web3/utils/vaultClient.js +0 -122
- package/packages/dashboard/dist/assets/index-Dg9eiK4h.css +0 -1
- package/packages/dashboard/dist/assets/index-p3yL9asH.js +0 -26
- 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/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/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,181 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
-
The format is based on [Keep a Changelog](https://
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
6
|
+
|
|
7
|
+
## [26.7.23]
|
|
8
|
+
### Dashboard Features & UI
|
|
9
|
+
- **System & Maintenance Module**: Engineered the `System.tsx` component from scratch. The interface now features a sleek, edge-to-edge stacked row list design, completely abandoning the legacy card-based layout for a more professional, native application feel.
|
|
10
|
+
- **Native System Operations**: Implemented deep integration between the React frontend and the Node.js daemon. Users can now natively trigger **Restart Server**, **Shutdown Server**, and **Clear System Cache** directly from the UI without touching the CLI.
|
|
11
|
+
- **OS Autostart Controller**: Introduced a cross-platform Auto-Start toggle in the dashboard. The system dynamically queries and manages `.desktop` (Linux) and `.plist` (macOS) configurations via `GET/POST /api/system/autostart`.
|
|
12
|
+
- **Wallet Balances Fix**: Resolved a data mapping issue in `Wallets.tsx`. The component now correctly utilizes `viem`'s `formatUnits` combined with backend `decimals` and `priceUsd` to flawlessly compute and render real-time fiat values for multi-chain assets. Added a functional Refresh button to sync the latest portfolio states.
|
|
13
|
+
- **Minimalist Aesthetic**: Purged redundant icons/emojis across the System settings to achieve a clean, text-heavy minimalist aesthetic, reserving visual icons strictly for the page header and footer.
|
|
14
|
+
|
|
15
|
+
### Bug Fixes & Agent Enhancements
|
|
16
|
+
- **Windows CLI Spawn Fix (Critical)**: Resolved a major UX issue for global Windows users where running `nyxora start` would rapidly spawn multiple visible `cmd.exe` and `node.exe` console windows. Implemented `windowsHide: true` across all detached daemon spawns and Cloudflared sub-processes in `nyxora.mjs` and `launcher.ts`, ensuring Nyxora boots perfectly in headless mode on Windows without spamming the user's desktop.
|
|
17
|
+
- **Windows CLI Stop/Restart Fix**: Fixed a critical crash where `nyxora stop` and `nyxora restart` failed on Windows systems. Switched process termination from POSIX-only `-pid` (Process Group Signal) to native Windows `taskkill /pid <PID> /t /f` via `spawnSync`, ensuring all daemon and microservice child processes (like Python ML Engine) are cleanly forcefully terminated without leaving zombie processes.
|
|
18
|
+
- **Smart Anti-Loop Breaker V2.0**: Completely overhauled the agent's anti-loop safety mechanism. Removed rigid hard-limits on specific tool usage (e.g. `write_local_file`) to allow unconstrained complex coding sessions. Replaced it with an intelligent "Soft Warning" system that injects a self-reflection prompt into the LLM's context every 5 repetitions, allowing the AI to organically realize if it's hallucinating and ask the user for help. Also increased global `MAX_TURNS` from 30 to 50 for extended autonomous workflows.
|
|
19
|
+
- **Auto-Scroll Chat Snap Fix**: Resolved a Dashboard UI glitch where LLM text streaming would scroll the container to the top instead of the bottom. Fixed ResizeObserver spacer calculation timing and exact layout recalculation bounds, ensuring smooth and flawless chat autoscrolling identical to the Desktop app.
|
|
20
|
+
## [26.7.22]
|
|
21
|
+
### Bug Fixes & Monorepo Enhancements
|
|
22
|
+
- **Global `npm install` Crash Fix (Critical Fix)**: Resolved a severe issue where `nyxora start` would crash immediately after global installation (`npm install -g nyxora`) due to missing dependencies. All required workspace dependencies (e.g., `systeminformation`, messaging bot SDKs) have now been synced and hoisted to the root `package.json`, ensuring the background daemon can boot properly for global users without throwing `Cannot find module` errors.
|
|
23
|
+
- **Dependency Overrides Synchronization**: Fixed dependency conflict warnings during installation by aligning `lodash-es` and `undici` versions with the root workspace `overrides`.
|
|
24
|
+
|
|
25
|
+
## [26.7.21]
|
|
26
|
+
### Dashboard Features & UI
|
|
27
|
+
- **Control Panel Expansion**: Engineered 4 brand new native dashboard menus (`Memory`, `Security`, `Wallets`, `Workflows`) transforming the dashboard into a full-fledged agent control panel.
|
|
28
|
+
- **Backend API Integration**: Fully connected the new UI to real-time Nyxora Core APIs. The interface now dynamically fetches and manages state for episodic memory (`/api/memory`), security policies (`/api/policy`), EVM wallet and multi-chain portfolio (`/api/wallet`, `/api/portfolio`), and automated playbooks (`/api/playbooks`).
|
|
29
|
+
- **Global Localization**: Ensured all new dashboard components are strictly in English to support the global user base natively.
|
|
30
|
+
- **Design System Consistency**: Applied the modern, unified `overview-container` styling across all new pages, featuring consistent glassmorphism effects, responsive card grids, and proper token alignments. Unified the toggle switch design in `Workflows.tsx` to match the custom iOS-style pill toggle used across other menus (e.g., `Skills.tsx`).
|
|
31
|
+
- **Playbook Editor (CRUD)**: Implemented full CRUD capabilities in the Workflows menu. Users can now directly create, edit, toggle, and delete scenarios via an integrated Markdown editor modal, with automatic local saving to `~/.nyxora/playbooks/`.
|
|
32
|
+
- **Memory Document RAG Upload**: Upgraded the Memory UI with a document upload feature. Connected the Node.js gateway to Python ML Engine's new `/memory/document` RAG endpoint, allowing seamless PDF/TXT/MD file chunking and vectorization using `pypdf`.
|
|
33
|
+
- **Wallet Security Enhancement**: Completely removed the raw Private Key display and toggle component from the Wallets UI to ensure maximum operational security.
|
|
34
|
+
- **Bug Fix**: Resolved a critical render crash in `Workflows.tsx` caused by a missing lucide-react import (`RefreshCw`), and cleaned up obsolete Episodic Memory fetch logic from the Logs menu.
|
|
35
|
+
|
|
36
|
+
### AI Memory & RAG Engine
|
|
37
|
+
- **Native Document Ingestion**: Introduced a new `/document` endpoint in the Python ML Engine. The system now autonomously parses, chunks, and vectorizes user-uploaded documents (PDF, TXT, MD) utilizing Langchain (`PyPDFLoader`, `RecursiveCharacterTextSplitter`).
|
|
38
|
+
- **Episodic Memory Sync**: Ingested document chunks are strictly categorized as `DOCUMENT` and seamlessly synchronized into both the SQLite episodic database and the local ChromaDB vector store for instant RAG retrieval.
|
|
39
|
+
|
|
40
|
+
### Desktop & Dashboard UI
|
|
41
|
+
- **Sidebar State Fix**: Resolved a visual bug in the SvelteKit Desktop app where active chat sessions remained highlighted even while the global Search modal was open.
|
|
42
|
+
- **Dashboard Cleanup**: Removed deprecated components (e.g., `DefiKeys.tsx`) and optimized settings panels across the React dashboard.
|
|
43
|
+
|
|
44
|
+
## [26.7.20]
|
|
45
|
+
### Desktop App MVP: UI/UX & Architecture Overhaul
|
|
46
|
+
- **Premium Interface Scaling**: Completely redesigned the Settings modal dimensions for desktop viewing. Expanded the modal wrapper to `w-[92vw]` with a maximum width of `1400px`, and removed legacy mobile constraints (`max-w-3xl`) from all submenu components (Agent Profile, LLM Engine, etc.) to utilize the full horizontal workspace natively.
|
|
47
|
+
- **Scroll Hierarchy Fixes**: Resolved a severe UX issue where scrolling inside long submenus (like Playbooks) would scroll the entire modal out of view. Enforced a strict height constraint (`h-[72vh]`) and `min-h-0` on inner containers, allowing localized, independent scrolling within the content pane.
|
|
48
|
+
- **Svelte 5 Reactivity Migration**: Refactored legacy Svelte 4 `<svelte:component>` dynamic imports within `SettingsModal.svelte`. Replaced them with modern Svelte 5 `{@const}` tags to eliminate compile-time deprecation warnings and ensure full compatibility with the new Runes architecture.
|
|
49
|
+
- **Asset Pipeline Synchronization**: Fixed pervasive `404 Not Found` errors for network/router icons (1inch, LiFi, CoinGecko, 0x) in the Desktop app by properly synchronizing the `public/routers/` directory from the Dashboard into the Desktop's `static/routers/` distribution folder.
|
|
50
|
+
|
|
51
|
+
### Desktop App MVP: Core Features Porting
|
|
52
|
+
- **Voice Mode & File Upload**: Successfully ported Dashboard Web features to the SvelteKit Desktop app. The chat composer now fully supports **Voice Mode** (via Web Speech API for TTS/STT) and **File Upload** (document analysis via `/api/upload`).
|
|
53
|
+
- **Advanced Risk Policies**: Integrated missing risk settings into the Desktop `Risk & Policy` menu, including **Daily Spend Limit**, **Strictly Avoid Memecoins** toggle, and **Allowed Contracts Whitelist**.
|
|
54
|
+
- **Auto-Lock Session (Idle Timeout)**: Added global idle timeout protection to the Desktop app. Users can configure auto-lock (15, 30, or 60 minutes) in `Security & Privacy`. Once locked, a glassmorphism overlay blocks the UI until authorized via the terminal (`nyxora unlock`).
|
|
55
|
+
|
|
56
|
+
### Desktop Bug Fixes & Semantic Alignment
|
|
57
|
+
- **Settings Auto-Save Illusion (Critical Fix)**: Fixed a severe UX logic flaw where settings were retained in memory even if the user cancelled/closed the modal. Introduced an explicit **Save Configuration** and **Cancel** button mechanism. The settings modal now safely fetches a fresh configuration state from the backend upon closing, guaranteeing that unsaved edits are flawlessly discarded.
|
|
58
|
+
- **Semantic Text Refinement**: Updated Desktop wording in the Security tab from "Dashboard Access" to "App Access" to accurately reflect the native application environment.
|
|
59
|
+
|
|
60
|
+
### Frontend Architecture & Core Refactoring
|
|
61
|
+
- **SvelteKit Migration (Desktop)**: Overhauled the native desktop interface by migrating from React to SvelteKit. Unified the component design system under `packages/desktop/src/lib/components`.
|
|
62
|
+
- **State Management**: Upgraded from React hooks to native Svelte Stores (`stores/app.ts`, `stores/wallet.ts`) for seamless state propagation.
|
|
63
|
+
- **Core Integrations**: Updated `osAgent.ts`, `llmProvider.ts`, and `logger.ts` to seamlessly plug into the new architectural layout.
|
|
64
|
+
|
|
65
|
+
## [26.7.19]
|
|
66
|
+
### Web3 & Market Intelligence
|
|
67
|
+
- **Super-Report & AI Financial Advisor**: Merged GoPlus Security data directly into the `analyze_market` tool to eliminate duplicate API requests. The LLM now receives a comprehensive dataset including Liquidity, 24h Volume, Pool Age, Holder Concentration (real-time from GoPlus), and smart contract security status (Honeypot, Taxes) in a single unified execution.
|
|
68
|
+
- **Advisor Persona Nudge**: Injected a "Sharp Crypto Financial Advisor" persona into the LLM's system note. The AI is now instructed to actively evaluate the combined fundamental and security metrics to provide concrete, strategic recommendations (e.g., Quick Flip, Hold, DCA, Avoid) rather than just passively reciting numbers.
|
|
69
|
+
|
|
70
|
+
### Agent Intelligence & Context Engine
|
|
71
|
+
- **Gen-AI Execution & Discipline Upgrade**: Completely overhauled `promptBuilder.ts` by injecting advanced cognitive discipline instructions (including *Execution Bias* and *Output Directives*). The AI is now significantly more proactive in utilizing tools, highly resilient to failures (*varies strategy* instead of giving up), and responds with a strict, senior-developer brevity (*anti-loop*, *anti-repetition*).
|
|
72
|
+
- **Date/Time Context Optimization**: Removed deprecated instructions that forced the LLM to execute a terminal command to check the current time. The system datetime context is now dynamically injected during prompt building, allowing the AI to read it instantly from memory. This saves unnecessary tool calls and reduces API quota consumption.
|
|
73
|
+
|
|
74
|
+
### Architecture & Memory Unification
|
|
75
|
+
- **Memory Fragmentation Cleanup**: Resolved a cross-language memory storage architectural conflict. Previously, the Node.js core wrote explicit preferences to `.nyxora/data/user.md` while the Python ML Engine wrote inferred narrative memories to `.nyxora/memory/USER.md`, creating severe overwrite risks on case-insensitive operating systems (Windows/Mac).
|
|
76
|
+
- **ML Engine Refactor**: Modified Python endpoints to exclusively read and write to the `data` directory. AI-generated narrative files have been systematically renamed to `narrative_user.md` and `narrative_memory.md` to cleanly separate them from explicit user profiles.
|
|
77
|
+
- **LLM Prompt Header Clarification**: Updated memory injection headers in the Node.js `system prompt` to be strictly descriptive (`EXPLICIT USER PREFERENCES` vs `AI INFERRED USER NARRATIVE`), eliminating LLM context confusion.
|
|
78
|
+
|
|
79
|
+
### Bug Fixes & Stability
|
|
80
|
+
- **Tool Loop Limit Expansion**: Increased the `MAX_TURNS` threshold in `osAgent.ts` from 10 to 30. This empowers the agent to autonomously execute significantly longer chained processes and complex coding refactors without being prematurely interrupted by system limits.
|
|
81
|
+
- **System Nudge UI Leak Remediation**: Prevented internal error logs from leaking into the user interface. When the LLM hallucinates or enters a prolonged *Silent Stop* that exhausts the Nudge tolerance, the agent no longer spews raw logs (`{"level":"error"}`). Instead, it gracefully intercepts the failure and returns a polite fallback response to the user.
|
|
82
|
+
|
|
83
|
+
## [26.7.18]
|
|
84
|
+
### NPM Global Installation Fixes
|
|
85
|
+
- **Drastic Installation Size Reduction**: Moved UI and Desktop build tools (`electron-builder`, `vite`, `tailwindcss`, `react`, etc.) from `dependencies` to `devDependencies` in the root `package.json`. This ensures global installations (`npm install -g nyxora`) are lightweight and fast.
|
|
86
|
+
- **Removed Deprecation Warnings**: By moving `electron-builder` to `devDependencies`, end-users will no longer see deprecation warnings from legacy upstream dependencies (`inflight`, `rimraf@2`, `glob@7`) during global installation.
|
|
87
|
+
- **Documentation Update**: Removed the `nyxora desktop` command from public CLI documentation, as this command is designed exclusively for local development and standalone distribution, not for global NPM installations.
|
|
88
|
+
|
|
89
|
+
### Core Agent Enhancements
|
|
90
|
+
- **Robust Context Compression**: Overhauled the context summarizer to eliminate silent API errors (HTTP 400) during long sessions. Introduced `Boundary Snapping` to guarantee that LLM tool calls and tool responses are never split during truncation. Implemented `Soft Archiving` in the SQLite `messages` table, allowing the UI to transparently render the entire conversation history while keeping the LLM context efficiently compressed.
|
|
91
|
+
|
|
92
|
+
## [26.7.17]
|
|
93
|
+
### NPM Global Publishing & Monorepo Enhancements
|
|
94
|
+
- **Global `npm install` Support**: Merged `packages/desktop` dependencies (`react`, `electron`, `vite`, etc.) into the root `package.json`. This ensures that when users run `npm install -g nyxora`, all dependencies required for the Desktop MVP are installed gracefully without causing read-only permission errors in the global directory.
|
|
95
|
+
- **ML Engine Auto-Setup (`postinstall`)**: Engineered `scripts/install-ml-engine.js` and hooked it into NPM's `postinstall` lifecycle. The framework now automatically spins up an isolated Python virtual environment at `~/.nyxora/ml-engine/venv` and installs all AI dependencies in the background during global installation.
|
|
96
|
+
- **CLI Desktop Hardening**: Stripped out the dynamic `npm install` mechanism from the `nyxora desktop` command, relying entirely on the new robust global dependency resolution to prevent `EACCES` permission errors for end-users.
|
|
97
|
+
|
|
98
|
+
## [26.7.16]
|
|
99
|
+
### Architecture Upgrade
|
|
100
|
+
- **Docker Sandbox Execution (`run_terminal_command`)**: Upgraded terminal execution tool to support an isolated environment (`envType: "docker"`). When enabled, commands run inside an ephemeral Docker container (default: `python:3.11-slim`), safely sandboxing code execution and file manipulation from the host OS.
|
|
101
|
+
- **Trajectory Generation (`TrajectoryLogger`)**: Implemented automated dataset generation. The agent loop now hooks into `TrajectoryLogger` to save execution histories as JSONL files (`~/.nyxora/trajectories.jsonl`). Trajectories are formatted with `<tool_call>` and `<tool_response>` tags, ready for next-gen tool-calling model fine-tuning.
|
|
102
|
+
- **Subagent Delegation (`delegate_subagent`)**: Empowered the core agent with the ability to recursively spawn isolated clone instances. Using the new `delegate_subagent` skill, the agent can dispatch long-running or complex tasks in parallel without polluting the main context window.
|
|
103
|
+
- **Terminal User Interface (TUI)**: Developed a native TUI using `blessed` for non-GUI / VPS users. Features a multi-pane layout (Chat, Active Tools, Subagents) and utilizes SSE streaming to render real-time LLM responses identically to the Web Dashboard. Launch via `nyxora tui`.
|
|
104
|
+
|
|
105
|
+
### Features & Platform Expansion
|
|
106
|
+
- **Nyxora Desktop MVP**: Successfully engineered and launched a native, standalone Desktop Application using Electron, Vite, and React.
|
|
107
|
+
- The desktop client seamlessly mirrors the sleek aesthetic of the web dashboard while providing a native OS-level experience.
|
|
108
|
+
- Introduced the new `nyxora desktop` CLI command. Running this command autonomously fetches dependencies, builds the renderer, and launches the Electron wrapper.
|
|
109
|
+
- **Zero-Touch Daemon Sync**: Implemented an intelligent lifecycle manager within the Electron main process. The app autonomously bootstraps the Nyxora background daemon (`nyxora start`) upon launch and securely tears it down when closed.
|
|
110
|
+
- **Race Condition & Auth Security Fix**: Engineered a robust asynchronous waiting mechanism and internal Vite proxy (`vite.config.ts`) to flawlessly synchronize the `runtime.token` injection between the backend daemon and the frontend UI, completely eradicating startup race conditions and CORS origin blocks.
|
|
111
|
+
|
|
112
|
+
### Self-Learning & Continuous Improvement
|
|
113
|
+
- **Proactive Tool-Iteration Trigger**: Refactored the core agent loop (`osAgent.ts`) to proactively trigger the background review engine (`ml-engine`) after every 10 tool iterations, rather than waiting for an arbitrary session end or a 3-minute idle timeout.
|
|
114
|
+
- **Aggressive Skill Creation**: Upgraded the `_COMBINED_REVIEW_PROMPT` in `ml-engine` to explicitly command the AI to be highly active in creating and patching skills. Frustration and user corrections are now treated as "FIRST-CLASS skill signals".
|
|
115
|
+
- **Deep Context Window**: Expanded the history payload sent to the background review engine from 30 messages to 100 messages, ensuring the background reviewer has the complete context of long debugging struggles.
|
|
116
|
+
- **UI Learning Notifications**: The core gateway now awaits the background review's execution result. When the AI successfully creates or patches a skill, a `💾 Self-improvement review` system message is automatically injected into the chat UI, providing immediate transparency that the agent is learning.
|
|
117
|
+
- **Persistent System Corrections**: Upgraded the Reflection Engine's schema (`reflection.ts`) to extract and permanently store `system_correction` memories. The AI now actively remembers explicit user rules regarding tool limitations or preferred workflows across all future sessions.
|
|
118
|
+
- **UI Tool Status Sanitization**: Fixed a visual bug where raw JSON tool arguments and execution states were leaking into the chat interface. Upgraded `getToolLabel` (`osAgent.ts`) to aggressively truncate tool outputs and provide clean status indicators.
|
|
119
|
+
|
|
120
|
+
## [26.7.15]
|
|
121
|
+
### Bug Fixes
|
|
122
|
+
|
|
123
|
+
#### Sudo Command Refused by LLM
|
|
124
|
+
- **Root Cause**: The `[SUDO & PACKAGE INSTALL STRATEGY]` section in `promptBuilder.ts` was written before `run_terminal_command_pty` existed. It told the LLM "this tool runs in a NON-INTERACTIVE shell" and instructed it to tell the user to run sudo manually — causing the LLM to refuse all sudo commands.
|
|
125
|
+
- **Fix (`promptBuilder.ts`)**: Rewrote the SUDO section. LLM now knows it has two terminal tools (`run_terminal_command` for non-interactive, `run_terminal_command_pty` for sudo/interactive), is instructed to ALWAYS use PTY for sudo, and is explicitly told it is "FULLY CAPABLE of running sudo commands." Password injection from `config.yaml → security.sudo_password` is handled automatically by the PTY tool.
|
|
126
|
+
|
|
127
|
+
#### LLM Output Repetition Loop
|
|
128
|
+
- **Root Cause**: When the LLM was corrected by the user (e.g., after giving wrong sports results), it entered an uncertain state and looped — echoing the same phrase in multiple rephrasings within a single response (e.g., "gue kabarin hasilnya kalo mau, gue kabarin hasilnya begitu selesai, gue kabarin aja kabarin aja...").
|
|
129
|
+
- **Fix #1 (`llmProvider.ts`)**: Added `frequency_penalty: 0.6` and `presence_penalty: 0.3` to all `OpenAIAdapter.chat()` and `.stream()` calls. These parameters suppress token-level repetition at the API level, effective for all OpenAI-compatible providers (Groq, OpenRouter, xAI, Mistral, DeepSeek, etc.).
|
|
130
|
+
- **Fix #2 (`promptBuilder.ts`)**: Added `[ANTI-REPETITION]` rule to the universal discipline prompt: LLM is instructed to never repeat the same phrase, clause, or sentence more than once per response — if it catches itself echoing, it must STOP immediately.
|
|
131
|
+
|
|
132
|
+
#### Search Inaccuracy / Hallucination on Factual Queries
|
|
133
|
+
- **Root Cause (5 bugs identified)**:
|
|
134
|
+
1. Temporal keyword `"tadi"` (and others: `kemarin`, `besok`, `pagi ini`, etc.) not detected → date not injected → search engine returned mixed results from multiple years.
|
|
135
|
+
2. LLM frequently ignored `depth=2` instruction in tool description → only snippets fetched → scores/data in article body never reached LLM context.
|
|
136
|
+
3. No `isFactualQuery` detection → sport/news/journal queries not auto-upgraded to `depth=2`.
|
|
137
|
+
4. No rule forbidding LLM from filling data gaps using training memory after an ambiguous search result.
|
|
138
|
+
5. No source citation enforcement → LLM gave hallucinated facts without accountability.
|
|
139
|
+
- **Fix #1 (`searchWeb.ts`)**: Expanded `isTimeSensitive` detection with 15+ new Indonesian/English temporal keywords (`tadi`, `kemarin`, `besok`, `malam ini`, `pagi ini`, `sore ini`, `minggu ini`, `bulan ini`, `baru saja`, `habis`, `sudah selesai`, `yesterday`, `tomorrow`, `this week`, `recent`, `breaking`). Added proper date arithmetic for `kemarin`/`yesterday` (now−1 day) and `besok`/`tomorrow` (now+1 day).
|
|
140
|
+
- **Fix #2 (`searchWeb.ts`)**: Added `isFactualQuery` detector covering sports (skor, hasil, pertandingan, piala, liga, klasemen), news (berita, kejadian), journals (jurnal, penelitian, paper, studi), and finance (harga, saham, inflasi). Factual queries auto-upgrade to `effectiveDepth = Math.max(depth, 2)` regardless of LLM's depth argument.
|
|
141
|
+
- **Fix #3 (`searchWeb.ts`)**: Added `[SEARCH_CONFIDENCE: HIGH/MEDIUM/LOW]` signal to all search outputs. Confidence is derived from how many top-3 articles were successfully scraped. If `LOW` on a factual/temporal query, an explicit warning is injected into the tool result instructing the LLM to admit data unavailability instead of guessing.
|
|
142
|
+
- **Fix #4 (`promptBuilder.ts`)**: Replaced `<web_search_accuracy>` section with stronger `[GROUNDED ANSWERS ONLY]` rule: after calling `search_web`, answers must be based strictly on search results. If `[SEARCH_CONFIDENCE: LOW]` or the specific fact is absent, LLM must say "Gue belum nemu data yang spesifik dari search" — never fill gaps from training memory for 2024–2026 events.
|
|
143
|
+
- **Fix #5 (`promptBuilder.ts`)**: Added `[SOURCE CITATION]` enforcement: when stating any specific fact (score, result, date, statistic), LLM must include the source URL.
|
|
144
|
+
## [26.7.14]
|
|
145
|
+
### Agent Identity & Execution Discipline Overhaul
|
|
146
|
+
- **Semantic Intent Router Refactor (`reasoning.ts`)**: Upgraded the intent router to utilize a strict \`CLASSIFICATION MATRIX\` and Context Hierarchy Rules. This completely eradicates intent misclassification between Web3 and OS workflows, especially during context-switching.
|
|
147
|
+
- **Agent Identity Compression (`promptBuilder.ts`)**: Consolidated verbose \`[CRITICAL EXECUTION RULES]\` into 5 high-impact, token-efficient mandates (e.g., OUTPUT RESTRICTION, THINKING GATE, HARD HARDENING) to maximize model attention retention.
|
|
148
|
+
- **Strict Real-World Facts Guardrail**: Introduced mandatory \`search_web\` requirements for sports scores, schedules, and real-world news to completely eliminate LLM hallucination on dynamic data.
|
|
149
|
+
- **Anti-Silent Stop / Interactive Execution Flow (`promptBuilder.ts`)**: Replaced standard tool-call enforcements with \`[INTERACTIVE EXECUTION FLOW]\`. The agent is now permitted exactly one short conversational sentence before a tool call (both on success and recovery paths), but is strictly forbidden from ending its turn without attaching the corrected tool payload. This cures the "Silent Stop" / "Promise Without Action" bug while maintaining a natural, conversational UX.
|
|
150
|
+
- **Force Action User Correction (`osAgent.ts`)**: Refactored the User Correction Detectors to intercept scoldings with a \`[CRITICAL INTERCEPT: USER CORRECTION]\` signal. The LLM is now forced to fetch fresh ground-truth data via tools instead of endlessly apologizing and recycling stale context.
|
|
151
|
+
|
|
152
|
+
### UI/UX & Quality of Life
|
|
153
|
+
- **Import Project Workflow Redesign**: Relocated the "Import Project" button from the main navigation sidebar into the "Workspaces" section header. The action is now represented by an intuitive `+` icon that perfectly scales with the slightly enlarged `0.85rem` section text, achieving a significantly cleaner UI layout while keeping workspace management centralized.
|
|
154
|
+
|
|
155
|
+
### Performance — LLM Response Speed Optimization
|
|
156
|
+
|
|
157
|
+
#### Cold Start Latency Fix
|
|
158
|
+
- **Non-Blocking DeFi Aggregator Discovery** (`server.ts`): `aggregatorRegistry.autoDiscover()` was previously `await`-ed synchronously before `app.listen()`, blocking the entire server startup by 2–5 seconds while it probed external DeFi providers. Refactored to `setImmediate()` fire-and-forget so the server starts accepting LLM requests immediately after plugins are loaded, with provider discovery happening in the background.
|
|
159
|
+
- **ML Engine Fetch Timeout** (`promptBuilder.ts`): All 3 network calls to the local Python ML Engine (`/memory/rag`, `/memory/narrative`, `/skills/list`) previously had no timeout. During cold start, when the ML Engine is still booting, these calls would hang for up to 2 minutes waiting for a TCP connection. Added `AbortSignal.timeout(1500)` to each fetch — if the ML Engine is not ready, calls fail in ≤1.5s and return empty strings gracefully, keeping the first LLM response fast.
|
|
160
|
+
|
|
161
|
+
#### Per-Request Latency Optimization
|
|
162
|
+
- **Parallel Volatile Prompt Parts** (`promptBuilder.ts`): `buildEpisodicMemories()` and `buildNarrativeMemories()` were called sequentially (`await` one, then `await` the other). Refactored to `Promise.all([...])` — both network calls now run concurrently, saving ~300–600ms per request.
|
|
163
|
+
- **Parallel Narrative + Skills Fetch** (`promptBuilder.ts`): Inside `buildNarrativeMemories()`, the `/memory/narrative` and `/skills/list` fetches were also sequential. Parallelized with `Promise.all()`.
|
|
164
|
+
- **TTL Cache for Narrative Memory & Skills** (`promptBuilder.ts`): Added a 30-second in-memory TTL cache for narrative memory and skills list. These change only when the user explicitly saves something — re-fetching on every message was wasteful. Cache hit returns instantly with zero network overhead.
|
|
165
|
+
- **5-Second Build Cache** (`promptBuilder.ts`): Added a short-lived cache keyed by `agentType + userInput[:80]`. Prevents double-building the system prompt when the router warm-up and the agent's own `getSystemPrompt()` call happen within 5 seconds of each other.
|
|
166
|
+
- **Parallel LLM Router + System Prompt Warm-Up** (`reasoning.ts`): For messages that don't match any keyword (triggering the LLM semantic router), the router call and the OS system prompt pre-build now run **simultaneously** via `Promise.all()`. Since `'os'` is the most common fallback, its system prompt is pre-warmed into the 5s build cache while the router is deciding — making the router's latency effectively invisible to the user. Applies to both sync and stream paths.
|
|
167
|
+
- **Static Import for `historySanitizer`** (`osAgent.ts`, `web3Agent.ts`): Dynamic `require('../utils/historySanitizer')` inside function bodies (4 occurrences across 2 files) replaced with static ES `import` at the top of each file.
|
|
168
|
+
|
|
169
|
+
## [26.7.12]
|
|
170
|
+
### Features
|
|
171
|
+
- **TTY Support for Interactive Commands**: Introduced a new tool `run_terminal_command_pty` implemented using `node-pty` to handle interactive shell commands (like `vim`, `nano`, and REPLs). Nyxora can now automatically execute `sudo` commands by securely injecting a password from `~/.nyxora/config/config.yaml`.
|
|
172
|
+
- **Tool Selection Safeguards**: Implemented a defense system (Clearer Descriptions and Runtime Auto-Detection) to help the LLM choose the correct terminal tool and gracefully fail if `sudo` is used with the non-PTY tool.
|
|
173
|
+
|
|
174
|
+
### Performance
|
|
175
|
+
- **Context Compression Optimization**: Refactored the agent loop to move context summarization (`compressHistory`) to a one-time operation before the loop starts, reducing redundant LLM calls by up to 66% and improving response time by ~33%.
|
|
176
|
+
|
|
177
|
+
## [26.7.11]
|
|
178
|
+
### Bug Fixes & Stability
|
|
179
|
+
- **Ghost Daemon & Stale Transactions Fix**: Resolved a critical issue where the `Nyx Daemon` leaked into the interactive CLI chat due to a static top-level import in `cli.ts`. Replaced with a dynamic import to keep the CLI environment pure. Additionally, overhauled the SQLite transaction manager by introducing a 3-minute transaction timeout (previously there was no expiration), and implemented an `auto-cleanup` mechanism that forcefully purges (`failed`) all stale pending transactions upon daemon startup to prevent persistent "ghost" transaction prompts after forced system shutdowns.
|
|
6
180
|
|
|
7
181
|
## [26.7.10]
|
|
8
182
|
### Web3 Integrations
|
package/README.md
CHANGED
|
@@ -97,7 +97,9 @@ It operates under a **Zero-Trust, Defense-in-Depth Cryptographically Bound Human
|
|
|
97
97
|
|
|
98
98
|
### 💻 OS & Web2 Skills (Off-Chain)
|
|
99
99
|
* **Google Workspace Automation 🚀**: Transform Nyxora into your ultimate personal assistant. The agent can read your latest Gmail inbox, check your Google Calendar, extract text from Google Docs, and even append expense/trading logs directly to your Google Sheets.
|
|
100
|
-
* **System Automation & Full OS Access**: Instruct the agent to read/write local files, run terminal commands, and browse the web natively.
|
|
100
|
+
* **System Automation & Full OS Access**: Instruct the agent to read/write local files, run interactive terminal commands (with secure `sudo` password auto-injection), and browse the web natively.
|
|
101
|
+
* **Docker Sandbox Execution**: Safely run untrusted code and manipulate files inside an isolated, ephemeral Docker container environment to protect your host OS.
|
|
102
|
+
* **Recursive Subagent Delegation**: Dispatch long-running or highly complex tasks to isolated clone subagents that run in parallel without clogging your main conversational context window.
|
|
101
103
|
* **Automated Excel Reporting**: Instruct the agent to compile its Web3 portfolio or transaction history findings and autonomously generate beautiful `.xlsx` spreadsheet reports saved directly to your local machine.
|
|
102
104
|
* **Unstoppable Synergy**: Combine both engines with a single prompt. Example: *"Read the latest presale token email from my Gmail, automatically set a Take Profit limit order on Uniswap, and log the execution result to my Google Sheets."*
|
|
103
105
|
* **Autonomous Skill Synthesizing (`skillExtractor.ts`)**: Instruct the AI to learn a new workflow, and it will autonomously write the Node.js execution logic and schema, saving it locally as a custom skill following the **`agentskills.io`** standard!
|
|
@@ -137,7 +139,7 @@ graph TD
|
|
|
137
139
|
User["User / External Client"]:::external
|
|
138
140
|
|
|
139
141
|
Dashboard["Dashboard (UI)<br/>Port 5173"]:::ui
|
|
140
|
-
MCP["MCP Server<br/>
|
|
142
|
+
MCP["MCP Server<br/>(Stdio / JSON-RPC)"]:::ui
|
|
141
143
|
|
|
142
144
|
Core["Core LLM Runtime<br/>Port 3000<br/>(NLP Parsing, Routing, Agent Logic)"]:::core
|
|
143
145
|
|
|
@@ -186,7 +188,7 @@ To dive deeper into the technical details of our Zero-Knowledge security archite
|
|
|
186
188
|
## 🚀 Quick Start & Installation
|
|
187
189
|
|
|
188
190
|
### Prerequisites
|
|
189
|
-
Nyxora requires **Node.js
|
|
191
|
+
Nyxora requires **Node.js 22+** and **Python 3.10+** (for the ML Cognitive Engine) to be installed on your system.
|
|
190
192
|
|
|
191
193
|
### Option 1: One-Line Installation (Recommended)
|
|
192
194
|
The fastest way to install Nyxora is via our smart installation wrapper. This script automatically prepares Node.js (if missing) and securely fetches the Nyxora daemon directly from the NPM Registry. *(Note: You must have Python 3.10+ pre-installed on your system, as this script only handles Node.js dependencies).*
|
|
@@ -208,6 +210,8 @@ If you already have Node.js installed, you can natively install Nyxora globally
|
|
|
208
210
|
# Install globally
|
|
209
211
|
npm install -g nyxora
|
|
210
212
|
|
|
213
|
+
> 💡 **ML Engine Setup**: When you run `npm install -g nyxora`, the Python ML Engine dependencies are automatically installed via the `postinstall` script. Requires Python 3.10+.
|
|
214
|
+
|
|
211
215
|
# Run the interactive setup wizard
|
|
212
216
|
# (Automatically validates Node.js & Python 3.10+ requirements, configures API Keys, Wallet, and ML Environment)
|
|
213
217
|
nyxora setup
|
|
@@ -217,6 +221,12 @@ nyxora start
|
|
|
217
221
|
|
|
218
222
|
# Open the interactive UI dashboard
|
|
219
223
|
nyxora dashboard
|
|
224
|
+
|
|
225
|
+
# 🖥️ Open the interactive Terminal UI (for VPS/CLI users)
|
|
226
|
+
nyxora tui
|
|
227
|
+
|
|
228
|
+
# 💬 Chat interactively via the terminal
|
|
229
|
+
nyxora chat
|
|
220
230
|
```
|
|
221
231
|
|
|
222
232
|
### Option 2: Local Development (Source Code)
|
|
@@ -229,7 +239,7 @@ cd Nyxora
|
|
|
229
239
|
# 1. Install Dependencies
|
|
230
240
|
npm install
|
|
231
241
|
|
|
232
|
-
# 2. Build the Core, MCP Server, and Dashboard UI
|
|
242
|
+
# 2. Build the Core, TUI, MCP Server, and Dashboard UI
|
|
233
243
|
npm run build
|
|
234
244
|
|
|
235
245
|
# 3. Interactive Setup Wizard (Will also install Python ML requirements via pip)
|
|
@@ -237,6 +247,9 @@ npm run setup
|
|
|
237
247
|
|
|
238
248
|
# 4. Start the Application (Spawns Node.js Core and Python FastAPI sidecar)
|
|
239
249
|
npm start
|
|
250
|
+
|
|
251
|
+
# 5. (Optional) Run the Desktop App locally
|
|
252
|
+
npm run desktop
|
|
240
253
|
```
|
|
241
254
|
|
|
242
255
|
*(If you are actively developing and modifying the source code, use `npm run dev` to enable hot-reloading for the frontend and backend).*
|
package/bin/nyxora.mjs
CHANGED
|
@@ -73,6 +73,7 @@ async function start() {
|
|
|
73
73
|
const child = spawn(cmd, args, {
|
|
74
74
|
cwd: projectRoot,
|
|
75
75
|
detached: true,
|
|
76
|
+
windowsHide: true,
|
|
76
77
|
stdio: ['ignore', out, err],
|
|
77
78
|
env: { ...process.env, TS_NODE_CACHE: 'false' }
|
|
78
79
|
});
|
|
@@ -91,7 +92,12 @@ async function stop(preserveTracker = false) {
|
|
|
91
92
|
if (pid) {
|
|
92
93
|
console.log(`Stopping Nyxora daemon (PID: ${pid})...`);
|
|
93
94
|
try {
|
|
94
|
-
process.
|
|
95
|
+
if (process.platform === 'win32') {
|
|
96
|
+
const { spawnSync } = await import('child_process');
|
|
97
|
+
spawnSync('taskkill', ['/pid', pid.toString(), '/t', '/f']);
|
|
98
|
+
} else {
|
|
99
|
+
process.kill(-pid, 'SIGTERM');
|
|
100
|
+
}
|
|
95
101
|
let attempts = 0;
|
|
96
102
|
while (isDaemonRunning(pid.toString()) && attempts < 20) {
|
|
97
103
|
await new Promise(r => setTimeout(r, 100));
|
|
@@ -362,6 +368,8 @@ async function serveMcp() {
|
|
|
362
368
|
await new Promise(resolve => child.on('close', resolve));
|
|
363
369
|
}
|
|
364
370
|
|
|
371
|
+
|
|
372
|
+
|
|
365
373
|
async function main() {
|
|
366
374
|
switch(command) {
|
|
367
375
|
case 'doctor': await runDoctor(); break;
|
|
@@ -379,6 +387,41 @@ async function main() {
|
|
|
379
387
|
case 'clean-logs': await cleanLogs(); break;
|
|
380
388
|
case 'autostart': await autostart(process.argv[3]); break;
|
|
381
389
|
case 'mcp': await serveMcp(); break;
|
|
390
|
+
|
|
391
|
+
case 'desktop': {
|
|
392
|
+
const desktopPkg = path.join(projectRoot, 'packages/desktop/package.json');
|
|
393
|
+
const desktopDist = path.join(projectRoot, 'packages/desktop/dist-electron');
|
|
394
|
+
if (!fs.existsSync(desktopPkg) || !fs.existsSync(desktopDist)) {
|
|
395
|
+
console.error('❌ Desktop app is not available in the npm package.');
|
|
396
|
+
console.error(' The Desktop app must be built from source.');
|
|
397
|
+
console.error(' Clone the repo and run: git clone https://github.com/nyxoraAI/Nyxora && cd Nyxora && npm install && npm run desktop');
|
|
398
|
+
process.exit(1);
|
|
399
|
+
}
|
|
400
|
+
const { default: open } = await import('open');
|
|
401
|
+
await open(desktopDist);
|
|
402
|
+
break;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
case 'tui': {
|
|
406
|
+
// Spawn pre-compiled TUI directly using Node.
|
|
407
|
+
// We must avoid wrappers like `npx` or `npm run` which spawn subshells
|
|
408
|
+
// and break TTY inheritance, causing Ink to think it's not a TTY (which makes it invisible).
|
|
409
|
+
const tuiDist = path.join(projectRoot, 'packages/tui/dist/index.js');
|
|
410
|
+
if (!fs.existsSync(tuiDist)) {
|
|
411
|
+
console.error('❌ TUI is not available (missing compiled output).');
|
|
412
|
+
console.error(' If you installed from npm, try: npm install -g nyxora@latest');
|
|
413
|
+
console.error(' If running from source: npm run build');
|
|
414
|
+
process.exit(1);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
const childTui = spawn('node', [tuiDist], {
|
|
418
|
+
cwd: path.join(projectRoot, 'packages/tui'),
|
|
419
|
+
stdio: 'inherit',
|
|
420
|
+
env: { ...process.env }
|
|
421
|
+
});
|
|
422
|
+
await new Promise(resolve => childTui.on('close', resolve));
|
|
423
|
+
break;
|
|
424
|
+
}
|
|
382
425
|
case '-v':
|
|
383
426
|
case '--v':
|
|
384
427
|
case '--version':
|
package/dist/launcher.js
CHANGED
|
@@ -35,7 +35,7 @@ const spawnService = (name, command, args, env, inheritStdio = false, cwd) => {
|
|
|
35
35
|
let crashWindowStart = Date.now();
|
|
36
36
|
let isShuttingDown = false;
|
|
37
37
|
const startProcess = () => {
|
|
38
|
-
const spawnOpts = { env, stdio: inheritStdio ? 'inherit' : 'pipe' };
|
|
38
|
+
const spawnOpts = { env, stdio: inheritStdio ? 'inherit' : 'pipe', windowsHide: true };
|
|
39
39
|
if (cwd)
|
|
40
40
|
spawnOpts.cwd = cwd;
|
|
41
41
|
child = (0, child_process_1.spawn)(command, args, spawnOpts);
|
|
@@ -66,6 +66,11 @@ const spawnService = (name, command, args, env, inheritStdio = false, cwd) => {
|
|
|
66
66
|
}
|
|
67
67
|
crashCount++;
|
|
68
68
|
if (crashCount > 5) {
|
|
69
|
+
if (name === 'ML Engine') {
|
|
70
|
+
console.error(`[Launcher] ML Engine crashed 5 times. Disabling it to prevent system shutdown.`);
|
|
71
|
+
isShuttingDown = true;
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
69
74
|
console.error(`[Launcher] FATAL: ${name} crashed 5 times in 1 minute. Initiating emergency shutdown.`);
|
|
70
75
|
isShuttingDown = true;
|
|
71
76
|
try {
|
|
@@ -147,7 +152,8 @@ setTimeout(() => {
|
|
|
147
152
|
const IS_WINDOWS_LAUNCHER = process.platform === 'win32';
|
|
148
153
|
const pythonBinDir = IS_WINDOWS_LAUNCHER ? 'Scripts' : 'bin';
|
|
149
154
|
const pythonExe = IS_WINDOWS_LAUNCHER ? 'python.exe' : 'python';
|
|
150
|
-
const
|
|
155
|
+
const defaultPythonPath = path_1.default.join(process.env.HOME || process.env.USERPROFILE || '', '.nyxora', 'ml-engine', 'venv', pythonBinDir, pythonExe);
|
|
156
|
+
const pythonPath = process.env.ML_ENGINE_PYTHON_PATH || defaultPythonPath;
|
|
151
157
|
if (fs_1.default.existsSync(pythonPath)) {
|
|
152
158
|
let mlDir = path_1.default.join(__dirnameResolved, 'packages', 'ml-engine');
|
|
153
159
|
if (!fs_1.default.existsSync(mlDir))
|
|
@@ -184,7 +190,7 @@ setTimeout(() => {
|
|
|
184
190
|
catch (e) { }
|
|
185
191
|
if (cfEnabled) {
|
|
186
192
|
console.log('[Launcher] Starting Auto-Tunnel (Cloudflare) on port 3000...');
|
|
187
|
-
const cf = (0, child_process_1.spawn)('npx', ['cloudflared', 'tunnel', '--url', 'http://localhost:3000'], { env, shell: true });
|
|
193
|
+
const cf = (0, child_process_1.spawn)('npx', ['cloudflared', 'tunnel', '--url', 'http://localhost:3000'], { env, shell: true, windowsHide: true });
|
|
188
194
|
children.push({
|
|
189
195
|
kill: () => { try {
|
|
190
196
|
process.kill(cf.pid, 'SIGTERM');
|
|
@@ -42,11 +42,55 @@ const parser_1 = require("../config/parser");
|
|
|
42
42
|
const telegram_1 = require("../channels/telegram");
|
|
43
43
|
const crypto_1 = require("crypto");
|
|
44
44
|
const picocolors_1 = __importDefault(require("picocolors"));
|
|
45
|
+
const fs_1 = __importDefault(require("fs"));
|
|
46
|
+
const paths_1 = require("../config/paths");
|
|
47
|
+
const CRON_PERSIST_FILE = (0, paths_1.getPath)('cron_jobs.json');
|
|
48
|
+
function loadPersistedJobs() {
|
|
49
|
+
try {
|
|
50
|
+
if (fs_1.default.existsSync(CRON_PERSIST_FILE)) {
|
|
51
|
+
const raw = fs_1.default.readFileSync(CRON_PERSIST_FILE, 'utf-8');
|
|
52
|
+
return JSON.parse(raw);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch (e) {
|
|
56
|
+
console.warn(picocolors_1.default.yellow('[Cron] Failed to load persisted jobs, starting fresh.'));
|
|
57
|
+
}
|
|
58
|
+
return [];
|
|
59
|
+
}
|
|
60
|
+
function savePersistedJobs(jobs) {
|
|
61
|
+
try {
|
|
62
|
+
const data = Array.from(jobs.values()).map(j => ({
|
|
63
|
+
id: j.id,
|
|
64
|
+
expression: j.expression,
|
|
65
|
+
prompt: j.prompt,
|
|
66
|
+
createdAt: j.createdAt
|
|
67
|
+
}));
|
|
68
|
+
fs_1.default.writeFileSync(CRON_PERSIST_FILE, JSON.stringify(data, null, 2), 'utf-8');
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
console.error(picocolors_1.default.red('[Cron] Failed to persist jobs:'), e);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
45
74
|
class CronManager {
|
|
46
75
|
jobs = new Map();
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
76
|
+
constructor() {
|
|
77
|
+
// Restore jobs from disk on startup
|
|
78
|
+
const persisted = loadPersistedJobs();
|
|
79
|
+
if (persisted.length > 0) {
|
|
80
|
+
console.log(picocolors_1.default.cyan(`[Cron] Restoring ${persisted.length} persisted job(s) from disk...`));
|
|
81
|
+
for (const saved of persisted) {
|
|
82
|
+
try {
|
|
83
|
+
this._scheduleJob(saved.id, saved.expression, saved.prompt, saved.createdAt);
|
|
84
|
+
console.log(picocolors_1.default.green(`[Cron] ✓ Restored job ${saved.id} (${saved.expression})`));
|
|
85
|
+
}
|
|
86
|
+
catch (e) {
|
|
87
|
+
console.warn(picocolors_1.default.yellow(`[Cron] ✗ Skipped invalid job ${saved.id}: ${e.message}`));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
_scheduleJob(id, expression, prompt, createdAt) {
|
|
93
|
+
// Validate expression first
|
|
50
94
|
try {
|
|
51
95
|
new croner_1.Cron(expression);
|
|
52
96
|
}
|
|
@@ -56,11 +100,8 @@ class CronManager {
|
|
|
56
100
|
const task = new croner_1.Cron(expression, async () => {
|
|
57
101
|
console.log(picocolors_1.default.cyan(`[Cron] Executing job ${id}: "${prompt}"`));
|
|
58
102
|
try {
|
|
59
|
-
// Dynamically import processUserInput to avoid circular dependencies
|
|
60
103
|
const { processUserInput } = await Promise.resolve().then(() => __importStar(require('./reasoning')));
|
|
61
|
-
|
|
62
|
-
const response = await processUserInput(prompt, 'system', undefined, sessionId || `cron-${id}`);
|
|
63
|
-
// Push notification to Telegram if configured
|
|
104
|
+
const response = await processUserInput(prompt, 'system', undefined, `cron-${id}`);
|
|
64
105
|
const config = (0, parser_1.loadConfig)();
|
|
65
106
|
if (config.integrations?.telegram?.enabled && config.integrations?.telegram?.authorized_chat_id) {
|
|
66
107
|
const message = `🤖 *AI Scheduled Report*\n\n${response}`;
|
|
@@ -75,13 +116,12 @@ class CronManager {
|
|
|
75
116
|
}
|
|
76
117
|
}
|
|
77
118
|
});
|
|
78
|
-
this.jobs.set(id, {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
});
|
|
119
|
+
this.jobs.set(id, { id, expression, prompt, task, createdAt });
|
|
120
|
+
}
|
|
121
|
+
addJob(expression, prompt, sessionId) {
|
|
122
|
+
const id = (0, crypto_1.randomUUID)();
|
|
123
|
+
this._scheduleJob(id, expression, prompt, Date.now());
|
|
124
|
+
savePersistedJobs(this.jobs);
|
|
85
125
|
console.log(picocolors_1.default.green(`[Cron] Scheduled new job ${id} with expression '${expression}'`));
|
|
86
126
|
return id;
|
|
87
127
|
}
|
|
@@ -90,6 +130,7 @@ class CronManager {
|
|
|
90
130
|
if (job) {
|
|
91
131
|
job.task.stop();
|
|
92
132
|
this.jobs.delete(id);
|
|
133
|
+
savePersistedJobs(this.jobs);
|
|
93
134
|
console.log(picocolors_1.default.yellow(`[Cron] Removed job ${id}`));
|
|
94
135
|
return true;
|
|
95
136
|
}
|