fix: sync missing import os + stray } from darkplex-core PR #2 (YesMan)
All checks were successful
Tests / test (push) Successful in 4s
All checks were successful
Tests / test (push) Successful in 4s
This commit is contained in:
parent
47f9703e3b
commit
fda607c204
5 changed files with 34 additions and 16 deletions
|
|
@ -8,6 +8,7 @@ Usage:
|
|||
"""
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
|
|
@ -75,11 +76,11 @@ def check_nats() -> list[Alert]:
|
|||
def check_docker() -> list[Alert]:
|
||||
alerts = []
|
||||
rc, out, _ = _run(
|
||||
["ssh", "deploy@192.168.0.137", "docker ps --format '{{.Names}}|{{.Status}}'"],
|
||||
["ssh", os.environ.get("DARKPLEX_DOCKER_HOST", "deploy@localhost"), "docker ps --format '{{.Names}}|{{.Status}}'"],
|
||||
timeout=15,
|
||||
)
|
||||
if rc != 0:
|
||||
alerts.append(Alert("Docker", "warning", "Cannot reach dock5"))
|
||||
alerts.append(Alert("Docker", "warning", "Cannot reach Docker host"))
|
||||
return alerts
|
||||
|
||||
for line in out.strip().split("\n"):
|
||||
|
|
@ -143,7 +144,7 @@ def aggregate_all(quiet=False) -> list[Alert]:
|
|||
|
||||
for name, fn in checks:
|
||||
if not quiet:
|
||||
print(f"🔍 Checking {name}...", file=sys.stderr)
|
||||
logging.getLogger(__name__).info("Checking %s...", name)
|
||||
try:
|
||||
all_alerts.extend(fn())
|
||||
except Exception as e:
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ def fetch_events(hours: int = 1) -> list:
|
|||
return events
|
||||
info = json.loads(r.stdout)
|
||||
end_seq = info["state"]["last_seq"]
|
||||
start_seq = max(info["state"]["first_seq"], end_seq - 2000)
|
||||
start_seq = max(info["state"]["first_seq"], end_seq - 200)
|
||||
|
||||
for seq in range(start_seq, end_seq + 1):
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ Usage:
|
|||
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from datetime import datetime
|
||||
|
|
@ -16,14 +17,28 @@ from pathlib import Path
|
|||
|
||||
from cortex.config import cortex_home
|
||||
|
||||
AGENTS = {
|
||||
"main": {"name": "Claudia", "emoji": "🛡️", "stream": "openclaw-events"},
|
||||
"mondo-assistant": {"name": "Mona", "emoji": "🌙", "stream": "events-mondo-assistant"},
|
||||
"vera": {"name": "Vera", "emoji": "🔒", "stream": "events-vera"},
|
||||
"stella": {"name": "Stella", "emoji": "💰", "stream": "events-stella"},
|
||||
"viola": {"name": "Viola", "emoji": "⚙️", "stream": "events-viola"},
|
||||
# Default agents — override via DARKPLEX_AGENTS_CONFIG or agents.json in config dir
|
||||
_DEFAULT_AGENTS = {
|
||||
"main": {"name": "Main", "emoji": "🤖", "stream": "openclaw-events"},
|
||||
}
|
||||
|
||||
def _load_agents():
|
||||
"""Load agent config from file or env, fall back to defaults."""
|
||||
config_path = os.environ.get("DARKPLEX_AGENTS_CONFIG", "")
|
||||
if not config_path:
|
||||
config_dir = os.environ.get("DARKPLEX_CONFIG_DIR", os.path.expanduser("~/.darkplex"))
|
||||
config_path = os.path.join(config_dir, "agents.json")
|
||||
if os.path.exists(config_path):
|
||||
try:
|
||||
with open(config_path) as f:
|
||||
import json
|
||||
return json.load(f)
|
||||
except Exception:
|
||||
pass
|
||||
return _DEFAULT_AGENTS
|
||||
|
||||
AGENTS = _load_agents()
|
||||
|
||||
NATS_BIN = str(Path.home() / "bin" / "nats")
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ Usage:
|
|||
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from dataclasses import asdict, dataclass, field
|
||||
|
|
@ -97,9 +98,9 @@ def sense_context():
|
|||
details.append("BOOT_CONTEXT.md missing")
|
||||
|
||||
home = cortex_home()
|
||||
memory_md = home.parent / "clawd" / "MEMORY.md" if "cortex" not in str(home) else home / "MEMORY.md"
|
||||
memory_md = Path(os.environ.get("DARKPLEX_WORKSPACE", str(Path.home()))) / "MEMORY.md" if "cortex" not in str(home) else home / "MEMORY.md"
|
||||
# Try standard location
|
||||
for p in [Path.home() / "clawd" / "MEMORY.md", home / "MEMORY.md"]:
|
||||
for p in [Path(os.environ.get('DARKPLEX_WORKSPACE', os.environ.get('OPENCLAW_WORKSPACE', str(Path.home())))) / "MEMORY.md", home / "MEMORY.md"]:
|
||||
if p.exists():
|
||||
if p.stat().st_size < 100:
|
||||
score -= 0.3
|
||||
|
|
@ -119,7 +120,7 @@ def sense_context():
|
|||
def sense_health():
|
||||
score, details, healed, escalate = 1.0, [], [], []
|
||||
|
||||
rc, out, _ = _run_cmd(["systemctl", "--user", "is-active", "event-consumer"])
|
||||
rc, out, _ = _run_cmd(["systemctl", "--user", "is-active", os.environ.get("DARKPLEX_EVENT_SERVICE", "event-consumer")])
|
||||
if out.strip() != "active":
|
||||
score -= 0.3
|
||||
details.append("Event Consumer inactive")
|
||||
|
|
@ -154,7 +155,7 @@ def sense_energy():
|
|||
score, details = 1.0, []
|
||||
|
||||
total_ctx_bytes = 0
|
||||
clawd = Path.home() / "clawd"
|
||||
clawd = Path(os.environ.get('DARKPLEX_WORKSPACE', os.environ.get('OPENCLAW_WORKSPACE', str(Path.home()))))
|
||||
for f in ["SOUL.md", "AGENTS.md", "TOOLS.md", "MEMORY.md", "USER.md"]:
|
||||
p = clawd / f
|
||||
if p.exists():
|
||||
|
|
@ -189,7 +190,7 @@ def sense_connection():
|
|||
def sense_growth():
|
||||
score, details = 1.0, []
|
||||
|
||||
rag_db = Path.home() / "clawd" / ".rag-db" / "chroma.sqlite3"
|
||||
rag_db = Path(os.environ.get('DARKPLEX_WORKSPACE', os.environ.get('OPENCLAW_WORKSPACE', str(Path.home())))) / ".rag-db" / "chroma.sqlite3"
|
||||
if rag_db.exists():
|
||||
age_days = (datetime.now().timestamp() - rag_db.stat().st_mtime) / 86400
|
||||
if age_days > 14:
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ Usage:
|
|||
import argparse
|
||||
import base64
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
|
@ -17,7 +18,7 @@ from pathlib import Path
|
|||
from cortex.config import cortex_home
|
||||
|
||||
NATS_BIN = str(Path.home() / "bin" / "nats")
|
||||
OLLAMA_URL = "http://desktop01:11434/api/generate"
|
||||
OLLAMA_URL = os.environ.get("DARKPLEX_LLM_URL", "http://localhost:11434/api/generate")
|
||||
STREAM = "openclaw-events"
|
||||
|
||||
SUMMARY_PROMPT = """You are a personal assistant summarizing a day's conversations.
|
||||
|
|
|
|||
Loading…
Reference in a new issue