fluff
Some checks failed
CI - Multi-Platform Native / Build Summary (push) Has been cancelled
CI - Multi-Platform Native / Build iOS (RSSuper) (push) Has been cancelled
CI - Multi-Platform Native / Build macOS (push) Has been cancelled
CI - Multi-Platform Native / Build Android (push) Has been cancelled
CI - Multi-Platform Native / Build Linux (push) Has been cancelled
Some checks failed
CI - Multi-Platform Native / Build Summary (push) Has been cancelled
CI - Multi-Platform Native / Build iOS (RSSuper) (push) Has been cancelled
CI - Multi-Platform Native / Build macOS (push) Has been cancelled
CI - Multi-Platform Native / Build Android (push) Has been cancelled
CI - Multi-Platform Native / Build Linux (push) Has been cancelled
This commit is contained in:
@@ -1,65 +0,0 @@
|
|||||||
const http = require('http');
|
|
||||||
|
|
||||||
const agentId = process.env.PAPERCLIP_AGENT_ID;
|
|
||||||
const apiKey = process.env.PAPERCLIP_API_KEY;
|
|
||||||
const apiUrl = process.env.PAPERCLIP_API_URL;
|
|
||||||
const runId = process.env.PAPERCLIP_RUN_ID;
|
|
||||||
|
|
||||||
console.log('Agent ID:', agentId);
|
|
||||||
console.log('API URL:', apiUrl);
|
|
||||||
console.log('Run ID:', runId);
|
|
||||||
|
|
||||||
if (!apiKey || !apiUrl) {
|
|
||||||
console.error('Missing environment variables');
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
function fetch(url, options = {}) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
const request = http.request({
|
|
||||||
hostname: new URL(url).hostname,
|
|
||||||
port: new URL(url).port,
|
|
||||||
path: new URL(url).pathname,
|
|
||||||
method: options.method || 'GET',
|
|
||||||
headers: {
|
|
||||||
'Authorization': `Bearer ${apiKey}`,
|
|
||||||
'X-Paperclip-Run-Id': runId,
|
|
||||||
...options.headers
|
|
||||||
}
|
|
||||||
}, (response) => {
|
|
||||||
let data = '';
|
|
||||||
response.on('data', chunk => data += chunk);
|
|
||||||
response.on('end', () => {
|
|
||||||
try {
|
|
||||||
resolve(JSON.parse(data));
|
|
||||||
} catch {
|
|
||||||
resolve(data);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
request.on('error', reject);
|
|
||||||
request.end();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async function main() {
|
|
||||||
console.log('\n=== FETCHING AGENT IDENTITY ===\n');
|
|
||||||
|
|
||||||
try {
|
|
||||||
const identity = await fetch(`${apiUrl}/api/agents/me`);
|
|
||||||
console.log(JSON.stringify(identity, null, 2));
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching identity:', err.message);
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('\n=== FETCHING INBOX-LITE ===\n');
|
|
||||||
|
|
||||||
try {
|
|
||||||
const inbox = await fetch(`${apiUrl}/api/agents/${agentId}/inbox-lite`);
|
|
||||||
console.log(JSON.stringify(inbox, null, 2));
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching inbox:', err.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
main();
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
import urllib.request
|
|
||||||
import json
|
|
||||||
import os
|
|
||||||
|
|
||||||
agentId = os.environ.get('PAPERCLIP_AGENT_ID', 'unknown')
|
|
||||||
apiKey = os.environ.get('PAPERCLIP_API_KEY', '')
|
|
||||||
apiUrl = os.environ.get('PAPERCLIP_API_URL', '')
|
|
||||||
runId = os.environ.get('PAPERCLIP_RUN_ID', '')
|
|
||||||
|
|
||||||
print(f'Agent ID: {agentId}')
|
|
||||||
print(f'API URL: {apiUrl}')
|
|
||||||
print(f'Run ID: {runId}')
|
|
||||||
|
|
||||||
if not apiKey or not apiUrl:
|
|
||||||
print('Missing environment variables')
|
|
||||||
exit(1)
|
|
||||||
|
|
||||||
def fetch(url, method='GET', headers=None):
|
|
||||||
req = urllib.request.Request(url, method=method)
|
|
||||||
if headers:
|
|
||||||
for k, v in headers.items():
|
|
||||||
req.add_header(k, str(v))
|
|
||||||
try:
|
|
||||||
with urllib.request.urlopen(req) as resp:
|
|
||||||
return json.loads(resp.read().decode())
|
|
||||||
except Exception as e:
|
|
||||||
print(f'Error: {e}')
|
|
||||||
return None
|
|
||||||
|
|
||||||
print('\n=== FETCHING AGENT IDENTITY ===\n')
|
|
||||||
identity = fetch(f'{apiUrl}/api/agents/me')
|
|
||||||
print(json.dumps(identity or {}, indent=2))
|
|
||||||
|
|
||||||
print('\n=== FETCHING INBOX-LITE ===\n')
|
|
||||||
inbox = fetch(f'{apiUrl}/api/agents/{agentId}/inbox-lite')
|
|
||||||
print(json.dumps(inbox or {}, indent=2))
|
|
||||||
Reference in New Issue
Block a user