agentmesh-ai 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.
Files changed (123) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +247 -0
  3. package/dist/cli/commands/init.d.ts +2 -0
  4. package/dist/cli/commands/init.d.ts.map +1 -0
  5. package/dist/cli/commands/init.js +134 -0
  6. package/dist/cli/commands/init.js.map +1 -0
  7. package/dist/cli/commands/memory.d.ts +8 -0
  8. package/dist/cli/commands/memory.d.ts.map +1 -0
  9. package/dist/cli/commands/memory.js +40 -0
  10. package/dist/cli/commands/memory.js.map +1 -0
  11. package/dist/cli/commands/serve.d.ts +8 -0
  12. package/dist/cli/commands/serve.d.ts.map +1 -0
  13. package/dist/cli/commands/serve.js +90 -0
  14. package/dist/cli/commands/serve.js.map +1 -0
  15. package/dist/cli/commands/setup.d.ts +2 -0
  16. package/dist/cli/commands/setup.d.ts.map +1 -0
  17. package/dist/cli/commands/setup.js +117 -0
  18. package/dist/cli/commands/setup.js.map +1 -0
  19. package/dist/cli/commands/status.d.ts +2 -0
  20. package/dist/cli/commands/status.d.ts.map +1 -0
  21. package/dist/cli/commands/status.js +66 -0
  22. package/dist/cli/commands/status.js.map +1 -0
  23. package/dist/cli/index.d.ts +3 -0
  24. package/dist/cli/index.d.ts.map +1 -0
  25. package/dist/cli/index.js +50 -0
  26. package/dist/cli/index.js.map +1 -0
  27. package/dist/conversation/client.d.ts +72 -0
  28. package/dist/conversation/client.d.ts.map +1 -0
  29. package/dist/conversation/client.js +245 -0
  30. package/dist/conversation/client.js.map +1 -0
  31. package/dist/conversation/index.d.ts +7 -0
  32. package/dist/conversation/index.d.ts.map +1 -0
  33. package/dist/conversation/index.js +4 -0
  34. package/dist/conversation/index.js.map +1 -0
  35. package/dist/conversation/protocol.d.ts +217 -0
  36. package/dist/conversation/protocol.d.ts.map +1 -0
  37. package/dist/conversation/protocol.js +7 -0
  38. package/dist/conversation/protocol.js.map +1 -0
  39. package/dist/conversation/recorder.d.ts +4 -0
  40. package/dist/conversation/recorder.d.ts.map +1 -0
  41. package/dist/conversation/recorder.js +60 -0
  42. package/dist/conversation/recorder.js.map +1 -0
  43. package/dist/conversation/server.d.ts +59 -0
  44. package/dist/conversation/server.d.ts.map +1 -0
  45. package/dist/conversation/server.js +529 -0
  46. package/dist/conversation/server.js.map +1 -0
  47. package/dist/index.d.ts +3 -0
  48. package/dist/index.d.ts.map +1 -0
  49. package/dist/index.js +3 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/integrations/claude-md.d.ts +2 -0
  52. package/dist/integrations/claude-md.d.ts.map +1 -0
  53. package/dist/integrations/claude-md.js +35 -0
  54. package/dist/integrations/claude-md.js.map +1 -0
  55. package/dist/integrations/copilot.d.ts +2 -0
  56. package/dist/integrations/copilot.d.ts.map +1 -0
  57. package/dist/integrations/copilot.js +39 -0
  58. package/dist/integrations/copilot.js.map +1 -0
  59. package/dist/integrations/detect.d.ts +9 -0
  60. package/dist/integrations/detect.d.ts.map +1 -0
  61. package/dist/integrations/detect.js +34 -0
  62. package/dist/integrations/detect.js.map +1 -0
  63. package/dist/mcp/conversation-tools.d.ts +4 -0
  64. package/dist/mcp/conversation-tools.d.ts.map +1 -0
  65. package/dist/mcp/conversation-tools.js +540 -0
  66. package/dist/mcp/conversation-tools.js.map +1 -0
  67. package/dist/mcp/index.d.ts +3 -0
  68. package/dist/mcp/index.d.ts.map +1 -0
  69. package/dist/mcp/index.js +86 -0
  70. package/dist/mcp/index.js.map +1 -0
  71. package/dist/mcp/memory-tools.d.ts +4 -0
  72. package/dist/mcp/memory-tools.d.ts.map +1 -0
  73. package/dist/mcp/memory-tools.js +195 -0
  74. package/dist/mcp/memory-tools.js.map +1 -0
  75. package/dist/mcp/resources.d.ts +3 -0
  76. package/dist/mcp/resources.d.ts.map +1 -0
  77. package/dist/mcp/resources.js +23 -0
  78. package/dist/mcp/resources.js.map +1 -0
  79. package/dist/memory/index.d.ts +7 -0
  80. package/dist/memory/index.d.ts.map +1 -0
  81. package/dist/memory/index.js +6 -0
  82. package/dist/memory/index.js.map +1 -0
  83. package/dist/memory/merge-view.d.ts +9 -0
  84. package/dist/memory/merge-view.d.ts.map +1 -0
  85. package/dist/memory/merge-view.js +88 -0
  86. package/dist/memory/merge-view.js.map +1 -0
  87. package/dist/memory/reader.d.ts +8 -0
  88. package/dist/memory/reader.d.ts.map +1 -0
  89. package/dist/memory/reader.js +53 -0
  90. package/dist/memory/reader.js.map +1 -0
  91. package/dist/memory/schema.d.ts +154 -0
  92. package/dist/memory/schema.d.ts.map +1 -0
  93. package/dist/memory/schema.js +34 -0
  94. package/dist/memory/schema.js.map +1 -0
  95. package/dist/memory/searcher.d.ts +7 -0
  96. package/dist/memory/searcher.d.ts.map +1 -0
  97. package/dist/memory/searcher.js +49 -0
  98. package/dist/memory/searcher.js.map +1 -0
  99. package/dist/memory/secret-scanner.d.ts +21 -0
  100. package/dist/memory/secret-scanner.d.ts.map +1 -0
  101. package/dist/memory/secret-scanner.js +54 -0
  102. package/dist/memory/secret-scanner.js.map +1 -0
  103. package/dist/memory/types.d.ts +71 -0
  104. package/dist/memory/types.d.ts.map +1 -0
  105. package/dist/memory/types.js +5 -0
  106. package/dist/memory/types.js.map +1 -0
  107. package/dist/memory/writer.d.ts +4 -0
  108. package/dist/memory/writer.d.ts.map +1 -0
  109. package/dist/memory/writer.js +114 -0
  110. package/dist/memory/writer.js.map +1 -0
  111. package/dist/utils/git.d.ts +7 -0
  112. package/dist/utils/git.d.ts.map +1 -0
  113. package/dist/utils/git.js +46 -0
  114. package/dist/utils/git.js.map +1 -0
  115. package/dist/utils/id.d.ts +6 -0
  116. package/dist/utils/id.d.ts.map +1 -0
  117. package/dist/utils/id.js +20 -0
  118. package/dist/utils/id.js.map +1 -0
  119. package/dist/utils/yaml.d.ts +7 -0
  120. package/dist/utils/yaml.d.ts.map +1 -0
  121. package/dist/utils/yaml.js +50 -0
  122. package/dist/utils/yaml.js.map +1 -0
  123. package/package.json +59 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copilot.js","sourceRoot":"","sources":["../../src/integrations/copilot.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE9D,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;CAa5B,CAAC;AAEF,MAAM,MAAM,GAAG,2BAA2B,CAAC;AAE3C,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,UAAkB;IAChE,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,yBAAyB,CAAC,CAAC;IAE1D,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACzB,MAAM,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QACzB,OAAO,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC5C,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YAC7B,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,MAAM,UAAU,GAAG,OAAO,GAAG,IAAI,GAAG,oBAAoB,CAAC;IACzD,MAAM,SAAS,CAAC,QAAQ,EAAE,UAAU,CAAC,IAAI,EAAE,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC;IAC7D,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,9 @@
