mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-11 16:23:17 +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,62 +0,0 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from oclaw.openclaw_runtime.system_prompt import build_openclaw_executor_system_prompt
|
||||
from oclaw.openclaw_runtime.types import OpenClawMemoryContext
|
||||
from oclaw.platform.persistence.sqlite_store import SqliteStore
|
||||
from oclaw.tools.base import ToolRegistry, ToolSpec
|
||||
|
||||
|
||||
def _spec(name: str) -> ToolSpec:
|
||||
return ToolSpec(
|
||||
name=name,
|
||||
description="d",
|
||||
parameters={"type": "object", "properties": {}},
|
||||
handler=lambda _a: {"ok": True},
|
||||
read_only=True,
|
||||
)
|
||||
|
||||
|
||||
def test_build_openclaw_executor_system_prompt_includes_skills_block(tmp_path: Path) -> None:
|
||||
store = SqliteStore(str(tmp_path / "sp.sqlite"))
|
||||
store.create_session("s")
|
||||
reg = ToolRegistry([_spec("demo_tool")])
|
||||
out = build_openclaw_executor_system_prompt(
|
||||
store=store,
|
||||
tools=reg,
|
||||
base_url="",
|
||||
base_system="You are helpful.",
|
||||
memory_context=OpenClawMemoryContext(),
|
||||
lang="zh",
|
||||
)
|
||||
assert "<available_skills>" in out
|
||||
|
||||
|
||||
def test_build_openclaw_executor_system_prompt_without_tools_has_no_skills_block(tmp_path: Path) -> None:
|
||||
store = SqliteStore(str(tmp_path / "sp1.sqlite"))
|
||||
store.create_session("s")
|
||||
out = build_openclaw_executor_system_prompt(
|
||||
store=store,
|
||||
tools=None,
|
||||
base_url="",
|
||||
base_system=" plain ",
|
||||
memory_context=OpenClawMemoryContext(),
|
||||
lang="zh",
|
||||
)
|
||||
assert "<available_skills>" not in out
|
||||
|
||||
|
||||
def test_build_openclaw_executor_system_prompt_with_tools_has_skills(tmp_path: Path) -> None:
|
||||
store = SqliteStore(str(tmp_path / "sp2.sqlite"))
|
||||
store.create_session("s")
|
||||
reg = ToolRegistry([_spec("x")])
|
||||
out = build_openclaw_executor_system_prompt(
|
||||
store=store,
|
||||
tools=reg,
|
||||
base_url="",
|
||||
base_system="base",
|
||||
memory_context=OpenClawMemoryContext(),
|
||||
lang="zh",
|
||||
)
|
||||
assert "<available_skills>" in out
|
||||
Loading…
Add table
Add a link
Reference in a new issue