Danush-Aries/jarvis

GitHub: Danush-Aries/jarvis

一个多供应商、零 API Key 的便携式自主 AI 助手,通过智能路由与多 Agent 架构实现语音交互、代码编写、桌面与浏览器自动化等端到端任务执行。

Stars: 0 | Forks: 0

# Jarvis — 零 API Key 自主 AI 助手

Jarvis wake-word demo

build license python claude ollama

## 为什么会有这个项目 我尝试过的每一个“AI 助手”项目,要么在一个周末内就耗尽了我的 API 预算,要么把我死死锁定在某个供应商上。Jarvis 会将每个任务路由到当前实际可用的 LLM 上——首先使用你的 `claude` CLI(Claude Max/Pro OAuth,无需 API key),如果存在相应的 key 则依次回退到 Anthropic/OpenAI/Groq/Gemini/DeepSeek,并始终以本地 Ollama 作为最终兜底。它还具备实操能力:OpenClaw 可以控制桌面,Hermes 将桌面、浏览器和 shell 串联起来以完成实际任务,而语音循环可通过“hey jarvis”唤醒,延迟在亚秒级。 ## 60 秒快速体验 ``` cd ~/jarvis ./bootstrap.sh # or: ./bootstrap.sh all (voice + web + daemon) source .venv/bin/activate jarvis doctor # what's live on this box jarvis chat # terminal chat jarvis ask --agent hermes "open my email and summarise the top 3" jarvis voice # "hey jarvis, ..." ``` 没有 `ANTHROPIC_API_KEY`?如果你登录了 `claude`(Max/Pro),它就能直接运行——每个任务层级都默认使用 `claude-code/sonnet`。也没有订阅?运行 `ollama pull llama3.1`,它就会在本地进行回退。 ## 运行机制 - **路由器 (`providers/router.py`)** 自上而下遍历任务层级,跳过不可达的后端,最终总会到达 Ollama。`claude-code/*` 会通过 shell 调用 `claude` CLI,并传入 `--strict-mcp-config --setting-sources user`(将约 2 分钟的冷启动缩短至约 4 秒)。 - **六大 agent** (`chat`、`coding`、`hacking`、`automation`、`openclaw`、`hermes`),首先通过关键词进行快速路径匹配,然后再由一个低成本的分类器模型进行选择。也可以使用 `--agent ` 强制指定。 - **OpenClaw 桌面控制** — Wayland (`wtype`/`grim`/`wl-copy`)、X11 (`xdotool`/`scrot`/`xclip`)、macOS 内置工具;每个技能都会进行自检测,并在缺少后端时给出明确报告,而不是静默失败。 - **唤醒词语音循环** — 基于能量的 VAD(根据你是否停止说话来录音,而非依赖计时器)、`faster-whisper` STT、edge-tts → piper → espeak 的 TTS 回退链。 - **自主权限门控** — `config.yaml` 中的 `approval_required_for` 会在自主模式下强制拦截破坏性的 shell 操作 (`shell.destructive`) 和对外发送请求 (`net.send`)。 ## 截图 | 终端聊天 | 语音循环 | Web 仪表盘 | `jarvis doctor` | |---|---|---|---| | ![](https://raw.githubusercontent.com/Danush-Aries/jarvis/main/assets/screenshot-1.png) | ![](https://raw.githubusercontent.com/Danush-Aries/jarvis/main/assets/screenshot-2.png) | ![](https://raw.githubusercontent.com/Danush-Aries/jarvis/main/assets/screenshot-3.png) | ![](https://raw.githubusercontent.com/Danush-Aries/jarvis/main/assets/screenshot-4.png) | ## 接口 ``` jarvis chat # interactive terminal (default) jarvis ask "fix the bug in app.py and run the tests" jarvis ask --agent hacking "recon example.com" jarvis ask --agent hermes "open my email in the browser and summarise the top 3" jarvis web # local dashboard at http://127.0.0.1:8787 (needs [web]) jarvis daemon # scheduled/autonomous background jobs (needs [daemon]) jarvis voice # "hey jarvis" voice loop (needs [voice] + mic) jarvis skills # list every registered skill (incl. MCP tools) jarvis doctor # capability report ``` ## Agent | Agent | 功能说明 | |-------|--------------| | `chat` | 简洁的通用助手。 | | `coding` | 工程模式 — 读取、编辑、运行、验证代码。 | | `hacking` | 授权的安全攻防模式 (PTES),连接到 MCP 安全工具。 | | `automation` | 在已连接的工具(邮件、日历、笔记、shell)中执行自动化任务。 | | `openclaw` | 桌面操作员 — 操控应用、浏览器、键盘、屏幕和剪贴板。 | | `hermes` | 自主操作员 — 端到端串联桌面、浏览器、shell、代码以及 `claude.code` 代理任务。 | ## Provider 与 Claude Max 的背景说明 - **`claude-code/*`** (例如 `claude-code/sonnet`、`claude-code/haiku`) — 使用你的 **Claude Max/Pro 订阅**(OAuth,无需 API key),通过 `claude` CLI 进行路由。运行命令为 `claude -p --output-format json --strict-mcp-config --setting-sources user` — 最后两个参数能将冷启动时间从几分钟缩短到约 4 秒。 - **`claude-*`** (无前缀,例如 `claude-sonnet-4-6`) — 通过 LiteLLM 调用付费的 **Anthropic API**,仅在设置了 `ANTHROPIC_API_KEY` 时使用。 - **其他所有** (`openai/*`、`groq/*`、`gemini/*`、`deepseek/*` 等) — 当存在对应的 key 时,通过 LiteLLM 进行调用。 - **`ollama/*`** — 始终可用的本地兜底方案。 订阅版的补全路径没有原生的 function-calling。为了在 Max 套餐上实现真正的“行动”,`claude.code` 技能会委托执行一次完整的 agentic Claude Code 运行——包含其自身的工具、MCP server 和技能——从而可以读写文件并执行命令。 ## 桌面控制 (OpenClaw) | 技能 | 用途 | |-------|---------| | `openclaw.launch_app` | 通过命令/名称打开桌面应用 | | `openclaw.open` | 使用默认处理程序打开文件、文件夹或 URL | | `openclaw.browse` | 在(指定的或默认的)浏览器中打开 URL | | `openclaw.type` | 在当前聚焦的窗口中输入文本 | | `openclaw.key` | 按下某个按键或快捷键 (例如 `ctrl+t`、`Return`) | | `openclaw.screenshot` | 将屏幕截图捕获为 PNG | | `openclaw.click` | 移动鼠标并点击 | | `openclaw.clipboard_set` / `openclaw.clipboard_get` | 读取/写入剪贴板 | 每个会话都会进行后端检测 — **Wayland**: `wtype` / `grim` / `wl-copy`;**X11**: `xdotool` / `scrot` / `xclip`;**macOS**: 内置工具。如果缺少后端,每个技能都会明确报告,而不是静默失败。如需进行精细的浏览器内控制(导航、点击、填写、截图),请使用 Playwright MCP server,它通过 MCP 桥接以 `mcp.playwright.*` 的形式展现。 ## 架构 ``` interfaces/{cli,web,daemon,voice_app} thin frontends — no business logic │ build RequestContext ▼ core/kernel.py ── route ──► agents/{chat,coding,hacking,automation,openclaw,hermes} │ │ ReAct loop + autonomy gate │ ▼ │ skills/ builtins + computer(openclaw) + claude.code │ + MCP bridge + project bridge + plugins ▼ providers/router.py tier-based model choice + fallback │ claude-code/* → claude CLI (Max/Pro) claude-*/openai/* → LiteLLM ollama/* → local ▼ memory/ SQLite: conversations, task_journal (audit), longterm (FTS5), jobs core/capabilities.py probes OS/keys/audio/tools/desktop → everything self-disables gracefully ``` ## 配置 - `config.yaml` — 模型、任务层级、自主模式、语音、Web 设置(非机密信息)。 - `.env` — 仅包含 API key。支持任意子集;全部都不是必需的。 - `~/.jarvis/` — SQLite 数据库 + 插拔式 `plugins/*.py`(自动加载带有 `@skill` 装饰器的技能)。 ## Docker ``` docker compose up --build # jarvis (web) + ollama docker compose exec ollama ollama pull llama3.1 ``` ## 扩展 在 `~/.jarvis/plugins/` 目录中放入一个文件: ``` from jarvis.skills import skill @skill(name="weather.now", description="Get current weather for a city.", parameters={"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}) async def weather_now(city: str) -> str: ... ``` 下次启动时即可对 agent 可用。 ## 技术栈 Python 3.11+ · `anthropic` / LiteLLM · `faster-whisper` · `edge-tts` / `piper-tts` · `pyautogui` / `xdotool` / `wtype` · FastAPI (Web) · APScheduler (守护进程) · SQLite + FTS5 (记忆存储) · MCP (Model Context Protocol) 桥接 · Playwright MCP · Docker + Compose. ## 自主性与安全性 默认模式为 `autonomous`(无需询问即可连续执行任务)。即便如此,`config.yaml` 中的 `approval_required_for` 匹配模式仍会受到严格管控——破坏性的 shell 命令 (`shell.destructive`) 和对外发送请求 (`net.send`) 会被强制拦截。工具的输出始终被视为不受信任的数据,绝不会被当作指令来执行。请仅在你获得授权操作或测试的系统上使用。 ## 许可证 MIT — 详见 [LICENSE](./LICENSE)。 ### Danush 的更多项目 - [ponytail-for-python](https://github.com/Danush-Aries/ponytail-for-python) — 针对 Python 代码库的代码智能工具 - [Agentic_Systems](https://github.com/Danush-Aries/Agentic_Systems) — agent 模式的参考实现 - [autonomous-coding-agent](https://github.com/Danush-Aries/autonomous-coding-agent) — 全自动工程 agent - [computer-use-agent](https://github.com/Danush-Aries/computer-use-agent) — Claude 通过 VNC 操控你的桌面 - [browser-automation-agent](https://github.com/Danush-Aries/browser-automation-agent) — Claude 操控 Playwright - [blinkchat](https://github.com/Danush-Aries/blinkchat) — 充满感觉的实时聊天
标签:AI助手, DLL 劫持, 人工智能, 多模型路由, 大语言模型, 桌面自动化, 特征检测, 用户模式Hook绕过, 语音助手, 请求拦截, 调试插件, 逆向工具