opc-agent 5.0.0-rc.21 → 5.0.0-rc.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +115 -147
  3. package/README.zh-CN.md +122 -142
  4. package/TASK.md +38 -42
  5. package/dist/cli.js +22 -31
  6. package/dist/cli.js.map +1 -1
  7. package/dist/core/agent.d.ts +9 -0
  8. package/dist/core/agent.d.ts.map +1 -1
  9. package/dist/core/agent.js +23 -0
  10. package/dist/core/agent.js.map +1 -1
  11. package/dist/core/runtime.d.ts.map +1 -1
  12. package/dist/core/runtime.js +9 -0
  13. package/dist/core/runtime.js.map +1 -1
  14. package/dist/core/types.d.ts +1 -0
  15. package/dist/core/types.d.ts.map +1 -1
  16. package/dist/scheduler/cron-engine.d.ts.map +1 -1
  17. package/dist/scheduler/cron-engine.js +3 -1
  18. package/dist/scheduler/cron-engine.js.map +1 -1
  19. package/dist/schema/oad.d.ts +155 -18
  20. package/dist/schema/oad.d.ts.map +1 -1
  21. package/dist/schema/oad.js +8 -1
  22. package/dist/schema/oad.js.map +1 -1
  23. package/dist/tools/builtin/index.d.ts +2 -0
  24. package/dist/tools/builtin/index.d.ts.map +1 -1
  25. package/dist/tools/builtin/index.js +8 -2
  26. package/dist/tools/builtin/index.js.map +1 -1
  27. package/dist/tools/builtin/read-file.d.ts +3 -0
  28. package/dist/tools/builtin/read-file.d.ts.map +1 -0
  29. package/dist/tools/builtin/read-file.js +126 -0
  30. package/dist/tools/builtin/read-file.js.map +1 -0
  31. package/dist/tools/builtin/write-file.d.ts +3 -0
  32. package/dist/tools/builtin/write-file.d.ts.map +1 -0
  33. package/dist/tools/builtin/write-file.js +95 -0
  34. package/dist/tools/builtin/write-file.js.map +1 -0
  35. package/dist/voice/tts.d.ts +8 -0
  36. package/dist/voice/tts.d.ts.map +1 -0
  37. package/dist/voice/tts.js +145 -0
  38. package/dist/voice/tts.js.map +1 -0
  39. package/package.json +1 -1
  40. package/AUDIT-TASK.md +0 -96
  41. package/COMPETITIVE-GAP.md +0 -92
  42. package/STUDIO-FIX-5678.md +0 -57
  43. package/STUDIO-FIX-ALL.md +0 -101
  44. package/STUDIO-REWRITE-TASK.md +0 -76
  45. package/TASK-STUDIO.md +0 -200
  46. package/templates/Dockerfile +0 -15
  47. package/templates/code-reviewer/README.md +0 -27
  48. package/templates/code-reviewer/oad.yaml +0 -41
  49. package/templates/customer-service/README.md +0 -22
  50. package/templates/customer-service/oad.yaml +0 -36
  51. package/templates/docker-compose.yml +0 -21
  52. package/templates/ecommerce-assistant/README.md +0 -45
  53. package/templates/ecommerce-assistant/oad.yaml +0 -47
  54. package/templates/knowledge-base/README.md +0 -28
  55. package/templates/knowledge-base/oad.yaml +0 -38
  56. package/templates/sales-assistant/README.md +0 -26
  57. package/templates/sales-assistant/oad.yaml +0 -43
  58. package/templates/tech-support/README.md +0 -43
  59. package/templates/tech-support/oad.yaml +0 -45
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## [5.0.0-rc.22] - 2026-04-24
4
+
5
+ ### New Features
6
+ - **read_file / write_file** — Agent 可以直接读写本地文件,支持路径安全检查(防止逃逸 workspace)、100KB 读取上限、二进制检测、append 模式
7
+ - **语音合成 (Voice Reply)** — 集成 edge-tts,双通道实现(Python CLI + WebSocket 直连微软服务 fallback),默认中文语音 `zh-CN-XiaoxiaoNeural`
8
+ - **`opc voice test "<文字>"`** — CLI 语音测试命令
9
+ - **OAD Schema 扩展** — voice.tts 配置新增默认值(provider=edge-tts, voice=zh-CN-XiaoxiaoNeural, speed=1.0)
10
+
11
+ ## [5.0.0-rc.21] - 2026-04-24
12
+
13
+ ### New Features
14
+ - **MCP 完整集成** — MCPClientManager(连接外部 MCP Server)+ MCPServer(暴露 OPC Agent builtin tools 给外部 MCP Client)+ CLI `opc mcp list/test/serve`
15
+ - **spawn_subagents** — 并行子代理工具,支持多任务并行执行
16
+ - **Ollama Embedding Hybrid Search** — DeepBrain 语义搜索(FTS5 + Ollama cosine similarity)
17
+ - **execute_code** — JS/TS/Python 沙箱执行
18
+ - **Skill→Tool** — 自动将 Skill 文件转换为可调用的 Tool
19
+ - **Provider Failover 增强** — 含 gpt-4o-mini → Ollama-first 默认值修复
20
+ - **handleMessageStream pipeline 修复**
21
+
3
22
  ## [5.0.0-rc.14] - 2026-04-23
