mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-11-17 04:11:35 +00:00
Introduce the pm store: a unified, hash-verified package store that
replaces lazy_deps and the old installer's ad-hoc tool downloads.
Store tools are provisioned on PATH (ffmpeg, node/npm via pinned uv),
with a resumable 8-way downloader, verify() returning failure reasons,
and adopt() made EPERM-safe. chromium ships in the payload for every
target. The 3600-line install.sh is replaced by a staged bootstrapper
(heavy deps are pm's job after this); setup-hermes.sh, Dockerfile and
nix pin tables are rewired onto the store. Old install-script tests,
lazy_deps/managed_uv/build_info, and the ps1/bash installer test
batteries are removed with the machinery they tested.
Rebuilt from ethie/pm onto upstream/main (ac6c8028e0) after the
utf-8-sig sweep. 16 hot files (main also churned them) hand-merged:
platform adapters, main.py, electron/main.ts, tui_gateway/server.py,
cua_backend, installer-tests workflow, install.sh (full rewrite),
setup-hermes.sh, plugins doc.
55 lines
1.9 KiB
Python
55 lines
1.9 KiB
Python
"""Regression coverage for deferred Feishu SDK loading."""
|
|
|
|
import asyncio
|
|
import os
|
|
import tempfile
|
|
from unittest.mock import AsyncMock, patch
|
|
|
|
|
|
def _feishu_adapter_module():
|
|
"""Import the adapter with the Windows app-data root available in CI."""
|
|
with patch.dict(os.environ, {"LOCALAPPDATA": tempfile.gettempdir()}):
|
|
from plugins.platforms.feishu import adapter
|
|
|
|
return adapter
|
|
|
|
|
|
def test_configured_feishu_dependency_check_does_not_load_sdk():
|
|
"""Gateway configuration can validate Feishu without importing its SDK."""
|
|
feishu_adapter = _feishu_adapter_module()
|
|
|
|
with (
|
|
patch.object(feishu_adapter, "FEISHU_AVAILABLE", False),
|
|
patch("pm.ensure_import", autospec=True) as ensure,
|
|
):
|
|
assert feishu_adapter.check_feishu_requirements() is True
|
|
assert feishu_adapter.FEISHU_AVAILABLE is False
|
|
|
|
ensure.assert_called_once_with("feishu")
|
|
|
|
|
|
def test_feishu_connect_loads_sdk_on_worker_thread():
|
|
"""The first SDK import is deferred until a configured adapter connects."""
|
|
from gateway.config import PlatformConfig
|
|
feishu_adapter = _feishu_adapter_module()
|
|
|
|
adapter = feishu_adapter.FeishuAdapter(
|
|
PlatformConfig(
|
|
extra={
|
|
"app_id": "cli_test",
|
|
"app_secret": "secret_test",
|
|
"connection_mode": "websocket",
|
|
}
|
|
)
|
|
)
|
|
|
|
with (
|
|
patch.object(feishu_adapter, "FEISHU_AVAILABLE", False),
|
|
patch.object(feishu_adapter, "_load_lark_oapi", return_value=True) as load_sdk,
|
|
patch.object(feishu_adapter.asyncio, "to_thread", new_callable=AsyncMock, return_value=True) as to_thread,
|
|
patch.object(adapter, "_connect_with_retry", new_callable=AsyncMock),
|
|
patch.object(feishu_adapter, "acquire_scoped_lock", return_value=(True, {})),
|
|
):
|
|
assert asyncio.run(adapter.connect()) is True
|
|
|
|
to_thread.assert_awaited_once_with(load_sdk)
|