Files
hermes-agent/tools/start_chat_tool.py
alt-glitch e0e0505989 feat(start_chat): any desktop agent can start a visible chat through a native tool
The setup chat handed off to a new chat through about 600 lines of
renderer code that always built into the default profile. This adds
start_chat, a backend tool that does the same job for any desktop agent.

- tools/start_chat_tool.py registers start_chat (message; optional
  title of at most 40 characters; optional existing profile, default the
  caller's own). The handler late-imports tui_gateway.start_chat.
- tui_gateway/start_chat.py finds the calling session from
  HERMES_UI_SESSION_ID, rejects an empty message, a long title or an
  unknown profile, and never creates a profile. It creates the session
  with the caller's source and transport, inside the target profile's
  runtime scope, so the caller's display config does not leak into the
  new chat. It latches onboarding.seen.profile_build_offered in the
  target profile and submits the first message through prompt.submit.
  The call is not idempotent and keeps no receipt.
- The start_chat toolset is desktop sessions only (keyed on the session
  platform), not in "all", not in `hermes tools`, stays direct instead
  of deferring behind tool_search, and is blocked for subagents.
- Docs: toolsets and tools reference rows, and the subagent block list.
2026-09-30 12:00:50 +05:30

48 lines
1.6 KiB
Python

from tools.registry import registry
START_CHAT_SCHEMA = {
"name": "start_chat",
"description": (
"Start a new chat in the Hermes desktop app and send it its first message, so the task runs "
"there in view of the user while this chat stays where it is. Call it ONCE per task: every "
"call opens another chat, and nothing de-duplicates a repeated call. The new chat starts with "
"no history, so the message must carry everything the task needs. 'profile' must name an "
"existing profile; omit it to use this chat's own profile. The result is 'started' with the "
"new chat's session_id, or 'rejected' with a reason."
),
"parameters": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "The new chat's first user message: the whole task, self-contained.",
},
"title": {
"type": "string",
"maxLength": 40,
"description": "Sidebar title for the new chat, at most 40 characters. Omit it to let the chat title itself.",
},
"profile": {
"type": "string",
"description": "An existing profile to run the chat in. Omit it for this chat's own profile.",
},
},
"required": ["message"],
},
}
def _start_chat(args, **_kw):
from tui_gateway.start_chat import start_chat
return start_chat(args)
registry.register(
name="start_chat",
toolset="start_chat",
schema=START_CHAT_SCHEMA,
handler=_start_chat,
emoji="💬",
)