重构主控编排与运行时预热链路,统一工作区提示词/专家调度协议并补齐 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

@ -29,10 +29,19 @@ def materialize_executable_skill_tools(*, store: Any | None = None) -> list[Tool
def _handler(args: dict[str, Any], *, _manifest=m, _rt=rt) -> dict[str, Any]:
from oclaw.runtime.tools.skills_runtime.subprocess_exec import run_skill_runtime_entry
source_meta = {}
if isinstance(getattr(_manifest, "metadata_oclaw", None), dict):
source_raw = _manifest.metadata_oclaw.get("source")
if isinstance(source_raw, dict):
source_meta = {
"provider": str(source_raw.get("provider") or ""),
"version": str(source_raw.get("version") or ""),
"kind": str(source_raw.get("kind") or ""),
}
return run_skill_runtime_entry(
skill_name=str(_manifest.name or ""),
skill_dir=str(_manifest.skill_dir or ""),
runtime=dict(_rt),
runtime={**dict(_rt), "__source_meta": source_meta},
args=dict(args or {}),
)

View file

@ -211,7 +211,12 @@ def run_skill_runtime_entry(
roots = _resolve_allowed_roots(root)
perms = runtime.get("permissions") if isinstance(runtime.get("permissions"), dict) else {}
source_meta = runtime.get("__source_meta") if isinstance(runtime.get("__source_meta"), dict) else {}
fs_write = bool(perms.get("fs_write")) if isinstance(perms, dict) and "fs_write" in perms else False
allow_net = bool(perms.get("net")) if isinstance(perms, dict) and "net" in perms else False
allow_process = bool(perms.get("process")) if isinstance(perms, dict) and "process" in perms else True
if not allow_process:
return {"ok": False, "error_code": "process_disabled", "error": "process_execution_disabled_by_policy"}
try:
if not fs_write:
_deny_writes_when_disabled(args)
@ -220,7 +225,15 @@ def run_skill_runtime_entry(
return {"ok": False, "error_code": "path_restricted", "error": str(exc)}
timeout_s = float((runtime or {}).get("timeout_s") or 60.0)
stdin_json = {"skill": name, "args": args, "permissions": {"fs_write": fs_write}}
timeout_s = min(max(timeout_s, 1.0), 120.0)
max_output_bytes = int((runtime or {}).get("max_output_bytes") or 131072)
max_output_bytes = min(max(max_output_bytes, 1024), 1048576)
stdin_json = {
"skill": name,
"args": args,
"permissions": {"fs_write": fs_write, "net": allow_net, "process": allow_process},
"source": dict(source_meta),
}
try:
if tp == "python":
@ -240,8 +253,13 @@ def run_skill_runtime_entry(
"ok": bool(rr.ok),
"exit_code": int(rr.exit_code),
"duration_ms": int(rr.duration_ms),
"stdout": rr.stdout,
"stderr": rr.stderr,
"stdout": rr.stdout[:max_output_bytes],
"stderr": rr.stderr[:max_output_bytes],
"stdout_truncated": len(rr.stdout) > max_output_bytes,
"stderr_truncated": len(rr.stderr) > max_output_bytes,
"source_provider": str(source_meta.get("provider") or ""),
"source_version": str(source_meta.get("version") or ""),
"source_kind": str(source_meta.get("kind") or ""),
}
# Best-effort JSON decode for programmatic skills.
out_obj: Any = None