fix(webui): reconcile threads after browser resume

This commit is contained in:
chengyongru
2026-07-28 16:25:08 +08:00
committed by chengyongru
parent 78cf68c291
commit ae089aa3ae
39 changed files with 6151 additions and 243 deletions
+16 -1
View File
@@ -14,7 +14,7 @@ from typing import Literal
from nanobot import __version__
from nanobot.agent.goal_permission import goal_mutation_permission
from nanobot.bus.events import OutboundMessage
from nanobot.command.router import CommandContext, CommandRouter
from nanobot.command.router import CommandContext, CommandRouter, normalize_command_text
from nanobot.utils.helpers import build_status_content
from nanobot.utils.restart import set_restart_notice_to_env
from nanobot.utils.workspace_prompts import initialize_workspace_prompt
@@ -180,6 +180,21 @@ def builtin_command_palette() -> list[dict[str, str | bool]]:
return [spec.as_dict() for spec in BUILTIN_COMMAND_SPECS]
def builtin_command_starts_agent_turn(text: str) -> bool:
"""Return whether WebUI ingress should expect a normal agent lifecycle."""
normalized = normalize_command_text(text)
command, separator, args = normalized.partition(" ")
spec = next(
(item for item in BUILTIN_COMMAND_SPECS if item.command == command.lower()),
None,
)
if spec is None or (separator and not spec.accepts_args):
return True
if spec.lifecycle == "agent_turn":
return True
return spec.lifecycle == "agent_turn_with_args" and bool(args.strip())
async def cmd_stop(ctx: CommandContext) -> OutboundMessage:
"""Cancel all active tasks and subagents for the session."""
loop = ctx.loop