mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-10 20:50:52 +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
|
|
@ -22,11 +22,25 @@ logger = logging.getLogger(__name__)
|
|||
# restricted to a single safe builtin (`system_time`), so this is left empty.
|
||||
TOOL_FACTORIES: tuple[object, ...] = ()
|
||||
|
||||
|
||||
def _is_truthy(v: str | None) -> bool:
|
||||
return str(v or "").strip().lower() in ("1", "true", "yes", "on")
|
||||
|
||||
|
||||
def _skill_toolcall_enabled(store: SqliteStore | None) -> bool:
|
||||
try:
|
||||
raw_env = str(os.getenv("AIA_SKILL_TOOLCALL_ENABLED") or "").strip()
|
||||
if raw_env:
|
||||
return _is_truthy(raw_env)
|
||||
if store is not None:
|
||||
raw = str(store.get_setting("AIA_SKILL_TOOLCALL_ENABLED") or "").strip()
|
||||
if raw:
|
||||
return _is_truthy(raw)
|
||||
except Exception:
|
||||
pass
|
||||
# Default off: skill uses prompt-injection path, not toolcall path.
|
||||
return False
|
||||
|
||||
|
||||
def _apply_declared_tool_policy(
|
||||
tools: list[ToolSpec],
|
||||
*,
|
||||
|
|
@ -168,16 +182,17 @@ def materialize_tool_specs(
|
|||
except Exception as exc:
|
||||
logger.warning("expert tool load skipped: %s", exc)
|
||||
|
||||
# Load executable skills (declared via SKILL.md metadata.oclaw.runtime).
|
||||
try:
|
||||
for spec in materialize_executable_skill_tools(store=store):
|
||||
if not isinstance(spec, ToolSpec):
|
||||
continue
|
||||
if any(str(t.name or "") == str(spec.name or "") for t in tools):
|
||||
continue
|
||||
tools.append(spec)
|
||||
except Exception as exc:
|
||||
logger.warning("skill runtime tool load skipped: %s", exc)
|
||||
# Load executable skills only when toolcall mode is explicitly enabled.
|
||||
if _skill_toolcall_enabled(store):
|
||||
try:
|
||||
for spec in materialize_executable_skill_tools(store=store):
|
||||
if not isinstance(spec, ToolSpec):
|
||||
continue
|
||||
if any(str(t.name or "") == str(spec.name or "") for t in tools):
|
||||
continue
|
||||
tools.append(spec)
|
||||
except Exception as exc:
|
||||
logger.warning("skill runtime tool load skipped: %s", exc)
|
||||
|
||||
# MCP tools are role-bound and should be materialized before model injection.
|
||||
# Fine-grained penalty/visibility is still applied by wire policy in direct_loop.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue