# v1.3.17 Release Notes

> v1.3.16 -> v1.3.17

## Summary

`fetch_page` now caches the original page and filters it against each task with the decision model at delivery, instead of cutting every page at 100 KiB; unrelated pages are withheld, long pages keep only related blocks, and pages over 1 MiB are checked within their first 1 MiB. `calculate` is rebuilt for exact and correctly ordered arithmetic, and the internal tool packages are reorganized around registration.

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

`fetch_page` 改為快取原始頁面，回傳前依每次的任務以 decision model 篩選，不再把每頁固定截在 100 KiB；無關的頁面會被排除，長頁面只留相關段落，超過 1 MiB 的頁面只在開頭 1 MiB 內查找。`calculate` 重寫為精確且運算順序正確的算術，內部工具套件也依註冊方式重新整理。

</details>

## Changes

### FIX

- Rebuild the `calculate` parser: `^` is now power with the highest precedence and right associativity (`2+3^2` = 11, `-2^2` = -4), integer results past int64 stay exact instead of clamping, literals are decimal only, fixed-arity functions reject extra arguments, NaN and Inf are errors, and `min`／`max`／`abs` keep large integers exact (@pardnchiu) [b45377ab]
- Fix `fetch_page` returning broken output: UTF-8 cut mid-character and JSON truncated into invalid JSON no longer happen, and normal pages whose URL contains `404`／`403`／`410` (e.g. `/wiki/HTTP_404`) are no longer reported as not found and blocked for 90 days; error pages are detected by HTTP status ≥ 400 or the error-page title list (@pardnchiu) [b2e0e486]
- Fix related pages being hidden: the whole-page relevance check no longer judges long pages by their opening only, so a page whose answer sits further down is returned instead of withheld (@pardnchiu) [b2e0e486]
- Fix `fetch_page` `keep_links` returning no links (markdown dropped every link with its text, json flattened link nodes) by upgrading go-browser to v0.3.5 (@pardnchiu) [b2e0e486]
- Fix GitHub Copilot `MAI Code 2`／`MAI Code 2 Flash` failing with `no model endpoints available`: models listing both `/chat/completions` and `/responses` now use `/responses`, by upgrading go-llm-router to v0.10.5 (@pardnchiu) [b2e0e486]

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

- 重寫 `calculate` 解析器：`^` 為次方、優先序最高且右結合（`2+3^2` = 11、`-2^2` = -4），超過 int64 的整數結果維持精確、不再被截到上限，只接受十進位字面值，固定參數的函式會拒絕多餘參數，NaN 與 Inf 視為錯誤，`min`／`max`／`abs` 保留大整數精度
- 修正 `fetch_page` 回傳壞掉的內容：不再切壞 UTF-8 字元、不再把 JSON 截成不合法格式；網址含 `404`／`403`／`410` 的正常頁面（如 `/wiki/HTTP_404`）不再被判為找不到並封鎖 90 天，錯誤頁改依 HTTP 狀態 ≥ 400 或錯誤頁標題判斷
- 修正相關頁面被隱藏：整頁相關性判斷不再只看長頁面的開頭，答案在後段的頁面會正常回傳
- 升級 go-browser 至 v0.3.5，修正 `fetch_page` 開啟 `keep_links` 時沒有任何連結（markdown 連同連結文字整段消失、json 的連結節點被攤平）
- 升級 go-llm-router 至 v0.10.5，修正 GitHub Copilot `MAI Code 2`／`MAI Code 2 Flash` 回 `no model endpoints available`：同時列出 `/chat/completions` 與 `/responses` 的模型改走 `/responses`

</details>

### UPDATE

