# v0.7.0 Release Notes

> v0.6.0 -> v0.7.0

## Summary

Major architectural refactor, LLM-driven agent routing, OpenAI-compatible endpoint support, and enhanced session reliability through file locking and atomic writes.

<details>
<summary>翻譯</summary>
大型架構重構，LLM 驅動的 Agent 路由、支援 OpenAI 相容端點，以及透過檔案鎖與原子寫入提升 session 可靠性。
</details>

## Changes

### FEAT
- Add LLM-driven automatic agent routing mechanism to dynamically select the best provider per request
- Add `compat` provider supporting any OpenAI-compatible endpoint (defaults to Ollama at `localhost:11434`)
- Add `search_history` tool for searching session conversation history with time-range filtering (`1d`/`7d`/`1m`/`1y`)
- Add duplicate tool-call result caching to avoid redundant API requests within a session
- Add post-iteration automatic summary when `MaxToolIterations` is exceeded instead of returning an error
- Add Unicode parameter normalization (`normalizeArgs`) to handle `\uXXXX` escape sequences from LLM outputs

<details>
<summary>翻譯</summary>

- 新增 LLM 驅動的自動 Agent 路由機制，依請求動態選擇最佳 provider
- 新增 `compat` provider，支援任意 OpenAI 相容端點（預設 Ollama `localhost:11434`）
- 新增 `search_history` 工具，支援時間範圍過濾（`1d`/`7d`/`1m`/`1y`）的 session 歷史搜尋
- 實作重複工具呼叫結果快取，避免 session 內冗餘 API 請求
- 超過 `MaxToolIterations` 後自動呼叫摘要，不再直接回傳錯誤
- 新增 `normalizeArgs` 處理 LLM 輸出的 `\uXXXX` Unicode 轉義序列

</details>

### FIX
- Fix concurrent session race condition by acquiring an exclusive `flock` on `config.json` before read/write
- Fix `config.json` initialization with atomic `O_EXCL` write to prevent duplicate session creation under concurrency
- Fix corrupted `config.json` detection and explicit error propagation

<details>
<summary>翻譯</summary>

- 修正並發 session 競態，讀寫 `config.json` 前取得排他 `flock` 鎖
- 使用 `O_EXCL` 原子寫入初始化 `config.json`，防止並發時建立重複 session
- 修正損毀 `config.json` 的偵測並明確傳遞錯誤

</details>

### UPDATE
- Force agent selector to always return a valid agent from the available list; remove `NONE` fallback response
- Replace dynamic `limit` parameter in `search_web` and `search_history` tools with a fixed cap of 10
- Reduce `MaxToolIterations` default from 32 to 8; introduce `MaxSkillIterations` (128) for skill-mode execution
- Add `default_model` field support in agent config to control fallback agent ordering

<details>
<summary>翻譯</summary>

- 強制 Agent 選擇器必須從可用清單回傳有效代理，移除 `NONE` fallback
- 將 `search_web` 和 `search_history` 的動態 `limit` 參數改為固定 10 筆上限
- 預設 `MaxToolIterations` 從 32 降至 8；skill 模式改用 `MaxSkillIterations`（128）
- Agent 設定檔新增 `default_model` 欄位控制 fallback 順序

</details>

### REFACTOR
- Split monolithic `agents/exec.go` into `exec/` sub-package with responsibility-separated files (`execute`, `run`, `toolCall`, `getSession`, `selectAgent`, `selectSkill`, `writeHistory`, `extractSummary`)
- Extract shared types (`Agent`, `Message`, `Session`, `AgentRegistry`, `AgentEntry`, `Output`, `OutputChoices`, `ToolCall`) into `internal/agents/types` package
- Simplify tool result message format; remove redundant `Tool 'x'\nresult:` prefix

<details>
<summary>翻譯</summary>

- 將單體 `agents/exec.go` 拆分為 `exec/` 子套件，按職責分離各檔案
- 將共用型別（`Agent`、`Message`、`Session`、`AgentRegistry` 等）抽離至 `internal/agents/types` 套件
- 簡化 tool result 訊息格式，移除冗餘的 `Tool 'x'\nresult:` 前綴

</details>

### PERF
- Replace `int64` arithmetic in calculator with `big.Int` for exact integer precision
- Reduce Google RSS, Yahoo Finance, and general API timeouts from 30s to 5s
- Cap Google RSS deduplicated results at 10 entries

<details>
<summary>翻譯</summary>

- 計算器整數運算改用 `big.Int` 確保精確度
- Google RSS、Yahoo Finance 及一般 API 超時從 30 秒縮短至 5 秒
- Google RSS 去重後結果上限設為 10 筆

</details>

***

## Files Changed

| File | Status | Tag |
|------|--------|-----|
| `internal/agents/exec/execute.go` | Added | REFACTOR |
| `internal/agents/exec/run.go` | Added | REFACTOR |
| `internal/agents/exec/toolCall.go` | Added | REFACTOR |
| `internal/agents/exec/getSession.go` | Added | FIX |
| `internal/agents/exec/selectAgent.go` | Added | FEAT |
| `internal/agents/exec/selectSkill.go` | Added | REFACTOR |
| `internal/agents/exec/writeHistory.go` | Added | REFACTOR |
| `internal/agents/exec/extractSummary.go` | Added | REFACTOR |
| `internal/agents/types/agent.go` | Added | REFACTOR |
| `internal/agents/types/message.go` | Added | REFACTOR |
| `internal/agents/provider/compat/new.go` | Added | FEAT |
| `internal/agents/provider/compat/send.go` | Added | FEAT |
| `internal/tools/file/searchHistory.go` | Added | FEAT |
| `internal/agents/exec.go` | Deleted | REFACTOR |
| `internal/agents/prompt/sysPrompt.md` | Deleted | REFACTOR |
| `internal/agents/prompt/skillSelector.md` | Deleted | REFACTOR |
| `cmd/cli/main.go` | Modified | UPDATE |
| `internal/agents/provider/claude/send.go` | Modified | REFACTOR |
| `internal/agents/provider/copilot/send.go` | Modified | REFACTOR |
| `internal/agents/provider/gemini/send.go` | Modified | REFACTOR |
| `internal/agents/provider/nvidia/send.go` | Modified | REFACTOR |
| `internal/agents/provider/openai/send.go` | Modified | REFACTOR |
| `internal/tools/executor.go` | Modified | FEAT |
| `internal/tools/embed/tools.json` | Modified | UPDATE |
| `internal/tools/file/routes.go` | Modified | FEAT |
| `internal/tools/apis/searchWeb/SearchWeb.go` | Modified | UPDATE |
| `internal/tools/apis/searchWeb/fetchDDG.go` | Modified | UPDATE |
| `internal/tools/apis/googleRSS/fetch.go` | Modified | PERF |
| `internal/tools/calculator/calculate.go` | Modified | PERF |
| `internal/tools/browser/extract.go` | Modified | UPDATE |
| `README.md` | Modified | DOC |
| `README.zh.md` | Modified | DOC |
| `doc.md` | Modified | DOC |
| `doc.zh.md` | Modified | DOC |
| `.gitignore` | Modified | CHORE |
| `go.mod` | Modified | CHORE |
| `go.sum` | Modified | CHORE |

***

Generated by [SKILL](https://github.com/pardnchiu/skill-version-generate)
