averecion-lite 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.
Files changed (50) hide show
  1. package/README.md +161 -0
  2. package/dashboard/dash.css +1085 -0
  3. package/dashboard/dash.js +898 -0
  4. package/dashboard/index.html +312 -0
  5. package/dashboard/landing.html +360 -0
  6. package/dist/cli.d.ts +3 -0
  7. package/dist/cli.d.ts.map +1 -0
  8. package/dist/cli.js +409 -0
  9. package/dist/hooks.d.ts +25 -0
  10. package/dist/hooks.d.ts.map +1 -0
  11. package/dist/hooks.js +68 -0
  12. package/dist/index.d.ts +34 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +64 -0
  15. package/dist/injectionGuard.d.ts +9 -0
  16. package/dist/injectionGuard.d.ts.map +1 -0
  17. package/dist/injectionGuard.js +16 -0
  18. package/dist/log-watcher.d.ts +26 -0
  19. package/dist/log-watcher.d.ts.map +1 -0
  20. package/dist/log-watcher.js +397 -0
  21. package/dist/metrics.d.ts +53 -0
  22. package/dist/metrics.d.ts.map +1 -0
  23. package/dist/metrics.js +58 -0
  24. package/dist/policy.d.ts +11 -0
  25. package/dist/policy.d.ts.map +1 -0
  26. package/dist/policy.js +60 -0
  27. package/dist/server.d.ts +3 -0
  28. package/dist/server.d.ts.map +1 -0
  29. package/dist/server.js +226 -0
  30. package/dist/src/capability-manifest.d.ts +16 -0
  31. package/dist/src/capability-manifest.d.ts.map +1 -0
  32. package/dist/src/capability-manifest.js +228 -0
  33. package/dist/src/http-proxy.d.ts +4 -0
  34. package/dist/src/http-proxy.d.ts.map +1 -0
  35. package/dist/src/http-proxy.js +266 -0
  36. package/dist/src/risk-engine.d.ts +43 -0
  37. package/dist/src/risk-engine.d.ts.map +1 -0
  38. package/dist/src/risk-engine.js +258 -0
  39. package/dist/src/shell-wrapper.d.ts +3 -0
  40. package/dist/src/shell-wrapper.d.ts.map +1 -0
  41. package/dist/src/shell-wrapper.js +264 -0
  42. package/dist/storage.d.ts +28 -0
  43. package/dist/storage.d.ts.map +1 -0
  44. package/dist/storage.js +144 -0
  45. package/examples/INTEGRATION.md +162 -0
  46. package/examples/claude-desktop-agent.json +32 -0
  47. package/examples/clawdbot-agent.json +44 -0
  48. package/examples/custom-agent.json +20 -0
  49. package/lite-policy.json +5 -0
  50. package/package.json +56 -0
