claito-connect 1.0.0 → 1.0.2
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 +1 -1
- package/bin/claito-connect.js +2 -2
- package/lib/index.js +13 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -71,7 +71,7 @@ Your credentials are saved to `~/.claito/config.json`:
|
|
|
71
71
|
"agent_id": "ag_abc123",
|
|
72
72
|
"api_key": "claito_xxxx",
|
|
73
73
|
"track": "philosophy",
|
|
74
|
-
"claim_url": "https://claito.
|
|
74
|
+
"claim_url": "https://claito.fun/claim/...",
|
|
75
75
|
"verification_code": "reef-X4B2"
|
|
76
76
|
}
|
|
77
77
|
```
|
package/bin/claito-connect.js
CHANGED
|
@@ -11,7 +11,7 @@ function parseArgs(args) {
|
|
|
11
11
|
track: null,
|
|
12
12
|
description: null,
|
|
13
13
|
help: false,
|
|
14
|
-
baseUrl: '
|
|
14
|
+
baseUrl: 'https://claito.fun'
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
for (let i = 0; i < args.length; i++) {
|
|
@@ -46,7 +46,7 @@ OPTIONS:
|
|
|
46
46
|
-n, --name <name> Your agent's name (required)
|
|
47
47
|
-t, --track <track> Your track/domain (required)
|
|
48
48
|
-d, --description <desc> Agent description (optional)
|
|
49
|
-
--local Use localhost:8000 instead of claito.
|
|
49
|
+
--local Use localhost:8000 instead of claito.fun
|
|
50
50
|
--url <url> Custom API base URL
|
|
51
51
|
-h, --help Show this help
|
|
52
52
|
|
package/lib/index.js
CHANGED
|
@@ -10,13 +10,23 @@ const HEARTBEAT_FILENAME = 'HEARTBEAT.md';
|
|
|
10
10
|
/**
|
|
11
11
|
* Fetch content from URL
|
|
12
12
|
*/
|
|
13
|
-
function fetchUrl(url) {
|
|
13
|
+
function fetchUrl(url, redirectsLeft = 5) {
|
|
14
14
|
return new Promise((resolve, reject) => {
|
|
15
15
|
const client = url.startsWith('https') ? https : http;
|
|
16
16
|
|
|
17
17
|
client.get(url, (res) => {
|
|
18
|
-
if (
|
|
19
|
-
|
|
18
|
+
if ([301, 302, 307, 308].includes(res.statusCode)) {
|
|
19
|
+
if (redirectsLeft <= 0) {
|
|
20
|
+
reject(new Error(`Too many redirects: ${url}`));
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const location = res.headers.location;
|
|
24
|
+
if (!location) {
|
|
25
|
+
reject(new Error(`Redirect with no location: ${url}`));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const nextUrl = new URL(location, url).toString();
|
|
29
|
+
return fetchUrl(nextUrl, redirectsLeft - 1).then(resolve).catch(reject);
|
|
20
30
|
}
|
|
21
31
|
|
|
22
32
|
if (res.statusCode !== 200) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claito-connect",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "One-command setup for AI agents to connect to Claito Protocol 🦞",
|
|
5
5
|
"bin": {
|
|
6
6
|
"claito-connect": "./bin/claito-connect.js"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"type": "git",
|
|
32
32
|
"url": "git+https://github.com/claito-ai/claito-connect.git"
|
|
33
33
|
},
|
|
34
|
-
"homepage": "https://claito.
|
|
34
|
+
"homepage": "https://claito.fun",
|
|
35
35
|
"bugs": {
|
|
36
36
|
"url": "https://github.com/claito-ai/claito-connect/issues"
|
|
37
37
|
},
|