pos-connect 0.1.3__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 (37) hide show
  1. pos_connect-0.1.3/CHANGES.txt +34 -0
  2. pos_connect-0.1.3/CONTRACT.md +60 -0
  3. pos_connect-0.1.3/LICENSE +201 -0
  4. pos_connect-0.1.3/MANIFEST.in +5 -0
  5. pos_connect-0.1.3/NOTICE +17 -0
  6. pos_connect-0.1.3/PKG-INFO +116 -0
  7. pos_connect-0.1.3/PROOF_OF_WORK.txt +9 -0
  8. pos_connect-0.1.3/README.md +93 -0
  9. pos_connect-0.1.3/README.pl.md +95 -0
  10. pos_connect-0.1.3/examples/01_pos_guard.py +23 -0
  11. pos_connect-0.1.3/examples/02_gate_client.py +20 -0
  12. pos_connect-0.1.3/examples/03_langchain.py +24 -0
  13. pos_connect-0.1.3/examples/04_crewai.py +23 -0
  14. pos_connect-0.1.3/examples/05_openai_agents.py +30 -0
  15. pos_connect-0.1.3/examples/06_mcp_proxy.py +19 -0
  16. pos_connect-0.1.3/examples/07_testgate_local.py +24 -0
  17. pos_connect-0.1.3/pos_connect/__init__.py +9 -0
  18. pos_connect-0.1.3/pos_connect/adapters/__init__.py +1 -0
  19. pos_connect-0.1.3/pos_connect/adapters/crewai.py +41 -0
  20. pos_connect-0.1.3/pos_connect/adapters/langchain.py +35 -0
  21. pos_connect-0.1.3/pos_connect/adapters/openai_agents.py +38 -0
  22. pos_connect-0.1.3/pos_connect/client.py +254 -0
  23. pos_connect-0.1.3/pos_connect/guard.py +68 -0
  24. pos_connect-0.1.3/pos_connect/mcp_proxy.py +154 -0
  25. pos_connect-0.1.3/pos_connect/testgate.py +72 -0
  26. pos_connect-0.1.3/pos_connect.egg-info/PKG-INFO +116 -0
  27. pos_connect-0.1.3/pos_connect.egg-info/SOURCES.txt +35 -0
  28. pos_connect-0.1.3/pos_connect.egg-info/dependency_links.txt +1 -0
  29. pos_connect-0.1.3/pos_connect.egg-info/entry_points.txt +2 -0
  30. pos_connect-0.1.3/pos_connect.egg-info/requires.txt +12 -0
  31. pos_connect-0.1.3/pos_connect.egg-info/top_level.txt +1 -0
  32. pos_connect-0.1.3/pyproject.toml +32 -0
  33. pos_connect-0.1.3/setup.cfg +4 -0
  34. pos_connect-0.1.3/tests/conftest.py +28 -0
  35. pos_connect-0.1.3/tests/test_adapters.py +85 -0
  36. pos_connect-0.1.3/tests/test_core.py +123 -0
  37. pos_connect-0.1.3/tests/test_mcp.py +65 -0
