chengyongru d4e34f8c67 fix(commands): intercept non-priority commands during active turn
Non-priority slash commands (e.g. /new, /help, /dream-log) arriving
while a session has an active LLM turn were silently queued into the
pending injection buffer and later injected as raw user messages into
the LLM conversation. This caused the model to respond to "/new" as
plain text instead of executing the command.

Root cause: the run() loop only checked priority commands (/stop,
/restart, /status) before routing messages to the pending queue. All
other command tiers (exact, prefix) bypassed command dispatch entirely.

Changes:
- Add CommandRouter.is_dispatchable_command() to match exact/prefix
  tiers, mirroring the existing is_priority() pattern.
- In run(), intercept dispatchable commands before pending queue
  insertion and dispatch them directly via _dispatch_command_inline().
- Extract _cancel_active_tasks() from cmd_stop for reuse; cmd_new now
  cancels active tasks before clearing the session to prevent shared
  mutable state corruption from concurrent asyncio coroutines.
- Update /new semantics: stops active task first, then clears session.
- Update documentation in help text, docs, and Discord command list.
2026-04-21 21:50:37 +08:00
..

nanobot Docs

For the latest documentation, visit nanobot.wiki.

The pages in this directory track the current repository and may move faster than the published website.

Core Docs

Start here for setup, everyday usage, and deployment.

Topic Repo docs What it covers
Install and quick start quick-start.md Installation, onboarding, and first-run setup
Chat apps chat-apps.md Connect nanobot to Telegram, Discord, WeChat, and more
Agent social network agent-social-network.md Join external agent communities from nanobot
Configuration configuration.md Providers, tools, channels, MCP, and runtime settings
Multiple instances multiple-instances.md Run isolated bots with separate configs and workspaces
CLI reference cli-reference.md Core CLI commands and common entrypoints
In-chat commands chat-commands.md Slash commands and periodic task behavior
OpenAI-compatible API openai-api.md Local API endpoints, request format, and file uploads
Deployment deployment.md Docker and Linux service setup

Advanced Docs

Use these when you want deeper customization, integration, or extension details.

Topic Repo docs What it covers
Memory memory.md How nanobot stores, consolidates, and restores memory
Python SDK python-sdk.md Use nanobot programmatically from Python
Channel plugin guide channel-plugin-guide.md Build and test custom chat channel plugins
WebSocket channel websocket.md Real-time WebSocket access and protocol details
Custom tools my-tool.md Inspect and tune runtime state with the my tool