securevector-sdk-hermes 1.0.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 (31) hide show
  1. securevector_sdk_hermes-1.0.0/CHANGELOG.md +50 -0
  2. securevector_sdk_hermes-1.0.0/LICENSE +202 -0
  3. securevector_sdk_hermes-1.0.0/MANIFEST.in +7 -0
  4. securevector_sdk_hermes-1.0.0/NOTICE +16 -0
  5. securevector_sdk_hermes-1.0.0/PKG-INFO +155 -0
  6. securevector_sdk_hermes-1.0.0/PRIVACY.md +96 -0
  7. securevector_sdk_hermes-1.0.0/README.md +131 -0
  8. securevector_sdk_hermes-1.0.0/pyproject.toml +57 -0
  9. securevector_sdk_hermes-1.0.0/setup.cfg +4 -0
  10. securevector_sdk_hermes-1.0.0/src/securevector_sdk_hermes/__init__.py +44 -0
  11. securevector_sdk_hermes-1.0.0/src/securevector_sdk_hermes/_version.py +7 -0
  12. securevector_sdk_hermes-1.0.0/src/securevector_sdk_hermes/auto.py +30 -0
  13. securevector_sdk_hermes-1.0.0/src/securevector_sdk_hermes/client.py +252 -0
  14. securevector_sdk_hermes-1.0.0/src/securevector_sdk_hermes/config.py +72 -0
  15. securevector_sdk_hermes-1.0.0/src/securevector_sdk_hermes/core.py +181 -0
  16. securevector_sdk_hermes-1.0.0/src/securevector_sdk_hermes/errors.py +27 -0
  17. securevector_sdk_hermes-1.0.0/src/securevector_sdk_hermes/plugin.py +214 -0
  18. securevector_sdk_hermes-1.0.0/src/securevector_sdk_hermes/tool_id.py +115 -0
  19. securevector_sdk_hermes-1.0.0/src/securevector_sdk_hermes.egg-info/PKG-INFO +155 -0
  20. securevector_sdk_hermes-1.0.0/src/securevector_sdk_hermes.egg-info/SOURCES.txt +29 -0
  21. securevector_sdk_hermes-1.0.0/src/securevector_sdk_hermes.egg-info/dependency_links.txt +1 -0
  22. securevector_sdk_hermes-1.0.0/src/securevector_sdk_hermes.egg-info/entry_points.txt +2 -0
  23. securevector_sdk_hermes-1.0.0/src/securevector_sdk_hermes.egg-info/requires.txt +5 -0
  24. securevector_sdk_hermes-1.0.0/src/securevector_sdk_hermes.egg-info/top_level.txt +1 -0
  25. securevector_sdk_hermes-1.0.0/tests/test_analyze.py +64 -0
  26. securevector_sdk_hermes-1.0.0/tests/test_auth.py +57 -0
  27. securevector_sdk_hermes-1.0.0/tests/test_builtins_drift.py +56 -0
  28. securevector_sdk_hermes-1.0.0/tests/test_interceptor.py +132 -0
  29. securevector_sdk_hermes-1.0.0/tests/test_plugin.py +158 -0
  30. securevector_sdk_hermes-1.0.0/tests/test_tool_id.py +62 -0
  31. securevector_sdk_hermes-1.0.0/tests/test_verdict.py +91 -0
