debug-control-plane 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- debug_control_plane/__init__.py +7 -0
- debug_control_plane/device_discovery/__init__.py +82 -0
- debug_control_plane/device_discovery/device_candidates.py +326 -0
- debug_control_plane/device_discovery/device_pool.py +369 -0
- debug_control_plane/device_discovery/discovery/__init__.py +14 -0
- debug_control_plane/device_discovery/discovery/cross_identify.py +396 -0
- debug_control_plane/device_discovery/discovery/lan_scan.py +183 -0
- debug_control_plane/device_discovery/discovery/manual_registry.py +245 -0
- debug_control_plane/device_discovery/discovery/usb_identity.py +228 -0
- debug_control_plane/device_discovery/discovery/vpn_immune.py +103 -0
- debug_control_plane/device_discovery/endpoint.py +317 -0
- debug_control_plane/device_discovery/protocol.py +230 -0
- debug_control_plane/mcp_plane/__init__.py +47 -0
- debug_control_plane/mcp_plane/bridge_client.py +525 -0
- debug_control_plane/mcp_plane/capability_mirror.py +642 -0
- debug_control_plane/mcp_plane/semantic_provider.py +57 -0
- debug_control_plane/mcp_plane/server.py +874 -0
- debug_control_plane-0.1.0.dist-info/METADATA +98 -0
- debug_control_plane-0.1.0.dist-info/RECORD +23 -0
- debug_control_plane-0.1.0.dist-info/WHEEL +5 -0
- debug_control_plane-0.1.0.dist-info/entry_points.txt +2 -0
- debug_control_plane-0.1.0.dist-info/licenses/LICENSE +21 -0
- debug_control_plane-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""SemanticProvider — pluggable hook for known-capability sugar (BF002).
|
|
2
|
+
|
|
3
|
+
固化自 R020 ``pantas_launcher/tools/mcp_debug_bridge/capability_mirror.py:177``。
|
|
4
|
+
本轮(R021-BF002)将 R020 既有 Protocol 抽出固化到独立 repo,作为契约源头迁移
|
|
5
|
+
(非新设计 — R020 BF010 hook 已落地代码)。
|
|
6
|
+
|
|
7
|
+
E 方案(OI-B1 resolved):平面 legacy 路径对每 capability tag 生成 sentinel
|
|
8
|
+
``CapabilitySchema``(``capability_id=tag``, 空 ``resources``/``commands``)交
|
|
9
|
+
``provider.matches`` 认领;业务 provider 内部按 tag→capability 映射产 tools。
|
|
10
|
+
本契约**不扩** ``propose_schemas`` 钩子(YAGNI)。
|
|
11
|
+
|
|
12
|
+
类型引用说明:
|
|
13
|
+
``CapabilitySchema`` / ``ToolSpec`` 已迁入 ``capability_mirror.py``(BF007)。
|
|
14
|
+
本模块用 ``TYPE_CHECKING`` 守卫 import 它们供静态分析器解析(消除 ruff F821);
|
|
15
|
+
运行时签名靠 ``from __future__ import annotations`` 字符串化,守卫块不执行,
|
|
16
|
+
不产生循环 import(``capability_mirror`` 不反向 import 本模块)。
|
|
17
|
+
"""
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
from typing import TYPE_CHECKING, Protocol
|
|
21
|
+
|
|
22
|
+
if TYPE_CHECKING:
|
|
23
|
+
from .capability_mirror import CapabilitySchema, ToolSpec
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class SemanticProvider(Protocol):
|
|
27
|
+
"""Builds semantic-sugar tools for a known capability.
|
|
28
|
+
|
|
29
|
+
BF010 (gamepad) implements this protocol and registers its instance on
|
|
30
|
+
:class:`CapabilityMirror` via the ``providers`` constructor arg. BF009
|
|
31
|
+
ships no built-in provider — the hook itself is exercised by a stub in
|
|
32
|
+
BF009's own tests.
|
|
33
|
+
|
|
34
|
+
Contract:
|
|
35
|
+
* :meth:`matches` is called once per parsed schema; return ``True`` if
|
|
36
|
+
this provider owns the capability (it then gets to build tools for
|
|
37
|
+
it). ``legacy_capabilities`` is the static ``/hello.capabilities``
|
|
38
|
+
frozenset (legacy/degrade mode); providers may match on it when no
|
|
39
|
+
structured schema is present (e.g. ``virtual_input`` heuristic).
|
|
40
|
+
* :meth:`build_tools` returns the manifest entries for the matched
|
|
41
|
+
capability. The schema is the structured mirror (when present) or a
|
|
42
|
+
synthetic legacy schema (capability_id set, empty resources/commands)
|
|
43
|
+
so providers don't have to special-case legacy mode.
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
def matches(
|
|
47
|
+
self,
|
|
48
|
+
schema: CapabilitySchema,
|
|
49
|
+
*,
|
|
50
|
+
legacy_capabilities: frozenset[str] | None = None,
|
|
51
|
+
) -> bool:
|
|
52
|
+
"""Return True if this provider owns the given capability."""
|
|
53
|
+
...
|
|
54
|
+
|
|
55
|
+
def build_tools(self, schema: CapabilitySchema) -> list[ToolSpec]:
|
|
56
|
+
"""Return the semantic-sugar tools for the matched capability."""
|
|
57
|
+
...
|