@trentapps/manager-protocol 1.1.1
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.
- package/LICENSE +21 -0
- package/README.md +446 -0
- package/dist/analyzers/ArchitectureDetector.d.ts +44 -0
- package/dist/analyzers/ArchitectureDetector.d.ts.map +1 -0
- package/dist/analyzers/ArchitectureDetector.js +218 -0
- package/dist/analyzers/ArchitectureDetector.js.map +1 -0
- package/dist/analyzers/CSSAnalyzer.d.ts +104 -0
- package/dist/analyzers/CSSAnalyzer.d.ts.map +1 -0
- package/dist/analyzers/CSSAnalyzer.js +578 -0
- package/dist/analyzers/CSSAnalyzer.js.map +1 -0
- package/dist/analyzers/index.d.ts +5 -0
- package/dist/analyzers/index.d.ts.map +1 -0
- package/dist/analyzers/index.js +5 -0
- package/dist/analyzers/index.js.map +1 -0
- package/dist/cli.d.ts +8 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +174 -0
- package/dist/cli.js.map +1 -0
- package/dist/design-system/index.d.ts +6 -0
- package/dist/design-system/index.d.ts.map +1 -0
- package/dist/design-system/index.js +6 -0
- package/dist/design-system/index.js.map +1 -0
- package/dist/design-system/tokens.d.ts +106 -0
- package/dist/design-system/tokens.d.ts.map +1 -0
- package/dist/design-system/tokens.js +554 -0
- package/dist/design-system/tokens.js.map +1 -0
- package/dist/engine/AppMonitor.d.ts +162 -0
- package/dist/engine/AppMonitor.d.ts.map +1 -0
- package/dist/engine/AppMonitor.js +754 -0
- package/dist/engine/AppMonitor.js.map +1 -0
- package/dist/engine/AuditLogger.d.ts +138 -0
- package/dist/engine/AuditLogger.d.ts.map +1 -0
- package/dist/engine/AuditLogger.js +448 -0
- package/dist/engine/AuditLogger.js.map +1 -0
- package/dist/engine/GitHubApprovalManager.d.ts +106 -0
- package/dist/engine/GitHubApprovalManager.d.ts.map +1 -0
- package/dist/engine/GitHubApprovalManager.js +315 -0
- package/dist/engine/GitHubApprovalManager.js.map +1 -0
- package/dist/engine/RateLimiter.d.ts +79 -0
- package/dist/engine/RateLimiter.d.ts.map +1 -0
- package/dist/engine/RateLimiter.js +232 -0
- package/dist/engine/RateLimiter.js.map +1 -0
- package/dist/engine/RulesEngine.d.ts +77 -0
- package/dist/engine/RulesEngine.d.ts.map +1 -0
- package/dist/engine/RulesEngine.js +400 -0
- package/dist/engine/RulesEngine.js.map +1 -0
- package/dist/engine/TaskManager.d.ts +173 -0
- package/dist/engine/TaskManager.d.ts.map +1 -0
- package/dist/engine/TaskManager.js +678 -0
- package/dist/engine/TaskManager.js.map +1 -0
- package/dist/engine/index.d.ts +9 -0
- package/dist/engine/index.d.ts.map +1 -0
- package/dist/engine/index.js +9 -0
- package/dist/engine/index.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/rules/architecture.d.ts +9 -0
- package/dist/rules/architecture.d.ts.map +1 -0
- package/dist/rules/architecture.js +322 -0
- package/dist/rules/architecture.js.map +1 -0
- package/dist/rules/azure.d.ts +7 -0
- package/dist/rules/azure.d.ts.map +1 -0
- package/dist/rules/azure.js +138 -0
- package/dist/rules/azure.js.map +1 -0
- package/dist/rules/compliance.d.ts +9 -0
- package/dist/rules/compliance.d.ts.map +1 -0
- package/dist/rules/compliance.js +304 -0
- package/dist/rules/compliance.js.map +1 -0
- package/dist/rules/css.d.ts +10 -0
- package/dist/rules/css.d.ts.map +1 -0
- package/dist/rules/css.js +1239 -0
- package/dist/rules/css.js.map +1 -0
- package/dist/rules/flask.d.ts +7 -0
- package/dist/rules/flask.d.ts.map +1 -0
- package/dist/rules/flask.js +155 -0
- package/dist/rules/flask.js.map +1 -0
- package/dist/rules/index.d.ts +607 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +401 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/rules/ml-ai.d.ts +7 -0
- package/dist/rules/ml-ai.d.ts.map +1 -0
- package/dist/rules/ml-ai.js +150 -0
- package/dist/rules/ml-ai.js.map +1 -0
- package/dist/rules/operational.d.ts +9 -0
- package/dist/rules/operational.d.ts.map +1 -0
- package/dist/rules/operational.js +318 -0
- package/dist/rules/operational.js.map +1 -0
- package/dist/rules/security.d.ts +9 -0
- package/dist/rules/security.d.ts.map +1 -0
- package/dist/rules/security.js +287 -0
- package/dist/rules/security.js.map +1 -0
- package/dist/rules/storage.d.ts +7 -0
- package/dist/rules/storage.d.ts.map +1 -0
- package/dist/rules/storage.js +134 -0
- package/dist/rules/storage.js.map +1 -0
- package/dist/rules/stripe.d.ts +7 -0
- package/dist/rules/stripe.d.ts.map +1 -0
- package/dist/rules/stripe.js +140 -0
- package/dist/rules/stripe.js.map +1 -0
- package/dist/rules/testing.d.ts +7 -0
- package/dist/rules/testing.d.ts.map +1 -0
- package/dist/rules/testing.js +135 -0
- package/dist/rules/testing.js.map +1 -0
- package/dist/rules/ux.d.ts +9 -0
- package/dist/rules/ux.d.ts.map +1 -0
- package/dist/rules/ux.js +280 -0
- package/dist/rules/ux.js.map +1 -0
- package/dist/rules/websocket.d.ts +7 -0
- package/dist/rules/websocket.d.ts.map +1 -0
- package/dist/rules/websocket.js +136 -0
- package/dist/rules/websocket.js.map +1 -0
- package/dist/server.d.ts +49 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +2330 -0
- package/dist/server.js.map +1 -0
- package/dist/supervisor/AgentSupervisor.d.ts +235 -0
- package/dist/supervisor/AgentSupervisor.d.ts.map +1 -0
- package/dist/supervisor/AgentSupervisor.js +596 -0
- package/dist/supervisor/AgentSupervisor.js.map +1 -0
- package/dist/supervisor/ManagedServerRegistry.d.ts +48 -0
- package/dist/supervisor/ManagedServerRegistry.d.ts.map +1 -0
- package/dist/supervisor/ManagedServerRegistry.js +145 -0
- package/dist/supervisor/ManagedServerRegistry.js.map +1 -0
- package/dist/supervisor/ProjectTracker.d.ts +188 -0
- package/dist/supervisor/ProjectTracker.d.ts.map +1 -0
- package/dist/supervisor/ProjectTracker.js +617 -0
- package/dist/supervisor/ProjectTracker.js.map +1 -0
- package/dist/supervisor/index.d.ts +6 -0
- package/dist/supervisor/index.d.ts.map +1 -0
- package/dist/supervisor/index.js +6 -0
- package/dist/supervisor/index.js.map +1 -0
- package/dist/types/index.d.ts +1176 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +391 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/errors.d.ts +86 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +171 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +5 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/shell.d.ts +22 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +29 -0
- package/dist/utils/shell.js.map +1 -0
- package/package.json +63 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 ManagerProtocol
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
# Enterprise Agent Supervisor
|
|
2
|
+
|
|
3
|
+
**A comprehensive governance framework for AI agents** - providing compliance, action limits, risk scoring, and audits through the Model Context Protocol (MCP).
|
|
4
|
+
|
|
5
|
+
Plug this into ANY agent and suddenly you have:
|
|
6
|
+
|
|
7
|
+
✔ Compliance enforcement
|
|
8
|
+
✔ Action limits & rate limiting
|
|
9
|
+
✔ Risk scoring
|
|
10
|
+
✔ Comprehensive audits
|
|
11
|
+
✔ Human-in-the-loop approval workflows
|
|
12
|
+
✔ UX/Architecture validation
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Why Agent Supervisor?
|
|
17
|
+
|
|
18
|
+
Companies **LOVE** governance add-ons. And all MCP ecosystems lack a good "decision gatekeeper."
|
|
19
|
+
|
|
20
|
+
AI agents are powerful, but without guardrails they can:
|
|
21
|
+
- Access sensitive data inappropriately
|
|
22
|
+
- Execute high-risk operations without approval
|
|
23
|
+
- Overwhelm external APIs
|
|
24
|
+
- Violate compliance requirements
|
|
25
|
+
- Make costly mistakes in production
|
|
26
|
+
|
|
27
|
+
**Agent Supervisor** provides the governance layer that enterprises need to deploy AI agents confidently.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Features
|
|
32
|
+
|
|
33
|
+
### 🛡️ Core Governance Tools
|
|
34
|
+
|
|
35
|
+
| Tool | Description |
|
|
36
|
+
|------|-------------|
|
|
37
|
+
| `evaluate_action` | Evaluate any agent action against governance rules |
|
|
38
|
+
| `apply_business_rules` | Apply business rules to operational context |
|
|
39
|
+
| `require_human_approval` | Request human-in-the-loop approval |
|
|
40
|
+
| `log_event` | Log audit events for compliance |
|
|
41
|
+
|
|
42
|
+
### 🎨 CSS Governance Tools
|
|
43
|
+
|
|
44
|
+
| Tool | Description |
|
|
45
|
+
|------|-------------|
|
|
46
|
+
| `css_eval` | Evaluate CSS before adding - finds duplicates, suggests externalization |
|
|
47
|
+
| `analyze_css_cleanup` | Analyze existing CSS for cleanup opportunities |
|
|
48
|
+
| `suggest_css_variables` | Identify values that should be CSS custom properties |
|
|
49
|
+
|
|
50
|
+
### 📋 Built-in Rule Sets
|
|
51
|
+
|
|
52
|
+
- **Security Rules** - SQL injection prevention, privilege escalation detection, authentication enforcement
|
|
53
|
+
- **Compliance Rules** - GDPR, HIPAA, PCI-DSS, SOX compliance
|
|
54
|
+
- **UX Rules** - Response length limits, accessibility checks, user experience validation
|
|
55
|
+
- **Architecture Rules** - API versioning, circuit breakers, observability requirements
|
|
56
|
+
- **Operational Rules** - Cost controls, deployment windows, incident escalation
|
|
57
|
+
- **CSS Rules** - Inline style detection, specificity warnings, variable recommendations
|
|
58
|
+
|
|
59
|
+
### 🎛️ Presets
|
|
60
|
+
|
|
61
|
+
| Preset | Description |
|
|
62
|
+
|--------|-------------|
|
|
63
|
+
| `minimal` | Basic security and logging only |
|
|
64
|
+
| `standard` | Balanced security and operations |
|
|
65
|
+
| `strict` | Full compliance and governance |
|
|
66
|
+
| `financial` | Optimized for financial services |
|
|
67
|
+
| `healthcare` | HIPAA-focused for healthcare |
|
|
68
|
+
| `frontend` | Frontend development with CSS governance |
|
|
69
|
+
| `development` | Relaxed rules for dev environment |
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Quick Start
|
|
74
|
+
|
|
75
|
+
### Installation
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npm install @trentapps/manager-protocol
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### MCP Configuration
|
|
82
|
+
|
|
83
|
+
Add to your Claude Desktop or MCP client configuration:
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"mcpServers": {
|
|
88
|
+
"agent-supervisor": {
|
|
89
|
+
"command": "npx",
|
|
90
|
+
"args": ["@trentapps/manager-protocol"]
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Programmatic Usage
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
import { AgentSupervisor } from '@trentapps/manager-protocol';
|
|
100
|
+
|
|
101
|
+
const supervisor = new AgentSupervisor({
|
|
102
|
+
config: {
|
|
103
|
+
environment: 'production',
|
|
104
|
+
strictMode: true,
|
|
105
|
+
requireApprovalAboveRisk: 80
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
await supervisor.initialize('standard');
|
|
110
|
+
|
|
111
|
+
// Evaluate an action
|
|
112
|
+
const result = await supervisor.evaluateAction({
|
|
113
|
+
name: 'delete_user_data',
|
|
114
|
+
category: 'data_modification',
|
|
115
|
+
parameters: { userId: '123', recordCount: 1000 }
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
if (!result.allowed) {
|
|
119
|
+
console.log('Action blocked:', result.violations);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (result.requiresHumanApproval) {
|
|
123
|
+
const approval = await supervisor.requireHumanApproval({
|
|
124
|
+
reason: result.approvalReason,
|
|
125
|
+
priority: 'high'
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## MCP Tools Reference
|
|
133
|
+
|
|
134
|
+
### evaluate_action
|
|
135
|
+
|
|
136
|
+
Evaluate an agent action against governance rules.
|
|
137
|
+
|
|
138
|
+
```json
|
|
139
|
+
{
|
|
140
|
+
"action": {
|
|
141
|
+
"name": "call_external_api",
|
|
142
|
+
"category": "external_api",
|
|
143
|
+
"parameters": {
|
|
144
|
+
"endpoint": "https://api.example.com",
|
|
145
|
+
"method": "POST"
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
"context": {
|
|
149
|
+
"environment": "production",
|
|
150
|
+
"userRole": "developer",
|
|
151
|
+
"dataClassification": "confidential"
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**Returns:**
|
|
157
|
+
```json
|
|
158
|
+
{
|
|
159
|
+
"status": "pending_approval",
|
|
160
|
+
"riskScore": 75,
|
|
161
|
+
"riskLevel": "high",
|
|
162
|
+
"allowed": true,
|
|
163
|
+
"requiresHumanApproval": true,
|
|
164
|
+
"violations": [],
|
|
165
|
+
"warnings": ["External API call to non-whitelisted host"],
|
|
166
|
+
"appliedRules": ["sec-030", "arch-010"]
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### apply_business_rules
|
|
171
|
+
|
|
172
|
+
Apply rules to understand constraints for a context.
|
|
173
|
+
|
|
174
|
+
```json
|
|
175
|
+
{
|
|
176
|
+
"context": {
|
|
177
|
+
"environment": "production",
|
|
178
|
+
"department": "engineering",
|
|
179
|
+
"dataClassification": "restricted",
|
|
180
|
+
"complianceFrameworks": ["gdpr", "hipaa"]
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### require_human_approval
|
|
186
|
+
|
|
187
|
+
Request human approval for high-risk actions.
|
|
188
|
+
|
|
189
|
+
```json
|
|
190
|
+
{
|
|
191
|
+
"reason": "Bulk delete of 10,000 customer records",
|
|
192
|
+
"priority": "urgent",
|
|
193
|
+
"riskScore": 85,
|
|
194
|
+
"details": "Agent requests permission to purge inactive accounts older than 2 years"
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### log_event
|
|
199
|
+
|
|
200
|
+
Log audit events for compliance.
|
|
201
|
+
|
|
202
|
+
```json
|
|
203
|
+
{
|
|
204
|
+
"action": "customer_data_exported",
|
|
205
|
+
"eventType": "action_executed",
|
|
206
|
+
"outcome": "success",
|
|
207
|
+
"metadata": {
|
|
208
|
+
"recordCount": 500,
|
|
209
|
+
"format": "csv",
|
|
210
|
+
"destination": "s3://exports/"
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### css_eval
|
|
216
|
+
|
|
217
|
+
Evaluate CSS before adding it. Checks for duplicates, recommends externalization, and more.
|
|
218
|
+
|
|
219
|
+
```json
|
|
220
|
+
{
|
|
221
|
+
"newRule": {
|
|
222
|
+
"selector": ".card-header",
|
|
223
|
+
"properties": {
|
|
224
|
+
"background-color": "#3b82f6",
|
|
225
|
+
"padding": "16px",
|
|
226
|
+
"border-radius": "8px"
|
|
227
|
+
},
|
|
228
|
+
"source": "inline"
|
|
229
|
+
},
|
|
230
|
+
"existingRules": [
|
|
231
|
+
{
|
|
232
|
+
"selector": ".header",
|
|
233
|
+
"properties": {
|
|
234
|
+
"background-color": "#3b82f6",
|
|
235
|
+
"padding": "16px"
|
|
236
|
+
},
|
|
237
|
+
"source": "external",
|
|
238
|
+
"file": "styles.css"
|
|
239
|
+
}
|
|
240
|
+
],
|
|
241
|
+
"context": {
|
|
242
|
+
"framework": "react",
|
|
243
|
+
"hasStyleSystem": true,
|
|
244
|
+
"styleSystemName": "tailwind"
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
**Returns:**
|
|
250
|
+
```json
|
|
251
|
+
{
|
|
252
|
+
"shouldExternalize": true,
|
|
253
|
+
"shouldMakeGlobal": false,
|
|
254
|
+
"duplicates": [{ "selector": ".header", "...": "..." }],
|
|
255
|
+
"suggestions": [
|
|
256
|
+
{
|
|
257
|
+
"type": "use_existing",
|
|
258
|
+
"severity": "warning",
|
|
259
|
+
"message": "Similar CSS properties (80% match) found in '.header'"
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"type": "externalize",
|
|
263
|
+
"severity": "warning",
|
|
264
|
+
"message": "Inline styles should be moved to external stylesheet"
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"type": "use_variable",
|
|
268
|
+
"severity": "info",
|
|
269
|
+
"message": "background-color: #3b82f6 should use a CSS variable"
|
|
270
|
+
}
|
|
271
|
+
],
|
|
272
|
+
"riskScore": 35,
|
|
273
|
+
"summary": "Should be moved to external stylesheet. 1 warning(s)."
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## Custom Rules
|
|
280
|
+
|
|
281
|
+
Create custom rules for your organization:
|
|
282
|
+
|
|
283
|
+
```typescript
|
|
284
|
+
supervisor.addRule({
|
|
285
|
+
id: 'my-rule-001',
|
|
286
|
+
name: 'Cost Limit Per Request',
|
|
287
|
+
type: 'financial',
|
|
288
|
+
priority: 900,
|
|
289
|
+
conditions: [
|
|
290
|
+
{ field: 'estimatedCost', operator: 'greater_than', value: 100 }
|
|
291
|
+
],
|
|
292
|
+
actions: [
|
|
293
|
+
{ type: 'require_approval', message: 'Request exceeds $100 cost threshold' }
|
|
294
|
+
],
|
|
295
|
+
riskWeight: 30,
|
|
296
|
+
tags: ['cost-control']
|
|
297
|
+
});
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### Condition Operators
|
|
301
|
+
|
|
302
|
+
| Operator | Description |
|
|
303
|
+
|----------|-------------|
|
|
304
|
+
| `equals` | Exact match |
|
|
305
|
+
| `not_equals` | Not equal |
|
|
306
|
+
| `contains` | String/array contains |
|
|
307
|
+
| `greater_than` | Numeric comparison |
|
|
308
|
+
| `less_than` | Numeric comparison |
|
|
309
|
+
| `in` | Value in array |
|
|
310
|
+
| `not_in` | Value not in array |
|
|
311
|
+
| `matches_regex` | Regex pattern match |
|
|
312
|
+
| `exists` | Field exists and is not null |
|
|
313
|
+
| `not_exists` | Field is null or undefined |
|
|
314
|
+
|
|
315
|
+
### Rule Actions
|
|
316
|
+
|
|
317
|
+
| Action | Description |
|
|
318
|
+
|--------|-------------|
|
|
319
|
+
| `allow` | Explicitly allow |
|
|
320
|
+
| `deny` | Block the action |
|
|
321
|
+
| `require_approval` | Request human approval |
|
|
322
|
+
| `warn` | Add warning but allow |
|
|
323
|
+
| `log` | Log the action |
|
|
324
|
+
| `rate_limit` | Apply rate limiting |
|
|
325
|
+
| `escalate` | Escalate for review |
|
|
326
|
+
| `notify` | Send notification |
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
## Rate Limiting
|
|
331
|
+
|
|
332
|
+
Configure rate limits to prevent abuse:
|
|
333
|
+
|
|
334
|
+
```typescript
|
|
335
|
+
supervisor.addRateLimit({
|
|
336
|
+
id: 'api-calls',
|
|
337
|
+
name: 'External API Rate Limit',
|
|
338
|
+
windowMs: 60000, // 1 minute window
|
|
339
|
+
maxRequests: 20, // Max 20 requests
|
|
340
|
+
scope: 'agent', // Per agent
|
|
341
|
+
actionCategories: ['external_api'],
|
|
342
|
+
burstLimit: 5 // Max 5 in burst
|
|
343
|
+
});
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
## Compliance Frameworks
|
|
349
|
+
|
|
350
|
+
Built-in support for:
|
|
351
|
+
|
|
352
|
+
- **GDPR** - Data subject rights, cross-border transfers, consent
|
|
353
|
+
- **HIPAA** - PHI access, minimum necessary, encryption
|
|
354
|
+
- **PCI-DSS** - Cardholder data, PAN masking, CVV prohibition
|
|
355
|
+
- **SOX** - Financial controls, segregation of duties
|
|
356
|
+
- **SOC 2** - Security, availability, confidentiality
|
|
357
|
+
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
## Architecture
|
|
361
|
+
|
|
362
|
+
```
|
|
363
|
+
┌──────────────────────────────────────────────────────────────┐
|
|
364
|
+
│ Agent Supervisor │
|
|
365
|
+
├──────────────────────────────────────────────────────────────┤
|
|
366
|
+
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
|
|
367
|
+
│ │ Rules │ │ Rate │ │ Approval │ │
|
|
368
|
+
│ │ Engine │ │ Limiter │ │ Manager │ │
|
|
369
|
+
│ └─────────────┘ └─────────────┘ └─────────────────────┘ │
|
|
370
|
+
│ ┌─────────────────────────────────────────────────────────┐│
|
|
371
|
+
│ │ Audit Logger ││
|
|
372
|
+
│ └─────────────────────────────────────────────────────────┘│
|
|
373
|
+
├──────────────────────────────────────────────────────────────┤
|
|
374
|
+
│ MCP Server │
|
|
375
|
+
│ evaluate_action | apply_business_rules | require_approval │
|
|
376
|
+
│ log_event | list_rules | add_rule | get_audit_events ... │
|
|
377
|
+
└──────────────────────────────────────────────────────────────┘
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
---
|
|
381
|
+
|
|
382
|
+
## Development
|
|
383
|
+
|
|
384
|
+
```bash
|
|
385
|
+
# Install dependencies
|
|
386
|
+
npm install
|
|
387
|
+
|
|
388
|
+
# Build
|
|
389
|
+
npm run build
|
|
390
|
+
|
|
391
|
+
# Run in development
|
|
392
|
+
npm run dev
|
|
393
|
+
|
|
394
|
+
# Run tests
|
|
395
|
+
npm test
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
---
|
|
399
|
+
|
|
400
|
+
## API Reference
|
|
401
|
+
|
|
402
|
+
### AgentSupervisor
|
|
403
|
+
|
|
404
|
+
The main class for agent governance.
|
|
405
|
+
|
|
406
|
+
```typescript
|
|
407
|
+
const supervisor = new AgentSupervisor(options);
|
|
408
|
+
|
|
409
|
+
// Core methods
|
|
410
|
+
await supervisor.evaluateAction(action, context);
|
|
411
|
+
await supervisor.applyBusinessRules(context);
|
|
412
|
+
await supervisor.requireHumanApproval(params);
|
|
413
|
+
await supervisor.logEvent(params);
|
|
414
|
+
|
|
415
|
+
// Rule management
|
|
416
|
+
supervisor.addRule(rule);
|
|
417
|
+
supervisor.removeRule(ruleId);
|
|
418
|
+
supervisor.getRules();
|
|
419
|
+
supervisor.loadPreset(preset);
|
|
420
|
+
|
|
421
|
+
// Approval management
|
|
422
|
+
await supervisor.approveRequest(requestId, approverId, comments);
|
|
423
|
+
await supervisor.denyRequest(requestId, denierId, reason);
|
|
424
|
+
supervisor.getPendingApprovals();
|
|
425
|
+
|
|
426
|
+
// Audit & reporting
|
|
427
|
+
supervisor.getAuditEvents(filter);
|
|
428
|
+
supervisor.getAuditStats(since);
|
|
429
|
+
supervisor.exportAuditLog(filter);
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
---
|
|
433
|
+
|
|
434
|
+
## License
|
|
435
|
+
|
|
436
|
+
MIT
|
|
437
|
+
|
|
438
|
+
---
|
|
439
|
+
|
|
440
|
+
## Contributing
|
|
441
|
+
|
|
442
|
+
Contributions welcome! Please read our contributing guidelines and submit PRs.
|
|
443
|
+
|
|
444
|
+
---
|
|
445
|
+
|
|
446
|
+
**Built for enterprise AI governance.** 🏢🤖🛡️
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Architecture Change Detector
|
|
3
|
+
*
|
|
4
|
+
* Detects when agent actions represent architectural changes that should
|
|
5
|
+
* be documented in the project's CLAUDE.md file.
|
|
6
|
+
*/
|
|
7
|
+
import type { AgentAction, BusinessContext } from '../types/index.js';
|
|
8
|
+
export interface ClaudeMdUpdate {
|
|
9
|
+
needed: boolean;
|
|
10
|
+
reason: string;
|
|
11
|
+
suggestedContent: string;
|
|
12
|
+
section: string;
|
|
13
|
+
}
|
|
14
|
+
export declare class ArchitectureDetector {
|
|
15
|
+
/**
|
|
16
|
+
* Detect if an action represents an architectural change
|
|
17
|
+
*/
|
|
18
|
+
static detectChanges(action: AgentAction, _context?: BusinessContext): ClaudeMdUpdate | null;
|
|
19
|
+
/**
|
|
20
|
+
* Check if action is file-related
|
|
21
|
+
*/
|
|
22
|
+
private static isFileAction;
|
|
23
|
+
/**
|
|
24
|
+
* Extract file path from action parameters
|
|
25
|
+
*/
|
|
26
|
+
private static extractFilePath;
|
|
27
|
+
/**
|
|
28
|
+
* Check if file should be skipped (not architectural)
|
|
29
|
+
*/
|
|
30
|
+
private static shouldSkipFile;
|
|
31
|
+
/**
|
|
32
|
+
* Detect the type of component being added/modified
|
|
33
|
+
*/
|
|
34
|
+
private static detectComponentType;
|
|
35
|
+
/**
|
|
36
|
+
* Generate documentation suggestion
|
|
37
|
+
*/
|
|
38
|
+
private static generateDocumentation;
|
|
39
|
+
/**
|
|
40
|
+
* Format component name for documentation
|
|
41
|
+
*/
|
|
42
|
+
private static formatComponentName;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=ArchitectureDetector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArchitectureDetector.d.ts","sourceRoot":"","sources":["../../src/analyzers/ArchitectureDetector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGtE,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,oBAAoB;IAC/B;;OAEG;IACH,MAAM,CAAC,aAAa,CAClB,MAAM,EAAE,WAAW,EACnB,QAAQ,CAAC,EAAE,eAAe,GACzB,cAAc,GAAG,IAAI;IA0BxB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,YAAY;IAe3B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAc9B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;IAwB7B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAuDlC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAsEpC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;CAUnC"}
|