pos-connect 0.1.3__py3-none-any.whl

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,9 @@
1
+ """PoS Connect - one universal plugin that puts any AI agent tool behind a
2
+ Proof-of-Silence gate (HTTP contract pos-connect/1). Fail-closed."""
3
+ from .client import (CONTRACT, Decision, GateClient, PoSBlocked, blocked_message,
4
+ evidence_hash, params_hash, redact)
5
+ from .guard import guard_callable, pos_guard
6
+
7
+ __version__ = "0.1.2"
8
+ __all__ = ["CONTRACT", "Decision", "GateClient", "PoSBlocked", "blocked_message",
9
+ "evidence_hash", "params_hash", "redact", "pos_guard", "guard_callable", "__version__"]
@@ -0,0 +1 @@
1
+ """Thin framework adapters. Each one only routes a tool call through GateClient.decide()."""
@@ -0,0 +1,41 @@
1
+ """CrewAI adapter: guard_tool(tool, client) -> CrewAI BaseTool that asks the gate before
2
+ running the wrapped tool."""
3
+ from __future__ import annotations
4
+
5
+ from typing import Any
6
+
7
+ from crewai.tools import BaseTool
8
+ from pydantic import PrivateAttr
9
+
10
+ from ..client import GateClient, blocked_message
11
+
12
+
13
+ class PoSGuardedTool(BaseTool):
14
+ _inner: Any = PrivateAttr()
15
+ _client: Any = PrivateAttr()
16
+ _action: str = PrivateAttr()
17
+ _origin: str = PrivateAttr()
18
+ _evidence: Any = PrivateAttr(default=None)
19
+
20
+ def _run(self, *args: Any, **kwargs: Any) -> Any:
21
+ params = dict(kwargs)
22
+ if args:
23
+ params["args"] = list(args)
24
+ d = self._client.decide(self._action, params, origin=self._origin,
25
+ evidence=self._evidence(params) if self._evidence else None)
26
+ if not d.allowed:
27
+ return blocked_message(d)
28
+ return self._inner.run(*args, **kwargs)
29
+
30
+
31
+ def guard_tool(tool: BaseTool, client: GateClient, *, action: str | None = None,
32
+ origin: str = "model", evidence=None) -> PoSGuardedTool:
33
+ g = PoSGuardedTool(name=tool.name, description=tool.description,
34
+ args_schema=tool.args_schema)
35
+ g._inner, g._client = tool, client
36
+ g._action, g._origin, g._evidence = action or tool.name, origin, evidence
37
+ return g
38
+
39
+
40
+ def guard_tools(tools, client: GateClient, **kw):
41
+ return [guard_tool(t, client, **kw) for t in tools]
@@ -0,0 +1,35 @@
1
+ """LangChain adapter: guard_tool(tool, client) -> new StructuredTool with the same name,
2
+ description and args schema, whose every call goes through the gate first."""
3
+ from __future__ import annotations
4
+
5
+ import asyncio
6
+
7
+ from langchain_core.tools import BaseTool, StructuredTool
8
+
9
+ from ..client import GateClient, blocked_message
10
+
11
+
12
+ def guard_tool(tool: BaseTool, client: GateClient, *, action: str | None = None,
13
+ origin: str = "model", evidence=None) -> StructuredTool:
14
+ name = action or tool.name
15
+
16
+ def run(**kwargs):
17
+ d = client.decide(name, kwargs, origin=origin, evidence=evidence(kwargs) if evidence else None)
18
+ if not d.allowed:
19
+ return blocked_message(d)
20
+ return tool.invoke(kwargs)
21
+
22
+ async def arun(**kwargs):
23
+ d = await asyncio.to_thread(client.decide, name, kwargs, origin=origin,
24
+ evidence=evidence(kwargs) if evidence else None)
25
+ if not d.allowed:
26
+ return blocked_message(d)
27
+ return await tool.ainvoke(kwargs)
28
+
29
+ return StructuredTool.from_function(
30
+ func=run, coroutine=arun, name=tool.name, description=tool.description,
31
+ args_schema=tool.args_schema, infer_schema=False)
32
+
33
+
34
+ def guard_tools(tools, client: GateClient, **kw):
35
+ return [guard_tool(t, client, **kw) for t in tools]
@@ -0,0 +1,38 @@
1
+ """OpenAI Agents SDK adapter: guard_tool(function_tool, client) -> copy of the FunctionTool whose
2
+ on_invoke_tool asks the gate first. Blocked calls return a message to the model; the tool never runs."""
3
+ from __future__ import annotations
4
+
5
+ import asyncio
6
+ import copy
7
+ import json
8
+
9
+ from agents import FunctionTool
10
+
11
+ from ..client import GateClient, blocked_message
12
+
13
+
14
+ def guard_tool(tool: FunctionTool, client: GateClient, *, action: str | None = None,
15
+ origin: str = "model", evidence=None) -> FunctionTool:
16
+ inner = tool.on_invoke_tool
17
+ name = action or tool.name
18
+
19
+ async def on_invoke(ctx, input_json: str):
20
+ try:
21
+ params = json.loads(input_json) if input_json else {}
22
+ if not isinstance(params, dict):
23
+ params = {"input": params}
24
+ except (TypeError, ValueError):
25
+ params = {"raw_input": str(input_json)[:2000]}
26
+ d = await asyncio.to_thread(client.decide, name, params, origin=origin,
27
+ evidence=evidence(params) if evidence else None)
28
+ if not d.allowed:
29
+ return blocked_message(d)
30
+ return await inner(ctx, input_json)
31
+
32
+ guarded = copy.copy(tool)
33
+ guarded.on_invoke_tool = on_invoke
34
+ return guarded
35
+
36
+
37
+ def guard_tools(tools, client: GateClient, **kw):
38
+ return [guard_tool(t, client, **kw) for t in tools]
pos_connect/client.py ADDED
@@ -0,0 +1,254 @@
1
+ """PoS Connect - gate client.
2
+
3
+ Talks to a Proof-of-Silence gate ONLY over HTTP (contract "pos-connect/1",
4
+ see CONTRACT.md). It contains no engine logic: the gate decides, this
5
+ client enforces the decision and fails closed on anything unexpected.
6
+
7
+ Rule: the wrapped action runs only when the gate returned ACT_NOW for
8
+ exactly this request (same request_id, same params_hash). Everything
9
+ else - WAIT, SILENCE, REJECT, unknown verdict, timeout, HTTP error,
10
+ malformed JSON, mismatched echo - blocks the action.
11
+ """
12
+ from __future__ import annotations
13
+
14
+ import hashlib
15
+ import json
16
+ import os
17
+ import threading
18
+ import time
19
+ import unicodedata
20
+ import urllib.error
21
+ import urllib.request
22
+ import uuid
23
+ from dataclasses import dataclass, field
24
+ from typing import Any, Mapping
25
+ from urllib.parse import urlparse
26
+
27
+ CONTRACT = "pos-connect/1"
28
+ ALLOW = "ACT_NOW"
29
+ KNOWN_VERDICTS = {"ACT_NOW", "WAIT", "SILENCE", "REJECT"}
30
+
31
+ # Keys whose values never leave the process (redacted at every depth).
32
+ SECRET_MARKERS = (
33
+ "password", "passwd", "secret", "token", "api_key", "apikey",
34
+ "authorization", "private_key", "cookie", "session", "credential",
35
+ )
36
+ REDACTED = "[REDACTED]"
37
+ MAX_RESPONSE_BYTES = 64 * 1024
38
+
39
+
40
+ class PoSBlocked(Exception):
41
+ """Raised when the gate did not allow the action. The action did NOT run."""
42
+
43
+ def __init__(self, decision: "Decision"):
44
+ self.decision = decision
45
+ super().__init__(
46
+ f"Proof-of-Silence blocked '{decision.action}': "
47
+ f"{decision.verdict} {list(decision.reasons)}"
48
+ )
49
+
50
+
51
+ @dataclass(frozen=True)
52
+ class Decision:
53
+ request_id: str
54
+ action: str
55
+ verdict: str
56
+ reasons: tuple = ()
57
+ record_hash: str | None = None
58
+ local: bool = False # True = decided by this client (gate not reached / invalid answer), NOT a signed gate record
59
+ raw: Mapping[str, Any] = field(default_factory=dict)
60
+
61
+ @property
62
+ def allowed(self) -> bool:
63
+ return self.verdict == ALLOW and not self.local
64
+
65
+
66
+ def _is_secret_key(key: str) -> bool:
67
+ k = key.lower().replace("-", "_")
68
+ return any(m in k for m in SECRET_MARKERS)
69
+
70
+
71
+ def redact(value: Any) -> Any:
72
+ """Recursively redact secret-looking keys (nested dicts and lists too)."""
73
+ if isinstance(value, Mapping):
74
+ return {
75
+ str(k): (REDACTED if _is_secret_key(str(k)) else redact(v))
76
+ for k, v in value.items()
77
+ }
78
+ if isinstance(value, (list, tuple)):
79
+ return [redact(v) for v in value]
80
+ return value
81
+
82
+
83
+ def canonical_json(value: Any) -> bytes:
84
+ """Sorted keys, compact separators, NFC-normalised strings, UTF-8."""
85
+ def norm(v):
86
+ if isinstance(v, str):
87
+ return unicodedata.normalize("NFC", v)
88
+ if isinstance(v, Mapping):
89
+ return {norm(str(k)): norm(x) for k, x in v.items()}
90
+ if isinstance(v, (list, tuple)):
91
+ return [norm(x) for x in v]
92
+ return v
93
+ return json.dumps(norm(value), sort_keys=True, separators=(",", ":"),
94
+ ensure_ascii=False, default=str).encode("utf-8")
95
+
96
+
97
+ def params_hash(params: Mapping[str, Any]) -> str:
98
+ return "sha256:" + hashlib.sha256(canonical_json(params)).hexdigest()
99
+
100
+
101
+ def _evidence_list(items) -> list[dict]:
102
+ """Evidence = references by hash. A string is a content_hash; a dict may add
103
+ origin, received_at (ISO-8601 with offset) and label. The content never leaves you."""
104
+ out = []
105
+ for it in items or []:
106
+ if isinstance(it, str):
107
+ it = {"content_hash": it}
108
+ if not isinstance(it, Mapping) or not isinstance(it.get("content_hash"), str):
109
+ continue
110
+ out.append({k: str(it[k]) for k in ("content_hash", "origin", "received_at", "label") if k in it})
111
+ return out
112
+
113
+
114
+ def evidence_hash(content: bytes | str) -> str:
115
+ """sha256:<hex> of a piece of evidence (e.g. the ticket text) - send this, not the content."""
116
+ if isinstance(content, str):
117
+ content = content.encode("utf-8")
118
+ return "sha256:" + hashlib.sha256(content).hexdigest()
119
+
120
+
121
+ def _clean(text: Any, limit: int = 200) -> str:
122
+ """Strip control / zero-width characters before echoing anything back to a model."""
123
+ s = str(text)
124
+ s = "".join(ch for ch in s if unicodedata.category(ch)[0] != "C")
125
+ return s[:limit]
126
+
127
+
128
+ class GateClient:
129
+ """HTTP client for a Proof-of-Silence gate.
130
+
131
+ gate_url base URL of the gate, e.g. https://gate.example.com (POST {gate_url}/v1/gate)
132
+ token bearer token; default env POS_GATE_TOKEN
133
+ agent agent identifier sent with every request
134
+ receipts optional path to a local JSONL file of client receipts (unsigned, for your own audit)
135
+ """
136
+
137
+ def __init__(self, gate_url: str | None = None, *, token: str | None = None,
138
+ agent: str = "agent", timeout: float = 10.0,
139
+ receipts: str | None = None, allow_insecure_http: bool = False):
140
+ gate_url = (gate_url or os.environ.get("POS_GATE_URL", "")).rstrip("/")
141
+ if not gate_url:
142
+ raise ValueError("gate_url missing (argument or POS_GATE_URL)")
143
+ u = urlparse(gate_url)
144
+ local_host = u.hostname in ("localhost", "127.0.0.1", "::1")
145
+ if u.scheme != "https" and not (u.scheme == "http" and (local_host or allow_insecure_http)):
146
+ raise ValueError("gate_url must be https:// (plain http only for localhost)")
147
+ self.endpoint = gate_url + "/v1/gate"
148
+ self.token = token if token is not None else os.environ.get("POS_GATE_TOKEN")
149
+ self.agent = agent
150
+ self.timeout = timeout
151
+ self.receipts = receipts
152
+ self._lock = threading.Lock()
153
+
154
+ # -- public -----------------------------------------------------------
155
+ def decide(self, action: str, params: Mapping[str, Any] | None = None, *,
156
+ origin: str = "model", evidence: list | None = None,
157
+ context: Mapping[str, Any] | None = None) -> Decision:
158
+ """Ask the gate. Never raises for gate problems - returns a blocking Decision instead."""
159
+ params = dict(params or {})
160
+ # redact, then round-trip through canonical JSON so what is sent == what is hashed
161
+ safe_params = json.loads(canonical_json(redact(params)))
162
+ req = {
163
+ "contract": CONTRACT,
164
+ "request_id": str(uuid.uuid4()),
165
+ "agent": self.agent,
166
+ "action": action,
167
+ "origin": origin,
168
+ "params": safe_params,
169
+ "params_hash": params_hash(safe_params),
170
+ "evidence": _evidence_list(evidence),
171
+ "context": dict(context or {}),
172
+ "client_ts": int(time.time()),
173
+ }
174
+ decision = self._call(req)
175
+ self._write_receipt(req, decision)
176
+ return decision
177
+
178
+ def require(self, action: str, params: Mapping[str, Any] | None = None, **kw) -> Decision:
179
+ """Like decide(), but raises PoSBlocked unless the action is allowed."""
180
+ d = self.decide(action, params, **kw)
181
+ if not d.allowed:
182
+ raise PoSBlocked(d)
183
+ return d
184
+
185
+ # -- internals --------------------------------------------------------
186
+ def _local(self, req, reason) -> Decision:
187
+ return Decision(request_id=req["request_id"], action=req["action"],
188
+ verdict="REJECT", reasons=(reason,), local=True)
189
+
190
+ def _call(self, req: dict) -> Decision:
191
+ body = json.dumps(req, ensure_ascii=False).encode("utf-8")
192
+ headers = {"Content-Type": "application/json", "Accept": "application/json"}
193
+ if self.token:
194
+ headers["Authorization"] = f"Bearer {self.token}"
195
+ http_req = urllib.request.Request(self.endpoint, data=body, headers=headers, method="POST")
196
+ try:
197
+ with urllib.request.urlopen(http_req, timeout=self.timeout) as resp:
198
+ if resp.status != 200:
199
+ return self._local(req, f"GATE_HTTP_{resp.status}")
200
+ raw = resp.read(MAX_RESPONSE_BYTES + 1)
201
+ except urllib.error.HTTPError as e:
202
+ return self._local(req, f"GATE_HTTP_{e.code}")
203
+ except Exception:
204
+ return self._local(req, "GATE_UNREACHABLE")
205
+ if len(raw) > MAX_RESPONSE_BYTES:
206
+ return self._local(req, "GATE_RESPONSE_TOO_LARGE")
207
+ try:
208
+ data = json.loads(raw.decode("utf-8"))
209
+ except Exception:
210
+ return self._local(req, "GATE_RESPONSE_NOT_JSON")
211
+ if not isinstance(data, dict):
212
+ return self._local(req, "GATE_RESPONSE_NOT_OBJECT")
213
+ if data.get("request_id") != req["request_id"]:
214
+ return self._local(req, "GATE_REQUEST_ID_MISMATCH")
215
+ if data.get("params_hash") != req["params_hash"]:
216
+ return self._local(req, "GATE_PARAMS_HASH_MISMATCH")
217
+ verdict = data.get("verdict")
218
+ if not isinstance(verdict, str) or verdict not in KNOWN_VERDICTS:
219
+ return self._local(req, "GATE_VERDICT_UNKNOWN")
220
+ reasons = data.get("reasons") or []
221
+ if not isinstance(reasons, list):
222
+ reasons = [reasons]
223
+ record_hash = data.get("record_hash")
224
+ if verdict == ALLOW and not (isinstance(record_hash, str) and record_hash.startswith("sha256:")):
225
+ # an allow without a gate record is not evidence of a decision
226
+ return self._local(req, "GATE_ALLOW_WITHOUT_RECORD")
227
+ return Decision(request_id=req["request_id"], action=req["action"], verdict=verdict,
228
+ reasons=tuple(_clean(r, 80) for r in reasons[:20]),
229
+ record_hash=record_hash if isinstance(record_hash, str) else None,
230
+ raw=data)
231
+
232
+ def _write_receipt(self, req: dict, d: Decision) -> None:
233
+ if not self.receipts:
234
+ return
235
+ line = {
236
+ "receipt": "pos-connect/client-receipt-1 (unsigned)",
237
+ "request_id": d.request_id, "action": d.action, "agent": req["agent"],
238
+ "params_hash": req["params_hash"], "verdict": d.verdict,
239
+ "reasons": list(d.reasons), "record_hash": d.record_hash,
240
+ "local_decision": d.local, "ts": req["client_ts"],
241
+ }
242
+ try:
243
+ with self._lock, open(self.receipts, "a", encoding="utf-8") as f:
244
+ f.write(json.dumps(line, ensure_ascii=False) + "\n")
245
+ except OSError:
246
+ pass # receipts are a convenience; the gate holds the signed record
247
+
248
+
249
+ def blocked_message(d: Decision) -> str:
250
+ """Safe, short text for a model when an action was blocked."""
251
+ src = "local (gate not confirmed)" if d.local else "gate"
252
+ return (f"BLOCKED by Proof-of-Silence: action '{_clean(d.action, 80)}' was NOT executed. "
253
+ f"Verdict {d.verdict} ({src}); reasons: {', '.join(d.reasons) or '-'}. "
254
+ f"Do not retry the same request; a human must decide or provide evidence.")
pos_connect/guard.py ADDED
@@ -0,0 +1,68 @@
1
+ """@pos_guard - put any Python function (sync or async) behind the gate."""
2
+ from __future__ import annotations
3
+
4
+ import functools
5
+ import inspect
6
+ from typing import Any, Callable
7
+
8
+ from .client import GateClient, PoSBlocked, blocked_message
9
+
10
+
11
+ def _bound_params(fn: Callable, args, kwargs) -> dict:
12
+ try:
13
+ ba = inspect.signature(fn).bind_partial(*args, **kwargs)
14
+ ba.apply_defaults()
15
+ return {k: v for k, v in ba.arguments.items() if k not in ("self", "cls")}
16
+ except (TypeError, ValueError):
17
+ return {"args": list(args), "kwargs": dict(kwargs)}
18
+
19
+
20
+ def pos_guard(client: GateClient, action: str | None = None, *, origin: str = "model",
21
+ on_block: str = "raise", evidence: Callable[[dict], list] | None = None):
22
+ """Decorator. on_block = "raise" (PoSBlocked) or "message" (return text for the model).
23
+ evidence(params) -> list of evidence hashes/dicts sent with each request (the real gate
24
+ requires at least one piece of evidence per action)."""
25
+ if on_block not in ("raise", "message"):
26
+ raise ValueError("on_block must be 'raise' or 'message'")
27
+
28
+ def deco(fn: Callable) -> Callable:
29
+ name = action or fn.__name__
30
+
31
+ def _blocked(d):
32
+ if on_block == "message":
33
+ return blocked_message(d)
34
+ raise PoSBlocked(d)
35
+
36
+ if inspect.iscoroutinefunction(fn):
37
+ @functools.wraps(fn)
38
+ async def awrapper(*args, **kwargs):
39
+ import asyncio
40
+ params = _bound_params(fn, args, kwargs)
41
+ d = await asyncio.to_thread(client.decide, name, params, origin=origin,
42
+ evidence=evidence(params) if evidence else None)
43
+ if not d.allowed:
44
+ return _blocked(d)
45
+ return await fn(*args, **kwargs)
46
+ awrapper.__pos_guarded__ = True
47
+ return awrapper
48
+
49
+ @functools.wraps(fn)
50
+ def wrapper(*args, **kwargs):
51
+ params = _bound_params(fn, args, kwargs)
52
+ d = client.decide(name, params, origin=origin,
53
+ evidence=evidence(params) if evidence else None)
54
+ if not d.allowed:
55
+ return _blocked(d)
56
+ return fn(*args, **kwargs)
57
+ wrapper.__pos_guarded__ = True
58
+ return wrapper
59
+
60
+ return deco
61
+
62
+
63
+ def guard_callable(client: GateClient, fn: Callable, action: str, *, origin: str = "model",
64
+ on_block: str = "raise", evidence=None) -> Callable:
65
+ return pos_guard(client, action, origin=origin, on_block=on_block, evidence=evidence)(fn)
66
+
67
+
68
+ __all__ = ["pos_guard", "guard_callable"]
@@ -0,0 +1,154 @@
1
+ """MCP stdio proxy: sits between ANY MCP client (Claude Desktop, Cursor, an agent framework...)
2
+ and ANY MCP server. Every tools/call goes to the Proof-of-Silence gate first; only ACT_NOW is
3
+ forwarded. Everything else is answered locally with isError=true and never reaches the server.
4
+
5
+ Usage:
6
+ pos-mcp-proxy --gate https://gate.example.com --agent my-agent -- <server command> [args...]
7
+
8
+ Hardening (from earlier PoS red-team lessons):
9
+ * duplicate JSON keys rejected (parsers disagree on which one wins)
10
+ * any method that normalises to "tools/..." other than tools/list is gated or blocked
11
+ * JSON-RPC batches containing a tool method are refused as a whole
12
+ * unparseable lines are dropped, never forwarded
13
+ """
14
+ from __future__ import annotations
15
+
16
+ import argparse
17
+ import json
18
+ import subprocess
19
+ import sys
20
+ import threading
21
+ import unicodedata
22
+
23
+ from .client import GateClient, blocked_message
24
+
25
+
26
+ class _DuplicateKey(ValueError):
27
+ pass
28
+
29
+
30
+ def _no_dupes(pairs):
31
+ out = {}
32
+ for k, v in pairs:
33
+ if k in out:
34
+ raise _DuplicateKey(k)
35
+ out[k] = v
36
+ return out
37
+
38
+
39
+ def parse(line: str):
40
+ return json.loads(line, object_pairs_hook=_no_dupes)
41
+
42
+
43
+ def _norm_method(m) -> str | None:
44
+ if not isinstance(m, str):
45
+ return None
46
+ m = "".join(ch for ch in unicodedata.normalize("NFKC", m) if unicodedata.category(ch)[0] != "C")
47
+ return m.strip().lower()
48
+
49
+
50
+ SAFE_TOOL_METHODS = {"tools/list"}
51
+
52
+
53
+ def _error(msg_id, code, text):
54
+ return {"jsonrpc": "2.0", "id": msg_id, "error": {"code": code, "message": text}}
55
+
56
+
57
+ def _tool_blocked(msg_id, text):
58
+ return {"jsonrpc": "2.0", "id": msg_id,
59
+ "result": {"content": [{"type": "text", "text": text}], "isError": True}}
60
+
61
+
62
+ class Proxy:
63
+ def __init__(self, client: GateClient, origin: str = "model"):
64
+ self.client = client
65
+ self.origin = origin
66
+
67
+ def handle(self, line: str):
68
+ """Return (forward_line | None, [local responses])."""
69
+ try:
70
+ msg = parse(line)
71
+ except Exception:
72
+ return None, []
73
+ if isinstance(msg, list):
74
+ tool_like = [m for m in msg if isinstance(m, dict) and
75
+ (_norm_method(m.get("method")) or "").startswith("tools/") and
76
+ _norm_method(m.get("method")) not in SAFE_TOOL_METHODS]
77
+ if tool_like:
78
+ return None, [_error(m.get("id"), -32600, "Batch with tool calls refused by Proof-of-Silence proxy")
79
+ for m in msg if isinstance(m, dict) and "id" in m]
80
+ return line, []
81
+ if not isinstance(msg, dict):
82
+ return None, []
83
+ method = _norm_method(msg.get("method"))
84
+ if method is None or not method.startswith("tools/") or method in SAFE_TOOL_METHODS:
85
+ return line, []
86
+ has_id = "id" in msg
87
+ if method != "tools/call" or msg.get("method") != "tools/call":
88
+ # obfuscated or unknown tool method: never forwarded
89
+ return None, ([_error(msg["id"], -32601, "Method blocked by Proof-of-Silence proxy")] if has_id else [])
90
+ if not has_id:
91
+ return None, [] # tools/call as notification: no reply possible, never executed
92
+ params = msg.get("params") if isinstance(msg.get("params"), dict) else {}
93
+ name = params.get("name")
94
+ args = params.get("arguments") if isinstance(params.get("arguments"), dict) else {}
95
+ if not isinstance(name, str) or not name:
96
+ return None, [_error(msg["id"], -32602, "tools/call without a tool name blocked")]
97
+ d = self.client.decide(name, args, origin=self.origin)
98
+ if not d.allowed:
99
+ return None, [_tool_blocked(msg["id"], blocked_message(d))]
100
+ return line, []
101
+
102
+
103
+ def main(argv=None):
104
+ ap = argparse.ArgumentParser(prog="pos-mcp-proxy")
105
+ ap.add_argument("--gate", required=False, help="gate base URL (or env POS_GATE_URL)")
106
+ ap.add_argument("--agent", default="mcp-agent")
107
+ ap.add_argument("--origin", default="model")
108
+ ap.add_argument("--receipts", default=None, help="optional local JSONL of client receipts")
109
+ ap.add_argument("server", nargs=argparse.REMAINDER, help="-- <mcp server command>")
110
+ a = ap.parse_args(argv)
111
+ cmd = a.server[1:] if a.server[:1] == ["--"] else a.server
112
+ if not cmd:
113
+ ap.error("missing MCP server command after --")
114
+ client = GateClient(a.gate, agent=a.agent, receipts=a.receipts)
115
+ proxy = Proxy(client, a.origin)
116
+
117
+ up = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True,
118
+ encoding="utf-8", bufsize=1)
119
+ out_lock = threading.Lock()
120
+
121
+ def emit(obj_or_line):
122
+ s = obj_or_line if isinstance(obj_or_line, str) else json.dumps(obj_or_line, ensure_ascii=False)
123
+ with out_lock:
124
+ sys.stdout.write(s.rstrip("\n") + "\n")
125
+ sys.stdout.flush()
126
+
127
+ def pump_up():
128
+ for line in up.stdout:
129
+ emit(line)
130
+
131
+ t = threading.Thread(target=pump_up, daemon=True)
132
+ t.start()
133
+ try:
134
+ for line in sys.stdin:
135
+ if not line.strip():
136
+ continue
137
+ fwd, local = proxy.handle(line)
138
+ for r in local:
139
+ emit(r)
140
+ if fwd is not None:
141
+ up.stdin.write(fwd.rstrip("\n") + "\n")
142
+ up.stdin.flush()
143
+ finally:
144
+ try:
145
+ up.stdin.close()
146
+ except Exception:
147
+ pass
148
+ up.wait(timeout=5)
149
+ t.join(timeout=2)
150
+ return up.returncode or 0
151
+
152
+
153
+ if __name__ == "__main__":
154
+ sys.exit(main())
@@ -0,0 +1,72 @@
1
+ """TEST GATE - for development and demos only. It is NOT Proof-of-Silence and signs nothing.
2
+ It implements the pos-connect/1 contract with trivial rules so the plugin can be tested
3
+ without the real engine:
4
+ * action listed in --allow -> ACT_NOW
5
+ * origin == "attachment" -> REJECT (ORIGIN_NOT_ALLOWED)
6
+ * otherwise -> WAIT (NO_GRANT)
7
+ """
8
+ from __future__ import annotations
9
+
10
+ import argparse
11
+ import hashlib
12
+ import json
13
+ from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
14
+
15
+
16
+ def make_handler(allow: set[str], mode: str = "normal"):
17
+ class H(BaseHTTPRequestHandler):
18
+ def log_message(self, *a):
19
+ pass
20
+
21
+ def do_POST(self):
22
+ if self.path != "/v1/gate":
23
+ self.send_response(404); self.end_headers(); return
24
+ n = int(self.headers.get("Content-Length", "0"))
25
+ req = json.loads(self.rfile.read(n))
26
+ if req.get("origin") == "attachment":
27
+ verdict, reasons = "REJECT", ["ORIGIN_NOT_ALLOWED"]
28
+ elif req.get("action") in allow:
29
+ verdict, reasons = "ACT_NOW", ["TEST_ALLOW_LIST"]
30
+ else:
31
+ verdict, reasons = "WAIT", ["NO_GRANT"]
32
+ from .client import params_hash as _ph
33
+ resp = {"request_id": req.get("request_id"), "params_hash": _ph(req.get("params") or {}), # recomputed, like a real gate
34
+ "verdict": verdict, "reasons": reasons,
35
+ "record_hash": "sha256:" + hashlib.sha256(json.dumps(req, sort_keys=True).encode()).hexdigest()}
36
+ # misbehaving modes for adversarial tests
37
+ if mode == "wrong_id":
38
+ resp["request_id"] = "other"
39
+ elif mode == "wrong_hash":
40
+ resp["params_hash"] = "sha256:00"
41
+ elif mode == "no_record":
42
+ resp.pop("record_hash")
43
+ elif mode == "weird_verdict":
44
+ resp["verdict"] = "act_now"
45
+ elif mode == "garbage":
46
+ body = b"<html>ok</html>"
47
+ self.send_response(200); self.send_header("Content-Length", str(len(body))); self.end_headers()
48
+ self.wfile.write(body); return
49
+ elif mode == "http500":
50
+ self.send_response(500); self.end_headers(); return
51
+ elif mode == "huge":
52
+ resp["pad"] = "x" * 100_000
53
+ body = json.dumps(resp).encode()
54
+ self.send_response(200)
55
+ self.send_header("Content-Type", "application/json")
56
+ self.send_header("Content-Length", str(len(body)))
57
+ self.end_headers()
58
+ self.wfile.write(body)
59
+ return H
60
+
61
+
62
+ def serve(port: int, allow: set[str], mode: str = "normal") -> ThreadingHTTPServer:
63
+ return ThreadingHTTPServer(("127.0.0.1", port), make_handler(allow, mode))
64
+
65
+
66
+ if __name__ == "__main__":
67
+ ap = argparse.ArgumentParser()
68
+ ap.add_argument("--port", type=int, default=8787)
69
+ ap.add_argument("--allow", default="read_file", help="comma-separated actions to allow")
70
+ a = ap.parse_args()
71
+ print(f"TEST GATE (not PoS) on http://127.0.0.1:{a.port}/v1/gate allow={a.allow}")
72
+ serve(a.port, set(a.allow.split(","))).serve_forever()
@@ -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,16 @@
1
+ pos_connect/__init__.py,sha256=I69xUTlAJ81a_I9oV98V0aDurwyDgqiUMXfaxJ_iSjU,532
2
+ pos_connect/client.py,sha256=hGnLZofPimapBS_bdI9v7sX0RT9oqiemAhk-SgA-0Mc,10768
3
+ pos_connect/guard.py,sha256=xhyTXCdzyKvD8-erlH5xVnn2_WlUogim1Rl23Ta7FeQ,2660
4
+ pos_connect/mcp_proxy.py,sha256=jqGFy_GDPeiAUPDAQwBltsDJWfqFIVrMmxMgXlGPmKI,5565
5
+ pos_connect/testgate.py,sha256=ntr5UHrxLZ8bbw_3UKrrsyHsD_AsqSS0efFcmjX1dUs,3236
6
+ pos_connect/adapters/__init__.py,sha256=kpPKG978Z6-cFQTf1WYbhEDvWnYv1m_N5wPW0v25DaQ,93
7
+ pos_connect/adapters/crewai.py,sha256=njvS3TCuTIMpqT4CehLW5zcwcp6_3KRHGvTEzqLScSA,1444
8
+ pos_connect/adapters/langchain.py,sha256=b1xGRhqnWK-pGWcP1zQfVdJgqwZkUYl5i7mA6VrPEiE,1330
9
+ pos_connect/adapters/openai_agents.py,sha256=6jUCaVwnIQ7bKQlTP7UZgM1JKV_h7SrDhX5MZ38fuTw,1365
10
+ pos_connect-0.1.3.dist-info/licenses/LICENSE,sha256=bETk0d6K6AnNC3-hsiZcLjwXnLKKb5e4hREeyPlAJtM,11314
11
+ pos_connect-0.1.3.dist-info/licenses/NOTICE,sha256=dhGSrTKvrZOfV0cRCwBV2zeoXBj7lBZarBzwuAo67bs,741
12
+ pos_connect-0.1.3.dist-info/METADATA,sha256=PadBQ3L_1VYT-3INnxKJMQlb5NktoLNC6vE5x9jJ-zc,5197
13
+ pos_connect-0.1.3.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
14
+ pos_connect-0.1.3.dist-info/entry_points.txt,sha256=OncwVdBFP81I3eDjzZylpu_llWBhmJp8M-p5dxHfoBw,61
15
+ pos_connect-0.1.3.dist-info/top_level.txt,sha256=JQEEQUP924ZoHbRIciNrqUUfbCoaXQqkryrK-xazN20,12
16
+ pos_connect-0.1.3.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ pos-mcp-proxy = pos_connect.mcp_proxy:main
@@ -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,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 @@
1
+ pos_connect