agentalk 0.1.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 IchenDEV
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,445 @@
1
+ <div align="center">
2
+
3
+ # โšก agentalk
4
+
5
+ **curl for AI agents โ€” the universal A2A protocol CLI**
6
+
7
+ Discover, message, stream, and manage tasks with any A2A-compatible agent โ€” right from your terminal.
8
+
9
+ [![npm version](https://img.shields.io/npm/v/agentalk?style=flat-square&color=cb3837&logo=npm&logoColor=white)](https://www.npmjs.com/package/agentalk)
10
+ [![license](https://img.shields.io/npm/l/agentalk?style=flat-square&color=blue)](https://github.com/IchenDEV/agentalk/blob/main/LICENSE)
11
+ [![node version](https://img.shields.io/node/v/agentalk?style=flat-square&color=339933&logo=node.js&logoColor=white)](https://nodejs.org)
12
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.7+-3178C6?style=flat-square&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
13
+ [![A2A Protocol](https://img.shields.io/badge/A2A_Protocol-v1.0-8B5CF6?style=flat-square&logo=google&logoColor=white)](https://google.github.io/A2A/)
14
+ [![zero config](https://img.shields.io/badge/zero_config-ready-10B981?style=flat-square)](#quick-start)
15
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-FF6F61?style=flat-square)](https://github.com/IchenDEV/agentalk/pulls)
16
+
17
+ <br />
18
+
19
+ [๐Ÿ‡จ๐Ÿ‡ณ ไธญๆ–‡ๆ–‡ๆกฃ](./README.zh-CN.md) ยท [Report Bug](https://github.com/IchenDEV/agentalk/issues) ยท [Request Feature](https://github.com/IchenDEV/agentalk/issues)
20
+
21
+ <br />
22
+
23
+ ```
24
+ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
25
+ โ”‚ โ”‚
26
+ โ”‚ $ agentalk agent https://my-agent.example.com โ”‚
27
+ โ”‚ โ”‚
28
+ โ”‚ ๐Ÿค– Recipe Agent โ”‚
29
+ โ”‚ v1.0.0 โ”‚
30
+ โ”‚ Helps with recipes and cooking โ”‚
31
+ โ”‚ โ”‚
32
+ โ”‚ Skills: โ”‚
33
+ โ”‚ โ€ข Recipe Search (recipe-search) โ”‚
34
+ โ”‚ Search by ingredients or cuisine โ”‚
35
+ โ”‚ โ”‚
36
+ โ”‚ $ agentalk send https://my-agent.example.com \ โ”‚
37
+ โ”‚ -m "Find me a pasta recipe" โ”‚
38
+ โ”‚ โ”‚
39
+ โ”‚ agent: Here's a classic carbonara recipe... โ”‚
40
+ โ”‚ โ”‚
41
+ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
42
+ ```
43
+
44
+ </div>
45
+
46
+ ---
47
+
48
+ ## Table of Contents
49
+
50
+ - [Why agentalk?](#why-agentalk)
51
+ - [Quick Start](#quick-start)
52
+ - [Usage](#usage)
53
+ - [Discover an Agent](#-discover-an-agent)
54
+ - [Send a Message](#-send-a-message)
55
+ - [Stream a Response](#-stream-a-response)
56
+ - [Manage Tasks](#-manage-tasks)
57
+ - [Command Reference](#command-reference)
58
+ - [Recipes](#recipes)
59
+ - [Task States](#task-states)
60
+ - [Architecture](#architecture)
61
+ - [Development](#development)
62
+ - [Contributing](#contributing)
63
+ - [License](#license)
64
+
65
+ ---
66
+
67
+ ## Why agentalk?
68
+
69
+ The [A2A (Agent-to-Agent) protocol](https://google.github.io/A2A/) is an open standard by Google for agents to communicate. **agentalk** brings that protocol to your terminal.
70
+
71
+ <table>
72
+ <tr>
73
+ <td width="50">๐Ÿ”</td>
74
+ <td><strong>Discover</strong></td>
75
+ <td>Fetch and inspect agent cards to see what an agent can do</td>
76
+ </tr>
77
+ <tr>
78
+ <td>๐Ÿ’ฌ</td>
79
+ <td><strong>Message</strong></td>
80
+ <td>Send messages and get structured responses</td>
81
+ </tr>
82
+ <tr>
83
+ <td>๐ŸŒŠ</td>
84
+ <td><strong>Stream</strong></td>
85
+ <td>Real-time SSE streaming for long-running tasks</td>
86
+ </tr>
87
+ <tr>
88
+ <td>๐Ÿ“‹</td>
89
+ <td><strong>Tasks</strong></td>
90
+ <td>Full task lifecycle management โ€” get, list, cancel</td>
91
+ </tr>
92
+ <tr>
93
+ <td>๐ŸŽจ</td>
94
+ <td><strong>Pretty Output</strong></td>
95
+ <td>Colored, human-friendly display; <code>--json</code> for scripting</td>
96
+ </tr>
97
+ <tr>
98
+ <td>๐Ÿ”’</td>
99
+ <td><strong>Auth-ready</strong></td>
100
+ <td>Pass any HTTP headers for Bearer tokens, API keys, etc.</td>
101
+ </tr>
102
+ <tr>
103
+ <td>๐Ÿข</td>
104
+ <td><strong>Multi-tenant</strong></td>
105
+ <td>Built-in tenant isolation with <code>--tenant</code></td>
106
+ </tr>
107
+ </table>
108
+
109
+ ## Quick Start
110
+
111
+ ### Install globally
112
+
113
+ ```bash
114
+ pnpm add -g agentalk
115
+ ```
116
+
117
+ ### Or run instantly with npx / pnpm dlx
118
+
119
+ ```bash
120
+ pnpm dlx agentalk agent https://agent.example.com
121
+ ```
122
+
123
+ > [!TIP]
124
+ > No configuration needed. Just point it at any A2A-compatible agent URL and go.
125
+
126
+ ## Usage
127
+
128
+ ### ๐Ÿ” Discover an Agent
129
+
130
+ ```bash
131
+ agentalk agent https://agent.example.com
132
+ ```
133
+
134
+ <details>
135
+ <summary>๐Ÿ“ธ <strong>Example output</strong></summary>
136
+
137
+ ```
138
+ ๐Ÿค– Recipe Agent
139
+ v1.0.0
140
+ Agent that helps users with recipes and cooking.
141
+
142
+ Provider:
143
+ Google (https://ai.google.dev)
144
+
145
+ Capabilities:
146
+ streaming, push-notifications
147
+
148
+ Skills:
149
+ โ€ข Recipe Search (recipe-search)
150
+ Search for recipes by ingredients or cuisine
151
+ tags: cooking, recipes, food
152
+ ```
153
+
154
+ </details>
155
+
156
+ ### ๐Ÿ’ฌ Send a Message
157
+
158
+ ```bash
159
+ # Simple message
160
+ agentalk send https://agent.example.com -m "What can you do?"
161
+
162
+ # Multi-turn conversation with context
163
+ agentalk send https://agent.example.com -m "Tell me more" -c ctx_abc123
164
+
165
+ # Continue an existing task
166
+ agentalk send https://agent.example.com -m "Yes, proceed" -t task_xyz
167
+
168
+ # Fire-and-forget (async)
169
+ agentalk send https://agent.example.com -m "Process this report" --async
170
+ ```
171
+
172
+ ### ๐ŸŒŠ Stream a Response
173
+
174
+ ```bash
175
+ agentalk stream https://agent.example.com -m "Generate a detailed analysis"
176
+ ```
177
+
178
+ <details>
179
+ <summary>๐Ÿ“ธ <strong>Example output</strong> (streamed in real-time)</summary>
180
+
181
+ ```
182
+ [task-42] status โ†’ working
183
+ agent: Analyzing the data...
184
+ agent: Here are the key findings:
185
+ [task-42] ๐Ÿ“Ž report.md: # Analysis Report ... (final)
186
+ [task-42] status โ†’ completed
187
+ ```
188
+
189
+ </details>
190
+
191
+ ### ๐Ÿ“‹ Manage Tasks
192
+
193
+ ```bash
194
+ agentalk task get https://agent.example.com task_abc123 # Get status
195
+ agentalk task list https://agent.example.com # List all
196
+ agentalk task list https://agent.example.com -s TASK_STATE_COMPLETED # Filter
197
+ agentalk task cancel https://agent.example.com task_abc123 # Cancel
198
+ ```
199
+
200
+ ---
201
+
202
+ ## Command Reference
203
+
204
+ ```
205
+ agentalk [options] [command]
206
+
207
+ Commands:
208
+ agent <url> Fetch and display an agent card
209
+ send [options] <url> Send a message to an agent
210
+ stream [options] <url> Send a message and stream the response (SSE)
211
+ task get <url> <taskId> Get a task by ID
212
+ task list [options] <url> List tasks
213
+ task cancel <url> <taskId> Cancel a task
214
+
215
+ Global Options:
216
+ --json Output raw JSON (great for piping/scripting)
217
+ -H, --header <key:value> Add HTTP header (repeatable)
218
+ --tenant <id> Tenant ID for multi-tenant agents
219
+ -V, --version Show version
220
+ -h, --help Show help
221
+ ```
222
+
223
+ <details>
224
+ <summary><code>send</code> options</summary>
225
+
226
+ | Flag | Description |
227
+ |------|-------------|
228
+ | `-m, --message <text>` | Message text **(required)** |
229
+ | `-c, --context <id>` | Context ID for multi-turn conversations |
230
+ | `-t, --task <id>` | Task ID to continue an existing task |
231
+ | `--output-modes <modes>` | Accepted output MIME types (comma-separated) |
232
+ | `--history-length <n>` | Max history messages to return |
233
+ | `--async` | Return immediately without waiting |
234
+
235
+ </details>
236
+
237
+ <details>
238
+ <summary><code>stream</code> options</summary>
239
+
240
+ | Flag | Description |
241
+ |------|-------------|
242
+ | `-m, --message <text>` | Message text **(required)** |
243
+ | `-c, --context <id>` | Context ID for multi-turn conversations |
244
+ | `-t, --task <id>` | Task ID to continue an existing task |
245
+ | `--output-modes <modes>` | Accepted output MIME types (comma-separated) |
246
+
247
+ </details>
248
+
249
+ <details>
250
+ <summary><code>task list</code> options</summary>
251
+
252
+ | Flag | Description |
253
+ |------|-------------|
254
+ | `-c, --context <id>` | Filter by context ID |
255
+ | `-s, --status <state>` | Filter by task state |
256
+ | `--history-length <n>` | Max history messages per task |
257
+ | `--artifacts` | Include artifacts in response |
258
+ | `--page-size <n>` | Results per page |
259
+ | `--page-token <token>` | Pagination token |
260
+
261
+ </details>
262
+
263
+ ---
264
+
265
+ ## Recipes
266
+
267
+ ### Pipe JSON output to jq
268
+
269
+ ```bash
270
+ # Extract just the task state
271
+ agentalk --json task get https://agent.example.com task_123 | jq '.status.state'
272
+
273
+ # Get all skill names from an agent
274
+ agentalk --json agent https://agent.example.com | jq '.skills[].name'
275
+ ```
276
+
277
+ ### Use with authentication
278
+
279
+ ```bash
280
+ # Bearer token
281
+ agentalk agent https://agent.example.com -H "Authorization: Bearer sk-xxx"
282
+
283
+ # API key in header
284
+ agentalk send https://agent.example.com -m "Hello" -H "X-API-Key: key_xxx"
285
+ ```
286
+
287
+ ### Multi-turn conversation
288
+
289
+ ```bash
290
+ # 1. Start conversation โ€” grab the contextId
291
+ CTX=$(agentalk --json send https://agent.example.com -m "Plan a trip to Tokyo" \
292
+ | jq -r '.task.contextId')
293
+
294
+ # 2. Continue with context
295
+ agentalk send https://agent.example.com -m "Make it a 5-day trip" -c "$CTX"
296
+
297
+ # 3. Continue with task
298
+ agentalk send https://agent.example.com -m "Add restaurants" -c "$CTX" -t task-xyz
299
+ ```
300
+
301
+ ### Multi-tenant agents
302
+
303
+ ```bash
304
+ agentalk --tenant org_acme send https://agent.example.com -m "Hello"
305
+ ```
306
+
307
+ ---
308
+
309
+ ## Task States
310
+
311
+ | State | Icon | Description |
312
+ |-------|------|-------------|
313
+ | `TASK_STATE_SUBMITTED` | ๐Ÿ“ฅ | Task received by the agent |
314
+ | `TASK_STATE_WORKING` | โณ | Agent is processing |
315
+ | `TASK_STATE_COMPLETED` | โœ… | Finished successfully |
316
+ | `TASK_STATE_FAILED` | โŒ | Encountered an error |
317
+ | `TASK_STATE_CANCELED` | ๐Ÿšซ | Canceled by user |
318
+ | `TASK_STATE_INPUT_REQUIRED` | ๐Ÿ’ฌ | Agent needs more input |
319
+ | `TASK_STATE_REJECTED` | โ›” | Agent rejected the task |
320
+ | `TASK_STATE_AUTH_REQUIRED` | ๐Ÿ” | Authentication required |
321
+
322
+ ---
323
+
324
+ ## Architecture
325
+
326
+ ```mermaid
327
+ graph LR
328
+ subgraph CLI["๐Ÿ–ฅ๏ธ CLI Layer"]
329
+ A[cli.ts<br/>Commander.js] --> B[commands/agent.ts]
330
+ A --> C[commands/send.ts]
331
+ A --> D[commands/stream.ts]
332
+ A --> E[commands/task.ts]
333
+ end
334
+
335
+ subgraph Core["โš™๏ธ Core"]
336
+ F[client.ts<br/>A2AClient]
337
+ G[format.ts<br/>chalk output]
338
+ H[types.ts<br/>A2A v1.0 types]
339
+ end
340
+
341
+ B & C & D & E --> F
342
+ B & C & D & E --> G
343
+ F --> H
344
+
345
+ subgraph Remote["โ˜๏ธ Remote Agent"]
346
+ I["/.well-known/agent.json"]
347
+ J["POST /"]
348
+ K["POST /stream (SSE)"]
349
+ L["GET/POST /tasks/*"]
350
+ end
351
+
352
+ F -->|HTTP| I & J & K & L
353
+ ```
354
+
355
+ <details>
356
+ <summary>๐Ÿ“ <strong>Project structure</strong></summary>
357
+
358
+ ```
359
+ src/
360
+ โ”œโ”€โ”€ cli.ts # Entry point โ€” Commander.js CLI setup
361
+ โ”œโ”€โ”€ client.ts # A2AClient โ€” HTTP client for all A2A operations
362
+ โ”œโ”€โ”€ format.ts # Pretty-print formatters (chalk-powered)
363
+ โ”œโ”€โ”€ types.ts # Full A2A Protocol v1.0 TypeScript types
364
+ โ”œโ”€โ”€ commands/
365
+ โ”‚ โ”œโ”€โ”€ agent.ts # `agentalk agent` command
366
+ โ”‚ โ”œโ”€โ”€ send.ts # `agentalk send` command
367
+ โ”‚ โ”œโ”€โ”€ stream.ts # `agentalk stream` command
368
+ โ”‚ โ””โ”€โ”€ task.ts # `agentalk task {get,list,cancel}` commands
369
+ โ””โ”€โ”€ test/
370
+ โ”œโ”€โ”€ client.test.ts # A2AClient unit tests (mock fetch)
371
+ โ”œโ”€โ”€ format.test.ts # Formatter unit tests
372
+ โ””โ”€โ”€ cli.test.ts # CLI integration tests
373
+ ```
374
+
375
+ </details>
376
+
377
+ ---
378
+
379
+ ## Development
380
+
381
+ ```bash
382
+ # Install dependencies
383
+ pnpm install
384
+
385
+ # Build
386
+ pnpm build
387
+
388
+ # Watch mode
389
+ pnpm dev
390
+
391
+ # Run tests (72 tests)
392
+ pnpm test
393
+
394
+ # Link globally for local dev
395
+ pnpm link --global
396
+ ```
397
+
398
+ ### Requirements
399
+
400
+ | Dependency | Version |
401
+ |-----------|---------|
402
+ | Node.js | โ‰ฅ 22 |
403
+ | TypeScript | โ‰ฅ 5.7 |
404
+
405
+ > [!NOTE]
406
+ > Uses native `fetch` (no polyfill needed) and `node:test` for zero-dependency testing.
407
+
408
+ ---
409
+
410
+ ## Contributing
411
+
412
+ Contributions are welcome! Here's how:
413
+
414
+ 1. Fork the repo
415
+ 2. Create your branch (`git checkout -b feat/amazing-feature`)
416
+ 3. Make your changes
417
+ 4. Run the tests (`pnpm test`)
418
+ 5. Commit (`git commit -m 'feat: add amazing feature'`)
419
+ 6. Push (`git push origin feat/amazing-feature`)
420
+ 7. Open a Pull Request
421
+
422
+ > [!NOTE]
423
+ > Please follow [Conventional Commits](https://www.conventionalcommits.org/) for commit messages.
424
+
425
+ ---
426
+
427
+ ## Related
428
+
429
+ | Resource | Link |
430
+ |----------|------|
431
+ | A2A Protocol Spec | [google.github.io/A2A](https://google.github.io/A2A/) |
432
+ | A2A GitHub | [github.com/google/A2A](https://github.com/google/A2A) |
433
+ | npm Package | [npmjs.com/package/agentalk](https://www.npmjs.com/package/agentalk) |
434
+
435
+ ---
436
+
437
+ <div align="center">
438
+
439
+ **[MIT](./LICENSE) ยฉ 2026**
440
+
441
+ Made with โค๏ธ for the A2A ecosystem
442
+
443
+ [โฌ† Back to top](#-agentalk)
444
+
445
+ </div>