-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpaths.py
More file actions
42 lines (31 loc) · 1.27 KB
/
Copy pathpaths.py
File metadata and controls
42 lines (31 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""Centralized path resolution for aiagentgres.
Replaces hardcoded `/root/aiagent/` paths. Direktori dasar bisa di-override
lewat env var `JAGRESMAN_HOME` (handy buat development di luar VPS).
"""
import os
from pathlib import Path
_DEFAULT_BASE = Path(__file__).resolve().parent
def _resolve_base() -> Path:
override = os.getenv("JAGRESMAN_HOME")
if override:
return Path(override).resolve()
return _DEFAULT_BASE
BASE_DIR: Path = _resolve_base()
SKILLS_DIR: Path = BASE_DIR / "skills"
TOOLS_DIR: Path = BASE_DIR / "tools"
OUTPUT_DIR: Path = BASE_DIR / "outputs"
OUTPUT_OFFICE_DIR: Path = BASE_DIR / "output_office"
LOGS_DIR: Path = BASE_DIR / "logs"
TMP_DIR: Path = BASE_DIR / "tmp"
DB_PATH: Path = BASE_DIR / "memory.db"
KNOWLEDGE_FILE: Path = BASE_DIR / "knowledge.txt"
SOUL_FILE: Path = BASE_DIR / "SOUL.md"
AGENTS_FILE: Path = BASE_DIR / "AGENTS.md"
PLAYWRIGHT_COOKIES: Path = BASE_DIR / "playwright_cookies.json"
def ensure_runtime_dirs() -> None:
"""Bikin direktori runtime kalau belum ada. Aman dipanggil berkali-kali."""
for d in (SKILLS_DIR, OUTPUT_DIR, OUTPUT_OFFICE_DIR, LOGS_DIR, TMP_DIR):
d.mkdir(parents=True, exist_ok=True)
def as_str(path: Path) -> str:
"""Convenience: dapetin path absolut sebagai string."""
return str(path)