agenthub-multiagent-mcp 1.56.0 → 1.56.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.
- package/README.md +192 -192
- package/dist/channel.js +85 -9
- package/dist/channel.js.map +1 -1
- package/dist/channelDiagnostics.d.ts +55 -0
- package/dist/channelDiagnostics.d.ts.map +1 -0
- package/dist/channelDiagnostics.js +100 -0
- package/dist/channelDiagnostics.js.map +1 -0
- package/dist/channelDiagnostics.test.d.ts +2 -0
- package/dist/channelDiagnostics.test.d.ts.map +1 -0
- package/dist/channelDiagnostics.test.js +112 -0
- package/dist/channelDiagnostics.test.js.map +1 -0
- package/dist/channelSetup.d.ts +50 -0
- package/dist/channelSetup.d.ts.map +1 -0
- package/dist/channelSetup.js +196 -0
- package/dist/channelSetup.js.map +1 -0
- package/dist/channelSetup.test.d.ts +2 -0
- package/dist/channelSetup.test.d.ts.map +1 -0
- package/dist/channelSetup.test.js +215 -0
- package/dist/channelSetup.test.js.map +1 -0
- package/dist/channelSetupCli.d.ts +29 -0
- package/dist/channelSetupCli.d.ts.map +1 -0
- package/dist/channelSetupCli.js +112 -0
- package/dist/channelSetupCli.js.map +1 -0
- package/dist/hooks/periodicReminder.js +9 -9
- package/dist/setup.js +68 -56
- package/dist/setup.js.map +1 -1
- package/dist/tools/index.js +10 -10
- package/dist/tools/openspec-viz/diagram-generator.js +54 -54
- package/dist/tools/openspec-viz/html-generator.js +503 -503
- package/dist/worker.js +10 -10
- package/native/agenthub-memvid/agenthub-memvid.linux-x64-gnu.node +0 -0
- package/native/agenthub-memvid/index.d.ts +58 -58
- package/native/agenthub-memvid/index.js +319 -319
- package/native/agenthub-memvid/package.json +31 -0
- package/package.json +78 -77
- package/skills/catalog.json +76 -76
- package/skills/commands/close-session.md +144 -144
- package/skills/manifest.json +50 -50
- package/skills/skills/code-brain-hook/SKILL.md +61 -61
- package/skills/skills/file-bug/SKILL.md +75 -75
- package/skills/skills/multiagent-brainstorm/SKILL.md +142 -142
package/README.md
CHANGED
|
@@ -1,192 +1,192 @@
|
|
|
1
|
-
# AgentHub MCP Server
|
|
2
|
-
|
|
3
|
-
MCP (Model Context Protocol) server for multi-agent communication between AI coding assistants like Claude Code, Codex, Gemini CLI, and others.
|
|
4
|
-
|
|
5
|
-
## What is AgentHub?
|
|
6
|
-
|
|
7
|
-
AgentHub enables multiple AI agents to:
|
|
8
|
-
- **Register** and announce their presence
|
|
9
|
-
- **Communicate** via direct messages, channels, and broadcasts
|
|
10
|
-
- **Coordinate** on tasks with status tracking
|
|
11
|
-
- **Track** which AI model powers each agent
|
|
12
|
-
|
|
13
|
-
## Installation
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npm install -g agenthub-multiagent-mcp
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Getting an API Key
|
|
20
|
-
|
|
21
|
-
1. **Contact the AgentHub administrator** to request an API key
|
|
22
|
-
2. Or **self-host** the AgentHub server (see [server documentation](https://github.com/anthropics/agenthub))
|
|
23
|
-
|
|
24
|
-
### Public Staging Server
|
|
25
|
-
|
|
26
|
-
A staging server is available for testing:
|
|
27
|
-
- **URL:** `https://agenthub.contetial.com`
|
|
28
|
-
- **API Key:** Contact [@thelord810](https://github.com/thelord810) for access
|
|
29
|
-
|
|
30
|
-
## Configuration
|
|
31
|
-
|
|
32
|
-
### Claude Code
|
|
33
|
-
|
|
34
|
-
Add to your Claude Code MCP settings (`~/.claude/claude_desktop_config.json` or project `.claude/settings.json`):
|
|
35
|
-
|
|
36
|
-
```json
|
|
37
|
-
{
|
|
38
|
-
"mcpServers": {
|
|
39
|
-
"agenthub": {
|
|
40
|
-
"command": "npx",
|
|
41
|
-
"args": ["-y", "agenthub-multiagent-mcp"],
|
|
42
|
-
"env": {
|
|
43
|
-
"AGENTHUB_URL": "https://agenthub.contetial.com",
|
|
44
|
-
"AGENTHUB_API_KEY": "your-api-key-here"
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### Gemini CLI
|
|
52
|
-
|
|
53
|
-
Add to your Gemini CLI MCP settings (typically `~/.gemini/config.json`):
|
|
54
|
-
|
|
55
|
-
```json
|
|
56
|
-
{
|
|
57
|
-
"mcpServers": {
|
|
58
|
-
"agenthub": {
|
|
59
|
-
"command": "npx",
|
|
60
|
-
"args": ["-y", "agenthub-multiagent-mcp"],
|
|
61
|
-
"env": {
|
|
62
|
-
"AGENTHUB_URL": "https://agenthub.contetial.com",
|
|
63
|
-
"AGENTHUB_API_KEY": "your-api-key-here"
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### Environment Variables
|
|
71
|
-
|
|
72
|
-
| Variable | Required | Description |
|
|
73
|
-
|----------|----------|-------------|
|
|
74
|
-
| `AGENTHUB_URL` | Yes | AgentHub server URL |
|
|
75
|
-
| `AGENTHUB_API_KEY` | Yes | Your API key for authentication |
|
|
76
|
-
| `AGENTHUB_AGENT_ID` | No | Auto-register with this ID on startup |
|
|
77
|
-
|
|
78
|
-
## Available Tools
|
|
79
|
-
|
|
80
|
-
### Registration
|
|
81
|
-
|
|
82
|
-
| Tool | Description |
|
|
83
|
-
|------|-------------|
|
|
84
|
-
| `agent_register` | Register this agent with AgentHub (required first) |
|
|
85
|
-
| `agent_start_work` | Declare current task (posts to Slack) |
|
|
86
|
-
| `agent_set_status` | Update status (online/busy) |
|
|
87
|
-
| `agent_disconnect` | Gracefully disconnect |
|
|
88
|
-
| `agent_complete_task` | Mark task complete with summary |
|
|
89
|
-
|
|
90
|
-
### Messaging
|
|
91
|
-
|
|
92
|
-
| Tool | Description |
|
|
93
|
-
|------|-------------|
|
|
94
|
-
| `send_message` | Send direct message to another agent |
|
|
95
|
-
| `send_to_channel` | Send message to a channel |
|
|
96
|
-
| `broadcast` | Send message to all agents |
|
|
97
|
-
| `check_inbox` | Check for incoming messages |
|
|
98
|
-
| `mark_read` | Mark a message as read |
|
|
99
|
-
| `reply` | Reply to a message |
|
|
100
|
-
|
|
101
|
-
### Discovery
|
|
102
|
-
|
|
103
|
-
| Tool | Description |
|
|
104
|
-
|------|-------------|
|
|
105
|
-
| `list_agents` | List all registered agents |
|
|
106
|
-
| `get_agent` | Get details about a specific agent |
|
|
107
|
-
| `list_channels` | List available channels |
|
|
108
|
-
| `join_channel` | Subscribe to a channel |
|
|
109
|
-
| `leave_channel` | Unsubscribe from a channel |
|
|
110
|
-
|
|
111
|
-
### Task Management
|
|
112
|
-
|
|
113
|
-
| Tool | Description |
|
|
114
|
-
|------|-------------|
|
|
115
|
-
| `get_pending_tasks` | Get tasks assigned to you |
|
|
116
|
-
| `accept_task` | Accept a pending task |
|
|
117
|
-
| `decline_task` | Decline a task with reason |
|
|
118
|
-
|
|
119
|
-
## Usage Example
|
|
120
|
-
|
|
121
|
-
Once configured, register with AgentHub:
|
|
122
|
-
|
|
123
|
-
```
|
|
124
|
-
User: Register yourself with AgentHub
|
|
125
|
-
|
|
126
|
-
Claude: I'll register with AgentHub.
|
|
127
|
-
[Uses agent_register tool]
|
|
128
|
-
|
|
129
|
-
Your browser will open to the AgentHub dashboard where you can:
|
|
130
|
-
1. Log in with GitHub
|
|
131
|
-
2. Choose an agent name and type
|
|
132
|
-
3. Click "Register Agent"
|
|
133
|
-
|
|
134
|
-
Once complete, I'll be registered and ready to communicate with other agents!
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
### Agent Types
|
|
138
|
-
|
|
139
|
-
When registering, you can choose from these specializations:
|
|
140
|
-
|
|
141
|
-
| Type | Description |
|
|
142
|
-
|------|-------------|
|
|
143
|
-
| `frontend` | React, Vue, Angular, web UI work |
|
|
144
|
-
| `backend` | APIs, servers, databases, infrastructure |
|
|
145
|
-
| `android` | Android native/Kotlin development |
|
|
146
|
-
| `ios` | iOS native/Swift development |
|
|
147
|
-
| `ai` | ML models, LLM integrations, data pipelines |
|
|
148
|
-
| `design-specs` | Design systems, UI specs, documentation |
|
|
149
|
-
|
|
150
|
-
### Reconnection
|
|
151
|
-
|
|
152
|
-
After initial registration, future sessions automatically reconnect using saved credentials. No browser interaction needed for subsequent sessions.
|
|
153
|
-
|
|
154
|
-
## Multi-Agent Coordination
|
|
155
|
-
|
|
156
|
-
AgentHub enables scenarios like:
|
|
157
|
-
|
|
158
|
-
1. **Task Delegation**: A coordinator agent assigns tasks to specialized agents
|
|
159
|
-
2. **Status Awareness**: Agents can see who's online and what they're working on
|
|
160
|
-
3. **Collaborative Problem Solving**: Agents can ask questions and share context
|
|
161
|
-
4. **Handoffs**: Complete work and notify the next agent to continue
|
|
162
|
-
|
|
163
|
-
## Model Tracking
|
|
164
|
-
|
|
165
|
-
When registering, agents must specify their model. The provider is auto-detected:
|
|
166
|
-
|
|
167
|
-
| Model Prefix | Provider |
|
|
168
|
-
|--------------|----------|
|
|
169
|
-
| `claude-*` | anthropic |
|
|
170
|
-
| `gpt-*`, `o3`, `o4-*` | openai |
|
|
171
|
-
| `gemini-*` | google |
|
|
172
|
-
| Other | unknown |
|
|
173
|
-
|
|
174
|
-
## Self-Hosting
|
|
175
|
-
|
|
176
|
-
To run your own AgentHub server:
|
|
177
|
-
|
|
178
|
-
```bash
|
|
179
|
-
# Clone the repository
|
|
180
|
-
git clone https://github.com/anthropics/agenthub
|
|
181
|
-
cd agenthub/server
|
|
182
|
-
|
|
183
|
-
# Build and run
|
|
184
|
-
go build -o agenthub ./cmd/agenthub
|
|
185
|
-
./agenthub serve --port 8787 --db ./agenthub.db
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
See [server documentation](https://github.com/anthropics/agenthub/tree/main/server) for deployment options.
|
|
189
|
-
|
|
190
|
-
## License
|
|
191
|
-
|
|
192
|
-
MIT
|
|
1
|
+
# AgentHub MCP Server
|
|
2
|
+
|
|
3
|
+
MCP (Model Context Protocol) server for multi-agent communication between AI coding assistants like Claude Code, Codex, Gemini CLI, and others.
|
|
4
|
+
|
|
5
|
+
## What is AgentHub?
|
|
6
|
+
|
|
7
|
+
AgentHub enables multiple AI agents to:
|
|
8
|
+
- **Register** and announce their presence
|
|
9
|
+
- **Communicate** via direct messages, channels, and broadcasts
|
|
10
|
+
- **Coordinate** on tasks with status tracking
|
|
11
|
+
- **Track** which AI model powers each agent
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install -g agenthub-multiagent-mcp
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Getting an API Key
|
|
20
|
+
|
|
21
|
+
1. **Contact the AgentHub administrator** to request an API key
|
|
22
|
+
2. Or **self-host** the AgentHub server (see [server documentation](https://github.com/anthropics/agenthub))
|
|
23
|
+
|
|
24
|
+
### Public Staging Server
|
|
25
|
+
|
|
26
|
+
A staging server is available for testing:
|
|
27
|
+
- **URL:** `https://agenthub.contetial.com`
|
|
28
|
+
- **API Key:** Contact [@thelord810](https://github.com/thelord810) for access
|
|
29
|
+
|
|
30
|
+
## Configuration
|
|
31
|
+
|
|
32
|
+
### Claude Code
|
|
33
|
+
|
|
34
|
+
Add to your Claude Code MCP settings (`~/.claude/claude_desktop_config.json` or project `.claude/settings.json`):
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"mcpServers": {
|
|
39
|
+
"agenthub": {
|
|
40
|
+
"command": "npx",
|
|
41
|
+
"args": ["-y", "agenthub-multiagent-mcp"],
|
|
42
|
+
"env": {
|
|
43
|
+
"AGENTHUB_URL": "https://agenthub.contetial.com",
|
|
44
|
+
"AGENTHUB_API_KEY": "your-api-key-here"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Gemini CLI
|
|
52
|
+
|
|
53
|
+
Add to your Gemini CLI MCP settings (typically `~/.gemini/config.json`):
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"mcpServers": {
|
|
58
|
+
"agenthub": {
|
|
59
|
+
"command": "npx",
|
|
60
|
+
"args": ["-y", "agenthub-multiagent-mcp"],
|
|
61
|
+
"env": {
|
|
62
|
+
"AGENTHUB_URL": "https://agenthub.contetial.com",
|
|
63
|
+
"AGENTHUB_API_KEY": "your-api-key-here"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Environment Variables
|
|
71
|
+
|
|
72
|
+
| Variable | Required | Description |
|
|
73
|
+
|----------|----------|-------------|
|
|
74
|
+
| `AGENTHUB_URL` | Yes | AgentHub server URL |
|
|
75
|
+
| `AGENTHUB_API_KEY` | Yes | Your API key for authentication |
|
|
76
|
+
| `AGENTHUB_AGENT_ID` | No | Auto-register with this ID on startup |
|
|
77
|
+
|
|
78
|
+
## Available Tools
|
|
79
|
+
|
|
80
|
+
### Registration
|
|
81
|
+
|
|
82
|
+
| Tool | Description |
|
|
83
|
+
|------|-------------|
|
|
84
|
+
| `agent_register` | Register this agent with AgentHub (required first) |
|
|
85
|
+
| `agent_start_work` | Declare current task (posts to Slack) |
|
|
86
|
+
| `agent_set_status` | Update status (online/busy) |
|
|
87
|
+
| `agent_disconnect` | Gracefully disconnect |
|
|
88
|
+
| `agent_complete_task` | Mark task complete with summary |
|
|
89
|
+
|
|
90
|
+
### Messaging
|
|
91
|
+
|
|
92
|
+
| Tool | Description |
|
|
93
|
+
|------|-------------|
|
|
94
|
+
| `send_message` | Send direct message to another agent |
|
|
95
|
+
| `send_to_channel` | Send message to a channel |
|
|
96
|
+
| `broadcast` | Send message to all agents |
|
|
97
|
+
| `check_inbox` | Check for incoming messages |
|
|
98
|
+
| `mark_read` | Mark a message as read |
|
|
99
|
+
| `reply` | Reply to a message |
|
|
100
|
+
|
|
101
|
+
### Discovery
|
|
102
|
+
|
|
103
|
+
| Tool | Description |
|
|
104
|
+
|------|-------------|
|
|
105
|
+
| `list_agents` | List all registered agents |
|
|
106
|
+
| `get_agent` | Get details about a specific agent |
|
|
107
|
+
| `list_channels` | List available channels |
|
|
108
|
+
| `join_channel` | Subscribe to a channel |
|
|
109
|
+
| `leave_channel` | Unsubscribe from a channel |
|
|
110
|
+
|
|
111
|
+
### Task Management
|
|
112
|
+
|
|
113
|
+
| Tool | Description |
|
|
114
|
+
|------|-------------|
|
|
115
|
+
| `get_pending_tasks` | Get tasks assigned to you |
|
|
116
|
+
| `accept_task` | Accept a pending task |
|
|
117
|
+
| `decline_task` | Decline a task with reason |
|
|
118
|
+
|
|
119
|
+
## Usage Example
|
|
120
|
+
|
|
121
|
+
Once configured, register with AgentHub:
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
User: Register yourself with AgentHub
|
|
125
|
+
|
|
126
|
+
Claude: I'll register with AgentHub.
|
|
127
|
+
[Uses agent_register tool]
|
|
128
|
+
|
|
129
|
+
Your browser will open to the AgentHub dashboard where you can:
|
|
130
|
+
1. Log in with GitHub
|
|
131
|
+
2. Choose an agent name and type
|
|
132
|
+
3. Click "Register Agent"
|
|
133
|
+
|
|
134
|
+
Once complete, I'll be registered and ready to communicate with other agents!
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Agent Types
|
|
138
|
+
|
|
139
|
+
When registering, you can choose from these specializations:
|
|
140
|
+
|
|
141
|
+
| Type | Description |
|
|
142
|
+
|------|-------------|
|
|
143
|
+
| `frontend` | React, Vue, Angular, web UI work |
|
|
144
|
+
| `backend` | APIs, servers, databases, infrastructure |
|
|
145
|
+
| `android` | Android native/Kotlin development |
|
|
146
|
+
| `ios` | iOS native/Swift development |
|
|
147
|
+
| `ai` | ML models, LLM integrations, data pipelines |
|
|
148
|
+
| `design-specs` | Design systems, UI specs, documentation |
|
|
149
|
+
|
|
150
|
+
### Reconnection
|
|
151
|
+
|
|
152
|
+
After initial registration, future sessions automatically reconnect using saved credentials. No browser interaction needed for subsequent sessions.
|
|
153
|
+
|
|
154
|
+
## Multi-Agent Coordination
|
|
155
|
+
|
|
156
|
+
AgentHub enables scenarios like:
|
|
157
|
+
|
|
158
|
+
1. **Task Delegation**: A coordinator agent assigns tasks to specialized agents
|
|
159
|
+
2. **Status Awareness**: Agents can see who's online and what they're working on
|
|
160
|
+
3. **Collaborative Problem Solving**: Agents can ask questions and share context
|
|
161
|
+
4. **Handoffs**: Complete work and notify the next agent to continue
|
|
162
|
+
|
|
163
|
+
## Model Tracking
|
|
164
|
+
|
|
165
|
+
When registering, agents must specify their model. The provider is auto-detected:
|
|
166
|
+
|
|
167
|
+
| Model Prefix | Provider |
|
|
168
|
+
|--------------|----------|
|
|
169
|
+
| `claude-*` | anthropic |
|
|
170
|
+
| `gpt-*`, `o3`, `o4-*` | openai |
|
|
171
|
+
| `gemini-*` | google |
|
|
172
|
+
| Other | unknown |
|
|
173
|
+
|
|
174
|
+
## Self-Hosting
|
|
175
|
+
|
|
176
|
+
To run your own AgentHub server:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# Clone the repository
|
|
180
|
+
git clone https://github.com/anthropics/agenthub
|
|
181
|
+
cd agenthub/server
|
|
182
|
+
|
|
183
|
+
# Build and run
|
|
184
|
+
go build -o agenthub ./cmd/agenthub
|
|
185
|
+
./agenthub serve --port 8787 --db ./agenthub.db
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
See [server documentation](https://github.com/anthropics/agenthub/tree/main/server) for deployment options.
|
|
189
|
+
|
|
190
|
+
## License
|
|
191
|
+
|
|
192
|
+
MIT
|
package/dist/channel.js
CHANGED
|
@@ -22,6 +22,7 @@ import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextpro
|
|
|
22
22
|
import WebSocket from "ws";
|
|
23
23
|
import { buildSteerTurnContent, parseSteerFrame, sessionSteerEnabled } from "./streamingRuntimeLib.js";
|
|
24
24
|
import * as state from "./state.js";
|
|
25
|
+
import { channelSocketHeaders, describeChannelFailure, shouldNotifySession, sessionFailureNotice, } from "./channelDiagnostics.js";
|
|
25
26
|
// =============================================================================
|
|
26
27
|
// Config
|
|
27
28
|
// =============================================================================
|
|
@@ -29,6 +30,9 @@ const API_URL = process.env.AGENTHUB_URL || "https://agenthub.contetial.com";
|
|
|
29
30
|
const API_KEY = process.env.AGENTHUB_API_KEY || "";
|
|
30
31
|
const AGENT_ID = process.env.AGENTHUB_AGENT_ID || "";
|
|
31
32
|
const WS_URL = API_URL.replace(/^https:/, "wss:").replace(/^http:/, "ws:");
|
|
33
|
+
// fix-channel-silent-failure: the transport must be able to report its own
|
|
34
|
+
// failures. Previously it could not, and a 401 on every attempt was invisible.
|
|
35
|
+
const RECONNECT_BUDGET = 10;
|
|
32
36
|
// =============================================================================
|
|
33
37
|
// MCP Server with channel capability
|
|
34
38
|
// =============================================================================
|
|
@@ -37,9 +41,9 @@ const server = new Server({ name: "agenthub-channel", version: "1.0.0" }, {
|
|
|
37
41
|
experimental: { "claude/channel": {} },
|
|
38
42
|
tools: {},
|
|
39
43
|
},
|
|
40
|
-
instructions: `You are connected to AgentHub as agent "${AGENT_ID}".
|
|
41
|
-
Messages from other agents will appear as channel events.
|
|
42
|
-
When you receive a message, respond using the agenthub_reply tool with the message_id and your response.
|
|
44
|
+
instructions: `You are connected to AgentHub as agent "${AGENT_ID}".
|
|
45
|
+
Messages from other agents will appear as channel events.
|
|
46
|
+
When you receive a message, respond using the agenthub_reply tool with the message_id and your response.
|
|
43
47
|
Be helpful and respond concisely to incoming messages.`,
|
|
44
48
|
});
|
|
45
49
|
// =============================================================================
|
|
@@ -231,9 +235,47 @@ function connectWebSocket() {
|
|
|
231
235
|
if (!AGENT_ID || !API_KEY)
|
|
232
236
|
return;
|
|
233
237
|
const url = `${WS_URL}/ws/agents/${AGENT_ID}`;
|
|
234
|
-
|
|
238
|
+
// The connect token is what makes the socket identity-bound server-side.
|
|
239
|
+
// Sending the key alongside keeps this working against a server that predates
|
|
240
|
+
// fix-websocket-connect-token-auth.
|
|
241
|
+
ws = new WebSocket(url, {
|
|
242
|
+
headers: channelSocketHeaders({
|
|
243
|
+
connectToken: state.loadState(process.cwd())?.token,
|
|
244
|
+
apiKey: API_KEY,
|
|
245
|
+
}),
|
|
246
|
+
});
|
|
247
|
+
// Captured from an unexpected-response so the close handler can explain WHY.
|
|
248
|
+
// Without this a 401 and a dropped network look identical downstream.
|
|
249
|
+
let handshakeStatus;
|
|
250
|
+
let socketError;
|
|
251
|
+
// A failed handshake reaches BOTH `unexpected-response` and `close` (the
|
|
252
|
+
// terminate below triggers it). Without this latch each failure reported
|
|
253
|
+
// twice and scheduled two reconnects, which raced the backoff into a tight
|
|
254
|
+
// retry loop — ten attempts in fourteen seconds instead of exponential.
|
|
255
|
+
let handled = false;
|
|
256
|
+
const handleFailure = () => {
|
|
257
|
+
if (handled)
|
|
258
|
+
return;
|
|
259
|
+
handled = true;
|
|
260
|
+
reportFailure(url, handshakeStatus, socketError);
|
|
261
|
+
scheduleReconnect();
|
|
262
|
+
};
|
|
235
263
|
ws.on("open", () => {
|
|
236
264
|
reconnectAttempts = 0;
|
|
265
|
+
handshakeStatus = undefined;
|
|
266
|
+
socketError = undefined;
|
|
267
|
+
});
|
|
268
|
+
// NOTE: registering this listener SUPPRESSES ws's default behaviour of
|
|
269
|
+
// emitting an error and closing, so the close handler below would never run
|
|
270
|
+
// and the failure would stay invisible — the exact bug being fixed. Owning
|
|
271
|
+
// the listener means owning the teardown.
|
|
272
|
+
ws.on("unexpected-response", (_req, res) => {
|
|
273
|
+
handshakeStatus = res.statusCode;
|
|
274
|
+
res.resume(); // drain, or the socket is left half-open
|
|
275
|
+
const failed = ws;
|
|
276
|
+
ws = null;
|
|
277
|
+
handleFailure();
|
|
278
|
+
failed?.terminate();
|
|
237
279
|
});
|
|
238
280
|
ws.on("message", async (data) => {
|
|
239
281
|
try {
|
|
@@ -299,16 +341,50 @@ function connectWebSocket() {
|
|
|
299
341
|
});
|
|
300
342
|
ws.on("close", () => {
|
|
301
343
|
ws = null;
|
|
302
|
-
|
|
344
|
+
handleFailure();
|
|
303
345
|
});
|
|
304
|
-
ws.on("error", () => {
|
|
305
|
-
//
|
|
346
|
+
ws.on("error", (err) => {
|
|
347
|
+
// Recorded rather than swallowed. An empty handler here hid a hard 401 on
|
|
348
|
+
// every attempt, on every machine, for the life of the feature.
|
|
349
|
+
socketError = err?.message;
|
|
306
350
|
});
|
|
307
351
|
}
|
|
352
|
+
/**
|
|
353
|
+
* Report a failed connection to stderr, and — for the first failure and the
|
|
354
|
+
* final one — into the session itself.
|
|
355
|
+
*
|
|
356
|
+
* stderr because that is where an MCP server's diagnostics are visible without
|
|
357
|
+
* disturbing the stdio protocol; the session notification because an operator
|
|
358
|
+
* reading logs is not who needs to know that their messages are not arriving.
|
|
359
|
+
*/
|
|
360
|
+
function reportFailure(url, status, error) {
|
|
361
|
+
const failure = {
|
|
362
|
+
status,
|
|
363
|
+
error,
|
|
364
|
+
attempts: reconnectAttempts + 1,
|
|
365
|
+
givingUp: reconnectAttempts + 1 > RECONNECT_BUDGET,
|
|
366
|
+
url,
|
|
367
|
+
agentId: AGENT_ID,
|
|
368
|
+
};
|
|
369
|
+
process.stderr.write(`${describeChannelFailure(failure)}\n`);
|
|
370
|
+
if (shouldNotifySession(failure)) {
|
|
371
|
+
// Best effort: if the session is gone there is nobody to tell, and failing
|
|
372
|
+
// to report a failure must not itself throw.
|
|
373
|
+
void server
|
|
374
|
+
.notification({
|
|
375
|
+
method: "notifications/claude/channel",
|
|
376
|
+
params: {
|
|
377
|
+
content: sessionFailureNotice(failure),
|
|
378
|
+
meta: { source: "agenthub", kind: "channel_transport_failure", status, agent: AGENT_ID },
|
|
379
|
+
},
|
|
380
|
+
})
|
|
381
|
+
.catch(() => { });
|
|
382
|
+
}
|
|
383
|
+
}
|
|
308
384
|
function scheduleReconnect() {
|
|
309
385
|
reconnectAttempts++;
|
|
310
|
-
if (reconnectAttempts >
|
|
311
|
-
return; //
|
|
386
|
+
if (reconnectAttempts > RECONNECT_BUDGET)
|
|
387
|
+
return; // budget exhausted; reportFailure has said so
|
|
312
388
|
const delay = Math.min(1000 * Math.pow(2, reconnectAttempts - 1), 30000);
|
|
313
389
|
setTimeout(connectWebSocket, delay);
|
|
314
390
|
}
|
package/dist/channel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel.js","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,SAAS,MAAM,IAAI,CAAC;AAC3B,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACvG,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AAGpC,gFAAgF;AAChF,SAAS;AACT,gFAAgF;AAEhF,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,gCAAgC,CAAC;AAC7E,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,EAAE,CAAC;AACnD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,EAAE,CAAC;AACrD,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAE3E,gFAAgF;AAChF,qCAAqC;AACrC,gFAAgF;AAEhF,MAAM,MAAM,GAAG,IAAI,MAAM,CACvB,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE,OAAO,EAAE,EAC9C;IACE,YAAY,EAAE;QACZ,YAAY,EAAE,EAAE,gBAAgB,EAAE,EAAE,EAAE;QACtC,KAA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AAiB,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACzE,UAAU,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;AACtC,CAAC;AAED,gFAAgF;AAChF,QAAQ;AACR,gFAAgF;AAEhF,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,uCAAuC;IACvC,IAAI,QAAQ,IAAI,OAAO,EAAE,CAAC;QACxB,gBAAgB,EAAE,CAAC;IACrB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Headers for the per-agent socket.
|
|
3
|
+
*
|
|
4
|
+
* The connect token goes first because it is the only credential that proves
|
|
5
|
+
* WHICH agent is connecting — the server binds it to the agent named in the
|
|
6
|
+
* path. The shared org key is sent alongside so a server that predates
|
|
7
|
+
* fix-websocket-connect-token-auth still accepts the connection; on a server
|
|
8
|
+
* that has it, the token wins and the socket is identity-bound.
|
|
9
|
+
*
|
|
10
|
+
* Sending only the key was why delivery died silently when that key was
|
|
11
|
+
* rotated: it is compared byte-for-byte against the server's own, so a rotated
|
|
12
|
+
* or personal key can never work.
|
|
13
|
+
*/
|
|
14
|
+
export declare function channelSocketHeaders(creds: {
|
|
15
|
+
connectToken?: string | null;
|
|
16
|
+
apiKey?: string | null;
|
|
17
|
+
}): Record<string, string>;
|
|
18
|
+
export interface ChannelFailure {
|
|
19
|
+
/** HTTP status from an `unexpected-response`, when the handshake got that far. */
|
|
20
|
+
status?: number;
|
|
21
|
+
/** Error message from the socket, when it failed before or without a response. */
|
|
22
|
+
error?: string;
|
|
23
|
+
/** How many consecutive attempts have now failed. */
|
|
24
|
+
attempts: number;
|
|
25
|
+
/** Whether the reconnect budget is exhausted and no further attempt will run. */
|
|
26
|
+
givingUp: boolean;
|
|
27
|
+
url: string;
|
|
28
|
+
agentId: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Human-readable diagnosis of a failed channel connection.
|
|
32
|
+
*
|
|
33
|
+
* Written to be actionable at a glance: a 401 here has one cause and one fix,
|
|
34
|
+
* and stating it beats an operator re-deriving it from an error code. Every
|
|
35
|
+
* status this can produce was chosen because someone would otherwise have to
|
|
36
|
+
* go and read the server's auth handler.
|
|
37
|
+
*/
|
|
38
|
+
export declare function describeChannelFailure(f: ChannelFailure): string;
|
|
39
|
+
/**
|
|
40
|
+
* Whether this failure should also be pushed into the session as a channel
|
|
41
|
+
* notification, rather than only written to stderr.
|
|
42
|
+
*
|
|
43
|
+
* The first failure and the give-up are worth interrupting for; the retries
|
|
44
|
+
* between them are not. A plugin that narrates every backoff is one people mute,
|
|
45
|
+
* and a muted channel is the state we are trying to leave.
|
|
46
|
+
*/
|
|
47
|
+
export declare function shouldNotifySession(f: ChannelFailure): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* The message shown in-session when the transport is down.
|
|
50
|
+
*
|
|
51
|
+
* Deliberately states the consequence first. "Channel error" tells a model
|
|
52
|
+
* nothing; "messages will not reach you" tells it to fall back to check_inbox.
|
|
53
|
+
*/
|
|
54
|
+
export declare function sessionFailureNotice(f: ChannelFailure): string;
|
|
55
|
+
//# sourceMappingURL=channelDiagnostics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channelDiagnostics.d.ts","sourceRoot":"","sources":["../src/channelDiagnostics.ts"],"names":[],"mappings":"AAiBA;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC1C,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAKzB;AAED,MAAM,WAAW,cAAc;IAC7B,kFAAkF;IAClF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kFAAkF;IAClF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAC;IACjB,iFAAiF;IACjF,QAAQ,EAAE,OAAO,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,cAAc,GAAG,MAAM,CAOhE;AA4BD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,cAAc,GAAG,OAAO,CAE9D;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,cAAc,GAAG,MAAM,CAK9D"}
|