agentgate 0.1.6 → 0.1.7
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 +2 -0
- package/package.json +1 -1
- package/src/index.js +27 -1
- package/src/lib/queueExecutor.js +6 -1
package/README.md
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
**Read requests** (GET) execute immediately. **Write requests** (POST/PUT/DELETE) are queued for human approval before execution.
|
|
10
10
|
|
|
11
|
+
📖 **[Read the blog post: How to Let AI Run Your Life Without Giving It Your Keys](https://monteslu.com/blog/ai-running-your-life)**
|
|
12
|
+
|
|
11
13
|
## How It Works
|
|
12
14
|
|
|
13
15
|
```mermaid
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -146,11 +146,22 @@ app.get('/api/readme', apiKeyAuth, (req, res) => {
|
|
|
146
146
|
method: 'POST',
|
|
147
147
|
path: '/api/queue/{service}/{accountName}/submit',
|
|
148
148
|
body: {
|
|
149
|
-
requests: '[{ method: "POST"|"PUT"|"PATCH"|"DELETE", path: "/api/path", body?: {}, headers?: {} }, ...]',
|
|
149
|
+
requests: '[{ method: "POST"|"PUT"|"PATCH"|"DELETE", path: "/api/path", body?: {}, headers?: {}, binaryBase64?: boolean }, ...]',
|
|
150
150
|
comment: 'Required: Explain what you are trying to do and why'
|
|
151
151
|
},
|
|
152
152
|
response: '{ id: "queue_entry_id", status: "pending" }'
|
|
153
153
|
},
|
|
154
|
+
binaryUploads: {
|
|
155
|
+
description: 'For binary data uploads (images, files), set binaryBase64: true and provide base64-encoded data in body',
|
|
156
|
+
example: {
|
|
157
|
+
method: 'POST',
|
|
158
|
+
path: 'com.atproto.repo.uploadBlob',
|
|
159
|
+
binaryBase64: true,
|
|
160
|
+
headers: { 'Content-Type': 'image/jpeg' },
|
|
161
|
+
body: '<base64 encoded image data>'
|
|
162
|
+
},
|
|
163
|
+
note: 'The executor will decode base64 to binary before sending'
|
|
164
|
+
},
|
|
154
165
|
checkStatus: {
|
|
155
166
|
method: 'GET',
|
|
156
167
|
path: '/api/queue/{service}/{accountName}/status/{id}',
|
|
@@ -298,11 +309,26 @@ Write operations (POST/PUT/DELETE) must go through the queue:
|
|
|
298
309
|
|
|
299
310
|
3. **Check response**: \`pending\`, \`completed\`, \`failed\`, or \`rejected\` (with reason)
|
|
300
311
|
|
|
312
|
+
## Binary Uploads
|
|
313
|
+
|
|
314
|
+
For binary data (images, files), set \`binaryBase64: true\` in the request:
|
|
315
|
+
|
|
316
|
+
\`\`\`json
|
|
317
|
+
{
|
|
318
|
+
"method": "POST",
|
|
319
|
+
"path": "com.atproto.repo.uploadBlob",
|
|
320
|
+
"binaryBase64": true,
|
|
321
|
+
"headers": { "Content-Type": "image/jpeg" },
|
|
322
|
+
"body": "<base64 encoded data>"
|
|
323
|
+
}
|
|
324
|
+
\`\`\`
|
|
325
|
+
|
|
301
326
|
## Important Notes
|
|
302
327
|
|
|
303
328
|
- Always include a clear comment explaining your intent
|
|
304
329
|
- Include markdown links to relevant resources (issues, PRs, docs)
|
|
305
330
|
- Be patient - approval requires human action
|
|
331
|
+
- For binary uploads, encode data as base64 and set binaryBase64: true
|
|
306
332
|
|
|
307
333
|
${writeGuidelines.length > 0 ? '## Service-Specific Guidelines\n\n' + writeGuidelines.join('\n\n') : ''}
|
|
308
334
|
|
package/src/lib/queueExecutor.js
CHANGED
|
@@ -316,7 +316,12 @@ export async function executeQueueEntry(entry) {
|
|
|
316
316
|
};
|
|
317
317
|
|
|
318
318
|
if (req.body && ['POST', 'PUT', 'PATCH'].includes(req.method.toUpperCase())) {
|
|
319
|
-
|
|
319
|
+
if (req.binaryBase64) {
|
|
320
|
+
// Binary data encoded as base64 (for blob uploads)
|
|
321
|
+
fetchOptions.body = Buffer.from(req.body, 'base64');
|
|
322
|
+
} else {
|
|
323
|
+
fetchOptions.body = typeof req.body === 'string' ? req.body : JSON.stringify(req.body);
|
|
324
|
+
}
|
|
320
325
|
}
|
|
321
326
|
|
|
322
327
|
const response = await fetch(url, fetchOptions);
|