package/README.md ADDED
@@ -0,0 +1,161 @@
1
+ # Averecion Lite Adapter
2
+
3
+ Lightweight, local-only governance adapter for OpenClaw and other AI agent frameworks.
4
+
5
+ ## Features
6
+
7
+ - **One-Command Setup**: `npx averecion-lite init` does everything
8
+ - **Policy Enforcement**: Allow/block skills based on a simple JSON policy
9
+ - **Prompt Injection Detection**: Regex-based scanning for hazardous patterns
10
+ - **Manual Confirmation**: CLI-based approval for high-risk actions
11
+ - **Local Dashboard**: Single-page dashboard showing action metrics
12
+ - **No Database**: Append-only JSON file with automatic rotation
13
+ - **Secure by Default**: Shared secret required, localhost-only binding
14
+
15
+ ## Quick Start (Automated)
16
+
17
+ ```bash
18
+ npx averecion-lite init
19
+ ```
20
+
21
+ That's it! The command:
22
+ 1. ✅ Generates a secret key automatically
23
+ 2. ✅ Detects your OpenClaw config
24
+ 3. ✅ Adds the safety hooks
25
+ 4. ✅ Creates the default policy
26
+
27
+ Then start the dashboard:
28
+ ```bash
29
+ npx averecion-lite start
30
+ ```
31
+
32
+ Visit `http://127.0.0.1:4321/clawguard` for the dashboard.
33
+
34
+ ## CLI Commands
35
+
36
+ ```bash
37
+ npx averecion-lite init # First-time setup
38
+ npx averecion-lite start # Start dashboard
39
+ npx averecion-lite status # Check configuration
40
+ ```
41
+
42
+ ## Usage
43
+
44
+ ### Basic Integration
45
+
46
+ ```typescript
47
+ import { initLiteAdapter, beforeAction, afterAction } from "./index";
48
+
49
+ await initLiteAdapter({
50
+ port: 4321,
51
+ enableCLIConfirm: true,
52
+ });
53
+
54
+ const result = await beforeAction({
55
+ tool: "shell.exec",
56
+ args: { command: "ls -la" },
57
+ plan: "List directory contents",
58
+ });
59
+
60
+ if (result.allowed) {
61
+ await afterAction(payload, result);
62
+ }
63
+ ```
64
+
65
+ ### OpenClaw Hook
66
+
67
+ ```typescript
68
+ import { createOpenClawHook, initLiteAdapter } from "./index";
69
+
70
+ await initLiteAdapter();
71
+ const hook = await createOpenClawHook();
72
+ openclaw.registerHook(hook);
73
+ ```
74
+
75
+ ## API
76
+
77
+ ### GET /lite-metrics
78
+
79
+ Returns aggregated metrics for the last 24 hours.
80
+
81
+ **Headers Required:**
82
+ - `X-Lite-Secret`: Your `LITE_ADAPTER_SECRET` value
83
+
84
+ **Response:**
85
+ ```json
86
+ {
87
+ "window": "24h",
88
+ "kpis": {
89
+ "approved": 142,
90
+ "blocked": 8,
91
+ "manualApproved": 5,
92
+ "highRiskIntercepts": 12,
93
+ "promptInjectionDetected": 1
94
+ },
95
+ "egressTop": [
96
+ {"host": "api.slack.com", "calls": 48}
97
+ ],
98
+ "skills": {"trusted": 18, "unknownBlocked": 3, "outdated": 0},
99
+ "instance": {
100
+ "reverseProxyHardened": true,
101
+ "dashboardLocalOnly": true,
102
+ "secretsEnvOnly": true
103
+ },
104
+ "timeline": {...},
105
+ "cost": {...},
106
+ "lastActions": [...]
107
+ }
108
+ ```
109
+
110
+ ### GET /clawguard
111
+
112
+ Serves the single-page dashboard HTML.
113
+
114
+ ### GET /health
115
+
116
+ Health check endpoint (no auth required).
117
+
118
+ ## Security
119
+
120
+ - **Shared Secret**: All API calls require `X-Lite-Secret` header
121
+ - **Localhost Binding**: Server binds to `127.0.0.1` only
122
+ - **No Proxy Trust**: Requests are rejected even if `X-Forwarded-For` indicates localhost
123
+ - **No Secret Logging**: Secrets are never logged or exposed
124
+
125
+ ## Configuration
126
+
127
+ ### Environment Variables
128
+
129
+ | Variable | Default | Description |
130
+ |----------|---------|-------------|
131
+ | `LITE_ADAPTER_SECRET` | (required) | Shared secret for authentication |
132
+ | `LITE_PORT` | 4321 | Server port |
133
+ | `LITE_HOST` | 127.0.0.1 | Server host |
134
+ | `LITE_POLICY_PATH` | built-in | Custom policy file path |
135
+
136
+ ### Policy File
137
+
138
+ Default location: `~/.averecion-lite/lite-policy.json`
139
+
140
+ ```json
141
+ {
142
+ "allowedSkills": ["email.send", "calendar.create", "web.get", "file.read"],
143
+ "highRiskActions": ["shell.exec", "file.write", "network.post", "delete.*", "wallet.tx"],
144
+ "blockUnknownSkills": true
145
+ }
146
+ ```
147
+
148
+ ## Storage
149
+
150
+ Events are stored in `~/.averecion-lite/history.json`. The file is automatically rotated when it exceeds 5MB (keeps the most recent half of events).
151
+
152
+ ## Upgrade to Averecion Full
153
+
154
+ Need enterprise features? Visit [averecion.com](https://averecion.com) for:
155
+
156
+ - Cloud dashboard
157
+ - Multi-agent orchestration
158
+ - A/B testing
159
+ - Compliance audit logs
160
+ - SSO / RBAC
161
+ - Enterprise support