mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 04:40:45 +08:00
保持入站到 agent 流程不变,在回送阶段支持 media_path/media_url 与 base64 附件直发,同时让通道回包沿用会话中助手附件记录以对齐 chat 历史逻辑。 Made-with: Cursor
59 lines
2.1 KiB
Python
59 lines
2.1 KiB
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
REPO_ROOT = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
def _read(rel: str) -> str:
|
|
return (REPO_ROOT / rel).read_text(encoding="utf-8")
|
|
|
|
|
|
def test_weixin_start_official_only_runner() -> None:
|
|
text = _read("runtime/operations/scripts/weixin_start.ps1")
|
|
assert "mode=official" in text
|
|
assert 'official_runner.ts' in text
|
|
assert "AIA_WEIXIN_RUNNER_MODE" not in text
|
|
|
|
|
|
def test_weixin_status_and_stop_track_official_runner() -> None:
|
|
status_text = _read("runtime/operations/scripts/weixin_status.ps1")
|
|
stop_text = _read("runtime/operations/scripts/weixin_stop.ps1")
|
|
assert "official_runner.ts" in status_text
|
|
assert "official_runner.ts" in stop_text
|
|
|
|
|
|
def test_weixin_install_copies_official_runner() -> None:
|
|
text = _read("runtime/operations/scripts/weixin_install.ps1")
|
|
assert "Sync-WeixinBridgeRunners" in text
|
|
assert '"official_runner.ts"' in text
|
|
assert "Ensure-OfficialPluginRuntimeDeps" in text
|
|
assert "LocalSourcePath" not in text
|
|
|
|
|
|
def test_weixin_start_ensures_plugin_runtime_deps() -> None:
|
|
text = _read("runtime/operations/scripts/weixin_start.ps1")
|
|
assert "Ensure-OfficialPluginRuntimeDeps" in text
|
|
assert "npm.cmd install openclaw@latest --no-save" in text
|
|
|
|
|
|
def test_official_runner_prefers_direct_inbound_before_other_fallbacks() -> None:
|
|
text = _read("runtime/operations/weixin_bridge/official_runner.ts")
|
|
assert "const native = await postNativeReply" in text
|
|
assert "falling back to direct /inbound bridge" not in text
|
|
assert "legacy local ilink bridge" not in text
|
|
|
|
|
|
def test_official_runner_logs_active_bridge_path() -> None:
|
|
text = _read("runtime/operations/weixin_bridge/official_runner.ts")
|
|
assert "official runner started account=" in text
|
|
assert "native reply failed; no fallback enabled" in text
|
|
|
|
|
|
def test_official_runner_supports_reply_attachments_base64() -> None:
|
|
text = _read("runtime/operations/weixin_bridge/official_runner.ts")
|
|
assert "_decodeReplyBase64Attachment" in text
|
|
assert "data_base64" in text
|
|
assert "media_base64" in text
|
|
assert "reply.attachments" in text
|