- `fetch_page` caches the original page with only noise removed and filters it against the current task with the decision model on every delivery, fresh or cached: short pages are judged whole, longer pages keep only related blocks (tables and headings kept), a page with nothing related is withheld, and the 100 KiB cut is gone; markdown and json follow the same rules, with json cached as `{title, tree}` and returned as the node array (@pardnchiu) [b2e0e486]
- `fetch_page` pages over 1 MiB are checked within their first 1 MiB and keep only blocks that directly answer the task; if none do, the agent is told the site is too large and to use `download_file`; html over 1 MiB is refused (@pardnchiu) [b2e0e486]
- Rename tool parameters: `fetch_page` and `download_file` take `output_type` instead of `type`, and `download_file` takes `link` instead of `url`; MCP or script callers must send the new names (@pardnchiu) [b2e0e486]
- `download_file` streams to a temp file and renames it into place, `render=true` saves the full page with no size limit, and the result drops `ok` and `status_code` (@pardnchiu) [b2e0e486]
- `find_tools` ranks fallback tools (`search_web`, `fetch_page`, `download_file`, `http_request`, `generate_image`, `generate_audio`) after other matches and marks them `system_default`; `public_api_list` is hidden from `find_tools` listing (@pardnchiu) [ef898c1f]
- `generate_image` and `generate_audio` are registered in every process (TUI and CLI included), not only the daemon; upgrade go-pkg to v0.14.0 (@pardnchiu) [02d097aa, b2e0e486]

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

- `fetch_page` 快取只去除雜訊的原始頁面，每次回傳前（不論新抓或讀快取）依當下任務以 decision model 篩選：短頁整頁判斷，長頁只留相關段落（表格與標題保留），完全無關的頁面不回傳，並移除 100 KiB 截斷；markdown 與 json 規則相同，json 以 `{title, tree}` 快取、以節點陣列回傳
- `fetch_page` 超過 1 MiB 的頁面只在開頭 1 MiB 內查找，只保留直接回答任務的段落；找不到時告知網站太大並建議改用 `download_file`；超過 1 MiB 的 html 直接拒絕
- 工具參數改名：`fetch_page` 與 `download_file` 的 `type` 改為 `output_type`，`download_file` 的 `url` 改為 `link`；經 MCP 或腳本呼叫者需改用新名稱
- `download_file` 改為串流寫入暫存檔後再改名就位，`render=true` 整頁存檔不限大小，回傳移除 `ok` 與 `status_code`
- `find_tools` 將保底工具（`search_web`、`fetch_page`、`download_file`、`http_request`、`generate_image`、`generate_audio`）排在其他命中結果之後並標記 `system_default`；`public_api_list` 不再出現在 `find_tools` 清單
- `generate_image` 與 `generate_audio` 改在所有程序註冊（含 TUI 與 CLI），不再只限 daemon；go-pkg 升級至 v0.14.0

</details>

### DOC

- Align [`doc/doc`](https://github.com/pardnchiu/Agenvoy/blob/master/doc/doc.md), [`doc/architecture`](https://github.com/pardnchiu/Agenvoy/blob/master/doc/architecture.md) and [`doc/optimization`](https://github.com/pardnchiu/Agenvoy/blob/master/doc/optimization.md) with the current code, and add [`doc/decision/fetchPage`](https://github.com/pardnchiu/Agenvoy/blob/master/doc/decision/fetchPage.md) measuring `fetch_page` before and after decision filtering (@pardnchiu) [cc271264]

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

- [`doc/doc`](https://github.com/pardnchiu/Agenvoy/blob/master/doc/doc.zh.md)、[`doc/architecture`](https://github.com/pardnchiu/Agenvoy/blob/master/doc/architecture.zh.md)、[`doc/optimization`](https://github.com/pardnchiu/Agenvoy/blob/master/doc/optimization.zh.md) 對齊目前程式碼，並新增 [`doc/decision/fetchPage`](https://github.com/pardnchiu/Agenvoy/blob/master/doc/decision/fetchPage.zh.md)，實測 `fetch_page` 加入 decision 篩選前後的差異

</details>

## Scope

- `internal/tools/fetchPage/` — FIX, UPDATE, REFACTOR
- `internal/tools/calculate/` — FIX
- `internal/tools/` (root, `command/`, `cron/`, `searchWeb/`, `toolAdapter/`, `toolSkill/`, `register/`) — UPDATE, REFACTOR
- `internal/runtime/chatbot/tool/`, `internal/runtime/mcp/`, `internal/runtime/routes/handler/` — REFACTOR
- `internal/agents/exec/`, `internal/utils/`, `cmd/app/`, `configs/` — UPDATE, REFACTOR
- `go.mod` — FIX, UPDATE (go-browser v0.3.5, go-llm-router v0.10.5, go-pkg v0.14.0)
- `doc/` — DOC

---

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