cirvix 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,14 @@
1
+ node_modules/
2
+ *.tgz
3
+ .cirvix/
4
+ __pycache__/
5
+ *.pyc
6
+ dist/
7
+ build/
8
+ *.egg-info/
9
+ .env
10
+ .env.*
11
+ !.env.example
12
+ *.pem
13
+ *.key
14
+ .DS_Store
cirvix-0.1.0/LICENSE ADDED
@@ -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.
cirvix-0.1.0/NOTICE ADDED
@@ -0,0 +1,42 @@
1
+ Cirvix AgentControl — enforcement engine
2
+ Copyright 2026 Umang Kumar, trading as Cirvix
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
5
+ this file except in compliance with the License. You may obtain a copy of the
6
+ License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software distributed
11
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
13
+ specific language governing permissions and limitations under the License.
14
+
15
+ ---
16
+
17
+ WHAT THIS LICENCE COVERS
18
+
19
+ This package is the enforcement engine: the policy evaluator, the risk
20
+ classifier, the secret detector and handle substitution, the local control
21
+ socket, the MCP gateway, the audit chain, the scanner, and the `cirvix` CLI.
22
+
23
+ It is licensed under Apache 2.0 deliberately. A security control that cannot be
24
+ read is a security control you are asked to take on faith, and this is the part
25
+ that decides whether a tool call runs. Read it, fork it, audit it, run it in
26
+ production without paying anything, and do not ask us for permission.
27
+
28
+ WHAT IT DOES NOT COVER
29
+
30
+ The Cirvix control plane — multi-tenant policy distribution, the team vault,
31
+ SSO and SCIM, approvals workflow, hosted audit retention and export, compliance
32
+ evidence reporting, fleet telemetry and billing — is a separate package under a
33
+ separate, proprietary licence. See packages/control-plane/LICENSE.
34
+
35
+ THIRD-PARTY CODE
36
+
37
+ There is none. This package has zero runtime dependencies, deliberately and
38
+ permanently — a security tool that drags in a transitive dependency tree is
39
+ asking to become the supply-chain incident it exists to prevent.
40
+
41
+ The self-hosted fonts shipped with the Cirvix website (Geist and Geist Mono) are
42
+ licensed SIL OFL-1.1 and are not part of this package.
cirvix-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,145 @@
1
+ Metadata-Version: 2.5
2
+ Name: cirvix
3
+ Version: 0.1.0
4
+ Summary: Runtime governance for AI agents — evaluate every tool call against policy before it executes.
5
+ Project-URL: Homepage, https://www.cirvix.com
6
+ Project-URL: Documentation, https://www.cirvix.com/sdks.html
7
+ Author: Cirvix
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ License-File: NOTICE
11
+ Keywords: agents,ai,governance,llm,mcp,policy,security
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: Security
16
+ Classifier: Typing :: Typed
17
+ Requires-Python: >=3.9
18
+ Description-Content-Type: text/markdown
19
+
20
+ # cirvix
21
+
22
+ Runtime governance for Python AI agents. Every tool call is evaluated against
23
+ policy before it executes.
24
+
25
+ **Zero dependencies.** Standard library only, permanently — the same reason the
26
+ Node package has none.
27
+
28
+ ```bash
29
+ pip install cirvix
30
+ ```
31
+
32
+ **Full documentation:** [`docs/`](../../docs/) — [Python SDK](../../docs/sdk-python.md), [policy reference](../../docs/policy.md), [quickstart](../../docs/quickstart.md).
33
+
34
+ ## Governing an agent
35
+
36
+ ```python
37
+ from cirvix import guard, CirvixDenied, CirvixHeld
38
+
39
+ tools = guard.wrap(
40
+ my_tools,
41
+ agent="pr-triage",
42
+ environment=os.environ.get("CIRVIX_ENV", "local"),
43
+ rules=rules,
44
+ )
45
+
46
+ try:
47
+ crew.kickoff()
48
+ except CirvixHeld as held:
49
+ print(held.approvers) # ["platform-oncall"] — this call is waiting
50
+ except CirvixDenied as err:
51
+ print(err.policy) # "deny-dotenv-read"
52
+ print(err.remediation) # 'secrets.get("STRIPE_KEY")'
53
+ print(err.decision_id) # pass to `cirvix why`
54
+ ```
55
+
56
+ `wrap` accepts the shapes Python tool collections actually come in and returns
57
+ the same shape:
58
+
59
+ | It accepts | Framework |
60
+ |---|---|
61
+ | A mapping of `name -> callable` | hand-rolled loops, AutoGen function maps |
62
+ | A sequence of objects carrying `func` | LangChain |
63
+ | A sequence of objects carrying `_run` | CrewAI |
64
+ | A single callable | anything |
65
+
66
+ Async tools stay async. Tool objects keep their descriptions and schemas, and
67
+ the list you passed in is left alone — a framework holding the originals does
68
+ not find them governed by surprise.
69
+
70
+ **`CirvixDenied` vs `CirvixHeld`.** A denial means re-plan. A hold means this
71
+ exact call may still happen once a person says yes. They are separate types
72
+ because collapsing them teaches an agent to treat both as failure.
73
+
74
+ ## Why this is a real evaluator and not an HTTP client
75
+
76
+ The easy version of this package asks a control plane over the network for
77
+ every decision. That would have been a fraction of the work and it would have
78
+ been wrong twice over: it puts a round trip in the enforcement path, and it
79
+ breaks the offline-first property the whole product rests on — a control plane
80
+ that stops enforcing when the network blips is worse than none, because the
81
+ failure is invisible.
82
+
83
+ So this is a native port. Which raises the real risk: **two engines that can
84
+ silently disagree are worse than one engine and an honest gap.** An agent
85
+ denied by the Node gateway and permitted here is a bypass nobody would find
86
+ until it mattered.
87
+
88
+ What makes it safe is `packages/conformance/policy-conformance.json`. Both
89
+ engines load that file and must produce identical verdicts, rules, canonical
90
+ resources, and rule traces across 44 cases — forbid short-circuiting, hold
91
+ outranking permit, default deny, glob semantics, path traversal, URL
92
+ normalization, every comparator, and the fail-closed behaviour for unknown
93
+ ones. Neither language gets a private copy, and changing behaviour means
94
+ changing the fixture first, in a commit a reviewer can see.
95
+
96
+ It has already earned its keep: writing it surfaced a bug where the Node engine
97
+ canonicalized `/etc/passwd` to `C:/etc/passwd` on Windows, so a rule written
98
+ `resources: ["/etc/**"]` silently did not match on the machine it was most
99
+ likely written to protect.
100
+
101
+ ```bash
102
+ python -m unittest discover -s tests
103
+ ```
104
+
105
+ ## Testing a policy like code
106
+
107
+ ```python
108
+ from cirvix.testing import evaluate, expect_no_loosening
109
+
110
+ def test_production_writes_are_held():
111
+ decision = evaluate(
112
+ policy_dir="./policies",
113
+ agent="deploy-bot",
114
+ action="k8s.apply",
115
+ resource="production/checkout",
116
+ context={"environment": "production"},
117
+ )
118
+ assert decision.verdict == "hold"
119
+ assert "platform-oncall" in decision.approvers
120
+ ```
121
+
122
+ `expect_no_loosening(before=…, after=…, calls=…)` reports any call a policy
123
+ change would newly permit. Tightening passes — a security policy is allowed to
124
+ move that way without surprising a reviewer.
125
+
126
+ ## What `wrap` does not do
127
+
128
+ The MCP gateway governs everything an agent does, **including tools added after
129
+ you deployed it**, because it sits on the wire. `wrap` governs a list. You keep
130
+ the same engine, rules, decision records, and audit chain; you give up coverage
131
+ of tools you did not enumerate.
132
+
133
+ If your agent speaks MCP — Claude Code, Cursor, or anything else — use the
134
+ gateway instead:
135
+
136
+ ```bash
137
+ cirvix gateway --servers ~/.cursor/mcp.json
138
+ ```
139
+
140
+ ## Status
141
+
142
+ Pre-release. The policy engine, `guard.wrap`, and the testing helpers work
143
+ today. Not yet in this package: secret-handle brokering and telemetry shipping,
144
+ both of which the Node SDK has — until then, point Python agents at the gateway
145
+ if you need those.
cirvix-0.1.0/README.md ADDED
@@ -0,0 +1,126 @@
1
+ # cirvix
2
+
3
+ Runtime governance for Python AI agents. Every tool call is evaluated against
4
+ policy before it executes.
5
+
6
+ **Zero dependencies.** Standard library only, permanently — the same reason the
7
+ Node package has none.
8
+
9
+ ```bash
10
+ pip install cirvix
11
+ ```
12
+
13
+ **Full documentation:** [`docs/`](../../docs/) — [Python SDK](../../docs/sdk-python.md), [policy reference](../../docs/policy.md), [quickstart](../../docs/quickstart.md).
14
+
15
+ ## Governing an agent
16
+
17
+ ```python
18
+ from cirvix import guard, CirvixDenied, CirvixHeld
19
+
20
+ tools = guard.wrap(
21
+ my_tools,
22
+ agent="pr-triage",
23
+ environment=os.environ.get("CIRVIX_ENV", "local"),
24
+ rules=rules,
25
+ )
26
+
27
+ try:
28
+ crew.kickoff()
29
+ except CirvixHeld as held:
30
+ print(held.approvers) # ["platform-oncall"] — this call is waiting
31
+ except CirvixDenied as err:
32
+ print(err.policy) # "deny-dotenv-read"
33
+ print(err.remediation) # 'secrets.get("STRIPE_KEY")'
34
+ print(err.decision_id) # pass to `cirvix why`
35
+ ```
36
+
37
+ `wrap` accepts the shapes Python tool collections actually come in and returns
38
+ the same shape:
39
+
40
+ | It accepts | Framework |
41
+ |---|---|
42
+ | A mapping of `name -> callable` | hand-rolled loops, AutoGen function maps |
43
+ | A sequence of objects carrying `func` | LangChain |
44
+ | A sequence of objects carrying `_run` | CrewAI |
45
+ | A single callable | anything |
46
+
47
+ Async tools stay async. Tool objects keep their descriptions and schemas, and
48
+ the list you passed in is left alone — a framework holding the originals does
49
+ not find them governed by surprise.
50
+
51
+ **`CirvixDenied` vs `CirvixHeld`.** A denial means re-plan. A hold means this
52
+ exact call may still happen once a person says yes. They are separate types
53
+ because collapsing them teaches an agent to treat both as failure.
54
+
55
+ ## Why this is a real evaluator and not an HTTP client
56
+
57
+ The easy version of this package asks a control plane over the network for
58
+ every decision. That would have been a fraction of the work and it would have
59
+ been wrong twice over: it puts a round trip in the enforcement path, and it
60
+ breaks the offline-first property the whole product rests on — a control plane
61
+ that stops enforcing when the network blips is worse than none, because the
62
+ failure is invisible.
63
+
64
+ So this is a native port. Which raises the real risk: **two engines that can
65
+ silently disagree are worse than one engine and an honest gap.** An agent
66
+ denied by the Node gateway and permitted here is a bypass nobody would find
67
+ until it mattered.
68
+
69
+ What makes it safe is `packages/conformance/policy-conformance.json`. Both
70
+ engines load that file and must produce identical verdicts, rules, canonical
71
+ resources, and rule traces across 44 cases — forbid short-circuiting, hold
72
+ outranking permit, default deny, glob semantics, path traversal, URL
73
+ normalization, every comparator, and the fail-closed behaviour for unknown
74
+ ones. Neither language gets a private copy, and changing behaviour means
75
+ changing the fixture first, in a commit a reviewer can see.
76
+
77
+ It has already earned its keep: writing it surfaced a bug where the Node engine
78
+ canonicalized `/etc/passwd` to `C:/etc/passwd` on Windows, so a rule written
79
+ `resources: ["/etc/**"]` silently did not match on the machine it was most
80
+ likely written to protect.
81
+
82
+ ```bash
83
+ python -m unittest discover -s tests
84
+ ```
85
+
86
+ ## Testing a policy like code
87
+
88
+ ```python
89
+ from cirvix.testing import evaluate, expect_no_loosening
90
+
91
+ def test_production_writes_are_held():
92
+ decision = evaluate(
93
+ policy_dir="./policies",
94
+ agent="deploy-bot",
95
+ action="k8s.apply",
96
+ resource="production/checkout",
97
+ context={"environment": "production"},
98
+ )
99
+ assert decision.verdict == "hold"
100
+ assert "platform-oncall" in decision.approvers
101
+ ```
102
+
103
+ `expect_no_loosening(before=…, after=…, calls=…)` reports any call a policy
104
+ change would newly permit. Tightening passes — a security policy is allowed to
105
+ move that way without surprising a reviewer.
106
+
107
+ ## What `wrap` does not do
108
+
109
+ The MCP gateway governs everything an agent does, **including tools added after
110
+ you deployed it**, because it sits on the wire. `wrap` governs a list. You keep
111
+ the same engine, rules, decision records, and audit chain; you give up coverage
112
+ of tools you did not enumerate.
113
+
114
+ If your agent speaks MCP — Claude Code, Cursor, or anything else — use the
115
+ gateway instead:
116
+
117
+ ```bash
118
+ cirvix gateway --servers ~/.cursor/mcp.json
119
+ ```
120
+
121
+ ## Status
122
+
123
+ Pre-release. The policy engine, `guard.wrap`, and the testing helpers work
124
+ today. Not yet in this package: secret-handle brokering and telemetry shipping,
125
+ both of which the Node SDK has — until then, point Python agents at the gateway
126
+ if you need those.
@@ -0,0 +1,85 @@
1
+ """Cirvix AgentControl — runtime governance for Python AI agents.
2
+
3
+ Zero dependencies, standard library only. A security tool that drags in a
4
+ transitive dependency tree is asking to become the supply-chain incident it
5
+ exists to prevent.
6
+
7
+ from cirvix import guard, CirvixDenied
8
+
9
+ tools = guard.wrap(my_tools, agent="pr-triage", rules=rules)
10
+
11
+ try:
12
+ crew.kickoff()
13
+ except CirvixDenied as err:
14
+ print(err.policy) # "deny-dotenv-read"
15
+ print(err.remediation) # 'secrets.get("STRIPE_KEY")'
16
+ print(err.decision_id) # pass to `cirvix why`
17
+
18
+ Enforcement is identical to the Node SDK and the MCP gateway, and that is not a
19
+ claim resting on care: all three run the shared conformance suite in
20
+ ``packages/conformance/policy-conformance.json``.
21
+ """
22
+
23
+ from __future__ import annotations
24
+
25
+ from importlib.metadata import PackageNotFoundError, version as package_version
26
+
27
+ from .guard import (
28
+ CirvixDenied,
29
+ CirvixHeld,
30
+ Guard,
31
+ action_for_tool,
32
+ destination_for,
33
+ resource_for_call,
34
+ wrap,
35
+ )
36
+ from .policy import (
37
+ EFFECT,
38
+ STARTER_RULES,
39
+ VERDICT,
40
+ Decision,
41
+ canonicalize_resource,
42
+ evaluate,
43
+ match_glob,
44
+ parse_rules,
45
+ )
46
+
47
+ try:
48
+ __version__ = package_version("cirvix")
49
+ except PackageNotFoundError:
50
+ # Source checkouts are not installed distributions. The package metadata
51
+ # and VERSION file are checked together by tools/check-version.mjs.
52
+ __version__ = "0.1.0"
53
+
54
+ __all__ = [
55
+ "CirvixDenied",
56
+ "CirvixHeld",
57
+ "Decision",
58
+ "EFFECT",
59
+ "Guard",
60
+ "STARTER_RULES",
61
+ "VERDICT",
62
+ "action_for_tool",
63
+ "canonicalize_resource",
64
+ "destination_for",
65
+ "evaluate",
66
+ "guard",
67
+ "match_glob",
68
+ "parse_rules",
69
+ "resource_for_call",
70
+ "wrap",
71
+ ]
72
+
73
+
74
+ class _GuardNamespace:
75
+ """The documented entry point: ``guard.wrap(tools, ...)``.
76
+
77
+ A namespace rather than a module so ``from cirvix import guard`` reads the
78
+ same way as the Node SDK's ``import { guard }``.
79
+ """
80
+
81
+ wrap = staticmethod(wrap)
82
+ Guard = Guard
83
+
84
+
85
+ guard = _GuardNamespace()