From 2b3083308ff3653cb85fc90415f14b62f0d8c108 Mon Sep 17 00:00:00 2001 From: modimihir07 Date: Sun, 17 May 2026 23:43:18 +0530 Subject: [PATCH] v1.2.0: opencode JSON mode, 180s Hermes timeout, client AbortController, SEO README, badge/CSS fixes, prompt clipboard fix --- .gitignore | 4 + AGENTS.md | 9 +- README.md | 307 +++++++++++++++++++++++++++++++++---- audit/audit.log | 8 - dashboard/api.js | 8 +- dashboard/app.js | 8 + dashboard/index.html | 3 +- dashboard/pages/chat.js | 9 +- dashboard/pages/prompts.js | 11 +- dashboard/pages/skills.js | 3 +- dashboard/styles.css | 85 ++++++---- data/chat-history.json | 60 -------- data/cost-history.json | 6 - server.py | 154 ++++++++++++++----- 14 files changed, 489 insertions(+), 186 deletions(-) delete mode 100644 audit/audit.log delete mode 100644 data/chat-history.json delete mode 100644 data/cost-history.json diff --git a/.gitignore b/.gitignore index acbfe0e..f25e75c 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,7 @@ node_modules/ .DS_Store *.tar.gz backups/*.tar.gz +audit/* +data/settings.json +data/chat-history.json +data/cost-history.json diff --git a/AGENTS.md b/AGENTS.md index 4a5a7ac..3e1c865 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -14,6 +14,7 @@ Your role is to act as the **kernel** of this system: route tasks to the right a |-------|-------| | **Name** | Agentic OS | | **Location** | `/home/mihir/Desktop/Agentic OS Project/` | +| **GitHub** | [github.com/modimihir07/agentic-os](https://github.com/modimihir07/agentic-os) | | **Author** | Mihir N Modi (Gujarat, India โ€” BTech CSE 1st year) | | **Created** | May 17, 2026 | | **License** | MIT | @@ -314,7 +315,7 @@ Your role is to act as the **kernel** of this system: route tasks to the right a | **Active Project** | CloudMart โ€” GCP DevOps multi-region e-commerce platform | | **Other Projects** | AgriAssist AI, Hermes Agent/OpenClaw, EROS Wellness AI, Java OOP practice | | **CLI Tools Available** | opencode, Hermes Agent, Gemini CLI | -| **Preferred Model** | deepseek-v4-flash-free | +| **Preferred Model** | Hermes: Owl Alpha (OpenRouter, free), opencode: deepseek-v4-flash-free (opencode-zen), Gemini: gemini-2.5-flash (Google OAuth) | | **Obsidian Vaults** | 4 vaults: DevOps, DeepSeek Chat, AI/ML, SEM-2 Academics (192 files) | --- @@ -343,6 +344,11 @@ When you (an AI agent) are dropped into this directory for the first time: - Any AI agent reading this file should have enough context to continue seamlessly - The agent should first read this file, then `brain/*`, then `data/settings.json` +### Session History +- opencode: `~/.local/share/opencode/opencode.db` + `~/.local/share/opencode/log/` +- Hermes: `~/.hermes/sessions.json` +- Gemini: `~/.gemini/history/` + --- ## API Endpoints (server.py FastAPI) @@ -379,6 +385,7 @@ When you (an AI agent) are dropped into this directory for the first time: | Date | Version | Changes | |------|---------|---------| | May 17, 2026 | v1.0.0 | Initial creation โ€” all 51 features + 10 extras | +| May 17, 2026 | v1.1.0 | AI Chat fixes: corrected CLI syntax (hermes `chat -q`, gemini positional), switched Hermes default to OpenRouter + Owl Alpha, improved timeout/error handling, updated execute_agent fallback logic | --- diff --git a/README.md b/README.md index 732bb50..a42a680 100644 --- a/README.md +++ b/README.md @@ -1,42 +1,283 @@ -# Agentic OS +
+
+ License: MIT + Python 3.10+ + FastAPI + 3 Agents + 16 Skills + Status: Stable +

+
-A multi-agent orchestration platform that coordinates **opencode**, **Hermes Agent**, and **Gemini CLI** into a unified, self-improving, autonomous work operating system. +# Agentic OS ๐Ÿง  โ€” Multi-Agent Orchestration Platform -## Quick Start +A locally-hosted operating system for AI agents that coordinates **opencode**, **Hermes Agent**, and **Gemini CLI** into a unified dashboard with persistent memory, cron scheduling, skill execution, cost analytics, and disaster recovery. + +> **Why Agentic OS?** Most agent tools work in isolation โ€” a terminal for coding, a separate chat for research, another for memory. Agentic OS is the **control plane** that unifies them: one dashboard, one memory layer, one scheduler, one skill hub. Three agents, infinite capabilities. + +--- + +## โœจ Features + +| Category | Features | +|----------|----------| +| **๐Ÿค– 3-Agent Engine** | opencode (code/DevOps), Hermes (memory/scheduling), Gemini (research/analysis) with intelligent routing | +| **๐Ÿงฉ 16+ Skills** | Executable skill packs with eval scoring, learnings, and score history per run | +| **๐Ÿง  Persistent Memory** | SQLite FTS5 + `brain/` folder โ€” shared context read by all agents at session start | +| **โฑ Cron Scheduler** | APScheduler-powered jobs โ€” heartbeat, memory consolidation, daily standup, DevOps audit | +| **๐Ÿ’ฐ Cost Analytics** | Track spending per provider, model, agent. Free-tier alerts prevent surprise bills | +| **๐Ÿ“‹ Audit Trail** | Every action logged โ€” chat, skill runs, settings changes, backups | +| **๐Ÿ’พ One-Click Backup** | Full tar.gz snapshot of all configs, skills, brain, agents, prompts | +| **๐Ÿ“ Prompt Library** | 10 reusable templates โ€” code review, system audit, project plan, brainstorm, and more | +| **๐Ÿ“ Standards System** | Discover and inject coding conventions across your project | +| **๐Ÿ”Œ Plugin Registry** | Marketplace-style plugin management (extensible via skills) | +| **๐ŸŽจ Dark/Light Theme** | GitHub-style dark mode + clean light theme, toggle from sidebar | +| **โšก Zero API Costs** | Built for free tiers โ€” Gemini Flash, OpenRouter free models, local opencode | + +--- + +## ๐Ÿ— Architecture + +``` +โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” +โ”‚ AGENTIC OS DASHBOARD โ”‚ +โ”‚ FastAPI + Tailwind SPA โ”‚ +โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค +โ”‚ โ”‚ +โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ +โ”‚ โ”‚ opencode โ”‚ โ”‚ Hermes โ”‚ โ”‚ Gemini CLI โ”‚ โ”‚ +โ”‚ โ”‚ (Code/DevOps)โ”‚ โ”‚ (Memory/Schedโ”‚ โ”‚ (Research/Analy) โ”‚ โ”‚ +โ”‚ โ”‚ File Ops) โ”‚ โ”‚ /Channels) โ”‚ โ”‚ โ”‚ โ”‚ +โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ +โ”‚ โ”‚ +โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ +โ”‚ โ”‚ 7 CORE LAYERS (Stacked) โ”‚ โ”‚ +โ”‚ โ”‚ Layer 7: Identity / Persona / Constitution โ”‚ โ”‚ +โ”‚ โ”‚ Layer 6: Self-Evolution + Capability Manager โ”‚ โ”‚ +โ”‚ โ”‚ Layer 5: Scheduler + Awareness + Health Guardian โ”‚ โ”‚ +โ”‚ โ”‚ Layer 4: Memory Graph + Memory Consolidation โ”‚ โ”‚ +โ”‚ โ”‚ Layer 3: Skills Hub + Eval + Learnings Loop โ”‚ โ”‚ +โ”‚ โ”‚ Layer 2: Business Brain + Context Folders โ”‚ โ”‚ +โ”‚ โ”‚ Layer 1: Agent Router + Standards + Profiles โ”‚ โ”‚ +โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ +โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ +``` + +### Agent Responsibilities + +| Agent | Role | Default Model | Provider | Cost | +|-------|------|---------------|----------|------| +| **opencode** | Code generation, DevOps, file operations | deepseek-v4-flash-free | opencode-zen | **$0** | +| **Hermes Agent** | Persistent memory, scheduling, messaging | Owl Alpha (1M ctx) | OpenRouter | **$0** | +| **Gemini CLI** | Web research, multi-modal analysis | gemini-2.5-flash | Google OAuth | **$0** | + +### Routing Rules + +- **Code/DevOps task?** โ†’ opencode +- **Memory/Channel/Schedule?** โ†’ Hermes Agent +- **Research/Analysis?** โ†’ Gemini CLI +- **Complex multi-step?** โ†’ Chain: Gemini researches โ†’ opencode implements โ†’ Hermes monitors/schedules + +--- + +## ๐Ÿš€ Quick Start ```bash +git clone https://github.com/modimihir07/agentic-os.git +cd agentic-os chmod +x install.sh && ./install.sh -``` - -## Architecture - -3 agents + 7 layers + web dashboard: - -| Agent | Role | -|-------|------| -| **opencode** | Code generation, DevOps, file operations | -| **Hermes Agent** | Memory, scheduling, channels | -| **Gemini CLI** | Research, analysis, multi-modal | - -## Features - -- 51 features from top agentic OS implementations -- 10 extra features (cost analytics, git versioning, backup, prompts, etc.) -- Interactive web dashboard (FastAPI + SPA) -- One-click skill execution -- Scheduled workflows -- Persistent memory across sessions -- Self-improving skills with eval scoring -- Multi-agent routing and handoff -- Cost tracking with free-tier alerts - -## Dashboard - -```bash ./start.sh -# Visit http://127.0.0.1:8080 +# Open http://127.0.0.1:8080 ``` -## License +--- -MIT +## ๐Ÿ“‹ Prerequisites + +| Tool | Required? | Install | +|------|-----------|---------| +| Python 3.10+ | โœ… Required | `sudo apt install python3 python3-pip` | +| Node.js 18+ | โš  For opencode | `curl -fsSL https://deb.nodesource.com/setup_20.x \| sudo bash - && sudo apt install -y nodejs` | +| opencode | โš  For code tasks | `npm install -g @opencode/cli` | +| Hermes Agent | โš  For memory/scheduling | `curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh \| bash` | +| Gemini CLI | โš  For Google AI | `npm install -g @google/gemini-cli` | + +> โš  = Optional โ€” the dashboard works with any subset of installed agents. + +--- + +## ๐Ÿ”ง Configuration + +### Hermes (OpenRouter) +```bash +# Set your OpenRouter API key +echo 'OPENROUTER_API_KEY=sk-or-v1-your-key-here' > ~/.hermes/.env +``` + +### Gemini CLI (Google OAuth) +```bash +gemini auth login +# Complete OAuth in browser โ€” tokens saved to ~/.gemini/oauth_creds.json +``` + +### Dashboard Settings +Edit `data/settings.json`: +```json +{ + "dashboard": { "port": 8080 }, + "theme": "dark", + "agents": { "opencode": true, "hermes": true, "gemini": true } +} +``` + +--- + +## ๐Ÿ“ Project Structure + +``` +agentic-os/ +โ”œโ”€โ”€ server.py # FastAPI backend (REST API) +โ”œโ”€โ”€ requirements.txt # Python dependencies +โ”œโ”€โ”€ install.sh # One-command installer +โ”œโ”€โ”€ start.sh # Launch dashboard +โ”œโ”€โ”€ backup.sh / restore.sh # Disaster recovery +โ”‚ +โ”œโ”€โ”€ dashboard/ # Web frontend (SPA) +โ”‚ โ”œโ”€โ”€ index.html # Entry point + sidebar +โ”‚ โ”œโ”€โ”€ app.js # SPA router + theme/sidebar toggle +โ”‚ โ”œโ”€โ”€ api.js # API client (all endpoints) +โ”‚ โ”œโ”€โ”€ styles.css # Full dark/light theme CSS +โ”‚ โ”œโ”€โ”€ utils.js # Shared utilities +โ”‚ โ””โ”€โ”€ pages/ # 13 page modules +โ”‚ โ”œโ”€โ”€ dashboard.js # Overview with stats +โ”‚ โ”œโ”€โ”€ skills.js # Skill grid/list/detail +โ”‚ โ”œโ”€โ”€ memory.js # Brain file editor +โ”‚ โ”œโ”€โ”€ chat.js # Multi-agent chat +โ”‚ โ”œโ”€โ”€ scheduler.js # Cron job manager +โ”‚ โ”œโ”€โ”€ audit.js # Activity trail +โ”‚ โ”œโ”€โ”€ cost.js # Cost analytics charts +โ”‚ โ”œโ”€โ”€ plugins.js # Plugin marketplace +โ”‚ โ”œโ”€โ”€ backups.js # Backup/restore UI +โ”‚ โ”œโ”€โ”€ prompts.js # Template library +โ”‚ โ”œโ”€โ”€ standards.js # Code conventions +โ”‚ โ”œโ”€โ”€ settings.js # Config editor +โ”‚ โ””โ”€โ”€ setup-wizard.js # Guided setup +โ”‚ +โ”œโ”€โ”€ brain/ # Shared context (all agents read) +โ”‚ โ”œโ”€โ”€ business-brain.md # Current project context +โ”‚ โ”œโ”€โ”€ memory.md # Accumulated knowledge +โ”‚ โ”œโ”€โ”€ recent-decisions.md +โ”‚ โ”œโ”€โ”€ active-projects.md +โ”‚ โ”œโ”€โ”€ identity.md +โ”‚ โ””โ”€โ”€ constitution.md +โ”‚ +โ”œโ”€โ”€ skills/ # 16 executable skills +โ”‚ โ”œโ”€โ”€ devops-audit/ # GCP/CloudMart infra audit +โ”‚ โ”œโ”€โ”€ heartbeat/ # 5-min health check +โ”‚ โ”œโ”€โ”€ content-draft/ # Blog/newsletter writing +โ”‚ โ”œโ”€โ”€ code-review/ # PR review checklist +โ”‚ โ”œโ”€โ”€ research-synthesis/ # Gemini research aggregator +โ”‚ โ”œโ”€โ”€ daily-standup/ # Morning briefing +โ”‚ โ”œโ”€โ”€ meeting-minutes/ # Notes processor +โ”‚ โ”œโ”€โ”€ project-planner/ # Step-by-step plans +โ”‚ โ”œโ”€โ”€ brainstorming/ # Socratic design +โ”‚ โ”œโ”€โ”€ systematic-debug/ # 4-phase root cause +โ”‚ โ”œโ”€โ”€ memory-consolidation/ # Weekly synthesis +โ”‚ โ”œโ”€โ”€ backup-skill/ # Snapshot creator +โ”‚ โ”œโ”€โ”€ cost-analytics/ # Multi-provider cost +โ”‚ โ”œโ”€โ”€ tdd-cycle/ # Red-green-refactor +โ”‚ โ”œโ”€โ”€ goal-planner/ # Goal โ†’ steps +โ”‚ โ””โ”€โ”€ _template/ # Starter template +โ”‚ +โ”œโ”€โ”€ agents/ # Per-agent configs +โ”œโ”€โ”€ scheduler/jobs/ # Cron job definitions +โ”œโ”€โ”€ registry/ # Plugin marketplace +โ”œโ”€โ”€ standards/ # Discover/inject conventions +โ”œโ”€โ”€ prompts/ # 10 reusable templates +โ”œโ”€โ”€ data/ # Runtime data (gitignored) +โ”œโ”€โ”€ audit/ # Activity log (gitignored) +โ””โ”€โ”€ backups/ # Snapshots (gitignored) +``` + +--- + +## ๐ŸŽฎ Usage + +### AI Chat +Select an agent from the sidebar โ†’ type your message โ†’ get response. + +| Agent | Best for | Example | +|-------|----------|---------| +| **opencode** | "Check system status", "Deploy to GKE" | Code + terminal automation | +| **Hermes** | "What did I work on recently?", "Schedule a daily backup" | Memory recall, scheduling | +| **Gemini** | "Research latest AI agent trends", "Analyze this image" | Web research, multi-modal | + +### Skills +Browse 16 skills from Skills Hub โ†’ click Run โ†’ monitor eval scores over time. + +### Scheduler +Create cron jobs: heartbeat (5 min), memory consolidation (weekly), daily standup, DevOps audit. + +### Cost Analytics +Track spending per provider/model/agent. Free-tier alerts warn when nearing limits. + +--- + +## ๐Ÿ“Š Comparison: Agentic OS vs Claude Agent OS (Julian Goldie) + +| Feature | Claude Agent OS (Video) | Agentic OS (This Project) | +|---------|------------------------|---------------------------| +| **Core Agents** | Claude + OpenClaw + Hermes | opencode + Hermes + Gemini CLI | +| **Cost** | $20/mo (Claude subscription) | **$0 โ€” all free tiers** | +| **Stack** | Next.js + Tailwind | FastAPI + vanilla JS SPA | +| **Architecture** | 4 layers | **7 layers** | +| **Skills System** | Plugin marketplace (2,000+ from Hermes) | 16 curated skills + eval scoring + learnings | +| **Memory** | Obsidian vault (external) | Built-in brain/ + SQLite FTS5 | +| **Scheduler** | Not shown | APScheduler cron jobs | +| **Cost Tracking** | Not shown | Built-in per-provider analytics | +| **Backup/Restore** | Not shown | One-click tar.gz snapshots | +| **Audit Trail** | Not shown | Full activity log | +| **Standards System** | Not shown | Discover/inject conventions | +| **Client Timeout** | Not shown | 200s AbortController | +| **Kanban Board** | Yes | No (not needed for agent OS) | +| **Open Source** | No (tutorial only) | **MIT License** | + +--- + +## ๐Ÿงช Tested On + +- **OS**: Linux (Ubuntu 22.04+), macOS +- **Python**: 3.10, 3.11, 3.12 +- **Browsers**: Chrome, Firefox, Edge +- **Agents**: opencode v0.8+, Hermes Agent v1.0+, Gemini CLI v1.0+ + +--- + +## ๐Ÿค Contributing + +1. Fork the repo +2. Create a feature branch (`git checkout -b feature/amazing-feature`) +3. Commit your changes (`git commit -m 'Add amazing feature'`) +4. Push (`git push origin feature/amazing-feature`) +5. Open a Pull Request + +See `data/agent-routes.json` for routing rules and `skills/_template/` for creating new skills. + +--- + +## ๐Ÿ“„ License + +MIT License โ€” free to use, modify, and distribute. + +--- + +
+

Agentic OS โ€” Built with โค๏ธ by Mihir Modi

+

+ Report Bug + ยท + Discussions + ยท + GitHub +

+
diff --git a/audit/audit.log b/audit/audit.log deleted file mode 100644 index ca50d60..0000000 --- a/audit/audit.log +++ /dev/null @@ -1,8 +0,0 @@ -{"action": "skill_run", "skill": "heartbeat", "agent": "opencode", "run_id": "d52d517a", "timestamp": "2026-05-17T09:58:07.559900+00:00", "id": "36284cbc"} -{"action": "skill_run", "skill": "devops-audit", "agent": "opencode", "run_id": "92cd4f97", "timestamp": "2026-05-17T09:59:08.213032+00:00", "id": "40695cd7"} -{"action": "skill_run", "skill": "heartbeat", "agent": "opencode", "run_id": "f18c903b", "timestamp": "2026-05-17T10:18:44.356138+00:00", "id": "c9117c6d"} -{"action": "job_deleted", "job_id": "daily-standup-default", "timestamp": "2026-05-17T10:34:38.978261+00:00", "id": "35513486"} -{"action": "chat_message", "agent": "opencode", "msg_preview": "hello", "timestamp": "2026-05-17T10:37:06.791873+00:00", "id": "c41e3054"} -{"action": "chat_message", "agent": "opencode", "msg_preview": "hello", "timestamp": "2026-05-17T10:40:56.501310+00:00", "id": "6d4ab33d"} -{"action": "chat_message", "agent": "opencode", "msg_preview": "hello", "timestamp": "2026-05-17T10:42:36.570364+00:00", "id": "358f4058"} -{"action": "chat_message", "agent": "opencode", "msg_preview": "hey", "timestamp": "2026-05-17T10:49:19.673600+00:00", "id": "c188ba46"} diff --git a/dashboard/api.js b/dashboard/api.js index ea241f3..a92c99c 100644 --- a/dashboard/api.js +++ b/dashboard/api.js @@ -4,8 +4,10 @@ const api = { if (!r.ok) { const e = await r.json().catch(() => ({})); throw new Error(e.detail || `Request failed: ${r.status}`); } return r.json(); }, - async post(path, body = {}) { - const r = await fetch(path, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) }); + async post(path, body = {}, controller) { + const opts = { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) }; + if (controller) opts.signal = controller.signal; + const r = await fetch(path, opts); if (!r.ok) { const e = await r.json().catch(() => ({})); throw new Error(e.detail || `Request failed: ${r.status}`); } return r.json(); }, @@ -43,6 +45,6 @@ const api = { updateSettings: (settings) => api.put('/api/settings', { settings }), getStandards: () => api.get('/api/standards'), discoverStandards: () => api.post('/api/standards/discover'), - chat: (agent, message) => api.post('/api/chat', { agent, message }), + chat: (agent, message, controller) => api.post('/api/chat', { agent, message }, controller), getChatHistory: () => api.get('/api/chat/history'), }; diff --git a/dashboard/app.js b/dashboard/app.js index 457eff2..d582423 100644 --- a/dashboard/app.js +++ b/dashboard/app.js @@ -28,6 +28,10 @@ async function navigate(page) { const hash = page || window.location.hash.slice(1) || 'dashboard'; if (!hash) { window.location.hash = 'dashboard'; return; } + // Show loading bar + const bar = document.getElementById('topLoadingBar'); + if (bar) { bar.classList.add('active'); bar.style.width = '30%'; } + document.querySelectorAll('.nav-item').forEach(el => el.classList.remove('active')); const navItem = document.querySelector(`[data-page="${hash}"]`); if (navItem) navItem.classList.add('active'); @@ -45,12 +49,16 @@ async function navigate(page) { if (renderFn) { content.innerHTML = ''; content.className = 'page-content page-enter'; + if (bar) bar.style.width = '70%'; await renderFn(); + if (bar) { bar.style.width = '100%'; setTimeout(() => { bar.style.width = '0'; bar.classList.remove('active'); }, 400); } } else { content.innerHTML = `
๐Ÿ”
Page not found
The page "${hash}" doesn't have a render function
`; + if (bar) { bar.style.width = '0'; bar.classList.remove('active'); } } } catch (err) { content.innerHTML = `
โš 
Failed to load
${escapeHtml(err.message)}
`; + if (bar) { bar.style.width = '0'; bar.classList.remove('active'); } } } diff --git a/dashboard/index.html b/dashboard/index.html index cfe750a..59c1e48 100644 --- a/dashboard/index.html +++ b/dashboard/index.html @@ -11,9 +11,10 @@ +