AnyBot/docs/restructure/notes/b02d-agent-4.md

19 lines
2.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# b02d agent.rs 2401-2671(步迴圈尾+輔助)
- attempt 迴圈接 got:Ok→room.last=Pictures 且 pictures_as_text→mark_pictures_too_costly(此 model 此後無圖,截圖轉文字);room.last=None;break。
- is_slow_start:make_room 一次再問(不收小→Error「對話已經收到最小…換快模型或 /compact」)。
- is_context_overflow:overflow_limit(<context_tokens)→job.context_tokens 收+StreamEvent::ContextLimit;pictures_read_as_text→make_room way=Pictures→room.pictures_as_text=as_text;None→Error still_too_long。
- 備用模型 D1:why_another_model+next_backup→providers::rest(base,model)(REST_SECS 分鐘休息);job.req 換 base_url/api_key/model(kind)/effort 清空、job.via=b.via;plan.quick_failed;Switched(line,via);line「改用 X 繼續(was:why,N 分鐘內先不用它)」。
- 其他 Err→close Failed+Error+return。
- out.tool_calls 逐筆:unwrapped_args({"data":…} 包法,依該 tool parameters.properties)→computer::expand_call→browser::expand_call(統一內部 per-action 名,守衛全用穩定名)。
- keep_to_chosen 每 call→moved(id→note)/runs_with(id→args)(聊天留原樣,執行用拉回的)。
- out.old_thinking_left_out→providers::forget_thinking(history)+ThinkingForgotten。
- Assistant Message{text,thinking,via,tool_calls,blocks,at}入 history。
- hush(提醒後的安靜步):is_done_mark/stopped_short;無 call 且(標或重複):無 steer 且未達上限→再 nudge(NUDGE 入 history,hush);無 steer→收尾;有 steer→continue。有內容→NextStep。
- 快速模型說完但動過東西→plan.recheck_answer→reuse_slot continue(quick 答案丟掉不顯示)。
- StepDone→plan.changed(非 only_looks 步)、changed_route;calls 空:Stop hook(MAX_STOP_CONTINUES 次;block→Retrying+「hook 要它接著做」user 訊息);說了就做 nudge(stopped_short→hush,MAX_IN_A_ROW/MAX_PER_TURN);steer 空→收尾(close Completed+Done+close_tabs+memory_note+learn);有 steer→continue。
- trouble Cell;previous(同一步兩個一模一樣點擊防重);逐 call run_call(Flow::End→return)。
- plan.after(trouble||switched);重播收尾:第k步出事→「後面的步驟沒有做…由你判斷」;做完→「共N步,確認真的做到了再回答」(附加在末 Tool 訊息文字,聊天看不到)。
- MAX_STEPS 用盡:NextStep+StepDone「(這次已經用了 {MAX_STEPS} 個步驟…回覆「繼續」)」+close Completed+Done。
- remote_vault_page:remote::run_on_device(host,vault::REMOTE_TOOL,args,via_name)→ok→page。remote_vault_login:login_secret_of→json{kind:login,username,password,site,profile,submit}+with_job(tag)→remote_vault_page→login_fill_text(密碼來源文字/新站記憶留本地)。
- 2672 起 #[cfg(test)] mod tests(3711 行,見 b02e)。