mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-10 04:00:44 +08:00
重构仓库目录为统一的 runtime 分层并清理历史 openclaw 残留。
本次迁移将网关/通道/工具/技能/脚本与协议资源集中到新结构,统一路径常量与脚本转发机制,减少顶层噪音并保证运行与测试行为一致。 Made-with: Cursor
This commit is contained in:
parent
ba3836f00f
commit
4a23b715a2
498 changed files with 2760 additions and 2200 deletions
|
|
@ -1,34 +0,0 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from oclaw.openclaw_runtime.hooks_runtime import resolve_runtime_config
|
||||
|
||||
|
||||
def test_resolve_runtime_config_from_env_json(monkeypatch) -> None:
|
||||
monkeypatch.setenv(
|
||||
"OPENCLAW_RUNTIME_CONFIG_JSON",
|
||||
json.dumps({"hooks": {"internal": {"enabled": False, "entries": {"x": {"enabled": False}}}}}),
|
||||
)
|
||||
monkeypatch.delenv("OPENCLAW_CONFIG_PATH", raising=False)
|
||||
cfg = resolve_runtime_config()
|
||||
assert ((cfg.get("hooks") or {}).get("internal") or {}).get("enabled") is False
|
||||
assert ((cfg.get("hooks") or {}).get("internal") or {}).get("entries", {}).get("x", {}).get("enabled") is False
|
||||
|
||||
|
||||
def test_resolve_runtime_config_from_config_path(monkeypatch, tmp_path: Path) -> None:
|
||||
cfg_path = tmp_path / "openclaw.custom.json"
|
||||
cfg_path.write_text(
|
||||
json.dumps({"hooks": {"internal": {"enabled": True, "entries": {"session-memory": {"messages": 99}}}}}),
|
||||
encoding="utf-8",
|
||||
)
|
||||
monkeypatch.delenv("OPENCLAW_RUNTIME_CONFIG_JSON", raising=False)
|
||||
monkeypatch.setenv("OPENCLAW_CONFIG_PATH", str(cfg_path))
|
||||
cfg = resolve_runtime_config()
|
||||
assert ((cfg.get("hooks") or {}).get("internal") or {}).get("enabled") is True
|
||||
assert (
|
||||
((cfg.get("hooks") or {}).get("internal") or {}).get("entries", {}).get("session-memory", {}).get("messages")
|
||||
== 99
|
||||
)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue