@galdor/a2a 0.3.0 → 0.3.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 +56 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,56 @@
1
+ # @galdor/a2a
2
+
3
+ A [Google Agent-to-Agent](https://github.com/google/A2A) (A2A) protocol client
4
+ and server for [galdor](https://github.com/YasserCR/galdor-bun) — JSON-RPC 2.0
5
+ over HTTP. Publish a galdor agent so other agents can call it, or drive a remote
6
+ A2A agent as a client.
7
+
8
+ Serves the Agent Card at `/.well-known/agent.json`, implements `tasks/send` and
9
+ `tasks/get`, the six spec `TaskState`s, task history/artifacts/sessions, and an
10
+ SSRF guard on the client (same-host redirects only, bounded body, configurable
11
+ deadline).
12
+
13
+ ## Install
14
+
15
+ ```bash
16
+ bun add @galdor/a2a # or: npm install @galdor/a2a
17
+ ```
18
+
19
+ ## Server
20
+
21
+ ```ts
22
+ import { newServer, handlerFunc, agentText, type AgentCard } from "@galdor/a2a";
23
+
24
+ const card: AgentCard = {
25
+ name: "greeter",
26
+ description: "Greets people.",
27
+ url: "http://localhost:4000",
28
+ version: "1.0.0",
29
+ capabilities: {},
30
+ skills: [],
31
+ };
32
+
33
+ const server = newServer(card, handlerFunc(async (task) => {
34
+ const name = task.message.parts.map((p) => p.text ?? "").join(" ");
35
+ return agentText(`Hello, ${name}!`);
36
+ }));
37
+
38
+ Bun.serve({ port: 4000, fetch: server.fetch }); // Node: pass server.fetch to your HTTP layer
39
+ ```
40
+
41
+ ## Client
42
+
43
+ ```ts
44
+ import { Client, userText } from "@galdor/a2a";
45
+
46
+ const client = new Client("http://localhost:4000");
47
+ // const client = new Client(url, { timeoutMs: 0, fetch: customFetch }); // optional
48
+
49
+ const card = await client.fetchAgentCard();
50
+ const task = await client.sendTask(userText("Ada"));
51
+ console.log(task.status.state, task.history?.at(-1)?.parts);
52
+ ```
53
+
54
+ ## License
55
+
56
+ Apache-2.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galdor/a2a",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "description": "galdor-bun a2a: Google Agent-to-Agent (A2A) protocol — JSON-RPC 2.0 over HTTP client + server.",
6
6
  "author": {
@@ -31,6 +31,6 @@
31
31
  "bun": ">=1.3"
32
32
  },
33
33
  "dependencies": {
34
- "@galdor/core": "0.3.0"
34
+ "@galdor/core": "0.3.1"
35
35
  }
36
36
  }