@@ -0,0 +1,34 @@
1
+ PoS Connect 0.1.2 (public plugin tree, not published)
2
+
3
+ Versus public 0.1.1 proposal:
4
+
5
+ - Version bumped to 0.1.2 in pyproject.toml, pos_connect/__init__.py,
6
+ README.md, README.pl.md and NOTICE.
7
+ - Added examples/: 01_pos_guard, 02_gate_client, 03_langchain, 04_crewai,
8
+ 05_openai_agents, 06_mcp_proxy, 07_testgate_local. Each header states that
9
+ a paid Proof-of-Silence gate from neonai.shop is needed for real proof.
10
+ 07 is labelled as a test stub, not a PoS gate. READMEs (EN+PL) link them.
11
+ - Wheel packages only pos_connect (tests and examples excluded). Optional
12
+ extras langchain / crewai / openai-agents unchanged. MANIFEST.in lists
13
+ docs, tests and examples for the source tree / sdist.
14
+ - Python library code is unchanged from 0.1.1 aside from __version__.
15
+
16
+ Earlier 0.1.1 public-proposal changes versus the uploaded Standard 0.1.1 ZIP:
17
+
18
+ - LICENSE.md (Standard/Commercial proprietary, no public redistribution)
19
+ replaced by official Apache License 2.0 in LICENSE, copyright 2026 Jerzy Skiba.
20
+ - Added NOTICE: plugin-only Apache-2.0; engine/gate stay separate; testgate warning.
21
+ - pyproject.toml: license = "Apache-2.0" (SPDX string + license-files).
22
+ - README.md and README.pl.md: verbatim audit sentence; plugin is not a gate
23
+ and needs a paid gate from neonai.shop; shop edition terms removed;
24
+ unverifiable e2e claim and "EU AI Act requirements" sentence removed.
25
+ - PROOF_OF_WORK.txt: dropped "VERIFIED 17/17, see private shim package".
26
+ - tests/test_adapters.py: pytest.importorskip so missing extras skip, not fail.
27
+ - CONTRACT.md: removed an empty code fence (cosmetic).
28
+
29
+ PoS Connect 0.1.3 changes versus 0.1.2:
30
+
31
+ - pyproject.toml: added readme = "README.md" so the PyPI project page shows
32
+ the English README instead of an empty description.
33
+ - pyproject.toml: added [project.urls] (Homepage, Source, Issues).
34
+ - No change to pos_connect/ source code, tests or examples.
@@ -0,0 +1,60 @@
1
+ # Gate contract `pos-connect/1`
2
+
3
+ PoS Connect knows only this HTTP contract. It contains no engine logic.
4
+ Your Proof-of-Silence gate (or a thin shim in front of it) must implement it.
5
+
6
+ ## Request
7
+
8
+ `POST {gate_url}/v1/gate` · `Content-Type: application/json` · `Authorization: Bearer <token>`
9
+
10
+ ```json
11
+ {
12
+ "contract": "pos-connect/1",
13
+ "request_id": "uuid4, new for every call",
14
+ "agent": "demo-agent",
15
+ "action": "send_email",
16
+ "origin": "model | operator | attachment | ...",
17
+ "params": { "...": "tool arguments, secret-looking keys already [REDACTED], NFC-normalised" },
18
+ "params_hash": "sha256:<hex of canonical JSON of params>",
19
+ "evidence": [{"content_hash": "sha256:...", "origin": "customer",
20
+ "received_at": "2026-11-27T09:00:00+00:00", "label": "ticket #4471"}],
21
+ "context": {},
22
+ "client_ts": 1795435560
23
+ }
24
+ ```
25
+
26
+ Evidence is referenced by hash only; the content never leaves the client. `origin`,
27
+ `received_at` and `label` are optional (gate defaults: the request origin, and the time
28
+ the gate received it). The real PoS 1.1.2 gate requires at least one piece of evidence
29
+ for every action — without it the answer is `WAIT EVIDENCE_MISSING`.
30
+
31
+ Canonical JSON = sorted keys, separators `,` and `:`, UTF-8, no ASCII escaping, strings NFC.
32
+
33
+ ## Response (HTTP 200)
34
+
35
+ ```json
36
+ {
37
+ "request_id": "same as request",
38
+ "params_hash": "recomputed by the gate from params",
39
+ "verdict": "ACT_NOW | WAIT | SILENCE | REJECT",
40
+ "reasons": ["..."],
41
+ "record_hash": "sha256:<hash of the signed gate record>",
42
+ "grant_id": "optional"
43
+ }
44
+ ```
45
+
46
+ With the PoS 1.1.2 gate, `params_hash` is the value stored in the signed decision record,
47
+ and `reasons` lists failed checks as `CHECK:CODE` (e.g. `PERMISSION:NO_VALID_GRANT`).
48
+
49
+ ## Client rule (fail-closed)
50
+
51
+ The tool runs **only** if all are true: HTTP 200, valid JSON object ≤ 64 KB,
52
+ `request_id` echoed, `params_hash` matches, `verdict == "ACT_NOW"`, `record_hash` present.
53
+ Anything else blocks the tool. Blocks decided by the client are marked `local: true`
54
+ (not a signed gate record).
55
+
56
+ ## What the client does NOT prove
57
+
58
+ The client does not verify the gate's signature (it has no key). It trusts the gate over
59
+ HTTPS + bearer token. Signed proof lives in the gate's chain and is checked with the
60
+ Proof-of-Silence offline verifier using `record_hash`.
@@ -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 those parts
104
+ of 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 those parts 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, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, or
149
+ MERCHANTABILITY. 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 Jerzy Skiba
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,5 @@
1
+ include LICENSE NOTICE README.md README.pl.md CONTRACT.md PROOF_OF_WORK.txt CHANGES.txt pyproject.toml
2
+ recursive-include pos_connect *
3
+ recursive-include tests *
4
+ recursive-include examples *
5
+ global-exclude __pycache__ *.py[cod] .pytest_cache
@@ -0,0 +1,17 @@
1
+ PoS Connect 0.1.2
2
+ Copyright 2026 Jerzy Skiba
3
+
4
+ This repository is the PoS Connect client plugin only. It is licensed under
5
+ the Apache License, Version 2.0 (see LICENSE).
6
+
7
+ This plugin is not the Proof-of-Silence engine or gate. The engine, the
8
+ gate, and any adapter in front of a gate stay separate and are not covered
9
+ by this Apache-2.0 grant. A working Proof-of-Silence gate licence is sold
10
+ separately at neonai.shop.
11
+
12
+ "Proof-of-Silence", "PoS Connect" and the PoS mark are trademarks used by
13
+ Jerzy Skiba. This licence does not grant trademark rights beyond the
14
+ reasonable use described in Apache-2.0 section 6.
15
+
16
+ pos_connect/testgate.py is a local test stub. It is not Proof-of-Silence
17
+ and signs nothing. Do not use it as a production gate.
@@ -0,0 +1,116 @@
1
+ Metadata-Version: 2.4
2
+ Name: pos-connect
3
+ Version: 0.1.3
4
+ Summary: Client plugin that puts an AI agent tool behind a Proof-of-Silence gate (fail-closed).
5
+ Author-email: Jerzy Skiba <sales@neonai.shop>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://neonai.shop
8
+ Project-URL: Source, https://github.com/Jerryolo/pos-connect
9
+ Project-URL: Issues, https://github.com/Jerryolo/pos-connect/issues
10
+ Requires-Python: >=3.10
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ License-File: NOTICE
14
+ Provides-Extra: langchain
15
+ Requires-Dist: langchain-core>=0.3; extra == "langchain"
16
+ Provides-Extra: crewai
17
+ Requires-Dist: crewai>=0.80; extra == "crewai"
18
+ Provides-Extra: openai-agents
19
+ Requires-Dist: openai-agents>=0.1; extra == "openai-agents"
20
+ Provides-Extra: dev
21
+ Requires-Dist: pytest; extra == "dev"
22
+ Dynamic: license-file
23
+
24
+ # PoS Connect 0.1.2 — one plugin for every agent
25
+
26
+ **Jerzy Skiba · neonai.shop** · Proof-of-Silence™
27
+
28
+ PoS Connect is a client plugin that puts an AI agent tool behind a
29
+ Proof-of-Silence gate. One core, thin adapters:
30
+
31
+ | Where your agent runs | How to connect |
32
+ |---|---|
33
+ | Any Python function | `@pos_guard(client, "send_email")` |
34
+ | LangChain | `pos_connect.adapters.langchain.guard_tools(tools, client)` |
35
+ | CrewAI | `pos_connect.adapters.crewai.guard_tools(tools, client)` |
36
+ | OpenAI Agents SDK | `pos_connect.adapters.openai_agents.guard_tools(tools, client)` |
37
+ | Any MCP client (Claude, Cursor, …) | `pos-mcp-proxy --gate URL -- <mcp server command>` |
38
+
39
+ The plugin talks to your gate only over HTTP (`CONTRACT.md`). **The engine
40
+ is not in this repository.** This plugin alone is not a Proof-of-Silence
41
+ gate, signs nothing, and does not by itself authorise any action. To get a
42
+ signed decision record you need a paid Proof-of-Silence gate from
43
+ [neonai.shop](https://neonai.shop). Wrapped tools fail closed if no gate is
44
+ reachable. `testgate.py` is a local test stub only — it is not
45
+ Proof-of-Silence and must not be used as a production gate.
46
+
47
+ This software was adversarially tested by the author and QA-tested by other AI models; no independent professional security audit yet.
48
+
49
+ Licence of this plugin: Apache License 2.0 (see `LICENSE` and `NOTICE`).
50
+ The Proof-of-Silence engine and gate are not included and are not Apache-2.0.
51
+
52
+ ## Quick start
53
+
54
+ ```python
55
+ from pos_connect import GateClient, evidence_hash, pos_guard
56
+
57
+ client = GateClient("https://gate.example.com", agent="sales-agent") # token: env POS_GATE_TOKEN
58
+
59
+ @pos_guard(client, "send_email", evidence=lambda p: [evidence_hash(ticket_text)])
60
+ def send_email(to: str, body: str): ...
61
+ ```
62
+
63
+ Only `ACT_NOW` runs the tool. `WAIT`, `SILENCE`, `REJECT`, timeouts, errors and any malformed
64
+ or mismatched gate answer block it (fail-closed). Adapters return a short "BLOCKED" message
65
+ to the model instead of running the tool.
66
+
67
+ MCP (e.g. Claude Desktop config):
68
+
69
+ ```json
70
+ { "command": "pos-mcp-proxy",
71
+ "args": ["--gate", "https://gate.example.com", "--agent", "desktop", "--", "npx", "your-mcp-server"] }
72
+ ```
73
+
74
+ Evidence: the real gate needs at least one piece of evidence per action (by hash; the
75
+ content stays with you). No evidence → `WAIT EVIDENCE_MISSING`. A grant authorises exactly
76
+ the parameters it names.
77
+
78
+ ## Protections
79
+
80
+ - Secret-looking keys (`token`, `password`, `api_key`, …) redacted at every depth before sending.
81
+ - `request_id` and recomputed `params_hash` must match; an allow without `record_hash` is rejected.
82
+ - HTTPS required (plain HTTP only for localhost).
83
+ - MCP proxy: duplicate JSON keys, obfuscated method names, tool calls in batches and
84
+ `tools/call` notifications are never forwarded.
85
+
86
+ ## Limits (honest)
87
+
88
+ - The client does not verify signatures; verify gate records with the PoS offline verifier.
89
+ - Secrets inside free-text values (e.g. an email body) are not detected.
90
+ - `testgate.py` is a test stub only. It is **not** Proof-of-Silence and signs nothing.
91
+ - MCP proxy sends no evidence yet, so with a real 1.1.2 gate tool calls end in `WAIT`.
92
+ - Your gate must speak `pos-connect/1`; if your current `/v1/gate` differs, add a thin
93
+ adapter in front of the gate (that adapter is not part of this repository).
94
+
95
+ Using this plugin does not by itself make any system meet any law.
96
+
97
+
98
+ ## Examples
99
+
100
+ Short scripts in `examples/`:
101
+
102
+ - `01_pos_guard.py` — `@pos_guard` decorator
103
+ - `02_gate_client.py` — `GateClient` and fail-closed handling
104
+ - `03_langchain.py` — LangChain adapter (`pip install "pos-connect[langchain]"`)
105
+ - `04_crewai.py` — CrewAI adapter (`pip install "pos-connect[crewai]"`)
106
+ - `05_openai_agents.py` — OpenAI Agents SDK adapter (`pip install "pos-connect[openai-agents]"`)
107
+ - `06_mcp_proxy.py` — MCP proxy (`pos-mcp-proxy`)
108
+ - `07_testgate_local.py` — local demo with the test stub (NOT a Proof-of-Silence gate)
109
+
110
+ For a signed decision record you need a paid Proof-of-Silence gate from neonai.shop.
111
+ The first six examples use `POS_GATE_URL`. `07_testgate_local.py` runs on 127.0.0.1
112
+ without a real gate, and is a stub only.
113
+
114
+ Tests: `pip install -e ".[dev]" && pytest` runs the core and MCP tests with the
115
+ standard library plus pytest. Adapter tests need the optional extras
116
+ `langchain`, `crewai` and `openai-agents`; without them those tests are skipped.
@@ -0,0 +1,9 @@
1
+ Unit and local contract tests live in tests/.
2
+ Run: pip install -e ".[dev]" && pytest
3
+ Core and MCP tests use only the standard library, pytest, and a local
4
+ test stub on 127.0.0.1 (pos_connect/testgate.py). That stub is not
5
+ Proof-of-Silence and signs nothing.
6
+ Adapter tests are skipped unless the optional extras are installed.
7
+ An end-to-end run against a real Proof-of-Silence gate is not included
8
+ in this public package and is not claimed here as independently checkable
9
+ proof.
@@ -0,0 +1,93 @@
1
+ # PoS Connect 0.1.2 — one plugin for every agent
2
+
3
+ **Jerzy Skiba · neonai.shop** · Proof-of-Silence™
4
+
5
+ PoS Connect is a client plugin that puts an AI agent tool behind a
6
+ Proof-of-Silence gate. One core, thin adapters:
7
+
8
+ | Where your agent runs | How to connect |
9
+ |---|---|
10
+ | Any Python function | `@pos_guard(client, "send_email")` |
11
+ | LangChain | `pos_connect.adapters.langchain.guard_tools(tools, client)` |
12
+ | CrewAI | `pos_connect.adapters.crewai.guard_tools(tools, client)` |
13
+ | OpenAI Agents SDK | `pos_connect.adapters.openai_agents.guard_tools(tools, client)` |
14
+ | Any MCP client (Claude, Cursor, …) | `pos-mcp-proxy --gate URL -- <mcp server command>` |
15
+
16
+ The plugin talks to your gate only over HTTP (`CONTRACT.md`). **The engine
17
+ is not in this repository.** This plugin alone is not a Proof-of-Silence
18
+ gate, signs nothing, and does not by itself authorise any action. To get a
19
+ signed decision record you need a paid Proof-of-Silence gate from
20
+ [neonai.shop](https://neonai.shop). Wrapped tools fail closed if no gate is
21
+ reachable. `testgate.py` is a local test stub only — it is not
22
+ Proof-of-Silence and must not be used as a production gate.
23
+
24
+ This software was adversarially tested by the author and QA-tested by other AI models; no independent professional security audit yet.
25
+
26
+ Licence of this plugin: Apache License 2.0 (see `LICENSE` and `NOTICE`).
27
+ The Proof-of-Silence engine and gate are not included and are not Apache-2.0.
28
+
29
+ ## Quick start
30
+
31
+ ```python
32
+ from pos_connect import GateClient, evidence_hash, pos_guard
33
+
34
+ client = GateClient("https://gate.example.com", agent="sales-agent") # token: env POS_GATE_TOKEN
35
+
36
+ @pos_guard(client, "send_email", evidence=lambda p: [evidence_hash(ticket_text)])
37
+ def send_email(to: str, body: str): ...
38
+ ```
39
+
40
+ Only `ACT_NOW` runs the tool. `WAIT`, `SILENCE`, `REJECT`, timeouts, errors and any malformed
41
+ or mismatched gate answer block it (fail-closed). Adapters return a short "BLOCKED" message
42
+ to the model instead of running the tool.
43
+
44
+ MCP (e.g. Claude Desktop config):
45
+
46
+ ```json
47
+ { "command": "pos-mcp-proxy",
48
+ "args": ["--gate", "https://gate.example.com", "--agent", "desktop", "--", "npx", "your-mcp-server"] }
49
+ ```
50
+
51
+ Evidence: the real gate needs at least one piece of evidence per action (by hash; the
52
+ content stays with you). No evidence → `WAIT EVIDENCE_MISSING`. A grant authorises exactly
53
+ the parameters it names.
54
+
55
+ ## Protections
56
+
57
+ - Secret-looking keys (`token`, `password`, `api_key`, …) redacted at every depth before sending.
58
+ - `request_id` and recomputed `params_hash` must match; an allow without `record_hash` is rejected.
59
+ - HTTPS required (plain HTTP only for localhost).
60
+ - MCP proxy: duplicate JSON keys, obfuscated method names, tool calls in batches and
61
+ `tools/call` notifications are never forwarded.
62
+
63
+ ## Limits (honest)
64
+
65
+ - The client does not verify signatures; verify gate records with the PoS offline verifier.
66
+ - Secrets inside free-text values (e.g. an email body) are not detected.
67
+ - `testgate.py` is a test stub only. It is **not** Proof-of-Silence and signs nothing.
68
+ - MCP proxy sends no evidence yet, so with a real 1.1.2 gate tool calls end in `WAIT`.
69
+ - Your gate must speak `pos-connect/1`; if your current `/v1/gate` differs, add a thin
70
+ adapter in front of the gate (that adapter is not part of this repository).
71
+
72
+ Using this plugin does not by itself make any system meet any law.
73
+
74
+
75
+ ## Examples
76
+
77
+ Short scripts in `examples/`:
78
+
79
+ - `01_pos_guard.py` — `@pos_guard` decorator
80
+ - `02_gate_client.py` — `GateClient` and fail-closed handling
81
+ - `03_langchain.py` — LangChain adapter (`pip install "pos-connect[langchain]"`)
82
+ - `04_crewai.py` — CrewAI adapter (`pip install "pos-connect[crewai]"`)
83
+ - `05_openai_agents.py` — OpenAI Agents SDK adapter (`pip install "pos-connect[openai-agents]"`)
84
+ - `06_mcp_proxy.py` — MCP proxy (`pos-mcp-proxy`)
85
+ - `07_testgate_local.py` — local demo with the test stub (NOT a Proof-of-Silence gate)
86
+
87
+ For a signed decision record you need a paid Proof-of-Silence gate from neonai.shop.
88
+ The first six examples use `POS_GATE_URL`. `07_testgate_local.py` runs on 127.0.0.1
89
+ without a real gate, and is a stub only.
90
+
91
+ Tests: `pip install -e ".[dev]" && pytest` runs the core and MCP tests with the
92
+ standard library plus pytest. Adapter tests need the optional extras
93
+ `langchain`, `crewai` and `openai-agents`; without them those tests are skipped.
@@ -0,0 +1,95 @@
1
+ # PoS Connect 0.1.2 — jedna wtyczka dla każdego agenta
2
+
3
+ **Jerzy Skiba · neonai.shop** · Proof-of-Silence™
4
+
5
+ PoS Connect to wtyczka-klient, która stawia narzędzie agenta AI za bramką
6
+ Proof-of-Silence. Jeden rdzeń, cienkie adaptery:
7
+
8
+ | Gdzie działa agent | Jak podłączyć |
9
+ |---|---|
10
+ | Dowolna funkcja Python | `@pos_guard(client, "send_email")` |
11
+ | LangChain | `pos_connect.adapters.langchain.guard_tools(tools, client)` |
12
+ | CrewAI | `pos_connect.adapters.crewai.guard_tools(tools, client)` |
13
+ | OpenAI Agents SDK | `pos_connect.adapters.openai_agents.guard_tools(tools, client)` |
14
+ | Każdy klient MCP (Claude, Cursor, …) | `pos-mcp-proxy --gate URL -- <komenda serwera MCP>` |
15
+
16
+ Wtyczka rozmawia z bramką wyłącznie przez HTTP (`CONTRACT.md`). **Silnika nie
17
+ ma w tym repozytorium.** Sama wtyczka nie jest bramką Proof-of-Silence,
18
+ niczego nie podpisuje i sama z siebie nie daje zgody na działanie. Żeby
19
+ mieć podpisany rekord decyzji, potrzebna jest płatna bramka Proof-of-Silence
20
+ z [neonai.shop](https://neonai.shop). Narzędzia owinięte wtyczką przy braku
21
+ bramki kończą się blokadą (fail-closed). `testgate.py` to tylko lokalna
22
+ atrapa do testów — to nie jest Proof-of-Silence i nie wolno jej używać jako
23
+ bramki produkcyjnej.
24
+
25
+ This software was adversarially tested by the author and QA-tested by other AI models; no independent professional security audit yet.
26
+
27
+ Licencja tej wtyczki: Apache License 2.0 (zob. `LICENSE` i `NOTICE`).
28
+ Silnik i bramka Proof-of-Silence nie wchodzą w skład tego repozytorium
29
+ i nie są objęte Apache-2.0.
30
+
31
+ ## Szybki start
32
+
33
+ ```python
34
+ from pos_connect import GateClient, evidence_hash, pos_guard
35
+
36
+ client = GateClient("https://gate.example.com", agent="sales-agent") # token: zmienna POS_GATE_TOKEN
37
+
38
+ @pos_guard(client, "send_email", evidence=lambda p: [evidence_hash(ticket_text)])
39
+ def send_email(to: str, body: str): ...
40
+ ```
41
+
42
+ Tylko `ACT_NOW` uruchamia narzędzie. `WAIT`, `SILENCE`, `REJECT`, przekroczony czas, błędy
43
+ i każda zniekształcona lub niezgodna odpowiedź bramki blokują je (fail-closed). Adaptery
44
+ zwracają modelowi krótki komunikat „BLOCKED” zamiast wykonać narzędzie.
45
+
46
+ MCP (np. konfiguracja Claude Desktop):
47
+
48
+ ```json
49
+ { "command": "pos-mcp-proxy",
50
+ "args": ["--gate", "https://gate.example.com", "--agent", "desktop", "--", "npx", "twoj-serwer-mcp"] }
51
+ ```
52
+
53
+ Dowody: prawdziwa bramka wymaga co najmniej jednego dowodu na każdą akcję (jako hash;
54
+ treść zostaje u Ciebie). Bez dowodu → `WAIT EVIDENCE_MISSING`. Grant zezwala dokładnie na
55
+ parametry, które wymienia.
56
+
57
+ ## Zabezpieczenia
58
+
59
+ - Klucze wyglądające na sekrety (`token`, `password`, `api_key`, …) są ukrywane na każdym poziomie zagnieżdżenia przed wysłaniem.
60
+ - `request_id` i przeliczony `params_hash` muszą się zgadzać; zgoda bez `record_hash` jest odrzucana.
61
+ - Wymagane HTTPS (zwykłe HTTP tylko dla localhost).
62
+ - Proxy MCP nie przepuszcza: zduplikowanych kluczy JSON, zamaskowanych nazw metod,
63
+ wywołań narzędzi w paczkach (batch) ani `tools/call` jako powiadomień.
64
+
65
+ ## Ograniczenia (uczciwie)
66
+
67
+ - Klient nie weryfikuje podpisów — rekordy bramki sprawdzasz weryfikatorem offline PoS.
68
+ - Sekrety ukryte w zwykłym tekście (np. treść maila) nie są wykrywane.
69
+ - `testgate.py` to tylko atrapa do testów. **To nie jest** Proof-of-Silence i niczego nie podpisuje.
70
+ - Proxy MCP nie wysyła jeszcze dowodów, więc z prawdziwą bramką 1.1.2 wywołania kończą się `WAIT`.
71
+ - Twoja bramka musi mówić `pos-connect/1`; jeśli obecne `/v1/gate` jest inne — dodaj cienki
72
+ adapter przed bramką (tego adaptera nie ma w tym repozytorium).
73
+
74
+ Samo użycie tej wtyczki nie sprawia, że system spełnia jakiekolwiek prawo.
75
+
76
+
77
+ ## Przykłady
78
+
79
+ Krótkie skrypty w `examples/`:
80
+
81
+ - `01_pos_guard.py` — dekorator `@pos_guard`
82
+ - `02_gate_client.py` — `GateClient` i obsługa fail-closed
83
+ - `03_langchain.py` — adapter LangChain (`pip install "pos-connect[langchain]"`)
84
+ - `04_crewai.py` — adapter CrewAI (`pip install "pos-connect[crewai]"`)
85
+ - `05_openai_agents.py` — adapter OpenAI Agents SDK (`pip install "pos-connect[openai-agents]"`)
86
+ - `06_mcp_proxy.py` — proxy MCP (`pos-mcp-proxy`)
87
+ - `07_testgate_local.py` — lokalne demo z atrapą testową (to NIE jest bramka Proof-of-Silence)
88
+
89
+ Żeby mieć podpisany rekord decyzji, potrzebna jest płatna bramka Proof-of-Silence
90
+ z neonai.shop. Pierwsze sześć przykładów używa `POS_GATE_URL`.
91
+ `07_testgate_local.py` działa na 127.0.0.1 bez prawdziwej bramki i jest tylko atrapą.
92
+
93
+ Testy: `pip install -e ".[dev]" && pytest` uruchamia testy rdzenia i MCP
94
+ (biblioteka standardowa plus pytest). Testy adapterów wymagają dodatków
95
+ `langchain`, `crewai` i `openai-agents`; bez nich są pomijane.
@@ -0,0 +1,23 @@
1
+ # Needs a paid Proof-of-Silence gate from neonai.shop for real proof.
2
+ # This plugin alone is not a PoS gate and signs nothing.
3
+ # Example: wrap a Python function with @pos_guard.
4
+ import os
5
+ import sys
6
+
7
+ from pos_connect import GateClient, PoSBlocked, evidence_hash, pos_guard
8
+
9
+ url = os.environ.get("POS_GATE_URL")
10
+ if not url:
11
+ sys.exit("Set POS_GATE_URL to your paid Proof-of-Silence gate (neonai.shop).")
12
+
13
+ client = GateClient(url, agent="sales-agent") # token: env POS_GATE_TOKEN
14
+ ticket_text = "Customer asked for a copy of the invoice."
15
+
16
+ @pos_guard(client, "send_email", evidence=lambda p: [evidence_hash(ticket_text)])
17
+ def send_email(to: str, body: str) -> str:
18
+ return f"sent to {to}"
19
+
20
+ try:
21
+ print(send_email("ada@example.com", "Here is your invoice."))
22
+ except PoSBlocked as exc:
23
+ print("blocked (fail-closed):", exc)