Skip to content

The agent that grows with you

feat(start_chat): a handoff from the setup profile marks onboarding complete

alt-glitchb3411f4d8c21
diff --git a/hermes_cli/setup_profile.py b/hermes_cli/setup_profile.py
index 585b904d1be..322da719439 100644
--- a/hermes_cli/setup_profile.py
+++ b/hermes_cli/setup_profile.py
@@ -5,6 +5,7 @@ import logging
import os
import random
import shutil
+from datetime import datetime, timezone
from pathlib import Path
from typing import Callable, NamedTuple, Optional
@@ -121,6 +122,11 @@ def mark_seen() -> dict:
return _change_state(lambda state: {**state, "intro": "seen"})
+def mark_completed() -> dict:
+ completed_at = datetime.now(timezone.utc).isoformat()
+ return _change_state(lambda state: {**state, "intro": "seen", "completed_at": completed_at})
+
+
def _free_setup_profile_name() -> str:
from hermes_cli.dashboard_register import _NAME_NOUNS
name = SETUP_PROFILE_NAME
diff --git a/tui_gateway/start_chat.py b/tui_gateway/start_chat.py
index 79c7a1a5206..6a25e934c25 100644
--- a/tui_gateway/start_chat.py
+++ b/tui_gateway/start_chat.py
@@ -11,6 +11,8 @@ def _rejected(reason: str) -> str:
def start_chat(args: dict) -> str:
from agent.onboarding import PROFILE_BUILD_FLAG, mark_seen
from gateway.session_context import get_session_env
+ from hermes_cli.profiles import SETUP_PROFILE_MARKER
+ from hermes_cli.setup_profile import mark_completed
from hermes_constants import profile_name_for_home
from tui_gateway import server
from tui_gateway.transport import bind_transport, reset_transport
@@ -18,6 +20,7 @@ def start_chat(args: dict) -> str:
caller = server._sessions.get(get_session_env("HERMES_UI_SESSION_ID", ""))
if caller is None:
return _rejected("start_chat works only from a chat in the Hermes desktop app.")
+ caller_home = Path(caller.get("profile_home") or server._hermes_home)
message = str(args.get("message") or "").strip()
if not message:
return _rejected("message is empty: pass the new chat's first message.")
@@ -29,6 +32,7 @@ def start_chat(args: dict) -> str:
home = server._profile_home(profile)
except server.ProfileUnavailableError as exc:
return _rejected(str(exc))
+ target_home = Path(home or server._hermes_home)
token = bind_transport(caller.get("transport"))
try:
with server._session_profile_runtime_scope({"profile_home": str(home) if home else None}):
@@ -37,13 +41,15 @@ def start_chat(args: dict) -> str:
if "error" in created:
return _rejected(created["error"]["message"])
result = created["result"]
- mark_seen(Path(home or server._hermes_home) / "config.yaml", PROFILE_BUILD_FLAG)
+ mark_seen(target_home / "config.yaml", PROFILE_BUILD_FLAG)
submitted = server._methods["prompt.submit"](None, {"session_id": result["session_id"], "text": message})
if "error" in submitted:
server._methods["session.close"](None, {"session_id": result["session_id"]})
return _rejected(submitted["error"]["message"])
finally:
reset_transport(token)
+ if (caller_home / SETUP_PROFILE_MARKER).is_file() and target_home.resolve() != caller_home.resolve():
+ mark_completed()
name = result["info"]["profile_name"]
return json.dumps({
"status": "started", "session_id": result["stored_session_id"], "profile": name, "title": title or None,
diff --git a/website/docs/reference/tools-reference.md b/website/docs/reference/tools-reference.md
index 67286d2a9a4..ef4f1f52dca 100644
--- a/website/docs/reference/tools-reference.md
+++ b/website/docs/reference/tools-reference.md
@@ -202,7 +202,7 @@ Enabled only when a profile's own config names it (`platform_toolsets.cli`). Onl
| Tool | Description | Requires environment |
|------|-------------|----------------------|
-| `start_chat` | Opens a new chat in the desktop app and sends `message` as its first user message. The calling chat shows a card with the new chat's title, its profile and an Open button; the app moves the user into the new chat only when they are watching the calling chat, otherwise the chat appears in the sidebar. The new chat starts with no history. `profile` must name an existing profile (it is never created); omitted, the chat runs in the caller's own profile. The new chat takes its settings from its own profile, never from the caller's. `title` (at most 40 characters) names the chat in the sidebar; omitted, the chat titles itself. Every call opens another chat: nothing de-duplicates a repeated call. The result is `started` with the new chat's `session_id` and `profile`, or `rejected` with a `reason` (unknown profile, empty message, title too long, not called from a desktop chat). | — |
+| `start_chat` | Opens a new chat in the desktop app and sends `message` as its first user message. The calling chat shows a card with the new chat's title, its profile and an Open button; the app moves the user into the new chat only when they are watching the calling chat, otherwise the chat appears in the sidebar. The new chat starts with no history. `profile` must name an existing profile (it is never created); omitted, the chat runs in the caller's own profile. The new chat takes its settings from its own profile, never from the caller's. `title` (at most 40 characters) names the chat in the sidebar; omitted, the chat titles itself. Every call opens another chat: nothing de-duplicates a repeated call. A `started` call from the desktop setup profile's chat into another profile marks onboarding complete. The result is `started` with the new chat's `session_id` and `profile`, or `rejected` with a `reason` (unknown profile, empty message, title too long, not called from a desktop chat). | — |
## `session_search` toolset