Refactor LLM runtime handling and enhance CLI documentation
- Updated `resolve_llm_runtime` to prioritize live configuration over legacy notes, ensuring accurate runtime resolution. - Enhanced `tunnel_forwards` to prefer current configuration for LLM runtime, improving tunnel setup logic. - Improved idle-killer logic to handle stale markers and provide clearer warnings in the status output. - Updated CLI documentation in `cli.md` to reflect changes in command behavior and runtime handling. - Enhanced tests to validate new runtime resolution logic and ensure proper handling of configuration states.
This commit is contained in:
+33
-12
@@ -25,14 +25,17 @@ class AccessLink:
|
||||
|
||||
|
||||
def resolve_llm_runtime(cfg: Config) -> str:
|
||||
"""Live config wins; notes only if cfg is none (legacy session hint)."""
|
||||
runtime = normalize_runtime(cfg.llm_runtime)
|
||||
if runtime != "none":
|
||||
return runtime
|
||||
try:
|
||||
noted = (load_state().notes or {}).get("llm_runtime")
|
||||
if noted:
|
||||
runtime = normalize_runtime(str(noted))
|
||||
return normalize_runtime(str(noted))
|
||||
except Exception:
|
||||
pass
|
||||
return runtime
|
||||
return "none"
|
||||
|
||||
|
||||
def collect_access_links(cfg: Config, *, tunneled: bool) -> list[AccessLink]:
|
||||
@@ -141,17 +144,35 @@ def render_access_panel(
|
||||
if host:
|
||||
subtitle.append(f" · FIP {host}", style="dim")
|
||||
|
||||
body = Group(
|
||||
subtitle,
|
||||
Text(""),
|
||||
table,
|
||||
Text(""),
|
||||
Text("команды", style="bold"),
|
||||
cmds,
|
||||
Text(""),
|
||||
Text("Cursor MCP (вставь в mcp.json — файл сам не трогаем)", style="bold"),
|
||||
mcp,
|
||||
warn_bits: list[str] = []
|
||||
try:
|
||||
notes = load_state().notes or {}
|
||||
if notes.get("idle_killer") == "failed":
|
||||
warn_bits.append(
|
||||
"idle-killer НЕ вооружён — GPU может крутиться без авто-stop"
|
||||
)
|
||||
if notes.get("llm_error"):
|
||||
warn_bits.append(f"LLM ошибка: {str(notes['llm_error'])[:120]}")
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
parts: list = [subtitle, Text("")]
|
||||
if warn_bits:
|
||||
for w in warn_bits:
|
||||
parts.append(Text(f"⚠ {w}", style="bold red"))
|
||||
parts.append(Text(""))
|
||||
parts.extend(
|
||||
[
|
||||
table,
|
||||
Text(""),
|
||||
Text("команды", style="bold"),
|
||||
cmds,
|
||||
Text(""),
|
||||
Text("Cursor MCP (вставь в mcp.json — файл сам не трогаем)", style="bold"),
|
||||
mcp,
|
||||
]
|
||||
)
|
||||
body = Group(*parts)
|
||||
return Panel(
|
||||
body,
|
||||
title=f"[bold]{title}[/bold]",
|
||||
|
||||
Reference in New Issue
Block a user