mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 05:50:44 +08:00
重构主控编排与运行时预热链路,统一工作区提示词/专家调度协议并补齐 wiki 记忆注入与写回闭环。
同时收敛启动与运维脚本默认行为(含 wiki worker)、更新 Admin 可观测性与相关测试,降低首轮时延并提高运行稳定性。 Made-with: Cursor
This commit is contained in:
parent
4a23b715a2
commit
dbbe3add6a
14438 changed files with 2693620 additions and 2546 deletions
|
|
@ -23,6 +23,7 @@ from oclaw.runtime.tools.tool_validation import validate_tool_arguments
|
|||
from oclaw.runtime.tools.experts.workspace.workspace_base import workspace_path_access_scope
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
_tool_exec_log = logging.getLogger("oclaw.tool_exec")
|
||||
|
||||
_TOOL_ERROR_MAP = {
|
||||
"tool_timeout_or_failed": "tool_timeout_or_failed",
|
||||
|
|
@ -275,13 +276,43 @@ class ToolExecutor:
|
|||
ex.shutdown(wait=False)
|
||||
else:
|
||||
result = _call()
|
||||
return normalize_tool_result(result), int((time.perf_counter() - t0) * 1000)
|
||||
out = normalize_tool_result(result)
|
||||
dur_ms = int((time.perf_counter() - t0) * 1000)
|
||||
try:
|
||||
_tool_exec_log.info(
|
||||
"tool_exec name=%s ok=%s dur_ms=%s session=%s specialist=%s tool_call_id=%s error_code=%s",
|
||||
str(tc.name or ""),
|
||||
str(bool(out.get("ok"))),
|
||||
str(dur_ms),
|
||||
str(ctx.session_id or ""),
|
||||
str(ctx.specialist or ""),
|
||||
str(getattr(tc, "id", "") or ""),
|
||||
str(out.get("error_code") or ""),
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
return out, dur_ms
|
||||
except Exception as e:
|
||||
if ctx.lang.startswith("en"):
|
||||
err = {"ok": False, "error_code": "tool_execution_error", "error": f"Tool execution error: {type(e).__name__}: {e}"}
|
||||
else:
|
||||
err = {"ok": False, "error_code": "tool_execution_error", "error": f"工具执行异常: {type(e).__name__}: {e}"}
|
||||
return normalize_tool_result(err), int((time.perf_counter() - t0) * 1000)
|
||||
out = normalize_tool_result(err)
|
||||
dur_ms = int((time.perf_counter() - t0) * 1000)
|
||||
try:
|
||||
_tool_exec_log.info(
|
||||
"tool_exec name=%s ok=%s dur_ms=%s session=%s specialist=%s tool_call_id=%s error_code=%s",
|
||||
str(tc.name or ""),
|
||||
str(bool(out.get("ok"))),
|
||||
str(dur_ms),
|
||||
str(ctx.session_id or ""),
|
||||
str(ctx.specialist or ""),
|
||||
str(getattr(tc, "id", "") or ""),
|
||||
str(out.get("error_code") or ""),
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
return out, dur_ms
|
||||
|
||||
@staticmethod
|
||||
def _json_dumps_safe(obj: Any) -> str:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue