@gareth1954/agentlink 0.0.0-stage → 0.1.0
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 +20 -2
- package/agentlink.mjs +72 -0
- package/package.json +25 -4
package/README.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
-
#
|
|
1
|
+
# AgentLink
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A batch write timed out. Use AgentLink to check which records already landed and which need a lookup before you retry.
|
|
4
|
+
|
|
5
|
+
This CLI sends requests to the free, hosted AgentLink API. It reports a recovery decision based on the evidence you supply. Use synthetic or non-sensitive inputs. The CLI performs no writes, retries, or payments.
|
|
6
|
+
|
|
7
|
+
Requires Node.js 22 or later.
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npx @gareth1954/agentlink discover
|
|
11
|
+
npx @gareth1954/agentlink example
|
|
12
|
+
npx @gareth1954/agentlink recover evidence.json
|
|
13
|
+
npx @gareth1954/agentlink recover - < evidence.json
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Results are JSON on stdout. Exit codes are 0 for a returned result, 1 for a request or input error, and 2 for incorrect invocation. A successful request may still report operations that need further evidence.
|
|
17
|
+
|
|
18
|
+
- [Example evidence](https://agentlink.roarleo.chatgpt.site/recovery-example-request.json)
|
|
19
|
+
- [Agent guide](https://agentlink.roarleo.chatgpt.site/llms.txt)
|
|
20
|
+
- [OpenAPI schema](https://agentlink.roarleo.chatgpt.site/openapi.json)
|
|
21
|
+
- [MCP over Streamable HTTP](https://agentlink.roarleo.chatgpt.site/v1/mcp)
|
package/agentlink.mjs
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { readFile } from "node:fs/promises";
|
|
4
|
+
|
|
5
|
+
const origin = "https://agentlink.roarleo.chatgpt.site";
|
|
6
|
+
const usage = `Usage: agentlink <discover | example | recover <file|->>
|
|
7
|
+
|
|
8
|
+
discover Print service and payment availability as JSON.
|
|
9
|
+
example Run the public, synthetic batch recovery example.
|
|
10
|
+
recover <file> Check caller-supplied evidence from a JSON file or stdin (-).`;
|
|
11
|
+
|
|
12
|
+
async function request(path, body) {
|
|
13
|
+
const options = {
|
|
14
|
+
headers: { Accept: "application/json" },
|
|
15
|
+
signal: AbortSignal.timeout(15_000),
|
|
16
|
+
redirect: "error",
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
if (body !== undefined) {
|
|
20
|
+
options.method = "POST";
|
|
21
|
+
options.headers["Content-Type"] = "application/json";
|
|
22
|
+
options.body = JSON.stringify(body);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const response = await fetch(origin + path, options);
|
|
26
|
+
const result = await response.json();
|
|
27
|
+
if (!response.ok) {
|
|
28
|
+
const code = typeof result?.code === "string" ? " " + result.code : "";
|
|
29
|
+
throw new Error(`AgentLink returned HTTP ${response.status}${code}.`);
|
|
30
|
+
}
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async function loadInput(source) {
|
|
35
|
+
if (source !== "-") return JSON.parse(await readFile(source, "utf8"));
|
|
36
|
+
let input = "";
|
|
37
|
+
process.stdin.setEncoding("utf8");
|
|
38
|
+
for await (const chunk of process.stdin) input += chunk;
|
|
39
|
+
return JSON.parse(input);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function run(args) {
|
|
43
|
+
const [command, source] = args;
|
|
44
|
+
if (args.length === 1 && (command === "--help" || command === "-h")) {
|
|
45
|
+
process.stdout.write(usage + "\n");
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
let result;
|
|
50
|
+
if (command === "discover" && args.length === 1) {
|
|
51
|
+
result = await request("/");
|
|
52
|
+
} else if (command === "example" && args.length === 1) {
|
|
53
|
+
const example = await request("/recovery-example-request.json");
|
|
54
|
+
result = await request("/v1/check-batch-recovery", example);
|
|
55
|
+
} else if (command === "recover" && args.length === 2 && source) {
|
|
56
|
+
result = await request("/v1/check-batch-recovery", await loadInput(source));
|
|
57
|
+
} else {
|
|
58
|
+
process.stderr.write(usage + "\n");
|
|
59
|
+
process.exitCode = 2;
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
process.stdout.write(JSON.stringify(result, null, 2) + "\n");
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
try {
|
|
67
|
+
await run(process.argv.slice(2));
|
|
68
|
+
} catch (error) {
|
|
69
|
+
const message = error instanceof SyntaxError ? "Could not read JSON." : error.message;
|
|
70
|
+
process.stderr.write(`agentlink: ${message}\n`);
|
|
71
|
+
process.exitCode = 1;
|
|
72
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gareth1954/agentlink",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Check an interrupted batch and identify which writes need a lookup before retrying.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"agentlink": "./agentlink.mjs"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"agentlink.mjs"
|
|
11
|
+
],
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=22"
|
|
14
|
+
},
|
|
15
|
+
"license": "UNLICENSED",
|
|
16
|
+
"homepage": "https://agentlink.roarleo.chatgpt.site/llms.txt",
|
|
17
|
+
"keywords": [
|
|
18
|
+
"agentlink",
|
|
19
|
+
"mcp",
|
|
20
|
+
"batch-recovery",
|
|
21
|
+
"tool-verification"
|
|
22
|
+
],
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public",
|
|
25
|
+
"registry": "https://registry.npmjs.org/"
|
|
26
|
+
}
|
|
27
|
+
}
|