合併: 工具呼叫改成 TurnTool trait
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
db9967e77e
|
|
@ -121,7 +121,7 @@
|
|||
- 做法:MCP 的 OAuth(PKCE+動態註冊),在大腦上跑,手機或電腦開瀏覽器完成登入,Token 存保險庫。
|
||||
- 做完:對一個測試用的 OAuth MCP 伺服器登入成功。
|
||||
|
||||
### M7. 拆開 agent::spawn、Tool trait 🚧(spawn 已經從 1797 行拆到 373 行、行為不變(937ca5c);Tool trait 還沒做:一個工具呼叫的 1400 行在 run_call,約 40 個 `if call.name == …` 共用 finish/started 兩個閉包和十幾個區域變數,要先改成一個 StepCx 物件帶 finish/started 方法,再把每一塊搬成 trait 的實作。這一步要再整段改寫一次,跟拆 spawn 分開做比較安全)
|
||||
### M7. 拆開 agent::spawn、Tool trait ✅(spawn 1797 → 373 行;一個工具呼叫的 1400 行拆成 src/agent/steps.rs 的 28 個 TurnTool,照原本的順序排在 TOOLS 裡,第一個 takes 的就 run;原本夾在中間的拒絕(看不懂的動作、沒有這個能力、技能的 allowed-tools、別人傳來的訊息)也是清單裡的一項,位置不變;最後一項 OnComputer 收下其他的。run_call 剩 146 行。工具的說明(spec)還是寫在各自的模組,trait 管的是一輪怎麼跑它們)
|
||||
- 做法:E9 之後,把工具執行改成一個 `Tool` trait(參數型別、說明、是否只看、執行),`spawn` 不再用一長串 if 分派。
|
||||
- 做完:行為不變,`agent.rs` 的 `spawn` 小於 500 行。
|
||||
|
||||
|
|
|
|||
1413
src/agent.rs
1413
src/agent.rs
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue