Metadata-Version: 2.4
Name: pos-connect
Version: 0.1.4
Summary: Client plugin that puts an AI agent tool behind a Proof-of-Silence gate (fail-closed).
Author-email: Jerzy Skiba <sales@neonai.shop>
License-Expression: Apache-2.0
Project-URL: Homepage, https://neonai.shop
Project-URL: Source, https://github.com/Jerryolo/pos-connect
Project-URL: Issues, https://github.com/Jerryolo/pos-connect/issues
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: NOTICE
Provides-Extra: langchain
Requires-Dist: langchain-core>=0.3; extra == "langchain"
Provides-Extra: crewai
Requires-Dist: crewai>=0.80; extra == "crewai"
Provides-Extra: openai-agents
Requires-Dist: openai-agents>=0.1; extra == "openai-agents"
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Dynamic: license-file

# PoS Connect 0.1.2 — one plugin for every agent

**Jerzy Skiba · neonai.shop** · Proof-of-Silence™

PoS Connect is a client plugin that puts an AI agent tool behind a
Proof-of-Silence gate. One core, thin adapters:

| Where your agent runs | How to connect |
|---|---|
| Any Python function | `@pos_guard(client, "send_email")` |
| LangChain | `pos_connect.adapters.langchain.guard_tools(tools, client)` |
| CrewAI | `pos_connect.adapters.crewai.guard_tools(tools, client)` |
| OpenAI Agents SDK | `pos_connect.adapters.openai_agents.guard_tools(tools, client)` |
| Any MCP client (Claude, Cursor, …) | `pos-mcp-proxy --gate URL -- <mcp server command>` |

The plugin talks to your gate only over HTTP (`CONTRACT.md`). **The engine
is not in this repository.** This plugin alone is not a Proof-of-Silence
gate, signs nothing, and does not by itself authorise any action. To get a
signed decision record you need a paid Proof-of-Silence gate from
[neonai.shop](https://neonai.shop). Wrapped tools fail closed if no gate is
reachable. `testgate.py` is a local test stub only — it is not
Proof-of-Silence and must not be used as a production gate.

This software was adversarially tested by the author and QA-tested by other AI models; no independent professional security audit yet.

Licence of this plugin: Apache License 2.0 (see `LICENSE` and `NOTICE`).
The Proof-of-Silence engine and gate are not included and are not Apache-2.0.

## Quick start

```python
from pos_connect import GateClient, evidence_hash, pos_guard

client = GateClient("https://gate.example.com", agent="sales-agent")  # token: env POS_GATE_TOKEN

@pos_guard(client, "send_email", evidence=lambda p: [evidence_hash(ticket_text)])
def send_email(to: str, body: str): ...
```

Only `ACT_NOW` runs the tool. `WAIT`, `SILENCE`, `REJECT`, timeouts, errors and any malformed
or mismatched gate answer block it (fail-closed). Adapters return a short "BLOCKED" message
to the model instead of running the tool.

MCP (e.g. Claude Desktop config):

```json
{ "command": "pos-mcp-proxy",
  "args": ["--gate", "https://gate.example.com", "--agent", "desktop", "--", "npx", "your-mcp-server"] }
```

Evidence: the real gate needs at least one piece of evidence per action (by hash; the
content stays with you). No evidence → `WAIT EVIDENCE_MISSING`. A grant authorises exactly
the parameters it names.

## Protections

- Secret-looking keys (`token`, `password`, `api_key`, …) redacted at every depth before sending.
- `request_id` and recomputed `params_hash` must match; an allow without `record_hash` is rejected.
- HTTPS required (plain HTTP only for localhost).
- MCP proxy: duplicate JSON keys, obfuscated method names, tool calls in batches and
  `tools/call` notifications are never forwarded.

## Limits (honest)

- The client does not verify signatures; verify gate records with the PoS offline verifier.
- Secrets inside free-text values (e.g. an email body) are not detected.
- `testgate.py` is a test stub only. It is **not** Proof-of-Silence and signs nothing.
- MCP proxy sends no evidence yet, so with a real 1.1.2 gate tool calls end in `WAIT`.
- Your gate must speak `pos-connect/1`; if your current `/v1/gate` differs, add a thin
  adapter in front of the gate (that adapter is not part of this repository).

Using this plugin does not by itself make any system meet any law.


## Examples

Short scripts in `examples/`:

- `01_pos_guard.py` — `@pos_guard` decorator
- `02_gate_client.py` — `GateClient` and fail-closed handling
- `03_langchain.py` — LangChain adapter (`pip install "pos-connect[langchain]"`)
- `04_crewai.py` — CrewAI adapter (`pip install "pos-connect[crewai]"`)
- `05_openai_agents.py` — OpenAI Agents SDK adapter (`pip install "pos-connect[openai-agents]"`)
- `06_mcp_proxy.py` — MCP proxy (`pos-mcp-proxy`)
- `07_testgate_local.py` — local demo with the test stub (NOT a Proof-of-Silence gate)

For a signed decision record you need a paid Proof-of-Silence gate from neonai.shop.
The first six examples use `POS_GATE_URL`. `07_testgate_local.py` runs on 127.0.0.1
without a real gate, and is a stub only.

Tests: `pip install -e ".[dev]" && pytest` runs the core and MCP tests with the
standard library plus pytest. Adapter tests need the optional extras
`langchain`, `crewai` and `openai-agents`; without them those tests are skipped.
