The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(onboarding): the backend owns onboarding state and the setup profile carries only the beat tools
alt-glitchd8ddf5502286
diff --git a/apps/desktop/src/app/contrib/onboarding-kickoff.ts b/apps/desktop/src/app/contrib/onboarding-kickoff.tsindex 8f0ea9e2222..3ddee8ce194 100644--- a/apps/desktop/src/app/contrib/onboarding-kickoff.ts+++ b/apps/desktop/src/app/contrib/onboarding-kickoff.ts@@ -17,7 +17,7 @@ import { activeGatewayConnectionId, requestGatewayForProfile } from '@/store/gatimport { loadMachineProfile } from '@/store/machine'import { notify } from '@/store/notifications'import { readOnboardingCapabilities } from '@/store/onboarding-capabilities'-import { skipGuide } from '@/store/onboarding-gate'+import type { GuideKickoffResult } from '@/store/onboarding-gate'import { prefetchOnboardingPlugins } from '@/store/onboarding-plugins'import { buildChatOnboardingSeedMessages } from '@/store/onboarding-script'import {@@ -104,9 +104,9 @@ export function useOnboardingKickoff({resumeSession,runCreatePinnedTo}: OnboardingKickoffOptions) {- return useCallback(async (): Promise<boolean> => {+ return useCallback(async (): Promise<GuideKickoffResult> => {if (!isOnboardingEnabled()) {- return false+ return 'off'}const previousNewChatProfile = $newChatProfile.get()@@ -126,7 +126,7 @@ export function useOnboardingKickoff({const record = await requestGatewayForProfile<SetupStatus>(setupProfile, 'setup.status', {})if (record.ready !== true || record.provider_configured !== true) {- return false+ return 'off'}swapped = true@@ -150,7 +150,7 @@ export function useOnboardingKickoff({if (canonical?.id) {await adoptGuideSession(setupProfile, canonical, record.free_tier_route, resumeSession, guideRequest)- return true+ return 'started'}const capabilities = await readOnboardingCapabilities({@@ -198,14 +198,13 @@ export function useOnboardingKickoff({guideRequest)- return true+ return 'started'} catch (error) {$newChatProfile.set(previousNewChatProfile)$newChatRoute.set(previousNewChatRoute)$setupSession.set(previousSetupSession)$chatOnboardingThreadIds.set(previousThreadIds)endChatOnboardingSolo()- skipGuide()if (swapped) {await (@@ -224,7 +223,7 @@ export function useOnboardingKickoff({message: error instanceof Error ? error.message : 'The welcome chat could not start.'})- return false+ return 'failed'}}, [createBackendSessionForSend, requestGateway, resumeSession, runCreatePinnedTo])}diff --git a/apps/desktop/src/components/onboarding-chat/gate.tsx b/apps/desktop/src/components/onboarding-chat/gate.tsxindex 5c54f26ddad..64b01a3b96e 100644--- a/apps/desktop/src/components/onboarding-chat/gate.tsx+++ b/apps/desktop/src/components/onboarding-chat/gate.tsx@@ -1,5 +1,6 @@+import type { OnboardingStateResult } from '@hermes/shared'import { useStore } from '@nanostores/react'-import { useEffect, useLayoutEffect } from 'react'+import { useEffect } from 'react'import { endChatOnboardingSolo, takeGuideShape } from '@/components/onboarding-chat/assembly'import { isOnboardingEnabled } from '@/lib/onboarding-enabled'@@ -8,16 +9,17 @@ import { $desktopOnboarding, clearFreeTierIntro } from '@/store/onboarding'import {$guideOpening,$onboardingGate,+ abandonGuide,beginOnboardingFlow,- runGuideKickoff,- skipGuide+ type GuideKickoffResult,+ runGuideKickoff} from '@/store/onboarding-gate'import { GuideLoading } from './guide-loading'interface OnboardingChatGateProps {enabled: boolean- onKickoff: () => Promise<boolean>+ onKickoff: () => Promise<GuideKickoffResult>requestGateway: FreeTierRequester}@@ -25,13 +27,22 @@ export function OnboardingChatGate({ enabled, onKickoff, requestGateway }: Onboaconst gate = useStore($onboardingGate)const opening = useStore($guideOpening)- useLayoutEffect(() => {- beginOnboardingFlow($desktopOnboarding.get().firstRunSkipped)-- if ($onboardingGate.get().guideQueued) {- takeGuideShape()+ useEffect(() => {+ if (!enabled || !isOnboardingEnabled()) {+ return}- }, [])++ void requestGateway<OnboardingStateResult>('onboarding.state').then(+ state => {+ beginOnboardingFlow(state, $desktopOnboarding.get().firstRunSkipped)++ if ($onboardingGate.get().guideQueued) {+ takeGuideShape()+ }+ },+ error => console.warn('[onboarding] state could not be read', error)+ )+ }, [enabled, requestGateway])useEffect(() => {if (!enabled || !isOnboardingEnabled()) {@@ -56,16 +67,19 @@ export function OnboardingChatGate({ enabled, onKickoff, requestGateway }: OnboauseEffect(() => {if (enabled && gate.guideQueued) {- const recover = () => {+ const recover = (result: Exclude<GuideKickoffResult, 'started'>) => {endChatOnboardingSolo()- skipGuide()+ abandonGuide(result)}- void runGuideKickoff(onKickoff).then(started => {- if (!started) {- recover()- }- }, recover)+ void runGuideKickoff(onKickoff).then(+ result => {+ if (result !== 'started') {+ recover(result)+ }+ },+ () => recover('failed')+ )}}, [enabled, gate.guideQueued, onKickoff])diff --git a/apps/desktop/src/store/onboarding-gate.ts b/apps/desktop/src/store/onboarding-gate.tsindex 40b17f2b645..f22ff933389 100644--- a/apps/desktop/src/store/onboarding-gate.ts+++ b/apps/desktop/src/store/onboarding-gate.ts@@ -1,20 +1,16 @@+import type { OnboardingStateResult } from '@hermes/shared'import { atom, computed } from 'nanostores'import { isOnboardingEnabled } from '@/lib/onboarding-enabled'-import { readKey, writeKey } from '@/lib/storage'import { $gateway } from './gateway'import { DEFAULT_ANSWERS, setOnboardingAnswers } from './onboarding-answers'-const PHASE_KEY = 'hermes-onboarding-phase-v1'-export const ONBOARDING_PHASES = ['idle', 'pending', 'guided', 'skipped', 'handoff', 'done'] as constexport type OnboardingPhase = (typeof ONBOARDING_PHASES)[number]-function isOnboardingPhase(value: string | null): value is OnboardingPhase {- return ONBOARDING_PHASES.some(phase => phase === value)-}+export type GuideKickoffResult = 'started' | 'off' | 'failed'export interface OnboardingGateState {phase: OnboardingPhase@@ -22,21 +18,10 @@ export interface OnboardingGateState {guideKickoff: 'idle' | 'starting' | 'started'}-type GuideKickoff = { status: 'idle' } | { status: 'starting'; promise: Promise<boolean> } | { status: 'started' }--function loadGate(): OnboardingGateState {- const saved = readKey(PHASE_KEY)+type GuideKickoff =+ { status: 'idle' } | { status: 'starting'; promise: Promise<GuideKickoffResult> } | { status: 'started' }- const phase = isOnboardingEnabled() && isOnboardingPhase(saved) ? saved : 'idle'-- return {- phase,- guideQueued: phase === 'pending' || phase === 'guided',- guideKickoff: 'idle'- }-}--export const $onboardingGate = atom<OnboardingGateState>(loadGate())+export const $onboardingGate = atom<OnboardingGateState>({ phase: 'idle', guideQueued: false, guideKickoff: 'idle' })let guideKickoff: GuideKickoff = { status: 'idle' }export const $guideOpening = computed(@@ -51,18 +36,30 @@ function setGuideKickoff(state: GuideKickoff): void {}function setPhase(phase: OnboardingPhase): void {- writeKey(PHASE_KEY, phase === 'idle' ? null : phase)$onboardingGate.set({ ...$onboardingGate.get(), phase, guideQueued: false })}+function reportOnboarding(method: 'onboarding.mark_seen' | 'onboarding.record_failed_start'): void {+ void $gateway+ .get()+ ?.request(method, {})+ .catch(error => console.warn(`[onboarding] ${method} failed`, error))+}+export function guidedOnboardingActive(): boolean {const { phase } = $onboardingGate.get()return isOnboardingEnabled() && (phase === 'pending' || phase === 'guided' || phase === 'handoff')}-export function beginOnboardingFlow(firstRunSkipped: boolean): void {- if (!isOnboardingEnabled() || firstRunSkipped || $onboardingGate.get().phase !== 'idle') {+export function beginOnboardingFlow(state: OnboardingStateResult, firstRunSkipped: boolean): void {+ if (+ !isOnboardingEnabled() ||+ !state.eligible ||+ state.intro !== 'unseen' ||+ firstRunSkipped ||+ $onboardingGate.get().phase !== 'idle'+ ) {return}@@ -70,9 +67,9 @@ export function beginOnboardingFlow(firstRunSkipped: boolean): void {$onboardingGate.set({ ...$onboardingGate.get(), guideQueued: true })}-export function runGuideKickoff(kickoff: () => Promise<boolean>): Promise<boolean> {+export function runGuideKickoff(kickoff: () => Promise<GuideKickoffResult>): Promise<GuideKickoffResult> {if (!isOnboardingEnabled()) {- return Promise.resolve(false)+ return Promise.resolve('off')}if (guideKickoff.status === 'starting') {@@ -80,24 +77,24 @@ export function runGuideKickoff(kickoff: () => Promise<boolean>): Promise<boolea}if (guideKickoff.status === 'started') {- return Promise.resolve(true)+ return Promise.resolve('started')}if (!$onboardingGate.get().guideQueued) {- return Promise.resolve(false)+ return Promise.resolve('off')}const promise = Promise.resolve().then(kickoff).then(- started => {- setGuideKickoff({ status: started ? 'started' : 'idle' })+ result => {+ setGuideKickoff({ status: result === 'started' ? 'started' : 'idle' })- if (started && $onboardingGate.get().phase === 'pending') {+ if (result === 'started' && $onboardingGate.get().phase === 'pending') {setPhase('guided')}- return started+ return result},error => {setGuideKickoff({ status: 'idle' })@@ -116,6 +113,7 @@ export function beginOnboardingHandoff(): void {if (isOnboardingEnabled() && (phase === 'guided' || phase === 'skipped')) {setPhase('handoff')+ reportOnboarding('onboarding.mark_seen')}}@@ -130,6 +128,19 @@ export function skipGuide(): void {if (isOnboardingEnabled() && (phase === 'pending' || phase === 'guided')) {setPhase('skipped')+ reportOnboarding('onboarding.mark_seen')+ }+}++export function abandonGuide(result: Exclude<GuideKickoffResult, 'started'>): void {+ const { phase } = $onboardingGate.get()++ if (isOnboardingEnabled() && (phase === 'pending' || phase === 'guided')) {+ setPhase('skipped')++ if (result === 'failed') {+ reportOnboarding('onboarding.record_failed_start')+ }}}diff --git a/apps/desktop/src/store/onboarding-script.ts b/apps/desktop/src/store/onboarding-script.tsindex 483a614952c..687437a548d 100644--- a/apps/desktop/src/store/onboarding-script.ts+++ b/apps/desktop/src/store/onboarding-script.ts@@ -75,13 +75,6 @@ export const TOUR_OPTIONS = {tour: 'Show me everything'} as const-const PERSONA = [- 'WHO YOU ARE, in voice: the person at the front desk of somewhere good. Pleased they walked in, and not performing it. Quick, unhurried, never flustered. You make the next thing easy without making a production of it. You have opinions and you offer them lightly ("most people go with the second one"). You remember what they said and use it two beats later instead of repeating it back at them. A little dry humour is welcome when it lands on its own; never reach for it.',- 'What that is NOT: chirpy, eager, apologetic, or formal. Do not thank them for answering. Do not tell them their choice was a good one. Do not announce what you are about to do before doing it. Do not ask if they are ready.',- 'The feel of it, concretely. Say "Nice, that suits the rest of it." not "Great choice!". Say "Two seconds, I am moving things around you." not "I will now configure your workspace." Say "You said Notion earlier, so I will keep that one in mind." not "Thank you for sharing that you use Notion." Say "Right, what are we making." not "Now let us move on to the next step."',- 'You are allowed to be brief to the point of terse when the moment is just a card and a nudge. Most of these turns are one sentence. That is not coldness, it is not wasting their time, and it is the main way this reads as a person rather than a wizard.'-] as const-const QUESTION_CARDS = ['look', 'connectors', 'layout', 'first', 'handoff'].map(step => `::onboarding{step="${step}"}`)export function forkOptions(): string[] {@@ -119,7 +112,6 @@ export function buildChatOnboardingPrompt(suggestedName?: string | null, signedIreturn ["You are Hermes, and this is a brand-new user's very first conversation with you. Your job right now is to get the app arranged around them and their first real job started.",- ...PERSONA,FIRST_USE_GUIDANCE,capabilities,...(languagediff --git a/apps/shared/src/gateway-contract.generated.ts b/apps/shared/src/gateway-contract.generated.tsindex ededa92e195..6ee2c2c9a83 100644--- a/apps/shared/src/gateway-contract.generated.ts+++ b/apps/shared/src/gateway-contract.generated.ts@@ -2100,6 +2100,18 @@ export interface OnboardingEnsureSetupProfileResult {path: stringcreated: boolean}+export interface OnboardingEnsureSetupSessionResult {+ profile: string+ session_id: string+ empty: boolean+}+export interface OnboardingStateResult {+ eligible: boolean+ intro: OnboardingIntro+ failed_starts: number+ completed_at?: string | null+}+export type OnboardingIntro = 'unseen' | 'seen'export interface OnboardingResetSetupProfileResult {name: stringpath: string@@ -5102,8 +5114,12 @@ export interface RpcMethods {'model.save_key': { params: ModelSaveKeyParams; result: ModelSaveKeyResult }/** Create-or-read the backend-owned setup profile; the backend picks the name. */'onboarding.ensure_setup_profile': { params: Params; result: OnboardingEnsureSetupProfileResult }+ 'onboarding.ensure_setup_session': { params: Params; result: OnboardingEnsureSetupSessionResult }+ 'onboarding.mark_seen': { params: Params; result: OnboardingStateResult }+ 'onboarding.record_failed_start': { params: Params; result: OnboardingStateResult }/** Restore the setup profile to its created state in place (soul, memories, skills, sessions). */'onboarding.reset_setup_profile': { params: Params; result: OnboardingResetSetupProfileResult }+ 'onboarding.state': { params: Params; result: OnboardingStateResult }/** Spill a large paste to a file and hand back the inline placeholder. */'paste.collapse': { params: PasteCollapseParams; result: PasteCollapseResult }/** Render a PDF's pages to PNG and queue them as images for the next turn. */@@ -5498,7 +5514,11 @@ export const RPC_METHODS = ['model.options','model.save_key','onboarding.ensure_setup_profile',+ 'onboarding.ensure_setup_session',+ 'onboarding.mark_seen',+ 'onboarding.record_failed_start','onboarding.reset_setup_profile',+ 'onboarding.state','paste.collapse','pdf.attach','pet.cancel',diff --git a/apps/shared/src/gateway-contract.openrpc.json b/apps/shared/src/gateway-contract.openrpc.jsonindex b534cdedc9a..8c7a5548959 100644--- a/apps/shared/src/gateway-contract.openrpc.json+++ b/apps/shared/src/gateway-contract.openrpc.json@@ -1968,6 +1968,60 @@}}},+ {+ "name": "onboarding.ensure_setup_session",+ "summary": "",+ "params": [+ {+ "name": "params",+ "schema": {+ "$ref": "#/components/schemas/Params"+ }+ }+ ],+ "result": {+ "name": "result",+ "schema": {+ "$ref": "#/components/schemas/OnboardingEnsureSetupSessionResult"+ }+ }+ },+ {+ "name": "onboarding.mark_seen",+ "summary": "",+ "params": [+ {+ "name": "params",+ "schema": {+ "$ref": "#/components/schemas/Params"+ }+ }+ ],+ "result": {+ "name": "result",+ "schema": {+ "$ref": "#/components/schemas/OnboardingStateResult"+ }+ }+ },+ {+ "name": "onboarding.record_failed_start",+ "summary": "",+ "params": [+ {+ "name": "params",+ "schema": {+ "$ref": "#/components/schemas/Params"+ }+ }+ ],+ "result": {+ "name": "result",+ "schema": {+ "$ref": "#/components/schemas/OnboardingStateResult"+ }+ }+ },{"name": "onboarding.reset_setup_profile","summary": "Restore the setup profile to its created state in place (soul, memories, skills, sessions).",@@ -1986,6 +2040,24 @@}}},+ {+ "name": "onboarding.state",+ "summary": "",+ "params": [+ {+ "name": "params",+ "schema": {+ "$ref": "#/components/schemas/Params"+ }+ }+ ],+ "result": {+ "name": "result",+ "schema": {+ "$ref": "#/components/schemas/OnboardingStateResult"+ }+ }+ },{"name": "paste.collapse","summary": "Spill a large paste to a file and hand back the inline placeholder.",@@ -19648,6 +19720,38 @@"title": "OnboardingEnsureSetupProfileResult","type": "object"},+ "OnboardingEnsureSetupSessionResult": {+ "additionalProperties": false,+ "properties": {+ "profile": {+ "title": "Profile",+ "type": "string"+ },+ "session_id": {+ "title": "Session Id",+ "type": "string"+ },+ "empty": {+ "title": "Empty",+ "type": "boolean"+ }+ },+ "required": [+ "profile",+ "session_id",+ "empty"+ ],+ "title": "OnboardingEnsureSetupSessionResult",+ "type": "object"+ },+ "OnboardingIntro": {+ "enum": [+ "unseen",+ "seen"+ ],+ "title": "OnboardingIntro",+ "type": "string"+ },"OnboardingResetSetupProfileResult": {"additionalProperties": false,"properties": {@@ -19672,6 +19776,41 @@"title": "OnboardingResetSetupProfileResult","type": "object"},+ "OnboardingStateResult": {+ "additionalProperties": false,+ "properties": {+ "eligible": {+ "title": "Eligible",+ "type": "boolean"+ },+ "intro": {+ "$ref": "#/components/schemas/OnboardingIntro"+ },+ "failed_starts": {+ "title": "Failed Starts",+ "type": "integer"+ },+ "completed_at": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Completed At"+ }+ },+ "required": [+ "eligible",+ "intro",+ "failed_starts"+ ],+ "title": "OnboardingStateResult",+ "type": "object"+ },"OpenRequestEntry": {"additionalProperties": false,"description": "One unanswered server\u2192client request (``server_requests.Request.snapshot``); the reconnecting\nclient re-delivers it to its request handlers.",diff --git a/hermes_cli/anon_auth.py b/hermes_cli/anon_auth.pyindex 3161c21229f..919ff0d7a72 100644--- a/hermes_cli/anon_auth.py+++ b/hermes_cli/anon_auth.py@@ -47,7 +47,7 @@ ANON_SECRET_HEADER = "x-anonymous-api-secret"ANON_SECRET_ENV = "HERMES_ANON_API_SECRET"# Launch gate for the whole free tier while it is pre-GA: exactly "1" turns it on for this process# (CLI, gateway, serve backend alike); anything else leaves every surface behaving as if the free-# tier did not exist. ``guest_enabled`` is the only reader. Not a user preference: never written to+# tier did not exist. Not a user preference: never written to# config.yaml or .env, never shown in setup. Deleted at GA together with this comment.GUEST_ONBOARDING_ENV = "HERMES_GUEST_ONBOARDING"GUEST_MINT_TIMEOUT_SECONDS = 5.0@@ -142,7 +142,7 @@ def anon_failure_copy(code: str, *, retry_after: Any = None) -> str:def guest_enabled() -> bool:"""The free tier is on for this process: the launch gate is set AND ``nous.guest`` (default- True) has not switched it off. The only place either is read."""+ True) has not switched it off."""if (os.environ.get(GUEST_ONBOARDING_ENV) or "").strip() != "1":return Falsetry:diff --git a/hermes_cli/setup_profile.py b/hermes_cli/setup_profile.pyindex fe5914bc93a..51fcb46756a 100644--- a/hermes_cli/setup_profile.py+++ b/hermes_cli/setup_profile.py@@ -1,10 +1,12 @@from __future__ import annotations+import jsonimport logging+import osimport randomimport shutilfrom pathlib import Path-from typing import NamedTuple, Optional+from typing import Callable, NamedTuple, Optionalfrom hermes_cli import profiles as profiles_modfrom hermes_constants import get_hermes_home@@ -13,6 +15,15 @@ logger = logging.getLogger(__name__)SETUP_PROFILE_NAME = "hermes-setup"SETUP_PROFILE_DESCRIPTION = "Where Hermes met you — walks your first run, then checks in as you find your feet."+SETUP_CHAT_TITLE = "Welcome to Hermes"+MAX_FAILED_STARTS = 3+_FRESH_STATE = {"intro": "unseen", "failed_starts": 0}+_SETUP_TOOLSETS = ["setup", "start_chat", "no_mcp"]+_SETUP_DEFERRED_TOOLS = [+ "computer_use", "session_search", "image_generate", "todo_list", "process_manage", "cronjob_manage",+ "drive_preview", "gui_tour", "desktop_preview", "annotate_preview", "show_tip", "desktop_project",+ "close_terminal", "read_terminal", "read_window_below", "focus_pane", "react_to_message",+]SETUP_SOUL = "\n".join(["# Hermes",@@ -61,8 +72,9 @@ def ensure_setup_profile() -> SetupProfile:path = profiles_mod.create_profile(name, clone_config=True, no_alias=True, description=SETUP_PROFILE_DESCRIPTION)try:_write_soul(path)- _enable_setup_toolset(path)- (path / profiles_mod.SETUP_PROFILE_MARKER).write_text("{}\n", encoding="utf-8")+ _replace_dir(path / "memories")+ _write_setup_config(path)+ _write_state(path, _FRESH_STATE)except BaseException:profiles_mod.delete_profile(name, yes=True)raise@@ -77,15 +89,37 @@ def reset_setup_profile() -> SetupProfile:source = get_hermes_home()_write_soul(path)_replace_dir(path / "memories")- for relpath in profiles_mod._CLONE_SUBDIR_FILES:- profiles_mod._clone_file(source, path, relpath)+ _write_setup_config(path)_replace_dir(path / "skills")if (source / "skills").is_dir():profiles_mod._copytree_keep_junctions(source / "skills", path / "skills",profiles_mod._non_exportable_entries, dirs_exist_ok=True)+ _write_state(path, _FRESH_STATE)return SetupProfile(name, path, created=False)+def onboarding_eligible() -> bool:+ from hermes_cli.anon_auth import GUEST_ONBOARDING_ENV+ return os.environ.get(GUEST_ONBOARDING_ENV, "").strip() == "1"+++def read_state() -> dict:+ found = find_setup_profile()+ return dict(_FRESH_STATE) if found is None else _read_state(found[1])+++def record_failed_start() -> dict:+ def change(state: dict) -> dict:+ failed = min(state["failed_starts"] + 1, MAX_FAILED_STARTS)+ return {**state, "failed_starts": failed,+ "intro": "seen" if failed == MAX_FAILED_STARTS else state["intro"]}+ return _change_state(change)+++def mark_seen() -> dict:+ return _change_state(lambda state: {**state, "intro": "seen"})++def _free_setup_profile_name() -> str:from hermes_cli.dashboard_register import _NAME_NOUNSname = SETUP_PROFILE_NAME@@ -94,16 +128,32 @@ def _free_setup_profile_name() -> str:return name-def _enable_setup_toolset(path: Path) -> None:+def _change_state(change: Callable[[dict], dict]) -> dict:+ found = find_setup_profile()+ if found is None:+ return dict(_FRESH_STATE)+ state = change(_read_state(found[1]))+ _write_state(found[1], state)+ return state+++def _read_state(path: Path) -> dict:+ return json.loads((path / profiles_mod.SETUP_PROFILE_MARKER).read_text(encoding="utf-8"))+++def _write_state(path: Path, state: dict) -> None:+ from utils import atomic_json_write+ atomic_json_write(path / profiles_mod.SETUP_PROFILE_MARKER, state)+++def _write_setup_config(path: Path) -> None:from hermes_cli.config import atomic_config_write, read_user_config_raw- from hermes_cli.tools_config import _coerce_platform_toolsets_value, _platform_default_toolsetconfig_path = path / "config.yaml"config = read_user_config_raw(config_path)- platform_toolsets = config.get("platform_toolsets") or {}- cli = _coerce_platform_toolsets_value(platform_toolsets.get("cli"), "cli")- if not isinstance(cli, list):- cli = [_platform_default_toolset("cli")]- config["platform_toolsets"] = {**platform_toolsets, "cli": list(dict.fromkeys([*cli, "setup"]))}+ tools = config.get("tools") or {}+ config["platform_toolsets"] = {**(config.get("platform_toolsets") or {}), "cli": list(_SETUP_TOOLSETS)}+ config["tools"] = {**tools, "tool_search": {**(tools.get("tool_search") or {}), "defer": list(_SETUP_DEFERRED_TOOLS)}}+ config["display"] = {**(config.get("display") or {}), "show_reasoning": False}atomic_config_write(config_path, config)diff --git a/tui_gateway/contracts/profiles_vault_complete_foreign_subagents.py b/tui_gateway/contracts/profiles_vault_complete_foreign_subagents.pyindex 93ed973c498..170270ee1bc 100644--- a/tui_gateway/contracts/profiles_vault_complete_foreign_subagents.py+++ b/tui_gateway/contracts/profiles_vault_complete_foreign_subagents.py@@ -393,6 +393,32 @@ method("onboarding.ensure_setup_profile", params=Params, result=OnboardingEnsuredoc="Create-or-read the backend-owned setup profile; the backend picks the name.")+class OnboardingEnsureSetupSessionResult(Result):+ profile: str+ session_id: str+ empty: bool+++method("onboarding.ensure_setup_session", params=Params, result=OnboardingEnsureSetupSessionResult)+++class OnboardingIntro(WireEnum):+ unseen = "unseen"+ seen = "seen"+++class OnboardingStateResult(Result):+ eligible: bool+ intro: OnboardingIntro+ failed_starts: int+ completed_at: str | None = None+++method("onboarding.state", params=Params, result=OnboardingStateResult)+method("onboarding.record_failed_start", params=Params, result=OnboardingStateResult)+method("onboarding.mark_seen", params=Params, result=OnboardingStateResult)++class OnboardingResetSetupProfileResult(Result):name: strpath: strdiff --git a/tui_gateway/methods_onboarding.py b/tui_gateway/methods_onboarding.pyindex 357fdcbced5..4438f9d39f6 100644--- a/tui_gateway/methods_onboarding.py+++ b/tui_gateway/methods_onboarding.py@@ -16,6 +16,45 @@ def _(rid, params: dict) -> dict:return _ok(rid, {"name": setup.name, "path": str(setup.path), "created": setup.created})+@method("onboarding.ensure_setup_session")+def _(rid, params: dict) -> dict:+ from hermes_cli.setup_profile import SETUP_CHAT_TITLE, ensure_setup_profile+ from hermes_state_registry import acquire, release_or_close+ try:+ setup = ensure_setup_profile()+ if setup.created:+ _mirror_launch_credentials(setup.path, {"share_auth": True})+ db = acquire(setup.path / "state.db")+ try:+ row = db.get_session_by_title(SETUP_CHAT_TITLE)+ if row is None:+ row = {"id": db.create_session(new_session_id(), "desktop"), "message_count": 0}+ db.set_session_title(row["id"], SETUP_CHAT_TITLE)+ finally:+ release_or_close(db)+ except Exception as e:+ return _err(rid, 5075, str(e))+ return _ok(rid, {"profile": setup.name, "session_id": row["id"], "empty": not row["message_count"]})+++@method("onboarding.state")+def _(rid, params: dict) -> dict:+ from hermes_cli.setup_profile import read_state+ return _onboarding_state_result(rid, read_state)+++@method("onboarding.record_failed_start")+def _(rid, params: dict) -> dict:+ from hermes_cli.setup_profile import record_failed_start+ return _onboarding_state_result(rid, record_failed_start)+++@method("onboarding.mark_seen")+def _(rid, params: dict) -> dict:+ from hermes_cli.setup_profile import mark_seen+ return _onboarding_state_result(rid, mark_seen)++@method("onboarding.reset_setup_profile")def _(rid, params: dict) -> dict:from hermes_cli.setup_profile import find_setup_profile, reset_setup_profile@@ -30,6 +69,15 @@ def _(rid, params: dict) -> dict:return _ok(rid, {"name": setup.name, "path": str(setup.path), "reset": True})+def _onboarding_state_result(rid, change) -> dict:+ from hermes_cli.setup_profile import onboarding_eligible+ try:+ state = change()+ except Exception as e:+ return _err(rid, 5076, str(e))+ return _ok(rid, {"eligible": onboarding_eligible(), **state})++def _clear_setup_sessions(profile_dir) -> None:target = Path(profile_dir).resolve()with _sessions_lock: