asap-compliance 1.2.0__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.
@@ -0,0 +1,183 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ /parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template before PyInstaller builds the exe, so may be deleted later.
31
+ *.manifest
32
+ *.spec
33
+
34
+ # Installer logs
35
+ pip-log.txt
36
+ pip-delete-this-directory.txt
37
+
38
+ # Unit test / coverage reports
39
+ htmlcov/
40
+ .tox/
41
+ .nox/
42
+ .coverage
43
+ .coverage.*
44
+ .cache
45
+ nosetests.xml
46
+ coverage.xml
47
+ coverage.json
48
+ *.cover
49
+ *.py,cover
50
+ .status
51
+ .pytest_cache/
52
+ .hypothesis/
53
+ .ruff_cache/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Local SQLite / state DBs (examples, demos, dev)
66
+ *.db
67
+ *.db-journal
68
+
69
+ # Flask stuff:
70
+ instance/
71
+ .webassets-cache
72
+
73
+ # Scrapy stuff:
74
+ .scrapy
75
+
76
+ # Sphinx documentation
77
+ docs/_build/
78
+
79
+ # PyBuilder
80
+ .pybuilder/
81
+ target/
82
+
83
+ # Jupyter Notebook
84
+ .ipynb_checkpoints
85
+
86
+ # IPython
87
+ profile_default/
88
+ ipython_config.py
89
+
90
+ # pyenv
91
+ # For a library or package, you might want to ignore these files since the Python version is usually managed by the user.
92
+ # .python-version
93
+
94
+ # pipenv
95
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
96
+ # However, in case of collaboration, if you work with different OSes or Python versions,
97
+ # it is better to ignore Pipfile.lock.
98
+ # Pipfile.lock
99
+
100
+ # poetry
101
+ # Similar to Pipenv, see https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ # poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipenv, see https://pdm.fming.dev/#use-pdm-in-a-project
106
+ .pdm.toml
107
+ .pdm-python
108
+ .pdm-build/
109
+
110
+ # PEP 582; used by e.g. github.com/fannheyward/coc-pyright
111
+ __pypackages__/
112
+
113
+ # Celery stuff
114
+ celerybeat-schedule
115
+ celerybeat.pid
116
+
117
+ # SageMath parsed files
118
+ *.sage.py
119
+
120
+ # Environments
121
+ .env
122
+ .venv
123
+ env/
124
+ venv/
125
+ ENV/
126
+ env.bak/
127
+ venv.bak/
128
+
129
+ # Local credentials and keys
130
+ *.pem
131
+ *.key
132
+ credentials.json
133
+ # Allow test fixture certs (Sprint T2 mTLS/trust)
134
+ !tests/fixtures/**/*.pem
135
+ !tests/fixtures/**/*.key
136
+
137
+ # Spyder project settings
138
+ .spyderproject
139
+ .spyproject
140
+
141
+ # Rope project settings
142
+ .ropeproject
143
+
144
+ # mkdocs documentation
145
+ /site
146
+
147
+ # mypy
148
+ .mypy_cache/
149
+ .dmypy.json
150
+ dmypy.json
151
+
152
+ # Pyre type checker
153
+ .pyre/
154
+
155
+ # pytype static type analyzer
156
+ .pytype/
157
+
158
+ # Cython debug symbols
159
+ cython_debug/
160
+
161
+ # OS X
162
+ .DS_Store
163
+
164
+ # IDEs
165
+ .idea/
166
+ .vscode/
167
+ *.swp
168
+ *.swo
169
+ *~
170
+
171
+ # Temporary / backup
172
+ *.tmp
173
+ *.temp
174
+ *.bak
175
+
176
+ # Project specific
177
+ !/.cursor/
178
+ node_modules/
179
+ .github/wiki/
180
+
181
+ # Benchmark and cache artifacts
182
+ .benchmarks/
183
+ .uv-cache/
@@ -0,0 +1,95 @@
1
+ Metadata-Version: 2.4
2
+ Name: asap-compliance
3
+ Version: 1.2.0
4
+ Summary: ASAP Protocol compliance testing harness
5
+ Author: ASAP Protocol Contributors
6
+ License: Apache-2.0
7
+ Keywords: asap,compliance,protocol,pytest,testing
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Framework :: Pytest
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Topic :: Software Development :: Testing
15
+ Classifier: Typing :: Typed
16
+ Requires-Python: >=3.13
17
+ Requires-Dist: asap-protocol>=1.2.0
18
+ Requires-Dist: httpx>=0.28.0
19
+ Requires-Dist: pydantic>=2.12.0
20
+ Requires-Dist: pytest>=8.0
21
+ Provides-Extra: dev
22
+ Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
23
+ Requires-Dist: pytest-cov>=6.0; extra == 'dev'
24
+ Requires-Dist: ruff>=0.14.0; extra == 'dev'
25
+ Description-Content-Type: text/markdown
26
+
27
+ # ASAP Compliance Harness
28
+
29
+ Protocol compliance testing suite for ASAP (Async Simple Agent Protocol) implementations.
30
+
31
+ ## Overview
32
+
33
+ The Compliance Harness validates that ASAP agents follow the protocol specification. Third parties can use this package to certify their agents are ASAP-compliant, enabling ecosystem interoperability.
34
+
35
+ ## Installation
36
+
37
+ ```bash
38
+ uv add asap-compliance
39
+ # or
40
+ pip install asap-compliance
41
+ ```
42
+
43
+ ## Usage
44
+
45
+ Run compliance tests against an agent:
46
+
47
+ ```bash
48
+ pytest --asap-agent-url https://your-agent.example.com -m asap_compliance
49
+ ```
50
+
51
+ Or set the agent URL via environment variable:
52
+
53
+ ```bash
54
+ ASAP_AGENT_URL=https://your-agent.example.com pytest -m asap_compliance
55
+ ```
56
+
57
+ ## Test Categories
58
+
59
+ - **handshake** (implemented): Agent connection, health/content-type, manifest schema,
60
+ signature verification, version negotiation
61
+ - **schema** (implemented): Pydantic model compliance (Envelope, TaskRequest,
62
+ TaskResponse, McpToolResult, MessageAck, extensions, extra='forbid')
63
+ - **state**: Task state machine transitions
64
+
65
+ ## Programmatic Usage
66
+
67
+ ```python
68
+ # Handshake validation (against live agent)
69
+ from asap_compliance import ComplianceConfig, validate_handshake
70
+
71
+ config = ComplianceConfig(agent_url="https://your-agent.example.com")
72
+ result = validate_handshake(config)
73
+ if result.passed:
74
+ print("Agent is compliant")
75
+ else:
76
+ for check in result.checks:
77
+ if not check.passed:
78
+ print(f"FAIL: {check.name} - {check.message}")
79
+
80
+ # Schema validation (static, for envelope/payload dicts)
81
+ from asap_compliance import validate_schema
82
+
83
+ envelope_dict = {"asap_version": "0.1", "sender": "urn:asap:agent:a", ...}
84
+ schema_result = validate_schema(envelope_dict)
85
+ if schema_result.passed:
86
+ print("Envelope and payload schema valid")
87
+ ```
88
+
89
+ ## Development
90
+
91
+ ```bash
92
+ cd asap-compliance
93
+ uv sync
94
+ uv run pytest
95
+ ```
@@ -0,0 +1,69 @@
1
+ # ASAP Compliance Harness
2
+
3
+ Protocol compliance testing suite for ASAP (Async Simple Agent Protocol) implementations.
4
+
5
+ ## Overview
6
+
7
+ The Compliance Harness validates that ASAP agents follow the protocol specification. Third parties can use this package to certify their agents are ASAP-compliant, enabling ecosystem interoperability.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ uv add asap-compliance
13
+ # or
14
+ pip install asap-compliance
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ Run compliance tests against an agent:
20
+
21
+ ```bash
22
+ pytest --asap-agent-url https://your-agent.example.com -m asap_compliance
23
+ ```
24
+
25
+ Or set the agent URL via environment variable:
26
+
27
+ ```bash
28
+ ASAP_AGENT_URL=https://your-agent.example.com pytest -m asap_compliance
29
+ ```
30
+
31
+ ## Test Categories
32
+
33
+ - **handshake** (implemented): Agent connection, health/content-type, manifest schema,
34
+ signature verification, version negotiation
35
+ - **schema** (implemented): Pydantic model compliance (Envelope, TaskRequest,
36
+ TaskResponse, McpToolResult, MessageAck, extensions, extra='forbid')
37
+ - **state**: Task state machine transitions
38
+
39
+ ## Programmatic Usage
40
+
41
+ ```python
42
+ # Handshake validation (against live agent)
43
+ from asap_compliance import ComplianceConfig, validate_handshake
44
+
45
+ config = ComplianceConfig(agent_url="https://your-agent.example.com")
46
+ result = validate_handshake(config)
47
+ if result.passed:
48
+ print("Agent is compliant")
49
+ else:
50
+ for check in result.checks:
51
+ if not check.passed:
52
+ print(f"FAIL: {check.name} - {check.message}")
53
+
54
+ # Schema validation (static, for envelope/payload dicts)
55
+ from asap_compliance import validate_schema
56
+
57
+ envelope_dict = {"asap_version": "0.1", "sender": "urn:asap:agent:a", ...}
58
+ schema_result = validate_schema(envelope_dict)
59
+ if schema_result.passed:
60
+ print("Envelope and payload schema valid")
61
+ ```
62
+
63
+ ## Development
64
+
65
+ ```bash
66
+ cd asap-compliance
67
+ uv sync
68
+ uv run pytest
69
+ ```
@@ -0,0 +1,7 @@
1
+ """ASAP Compliance Harness - Protocol compliance testing suite.
2
+
3
+ Validates that ASAP implementations follow the protocol specification.
4
+ Third parties can use this package to certify their agents are ASAP-compliant.
5
+ """
6
+
7
+ __version__ = "1.2.0"
@@ -0,0 +1,22 @@
1
+ """Configuration for ASAP compliance harness."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pydantic import BaseModel, Field
6
+
7
+
8
+ class ComplianceConfig(BaseModel):
9
+ agent_url: str = Field(..., description="Base URL of the agent under test")
10
+ timeout_seconds: float = Field(default=30.0, gt=0, description="HTTP timeout in seconds")
11
+ test_categories: list[str] = Field(
12
+ default=["handshake", "schema", "state"],
13
+ description="Test categories to run",
14
+ )
15
+ sla_skill_id: str = Field(
16
+ default="echo",
17
+ description="Skill ID for SLA and state validation (agent must implement this skill)",
18
+ )
19
+ skip_checks: list[str] = Field(
20
+ default_factory=list,
21
+ description="Check names to skip (e.g. 'sla' to skip SLA timeout check)",
22
+ )
@@ -0,0 +1,32 @@
1
+ """Test harness for ASAP protocol compliance evaluation."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from asap_compliance.config import ComplianceConfig
6
+ from asap_compliance.validators.handshake import (
7
+ HandshakeResult,
8
+ validate_handshake,
9
+ validate_handshake_async,
10
+ )
11
+ from asap_compliance.validators.schema import SchemaResult, validate_schema
12
+ from asap_compliance.validators.sla import SlaResult, validate_sla, validate_sla_async
13
+ from asap_compliance.validators.state import (
14
+ StateResult,
15
+ validate_state_machine,
16
+ validate_state_machine_async,
17
+ )
18
+
19
+ __all__ = [
20
+ "ComplianceConfig",
21
+ "HandshakeResult",
22
+ "SchemaResult",
23
+ "SlaResult",
24
+ "StateResult",
25
+ "validate_handshake",
26
+ "validate_handshake_async",
27
+ "validate_schema",
28
+ "validate_sla",
29
+ "validate_sla_async",
30
+ "validate_state_machine",
31
+ "validate_state_machine_async",
32
+ ]
@@ -0,0 +1,52 @@
1
+ """Pytest plugin for ASAP compliance harness.
2
+
3
+ Provides:
4
+ - Fixture: compliance_harness
5
+ - Marker: @pytest.mark.asap_compliance
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import os
11
+
12
+ import pytest
13
+
14
+ from asap_compliance.config import ComplianceConfig
15
+
16
+ MARKER_NAME = "asap_compliance"
17
+ MARKER_HELP = "Marks a test as an ASAP protocol compliance test."
18
+
19
+
20
+ def pytest_addoption(parser: pytest.Parser) -> None:
21
+ group = parser.getgroup("asap-compliance", description="ASAP protocol compliance options")
22
+ group.addoption(
23
+ "--asap-agent-url",
24
+ action="store",
25
+ dest="asap_agent_url",
26
+ default=os.environ.get("ASAP_AGENT_URL", "http://localhost:8000"),
27
+ help="Base URL of the ASAP agent under test (default: ASAP_AGENT_URL or http://localhost:8000)",
28
+ )
29
+ group.addoption(
30
+ "--asap-timeout",
31
+ action="store",
32
+ type=float,
33
+ dest="asap_timeout",
34
+ default=30.0,
35
+ help="HTTP timeout in seconds for compliance requests (default: 30.0)",
36
+ )
37
+
38
+
39
+ def pytest_configure(config: pytest.Config) -> None:
40
+ config.addinivalue_line("markers", f"{MARKER_NAME}: {MARKER_HELP}")
41
+
42
+
43
+ @pytest.fixture
44
+ def compliance_harness(request: pytest.FixtureRequest) -> ComplianceConfig:
45
+ config = request.config
46
+ agent_url = config.getoption("asap_agent_url", default="http://localhost:8000")
47
+ timeout = config.getoption("asap_timeout", default=30.0)
48
+ return ComplianceConfig(
49
+ agent_url=agent_url,
50
+ timeout_seconds=timeout,
51
+ test_categories=["handshake", "schema", "state"],
52
+ )
@@ -0,0 +1,43 @@
1
+ """ASAP compliance validators."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from asap_compliance.validators.handshake import (
6
+ CheckResult,
7
+ HandshakeResult,
8
+ validate_handshake,
9
+ validate_handshake_async,
10
+ )
11
+ from asap_compliance.validators.schema import (
12
+ SchemaResult,
13
+ validate_envelope,
14
+ validate_payload,
15
+ validate_schema,
16
+ )
17
+ from asap_compliance.validators.sla import (
18
+ SlaResult,
19
+ validate_sla,
20
+ validate_sla_async,
21
+ )
22
+ from asap_compliance.validators.state import (
23
+ StateResult,
24
+ validate_state_machine,
25
+ validate_state_machine_async,
26
+ )
27
+
28
+ __all__ = [
29
+ "CheckResult",
30
+ "HandshakeResult",
31
+ "SchemaResult",
32
+ "StateResult",
33
+ "validate_envelope",
34
+ "validate_handshake",
35
+ "validate_handshake_async",
36
+ "validate_payload",
37
+ "validate_schema",
38
+ "validate_sla",
39
+ "validate_sla_async",
40
+ "validate_state_machine",
41
+ "validate_state_machine_async",
42
+ "SlaResult",
43
+ ]