wger-agent 2.2.4__tar.gz → 2.2.6__tar.gz
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.
- {wger_agent-2.2.4/wger_agent.egg-info → wger_agent-2.2.6}/PKG-INFO +6 -6
- {wger_agent-2.2.4 → wger_agent-2.2.6}/README.md +1 -1
- {wger_agent-2.2.4 → wger_agent-2.2.6}/pyproject.toml +11 -14
- {wger_agent-2.2.4 → wger_agent-2.2.6}/scripts/security_contract.py +1 -3
- {wger_agent-2.2.4 → wger_agent-2.2.6}/tests/conftest.py +2 -1
- {wger_agent-2.2.4 → wger_agent-2.2.6}/tests/test_coverage_booster.py +10 -17
- wger_agent-2.2.6/tests/test_default_content_surfaces.py +148 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/tests/test_fleet_name.py +2 -2
- {wger_agent-2.2.4 → wger_agent-2.2.6}/tests/test_init_dynamics.py +5 -1
- wger_agent-2.2.6/tests/test_publication_workflow.py +120 -0
- wger_agent-2.2.6/tests/test_wheel_inventory.py +55 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/__init__.py +17 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/connector_sources.py +0 -20
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/mcp/mcp_server.py +11 -16
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/mcp_server.py +3 -1
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/ontology/certification.json +5 -5
- wger_agent-2.2.6/wger_agent/skills/wger-agent-development/SKILL.md +86 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/skills/wger-agent-docs/reference/production_docker.html.md +3 -3
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/skills/wger-agent-docs/reference/production_installation.html.md +21 -21
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/skills/wger-exercise-library/SKILL.md +1 -1
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/skills/wger-nutrition-tracking/SKILL.md +1 -1
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/skills/wger-workout-routines/SKILL.md +1 -1
- {wger_agent-2.2.4 → wger_agent-2.2.6/wger_agent.egg-info}/PKG-INFO +6 -6
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent.egg-info/SOURCES.txt +3 -2
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent.egg-info/entry_points.txt +1 -7
- wger_agent-2.2.6/wger_agent.egg-info/requires.txt +14 -0
- wger_agent-2.2.4/scripts/security_sanitizer.py +0 -318
- wger_agent-2.2.4/scripts/verify_api_integration.py +0 -320
- wger_agent-2.2.4/tests/test_default_content_surfaces.py +0 -43
- wger_agent-2.2.4/wger_agent.egg-info/requires.txt +0 -14
- {wger_agent-2.2.4 → wger_agent-2.2.6}/LICENSE +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/MANIFEST.in +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/requirements.txt +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/setup.cfg +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/tests/test_bug_cx_046_ctx_await.py +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/tests/test_init.py +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/tests/test_kg_ingest.py +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/__main__.py +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/api/__init__.py +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/api/api_client_base.py +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/api/api_client_body.py +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/api/api_client_configs.py +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/api/api_client_exercises.py +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/api/api_client_nutrition.py +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/api/api_client_routine.py +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/api/api_client_user_system.py +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/api/api_client_workout_sessions.py +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/api_client.py +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/auth.py +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/connectors/__init__.py +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/kg_ingest.py +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/mcp/__init__.py +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/mcp/tools.py +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/mcp_config.json +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/ontology/__init__.py +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/ontology/fixtures/records.json +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/ontology/mappings/source.yaml +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/ontology/migrations/manifest.json +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/ontology/shapes/connector.shacl.ttl +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/ontology/wellness.ttl +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/prompts/__init__.py +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/prompts/fitness_specialist.json +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/skills/__init__.py +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/skills/wger-agent-docs/SKILL.md +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/skills/wger-agent-docs/WORKFLOW.md +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/skills/wger-agent-docs/reference/_images_logo.png.md +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/skills/wger-agent-docs/reference/administration_auth_proxy.html.md +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/skills/wger-agent-docs/reference/administration_commands.html.md +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/skills/wger-agent-docs/reference/administration_gym.html.md +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/skills/wger-agent-docs/reference/administration_settings.html.md +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/skills/wger-agent-docs/reference/api_api.html.md +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/skills/wger-agent-docs/reference/api_routines.html.md +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/skills/wger-agent-docs/reference/changelog.html.md +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/skills/wger-agent-docs/reference/contributing.html.md +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/skills/wger-agent-docs/reference/development_backend.html.md +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/skills/wger-agent-docs/reference/development_frontend.html.md +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/skills/wger-agent-docs/reference/development_mobile_app.html.md +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/skills/wger-agent-docs/reference/en_latest.md +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/skills/wger-agent-docs/reference/manual_routines.html.md +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/skills/wger-agent-operations/SKILL.md +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/skills/wger-agent-operations/agents/openai.yaml +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/skills/wger-agent-operations/references/catalog.md +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/skills/wger-exercise-library/WORKFLOW.md +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/skills/wger-nutrition-tracking/WORKFLOW.md +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent/skills/wger-workout-routines/WORKFLOW.md +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent.egg-info/dependency_links.txt +0 -0
- {wger_agent-2.2.4 → wger_agent-2.2.6}/wger_agent.egg-info/top_level.txt +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: wger-agent
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.6
|
|
4
4
|
Summary: Wger Workout Manager — exercise database, workout routines, nutrition plans, body measurements, and progress tracking.
|
|
5
|
-
Author-email:
|
|
5
|
+
Author-email: Repository Maintainers <maintainers@knuckles.team>
|
|
6
6
|
License: MIT
|
|
7
7
|
Classifier: Development Status :: 4 - Beta
|
|
8
8
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -12,12 +12,12 @@ Classifier: Programming Language :: Python :: 3
|
|
|
12
12
|
Requires-Python: <3.15,>=3.12
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
License-File: LICENSE
|
|
15
|
-
Requires-Dist:
|
|
15
|
+
Requires-Dist: scion-sdk[mcp]<1.0.0,>=0.5.6
|
|
16
16
|
Requires-Dist: requests>=2.34.2
|
|
17
17
|
Provides-Extra: mcp
|
|
18
|
-
Requires-Dist:
|
|
18
|
+
Requires-Dist: scion-sdk[mcp]<1.0.0,>=0.5.6; extra == "mcp"
|
|
19
19
|
Provides-Extra: all
|
|
20
|
-
Requires-Dist:
|
|
20
|
+
Requires-Dist: scion-sdk[mcp]<1.0.0,>=0.5.6; extra == "all"
|
|
21
21
|
Provides-Extra: test
|
|
22
22
|
Requires-Dist: pytest-xdist>=3.8.0; extra == "test"
|
|
23
23
|
Requires-Dist: pytest>=9.1.1; extra == "test"
|
|
@@ -47,7 +47,7 @@ Dynamic: license-file
|
|
|
47
47
|

