agentgate 0.1.2 → 0.1.4

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 (3) hide show
  1. package/README.md +50 -10
  2. package/package.json +1 -1
  3. package/src/cli.js +21 -12
package/README.md CHANGED
@@ -60,21 +60,60 @@ The server runs on port 3050 by default. Set `PORT` environment variable to chan
60
60
  3. Add service accounts (OAuth or API tokens depending on service)
61
61
  4. Create API keys for your agents via CLI
62
62
 
63
- ## API Key Management
63
+ ## Using with Clawdbot / OpenClaw
64
64
 
65
- Manage API keys in the admin UI at `/ui/keys`, or via CLI:
65
+ > ⚠️ **IMPORTANT:** Do NOT run agentgate on the same machine as your AI agent (Clawdbot, OpenClaw, etc.). If the agent has local filesystem access, it could read the database directly and bypass all security controls. Always run agentgate on a **separate, isolated machine** that agents can only reach over the network.
66
66
 
67
- ```bash
68
- # List all API keys
69
- npm run keys list
67
+ ### Configure Your Agent
68
+
69
+ Add agentgate to your agent's `TOOLS.md`:
70
+
71
+ ```markdown
72
+ ### agentgate
73
+ - Base URL: `https://your-agentgate-server.com`
74
+ - Bearer token: `rms_your_key_here`
75
+ - **URL pattern:** `/api/{service}/{accountName}/...`
76
+ - **Reads (GET):** Execute immediately
77
+ - **Writes (POST/PUT/DELETE):** Queue for human approval
78
+
79
+ #### Write Queue
80
+ # Submit write request
81
+ POST /api/queue/{service}/{accountName}/submit
82
+ body: { requests: [{method, path, body}], comment: "why" }
83
+
84
+ # Check status
85
+ GET /api/queue/{service}/{accountName}/status/{id}
86
+ ```
87
+
88
+ Or include in your agent's system prompt:
89
+
90
+ ```
91
+ You have access to agentgate at https://your-server.com
92
+ API key: rms_your_key_here
93
+
94
+ For reads: GET /api/{service}/{account}/path
95
+ For writes: POST to /api/queue/{service}/{account}/submit with {requests, comment}
96
+
97
+ Always include a clear comment explaining your intent for write operations.
98
+ A human will review and approve before execution.
99
+ ```
100
+
101
+ ### Generate a Skill File
70
102
 
71
- # Create a new key
72
- npm run keys create <name>
103
+ agentgate can generate an [AgentSkill](https://docs.openclaw.ai/tools/skills) compatible file:
73
104
 
74
- # Delete a key
75
- npm run keys delete <id>
105
+ ```bash
106
+ curl -H "Authorization: Bearer rms_your_key" \
107
+ https://your-server.com/api/skill > SKILL.md
76
108
  ```
77
109
 
110
+
111
+
112
+ ## API Key Management
113
+
114
+ Create and manage API keys for your agents in the admin UI at `/ui/keys`.
115
+
116
+
78
117
  ## Usage
79
118
 
80
119
  Agents make requests with the API key in the Authorization header:
@@ -207,10 +246,11 @@ BASE_URL=https://agentgate.yourdomain.com npm start
207
246
  ## TODO
208
247
 
209
248
  - [ ] Per-agent service access control - different agents can access different services/accounts
210
-
211
249
  - [ ] Fine-grained endpoint control per service - whitelist/blacklist individual endpoints (even for read operations)
212
250
 
213
251
  ## License
214
252
 
215
253
  ISC
216
254
 
255
+
256
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentgate",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "type": "module",
5
5
  "description": "API gateway for AI agents with human-in-the-loop write approval",
6
6
  "main": "src/index.js",
package/src/cli.js CHANGED
@@ -12,9 +12,10 @@ function printUsage() {
12
12
  console.log(`
13
13
  agentgate - API gateway for AI agents with human-in-the-loop write approval
14
14
 
15
- Usage: agentgate <command> [options]
15
+ Usage: agentgate [command] [options]
16
16
 
17
17
  Commands:
18
+ (default) Start the agentgate server
18
19
  start Start the agentgate server
19
20
  keys list List all API keys
20
21
  keys create <name> Create a new API key
@@ -25,28 +26,36 @@ Options:
25
26
  -h, --help Show this help message
26
27
 
27
28
  Examples:
28
- agentgate start
29
+ agentgate
29
30
  agentgate start --port 8080
30
31
  agentgate keys create my-agent
31
32
  agentgate keys list
32
33
  `);
33
34
  }
34
35
 
36
+ async function startServer(args) {
37
+ // Parse port from args
38
+ const portIdx = args.findIndex(a => a === '-p' || a === '--port');
39
+ if (portIdx !== -1 && args[portIdx + 1]) {
40
+ process.env.PORT = args[portIdx + 1];
41
+ }
42
+
43
+ // Import and run the server
44
+ await import('./index.js');
45
+ }
46
+
35
47
  async function main() {
36
- if (!command || command === '-h' || command === '--help') {
48
+ if (command === '-h' || command === '--help') {
37
49
  printUsage();
38
50
  process.exit(0);
39
51
  }
40
52
 
41
- if (command === 'start') {
42
- // Parse port from args
43
- const portIdx = args.findIndex(a => a === '-p' || a === '--port');
44
- if (portIdx !== -1 && args[portIdx + 1]) {
45
- process.env.PORT = args[portIdx + 1];
46
- }
47
-
48
- // Import and run the server
49
- await import('./index.js');
53
+ // Default behavior: start the server
54
+ if (!command || command === 'start') {
55
+ await startServer(args);
56
+ } else if (command === '-p' || command === '--port') {
57
+ // Handle case where user runs: agentgate -p 8080
58
+ await startServer([command, ...args]);
50
59
  } else if (command === 'keys') {
51
60
  const subcommand = args[0];
52
61
  const { createApiKey, listApiKeys, deleteApiKey } = await import('./lib/db.js');