重构主控编排与运行时预热链路,统一工作区提示词/专家调度协议并补齐 wiki 记忆注入与写回闭环。

同时收敛启动与运维脚本默认行为(含 wiki worker)、更新 Admin 可观测性与相关测试,降低首轮时延并提高运行稳定性。

Made-with: Cursor
This commit is contained in:
oliver 2026-04-26 08:34:33 +08:00
parent 4a23b715a2
commit dbbe3add6a
14438 changed files with 2693620 additions and 2546 deletions

View file

@ -3,19 +3,41 @@ from __future__ import annotations
import subprocess
from typing import Any
from oclaw.platform.config.paths import db_path
from oclaw.platform.persistence.sqlite_store import SqliteStore
from oclaw.runtime.tools.base import ToolSpec
from oclaw.runtime.tools.experts.workspace.workspace_base import resolve_workspace_path, truncate_text
def run_command_tool() -> ToolSpec:
def _run_command_enabled() -> bool:
import os
try:
raw_setting = str(SqliteStore(db_path()).get_setting("AIA_ENABLE_RUN_COMMAND") or "").strip().lower()
if raw_setting in ("0", "false", "no", "off"):
return False
if raw_setting in ("1", "true", "yes", "on"):
return True
except Exception:
pass
raw_env = str(os.getenv("AIA_ENABLE_RUN_COMMAND") or "").strip().lower()
if raw_env in ("0", "false", "no", "off"):
return False
if raw_env in ("1", "true", "yes", "on"):
return True
# Default disabled when unset (explicit opt-in only).
return False
def handler(args: dict[str, Any]) -> dict[str, Any]:
import os
if str(os.getenv("AIA_ENABLE_RUN_COMMAND") or "").strip().lower() not in ("1", "true", "yes", "on"):
if not _run_command_enabled():
return {
"ok": False,
"error": "disabled",
"hint": "Set AIA_ENABLE_RUN_COMMAND=1 to enable this high-risk tool.",
"hint": "Enable run_command in Admin -> Plugins -> Tool Policy.",
}
command = str(args.get("command") or "").strip()
cwd = str(args.get("cwd") or "").strip()