@agnt-id/resolve 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/README.md +144 -0
  2. package/package.json +15 -3
package/README.md ADDED
@@ -0,0 +1,144 @@
1
+ # @agnt-id/resolve
2
+
3
+ Resolve `.agnt` names to wallets, agent endpoints, and identity records.
4
+
5
+ `.agnt` is an on-chain ENS-style naming system for AI agents deployed on Ethereum, Base, and Arbitrum. This package is the core SDK — it talks to the [gateway API](https://api.agnt.id) and gives you a typed client for forward resolution, reverse lookups, discovery, trust scores, and availability checks.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm i @agnt-id/resolve
11
+ ```
12
+
13
+ Or install everything at once:
14
+
15
+ ```bash
16
+ npm i @agnt-id/sdk
17
+ ```
18
+
19
+ ## Quick Start
20
+
21
+ ```typescript
22
+ import { AgntClient } from "@agnt-id/resolve";
23
+
24
+ const agnt = new AgntClient();
25
+
26
+ // Resolve a name
27
+ const result = await agnt.resolve("alice.agnt");
28
+ console.log(result.records.wallets); // { "eip155:1": "eip155:1:0x..." }
29
+ console.log(result.records.a2a); // "https://alice.example.com/.well-known/agent.json"
30
+ console.log(result.records.mcp); // "https://alice.example.com/mcp"
31
+
32
+ // Reverse lookup
33
+ const reverse = await agnt.reverse("0x1234...abcd");
34
+ console.log(reverse.name); // "alice.agnt"
35
+
36
+ // Discover agents
37
+ const agents = await agnt.discover({ q: "trading", skill: "defi" });
38
+ console.log(agents.entries);
39
+
40
+ // Check availability
41
+ const free = await agnt.available("myagent");
42
+ console.log(free); // true
43
+ ```
44
+
45
+ ## API
46
+
47
+ ### `new AgntClient(options?)`
48
+
49
+ | Option | Type | Default | Description |
50
+ |--------|------|---------|-------------|
51
+ | `gateway` | `string` | `"https://api.agnt.id"` | Gateway API base URL |
52
+ | `chainId` | `string` | `"eip155:1"` | CAIP-2 chain ID |
53
+ | `fetch` | `typeof fetch` | `globalThis.fetch` | Custom fetch implementation |
54
+
55
+ ### Methods
56
+
57
+ #### `resolve(name: string): Promise<AgntName>`
58
+
59
+ Forward resolution — returns ownership, expiry, and all records (wallets, endpoints, text records, identity link, skills, domains).
60
+
61
+ #### `reverse(address: string, options?): Promise<ReverseResult>`
62
+
63
+ Reverse lookup — address to `.agnt` name.
64
+
65
+ | Option | Type | Description |
66
+ |--------|------|-------------|
67
+ | `chainId` | `string` | Override chain ID for this call |
68
+
69
+ #### `discover(options?): Promise<DiscoverResult>`
70
+
71
+ Search and discover agents.
72
+
73
+ | Option | Type | Description |
74
+ |--------|------|-------------|
75
+ | `q` | `string` | Search query |
76
+ | `skill` | `string` | Filter by OASF skill slug |
77
+ | `domain` | `string` | Filter by OASF domain slug |
78
+ | `limit` | `number` | Max results |
79
+ | `offset` | `number` | Pagination offset |
80
+
81
+ #### `owner(address: string, options?): Promise<OwnerResult>`
82
+
83
+ List all `.agnt` names owned by an address.
84
+
85
+ #### `trust(name: string): Promise<TrustResult>`
86
+
87
+ Get trust score, confidence, and signal breakdown for a name.
88
+
89
+ #### `domains(name: string): Promise<DomainResult>`
90
+
91
+ Get domain verification records for a name.
92
+
93
+ #### `available(name: string): Promise<boolean>`
94
+
95
+ Check if a `.agnt` name is available for registration.
96
+
97
+ ### Error Handling
98
+
99
+ ```typescript
100
+ import { AgntClient, AgntError } from "@agnt-id/resolve";
101
+
102
+ try {
103
+ await agnt.resolve("nonexistent.agnt");
104
+ } catch (err) {
105
+ if (err instanceof AgntError) {
106
+ console.log(err.status); // 404
107
+ console.log(err.message); // "not found"
108
+ }
109
+ }
110
+ ```
111
+
112
+ ## Types
113
+
114
+ All types are exported:
115
+
116
+ ```typescript
117
+ import type {
118
+ AgntRecord,
119
+ AgntName,
120
+ ResolveResult,
121
+ ReverseResult,
122
+ DiscoverResult,
123
+ DiscoverEntry,
124
+ OwnerResult,
125
+ TrustResult,
126
+ TrustScore,
127
+ TrustSignal,
128
+ DomainResult,
129
+ DomainEntry,
130
+ AgntClientOptions,
131
+ DiscoverOptions,
132
+ OwnerOptions,
133
+ } from "@agnt-id/resolve";
134
+ ```
135
+
136
+ ## Links
137
+
138
+ - [Website](https://www.agnt.id)
139
+ - [API Docs](https://www.agnt.id/docs)
140
+ - [GitHub](https://github.com/txc0ld/agnt.id)
141
+
142
+ ## License
143
+
144
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agnt-id/resolve",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Resolve .agnt names to wallets, agent endpoints, and identity records",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -11,12 +11,24 @@
11
11
  "types": "./dist/index.d.ts"
12
12
  }
13
13
  },
14
- "files": ["dist", "README.md"],
14
+ "files": [
15
+ "dist",
16
+ "README.md"
17
+ ],
15
18
  "scripts": {
16
19
  "build": "tsc",
17
20
  "prepublishOnly": "tsc"
18
21
  },
19
- "keywords": ["agnt", "agent", "naming", "web3", "ethereum", "resolve", "a2a", "mcp"],
22
+ "keywords": [
23
+ "agnt",
24
+ "agent",
25
+ "naming",
26
+ "web3",
27
+ "ethereum",
28
+ "resolve",
29
+ "a2a",
30
+ "mcp"
31
+ ],
20
32
  "license": "MIT",
21
33
  "devDependencies": {
22
34
  "typescript": "^5.9.3"