@hailer/mcp 0.1.17 → 0.2.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.
Files changed (200) hide show
  1. package/dist/app.js +24 -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,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=definitions.d.ts.map
@@ -1,263 +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
- giuseppe: {
25
- name: "Giuseppe",
26
- botEmail: "", // Set from config at runtime (uses same bot as orchestrator for now)
27
- expertise: [
28
- "bug fixing",
29
- "app debugging",
30
- "React/TypeScript fixes",
31
- "Hailer app development",
32
- "automated code repair",
33
- ],
34
- triggerPatterns: [
35
- // Bug reports
36
- /bug\s+(report|in|with|found)/i,
37
- /report\s+(a\s+)?bug/i,
38
- /found\s+(a\s+)?bug/i,
39
- /there('s|\s+is)\s+(a\s+)?bug/i,
40
- // Fix requests
41
- /fix\s+(the|this|my)\s+(bug|issue|problem|app)/i,
42
- /can\s+you\s+fix/i,
43
- /please\s+fix/i,
44
- // App issues
45
- /app\s+(is\s+)?(broken|not\s+working|crashing|laggy)/i,
46
- /(broken|crashing|laggy)\s+app/i,
47
- // Giuseppe mentions
48
- /giuseppe/i,
49
- /auto.?fix/i,
50
- ],
51
- triggerKeywords: [
52
- "bug",
53
- "fix",
54
- "broken",
55
- "issue",
56
- "error",
57
- "crash",
58
- "laggy",
59
- "not working",
60
- "giuseppe",
61
- ],
62
- systemPrompt: `<identity>
63
- You are Giuseppe - the autonomous bug fixing specialist.
64
- You were designed to automatically detect, analyze, and fix bugs in Hailer apps.
65
- </identity>
66
-
67
- <capabilities>
68
- **Automatic Bug Detection:**
69
- - I monitor the "Bug Reports" workflow for new bugs
70
- - When a bug is detected, I automatically:
71
- 1. Find the app project
72
- 2. Analyze the code
73
- 3. Generate a fix using Claude
74
- 4. Apply and test the fix
75
- 5. Ask for approval before publishing
76
-
77
- **Bug Report Workflow:**
78
- - Users create bug reports in the "Bug Reports" workflow
79
- - I pick them up automatically and start fixing
80
- - After the fix is ready, I ask the user to test
81
- - User replies "approved" → I publish to production
82
- - User replies "denied" → I ask what's wrong and retry
83
-
84
- **What I Can Fix:**
85
- - React/TypeScript compilation errors
86
- - Hailer app SDK issues
87
- - UI bugs and layout problems
88
- - State management issues
89
- - API integration bugs
90
- </capabilities>
91
-
92
- <how_to_use>
93
- To report a bug for me to fix:
94
- 1. Create a new activity in the "Bug Reports" workflow
95
- 2. Set the title to include the app name (e.g., "Bug Report - My App")
96
- 3. Describe the bug in detail
97
- 4. I'll automatically pick it up and start working on it!
98
-
99
- Or just tell HAL about a bug and ask to create a bug report.
100
- </how_to_use>
101
-
102
- <response_format>
103
- When asked about bugs or my capabilities:
104
- - Explain what I can do
105
- - Offer to create a bug report if they describe a bug
106
- - Tell them to check the Bug Reports workflow for status
107
- </response_format>`,
108
- },
109
- hailerExpert: {
110
- name: "Hailer Expert",
111
- botEmail: "", // Set from config at runtime
112
- expertise: [
113
- "workflow creation and management",
114
- "activity bulk operations",
115
- "insights and SQL reports",
116
- "complex data queries",
117
- "workflow configuration",
118
- ],
119
- triggerPatterns: [
120
- // Workflow creation
121
- /create\s+(a\s+)?(new\s+)?(workflow|pipeline|process|tracker)/i,
122
- /set\s+up\s+(a\s+)?(new\s+)?(workflow|pipeline|process)/i,
123
- /build\s+(me\s+)?(a\s+)?(workflow|pipeline|crm|tracker)/i,
124
- // Insight/report creation
125
- /create\s+(a\s+)?(new\s+)?(report|insight|dashboard)/i,
126
- /set\s+up\s+(a\s+)?(report|insight|analytics)/i,
127
- /build\s+(a\s+)?(report|dashboard)\s+(showing|for)/i,
128
- // Bulk operations
129
- /create\s+(\d{2,}|multiple|several|many)\s+(activities|tasks|records)/i,
130
- /bulk\s+(create|update|import)/i,
131
- /import\s+(\d+|these|the)\s+(activities|tasks|records|items)/i,
132
- // Complex queries
133
- /complex\s+(query|filter|search)/i,
134
- /advanced\s+(search|filter)/i,
135
- // Multi-step operations
136
- /(and|then|also)\s+(create|set up|add)\s+(a\s+)?(report|insight|workflow)/i,
137
- ],
138
- triggerKeywords: [
139
- "workflow",
140
- "pipeline",
141
- "insight",
142
- "report",
143
- "dashboard",
144
- "bulk",
145
- "import",
146
- "phases",
147
- "stages",
148
- ],
149
- systemPrompt: `<identity>
150
- You are the Hailer Expert - a specialized assistant for Hailer workspace operations.
151
- You were invited to this discussion by HAL to help with a specific task.
152
- </identity>
153
-
154
- <capabilities>
155
- You have access to these MCP tools:
156
-
157
- **Workflow Management:**
158
- - list_workflows, list_workflows_minimal - See available workflows
159
- - list_workflow_phases - See phases in a workflow
160
- - get_workflow_schema - See fields and structure
161
- - install_workflow - Create new workflows
162
- - update_workflow_field - Modify workflow fields
163
- - update_workflow_phase - Modify phases
164
-
165
- **Activity Operations:**
166
- - list_activities(workflowId, phaseId, filters?, fields?, search?, limit?) - Query activities
167
- - show_activity_by_id(activityId) - Get activity details
168
- - create_activity(workflowId, name, fields?) OR create_activity(workflowId, activities[{name, fields}]) - Create single/bulk
169
- - update_activity(activityId, name?, fields?, phaseId?) - Update SINGLE activity
170
- - update_activity(activities: [{_id, name?, fields?, phaseId?}]) - Update BULK (3+ activities)
171
- - count_activities(workflowId, phaseId?) - Count activities
172
-
173
- **CRITICAL for update_activity:**
174
- - SINGLE: use "activityId" parameter (NOT "_id")
175
- - BULK: use "activities" array, each object MUST have "_id" (the activity ID)
176
-
177
- **Insights (SQL Reports):**
178
- - list_insights - See existing insights
179
- - create_insight - Create SQL-like reports
180
- - preview_insight - Test SQL queries
181
- - get_insight_data - Execute and get results
182
-
183
- **Other:**
184
- - search_workspace_users - Find users
185
- - Discussion tools for chat
186
- </capabilities>
187
-
188
- <protocol>
189
- 1. Read HAL's handoff message carefully - it contains the task context
190
- 2. Plan the operations needed
191
- 3. Execute using MCP tools - NEVER fabricate data
192
- 4. Report back with:
193
- - What you did
194
- - Results with clickable links (#activityId format)
195
- - Any follow-up suggestions
196
- </protocol>
197
-
198
- <response_format>
199
- When completing a task:
200
- <respond discussion="DISCUSSION_ID">
201
- [Brief status emoji + summary]
202
-
203
- **What I did:**
204
- - Step 1: ...
205
- - Step 2: ...
206
-
207
- **Results:**
208
- [Data, links, or confirmation]
209
-
210
- **Next steps (optional):**
211
- [Suggestions for follow-up]
212
- </respond>
213
- </response_format>
214
-
215
- <rules>
216
- - Only respond when @mentioned - you were invited for a specific task
217
- - Always use tools - never make up data or IDs
218
- - Use #activityId format for activity links (auto-resolves to names)
219
- - Be concise and technical
220
- - If a tool call fails, DO NOT retry with the same parameters - explain the error to the user
221
- - If you get "activityId is required" error, you forgot to pass the activity ID - fix your parameters
222
- - Maximum 5 tool calls per task - if you need more, ask the user to break it down
223
- </rules>`,
224
- },
225
- };
226
- /**
227
- * Find a specialist that matches the given message content
228
- * Returns the specialist if patterns match, null otherwise
229
- */
230
- function findMatchingSpecialist(content) {
231
- for (const specialist of Object.values(exports.SPECIALISTS)) {
232
- // Check trigger patterns (strict match)
233
- for (const pattern of specialist.triggerPatterns) {
234
- if (pattern.test(content)) {
235
- return specialist;
236
- }
237
- }
238
- }
239
- return null;
240
- }
241
- /**
242
- * Check if content contains keywords suggesting a specialist might help
243
- * Less strict than pattern matching - used for secondary consideration
244
- */
245
- function hasSpecialistKeywords(content, specialist) {
246
- const contentLower = content.toLowerCase();
247
- const keywordCount = specialist.triggerKeywords.filter((kw) => contentLower.includes(kw.toLowerCase())).length;
248
- // Require at least 2 keywords for a soft match
249
- return keywordCount >= 2;
250
- }
251
- /**
252
- * Get specialist by key
253
- */
254
- function getSpecialist(key) {
255
- return exports.SPECIALISTS[key];
256
- }
257
- /**
258
- * Get all specialist keys
259
- */
260
- function getSpecialistKeys() {
261
- return Object.keys(exports.SPECIALISTS);
262
- }
263
- //# sourceMappingURL=definitions.js.map
@@ -1,141 +0,0 @@
1
- /**
2
- * Orchestrator Daemon (HAL)
3
- *
4
- * The main conversational bot that handles general chat and coordinates
5
- * with specialist bots when tasks are too complex.
6
- *
7
- * HAL can:
8
- * - Handle general conversation and simple queries
9
- * - Detect when a task needs specialist help
10
- * - Invite specialist bots to the discussion
11
- * - Hand off context to specialists
12
- * - Summarize specialist responses for users
13
- */
14
- import { ChatAgentDaemon, ChatAgentDaemonConfig, IncomingMessage } from "./base";
15
- import { HailerSignal } from "../../mcp/signal-handler";
16
- import { ToolInput } from "../types";
17
- import Anthropic from "@anthropic-ai/sdk";
18
- export interface OrchestratorDaemonConfig extends ChatAgentDaemonConfig {
19
- /** Map of specialist key to their Hailer user ID */
20
- specialistUserIds?: Map<string, string>;
21
- }
22
- export declare class OrchestratorDaemon extends ChatAgentDaemon {
23
- private orchestratorLogger;
24
- private specialists;
25
- private activeSpecialistsInDiscussion;
26
- private specialistUserIds;
27
- private toolsUsedInCurrentMessage;
28
- private lastToolsUsed;
29
- private lastToolsFailed;
30
- private static SILENT_SUCCESS_TOOLS;
31
- private lastKnownActivityId;
32
- private lastKnownActivityName;
33
- private lastKnownActivityTime;
34
- private static CONTEXT_MEMORY_TIMEOUT;
35
- constructor(config: OrchestratorDaemonConfig);
36
- /**
37
- * Trigger HAL to respond in a discussion with specific context
38
- * Used when bug monitor needs HAL to naturally inform users about Giuseppe being disabled
39
- */
40
- respondWithContext(discussionId: string, activityId: string, contextMessage: string): Promise<void>;
41
- /**
42
- * Override agent name for Agent Directory
43
- * Uses the actual Hailer user name from BotClient (set in workspace)
44
- */
45
- protected getAgentName(): {
46
- firstName: string;
47
- lastName: string;
48
- };
49
- /**
50
- * Override agent description for Agent Directory
51
- */
52
- protected getAgentDescription(): string;
53
- /**
54
- * Override Position details for Orchestrator
55
- */
56
- protected getPositionDetails(): {
57
- name: string;
58
- purpose: string;
59
- personaTone: string;
60
- coreCapabilities: string;
61
- boundaries: string;
62
- };
63
- /**
64
- * Orchestrator only needs basic tools - complex ops go to specialists
65
- */
66
- protected getToolWhitelist(): string[];
67
- /**
68
- * Preprocess tool input - inject context for certain tools
69
- * Uses cross-discussion memory to maintain context awareness
70
- */
71
- protected preprocessToolInput(toolName: string, input: ToolInput): ToolInput;
72
- /**
73
- * Override to detect tool failures for silent success feature
74
- */
75
- protected executeToolsAndContinue(toolUseBlocks: Anthropic.ToolUseBlock[], originalMessage: IncomingMessage): Promise<void>;
76
- /**
77
- * Update cross-discussion memory when processing messages
78
- * Call this when entering an activity discussion to remember context
79
- */
80
- private updateContextMemory;
81
- /**
82
- * Override to update cross-discussion memory when entering activity discussions
83
- * Also checks if a specialist bot (like Giuseppe) has locked this discussion
84
- */
85
- protected extractIncomingMessage(signal: HailerSignal): Promise<IncomingMessage | null>;
86
- /**
87
- * Register a specialist's Hailer user ID
88
- * Called during initialization when we know the specialist bot's user ID
89
- */
90
- registerSpecialistUserId(specialistKey: string, userId: string): void;
91
- /**
92
- * Check if a specialist is already active in a discussion
93
- */
94
- private isSpecialistActiveInDiscussion;
95
- /**
96
- * Mark a specialist as active in a discussion
97
- */
98
- private markSpecialistActive;
99
- /**
100
- * Invite a specialist to a discussion
101
- */
102
- private inviteSpecialist;
103
- /**
104
- * Override getTools to include Giuseppe retry tool when there's a pending fix
105
- */
106
- protected getTools(): Anthropic.Tool[];
107
- /**
108
- * Get tools list with Giuseppe retry tool added
109
- */
110
- private getToolsWithGiuseppeRetry;
111
- /**
112
- * Get pending fix context for a discussion (if any)
113
- */
114
- private getPendingFixContext;
115
- /**
116
- * Get pending classification context for a discussion (if any)
117
- */
118
- private getPendingClassificationContext;
119
- /**
120
- * Override system prompt to include orchestrator capabilities
121
- */
122
- protected getSystemPrompt(): string;
123
- /**
124
- * Override response handling to detect specialist invitations
125
- */
126
- protected handleLlmResponse(response: Anthropic.Message, originalMessage: IncomingMessage): Promise<void>;
127
- /**
128
- * Get orchestrator status including specialist info
129
- */
130
- getOrchestratorStatus(): {
131
- conversationState: ReturnType<ChatAgentDaemon["getConversationState"]>;
132
- specialists: Array<{
133
- key: string;
134
- name: string;
135
- available: boolean;
136
- userId?: string;
137
- }>;
138
- activeInDiscussions: Record<string, string[]>;
139
- };
140
- }
141
- //# sourceMappingURL=orchestrator.d.ts.map