mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix: use display_hermes_home() for profile-aware paths in plugin env prompts
Follow-up to PR #5470. Replaces hardcoded ~/.hermes/.env references with display_hermes_home() for correct behavior under profiles. Also updates PluginManifest.requires_env type hint to List[Union[str, Dict[str, Any]]] to document the rich format introduced in #5470.
This commit is contained in:
parent
9201370c7e
commit
631d159864
2 changed files with 7 additions and 6 deletions
|
|
@ -36,7 +36,7 @@ import sys
|
|||
import types
|
||||
from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
from typing import Any, Callable, Dict, List, Optional, Set
|
||||
from typing import Any, Callable, Dict, List, Optional, Set, Union
|
||||
|
||||
from utils import env_var_enabled
|
||||
|
||||
|
|
@ -95,7 +95,7 @@ class PluginManifest:
|
|||
version: str = ""
|
||||
description: str = ""
|
||||
author: str = ""
|
||||
requires_env: List[str] = field(default_factory=list)
|
||||
requires_env: List[Union[str, Dict[str, Any]]] = field(default_factory=list)
|
||||
provides_tools: List[str] = field(default_factory=list)
|
||||
provides_hooks: List[str] = field(default_factory=list)
|
||||
source: str = "" # "user", "project", or "entrypoint"
|
||||
|
|
|
|||
|
|
@ -165,13 +165,14 @@ def _prompt_plugin_env_vars(manifest: dict, console) -> None:
|
|||
url: "https://acme.com/keys"
|
||||
secret: true
|
||||
|
||||
Already-set variables are skipped. Values are saved to ``~/.hermes/.env``.
|
||||
Already-set variables are skipped. Values are saved to the user's ``.env``.
|
||||
"""
|
||||
requires_env = manifest.get("requires_env") or []
|
||||
if not requires_env:
|
||||
return
|
||||
|
||||
from hermes_cli.config import get_env_value, save_env_value # noqa: F811
|
||||
from hermes_constants import display_hermes_home
|
||||
|
||||
# Normalise to list-of-dicts
|
||||
env_specs: list[dict] = []
|
||||
|
|
@ -209,15 +210,15 @@ def _prompt_plugin_env_vars(manifest: dict, console) -> None:
|
|||
else:
|
||||
value = input(f" {name}: ").strip()
|
||||
except (EOFError, KeyboardInterrupt):
|
||||
console.print("\n[dim] Skipped (you can set these later in ~/.hermes/.env)[/dim]")
|
||||
console.print(f"\n[dim] Skipped (you can set these later in {display_hermes_home()}/.env)[/dim]")
|
||||
return
|
||||
|
||||
if value:
|
||||
save_env_value(name, value)
|
||||
os.environ[name] = value
|
||||
console.print(f" [green]✓[/green] Saved to ~/.hermes/.env")
|
||||
console.print(f" [green]✓[/green] Saved to {display_hermes_home()}/.env")
|
||||
else:
|
||||
console.print(f" [dim] Skipped (set {name} in ~/.hermes/.env later)[/dim]")
|
||||
console.print(f" [dim] Skipped (set {name} in {display_hermes_home()}/.env later)[/dim]")
|
||||
|
||||
console.print()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue