From a065a4c30be748b0c8fc6dd0b5ee1dc4d3de4b1c Mon Sep 17 00:00:00 2001 From: Agando Date: Mon, 9 Nov 2026 15:36:23 +0100 Subject: chore(newos4): commit accumulated maintenance output The daily collector and the feedback pipeline had left 57 modified files uncommitted (skills, modules-index, CHANGELOG, feedback decisions, debug counters). The public mirror publishes git HEAD, so without this the published repo stayed behind the tree - and it blocked the publisher outright once uncommitted subtrees started failing loudly. --- .bkp-fix-20261023_143429/skill-pack-core.js | 1150 +++++++++++++++++++++++++++ 1 file changed, 1150 insertions(+) create mode 100644 .bkp-fix-20261023_143429/skill-pack-core.js (limited to '.bkp-fix-20261023_143429/skill-pack-core.js') diff --git a/.bkp-fix-20261023_143429/skill-pack-core.js b/.bkp-fix-20261023_143429/skill-pack-core.js new file mode 100644 index 0000000..f204e70 --- /dev/null +++ b/.bkp-fix-20261023_143429/skill-pack-core.js @@ -0,0 +1,1150 @@ +class SkillPackCoreModule { + constructor() { + this.commands = {}; + this.commandsMeta = { + 'skill-list': { argType: 'enum', enumFn: '_getSkillCategories' }, 'skill-view': { argType: 'file' }, + 'skill-create': { argType: 'dir' }, 'skill-patch': { argType: 'file' }, + 'skill-delete': { argType: 'file' }, 'skill-export': { argType: 'file' }, + 'skill-sync': { argType: 'file' }, + }; + this.terminal = null; + this._seeded = false; + this._skills = this._buildSkills(); + } + + requirements() { + try { + const fs = this.terminal && this.terminal.fs; + if (fs && fs.readFile('/skills/_seeded')) { + return { met: true, missing: [] }; + } + return { met: false, missing: ['Skills directory not initialized. Will be created on first use.'] }; + } catch (e) { + return { met: true, missing: [] }; + } + } + + getHelpInfo() { + return { + 'skill-pack-core': 'Seed and manage built-in core skills (navigation, memory, search, modules, backup, agents, webdav, security, etc.)', + 'skill-list': 'skill-list [category] — List all skills, optionally filtered by category', + 'skill-view': 'skill-view — View a skill\'s full content', + 'skill-create': 'skill-create "" [tags] — Create a new skill', + 'skill-patch': 'skill-patch "" — Replace a skill\'s full content', + 'skill-delete': 'skill-delete — Delete a skill', + 'skill-export': 'skill-export — Export a skill as JSON', + 'skill-import': 'skill-import — Import a skill from JSON string', + 'skill-sync': 'skill-sync — Rebuild skills index from /skills/ directory', + 'learn-skill': 'learn-skill — Reflect on topic, draft a skill from experience', + 'skill-validate': 'skill-validate — Validate skill structure and get confidence score', + 'skill-audit': 'skill-audit — Audit skills for stale, duplicate, and broken references', + 'skill-restore': 'skill-restore — Restore an archived skill', + 'skill-webdav-sync': 'skill-webdav-sync — Push all skills to WebDAV as JSON files', + }; + } + + _buildSkills() { + const s = (name, desc, tags, cat, steps) => ({ + name, description: desc, tags, category: cat, + content: '---\nname: ' + name + '\ndescription: ' + desc + '\ntags: [' + tags.join(', ') + ']\ncategory: ' + cat + '\n---\n## Steps\n' + steps + }); + + const sk = (name, desc, tags, cat, content) => ({ + name, description: desc, tags, category: cat, + content: '---\nname: ' + name + '\ndescription: ' + desc + '\ntags: [' + tags.join(', ') + ']\ncategory: ' + cat + '\n---\n' + content + }); + + return [ + s('navigating-the-terminal', 'How to explore the WebX11 terminal, find commands, check status, and navigate the filesystem', ['terminal', 'navigation', 'help', 'filesystem'], 'system', +`1. **Get an overview of available commands:** + - Type "help" for a full command list sorted by category + - Type "status" to see filesystem state, loaded modules, Ollama status + - For a specific command, use help + - Type "commands" for a compact list with module source info + - Type "check" for system health including module requirements + +2. **Explore the filesystem:** + - Use ls, ll, tree to browse directories + - Use cd to navigate, pwd to show current path + - Use cat or edit to view file contents + - Use find or grep to search files + - Use du to see disk usage + +3. **Understand system state:** + - mem — memory usage (auto-shown in header on boot) + - status — network, files, modules, Ollama + - modules — module manager GUI + - health-check — VFS size, modules, logs, trash, skills, tool failures + - checkpoint-list — VFS checkpoint snapshots + +4. **Agent / Orchestration state:** + - agent-list — registered agents (type, capabilities, status) + - orchestrate — list active orchestrated agents + - lease-list — show active leases with TTL + +5. **When user asks a vague question:** + - First run status and help to understand the current state + - Then ask clarifying questions based on what you found`), + + s('memory-and-profile', 'How to use the user profile system, session memory, and pattern tracking for persistent context', ['memory', 'profile', 'session', 'persistence'], 'system', +`1. **User Profile (persists across sessions):** + - user_get(key) — read any profile field (e.g. "preferredModel", "fontSize") + - user_set(key, value) — write to profile, auto-persists to localStorage + - user_list — show all stored profile keys + - user_forget(key) — delete a profile key + - Dot notation supported: user_set knownFacts.name "Alex" + +2. **Session Memory (VFS-based daily logs):** + - session_save(summary) — save a summary of what was accomplished + - session_load(date) — read a specific day's log (format: YYYY-MM-DD) + - session_recent(count) — show last N session summaries + - session_stats — aggregate totals across all sessions + - Recent sessions auto-load into context on first message + - systemd-style journal: use logs and logrotate commands for persistent logging + +3. **Conversation Patterns:** + - Pattern tracking runs automatically — frequent topics surface as hints + - my-set, my-get, my-list store additional personal data + - AI conversation context persists within a session (use ai-clear to reset) + - debug command toggles real-time debug panel with Copy/Export/VFS buttons + +4. **Checkpoints (VFS snapshots):** + - checkpoint [name] — snapshot current VFS state + - checkpoint-list — list all checkpoints + - rollback — restore from checkpoint + - checkpoint-del — delete a checkpoint + +5. **When to use:** + - At start: call session_recent(3) to see what was worked on before + - After identifying user preferences: call user_set to store them + - After complex tasks: call session_save with a brief summary + - Before risky edits: call checkpoint to create a restore point`), + + s('web-search-and-fetch', 'How to search the web and fetch URL content using the WebX11 proxy API', ['search', 'fetch', 'web', 'proxy', 'api'], 'research', +`1. **Search the web:** + - Use search or web_search(query) — uses /api/search which queries SearXNG + DDG fallback + - Results include: title, url, content snippet, source engine + - Always available (same-origin, no CORS issues) + - 5-minute server-side cache for repeated queries + - Alternative: use ddg or duck for DuckDuckGo direct, or s as alias + +2. **Fetch URL content:** + - Use fetch or web_fetch(url) — uses /api/extract which strips HTML, extracts clean text + - Returns: title, content (up to 4000 chars), word_count, extraction method + - SSRF protection blocks internal network addresses + - 15-minute server-side cache + +3. **Search flags (via terminal search command):** + - search --summarize — adds AI-generated overview via Ollama + - search --fetch — fetches content snippets for top 3 results + +4. **When to use:** + - User asks about current events, facts, research → use search + - User says "read this article" or provides a URL → use fetch + - For in-depth analysis: search first, then fetch top results`), + + s('module-management', 'How to view, edit, test, reload modules and manage startup configuration', ['modules', 'editing', 'code', 'self-improvement'], 'dev', +`1. **View module source:** + - view_module(name) — fetches original source or reads from _mods/ if edited + - Supports all loaded modules: SystemModule, FileSystemModule, SearXNGModule, etc. + - Or use modules command for GUI module manager + +2. **Edit a module:** + - edit_module(name) — copies source to _mods/.js and opens code editor + - Editor shows the full source in a textarea + - Click "Save & Test" to save and auto-load the edited version + - Checkpoint before editing: checkpoint mod-edit- + +3. **Test and reload:** + - test_module(name) — loads edited module from _mods/ for live testing + - reload_module(name) — discards edits and reloads from original URL + - list_modified_modules — shows all modules with pending edits + +4. **Check for updates:** + - check_updates — HEAD-requests all loaded module URLs to verify reachability + +5. **Manage startup:** + - startup-modules — opens the Startup Modules UI to select which modules load + - load-local — load a module from VFS or URL without editing + - loadmod — alternative: load module from URL + - removemod — remove a loaded module + +6. **Agent modules (Phase 2):** + - module-agent-registry.js — Agent registry with agent-list, agent-register, agent-unregister, agent-status + - module-leases.js — Time-bound contracts with 5s watchdog, auto-expiry + - module-orchestrator.js — Spawn, delegate, kill, purge with heartbeat monitoring + +7. **When to use:** + - User reports a bug in a module → view_module, edit_module, test_module + - User asks "can you add X feature?" → same workflow + - Always save edits before testing. If test fails, the original module stays loaded.`), + + s('system-maintenance', 'How to reset, troubleshoot, and maintain the WebX11 terminal', ['system', 'maintenance', 'reset', 'troubleshoot', 'config'], 'system', +`1. **Factory reset (wipes everything):** + - factory-reset --confirm — clears all webx11_ localStorage keys, resets VFS, reloads + - Use only when the system is in an unrecoverable state + +2. **Soft VFS reset:** + - reset-vfs --confirm — clears only the filesystem, preserves settings/profile/modules + +3. **Config management:** + - config-list — show all config keys and values + - config-set — set a config value + - config-delete — remove a config key + - config-export — dump all config as JSON + - config-reset — restore defaults (use before factory-reset if you want to save data) + +4. **Security level:** + - security-level <0-3> — set security level (0=Permissive, 1=Standard, 2=Paranoid, 3=Audit) + - security — show current security level, blocked count, and stats + - cmd-allow — whitelist a command from security checks + - cmd-deny — blacklist a command + +5. **Health checks (run automatically after complex tasks):** + - Check module loading status: loaded vs total + - Check for pending module edits + - Check memory usage (high if >100MB) + - Check skill count (0 skills after 2+ tool calls → suggest create_skill) + - health-check — full audit: VFS size, modules, logs, trash, skills, tool failures + +6. **Font size and display:** + - font-size <8-32> — set terminal font size, persists across sessions + - setfont — alias for font-size + +7. **Checkpoints:** + - checkpoint [name] — snapshot current VFS state + - checkpoint-list — list all checkpoints + - rollback — restore from checkpoint + +8. **When to use:** + - System is slow or modules fail to load → check check_updates, mem + - User says "reset everything" → factory-reset --confirm + - User says "clear my files but keep settings" → reset-vfs --confirm + - User reports security concerns → security-level or cmd-allow/cmd-deny`), + + s('backup-and-restore', 'How to backup, restore, and export WebX11 data', ['backup', 'restore', 'export', 'import', 'persistence'], 'system', +`1. **Backup VFS:** + - vfs-export — downloads the entire virtual filesystem as a dated JSON file + - backup — creates a full backup including VFS, modules, config (saves to _backups/) + +2. **WebDAV cloud backup:** + - webdav-backup — push VFS snapshot to WebDAV server (auto-archive) + - webdav-backup-list — list remote WebDAV backups + - webdav-restore — restore VFS from remote WebDAV snapshot + - webdav-push — push file to WebDAV space + - webdav-pull — pull file from WebDAV space + - webdav-ls [path] — list remote WebDAV directory contents + - webdav-status — check WebDAV connection and space usage + - webdav-explorer — GUI file browser for WebDAV + - webdav-browser — simpler file listing for WebDAV + - webdav-config — configure WebDAV endpoint and credentials + +3. **Export/Import personal data:** + - my-export — prints all my-set data as formatted JSON + - my-import — bulk-import personal data from JSON string + +4. **Export/Import modules:** + - export-mods — exports module registry as JSON + - import-mods — imports modules from JSON backup + +5. **Restore:** + - restore — restores terminal state from a backup JSON + - Session logs are saved to /memory/ automatically on page unload + +6. **When to use:** + - Before factory-reset: call my-export, vfs-export, export-mods to save data + - When switching browsers or devices: export all, then import + - User says "backup my data" or "save my files" + - For cloud backup: use webdav-backup (requires WebDAV server configured)`), + + s('mindmap-workflow', 'How to create, view, edit, and manage brainstorming mindmaps', ['mindmap', 'brainstorming', 'planning', 'organization'], 'productivity', +`1. **Create a new mindmap:** + - mindmap new "" -t tag1,tag2 — creates a root node + - Tags are optional (e.g. planning, research, dev) + - Root gets auto-assigned a color from 7-color palette + +2. **Add child nodes:** + - mindmap add "" -t tag — add a child + - Get the parent-id from mindmap show + - IDs are 4-char random strings (e.g. a3f8, x7k2) + +3. **View:** + - mindmap show — full tree with Unicode box-drawing + - mindmap show — subtree starting at that node + +4. **Edit nodes:** + - mindmap rename "" — change text + - mindmap color — set color (red/green/yellow/blue/cyan/magenta/white) + - mindmap tag — add a tag + +5. **Persistence:** + - mindmap save — save to localStorage + - mindmap load — restore + - mindmap list — show saved mindmaps + - mindmap delete — remove saved + +6. **Export:** + - mindmap export [id] — Markdown bullet list output, auto-copies to clipboard + +7. **When to use:** + - Map out project structure, brainstorm features, organize ideas + - Break down complex tasks into subtrees + - User says "brainstorm", "diagram", "organize thoughts", "plan"`), + + s('skills-system-guide', 'How to use the skills system: load, create, patch, list, and audit skills for persistent procedural memory', ['skills', 'system', 'meta'], 'system', +`1. **Always load skills at task start:** + - At the START of every task, type or call "skill-view " or "skill-list" + - Example: skill-view "module-management" — returns matching skill content + - Example: skill-list system — browse skills by category + +2. **Create skills after complex tasks:** + - After any task with 3+ tool calls, call "skill-create" + - Required fields: name (kebab-case), description, content (markdown with YAML frontmatter) + - Optional: tags (comma-separated), category (e.g. research, system, dev) + - Skills persist in /skills/ as .md files with /skills/index.json for fast lookup + - Skill pack auto-seeds 8 core skills on first boot + +3. **Patch skills when they're outdated:** + - If a stored procedure has wrong steps, call "skill-patch " + - This replaces the entire skill content and updates the index + - Do NOT create a duplicate — always patch the existing skill + +4. **Auto-created error skills:** + - If the same tool fails 3+ times, a workaround skill is created automatically + - Named tool--workaround (e.g. tool-write_file-workaround) + +5. **Audit and maintenance:** + - skill-list — browse available skills, optionally filter + - skill-export — download a skill as markdown + - skill-import — bulk import skills + - skill-sync — re-index skills from /skills/ directory + - Skills are audited every 20 messages for staleness (empty content, >30 days old) + +6. **YAML frontmatter format:** + - Each skill file must start with: ---\\nname: \\ndescription: \\ntags: [...]\\ncategory: \\n---\\n + - Steps follow under ## Steps heading + - Use numbered lists for sequential steps`), + + sk('agent-orchestration', 'How to use the agent registry, leases, and orchestrator for multi-agent workflows', ['agents', 'orchestration', 'delegation', 'leases'], 'system', +`## Steps +1. **Agent Registry:** + - agent-list — list all registered agents (ID, type, capabilities, status) + - agent-register — register a new agent (capabilities: comma-separated like "code,research") + - agent-unregister — remove an agent + - agent-status — detailed status including uptime, task history + +2. **Leases (time-bound contracts):** + - lease-create — create a lease with watchdog timer + - lease-list — show active leases with remaining TTL + - lease-revoke — terminate a lease early + - lease-renew — extend a lease + +3. **Orchestrator (spawn, delegate, kill):** + - orchestrator-spawn — spawn a new agent automatically (registers + creates lease) + - orchestrator-kill — kill an agent (revokes lease + unregisters) + - orchestrate — list all active agents with their orchestrator state + - orchestrator-purge — kill all idle/expired agents + - orchestrator-status — full system status: active, idle, dead agents + +4. **AI tool integration:** + - AI tools list_agents, delegate_task, spawn_agent are available in the AI system prompt + - The AI can auto-spawn worker agents for sub-tasks + - Each agent gets its own VFS workspace at /agents// + +5. **When to use:** + - User needs parallel task execution → orchestrator-spawn coder + researcher + - Time-bound automation → lease-create with short TTL + - System cleanup → orchestrator-purge to kill stale agents`), + + sk('debug-panel-and-logs', 'How to use the debug panel, session logging, and terminal diagnostics', ['debug', 'logging', 'diagnostics', 'troubleshooting'], 'system', +`## Steps +1. **Toggle debug panel:** + - debug — opens real-time debug panel showing last AI tool call, response time, and context + - Debug panel includes Copy, Export, and Write to VFS buttons + - Export: saves tool call log as timestamped JSON to downloads + - Write to VFS: appends debug data to /debug.log (dedup by turn ID) + +2. **Session logging:** + - logs [n] [LEVEL] — view last n log entries (optionally filtered by INFO/WARN/ERROR) + - logrotate — rotate current.log to dated archive (auto-cleans old logs beyond 10) + - Logs stored in /logs/ directory: current.log + dated archives + - Health check runs automatically after complex tasks + +3. **Diagnostic commands:** + - health-check — full audit: VFS size, modules, logs, trash, skills + - check — quick system health including module requirement status + - mem — real-time memory usage (also in header) + - status — network, files, modules, Ollama connectivity + +4. **System journals:** + - debug.log — appended by debug panel VFS button (dedup by turn ID) + - current.log — system activity log with rotation + - Auto-save: terminal state auto-saves every 60s + +5. **When to use:** + - AI is behaving unexpectedly → debug to see tool calls + - User reports errors → logs 50 ERROR to see error entries + - Memory concerns → mem to check, health-check for full audit`), + + sk('webdav-operations', 'How to use WebDAV cloud storage for backup, file sync, and remote file access', ['webdav', 'cloud', 'backup', 'sync', 'storage'], 'system', +`## Steps +1. **Configuration:** + - webdav-config — configure WebDAV endpoint URL and credentials + - Connection auto-tested on config; webdav-status shows connection health + - Uses per-user token stored in .token file on the server side + +2. **File operations:** + - webdav-ls [path] — list remote directory contents + - webdav-push — upload file to WebDAV + - webdav-pull [local-path] — download file from WebDAV + - webdav-explorer — GUI file browser for WebDAV + - webdav-browser — CLI file browser for WebDAV + +3. **Backup & Restore:** + - webdav-backup — push full VFS snapshot to WebDAV (creates /backups/newos4-.json) + - webdav-backup-list — list all remote backup snapshots + - webdav-restore — restore VFS from a remote backup snapshot + +4. **Status & Diagnostics:** + - webdav-status — connection status, last sync, space information + - If uploads fail: check webdav-config, ensure .token file is valid + - WebDAV runs on the same server (nginx with WebDAV module), no external dependency + +5. **When to use:** + - Before factory-reset: webdav-backup to store VFS remotely + - Cross-browser: webdav-push/pull to move files between instances + - User says "cloud backup" or "remote save" → webdav-backup`), + + sk('security-and-safety', 'How to use WebX11 security levels, command blocking, and safety features', ['security', 'safety', 'blocking', 'permissions'], 'system', +`## Steps +1. **Security levels:** + - security-level <0-3> — set security level: + 0 = Permissive (no blocks, no confirms — anything runs) + 1 = Standard (unknown cmds → AI route, destructive → confirm, system → block) + 2 = Paranoid (unknown cmds blocked entirely, destructive blocked) + 3 = Audit (everything allowed, everything logged) + - Default: level 1 + - security — show current level, blocked count, and stats + +2. **Command control:** + - cmd-allow — whitelist a command from security checks + - cmd-deny — blacklist/block a command entirely + - whitelist built-in: help, clear, ls, cat, pwd, whoami, df, free, top, ps, echo, date, env, history + +3. **What gets blocked at each level:** + - Unknown commands: Level 1 → AI routed, Level 2+ → blocked + - Destructive commands (delete, write, save, format, etc.): Level 1 → confirmation, Level 2+ → blocked + - System commands (reboot, shutdown, format, kill): Level 1+ → blocked + - Suspicious flags (--execute, --eval, --shell): Level 1+ → blocked + +4. **Safety checklist:** + - Check security: security shows your current level + - Before running risky commands: create a checkpoint first + - For temporary relax: security-level 0, then restore to 1 + - For total lockdown before leaving: security-level 2 + +5. **When to use:** + - User wants to lock down the terminal → security-level 2 + - User wants to allow a blocked command → cmd-allow + - Debugging strange behavior → verify security-level (user may have set it higher)`), + + sk('mindmap-user-guide', 'How to create, view, and manage brainstorming mindmaps using the mindmap terminal module', ['mindmap', 'brainstorming', 'organization', 'planning'], 'productivity', +`## Steps +1. **Create a new mindmap:** + - mindmap new "" -t tag1,tag2 — creates a root node + - Tags are optional (e.g. planning, research, dev) + - Root gets auto-assigned a color + +2. **Add child nodes:** + - mindmap add "" -t tag — add a child + - Get the parent-id from mindmap show + - IDs are 4-char random strings (e.g. a3f8, x7k2) + +3. **View the mindmap:** + - mindmap show — full tree with Unicode box-drawing + - mindmap show — subtree starting at that node + +4. **Edit nodes:** + - mindmap rename "" — change text + - mindmap color — set color (red/green/yellow/blue/cyan/magenta/white) + - mindmap tag — add a tag + +5. **Persistence:** + - mindmap save — save to localStorage + - mindmap load — restore + - mindmap list — show saved mindmaps + - mindmap delete — remove saved + +6. **Export:** + - mindmap export [id] — Markdown bullet list output + +## When to use +- User wants to brainstorm, organize ideas, plan features +- User says "map out", "diagram", "brainstorm", "organize thoughts" +- Visualizing project structure or task decomposition`), + + sk('floating-ui', 'How to create, manage, and remove floating UI elements — buttons, collapsible menus, and status panels that persist across page reloads', ['floating', 'ui', 'buttons', 'menu', 'gui'], 'ui', +`## Commands + +1. **Create a floating button:** + - floating-add btn