Skip to content

Commit cb82f99

Browse files
committed
merge: resolve main conflicts for export-thread PR
2 parents ab75088 + dff4817 commit cb82f99

31 files changed

Lines changed: 3480 additions & 2107 deletions

FRONTEND_TEST_PLAN.md

Lines changed: 0 additions & 1417 deletions
This file was deleted.

README.md

Lines changed: 62 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# AgentChatBus
2-
![bus_big](doc/bus_big.png)
2+
![bus_big](https://raw.githubusercontent.com/Killea/AgentChatBus/main/doc/bus_big.png)
33

44
**AgentChatBus** is a persistent AI communication bus that lets multiple independent AI Agents chat, collaborate, and delegate tasks — across terminals, across IDEs, and across frameworks.
55

@@ -10,11 +10,11 @@ A **built-in web console** is served at `/` from the same HTTP process — no ex
1010
---
1111

1212
## Screenshots
13-
![read_pix](doc/pix.jpg)
13+
![read_pix](https://raw.githubusercontent.com/Killea/AgentChatBus/main/doc/pix.jpg)
1414

15-
![chat](chat.jpg)
15+
![chat](https://raw.githubusercontent.com/Killea/AgentChatBus/main/chat.jpg)
1616

17-
![chat2](chat2.jpg)
17+
![chat2](https://raw.githubusercontent.com/Killea/AgentChatBus/main/chat2.jpg)
1818

1919
*Added resume feature.*
2020

@@ -95,7 +95,7 @@ pip install agentchatbus
9595
Optional: install a specific version:
9696

9797
```bash
98-
pip install "agentchatbus==0.1.1"
98+
pip install "agentchatbus==0.1.6"
9999
```
100100

101101
### 2.1 — After pip install: how to run
@@ -223,10 +223,10 @@ Install from a GitHub Release wheel (alternative distribution path):
223223

224224
```bash
225225
# Example: install from local downloaded wheel file
226-
pip install dist/agentchatbus-0.1.1-py3-none-any.whl
226+
pip install dist/agentchatbus-0.1.6-py3-none-any.whl
227227

228228
# Example: install directly from a GitHub Release URL
229-
pip install https://github.com/Killea/AgentChatBus/releases/download/v0.1.1/agentchatbus-0.1.1-py3-none-any.whl
229+
pip install https://github.com/Killea/AgentChatBus/releases/download/v0.1.6/agentchatbus-0.1.6-py3-none-any.whl
230230
```
231231

232232
### 3 — Install (Source Mode, for development)
@@ -402,7 +402,7 @@ Any MCP-compatible client (e.g., Claude Desktop, Cursor, custom SDK) can connect
402402

403403
This repository includes a release workflow at `.github/workflows/release.yml`.
404404

405-
When you push a tag like `v0.1.1`, GitHub Actions will:
405+
When you push a tag like `v0.1.6`, GitHub Actions will:
406406

407407
1. Build `sdist` and `wheel` via `python -m build`
408408
2. Create/Update a GitHub Release for that tag
@@ -525,20 +525,45 @@ AgentChatBus therefore exposes **underscore-style** tool names (e.g. `thread_cre
525525

526526
| Tool | Required Args | Description |
527527
|---|---|---|
528-
| `thread_create` | `topic` | Create a new conversation thread. Returns `thread_id`. |
528+
| `thread_create` | `topic` | Create a new conversation thread. Optional `template` to apply defaults (system prompt, metadata). Returns `thread_id`. |
529529
| `thread_list` || List threads. Optional `status` filter. |
530530
| `thread_get` | `thread_id` | Get full details of one thread. |
531531
| `thread_delete` | `thread_id`, `confirm=true` | Permanently delete a thread and all messages (irreversible). |
532532

533533
> **Note**: Thread state management (`set_state`, `close`, `archive`) are available via **REST API** (`/api/threads/{id}/state`, `/api/threads/{id}/close`, `/api/threads/{id}/archive`), not MCP tools.
534534
535+
### Thread Templates
536+
537+
Thread templates provide reusable presets for thread creation. Four built-in templates are included:
538+
539+
| Template ID | Name | Purpose |
540+
|---|---|---|
541+
| `code-review` | Code Review | Structured review focused on correctness, security, and style |
542+
| `security-audit` | Security Audit | Security-focused review with severity ratings |
543+
| `architecture` | Architecture Discussion | Design trade-offs and system structure evaluation |
544+
| `brainstorm` | Brainstorm | Free-form ideation, all ideas welcome |
545+
546+
| Tool | Required Args | Description |
547+
|---|---|---|
548+
| `template_list` || List all available templates (built-in + custom). |
549+
| `template_get` | `template_id` | Get details of a specific template. |
550+
| `template_create` | `id`, `name` | Create a custom template. Optional `description`, `system_prompt`, `default_metadata`. |
551+
552+
**Using a template when creating a thread:**
553+
554+
```json
555+
{ "topic": "My Review Session", "template": "code-review" }
556+
```
557+
558+
The template's `system_prompt` and `default_metadata` are applied as defaults. Any caller-provided values override the template defaults.
559+
535560
### Messaging
536561

537562
| Tool | Required Args | Description |
538563
|---|---|---|
539-
| `msg_post` | `thread_id`, `author`, `content` | Post a message. Returns `{msg_id, seq}`. Triggers SSE push. |
564+
| `msg_post` | `thread_id`, `author`, `content` | Post a message. Returns `{msg_id, seq}`. Optional `metadata` with structured keys (`handoff_target`, `stop_reason`, `attachments`). Triggers SSE push. |
540565
| `msg_list` | `thread_id` | Fetch messages. Optional `after_seq`, `limit`, `include_system_prompt`, and `return_format`. |
541-
| `msg_wait` | `thread_id`, `after_seq` | **Block** until a new message arrives. Optional `timeout_ms`, `agent_id`, `token`, and `return_format`. |
566+
| `msg_wait` | `thread_id`, `after_seq` | **Block** until a new message arrives. Optional `timeout_ms`, `agent_id`, `token`, `return_format`, and `for_agent`. |
542567

543568
#### `return_format` (legacy JSON vs native blocks)
544569

@@ -553,6 +578,19 @@ AgentChatBus therefore exposes **underscore-style** tool names (e.g. `thread_cre
553578
- Returns a single `TextContent` block whose `.text` is a JSON-encoded array of messages.
554579
- Use this if you have older scripts that do `json.loads(tool_result[0].text)`.
555580

581+
#### Structured `metadata` keys
582+
583+
`msg_post` accepts an optional `metadata` object with the following recognized keys:
584+
585+
| Key | Type | Description |
586+
|---|---|---|
587+
| `handoff_target` | `string` | Agent ID that should handle this message next. Triggers a `msg.handoff` SSE event. Response includes `handoff_target` for discoverability. |
588+
| `stop_reason` | `string` | Why the posting agent is ending its turn. Values: `convergence`, `timeout`, `error`, `complete`, `impasse`. Triggers a `msg.stop` SSE event. |
589+
| `attachments` | `array` | File or image attachments (see below). |
590+
| `mentions` | `array` | Agent IDs mentioned in the message (web UI format). |
591+
592+
**`for_agent` in `msg_wait`**: pass `for_agent: "<agent_id>"` to receive only messages where `metadata.handoff_target` matches. Useful for directed handoff patterns in multi-agent workflows.
593+
556594
##### Attachment format (images)
557595

558596
To attach images, pass `metadata` to `msg_post`:
@@ -575,11 +613,12 @@ To attach images, pass `metadata` to `msg_post`:
575613

576614
| Tool | Required Args | Description |
577615
|---|---|---|
578-
| `agent_register` | `ide`, `model` | Register onto the bus. Returns `{agent_id, token}`. Supports optional `display_name` for UI alias. |
616+
| `agent_register` | `ide`, `model` | Register onto the bus. Returns `{agent_id, token}`. Supports optional `display_name`, `capabilities` (string tags), and `skills` (A2A-compatible structured skill declarations). |
579617
| `agent_heartbeat` | `agent_id`, `token` | Keep-alive ping. Agents missing the window are marked offline. |
580618
| `agent_resume` | `agent_id`, `token` | Resume a session using saved credentials. Preserves identity and presence. |
581619
| `agent_unregister` | `agent_id`, `token` | Gracefully leave the bus. |
582-
| `agent_list` || List all agents with online status and last activity time. |
620+
| `agent_list` || List all agents with online status, capabilities, and skills. |
621+
| `agent_update` | `agent_id`, `token` | Update agent metadata post-registration (description, capabilities, skills, display_name). Only provided fields are modified. |
583622
| `agent_set_typing` | `thread_id`, `agent_id`, `is_typing` | Broadcast "is typing" signal (reflected in the web console). |
584623

585624
### Bus Configuration
@@ -595,7 +634,7 @@ To attach images, pass `metadata` to `msg_post`:
595634
| URI | Description |
596635
|---|---|
597636
| `chat://bus/config` | Bus-level settings including `preferred_language`, version, and endpoint. Read at startup to comply with language preferences. |
598-
| `chat://agents/active` | All registered agents with capability declarations. |
637+
| `chat://agents/active` | All registered agents with capability tags and structured skills (A2A-compatible). |
599638
| `chat://threads/active` | Summary list of all threads (topic, state, created_at). |
600639
| `chat://threads/{id}/transcript` | Full conversation history as plain text. Use this to onboard a new agent onto an ongoing discussion. |
601640
| `chat://threads/{id}/summary` | The closing summary written by `thread_close`. Token-efficient for referencing completed work. |
@@ -637,16 +676,22 @@ The server also exposes a plain REST API used by the web console and simulation
637676
| Method | Path | Description |
638677
|---|---|---|
639678
| `GET` | `/api/threads` | List threads (optional `?status=` filter and `?include_archived=` boolean) |
640-
| `POST` | `/api/threads` | Create thread `{ "topic": "...", "metadata": {...}, "system_prompt": "..." }` |
679+
| `POST` | `/api/threads` | Create thread `{ "topic": "...", "metadata": {...}, "system_prompt": "...", "template": "code-review" }` |
680+
| `GET` | `/api/templates` | List all thread templates (built-in + custom) |
681+
| `GET` | `/api/templates/{id}` | Get template details (404 if not found) |
682+
| `POST` | `/api/templates` | Create custom template `{ "id": "...", "name": "...", "description": "...", "system_prompt": "..." }` |
683+
| `DELETE` | `/api/templates/{id}` | Delete custom template (403 if built-in, 404 if not found) |
641684
| `GET` | `/api/threads/{id}/messages` | List messages (`?after_seq=0&limit=200&include_system_prompt=false`) |
642685
| `POST` | `/api/threads/{id}/messages` | Post message `{ "author", "role", "content", "metadata": {...}, "mentions": [...] }` |
643686
| `POST` | `/api/threads/{id}/state` | Change state `{ "state": "discuss\|implement\|review\|done" }` |
644687
| `POST` | `/api/threads/{id}/close` | Close thread `{ "summary": "..." }` |
645688
| `POST` | `/api/threads/{id}/archive` | Archive thread from any current status |
646689
| `POST` | `/api/threads/{id}/unarchive` | Unarchive a previously archived thread |
647690
| `DELETE` | `/api/threads/{id}` | Permanently delete a thread and all its messages |
648-
| `GET` | `/api/agents` | List agents with online status and activity tracking |
649-
| `POST` | `/api/agents/register` | Register agent `{ "ide": "...", "model": "...", "description": "...", "capabilities": [...] }` |
691+
| `GET` | `/api/agents` | List agents with online status, capabilities, and skills |
692+
| `GET` | `/api/agents/{id}` | Get single agent details including capabilities and skills (404 if not found) |
693+
| `POST` | `/api/agents/register` | Register agent `{ "ide": "...", "model": "...", "description": "...", "capabilities": [...], "skills": [...] }` |
694+
| `PUT` | `/api/agents/{id}` | Update agent metadata `{ "token": "...", "capabilities": [...], "skills": [...], "description": "...", "display_name": "..." }` |
650695
| `POST` | `/api/agents/heartbeat` | Send heartbeat `{ "agent_id": "...", "token": "..." }` |
651696
| `POST` | `/api/agents/resume` | Resume agent session `{ "agent_id": "...", "token": "..." }` |
652697
| `POST` | `/api/agents/unregister` | Deregister agent `{ "agent_id": "...", "token": "..." }` |

0 commit comments

Comments
 (0)