@hailer/mcp 0.1.17 → 0.2.2

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 (200) hide show
  1. package/dist/app.js +27 -20
  2. package/dist/core.d.ts +33 -9
  3. package/dist/core.js +279 -147
  4. package/dist/mcp/UserContextCache.js +18 -0
  5. package/dist/mcp/hailer-clients.d.ts +9 -1
  6. package/dist/mcp/hailer-clients.js +13 -3
  7. package/dist/mcp/signal-handler.js +1 -1
  8. package/dist/mcp/tool-registry.d.ts +3 -1
  9. package/dist/mcp/tool-registry.js +4 -1
  10. package/dist/mcp/tools/activity.js +43 -34
  11. package/dist/mcp/tools/bot-config/constants.d.ts +23 -0
  12. package/dist/mcp/tools/bot-config/constants.js +94 -0
  13. package/dist/mcp/tools/{bot-config.d.ts → bot-config/core.d.ts} +6 -6
  14. package/dist/mcp/tools/{bot-config.js → bot-config/core.js} +15 -15
  15. package/dist/mcp/tools/bot-config/index.d.ts +10 -0
  16. package/dist/mcp/tools/bot-config/index.js +59 -0
  17. package/dist/mcp/tools/bot-config/tools.d.ts +7 -0
  18. package/dist/mcp/tools/bot-config/tools.js +15 -0
  19. package/dist/mcp/tools/bot-config/types.d.ts +50 -0
  20. package/dist/mcp/tools/bot-config/types.js +6 -0
  21. package/dist/mcp/tools/bug-fixer-tools.d.ts +21 -0
  22. package/dist/mcp/tools/{giuseppe-tools.js → bug-fixer-tools.js} +61 -61
  23. package/dist/mcp/tools/user.js +10 -29
  24. package/dist/mcp/tools/workflow.js +36 -2
  25. package/dist/mcp/utils/data-transformers.d.ts +0 -8
  26. package/dist/mcp/utils/data-transformers.js +0 -28
  27. package/dist/mcp/utils/index.d.ts +4 -1
  28. package/dist/mcp/utils/index.js +17 -3
  29. package/dist/mcp/utils/pagination.d.ts +40 -0
  30. package/dist/mcp/utils/pagination.js +55 -0
  31. package/dist/mcp/utils/response-builder.d.ts +53 -0
  32. package/dist/mcp/utils/response-builder.js +110 -0
  33. package/dist/mcp/utils/tool-helpers.d.ts +0 -8
  34. package/dist/mcp/utils/tool-helpers.js +0 -24
  35. package/dist/mcp/utils/types.d.ts +1 -33
  36. package/dist/mcp-server.d.ts +2 -2
  37. package/dist/mcp-server.js +161 -139
  38. package/package.json +1 -1
  39. package/REFACTOR_STATUS.md +0 -127
  40. package/dist/agents/bot-manager.d.ts +0 -48
  41. package/dist/agents/bot-manager.js +0 -254
  42. package/dist/agents/factory.d.ts +0 -150
  43. package/dist/agents/factory.js +0 -650
  44. package/dist/agents/giuseppe/ai.d.ts +0 -83
  45. package/dist/agents/giuseppe/ai.js +0 -466
  46. package/dist/agents/giuseppe/bot.d.ts +0 -110
  47. package/dist/agents/giuseppe/bot.js +0 -780
  48. package/dist/agents/giuseppe/config.d.ts +0 -25
  49. package/dist/agents/giuseppe/config.js +0 -227
  50. package/dist/agents/giuseppe/files.d.ts +0 -52
  51. package/dist/agents/giuseppe/files.js +0 -338
  52. package/dist/agents/giuseppe/git.d.ts +0 -48
  53. package/dist/agents/giuseppe/git.js +0 -298
  54. package/dist/agents/giuseppe/index.d.ts +0 -97
  55. package/dist/agents/giuseppe/index.js +0 -258
  56. package/dist/agents/giuseppe/lsp.d.ts +0 -113
  57. package/dist/agents/giuseppe/lsp.js +0 -485
  58. package/dist/agents/giuseppe/monitor.d.ts +0 -118
  59. package/dist/agents/giuseppe/monitor.js +0 -621
  60. package/dist/agents/giuseppe/prompt.d.ts +0 -5
  61. package/dist/agents/giuseppe/prompt.js +0 -94
  62. package/dist/agents/giuseppe/registries/pending-classification.d.ts +0 -28
  63. package/dist/agents/giuseppe/registries/pending-classification.js +0 -50
  64. package/dist/agents/giuseppe/registries/pending-fix.d.ts +0 -30
  65. package/dist/agents/giuseppe/registries/pending-fix.js +0 -42
  66. package/dist/agents/giuseppe/registries/pending.d.ts +0 -27
  67. package/dist/agents/giuseppe/registries/pending.js +0 -49
  68. package/dist/agents/giuseppe/specialist.d.ts +0 -47
  69. package/dist/agents/giuseppe/specialist.js +0 -237
  70. package/dist/agents/giuseppe/types.d.ts +0 -123
  71. package/dist/agents/giuseppe/types.js +0 -9
  72. package/dist/agents/hailer-expert/index.d.ts +0 -8
  73. package/dist/agents/hailer-expert/index.js +0 -14
  74. package/dist/agents/hal/daemon.d.ts +0 -142
  75. package/dist/agents/hal/daemon.js +0 -1103
  76. package/dist/agents/hal/definitions.d.ts +0 -55
  77. package/dist/agents/hal/definitions.js +0 -263
  78. package/dist/agents/hal/index.d.ts +0 -3
  79. package/dist/agents/hal/index.js +0 -8
  80. package/dist/agents/index.d.ts +0 -18
  81. package/dist/agents/index.js +0 -48
  82. package/dist/agents/shared/base.d.ts +0 -216
  83. package/dist/agents/shared/base.js +0 -846
  84. package/dist/agents/shared/services/agent-registry.d.ts +0 -107
  85. package/dist/agents/shared/services/agent-registry.js +0 -629
  86. package/dist/agents/shared/services/conversation-manager.d.ts +0 -50
  87. package/dist/agents/shared/services/conversation-manager.js +0 -136
  88. package/dist/agents/shared/services/mcp-client.d.ts +0 -56
  89. package/dist/agents/shared/services/mcp-client.js +0 -124
  90. package/dist/agents/shared/services/message-classifier.d.ts +0 -37
  91. package/dist/agents/shared/services/message-classifier.js +0 -187
  92. package/dist/agents/shared/services/message-formatter.d.ts +0 -89
  93. package/dist/agents/shared/services/message-formatter.js +0 -371
  94. package/dist/agents/shared/services/session-logger.d.ts +0 -106
  95. package/dist/agents/shared/services/session-logger.js +0 -446
  96. package/dist/agents/shared/services/tool-executor.d.ts +0 -41
  97. package/dist/agents/shared/services/tool-executor.js +0 -169
  98. package/dist/agents/shared/services/workspace-schema-cache.d.ts +0 -125
  99. package/dist/agents/shared/services/workspace-schema-cache.js +0 -578
  100. package/dist/agents/shared/specialist.d.ts +0 -91
  101. package/dist/agents/shared/specialist.js +0 -399
  102. package/dist/agents/shared/tool-schema-loader.d.ts +0 -62
  103. package/dist/agents/shared/tool-schema-loader.js +0 -232
  104. package/dist/agents/shared/types.d.ts +0 -327
  105. package/dist/agents/shared/types.js +0 -121
  106. package/dist/client/agents/base.d.ts +0 -207
  107. package/dist/client/agents/base.js +0 -744
  108. package/dist/client/agents/definitions.d.ts +0 -53
  109. package/dist/client/agents/definitions.js +0 -263
  110. package/dist/client/agents/orchestrator.d.ts +0 -141
  111. package/dist/client/agents/orchestrator.js +0 -1062
  112. package/dist/client/agents/specialist.d.ts +0 -86
  113. package/dist/client/agents/specialist.js +0 -340
  114. package/dist/client/bot-entrypoint.d.ts +0 -7
  115. package/dist/client/bot-entrypoint.js +0 -103
  116. package/dist/client/bot-manager.d.ts +0 -44
  117. package/dist/client/bot-manager.js +0 -173
  118. package/dist/client/bot-runner.d.ts +0 -35
  119. package/dist/client/bot-runner.js +0 -188
  120. package/dist/client/chat-agent-daemon.d.ts +0 -464
  121. package/dist/client/chat-agent-daemon.js +0 -1774
  122. package/dist/client/daemon-factory.d.ts +0 -106
  123. package/dist/client/daemon-factory.js +0 -301
  124. package/dist/client/factory.d.ts +0 -111
  125. package/dist/client/factory.js +0 -314
  126. package/dist/client/index.d.ts +0 -17
  127. package/dist/client/index.js +0 -38
  128. package/dist/client/multi-bot-manager.d.ts +0 -42
  129. package/dist/client/multi-bot-manager.js +0 -161
  130. package/dist/client/orchestrator-daemon.d.ts +0 -87
  131. package/dist/client/orchestrator-daemon.js +0 -444
  132. package/dist/client/server.d.ts +0 -8
  133. package/dist/client/server.js +0 -251
  134. package/dist/client/services/agent-registry.d.ts +0 -108
  135. package/dist/client/services/agent-registry.js +0 -630
  136. package/dist/client/services/conversation-manager.d.ts +0 -50
  137. package/dist/client/services/conversation-manager.js +0 -136
  138. package/dist/client/services/mcp-client.d.ts +0 -48
  139. package/dist/client/services/mcp-client.js +0 -105
  140. package/dist/client/services/message-classifier.d.ts +0 -37
  141. package/dist/client/services/message-classifier.js +0 -187
  142. package/dist/client/services/message-formatter.d.ts +0 -84
  143. package/dist/client/services/message-formatter.js +0 -353
  144. package/dist/client/services/session-logger.d.ts +0 -106
  145. package/dist/client/services/session-logger.js +0 -446
  146. package/dist/client/services/tool-executor.d.ts +0 -41
  147. package/dist/client/services/tool-executor.js +0 -169
  148. package/dist/client/services/workspace-schema-cache.d.ts +0 -149
  149. package/dist/client/services/workspace-schema-cache.js +0 -732
  150. package/dist/client/specialist-daemon.d.ts +0 -77
  151. package/dist/client/specialist-daemon.js +0 -197
  152. package/dist/client/specialists.d.ts +0 -53
  153. package/dist/client/specialists.js +0 -178
  154. package/dist/client/tool-schema-loader.d.ts +0 -62
  155. package/dist/client/tool-schema-loader.js +0 -232
  156. package/dist/client/types.d.ts +0 -327
  157. package/dist/client/types.js +0 -121
  158. package/dist/commands/seed-config.d.ts +0 -9
  159. package/dist/commands/seed-config.js +0 -372
  160. package/dist/lib/context-manager.d.ts +0 -111
  161. package/dist/lib/context-manager.js +0 -431
  162. package/dist/lib/prompt-length-manager.d.ts +0 -81
  163. package/dist/lib/prompt-length-manager.js +0 -457
  164. package/dist/mcp/tools/giuseppe-tools.d.ts +0 -21
  165. package/dist/modules/bug-reports/bug-config.d.ts +0 -25
  166. package/dist/modules/bug-reports/bug-config.js +0 -187
  167. package/dist/modules/bug-reports/bug-monitor.d.ts +0 -108
  168. package/dist/modules/bug-reports/bug-monitor.js +0 -510
  169. package/dist/modules/bug-reports/giuseppe-agent.d.ts +0 -58
  170. package/dist/modules/bug-reports/giuseppe-agent.js +0 -467
  171. package/dist/modules/bug-reports/giuseppe-ai.d.ts +0 -83
  172. package/dist/modules/bug-reports/giuseppe-ai.js +0 -466
  173. package/dist/modules/bug-reports/giuseppe-bot.d.ts +0 -110
  174. package/dist/modules/bug-reports/giuseppe-bot.js +0 -804
  175. package/dist/modules/bug-reports/giuseppe-daemon.d.ts +0 -80
  176. package/dist/modules/bug-reports/giuseppe-daemon.js +0 -617
  177. package/dist/modules/bug-reports/giuseppe-files.d.ts +0 -64
  178. package/dist/modules/bug-reports/giuseppe-files.js +0 -375
  179. package/dist/modules/bug-reports/giuseppe-git.d.ts +0 -48
  180. package/dist/modules/bug-reports/giuseppe-git.js +0 -298
  181. package/dist/modules/bug-reports/giuseppe-lsp.d.ts +0 -113
  182. package/dist/modules/bug-reports/giuseppe-lsp.js +0 -485
  183. package/dist/modules/bug-reports/giuseppe-prompt.d.ts +0 -5
  184. package/dist/modules/bug-reports/giuseppe-prompt.js +0 -94
  185. package/dist/modules/bug-reports/index.d.ts +0 -77
  186. package/dist/modules/bug-reports/index.js +0 -215
  187. package/dist/modules/bug-reports/pending-classification-registry.d.ts +0 -28
  188. package/dist/modules/bug-reports/pending-classification-registry.js +0 -50
  189. package/dist/modules/bug-reports/pending-fix-registry.d.ts +0 -30
  190. package/dist/modules/bug-reports/pending-fix-registry.js +0 -42
  191. package/dist/modules/bug-reports/pending-registry.d.ts +0 -27
  192. package/dist/modules/bug-reports/pending-registry.js +0 -49
  193. package/dist/modules/bug-reports/types.d.ts +0 -123
  194. package/dist/modules/bug-reports/types.js +0 -9
  195. package/dist/routes/agents.d.ts +0 -44
  196. package/dist/routes/agents.js +0 -311
  197. package/dist/services/agent-credential-store.d.ts +0 -73
  198. package/dist/services/agent-credential-store.js +0 -212
  199. package/dist/services/bug-monitor.d.ts +0 -23
  200. package/dist/services/bug-monitor.js +0 -275