1
+ export interface DetectedTool {
2
+ name: string;
3
+ slug: string;
4
+ detected: boolean;
5
+ mcpConfigPath: string;
6
+ mcpConfigDir: string;
7
+ }
8
+ export declare function detectTools(projectDir: string): DetectedTool[];
9
+ //# sourceMappingURL=detect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../../src/integrations/detect.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,YAAY,EAAE,CA2B9D"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Detect which AI coding tools are installed/configured in the project.
3
+ */
4
+ import { existsSync } from 'node:fs';
5
+ import { join } from 'node:path';
6
+ export function detectTools(projectDir) {
7
+ return [
8
+ {
9
+ name: 'Claude Code',
10
+ slug: 'claude-code',
11
+ detected: existsSync(join(projectDir, '.claude')) ||
12
+ existsSync(join(projectDir, 'CLAUDE.md')),
13
+ mcpConfigPath: join(projectDir, '.claude', 'mcp.json'),
14
+ mcpConfigDir: join(projectDir, '.claude'),
15
+ },
16
+ {
17
+ name: 'Cursor',
18
+ slug: 'cursor',
19
+ detected: existsSync(join(projectDir, '.cursor')) ||
20
+ existsSync(join(projectDir, '.cursorrc')) ||
21
+ existsSync(join(projectDir, '.cursorrules')),
22
+ mcpConfigPath: join(projectDir, '.cursor', 'mcp.json'),
23
+ mcpConfigDir: join(projectDir, '.cursor'),
24
+ },
25
+ {
26
+ name: 'Windsurf',
27
+ slug: 'windsurf',
28
+ detected: existsSync(join(projectDir, '.windsurf')),
29
+ mcpConfigPath: join(projectDir, '.windsurf', 'mcp.json'),
30
+ mcpConfigDir: join(projectDir, '.windsurf'),
31
+ },
32
+ ];
33
+ }
34
+ //# sourceMappingURL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 +1,4 @@
1
+ import { ConversationClient } from '../conversation/client.js';
2
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
+ export declare function registerConversationTools(server: McpServer, getAgentHubDir: () => string, getAgentId: () => string, getClient: () => ConversationClient | null): void;
4
+ //# sourceMappingURL=conversation-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-tools.d.ts","sourceRoot":"","sources":["../../src/mcp/conversation-tools.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAG/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,SAAS,EACjB,cAAc,EAAE,MAAM,MAAM,EAC5B,UAAU,EAAE,MAAM,MAAM,EACxB,SAAS,EAAE,MAAM,kBAAkB,GAAG,IAAI,QAioB3C"}
@@ -0,0 +1,540 @@
1
+ /**
2
+ * MCP tool definitions for conversation space operations.
3
+ */
4
+ import { z } from 'zod';
5
+ import { randomUUID } from 'node:crypto';
6
+ import { writeMemoryEntry } from '../memory/writer.js';
7
+ import { readHubConfig } from '../memory/reader.js';
8
+ export function registerConversationTools(server, getAgentHubDir, getAgentId, getClient) {
9
+ server.tool('start_meeting', `Start a meeting β€” check that all required team members are online before discussing.
10
+
11
+ Use this BEFORE using discuss when you need a team decision. It ensures everyone
12
+ is present so decisions have full participation.
13
+
14
+ If someone is missing, tell your human to notify them (via WeChat, Slack, etc.)
15
+ to come online. You can call start_meeting again to check if they've joined.`, {
16
+ topic: z.string().describe('Meeting topic (e.g. "Database selection", "Architecture review")'),
17
+ requiredAgents: z.array(z.string()).optional().describe('Agent IDs that must attend. If omitted, all agents from hub.yaml are required.'),
18
+ }, async ({ topic, requiredAgents }) => {
19
+ const client = getClient();
20
+ if (!client?.isConnected) {
21
+ return {
22
+ content: [{
23
+ type: 'text',
24
+ text: 'Cannot start meeting: no conversation space is running. A human can start one with: npx agenthub serve'
25
+ }]
26
+ };
27
+ }
28
+ // If no specific agents given, require all from hub.yaml
29
+ let required = requiredAgents;
30
+ if (!required || required.length === 0) {
31
+ const dir = getAgentHubDir();
32
+ const hub = await readHubConfig(dir);
33
+ required = hub?.agents.map(a => a.id) ?? [];
34
+ }
35
+ const meetingId = `meeting-${randomUUID()}`;
36
+ client.startMeeting(meetingId, topic, required);
37
+ // Wait for server to process and send back status
38
+ await new Promise(resolve => setTimeout(resolve, 2000));
39
+ const status = client.meetings.find(m => m.meetingId === meetingId);
40
+ if (!status) {
41
+ return {
42
+ content: [{ type: 'text', text: 'Meeting created but no status received yet. Try list_conversations to check.' }]
43
+ };
44
+ }
45
+ if (status.status === 'active') {
46
+ return {
47
+ content: [{
48
+ type: 'text',
49
+ text: `βœ… Meeting "${topic}" β€” all ${status.presentAgents.length} members present!\n\nAttendees: ${status.presentAgents.join(', ')}\n\nYou can now use the discuss tool to start the discussion.`
50
+ }]
51
+ };
52
+ }
53
+ else {
54
+ const lines = [
55
+ `⏳ Meeting "${topic}" β€” waiting for members`,
56
+ '',
57
+ `Present (${status.presentAgents.length}): ${status.presentAgents.join(', ') || 'none'}`,
58
+ `Missing (${status.missingAgents.length}): ${status.missingAgents.join(', ')}`,
59
+ '',
60
+ 'Please ask your human to notify the missing members to come online.',
61
+ 'Call start_meeting again to check if everyone has joined.',
62
+ ];
63
+ return { content: [{ type: 'text', text: lines.join('\n') }] };
64
+ }
65
+ });
66
+ server.tool('list_conversations', `List active conversation topics and connected agents in the conversation space.
67
+ Returns the list of online agents and what topics are being discussed.
68
+ If no conversation space is running, tells you so.`, {}, async () => {
69
+ const client = getClient();
70
+ if (!client?.isConnected) {
71
+ return {
72
+ content: [{
73
+ type: 'text',
74
+ text: 'No conversation space is running. A human can start one with: npx agenthub serve'
75
+ }]
76
+ };
77
+ }
78
+ const agents = client.agents;
79
+ const topics = client.topics;
80
+ const myId = getAgentId();
81
+ const lines = [];
82
+ lines.push(`Connected agents (${agents.length}):`);
83
+ for (const a of agents) {
84
+ lines.push(` - ${a.displayName} (${a.role}) using ${a.tool}`);
85
+ }
86
+ lines.push('');
87
+ if (topics.length > 0) {
88
+ lines.push(`Active topics (${topics.length}):`);
89
+ for (const t of topics) {
90
+ const msgs = client.getTopicMessages(t);
91
+ const participants = [...new Set(msgs.map(m => m.from.displayName))];
92
+ const lastMsg = msgs[msgs.length - 1];
93
+ const lastTime = lastMsg ? lastMsg.timestamp.slice(11, 19) : '?';
94
+ const myParticipation = msgs.some(m => m.from.id === myId) ? 'βœ“ you spoke' : '⏳ waiting for you';
95
+ lines.push(` - "${t}" β€” ${msgs.length} msgs, participants: ${participants.join(', ')}, last: ${lastTime} (${myParticipation})`);
96
+ }
97
+ }
98
+ else {
99
+ lines.push('No active discussion topics yet.');
100
+ }
101
+ return { content: [{ type: 'text', text: lines.join('\n') }] };
102
+ });
103
+ server.tool('send_message', `Send a message in the conversation space to discuss something with other agents.
104
+ Use this when you need to coordinate with other agents β€” e.g. proposing a tech choice,
105
+ asking about an interface, or discussing architecture.
106
+ Your message will be seen by all connected agents.`, {
107
+ topic: z.string().describe('Discussion topic (e.g. "Database selection", "API format")'),
108
+ message: z.string().describe('Your message to the other agents'),
109
+ related_to: z.string().optional().describe('Memory topic or file path this relates to'),
110
+ }, async ({ topic, message, related_to }) => {
111
+ const client = getClient();
112
+ if (!client?.isConnected) {
113
+ return {
114
+ content: [{
115
+ type: 'text',
116
+ text: 'Cannot send message: no conversation space is running. A human can start one with: npx agenthub serve'
117
+ }]
118
+ };
119
+ }
120
+ client.sendMessage(topic, message, related_to);
121
+ // Wait a moment for replies
122
+ await new Promise(resolve => setTimeout(resolve, 2000));
123
+ // Return recent messages on this topic
124
+ const recent = client.getTopicMessages(topic).slice(-10);
125
+ if (recent.length === 0) {
126
+ return {
127
+ content: [{
128
+ type: 'text',
129
+ text: `Message sent to topic "${topic}". No replies yet.`
130
+ }]
131
+ };
132
+ }
133
+ const lines = [`Messages on "${topic}":\n`];
134
+ for (const m of recent) {
135
+ lines.push(`[${m.from.displayName}]: ${m.content}`);
136
+ }
137
+ return { content: [{ type: 'text', text: lines.join('\n') }] };
138
+ });
139
+ server.tool('get_messages', `Get the latest messages from a conversation topic.
140
+ Use this to check if other agents have replied to your earlier message.`, {
141
+ topic: z.string().describe('The topic to get messages from'),
142
+ since: z.string().optional().describe('Only get messages after this ISO timestamp'),
143
+ }, async ({ topic, since }) => {
144
+ const client = getClient();
145
+ if (!client?.isConnected) {
146
+ return {
147
+ content: [{
148
+ type: 'text',
149
+ text: 'No conversation space is running.'
150
+ }]
151
+ };
152
+ }
153
+ let messages = client.getTopicMessages(topic);
154
+ if (since) {
155
+ const sinceTime = new Date(since).getTime();
156
+ messages = messages.filter(m => new Date(m.timestamp).getTime() > sinceTime);
157
+ }
158
+ if (messages.length === 0) {
159
+ return {
160
+ content: [{
161
+ type: 'text',
162
+ text: `No messages on "${topic}"${since ? ' since ' + since : ''}.`
163
+ }]
164
+ };
165
+ }
166
+ const lines = [`Messages on "${topic}" (${messages.length}):\n`];
167
+ for (const m of messages) {
168
+ const time = m.timestamp.slice(11, 19);
169
+ lines.push(`[${time}] ${m.from.displayName}: ${m.content}`);
170
+ }
171
+ return { content: [{ type: 'text', text: lines.join('\n') }] };
172
+ });
173
+ server.tool('discuss', `Start or continue a multi-round discussion with other agents on a topic.
174
+
175
+ This is the PRIMARY tool for team discussions. Use this instead of send_message
176
+ when you want a real back-and-forth conversation.
177
+
178
+ HOW IT WORKS:
179
+ 1. You send your message to the topic
180
+ 2. The tool waits for other agents to reply (up to 60 seconds)
181
+ 3. Returns ALL replies so you can see the full discussion
182
+ 4. You then decide: call discuss again to continue, or save_to_memory to conclude
183
+
184
+ WHEN TO USE:
185
+ - You need team consensus on a decision (tech stack, architecture, conventions)
186
+ - You want to propose something and hear others' opinions
187
+ - You discovered a conflict that needs resolution
188
+
189
+ The human only needs to trigger you once ("discuss database choice with the team").
190
+ You drive the discussion loop yourself β€” keep calling discuss until consensus is reached,
191
+ then call save_to_memory to record the conclusion.
192
+
193
+ ASYNC FALLBACK:
194
+ If the conversation space is not running or some members are offline,
195
+ you can discuss asynchronously through shared memory:
196
+ 1. Write your proposal with write_memory, topic prefix "Discussion: ", status "proposal"
197
+ 2. Other agents will see it when they read_memory (marked πŸ“‹)
198
+ 3. They can respond by writing their own entries on the same topic
199
+ 4. Once consensus forms in memory, upgrade the conclusion to status "protected"`, {
200
+ topic: z.string().describe('Discussion topic'),
201
+ message: z.string().describe('Your message β€” proposal, question, or response to others'),
202
+ wait_seconds: z.number().optional().describe('How long to wait for replies (default: 30, max: 120)'),
203
+ related_to: z.string().optional().describe('Memory topic or file path this discussion relates to'),
204
+ }, async ({ topic, message, wait_seconds, related_to }) => {
205
+ const client = getClient();
206
+ if (!client?.isConnected) {
207
+ return {
208
+ content: [{
209
+ type: 'text',
210
+ text: 'Cannot discuss: no conversation space is running. A human can start one with: npx agenthub serve'
211
+ }]
212
+ };
213
+ }
214
+ // Record the timestamp before sending so we can filter for new replies
215
+ const beforeSend = new Date().toISOString();
216
+ // Send our message
217
+ client.sendMessage(topic, message, related_to);
218
+ // Wait for replies
219
+ const waitMs = Math.min((wait_seconds ?? 30), 120) * 1000;
220
+ const pollInterval = 3000; // check every 3 seconds
221
+ const deadline = Date.now() + waitMs;
222
+ let lastCount = 0;
223
+ let silentSince = Date.now();
224
+ // Poll for new messages, with early exit if replies stop coming
225
+ while (Date.now() < deadline) {
226
+ await new Promise(resolve => setTimeout(resolve, pollInterval));
227
+ const newMessages = client.getTopicMessages(topic).filter(m => new Date(m.timestamp).getTime() > new Date(beforeSend).getTime()
228
+ && m.from.id !== getAgentId());
229
+ if (newMessages.length > lastCount) {
230
+ // New replies came in β€” reset silence timer
231
+ lastCount = newMessages.length;
232
+ silentSince = Date.now();
233
+ }
234
+ else if (Date.now() - silentSince > 15000 && lastCount > 0) {
235
+ // 15 seconds of silence after getting at least one reply β€” discussion round is done
236
+ break;
237
+ }
238
+ }
239
+ // Collect all messages on this topic
240
+ const allMessages = client.getTopicMessages(topic);
241
+ if (allMessages.length === 0) {
242
+ return {
243
+ content: [{
244
+ type: 'text',
245
+ text: `Your message was sent to "${topic}". No other agents replied within ${wait_seconds ?? 30}s. They may be offline β€” the message will be there when they check.`
246
+ }]
247
+ };
248
+ }
249
+ // Format the full discussion
250
+ const lines = [];
251
+ lines.push(`Discussion on "${topic}" (${allMessages.length} messages):\n`);
252
+ for (const m of allMessages) {
253
+ const time = m.timestamp.slice(11, 19);
254
+ const isMe = m.from.id === getAgentId();
255
+ const prefix = isMe ? '(you)' : `${m.from.displayName} [${m.from.role}]`;
256
+ lines.push(`[${time}] ${prefix}: ${m.content}`);
257
+ }
258
+ // Count unique participants (excluding self)
259
+ const others = new Set(allMessages.filter(m => m.from.id !== getAgentId()).map(m => m.from.id));
260
+ lines.push('');
261
+ lines.push(`--- ${others.size} other agent(s) participated ---`);
262
+ lines.push('');
263
+ lines.push('Next steps:');
264
+ lines.push('- To continue the discussion: call discuss again with your response');
265
+ lines.push('- If consensus is reached: call save_to_memory to record the decision');
266
+ lines.push('- If there\'s a disagreement you can\'t resolve: tell the user and let them decide');
267
+ return { content: [{ type: 'text', text: lines.join('\n') }] };
268
+ });
269
+ server.tool('save_to_memory', `Save a conversation conclusion to shared memory.
270
+ Use this after reaching agreement on a topic in the conversation space.
271
+ This records the conclusion permanently so all agents (including offline ones) will follow it.`, {
272
+ topic: z.string().describe('The topic that was discussed'),
273
+ content: z.string().describe('The conclusion / decision reached'),
274
+ tags: z.array(z.string()).describe('Tags for categorization'),
275
+ decided_with: z.array(z.string()).optional().describe('Agent IDs of other participants'),
276
+ }, async ({ topic, content, tags, decided_with }) => {
277
+ const dir = getAgentHubDir();
278
+ const agentId = getAgentId();
279
+ const hub = await readHubConfig(dir);
280
+ const agentInfo = hub?.agents.find(a => a.id === agentId);
281
+ // Write to memory
282
+ await writeMemoryEntry(dir, agentId, agentInfo?.role ?? 'developer', agentInfo?.tool ?? 'unknown', { topic, content, tags, decided_with });
283
+ // Also send CONCLUDE to conversation space
284
+ const client = getClient();
285
+ if (client?.isConnected) {
286
+ client.conclude(topic, content, tags);
287
+ }
288
+ return {
289
+ content: [{
290
+ type: 'text',
291
+ text: `βœ… Conclusion saved to shared memory: "${topic}" [${tags.join(', ')}]\nAll agents will see this on their next read.`
292
+ }]
293
+ };
294
+ });
295
+ server.tool('escalate_to_human', `Present a decision to ALL humans in the team for approval.
296
+
297
+ IMPORTANT: This is not just asking YOUR human β€” it broadcasts the decision to the conversation
298
+ space so every agent's human must confirm. A decision only becomes protected after ALL humans approve.
299
+
300
+ Use this when:
301
+ - Agents disagree and can't resolve it themselves
302
+ - A decision requires human judgment (business rules, priorities, preferences)
303
+ - You need team-wide confirmation before recording a major decision
304
+
305
+ Flow:
306
+ 1. Shows an interactive form to YOUR human for their vote
307
+ 2. Simultaneously broadcasts the proposal to the conversation space
308
+ 3. Other agents will see the proposal and ask THEIR humans to vote
309
+ 4. Only when ALL humans approve β†’ decision becomes protected
310
+ 5. If ANY human rejects β†’ discussion restarts with their feedback`, {
311
+ title: z.string().describe('Short title for the decision (e.g. "Database Selection")'),
312
+ description: z.string().describe('Plain-language explanation of what needs to be decided and why, written for someone who may not be technical'),
313
+ options: z.array(z.object({
314
+ label: z.string().describe('Option name (e.g. "PostgreSQL")'),
315
+ description: z.string().describe('Plain-language explanation of this option\'s pros and cons'),
316
+ })).describe('The options to choose from (2-5 options)'),
317
+ recommendation: z.string().optional().describe('Your recommended option and why, if you have one'),
318
+ }, async ({ title, description: desc, options, recommendation }) => {
319
+ const client = getClient();
320
+ const optionLabels = options.map(o => o.label);
321
+ const message = [
322
+ desc,
323
+ '',
324
+ 'Options:',
325
+ ...options.map(o => `β€’ ${o.label} β€” ${o.description}`),
326
+ '',
327
+ recommendation ? `πŸ’‘ Recommendation: ${recommendation}` : '',
328
+ ].filter(Boolean).join('\n');
329
+ // Generate a unique decision ID
330
+ const decisionId = `decision-${randomUUID()}`;
331
+ // Broadcast proposal to conversation space (so other agents see it)
332
+ if (client?.isConnected) {
333
+ client.proposeDecision(decisionId, title, options, recommendation);
334
+ }
335
+ // Ask THIS human via elicitation
336
+ try {
337
+ const result = await server.server.elicitInput({
338
+ mode: 'form',
339
+ message,
340
+ requestedSchema: {
341
+ type: 'object',
342
+ properties: {
343
+ choice: {
344
+ type: 'string',
345
+ title,
346
+ description: `Choose one: ${optionLabels.join(', ')}`,
347
+ oneOf: [
348
+ ...optionLabels.map(label => ({
349
+ const: label,
350
+ title: label,
351
+ })),
352
+ {
353
+ const: '__none_of_the_above__',
354
+ title: 'None of the above',
355
+ },
356
+ ],
357
+ },
358
+ reason: {
359
+ type: 'string',
360
+ title: 'Reason or your own idea',
361
+ description: 'Why did you choose this? Or if you picked "None of the above", describe what you want instead.',
362
+ },
363
+ },
364
+ required: ['choice'],
365
+ },
366
+ });
367
+ if (result.action === 'accept' && result.content) {
368
+ const choice = result.content.choice;
369
+ const reason = result.content.reason;
370
+ if (choice === '__none_of_the_above__') {
371
+ const userDirection = reason || 'No specific direction given';
372
+ // Vote reject and broadcast the reason to the conversation space
373
+ if (client?.isConnected) {
374
+ client.vote(decisionId, 'reject', undefined, userDirection);
375
+ client.sendMessage(title, `❌ Human rejected all proposed options. Feedback: "${userDirection}". Discussion should restart with this new direction.`);
376
+ }
377
+ return {
378
+ content: [{
379
+ type: 'text',
380
+ text: `πŸ”„ Your human rejected all options.\n\nTheir input: "${userDirection}"\n\nUse the discuss tool to restart the discussion with this new direction. Inform the other agents.`,
381
+ }]
382
+ };
383
+ }
384
+ // Vote approve in the conversation space
385
+ if (client?.isConnected) {
386
+ client.vote(decisionId, 'approve', choice, reason);
387
+ // Wait for other votes
388
+ const waitMs = 60000; // wait up to 60s for all votes
389
+ const pollInterval = 3000;
390
+ const deadline = Date.now() + waitMs;
391
+ while (Date.now() < deadline) {
392
+ await new Promise(resolve => setTimeout(resolve, pollInterval));
393
+ const resolved = client.resolvedDecisions.find(d => d.decisionId === decisionId);
394
+ if (resolved) {
395
+ if (resolved.outcome === 'approved') {
396
+ return {
397
+ content: [{
398
+ type: 'text',
399
+ text: `βœ… ALL humans approved: ${resolved.choice ?? choice}\n\nVotes:\n${resolved.votes.map(v => ` ${v.agentId}: ${v.vote}${v.choice ? ` (${v.choice})` : ''}${v.reason ? ` β€” ${v.reason}` : ''}`).join('\n')}\n\nYou should now call save_to_memory with protected: true to record this team decision.`,
400
+ }]
401
+ };
402
+ }
403
+ else {
404
+ const rejects = resolved.votes.filter(v => v.vote === 'reject');
405
+ return {
406
+ content: [{
407
+ type: 'text',
408
+ text: `❌ Decision rejected.\n\nRejections:\n${rejects.map(v => ` ${v.agentId}: ${v.reason ?? 'no reason given'}`).join('\n')}\n\nUse the discuss tool to restart with this feedback.`,
409
+ }]
410
+ };
411
+ }
412
+ }
413
+ }
414
+ // Timeout β€” not all voted yet
415
+ return {
416
+ content: [{
417
+ type: 'text',
418
+ text: `⏳ Your human voted for "${choice}", but not all team members have voted yet.\n\nDecision ID: ${decisionId}\nOther agents need to ask their humans to vote. The decision will be finalized when everyone votes.`,
419
+ }]
420
+ };
421
+ }
422
+ // No conversation space β€” single user decision
423
+ return {
424
+ content: [{
425
+ type: 'text',
426
+ text: `βœ… Human decided: ${choice}${reason ? ` (reason: ${reason})` : ''}\n\nNo conversation space running, so this is a single-user decision.\nCall save_to_memory with protected: true to record it.`,
427
+ }]
428
+ };
429
+ }
430
+ else {
431
+ return {
432
+ content: [{
433
+ type: 'text',
434
+ text: '⏸️ User declined to vote right now. Continue with other work and come back to this later.',
435
+ }]
436
+ };
437
+ }
438
+ }
439
+ catch {
440
+ // Elicitation not supported β€” fall back to text
441
+ return {
442
+ content: [{
443
+ type: 'text',
444
+ text: `❓ Decision needed: ${title}\n\n${message}\n\nPlease tell me which option you prefer.`,
445
+ }]
446
+ };
447
+ }
448
+ });
449
+ server.tool('list_pending_decisions', `List all pending decisions that need votes from team members.`, {}, async () => {
450
+ const client = getClient();
451
+ if (!client?.isConnected) {
452
+ return { content: [{ type: 'text', text: 'No conversation space running.' }] };
453
+ }
454
+ const pending = client.pendingDecisions;
455
+ if (pending.length === 0) {
456
+ return { content: [{ type: 'text', text: 'No pending decisions.' }] };
457
+ }
458
+ const lines = [`Pending decisions (${pending.length}):\n`];
459
+ for (const d of pending) {
460
+ lines.push(`πŸ“‹ ${d.topic} (ID: ${d.decisionId})`);
461
+ lines.push(` Proposed by: ${d.proposedBy.displayName}`);
462
+ lines.push(` Options: ${d.options.map(o => o.label).join(', ')}`);
463
+ if (d.recommendation)
464
+ lines.push(` Recommended: ${d.recommendation}`);
465
+ lines.push('');
466
+ }
467
+ return { content: [{ type: 'text', text: lines.join('\n') }] };
468
+ });
469
+ server.tool('vote_on_decision', `Vote on a pending team decision that was proposed by another agent.
470
+
471
+ When you see a DECISION_PROPOSED in the conversation space, use this tool to ask your human
472
+ to vote. This shows them the options and sends their vote back to the conversation space.
473
+ A decision is only finalized when ALL humans have voted.`, {
474
+ decisionId: z.string().describe('The decision ID from the proposal'),
475
+ topic: z.string().describe('The decision topic (for display)'),
476
+ options: z.array(z.object({
477
+ label: z.string(),
478
+ description: z.string(),
479
+ })).describe('The options to vote on'),
480
+ recommendation: z.string().optional().describe('The proposer\'s recommendation'),
481
+ }, async ({ decisionId, topic, options, recommendation }) => {
482
+ const client = getClient();
483
+ const optionLabels = options.map(o => o.label);
484
+ const message = [
485
+ `Team decision requested: ${topic}`,
486
+ '',
487
+ 'Options:',
488
+ ...options.map(o => `β€’ ${o.label} β€” ${o.description}`),
489
+ '',
490
+ recommendation ? `πŸ’‘ Proposer recommends: ${recommendation}` : '',
491
+ ].filter(Boolean).join('\n');
492
+ try {
493
+ const result = await server.server.elicitInput({
494
+ mode: 'form',
495
+ message,
496
+ requestedSchema: {
497
+ type: 'object',
498
+ properties: {
499
+ choice: {
500
+ type: 'string',
501
+ title: topic,
502
+ oneOf: [
503
+ ...optionLabels.map(label => ({ const: label, title: label })),
504
+ { const: '__none_of_the_above__', title: 'None of the above β€” reject' },
505
+ ],
506
+ },
507
+ reason: {
508
+ type: 'string',
509
+ title: 'Reason (optional)',
510
+ },
511
+ },
512
+ required: ['choice'],
513
+ },
514
+ });
515
+ if (result.action === 'accept' && result.content) {
516
+ const choice = result.content.choice;
517
+ const reason = result.content.reason;
518
+ if (choice === '__none_of_the_above__') {
519
+ client?.vote(decisionId, 'reject', undefined, reason || 'Rejected all options');
520
+ return {
521
+ content: [{ type: 'text', text: `❌ Vote: rejected. ${reason ? `Reason: ${reason}` : ''}` }]
522
+ };
523
+ }
524
+ client?.vote(decisionId, 'approve', choice, reason);
525
+ return {
526
+ content: [{ type: 'text', text: `βœ… Vote: approved "${choice}". Waiting for other team members...` }]
527
+ };
528
+ }
529
+ return {
530
+ content: [{ type: 'text', text: '⏸️ User skipped voting for now.' }]
531
+ };
532
+ }
533
+ catch {
534
+ return {
535
+ content: [{ type: 'text', text: `❓ Vote needed on: ${topic}\n\n${message}\n\nTell me which option you prefer, or say "reject" if none work.` }]
536
+ };
537
+ }
538
+ });
539
+ }
540
+ //# sourceMappingURL=conversation-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-tools.js","sourceRoot":"","sources":["../../src/mcp/conversation-tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,MAAM,UAAU,yBAAyB,CACvC,MAAiB,EACjB,cAA4B,EAC5B,UAAwB,EACxB,SAA0C;IAG1C,MAAM,CAAC,IAAI,CACT,eAAe,EACf;;;;;;6EAMyE,EACzE;QACE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kEAAkE,CAAC;QAC9F,cAAc,EAAE,CAAC,CA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