[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-82855":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":14,"stars7d":13,"stars30d":15,"stars90d":14,"forks30d":14,"starsTrendScore":14,"compositeScore":16,"rankGlobal":9,"rankLanguage":9,"license":17,"archived":18,"fork":18,"defaultBranch":19,"hasWiki":20,"hasPages":18,"topics":21,"createdAt":9,"pushedAt":9,"updatedAt":22,"readmeContent":23,"aiSummary":24,"trendingCount":14,"starSnapshotCount":14,"syncStatus":15,"lastSyncTime":25,"discoverSource":26},82855,"nexora-ai-platform","lb08111\u002Fnexora-ai-platform","lb08111","Nexora AI Platform — Enterprise AI Workspace built on QwenPaw",null,"Python",59,4,1,0,2,42.8,"Apache License 2.0",false,"main",true,[],"2026-06-12 04:01:39","\u003Cdiv align=\"center\">\n\n# Nexora AI Platform\n\n**Enterprise AI Workspace**\n\n[![License](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-Apache%202.0-red.svg?logo=apache)](LICENSE)\n[![Python](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fpython-3.10%20~%20%3C3.14-blue.svg?logo=python)](https:\u002F\u002Fwww.python.org\u002Fdownloads\u002F)\n[![Built on QwenPaw](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fbuilt%20on-QwenPaw-orange.svg)](https:\u002F\u002Fgithub.com\u002Fagentscope-ai\u002FQwenPaw)\n\n[English](#overview) | [中文](#概述)\n\n\u003C\u002Fdiv>\n\n---\n\n## What is Nexora?\n\n**Nexora** = **Nex**us + **ora** (edge, frontier)\n\n- **Nexus** — a central hub where things connect. Nexora is the nexus where AI agents, enterprise tools, team members, and messaging channels converge into a unified workspace.\n- **Ora** — derived from Latin *ora* (edge, boundary), representing the frontier of AI-driven enterprise operations.\n\nTogether, the name embodies the platform's mission: **the central hub at the frontier of enterprise AI** — connecting intelligent agents with the people and tools that run your business, under controlled governance.\n\n---\n\n## Overview\n\nNexora AI Platform is an enterprise-grade AI workspace built on [QwenPaw](https:\u002F\u002Fgithub.com\u002Fagentscope-ai\u002FQwenPaw). It inherits all the core capabilities of QwenPaw — multi-agent orchestration, multi-channel messaging, skill extensions, local model support, and memory-evolving agents — while adding enterprise-essential layers: multi-tenant access control, security governance, audit logging, and token usage analytics.\n\n> **What you can do with Nexora:**\n>\n> - **Team AI workspace** — Multiple users share one platform, each with their own agents and permissions\n> - **Social media & productivity** — Daily hot post digests, email highlights, newsletter summaries pushed to DingTalk\u002FFeishu\u002FWeChat\n> - **Creative & building** — Describe a goal, let agents auto-execute; full workflow from idea to prototype\n> - **Research & learning** — Track tech & AI news, personal knowledge base search and reuse\n> - **Desktop & files** — Organize and search local files, read & summarize documents\n> - **Operations & governance** — Audit every AI action, control who can use which tools, track token spend per user\n\n---\n\n## Core Features\n\n### AI Agent Capabilities (from QwenPaw)\n\n| Feature | Description |\n|---------|-------------|\n| **Multi-Agent Collaboration** | Create multiple independent agents, each with their own role; enable inter-agent communication for complex tasks |\n| **Skills Extension** | Built-in scheduling, PDF\u002FOffice processing, news digest, web search, and more; custom skills auto-loaded |\n| **Memory-Evolving & Proactive** | Agents learn from interactions, reflect on experience, and proactively serve you — smarter the more you use |\n| **Multi-Channel Messaging** | DingTalk, Feishu, WeChat, Discord, Telegram, Slack, QQ, and more — one platform, connect as needed |\n| **Local Model Support** | Run LLMs entirely on your machine via llama.cpp, Ollama, or LM Studio — no API keys required |\n| **Cloud LLM Providers** | DashScope (Qwen), OpenAI, Gemini, Claude, MiniMax, DeepSeek, and many more |\n| **Coding Mode** | Built-in Web IDE with file tree, tabbed editor, inline diff review, and Git panel |\n| **Plugin Ecosystem** | Extend with custom tools, skills, and MCP servers; official plugin marketplace |\n| **Scheduled Tasks (Cron)** | Automate recurring tasks — daily briefings, periodic data checks, scheduled reports |\n| **Context Management** | Intelligent context compression for long conversations |\n| **Tool Guard** | Automatically intercepts dangerous shell commands (rm -rf, fork bombs, reverse shells) |\n| **File Access Guard** | Restricts agent access to sensitive paths (~\u002F.ssh, key files, system directories) |\n| **Skill Security Scanning** | Detects risks like prompt injection, command injection, hardcoded keys before installing skills |\n\n### Enterprise Extensions (Nexora)\n\n| Feature | Description |\n|---------|-------------|\n| **Multi-Tenant RBAC** | Two-role model (admin \u002F operator) with platform-level access control and user management |\n| **Agent Authorization** | Fine-grained agent grants per user — control who can access which AI agents |\n| **Capability Approval** | Risk-based approval workflow for installing\u002Fremoving tools, skills, MCP servers, and plugins |\n| **Audit Logging** | Full audit trail with PostgreSQL backend — auth, chat, tool use, config changes, admin actions |\n| **Token Usage Analytics** | Track LLM token consumption by user, agent, model, and date with dashboard visualization |\n| **Security Governance** | Resource policies, tool scanners, and centralized secret management |\n| **PostgreSQL Backend** | All enterprise data (users, grants, audit, config, tokens) stored in PostgreSQL |\n\n---\n\n## Architecture\n\n```\n┌─────────────────────────────────────────────────────────────┐\n│                    Frontend (React + Vite)                   │\n│  ┌───────────────────────┐  ┌─────────────────────────────┐ │\n│  │   QwenPaw Console UI  │  │  Nexora Admin Dashboard     │ │\n│  │  Chat \u002F Agents \u002F Cron │  │  Users \u002F Grants \u002F Audit     │ │\n│  │  Skills \u002F MCP \u002F Coding│  │  Token Usage \u002F Governance   │ │\n│  └───────────────────────┘  └─────────────────────────────┘ │\n├─────────────────────────────────────────────────────────────┤\n│                    Backend (FastAPI)                         │\n│  ┌──────────────┐  ┌──────────────┐  ┌──────────────────┐  │\n│  │  QwenPaw     │  │   Nexora     │  │  Auth Middleware  │  │\n│  │  Core Engine │  │  Extension   │  │  JWT + RBAC       │  │\n│  │  Agents      │  │  RBAC\u002FAudit  │  │  Route Guards     │  │\n│  │  Providers   │  │  Governance  │  │                   │  │\n│  │  Channels    │  │  Token Track │  │                   │  │\n│  └──────────────┘  └──────────────┘  └──────────────────┘  │\n├─────────────────────────────────────────────────────────────┤\n│                    PostgreSQL 16                             │\n│    Users · Roles · Agent Grants · Audit Logs · Approvals    │\n│    Runtime Config · Governance Policies · Token Usage        │\n├─────────────────────────────────────────────────────────────┤\n│                    Channels                                  │\n│  Console · DingTalk · Feishu · WeChat · Discord · Telegram  │\n│  Slack · QQ · iMessage · Email · ...                        │\n└─────────────────────────────────────────────────────────────┘\n```\n\n**Extension isolation**: All Nexora-specific code lives in dedicated directories (`src\u002Fqwenpaw_ext\u002Fnexora\u002F` and `console\u002Fsrc\u002Fnexora\u002F`), keeping the upstream QwenPaw core clean for future syncs.\n\n---\n\n## Technical Design\n\n> Full details in [Technical Solution](docs\u002Ftechnical-solution.md)\n\n### Three-Layer Permission Model\n\nNexora enforces access control through three cascading layers — each request must pass all applicable checks before reaching the agent runtime:\n\n```\nLayer 1 — Platform Access          Layer 2 — Agent Authorization       Layer 3 — Capability Approval\n┌──────────────────────┐           ┌──────────────────────┐           ┌──────────────────────┐\n│  User authenticates  │           │  Check agent_grants  │           │  When user installs  │\n│  via JWT             │──pass──▶  │  for this user       │           │  or removes a tool,  │\n│                      │           │                      │           │  skill, MCP, plugin  │\n│  RBAC role checked   │           │  Only granted agents │           │  Low risk → allow    │\n│  against route       │           │  are visible & usable│           │  High risk → queue   │\n└──────────────────────┘           └──────────────────────┘           └──────────────────────┘\n        │ fail                             │ fail                             │ pending\n        ▼                                  ▼                                  ▼\n   401 \u002F 403                          403 Forbidden                    Approval Request\n   + audit log                        + audit log                      → Admin reviews\n                                                                       → Approve or reject\n                                                                       + audit log\n```\n\n### Request Lifecycle\n\nEvery user action flows through a unified pipeline — auth, permission, execution, and audit are never bypassed:\n\n```\nBrowser ──▶ FastAPI ──▶ JWT Middleware ──▶ RBAC Guard ──▶ Agent Grant Check\n                                                              │\n                        ┌─────────────────────────────────────┘\n                        ▼\n               QwenPaw Agent Runtime ──▶ LLM Provider\n                        │                       │\n                        ▼                       ▼\n                  Tool Execution          Token Recording\n                        │                       │\n                        └───────────────────────┘\n                                                 ▼\n                                           PostgreSQL\n                                    (audit · tokens · approvals)\n\nCapability changes (install\u002Fremove tools, skills, MCP, plugins)\ngo through a separate approval workflow before taking effect.\n```\n\n### Multi-Agent Runtime\n\nNexora manages 100+ agents on a single node using lazy loading and automatic lifecycle management:\n\n```\n                         ┌─────────────────────────────────┐\n                         │      MultiAgentManager          │\n                         │                                 │\n  User request ────▶     │  ┌─ Active Agent Pool ────────┐ │\n  (agent_id)             │  │  agent_a  [last used: 10s] │ │     Max active: 20\n                         │  │  agent_b  [last used: 45s] │ │     Idle TTL: 1 hour\n                         │  │  agent_c  [last used: 300s]│ │     Eviction: LRU\n                         │  └────────────────────────────┘ │\n                         │         ▲           │           │\n                         │    lazy load    idle evict      │\n                         │         │           ▼           │\n                         │  ┌─ Agent Configs (disk) ─────┐ │\n                         │  │  100+ agent YAML configs   │ │\n                         │  └────────────────────────────┘ │\n                         └─────────────────────────────────┘\n```\n\n- Agents are loaded on first request, not at startup — cold start stays fast\n- Idle agents are evicted after a configurable TTL (default 1 hour)\n- When the pool is full, least-recently-used agents are evicted first\n- Each agent maintains its own memory, tools, and channel bindings\n\n### Capability Approval Workflow\n\nWhen users install or remove capabilities (tools, skills, MCP servers, plugins), a configurable approval gate controls the change:\n\n```\nUser adds\u002Fremoves capability ──▶ Policy Engine checks risk level\n(skill.create, mcp.delete,            │\n plugin.install, tool.create…)         │\n                          ┌────────────┼────────────┐\n                          ▼            ▼            ▼\n                      Low Risk    Medium Risk   High Risk\n                          │            │            │\n                          ▼            ▼            ▼\n                     Auto-allow   Configurable   Must approve\n                     + audit log  (approve\u002F      + audit log\n                                   auto)\n                                       │\n                                       ▼\n                                ┌─────────────┐\n                                │  Approval   │──▶ Admin reviews in Approval Center\n                                │  Queue      │    (capability type, action, risk level,\n                                │  (PG-backed)│     requesting user context)\n                                └─────────────┘\n                                       │\n                             ┌─────────┴─────────┐\n                             ▼                   ▼\n                        Approved              Rejected\n                        Change applied        Change blocked\n                        + audit log           + audit log\n```\n\nPolicies are configurable per capability type, per risk level, and per environment — stored in `nexora_capability_policies`.\n\n### Audit System\n\nEvery significant action produces an immutable audit record in PostgreSQL:\n\n```\n┌──────────────────────────────────────────────────────────┐\n│                    Audit Event Record                     │\n├──────────┬───────────────────────────────────────────────┤\n│ actor    │ The authenticated user who triggered action   │\n│ action   │ e.g. chat.message.send, auth.login, tool.exec│\n│ resource │ Type + ID of affected resource                │\n│ status   │ success \u002F failure                             │\n│ ip       │ Client IP address                             │\n│ ua       │ User-Agent string                             │\n│ detail   │ JSON payload (params, result summary, etc.)   │\n│ timestamp│ Server-side UTC timestamp                     │\n└──────────┴───────────────────────────────────────────────┘\n```\n\nAudit coverage:\n\n| Category | Events |\n|----------|--------|\n| **Auth** | Login success\u002Ffailure, registration, logout |\n| **Users** | Create, delete, role change, password reset |\n| **Agents** | Grant\u002Frevoke authorization, config changes |\n| **Chat** | Message send, reconnect, stop, file upload |\n| **Tools** | Execution attempts (success + blocked) |\n| **Approvals** | Request created, approved, rejected, timeout |\n| **Config** | Model changes, environment variable updates |\n\nAudit writes are fire-and-forget — a failed audit write never blocks the main operation.\n\n### Token Usage Tracking\n\nToken consumption is attributed to the **authenticated JWT user** (not the chat payload sender), using Python's `ContextVar` to propagate identity through the async call chain:\n\n```\nJWT Middleware                    Console Router                   Model Wrapper\n─────────────                    ──────────────                   ─────────────\nrequest.state.user = \"alice\"  →  set_current_actor(\"alice\")   →  get_current_actor()\n                                                                       │\n                                                                       ▼\n                                                              INSERT INTO nexora_token_usage\n                                                              (actor=\"alice\", model, tokens)\n                                                              via background daemon thread\n```\n\nRecords are aggregated by user, agent, model, and date — visualized in the Token Usage dashboard with trend charts and per-user breakdown tables.\n\n### Extension Isolation\n\nNexora follows a strict \"upstream core + extension layer\" architecture to minimize merge conflicts when syncing with QwenPaw:\n\n```\n┌────────────────────────────────────────────────────────────────┐\n│  QwenPaw Core (upstream)                    Modification: ≤5% │\n│  ├── app\u002Fauth.py ·············· JWT middleware hook            │\n│  ├── app\u002Frouters\u002Fconsole.py ··· audit + ContextVar injection  │\n│  ├── app\u002Frouters\u002F__init__.py ·· register nexora router        │\n│  └── token_usage\u002Fmodel_wrapper · PG write hook                │\n├────────────────────────────────────────────────────────────────┤\n│  Nexora Extension Layer (isolated)         Modification: 100% │\n│  ├── qwenpaw_ext\u002Fnexora\u002F ····· All backend business logic     │\n│  │   ├── rbac.py, audit.py, agent_grants.py, ...              │\n│  │   └── repositories\u002F ······ PostgreSQL data access          │\n│  ├── console\u002Fsrc\u002Fnexora\u002F ····· All frontend pages & API       │\n│  └── alembic\u002Fversions\u002F ······ Database migrations             │\n└────────────────────────────────────────────────────────────────┘\n```\n\nOnly 4 upstream files are modified — the rest of Nexora lives entirely in extension directories. This keeps `git merge upstream\u002Fmain` clean in >95% of cases.\n\n### Security Defense in Depth\n\nMultiple independent safety layers protect the system — no single bypass compromises security:\n\n```\n       Inbound Request\n            │\n    ┌───────▼───────┐\n    │ JWT Auth      │  Identity verification\n    │ (middleware)  │  Reject: 401 Unauthorized\n    └───────┬───────┘\n    ┌───────▼───────┐\n    │ RBAC Guard    │  Role-based route protection\n    │ (per-route)   │  Reject: 403 Forbidden\n    └───────┬───────┘\n    ┌───────▼───────┐\n    │ Agent Grants  │  Per-user agent access control\n    │ (DB lookup)   │  Reject: 403 Forbidden\n    └───────┬───────┘\n    ┌───────▼───────┐\n    │ Tool Guard    │  Block rm -rf, fork bombs, reverse shells\n    │ (pattern)     │  Reject: blocked + audit log\n    └───────┬───────┘\n    ┌───────▼───────┐\n    │ File Guard    │  Restrict ~\u002F.ssh, \u002Fetc\u002Fpasswd, key files\n    │ (path check)  │  Reject: blocked + audit log\n    └───────┬───────┘\n    ┌───────▼───────┐\n    │ Capability    │  Approval gate for installing\u002Fremoving\n    │ Approval      │  tools, skills, MCP, plugins\n    └───────┬───────┘\n    ┌───────▼───────┐\n    │ Skill Scanner │  Pre-install scan for injection, exfil,\n    │ (static)      │  hardcoded keys, suspicious patterns\n    └───────┬───────┘\n            ▼\n      Execute + Audit\n\n### PostgreSQL Schema\n\nAll enterprise data is persisted in PostgreSQL with versioned migrations (Alembic):\n\n| Table | Purpose |\n|-------|---------|\n| `nexora_users` | User accounts, password hashes, roles |\n| `nexora_agent_grants` | User ↔ Agent authorization mapping |\n| `nexora_audit_events` | Full audit trail (indexed by date, actor) |\n| `nexora_approval_requests` | Capability change approval queue and results |\n| `nexora_capability_policies` | Risk-based capability change approval policies |\n| `nexora_governance` | Agent ↔ Tool\u002FMCP\u002FSkill resource policies |\n| `nexora_token_usage` | LLM token consumption records |\n| `nexora_runtime_config` | Runtime configuration key-value store |\n\n### Streaming Chat & Task Management\n\nChat sessions use server-sent events (SSE) with background task tracking — clients can disconnect and reconnect without losing the agent's response:\n\n```\nClient POST \u002Fconsole\u002Fchat\n        │\n        ▼\n  TaskTracker.attach_or_start()\n        │\n        ├──▶ New chat: spawn background task → agent.stream_one()\n        │                                           │\n        │                                     SSE events ──▶ Queue\n        │                                           │\n        └──▶ Reconnect: attach to existing queue ◀──┘\n                    │\n                    ▼\n            StreamingResponse (SSE)\n            \"data: {token}...\"\n            \"data: {token}...\"\n            \"data: [DONE]\"\n```\n\n- Agent runs in background — client abort doesn't kill the computation\n- `POST \u002Fconsole\u002Fchat\u002Fstop` sends a cancellation signal\n- Multiple subscribers can attach to the same running stream\n- Chat title is auto-generated via LLM in a detached background task\n\n---\n\n## Quick Start\n\n### Prerequisites\n\n- Python 3.10 ~ 3.13\n- Node.js 18+\n- PostgreSQL 16 (or use the bundled Docker Compose)\n\n### 1. Clone and install\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fyour-org\u002Fnexora-ai-platform.git\ncd nexora-ai-platform\npip install -e .\ncd console && npm install && npm run build && cd ..\n```\n\n### 2. Start PostgreSQL\n\n```bash\ndocker compose up -d postgres\n```\n\n### 3. Configure environment\n\n```bash\n# Database connection\nexport NEXORA_DB_URL=\"postgresql+psycopg2:\u002F\u002Fnexora:changeme@127.0.0.1:5432\u002Fnexora\"\n\n# LLM API key (example for DashScope\u002FQwen)\nexport DASHSCOPE_API_KEY=\"your-api-key\"\n```\n\n### 4. Run\n\n```bash\nbash start-qwenpaw-zh.sh\n```\n\nOpen http:\u002F\u002F127.0.0.1:8088 in your browser. Go to **Settings > Models** to configure your LLM provider and start chatting.\n\n### Docker (one-command deploy)\n\n```bash\ndocker compose up -d\n```\n\nSee [Docker Deployment Guide](docs\u002Fdocker-deployment-guide.md) for details.\n\n---\n\n## LLM Configuration\n\nNexora supports both cloud and local LLM providers:\n\n### Cloud Providers\n\nConfigure via **Settings > Models** in the web UI, or set environment variables:\n\n| Provider | Env Variable | Notes |\n|----------|-------------|-------|\n| DashScope (Qwen) | `DASHSCOPE_API_KEY` | Recommended for Chinese users |\n| OpenAI | `OPENAI_API_KEY` | GPT-4o, GPT-4, etc. |\n| Google Gemini | `GOOGLE_API_KEY` | Gemini Pro, etc. |\n| Anthropic | `ANTHROPIC_API_KEY` | Claude series |\n| DeepSeek | `DEEPSEEK_API_KEY` | DeepSeek series |\n| MiniMax | via Settings UI | MiniMax models |\n\n### Local Models (no API key needed)\n\n| Backend | Best for | Setup |\n|---------|----------|-------|\n| **llama.cpp** | Cross-platform | Click \"Download\" in the web UI |\n| **Ollama** | Easy model management | Install Ollama app, then configure in Settings |\n| **LM Studio** | GUI-based | Install LM Studio, start server, configure in Settings |\n\n---\n\n## Multi-Channel Messaging\n\nConnect your agents to the platforms your team already uses:\n\n| Channel | Status | Auth Method |\n|---------|--------|-------------|\n| Console (Web UI) | Built-in | JWT |\n| DingTalk | Supported | Bot Token |\n| Feishu (Lark) | Supported | App Credentials |\n| WeChat (Enterprise) | Supported | Webhook |\n| Discord | Supported | Bot Token |\n| Telegram | Supported | Bot Token |\n| Slack | Supported | OAuth |\n| QQ | Supported | Bot API |\n| Email | Supported | IMAP\u002FSMTP |\n\nSee [Channel Documentation](https:\u002F\u002Fqwenpaw.agentscope.io\u002Fdocs\u002Fchannels) for setup guides.\n\n---\n\n## Project Structure\n\n```\nsrc\u002F\n├── qwenpaw\u002F                     # QwenPaw core engine\n│   ├── app\u002F                     # FastAPI app, routers, middleware, auth\n│   ├── agents\u002F                  # Agent runtime, memory, proactive behavior\n│   ├── providers\u002F               # LLM provider adapters (OpenAI, DashScope, etc.)\n│   ├── token_usage\u002F             # Token consumption tracking (model wrapper)\n│   ├── security\u002F                # Tool guard, file guard, skill scanner\n│   ├── plugins\u002F                 # Plugin system runtime\n│   ├── config\u002F                  # Configuration management\n│   └── cli\u002F                     # Command-line interface\n└── qwenpaw_ext\u002F\n    └── nexora\u002F                  # Nexora enterprise extension layer\n        ├── rbac.py              # Role-based access control\n        ├── audit.py             # Audit event logging\n        ├── agent_grants.py      # Per-user agent authorization\n        ├── capability_approval.py # Capability change approval workflow\n        ├── governance.py        # Resource governance policies\n        ├── authorization.py     # Authorization engine\n        ├── db.py                # PostgreSQL schema & connection\n        └── repositories\u002F       # Data access layer\n\nconsole\u002Fsrc\u002F\n├── nexora\u002F                      # Nexora frontend extensions\n│   ├── pages\u002F                   # Admin pages (users, grants, audit, governance)\n│   └── api\u002F                     # Nexora API clients\n├── pages\u002F                       # Core pages (Chat, Settings, Login, Agent, Inbox)\n│   └── Settings\u002FTokenUsage\u002F     # Token consumption dashboard\n├── components\u002F                  # Shared UI components\n└── layouts\u002F                     # App layout (sidebar, header)\n\ntests\u002F\n├── unit\u002F                        # Unit tests (including nexora modules)\n├── integration\u002F                 # Integration tests\n├── contract\u002F                    # Contract tests (API, security)\n├── e2e\u002F                         # End-to-end tests\n└── load\u002F                        # Load testing (Locust)\n\ndocs\u002F                            # Documentation\nplugins\u002F                         # Plugin bundles and tools\ndeploy\u002F                          # Docker deployment configs\n```\n\n---\n\n## Security\n\nNexora combines QwenPaw's built-in security with enterprise governance:\n\n| Layer | Mechanism | Description |\n|-------|-----------|-------------|\n| **Authentication** | JWT + Password | Login required, token-based session management |\n| **Authorization** | RBAC | Admin \u002F Operator roles with route-level guards |\n| **Agent Access** | Agent Grants | Users can only access explicitly authorized agents |\n| **Tool Safety** | Tool Guard | Blocks dangerous commands (rm -rf, fork bombs, etc.) |\n| **File Safety** | File Access Guard | Restricts access to sensitive system paths |\n| **Skill Safety** | Security Scanner | Scans for injection, hardcoded keys, data exfiltration |\n| **Capability Control** | Approval Workflow | Installing\u002Fremoving capabilities requires admin approval |\n| **Audit** | Full Logging | Every action logged to PostgreSQL with actor, timestamp, detail |\n| **Data** | Local Deployment | All data stays on your infrastructure |\n\n---\n\n## Syncing Upstream\n\nNexora maintains two Git remotes to stay current with QwenPaw improvements:\n\n```bash\n# Add upstream (first time only)\ngit remote add upstream https:\u002F\u002Fgithub.com\u002Fagentscope-ai\u002FQwenPaw.git\n\n# Sync upstream updates\ngit fetch upstream\ngit checkout -b sync\u002Fupstream-YYYYMMDD\ngit merge upstream\u002Fmain\n# Resolve conflicts, test, merge to main\n```\n\nPost-merge checklist:\n- Login \u002F logout works\n- Chat functions normally\n- Agent and user management pages load\n- Frontend builds successfully\n- Backend starts without errors\n\n---\n\n## Documentation\n\n| Topic | Link |\n|-------|------|\n| Technical Solution | [docs\u002Ftechnical-solution.md](docs\u002Ftechnical-solution.md) |\n| Docker Deployment | [docs\u002Fdocker-deployment-guide.md](docs\u002Fdocker-deployment-guide.md) |\n| Engineering Governance | [docs\u002Fcompany-grade-engineering-governance.md](docs\u002Fcompany-grade-engineering-governance.md) |\n| QwenPaw Core Docs | [qwenpaw.agentscope.io](https:\u002F\u002Fqwenpaw.agentscope.io\u002F) |\n| Models Configuration | [QwenPaw Models Guide](https:\u002F\u002Fqwenpaw.agentscope.io\u002Fdocs\u002Fmodels) |\n| Channel Setup | [QwenPaw Channels Guide](https:\u002F\u002Fqwenpaw.agentscope.io\u002Fdocs\u002Fchannels) |\n| Skills & Plugins | [QwenPaw Skills Guide](https:\u002F\u002Fqwenpaw.agentscope.io\u002Fdocs\u002Fskills) |\n| Security | [QwenPaw Security Guide](https:\u002F\u002Fqwenpaw.agentscope.io\u002Fdocs\u002Fsecurity) |\n\n---\n\n## License\n\nThis project is licensed under [Apache 2.0](LICENSE), same as the upstream QwenPaw project.\n\n## Acknowledgements\n\nBuilt on [QwenPaw](https:\u002F\u002Fgithub.com\u002Fagentscope-ai\u002FQwenPaw) by [AgentScope AI](https:\u002F\u002Fgithub.com\u002Fagentscope-ai).\n\n---\n\n\u003Cdiv align=\"center\">\n\n# Nexora AI Platform\n\n**企业级 AI 工作台**\n\n\u003C\u002Fdiv>\n\n---\n\n## 什么是 Nexora？\n\n**Nexora** = **Nex**us + **ora**（边界、前沿）\n\n- **Nexus** — 连接的枢纽。Nexora 是 AI 智能体、企业工具、团队成员和消息渠道汇聚的统一工作台。\n- **Ora** — 源自拉丁语 *ora*（边界、前沿），代表 AI 驱动企业运营的最前沿。\n\n两者合一，体现平台的使命：**企业 AI 前沿的中枢平台** — 在可控的治理框架下，将智能体与业务中的人和工具连接在一起。\n\n---\n\n## 概述\n\nNexora AI Platform 是基于 [QwenPaw](https:\u002F\u002Fgithub.com\u002Fagentscope-ai\u002FQwenPaw) 构建的企业级 AI 工作台。完整继承了 QwenPaw 的所有核心能力 — 多智能体协作、多渠道消息接入、技能扩展、本地模型支持、记忆进化 — 并在此基础上增加了企业必需的多租户权限控制、安全治理、审计日志和 Token 消耗分析。\n\n> **你可以用 Nexora 做什么：**\n>\n> - **团队 AI 工作台** — 多用户共享平台，每个人拥有独立的智能体和权限\n> - **资讯与效率** — 每日热帖摘要、邮件要点、新闻简报，推送到钉钉\u002F飞书\u002F企业微信\n> - **创意与构建** — 描述目标，让智能体自动执行，醒来即可看到原型\n> - **研究与学习** — 追踪科技和 AI 动态，个人知识库搜索复用\n> - **文件与桌面** — 整理搜索本地文件，阅读并总结文档\n> - **运维与治理** — 审计每一次 AI 操作，控制谁能使用哪些工具，按用户追踪 Token 消耗\n\n---\n\n## 功能特性\n\n### AI 智能体能力（继承自 QwenPaw）\n\n| 功能 | 说明 |\n|------|------|\n| **多智能体协作** | 创建多个独立智能体，各有角色分工，支持跨智能体通信协作 |\n| **技能扩展** | 内置定时任务、PDF\u002FOffice 处理、新闻摘要、网页搜索等；自定义技能自动加载 |\n| **记忆进化与主动服务** | 智能体从交互中学习，反思经验，主动服务 — 越用越聪明 |\n| **多渠道消息接入** | 钉钉、飞书、微信、Discord、Telegram、Slack、QQ 等 — 一个平台，按需接入 |\n| **本地模型支持** | 通过 llama.cpp、Ollama、LM Studio 在本机运行 LLM，无需 API 密钥 |\n| **云端模型支持** | 通义千问、OpenAI、Gemini、Claude、MiniMax、DeepSeek 等主流供应商 |\n| **Coding 模式** | 内置 Web IDE，含文件树、标签编辑器、行内 diff 审查和 Git 面板 |\n| **插件生态** | 自定义工具、技能和 MCP 服务器扩展；官方插件市场 |\n| **定时任务 (Cron)** | 自动化重复任务 — 每日简报、定期数据检查、定时报告 |\n| **安全防护** | 工具守卫（拦截危险命令）、文件访问控制、技能安全扫描 |\n\n### 企业扩展能力（Nexora）\n\n| 功能 | 说明 |\n|------|------|\n| **多租户 RBAC** | 管理员 \u002F 操作员双角色模型，平台级访问控制和用户管理 |\n| **智能体授权** | 按用户精细分配智能体访问权限，控制谁可以使用哪个智能体 |\n| **能力审批** | 安装\u002F卸载工具、技能、MCP 服务器、插件时的风险审批流程，可配置策略 |\n| **审计日志** | PostgreSQL 存储的全链路审计 — 认证、对话、工具调用、配置变更、管理操作 |\n| **Token 消耗分析** | 按用户、智能体、模型、日期维度追踪 LLM Token 消耗，可视化仪表盘 |\n| **安全治理** | 资源策略、工具扫描器、集中化密钥管理 |\n| **PostgreSQL 后端** | 全部企业数据（用户、授权、审计、配置、Token）存储在 PostgreSQL |\n\n---\n\n## 技术设计\n\n> 完整文档见 [技术方案](docs\u002Ftechnical-solution.md)\n\n### 三层权限模型\n\nNexora 通过三层级联访问控制保护平台资源 — 每个请求必须逐层通过所有检查：\n\n```\n第一层 — 平台访问                第二层 — 智能体授权              第三层 — 能力审批\n┌──────────────────┐            ┌──────────────────┐            ┌──────────────────┐\n│ 用户 JWT 认证    │            │ 检查 agent_grants│            │ 安装\u002F卸载工具、  │\n│                  │──通过──▶   │ 是否授权该智能体 │            │ 技能、MCP、插件时│\n│ RBAC 角色校验    │            │                  │            │ 低风险 → 直接放行│\n│ 路由级权限守卫   │            │ 仅展示已授权智能体│            │ 高风险 → 进入审批│\n└──────────────────┘            └──────────────────┘            └──────────────────┘\n       │ 拒绝                          │ 拒绝                          │ 待审批\n       ▼                               ▼                               ▼\n   401 \u002F 403                      403 禁止访问                    审批请求 → 管理员审批\n   + 审计日志                     + 审计日志                      → 通过或拒绝 + 审计日志\n```\n\n### 多智能体运行时\n\n单节点管理 100+ 智能体，按需懒加载，自动生命周期管理：\n\n```\n                         ┌─────────────────────────────────┐\n                         │      MultiAgentManager          │\n                         │                                 │\n  用户请求 ─────▶        │  ┌─ 活跃智能体池 ────────────┐  │\n  (agent_id)             │  │  agent_a [最近使用: 10s]  │  │    最大活跃: 20\n                         │  │  agent_b [最近使用: 45s]  │  │    空闲回收: 1小时\n                         │  │  agent_c [最近使用: 300s] │  │    淘汰策略: LRU\n                         │  └────────────────────────────┘ │\n                         │         ▲           │           │\n                         │     懒加载      空闲回收        │\n                         │         │           ▼           │\n                         │  ┌─ 智能体配置 (磁盘) ────────┐ │\n                         │  │  100+ 智能体 YAML 配置     │ │\n                         │  └────────────────────────────┘ │\n                         └─────────────────────────────────┘\n```\n\n- 智能体首次请求时才加载，启动保持快速\n- 空闲超过 TTL 自动回收（默认 1 小时）\n- 池满时按最近最少使用（LRU）策略淘汰\n- 每个智能体独立维护记忆、工具和渠道绑定\n\n### 能力审批流程\n\n用户安装或卸载能力（工具、技能、MCP 服务器、插件）时，通过可配置的审批闸口管控变更：\n\n```\n用户新增\u002F删除能力 ──▶ 策略引擎检查风险等级\n(skill.create, mcp.delete,       │\n plugin.install, tool.create…)   │\n                      ┌──────────┼──────────┐\n                      ▼          ▼          ▼\n                  低风险       中风险      高风险\n                      │          │          │\n                      ▼          ▼          ▼\n                 自动放行     可配置       必须审批\n                 + 审计      (审批\u002F自动)   + 审计\n                                 │\n                                 ▼\n                          ┌─────────────┐\n                          │  审批队列    │──▶ 管理员在审批中心审核\n                          │ (PG 存储)   │   (能力类型、操作、风险等级、\n                          └─────────────┘    请求用户上下文)\n                                 │\n                       ┌─────────┴─────────┐\n                       ▼                   ▼\n                    通过                 拒绝\n                  变更生效             变更阻止\n                  + 审计日志           + 审计日志\n```\n\n### 审计系统\n\n每个重要操作产生一条不可变的审计记录：\n\n| 分类 | 审计事件 |\n|------|---------|\n| **认证** | 登录成功\u002F失败、注册、退出 |\n| **用户** | 创建、删除、角色变更、密码重置 |\n| **智能体** | 授权\u002F撤销、配置变更 |\n| **对话** | 消息发送、重连、停止、文件上传 |\n| **工具** | 执行尝试（成功 + 被拦截） |\n| **审批** | 请求创建、审批通过、拒绝、超时 |\n| **配置** | 模型变更、环境变量更新 |\n\n审计写入采用 fire-and-forget 模式 — 审计写入失败不会阻断主流程。\n\n### Token 消耗追踪\n\nToken 消耗归属到 **JWT 认证用户**（而非聊天负载中的 sender_id），通过 Python `ContextVar` 在异步调用链中传递身份：\n\n```\nJWT 中间件                      Console 路由                     模型包装器\n──────────                      ──────────                       ──────────\nrequest.state.user = \"alice\" → set_current_actor(\"alice\")  →  get_current_actor()\n                                                                      │\n                                                                      ▼\n                                                             INSERT INTO nexora_token_usage\n                                                             (actor=\"alice\", model, tokens)\n                                                             后台守护线程写入，不阻塞请求\n```\n\n按用户、智能体、模型、日期四维聚合，在 Token 消耗仪表盘中可视化展示趋势图和用户明细表。\n\n### 扩展隔离架构\n\n严格的\"上游核心 + 扩展层\"架构，最小化上游合并冲突：\n\n```\n┌────────────────────────────────────────────────────────────────┐\n│  QwenPaw 核心 (上游)                        修改比例: ≤5%     │\n│  ├── app\u002Fauth.py ·············· JWT 中间件挂载点              │\n│  ├── app\u002Frouters\u002Fconsole.py ··· 审计 + ContextVar 注入        │\n│  ├── app\u002Frouters\u002F__init__.py ·· 注册 nexora 路由              │\n│  └── token_usage\u002Fmodel_wrapper · PG 写入挂载点                │\n├────────────────────────────────────────────────────────────────┤\n│  Nexora 扩展层 (隔离)                       修改比例: 100%    │\n│  ├── qwenpaw_ext\u002Fnexora\u002F ····· 全部后端业务逻辑               │\n│  │   ├── rbac.py, audit.py, agent_grants.py, ...              │\n│  │   └── repositories\u002F ······ PostgreSQL 数据访问层           │\n│  ├── console\u002Fsrc\u002Fnexora\u002F ····· 全部前端页面和 API             │\n│  └── alembic\u002Fversions\u002F ······ 数据库迁移脚本                  │\n└────────────────────────────────────────────────────────────────┘\n```\n\n仅修改 4 个上游文件，其余 Nexora 代码完全在扩展目录中。`git merge upstream\u002Fmain` 在 95% 以上的情况下无冲突。\n\n### 安全纵深防御\n\n多层独立安全机制 — 任何单一绕过都不会导致系统失守：\n\n```\n       请求进入\n           │\n   ┌───────▼───────┐\n   │ JWT 认证      │  身份验证 → 401\n   └───────┬───────┘\n   ┌───────▼───────┐\n   │ RBAC 守卫     │  角色权限 → 403\n   └───────┬───────┘\n   ┌───────▼───────┐\n   │ 智能体授权    │  用户-智能体映射 → 403\n   └───────┬───────┘\n   ┌───────▼───────┐\n   │ 工具守卫      │  拦截危险命令 → blocked\n   └───────┬───────┘\n   ┌───────▼───────┐\n   │ 文件守卫      │  限制敏感路径 → blocked\n   └───────┬───────┘\n   ┌───────▼───────┐\n   │ 能力审批      │  安装\u002F卸载能力 → 审批管控\n   └───────┬───────┘\n   ┌───────▼───────┐\n   │ 技能扫描器    │  安装前检测注入\u002F泄露 → blocked\n   └───────┬───────┘\n           ▼\n     执行 + 审计记录\n```\n\n### 流式对话与任务管理\n\n对话使用 SSE（Server-Sent Events）推送，后台任务跟踪 — 客户端断线重连不丢失响应：\n\n```\n客户端 POST \u002Fconsole\u002Fchat\n        │\n        ▼\n  TaskTracker.attach_or_start()\n        │\n        ├──▶ 新对话: 启动后台任务 → agent.stream_one()\n        │                               │\n        │                         SSE 事件 ──▶ 队列\n        │                               │\n        └──▶ 重连: 接入已有队列 ◀────────┘\n                    │\n                    ▼\n            StreamingResponse (SSE)\n            \"data: {token}...\"\n            \"data: [DONE]\"\n```\n\n- 智能体在后台运行 — 客户端断开不会终止计算\n- `POST \u002Fconsole\u002Fchat\u002Fstop` 发送取消信号\n- 多个订阅者可以接入同一运行中的流\n- 对话标题通过 LLM 在后台自动生成\n\n### PostgreSQL 数据表\n\n全部企业数据通过 Alembic 版本化迁移持久化在 PostgreSQL：\n\n| 表名 | 用途 |\n|------|------|\n| `nexora_users` | 用户账号、密码哈希、角色 |\n| `nexora_agent_grants` | 用户 ↔ 智能体授权映射 |\n| `nexora_audit_events` | 全链路审计日志（按日期、用户索引） |\n| `nexora_approval_requests` | 能力审批队列与结果 |\n| `nexora_capability_policies` | 基于风险的审批策略配置 |\n| `nexora_governance` | 智能体 ↔ 工具\u002FMCP\u002FSkill 资源策略 |\n| `nexora_token_usage` | LLM Token 消耗记录 |\n| `nexora_runtime_config` | 运行时配置键值存储 |\n\n---\n\n## 快速开始\n\n### 环境要求\n\n- Python 3.10 ~ 3.13\n- Node.js 18+\n- PostgreSQL 16（或使用项目自带的 Docker Compose）\n\n### 安装并运行\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fyour-org\u002Fnexora-ai-platform.git\ncd nexora-ai-platform\npip install -e .\ncd console && npm install && npm run build && cd ..\ndocker compose up -d postgres\nexport NEXORA_DB_URL=\"postgresql+psycopg2:\u002F\u002Fnexora:changeme@127.0.0.1:5432\u002Fnexora\"\nbash start-qwenpaw-zh.sh\n```\n\n浏览器打开 http:\u002F\u002F127.0.0.1:8088，进入 **设置 > 模型** 配置你的 LLM 供应商，即可开始对话。\n\n### Docker 一键部署\n\n```bash\ndocker compose up -d\n```\n\n详见 [Docker 部署指南](docs\u002Fdocker-deployment-guide.md)。\n\n---\n\n## 模型配置\n\n### 云端模型\n\n通过 Web 界面 **设置 > 模型** 配置，或设置环境变量：\n\n| 供应商 | 环境变量 | 说明 |\n|--------|---------|------|\n| 通义千问 (DashScope) | `DASHSCOPE_API_KEY` | 推荐国内用户使用 |\n| OpenAI | `OPENAI_API_KEY` | GPT-4o、GPT-4 等 |\n| DeepSeek | `DEEPSEEK_API_KEY` | DeepSeek 系列 |\n| Google Gemini | `GOOGLE_API_KEY` | Gemini Pro 等 |\n| Anthropic | `ANTHROPIC_API_KEY` | Claude 系列 |\n\n### 本地模型（无需 API 密钥）\n\n| 方式 | 适用场景 | 配置 |\n|------|---------|------|\n| **llama.cpp** | 跨平台 | 在 Web 界面点击\"下载\" |\n| **Ollama** | 模型管理便捷 | 安装 Ollama 应用后在设置中配置 |\n| **LM Studio** | 图形界面 | 安装 LM Studio 后启动服务器并配置 |\n\n---\n\n## 多渠道接入\n\n将智能体连接到团队已在使用的平台：\n\n| 渠道 | 状态 | 认证方式 |\n|------|------|---------|\n| 控制台 (Web UI) | 内置 | JWT |\n| 钉钉 | 支持 | Bot Token |\n| 飞书 | 支持 | App 凭证 |\n| 企业微信 | 支持 | Webhook |\n| Discord | 支持 | Bot Token |\n| Telegram | 支持 | Bot Token |\n| Slack | 支持 | OAuth |\n| QQ | 支持 | Bot API |\n| 邮箱 | 支持 | IMAP\u002FSMTP |\n\n详见 [渠道配置文档](https:\u002F\u002Fqwenpaw.agentscope.io\u002Fdocs\u002Fchannels)。\n\n---\n\n## 安全体系\n\n| 层级 | 机制 | 说明 |\n|------|------|------|\n| **认证** | JWT + 密码 | 登录认证，基于 Token 的会话管理 |\n| **授权** | RBAC | 管理员\u002F操作员角色，路由级权限守卫 |\n| **智能体访问** | 智能体授权 | 用户只能访问被明确授权的智能体 |\n| **工具安全** | 工具守卫 | 拦截危险命令（rm -rf、fork 炸弹等） |\n| **文件安全** | 文件访问控制 | 限制访问敏感系统路径 |\n| **技能安全** | 安全扫描器 | 安装前检测注入、硬编码密钥、数据泄露 |\n| **能力管控** | 审批流程 | 安装\u002F卸载能力需管理员审批 |\n| **审计** | 全链路日志 | 每个操作记录到 PostgreSQL，含操作者、时间、详情 |\n| **数据** | 本地部署 | 所有数据存储在你自己的基础设施上 |\n\n---\n\n## 文档\n\n| 主题 | 链接 |\n|------|------|\n| 技术方案 | [docs\u002Ftechnical-solution.md](docs\u002Ftechnical-solution.md) |\n| Docker 部署 | [docs\u002Fdocker-deployment-guide.md](docs\u002Fdocker-deployment-guide.md) |\n| 工程治理规范 | [docs\u002Fcompany-grade-engineering-governance.md](docs\u002Fcompany-grade-engineering-governance.md) |\n| QwenPaw 核心文档 | [qwenpaw.agentscope.io](https:\u002F\u002Fqwenpaw.agentscope.io\u002F) |\n| 模型配置 | [QwenPaw 模型指南](https:\u002F\u002Fqwenpaw.agentscope.io\u002Fdocs\u002Fmodels) |\n| 渠道接入 | [QwenPaw 渠道指南](https:\u002F\u002Fqwenpaw.agentscope.io\u002Fdocs\u002Fchannels) |\n| 技能与插件 | [QwenPaw 技能指南](https:\u002F\u002Fqwenpaw.agentscope.io\u002Fdocs\u002Fskills) |\n\n---\n\n## 许可证\n\n本项目采用 [Apache 2.0](LICENSE) 协议，与上游 QwenPaw 项目一致。\n\n基于 [AgentScope AI](https:\u002F\u002Fgithub.com\u002Fagentscope-ai) 团队的 [QwenPaw](https:\u002F\u002Fgithub.com\u002Fagentscope-ai\u002FQwenPaw) 构建。\n","Nexora AI Platform 是一个基于 QwenPaw 构建的企业级AI工作空间。它集成了多智能体协同、多渠道消息传递、技能扩展、本地模型支持以及记忆进化等核心功能，并针对企业需求增加了多租户访问控制、安全治理、审计日志和令牌使用分析等功能。适用于需要在一个统一平台上管理多个用户及其智能代理的企业场景，包括团队协作、社交媒体与生产力工具集成、创意开发、研究学习、文件管理和操作治理等多种用途。通过Nexora，企业能够更高效地利用AI技术促进业务发展，同时确保数据安全与合规性。","2026-06-11 04:09:25","CREATED_QUERY"]