重开仓库内容:改推五个技能(browser-harness / humanizer / humanizer-zh / product-planning / session-mechanism)
按授权清空原有内容后重新提交(原 oil-ui-pro 一并移出,可从历史恢复)。 browser-harness 剔除 .venv 等运行环境;根 .gitignore 补记 .venv/ 与 node_modules/。
This commit is contained in:
1 parent
9a152a1952
commit
777f7fe5d0
240 files changed
+52518
-4409
No files matched your search
@@ -0,0 +1,49 @@
|
||||
"""browser-harness filesystem layout."""
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def home_dir() -> Path:
|
||||
raw = os.environ.get("BH_HOME") or os.environ.get("BROWSER_HARNESS_HOME")
|
||||
if raw:
|
||||
return Path(raw).expanduser().resolve()
|
||||
base = os.environ.get("XDG_CONFIG_HOME")
|
||||
if base:
|
||||
return (Path(base).expanduser() / "browser-harness").resolve()
|
||||
return (Path.home() / ".config" / "browser-harness").resolve()
|
||||
|
||||
|
||||
def ensure_private_dir(path: Path) -> Path:
|
||||
existed = path.exists()
|
||||
path.mkdir(parents=True, exist_ok=True)
|
||||
if not existed and sys.platform != "win32":
|
||||
os.chmod(path, 0o700)
|
||||
return path
|
||||
|
||||
|
||||
def config_dir() -> Path:
|
||||
raw = os.environ.get("BH_CONFIG_DIR")
|
||||
return ensure_private_dir(Path(raw).expanduser().resolve() if raw else home_dir())
|
||||
|
||||
|
||||
def inspect_marker() -> Path:
|
||||
"""Marker recording that the harness opened a chrome://inspect tab"""
|
||||
return config_dir() / "inspect-opened"
|
||||
|
||||
|
||||
def runtime_dir() -> Path:
|
||||
raw = os.environ.get("BH_RUNTIME_DIR")
|
||||
return ensure_private_dir(Path(raw).expanduser().resolve() if raw else home_dir() / "runtime")
|
||||
|
||||
|
||||
def tmp_dir() -> Path:
|
||||
raw = os.environ.get("BH_TMP_DIR")
|
||||
return ensure_private_dir(Path(raw).expanduser().resolve() if raw else home_dir() / "tmp")
|
||||
|
||||
|
||||
def workspace_dir() -> Path:
|
||||
raw = os.environ.get("BH_AGENT_WORKSPACE")
|
||||
return ensure_private_dir(Path(raw).expanduser().resolve() if raw else home_dir() / "agent-workspace")
|
||||
Reference in new issue
Block a user