mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-15 04:12:25 +00:00
fix: include default profile in kanban assignees
This commit is contained in:
parent
fc4aa66ee4
commit
542e06c789
2 changed files with 32 additions and 22 deletions
|
|
@ -3277,30 +3277,38 @@ def read_worker_log(
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
def list_profiles_on_disk() -> list[str]:
|
def list_profiles_on_disk() -> list[str]:
|
||||||
"""Return the set of named profiles discovered on disk.
|
"""Return the set of assignee/profile names discovered on disk.
|
||||||
|
|
||||||
Reads ``~/.hermes/profiles/`` directly so this module has no import
|
Includes:
|
||||||
dependency on ``hermes_cli.profiles`` (which pulls in a large chunk
|
- named profiles under ``<default-root>/profiles/<name>/config.yaml``
|
||||||
of the CLI startup path). Only returns directories that contain a
|
- the implicit ``default`` profile when the default Hermes root exists
|
||||||
``config.yaml`` — a bare dir without config isn't a real profile.
|
|
||||||
|
Reads profile paths directly so this module has no import dependency on
|
||||||
|
``hermes_cli.profiles`` (which pulls in a large chunk of the CLI startup
|
||||||
|
path).
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
from hermes_constants import get_default_hermes_root
|
from hermes_constants import get_default_hermes_root
|
||||||
home = get_default_hermes_root() / "profiles"
|
default_root = get_default_hermes_root()
|
||||||
|
profiles_dir = default_root / "profiles"
|
||||||
except Exception:
|
except Exception:
|
||||||
return []
|
return []
|
||||||
if not home.is_dir():
|
|
||||||
return []
|
names: set[str] = set()
|
||||||
names: list[str] = []
|
if default_root.exists():
|
||||||
try:
|
names.add("default")
|
||||||
for entry in sorted(home.iterdir()):
|
|
||||||
if not entry.is_dir():
|
if profiles_dir.is_dir():
|
||||||
continue
|
try:
|
||||||
if (entry / "config.yaml").is_file():
|
for entry in sorted(profiles_dir.iterdir()):
|
||||||
names.append(entry.name)
|
if not entry.is_dir():
|
||||||
except OSError:
|
continue
|
||||||
return names
|
if (entry / "config.yaml").is_file():
|
||||||
return names
|
names.add(entry.name)
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return sorted(names)
|
||||||
|
|
||||||
|
|
||||||
def known_assignees(conn: sqlite3.Connection) -> list[dict]:
|
def known_assignees(conn: sqlite3.Connection) -> list[dict]:
|
||||||
|
|
|
||||||
|
|
@ -899,8 +899,8 @@ def test_migration_renames_legacy_event_kinds(tmp_path, monkeypatch):
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
def test_list_profiles_on_disk(tmp_path, monkeypatch):
|
def test_list_profiles_on_disk(tmp_path, monkeypatch):
|
||||||
"""list_profiles_on_disk returns directories under ~/.hermes/profiles/
|
"""list_profiles_on_disk returns the implicit default profile plus
|
||||||
that contain a config.yaml."""
|
named profiles under ~/.hermes/profiles/ that contain a config.yaml."""
|
||||||
monkeypatch.setattr(Path, "home", lambda: tmp_path)
|
monkeypatch.setattr(Path, "home", lambda: tmp_path)
|
||||||
monkeypatch.delenv("HERMES_HOME", raising=False)
|
monkeypatch.delenv("HERMES_HOME", raising=False)
|
||||||
profiles = tmp_path / ".hermes" / "profiles"
|
profiles = tmp_path / ".hermes" / "profiles"
|
||||||
|
|
@ -914,7 +914,7 @@ def test_list_profiles_on_disk(tmp_path, monkeypatch):
|
||||||
(profiles / "stray.txt").write_text("noise")
|
(profiles / "stray.txt").write_text("noise")
|
||||||
|
|
||||||
names = kb.list_profiles_on_disk()
|
names = kb.list_profiles_on_disk()
|
||||||
assert names == ["researcher", "writer"]
|
assert names == ["default", "researcher", "writer"]
|
||||||
|
|
||||||
|
|
||||||
def test_list_profiles_on_disk_custom_root(tmp_path, monkeypatch):
|
def test_list_profiles_on_disk_custom_root(tmp_path, monkeypatch):
|
||||||
|
|
@ -928,7 +928,7 @@ def test_list_profiles_on_disk_custom_root(tmp_path, monkeypatch):
|
||||||
(d / "config.yaml").write_text("model: {}\n")
|
(d / "config.yaml").write_text("model: {}\n")
|
||||||
|
|
||||||
names = kb.list_profiles_on_disk()
|
names = kb.list_profiles_on_disk()
|
||||||
assert names == ["researcher", "writer"]
|
assert names == ["default", "researcher", "writer"]
|
||||||
|
|
||||||
|
|
||||||
def test_known_assignees_merges_disk_and_board(tmp_path, monkeypatch):
|
def test_known_assignees_merges_disk_and_board(tmp_path, monkeypatch):
|
||||||
|
|
@ -955,6 +955,8 @@ def test_known_assignees_merges_disk_and_board(tmp_path, monkeypatch):
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
by_name = {d["name"]: d for d in data}
|
by_name = {d["name"]: d for d in data}
|
||||||
|
assert by_name["default"]["on_disk"] is True
|
||||||
|
assert by_name["default"]["counts"] == {}
|
||||||
assert by_name["researcher"]["on_disk"] is True
|
assert by_name["researcher"]["on_disk"] is True
|
||||||
assert by_name["researcher"]["counts"] == {}
|
assert by_name["researcher"]["counts"] == {}
|
||||||
assert by_name["writer"]["on_disk"] is True
|
assert by_name["writer"]["on_disk"] is True
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue