@goplus/agentguard 1.1.18 → 1.1.26
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 +6 -1
- package/dist/adapters/engine.d.ts.map +1 -1
- package/dist/adapters/engine.js +10 -0
- package/dist/adapters/engine.js.map +1 -1
- package/dist/adapters/openclaw-plugin.d.ts.map +1 -1
- package/dist/adapters/openclaw-plugin.js +24 -3
- package/dist/adapters/openclaw-plugin.js.map +1 -1
- package/dist/adapters/openclaw.d.ts.map +1 -1
- package/dist/adapters/openclaw.js +7 -2
- package/dist/adapters/openclaw.js.map +1 -1
- package/dist/cli.js +254 -72
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +5 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +13 -0
- package/dist/config.js.map +1 -1
- package/dist/feed/cron.d.ts +17 -0
- package/dist/feed/cron.d.ts.map +1 -1
- package/dist/feed/cron.js +197 -18
- package/dist/feed/cron.js.map +1 -1
- package/dist/feed/selfcheck.d.ts.map +1 -1
- package/dist/feed/selfcheck.js +205 -54
- package/dist/feed/selfcheck.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/installers.d.ts.map +1 -1
- package/dist/installers.js +91 -5
- package/dist/installers.js.map +1 -1
- package/dist/runtime/approvals.d.ts +38 -0
- package/dist/runtime/approvals.d.ts.map +1 -0
- package/dist/runtime/approvals.js +227 -0
- package/dist/runtime/approvals.js.map +1 -0
- package/dist/runtime/evaluator.d.ts.map +1 -1
- package/dist/runtime/evaluator.js +54 -0
- package/dist/runtime/evaluator.js.map +1 -1
- package/dist/runtime/protect.d.ts +2 -0
- package/dist/runtime/protect.d.ts.map +1 -1
- package/dist/runtime/protect.js +81 -9
- package/dist/runtime/protect.js.map +1 -1
- package/dist/runtime/self-command.d.ts +2 -0
- package/dist/runtime/self-command.d.ts.map +1 -0
- package/dist/runtime/self-command.js +93 -0
- package/dist/runtime/self-command.js.map +1 -0
- package/dist/tests/adapter.test.js +8 -0
- package/dist/tests/adapter.test.js.map +1 -1
- package/dist/tests/cli-connect.test.js +118 -1
- package/dist/tests/cli-connect.test.js.map +1 -1
- package/dist/tests/cli-init.test.js +123 -0
- package/dist/tests/cli-init.test.js.map +1 -1
- package/dist/tests/cli-subscribe.test.js +176 -0
- package/dist/tests/cli-subscribe.test.js.map +1 -1
- package/dist/tests/feed-cron.test.js +236 -0
- package/dist/tests/feed-cron.test.js.map +1 -1
- package/dist/tests/feed-selfcheck.test.js +81 -0
- package/dist/tests/feed-selfcheck.test.js.map +1 -1
- package/dist/tests/installer.test.js +78 -2
- package/dist/tests/installer.test.js.map +1 -1
- package/dist/tests/integration.test.js +64 -0
- package/dist/tests/integration.test.js.map +1 -1
- package/dist/tests/runtime-cloud.test.js +406 -0
- package/dist/tests/runtime-cloud.test.js.map +1 -1
- package/docs/claude-code.md +3 -2
- package/docs/cloud-connect.md +16 -3
- package/docs/cloud-native-api.md +26 -118
- package/docs/codex.md +13 -1
- package/docs/openclaw.md +32 -1
- package/docs/privacy-boundary.md +0 -1
- package/package.json +1 -1
- package/skills/agentguard/SKILL.md +14 -4
package/docs/cloud-native-api.md
CHANGED
|
@@ -25,7 +25,7 @@ X-API-Key: ag_live_xxxxx
|
|
|
25
25
|
3. Evaluate runtime actions locally using cached policy and the bundled local engine.
|
|
26
26
|
4. Write local audit JSONL before any Cloud sync.
|
|
27
27
|
5. Upload redacted audit events to `POST /api/v1/events/ingest`.
|
|
28
|
-
6. For `require_approval`,
|
|
28
|
+
6. For `require_approval`, use the local agent host's native permission channel when supported. If the host cannot safely resume a reviewed call, block locally and ask the user to retry only after intentionally changing local policy.
|
|
29
29
|
7. Use `GET /api/v1/sessions/:sessionId/timeline` for review/debug UI.
|
|
30
30
|
|
|
31
31
|
If Cloud is unavailable, continue local enforcement using cached policy, then bundled default policy.
|
|
@@ -91,10 +91,24 @@ The script installs `@goplus/agentguard`, writes a safe fallback local config, t
|
|
|
91
91
|
|
|
92
92
|
```bash
|
|
93
93
|
agentguard init --agent "$AGENTGUARD_AGENT" --cloud "$AGENTGUARD_CLOUD_URL"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
When the effective agent host is OpenClaw, the script should connect without an
|
|
97
|
+
API key:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
agentguard connect --cloud "$AGENTGUARD_CLOUD_URL"
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The CLI registers a local Agent JWT and prints an activation link. For other
|
|
104
|
+
agent hosts, or when the user explicitly chooses API-key auth, the script should
|
|
105
|
+
call:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
94
108
|
agentguard connect --cloud "$AGENTGUARD_CLOUD_URL" --api-key "$AGENTGUARD_API_KEY"
|
|
95
109
|
```
|
|
96
110
|
|
|
97
|
-
Native CLI implementations should support `--cloud` as an alias for the Cloud URL and `--api-key` as an alias for the API key.
|
|
111
|
+
Native CLI implementations should support `--cloud` as an alias for the Cloud URL and `--api-key` as an alias for the API key. Installers that accept `agent=auto` should use the agent host persisted by `agentguard init --agent auto` when choosing between Agent JWT and API-key auth.
|
|
98
112
|
|
|
99
113
|
### Health check
|
|
100
114
|
|
|
@@ -262,126 +276,20 @@ Limits and behavior:
|
|
|
262
276
|
- `input` should be a redacted preview, not full file content or full prompt content.
|
|
263
277
|
- If upload fails, spool locally and retry later.
|
|
264
278
|
|
|
265
|
-
###
|
|
279
|
+
### Runtime approvals
|
|
266
280
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
Content-Type: application/json
|
|
270
|
-
X-API-Key: ag_live_xxxxx
|
|
271
|
-
```
|
|
281
|
+
There is no Cloud approval inbox in the current native runtime flow. Native
|
|
282
|
+
clients must not tell users to approve protected runtime actions in Cloud.
|
|
272
283
|
|
|
273
|
-
|
|
284
|
+
When a decision returns `require_approval`:
|
|
274
285
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
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
|
-
```
|
|
286
|
+
- Claude Code should surface the native `PreToolUse` `ask` response.
|
|
287
|
+
- Codex-style hosts should surface the local `confirm` response.
|
|
288
|
+
- OpenClaw currently blocks locally because the runtime hook cannot safely pause
|
|
289
|
+
and resume the original tool call after an external review.
|
|
383
290
|
|
|
384
|
-
|
|
291
|
+
Cloud may still provide policy and session timeline visibility, but approval or
|
|
292
|
+
confirmation must happen in the local agent host.
|
|
385
293
|
|
|
386
294
|
### Session timeline
|
|
387
295
|
|
package/docs/codex.md
CHANGED
|
@@ -35,4 +35,16 @@ Use these mappings for Codex-style hooks or skills:
|
|
|
35
35
|
- browser/network fetches → `network`
|
|
36
36
|
- MCP tool calls → `mcp_tool`
|
|
37
37
|
|
|
38
|
-
When Cloud is connected, Codex events are synced as redacted previews
|
|
38
|
+
When Cloud is connected, Codex events are synced as redacted previews. Confirmation still happens through the local agent permission flow, not a Cloud approval page.
|
|
39
|
+
|
|
40
|
+
If a protected action returns `confirm`, AgentGuard stores a short-lived pending
|
|
41
|
+
approval and includes an approval command:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
agentguard approve --action-id act_local_... --once
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Run that command only after the user explicitly approves, then retry the
|
|
48
|
+
original action once. If the action id was not visible, inspect
|
|
49
|
+
`agentguard approvals list --json`; use `agentguard approve --last --once`
|
|
50
|
+
only when there is exactly one relevant unexpired pending approval.
|
package/docs/openclaw.md
CHANGED
|
@@ -10,7 +10,7 @@ To install and enable the AgentGuard OpenClaw plugin:
|
|
|
10
10
|
agentguard init --agent openclaw
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
This creates a local plugin under `~/.openclaw/plugins/agentguard
|
|
13
|
+
This creates a local plugin under `~/.openclaw/plugins/agentguard`, installs the AgentGuard skill under `~/.openclaw/skills/agentguard`, and enables the plugin in `~/.openclaw/openclaw.json`.
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
16
|
import { registerOpenClawPlugin } from '@goplus/agentguard';
|
|
@@ -23,6 +23,18 @@ export default function setup(api) {
|
|
|
23
23
|
}
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
+
## Cloud connect
|
|
27
|
+
|
|
28
|
+
After OpenClaw initialization, run:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
agentguard connect
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
No API key is required for the OpenClaw flow. AgentGuard registers a local Agent
|
|
35
|
+
JWT, prints an activation link, and may send the link to the latest OpenClaw
|
|
36
|
+
channel. Open that link to bind the local agent to your account.
|
|
37
|
+
|
|
26
38
|
## Runtime hook shape
|
|
27
39
|
|
|
28
40
|
For direct hook integration, send events to:
|
|
@@ -36,6 +48,25 @@ agentguard protect
|
|
|
36
48
|
|
|
37
49
|
AgentGuard accepts OpenClaw-style JSON with `toolName` and `params`, plus Claude-style `tool_name` and `tool_input`.
|
|
38
50
|
|
|
51
|
+
OpenClaw cannot safely pause and resume a protected tool call, so AgentGuard
|
|
52
|
+
blocks `require_approval` actions locally and stores a short-lived pending
|
|
53
|
+
approval. The block reason includes:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
agentguard approve --action-id act_local_... --once
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Run that command only after the user explicitly approves, then retry the
|
|
60
|
+
original action once. If the action id was not visible in the OpenClaw message,
|
|
61
|
+
inspect pending approvals first:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
agentguard approvals list --json
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Use `agentguard approve --last --once` only when there is exactly one relevant
|
|
68
|
+
unexpired pending approval; otherwise approve the specific `actionId`.
|
|
69
|
+
|
|
39
70
|
## Docker demo
|
|
40
71
|
|
|
41
72
|
See `examples/openclaw-docker/` for a minimal Docker demo that installs `@goplus/agentguard`, runs `agentguard init --agent openclaw`, and provides a starter plugin.
|
package/docs/privacy-boundary.md
CHANGED
|
@@ -18,7 +18,6 @@ Only redacted runtime audit previews are uploaded by default:
|
|
|
18
18
|
- `sessionId`, `agentHost`, `actionType`, `toolName`
|
|
19
19
|
- Redacted `input` preview, capped at 2,000 characters
|
|
20
20
|
- Decision, risk score, risk level, reasons, and policy version
|
|
21
|
-
- Optional approval request metadata for `require_approval`
|
|
22
21
|
|
|
23
22
|
## Built-in redaction
|
|
24
23
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goplus/agentguard",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.26",
|
|
4
4
|
"description": "GoPlus AgentGuard — Security guard for AI agents. Blocks dangerous commands, prevents data leaks, protects secrets. 20 detection rules, runtime action evaluation, trust registry.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -71,7 +71,7 @@ required post-install steps.
|
|
|
71
71
|
Parse `$ARGUMENTS` to determine the subcommand:
|
|
72
72
|
|
|
73
73
|
- **`init [args...]`** — Run `agentguard init`, especially `agentguard init --agent <agent>` after installation
|
|
74
|
-
- **`connect [args...]`** — Run `agentguard connect` to connect optional Cloud policy, audit, and approvals
|
|
74
|
+
- **`connect [args...]`** — Run `agentguard connect` to connect optional Cloud policy, audit, and approvals. AgentGuard supports either API-key auth or Agent JWT auth; only one Cloud auth method is required.
|
|
75
75
|
- **`scan <path>`** — Scan a skill or codebase for security risks
|
|
76
76
|
- **`action <description>`** — Evaluate whether a runtime action is safe
|
|
77
77
|
- **`patrol [run|setup|status]`** — Daily security patrol for OpenClaw environments
|
|
@@ -98,19 +98,29 @@ Supported CLI commands and options:
|
|
|
98
98
|
| CLI command | Options | Notes |
|
|
99
99
|
|---|---|---|
|
|
100
100
|
| `agentguard init` | `--level <level>`, `--agent <agent>`, `--cloud <url>`, `--force` | Creates local config, persists the selected agent host, and optionally installs templates for `claude-code`, `codex`, `openclaw`, `hermes`, or `qclaw` |
|
|
101
|
-
| `agentguard connect` | `--key <key>`, `--api-key <key>`, `--url <url>`, `--cloud <url>` | Prefer `AGENTGUARD_API_KEY` over passing secrets in flags |
|
|
102
|
-
| `agentguard disconnect` | none | Removes local Cloud
|
|
103
|
-
| `agentguard status` | none | Shows local config, Cloud
|
|
101
|
+
| `agentguard connect` | `--key <key>`, `--api-key <key>`, `--url <url>`, `--cloud <url>` | API-key auth and Agent JWT auth are alternatives; configure only one. Prefer `AGENTGUARD_API_KEY` over passing secrets in flags |
|
|
102
|
+
| `agentguard disconnect` | none | Removes local Cloud credentials, pending event spool, cached Cloud policy, and the managed `agentguard-threat-feed` subscribe cron job; keeps Cloud URL, audit log, and installed hooks/templates |
|
|
103
|
+
| `agentguard status` | none | Shows local config, active Cloud auth method, policy cache, audit path |
|
|
104
104
|
| `agentguard policy pull` | `--json` | Pulls Cloud effective runtime policy into the local cache |
|
|
105
105
|
| `agentguard policy show` | `--json` | Shows the cached effective runtime policy, or the bundled default policy when no cache exists |
|
|
106
|
+
| `agentguard approve` | `--action-id <id>` or `--last`, `--once`, `--json` | Approves one existing pending runtime action; never approve without explicit user confirmation |
|
|
107
|
+
| `agentguard approvals list` | `--json` | Lists unexpired pending runtime approvals |
|
|
106
108
|
| `agentguard doctor` | none | Checks local setup and Cloud reachability when connected |
|
|
107
109
|
| `agentguard protect` | `--agent <agent>`, `--action-type <type>`, `--tool-name <name>`, `--session-id <id>`, `--decision-mode <local-first|cloud>`, `--json` | Evaluates one runtime action from stdin or hook environment |
|
|
108
110
|
| `agentguard subscribe` | `--since <iso>`, `--json`, `--quiet`, `--no-report`, `--cron <expr>`, `--cron-target <auto|openclaw|qclaw|hermes|system>`, `--cron-name <name>`, `--force`, `--cron-run`, `--cron-notify-run` | Pulls Cloud threat advisories and optionally self-checks local skills |
|
|
109
111
|
| `agentguard checkup` | `--json` | Runs the local agent health checkup |
|
|
110
112
|
| `agentguard checkup --against-advisory <id>` | `--json` | CLI threat-feed self-check for one advisory; this is a targeted mode, not the default health-check workflow |
|
|
111
113
|
|
|
114
|
+
Connect behavior:
|
|
115
|
+
|
|
116
|
+
- Always execute `agentguard connect ...` directly when the user asks for it. Do not answer that an API key must be obtained before running the command.
|
|
117
|
+
- `agentguard connect` with no `--key`, `--api-key`, or `AGENTGUARD_API_KEY` is valid in OpenClaw environments: the CLI uses Agent JWT registration, prints an activation link, and may notify the latest OpenClaw channel.
|
|
118
|
+
- Only suggest `agentguard connect --key <key>` when the user explicitly wants API-key auth or when the CLI itself reports that Agent JWT registration is unavailable. If the CLI says OpenClaw is not initialized, suggest `agentguard init --agent openclaw` and then rerun `agentguard connect`.
|
|
119
|
+
|
|
112
120
|
If the user writes `/agentguard cli <args...>`, execute `agentguard <args...>` directly.
|
|
113
121
|
|
|
122
|
+
When AgentGuard returns `confirm` or a block reason that includes `Approve once: agentguard approve --action-id ... --once`, do not retry the protected action until the user explicitly approves. Treat user replies such as "yes", "approve", "approved", "confirm", "confirmed", "continue", "go ahead", "execute", "run it", "同意", "确认", "批准", "继续", or "执行" as explicit approval for the most recent protected action. After approval, run exactly the provided `agentguard approve --action-id ... --once` command, then retry the original action once. If the action id is unavailable, use `agentguard approvals list --json`; only use `agentguard approve --last --once` when there is exactly one relevant unexpired pending approval. If multiple pending approvals exist, ask the user to choose a specific action id.
|
|
123
|
+
|
|
114
124
|
Do **not** route plain `/agentguard scan`, `/agentguard action`, `/agentguard patrol`, `/agentguard trust`, `/agentguard report`, `/agentguard config`, `/agentguard checkup`, `/agentguard checkup --json`, or natural-language requests like "run agentguard checkup" through the packaged CLI. Those are this skill's higher-level workflows. Only use the packaged CLI checkup path when the user includes `--against-advisory <id>` or explicitly writes `/agentguard cli checkup ...`.
|
|
115
125
|
|
|
116
126
|
If the user writes `/agentguard checkup --against-advisory <id>`, use the CLI command `agentguard checkup --against-advisory <id>` instead of the comprehensive HTML health-report workflow.
|