Skip to content

feat: Jev planner — TypeSafe System One 接進 session 推薦引擎(v1.7.0) - #14

Merged
JoshuaWangTW merged 1 commit into
masterfrom
feat/jev-planner
Sep 18, 2026
Merged

JoshuaWangTW merged 1 commit into
masterfrom
feat/jev-planner

Conversation

@JoshuaWangTW

Copy link
Copy Markdown
Owner

摘要

移植 browser-use/jev-ultrafast 的核心技術:「動態索引動作空間 + speculative fan-out」。RB 既有的 available_actions(stable action_id)就是那張索引元素表;本 PR 把決策引擎從啟發式換成 TypeSafe Jev(System One 模型),只推薦、不執行

  • session_start 新增 goal。每步 settle 後一次請求問 Jev 兩個 typed choice:operation(follow / submit_form / done / blocked,只列有候選的)與 target(依 operation 的 action_id 候選)。
  • 答案取代 loop.recommended_next_actions,附 calibrated confidence。新增 loop.plannerjev / heuristic)與 loop.planner_note(Jev 失敗原因)。
  • 驗證同 jev-ultrafast validate_choice:id 在候選內、分佈總和 ≈ 1、argmax 一致;任一不符 = 不推薦、退回啟發式。
  • 執行權仍在呼叫端;非 GET 表單照樣 dangerous。守 CLAUDE.md 紅線(不做完整 JS browser / 不自動執行)。
  • Env:TYPESAFE_API_KEY(無 key 帶 goal 回 invalid_params)、TYPESAFE_MODELTYPESAFE_ENDPOINT
  • 零新依賴(reqwest 未開 json feature,改手動 serde_json)。全部 additive,1.6.0 → 1.7.0;API.md、CHANGELOG 同步。

資料外送

goal 時每步送 {url, title, text ≤ 6000 字, elements(action_id/kind/label/dangerous), 最近 10 個 op}api.typesafe.ai。不帶 goal 行為與 1.6 完全相同。

驗證

  • cargo fmt --all -- --check / cargo clippy --all-targets -- -D warnings 通過
  • cargo test 全綠:84 unit(含 jev.rs 4 個離線測試)+ 15 session(新增 wiremock 假 Jev 端點測試:正常路徑取 form_0 confidence 0.85;端點死掉退回 heuristic 並附 note)
  • release 二進位 stdio 煙測 example.com 三路徑:
    • 無 goal → planner: heuristic
    • 有 goal 無 key → goal requires TYPESAFE_API_KEY in the MCP server environment
    • 有 goal 對本機假 Jev 端點 → planner: jev{"action_id":"link_0","confidence":0.88,"why":"jev: follow (p=0.90) → Learn more (p=1.00)"}
  • 測試抓到一個真 bug:request 只提供有候選的 operation,驗證卻硬用四個 → 抽 offered_operations() 共用。

未做

B 方案(session_run 自動 GET 迴圈)等拿到真 key 評估 Jev 判斷品質後再議。TypeSafe 目前 invite-only,尚無真實 key 實測。

🤖 Generated with Claude Code

….goal)

移植 browser-use/jev-ultrafast 的「動態索引動作空間 + speculative fan-out」:
RB 既有 available_actions 即為索引元素表,settle 後一次請求問 Jev 兩個
typed choice(operation / target),結果取代 heuristic 的
recommended_next_actions 並附 calibrated confidence。

- 新增 src/jev.rs:request 建構、答案驗證(同 validate_choice)、fallback
- Session::with_jev(cfg, goal);commit_settle() 後 refresh_jev(),失敗非致命,
  結果先算後寫,外層 step_budget 逾時不會留下半清空狀態
- LoopView 新增 planner(jev/heuristic)、planner_note;RecommendedAction.confidence?
- MCP session_start 新增 goal;無 TYPESAFE_API_KEY 回 invalid_params
- Env:TYPESAFE_API_KEY / TYPESAFE_MODEL / TYPESAFE_ENDPOINT
- 全部 additive;rebase 到 v1.7.0(real-world)之上,版本 1.7.0 → 1.8.0;API.md、CHANGELOG 同步
- .gitignore 補 /target-*(替代 target 目錄)

驗證(rebase 後重跑):fmt / clippy -D warnings / cargo test 全綠
(97 unit + 16 session,含新 wiremock 測試);release 二進位 stdio 煙測
example.com:無 goal → heuristic、有 goal 無 key → invalid_params、
有 goal 對假 Jev 端點 → planner=jev + confidence。

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@JoshuaWangTW
JoshuaWangTW merged commit 60a91a2 into master Sep 18, 2026
3 checks passed
@JoshuaWangTW
JoshuaWangTW deleted the feat/jev-planner branch September 18, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant