# Changelog

## [5.0.0-rc.22] - 2026-04-24

### New Features
- **read_file / write_file** — Agent 可以直接读写本地文件，支持路径安全检查（防止逃逸 workspace）、100KB 读取上限、二进制检测、append 模式
- **语音合成 (Voice Reply)** — 集成 edge-tts，双通道实现（Python CLI + WebSocket 直连微软服务 fallback），默认中文语音 `zh-CN-XiaoxiaoNeural`
- **`opc voice test "<文字>"`** — CLI 语音测试命令
- **OAD Schema 扩展** — voice.tts 配置新增默认值（provider=edge-tts, voice=zh-CN-XiaoxiaoNeural, speed=1.0）

## [5.0.0-rc.21] - 2026-04-24

### New Features
- **MCP 完整集成** — MCPClientManager（连接外部 MCP Server）+ MCPServer（暴露 OPC Agent builtin tools 给外部 MCP Client）+ CLI `opc mcp list/test/serve`
- **spawn_subagents** — 并行子代理工具，支持多任务并行执行
- **Ollama Embedding Hybrid Search** — DeepBrain 语义搜索（FTS5 + Ollama cosine similarity）
- **execute_code** — JS/TS/Python 沙箱执行
- **Skill→Tool** — 自动将 Skill 文件转换为可调用的 Tool
- **Provider Failover 增强** — 含 gpt-4o-mini → Ollama-first 默认值修复
- **handleMessageStream pipeline 修复**

## [5.0.0-rc.14] - 2026-04-23

### New Features
- **OutputGuard** — Unified output sanitization pipeline with 6 rules: PII scrubbing, prompt-injection echo suppression, `<think>` reasoning block stripping, model identity self-disclosure detection (Claude/GPT/Gemini/etc.), jailbreak echo filtering, and sensitive-key redaction. Integrated into all 6 active channels (Telegram, Web, WeChat, Feishu, Discord, Slack) with full streaming support.

## [5.0.0-rc.13] - 2026-04-23

### New Features
- **Hybrid FTS5 + Semantic Search** — DeepBrain now combines SQLite FTS5 full-text search with vector embeddings for higher-recall recall queries
- **Skill Platform Filter** — Skills declare supported platforms; runtime skips unsupported tools automatically
- **TUI LogStream** — Live structured log panel inside the terminal chat UI
- **MCPClient stub** — MCP client interface wired into runtime (server connectivity TBD)
- **WorkflowEngine** — DAG-based task orchestration with step dependencies and parallel branches
- **SandboxManager** — Isolated execution environment for untrusted code steps
- **Workstation Template system** — `opc init --template <id>` scaffolds a complete agent workspace (e.g. `opc init --template ceo-coach-socratic`)
- **7-layer System Prompt Assembly** — Layered prompt construction: base identity → EGO.md → SOUL.md → CONTEXT.md → memory → skills → conversation history
- **DeepBrain Auto-import** — Knowledge base is automatically populated on `opc brain learn`
- **DeepBrain Recall in Conversations** — Every conversation turn runs a semantic prefetch against DeepBrain and injects relevant memories into context

## [5.0.0-rc.12] - 2026-04-22

### New Features
- **FailoverProvider** — Automatic LLM provider failover with configurable priority order and circuit-breaker
- **HeartbeatMonitor** — Per-provider liveness probes; removes unhealthy providers from rotation
- **`create_skill` tool** — Agent self-writes new skills at runtime; persisted to disk and hot-reloaded
- **InsightsExtractor** — Structured extraction of entities, decisions, and action items from conversation turns
- **SubAgentManager** — Spawn, track, and aggregate results from parallel sub-agents
- **SessionEventEmitter** — Internal event bus for session lifecycle hooks (start, turn, end, error)
- **InjectionDetector** — Heuristic + pattern-based prompt injection detection layer
- **ProgressiveDisclosure** — Truncates lengthy tool outputs; exposes `show more` expansion in TUI
- **ContextCompressor V2** — Token-aware summarisation with configurable compression ratio and anchor preservation

## [5.0.0-rc.11] - 2026-04-22

### New Features
- **Provider Failover** — LLM provider switching on transient errors; retries with exponential back-off
- **Prompt Injection Detection** — Early-stage detection of adversarial inputs before they reach the model

## [5.0.0-rc.10]

### New Features
- **P1 Orchestration** — Memory prefetch/sync, context window guard (auto-truncation before overflow), cron job delivery to channels, DeepBrain recall wired into every turn

## [5.0.0-rc.9]

### New Features
- **P0 Orchestration** — SQLite conversation history persistence, context compaction (summarise-and-truncate), isolated cron scheduler
- **Pipe Mode Tool Loop** — `opc run --pipe` accepts newline-delimited JSON tasks; agent executes tool loop and writes JSON results to stdout
- **Skill Loader Integration** — Runtime discovers and loads skills from `~/.opc/skills/` and project-local `skills/` on startup

## [5.0.0-rc.5]

### Improvements
- **Banner v2** — High-fidelity ASCII-art splash with version and hardware stats
- **TUI Markdown Enhancement** — Tables, code fences, and inline styles rendered natively in terminal

## [5.0.0-rc.3]

### New Features
- **TUI Markdown Rendering** — Full CommonMark rendering in `opc chat` terminal UI

## [5.0.0-rc.2]

### New Features
- **Interactive Tool Calling** — Tools are confirmed and displayed live inside the TUI before execution

## [5.0.0-rc.1] - 2026-04-20

### Major Release — Complete v5 Rewrite
- All-in-one architecture merging **DeepBrain** (knowledge) + **AgentKits** (model routing) + **Workstation** (templates) into a single package
- 1114 tests passing
- TypeScript 5.x, CommonJS module format, Node.js 18+ required
- Declarative `oad.yaml` agent definition replaces legacy JSON config
- New self-evolution engine: L1 Experience Compile → L2 Memory Consolidate → L3 Skill Discovery → L4 Group Evolution

## [5.0.0-alpha.1]

- Initial v5 alpha — early preview of the rewritten architecture

---

## [4.2.0] - 2026-04-21

### New Features
- **Priority Queue / Fast Mode** — Priority-aware request routing with per-session `/fast` toggle. Fast-mode requests are processed first and routed through provider priority endpoints (OpenAI, Anthropic, Google). Includes concurrency control, batch tier, and custom provider endpoint registration.
- **Gateway Registry** — Advanced multi-gateway tool provider pattern. Register multiple remote tool gateways with subscription-based access, per-tool quota tracking, auto-retry with backoff, and unified invocation routing across gateways. Complements the existing single-gateway `ToolGateway`.

### Improvements
- New `FastModeManager` for per-session priority state management
- `PriorityQueue` with weighted dequeue, provider concurrency limits, and drain support
- `ToolGatewayRegistry` for routing tool calls across multiple gateway providers

## [2.0.0] - 2026-04-18

### Major Features
- **Interactive CLI** (`opc chat`) — Full TUI with streaming, slash commands, history
- **Daemon Mode** (`opc start/stop/status`) — Run agents as background processes
- **Cron Scheduler** — Built-in job scheduling with cron expressions
- **Autonomous Skill Learning** — Agents create and improve skills from experience
- **Sub-Agent System** — Spawn parallel sub-agents for task delegation
- **Built-in Tools** — File operations, web fetch, shell exec, datetime
- **MCP Client** — Connect to external MCP servers via JSON-RPC
- **Telegram Channel** — Dual-mode (polling + webhook) with Markdown support
- **Discord Channel** — Gateway WebSocket with auto-reconnect
- **Slack Channel** — Real Events API + chat.postMessage
- **SOUL.md + CONTEXT.md** — Agent personality and project context files
- **Analytics** — Wired into runtime for message tracking, skill usage, errors

### Enhanced
- `/health` endpoint returns comprehensive agent info
- `opc init` generates SOUL.md, CONTEXT.md, and richer project templates
- OAD config supports scheduler, learning, and tools sections
- 204 tests passing

### CLI Commands
init, chat, run, dev, start, stop, status, jobs, skills, info, build, test, analytics, brain, logs, score, search, deploy, publish, install, plugin, tool, workflow, migrate

## [1.4.0] - 2026-04-18
- feat: wire Analytics into AgentRuntime (message timing, skill usage, error tracking)
- feat: expose analytics snapshot on /health and /api/dashboard endpoints
- feat: enhanced /health endpoint with agent name, version, uptime, memory type, skills, channels
- feat: Slack channel — real Events API webhook server + chat.postMessage via fetch
- feat: WebChannel metadata setters (version, memory type, skills, channels, analytics provider)
- feat: AgentRuntime.getAnalytics() and getConfig() accessors

## [1.3.1] - 2026-04-17
- fix: remove residual DTV/marketplace references
- fix: duplicate WatchPattern export

## [1.3.0] - 2026-04-17
- feat: Traces collection (OpenTelemetry-style)
- feat: DeepBrain exporter
- feat: brain/logs/score CLI commands

## [1.2.0]
- Initial public release
- 11 channels, plugins, analytics
- Declarative OAD configuration
