hermes-agent/tui_gateway/onboarding_personalization.py
Siddharth Balyan d9d122a003
refactor(onboarding): remove the intro cinematic, the guided-onboarding tests, and their comments (#126139)
* refactor(desktop): remove the onboarding intro cinematic and the guided-onboarding tests

The guided first run now opens straight into the guide: the gate's
`cinematic` phase becomes `pending`, and OnboardingChatGate owes the guide
on mount (the old HERMES_SKIP_INTRO path, now the only path). Removes the
native intro window, its IPC bridge, the `?win=intro` renderer, its assets,
and the skipIntro launch flag. Deletes the guided-onboarding test files ahead
of the rewrite, plus the reset helpers only they called.

* refactor(onboarding): strip comments from the guided-onboarding modules

Clears comments and docstrings from the guided-onboarding files ahead of
their rewrite, desktop and backend. Lint and type pragmas stay. No code
changes.
2026-09-28 08:33:43 +00:00

41 lines
2.2 KiB
Python

import json
from hermes_constants import reset_hermes_home_override, set_hermes_home_override
from hermes_cli.profiles import get_profile_dir
from tools.memory_tool import load_on_disk_store, memory_tool
def remember_onboarding(answers: dict) -> dict:
if not isinstance(answers, dict):
raise ValueError('Onboarding answers must be an object')
facts = []
for key, label in (('name', 'User prefers to be called'), ('context', 'Working on'),
('theme', 'Desktop theme'), ('accent', 'Desktop accent'), ('layout', 'Desktop layout')):
value = answers.get(key)
if value is not None and not isinstance(value, str):
raise ValueError(f'{key} must be text')
if value and value.strip():
facts.append(f'{label}: {value.strip()}')
for key, label in (('focus', 'Focus areas'), ('connectors', 'Tools the user uses (not connection status)'),
('plugins', 'Hermes plugins the user picked during onboarding (not install status)')):
values = answers.get(key, [])
if not isinstance(values, list) or not all(isinstance(value, str) for value in values):
raise ValueError(f'{key} must be a list of text')
if values := list(dict.fromkeys(value.strip() for value in values if value.strip())):
facts.append(f'{label}: {", ".join(values)}')
if not facts:
return {'saved': True, 'profile': 'default', 'target': 'user'}
content = 'Agreed during onboarding:\n' + '\n'.join(facts)
if len(content) > 2000:
raise ValueError('Onboarding facts are too long to remember')
token = set_hermes_home_override(get_profile_dir('default'))
try:
result = json.loads(memory_tool(action='add', target='user', content=content, store=load_on_disk_store()))
if not result.get('success') or result.get('staged'):
raise ValueError(result.get('error') or result.get('message') or 'Memory was not saved')
if content not in load_on_disk_store().user_entries:
raise ValueError('Could not verify saved onboarding facts')
return {'saved': True, 'profile': 'default', 'target': 'user'}
finally:
reset_hermes_home_override(token)