@trentapps/manager-protocol 1.3.0
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 +639 -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 +284 -0
- package/dist/analyzers/CSSAnalyzer.d.ts.map +1 -0
- package/dist/analyzers/CSSAnalyzer.js +1180 -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/AuditLogger.d.ts +506 -0
- package/dist/engine/AuditLogger.d.ts.map +1 -0
- package/dist/engine/AuditLogger.js +1491 -0
- package/dist/engine/AuditLogger.js.map +1 -0
- package/dist/engine/GitHubApprovalManager.d.ts +123 -0
- package/dist/engine/GitHubApprovalManager.d.ts.map +1 -0
- package/dist/engine/GitHubApprovalManager.js +347 -0
- package/dist/engine/GitHubApprovalManager.js.map +1 -0
- package/dist/engine/GitHubClient.d.ts +183 -0
- package/dist/engine/GitHubClient.d.ts.map +1 -0
- package/dist/engine/GitHubClient.js +411 -0
- package/dist/engine/GitHubClient.js.map +1 -0
- package/dist/engine/RateLimiter.d.ts +81 -0
- package/dist/engine/RateLimiter.d.ts.map +1 -0
- package/dist/engine/RateLimiter.js +215 -0
- package/dist/engine/RateLimiter.js.map +1 -0
- package/dist/engine/RuleDependencyAnalyzer.d.ts +73 -0
- package/dist/engine/RuleDependencyAnalyzer.d.ts.map +1 -0
- package/dist/engine/RuleDependencyAnalyzer.js +475 -0
- package/dist/engine/RuleDependencyAnalyzer.js.map +1 -0
- package/dist/engine/RulesEngine.d.ts +176 -0
- package/dist/engine/RulesEngine.d.ts.map +1 -0
- package/dist/engine/RulesEngine.js +705 -0
- package/dist/engine/RulesEngine.js.map +1 -0
- package/dist/engine/TaskManager.d.ts +174 -0
- package/dist/engine/TaskManager.d.ts.map +1 -0
- package/dist/engine/TaskManager.js +663 -0
- package/dist/engine/TaskManager.js.map +1 -0
- package/dist/engine/index.d.ts +11 -0
- package/dist/engine/index.d.ts.map +1 -0
- package/dist/engine/index.js +13 -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 +136 -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 +286 -0
- package/dist/rules/compliance.js.map +1 -0
- package/dist/rules/condition-optimizer.d.ts +151 -0
- package/dist/rules/condition-optimizer.d.ts.map +1 -0
- package/dist/rules/condition-optimizer.js +479 -0
- package/dist/rules/condition-optimizer.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 +1777 -0
- package/dist/rules/css.js.map +1 -0
- package/dist/rules/field-standards.d.ts +1172 -0
- package/dist/rules/field-standards.d.ts.map +1 -0
- package/dist/rules/field-standards.js +908 -0
- package/dist/rules/field-standards.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 +142 -0
- package/dist/rules/flask.js.map +1 -0
- package/dist/rules/index.d.ts +827 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +556 -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 +148 -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/patterns.d.ts +568 -0
- package/dist/rules/patterns.d.ts.map +1 -0
- package/dist/rules/patterns.js +1359 -0
- package/dist/rules/patterns.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 +848 -0
- package/dist/rules/security.js.map +1 -0
- package/dist/rules/shared-patterns.d.ts +268 -0
- package/dist/rules/shared-patterns.d.ts.map +1 -0
- package/dist/rules/shared-patterns.js +556 -0
- package/dist/rules/shared-patterns.js.map +1 -0
- package/dist/rules/storage.d.ts +13 -0
- package/dist/rules/storage.d.ts.map +1 -0
- package/dist/rules/storage.js +672 -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 +133 -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 +128 -0
- package/dist/rules/websocket.js.map +1 -0
- package/dist/server.d.ts +43 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +1967 -0
- package/dist/server.js.map +1 -0
- package/dist/supervisor/AgentSupervisor.d.ts +195 -0
- package/dist/supervisor/AgentSupervisor.d.ts.map +1 -0
- package/dist/supervisor/AgentSupervisor.js +569 -0
- package/dist/supervisor/AgentSupervisor.js.map +1 -0
- package/dist/supervisor/ManagedServerRegistry.d.ts +185 -0
- package/dist/supervisor/ManagedServerRegistry.d.ts.map +1 -0
- package/dist/supervisor/ManagedServerRegistry.js +729 -0
- package/dist/supervisor/ManagedServerRegistry.js.map +1 -0
- package/dist/supervisor/ProjectTracker.d.ts +210 -0
- package/dist/supervisor/ProjectTracker.d.ts.map +1 -0
- package/dist/supervisor/ProjectTracker.js +709 -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/testing/index.d.ts +11 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +12 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/rule-tester.d.ts +217 -0
- package/dist/testing/rule-tester.d.ts.map +1 -0
- package/dist/testing/rule-tester.examples.d.ts +57 -0
- package/dist/testing/rule-tester.examples.d.ts.map +1 -0
- package/dist/testing/rule-tester.examples.js +375 -0
- package/dist/testing/rule-tester.examples.js.map +1 -0
- package/dist/testing/rule-tester.js +381 -0
- package/dist/testing/rule-tester.js.map +1 -0
- package/dist/testing/rule-validator.d.ts +141 -0
- package/dist/testing/rule-validator.d.ts.map +1 -0
- package/dist/testing/rule-validator.js +640 -0
- package/dist/testing/rule-validator.js.map +1 -0
- package/dist/types/index.d.ts +1282 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +386 -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 +7 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +7 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/rate-limiting.d.ts +268 -0
- package/dist/utils/rate-limiting.d.ts.map +1 -0
- package/dist/utils/rate-limiting.js +403 -0
- package/dist/utils/rate-limiting.js.map +1 -0
- package/dist/utils/shared.d.ts +306 -0
- package/dist/utils/shared.d.ts.map +1 -0
- package/dist/utils/shared.js +464 -0
- package/dist/utils/shared.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 +67 -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,639 @@
|
|
|
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
|
+
### Claude Code
|
|
82
|
+
|
|
83
|
+
The fastest way to get started with Claude Code:
|
|
84
|
+
|
|
85
|
+
**Option 1: Using the CLI (Recommended)**
|
|
86
|
+
```bash
|
|
87
|
+
claude mcp add agent-supervisor -- npx @trentapps/manager-protocol
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Option 2: Manual Configuration**
|
|
91
|
+
|
|
92
|
+
Add to your MCP settings file (`~/.claude/settings.json` or `.mcp.json` in your project):
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"mcpServers": {
|
|
97
|
+
"agent-supervisor": {
|
|
98
|
+
"command": "npx",
|
|
99
|
+
"args": ["@trentapps/manager-protocol"]
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Other MCP Clients
|
|
106
|
+
|
|
107
|
+
For Claude Desktop or other MCP clients, add to your configuration file:
|
|
108
|
+
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"mcpServers": {
|
|
112
|
+
"agent-supervisor": {
|
|
113
|
+
"command": "npx",
|
|
114
|
+
"args": ["@trentapps/manager-protocol"]
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Programmatic Usage
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
import { AgentSupervisor } from '@trentapps/manager-protocol';
|
|
124
|
+
|
|
125
|
+
const supervisor = new AgentSupervisor({
|
|
126
|
+
config: {
|
|
127
|
+
environment: 'production',
|
|
128
|
+
strictMode: true,
|
|
129
|
+
requireApprovalAboveRisk: 80
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
await supervisor.initialize('standard');
|
|
134
|
+
|
|
135
|
+
// Evaluate an action
|
|
136
|
+
const result = await supervisor.evaluateAction({
|
|
137
|
+
name: 'delete_user_data',
|
|
138
|
+
category: 'data_modification',
|
|
139
|
+
parameters: { userId: '123', recordCount: 1000 }
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
if (!result.allowed) {
|
|
143
|
+
console.log('Action blocked:', result.violations);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (result.requiresHumanApproval) {
|
|
147
|
+
const approval = await supervisor.requireHumanApproval({
|
|
148
|
+
reason: result.approvalReason,
|
|
149
|
+
priority: 'high'
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## MCP Tools Reference
|
|
157
|
+
|
|
158
|
+
### evaluate_action
|
|
159
|
+
|
|
160
|
+
Evaluate an agent action against governance rules.
|
|
161
|
+
|
|
162
|
+
```json
|
|
163
|
+
{
|
|
164
|
+
"action": {
|
|
165
|
+
"name": "call_external_api",
|
|
166
|
+
"category": "external_api",
|
|
167
|
+
"parameters": {
|
|
168
|
+
"endpoint": "https://api.example.com",
|
|
169
|
+
"method": "POST"
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
"context": {
|
|
173
|
+
"environment": "production",
|
|
174
|
+
"userRole": "developer",
|
|
175
|
+
"dataClassification": "confidential"
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Returns:**
|
|
181
|
+
```json
|
|
182
|
+
{
|
|
183
|
+
"status": "pending_approval",
|
|
184
|
+
"riskScore": 75,
|
|
185
|
+
"riskLevel": "high",
|
|
186
|
+
"allowed": true,
|
|
187
|
+
"requiresHumanApproval": true,
|
|
188
|
+
"violations": [],
|
|
189
|
+
"warnings": ["External API call to non-whitelisted host"],
|
|
190
|
+
"appliedRules": ["sec-030", "arch-010"]
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### apply_business_rules
|
|
195
|
+
|
|
196
|
+
Apply rules to understand constraints for a context.
|
|
197
|
+
|
|
198
|
+
```json
|
|
199
|
+
{
|
|
200
|
+
"context": {
|
|
201
|
+
"environment": "production",
|
|
202
|
+
"department": "engineering",
|
|
203
|
+
"dataClassification": "restricted",
|
|
204
|
+
"complianceFrameworks": ["gdpr", "hipaa"]
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### require_human_approval
|
|
210
|
+
|
|
211
|
+
Request human approval for high-risk actions.
|
|
212
|
+
|
|
213
|
+
```json
|
|
214
|
+
{
|
|
215
|
+
"reason": "Bulk delete of 10,000 customer records",
|
|
216
|
+
"priority": "urgent",
|
|
217
|
+
"riskScore": 85,
|
|
218
|
+
"details": "Agent requests permission to purge inactive accounts older than 2 years"
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### log_event
|
|
223
|
+
|
|
224
|
+
Log audit events for compliance.
|
|
225
|
+
|
|
226
|
+
```json
|
|
227
|
+
{
|
|
228
|
+
"action": "customer_data_exported",
|
|
229
|
+
"eventType": "action_executed",
|
|
230
|
+
"outcome": "success",
|
|
231
|
+
"metadata": {
|
|
232
|
+
"recordCount": 500,
|
|
233
|
+
"format": "csv",
|
|
234
|
+
"destination": "s3://exports/"
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### css_eval
|
|
240
|
+
|
|
241
|
+
Evaluate CSS before adding it. Checks for duplicates, recommends externalization, and more.
|
|
242
|
+
|
|
243
|
+
```json
|
|
244
|
+
{
|
|
245
|
+
"newRule": {
|
|
246
|
+
"selector": ".card-header",
|
|
247
|
+
"properties": {
|
|
248
|
+
"background-color": "#3b82f6",
|
|
249
|
+
"padding": "16px",
|
|
250
|
+
"border-radius": "8px"
|
|
251
|
+
},
|
|
252
|
+
"source": "inline"
|
|
253
|
+
},
|
|
254
|
+
"existingRules": [
|
|
255
|
+
{
|
|
256
|
+
"selector": ".header",
|
|
257
|
+
"properties": {
|
|
258
|
+
"background-color": "#3b82f6",
|
|
259
|
+
"padding": "16px"
|
|
260
|
+
},
|
|
261
|
+
"source": "external",
|
|
262
|
+
"file": "styles.css"
|
|
263
|
+
}
|
|
264
|
+
],
|
|
265
|
+
"context": {
|
|
266
|
+
"framework": "react",
|
|
267
|
+
"hasStyleSystem": true,
|
|
268
|
+
"styleSystemName": "tailwind"
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
**Returns:**
|
|
274
|
+
```json
|
|
275
|
+
{
|
|
276
|
+
"shouldExternalize": true,
|
|
277
|
+
"shouldMakeGlobal": false,
|
|
278
|
+
"duplicates": [{ "selector": ".header", "...": "..." }],
|
|
279
|
+
"suggestions": [
|
|
280
|
+
{
|
|
281
|
+
"type": "use_existing",
|
|
282
|
+
"severity": "warning",
|
|
283
|
+
"message": "Similar CSS properties (80% match) found in '.header'"
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"type": "externalize",
|
|
287
|
+
"severity": "warning",
|
|
288
|
+
"message": "Inline styles should be moved to external stylesheet"
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"type": "use_variable",
|
|
292
|
+
"severity": "info",
|
|
293
|
+
"message": "background-color: #3b82f6 should use a CSS variable"
|
|
294
|
+
}
|
|
295
|
+
],
|
|
296
|
+
"riskScore": 35,
|
|
297
|
+
"summary": "Should be moved to external stylesheet. 1 warning(s)."
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### Task Management Tools
|
|
302
|
+
|
|
303
|
+
The supervisor includes full GitHub-integrated task management:
|
|
304
|
+
|
|
305
|
+
| Tool | Description |
|
|
306
|
+
|------|-------------|
|
|
307
|
+
| `create_task` | Create a new task (GitHub Issue) |
|
|
308
|
+
| `get_tasks` | List tasks with filtering |
|
|
309
|
+
| `get_pending_tasks` | Get tasks needing approval |
|
|
310
|
+
| `get_approved_tasks` | Get tasks ready to work on |
|
|
311
|
+
| `update_task` | Update task metadata |
|
|
312
|
+
| `close_task_with_comment` | Close with resolution |
|
|
313
|
+
| `add_task_comment` | Add comment to task |
|
|
314
|
+
| `link_commits` | Link commits to tasks |
|
|
315
|
+
|
|
316
|
+
### App Monitoring Tools
|
|
317
|
+
|
|
318
|
+
Monitor production applications for health and uptime:
|
|
319
|
+
|
|
320
|
+
| Tool | Description |
|
|
321
|
+
|------|-------------|
|
|
322
|
+
| `add_monitored_app` | Register app for monitoring |
|
|
323
|
+
| `check_app_health` | Immediate health check |
|
|
324
|
+
| `check_all_apps_health` | Health check all apps |
|
|
325
|
+
| `get_app_status` | Get detailed app status |
|
|
326
|
+
| `list_monitored_apps` | List all monitored apps |
|
|
327
|
+
| `get_offline_apps` | List currently offline apps |
|
|
328
|
+
|
|
329
|
+
### Session Management Tools
|
|
330
|
+
|
|
331
|
+
Track agent sessions for audit and observability:
|
|
332
|
+
|
|
333
|
+
| Tool | Description |
|
|
334
|
+
|------|-------------|
|
|
335
|
+
| `register_session` | Register a Claude session |
|
|
336
|
+
| `complete_session` | Mark session complete |
|
|
337
|
+
| `health_check` | Check supervisor health |
|
|
338
|
+
|
|
339
|
+
### Rules Management Tools
|
|
340
|
+
|
|
341
|
+
| Tool | Description |
|
|
342
|
+
|------|-------------|
|
|
343
|
+
| `list_rules` | List configured rules (use filters!) |
|
|
344
|
+
| `add_rule` | Add custom rule |
|
|
345
|
+
| `remove_rule` | Remove rule |
|
|
346
|
+
| `load_preset` | Load rule preset |
|
|
347
|
+
| `discover_relevant_rules` | Auto-detect project tech stack |
|
|
348
|
+
| `list_project_profiles` | List available profiles |
|
|
349
|
+
|
|
350
|
+
### Approval Workflow Tools
|
|
351
|
+
|
|
352
|
+
| Tool | Description |
|
|
353
|
+
|------|-------------|
|
|
354
|
+
| `list_pending_approvals` | List pending approvals |
|
|
355
|
+
| `approve_request` | Approve a request |
|
|
356
|
+
| `deny_request` | Deny a request |
|
|
357
|
+
| `check_approval_status` | Check approval status |
|
|
358
|
+
|
|
359
|
+
### Audit Tools
|
|
360
|
+
|
|
361
|
+
| Tool | Description |
|
|
362
|
+
|------|-------------|
|
|
363
|
+
| `get_audit_events` | Query audit log |
|
|
364
|
+
| `get_audit_stats` | Get statistics |
|
|
365
|
+
| `export_audit_log` | Export as JSON |
|
|
366
|
+
| `get_approval_stats` | Approval workflow stats |
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
## Custom Rules
|
|
371
|
+
|
|
372
|
+
Create custom rules for your organization:
|
|
373
|
+
|
|
374
|
+
```typescript
|
|
375
|
+
supervisor.addRule({
|
|
376
|
+
id: 'my-rule-001',
|
|
377
|
+
name: 'Cost Limit Per Request',
|
|
378
|
+
type: 'financial',
|
|
379
|
+
priority: 900,
|
|
380
|
+
conditions: [
|
|
381
|
+
{ field: 'estimatedCost', operator: 'greater_than', value: 100 }
|
|
382
|
+
],
|
|
383
|
+
actions: [
|
|
384
|
+
{ type: 'require_approval', message: 'Request exceeds $100 cost threshold' }
|
|
385
|
+
],
|
|
386
|
+
riskWeight: 30,
|
|
387
|
+
tags: ['cost-control']
|
|
388
|
+
});
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
### Condition Operators
|
|
392
|
+
|
|
393
|
+
| Operator | Description |
|
|
394
|
+
|----------|-------------|
|
|
395
|
+
| `equals` | Exact match |
|
|
396
|
+
| `not_equals` | Not equal |
|
|
397
|
+
| `contains` | String/array contains |
|
|
398
|
+
| `greater_than` | Numeric comparison |
|
|
399
|
+
| `less_than` | Numeric comparison |
|
|
400
|
+
| `in` | Value in array |
|
|
401
|
+
| `not_in` | Value not in array |
|
|
402
|
+
| `matches_regex` | Regex pattern match |
|
|
403
|
+
| `exists` | Field exists and is not null |
|
|
404
|
+
| `not_exists` | Field is null or undefined |
|
|
405
|
+
|
|
406
|
+
### Rule Actions
|
|
407
|
+
|
|
408
|
+
| Action | Description |
|
|
409
|
+
|--------|-------------|
|
|
410
|
+
| `allow` | Explicitly allow |
|
|
411
|
+
| `deny` | Block the action |
|
|
412
|
+
| `require_approval` | Request human approval |
|
|
413
|
+
| `warn` | Add warning but allow |
|
|
414
|
+
| `log` | Log the action |
|
|
415
|
+
| `rate_limit` | Apply rate limiting |
|
|
416
|
+
| `escalate` | Escalate for review |
|
|
417
|
+
| `notify` | Send notification |
|
|
418
|
+
|
|
419
|
+
---
|
|
420
|
+
|
|
421
|
+
## Rate Limiting
|
|
422
|
+
|
|
423
|
+
Configure rate limits to prevent abuse:
|
|
424
|
+
|
|
425
|
+
```typescript
|
|
426
|
+
supervisor.addRateLimit({
|
|
427
|
+
id: 'api-calls',
|
|
428
|
+
name: 'External API Rate Limit',
|
|
429
|
+
windowMs: 60000, // 1 minute window
|
|
430
|
+
maxRequests: 20, // Max 20 requests
|
|
431
|
+
scope: 'agent', // Per agent
|
|
432
|
+
actionCategories: ['external_api'],
|
|
433
|
+
burstLimit: 5 // Max 5 in burst
|
|
434
|
+
});
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
---
|
|
438
|
+
|
|
439
|
+
## Compliance Frameworks
|
|
440
|
+
|
|
441
|
+
Built-in support for:
|
|
442
|
+
|
|
443
|
+
- **GDPR** - Data subject rights, cross-border transfers, consent
|
|
444
|
+
- **HIPAA** - PHI access, minimum necessary, encryption
|
|
445
|
+
- **PCI-DSS** - Cardholder data, PAN masking, CVV prohibition
|
|
446
|
+
- **SOX** - Financial controls, segregation of duties
|
|
447
|
+
- **SOC 2** - Security, availability, confidentiality
|
|
448
|
+
|
|
449
|
+
---
|
|
450
|
+
|
|
451
|
+
## Configuration
|
|
452
|
+
|
|
453
|
+
### Environment Variables
|
|
454
|
+
|
|
455
|
+
| Variable | Description | Default |
|
|
456
|
+
|----------|-------------|---------|
|
|
457
|
+
| `GITHUB_TOKEN` | GitHub personal access token for task management and approvals | Required for GitHub features |
|
|
458
|
+
| `DASHBOARD_PORT` | HTTP dashboard port | `3100` |
|
|
459
|
+
| `AUDIT_DB_PATH` | Path to SQLite audit database | `./data/audit.db` |
|
|
460
|
+
| `NODE_ENV` | Environment (development/production) | `development` |
|
|
461
|
+
| `DEBUG` | Enable debug logging | `false` |
|
|
462
|
+
|
|
463
|
+
### Node.js Requirements
|
|
464
|
+
|
|
465
|
+
- Node.js 18.0.0 or higher required
|
|
466
|
+
|
|
467
|
+
---
|
|
468
|
+
|
|
469
|
+
## Security & Deployment
|
|
470
|
+
|
|
471
|
+
### Local Usage (Default)
|
|
472
|
+
|
|
473
|
+
The Agent Supervisor MCP server is designed to run **locally** alongside your AI agent. When configured as an MCP server in Claude Desktop or other MCP clients, it communicates via stdio (standard input/output), not HTTP.
|
|
474
|
+
|
|
475
|
+
**Key points:**
|
|
476
|
+
- **No CORS required** - The MCP protocol uses stdio for communication, not HTTP requests
|
|
477
|
+
- **No network exposure** - The server doesn't listen on any network ports by default
|
|
478
|
+
- **Process isolation** - Runs as a child process of the MCP client
|
|
479
|
+
|
|
480
|
+
### Dashboard (Optional)
|
|
481
|
+
|
|
482
|
+
The optional HTTP dashboard (for monitoring and approvals) runs on `localhost:3100` by default:
|
|
483
|
+
- Only accessible from the local machine
|
|
484
|
+
- Not exposed to the network
|
|
485
|
+
- For remote access, use SSH tunneling or a reverse proxy with authentication
|
|
486
|
+
|
|
487
|
+
### Production Considerations
|
|
488
|
+
|
|
489
|
+
If deploying in a production environment with network access:
|
|
490
|
+
1. **Add authentication** - Implement your own auth layer (OAuth, API keys, etc.)
|
|
491
|
+
2. **Use a reverse proxy** - Put nginx/Caddy in front with TLS and auth
|
|
492
|
+
3. **Network isolation** - Run in a private network or VPC
|
|
493
|
+
4. **Audit logging** - Enable comprehensive audit logging (built-in)
|
|
494
|
+
|
|
495
|
+
---
|
|
496
|
+
|
|
497
|
+
## Considerations & Limitations
|
|
498
|
+
|
|
499
|
+
Before deploying the Agent Supervisor, understand these important points:
|
|
500
|
+
|
|
501
|
+
### Advisory, Not Enforcement
|
|
502
|
+
|
|
503
|
+
The supervisor evaluates actions and provides recommendations based on configured rules. **It does not enforce** - the calling agent or application must respect the supervisor's decisions. A misconfigured or malicious agent could ignore governance responses entirely.
|
|
504
|
+
|
|
505
|
+
### Rule Quality Matters
|
|
506
|
+
|
|
507
|
+
The supervisor is only as good as its rules:
|
|
508
|
+
- **Overly permissive rules** may allow risky actions to proceed
|
|
509
|
+
- **Overly strict rules** may block legitimate operations
|
|
510
|
+
- **Missing rules** won't catch edge cases specific to your domain
|
|
511
|
+
|
|
512
|
+
Test your rule configurations thoroughly before production use. Start with a preset (`standard` or `strict`) and customize from there.
|
|
513
|
+
|
|
514
|
+
### Token Security
|
|
515
|
+
|
|
516
|
+
If using GitHub integration for tasks and approvals:
|
|
517
|
+
- The `GITHUB_TOKEN` requires repository access (`repo` scope)
|
|
518
|
+
- Protect this token as you would any credential
|
|
519
|
+
- Use fine-grained personal access tokens where possible
|
|
520
|
+
- Consider separate tokens for different environments
|
|
521
|
+
|
|
522
|
+
### Audit Data Sensitivity
|
|
523
|
+
|
|
524
|
+
Audit logs may contain:
|
|
525
|
+
- Action parameters (potentially sensitive data)
|
|
526
|
+
- User and agent identifiers
|
|
527
|
+
- Timestamps and patterns of activity
|
|
528
|
+
|
|
529
|
+
Secure the audit database (`AUDIT_DB_PATH`) appropriately and implement retention policies for your compliance requirements.
|
|
530
|
+
|
|
531
|
+
### Not a Security Substitute
|
|
532
|
+
|
|
533
|
+
This tool complements but does not replace:
|
|
534
|
+
- Proper authentication and authorization systems
|
|
535
|
+
- Network security and firewalls
|
|
536
|
+
- Input validation and sanitization
|
|
537
|
+
- Security code reviews and penetration testing
|
|
538
|
+
|
|
539
|
+
Use at your own discretion. The MIT License provides this software "as is" without warranty.
|
|
540
|
+
|
|
541
|
+
---
|
|
542
|
+
|
|
543
|
+
## Architecture
|
|
544
|
+
|
|
545
|
+
```
|
|
546
|
+
┌──────────────────────────────────────────────────────────────────┐
|
|
547
|
+
│ Agent Supervisor │
|
|
548
|
+
├──────────────────────────────────────────────────────────────────┤
|
|
549
|
+
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────────┐ │
|
|
550
|
+
│ │ Rules │ │ Rate │ │ GitHub Approval │ │
|
|
551
|
+
│ │ Engine │ │ Limiter │ │ Manager │ │
|
|
552
|
+
│ └─────────────┘ └─────────────┘ └─────────────────────────┘ │
|
|
553
|
+
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────────┐ │
|
|
554
|
+
│ │ Task │ │ App │ │ CSS │ │
|
|
555
|
+
│ │ Manager │ │ Monitor │ │ Analyzer │ │
|
|
556
|
+
│ └─────────────┘ └─────────────┘ └─────────────────────────┘ │
|
|
557
|
+
│ ┌───────────────────────────────────────────────────────────┐ │
|
|
558
|
+
│ │ Audit Logger (SQLite) │ │
|
|
559
|
+
│ └───────────────────────────────────────────────────────────┘ │
|
|
560
|
+
├──────────────────────────────────────────────────────────────────┤
|
|
561
|
+
│ MCP Server (stdio) │
|
|
562
|
+
│ evaluate_action | create_task | check_app_health | css_eval │
|
|
563
|
+
│ log_event | register_session | list_rules | require_approval │
|
|
564
|
+
└──────────────────────────────────────────────────────────────────┘
|
|
565
|
+
│ │
|
|
566
|
+
▼ ▼
|
|
567
|
+
┌─────────────────────┐ ┌─────────────────────┐
|
|
568
|
+
│ GitHub Issues │ │ HTTP Dashboard │
|
|
569
|
+
│ (Task Storage) │ │ (localhost:3100) │
|
|
570
|
+
└─────────────────────┘ └─────────────────────┘
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
---
|
|
574
|
+
|
|
575
|
+
## Development
|
|
576
|
+
|
|
577
|
+
```bash
|
|
578
|
+
# Install dependencies
|
|
579
|
+
npm install
|
|
580
|
+
|
|
581
|
+
# Build
|
|
582
|
+
npm run build
|
|
583
|
+
|
|
584
|
+
# Run in development
|
|
585
|
+
npm run dev
|
|
586
|
+
|
|
587
|
+
# Run tests
|
|
588
|
+
npm test
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
---
|
|
592
|
+
|
|
593
|
+
## API Reference
|
|
594
|
+
|
|
595
|
+
### AgentSupervisor
|
|
596
|
+
|
|
597
|
+
The main class for agent governance.
|
|
598
|
+
|
|
599
|
+
```typescript
|
|
600
|
+
const supervisor = new AgentSupervisor(options);
|
|
601
|
+
|
|
602
|
+
// Core methods
|
|
603
|
+
await supervisor.evaluateAction(action, context);
|
|
604
|
+
await supervisor.applyBusinessRules(context);
|
|
605
|
+
await supervisor.requireHumanApproval(params);
|
|
606
|
+
await supervisor.logEvent(params);
|
|
607
|
+
|
|
608
|
+
// Rule management
|
|
609
|
+
supervisor.addRule(rule);
|
|
610
|
+
supervisor.removeRule(ruleId);
|
|
611
|
+
supervisor.getRules();
|
|
612
|
+
supervisor.loadPreset(preset);
|
|
613
|
+
|
|
614
|
+
// Approval management
|
|
615
|
+
await supervisor.approveRequest(requestId, approverId, comments);
|
|
616
|
+
await supervisor.denyRequest(requestId, denierId, reason);
|
|
617
|
+
supervisor.getPendingApprovals();
|
|
618
|
+
|
|
619
|
+
// Audit & reporting
|
|
620
|
+
supervisor.getAuditEvents(filter);
|
|
621
|
+
supervisor.getAuditStats(since);
|
|
622
|
+
supervisor.exportAuditLog(filter);
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
---
|
|
626
|
+
|
|
627
|
+
## License
|
|
628
|
+
|
|
629
|
+
MIT
|
|
630
|
+
|
|
631
|
+
---
|
|
632
|
+
|
|
633
|
+
## Contributing
|
|
634
|
+
|
|
635
|
+
Contributions are welcome! Please read our contributing guidelines and submit PRs.
|
|
636
|
+
|
|
637
|
+
---
|
|
638
|
+
|
|
639
|
+
**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"}
|