refactor(agent): remove ask_user tool

The ask_user tool used AskUserInterrupt(BaseException) for mid-turn
blocking, creating heavy coupling across runner, loop, and session
management. The model now asks questions naturally in response text,
the turn ends normally, and the user's next message starts a new turn
with session history providing continuity.

Removed:
- nanobot/agent/tools/ask.py (tool, interrupt, helpers)
- tests/agent/test_ask_user.py
- webui/src/components/thread/AskUserPrompt.tsx
- AskUserInterrupt handling in runner.py
- Dual-path message building in loop.py
- Pending ask detection via history scanning
- button_prompt/buttons emission in WebSocket channel
- ask_user references in Slack channel docstrings

Preserved (MessageTool uses these independently):
- OutboundMessage.buttons field
- Channel button rendering (Telegram, Slack, WebSocket)
This commit is contained in:
chengyongru
2026-05-12 22:48:26 +08:00
committed by Xubin Ren
parent 07f9ab580a
commit 9e15925cf4
16 changed files with 24 additions and 673 deletions
+4 -4
View File
@@ -11,7 +11,7 @@ Generate a personalized upgrade skill for this workspace.
Use `read_file` to check if `skills/update/SKILL.md` already exists in the workspace.
If it exists, use `ask_user` to ask: "An upgrade skill already exists. Reconfigure?" with options ["yes", "no"]. If no, stop here.
If it exists, ask the user: "An upgrade skill already exists. Reconfigure?" Wait for the user's reply. If no, stop here.
## Step 2: Current Version and Install Clues
@@ -38,9 +38,9 @@ answer or confirmation, not from inference alone. If you cannot get a clear
answer, stop and ask the user to rerun this setup when they know how nanobot was
installed.
Use `ask_user` for the questions below, one question per call. If `ask_user` is
not available or cannot collect the answer, ask in normal chat and stop without
writing the skill.
Ask the user the questions below, one at a time, in your response text. Wait for
the user's reply before proceeding to the next question. If you cannot get a clear
answer, stop without writing the skill.
**Question 1 — Install method:**