@@ -1,77 +0,0 @@
1
- /**
2
- * Specialist Daemon
3
- *
4
- * A lightweight daemon for specialist bots that only responds when @mentioned.
5
- * Specialists are invited to discussions by the orchestrator (HAL) to handle
6
- * specific complex tasks.
7
- *
8
- * Key differences from ChatAgentDaemon:
9
- * - Only responds when @mentioned (not all messages)
10
- * - Has specialized system prompt from Specialist config
11
- * - More tool-focused, less conversational
12
- */
13
- import { ChatAgentDaemon, ChatAgentDaemonConfig, IncomingMessage } from "./chat-agent-daemon";
14
- import { Specialist } from "./specialists";
15
- import { HailerSignal } from "../mcp/signal-handler";
16
- export interface SpecialistDaemonConfig extends ChatAgentDaemonConfig {
17
- /** The specialist configuration */
18
- specialist: Specialist;
19
- }
20
- export declare class SpecialistDaemon extends ChatAgentDaemon {
21
- private specialistLogger;
22
- private specialist;
23
- private lastResponseTime;
24
- private minResponseGap;
25
- constructor(config: SpecialistDaemonConfig);
26
- /**
27
- * Override agent name for Agent Directory - uses specialist's configured name
28
- */
29
- protected getAgentName(): {
30
- firstName: string;
31
- lastName: string;
32
- };
33
- /**
34
- * Override agent description for Agent Directory - uses specialist's expertise
35
- */
36
- protected getAgentDescription(): string;
37
- /**
38
- * Override Position details for Specialist - uses specialist's expertise
39
- */
40
- protected getPositionDetails(): {
41
- name: string;
42
- purpose: string;
43
- personaTone: string;
44
- coreCapabilities: string;
45
- boundaries: string;
46
- };
47
- /**
48
- * Override to only process messages where we're @mentioned
49
- */
50
- protected extractIncomingMessage(signal: HailerSignal): Promise<IncomingMessage | null>;
51
- /**
52
- * Check if this specialist is mentioned in the message
53
- * Supports various mention formats:
54
- * - @"Specialist Name"
55
- * - @SpecialistName (no spaces)
56
- * - Direct user tag [hailerTag|Name](userId)
57
- */
58
- private isMentionedInMessage;
59
- /**
60
- * Override system prompt with specialist-specific prompt
61
- */
62
- protected getSystemPrompt(): string;
63
- /**
64
- * Track response time for rate limiting
65
- */
66
- protected postResponse(discussionId: string, content: string): Promise<void>;
67
- /**
68
- * Get specialist status
69
- */
70
- getSpecialistStatus(): {
71
- name: string;
72
- expertise: string[];
73
- conversationState: ReturnType<ChatAgentDaemon["getConversationState"]>;
74
- lastResponseTime: number;
75
- };
76
- }
77
- //# sourceMappingURL=specialist-daemon.d.ts.map
@@ -1,197 +0,0 @@
1
- "use strict";
2
- /**
3
- * Specialist Daemon
4
- *
5
- * A lightweight daemon for specialist bots that only responds when @mentioned.
6
- * Specialists are invited to discussions by the orchestrator (HAL) to handle
7
- * specific complex tasks.
8
- *
9
- * Key differences from ChatAgentDaemon:
10
- * - Only responds when @mentioned (not all messages)
11
- * - Has specialized system prompt from Specialist config
12
- * - More tool-focused, less conversational
13
- */
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.SpecialistDaemon = void 0;
16
- const chat_agent_daemon_1 = require("./chat-agent-daemon");
17
- const logger_1 = require("../lib/logger");
18
- class SpecialistDaemon extends chat_agent_daemon_1.ChatAgentDaemon {
19
- specialistLogger;
20
- specialist;
21
- lastResponseTime = 0;
22
- minResponseGap = 2000; // 2 seconds minimum between responses
23
- constructor(config) {
24
- super(config);
25
- this.specialist = config.specialist;
26
- this.specialistLogger = (0, logger_1.createLogger)({
27
- component: "SpecialistDaemon",
28
- botId: config.botClient.userId,
29
- specialistName: config.specialist.name,
30
- });
31
- }
32
- // ===== AGENT DIRECTORY OVERRIDES =====
33
- /**
34
- * Override agent name for Agent Directory - uses specialist's configured name
35
- */
36
- getAgentName() {
37
- const nameParts = this.specialist.name.split(" ");
38
- const firstName = nameParts[0] || "Specialist";
39
- const lastName = nameParts.slice(1).join(" ") || "Bot";
40
- return { firstName, lastName };
41
- }
42
- /**
43
- * Override agent description for Agent Directory - uses specialist's expertise
44
- */
45
- getAgentDescription() {
46
- return `${this.specialist.name} - Specialist bot.\n\nExpertise: ${this.specialist.expertise.join(", ")}\n\n${this.specialist.systemPrompt.substring(0, 500)}...`;
47
- }
48
- /**
49
- * Override Position details for Specialist - uses specialist's expertise
50
- */
51
- getPositionDetails() {
52
- return {
53
- name: `${this.specialist.name} Position`,
54
- purpose: `Specialist bot for: ${this.specialist.expertise.join(", ")}`,
55
- personaTone: "Technical, precise, and data-focused. Responds with structured results.",
56
- coreCapabilities: this.specialist.expertise.map(e => `- ${e}`).join("\n"),
57
- boundaries: "- Only respond when explicitly @mentioned\n- Never fabricate data - always use tools\n- Stay focused on specialty area\n- Hand back to orchestrator when done",
58
- };
59
- }
60
- /**
61
- * Override to only process messages where we're @mentioned
62
- */
63
- async extractIncomingMessage(signal) {
64
- // Get base message extraction
65
- const message = await super.extractIncomingMessage(signal);
66
- if (!message)
67
- return null;
68
- // Specialists only respond when mentioned
69
- if (!this.isMentionedInMessage(message)) {
70
- this.specialistLogger.debug("Message doesn't mention specialist, ignoring", {
71
- discussion: message.discussionId,
72
- from: message.senderName,
73
- });
74
- return null;
75
- }
76
- // Rate limit responses
77
- const now = Date.now();
78
- if (now - this.lastResponseTime < this.minResponseGap) {
79
- this.specialistLogger.debug("Rate limiting specialist response", {
80
- timeSinceLastResponse: now - this.lastResponseTime,
81
- });
82
- return null;
83
- }
84
- // Mark as high priority since we're explicitly mentioned
85
- message.priority = "high";
86
- message.priorityReason = `Specialist ${this.specialist.name} was tagged`;
87
- this.specialistLogger.info("Specialist mentioned, processing message", {
88
- discussion: message.discussionId,
89
- from: message.senderName,
90
- preview: message.content.substring(0, 50),
91
- });
92
- return message;
93
- }
94
- /**
95
- * Check if this specialist is mentioned in the message
96
- * Supports various mention formats:
97
- * - @"Specialist Name"
98
- * - @SpecialistName (no spaces)
99
- * - Direct user tag [hailerTag|Name](userId)
100
- */
101
- isMentionedInMessage(message) {
102
- const content = message.content;
103
- const name = this.specialist.name;
104
- const userId = this.botClient.userId;
105
- // Check for hailerTag mention (most reliable)
106
- const hailerTagPattern = new RegExp(`\\[hailerTag\\|[^\\]]*\\]\\(${userId}\\)`, "i");
107
- if (hailerTagPattern.test(content)) {
108
- return true;
109
- }
110
- // Check for @"Name" mention
111
- if (content.includes(`@"${name}"`)) {
112
- return true;
113
- }
114
- // Check for @Name (no spaces version)
115
- const nameNoSpaces = name.replace(/\s+/g, "");
116
- if (content.includes(`@${nameNoSpaces}`)) {
117
- return true;
118
- }
119
- // Check for @Name (first word)
120
- const firstName = name.split(" ")[0];
121
- if (content.includes(`@${firstName}`)) {
122
- return true;
123
- }
124
- // Check message.isMention (set by parent class)
125
- if (message.isMention) {
126
- return true;
127
- }
128
- return false;
129
- }
130
- /**
131
- * Override system prompt with specialist-specific prompt
132
- */
133
- getSystemPrompt() {
134
- const now = new Date();
135
- return `${this.specialist.systemPrompt}
136
-
137
- <current_time>${now.toISOString()}</current_time>
138
-
139
- <bot_info>
140
- Bot ID: ${this.botClient.userId}
141
- Name: ${this.specialist.name}
142
- </bot_info>
143
-
144
- <response_rules>
145
- - You were invited to this discussion to help with a specific task
146
- - Read HAL's handoff message to understand what's needed
147
- - Use MCP tools to complete the task - NEVER fabricate data
148
- - Respond with clear, structured results
149
- - Include activity links using #activityId format
150
- - Be concise and technical - data first, explanation second
151
- </response_rules>
152
-
153
- <response_format>
154
- When you complete a task, respond with:
155
- <respond discussion="DISCUSSION_ID">
156
- [Status emoji] [Brief summary]
157
-
158
- **What I did:**
159
- - Step 1: ...
160
- - Step 2: ...
161
-
162
- **Results:**
163
- [Data, links, or confirmation]
164
-
165
- **Next steps (if applicable):**
166
- [Suggestions for follow-up]
167
- </respond>
168
-
169
- If you need clarification:
170
- <respond discussion="DISCUSSION_ID">
171
- I need more information to complete this task:
172
- - Question 1?
173
- - Question 2?
174
- </respond>
175
- </response_format>`;
176
- }
177
- /**
178
- * Track response time for rate limiting
179
- */
180
- async postResponse(discussionId, content) {
181
- await super.postResponse(discussionId, content);
182
- this.lastResponseTime = Date.now();
183
- }
184
- /**
185
- * Get specialist status
186
- */
187
- getSpecialistStatus() {
188
- return {
189
- name: this.specialist.name,
190
- expertise: this.specialist.expertise,
191
- conversationState: this.getConversationState(),
192
- lastResponseTime: this.lastResponseTime,
193
- };
194
- }
195
- }
196
- exports.SpecialistDaemon = SpecialistDaemon;
197
- //# sourceMappingURL=specialist-daemon.js.map
@@ -1,53 +0,0 @@
1
- /**
2
- * Specialist Bot Configuration
3
- *
4
- * Defines specialist bots that can be invited by the orchestrator (HAL)
5
- * when tasks are too complex for general handling.
6
- *
7
- * Each specialist has:
8
- * - Trigger patterns: When HAL should consider inviting them
9
- * - Expertise areas: What they're good at
10
- * - System prompt: How they behave when invited
11
- */
12
- export interface Specialist {
13
- /** Display name (used in @mentions) */
14
- name: string;
15
- /** Hailer user ID of this bot (set at runtime from config) */
16
- botUserId?: string;
17
- /** Email of this bot (for matching with config) */
18
- botEmail: string;
19
- /** What this specialist is good at */
20
- expertise: string[];
21
- /** Regex patterns that trigger consideration of this specialist */
22
- triggerPatterns: RegExp[];
23
- /** Keywords that suggest this specialist (less strict than patterns) */
24
- triggerKeywords: string[];
25
- /** System prompt for this specialist when active */
26
- systemPrompt: string;
27
- /** Model to use (defaults to parent config) */
28
- model?: string;
29
- }
30
- /**
31
- * Registry of available specialists
32
- * Key is the specialist identifier used internally
33
- */
34
- export declare const SPECIALISTS: Record<string, Specialist>;
35
- /**
36
- * Find a specialist that matches the given message content
37
- * Returns the specialist if patterns match, null otherwise
38
- */
39
- export declare function findMatchingSpecialist(content: string): Specialist | null;
40
- /**
41
- * Check if content contains keywords suggesting a specialist might help
42
- * Less strict than pattern matching - used for secondary consideration
43
- */
44
- export declare function hasSpecialistKeywords(content: string, specialist: Specialist): boolean;
45
- /**
46
- * Get specialist by key
47
- */
48
- export declare function getSpecialist(key: string): Specialist | undefined;
49
- /**
50
- * Get all specialist keys
51
- */
52
- export declare function getSpecialistKeys(): string[];
53
- //# sourceMappingURL=specialists.d.ts.map
@@ -1,178 +0,0 @@
1
- "use strict";
2
- /**
3
- * Specialist Bot Configuration
4
- *
5
- * Defines specialist bots that can be invited by the orchestrator (HAL)
6
- * when tasks are too complex for general handling.
7
- *
8
- * Each specialist has:
9
- * - Trigger patterns: When HAL should consider inviting them
10
- * - Expertise areas: What they're good at
11
- * - System prompt: How they behave when invited
12
- */
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.SPECIALISTS = void 0;
15
- exports.findMatchingSpecialist = findMatchingSpecialist;
16
- exports.hasSpecialistKeywords = hasSpecialistKeywords;
17
- exports.getSpecialist = getSpecialist;
18
- exports.getSpecialistKeys = getSpecialistKeys;
19
- /**
20
- * Registry of available specialists
21
- * Key is the specialist identifier used internally
22
- */
23
- exports.SPECIALISTS = {
24
- hailerExpert: {
25
- name: "Hailer Expert",
26
- botEmail: "", // Set from config at runtime
27
- expertise: [
28
- "workflow creation and management",
29
- "activity bulk operations",
30
- "insights and SQL reports",
31
- "complex data queries",
32
- "workflow configuration",
33
- ],
34
- triggerPatterns: [
35
- // Workflow creation
36
- /create\s+(a\s+)?(new\s+)?(workflow|pipeline|process|tracker)/i,
37
- /set\s+up\s+(a\s+)?(new\s+)?(workflow|pipeline|process)/i,
38
- /build\s+(me\s+)?(a\s+)?(workflow|pipeline|crm|tracker)/i,
39
- // Insight/report creation
40
- /create\s+(a\s+)?(new\s+)?(report|insight|dashboard)/i,
41
- /set\s+up\s+(a\s+)?(report|insight|analytics)/i,
42
- /build\s+(a\s+)?(report|dashboard)\s+(showing|for)/i,
43
- // Bulk operations
44
- /create\s+(\d{2,}|multiple|several|many)\s+(activities|tasks|records)/i,
45
- /bulk\s+(create|update|import)/i,
46
- /import\s+(\d+|these|the)\s+(activities|tasks|records|items)/i,
47
- // Complex queries
48
- /complex\s+(query|filter|search)/i,
49
- /advanced\s+(search|filter)/i,
50
- // Multi-step operations
51
- /(and|then|also)\s+(create|set up|add)\s+(a\s+)?(report|insight|workflow)/i,
52
- ],
53
- triggerKeywords: [
54
- "workflow",
55
- "pipeline",
56
- "insight",
57
- "report",
58
- "dashboard",
59
- "bulk",
60
- "import",
61
- "phases",
62
- "stages",
63
- ],
64
- systemPrompt: `<identity>
65
- You are the Hailer Expert - a specialized assistant for Hailer workspace operations.
66
- You were invited to this discussion by HAL to help with a specific task.
67
- </identity>
68
-
69
- <capabilities>
70
- You have access to these MCP tools:
71
-
72
- **Workflow Management:**
73
- - list_workflows, list_workflows_minimal - See available workflows
74
- - list_workflow_phases - See phases in a workflow
75
- - get_workflow_schema - See fields and structure
76
- - install_workflow - Create new workflows
77
- - update_workflow_field - Modify workflow fields
78
- - update_workflow_phase - Modify phases
79
-
80
- **Activity Operations:**
81
- - list_activities(workflowId, phaseId, filters?, fields?, search?, limit?) - Query activities
82
- - show_activity_by_id(activityId) - Get activity details
83
- - create_activity(workflowId, name, fields?) OR create_activity(workflowId, activities[{name, fields}]) - Create single/bulk
84
- - update_activity(activityId, name?, fields?, phaseId?) - Update SINGLE activity
85
- - update_activity(activities: [{_id, name?, fields?, phaseId?}]) - Update BULK (3+ activities)
86
- - count_activities(workflowId, phaseId?) - Count activities
87
-
88
- **CRITICAL for update_activity:**
89
- - SINGLE: use "activityId" parameter (NOT "_id")
90
- - BULK: use "activities" array, each object MUST have "_id" (the activity ID)
91
-
92
- **Insights (SQL Reports):**
93
- - list_insights - See existing insights
94
- - create_insight - Create SQL-like reports
95
- - preview_insight - Test SQL queries
96
- - get_insight_data - Execute and get results
97
-
98
- **Other:**
99
- - search_workspace_users - Find users
100
- - Discussion tools for chat
101
- </capabilities>
102
-
103
- <protocol>
104
- 1. Read HAL's handoff message carefully - it contains the task context
105
- 2. Plan the operations needed
106
- 3. Execute using MCP tools - NEVER fabricate data
107
- 4. Report back with:
108
- - What you did
109
- - Results with clickable links (#activityId format)
110
- - Any follow-up suggestions
111
- </protocol>
112
-
113
- <response_format>
114
- When completing a task:
115
- <respond discussion="DISCUSSION_ID">
116
- [Brief status emoji + summary]
117
-
118
- **What I did:**
119
- - Step 1: ...
120
- - Step 2: ...
121
-
122
- **Results:**
123
- [Data, links, or confirmation]
124
-
125
- **Next steps (optional):**
126
- [Suggestions for follow-up]
127
- </respond>
128
- </response_format>
129
-
130
- <rules>
131
- - Only respond when @mentioned - you were invited for a specific task
132
- - Always use tools - never make up data or IDs
133
- - Use #activityId format for activity links (auto-resolves to names)
134
- - Be concise and technical
135
- - If a tool call fails, DO NOT retry with the same parameters - explain the error to the user
136
- - If you get "activityId is required" error, you forgot to pass the activity ID - fix your parameters
137
- - Maximum 5 tool calls per task - if you need more, ask the user to break it down
138
- </rules>`,
139
- },
140
- };
141
- /**
142
- * Find a specialist that matches the given message content
143
- * Returns the specialist if patterns match, null otherwise
144
- */
145
- function findMatchingSpecialist(content) {
146
- for (const specialist of Object.values(exports.SPECIALISTS)) {
147
- // Check trigger patterns (strict match)
148
- for (const pattern of specialist.triggerPatterns) {
149
- if (pattern.test(content)) {
150
- return specialist;
151
- }
152
- }
153
- }
154
- return null;
155
- }
156
- /**
157
- * Check if content contains keywords suggesting a specialist might help
158
- * Less strict than pattern matching - used for secondary consideration
159
- */
160
- function hasSpecialistKeywords(content, specialist) {
161
- const contentLower = content.toLowerCase();
162
- const keywordCount = specialist.triggerKeywords.filter((kw) => contentLower.includes(kw.toLowerCase())).length;
163
- // Require at least 2 keywords for a soft match
164
- return keywordCount >= 2;
165
- }
166
- /**
167
- * Get specialist by key
168
- */
169
- function getSpecialist(key) {
170
- return exports.SPECIALISTS[key];
171
- }
172
- /**
173
- * Get all specialist keys
174
- */
175
- function getSpecialistKeys() {
176
- return Object.keys(exports.SPECIALISTS);
177
- }
178
- //# sourceMappingURL=specialists.js.map
@@ -1,62 +0,0 @@
1
- /**
2
- * Tool Schema Loader
3
- *
4
- * Manages MCP tool discovery, schema loading, and filtering.
5
- * Shared between all LLM providers (Anthropic, OpenAI, etc.)
6
- *
7
- * Key Features:
8
- * - Load lightweight tool index from MCP server
9
- * - Filter tools by groups (READ, WRITE, PLAYGROUND)
10
- * - Load full schemas on-demand (token-efficient)
11
- * - Cache loaded schemas
12
- */
13
- import { ToolGroup } from '../mcp/tool-registry';
14
- import { JsonSchema } from './types';
15
- import Anthropic from '@anthropic-ai/sdk';
16
- export interface ToolIndexEntry {
17
- name: string;
18
- category: string;
19
- description: string;
20
- }
21
- export interface ToolDefinition {
22
- name: string;
23
- description: string;
24
- input_schema: JsonSchema;
25
- }
26
- export interface LoadToolsOptions {
27
- mcpServerUrl: string;
28
- mcpServerApiKey: string;
29
- allowedGroups: ToolGroup[];
30
- allowedTools?: string[];
31
- excludeMessageFetchTools?: boolean;
32
- }
33
- export declare class ToolSchemaLoader {
34
- private toolSchemaCache;
35
- /**
36
- * Load tool index with filtering
37
- * Returns lightweight tool list with optional exclusions
38
- */
39
- loadToolIndex(options: LoadToolsOptions): Promise<ToolIndexEntry[]>;
40
- /**
41
- * Load full schema for a specific tool on-demand
42
- */
43
- loadToolSchema(mcpServerUrl: string, mcpServerApiKey: string, toolName: string): Promise<any>;
44
- /**
45
- * Convert tool index to minimal tool definitions (stubs)
46
- * Full schemas will be loaded on-demand when needed
47
- */
48
- toMinimalToolDefinitions(toolIndex: ToolIndexEntry[]): Anthropic.Tool[];
49
- /**
50
- * Get count of loaded schemas
51
- */
52
- getLoadedSchemaCount(): number;
53
- /**
54
- * Clear schema cache
55
- */
56
- clearCache(): void;
57
- /**
58
- * Fetch tool index from MCP server
59
- */
60
- private fetchMcpToolIndex;
61
- }
62
- //# sourceMappingURL=tool-schema-loader.d.ts.map