@a2a-js/sdk 0.3.6 → 0.3.8
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 +17 -7
- package/dist/chunk-DHC2REQH.js +2145 -0
- package/dist/{chunk-LTPINR5K.js → chunk-NUQQPJNY.js} +3 -60
- package/dist/chunk-UHZEIZLS.js +62 -0
- package/dist/client/index.cjs +2537 -168
- package/dist/client/index.d.cts +60 -2
- package/dist/client/index.d.ts +60 -2
- package/dist/client/index.js +321 -99
- package/dist/server/express/index.cjs +2171 -115
- package/dist/server/express/index.js +79 -54
- package/dist/server/index.cjs +184 -6
- package/dist/server/index.d.cts +68 -8
- package/dist/server/index.d.ts +68 -8
- package/dist/server/index.js +188 -8
- package/package.json +22 -15
package/README.md
CHANGED
|
@@ -23,16 +23,26 @@ npm install @a2a-js/sdk
|
|
|
23
23
|
|
|
24
24
|
### For Server Usage
|
|
25
25
|
|
|
26
|
-
If you plan to use the
|
|
26
|
+
If you plan to use the Express integration (imports from `@a2a-js/sdk/server/express`) for A2A server, you'll also need to install Express as it's a peer dependency:
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
29
|
npm install express
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
You can also find
|
|
32
|
+
You can also find some samples [here](https://github.com/a2aproject/a2a-js/tree/main/src/samples).
|
|
33
33
|
|
|
34
34
|
---
|
|
35
35
|
|
|
36
|
+
## Compatibility
|
|
37
|
+
|
|
38
|
+
This SDK implements the A2A Protocol Specification [`v0.3.0`](https://a2a-protocol.org/v0.3.0/specification).
|
|
39
|
+
|
|
40
|
+
| Transport | Client | Server |
|
|
41
|
+
| :--- | :---: | :---: |
|
|
42
|
+
| **JSON-RPC** | ✅ | ✅ |
|
|
43
|
+
| **HTTP+JSON/REST** | ✅ | ✅ |
|
|
44
|
+
| **gRPC** | ❌ | ❌ |
|
|
45
|
+
|
|
36
46
|
## Quickstart
|
|
37
47
|
|
|
38
48
|
This example shows how to create a simple "Hello World" agent server and a client to interact with it.
|
|
@@ -121,8 +131,8 @@ The [`ClientFactory`](src/client/factory.ts) makes it easy to communicate with a
|
|
|
121
131
|
|
|
122
132
|
```typescript
|
|
123
133
|
// client.ts
|
|
124
|
-
import { ClientFactory
|
|
125
|
-
import { Message, MessageSendParams } from '@a2a-js/sdk';
|
|
134
|
+
import { ClientFactory } from '@a2a-js/sdk/client';
|
|
135
|
+
import { Message, MessageSendParams, SendMessageSuccessResponse } from '@a2a-js/sdk';
|
|
126
136
|
import { v4 as uuidv4 } from 'uuid';
|
|
127
137
|
|
|
128
138
|
async function run() {
|
|
@@ -222,8 +232,8 @@ The client sends a message and receives a `Task` object as the result.
|
|
|
222
232
|
|
|
223
233
|
```typescript
|
|
224
234
|
// client.ts
|
|
225
|
-
import { ClientFactory
|
|
226
|
-
import { Message, MessageSendParams, Task } from '@a2a-js/sdk';
|
|
235
|
+
import { ClientFactory } from '@a2a-js/sdk/client';
|
|
236
|
+
import { Message, MessageSendParams, SendMessageSuccessResponse, Task } from '@a2a-js/sdk';
|
|
227
237
|
// ... other imports ...
|
|
228
238
|
|
|
229
239
|
const factory = new ClientFactory();
|
|
@@ -354,7 +364,7 @@ Here's how to use it to manage a Bearer token:
|
|
|
354
364
|
```typescript
|
|
355
365
|
import {
|
|
356
366
|
ClientFactory,
|
|
357
|
-
ClientFactoryOptions
|
|
367
|
+
ClientFactoryOptions,
|
|
358
368
|
JsonRpcTransportFactory,
|
|
359
369
|
AuthenticationHandler,
|
|
360
370
|
createAuthenticatingFetchWithRetry,
|