@goplus/agentguard 1.0.14 → 1.1.3
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/README.md +33 -2
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +172 -0
- package/dist/cli.js.map +1 -0
- package/dist/cloud/client.d.ts +19 -0
- package/dist/cloud/client.d.ts.map +1 -0
- package/dist/cloud/client.js +86 -0
- package/dist/cloud/client.js.map +1 -0
- package/dist/config.d.ts +31 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +131 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -1
- package/dist/index.js.map +1 -1
- package/dist/installers.d.ts +10 -0
- package/dist/installers.d.ts.map +1 -0
- package/dist/installers.js +137 -0
- package/dist/installers.js.map +1 -0
- package/dist/mcp-server.js +3 -2
- package/dist/mcp-server.js.map +1 -1
- package/dist/postinstall.d.ts +3 -0
- package/dist/postinstall.d.ts.map +1 -0
- package/dist/postinstall.js +13 -0
- package/dist/postinstall.js.map +1 -0
- package/dist/runtime/audit.d.ts +10 -0
- package/dist/runtime/audit.d.ts.map +1 -0
- package/dist/runtime/audit.js +94 -0
- package/dist/runtime/audit.js.map +1 -0
- package/dist/runtime/evaluator.d.ts +3 -0
- package/dist/runtime/evaluator.d.ts.map +1 -0
- package/dist/runtime/evaluator.js +197 -0
- package/dist/runtime/evaluator.js.map +1 -0
- package/dist/runtime/policy.d.ts +12 -0
- package/dist/runtime/policy.d.ts.map +1 -0
- package/dist/runtime/policy.js +81 -0
- package/dist/runtime/policy.js.map +1 -0
- package/dist/runtime/protect.d.ts +22 -0
- package/dist/runtime/protect.d.ts.map +1 -0
- package/dist/runtime/protect.js +172 -0
- package/dist/runtime/protect.js.map +1 -0
- package/dist/runtime/redaction.d.ts +6 -0
- package/dist/runtime/redaction.d.ts.map +1 -0
- package/dist/runtime/redaction.js +103 -0
- package/dist/runtime/redaction.js.map +1 -0
- package/dist/runtime/types.d.ts +62 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/types.js +3 -0
- package/dist/runtime/types.js.map +1 -0
- package/dist/scanner/rules/trojan.js +1 -1
- package/dist/scanner/rules/trojan.js.map +1 -1
- package/dist/tests/cloud-live.test.d.ts +2 -0
- package/dist/tests/cloud-live.test.d.ts.map +1 -0
- package/dist/tests/cloud-live.test.js +68 -0
- package/dist/tests/cloud-live.test.js.map +1 -0
- package/dist/tests/installer.test.d.ts +2 -0
- package/dist/tests/installer.test.d.ts.map +1 -0
- package/dist/tests/installer.test.js +32 -0
- package/dist/tests/installer.test.js.map +1 -0
- package/dist/tests/runtime-cloud.test.d.ts +2 -0
- package/dist/tests/runtime-cloud.test.d.ts.map +1 -0
- package/dist/tests/runtime-cloud.test.js +202 -0
- package/dist/tests/runtime-cloud.test.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +7 -0
- package/dist/version.js.map +1 -0
- package/docs/SECURITY-POLICY.md +558 -0
- package/docs/architecture.md +54 -0
- package/docs/claude-code.md +41 -0
- package/docs/cloud-connect.md +73 -0
- package/docs/cloud-native-api.md +526 -0
- package/docs/codex.md +38 -0
- package/docs/goplus-api.md +38 -0
- package/docs/mcp-server.md +39 -0
- package/docs/openclaw.md +41 -0
- package/docs/privacy-boundary.md +37 -0
- package/docs/sdk.md +83 -0
- package/docs/trust-cli.md +58 -0
- package/examples/openclaw-docker/Dockerfile +10 -0
- package/examples/openclaw-docker/README.md +16 -0
- package/examples/openclaw-docker/docker-compose.yml +8 -0
- package/examples/openclaw-docker/plugin.ts +8 -0
- package/package.json +7 -2
- package/skills/agentguard/SKILL.md +157 -61
- package/skills/agentguard/{scripts/package.json → package.json} +2 -1
- package/skills/agentguard/patrol-checks.md +12 -2
- package/skills/agentguard/scan-rules.md +1 -1
- package/skills/agentguard/scripts/checkup-report.js +71 -30
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Connect AgentGuard OSS to AgentGuard Cloud
|
|
2
|
+
|
|
3
|
+
AgentGuard is local-first. Cloud is optional and adds hosted policy, redacted audit sync, session timelines, and approval workflows.
|
|
4
|
+
|
|
5
|
+
## Install and initialize
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @goplus/agentguard
|
|
9
|
+
agentguard init
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
This creates `~/.agentguard/config.json`, `~/.agentguard/audit.jsonl`, and local cache paths.
|
|
13
|
+
|
|
14
|
+
## Connect Cloud
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
AGENTGUARD_API_KEY=ag_live_xxxxx \
|
|
18
|
+
agentguard connect --url https://agentguard.gopluslabs.io
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`connect` stores the API key locally, fetches `/api/v1/policies/effective`, and caches the policy. If Cloud is unavailable, AgentGuard keeps enforcing with cached policy or the bundled default policy.
|
|
22
|
+
|
|
23
|
+
Prefer `AGENTGUARD_API_KEY` or an ignored `.env.local` file over passing secrets as CLI flags, because shell history can persist command-line arguments.
|
|
24
|
+
|
|
25
|
+
## Runtime flow
|
|
26
|
+
|
|
27
|
+
1. Agent host sends tool metadata to `agentguard protect`.
|
|
28
|
+
2. AgentGuard evaluates locally by default.
|
|
29
|
+
3. Local audit is written to `~/.agentguard/audit.jsonl`.
|
|
30
|
+
4. Connected clients sync redacted audit events to `/api/v1/events/ingest`.
|
|
31
|
+
5. `require_approval` creates `/api/v1/approvals` and blocks the action until reviewed.
|
|
32
|
+
|
|
33
|
+
Use `AGENTGUARD_DECISION_MODE=cloud` or `agentguard protect --decision-mode cloud` only when Cloud should be authoritative for a specific hook.
|
|
34
|
+
|
|
35
|
+
## Commands
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
agentguard status
|
|
39
|
+
agentguard doctor
|
|
40
|
+
agentguard scan ./skills/example
|
|
41
|
+
agentguard protect --agent claude-code --action-type shell --tool-name Bash
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
For the full native API contract, see [AgentGuard Cloud Native API](cloud-native-api.md).
|
|
45
|
+
|
|
46
|
+
## Live Cloud smoke test
|
|
47
|
+
|
|
48
|
+
The normal test suite uses mocks and never touches Cloud. To verify a real test environment, build first and pass credentials through your shell:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm run build
|
|
52
|
+
AGENTGUARD_CLOUD_URL=https://your-agentguard-cloud.example.com \
|
|
53
|
+
AGENTGUARD_API_KEY=ag_live_xxxxx \
|
|
54
|
+
npm run test:cloud-live
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
You may also keep local-only credentials in an ignored `.env.local` file:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
AGENTGUARD_CLOUD_URL=https://your-agentguard-cloud.example.com
|
|
61
|
+
AGENTGUARD_API_KEY=ag_live_xxxxx
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Then run:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
set -a
|
|
68
|
+
. ./.env.local
|
|
69
|
+
set +a
|
|
70
|
+
npm run test:cloud-live
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Do not commit `.env.local`, `.env`, `~/.agentguard/config.json`, or any real API key.
|
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
# AgentGuard Cloud Native API
|
|
2
|
+
|
|
3
|
+
This document summarizes the Cloud APIs that a local/native AgentGuard runtime should use. The native client remains local-first: it enforces policy locally by default, uses Cloud for hosted policy and audit visibility, and never depends on the network to block a known-dangerous action.
|
|
4
|
+
|
|
5
|
+
## Base URL and authentication
|
|
6
|
+
|
|
7
|
+
Production base URL:
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
https://agentguard.gopluslabs.io
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
All protected runtime APIs require an AgentGuard API key:
|
|
14
|
+
|
|
15
|
+
```http
|
|
16
|
+
X-API-Key: ag_live_xxxxx
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`Authorization: Bearer ag_live_xxxxx` is also accepted by the Cloud proxy, but `X-API-Key` is the recommended native-client header.
|
|
20
|
+
|
|
21
|
+
## Recommended native flow
|
|
22
|
+
|
|
23
|
+
1. `agentguard connect` stores `cloudUrl` and `apiKey` in the local config.
|
|
24
|
+
2. Fetch `GET /api/v1/policies/effective` and cache the response locally.
|
|
25
|
+
3. Evaluate runtime actions locally using cached policy and the bundled local engine.
|
|
26
|
+
4. Write local audit JSONL before any Cloud sync.
|
|
27
|
+
5. Upload redacted audit events to `POST /api/v1/events/ingest`.
|
|
28
|
+
6. For `require_approval`, create `POST /api/v1/approvals` and block the action until reviewed.
|
|
29
|
+
7. Use `GET /api/v1/sessions/:sessionId/timeline` for review/debug UI.
|
|
30
|
+
|
|
31
|
+
If Cloud is unavailable, continue local enforcement using cached policy, then bundled default policy.
|
|
32
|
+
|
|
33
|
+
## Decision values
|
|
34
|
+
|
|
35
|
+
Cloud returns:
|
|
36
|
+
|
|
37
|
+
```text
|
|
38
|
+
allow | warn | require_approval | block
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Native UI may present `require_approval` as `confirm`, but API payloads should keep the Cloud value.
|
|
42
|
+
|
|
43
|
+
## Shared types
|
|
44
|
+
|
|
45
|
+
### Agent hosts
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
claude-code | codex | openclaw | cursor | gemini | copilot | other
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Action types
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
shell | file_read | file_write | network | mcp_tool | browser | skill_install | deploy | other
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Risk levels
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
safe | low | medium | high | critical
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Policy reason
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"code": "SECRET_ACCESS",
|
|
68
|
+
"severity": "high",
|
|
69
|
+
"title": "Protected path access",
|
|
70
|
+
"description": "The agent attempted to access a path protected by runtime policy.",
|
|
71
|
+
"evidence": "~/.ssh/id_rsa",
|
|
72
|
+
"remediation": "Require approval before this access."
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## API surface
|
|
77
|
+
|
|
78
|
+
### Commercial install script
|
|
79
|
+
|
|
80
|
+
```http
|
|
81
|
+
GET /install.sh?agent=claude-code
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Allowed `agent` values:
|
|
85
|
+
|
|
86
|
+
```text
|
|
87
|
+
auto | claude-code | openclaw | codex
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The script installs `@goplus/agentguard`, writes a safe fallback local config, then calls:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
agentguard init --agent "$AGENTGUARD_AGENT" --cloud "$AGENTGUARD_CLOUD_URL"
|
|
94
|
+
agentguard connect --cloud "$AGENTGUARD_CLOUD_URL" --api-key "$AGENTGUARD_API_KEY"
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Native CLI implementations should support `--cloud` as an alias for the Cloud URL and `--api-key` as an alias for the API key.
|
|
98
|
+
|
|
99
|
+
### Health check
|
|
100
|
+
|
|
101
|
+
```http
|
|
102
|
+
GET /api/v1/status
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Auth is not required.
|
|
106
|
+
|
|
107
|
+
Response:
|
|
108
|
+
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"success": true,
|
|
112
|
+
"data": {
|
|
113
|
+
"status": "healthy",
|
|
114
|
+
"version": "1.0.0",
|
|
115
|
+
"timestamp": "2026-05-11T00:00:00.000Z"
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Native usage: `doctor` command and diagnostics.
|
|
121
|
+
|
|
122
|
+
### Fetch effective policy
|
|
123
|
+
|
|
124
|
+
```http
|
|
125
|
+
GET /api/v1/policies/effective
|
|
126
|
+
X-API-Key: ag_live_xxxxx
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Response:
|
|
130
|
+
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"success": true,
|
|
134
|
+
"data": {
|
|
135
|
+
"policyVersion": "runtime-v0.1",
|
|
136
|
+
"mode": "balanced",
|
|
137
|
+
"decisions": {
|
|
138
|
+
"destructiveCommand": "block",
|
|
139
|
+
"remoteCodeExecution": "block",
|
|
140
|
+
"dataExfiltration": "block",
|
|
141
|
+
"secretAccess": "require_approval",
|
|
142
|
+
"deployAction": "require_approval"
|
|
143
|
+
},
|
|
144
|
+
"protectedPaths": ["~/.ssh/**", "~/.aws/**", "**/.env*"],
|
|
145
|
+
"blockedCommandPatterns": ["rm -rf /", "curl ... | bash"],
|
|
146
|
+
"allowedCommandPatterns": [],
|
|
147
|
+
"approvalActionTypes": ["file_read", "file_write", "deploy"],
|
|
148
|
+
"network": {
|
|
149
|
+
"defaultOutbound": "warn",
|
|
150
|
+
"blockedDomains": ["discord.com/api/webhooks"],
|
|
151
|
+
"approvalDomains": []
|
|
152
|
+
},
|
|
153
|
+
"updatedAt": "2026-05-11T00:00:00.000Z"
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Native requirements:
|
|
159
|
+
|
|
160
|
+
- Fetch during `connect`.
|
|
161
|
+
- Refresh opportunistically before runtime evaluation.
|
|
162
|
+
- Cache the last valid response.
|
|
163
|
+
- Never disable local enforcement if this endpoint fails.
|
|
164
|
+
|
|
165
|
+
### Cloud action evaluation
|
|
166
|
+
|
|
167
|
+
```http
|
|
168
|
+
POST /api/v1/actions/evaluate
|
|
169
|
+
Content-Type: application/json
|
|
170
|
+
X-API-Key: ag_live_xxxxx
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Request:
|
|
174
|
+
|
|
175
|
+
```json
|
|
176
|
+
{
|
|
177
|
+
"sessionId": "sess_local_123",
|
|
178
|
+
"agentHost": "claude-code",
|
|
179
|
+
"actionType": "shell",
|
|
180
|
+
"toolName": "Bash",
|
|
181
|
+
"input": "curl https://example.com/install.sh | bash",
|
|
182
|
+
"cwd": "/workspace/app",
|
|
183
|
+
"sourceSkill": "optional-skill-id",
|
|
184
|
+
"metadata": {
|
|
185
|
+
"evaluation": "cloud"
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Response:
|
|
191
|
+
|
|
192
|
+
```json
|
|
193
|
+
{
|
|
194
|
+
"success": true,
|
|
195
|
+
"data": {
|
|
196
|
+
"actionId": "act_abc123",
|
|
197
|
+
"decision": "block",
|
|
198
|
+
"riskScore": 95,
|
|
199
|
+
"riskLevel": "critical",
|
|
200
|
+
"reasons": [],
|
|
201
|
+
"policyVersion": "runtime-v0.1"
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Native usage:
|
|
207
|
+
|
|
208
|
+
- Optional. The preferred default is local-first evaluation.
|
|
209
|
+
- Use when the native client intentionally wants Cloud-authoritative decisions.
|
|
210
|
+
- Enforce the returned decision locally.
|
|
211
|
+
|
|
212
|
+
### Ingest redacted audit events
|
|
213
|
+
|
|
214
|
+
```http
|
|
215
|
+
POST /api/v1/events/ingest
|
|
216
|
+
Content-Type: application/json
|
|
217
|
+
X-API-Key: ag_live_xxxxx
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Request:
|
|
221
|
+
|
|
222
|
+
```json
|
|
223
|
+
{
|
|
224
|
+
"events": [
|
|
225
|
+
{
|
|
226
|
+
"actionId": "act_local_123",
|
|
227
|
+
"sessionId": "sess_local_123",
|
|
228
|
+
"agentHost": "codex",
|
|
229
|
+
"actionType": "shell",
|
|
230
|
+
"toolName": "Bash",
|
|
231
|
+
"input": "echo safe --api_key=[REDACTED]",
|
|
232
|
+
"decision": "warn",
|
|
233
|
+
"riskScore": 20,
|
|
234
|
+
"riskLevel": "medium",
|
|
235
|
+
"reasons": [],
|
|
236
|
+
"policyVersion": "runtime-v0.1",
|
|
237
|
+
"cwd": "/workspace/app",
|
|
238
|
+
"sourceSkill": "optional-skill-id",
|
|
239
|
+
"metadata": {
|
|
240
|
+
"evaluation": "local-oss"
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
]
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
Response:
|
|
248
|
+
|
|
249
|
+
```json
|
|
250
|
+
{
|
|
251
|
+
"success": true,
|
|
252
|
+
"data": {
|
|
253
|
+
"accepted": 1,
|
|
254
|
+
"rejected": 0
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Limits and behavior:
|
|
260
|
+
|
|
261
|
+
- Maximum `100` events per batch.
|
|
262
|
+
- `input` should be a redacted preview, not full file content or full prompt content.
|
|
263
|
+
- If upload fails, spool locally and retry later.
|
|
264
|
+
|
|
265
|
+
### Create approval
|
|
266
|
+
|
|
267
|
+
```http
|
|
268
|
+
POST /api/v1/approvals
|
|
269
|
+
Content-Type: application/json
|
|
270
|
+
X-API-Key: ag_live_xxxxx
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
Request:
|
|
274
|
+
|
|
275
|
+
```json
|
|
276
|
+
{
|
|
277
|
+
"actionId": "act_local_123",
|
|
278
|
+
"sessionId": "sess_local_123",
|
|
279
|
+
"agentHost": "claude-code",
|
|
280
|
+
"actionType": "file_read",
|
|
281
|
+
"toolName": "Read",
|
|
282
|
+
"input": "~/.ssh/id_rsa",
|
|
283
|
+
"riskScore": 55,
|
|
284
|
+
"riskLevel": "high",
|
|
285
|
+
"reasons": [],
|
|
286
|
+
"policyVersion": "runtime-v0.1",
|
|
287
|
+
"cwd": "/workspace/app",
|
|
288
|
+
"sourceSkill": "optional-skill-id",
|
|
289
|
+
"metadata": {
|
|
290
|
+
"evaluation": "local-oss"
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
Response:
|
|
296
|
+
|
|
297
|
+
```json
|
|
298
|
+
{
|
|
299
|
+
"success": true,
|
|
300
|
+
"data": {
|
|
301
|
+
"approvalId": "apr_abc123",
|
|
302
|
+
"actionId": "act_local_123",
|
|
303
|
+
"sessionId": "sess_local_123",
|
|
304
|
+
"status": "pending"
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
Native behavior:
|
|
310
|
+
|
|
311
|
+
- Create this only after local or Cloud decision returns `require_approval`.
|
|
312
|
+
- Block the action while approval is pending.
|
|
313
|
+
- Show the approval id to the user when available.
|
|
314
|
+
|
|
315
|
+
### List approvals
|
|
316
|
+
|
|
317
|
+
```http
|
|
318
|
+
GET /api/v1/approvals?status=pending
|
|
319
|
+
X-API-Key: ag_live_xxxxx
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
Response:
|
|
323
|
+
|
|
324
|
+
```json
|
|
325
|
+
{
|
|
326
|
+
"success": true,
|
|
327
|
+
"data": {
|
|
328
|
+
"approvals": [
|
|
329
|
+
{
|
|
330
|
+
"approvalId": "apr_abc123",
|
|
331
|
+
"actionId": "act_local_123",
|
|
332
|
+
"sessionId": "sess_local_123",
|
|
333
|
+
"agentHost": "claude-code",
|
|
334
|
+
"actionType": "file_read",
|
|
335
|
+
"toolName": "Read",
|
|
336
|
+
"inputPreview": "~/.ssh/id_rsa",
|
|
337
|
+
"status": "pending",
|
|
338
|
+
"riskScore": 55,
|
|
339
|
+
"riskLevel": "high",
|
|
340
|
+
"reasons": [],
|
|
341
|
+
"policyVersion": "runtime-v0.1",
|
|
342
|
+
"createdAt": "2026-05-11T00:00:00.000Z"
|
|
343
|
+
}
|
|
344
|
+
]
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
Native usage: optional inbox UI or debugging command.
|
|
350
|
+
|
|
351
|
+
### Review approval
|
|
352
|
+
|
|
353
|
+
```http
|
|
354
|
+
PATCH /api/v1/approvals/:approvalId
|
|
355
|
+
Content-Type: application/json
|
|
356
|
+
X-API-Key: ag_live_xxxxx
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
Request:
|
|
360
|
+
|
|
361
|
+
```json
|
|
362
|
+
{
|
|
363
|
+
"status": "approved",
|
|
364
|
+
"note": "Expected deploy"
|
|
365
|
+
}
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
`status` must be either `approved` or `denied`.
|
|
369
|
+
|
|
370
|
+
Response:
|
|
371
|
+
|
|
372
|
+
```json
|
|
373
|
+
{
|
|
374
|
+
"success": true,
|
|
375
|
+
"data": {
|
|
376
|
+
"approvalId": "apr_abc123",
|
|
377
|
+
"actionId": "act_local_123",
|
|
378
|
+
"sessionId": "sess_local_123",
|
|
379
|
+
"status": "approved"
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
Native usage: optional reviewer UX. Most local hooks should simply block and ask the user to review in Cloud.
|
|
385
|
+
|
|
386
|
+
### Session timeline
|
|
387
|
+
|
|
388
|
+
```http
|
|
389
|
+
GET /api/v1/sessions/:sessionId/timeline
|
|
390
|
+
X-API-Key: ag_live_xxxxx
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
Response:
|
|
394
|
+
|
|
395
|
+
```json
|
|
396
|
+
{
|
|
397
|
+
"success": true,
|
|
398
|
+
"data": {
|
|
399
|
+
"sessionId": "sess_local_123",
|
|
400
|
+
"events": [
|
|
401
|
+
{
|
|
402
|
+
"actionId": "act_local_123",
|
|
403
|
+
"sessionId": "sess_local_123",
|
|
404
|
+
"agentHost": "codex",
|
|
405
|
+
"actionType": "shell",
|
|
406
|
+
"toolName": "Bash",
|
|
407
|
+
"inputPreview": "echo safe",
|
|
408
|
+
"decision": "allow",
|
|
409
|
+
"riskScore": 0,
|
|
410
|
+
"riskLevel": "safe",
|
|
411
|
+
"reasons": [],
|
|
412
|
+
"policyVersion": "runtime-v0.1",
|
|
413
|
+
"approvalStatus": null,
|
|
414
|
+
"createdAt": "2026-05-11T00:00:00.000Z"
|
|
415
|
+
}
|
|
416
|
+
]
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
Native usage: optional status/debug command and incident review.
|
|
422
|
+
|
|
423
|
+
## Supply-chain scan APIs
|
|
424
|
+
|
|
425
|
+
These are Cloud scan APIs rather than runtime control-plane APIs. Native clients may use them for paid/deep scans, but local scan should still work without Cloud.
|
|
426
|
+
|
|
427
|
+
### Scan content
|
|
428
|
+
|
|
429
|
+
```http
|
|
430
|
+
POST /api/v1/scan
|
|
431
|
+
Content-Type: application/json
|
|
432
|
+
X-API-Key: ag_live_xxxxx
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
Request:
|
|
436
|
+
|
|
437
|
+
```json
|
|
438
|
+
{
|
|
439
|
+
"content": "# SKILL.md content",
|
|
440
|
+
"context": {
|
|
441
|
+
"registry": "github.com/org/repo",
|
|
442
|
+
"author": "org",
|
|
443
|
+
"version": "v1.0.0"
|
|
444
|
+
},
|
|
445
|
+
"ai": false
|
|
446
|
+
}
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
### Scan URL
|
|
450
|
+
|
|
451
|
+
```http
|
|
452
|
+
POST /api/v1/scan-url
|
|
453
|
+
Content-Type: application/json
|
|
454
|
+
X-API-Key: ag_live_xxxxx
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
Request:
|
|
458
|
+
|
|
459
|
+
```json
|
|
460
|
+
{
|
|
461
|
+
"url": "https://github.com/org/repo/blob/main/SKILL.md",
|
|
462
|
+
"type": "github",
|
|
463
|
+
"ai": false
|
|
464
|
+
}
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
### Scan registry
|
|
468
|
+
|
|
469
|
+
```http
|
|
470
|
+
POST /api/v1/scan-registry
|
|
471
|
+
Content-Type: application/json
|
|
472
|
+
X-API-Key: ag_live_xxxxx
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
Request:
|
|
476
|
+
|
|
477
|
+
```json
|
|
478
|
+
{
|
|
479
|
+
"registry": "https://example-registry.invalid",
|
|
480
|
+
"limit": 50,
|
|
481
|
+
"offset": 0,
|
|
482
|
+
"filter": "latest"
|
|
483
|
+
}
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
Valid `filter` values:
|
|
487
|
+
|
|
488
|
+
```text
|
|
489
|
+
latest | popular | all
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
## Privacy rules for native clients
|
|
493
|
+
|
|
494
|
+
Native clients must redact before upload:
|
|
495
|
+
|
|
496
|
+
- API keys
|
|
497
|
+
- Bearer tokens
|
|
498
|
+
- private key PEM blocks
|
|
499
|
+
- URL query secrets
|
|
500
|
+
- env-style secrets such as `api_key=...`, `token=...`, `password=...`
|
|
501
|
+
|
|
502
|
+
Native clients should upload only:
|
|
503
|
+
|
|
504
|
+
- action metadata
|
|
505
|
+
- redacted input preview
|
|
506
|
+
- decision/risk/reasons
|
|
507
|
+
- policy version
|
|
508
|
+
- optional source skill and cwd
|
|
509
|
+
|
|
510
|
+
Native clients should not upload by default:
|
|
511
|
+
|
|
512
|
+
- full file contents
|
|
513
|
+
- full prompts
|
|
514
|
+
- full command output
|
|
515
|
+
- full secrets
|
|
516
|
+
|
|
517
|
+
## Error handling
|
|
518
|
+
|
|
519
|
+
Expected native behavior:
|
|
520
|
+
|
|
521
|
+
- `401`: API key missing/invalid. Continue local-only mode and ask user to reconnect.
|
|
522
|
+
- `403`: plan/tier does not allow the endpoint. Continue local protection.
|
|
523
|
+
- `429`: rate limited. Queue audit events and retry later.
|
|
524
|
+
- `5xx`: Cloud unavailable or server write failed. Continue local enforcement and spool events.
|
|
525
|
+
|
|
526
|
+
Never fail open for a local `block` decision.
|
package/docs/codex.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Codex
|
|
2
|
+
|
|
3
|
+
Codex can use AgentGuard as a local skill/runtime template for command, file, and network review.
|
|
4
|
+
|
|
5
|
+
## Local commands
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @goplus/agentguard
|
|
9
|
+
agentguard init
|
|
10
|
+
agentguard scan ./skills/example
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Runtime template
|
|
14
|
+
|
|
15
|
+
To write Codex templates in the current project:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
agentguard init --agent codex
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
This creates `.codex/skills/agentguard/SKILL.md` and `.codex/agentguard-hook.example.json`.
|
|
22
|
+
|
|
23
|
+
Pipe a tool event to `agentguard protect`:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
printf '{"tool_name":"Bash","tool_input":{"command":"rm -rf /"}}' \
|
|
27
|
+
| AGENTGUARD_AGENT_HOST=codex agentguard protect --json
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Use these mappings for Codex-style hooks or skills:
|
|
31
|
+
|
|
32
|
+
- shell commands → `shell`
|
|
33
|
+
- file reads → `file_read`
|
|
34
|
+
- file writes/patches → `file_write`
|
|
35
|
+
- browser/network fetches → `network`
|
|
36
|
+
- MCP tool calls → `mcp_tool`
|
|
37
|
+
|
|
38
|
+
When Cloud is connected, Codex events are synced as redacted previews and can participate in Cloud approvals.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# GoPlus API Integration
|
|
2
|
+
|
|
3
|
+
GoPlus AgentGuard optionally integrates with the [GoPlus Security API](https://gopluslabs.io/security-api) for enhanced Web3 security.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
export GOPLUS_API_KEY=your_key
|
|
9
|
+
export GOPLUS_API_SECRET=your_secret
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Get keys at: https://gopluslabs.io/security-api
|
|
13
|
+
|
|
14
|
+
## What It Adds
|
|
15
|
+
|
|
16
|
+
Without GoPlus API, AgentGuard uses local pattern matching for Web3 security (unlimited approvals, reentrancy, selfdestruct, etc.).
|
|
17
|
+
|
|
18
|
+
With GoPlus API, you get additional capabilities:
|
|
19
|
+
|
|
20
|
+
- **Token Security**: Check if a token is a honeypot, has a tax, or has other risks
|
|
21
|
+
- **Address Security**: Check if an address is associated with phishing, scams, or malicious activity
|
|
22
|
+
- **Transaction Simulation**: Simulate a transaction to see its effects before execution
|
|
23
|
+
- **Approval Security**: Check for risky token approvals
|
|
24
|
+
- **dApp Security**: Verify the safety of decentralized applications
|
|
25
|
+
|
|
26
|
+
## Graceful Degradation
|
|
27
|
+
|
|
28
|
+
If the GoPlus API is unavailable or keys are not configured, AgentGuard falls back to local-only analysis. No functionality is lost — you just get fewer Web3-specific insights.
|
|
29
|
+
|
|
30
|
+
## External Scanner
|
|
31
|
+
|
|
32
|
+
GoPlus AgentGuard also integrates with [cisco-ai-defense/skill-scanner](https://github.com/cisco-ai-defense/skill-scanner) for additional scanning capabilities:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install cisco-ai-skill-scanner
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
This adds YAML/YARA pattern scanning, Python AST analysis, and VirusTotal integration.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# MCP Server
|
|
2
|
+
|
|
3
|
+
AgentGuard still ships an MCP server for hosts that prefer MCP tools over hooks.
|
|
4
|
+
|
|
5
|
+
## Run
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx -y --package @goplus/agentguard agentguard-mcp
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
If installed globally:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
agentguard-mcp
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Configure
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"mcpServers": {
|
|
22
|
+
"agentguard": {
|
|
23
|
+
"command": "agentguard-mcp"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Tools
|
|
30
|
+
|
|
31
|
+
- `skill_scanner_scan`
|
|
32
|
+
- `registry_lookup`
|
|
33
|
+
- `registry_attest`
|
|
34
|
+
- `registry_revoke`
|
|
35
|
+
- `registry_list`
|
|
36
|
+
- `action_scanner_decide`
|
|
37
|
+
- `action_scanner_simulate_web3`
|
|
38
|
+
|
|
39
|
+
For live action blocking, prefer `agentguard protect` hooks. MCP is best for agent-invoked scans, trust registry operations, and Web3 simulation.
|