diff options
| author | Agando <roduccomm@gmail.com> | 2026-06-23 18:00:58 +0200 |
|---|---|---|
| committer | Agando <roduccomm@gmail.com> | 2026-06-23 18:00:58 +0200 |
| commit | 168a7bc6d50023215f75fa8a0d95362473cfe033 (patch) | |
| tree | 7351abfcaff59a6fcebf19ea322a77eda9b6ed6b | |
| parent | e9b75cd3a801689f57bc8a013f14c058e57e3b46 (diff) | |
auto: 2026-06-23_18:00 changes
| -rw-r--r-- | downloads/readme.html | 225 | ||||
| -rw-r--r-- | modules-index.json | 13 | ||||
| -rw-r--r-- | modules/core/core-bundle.js | 167 | ||||
| -rw-r--r-- | modules/core/module-aiassist.js | 21 | ||||
| -rw-r--r-- | modules/core/terminal.js | 2 | ||||
| -rw-r--r-- | scripts/rebuild-bundles.py | 1 |
6 files changed, 415 insertions, 14 deletions
diff --git a/downloads/readme.html b/downloads/readme.html new file mode 100644 index 0000000..edbcc8b --- /dev/null +++ b/downloads/readme.html @@ -0,0 +1,225 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> + <title>newOS | System Documentation</title> + <style> + :root { + --bg-dark: #0a0a0b; + --bg-card: #161618; + --accent: #3b82f6; + --accent-glow: rgba(59, 130, 246, 0.5); + --text-main: #e4e4e7; + --text-muted: #a1a1aa; + --border: #27272a; + --code-bg: #1e1e20; + } + + * { + box-sizing: border-box; + -webkit-tap-highlight-color: transparent; + } + + body { + margin: 0; + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; + background-color: var(--bg-dark); + color: var(--text-main); + line-height: 1.6; + overflow-x: hidden; + } + + /* Mobile-First Navigation */ + header { + position: sticky; + top: 0; + z-index: 100; + background: rgba(10, 10, 11, 0.8); + backdrop-filter: blur(12px); + border-bottom: 1px solid var(--border); + padding: 1rem; + display: flex; + justify-content: space-between; + align-items: center; + } + + .logo { + font-weight: 800; + font-size: 1.2rem; + letter-spacing: -0.02em; + display: flex; + align-items: center; + gap: 8px; + } + + .logo span { + color: var(--accent); + } + + /* Content Container */ + main { + max-width: 800px; + margin: 0 auto; + padding: 1.5rem 1rem; + } + + section { + margin-bottom: 3rem; + animation: fadeIn 0.5s ease-out; + } + + h1, h2, h3 { + color: #fff; + font-weight: 600; + line-height: 1.2; + } + + h1 { font-size: 2.2rem; margin-bottom: 1rem; } + h2 { font-size: 1.5rem; margin-top: 2rem; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; } + + p { color: var(--text-muted); font-size: 1rem; } + + /* Components */ + .card { + background: var(--bg-card); + border: 1px solid var(--border); + border-radius: 12px; + padding: 1.25rem; + margin: 1rem 0; + } + + .grid { + display: grid; + grid-template-columns: 1fr; + gap: 1rem; + } + + @media (min-width: 600px) { + .grid { grid-template-columns: 1fr 1fr; } + } + + code { + font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; + background: var(--code-bg); + color: #f8f8f2; + padding: 0.2rem 0.4rem; + border-radius: 4px; + font-size: 0.9rem; + } + + pre { + background: var(--code-bg); + padding: 1rem; + border-radius: 12px; + overflow-x: auto; + border: 1px solid var(--border); + position: relative; + } + + .badge { + display: inline-block; + padding: 2px 8px; + border-radius: 100px; + font-size: 0.75rem; + background: var(--accent); + color: white; + font-weight: bold; + text-transform: uppercase; + } + + .footer { + text-align: center; + padding: 2rem; + color: var(--text-muted); + font-size: 0.8rem; + border-top: 1px solid var(--border); + } + + @keyframes fadeIn { + from { opacity: 0; transform: translateY(10px); } + to { opacity: 1; transform: translateY(0); } + } + + /* Mobile Utility */ + .btn-primary { + display: block; + width: 100%; + text-align: center; + background: var(--accent); + color: white; + text-decoration: none; + padding: 12px; + border-radius: 8px; + font-weight: 600; + margin-top: 1rem; + box-shadow: 0 4px 14px 0 var(--accent-glow); + } + </style> +</head> +<body> + +<header> + <div class="logo"><span>new</span>OS</div> + <div class="badge">v4.5.79</div> +</header> + +<main> + <section id="hero"> + <h1>The Next Evolution of OS</h1> + <p>A modular, AI-driven environment designed for extreme flexibility and developer productivity. newOS integrates a Neural Virtual File System (NVFS) with an extensible module architecture.</p> + <a href="#docs" class="btn-primary">Explore System</a> + </section> + + <section id="features"> + <h2>Core Architecture</h2> + <div class="grid"> + <div class="card"> + <h3>🧠 Neural VFS</h3> + <p>Semantic file resolution allowing the system to find files by concept rather than just path.</p> + </div> + <div class="card"> + <h3>🧩 Modular Core</h3> + <p>Dynamic loading/unloading of system modules via a robust interface for runtime extensibility.</p> + </div> + <div class="card"> + <h3>🤖 Agentic Layer</h3> + <p>Integrated support for autonomous worker agents and specialized AI context profiles.</p> + </div> + <div class="card"> + <h3>⚡ Hyper-Connectivity</h3> + <p>Native bridges to VaultMind and Hyperliquid for real-time DeFi and market interaction.</p> + </div> + </div> + </section> + + <section id="quickstart"> + <h2>Quick Start</h2> + <div class="card"> + <p>Initialize the neural index to enable semantic search across your environment:</p> + <pre><code>nvfs-index && nvfs-resolve "my project goals"</code></pre> + </div> + <div class="card"> + <p>Check system health and loaded modules:</p> + <pre><code>get_status</code></pre> + </div> + </section> + + <section id="technical"> + <h2>Technical Specs</h2> + <p>NewOS is built on a high-performance substrate supporting:</p> + <ul> + <li><strong>VFS:</strong> Virtual File System with read/write/delete.</li> + <li><strong>Modules:</strong> Hot-reloadable system extensions.</li> + <li><strong>Skills:</strong> A shared knowledge base for AI agents.</li> + <li><strong>Contexts:</strong> Switchable AI behaviors (Coding, Debug, Technical).</li> + </ul> + </section> +</main> + +<div class="footer"> + © 2026 newOS Project. Built for the future of computing. +</div> + +</body> +</html> diff --git a/modules-index.json b/modules-index.json index d9a96eb..289946c 100644 --- a/modules-index.json +++ b/modules-index.json @@ -778,6 +778,19 @@ "sandbox-run" ] }, + "module-smartctx": { + "class": "SmartContextModule", + "file": "modules/core/module-smartctx.js", + "layer": "core", + "description": "AI context profiles — set AI behavior (coding, debug, creative, technical, chat)", + "commands": [ + "context", + "contexts", + "context-new", + "context-delete", + "smart-ask" + ] + }, "sandbox-worker": { "class": "SandboxWorker", "file": "modules/core/sandbox-worker.js", diff --git a/modules/core/core-bundle.js b/modules/core/core-bundle.js index 175df87..13330ab 100644 --- a/modules/core/core-bundle.js +++ b/modules/core/core-bundle.js @@ -3473,6 +3473,7 @@ Only output XML function calls for tool tasks. If no tool is needed, answer norm this._safeRegister('PredictorModule', 'predictor'); this._safeRegister('WorldModelModule', 'world model'); this._safeRegister('ServerMonitorModule', 'server monitor'); + this._safeRegister('SmartContextModule', 'smart context'); this._safeRegister('SimpleGUIModule', 'simple GUI builder'); // v4.5.47: Critical ext modules promoted to boot path this._safeRegister('EditorModule', 'editor'); @@ -3520,6 +3521,7 @@ Only output XML function calls for tool tasks. If no tool is needed, answer norm FileManagerModule: typeof FileManagerModule !== 'undefined' ? FileManagerModule : undefined, DiffModule: typeof DiffModule !== 'undefined' ? DiffModule : undefined, BusyBoxModule: typeof BusyBoxModule !== 'undefined' ? BusyBoxModule : undefined, + SmartContextModule: typeof SmartContextModule !== 'undefined' ? SmartContextModule : undefined, }; const cls = registry[className]; if (typeof cls === 'undefined') { @@ -8197,6 +8199,7 @@ buildSystemPrompt() { async agenticLoop(messages) { let toolTurns = 0; const _seenCalls = new Map(); // v4.5.66: loop detection — track repeated tool calls + const _loopWindow = 30000; // 30s window for loop detection while (toolTurns < this.MAX_TOOL_TURNS) { if (this._cancelled) { this.terminal.print('AI loop cancelled', 'warning'); return { finalAnswer: null, toolTurns }; } toolTurns++; @@ -8223,16 +8226,22 @@ buildSystemPrompt() { return { finalAnswer: text, toolTurns }; } if (res.tool_calls && res.tool_calls.length > 0) { - // v4.5.66: Loop detection — break if AI repeats same tool+args 3+ times - // Reset per-turn so legitimate retries across turns don't false-positive - _seenCalls.clear(); + // v4.5.66: Loop detection — break if AI repeats same tool+args 6+ times in 30s + // Accumulates across turns (no clear) so real loops are caught, + // but time-windowed so legitimate retries across separate queries don't false-positive + const now = Date.now(); let looping = false; for (const tc of res.tool_calls) { const sig = tc.function.name + ':' + (tc.function.arguments || ''); - const count = (_seenCalls.get(sig) || 0) + 1; - _seenCalls.set(sig, count); - if (count >= 3) { - this.terminal.print(`🔄 Loop detected: ${tc.function.name} called ${count}x with same args — breaking loop`, 'warning'); + let entry = _seenCalls.get(sig); + if (!entry || (now - entry.ts) > _loopWindow) { + entry = { count: 0, ts: now }; + } + entry.count++; + entry.ts = now; + _seenCalls.set(sig, entry); + if (entry.count >= 6) { + this.terminal.print(`🔄 Loop detected: ${tc.function.name} called ${entry.count}x with same args in 30s — breaking loop`, 'warning'); looping = true; break; } @@ -16271,4 +16280,148 @@ if (typeof window !== 'undefined') { window.NeuralVFSModule = NeuralVFSModule; } +/* === module-smartctx.js === */ +// Extracted from newOS4 index.html — SmartContextModule + class SmartContextModule { + constructor() { + this.commands = {}; this.terminal = null; + this.contextProfiles = this.loadProfiles(); this.activeProfile = this.loadActiveProfile(); + } + getHelpInfo() { + return { + 'context': 'context [name] — Set or view current context profile', + 'contexts': 'contexts — List all available context profiles', + 'context-new': 'context-new <name> <displayName> <systemPrompt> — Create a new context profile', + 'context-delete': 'context-delete <name> — Delete a context profile', + 'smart-ask': 'smart-ask <question> — Ask a question using the active context' + }; + } + loadProfiles() { + try { + const saved = localStorage.getItem('webx11_context_profiles'); + return saved ? JSON.parse(saved) : this.getDefaultProfiles(); + } catch (e) { return this.getDefaultProfiles(); } + } + saveProfiles() { + localStorage.setItem('webx11_context_profiles', JSON.stringify(this.contextProfiles)); + } + loadActiveProfile() { + try { + const saved = localStorage.getItem('webx11_active_context_profile'); + if (saved && this.contextProfiles[saved]) return saved; + } catch (e) {} + return null; + } + saveActiveProfile() { + try { + if (this.activeProfile) { + localStorage.setItem('webx11_active_context_profile', this.activeProfile); + } else { + localStorage.removeItem('webx11_active_context_profile'); + } + } catch (e) {} + } + getDefaultProfiles() { + return { + 'coding': { name: 'Coding Assistant', systemPrompt: "You are an expert programmer.", temperature: 0.7 }, + 'debug': { name: 'Debug Helper', systemPrompt: "You are a debugging expert.", temperature: 0.5 }, + 'creative': { name: 'Creative Writer', systemPrompt: "You are a creative writer.", temperature: 0.9 }, + 'technical': { name: 'Technical Docs', systemPrompt: "You are a technical writer.", temperature: 0.3 }, + 'chat': { name: 'Casual Chat', systemPrompt: "You are a friendly assistant.", temperature: 0.8 } + }; + } + registerCommands() { + this.commands['context'] = (args) => this.setContext(args); + this.commands['contexts'] = () => this.listContexts(); + this.commands['context-new'] = (args) => this.createContext(args); + this.commands['context-delete'] = (args) => this.deleteContext(args); + this.commands['smart-ask'] = (args) => this.smartAsk(args); + } + setContext(args) { + if (!args[0]) { + this.terminal.print(`Current context: ${this.activeProfile || 'none'}`, "info"); return; + } + if (this.contextProfiles[args[0]]) { + this.activeProfile = args[0]; + this.saveActiveProfile(); + this.terminal.print(`Context set to: ${this.contextProfiles[args[0]].name}`, "success"); + } else { + this.terminal.print(`Profile '${args[0]}' not found`, "error"); + } + } + listContexts() { + this.terminal.print("=== Context Profiles ===", "info"); + Object.entries(this.contextProfiles).forEach(([key, profile]) => { + const active = key === this.activeProfile ? ' ✅' : ''; + this.terminal.print(`${key}: ${profile.name}${active}`); + }); + } + createContext(args) { + if (args.length < 3) { + this.terminal.print("Usage: context-new <name> <displayName> <systemPrompt>", "warning"); return; + } + const name = args[0], displayName = args[1], systemPrompt = args.slice(2).join(' '); + this.contextProfiles[name] = { name: displayName, systemPrompt, temperature: 0.7 }; + this.saveProfiles(); + this.terminal.print(`Context profile '${name}' created`, "success"); + } + deleteContext(args) { + if (!args[0]) { + this.terminal.print("Usage: context-delete <name>", "warning"); return; + } + if (this.contextProfiles[args[0]]) { + delete this.contextProfiles[args[0]]; + this.saveProfiles(); + if (this.activeProfile === args[0]) { this.activeProfile = null; } + this.terminal.print(`Context profile '${args[0]}' deleted`, "success"); + } else { + this.terminal.print(`Profile '${args[0]}' not found`, "error"); + } + } + async smartAsk(args) { + if (!args[0]) { + this.terminal.print("Usage: smart-ask <your-question>", "warning"); return; + } + let systemPrompt = "You are a helpful assistant."; + let temperature = 0.7; + if (this.activeProfile && this.contextProfiles[this.activeProfile]) { + const profile = this.contextProfiles[this.activeProfile]; + systemPrompt = profile.systemPrompt; + temperature = profile.temperature || 0.7; + this.terminal.print(`Using context: ${profile.name} (temp: ${temperature})`, "info"); + } + // Use agentic loop via the AI assistant module for tool-enabled responses + const aiModule = this.terminal?.moduleManager?.modules?.WebX11AIAssistantModule; + if (aiModule) { + // Set temperature on ollamaManager modelParams temporarily + const om = this.terminal.ollamaManager; + const savedTemp = om.modelParams ? om.modelParams.temperature : undefined; + if (om.modelParams) { + om.modelParams.temperature = temperature; + } + try { + const messages = [ + { role: 'system', content: systemPrompt }, + { role: 'user', content: args.join(' ') } + ]; + const result = await om.chatWithTools(messages, aiModule.getToolDefinitions()); + if (result && result.message) { + this.terminal.printAIResponse(result.message.content || '(no response)'); + } else if (result && result.error) { + this.terminal.print(`⚠️ AI error: ${result.error}`, 'error'); + } + } finally { + if (om.modelParams && savedTemp !== undefined) { + om.modelParams.temperature = savedTemp; + } + } + } else { + // Fallback: simple chat with temperature + const om = this.terminal.ollamaManager; + const fullPrompt = `${systemPrompt}\n\nUser: ${args.join(' ')}`; + await om.chat(fullPrompt); + } + } + } + /* === end core module bundle === */ diff --git a/modules/core/module-aiassist.js b/modules/core/module-aiassist.js index 9c9b1ca..caf6d99 100644 --- a/modules/core/module-aiassist.js +++ b/modules/core/module-aiassist.js @@ -765,6 +765,7 @@ buildSystemPrompt() { async agenticLoop(messages) { let toolTurns = 0; const _seenCalls = new Map(); // v4.5.66: loop detection — track repeated tool calls + const _loopWindow = 30000; // 30s window for loop detection while (toolTurns < this.MAX_TOOL_TURNS) { if (this._cancelled) { this.terminal.print('AI loop cancelled', 'warning'); return { finalAnswer: null, toolTurns }; } toolTurns++; @@ -791,16 +792,22 @@ buildSystemPrompt() { return { finalAnswer: text, toolTurns }; } if (res.tool_calls && res.tool_calls.length > 0) { - // v4.5.66: Loop detection — break if AI repeats same tool+args 3+ times - // Reset per-turn so legitimate retries across turns don't false-positive - _seenCalls.clear(); + // v4.5.66: Loop detection — break if AI repeats same tool+args 6+ times in 30s + // Accumulates across turns (no clear) so real loops are caught, + // but time-windowed so legitimate retries across separate queries don't false-positive + const now = Date.now(); let looping = false; for (const tc of res.tool_calls) { const sig = tc.function.name + ':' + (tc.function.arguments || ''); - const count = (_seenCalls.get(sig) || 0) + 1; - _seenCalls.set(sig, count); - if (count >= 3) { - this.terminal.print(`🔄 Loop detected: ${tc.function.name} called ${count}x with same args — breaking loop`, 'warning'); + let entry = _seenCalls.get(sig); + if (!entry || (now - entry.ts) > _loopWindow) { + entry = { count: 0, ts: now }; + } + entry.count++; + entry.ts = now; + _seenCalls.set(sig, entry); + if (entry.count >= 6) { + this.terminal.print(`🔄 Loop detected: ${tc.function.name} called ${entry.count}x with same args in 30s — breaking loop`, 'warning'); looping = true; break; } diff --git a/modules/core/terminal.js b/modules/core/terminal.js index b5f50a6..2b41fd3 100644 --- a/modules/core/terminal.js +++ b/modules/core/terminal.js @@ -1193,6 +1193,7 @@ this._safeRegister('PredictorModule', 'predictor'); this._safeRegister('WorldModelModule', 'world model'); this._safeRegister('ServerMonitorModule', 'server monitor'); + this._safeRegister('SmartContextModule', 'smart context'); this._safeRegister('SimpleGUIModule', 'simple GUI builder'); // v4.5.47: Critical ext modules promoted to boot path this._safeRegister('EditorModule', 'editor'); @@ -1240,6 +1241,7 @@ FileManagerModule: typeof FileManagerModule !== 'undefined' ? FileManagerModule : undefined, DiffModule: typeof DiffModule !== 'undefined' ? DiffModule : undefined, BusyBoxModule: typeof BusyBoxModule !== 'undefined' ? BusyBoxModule : undefined, + SmartContextModule: typeof SmartContextModule !== 'undefined' ? SmartContextModule : undefined, }; const cls = registry[className]; if (typeof cls === 'undefined') { diff --git a/scripts/rebuild-bundles.py b/scripts/rebuild-bundles.py index b4b6c75..3b04af5 100644 --- a/scripts/rebuild-bundles.py +++ b/scripts/rebuild-bundles.py @@ -33,6 +33,7 @@ CORE_FILES = [ 'module-predictor.js', 'module-world-model.js', 'module-neural-vfs.js', + 'module-smartctx.js', ] CRITICAL_EXT_FILES = [ |