@@ -0,0 +1,50 @@
1
+ # Changelog
2
+
3
+ All notable changes to `securevector-sdk-hermes` are documented here.
4
+ This project adheres to [Semantic Versioning](https://semver.org/).
5
+
6
+ ## [1.0.0]
7
+
8
+ ### Added
9
+ - Initial Hermes (NousResearch `hermes-agent`) adapter — release unit δ of the
10
+ `active-guard-plugin` bundle, story #183.
11
+ - **Zero-config Hermes plugin** via the `hermes_agent.plugins` entry point:
12
+ the Hermes plugin manager auto-loads the guard in every mode (interactive
13
+ CLI, gateway, ACP). `pre_tool_call` enforces via Hermes's documented block
14
+ directive (`{"action": "block", "message": ...}`) with the
15
+ `SecureVector Guard:` branded reason; `post_tool_call` scans tool results.
16
+ Runs the three controls on every tool call:
17
+ - **(a)** tool-call permission resolution (synced → override → essential → default-allow),
18
+ - **(b)** secret / data-leak detection on tool input and output,
19
+ - **(c)** threat detection on tool input and output.
20
+ - `install(mode=...)` for programmatic embeddings — wraps
21
+ `tools.registry.dispatch`, the choke point all Hermes execution paths funnel
22
+ through (deliberately NOT `model_tools.handle_function_call`, which
23
+ `run_agent` re-imports by reference). `import securevector_sdk_hermes.auto`
24
+ calls it with env-derived mode.
25
+ - **MCP-aware tool-id candidates**: Hermes registers MCP tools as
26
+ `mcp_<server>_<tool>` (hyphens/dots sanitized to underscores — lossy), so
27
+ permission resolution matches the raw Hermes name plus every
28
+ `<server>:<tool>` split, tier precedence first.
29
+ - `HERMES_BUILTINS` — empirical built-in inventory extracted from the
30
+ hermes-agent 0.18.0 sdist (69 registry tools + 3 Tool-Search bridge tools +
31
+ bundled plugin tools), with a drift test that compares against a live
32
+ hermes-agent install when importable.
33
+ - `observe` (fail-open, default) and `enforce` (fail-closed) modes; one-line
34
+ cold-install notice when the app is unreachable in observe mode.
35
+ - Audit forwarding to the local app's tamper-evident chain with
36
+ `runtime_kind="hermes"` attribution, keyed by Hermes `session_id` /
37
+ `tool_call_id`.
38
+ - `/analyze` requests send the correct `direction` field (`outgoing` for tool
39
+ input, `incoming` for tool output) — fixes the `mode`-field drift present in
40
+ the sibling SDKs, so tool-output scans actually run the IDPI rule pack.
41
+ - Base URL honors the unified `SECUREVECTOR_ENGINE_ENDPOINT` (with legacy
42
+ `SECUREVECTOR_SDK_APP_URL` fallback) and forwards an optional
43
+ `SECUREVECTOR_API_KEY` as `Authorization: Bearer` for remote, token-gated
44
+ deployments.
45
+ - Version pin `hermes-agent>=0.18,<0.19` — the attach points are re-verified
46
+ before every pin raise.
47
+ - Harness-tailored [PRIVACY.md](PRIVACY.md); Apache-2.0 LICENSE + NOTICE with
48
+ Nous Research trademark disclaimer.
49
+ - CI + Test PyPI (develop) / PyPI (main release) publishing via OIDC trusted
50
+ publishing, mirroring the sibling framework SDKs.
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,7 @@
1
+ # Ship the compliance/privacy docs in the source distribution. Story #183
2
+ # requires the harness-tailored PRIVACY.md in the shipped artifact; LICENSE and
3
+ # NOTICE are already picked up as license-files, but PRIVACY.md and the
4
+ # CHANGELOG are not, so include them explicitly.
5
+ include PRIVACY.md
6
+ include CHANGELOG.md
7
+ include NOTICE
@@ -0,0 +1,16 @@
1
+ SecureVector SDK for Hermes
2
+ Copyright (c) SecureVector
3
+
4
+ This product is licensed under the Apache License, Version 2.0 (see LICENSE).
5
+
6
+ This software integrates with the Hermes agent framework via its public
7
+ plugin API (the `hermes_agent.plugins` entry-point group and its documented
8
+ `pre_tool_call` / `post_tool_call` hooks). "Hermes" and "Nous Research" are
9
+ trademarks of Nous Research. This package is an independent, community
10
+ integration and is not affiliated with, sponsored by, or endorsed by Nous
11
+ Research. The framework name is used only descriptively to identify
12
+ compatibility (nominative fair use).
13
+
14
+ This package depends on:
15
+ - securevector-ai-monitor (the local SecureVector app + SDK)
16
+ - hermes-agent (MIT, (c) 2025 Nous Research)
@@ -0,0 +1,155 @@
1
+ Metadata-Version: 2.4
2
+ Name: securevector-sdk-hermes
3
+ Version: 1.0.0
4
+ Summary: SecureVector SDK for Hermes (NousResearch hermes-agent) — brings the local threat monitor's three controls (tool-call permissions, secret/data-leak detection, threat detection) to every Hermes tool call, with tamper-evident audit logging.
5
+ Author: SecureVector
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://securevector.io
8
+ Project-URL: Source, https://github.com/Secure-Vector/securevector-sdk-hermes
9
+ Keywords: hermes,hermes-agent,llm,security,ai-agent,audit,compliance,tool-permissions
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Topic :: Security
15
+ Requires-Python: >=3.11
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ License-File: NOTICE
19
+ Requires-Dist: securevector-ai-monitor>=4.7
20
+ Requires-Dist: hermes-agent<0.19,>=0.18
21
+ Provides-Extra: dev
22
+ Requires-Dist: pytest>=7.0; extra == "dev"
23
+ Dynamic: license-file
24
+
25
+ # SecureVector SDK for Hermes
26
+
27
+ [![PyPI](https://img.shields.io/pypi/v/securevector-sdk-hermes)](https://pypi.org/project/securevector-sdk-hermes/)
28
+ [![Downloads](https://img.shields.io/pypi/dm/securevector-sdk-hermes)](https://pypistats.org/packages/securevector-sdk-hermes)
29
+ [![Python](https://img.shields.io/badge/python-3.11%2B-blue)](https://pypi.org/project/securevector-sdk-hermes/)
30
+ [![License](https://img.shields.io/badge/license-Apache--2.0-green)](LICENSE)
31
+
32
+ > Bring the SecureVector local threat monitor's three controls — **tool-call
33
+ > permissions**, **secret / data-leak detection**, and **threat detection** —
34
+ > to every Hermes (NousResearch `hermes-agent`) tool call, with tamper-evident
35
+ > audit logging. Zero code changes.
36
+
37
+ ```bash
38
+ pip install securevector-sdk-hermes
39
+ ```
40
+
41
+ > 📦 **One install — batteries included.** `pip install securevector-sdk-hermes`
42
+ > **also installs the local SecureVector app** (`securevector-ai-monitor`): the
43
+ > adapter **and** the detection engine + tamper-evident audit chain arrive in a
44
+ > single `pip install`. The SDK is a thin interception layer — **the app must be
45
+ > running locally** (`securevector-app --web`) for it to do anything.
46
+
47
+ ## Quick start
48
+
49
+ **Zero-config (recommended).** The package registers a Hermes plugin via the
50
+ `hermes_agent.plugins` entry point — the Hermes plugin manager auto-loads it
51
+ on startup in **every mode**: the interactive `hermes` CLI, `hermes gateway`
52
+ (Telegram / Discord / Slack / …), and the ACP/Zed adapter.
53
+
54
+ ```bash
55
+ pip install securevector-sdk-hermes
56
+ hermes # that's it — observe mode is on
57
+
58
+ export SECUREVECTOR_SDK_MODE=enforce # opt into blocking
59
+ hermes
60
+ ```
61
+
62
+ A denied tool is stopped through Hermes's own `pre_tool_call` block directive —
63
+ the model sees a clean `SecureVector Guard: tool '<name>' blocked — <reason>`
64
+ result. No exceptions, no crashed runs, no fork of Hermes.
65
+
66
+ **Programmatic / library embeddings** (driving `AIAgent` from your own Python
67
+ process, where the plugin manager never runs):
68
+
69
+ ```python
70
+ from securevector_sdk_hermes import install
71
+
72
+ install(mode="enforce") # wraps Hermes's tool-registry dispatch
73
+ ```
74
+
75
+ > Why two paths? The plugin hooks are Hermes's **documented interception
76
+ > surface** and require no code at all. `install()` covers embeddings by
77
+ > wrapping `tools.registry.dispatch` — the single choke point every Hermes
78
+ > execution path (CLI, gateway, ACP, subagents) funnels through.
79
+
80
+ ## What happens on every tool call
81
+
82
+ Before a tool runs, the SDK:
83
+
84
+ 1. **(a) Permissions** — resolves an allow/block verdict for the tool, using the
85
+ app's own precedence: cloud-pushed **synced** policy → local **override** →
86
+ **essential** registry → default-allow. Hermes MCP tools
87
+ (`mcp_<server>_<tool>`) are matched against the raw Hermes name **and** the
88
+ cloud `<server>:<tool>` form, so policies authored either way apply.
89
+ 2. **(b)+(c) Secret & threat scan** — sends the serialized tool input through the
90
+ app's `/analyze` pipeline.
91
+
92
+ After the tool returns, the result is scanned the same way to catch secrets /
93
+ exfiltration in tool output. Every decision is written to the app's audit chain
94
+ tagged `runtime_kind="hermes"`, keyed by Hermes's own `session_id` and
95
+ `tool_call_id`.
96
+
97
+ This covers all ~70 Hermes built-in tools (`terminal`, `execute_code`,
98
+ `write_file`, `browser_*`, …), every MCP tool, and plugin tools — including in
99
+ gateway/headless contexts where Hermes's built-in dangerous-command approval
100
+ is known to fail open (upstream `hermes-agent` issue #30882): the guard sits
101
+ underneath the approval layer, at the dispatch choke point.
102
+
103
+ ## observe vs enforce
104
+
105
+ | | local app reachable | local app unreachable |
106
+ |---|---|---|
107
+ | **observe** (default) | log + advisory verdict; tool always runs | tool runs (fail-open, one-line notice) |
108
+ | **enforce** (opt-in) | tool runs only if the verdict ≠ block | **tool denied** (fail-closed) |
109
+
110
+ Enforce mode prints a one-time disclosure to stderr.
111
+
112
+ ## Configuration
113
+
114
+ All optional, via env (the plugin path) or `install(...)` kwargs:
115
+
116
+ | Env var | Default | Meaning |
117
+ |---|---|---|
118
+ | `SECUREVECTOR_ENGINE_ENDPOINT` | `http://127.0.0.1:8741` | local app / engine base URL (unified variable; legacy `SECUREVECTOR_SDK_APP_URL` also honored) |
119
+ | `SECUREVECTOR_SDK_MODE` | `observe` | `observe` or `enforce` |
120
+ | `SECUREVECTOR_SDK_TIMEOUT_MS` | `3000` | per-call verdict timeout |
121
+ | `SECUREVECTOR_SDK_RISK_THRESHOLD` | `70` | risk score that blocks in enforce mode |
122
+ | `SECUREVECTOR_SDK_DISABLED` | _(unset)_ | set truthy to no-op |
123
+ | `SECUREVECTOR_API_KEY` | _(unset)_ | bearer credential for remote, token-gated deployments |
124
+
125
+ ## Version pinning
126
+
127
+ The guard attaches to Hermes internals (the plugin hook bus and
128
+ `tools.registry`), so the dependency is pinned to the verified minor:
129
+ `hermes-agent>=0.18,<0.19`. Each upstream minor is re-verified against the
130
+ attach points before the pin is raised — see [CHANGELOG](CHANGELOG.md).
131
+
132
+ ## Privacy
133
+
134
+ Everything runs on loopback; the SDK makes no external network calls. See
135
+ [PRIVACY.md](PRIVACY.md) for the exact read/send surface.
136
+
137
+ ## Compliance
138
+
139
+ The tool-call-level, attributed, tamper-evident audit trail this produces is
140
+ exactly the **action-layer logging** auditors ask for under **EU AI Act
141
+ Art. 12 / 15**. This SDK produces the local evidence; the cloud governance
142
+ surface turns it into an auditor-ready pack.
143
+
144
+ ## Trademarks
145
+
146
+ **SecureVector** is the product name of this SDK. **Hermes** and **Nous
147
+ Research** are trademarks of Nous Research. This is an independent, community
148
+ SDK that *integrates with* Hermes via its public plugin API. It is **not
149
+ affiliated with, sponsored by, or endorsed by Nous Research.** The name uses
150
+ "hermes" only descriptively, to identify the framework this package works
151
+ with (nominative fair use).
152
+
153
+ ## License
154
+
155
+ Apache-2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
@@ -0,0 +1,96 @@
1
+ # Privacy Policy — SecureVector SDK for Hermes
2
+
3
+ **Last updated:** 2026-07-01
4
+ **Applies to:** securevector-sdk-hermes v1.0.x
5
+
6
+ The SecureVector SDK for Hermes runs entirely on your machine, inside the same
7
+ Python process as NousResearch's `hermes-agent`. It observes Hermes tool calls
8
+ through Hermes's public plugin hooks (`pre_tool_call` / `post_tool_call`) — or,
9
+ for library embeddings, a wrap of Hermes's tool-registry dispatch — and posts a
10
+ small payload over **loopback HTTP** to a companion app you installed locally.
11
+ The SDK itself makes no network calls to SecureVector, to Nous Research, or to
12
+ any third party.
13
+
14
+ What happens to the data *after* it reaches the companion app — local storage,
15
+ optional cloud sync, retention, deletion — is governed by the **companion
16
+ app's** own privacy policy, not this one.
17
+
18
+ ## What the SDK reads
19
+
20
+ | Surface | What it reads | Where it sends it |
21
+ |---|---|---|
22
+ | `pre_tool_call` hook (or dispatch wrap, pre-execution) | Tool name, serialized tool arguments, Hermes `session_id` / `tool_call_id` / `api_request_id` | Local app: GET `/api/tool-permissions/{essential,overrides,synced-overrides}` (no user data in the GETs), POST `/analyze` (arguments text, capped at 100 KB), POST `/api/tool-permissions/call-audit` (tool id, decision, an args preview truncated to 500 chars) |
23
+ | `post_tool_call` hook (or dispatch wrap, post-execution) | Tool name and the tool's result text | Local app POST `/analyze` (result text, capped at 100 KB); POST `/api/tool-permissions/call-audit` only when a finding is detected |
24
+
25
+ The SDK never reads Hermes state files, `~/.hermes/` contents, prompts, or
26
+ model responses — only what Hermes passes to the tool-call hooks.
27
+
28
+ ## Where the data goes
29
+
30
+ Every network-bound surface talks to **loopback HTTP** at
31
+ `http://127.0.0.1:8741` (overridable via `SECUREVECTOR_ENGINE_ENDPOINT`, or
32
+ the legacy `SECUREVECTOR_SDK_APP_URL`). Traffic never leaves your machine
33
+ unless you deliberately point that variable at a remote SecureVector
34
+ deployment you operate (in which case `SECUREVECTOR_API_KEY` is forwarded as
35
+ a bearer credential to that host and nothing else).
36
+
37
+ The SDK writes no files to disk.
38
+
39
+ For anything the companion app does with payloads after they arrive (local
40
+ SQLite persistence, optional Cloud Connect, SIEM forwarding, retention
41
+ windows, deletion), see the companion app's privacy documentation:
42
+ <https://github.com/Secure-Vector/securevector-ai-threat-monitor>.
43
+
44
+ ## Client-side redaction before any POST
45
+
46
+ Before sending an `args_preview` to the audit endpoint, the SDK masks common
47
+ secret shapes (AWS access key IDs, GitHub `ghp_` tokens, `sk-…` API keys,
48
+ labelled `password=` pairs) and truncates to 500 characters. Redaction is
49
+ **best-effort pattern matching, not a cryptographic guarantee** — the
50
+ canonical pattern set lives in `src/securevector_sdk_hermes/core.py`. The
51
+ full argument/result text sent to `/analyze` is redacted and persisted by the
52
+ companion app according to its own policy.
53
+
54
+ ## What the SDK never collects
55
+
56
+ - **No external telemetry, analytics, or crash reports.**
57
+ - **No data to Nous Research.**
58
+ - **No data to SecureVector's cloud.** The SDK makes no outbound network calls.
59
+ - **No OS identifiers, IP addresses, or third-party account identifiers.**
60
+ The SDK forwards the Hermes-generated `session_id` / `tool_call_id` to the
61
+ **local** endpoints for correlation; these identifiers never leave the
62
+ loopback POSTs.
63
+
64
+ ## Failing open
65
+
66
+ If the local companion app is unreachable, `observe` mode (the default) lets
67
+ every tool call proceed — the event is dropped, not queued, buffered, or
68
+ retried, and never reaches network. A one-line notice is printed once per
69
+ process. In `enforce` mode an unreachable app blocks tool calls (fail-closed)
70
+ by design; no data is transmitted in either case.
71
+
72
+ ## Disabling the SDK
73
+
74
+ - `pip uninstall securevector-sdk-hermes`, or
75
+ - set `SECUREVECTOR_SDK_DISABLED=1` to no-op without uninstalling.
76
+
77
+ Once disabled, no hooks are registered and no POSTs are made.
78
+
79
+ ## Source code & licence
80
+
81
+ The SDK is **Apache-2.0 licensed** and published at
82
+ <https://github.com/Secure-Vector/securevector-sdk-hermes>. The whole
83
+ interception surface is auditable — `plugin.py` (hooks + dispatch wrap),
84
+ `client.py` (every HTTP call), and `core.py` (decision logic + redactor) — we
85
+ encourage reviewing them before installation.
86
+
87
+ ## Changes to this policy
88
+
89
+ We may update this policy from time to time. Material changes will bump the
90
+ **Last updated** date and be noted in the [CHANGELOG](./CHANGELOG.md).
91
+
92
+ ## Contact
93
+
94
+ For privacy questions about the SDK, email **privacy@securevector.io**, or
95
+ open an issue at
96
+ <https://github.com/Secure-Vector/securevector-sdk-hermes/issues>.
@@ -0,0 +1,131 @@
1
+ # SecureVector SDK for Hermes
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/securevector-sdk-hermes)](https://pypi.org/project/securevector-sdk-hermes/)
4
+ [![Downloads](https://img.shields.io/pypi/dm/securevector-sdk-hermes)](https://pypistats.org/packages/securevector-sdk-hermes)
5
+ [![Python](https://img.shields.io/badge/python-3.11%2B-blue)](https://pypi.org/project/securevector-sdk-hermes/)
6
+ [![License](https://img.shields.io/badge/license-Apache--2.0-green)](LICENSE)
7
+
8
+ > Bring the SecureVector local threat monitor's three controls — **tool-call
9
+ > permissions**, **secret / data-leak detection**, and **threat detection** —
10
+ > to every Hermes (NousResearch `hermes-agent`) tool call, with tamper-evident
11
+ > audit logging. Zero code changes.
12
+
13
+ ```bash
14
+ pip install securevector-sdk-hermes
15
+ ```
16
+
17
+ > 📦 **One install — batteries included.** `pip install securevector-sdk-hermes`
18
+ > **also installs the local SecureVector app** (`securevector-ai-monitor`): the
19
+ > adapter **and** the detection engine + tamper-evident audit chain arrive in a
20
+ > single `pip install`. The SDK is a thin interception layer — **the app must be
21
+ > running locally** (`securevector-app --web`) for it to do anything.
22
+
23
+ ## Quick start
24
+
25
+ **Zero-config (recommended).** The package registers a Hermes plugin via the
26
+ `hermes_agent.plugins` entry point — the Hermes plugin manager auto-loads it
27
+ on startup in **every mode**: the interactive `hermes` CLI, `hermes gateway`
28
+ (Telegram / Discord / Slack / …), and the ACP/Zed adapter.
29
+
30
+ ```bash
31
+ pip install securevector-sdk-hermes
32
+ hermes # that's it — observe mode is on
33
+
34
+ export SECUREVECTOR_SDK_MODE=enforce # opt into blocking
35
+ hermes
36
+ ```
37
+
38
+ A denied tool is stopped through Hermes's own `pre_tool_call` block directive —
39
+ the model sees a clean `SecureVector Guard: tool '<name>' blocked — <reason>`
40
+ result. No exceptions, no crashed runs, no fork of Hermes.
41
+
42
+ **Programmatic / library embeddings** (driving `AIAgent` from your own Python
43
+ process, where the plugin manager never runs):
44
+
45
+ ```python
46
+ from securevector_sdk_hermes import install
47
+
48
+ install(mode="enforce") # wraps Hermes's tool-registry dispatch
49
+ ```
50
+
51
+ > Why two paths? The plugin hooks are Hermes's **documented interception
52
+ > surface** and require no code at all. `install()` covers embeddings by
53
+ > wrapping `tools.registry.dispatch` — the single choke point every Hermes
54
+ > execution path (CLI, gateway, ACP, subagents) funnels through.
55
+
56
+ ## What happens on every tool call
57
+
58
+ Before a tool runs, the SDK:
59
+
60
+ 1. **(a) Permissions** — resolves an allow/block verdict for the tool, using the
61
+ app's own precedence: cloud-pushed **synced** policy → local **override** →
62
+ **essential** registry → default-allow. Hermes MCP tools
63
+ (`mcp_<server>_<tool>`) are matched against the raw Hermes name **and** the
64
+ cloud `<server>:<tool>` form, so policies authored either way apply.
65
+ 2. **(b)+(c) Secret & threat scan** — sends the serialized tool input through the
66
+ app's `/analyze` pipeline.
67
+
68
+ After the tool returns, the result is scanned the same way to catch secrets /
69
+ exfiltration in tool output. Every decision is written to the app's audit chain
70
+ tagged `runtime_kind="hermes"`, keyed by Hermes's own `session_id` and
71
+ `tool_call_id`.
72
+
73
+ This covers all ~70 Hermes built-in tools (`terminal`, `execute_code`,
74
+ `write_file`, `browser_*`, …), every MCP tool, and plugin tools — including in
75
+ gateway/headless contexts where Hermes's built-in dangerous-command approval
76
+ is known to fail open (upstream `hermes-agent` issue #30882): the guard sits
77
+ underneath the approval layer, at the dispatch choke point.
78
+
79
+ ## observe vs enforce
80
+
81
+ | | local app reachable | local app unreachable |
82
+ |---|---|---|
83
+ | **observe** (default) | log + advisory verdict; tool always runs | tool runs (fail-open, one-line notice) |
84
+ | **enforce** (opt-in) | tool runs only if the verdict ≠ block | **tool denied** (fail-closed) |
85
+
86
+ Enforce mode prints a one-time disclosure to stderr.
87
+
88
+ ## Configuration
89
+
90
+ All optional, via env (the plugin path) or `install(...)` kwargs:
91
+
92
+ | Env var | Default | Meaning |
93
+ |---|---|---|
94
+ | `SECUREVECTOR_ENGINE_ENDPOINT` | `http://127.0.0.1:8741` | local app / engine base URL (unified variable; legacy `SECUREVECTOR_SDK_APP_URL` also honored) |
95
+ | `SECUREVECTOR_SDK_MODE` | `observe` | `observe` or `enforce` |
96
+ | `SECUREVECTOR_SDK_TIMEOUT_MS` | `3000` | per-call verdict timeout |
97
+ | `SECUREVECTOR_SDK_RISK_THRESHOLD` | `70` | risk score that blocks in enforce mode |
98
+ | `SECUREVECTOR_SDK_DISABLED` | _(unset)_ | set truthy to no-op |
99
+ | `SECUREVECTOR_API_KEY` | _(unset)_ | bearer credential for remote, token-gated deployments |
100
+
101
+ ## Version pinning
102
+
103
+ The guard attaches to Hermes internals (the plugin hook bus and
104
+ `tools.registry`), so the dependency is pinned to the verified minor:
105
+ `hermes-agent>=0.18,<0.19`. Each upstream minor is re-verified against the
106
+ attach points before the pin is raised — see [CHANGELOG](CHANGELOG.md).
107
+
108
+ ## Privacy
109
+
110
+ Everything runs on loopback; the SDK makes no external network calls. See
111
+ [PRIVACY.md](PRIVACY.md) for the exact read/send surface.
112
+
113
+ ## Compliance
114
+
115
+ The tool-call-level, attributed, tamper-evident audit trail this produces is
116
+ exactly the **action-layer logging** auditors ask for under **EU AI Act
117
+ Art. 12 / 15**. This SDK produces the local evidence; the cloud governance
118
+ surface turns it into an auditor-ready pack.
119
+
120
+ ## Trademarks
121
+
122
+ **SecureVector** is the product name of this SDK. **Hermes** and **Nous
123
+ Research** are trademarks of Nous Research. This is an independent, community
124
+ SDK that *integrates with* Hermes via its public plugin API. It is **not
125
+ affiliated with, sponsored by, or endorsed by Nous Research.** The name uses
126
+ "hermes" only descriptively, to identify the framework this package works
127
+ with (nominative fair use).
128
+
129
+ ## License
130
+
131
+ Apache-2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).