@axiomworks/agentreader 0.0.0-stage → 1.6.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/LICENSE +9 -0
- package/README.md +106 -2
- package/dist/index.d.ts +151 -0
- package/dist/index.js +207 -0
- package/dist/index.js.map +1 -0
- package/package.json +78 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AgentReader
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,107 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @axiomworks/agentreader
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Typed JS/TS SDK for **Axiom Works AgentReader** — pay-per-call tools for AI agents.
|
|
4
|
+
|
|
5
|
+
> Not affiliated with other products named “AgentReader”. This is **Axiom Works AgentReader** at [api.axiomworks.co.uk](https://api.axiomworks.co.uk).
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i @axiomworks/agentreader
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { createClient } from "@axiomworks/agentreader";
|
|
13
|
+
|
|
14
|
+
// Preview mode (no key): free truncated samples
|
|
15
|
+
const preview = createClient();
|
|
16
|
+
console.log(await preview.checkDomain({ domain: "example.com" }));
|
|
17
|
+
|
|
18
|
+
// Paid mode: auto x402 USDC on Base
|
|
19
|
+
const client = createClient({ privateKey: process.env.AGENTREADER_PRIVATE_KEY });
|
|
20
|
+
const report = await client.ukCompanyLite({ number: "00445790" });
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Also reads `AGENTREADER_PRIVATE_KEY` / `EVM_PRIVATE_KEY` / `PRIVATE_KEY` from the environment when `privateKey` is omitted.
|
|
24
|
+
|
|
25
|
+
- **API:** https://api.axiomworks.co.uk
|
|
26
|
+
- **MCP (stdio npm):** [`@axiomworks/agentreader-mcp`](https://www.npmjs.com/package/@axiomworks/agentreader-mcp) — `npx -y @axiomworks/agentreader-mcp`
|
|
27
|
+
- **Remote MCP:** https://api.axiomworks.co.uk/mcp
|
|
28
|
+
- **Dashboard:** https://api.axiomworks.co.uk/dashboard
|
|
29
|
+
- **Landing:** https://grokbot1233.github.io/agentreader/
|
|
30
|
+
- **Repo:** https://github.com/grokbot1233/agentreader
|
|
31
|
+
|
|
32
|
+
## x402 payments
|
|
33
|
+
|
|
34
|
+
Paid routes return HTTP 402. With a private key, the SDK wraps `fetch` via [`@x402/fetch`](https://www.npmjs.com/package/@x402/fetch) + `ExactEvmScheme` (`@x402/evm`) and settles **USDC on Base** (`eip155:8453`) automatically (EIP-3009 — no ETH gas for the payer).
|
|
35
|
+
|
|
36
|
+
Without a key, GET methods append `preview=1` (free truncated JSON, 8/IP/day). A paid response without settlement throws `PaymentRequiredError` with the payment requirements attached.
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import { createClient, PaymentRequiredError } from "@axiomworks/agentreader";
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
await createClient().ukCompany({ number: "00445790" }); // preview unless key set
|
|
43
|
+
} catch (e) {
|
|
44
|
+
if (e instanceof PaymentRequiredError) console.log(e.paymentRequired);
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Methods (USDC prices)
|
|
49
|
+
|
|
50
|
+
| Method | Route | Price |
|
|
51
|
+
|---|---|---|
|
|
52
|
+
| `readUrl({ url })` | `/read` | $0.002 |
|
|
53
|
+
| `extractLinks({ url })` | `/links` | $0.001 |
|
|
54
|
+
| `checkDomain({ domain })` | `/check` | $0.001 |
|
|
55
|
+
| `companyResearch({ domain })` | `/company` | $0.25 |
|
|
56
|
+
| `ukCompany({ number?, name? })` | `/uk-company` | $0.50 |
|
|
57
|
+
| `ukCompanyLite({ number?, name? })` | `/uk-company-lite` | $0.05 |
|
|
58
|
+
| `companyFull({ domain })` | `/company-full` | $0.65 |
|
|
59
|
+
| `ukCharity({ number?, name? })` | `/uk-charity` | $0.05 |
|
|
60
|
+
| `ukCharityFull({ number?, name? })` | `/uk-charity-full` | $0.25 |
|
|
61
|
+
| `convertDocument({ url, format? })` | `/convert` | $0.03 |
|
|
62
|
+
| `createMonitor({ url, webhook, … })` | `POST /monitor` | $1.00 / 30d |
|
|
63
|
+
| `walletBalances({ address, chain? })` | `/wallet` | $0.003 |
|
|
64
|
+
| `txStatus({ hash, chain? })` | `/tx` | $0.003 |
|
|
65
|
+
| `tokenCheck({ address, chain? })` | `/token-check` | $0.01 |
|
|
66
|
+
| `fxRates({ base?, symbols?, … })` | `/fx` | $0.002 |
|
|
67
|
+
| `ensLookup({ name?, address? })` | `/ens` | $0.002 |
|
|
68
|
+
| `tokenMetadata({ address, chain? })` | `/token` | $0.001 |
|
|
69
|
+
| `tokenAllowance({ token, owner, spender })` | `/allowance` | $0.002 |
|
|
70
|
+
| `contractInfo({ address, chain? })` | `/contract` | $0.003 |
|
|
71
|
+
| `gasFees({ chain? })` | `/gas` | $0.001 |
|
|
72
|
+
| `blockLookup({ number?, timestamp? })` | `/block` | $0.001 |
|
|
73
|
+
| `nftLookup({ contract, token_id, chain? })` | `/nft` | $0.002 |
|
|
74
|
+
| `webSearch({ q })` | `/search` | $0.003 |
|
|
75
|
+
| `ukPropertyPrices({ postcode })` | `/uk-property` | $0.01 |
|
|
76
|
+
| `ukAreaProfile({ postcode })` | `/uk-area` | $0.005 |
|
|
77
|
+
| `pricing()` | `/.well-known/x402` | free |
|
|
78
|
+
|
|
79
|
+
Pass `{ preview: true }` / `{ preview: false }` on any call to override the default.
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
const client = createClient({ privateKey: "0x…" });
|
|
83
|
+
// Force a free truncated sample even with a key:
|
|
84
|
+
await client.companyResearch({ domain: "stripe.com" }, { preview: true });
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## MCP for Claude Desktop / Cursor
|
|
88
|
+
|
|
89
|
+
Prefer the companion package:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
npx -y @axiomworks/agentreader-mcp
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"mcpServers": {
|
|
98
|
+
"agentreader": {
|
|
99
|
+
"command": "npx",
|
|
100
|
+
"args": ["-y", "@axiomworks/agentreader-mcp"],
|
|
101
|
+
"env": { "AGENTREADER_PRIVATE_KEY": "0x…" }
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
MIT © Axiom Works · info@axiomworks.co.uk
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
type Chain = "base" | "ethereum" | "arbitrum" | "optimism" | "polygon";
|
|
2
|
+
type ClientOptions = {
|
|
3
|
+
/** EVM private key (0x… or bare hex). Enables auto x402 payment on Base. */
|
|
4
|
+
privateKey?: string;
|
|
5
|
+
/** API origin. Default https://api.axiomworks.co.uk */
|
|
6
|
+
origin?: string;
|
|
7
|
+
/**
|
|
8
|
+
* When true (default if no privateKey), append preview=1 on GET paid routes
|
|
9
|
+
* for free truncated samples (8/IP/day). Ignored when paying.
|
|
10
|
+
*/
|
|
11
|
+
preview?: boolean;
|
|
12
|
+
/** Optional fetch implementation (defaults to global fetch, wrapped with x402 when paying). */
|
|
13
|
+
fetch?: typeof fetch;
|
|
14
|
+
/** User-Agent suffix */
|
|
15
|
+
userAgent?: string;
|
|
16
|
+
};
|
|
17
|
+
type RequestOpts = {
|
|
18
|
+
/** Force preview=1 even when a key is set (still free truncated). */
|
|
19
|
+
preview?: boolean;
|
|
20
|
+
/** Extra query params */
|
|
21
|
+
query?: Record<string, string | number | boolean | undefined | null>;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
declare class PaymentRequiredError extends Error {
|
|
25
|
+
readonly status = 402;
|
|
26
|
+
readonly paymentRequired: unknown;
|
|
27
|
+
readonly body: unknown;
|
|
28
|
+
readonly url: string;
|
|
29
|
+
constructor(url: string, paymentRequired: unknown, body: unknown);
|
|
30
|
+
}
|
|
31
|
+
declare class AgentReaderClient {
|
|
32
|
+
readonly origin: string;
|
|
33
|
+
readonly paying: boolean;
|
|
34
|
+
private readonly fetchFn;
|
|
35
|
+
private readonly defaultPreview;
|
|
36
|
+
private readonly ua;
|
|
37
|
+
constructor(opts?: ClientOptions);
|
|
38
|
+
private request;
|
|
39
|
+
private get;
|
|
40
|
+
/** Free: x402 catalog / prices */
|
|
41
|
+
pricing(opts?: RequestOpts): Promise<any>;
|
|
42
|
+
readUrl(input: {
|
|
43
|
+
url: string;
|
|
44
|
+
}, opts?: RequestOpts): Promise<any>;
|
|
45
|
+
extractLinks(input: {
|
|
46
|
+
url: string;
|
|
47
|
+
}, opts?: RequestOpts): Promise<any>;
|
|
48
|
+
checkDomain(input: {
|
|
49
|
+
domain: string;
|
|
50
|
+
}, opts?: RequestOpts): Promise<any>;
|
|
51
|
+
companyResearch(input: {
|
|
52
|
+
domain: string;
|
|
53
|
+
}, opts?: RequestOpts): Promise<any>;
|
|
54
|
+
ukCompany(input: {
|
|
55
|
+
number?: string;
|
|
56
|
+
name?: string;
|
|
57
|
+
}, opts?: RequestOpts): Promise<any>;
|
|
58
|
+
ukCompanyLite(input: {
|
|
59
|
+
number?: string;
|
|
60
|
+
name?: string;
|
|
61
|
+
}, opts?: RequestOpts): Promise<any>;
|
|
62
|
+
companyFull(input: {
|
|
63
|
+
domain: string;
|
|
64
|
+
}, opts?: RequestOpts): Promise<any>;
|
|
65
|
+
convertDocument(input: {
|
|
66
|
+
url: string;
|
|
67
|
+
format?: "markdown" | "text";
|
|
68
|
+
}, opts?: RequestOpts): Promise<any>;
|
|
69
|
+
createMonitor(input: {
|
|
70
|
+
url: string;
|
|
71
|
+
webhook: string;
|
|
72
|
+
selector?: string;
|
|
73
|
+
keyword?: string;
|
|
74
|
+
}, opts?: RequestOpts): Promise<any>;
|
|
75
|
+
walletBalances(input: {
|
|
76
|
+
address: string;
|
|
77
|
+
chain?: Chain;
|
|
78
|
+
tokens?: string;
|
|
79
|
+
}, opts?: RequestOpts): Promise<any>;
|
|
80
|
+
txStatus(input: {
|
|
81
|
+
hash: string;
|
|
82
|
+
chain?: Chain;
|
|
83
|
+
}, opts?: RequestOpts): Promise<any>;
|
|
84
|
+
tokenCheck(input: {
|
|
85
|
+
address: string;
|
|
86
|
+
chain?: Chain;
|
|
87
|
+
}, opts?: RequestOpts): Promise<any>;
|
|
88
|
+
fxRates(input?: {
|
|
89
|
+
base?: string;
|
|
90
|
+
symbols?: string;
|
|
91
|
+
date?: string;
|
|
92
|
+
amount?: string;
|
|
93
|
+
}, opts?: RequestOpts): Promise<any>;
|
|
94
|
+
ensLookup(input: {
|
|
95
|
+
name?: string;
|
|
96
|
+
address?: string;
|
|
97
|
+
}, opts?: RequestOpts): Promise<any>;
|
|
98
|
+
tokenMetadata(input: {
|
|
99
|
+
address: string;
|
|
100
|
+
chain?: Chain;
|
|
101
|
+
}, opts?: RequestOpts): Promise<any>;
|
|
102
|
+
tokenAllowance(input: {
|
|
103
|
+
token: string;
|
|
104
|
+
owner: string;
|
|
105
|
+
spender: string;
|
|
106
|
+
chain?: Chain;
|
|
107
|
+
}, opts?: RequestOpts): Promise<any>;
|
|
108
|
+
contractInfo(input: {
|
|
109
|
+
address: string;
|
|
110
|
+
chain?: Chain;
|
|
111
|
+
}, opts?: RequestOpts): Promise<any>;
|
|
112
|
+
gasFees(input?: {
|
|
113
|
+
chain?: Chain;
|
|
114
|
+
}, opts?: RequestOpts): Promise<any>;
|
|
115
|
+
blockLookup(input?: {
|
|
116
|
+
number?: string;
|
|
117
|
+
timestamp?: string;
|
|
118
|
+
chain?: Chain;
|
|
119
|
+
}, opts?: RequestOpts): Promise<any>;
|
|
120
|
+
nftLookup(input: {
|
|
121
|
+
contract: string;
|
|
122
|
+
token_id: string;
|
|
123
|
+
chain?: Chain;
|
|
124
|
+
}, opts?: RequestOpts): Promise<any>;
|
|
125
|
+
webSearch(input: {
|
|
126
|
+
q: string;
|
|
127
|
+
sources?: string;
|
|
128
|
+
limit?: string | number;
|
|
129
|
+
}, opts?: RequestOpts): Promise<any>;
|
|
130
|
+
ukPropertyPrices(input: {
|
|
131
|
+
postcode: string;
|
|
132
|
+
radius?: string;
|
|
133
|
+
}, opts?: RequestOpts): Promise<any>;
|
|
134
|
+
ukAreaProfile(input: {
|
|
135
|
+
postcode: string;
|
|
136
|
+
}, opts?: RequestOpts): Promise<any>;
|
|
137
|
+
ukCharity(input: {
|
|
138
|
+
number?: string;
|
|
139
|
+
name?: string;
|
|
140
|
+
suffix?: string;
|
|
141
|
+
}, opts?: RequestOpts): Promise<any>;
|
|
142
|
+
ukCharityFull(input: {
|
|
143
|
+
number?: string;
|
|
144
|
+
name?: string;
|
|
145
|
+
suffix?: string;
|
|
146
|
+
}, opts?: RequestOpts): Promise<any>;
|
|
147
|
+
}
|
|
148
|
+
/** Create a typed AgentReader client. Pass privateKey (or set AGENTREADER_PRIVATE_KEY) to auto-pay. */
|
|
149
|
+
declare function createClient(opts?: ClientOptions): AgentReaderClient;
|
|
150
|
+
|
|
151
|
+
export { AgentReaderClient, type Chain, type ClientOptions, PaymentRequiredError, type RequestOpts, createClient };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
// src/client.ts
|
|
2
|
+
import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
|
|
3
|
+
import { ExactEvmScheme } from "@x402/evm/exact/client";
|
|
4
|
+
import { privateKeyToAccount } from "viem/accounts";
|
|
5
|
+
var DEFAULT_ORIGIN = "https://api.axiomworks.co.uk";
|
|
6
|
+
var VERSION = "1.6.0";
|
|
7
|
+
function normalizeKey(raw) {
|
|
8
|
+
if (!raw) return void 0;
|
|
9
|
+
const key = raw.startsWith("0x") ? raw : `0x${raw}`;
|
|
10
|
+
if (!/^0x[0-9a-fA-F]{64}$/.test(key)) {
|
|
11
|
+
throw new Error("privateKey must be a 32-byte hex string (optional 0x prefix)");
|
|
12
|
+
}
|
|
13
|
+
return key;
|
|
14
|
+
}
|
|
15
|
+
function qs(params) {
|
|
16
|
+
const sp = new URLSearchParams();
|
|
17
|
+
for (const [k, v] of Object.entries(params)) {
|
|
18
|
+
if (v == null || v === "") continue;
|
|
19
|
+
sp.set(k, String(v));
|
|
20
|
+
}
|
|
21
|
+
return sp.toString();
|
|
22
|
+
}
|
|
23
|
+
var PaymentRequiredError = class extends Error {
|
|
24
|
+
status = 402;
|
|
25
|
+
paymentRequired;
|
|
26
|
+
body;
|
|
27
|
+
url;
|
|
28
|
+
constructor(url, paymentRequired, body) {
|
|
29
|
+
super("Payment required (x402). Pass privateKey to createClient or fund/retry with @x402/fetch.");
|
|
30
|
+
this.name = "PaymentRequiredError";
|
|
31
|
+
this.url = url;
|
|
32
|
+
this.paymentRequired = paymentRequired;
|
|
33
|
+
this.body = body;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var AgentReaderClient = class {
|
|
37
|
+
origin;
|
|
38
|
+
paying;
|
|
39
|
+
fetchFn;
|
|
40
|
+
defaultPreview;
|
|
41
|
+
ua;
|
|
42
|
+
constructor(opts = {}) {
|
|
43
|
+
this.origin = (opts.origin || DEFAULT_ORIGIN).replace(/\/$/, "");
|
|
44
|
+
const key = normalizeKey(
|
|
45
|
+
opts.privateKey || process.env.AGENTREADER_PRIVATE_KEY || process.env.EVM_PRIVATE_KEY || process.env.PRIVATE_KEY
|
|
46
|
+
);
|
|
47
|
+
this.paying = !!key;
|
|
48
|
+
this.defaultPreview = opts.preview ?? !this.paying;
|
|
49
|
+
this.ua = opts.userAgent || `axiomworks-agentreader-sdk/${VERSION}`;
|
|
50
|
+
if (key) {
|
|
51
|
+
const account = privateKeyToAccount(key);
|
|
52
|
+
const client = new x402Client().register("eip155:8453", new ExactEvmScheme(account));
|
|
53
|
+
const base = opts.fetch || globalThis.fetch.bind(globalThis);
|
|
54
|
+
this.fetchFn = wrapFetchWithPayment(base, client);
|
|
55
|
+
} else {
|
|
56
|
+
this.fetchFn = opts.fetch || globalThis.fetch.bind(globalThis);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
async request(path, init = {}, opts = {}) {
|
|
60
|
+
const url = new URL(path.startsWith("http") ? path : `${this.origin}${path}`);
|
|
61
|
+
if (opts.query) {
|
|
62
|
+
for (const [k, v] of Object.entries(opts.query)) {
|
|
63
|
+
if (v == null || v === "") continue;
|
|
64
|
+
url.searchParams.set(k, String(v));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const wantPreview = opts.preview === true || opts.preview !== false && this.defaultPreview && init.method !== "POST" && init.previewable !== false;
|
|
68
|
+
if (wantPreview && !url.searchParams.has("preview")) {
|
|
69
|
+
url.searchParams.set("preview", "1");
|
|
70
|
+
}
|
|
71
|
+
const res = await this.fetchFn(url.toString(), {
|
|
72
|
+
...init,
|
|
73
|
+
headers: {
|
|
74
|
+
accept: "application/json",
|
|
75
|
+
"user-agent": this.ua,
|
|
76
|
+
...init.headers || {}
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
const pr = res.headers.get("payment-required") || res.headers.get("PAYMENT-REQUIRED");
|
|
80
|
+
const text = await res.text();
|
|
81
|
+
let body;
|
|
82
|
+
try {
|
|
83
|
+
body = JSON.parse(text);
|
|
84
|
+
} catch {
|
|
85
|
+
body = { raw: text.slice(0, 4e3) };
|
|
86
|
+
}
|
|
87
|
+
if (res.status === 402 || pr) {
|
|
88
|
+
let payment = null;
|
|
89
|
+
if (pr) {
|
|
90
|
+
try {
|
|
91
|
+
payment = JSON.parse(Buffer.from(pr, "base64").toString("utf8"));
|
|
92
|
+
} catch {
|
|
93
|
+
payment = { raw: pr.slice(0, 200) };
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
throw new PaymentRequiredError(url.toString(), payment ?? body, body);
|
|
97
|
+
}
|
|
98
|
+
if (!res.ok) {
|
|
99
|
+
const err = new Error(body?.error || `HTTP ${res.status}`);
|
|
100
|
+
err.status = res.status;
|
|
101
|
+
err.body = body;
|
|
102
|
+
throw err;
|
|
103
|
+
}
|
|
104
|
+
return body;
|
|
105
|
+
}
|
|
106
|
+
get(path, query, opts) {
|
|
107
|
+
const q = qs({ ...query || {}, ...opts?.query || {} });
|
|
108
|
+
return this.request(`${path}${q ? `?${q}` : ""}`, { method: "GET" }, opts);
|
|
109
|
+
}
|
|
110
|
+
/** Free: x402 catalog / prices */
|
|
111
|
+
pricing(opts) {
|
|
112
|
+
return this.request(`${this.origin}/.well-known/x402`, { method: "GET", previewable: false }, { ...opts, preview: false });
|
|
113
|
+
}
|
|
114
|
+
readUrl(input, opts) {
|
|
115
|
+
return this.get("/read", input, opts);
|
|
116
|
+
}
|
|
117
|
+
extractLinks(input, opts) {
|
|
118
|
+
return this.get("/links", input, opts);
|
|
119
|
+
}
|
|
120
|
+
checkDomain(input, opts) {
|
|
121
|
+
return this.get("/check", input, opts);
|
|
122
|
+
}
|
|
123
|
+
companyResearch(input, opts) {
|
|
124
|
+
return this.get("/company", input, opts);
|
|
125
|
+
}
|
|
126
|
+
ukCompany(input, opts) {
|
|
127
|
+
return this.get("/uk-company", input, opts);
|
|
128
|
+
}
|
|
129
|
+
ukCompanyLite(input, opts) {
|
|
130
|
+
return this.get("/uk-company-lite", input, opts);
|
|
131
|
+
}
|
|
132
|
+
companyFull(input, opts) {
|
|
133
|
+
return this.get("/company-full", input, opts);
|
|
134
|
+
}
|
|
135
|
+
convertDocument(input, opts) {
|
|
136
|
+
return this.get("/convert", { format: "markdown", ...input }, opts);
|
|
137
|
+
}
|
|
138
|
+
createMonitor(input, opts) {
|
|
139
|
+
return this.request(
|
|
140
|
+
`${this.origin}/monitor`,
|
|
141
|
+
{
|
|
142
|
+
method: "POST",
|
|
143
|
+
headers: { "content-type": "application/json" },
|
|
144
|
+
body: JSON.stringify(input),
|
|
145
|
+
previewable: false
|
|
146
|
+
},
|
|
147
|
+
{ ...opts, preview: false }
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
walletBalances(input, opts) {
|
|
151
|
+
return this.get("/wallet", input, opts);
|
|
152
|
+
}
|
|
153
|
+
txStatus(input, opts) {
|
|
154
|
+
return this.get("/tx", input, opts);
|
|
155
|
+
}
|
|
156
|
+
tokenCheck(input, opts) {
|
|
157
|
+
return this.get("/token-check", input, opts);
|
|
158
|
+
}
|
|
159
|
+
fxRates(input = {}, opts) {
|
|
160
|
+
return this.get("/fx", input, opts);
|
|
161
|
+
}
|
|
162
|
+
ensLookup(input, opts) {
|
|
163
|
+
return this.get("/ens", input, opts);
|
|
164
|
+
}
|
|
165
|
+
tokenMetadata(input, opts) {
|
|
166
|
+
return this.get("/token", input, opts);
|
|
167
|
+
}
|
|
168
|
+
tokenAllowance(input, opts) {
|
|
169
|
+
return this.get("/allowance", input, opts);
|
|
170
|
+
}
|
|
171
|
+
contractInfo(input, opts) {
|
|
172
|
+
return this.get("/contract", input, opts);
|
|
173
|
+
}
|
|
174
|
+
gasFees(input = {}, opts) {
|
|
175
|
+
return this.get("/gas", input, opts);
|
|
176
|
+
}
|
|
177
|
+
blockLookup(input = {}, opts) {
|
|
178
|
+
return this.get("/block", input, opts);
|
|
179
|
+
}
|
|
180
|
+
nftLookup(input, opts) {
|
|
181
|
+
return this.get("/nft", input, opts);
|
|
182
|
+
}
|
|
183
|
+
webSearch(input, opts) {
|
|
184
|
+
return this.get("/search", input, opts);
|
|
185
|
+
}
|
|
186
|
+
ukPropertyPrices(input, opts) {
|
|
187
|
+
return this.get("/uk-property", input, opts);
|
|
188
|
+
}
|
|
189
|
+
ukAreaProfile(input, opts) {
|
|
190
|
+
return this.get("/uk-area", input, opts);
|
|
191
|
+
}
|
|
192
|
+
ukCharity(input, opts) {
|
|
193
|
+
return this.get("/uk-charity", input, opts);
|
|
194
|
+
}
|
|
195
|
+
ukCharityFull(input, opts) {
|
|
196
|
+
return this.get("/uk-charity-full", input, opts);
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
function createClient(opts = {}) {
|
|
200
|
+
return new AgentReaderClient(opts);
|
|
201
|
+
}
|
|
202
|
+
export {
|
|
203
|
+
AgentReaderClient,
|
|
204
|
+
PaymentRequiredError,
|
|
205
|
+
createClient
|
|
206
|
+
};
|
|
207
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/client.ts"],"sourcesContent":["import { wrapFetchWithPayment, x402Client } from \"@x402/fetch\";\nimport { ExactEvmScheme } from \"@x402/evm/exact/client\";\nimport { privateKeyToAccount } from \"viem/accounts\";\nimport type { Chain, ClientOptions, RequestOpts } from \"./types.js\";\n\nconst DEFAULT_ORIGIN = \"https://api.axiomworks.co.uk\";\nconst VERSION = \"1.6.0\";\n\nfunction normalizeKey(raw?: string): `0x${string}` | undefined {\n if (!raw) return undefined;\n const key = raw.startsWith(\"0x\") ? raw : `0x${raw}`;\n if (!/^0x[0-9a-fA-F]{64}$/.test(key)) {\n throw new Error(\"privateKey must be a 32-byte hex string (optional 0x prefix)\");\n }\n return key as `0x${string}`;\n}\n\nfunction qs(params: Record<string, unknown>): string {\n const sp = new URLSearchParams();\n for (const [k, v] of Object.entries(params)) {\n if (v == null || v === \"\") continue;\n sp.set(k, String(v));\n }\n return sp.toString();\n}\n\nexport class PaymentRequiredError extends Error {\n readonly status = 402;\n readonly paymentRequired: unknown;\n readonly body: unknown;\n readonly url: string;\n constructor(url: string, paymentRequired: unknown, body: unknown) {\n super(\"Payment required (x402). Pass privateKey to createClient or fund/retry with @x402/fetch.\");\n this.name = \"PaymentRequiredError\";\n this.url = url;\n this.paymentRequired = paymentRequired;\n this.body = body;\n }\n}\n\nexport class AgentReaderClient {\n readonly origin: string;\n readonly paying: boolean;\n private readonly fetchFn: typeof fetch;\n private readonly defaultPreview: boolean;\n private readonly ua: string;\n\n constructor(opts: ClientOptions = {}) {\n this.origin = (opts.origin || DEFAULT_ORIGIN).replace(/\\/$/, \"\");\n const key = normalizeKey(\n opts.privateKey ||\n process.env.AGENTREADER_PRIVATE_KEY ||\n process.env.EVM_PRIVATE_KEY ||\n process.env.PRIVATE_KEY,\n );\n this.paying = !!key;\n this.defaultPreview = opts.preview ?? !this.paying;\n this.ua = opts.userAgent || `axiomworks-agentreader-sdk/${VERSION}`;\n if (key) {\n const account = privateKeyToAccount(key);\n const client = new x402Client().register(\"eip155:8453\", new ExactEvmScheme(account));\n const base = opts.fetch || globalThis.fetch.bind(globalThis);\n this.fetchFn = wrapFetchWithPayment(base, client);\n } else {\n this.fetchFn = opts.fetch || globalThis.fetch.bind(globalThis);\n }\n }\n\n private async request(\n path: string,\n init: RequestInit & { previewable?: boolean } = {},\n opts: RequestOpts = {},\n ): Promise<any> {\n const url = new URL(path.startsWith(\"http\") ? path : `${this.origin}${path}`);\n if (opts.query) {\n for (const [k, v] of Object.entries(opts.query)) {\n if (v == null || v === \"\") continue;\n url.searchParams.set(k, String(v));\n }\n }\n const wantPreview =\n opts.preview === true ||\n (opts.preview !== false && this.defaultPreview && init.method !== \"POST\" && init.previewable !== false);\n if (wantPreview && !url.searchParams.has(\"preview\")) {\n url.searchParams.set(\"preview\", \"1\");\n }\n const res = await this.fetchFn(url.toString(), {\n ...init,\n headers: {\n accept: \"application/json\",\n \"user-agent\": this.ua,\n ...(init.headers || {}),\n },\n });\n const pr = res.headers.get(\"payment-required\") || res.headers.get(\"PAYMENT-REQUIRED\");\n const text = await res.text();\n let body: any;\n try {\n body = JSON.parse(text);\n } catch {\n body = { raw: text.slice(0, 4000) };\n }\n if (res.status === 402 || pr) {\n let payment: unknown = null;\n if (pr) {\n try {\n payment = JSON.parse(Buffer.from(pr, \"base64\").toString(\"utf8\"));\n } catch {\n payment = { raw: pr.slice(0, 200) };\n }\n }\n throw new PaymentRequiredError(url.toString(), payment ?? body, body);\n }\n if (!res.ok) {\n const err: any = new Error(body?.error || `HTTP ${res.status}`);\n err.status = res.status;\n err.body = body;\n throw err;\n }\n return body;\n }\n\n private get(path: string, query?: Record<string, unknown>, opts?: RequestOpts) {\n const q = qs({ ...(query || {}), ...(opts?.query || {}) });\n return this.request(`${path}${q ? `?${q}` : \"\"}`, { method: \"GET\" }, opts);\n }\n\n /** Free: x402 catalog / prices */\n pricing(opts?: RequestOpts) {\n return this.request(`${this.origin}/.well-known/x402`, { method: \"GET\", previewable: false }, { ...opts, preview: false });\n }\n\n readUrl(input: { url: string }, opts?: RequestOpts) {\n return this.get(\"/read\", input, opts);\n }\n extractLinks(input: { url: string }, opts?: RequestOpts) {\n return this.get(\"/links\", input, opts);\n }\n checkDomain(input: { domain: string }, opts?: RequestOpts) {\n return this.get(\"/check\", input, opts);\n }\n companyResearch(input: { domain: string }, opts?: RequestOpts) {\n return this.get(\"/company\", input, opts);\n }\n ukCompany(input: { number?: string; name?: string }, opts?: RequestOpts) {\n return this.get(\"/uk-company\", input, opts);\n }\n ukCompanyLite(input: { number?: string; name?: string }, opts?: RequestOpts) {\n return this.get(\"/uk-company-lite\", input, opts);\n }\n companyFull(input: { domain: string }, opts?: RequestOpts) {\n return this.get(\"/company-full\", input, opts);\n }\n convertDocument(input: { url: string; format?: \"markdown\" | \"text\" }, opts?: RequestOpts) {\n return this.get(\"/convert\", { format: \"markdown\", ...input }, opts);\n }\n createMonitor(\n input: { url: string; webhook: string; selector?: string; keyword?: string },\n opts?: RequestOpts,\n ) {\n return this.request(\n `${this.origin}/monitor`,\n {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify(input),\n previewable: false,\n },\n { ...opts, preview: false },\n );\n }\n walletBalances(input: { address: string; chain?: Chain; tokens?: string }, opts?: RequestOpts) {\n return this.get(\"/wallet\", input, opts);\n }\n txStatus(input: { hash: string; chain?: Chain }, opts?: RequestOpts) {\n return this.get(\"/tx\", input, opts);\n }\n tokenCheck(input: { address: string; chain?: Chain }, opts?: RequestOpts) {\n return this.get(\"/token-check\", input, opts);\n }\n fxRates(\n input: { base?: string; symbols?: string; date?: string; amount?: string } = {},\n opts?: RequestOpts,\n ) {\n return this.get(\"/fx\", input, opts);\n }\n ensLookup(input: { name?: string; address?: string }, opts?: RequestOpts) {\n return this.get(\"/ens\", input, opts);\n }\n tokenMetadata(input: { address: string; chain?: Chain }, opts?: RequestOpts) {\n return this.get(\"/token\", input, opts);\n }\n tokenAllowance(\n input: { token: string; owner: string; spender: string; chain?: Chain },\n opts?: RequestOpts,\n ) {\n return this.get(\"/allowance\", input, opts);\n }\n contractInfo(input: { address: string; chain?: Chain }, opts?: RequestOpts) {\n return this.get(\"/contract\", input, opts);\n }\n gasFees(input: { chain?: Chain } = {}, opts?: RequestOpts) {\n return this.get(\"/gas\", input, opts);\n }\n blockLookup(input: { number?: string; timestamp?: string; chain?: Chain } = {}, opts?: RequestOpts) {\n return this.get(\"/block\", input, opts);\n }\n nftLookup(input: { contract: string; token_id: string; chain?: Chain }, opts?: RequestOpts) {\n return this.get(\"/nft\", input, opts);\n }\n webSearch(input: { q: string; sources?: string; limit?: string | number }, opts?: RequestOpts) {\n return this.get(\"/search\", input, opts);\n }\n ukPropertyPrices(input: { postcode: string; radius?: string }, opts?: RequestOpts) {\n return this.get(\"/uk-property\", input, opts);\n }\n ukAreaProfile(input: { postcode: string }, opts?: RequestOpts) {\n return this.get(\"/uk-area\", input, opts);\n }\n ukCharity(input: { number?: string; name?: string; suffix?: string }, opts?: RequestOpts) {\n return this.get(\"/uk-charity\", input, opts);\n }\n ukCharityFull(input: { number?: string; name?: string; suffix?: string }, opts?: RequestOpts) {\n return this.get(\"/uk-charity-full\", input, opts);\n }\n}\n\n/** Create a typed AgentReader client. Pass privateKey (or set AGENTREADER_PRIVATE_KEY) to auto-pay. */\nexport function createClient(opts: ClientOptions = {}): AgentReaderClient {\n return new AgentReaderClient(opts);\n}\n"],"mappings":";AAAA,SAAS,sBAAsB,kBAAkB;AACjD,SAAS,sBAAsB;AAC/B,SAAS,2BAA2B;AAGpC,IAAM,iBAAiB;AACvB,IAAM,UAAU;AAEhB,SAAS,aAAa,KAAyC;AAC7D,MAAI,CAAC,IAAK,QAAO;AACjB,QAAM,MAAM,IAAI,WAAW,IAAI,IAAI,MAAM,KAAK,GAAG;AACjD,MAAI,CAAC,sBAAsB,KAAK,GAAG,GAAG;AACpC,UAAM,IAAI,MAAM,8DAA8D;AAAA,EAChF;AACA,SAAO;AACT;AAEA,SAAS,GAAG,QAAyC;AACnD,QAAM,KAAK,IAAI,gBAAgB;AAC/B,aAAW,CAAC,GAAG,CAAC,KAAK,OAAO,QAAQ,MAAM,GAAG;AAC3C,QAAI,KAAK,QAAQ,MAAM,GAAI;AAC3B,OAAG,IAAI,GAAG,OAAO,CAAC,CAAC;AAAA,EACrB;AACA,SAAO,GAAG,SAAS;AACrB;AAEO,IAAM,uBAAN,cAAmC,MAAM;AAAA,EACrC,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACT,YAAY,KAAa,iBAA0B,MAAe;AAChE,UAAM,0FAA0F;AAChG,SAAK,OAAO;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oB;AAC7D,WAAO,KAAK,IAAI,YAAY,OAAO,IAAI;AAAA,EACzC;AAAA,EACA,UAAU,OAA4D,MAAoB;AACxF,WAAO,KAAK,IAAI,eAAe,OAAO,IAAI;AAAA,EAC5C;AAAA,EACA,cAAc,OAA4D,MAAoB;AAC5F,WAAO,KAAK,IAAI,oBAAoB,OAAO,IAAI;AAAA,EACjD;AACF;AAGO,SAAS,aAAa,OAAsB,CAAC,GAAsB;AACxE,SAAO,IAAI,kBAAkB,IAAI;AACnC;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,80 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axiomworks/agentreader",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.6.0",
|
|
4
|
+
"description": "Axiom Works AgentReader typed JS/TS SDK — createClient({ privateKey }) with one method per tool, auto x402 USDC payment on Base, free preview mode. Web read, UK company/charity/property, EVM, FX, search.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md",
|
|
17
|
+
"LICENSE"
|
|
18
|
+
],
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=18"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsup",
|
|
24
|
+
"prepublishOnly": "npm run build"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"agentreader",
|
|
28
|
+
"axiomworks",
|
|
29
|
+
"axiom-works",
|
|
30
|
+
"x402",
|
|
31
|
+
"ai-agent",
|
|
32
|
+
"agents",
|
|
33
|
+
"sdk",
|
|
34
|
+
"typescript",
|
|
35
|
+
"mcp",
|
|
36
|
+
"model-context-protocol",
|
|
37
|
+
"web-scraping",
|
|
38
|
+
"markdown",
|
|
39
|
+
"companies-house",
|
|
40
|
+
"uk-company",
|
|
41
|
+
"uk-charity",
|
|
42
|
+
"charity-commission",
|
|
43
|
+
"due-diligence",
|
|
44
|
+
"blockchain",
|
|
45
|
+
"base",
|
|
46
|
+
"usdc",
|
|
47
|
+
"crypto",
|
|
48
|
+
"evm",
|
|
49
|
+
"ens",
|
|
50
|
+
"nft",
|
|
51
|
+
"fx",
|
|
52
|
+
"langchain",
|
|
53
|
+
"pay-per-call",
|
|
54
|
+
"fetch"
|
|
55
|
+
],
|
|
56
|
+
"author": "Axiom Works <info@axiomworks.co.uk>",
|
|
57
|
+
"license": "MIT",
|
|
58
|
+
"homepage": "https://grokbot1233.github.io/agentreader/",
|
|
59
|
+
"repository": {
|
|
60
|
+
"type": "git",
|
|
61
|
+
"url": "git+https://github.com/grokbot1233/agentreader.git",
|
|
62
|
+
"directory": "packages/agentreader"
|
|
63
|
+
},
|
|
64
|
+
"bugs": {
|
|
65
|
+
"url": "https://github.com/grokbot1233/agentreader/issues"
|
|
66
|
+
},
|
|
67
|
+
"dependencies": {
|
|
68
|
+
"@x402/evm": "^2.30.0",
|
|
69
|
+
"@x402/fetch": "^2.30.0",
|
|
70
|
+
"viem": "^2.57.0"
|
|
71
|
+
},
|
|
72
|
+
"devDependencies": {
|
|
73
|
+
"@types/node": "^22.13.4",
|
|
74
|
+
"tsup": "^8.4.0",
|
|
75
|
+
"typescript": "^5.7.3"
|
|
76
|
+
},
|
|
77
|
+
"allowScripts": {
|
|
78
|
+
"esbuild@0.27.7": true
|
|
79
|
+
}
|
|
80
|
+
}
|