@agnt-id/a2a 0.1.0 → 0.1.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 +107 -0
- package/dist/convert.d.ts +6 -1
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# @agnt-id/a2a
|
|
2
|
+
|
|
3
|
+
Generate [Google A2A](https://google.github.io/A2A/) Agent Cards from `.agnt` names.
|
|
4
|
+
|
|
5
|
+
Takes a resolved `.agnt` record and produces a spec-compliant A2A Agent Card — the standard discovery format for the Agent-to-Agent protocol.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm i @agnt-id/a2a
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or install everything at once:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm i @agnt-id/sdk
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
### From a resolved name
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { AgntClient } from "@agnt-id/resolve";
|
|
25
|
+
import { toAgentCard, agentCardToJSON } from "@agnt-id/a2a";
|
|
26
|
+
|
|
27
|
+
const agnt = new AgntClient();
|
|
28
|
+
const resolved = await agnt.resolve("alice.agnt");
|
|
29
|
+
|
|
30
|
+
const card = toAgentCard(resolved, {
|
|
31
|
+
version: "1.0.0",
|
|
32
|
+
provider: { organization: "Alice Labs", url: "https://alice.example.com" },
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
console.log(agentCardToJSON(card));
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### One-step resolve + convert
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
import { fromAgnt } from "@agnt-id/a2a";
|
|
42
|
+
|
|
43
|
+
// Requires @agnt-id/resolve as a peer dependency
|
|
44
|
+
const card = await fromAgnt("alice.agnt", {
|
|
45
|
+
version: "1.0.0",
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## API
|
|
50
|
+
|
|
51
|
+
### `toAgentCard(agnt, options?): AgentCard`
|
|
52
|
+
|
|
53
|
+
Convert a resolved `.agnt` name to an A2A Agent Card.
|
|
54
|
+
|
|
55
|
+
The function maps `.agnt` records to A2A fields:
|
|
56
|
+
|
|
57
|
+
| .agnt field | A2A field |
|
|
58
|
+
|-------------|-----------|
|
|
59
|
+
| `name` | `name` |
|
|
60
|
+
| `records.texts.description` | `description` |
|
|
61
|
+
| `records.texts.avatar` | `iconUrl` |
|
|
62
|
+
| `records.a2a` | `supportedInterfaces[].url` |
|
|
63
|
+
| `records.skills` | `skills[]` |
|
|
64
|
+
|
|
65
|
+
**Options:**
|
|
66
|
+
|
|
67
|
+
| Option | Type | Description |
|
|
68
|
+
|--------|------|-------------|
|
|
69
|
+
| `version` | `string` | Agent version (default: `"0.1.0"`) |
|
|
70
|
+
| `provider` | `AgentProvider` | Provider info (organization, url) |
|
|
71
|
+
| `capabilities` | `AgentCapabilities` | streaming, pushNotifications, stateTransitionHistory |
|
|
72
|
+
| `securitySchemes` | `Record<string, SecurityScheme>` | Auth schemes |
|
|
73
|
+
| `documentationUrl` | `string` | Link to agent docs |
|
|
74
|
+
|
|
75
|
+
### `agentCardToJSON(card): string`
|
|
76
|
+
|
|
77
|
+
Serialize an Agent Card to formatted JSON.
|
|
78
|
+
|
|
79
|
+
### `fromAgnt(name, options?): Promise<AgentCard>`
|
|
80
|
+
|
|
81
|
+
Resolve a `.agnt` name and convert to an Agent Card in one call. Requires `@agnt-id/resolve` as a peer dependency (uses dynamic import).
|
|
82
|
+
|
|
83
|
+
## Types
|
|
84
|
+
|
|
85
|
+
All A2A protocol types are exported:
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
import type {
|
|
89
|
+
AgentCard,
|
|
90
|
+
AgentProvider,
|
|
91
|
+
AgentInterface,
|
|
92
|
+
AgentCapabilities,
|
|
93
|
+
AgentSkill,
|
|
94
|
+
SecurityScheme,
|
|
95
|
+
ToAgentCardOptions,
|
|
96
|
+
} from "@agnt-id/a2a";
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Links
|
|
100
|
+
|
|
101
|
+
- [A2A Protocol Spec](https://google.github.io/A2A/)
|
|
102
|
+
- [Website](https://www.agnt.id)
|
|
103
|
+
- [GitHub](https://github.com/txc0ld/agnt.id)
|
|
104
|
+
|
|
105
|
+
## License
|
|
106
|
+
|
|
107
|
+
MIT
|
package/dist/convert.d.ts
CHANGED
|
@@ -16,7 +16,12 @@ export type AgntRecordLike = {
|
|
|
16
16
|
domains?: string[];
|
|
17
17
|
a2aVersion?: string;
|
|
18
18
|
profileURI?: string;
|
|
19
|
-
|
|
19
|
+
x402Config?: {
|
|
20
|
+
paymentAddress: string;
|
|
21
|
+
pricePerCall: string;
|
|
22
|
+
chainId: number;
|
|
23
|
+
enabled: boolean;
|
|
24
|
+
};
|
|
20
25
|
};
|
|
21
26
|
/**
|
|
22
27
|
* Minimal shape of a resolved .agnt name.
|