clawsentry 0.2.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.
- clawsentry-0.2.0/LICENSE +21 -0
- clawsentry-0.2.0/PKG-INFO +469 -0
- clawsentry-0.2.0/README.md +105 -0
- clawsentry-0.2.0/pyproject.toml +86 -0
- clawsentry-0.2.0/setup.cfg +4 -0
- clawsentry-0.2.0/src/clawsentry/README.md +425 -0
- clawsentry-0.2.0/src/clawsentry/__init__.py +3 -0
- clawsentry-0.2.0/src/clawsentry/__main__.py +6 -0
- clawsentry-0.2.0/src/clawsentry/adapters/__init__.py +0 -0
- clawsentry-0.2.0/src/clawsentry/adapters/a3s_adapter.py +431 -0
- clawsentry-0.2.0/src/clawsentry/adapters/a3s_gateway_harness.py +296 -0
- clawsentry-0.2.0/src/clawsentry/adapters/openclaw_adapter.py +479 -0
- clawsentry-0.2.0/src/clawsentry/adapters/openclaw_approval.py +198 -0
- clawsentry-0.2.0/src/clawsentry/adapters/openclaw_bootstrap.py +253 -0
- clawsentry-0.2.0/src/clawsentry/adapters/openclaw_gateway_client.py +261 -0
- clawsentry-0.2.0/src/clawsentry/adapters/openclaw_normalizer.py +262 -0
- clawsentry-0.2.0/src/clawsentry/adapters/openclaw_webhook_receiver.py +171 -0
- clawsentry-0.2.0/src/clawsentry/adapters/openclaw_ws_client.py +397 -0
- clawsentry-0.2.0/src/clawsentry/adapters/webhook_security.py +220 -0
- clawsentry-0.2.0/src/clawsentry/cli/__init__.py +1 -0
- clawsentry-0.2.0/src/clawsentry/cli/dotenv_loader.py +53 -0
- clawsentry-0.2.0/src/clawsentry/cli/init_command.py +89 -0
- clawsentry-0.2.0/src/clawsentry/cli/initializers/__init__.py +25 -0
- clawsentry-0.2.0/src/clawsentry/cli/initializers/a3s_code.py +77 -0
- clawsentry-0.2.0/src/clawsentry/cli/initializers/base.py +41 -0
- clawsentry-0.2.0/src/clawsentry/cli/initializers/openclaw.py +342 -0
- clawsentry-0.2.0/src/clawsentry/cli/main.py +259 -0
- clawsentry-0.2.0/src/clawsentry/cli/start_command.py +223 -0
- clawsentry-0.2.0/src/clawsentry/cli/watch_command.py +690 -0
- clawsentry-0.2.0/src/clawsentry/gateway/__init__.py +0 -0
- clawsentry-0.2.0/src/clawsentry/gateway/agent_analyzer.py +506 -0
- clawsentry-0.2.0/src/clawsentry/gateway/attack_patterns.yaml +583 -0
- clawsentry-0.2.0/src/clawsentry/gateway/detection_config.py +150 -0
- clawsentry-0.2.0/src/clawsentry/gateway/idempotency.py +109 -0
- clawsentry-0.2.0/src/clawsentry/gateway/injection_detector.py +162 -0
- clawsentry-0.2.0/src/clawsentry/gateway/l3_trigger.py +94 -0
- clawsentry-0.2.0/src/clawsentry/gateway/llm_factory.py +106 -0
- clawsentry-0.2.0/src/clawsentry/gateway/llm_provider.py +128 -0
- clawsentry-0.2.0/src/clawsentry/gateway/models.py +489 -0
- clawsentry-0.2.0/src/clawsentry/gateway/pattern_matcher.py +355 -0
- clawsentry-0.2.0/src/clawsentry/gateway/policy_engine.py +387 -0
- clawsentry-0.2.0/src/clawsentry/gateway/post_action_analyzer.py +239 -0
- clawsentry-0.2.0/src/clawsentry/gateway/review_skills.py +152 -0
- clawsentry-0.2.0/src/clawsentry/gateway/review_toolkit.py +137 -0
- clawsentry-0.2.0/src/clawsentry/gateway/risk_snapshot.py +468 -0
- clawsentry-0.2.0/src/clawsentry/gateway/semantic_analyzer.py +388 -0
- clawsentry-0.2.0/src/clawsentry/gateway/server.py +2181 -0
- clawsentry-0.2.0/src/clawsentry/gateway/session_enforcement.py +141 -0
- clawsentry-0.2.0/src/clawsentry/gateway/skills/code-review.yaml +51 -0
- clawsentry-0.2.0/src/clawsentry/gateway/skills/credential-audit.yaml +55 -0
- clawsentry-0.2.0/src/clawsentry/gateway/skills/file-system-audit.yaml +53 -0
- clawsentry-0.2.0/src/clawsentry/gateway/skills/general-review.yaml +32 -0
- clawsentry-0.2.0/src/clawsentry/gateway/skills/network-audit.yaml +53 -0
- clawsentry-0.2.0/src/clawsentry/gateway/skills/shell-audit.yaml +57 -0
- clawsentry-0.2.0/src/clawsentry/gateway/stack.py +468 -0
- clawsentry-0.2.0/src/clawsentry/gateway/trajectory_analyzer.py +379 -0
- clawsentry-0.2.0/src/clawsentry/py.typed +0 -0
- clawsentry-0.2.0/src/clawsentry/ui/dist/assets/index-Ba3k4Uql.css +1 -0
- clawsentry-0.2.0/src/clawsentry/ui/dist/assets/index-Dbc6n7Zx.js +223 -0
- clawsentry-0.2.0/src/clawsentry/ui/dist/index.html +13 -0
- clawsentry-0.2.0/src/clawsentry.egg-info/PKG-INFO +469 -0
- clawsentry-0.2.0/src/clawsentry.egg-info/SOURCES.txt +64 -0
- clawsentry-0.2.0/src/clawsentry.egg-info/dependency_links.txt +1 -0
- clawsentry-0.2.0/src/clawsentry.egg-info/entry_points.txt +5 -0
- clawsentry-0.2.0/src/clawsentry.egg-info/requires.txt +22 -0
- clawsentry-0.2.0/src/clawsentry.egg-info/top_level.txt +1 -0
clawsentry-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ClawSentry Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: clawsentry
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: AHP unified safety supervision framework for AI agent runtimes.
|
|
5
|
+
Author: ClawSentry Contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Elroyper/ClawSentry
|
|
8
|
+
Project-URL: Documentation, https://elroyper.github.io/ClawSentry/
|
|
9
|
+
Project-URL: Repository, https://github.com/Elroyper/ClawSentry
|
|
10
|
+
Project-URL: Changelog, https://github.com/Elroyper/ClawSentry/blob/main/CHANGELOG.md
|
|
11
|
+
Project-URL: Bug Tracker, https://github.com/Elroyper/ClawSentry/issues
|
|
12
|
+
Keywords: ai-safety,agent-supervision,llm-security,runtime-monitor,ahp,policy-engine
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Security
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: fastapi>=0.100
|
|
26
|
+
Requires-Dist: uvicorn[standard]>=0.23
|
|
27
|
+
Requires-Dist: pydantic>=2.0
|
|
28
|
+
Requires-Dist: PyYAML>=6.0
|
|
29
|
+
Provides-Extra: llm
|
|
30
|
+
Requires-Dist: anthropic>=0.20; extra == "llm"
|
|
31
|
+
Requires-Dist: openai>=1.10; extra == "llm"
|
|
32
|
+
Provides-Extra: enforcement
|
|
33
|
+
Requires-Dist: websockets<16.0,>=12.0; extra == "enforcement"
|
|
34
|
+
Provides-Extra: dev
|
|
35
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
36
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
|
|
37
|
+
Requires-Dist: httpx>=0.24; extra == "dev"
|
|
38
|
+
Requires-Dist: websockets<16.0,>=12.0; extra == "dev"
|
|
39
|
+
Provides-Extra: all
|
|
40
|
+
Requires-Dist: clawsentry[llm]; extra == "all"
|
|
41
|
+
Requires-Dist: clawsentry[enforcement]; extra == "all"
|
|
42
|
+
Requires-Dist: clawsentry[dev]; extra == "all"
|
|
43
|
+
Dynamic: license-file
|
|
44
|
+
|
|
45
|
+
# ClawSentry — AHP 安全监督网关
|
|
46
|
+
|
|
47
|
+
> **Python 3.11+** | **775 tests** | 协议版本 `ahp.1.0`
|
|
48
|
+
|
|
49
|
+
**ClawSentry** 是 AHP(Agent Harness Protocol)的 Python 参考实现,面向多 Agent 框架的统一安全监督网关。它以 Sidecar 形式部署,将来自不同运行时(a3s-code、OpenClaw 等)的事件归一化为统一协议,经过三层递进式风险评估后产生实时决策(放行 / 拦截 / 修改 / 延迟),并保留完整的审计轨迹。
|
|
50
|
+
|
|
51
|
+
**核心目标**:消除跨框架的策略重复实现与可观测性碎片化,用"协议优先、决策集中"的方式统一 Agent 安全监管。
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## 目录
|
|
56
|
+
|
|
57
|
+
- [三层决策模型](#三层决策模型)
|
|
58
|
+
- [架构概览](#架构概览)
|
|
59
|
+
- [快速开始](#快速开始)
|
|
60
|
+
- [CLI 命令](#cli-命令)
|
|
61
|
+
- [API 端点](#api-端点)
|
|
62
|
+
- [Web 安全仪表板](#web-安全仪表板)
|
|
63
|
+
- [项目结构](#项目结构)
|
|
64
|
+
- [配置参数](#配置参数)
|
|
65
|
+
- [运行测试](#运行测试)
|
|
66
|
+
- [设计文档索引](#设计文档索引)
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 三层决策模型
|
|
71
|
+
|
|
72
|
+
本框架采用**分层递进**的评估架构,每层有明确的延迟预算和职责边界:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
事件流量 100%
|
|
76
|
+
│
|
|
77
|
+
┌──────▼──────┐
|
|
78
|
+
│ L1 规则引擎 │ ← 确定性规则,< 1ms
|
|
79
|
+
└──────┬──────┘
|
|
80
|
+
│
|
|
81
|
+
┌───────────┼───────────┐
|
|
82
|
+
▼ ▼ ▼
|
|
83
|
+
LOW (allow) MEDIUM (?) CRITICAL (block)
|
|
84
|
+
~60%流量 ~30%流量 ~10%流量
|
|
85
|
+
│ │ │
|
|
86
|
+
│ ┌──────▼──────┐ │
|
|
87
|
+
│ │ L2 语义引擎 │ │ ← 可插拔 LLM,< 3s
|
|
88
|
+
│ └──────┬──────┘ │
|
|
89
|
+
│ │ │
|
|
90
|
+
│ ┌──────▼──────┐ │
|
|
91
|
+
│ │ L3 审查Agent │ │ ← 多轮工具调用,< 30s
|
|
92
|
+
│ └──────┬──────┘ │
|
|
93
|
+
│ │ │
|
|
94
|
+
▼ ▼ ▼
|
|
95
|
+
allow allow/block block
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
| 层级 | 实现 | 延迟 | 依赖 | 激活方式 |
|
|
99
|
+
|------|------|------|------|---------|
|
|
100
|
+
| **L1** 规则引擎 | D1-D5 五维评分 + 短路规则 | < 1ms | 无 | 默认启用 |
|
|
101
|
+
| **L2** 语义分析 | RuleBased / LLM / Composite | < 3s | Anthropic/OpenAI API (可选) | `CS_LLM_PROVIDER` 环境变量 |
|
|
102
|
+
| **L3** 审查 Agent | AgentAnalyzer + ReadOnlyToolkit + SkillRegistry | < 30s | LLM API | `CS_L3_ENABLED=true` |
|
|
103
|
+
|
|
104
|
+
### D1-D5 五维风险评估
|
|
105
|
+
|
|
106
|
+
| 维度 | 评估对象 | 分值 |
|
|
107
|
+
|------|---------|------|
|
|
108
|
+
| **D1** 工具类型 | 工具本身的风险等级 (bash=3, read_file=0) | 0-3 |
|
|
109
|
+
| **D2** 目标路径 | 操作涉及的文件/路径 (/etc/passwd=3, /tmp=0) | 0-3 |
|
|
110
|
+
| **D3** 命令模式 | bash/exec 命令内容 (rm -rf=3, ls=0) | 0-3 |
|
|
111
|
+
| **D4** 会话累积 | 该会话已发生的高危事件数 | 0-2 |
|
|
112
|
+
| **D5** 信任等级 | Agent 的权限层级 | 0-2 |
|
|
113
|
+
|
|
114
|
+
**短路规则**:D1=3 且 D2>=2 → CRITICAL | D3=3 → CRITICAL | D1=D2=D3=0 → LOW
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## 架构概览
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
┌──────────────────────────────────────────────────────────────────┐
|
|
122
|
+
│ Framework Runtime Layer │
|
|
123
|
+
│ ┌──────────────────┐ ┌─────────────────────────┐ │
|
|
124
|
+
│ │ a3s-code (Rust) │ │ OpenClaw (TypeScript) │ │
|
|
125
|
+
│ │ stdio Hook │ │ WS exec.approval │ │
|
|
126
|
+
│ └────────┬─────────┘ └──────────┬──────────────┘ │
|
|
127
|
+
└───────────┼───────────────────────────────┼─────────────────────┘
|
|
128
|
+
│ │
|
|
129
|
+
┌───────────▼───────────────────────────────▼─────────────────────┐
|
|
130
|
+
│ Adapter Layer │
|
|
131
|
+
│ ┌──────────────────┐ ┌──────────────────────────────┐ │
|
|
132
|
+
│ │ A3SCodeAdapter │ │ OpenClawAdapter + WS Client │ │
|
|
133
|
+
│ │ + Harness 桥接 │ │ + Webhook Receiver │ │
|
|
134
|
+
│ └────────┬─────────┘ └──────────┬───────────────────┘ │
|
|
135
|
+
└───────────┼──────────────────────────┼──────────────────────────┘
|
|
136
|
+
│ UDS / HTTP (JSON-RPC) │
|
|
137
|
+
┌───────────▼──────────────────────────▼──────────────────────────┐
|
|
138
|
+
│ ClawSentry — AHP Supervision Gateway │
|
|
139
|
+
│ │
|
|
140
|
+
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌────────────────┐ │
|
|
141
|
+
│ │ L1 Rules │→│ L2 LLM │→│ L3 Agent │→│ Decision Router │ │
|
|
142
|
+
│ │ D1-D5 │ │ Semantic │ │ Toolkit │ │ allow/block/ │ │
|
|
143
|
+
│ │ <1ms │ │ <3s │ │ <30s │ │ modify/defer │ │
|
|
144
|
+
│ └──────────┘ └──────────┘ └──────────┘ └───────┬────────┘ │
|
|
145
|
+
│ │ │
|
|
146
|
+
│ ┌─────────────────┐ ┌────────────────┐ ┌─────────▼────────┐ │
|
|
147
|
+
│ │ SessionRegistry │ │ AlertRegistry │ │ TrajectoryStore │ │
|
|
148
|
+
│ │ 会话风险跟踪 │ │ 告警管理 │ │ SQLite 审计轨迹 │ │
|
|
149
|
+
│ └─────────────────┘ └────────────────┘ └──────────────────┘ │
|
|
150
|
+
│ │
|
|
151
|
+
│ ┌─────────────────┐ ┌────────────────┐ ┌──────────────────┐ │
|
|
152
|
+
│ │ EventBus + SSE │ │ Idempotency │ │ Web Dashboard │ │
|
|
153
|
+
│ │ 实时事件推送 │ │ Cache (去重) │ │ React SPA at /ui │ │
|
|
154
|
+
│ └─────────────────┘ └────────────────┘ └──────────────────┘ │
|
|
155
|
+
└──────────────────────────────────────────────────────────────────┘
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**设计原则**:
|
|
159
|
+
|
|
160
|
+
| 原则 | 说明 |
|
|
161
|
+
|------|------|
|
|
162
|
+
| 协议优先 | 先解决跨框架互操作,再叠加策略 |
|
|
163
|
+
| 决策集中 | 所有最终决策由 Gateway 产生,Adapter 不做决策 |
|
|
164
|
+
| 双通道处理 | pre-action 同步拦截,post-action 异步审计 |
|
|
165
|
+
| 仅升级不降级 | L2/L3 只能把风险往上调,确保安全下限 |
|
|
166
|
+
| fail-closed | 高危操作在 Gateway 不可达时默认拦截 |
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## 快速开始
|
|
171
|
+
|
|
172
|
+
### 安装
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
# 基础安装
|
|
176
|
+
pip install clawsentry
|
|
177
|
+
|
|
178
|
+
# 含 OpenClaw WS 集成
|
|
179
|
+
pip install "clawsentry[enforcement]"
|
|
180
|
+
|
|
181
|
+
# 含 LLM 语义分析
|
|
182
|
+
pip install "clawsentry[llm]"
|
|
183
|
+
|
|
184
|
+
# 全量安装(含开发依赖)
|
|
185
|
+
pip install "clawsentry[all]"
|
|
186
|
+
|
|
187
|
+
# 开发模式(从源码)
|
|
188
|
+
git clone <repo-url> && cd ClawSentry
|
|
189
|
+
pip install -e ".[dev]"
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### OpenClaw 用户(推荐流程)
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
# 1. 一键初始化(自动探测 ~/.openclaw/openclaw.json 提取 token/端口)
|
|
196
|
+
clawsentry init openclaw --auto-detect
|
|
197
|
+
|
|
198
|
+
# 2. 自动配置 OpenClaw(设置 tools.exec.host + exec-approvals)
|
|
199
|
+
clawsentry init openclaw --setup
|
|
200
|
+
|
|
201
|
+
# 3. 启动 Gateway(自动检测 OpenClaw 配置,按需启动 WS/Webhook)
|
|
202
|
+
clawsentry gateway
|
|
203
|
+
|
|
204
|
+
# 4. 实时监控(另一终端)
|
|
205
|
+
clawsentry watch
|
|
206
|
+
|
|
207
|
+
# 5. Web 仪表板
|
|
208
|
+
# 浏览器打开 http://127.0.0.1:8080/ui
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### a3s-code 用户
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
# 1. 初始化配置
|
|
215
|
+
clawsentry init a3s-code
|
|
216
|
+
|
|
217
|
+
# 2. 启动 Gateway
|
|
218
|
+
clawsentry gateway
|
|
219
|
+
|
|
220
|
+
# 3. 在 a3s-code 中配置 AHP transport
|
|
221
|
+
# opts.ahp_transport = StdioTransport(program="clawsentry-harness")
|
|
222
|
+
|
|
223
|
+
# 4. 实时监控
|
|
224
|
+
clawsentry watch
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### 直接调用 Gateway (JSON-RPC)
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
# 通过 HTTP 发送决策请求
|
|
231
|
+
curl -X POST http://127.0.0.1:8080/ahp \
|
|
232
|
+
-H "Content-Type: application/json" \
|
|
233
|
+
-H "Authorization: Bearer <your-token>" \
|
|
234
|
+
-d '{
|
|
235
|
+
"jsonrpc": "2.0",
|
|
236
|
+
"method": "ahp/sync_decision",
|
|
237
|
+
"id": "req-001",
|
|
238
|
+
"params": {
|
|
239
|
+
"rpc_version": "sync_decision.1.0",
|
|
240
|
+
"request_id": "req-001",
|
|
241
|
+
"deadline_ms": 100,
|
|
242
|
+
"decision_tier": "L1",
|
|
243
|
+
"event": {
|
|
244
|
+
"schema_version": "ahp.1.0",
|
|
245
|
+
"event_id": "evt-001",
|
|
246
|
+
"trace_id": "trace-001",
|
|
247
|
+
"event_type": "pre_action",
|
|
248
|
+
"session_id": "sess-abc",
|
|
249
|
+
"agent_id": "agent-001",
|
|
250
|
+
"source_framework": "a3s-code",
|
|
251
|
+
"occurred_at": "2025-01-01T00:00:00Z",
|
|
252
|
+
"payload": {"tool": "bash", "command": "ls"},
|
|
253
|
+
"event_subtype": "tool:execute"
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}'
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## CLI 命令
|
|
262
|
+
|
|
263
|
+
统一入口 `clawsentry`,行为由配置自动决定:
|
|
264
|
+
|
|
265
|
+
| 命令 | 说明 |
|
|
266
|
+
|------|------|
|
|
267
|
+
| `clawsentry gateway` | 启动 Gateway(自动检测 OpenClaw 配置,按需启动 WS/Webhook) |
|
|
268
|
+
| `clawsentry watch` | 连接 SSE 实时展示决策(`--filter`/`--json`/`--no-color`/`--interactive`) |
|
|
269
|
+
| `clawsentry init <framework>` | 一键初始化配置(`openclaw`/`a3s-code`) |
|
|
270
|
+
| `clawsentry init openclaw --auto-detect` | 自动探测 `~/.openclaw/openclaw.json` 提取 token/端口 |
|
|
271
|
+
| `clawsentry init openclaw --setup` | 自动配置 OpenClaw(`tools.exec.host` + `exec-approvals`) |
|
|
272
|
+
| `clawsentry harness` | a3s-code stdio 桥接子进程 |
|
|
273
|
+
|
|
274
|
+
**环境变量自动加载**:Gateway 启动时自动读取 `.env.clawsentry` 文件(不覆盖已有环境变量)。
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## API 端点
|
|
279
|
+
|
|
280
|
+
所有端点需 `Authorization: Bearer <token>` 认证(`/health` 和 `/ui` 除外)。SSE 端点支持 `?token=xxx` query param 认证(`EventSource` 不支持自定义 header)。
|
|
281
|
+
|
|
282
|
+
### 决策
|
|
283
|
+
|
|
284
|
+
| 方法 | 路径 | 说明 |
|
|
285
|
+
|------|------|------|
|
|
286
|
+
| POST | `/ahp` | JSON-RPC 同步决策(ahp/sync_decision) |
|
|
287
|
+
| POST | `/ahp/resolve` | DEFER 决策代理(allow-once/deny),503 当无 OpenClaw |
|
|
288
|
+
|
|
289
|
+
### 报表 & 监控
|
|
290
|
+
|
|
291
|
+
| 方法 | 路径 | 说明 |
|
|
292
|
+
|------|------|------|
|
|
293
|
+
| GET | `/health` | 健康检查(无需认证,K8s probe 兼容) |
|
|
294
|
+
| GET | `/report/summary` | 跨框架聚合统计(支持 `window_seconds` 参数) |
|
|
295
|
+
| GET | `/report/sessions` | 活跃会话列表 + 风险排序 |
|
|
296
|
+
| GET | `/report/session/{id}` | 会话轨迹回放 |
|
|
297
|
+
| GET | `/report/session/{id}/risk` | 会话风险详情 + D1-D5 时间线 |
|
|
298
|
+
| GET | `/report/stream` | SSE 实时事件推送(decision/session_start/session_risk_change/alert) |
|
|
299
|
+
| GET | `/report/alerts` | 告警列表(过滤: severity/acknowledged/window_seconds) |
|
|
300
|
+
| POST | `/report/alerts/{id}/acknowledge` | 确认告警 |
|
|
301
|
+
|
|
302
|
+
### Web 界面
|
|
303
|
+
|
|
304
|
+
| 方法 | 路径 | 说明 |
|
|
305
|
+
|------|------|------|
|
|
306
|
+
| GET | `/ui` | Web 安全仪表板 SPA(无需认证) |
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
## Web 安全仪表板
|
|
311
|
+
|
|
312
|
+
Gateway 内置 React SPA 安全仪表板,通过 `/ui` 路径访问。暗色 SOC 主题,实时 SSE 数据推送。
|
|
313
|
+
|
|
314
|
+
| 页面 | 功能 |
|
|
315
|
+
|------|------|
|
|
316
|
+
| **Dashboard** | 实时决策 feed + 4 指标卡 + 风险分布图 + 决策来源图 |
|
|
317
|
+
| **Sessions** | 活跃会话列表 + D1-D5 雷达图 + 风险曲线 + 决策时间线 |
|
|
318
|
+
| **Alerts** | 告警表格 + severity/acknowledged 过滤 + 确认按钮 + SSE 自动推送 |
|
|
319
|
+
| **DEFER Panel** | 待决策列表 + 倒计时器 + Allow/Deny 按钮 + 503 降级提示 |
|
|
320
|
+
|
|
321
|
+
技术栈:React 18 + TypeScript + Vite + recharts + lucide-react
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## 项目结构
|
|
326
|
+
|
|
327
|
+
```
|
|
328
|
+
src/clawsentry/
|
|
329
|
+
├── gateway/ # 核心监督引擎
|
|
330
|
+
│ ├── models.py # 统一数据模型 (CanonicalEvent / Decision / RiskSnapshot)
|
|
331
|
+
│ ├── server.py # FastAPI HTTP + UDS 双传输 + Auth + SSE + 静态文件
|
|
332
|
+
│ ├── stack.py # 一键启动 Gateway + OpenClaw 运行时 + DEFER resolve
|
|
333
|
+
│ ├── policy_engine.py # L1 规则 + L2 Analyzer 集成
|
|
334
|
+
│ ├── risk_snapshot.py # D1-D5 五维风险评估
|
|
335
|
+
│ ├── semantic_analyzer.py # L2 可插拔语义分析 (Protocol + 3 种实现)
|
|
336
|
+
│ ├── llm_provider.py # LLM Provider 基类 (Anthropic/OpenAI)
|
|
337
|
+
│ ├── llm_factory.py # 环境变量驱动 analyzer 构建
|
|
338
|
+
│ ├── agent_analyzer.py # L3 审查 Agent (MVP 单轮 + 标准多轮)
|
|
339
|
+
│ ├── review_toolkit.py # L3 ReadOnlyToolkit (5 个只读工具)
|
|
340
|
+
│ ├── review_skills.py # L3 SkillRegistry (YAML 加载/选择)
|
|
341
|
+
│ ├── l3_trigger.py # L3 触发策略 (4 类触发条件)
|
|
342
|
+
│ ├── idempotency.py # 请求幂等性缓存
|
|
343
|
+
│ └── skills/ # 6 个内置审查领域 skill (YAML)
|
|
344
|
+
├── adapters/ # 框架适配器
|
|
345
|
+
│ ├── a3s_adapter.py # a3s-code Hook → CanonicalEvent 归一化
|
|
346
|
+
│ ├── a3s_gateway_harness.py # a3s-code stdio 桥接 (JSON-RPC 2.0)
|
|
347
|
+
│ ├── openclaw_adapter.py # OpenClaw 主适配器 (含审批状态机)
|
|
348
|
+
│ ├── openclaw_normalizer.py # OpenClaw 事件归一化
|
|
349
|
+
│ ├── openclaw_ws_client.py # OpenClaw WS 客户端 (事件监听 + resolve)
|
|
350
|
+
│ ├── openclaw_webhook_receiver.py # OpenClaw Webhook 安全接收器
|
|
351
|
+
│ ├── openclaw_gateway_client.py # OpenClaw → Gateway RPC 客户端
|
|
352
|
+
│ ├── openclaw_approval.py # 审批生命周期状态机
|
|
353
|
+
│ ├── openclaw_bootstrap.py # OpenClaw 统一配置工厂
|
|
354
|
+
│ └── webhook_security.py # Token + HMAC 校验
|
|
355
|
+
├── cli/ # 统一 CLI
|
|
356
|
+
│ ├── main.py # clawsentry 入口 (init/gateway/watch/harness)
|
|
357
|
+
│ ├── init_command.py # init 命令 + --setup + --auto-detect
|
|
358
|
+
│ ├── watch_command.py # watch SSE 实时终端 + --interactive DEFER
|
|
359
|
+
│ ├── dotenv_loader.py # .env.clawsentry 自动加载
|
|
360
|
+
│ └── initializers/ # 框架初始化器 (openclaw/a3s_code)
|
|
361
|
+
├── ui/ # Web 安全仪表板 (React SPA)
|
|
362
|
+
│ ├── src/ # TypeScript 源码
|
|
363
|
+
│ │ ├── api/ # API client + SSE + types
|
|
364
|
+
│ │ ├── hooks/ # useAuth
|
|
365
|
+
│ │ ├── components/ # Layout, StatusBar, badges, etc.
|
|
366
|
+
│ │ └── pages/ # Dashboard, Sessions, Alerts, DeferPanel
|
|
367
|
+
│ └── dist/ # 预构建产物 (随 pip 包分发)
|
|
368
|
+
└── tests/ # 测试套件 (775 tests)
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
373
|
+
## 配置参数
|
|
374
|
+
|
|
375
|
+
### 核心环境变量
|
|
376
|
+
|
|
377
|
+
| 变量 | 默认值 | 说明 |
|
|
378
|
+
|------|--------|------|
|
|
379
|
+
| `CS_AUTH_TOKEN` | (禁用) | HTTP 端点 Bearer token(建议 >= 32 字符) |
|
|
380
|
+
| `CS_HTTP_HOST` | `127.0.0.1` | HTTP 绑定地址 |
|
|
381
|
+
| `CS_HTTP_PORT` | `8080` | HTTP 端口 |
|
|
382
|
+
| `CS_UDS_PATH` | `/tmp/clawsentry.sock` | UDS 监听地址 |
|
|
383
|
+
| `CS_TRAJECTORY_DB_PATH` | `/tmp/clawsentry-trajectory.db` | SQLite 轨迹文件 |
|
|
384
|
+
|
|
385
|
+
### LLM 配置
|
|
386
|
+
|
|
387
|
+
| 变量 | 说明 |
|
|
388
|
+
|------|------|
|
|
389
|
+
| `CS_LLM_PROVIDER` | LLM 提供商 (`anthropic` / `openai`) |
|
|
390
|
+
| `CS_LLM_BASE_URL` | 自定义 API 端点 |
|
|
391
|
+
| `CS_LLM_MODEL` | 模型名称 |
|
|
392
|
+
| `CS_L3_ENABLED` | 启用 L3 审查 Agent (`true`/`false`) |
|
|
393
|
+
|
|
394
|
+
### OpenClaw 配置
|
|
395
|
+
|
|
396
|
+
| 变量 | 说明 |
|
|
397
|
+
|------|------|
|
|
398
|
+
| `OPENCLAW_WS_URL` | OpenClaw Gateway WS 地址 |
|
|
399
|
+
| `OPENCLAW_OPERATOR_TOKEN` | 操作员令牌 |
|
|
400
|
+
| `OPENCLAW_ENFORCEMENT_ENABLED` | 启用执法模式 (`true`/`false`) |
|
|
401
|
+
| `OPENCLAW_WEBHOOK_TOKEN` | Webhook 认证 token |
|
|
402
|
+
| `OPENCLAW_WEBHOOK_SECRET` | Webhook HMAC 签名密钥 |
|
|
403
|
+
|
|
404
|
+
### 会话强制策略
|
|
405
|
+
|
|
406
|
+
| 变量 | 默认值 | 说明 |
|
|
407
|
+
|------|--------|------|
|
|
408
|
+
| `AHP_SESSION_ENFORCEMENT_ENABLED` | `false` | 启用会话级累积高危强制策略 |
|
|
409
|
+
| `AHP_SESSION_ENFORCEMENT_THRESHOLD` | `3` | 触发强制的高危事件累积阈值 |
|
|
410
|
+
| `AHP_SESSION_ENFORCEMENT_ACTION` | `defer` | 触发后的动作 (`defer`/`block`/`l3_require`) |
|
|
411
|
+
| `AHP_SESSION_ENFORCEMENT_COOLDOWN_SECONDS` | `600` | 强制状态冷却时间(秒) |
|
|
412
|
+
|
|
413
|
+
### 安全加固
|
|
414
|
+
|
|
415
|
+
| 变量 | 说明 |
|
|
416
|
+
|------|------|
|
|
417
|
+
| `CS_RATE_LIMIT_PER_MINUTE` | 速率限制(默认 300/分钟) |
|
|
418
|
+
| `AHP_SSL_CERTFILE` | SSL 证书路径(启用 HTTPS) |
|
|
419
|
+
| `AHP_SSL_KEYFILE` | SSL 私钥路径 |
|
|
420
|
+
| `AHP_WEBHOOK_IP_WHITELIST` | Webhook 来源 IP 白名单(逗号分隔) |
|
|
421
|
+
| `AHP_WEBHOOK_TOKEN_TTL_SECONDS` | Webhook Token 有效期(秒) |
|
|
422
|
+
| `AHP_SKILLS_DIR` | L3 自定义 Skills 目录路径 |
|
|
423
|
+
|
|
424
|
+
---
|
|
425
|
+
|
|
426
|
+
## 运行测试
|
|
427
|
+
|
|
428
|
+
```bash
|
|
429
|
+
# 安装开发依赖
|
|
430
|
+
pip install -e ".[dev]"
|
|
431
|
+
|
|
432
|
+
# 运行全部测试
|
|
433
|
+
python -m pytest src/clawsentry/tests/ -v --tb=short
|
|
434
|
+
# 预期:775 passed
|
|
435
|
+
|
|
436
|
+
# 按模块运行
|
|
437
|
+
python -m pytest src/clawsentry/tests/test_risk_and_policy.py -v # L1 风险评估
|
|
438
|
+
python -m pytest src/clawsentry/tests/test_semantic_analyzer.py -v # L2 语义分析
|
|
439
|
+
python -m pytest src/clawsentry/tests/test_agent_analyzer.py -v # L3 审查 Agent
|
|
440
|
+
python -m pytest src/clawsentry/tests/test_gateway.py -v # Gateway 协议
|
|
441
|
+
python -m pytest src/clawsentry/tests/test_openclaw_adapter.py -v # OpenClaw 适配器
|
|
442
|
+
python -m pytest src/clawsentry/tests/test_ws_gateway_integration.py -v # WS 全链路集成
|
|
443
|
+
python -m pytest src/clawsentry/tests/test_a3s_e2e_integration.py -v # a3s-code E2E
|
|
444
|
+
python -m pytest src/clawsentry/tests/test_http_auth.py -v # HTTP 认证
|
|
445
|
+
python -m pytest src/clawsentry/tests/test_resolve_endpoint.py -v # DEFER resolve
|
|
446
|
+
python -m pytest src/clawsentry/tests/test_ui_static.py -v # Web UI 静态文件
|
|
447
|
+
python -m pytest src/clawsentry/tests/test_cli_init.py -v # CLI init
|
|
448
|
+
python -m pytest src/clawsentry/tests/test_watch_command.py -v # watch 命令
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
---
|
|
452
|
+
|
|
453
|
+
## 设计文档索引
|
|
454
|
+
|
|
455
|
+
详细设计文档位于 `docs/designs/ClawSentry/`:
|
|
456
|
+
|
|
457
|
+
| 文档 | 内容 | 状态 |
|
|
458
|
+
|------|------|------|
|
|
459
|
+
| `01-scope-and-architecture.md` | 整体范围、架构层次、部署模型 | FROZEN |
|
|
460
|
+
| `02-unified-ahp-contract.md` | Canonical Event / Decision 统一合约 | FROZEN |
|
|
461
|
+
| `03-openclaw-adapter-design.md` | OpenClaw 适配器设计 | FROZEN |
|
|
462
|
+
| `04-policy-decision-and-fallback.md` | 决策模型、风险评分、超时/重试/降级 | FROZEN |
|
|
463
|
+
| `05-trajectory-observability-audit.md` | 审计轨迹与合规报告 | FROZEN |
|
|
464
|
+
| `06-rollout-validation-and-risks.md` | 分阶段上线风险与验证检查点 | FROZEN |
|
|
465
|
+
| `07-openclaw-field-level-mapping.md` | OpenClaw 字段级映射 | FROZEN |
|
|
466
|
+
| `08-openclaw-webhook-security-hardening.md` | Webhook 安全补强方案 | FROZEN |
|
|
467
|
+
| `09-l2-pluggable-semantic-analysis.md` | L2 可插拔语义分析架构 | FROZEN |
|
|
468
|
+
| `10-http-endpoint-auth.md` | HTTP Bearer Token 认证 | FROZEN |
|
|
469
|
+
| `11-long-term-evolution-vision.md` | 长期演进路线图 (Phase 5+) | ACTIVE |
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
[](https://pypi.org/project/clawsentry/) [](https://pypi.org/project/clawsentry/) [](LICENSE) [](https://elroyper.github.io/ClawSentry/)
|
|
2
|
+
|
|
3
|
+
# ClawSentry
|
|
4
|
+
|
|
5
|
+
AHP (Agent Harness Protocol) reference implementation — a unified security supervision gateway for AI agent runtimes.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Three-tier progressive decision**: L1 rule engine (<1 ms) → L2 semantic analysis (<3 s) → L3 review agent (<30 s)
|
|
10
|
+
- **Dual framework support**: a3s-code (stdio / HTTP) + OpenClaw (WebSocket / Webhook)
|
|
11
|
+
- **Real-time monitoring**: SSE streaming, `clawsentry watch` CLI, React/TypeScript web dashboard
|
|
12
|
+
- **Production security**: Bearer token auth, HMAC webhook signatures, UDS chmod 0o600, SSL/TLS, rate limiting
|
|
13
|
+
- **Session enforcement**: auto-escalate after N high-risk events with configurable cooldown
|
|
14
|
+
- **775+ tests**, ~6.5 s full suite
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install clawsentry # core
|
|
20
|
+
pip install clawsentry[llm] # + Anthropic/OpenAI for L2/L3
|
|
21
|
+
pip install clawsentry[all] # everything
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Requires Python >= 3.11.
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
### One-Command Launch (Recommended)
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
clawsentry start # auto-detect framework + init + gateway + watch
|
|
32
|
+
# or specify framework:
|
|
33
|
+
clawsentry start --framework openclaw
|
|
34
|
+
clawsentry start --framework a3s-code --interactive # enable DEFER interaction
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The `start` command will:
|
|
38
|
+
1. Auto-detect your framework (OpenClaw or a3s-code)
|
|
39
|
+
2. Initialize configuration if needed
|
|
40
|
+
3. Start the gateway in the background
|
|
41
|
+
4. Display live monitoring in the foreground
|
|
42
|
+
5. Show Web UI URL with auto-login token
|
|
43
|
+
|
|
44
|
+
Press Ctrl+C to gracefully shutdown.
|
|
45
|
+
|
|
46
|
+
### Manual Step-by-Step
|
|
47
|
+
|
|
48
|
+
#### a3s-code
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
clawsentry init a3s-code --setup # generate config + patch a3s-code settings
|
|
52
|
+
clawsentry gateway # start gateway (default :8080)
|
|
53
|
+
clawsentry watch # tail live decisions in your terminal
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
#### OpenClaw
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
clawsentry init openclaw --setup # generate config + patch OpenClaw settings
|
|
60
|
+
clawsentry gateway # start gateway (default :8080)
|
|
61
|
+
open http://localhost:8080/ui # open web dashboard
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Architecture
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
a3s-code ──→ A3S Adapter ──┐
|
|
68
|
+
├──→ AHP CanonicalEvent ──→ PolicyEngine ──→ L1/L2/L3
|
|
69
|
+
OpenClaw ──→ OC Adapter ───┘ │
|
|
70
|
+
SessionRegistry ←┘
|
|
71
|
+
EventBus ──→ SSE / CLI / Web UI
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Decision tiers:**
|
|
75
|
+
|
|
76
|
+
- **L1 PolicyEngine** — deterministic rule scoring across five risk dimensions (D1–D5), sub-millisecond latency
|
|
77
|
+
- **L2 SemanticAnalyzer** — LLM-backed semantic analysis with configurable provider (Anthropic / OpenAI / rule-based fallback)
|
|
78
|
+
- **L3 AgentAnalyzer** — multi-turn review agent with read-only toolkit and per-session skill dispatch
|
|
79
|
+
|
|
80
|
+
## Documentation
|
|
81
|
+
|
|
82
|
+
Full documentation is available at **https://elroyper.github.io/ClawSentry/**
|
|
83
|
+
|
|
84
|
+
- [Getting Started](https://elroyper.github.io/ClawSentry/getting-started/)
|
|
85
|
+
- [Architecture Overview](https://elroyper.github.io/ClawSentry/architecture/)
|
|
86
|
+
- [a3s-code Integration Guide](https://elroyper.github.io/ClawSentry/guides/a3s-code/)
|
|
87
|
+
- [OpenClaw Integration Guide](https://elroyper.github.io/ClawSentry/guides/openclaw/)
|
|
88
|
+
- [Configuration Reference](https://elroyper.github.io/ClawSentry/reference/configuration/)
|
|
89
|
+
- [REST & SSE API](https://elroyper.github.io/ClawSentry/reference/api/)
|
|
90
|
+
|
|
91
|
+
## Key Environment Variables
|
|
92
|
+
|
|
93
|
+
| Variable | Default | Description |
|
|
94
|
+
|---|---|---|
|
|
95
|
+
| `CS_AUTH_TOKEN` | *(required)* | Bearer token for all REST / SSE endpoints |
|
|
96
|
+
| `AHP_LLM_PROVIDER` | `rule_based` | LLM backend for L2/L3: `anthropic`, `openai`, or `rule_based` |
|
|
97
|
+
| `AHP_L3_ENABLED` | `false` | Enable L3 multi-turn review agent |
|
|
98
|
+
| `AHP_SESSION_ENFORCEMENT_ENABLED` | `false` | Auto-escalate sessions after N high-risk events |
|
|
99
|
+
| `OPENCLAW_WS_URL` | — | WebSocket URL of a running OpenClaw gateway |
|
|
100
|
+
|
|
101
|
+
See the [full configuration reference](https://elroyper.github.io/ClawSentry/reference/configuration/) for all variables.
|
|
102
|
+
|
|
103
|
+
## License
|
|
104
|
+
|
|
105
|
+
MIT — see [LICENSE](LICENSE)
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "clawsentry"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "AHP unified safety supervision framework for AI agent runtimes."
|
|
9
|
+
readme = "src/clawsentry/README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "ClawSentry Contributors"},
|
|
14
|
+
]
|
|
15
|
+
keywords = [
|
|
16
|
+
"ai-safety",
|
|
17
|
+
"agent-supervision",
|
|
18
|
+
"llm-security",
|
|
19
|
+
"runtime-monitor",
|
|
20
|
+
"ahp",
|
|
21
|
+
"policy-engine",
|
|
22
|
+
]
|
|
23
|
+
classifiers = [
|
|
24
|
+
"Development Status :: 4 - Beta",
|
|
25
|
+
"Intended Audience :: Developers",
|
|
26
|
+
"License :: OSI Approved :: MIT License",
|
|
27
|
+
"Programming Language :: Python :: 3",
|
|
28
|
+
"Programming Language :: Python :: 3.11",
|
|
29
|
+
"Programming Language :: Python :: 3.12",
|
|
30
|
+
"Topic :: Security",
|
|
31
|
+
"Topic :: Software Development :: Libraries :: Application Frameworks",
|
|
32
|
+
"Typing :: Typed",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
dependencies = [
|
|
36
|
+
"fastapi>=0.100",
|
|
37
|
+
"uvicorn[standard]>=0.23",
|
|
38
|
+
"pydantic>=2.0",
|
|
39
|
+
"PyYAML>=6.0",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
[project.urls]
|
|
43
|
+
Homepage = "https://github.com/Elroyper/ClawSentry"
|
|
44
|
+
Documentation = "https://elroyper.github.io/ClawSentry/"
|
|
45
|
+
Repository = "https://github.com/Elroyper/ClawSentry"
|
|
46
|
+
Changelog = "https://github.com/Elroyper/ClawSentry/blob/main/CHANGELOG.md"
|
|
47
|
+
"Bug Tracker" = "https://github.com/Elroyper/ClawSentry/issues"
|
|
48
|
+
|
|
49
|
+
[project.optional-dependencies]
|
|
50
|
+
llm = [
|
|
51
|
+
"anthropic>=0.20",
|
|
52
|
+
"openai>=1.10",
|
|
53
|
+
]
|
|
54
|
+
enforcement = [
|
|
55
|
+
"websockets>=12.0,<16.0",
|
|
56
|
+
]
|
|
57
|
+
dev = [
|
|
58
|
+
"pytest>=7.0",
|
|
59
|
+
"pytest-asyncio>=0.21",
|
|
60
|
+
"httpx>=0.24",
|
|
61
|
+
"websockets>=12.0,<16.0",
|
|
62
|
+
]
|
|
63
|
+
all = [
|
|
64
|
+
"clawsentry[llm]",
|
|
65
|
+
"clawsentry[enforcement]",
|
|
66
|
+
"clawsentry[dev]",
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
[project.scripts]
|
|
70
|
+
clawsentry = "clawsentry.cli.main:main"
|
|
71
|
+
clawsentry-gateway = "clawsentry.gateway.server:main"
|
|
72
|
+
clawsentry-harness = "clawsentry.adapters.a3s_gateway_harness:main"
|
|
73
|
+
clawsentry-stack = "clawsentry.gateway.stack:main"
|
|
74
|
+
|
|
75
|
+
[tool.setuptools.package-data]
|
|
76
|
+
clawsentry = ["ui/dist/**", "gateway/skills/*.yaml", "gateway/attack_patterns.yaml"]
|
|
77
|
+
|
|
78
|
+
[tool.setuptools.packages.find]
|
|
79
|
+
where = ["src"]
|
|
80
|
+
include = ["clawsentry*"]
|
|
81
|
+
exclude = ["clawsentry.tests*"]
|
|
82
|
+
|
|
83
|
+
[tool.pytest.ini_options]
|
|
84
|
+
testpaths = ["src/clawsentry/tests"]
|
|
85
|
+
pythonpath = ["src"]
|
|
86
|
+
asyncio_mode = "auto"
|