@agentwares/agentguard 0.1.1 → 0.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/LICENSE +21 -0
- package/README.md +38 -20
- package/dist/cli.js +303 -150
- package/dist/cli.js.map +1 -1
- package/dist/fixtures/crm-server.js +53 -24
- package/dist/fixtures/crm-server.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +202 -49
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/server.json +2 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 agentwares
|
|
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
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**60 seconds to a safe first run.** Your agent already has an MCP config. Put agentguard in front of it, run the agent once in dry-run, and read what it _would_ have done:
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
|
-
npx @agentwares/agentguard init #
|
|
6
|
+
npx @agentwares/agentguard init # finds your MCP config, writes agentguard.yaml (dry-run), routes every server through the proxy
|
|
7
7
|
# restart your MCP client, run your agent as usual — writes are faked, nothing executes upstream
|
|
8
8
|
npx @agentwares/agentguard report # "would have deleted 12 records, sent 5 emails, spent $140 — halted a loop at call 31"
|
|
9
9
|
npx @agentwares/agentguard diff # the record-by-record mutation diff
|
|
@@ -36,16 +36,18 @@ agentguard is an MCP policy proxy for agents that touch production. It sits betw
|
|
|
36
36
|
- **Dry-run writes with mutation diffs** — classified writes return a plausible success shaped by the tool's output schema so the agent keeps going; `agentguard diff` shows what would have changed.
|
|
37
37
|
- **Semantic loop breaker** — the same `(tool, normalized args)` 3× in the last 30 calls, or an A→B→A→B cycle, returns `LOOP_DETECTED`. Timestamps, ids, whitespace and key order are ignored.
|
|
38
38
|
- **Blast-radius caps** — `tool_calls`, `writes`, `deletes`, `emails`, `spend_usd` and custom counters, per run and per day.
|
|
39
|
-
- **Hash-chained audit log** — every call is a JSONL line with `prev_hash` and `hash`; `agentguard verify` proves
|
|
39
|
+
- **Hash-chained audit log** — every call is a JSONL line with `prev_hash` and `hash`; `agentguard verify` proves no entry was edited, removed from the middle, or reordered (see Limits for what a local chain cannot prove on its own).
|
|
40
40
|
|
|
41
41
|
No LLM calls. No phone-home. No account. MIT.
|
|
42
42
|
|
|
43
|
-
Two install paths, one policy engine: the **MCP proxy** (`npx @agentwares/agentguard`, stdio + Streamable HTTP, multiple upstreams) and the **SDK/middleware** ([`@agentwares/agentguard-sdk`](
|
|
43
|
+
Two install paths, one policy engine: the **MCP proxy** (`npx @agentwares/agentguard`, stdio + Streamable HTTP, multiple upstreams) and the **SDK/middleware** ([`@agentwares/agentguard-sdk`](https://github.com/agentwares/agentguard/tree/main/packages/agentguard-sdk#readme)) for OpenAI Agents SDK, LangChain or plain-function tools that never go through MCP.
|
|
44
44
|
|
|
45
45
|
## Install
|
|
46
46
|
|
|
47
47
|
```sh
|
|
48
|
-
npx @agentwares/agentguard init #
|
|
48
|
+
npx @agentwares/agentguard init # rewrites the first project-level config it finds
|
|
49
|
+
npx @agentwares/agentguard init --all # ...or every config: .mcp.json, .cursor/mcp.json, .vscode/mcp.json
|
|
50
|
+
npx @agentwares/agentguard init --client ~/.claude.json # a user-level config, which --all still leaves alone
|
|
49
51
|
npx @agentwares/agentguard init --client ~/Library/Application\ Support/Claude/claude_desktop_config.json # user-level configs only with --client
|
|
50
52
|
npx @agentwares/agentguard init --undo # restore the backup
|
|
51
53
|
```
|
|
@@ -137,19 +139,34 @@ Run identity: `X-Run-Id` header (HTTP) → `_meta.runId` on the call → session
|
|
|
137
139
|
|
|
138
140
|
## Commands
|
|
139
141
|
|
|
140
|
-
| Command | What it does
|
|
141
|
-
| ------------------------------------------------------------------------------------------------------------------------------- |
|
|
142
|
-
| `agentguard init [--client path] [--all] [--no-probe] [--mode enforce] [--undo]` | generate the policy, rewrite the client config (project-level by default)
|
|
143
|
-
| `agentguard proxy [--http --port 8788] [--agent name] [--run-id id] [--mode m]` | run the proxy (stdio default)
|
|
144
|
-
| `agentguard report [--run id \| --all] [--json]` | what this run did / would have destroyed / spent; where it was halted; chain status
|
|
145
|
-
| `agentguard diff [--run id]` | mutation diff of faked writes
|
|
146
|
-
| `agentguard verify [audit.jsonl]` | recompute the hash chain; exit 1 on the first break
|
|
147
|
-
| `agentguard status [--run id]` | counters vs caps, kill state, pending approvals, running HTTP proxy
|
|
148
|
-
| `agentguard tools [--json]` | every exposed tool with class, verb, upstream and the reason
|
|
149
|
-
| `agentguard kill [reason]` / `agentguard resume` | halt everything now / clear it
|
|
150
|
-
| `agentguard approvals [--all]` / `approve <id>` / `deny <id> [--note …]` | the approval queue
|
|
151
|
-
| `agentguard key create <agent> [--allow p]… [--deny p] [--writes n] [--spend n] [--mode m]` / `key list` / `key revoke <agent>` | scoped credentials
|
|
152
|
-
| `agentguard
|
|
142
|
+
| Command | What it does |
|
|
143
|
+
| ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
144
|
+
| `agentguard init [--client path] [--all] [--no-probe] [--mode enforce] [--undo]` | generate the policy, rewrite the client config (project-level by default) |
|
|
145
|
+
| `agentguard proxy [--http --port 8788] [--agent name] [--run-id id] [--mode m]` | run the proxy (stdio default) |
|
|
146
|
+
| `agentguard report [--run id \| --all] [--json]` | what this run did / would have destroyed / spent; where it was halted; chain status |
|
|
147
|
+
| `agentguard diff [--run id]` | mutation diff of faked writes |
|
|
148
|
+
| `agentguard verify [audit.jsonl]` | recompute the hash chain; exit 1 on the first break |
|
|
149
|
+
| `agentguard status [--run id]` | counters vs caps, kill state, pending approvals, running HTTP proxy |
|
|
150
|
+
| `agentguard tools [--json]` | every exposed tool with class, verb, upstream and the reason |
|
|
151
|
+
| `agentguard kill [reason]` / `agentguard resume` | halt everything now / clear it |
|
|
152
|
+
| `agentguard approvals [--all]` / `approve <id>` / `deny <id> [--note …]` | the approval queue |
|
|
153
|
+
| `agentguard key create <agent> [--allow p]… [--deny p] [--writes n] [--spend n] [--mode m]` / `key list` / `key revoke <agent>` | scoped credentials |
|
|
154
|
+
| `agentguard connect <key> [--write] [--client path] [--all] [--url base]` | point this machine's MCP client at a hosted proxy (paid tiers); prints the config, `--write` merges it in |
|
|
155
|
+
| `agentguard permission-diff [--base ref] [--head ref] [--fail-on-widen]` | which config changes widen agent permissions (also a [GitHub Action](https://github.com/agentwares/agentguard/tree/main/assets/permission-diff-action)) |
|
|
156
|
+
|
|
157
|
+
### Hosted tiers
|
|
158
|
+
|
|
159
|
+
The CLI enforces policy on your machine and needs no account. The paid tiers move enforcement
|
|
160
|
+
server-side — shared state across machines, retained audit, alerting — and `connect` is how you
|
|
161
|
+
point a client at yours:
|
|
162
|
+
|
|
163
|
+
```sh
|
|
164
|
+
npx @agentwares/agentguard connect agk_... # print the MCP server block
|
|
165
|
+
npx @agentwares/agentguard connect agk_... --write # merge it into your MCP config (existing servers are kept)
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Unlike `init`, `connect` adds one remote server and leaves the rest of your config alone. The key
|
|
169
|
+
comes from your dashboard; everything else — proxy URL, mode, band — is answered by the server.
|
|
153
170
|
|
|
154
171
|
HTTP control endpoints (token in `.agentguard/http.json`): `GET /health`, `GET /status?run=`, `POST /kill`, `POST /resume`, `GET|POST /approve/:id`, `/deny/:id`, `GET /approvals`.
|
|
155
172
|
|
|
@@ -180,9 +197,10 @@ node dist/cli.js report && node dist/cli.js diff && node dist/cli.js verify
|
|
|
180
197
|
- Dry-run synthesizes results from the tool's `outputSchema`; agents that depend on real ids from a create → update chain will see plausible but fake ids. `dry_run.tools` lets you fake only the dangerous tools in enforce mode.
|
|
181
198
|
- Per-day counters are a JSON file under a directory lock; fine for a workstation or one box, not a fleet. The hosted tier (coming) is the shared-state version.
|
|
182
199
|
- Slack "Approve" buttons are links to the local HTTP proxy; they work for people who can reach it. Without HTTP mode the message carries the `agentguard approve <id>` command.
|
|
200
|
+
- A local hash chain is tamper-**evident**, not tamper-proof, and it has one blind spot: entries deleted from the **end** of the file leave a shorter chain that still verifies. Editing, deleting from the middle, and reordering are all caught. `agentguard verify` prints the head hash and the entry count — record them (CI log, ticket, chat) to close the gap, or use the hosted tier, which publishes a daily Merkle root you can check the run against.
|
|
183
201
|
|
|
184
202
|
## Related
|
|
185
203
|
|
|
186
|
-
- [`@agentwares/agentguard-sdk`](
|
|
187
|
-
- [`@agentwares/agentguard-core`](
|
|
188
|
-
- [permission-diff GitHub Action](
|
|
204
|
+
- [`@agentwares/agentguard-sdk`](https://github.com/agentwares/agentguard/tree/main/packages/agentguard-sdk#readme) — the same engine for OpenAI Agents SDK / LangChain / plain functions, plus the guarded `fetch` for LLM spend.
|
|
205
|
+
- [`@agentwares/agentguard-core`](https://github.com/agentwares/agentguard/tree/main/packages/agentguard-core#readme) — the Web-standard policy engine (bring your own stores).
|
|
206
|
+
- [permission-diff GitHub Action](https://github.com/agentwares/agentguard/tree/main/assets/permission-diff-action) — comments on PRs that widen `agentguard.yaml`, `.claude/settings.json` or `mcp.json`.
|