|
|
48
48
|

|
|
49
49
|
|
|
50
|
-
*Version: 2.2.
|
|
50
|
+
*Version: 2.2.6*
|
|
51
51
|
|
|
52
52
|
> **Documentation** — Installation, deployment, usage across the MCP, API, and agent
|
|
53
53
|
> interfaces, and guidance for provisioning the Wger Workout Manager platform are
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|

|
|
21
21
|

|
|
22
22
|
|
|
23
|
-
*Version: 2.2.
|
|
23
|
+
*Version: 2.2.6*
|
|
24
24
|
|
|
25
25
|
> **Documentation** — Installation, deployment, usage across the MCP, API, and agent
|
|
26
26
|
> interfaces, and guidance for provisioning the Wger Workout Manager platform are
|
|
@@ -4,40 +4,33 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "wger-agent"
|
|
7
|
-
version = "2.2.
|
|
7
|
+
version = "2.2.6"
|
|
8
8
|
description = "Wger Workout Manager — exercise database, workout routines, nutrition plans, body measurements, and progress tracking."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
classifiers = [ "Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License", "Environment :: Console", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3",]
|
|
11
11
|
requires-python = ">=3.12, <3.15"
|
|
12
|
-
dependencies = [ "
|
|
12
|
+
dependencies = [ "scion-sdk[mcp]>=0.5.6,<1.0.0", "requests>=2.34.2",]
|
|
13
13
|
[[project.authors]]
|
|
14
|
-
name = "
|
|
15
|
-
email = "maintainers@
|
|
14
|
+
name = "Repository Maintainers"
|
|
15
|
+
email = "maintainers@knuckles.team"
|
|
16
16
|
|
|
17
17
|
[project.license]
|
|
18
18
|
text = "MIT"
|
|
19
19
|
|
|
20
20
|
[project.optional-dependencies]
|
|
21
|
-
mcp = [ "
|
|
22
|
-
all = [ "
|
|
21
|
+
mcp = [ "scion-sdk[mcp]>=0.5.6,<1.0.0",]
|
|
22
|
+
all = [ "scion-sdk[mcp]>=0.5.6,<1.0.0",]
|
|
23
23
|
test = [
|
|
24
24
|
"pytest-xdist>=3.8.0", "pytest>=9.1.1", "pytest-asyncio>=1.4.0", "pytest-cov>=7.1.0",]
|
|
25
25
|
|
|
26
26
|
[project.scripts]
|
|
27
27
|
wger-mcp = "wger_agent.mcp_server:mcp_server"
|
|
28
28
|
|
|
29
|
-
[project.entry-points."agent_connector_sdk.skill_providers"]
|
|
30
|
-
wger-agent = "wger_agent.skills"
|
|
31
|
-
|
|
32
29
|
[project.entry-points."agent_connector_sdk.prompt_providers"]
|
|
33
30
|
wger-agent = "wger_agent.prompts"
|
|
34
31
|
|
|
35
|
-
[project.entry-points."agent_connector_sdk.ontology_providers"]
|
|
36
|
-
wger-agent = "wger_agent.ontology"
|
|
37
|
-
|
|
38
|
-
# The one declared connector identity: the fleet name (SDK-CONNECTOR-CONTROL-R071).
|
|
39
32
|
[project.entry-points."agent_connector_sdk.connector"]
|
|
40
|
-
wger-mcp = "wger_agent"
|
|
33
|
+
wger-mcp = "wger_agent:connector"
|
|
41
34
|
|
|
42
35
|
[tool.uv.workspace]
|
|
43
36
|
members = ["."]
|
|
@@ -61,6 +54,7 @@ check_untyped_defs = true
|
|
|
61
54
|
|
|
62
55
|
[dependency-groups]
|
|
63
56
|
dev = [
|
|
57
|
+
"bump2version>=1.0.1,<2",
|
|
64
58
|
"pytest-timeout>=2.4.0",
|
|
65
59
|
]
|
|
66
60
|
|
|
@@ -79,3 +73,6 @@ ignore_names = ["request", "config"]
|
|
|
79
73
|
|
|
80
74
|
[tool.pipelines_hooks.ste]
|
|
81
75
|
exempt = ["specs/*", "specs/**/*"]
|
|
76
|
+
|
|
77
|
+
[tool.setuptools.exclude-package-data]
|
|
78
|
+
"*" = ["**/__pycache__/**", "**/*.pyc"]
|
|
@@ -604,9 +604,7 @@ def _classify_component(
|
|
|
604
604
|
"""Return "violation", "unknown", or "ok" for one SBOM component."""
|
|
605
605
|
|
|
606
606
|
if not isinstance(component, dict):
|
|
607
|
-
raise SecurityContractError(
|
|
608
|
-
"software bill of materials component is invalid"
|
|
609
|
-
)
|
|
607
|
+
raise SecurityContractError("software bill of materials component is invalid")
|
|
610
608
|
licenses, malformed = _component_licenses(component)
|
|
611
609
|
if not licenses:
|
|
612
610
|
return "violation" if malformed else "unknown"
|
|
@@ -1,30 +1,29 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import sys
|
|
3
|
-
import pytest
|
|
4
1
|
import importlib
|
|
2
|
+
import os
|
|
5
3
|
import runpy
|
|
6
|
-
|
|
4
|
+
import sys
|
|
7
5
|
from typing import Any
|
|
6
|
+
from unittest.mock import AsyncMock, MagicMock, patch
|
|
8
7
|
|
|
8
|
+
import pytest
|
|
9
|
+
|
|
10
|
+
import wger_agent.auth as auth_mod
|
|
9
11
|
from wger_agent.api_client import WgerApi
|
|
10
12
|
from wger_agent.auth import get_client
|
|
11
|
-
import wger_agent.auth as auth_mod
|
|
12
13
|
from wger_agent.mcp_server import (
|
|
13
14
|
get_mcp_instance,
|
|
14
|
-
|
|
15
|
-
register_routineconfig_tools,
|
|
15
|
+
register_body_tools,
|
|
16
16
|
register_exercise_tools,
|
|
17
|
-
register_workout_tools,
|
|
18
17
|
register_nutrition_tools,
|
|
19
|
-
|
|
18
|
+
register_routine_tools,
|
|
19
|
+
register_routineconfig_tools,
|
|
20
20
|
register_user_tools,
|
|
21
|
+
register_workout_tools,
|
|
21
22
|
)
|
|
22
23
|
|
|
23
24
|
mcp_server_mod = sys.modules["wger_agent.mcp.mcp_server"]
|
|
24
25
|
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
28
27
|
def test_import_module_safely_error():
|
|
29
28
|
from wger_agent import _import_module_safely
|
|
30
29
|
|
|
@@ -817,12 +816,6 @@ def test_mcp_server_exceptions_reload():
|
|
|
817
816
|
importlib.reload(mcp_module)
|
|
818
817
|
|
|
819
818
|
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
819
|
def test_mcp_server_main():
|
|
827
820
|
# Cover wger_agent.mcp_server __main__ logic
|
|
828
821
|
with patch("fastmcp.FastMCP.run") as mock_run, patch("sys.argv", ["mcp-server"]):
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"""CONN-WGER-AGENT-CONNECTOR-CONTENT-R001: the server lists its packaged skills, ontology and prompts by default."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import asyncio
|
|
6
|
+
import importlib
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
import pytest
|
|
10
|
+
from fastmcp import Client
|
|
11
|
+
|
|
12
|
+
PACKAGE = "wger_agent"
|
|
13
|
+
ROOT = Path(list(importlib.import_module(PACKAGE).__path__)[0])
|
|
14
|
+
|
|
15
|
+
pytestmark = pytest.mark.spec("CONN-WGER-AGENT-CONNECTOR-CONTENT-R001")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _server():
|
|
19
|
+
from wger_agent.mcp_server import get_mcp_instance
|
|
20
|
+
|
|
21
|
+
return get_mcp_instance(
|
|
22
|
+
command_args=["--transport", "stdio", "--auth-type", "none"]
|
|
23
|
+
)[0]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
async def _listings():
|
|
27
|
+
async with Client(_server()) as client:
|
|
28
|
+
resources = {str(r.uri) for r in await client.list_resources()}
|
|
29
|
+
prompts = {p.name for p in await client.list_prompts()}
|
|
30
|
+
for uri in resources:
|
|
31
|
+
if uri.startswith(("ontology://", "shapes://")):
|
|
32
|
+
directory = ROOT / "ontology"
|
|
33
|
+
if uri.startswith("shapes://"):
|
|
34
|
+
directory = directory / "shapes"
|
|
35
|
+
actual = await client.read_resource(uri)
|
|
36
|
+
assert (
|
|
37
|
+
actual[0].text.encode()
|
|
38
|
+
== (directory / uri.rsplit("/", 1)[-1]).read_bytes()
|
|
39
|
+
)
|
|
40
|
+
return resources, prompts
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def test_default_content_surfaces() -> None:
|
|
44
|
+
resources, prompts = asyncio.run(_listings())
|
|
45
|
+
if list(ROOT.glob("skills/*/SKILL.md")):
|
|
46
|
+
assert any(u.startswith("skill://") for u in resources)
|
|
47
|
+
if list(ROOT.glob("ontology/*.ttl")):
|
|
48
|
+
assert any(u.startswith("ontology://wger-mcp/") for u in resources)
|
|
49
|
+
for path in ROOT.glob("prompts/*.json"):
|
|
50
|
+
if not path.name.startswith("_"):
|
|
51
|
+
assert path.stem in prompts
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@pytest.fixture(autouse=True)
|
|
55
|
+
def _no_outbound_network(monkeypatch):
|
|
56
|
+
import socket
|
|
57
|
+
|
|
58
|
+
def refuse(*_args, **_kwargs):
|
|
59
|
+
raise AssertionError("content publication must not contact an external system")
|
|
60
|
+
|
|
61
|
+
monkeypatch.setenv("MCP_FLEET_REGISTRATION", "false")
|
|
62
|
+
monkeypatch.setattr(socket.socket, "connect", refuse)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def test_sdk_floor_supports_content_identity_and_current_pack_protocol() -> None:
|
|
66
|
+
import tomllib
|
|
67
|
+
|
|
68
|
+
from packaging.requirements import Requirement
|
|
69
|
+
|
|
70
|
+
project = tomllib.loads((ROOT.parent / "pyproject.toml").read_text())["project"]
|
|
71
|
+
declared = list(project.get("dependencies", []))
|
|
72
|
+
for extra in project.get("optional-dependencies", {}).values():
|
|
73
|
+
declared.extend(extra)
|
|
74
|
+
sdk = [Requirement(value) for value in declared if value.startswith("scion-sdk")]
|
|
75
|
+
assert sdk
|
|
76
|
+
for requirement in sdk:
|
|
77
|
+
assert requirement.specifier.contains("0.5.6")
|
|
78
|
+
assert not requirement.specifier.contains("0.5.5")
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def test_production_pack_binds_packaged_ontology_and_shapes():
|
|
82
|
+
import hashlib
|
|
83
|
+
from importlib.metadata import version
|
|
84
|
+
|
|
85
|
+
from agent_connector_sdk.artifacts.pack import build_content_pack
|
|
86
|
+
from agent_connector_sdk.artifacts.resources import ResourceArtifactKind
|
|
87
|
+
from agent_connector_sdk.ports.session import TransportEndpoint
|
|
88
|
+
from agent_connector_sdk.transports.mcp import McpTransport
|
|
89
|
+
|
|
90
|
+
async def capture():
|
|
91
|
+
async with McpTransport().session(
|
|
92
|
+
TransportEndpoint(in_process=_server())
|
|
93
|
+
) as session:
|
|
94
|
+
return await build_content_pack(
|
|
95
|
+
session, connector="wger-mcp", kinds=(ResourceArtifactKind(),)
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
pack = asyncio.run(capture())
|
|
99
|
+
assert pack.server_package_version == version("wger-agent")
|
|
100
|
+
entries = {str(entry.uri): entry for entry in pack.archive.entries}
|
|
101
|
+
assert "connector://resources" in entries
|
|
102
|
+
for path in ROOT.glob("ontology/**/*.ttl"):
|
|
103
|
+
scheme = "shapes" if path.parent.name == "shapes" else "ontology"
|
|
104
|
+
uri = f"{scheme}://wger-mcp/{path.name}"
|
|
105
|
+
assert entries[uri].body.sha256 == hashlib.sha256(path.read_bytes()).hexdigest()
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def test_canonical_and_legacy_routes_preserve_the_full_tool_surface():
|
|
109
|
+
from agent_connector_sdk.connector import build_server
|
|
110
|
+
|
|
111
|
+
async def capture():
|
|
112
|
+
_, canonical = build_server(
|
|
113
|
+
PACKAGE, command_args=["--transport", "stdio", "--auth-type", "none"]
|
|
114
|
+
)
|
|
115
|
+
async with (
|
|
116
|
+
Client(_server()) as legacy_client,
|
|
117
|
+
Client(canonical) as canonical_client,
|
|
118
|
+
):
|
|
119
|
+
legacy = {
|
|
120
|
+
tool.name: tool.model_dump(mode="json")
|
|
121
|
+
for tool in await legacy_client.list_tools()
|
|
122
|
+
}
|
|
123
|
+
declared = {
|
|
124
|
+
tool.name: tool.model_dump(mode="json")
|
|
125
|
+
for tool in await canonical_client.list_tools()
|
|
126
|
+
}
|
|
127
|
+
assert len(legacy) == 135
|
|
128
|
+
assert declared == legacy
|
|
129
|
+
|
|
130
|
+
asyncio.run(capture())
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def test_legacy_cli_configuration_file_still_controls_host_and_port(
|
|
134
|
+
tmp_path, monkeypatch
|
|
135
|
+
):
|
|
136
|
+
import json
|
|
137
|
+
|
|
138
|
+
from wger_agent.mcp_server import get_mcp_instance
|
|
139
|
+
|
|
140
|
+
config = tmp_path / "connector.json"
|
|
141
|
+
config.write_text(json.dumps({"HOST": "127.0.0.1", "PORT": 9187}))
|
|
142
|
+
monkeypatch.delenv("HOST", raising=False)
|
|
143
|
+
monkeypatch.delenv("PORT", raising=False)
|
|
144
|
+
monkeypatch.setenv("CONNECTOR_CONFIG_FILE", str(config))
|
|
145
|
+
_, args, _ = get_mcp_instance(
|
|
146
|
+
command_args=["--transport", "stdio", "--auth-type", "none"]
|
|
147
|
+
)
|
|
148
|
+
assert (args.host, args.port) == ("127.0.0.1", 9187)
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from agent_connector_sdk.connector_identity import connector_name
|
|
6
5
|
import ast
|
|
7
6
|
import tomllib
|
|
8
7
|
from pathlib import Path
|
|
9
8
|
|
|
10
9
|
import pytest
|
|
10
|
+
from agent_connector_sdk.connector_identity import connector_name
|
|
11
11
|
|
|
12
12
|
ROOT = Path(__file__).resolve().parents[1]
|
|
13
13
|
PACKAGE = ROOT / "wger_agent"
|
|
@@ -35,7 +35,7 @@ def _call_connectors(path: Path) -> list[str]:
|
|
|
35
35
|
def test_connector_name_is_the_fleet_name() -> None:
|
|
36
36
|
pyproject = tomllib.loads((ROOT / "pyproject.toml").read_text(encoding="utf-8"))
|
|
37
37
|
assert pyproject["project"]["entry-points"]["agent_connector_sdk.connector"] == {
|
|
38
|
-
FLEET: "wger_agent"
|
|
38
|
+
FLEET: "wger_agent:connector"
|
|
39
39
|
}
|
|
40
40
|
assert connector_name("wger_agent") == FLEET
|
|
41
41
|
for module in sorted(PACKAGE.glob("*.py")):
|
|
@@ -28,7 +28,11 @@ def _get_pkg_name():
|
|
|
28
28
|
return name.replace("-", "_")
|
|
29
29
|
|
|
30
30
|
for child in project_dir.iterdir():
|
|
31
|
-
if
|
|
31
|
+
if (
|
|
32
|
+
child.is_dir()
|
|
33
|
+
and (child / "__init__.py").exists()
|
|
34
|
+
and child.name != "tests"
|
|
35
|
+
):
|
|
32
36
|
return child.name
|
|
33
37
|
|
|
34
38
|
return project_dir.name.replace("-", "_")
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"""Keep shared publication, Pages, and development contracts explicit."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import re
|
|
7
|
+
import tomllib
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
import yaml
|
|
11
|
+
|
|
12
|
+
ROOT = Path(__file__).resolve().parents[1]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _workflow(name: str):
|
|
16
|
+
return yaml.safe_load((ROOT / ".github/workflows" / name).read_text())
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _actions_on(workflow: dict):
|
|
20
|
+
# PyYAML's YAML 1.1 reader represents the Actions ``on`` key as True.
|
|
21
|
+
return workflow["on"] if "on" in workflow else workflow[True]
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_pages_publishes_spec_dashboard_and_supports_manual_refresh():
|
|
25
|
+
workflow = _workflow("pages.yml")
|
|
26
|
+
publisher = workflow["jobs"]["publish-pages"]
|
|
27
|
+
push = _actions_on(workflow)["push"]
|
|
28
|
+
|
|
29
|
+
assert publisher["uses"] == (
|
|
30
|
+
"Knuckles-Team/pipelines/.github/workflows/pages_pipeline.yml@main"
|
|
31
|
+
)
|
|
32
|
+
assert publisher["with"] == {
|
|
33
|
+
"content_source": "docs",
|
|
34
|
+
"spec_dashboard_enabled": True,
|
|
35
|
+
"spec_dashboard_config": ".config/spec-dashboard.json",
|
|
36
|
+
}
|
|
37
|
+
assert "workflow_dispatch" in _actions_on(workflow)
|
|
38
|
+
assert {
|
|
39
|
+
"docs/**",
|
|
40
|
+
"mkdocs.yml",
|
|
41
|
+
"README.md",
|
|
42
|
+
"specs/**",
|
|
43
|
+
".config/spec-dashboard.json",
|
|
44
|
+
".github/workflows/pages.yml",
|
|
45
|
+
} <= set(push["paths"])
|
|
46
|
+
|
|
47
|
+
config = json.loads((ROOT / ".config/spec-dashboard.json").read_text())
|
|
48
|
+
assert config == {
|
|
49
|
+
"version": 1,
|
|
50
|
+
"sources": [{"glob": "specs/*/status.json", "kind": "spec"}],
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def test_release_workflow_uses_shared_connector_publishers():
|
|
55
|
+
workflow = _workflow("pipeline.yml")
|
|
56
|
+
jobs = workflow["jobs"]
|
|
57
|
+
assert set(jobs) == {"publish-pypi", "publish-docker"}
|
|
58
|
+
|
|
59
|
+
pypi = jobs["publish-pypi"]
|
|
60
|
+
assert pypi["uses"].endswith("/python_pipeline.yml@main")
|
|
61
|
+
assert pypi["with"] == {"connector": True}
|
|
62
|
+
|
|
63
|
+
docker = jobs["publish-docker"]
|
|
64
|
+
assert docker["needs"] == "publish-pypi"
|
|
65
|
+
assert docker["uses"].endswith("/container_pipeline.yml@main")
|
|
66
|
+
assert docker["with"] == {"render_connector": True}
|
|
67
|
+
for publisher in (pypi, docker):
|
|
68
|
+
assert "if" not in publisher
|
|
69
|
+
assert not publisher.get("continue-on-error", False)
|
|
70
|
+
|
|
71
|
+
assert not (ROOT / ".github/workflows/docs.yml").exists()
|
|
72
|
+
assert not (ROOT / ".github/workflows/container-release.yml").exists()
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def test_precommit_uses_the_canonical_pipelines_contract():
|
|
76
|
+
config = yaml.safe_load((ROOT / ".pre-commit-config.yaml").read_text())
|
|
77
|
+
pipelines = next(
|
|
78
|
+
repo
|
|
79
|
+
for repo in config["repos"]
|
|
80
|
+
if repo["repo"] == "https://github.com/Knuckles-Team/pipelines"
|
|
81
|
+
)
|
|
82
|
+
assert pipelines["rev"] == "main"
|
|
83
|
+
assert {hook["id"] for hook in pipelines["hooks"]} == {
|
|
84
|
+
"connector-standard",
|
|
85
|
+
"secrets",
|
|
86
|
+
"spec",
|
|
87
|
+
"tests-fast",
|
|
88
|
+
"dependency-readiness",
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def test_development_skill_has_real_delivery_contract_and_actual_tests():
|
|
93
|
+
skill = ROOT / "wger_agent/skills/wger-agent-development/SKILL.md"
|
|
94
|
+
content = skill.read_text()
|
|
95
|
+
|
|
96
|
+
assert "name: wger-agent-development" in content
|
|
97
|
+
assert "## Rapid delivery: the 5-minute contract" in content
|
|
98
|
+
for test_path in (
|
|
99
|
+
"tests/test_publication_workflow.py",
|
|
100
|
+
"tests/test_default_content_surfaces.py",
|
|
101
|
+
"tests/test_fleet_name.py",
|
|
102
|
+
"tests/test_wheel_inventory.py",
|
|
103
|
+
):
|
|
104
|
+
assert test_path in content
|
|
105
|
+
assert (ROOT / test_path).exists()
|
|
106
|
+
assert "WGER_API_KEY" in content
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def test_packaged_skill_and_version_mirrors_are_coherent():
|
|
110
|
+
project = tomllib.loads((ROOT / "pyproject.toml").read_text())["project"]
|
|
111
|
+
version = project["version"]
|
|
112
|
+
readme = (ROOT / "README.md").read_text()
|
|
113
|
+
assert re.search(rf"\*Version: {re.escape(version)}\*", readme)
|
|
114
|
+
lock = (ROOT / "uv.lock").read_text()
|
|
115
|
+
assert f'name = "wger-agent"\nversion = "{version}"' in lock
|
|
116
|
+
package_data = tomllib.loads((ROOT / "pyproject.toml").read_text())["tool"][
|
|
117
|
+
"setuptools"
|
|
118
|
+
]["package-data"]
|
|
119
|
+
assert "skills/**" in package_data["wger_agent"]
|
|
120
|
+
assert (ROOT / "wger_agent/skills/wger-agent-development/SKILL.md").is_file()
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""The published wheel preserves tracked resources and excludes bytecode."""
|
|
2
|
+
|
|
3
|
+
import shutil
|
|
4
|
+
import subprocess
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from zipfile import ZipFile
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def _clean_build_source(root, destination):
|
|
10
|
+
paths = (
|
|
11
|
+
subprocess.check_output(["git", "ls-files", "-z"], cwd=root)
|
|
12
|
+
.decode()
|
|
13
|
+
.split("\0")
|
|
14
|
+
)
|
|
15
|
+
for name in filter(None, paths):
|
|
16
|
+
source = root / name
|
|
17
|
+
if source.is_file():
|
|
18
|
+
target = destination / name
|
|
19
|
+
target.parent.mkdir(parents=True, exist_ok=True)
|
|
20
|
+
shutil.copy2(source, target)
|
|
21
|
+
cache = destination / "wger_agent/connectors/__pycache__/unshipped.pyc"
|
|
22
|
+
cache.parent.mkdir(parents=True, exist_ok=True)
|
|
23
|
+
cache.write_bytes(b"bytecode must not enter a wheel")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def test_wheel_matches_the_full_tracked_package_inventory(tmp_path):
|
|
27
|
+
root = Path(__file__).resolve().parents[1]
|
|
28
|
+
tracked = subprocess.check_output(
|
|
29
|
+
[
|
|
30
|
+
"git",
|
|
31
|
+
"ls-files",
|
|
32
|
+
"--cached",
|
|
33
|
+
"--others",
|
|
34
|
+
"--exclude-standard",
|
|
35
|
+
"--",
|
|
36
|
+
"wger_agent/",
|
|
37
|
+
],
|
|
38
|
+
cwd=root,
|
|
39
|
+
text=True,
|
|
40
|
+
).splitlines()
|
|
41
|
+
source = tmp_path / "source"
|
|
42
|
+
_clean_build_source(root, source)
|
|
43
|
+
output = tmp_path / "dist"
|
|
44
|
+
subprocess.run(
|
|
45
|
+
["uv", "build", "--wheel", "--out-dir", str(output)], cwd=source, check=True
|
|
46
|
+
)
|
|
47
|
+
with ZipFile(next(output.glob("*.whl"))) as wheel:
|
|
48
|
+
payload = {
|
|
49
|
+
name
|
|
50
|
+
for name in wheel.namelist()
|
|
51
|
+
if name.startswith("wger_agent/") and not name.endswith("/")
|
|
52
|
+
}
|
|
53
|
+
assert payload == set(tracked)
|
|
54
|
+
for name in payload:
|
|
55
|
+
assert wheel.read(name) == (root / name).read_bytes(), name
|
|
@@ -86,3 +86,20 @@ def __getattr__(name: str) -> Any:
|
|
|
86
86
|
|
|
87
87
|
def __dir__() -> list[str]:
|
|
88
88
|
return sorted(list(globals().keys()) + __all__)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
from agent_connector_sdk.connector import Connector
|
|
92
|
+
from agent_connector_sdk.connector_hooks import RegistrationContext
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def _register_legacy_surface(context: RegistrationContext) -> None:
|
|
96
|
+
"""Register the existing Wger surface through the public SDK hook."""
|
|
97
|
+
from wger_agent.mcp.mcp_server import register_server_surface
|
|
98
|
+
|
|
99
|
+
register_server_surface(context.server)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
connector = Connector(
|
|
103
|
+
instructions="wger-agent MCP Server — Condensed Action-Routed Tools.",
|
|
104
|
+
extra_registrations=(_register_legacy_surface,),
|
|
105
|
+
)
|
|
@@ -7,7 +7,6 @@ Served live as ``connector://resources``. Regenerate by editing the declarations
|
|
|
7
7
|
from __future__ import annotations
|
|
8
8
|
|
|
9
9
|
from agent_connector_sdk.ingest.live_declaration import source_meta
|
|
10
|
-
from agent_connector_sdk.ingest.sources import IngestSourceDeclaration, IngestSourceSpec
|
|
11
10
|
|
|
12
11
|
CONNECTOR = "wger-mcp"
|
|
13
12
|
|
|
@@ -533,22 +532,3 @@ RESOURCES = (
|
|
|
533
532
|
"name": "WorkoutSession",
|
|
534
533
|
},
|
|
535
534
|
)
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
def declaration() -> IngestSourceDeclaration:
|
|
539
|
-
"""The declaration the server assembles from this module."""
|
|
540
|
-
specs = []
|
|
541
|
-
for item in SOURCES:
|
|
542
|
-
for entry in item["connector_sources"]:
|
|
543
|
-
body = {k: v for k, v in entry.items() if k not in ("tool", "mapping")}
|
|
544
|
-
specs.append(
|
|
545
|
-
IngestSourceSpec.model_validate({**body, "tools": (entry["tool"],)})
|
|
546
|
-
)
|
|
547
|
-
return IngestSourceDeclaration.model_validate(
|
|
548
|
-
{
|
|
549
|
-
"connector": CONNECTOR,
|
|
550
|
-
"sources": specs,
|
|
551
|
-
"schema_mappings": SCHEMA_MAPPINGS,
|
|
552
|
-
"resources": RESOURCES,
|
|
553
|
-
}
|
|
554
|
-
)
|
|
@@ -23,7 +23,8 @@ import sys
|
|
|
23
23
|
from typing import Any
|
|
24
24
|
|
|
25
25
|
from agent_connector_sdk.config import load_config
|
|
26
|
-
from agent_connector_sdk.
|
|
26
|
+
from agent_connector_sdk.connector import build_server
|
|
27
|
+
from agent_connector_sdk.connector_identity import connector_version
|
|
27
28
|
from agent_connector_sdk.mcp.tool_surface import register_tool_surface
|
|
28
29
|
from starlette.requests import Request
|
|
29
30
|
from starlette.responses import JSONResponse
|
|
@@ -32,23 +33,14 @@ from wger_agent.api_client import WgerApi
|
|
|
32
33
|
from wger_agent.auth import get_client
|
|
33
34
|
from wger_agent.mcp import tools
|
|
34
35
|
|
|
35
|
-
__version__ = "
|
|
36
|
+
__version__ = connector_version("wger_agent")
|
|
36
37
|
|
|
37
38
|
logger = get_logger(name="wger-agent")
|
|
38
39
|
logger.setLevel(logging.INFO)
|
|
39
40
|
|
|
40
41
|
|
|
41
|
-
def
|
|
42
|
-
"""
|
|
43
|
-
|
|
44
|
-
Bootstraps FastMCP instance, custom routes, and conditionally registers tools.
|
|
45
|
-
"""
|
|
46
|
-
load_config()
|
|
47
|
-
args, mcp, middlewares = create_mcp_server(
|
|
48
|
-
name="wger-agent MCP",
|
|
49
|
-
version=__version__,
|
|
50
|
-
instructions="wger-agent MCP Server — Condensed Action-Routed Tools.",
|
|
51
|
-
)
|
|
42
|
+
def register_server_surface(mcp):
|
|
43
|
+
"""Reuse the existing health route and Wger API registrations."""
|
|
52
44
|
|
|
53
45
|
@mcp.custom_route("/health", methods=["GET"])
|
|
54
46
|
async def health_check(request: Request | None = None) -> JSONResponse:
|
|
@@ -63,9 +55,12 @@ def get_mcp_instance() -> tuple[Any, ...]:
|
|
|
63
55
|
tools_module=tools,
|
|
64
56
|
)
|
|
65
57
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
58
|
+
|
|
59
|
+
def get_mcp_instance(*, command_args=None) -> tuple[Any, ...]:
|
|
60
|
+
"""Load legacy configuration and compose the declared SDK connector."""
|
|
61
|
+
load_config()
|
|
62
|
+
args, mcp = build_server("wger_agent", command_args=command_args)
|
|
63
|
+
return mcp, args, list(mcp.middleware)
|
|
69
64
|
|
|
70
65
|
|
|
71
66
|
def mcp_server() -> None:
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# wger_agent/mcp_server.py
|
|
2
2
|
"""Backward compatibility wrapper redirecting to wger_agent/mcp/ package."""
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
from agent_connector_sdk.connector_identity import connector_version
|
|
5
|
+
|
|
6
|
+
__version__ = connector_version("wger_agent")
|
|
5
7
|
|
|
6
8
|
from wger_agent.mcp.mcp_server import (
|
|
7
9
|
get_mcp_instance,
|