Decouple bridges: ship each with its pack
The core no longer owns concrete bridge implementations. A bridge now ships inside the pack that declares it (packs/<name>/bridge/<name>.py, plus its package marker, optional client module, and hermetic test), and the core registry imports it by convention from the pack's `bridges`. Core keeps only: - bridges/base.py: BridgeInfo + BridgeService (shared HTTP/JSON/auth layer), plus a new BridgeService.from_config build hook (a bridge that needs the scheduler's `llm` client or top-level fallback values declares that itself, replacing build_bridge's per-name special-casing) and checkout_root() so a pack-relative bridge can still anchor .runtime/ paths; - bridges/inbox.py: the generic MessagingInbox; - bridges/llm.py: the one shared, pack-less LLMBridge (CORE_BRIDGES); - bridges/registry.py: discovery (discover_bridge_classes/known_infos/ describe_bridges/derived_config_vars/build_bridge/run_bridges) scanning each pack's bridge/ dir, plus load_pack_bridge_module/package for tests. Moved to their packs: simplex, nextcloud (+client), outlook (+client), browser (+client) — each with its hermetic test. tests/test_bridges.py now covers the core (shared LLM bridge + registry); tests/test_packs.py runs every pack's bridge test. Docs (AGENTS.md, PACKGEN.md, README.md) updated. Packs pushed separately to pack.<name>.
This commit is contained in:
1 parent
16e8583921
commit
41c18e6c47
21 files changed
+485
-7476
No files matched your search
@@ -11,6 +11,12 @@ fronts a service, a generated body never speaks that system's native protocol
|
||||
directly: it calls a small, documented, uniform HTTP surface instead, and the
|
||||
bridge owns the messy integration details and credentials.
|
||||
|
||||
Bridges **ship with their pack**: the core owns only the shared contract
|
||||
(``bridges/base.py``) and the discovery registry (``bridges/registry.py``); a
|
||||
bridge implementation lives in ``packs/<name>/bridge/`` and is imported by
|
||||
convention from the pack that declares it. The one exception is the shared,
|
||||
pack-less LLM bridge (``bridges/llm.py``), which many packs call.
|
||||
|
||||
Two boundaries matter:
|
||||
|
||||
- **Bridges are not the gateway.** The command gateway only takes commands and
|
||||
@@ -25,14 +31,19 @@ Two boundaries matter:
|
||||
and TESTGEN.md carry only the generic pattern.
|
||||
"""
|
||||
|
||||
from .base import BridgeInfo, BridgeService
|
||||
from .base import BridgeInfo, BridgeService, checkout_root
|
||||
from .inbox import MessagingInbox
|
||||
from .registry import (
|
||||
build_bridge,
|
||||
derived_config_vars,
|
||||
describe_bridges,
|
||||
discover_bridge_classes,
|
||||
known_infos,
|
||||
load_pack_bridge_class,
|
||||
load_pack_bridge_module,
|
||||
load_pack_bridge_package,
|
||||
run_bridges,
|
||||
set_bridge_packs,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
@@ -40,8 +51,14 @@ __all__ = [
|
||||
"BridgeService",
|
||||
"MessagingInbox",
|
||||
"build_bridge",
|
||||
"checkout_root",
|
||||
"derived_config_vars",
|
||||
"describe_bridges",
|
||||
"discover_bridge_classes",
|
||||
"known_infos",
|
||||
"load_pack_bridge_class",
|
||||
"load_pack_bridge_module",
|
||||
"load_pack_bridge_package",
|
||||
"run_bridges",
|
||||
"set_bridge_packs",
|
||||
]
|
||||
Reference in new issue
Block a user