mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 04:40:45 +08:00
本次迁移将网关/通道/工具/技能/脚本与协议资源集中到新结构,统一路径常量与脚本转发机制,减少顶层噪音并保证运行与测试行为一致。 Made-with: Cursor
20 lines
644 B
Python
20 lines
644 B
Python
from __future__ import annotations
|
|
|
|
from oclaw.runtime.skills_prompt import format_skills_for_prompt
|
|
|
|
|
|
def test_format_skills_for_prompt_xml_shape() -> None:
|
|
out = format_skills_for_prompt(
|
|
[("demo", "desc", "/tmp/skills/demo/SKILL.md")],
|
|
max_chars=50_000,
|
|
)
|
|
assert "<available_skills>" in out
|
|
assert "</available_skills>" in out
|
|
assert "<name>demo</name>" in out
|
|
assert "read_file" in out
|
|
|
|
|
|
def test_format_skills_for_prompt_truncates_by_budget() -> None:
|
|
entries = [(f"s{i}", "d", f"/p/{i}") for i in range(30)]
|
|
out = format_skills_for_prompt(entries, max_chars=800)
|
|
assert len(out) <= 800
|