fix(onboarding): setup keeps what is already there
Reset run from the setup chat copied the setup profile's own skills onto itself after emptying them; it now copies from the launch profile, the rule primary_profile() already uses. A /initiate-setup re-sent into a stalled chat replaced the cards file and dropped the picks; it now refreshes the facts and keeps the answers.
This commit is contained in:
@@ -24,11 +24,12 @@ def build_initiate_setup_prompt(surface: str, tools, primary_profile: str, sessi
|
||||
"""The skill, then one JSON block of facts the model reads as they are. ``session_id``: the desktop session
|
||||
the turn runs in; its ``setup_choose`` cards read the same facts."""
|
||||
from hermes_cli.anon_auth import free_tier_route
|
||||
from hermes_cli.setup_profile import read_state, record_cards
|
||||
from hermes_cli.setup_profile import read_cards, read_state, record_cards
|
||||
|
||||
host = initiate_setup_facts.facts()
|
||||
if session_id:
|
||||
record_cards(session_id, initiate_setup_facts.setup_cards(host))
|
||||
# Kickoff re-sends the command into a stalled chat: keep the picks already recorded there.
|
||||
record_cards(session_id, {**read_cards(session_id), **initiate_setup_facts.setup_cards(host)})
|
||||
block = {
|
||||
"surface": surface,
|
||||
"tools_present": sorted(set(tools)),
|
||||
|
||||
@@ -88,12 +88,15 @@ def ensure_setup_profile() -> SetupProfile:
|
||||
return SetupProfile(name, path, created=True)
|
||||
|
||||
|
||||
def reset_setup_profile() -> SetupProfile:
|
||||
def reset_setup_profile(launch_home: Path) -> SetupProfile:
|
||||
found = find_setup_profile()
|
||||
if found is None:
|
||||
raise LookupError("no setup profile to reset")
|
||||
name, path = found
|
||||
# Reset can run on the setup profile's own backend; its skills then come from the launch profile.
|
||||
source = get_hermes_home()
|
||||
if (source / profiles_mod.SETUP_PROFILE_MARKER).is_file():
|
||||
source = launch_home
|
||||
_write_soul(path)
|
||||
_replace_dir(path / "memories")
|
||||
_write_setup_config(path)
|
||||
|
||||
@@ -75,7 +75,7 @@ def _(rid, params: dict) -> dict:
|
||||
return _err(rid, 4072, "no setup profile to reset")
|
||||
_clear_setup_sessions(found[1])
|
||||
try:
|
||||
setup = reset_setup_profile()
|
||||
setup = reset_setup_profile(_launch_home())
|
||||
except Exception as e:
|
||||
return _err(rid, 5074, str(e))
|
||||
return _ok(rid, {"name": setup.name, "path": str(setup.path), "reset": True})
|
||||
|
||||
Reference in New Issue
Block a user