4
23
 
5
24
  ### New Features
package/README.md CHANGED
@@ -1,218 +1,188 @@
1
1
  <div align="center">
2
2
 
3
- # ⚡ OPC Agent — 瞬知 Studio
3
+ # ⚡ OPC Agent
4
4
 
5
- **Your AI workforce, running locally. Zero cloud cost to start.**
6
-
7
- One computer. One command. Your own AI agents — learning, evolving, working 24/7.
5
+ **Your own AI employee local, private, gets smarter over time.**
8
6
 
9
7
  [![npm](https://img.shields.io/npm/v/opc-agent/alpha?label=opc-agent%40alpha)](https://www.npmjs.com/package/opc-agent)
10
8
  [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
11
9
  [![Node](https://img.shields.io/badge/Node.js-%3E%3D18-339933?logo=node.js&logoColor=white)](https://nodejs.org/)
12
- [![Tests](https://img.shields.io/badge/tests-1114%2B%20passing-brightgreen)](CONTRIBUTING.md)
13
10
 
14
- [Quick Start](#-quick-start) · [What's New in v5](#-whats-new-in-v5) · [Features](#-features) · [Architecture](#-architecture) · [CLI](#-cli-commands) · [中文](README.zh-CN.md)
11
+ [中文文档](README.zh-CN.md)
15
12
 
16
13
  </div>
17
14
 
18
15
  ---
19
16
 
20
- ## 🚀 Quick Start
17
+ ## Why OPC Agent?
18
+
19
+ AI Agents are powerful, but hard to use for most people:
20
+
21
+ - **Expensive** — Cloud agents charge per token. Costs add up fast.
22
+ - **No memory** — Every conversation starts from scratch.
23
+ - **Data privacy** — Your chats and documents live on someone else's servers.
24
+ - **Can only chat** — Can't read files, search the web, or run code.
21
25
 
22
- ### One-Line Install (recommended)
26
+ **OPC Agent fixes all of this:**
27
+
28
+ ✅ Runs locally, zero cost (powered by Ollama)<br>
29
+ ✅ Gets smarter over time (automatic learning & evolution)<br>
30
+ ✅ Your data stays on your machine<br>
31
+ ✅ Can read/write files, search the web, execute code, use tools
32
+
33
+ ---
34
+
35
+ ## 🚀 Install
36
+
37
+ Pick your OS, copy one line:
38
+
39
+ ### macOS / Linux
23
40
 
24
41
  ```bash
25
- # macOS / Linux
26
42
  curl -fsSL https://raw.githubusercontent.com/Deepleaper/opc-agent/main/install.sh | bash
43
+ ```
44
+
45
+ ### Windows
27
46
 
28
- # Windows (PowerShell)
47
+ ```powershell
29
48
  irm https://raw.githubusercontent.com/Deepleaper/opc-agent/main/install.ps1 | iex
30
49
  ```
31
50
 
32
- This automatically installs Node.js, OPC Agent, Ollama, and a recommended AI model based on your hardware.
51
+ > The installer automatically sets up Node.js, OPC Agent, Ollama, and the best AI model for your hardware. No manual steps.
33
52
 
34
- ### Or install manually
53
+ ### Manual install
35
54
 
36
55
  ```bash
37
56
  npm install -g opc-agent@alpha
38
- opc setup # Interactive setup wizard
39
57
  ```
40
58
 
41
- ### Get started in 30 seconds
59
+ ---
60
+
61
+ ## ⚡ Get started in 30 seconds
62
+
63
+ ### Step 1: Create your AI employee
42
64
 
43
65
  ```bash
44
- opc chat # Chat in terminal
45
- opc studio # Open web UI → localhost:4000
46
- opc run # Start everything: Agent + Telegram + Web + Studio
66
+ opc init my-agent
67
+ cd my-agent
47
68
  ```
48
69
 
49
- ---
70
+ ### Step 2: Start chatting
50
71
 
51
- ## 🆕 What's New in v5
72
+ ```bash
73
+ opc chat
74
+ ```
52
75
 
53
- **v5.0.0-rc.14** is the most complete release yet. Key highlights:
76
+ That's it. Your AI employee is ready.
54
77
 
55
- - **OutputGuard** — Every agent response is passed through a 6-rule sanitization pipeline before it reaches any channel. Prevents model identity leakage, reasoning tag exposure (`<think>`), PII, and prompt-injection echoes. Works with streaming.
56
- - **Workstation Templates** — `opc init --template ceo-coach-socratic` scaffolds a fully-configured agent workspace in seconds. More templates in the registry.
57
- - **Provider Failover** — Automatic LLM failover across OpenAI, Anthropic, Ollama, and others. Circuit-breaker + heartbeat monitoring. No dropped requests.
58
- - **7-Layer System Prompt** — Context assembly is now deterministic and layered: base identity → EGO.md → SOUL.md → CONTEXT.md → memory → skills → history.
59
- - **DeepBrain Recall** — Semantic memory is prefetched and injected into every conversation turn automatically.
60
- - **Hybrid Search** — DeepBrain combines FTS5 full-text and vector semantic search for higher-recall knowledge retrieval.
61
- - **1114+ tests passing** — Up from 204 in v2.
78
+ ### More
62
79
 
63
- See [CHANGELOG.md](CHANGELOG.md) for the full rc.1–rc.14 history.
80
+ ```bash
81
+ opc studio # Web dashboard at localhost:4000
82
+ opc run # Start everything: chat + Telegram + web + dashboard
83
+ ```
64
84
 
65
85
  ---
66
86
 
67
- ## Features
87
+ ## What can it do?
68
88
 
69
- | Feature | Description |
70
- |---------|-------------|
71
- | 🧠 **Self-Evolving** | 4-layer evolution engine: Experience → Memory → Skills → Group knowledge |
72
- | 💰 **Zero Cost Start** | Runs 100% locally with Ollama. No API key needed. |
73
- | 🎨 **Studio UI** | Web-based management at localhost:4000 — models, channels, knowledge, templates |
74
- | 📱 **Multi-Channel** | Telegram, Web, WeChat, Feishu, Discord, Slack, Email |
75
- | 🔧 **40 Built-in Skills** | File ops, web search, code execution, image generation, and more |
76
- | 🛡 **OutputGuard** | Unified output sanitization: prevents identity leakage, PII, reasoning tag exposure |
77
- | 🏗 **Workstation Templates** | `opc init --template <id>` creates a full agent workspace instantly |
78
- | 🔀 **Provider Failover** | Automatic LLM failover with circuit-breaker and heartbeat monitoring |
79
- | 🤖 **A2A Protocol** | Agent-to-agent communication for multi-agent workflows |
80
- | 📦 **All-in-One** | DeepBrain (knowledge) + AgentKits (models) + Workstation (templates) |
81
- | 🔒 **Privacy First** | Your data stays on your machine. No telemetry. |
89
+ OPC Agent isn't just a chatbot. It's an **AI employee that gets work done**:
90
+
91
+ | Capability | Details |
92
+ |-----------|---------|
93
+ | 💬 **Chat** | Terminal or web interface |
94
+ | 📁 **Read & write files** | Read your docs, write reports, organize notes |
95
+ | 🔍 **Web search** | Real-time search for up-to-date information |
96
+ | 🌐 **Read web pages** | Fetch and summarize any URL |
97
+ | 💻 **Execute code** | Run JavaScript, TypeScript, Python |
98
+ | 🧠 **Memory** | Remembers past conversations, gets smarter over time |
99
+ | 🔧 **MCP tool extensions** | Connect GitHub, databases, Slack, and more |
100
+ | 📱 **Telegram bot** | Add a bot token and chat via Telegram |
101
+ | 🎙 **Voice synthesis** | Text-to-speech via edge-tts |
102
+ | 👥 **Sub-agents** | Spawn parallel workers for complex tasks |
82
103
 
83
104
  ---
84
105
 
85
- ## 🏗 Architecture
106
+ ## 🧠 Gets smarter over time
107
+
108
+ This is what makes OPC Agent different: **it evolves.**
86
109
 
87
110
  ```
88
- ┌──────────────────────────────────────────────────────┐
89
- │ OPC Agent CLI │
90
- │ opc chat · opc studio · opc run │
91
- ├──────────────────────────────────────────────────────┤
92
- │ Agent Loop │ Self-Evolution (L1-L4) │
93
- │ 7-Layer Context │ L1 Experience Compile │
94
- │ Assembly │ L2 Memory Consolidate │
95
- │ OutputGuard │ L3 Skill Discovery │
96
- │ │ L4 Group Evolution │
97
- ├──────────────────────────────────────────────────────┤
98
- │ DeepBrain │ AgentKits │ Workstation │
99
- │ (Knowledge) │ (Models + │ (Templates) │
100
- │ SQLite+FTS5+Vector │ Failover) │ opc init │
101
- ├──────────────────────────────────────────────────────┤
102
- │ Channels (OutputGuard applied to all) │
103
- │ Telegram │ Web │ WeChat │ Feishu │ Discord │ Slack │
104
- └──────────────────────────────────────────────────────┘
111
+ You chat with your AI
112
+
113
+ AI extracts knowledge from the conversation ← automatic
114
+
115
+ Knowledge is saved to a local database ← on your machine
116
+
117
+ Next conversation references that knowledge ← it remembers
118
+
119
+ Knowledge gradually refines and improves ← gets better over time
105
120
  ```
106
121
 
107
- ### How it works
108
-
109
- 1. **You talk** → Agent receives message via any channel
110
- 2. **Agent thinks** → 7-layer context assembly + tool selection + LLM reasoning
111
- 3. **Agent acts** → Executes tools, calls APIs, generates content
112
- 4. **OutputGuard** → Sanitizes response through 6 rules before delivery
113
- 5. **Agent learns** → Every interaction feeds the evolution engine
114
- 6. **Agent evolves** → Knowledge distills upward: experience → memory → skills
115
-
116
- ---
117
-
118
- ## 💻 CLI Commands
119
-
120
- | Command | Description |
121
- |---------|-------------|
122
- | `opc setup` | Interactive setup wizard |
123
- | `opc init [name]` | Create new agent project |
124
- | `opc init --template <id>` | Scaffold agent from template (e.g. `ceo-coach-socratic`) |
125
- | `opc chat` | Terminal chat with agent |
126
- | `opc studio` | Open Studio web UI (port 4000) |
127
- | `opc run` | Start all services (Agent + channels + Studio) |
128
- | `opc brain stats` | Show knowledge base statistics |
129
- | `opc brain recall <query>` | Semantic search in knowledge |
130
- | `opc brain learn <file>` | Import document into knowledge |
131
- | `opc doctor` | Diagnose installation issues |
122
+ All learning runs on local Ollama models. **Zero cost.**
132
123
 
133
124
  ---
134
125
 
135
- ## 🔧 Configuration
126
+ ## 🎨 Studio Dashboard
136
127
 
137
- After `opc setup`, all configuration lives in Studio UI (localhost:4000):
128
+ ```bash
129
+ opc studio
130
+ ```
138
131
 
139
- - **Models** Switch between Ollama models, add cloud API keys, configure failover order
140
- - **Channels** — Configure Telegram bot, WeChat, Feishu, etc.
141
- - **Knowledge** — Drag & drop documents, manage DeepBrain
142
- - **Templates** — Browse industry/job/workstation templates
143
- - **Agent Settings** — Edit personality, skills, model assignments
132
+ Open `localhost:4000` in your browser to:
144
133
 
145
- Config files: `~/.opc/config.json` (global), `oad.yaml` (per agent)
134
+ - **Models** Switch AI models (local or cloud)
135
+ - **Channels** — Configure Telegram bot
136
+ - **Knowledge** — See what your agent has learned
137
+ - **Settings** — Customize personality, skills, behavior
146
138
 
147
139
  ---
148
140
 
149
- ## 📖 Model Support
141
+ ## 📖 Model support
142
+
143
+ ### Local (zero cost)
150
144
 
151
- ### Local (Ollama) Zero Cost
152
- Auto-detected and recommended based on your RAM:
145
+ Auto-recommended based on your RAM:
153
146
 
154
- | RAM | Recommended Model | Size |
155
- |-----|------------------|------|
147
+ | RAM | Model | Download |
148
+ |-----|-------|----------|
156
149
  | ≤3 GB | qwen2.5:0.5b | 400MB |
157
150
  | ≤7 GB | qwen2.5:1.5b | 1.0GB |
158
151
  | ≤15 GB | qwen2.5:7b | 4.7GB |
159
152
  | ≤31 GB | qwen2.5:14b | 9.0GB |
160
153
  | 32+ GB | qwen2.5:32b | 19GB |
161
154
 
162
- ### Cloud (via AgentKits)
163
- Configure in Studio → Models: OpenAI, DeepSeek, Anthropic, Qwen, Google Gemini
155
+ ### Cloud (optional)
164
156
 
165
- Provider failover is configured per-agent in `oad.yaml`.
157
+ Add API keys in Studio: OpenAI, DeepSeek, Anthropic, Qwen, Google Gemini
166
158
 
167
- ---
168
-
169
- ## 🌐 Multi-Channel
170
-
171
- | Channel | Setup |
172
- |---------|-------|
173
- | 💬 Web Chat | Built-in, localhost:3000 |
174
- | 📱 Telegram | Add bot token in Studio |
175
- | 💬 WeChat | Add app credentials in Studio |
176
- | 🐦 Feishu | Add app credentials in Studio |
177
- | 🎮 Discord | Add bot token in Studio |
178
- | 💼 Slack | Add bot token in Studio |
179
- | 📧 Email | Add SMTP config in Studio |
180
-
181
- All channels run OutputGuard on every outbound message.
159
+ Automatic failover — if one provider goes down, the next one takes over.
182
160
 
183
161
  ---
184
162
 
185
- ## 🧬 Self-Evolution
186
-
187
- OPC Agent gets smarter over time through 4 layers of evolution:
163
+ ## 📋 Commands
188
164
 
189
- - **L1 Experience Compilation**: Raw interactions → structured insights (local Ollama)
190
- - **L2 — Memory Consolidation**: Insights → refined knowledge (cloud AgentKits)
191
- - **L3 Skill Discovery**: Patterns auto-generated skills (cloud AgentKits)
192
- - **L4 Group Evolution**: Individual knowledge → shared wisdom (local Ollama)
193
-
194
- All L1/L4 processing runs locally at zero cost. L2/L3 uses cloud models for higher quality.
165
+ | Command | What it does |
166
+ |---------|-------------|
167
+ | `opc init [name]` | Create an AI employee |
168
+ | `opc chat` | Chat in terminal |
169
+ | `opc studio` | Open web dashboard |
170
+ | `opc run` | Start all services |
171
+ | `opc brain stats` | Knowledge base status |
172
+ | `opc brain recall "query"` | Search knowledge |
173
+ | `opc brain learn file.md` | Import a document |
174
+ | `opc voice test "hello"` | Test voice synthesis |
175
+ | `opc mcp list` | List connected tools |
176
+ | `opc doctor` | Diagnose issues |
195
177
 
196
178
  ---
197
179
 
198
- ## 📦 Project Structure
180
+ ## 🔒 Privacy
199
181
 
200
- ```
201
- ~/.opc/ # Global config
202
- config.json # Settings
203
- agents/ # Agent data
204
-
205
- my-agent/ # Agent workspace
206
- EGO.md # Agent personality
207
- SOUL.md # Tone and values
208
- CONTEXT.md # Project context
209
- DEEPBRAIN.md # Knowledge summary
210
- oad.yaml # Agent definition
211
- .opc/
212
- brain.db # Knowledge database (SQLite + FTS5 + vector)
213
- skills/ # Auto-generated skills
214
- evolution/ # Evolution logs
215
- ```
182
+ - All data stored locally on your machine
183
+ - No telemetry
184
+ - Local Ollama models never touch the cloud
185
+ - Your knowledge, conversations, and files stay private
216
186
 
217
187
  ---
218
188
 
@@ -223,11 +193,9 @@ git clone https://github.com/Deepleaper/opc-agent.git
223
193
  cd opc-agent
224
194
  npm install
225
195
  npx tsc # Build
226
- npx vitest run # Test (1114+ tests)
196
+ npx vitest run # Test
227
197
  ```
228
198
 
229
- See [CONTRIBUTING.md](CONTRIBUTING.md) for the full guide.
230
-
231
199
  ---
232
200
 
233
201
  ## 📄 License
@@ -238,8 +206,8 @@ Apache-2.0 © [Deepleaper](https://github.com/Deepleaper)
238
206
 
239
207
  <div align="center">
240
208
 
241
- **Built by [Deepleaper](https://www.deepleaper.com)** — Making AI work for everyone.
209
+ **Built by [Deepleaper](https://www.deepleaper.com)**
242
210
 
243
- ⭐ Star this repo if OPC Agent helps you!
211
+ ⭐ Star this repo if it helps you!
244
212
 
245
213
  </div>