probity-verify 0.1.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.
Files changed (44) hide show
  1. probity_verify-0.1.0/LICENSE +201 -0
  2. probity_verify-0.1.0/PKG-INFO +76 -0
  3. probity_verify-0.1.0/README.md +54 -0
  4. probity_verify-0.1.0/pyproject.toml +36 -0
  5. probity_verify-0.1.0/setup.cfg +4 -0
  6. probity_verify-0.1.0/src/probity_verify/__init__.py +5 -0
  7. probity_verify-0.1.0/src/probity_verify/a2a_client.py +110 -0
  8. probity_verify-0.1.0/src/probity_verify/a2a_server.py +283 -0
  9. probity_verify-0.1.0/src/probity_verify/adapters/__init__.py +1 -0
  10. probity_verify-0.1.0/src/probity_verify/adapters/authority_anchor.py +148 -0
  11. probity_verify-0.1.0/src/probity_verify/adapters/brokered_file_write.py +165 -0
  12. probity_verify-0.1.0/src/probity_verify/adapters/event_absence.py +239 -0
  13. probity_verify-0.1.0/src/probity_verify/adapters/operand_lineage.py +253 -0
  14. probity_verify-0.1.0/src/probity_verify/adapters/source_coverage.py +180 -0
  15. probity_verify-0.1.0/src/probity_verify/adapters/spend_reservation.py +334 -0
  16. probity_verify-0.1.0/src/probity_verify/broker_records.py +387 -0
  17. probity_verify-0.1.0/src/probity_verify/bundle.py +288 -0
  18. probity_verify-0.1.0/src/probity_verify/cli.py +47 -0
  19. probity_verify-0.1.0/src/probity_verify/common.py +174 -0
  20. probity_verify-0.1.0/src/probity_verify/core.py +148 -0
  21. probity_verify-0.1.0/src/probity_verify/index.py +344 -0
  22. probity_verify-0.1.0/src/probity_verify/json_input.py +64 -0
  23. probity_verify-0.1.0/src/probity_verify.egg-info/PKG-INFO +76 -0
  24. probity_verify-0.1.0/src/probity_verify.egg-info/SOURCES.txt +42 -0
  25. probity_verify-0.1.0/src/probity_verify.egg-info/dependency_links.txt +1 -0
  26. probity_verify-0.1.0/src/probity_verify.egg-info/entry_points.txt +6 -0
  27. probity_verify-0.1.0/src/probity_verify.egg-info/requires.txt +9 -0
  28. probity_verify-0.1.0/src/probity_verify.egg-info/top_level.txt +1 -0
  29. probity_verify-0.1.0/tests/test_a2a_transport.py +276 -0
  30. probity_verify-0.1.0/tests/test_adapter_registry.py +240 -0
  31. probity_verify-0.1.0/tests/test_adjudication.py +186 -0
  32. probity_verify-0.1.0/tests/test_artifact_reader.py +229 -0
  33. probity_verify-0.1.0/tests/test_authority_anchor.py +127 -0
  34. probity_verify-0.1.0/tests/test_brokered_file_write.py +427 -0
  35. probity_verify-0.1.0/tests/test_bundle.py +189 -0
  36. probity_verify-0.1.0/tests/test_cli_commands.py +29 -0
  37. probity_verify-0.1.0/tests/test_consumer_bundle.py +106 -0
  38. probity_verify-0.1.0/tests/test_customer_support_action.py +236 -0
  39. probity_verify-0.1.0/tests/test_event_absence.py +177 -0
  40. probity_verify-0.1.0/tests/test_event_absence_v2.py +132 -0
  41. probity_verify-0.1.0/tests/test_index.py +180 -0
  42. probity_verify-0.1.0/tests/test_operand_lineage.py +205 -0
  43. probity_verify-0.1.0/tests/test_recipes.py +105 -0
  44. probity_verify-0.1.0/tests/test_spend_reservation.py +264 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Sankalp Gilda
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,76 @@
1
+ Metadata-Version: 2.4
2
+ Name: probity-verify
3
+ Version: 0.1.0
4
+ Summary: Check claims against pinned evidence offline, with replayable decisions
5
+ License-Expression: Apache-2.0
6
+ Project-URL: Documentation, https://github.com/probityai/probity-verify/blob/main/docs/install.md
7
+ Project-URL: Source, https://github.com/probityai/probity-verify
8
+ Project-URL: Issues, https://github.com/probityai/probity-verify/issues
9
+ Project-URL: Agent guide, https://github.com/probityai/probity-verify/blob/main/llms.txt
10
+ Keywords: ai-agents,evidence-verification,provenance,offline,audit
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: cryptography<51,>=50.0.2
15
+ Provides-Extra: test
16
+ Requires-Dist: pytest<10,>=8; extra == "test"
17
+ Requires-Dist: hypothesis<7,>=6; extra == "test"
18
+ Provides-Extra: a2a
19
+ Requires-Dist: a2a-sdk[http-server]==1.2.1; extra == "a2a"
20
+ Requires-Dist: uvicorn==0.54.0; extra == "a2a"
21
+ Dynamic: license-file
22
+
23
+ # probity-verify
24
+
25
+ An offline verifier that decides whether a claim holds against evidence bytes the consumer pinned, with adapters for source passages, operand lineage, authority captures, bounded absence and spend journals.
26
+
27
+ It's for auditors, incident reviewers and relying parties who receive a claim about an AI system and need a decision they can replay, not a report they have to trust.
28
+
29
+ ## Quick start
30
+
31
+ There is no package release yet, so pin a commit. Python 3.10 or newer and [uv](https://docs.astral.sh/uv/):
32
+
33
+ ```sh
34
+ git clone https://github.com/probityai/probity-verify && cd probity-verify
35
+ git checkout 588db582c50558f3e2a928be89ffc135188afcdb
36
+ uv run probity-verify examples/source-coverage/case.json \
37
+ --policy examples/source-coverage/policy-june.json
38
+ ```
39
+
40
+ It prints a decision packet that opens:
41
+
42
+ ```text
43
+ Probity decision packet v1
44
+ Case: "source-coverage-demo"
45
+ Claim: source_text_coverage/v1
46
+ Decision: contradicted
47
+ Reason: selected_span_missing_from_record
48
+ Policy SHA-256: dfda1551714f92702169d1411af6b0bfeee54732f934ce71265534af775fa388
49
+ ```
50
+
51
+ A selected passage is in the source capture but missing from the stored report. The packet goes on to list every artifact binding and check. `uv run pytest` runs the test suite.
52
+
53
+ ## Status
54
+
55
+ Version 0.1.0, unreleased. Six adapters ship: `source_text_coverage/v1`, `operand_lineage/v1`, `authority_anchor/v1`, `event_absence/v1`, `event_absence/v2` and `spend_reservation/v1`. Each decision is `supported`, `contradicted` or `not_established`. The verifier checks supplied bytes only: it does not fetch URLs or authenticate the authority a policy names.
56
+
57
+ ## Documentation
58
+
59
+ | page | read it for |
60
+ | --- | --- |
61
+ | [Install a pinned version](https://github.com/probityai/probity-verify/blob/main/docs/install.md) | install outside the source checkout and replay three sample decisions |
62
+ | [Choose a claim check](https://github.com/probityai/probity-verify/blob/main/docs/recipes.md) | select a task from checked recipes and retrieve exact commands and input digests |
63
+ | [Select a consumer adapter](https://github.com/probityai/probity-verify/blob/main/docs/adapter-api.md) | supply exact adapter versions through adjudication, bundle creation and replay |
64
+ | [Check a customer offer](https://github.com/probityai/probity-verify/blob/main/docs/customer-support-action.md) | compare a draft with raw company records and an exact manager approval |
65
+ | <a name="run"></a><a name="inputs-and-decisions"></a>[Running the verifier](https://github.com/probityai/probity-verify/blob/main/docs/running.md) | every example command, the case and policy inputs, and what each decision means |
66
+ | <a name="share-a-replayable-decision"></a><a name="index-decisions-and-disputes"></a>[Replayable decisions and the index](https://github.com/probityai/probity-verify/blob/main/docs/bundles-and-index.md) | ZIP bundles, replay, and the local index of decisions, challenges and supersessions |
67
+ | <a name="operand-lineage"></a><a name="authority-anchor"></a><a name="event-absence"></a>[Adapters](https://github.com/probityai/probity-verify/blob/main/docs/adapters.md) | what operand lineage, authority anchor and event absence check, and what they leave to the consumer |
68
+ | [Spend reservations](https://github.com/probityai/probity-verify/blob/main/docs/spend-reservation.md) | replay a pinned budget journal, refuse dispatch without an affordable reservation, and keep pending calls charged |
69
+ | [Observation vantage](https://github.com/probityai/probity-verify/blob/main/docs/observation-vantage.md) | select the producer and observation scope, replay bounded absence, and operate a witness with separate keys and retained heads |
70
+ | [Adapter plan](https://github.com/probityai/probity-verify/blob/main/docs/architecture.md) | the architecture and the adapters planned next |
71
+ | [A2A server and client](docs/a2a.md) | send raw case bytes to an operator-configured verifier, or read a pinned Lab record |
72
+ | [Source coverage vectors](https://github.com/probityai/probity-verify/blob/main/vectors-source-coverage/README.md) and [operand-lineage vectors](https://github.com/probityai/probity-verify/blob/main/vectors-operand-lineage/README.md) | conformance cases with pinned bytes and expected decisions |
73
+
74
+ ## License
75
+
76
+ Apache-2.0.
@@ -0,0 +1,54 @@
1
+ # probity-verify
2
+
3
+ An offline verifier that decides whether a claim holds against evidence bytes the consumer pinned, with adapters for source passages, operand lineage, authority captures, bounded absence and spend journals.
4
+
5
+ It's for auditors, incident reviewers and relying parties who receive a claim about an AI system and need a decision they can replay, not a report they have to trust.
6
+
7
+ ## Quick start
8
+
9
+ There is no package release yet, so pin a commit. Python 3.10 or newer and [uv](https://docs.astral.sh/uv/):
10
+
11
+ ```sh
12
+ git clone https://github.com/probityai/probity-verify && cd probity-verify
13
+ git checkout 588db582c50558f3e2a928be89ffc135188afcdb
14
+ uv run probity-verify examples/source-coverage/case.json \
15
+ --policy examples/source-coverage/policy-june.json
16
+ ```
17
+
18
+ It prints a decision packet that opens:
19
+
20
+ ```text
21
+ Probity decision packet v1
22
+ Case: "source-coverage-demo"
23
+ Claim: source_text_coverage/v1
24
+ Decision: contradicted
25
+ Reason: selected_span_missing_from_record
26
+ Policy SHA-256: dfda1551714f92702169d1411af6b0bfeee54732f934ce71265534af775fa388
27
+ ```
28
+
29
+ A selected passage is in the source capture but missing from the stored report. The packet goes on to list every artifact binding and check. `uv run pytest` runs the test suite.
30
+
31
+ ## Status
32
+
33
+ Version 0.1.0, unreleased. Six adapters ship: `source_text_coverage/v1`, `operand_lineage/v1`, `authority_anchor/v1`, `event_absence/v1`, `event_absence/v2` and `spend_reservation/v1`. Each decision is `supported`, `contradicted` or `not_established`. The verifier checks supplied bytes only: it does not fetch URLs or authenticate the authority a policy names.
34
+
35
+ ## Documentation
36
+
37
+ | page | read it for |
38
+ | --- | --- |
39
+ | [Install a pinned version](https://github.com/probityai/probity-verify/blob/main/docs/install.md) | install outside the source checkout and replay three sample decisions |
40
+ | [Choose a claim check](https://github.com/probityai/probity-verify/blob/main/docs/recipes.md) | select a task from checked recipes and retrieve exact commands and input digests |
41
+ | [Select a consumer adapter](https://github.com/probityai/probity-verify/blob/main/docs/adapter-api.md) | supply exact adapter versions through adjudication, bundle creation and replay |
42
+ | [Check a customer offer](https://github.com/probityai/probity-verify/blob/main/docs/customer-support-action.md) | compare a draft with raw company records and an exact manager approval |
43
+ | <a name="run"></a><a name="inputs-and-decisions"></a>[Running the verifier](https://github.com/probityai/probity-verify/blob/main/docs/running.md) | every example command, the case and policy inputs, and what each decision means |
44
+ | <a name="share-a-replayable-decision"></a><a name="index-decisions-and-disputes"></a>[Replayable decisions and the index](https://github.com/probityai/probity-verify/blob/main/docs/bundles-and-index.md) | ZIP bundles, replay, and the local index of decisions, challenges and supersessions |
45
+ | <a name="operand-lineage"></a><a name="authority-anchor"></a><a name="event-absence"></a>[Adapters](https://github.com/probityai/probity-verify/blob/main/docs/adapters.md) | what operand lineage, authority anchor and event absence check, and what they leave to the consumer |
46
+ | [Spend reservations](https://github.com/probityai/probity-verify/blob/main/docs/spend-reservation.md) | replay a pinned budget journal, refuse dispatch without an affordable reservation, and keep pending calls charged |
47
+ | [Observation vantage](https://github.com/probityai/probity-verify/blob/main/docs/observation-vantage.md) | select the producer and observation scope, replay bounded absence, and operate a witness with separate keys and retained heads |
48
+ | [Adapter plan](https://github.com/probityai/probity-verify/blob/main/docs/architecture.md) | the architecture and the adapters planned next |
49
+ | [A2A server and client](docs/a2a.md) | send raw case bytes to an operator-configured verifier, or read a pinned Lab record |
50
+ | [Source coverage vectors](https://github.com/probityai/probity-verify/blob/main/vectors-source-coverage/README.md) and [operand-lineage vectors](https://github.com/probityai/probity-verify/blob/main/vectors-operand-lineage/README.md) | conformance cases with pinned bytes and expected decisions |
51
+
52
+ ## License
53
+
54
+ Apache-2.0.
@@ -0,0 +1,36 @@
1
+ [build-system]
2
+ requires = ["setuptools>=69"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "probity-verify"
7
+ version = "0.1.0"
8
+ description = "Check claims against pinned evidence offline, with replayable decisions"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "Apache-2.0"
12
+ dependencies = ["cryptography>=50.0.2,<51"]
13
+ keywords = ["ai-agents", "evidence-verification", "provenance", "offline", "audit"]
14
+
15
+ [project.urls]
16
+ Documentation = "https://github.com/probityai/probity-verify/blob/main/docs/install.md"
17
+ Source = "https://github.com/probityai/probity-verify"
18
+ Issues = "https://github.com/probityai/probity-verify/issues"
19
+ "Agent guide" = "https://github.com/probityai/probity-verify/blob/main/llms.txt"
20
+
21
+ [project.optional-dependencies]
22
+ test = ["pytest>=8,<10", "hypothesis>=6,<7"]
23
+ a2a = ["a2a-sdk[http-server]==1.2.1", "uvicorn==0.54.0"]
24
+
25
+ [tool.pytest.ini_options]
26
+ testpaths = ["tests", "vectors-source-coverage/tests", "vectors-operand-lineage/tests"]
27
+
28
+ [project.scripts]
29
+ probity-verify = "probity_verify.cli:main"
30
+ probity-bundle = "probity_verify.bundle:main"
31
+ probity-index = "probity_verify.index:main"
32
+ probity-a2a = "probity_verify.a2a_server:main"
33
+ probity-a2a-client = "probity_verify.a2a_client:main"
34
+
35
+ [tool.setuptools.packages.find]
36
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,5 @@
1
+ """Consumer-side claim adjudication. No network access or implicit trust roots."""
2
+
3
+ from .core import CaseError, adjudicate
4
+
5
+ __all__ = ["CaseError", "adjudicate"]
@@ -0,0 +1,110 @@
1
+ """Official-SDK client for the optional Verify A2A service."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import asyncio
7
+ import sys
8
+ from pathlib import Path
9
+ from urllib.parse import urlsplit
10
+ from uuid import uuid4
11
+
12
+ import httpx
13
+ from a2a.client import A2ACardResolver, ClientConfig, ClientFactory
14
+ from a2a.types import (
15
+ GetTaskRequest, Message, Part, Role, SendMessageConfiguration,
16
+ SendMessageRequest, TaskState,
17
+ )
18
+ from a2a.utils.errors import A2AError
19
+ from google.protobuf.json_format import MessageToDict
20
+
21
+ from .a2a_server import (
22
+ CASE_MIME, DECISION_MIME, LAB_QUERY_MIME, LAB_RECORD_MIME, MAX_CASE_BYTES,
23
+ digest, parse_raw, read_bounded,
24
+ )
25
+ from .core import CaseError, canonical_json
26
+
27
+
28
+ async def request(base_url: str, raw: bytes, mime: str, pin: str) -> tuple[bytes, str]:
29
+ if not raw or len(raw) > MAX_CASE_BYTES:
30
+ raise CaseError("request bytes exceed the input limit")
31
+ expected_mime = DECISION_MIME if mime == CASE_MIME else LAB_RECORD_MIME
32
+ pin_name = "policy_sha256" if mime == CASE_MIME else "register_sha256"
33
+ origin = urlsplit(base_url)
34
+ if (origin.scheme not in {"http", "https"} or not origin.netloc or origin.path not in {"", "/"}
35
+ or origin.username or origin.password or origin.query or origin.fragment):
36
+ raise CaseError("base URL must be an HTTP origin")
37
+ use_environment = origin.hostname not in {"127.0.0.1", "::1", "localhost"}
38
+ async with httpx.AsyncClient(timeout=30, follow_redirects=False, trust_env=use_environment) as http:
39
+ card = await A2ACardResolver(http, base_url).get_agent_card()
40
+ interfaces = [i for i in card.supported_interfaces
41
+ if i.protocol_binding == "JSONRPC" and i.protocol_version == "1.0"]
42
+ if (len(interfaces) != 1 or urlsplit(interfaces[0].url).scheme != origin.scheme
43
+ or urlsplit(interfaces[0].url).netloc != origin.netloc
44
+ or urlsplit(interfaces[0].url).path != "/a2a/jsonrpc"):
45
+ raise CaseError("agent card must name its own A2A 1.0 JSON-RPC route")
46
+ client = ClientFactory(ClientConfig(streaming=False, httpx_client=http,
47
+ supported_protocol_bindings=["JSONRPC"])).create(card)
48
+ message = Message(message_id=str(uuid4()), role=Role.ROLE_USER,
49
+ parts=[Part(raw=raw, media_type=mime, metadata={
50
+ "length": len(raw), "sha256": digest(raw), pin_name: pin})])
51
+ task = None
52
+ try:
53
+ async for response in client.send_message(SendMessageRequest(
54
+ message=message, configuration=SendMessageConfiguration(return_immediately=False))):
55
+ if response.HasField("task"):
56
+ task = response.task
57
+ if task is None or task.status.state != TaskState.TASK_STATE_COMPLETED:
58
+ raise CaseError("A2A request did not complete")
59
+ retained = await client.get_task(GetTaskRequest(id=task.id))
60
+ if retained != task:
61
+ raise CaseError("retained task differs from the completed response")
62
+ parts = [part for artifact in task.artifacts for part in artifact.parts
63
+ if part.media_type == expected_mime]
64
+ if len(parts) != 1 or parts[0].WhichOneof("content") != "raw":
65
+ raise CaseError("expected one raw result artifact")
66
+ result = parts[0].raw
67
+ metadata = MessageToDict(parts[0].metadata)
68
+ if (metadata.get("sha256") != digest(result) or metadata.get("length") != len(result)
69
+ or metadata.get(pin_name) != pin):
70
+ raise CaseError("result binding differs")
71
+ if mime == CASE_MIME and metadata.get("case_sha256") != digest(raw):
72
+ raise CaseError("result case binding differs")
73
+ parse_raw(result)
74
+ return result, task.id
75
+ finally:
76
+ await client.close()
77
+
78
+
79
+ def main(argv: list[str] | None = None) -> int:
80
+ parser = argparse.ArgumentParser(prog="probity-a2a-client")
81
+ parser.add_argument("--url", default="http://127.0.0.1:41241")
82
+ commands = parser.add_subparsers(dest="command", required=True)
83
+ verify = commands.add_parser("verify")
84
+ verify.add_argument("case", type=Path)
85
+ verify.add_argument("--policy", type=Path, required=True)
86
+ lab = commands.add_parser("lab-record")
87
+ lab.add_argument("record_id")
88
+ lab.add_argument("--register-sha256", required=True)
89
+ args = parser.parse_args(argv)
90
+ try:
91
+ if args.command == "verify":
92
+ raw = read_bounded(args.case, MAX_CASE_BYTES)
93
+ policy = parse_raw(read_bounded(args.policy, 4 * 1024 * 1024))
94
+ pin = digest(canonical_json(policy))
95
+ mime = CASE_MIME
96
+ else:
97
+ raw = canonical_json({"record_id": args.record_id})
98
+ pin = args.register_sha256
99
+ mime = LAB_QUERY_MIME
100
+ result, _ = asyncio.run(request(args.url, raw, mime, pin))
101
+ except (CaseError, ValueError, OSError, RecursionError, httpx.InvalidURL,
102
+ httpx.HTTPError, A2AError) as exc:
103
+ print(f"probity-a2a-client: {exc}", file=sys.stderr)
104
+ return 2
105
+ sys.stdout.buffer.write(result)
106
+ return 0
107
+
108
+
109
+ if __name__ == "__main__":
110
+ raise SystemExit(main())