fix: profile default workspace reads terminal.cwd; dropdown opens upward

1. _profile_default_workspace() now checks terminal.cwd
   Profile config.yaml files don't have a 'workspace' or 'default_workspace' key
   — they store the working directory as terminal.cwd (the hermes-agent CLI
   setting). Added it as the third fallback after 'workspace' and
   'default_workspace', so switching to camanji correctly resolves
   ~/Camanji, webui resolves ~/webui-mvp, etc.

2. Workspace dropdown opens upward (bottom: calc(100% + 4px))
   The dropdown is now anchored at the bottom of the sidebar. Opening it
   downward (top: 100%) caused it to clip off screen. Flipped to open upward
   with an upward shadow so it expands into the session list area instead.

Tests: 426 passed, 0 failed.
This commit is contained in:
Nathan Esquenazi
2026-04-03 19:47:38 +00:00
parent d4ab01c152
commit 3d8cf85ef2
2 changed files with 21 additions and 7 deletions

View File

@@ -53,17 +53,31 @@ def _last_workspace_file() -> Path:
def _profile_default_workspace() -> str: def _profile_default_workspace() -> str:
"""Read the profile's default workspace from its config.yaml. """Read the profile's default workspace from its config.yaml.
Checks keys in priority order:
1. 'workspace' — explicit webui workspace key
2. 'default_workspace' — alternate explicit key
3. 'terminal.cwd' — hermes-agent terminal working dir (most common)
Falls back to the boot-time DEFAULT_WORKSPACE constant. Falls back to the boot-time DEFAULT_WORKSPACE constant.
""" """
try: try:
from api.profiles import get_active_hermes_home
from api.config import get_config from api.config import get_config
cfg = get_config() cfg = get_config()
ws = cfg.get('default_workspace') # Explicit webui workspace keys first
if ws: for key in ('workspace', 'default_workspace'):
p = Path(ws).expanduser().resolve() ws = cfg.get(key)
if p.is_dir(): if ws:
return str(p) p = Path(str(ws)).expanduser().resolve()
if p.is_dir():
return str(p)
# Fall through to terminal.cwd — the agent's configured working directory
terminal_cfg = cfg.get('terminal', {})
if isinstance(terminal_cfg, dict):
cwd = terminal_cfg.get('cwd', '')
if cwd and str(cwd) not in ('.', ''):
p = Path(str(cwd)).expanduser().resolve()
if p.is_dir():
return str(p)
except (ImportError, Exception): except (ImportError, Exception):
pass pass
return str(_BOOT_DEFAULT_WORKSPACE) return str(_BOOT_DEFAULT_WORKSPACE)

View File

@@ -345,7 +345,7 @@
/* ── Workspace dropdown (topbar) ── */ /* ── Workspace dropdown (topbar) ── */
.ws-chip{user-select:none;} .ws-chip{user-select:none;}
.ws-dropdown{display:none;position:absolute;top:calc(100% + 4px);left:0;right:0;min-width:200px;background:#1a2535;border:1px solid var(--border2);border-radius:10px;box-shadow:0 8px 24px rgba(0,0,0,.4);z-index:200;overflow:hidden;max-height:320px;overflow-y:auto;} .ws-dropdown{display:none;position:absolute;bottom:calc(100% + 4px);left:0;right:0;min-width:200px;background:#1a2535;border:1px solid var(--border2);border-radius:10px;box-shadow:0 -4px 24px rgba(0,0,0,.4);z-index:200;overflow:hidden;max-height:320px;overflow-y:auto;}
.ws-dropdown.open{display:block;} .ws-dropdown.open{display:block;}
.ws-opt{padding:9px 14px;cursor:pointer;transition:background .12s;} .ws-opt{padding:9px 14px;cursor:pointer;transition:background .12s;}
.ws-opt:hover{background:rgba(255,255,255,.07);} .ws-opt:hover{background:rgba(255,255,255,.07);}