@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.
- package/dist/app.js +24 -20
- package/dist/core.d.ts +33 -9
- package/dist/core.js +279 -147
- package/dist/mcp/UserContextCache.js +18 -0
- package/dist/mcp/hailer-clients.d.ts +9 -1
- package/dist/mcp/hailer-clients.js +13 -3
- package/dist/mcp/signal-handler.js +1 -1
- package/dist/mcp/tool-registry.d.ts +3 -1
- package/dist/mcp/tool-registry.js +4 -1
- package/dist/mcp/tools/activity.js +43 -34
- package/dist/mcp/tools/bot-config/constants.d.ts +23 -0
- package/dist/mcp/tools/bot-config/constants.js +94 -0
- package/dist/mcp/tools/{bot-config.d.ts → bot-config/core.d.ts} +6 -6
- package/dist/mcp/tools/{bot-config.js → bot-config/core.js} +15 -15
- package/dist/mcp/tools/bot-config/index.d.ts +10 -0
- package/dist/mcp/tools/bot-config/index.js +59 -0
- package/dist/mcp/tools/bot-config/tools.d.ts +7 -0
- package/dist/mcp/tools/bot-config/tools.js +15 -0
- package/dist/mcp/tools/bot-config/types.d.ts +50 -0
- package/dist/mcp/tools/bot-config/types.js +6 -0
- package/dist/mcp/tools/bug-fixer-tools.d.ts +21 -0
- package/dist/mcp/tools/{giuseppe-tools.js → bug-fixer-tools.js} +61 -61
- package/dist/mcp/tools/user.js +10 -29
- package/dist/mcp/tools/workflow.js +36 -2
- package/dist/mcp/utils/data-transformers.d.ts +0 -8
- package/dist/mcp/utils/data-transformers.js +0 -28
- package/dist/mcp/utils/index.d.ts +4 -1
- package/dist/mcp/utils/index.js +17 -3
- package/dist/mcp/utils/pagination.d.ts +40 -0
- package/dist/mcp/utils/pagination.js +55 -0
- package/dist/mcp/utils/response-builder.d.ts +53 -0
- package/dist/mcp/utils/response-builder.js +110 -0
- package/dist/mcp/utils/tool-helpers.d.ts +0 -8
- package/dist/mcp/utils/tool-helpers.js +0 -24
- package/dist/mcp/utils/types.d.ts +1 -33
- package/dist/mcp-server.d.ts +2 -2
- package/dist/mcp-server.js +161 -139
- package/package.json +1 -1
- package/REFACTOR_STATUS.md +0 -127
- package/dist/agents/bot-manager.d.ts +0 -48
- package/dist/agents/bot-manager.js +0 -254
- package/dist/agents/factory.d.ts +0 -150
- package/dist/agents/factory.js +0 -650
- package/dist/agents/giuseppe/ai.d.ts +0 -83
- package/dist/agents/giuseppe/ai.js +0 -466
- package/dist/agents/giuseppe/bot.d.ts +0 -110
- package/dist/agents/giuseppe/bot.js +0 -780
- package/dist/agents/giuseppe/config.d.ts +0 -25
- package/dist/agents/giuseppe/config.js +0 -227
- package/dist/agents/giuseppe/files.d.ts +0 -52
- package/dist/agents/giuseppe/files.js +0 -338
- package/dist/agents/giuseppe/git.d.ts +0 -48
- package/dist/agents/giuseppe/git.js +0 -298
- package/dist/agents/giuseppe/index.d.ts +0 -97
- package/dist/agents/giuseppe/index.js +0 -258
- package/dist/agents/giuseppe/lsp.d.ts +0 -113
- package/dist/agents/giuseppe/lsp.js +0 -485
- package/dist/agents/giuseppe/monitor.d.ts +0 -118
- package/dist/agents/giuseppe/monitor.js +0 -621
- package/dist/agents/giuseppe/prompt.d.ts +0 -5
- package/dist/agents/giuseppe/prompt.js +0 -94
- package/dist/agents/giuseppe/registries/pending-classification.d.ts +0 -28
- package/dist/agents/giuseppe/registries/pending-classification.js +0 -50
- package/dist/agents/giuseppe/registries/pending-fix.d.ts +0 -30
- package/dist/agents/giuseppe/registries/pending-fix.js +0 -42
- package/dist/agents/giuseppe/registries/pending.d.ts +0 -27
- package/dist/agents/giuseppe/registries/pending.js +0 -49
- package/dist/agents/giuseppe/specialist.d.ts +0 -47
- package/dist/agents/giuseppe/specialist.js +0 -237
- package/dist/agents/giuseppe/types.d.ts +0 -123
- package/dist/agents/giuseppe/types.js +0 -9
- package/dist/agents/hailer-expert/index.d.ts +0 -8
- package/dist/agents/hailer-expert/index.js +0 -14
- package/dist/agents/hal/daemon.d.ts +0 -142
- package/dist/agents/hal/daemon.js +0 -1103
- package/dist/agents/hal/definitions.d.ts +0 -55
- package/dist/agents/hal/definitions.js +0 -263
- package/dist/agents/hal/index.d.ts +0 -3
- package/dist/agents/hal/index.js +0 -8
- package/dist/agents/index.d.ts +0 -18
- package/dist/agents/index.js +0 -48
- package/dist/agents/shared/base.d.ts +0 -216
- package/dist/agents/shared/base.js +0 -846
- package/dist/agents/shared/services/agent-registry.d.ts +0 -107
- package/dist/agents/shared/services/agent-registry.js +0 -629
- package/dist/agents/shared/services/conversation-manager.d.ts +0 -50
- package/dist/agents/shared/services/conversation-manager.js +0 -136
- package/dist/agents/shared/services/mcp-client.d.ts +0 -56
- package/dist/agents/shared/services/mcp-client.js +0 -124
- package/dist/agents/shared/services/message-classifier.d.ts +0 -37
- package/dist/agents/shared/services/message-classifier.js +0 -187
- package/dist/agents/shared/services/message-formatter.d.ts +0 -89
- package/dist/agents/shared/services/message-formatter.js +0 -371
- package/dist/agents/shared/services/session-logger.d.ts +0 -106
- package/dist/agents/shared/services/session-logger.js +0 -446
- package/dist/agents/shared/services/tool-executor.d.ts +0 -41
- package/dist/agents/shared/services/tool-executor.js +0 -169
- package/dist/agents/shared/services/workspace-schema-cache.d.ts +0 -125
- package/dist/agents/shared/services/workspace-schema-cache.js +0 -578
- package/dist/agents/shared/specialist.d.ts +0 -91
- package/dist/agents/shared/specialist.js +0 -399
- package/dist/agents/shared/tool-schema-loader.d.ts +0 -62
- package/dist/agents/shared/tool-schema-loader.js +0 -232
- package/dist/agents/shared/types.d.ts +0 -327
- package/dist/agents/shared/types.js +0 -121
- package/dist/client/agents/base.d.ts +0 -207
- package/dist/client/agents/base.js +0 -744
- package/dist/client/agents/definitions.d.ts +0 -53
- package/dist/client/agents/definitions.js +0 -263
- package/dist/client/agents/orchestrator.d.ts +0 -141
- package/dist/client/agents/orchestrator.js +0 -1062
- package/dist/client/agents/specialist.d.ts +0 -86
- package/dist/client/agents/specialist.js +0 -340
- package/dist/client/bot-entrypoint.d.ts +0 -7
- package/dist/client/bot-entrypoint.js +0 -103
- package/dist/client/bot-manager.d.ts +0 -44
- package/dist/client/bot-manager.js +0 -173
- package/dist/client/bot-runner.d.ts +0 -35
- package/dist/client/bot-runner.js +0 -188
- package/dist/client/chat-agent-daemon.d.ts +0 -464
- package/dist/client/chat-agent-daemon.js +0 -1774
- package/dist/client/daemon-factory.d.ts +0 -106
- package/dist/client/daemon-factory.js +0 -301
- package/dist/client/factory.d.ts +0 -111
- package/dist/client/factory.js +0 -314
- package/dist/client/index.d.ts +0 -17
- package/dist/client/index.js +0 -38
- package/dist/client/multi-bot-manager.d.ts +0 -42
- package/dist/client/multi-bot-manager.js +0 -161
- package/dist/client/orchestrator-daemon.d.ts +0 -87
- package/dist/client/orchestrator-daemon.js +0 -444
- package/dist/client/server.d.ts +0 -8
- package/dist/client/server.js +0 -251
- package/dist/client/services/agent-registry.d.ts +0 -108
- package/dist/client/services/agent-registry.js +0 -630
- package/dist/client/services/conversation-manager.d.ts +0 -50
- package/dist/client/services/conversation-manager.js +0 -136
- package/dist/client/services/mcp-client.d.ts +0 -48
- package/dist/client/services/mcp-client.js +0 -105
- package/dist/client/services/message-classifier.d.ts +0 -37
- package/dist/client/services/message-classifier.js +0 -187
- package/dist/client/services/message-formatter.d.ts +0 -84
- package/dist/client/services/message-formatter.js +0 -353
- package/dist/client/services/session-logger.d.ts +0 -106
- package/dist/client/services/session-logger.js +0 -446
- package/dist/client/services/tool-executor.d.ts +0 -41
- package/dist/client/services/tool-executor.js +0 -169
- package/dist/client/services/workspace-schema-cache.d.ts +0 -149
- package/dist/client/services/workspace-schema-cache.js +0 -732
- package/dist/client/specialist-daemon.d.ts +0 -77
- package/dist/client/specialist-daemon.js +0 -197
- package/dist/client/specialists.d.ts +0 -53
- package/dist/client/specialists.js +0 -178
- package/dist/client/tool-schema-loader.d.ts +0 -62
- package/dist/client/tool-schema-loader.js +0 -232
- package/dist/client/types.d.ts +0 -327
- package/dist/client/types.js +0 -121
- package/dist/commands/seed-config.d.ts +0 -9
- package/dist/commands/seed-config.js +0 -372
- package/dist/lib/context-manager.d.ts +0 -111
- package/dist/lib/context-manager.js +0 -431
- package/dist/lib/prompt-length-manager.d.ts +0 -81
- package/dist/lib/prompt-length-manager.js +0 -457
- package/dist/mcp/tools/giuseppe-tools.d.ts +0 -21
- package/dist/modules/bug-reports/bug-config.d.ts +0 -25
- package/dist/modules/bug-reports/bug-config.js +0 -187
- package/dist/modules/bug-reports/bug-monitor.d.ts +0 -108
- package/dist/modules/bug-reports/bug-monitor.js +0 -510
- package/dist/modules/bug-reports/giuseppe-agent.d.ts +0 -58
- package/dist/modules/bug-reports/giuseppe-agent.js +0 -467
- package/dist/modules/bug-reports/giuseppe-ai.d.ts +0 -83
- package/dist/modules/bug-reports/giuseppe-ai.js +0 -466
- package/dist/modules/bug-reports/giuseppe-bot.d.ts +0 -110
- package/dist/modules/bug-reports/giuseppe-bot.js +0 -804
- package/dist/modules/bug-reports/giuseppe-daemon.d.ts +0 -80
- package/dist/modules/bug-reports/giuseppe-daemon.js +0 -617
- package/dist/modules/bug-reports/giuseppe-files.d.ts +0 -64
- package/dist/modules/bug-reports/giuseppe-files.js +0 -375
- package/dist/modules/bug-reports/giuseppe-git.d.ts +0 -48
- package/dist/modules/bug-reports/giuseppe-git.js +0 -298
- package/dist/modules/bug-reports/giuseppe-lsp.d.ts +0 -113
- package/dist/modules/bug-reports/giuseppe-lsp.js +0 -485
- package/dist/modules/bug-reports/giuseppe-prompt.d.ts +0 -5
- package/dist/modules/bug-reports/giuseppe-prompt.js +0 -94
- package/dist/modules/bug-reports/index.d.ts +0 -77
- package/dist/modules/bug-reports/index.js +0 -215
- package/dist/modules/bug-reports/pending-classification-registry.d.ts +0 -28
- package/dist/modules/bug-reports/pending-classification-registry.js +0 -50
- package/dist/modules/bug-reports/pending-fix-registry.d.ts +0 -30
- package/dist/modules/bug-reports/pending-fix-registry.js +0 -42
- package/dist/modules/bug-reports/pending-registry.d.ts +0 -27
- package/dist/modules/bug-reports/pending-registry.js +0 -49
- package/dist/modules/bug-reports/types.d.ts +0 -123
- package/dist/modules/bug-reports/types.js +0 -9
- package/dist/routes/agents.d.ts +0 -44
- package/dist/routes/agents.js +0 -311
- package/dist/services/agent-credential-store.d.ts +0 -73
- package/dist/services/agent-credential-store.js +0 -212
- package/dist/services/bug-monitor.d.ts +0 -23
- package/dist/services/bug-monitor.js +0 -275
|
@@ -1,86 +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 "./base";
|
|
14
|
-
import { Specialist } from "./definitions";
|
|
15
|
-
import { HailerSignal } from "../../mcp/signal-handler";
|
|
16
|
-
import { ToolInput } from "../types";
|
|
17
|
-
export interface SpecialistDaemonConfig extends ChatAgentDaemonConfig {
|
|
18
|
-
/** The specialist configuration */
|
|
19
|
-
specialist: Specialist;
|
|
20
|
-
}
|
|
21
|
-
export declare class SpecialistDaemon extends ChatAgentDaemon {
|
|
22
|
-
private specialistLogger;
|
|
23
|
-
private specialist;
|
|
24
|
-
private lastResponseTime;
|
|
25
|
-
private minResponseGap;
|
|
26
|
-
constructor(config: SpecialistDaemonConfig);
|
|
27
|
-
/**
|
|
28
|
-
* Override agent name for Agent Directory - uses specialist's configured name
|
|
29
|
-
*/
|
|
30
|
-
protected getAgentName(): {
|
|
31
|
-
firstName: string;
|
|
32
|
-
lastName: string;
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Override agent description for Agent Directory - uses specialist's expertise
|
|
36
|
-
*/
|
|
37
|
-
protected getAgentDescription(): string;
|
|
38
|
-
/**
|
|
39
|
-
* Override Position details for Specialist - uses specialist's expertise
|
|
40
|
-
*/
|
|
41
|
-
protected getPositionDetails(): {
|
|
42
|
-
name: string;
|
|
43
|
-
purpose: string;
|
|
44
|
-
personaTone: string;
|
|
45
|
-
coreCapabilities: string;
|
|
46
|
-
boundaries: string;
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Specialist gets more tools for complex operations
|
|
50
|
-
*/
|
|
51
|
-
protected getToolWhitelist(): string[];
|
|
52
|
-
/**
|
|
53
|
-
* Force compact output for schema tools (avoid verbose field dumps in discussions)
|
|
54
|
-
*/
|
|
55
|
-
protected preprocessToolInput(toolName: string, input: ToolInput): ToolInput;
|
|
56
|
-
/**
|
|
57
|
-
* Override to only process messages where we're @mentioned
|
|
58
|
-
*/
|
|
59
|
-
protected extractIncomingMessage(signal: HailerSignal): Promise<IncomingMessage | null>;
|
|
60
|
-
/**
|
|
61
|
-
* Check if this specialist is mentioned in the message
|
|
62
|
-
* Supports various mention formats:
|
|
63
|
-
* - @"Specialist Name"
|
|
64
|
-
* - @SpecialistName (no spaces)
|
|
65
|
-
* - Direct user tag [hailerTag|Name](userId)
|
|
66
|
-
*/
|
|
67
|
-
private isMentionedInMessage;
|
|
68
|
-
/**
|
|
69
|
-
* Override system prompt with specialist-specific prompt
|
|
70
|
-
*/
|
|
71
|
-
protected getSystemPrompt(): string;
|
|
72
|
-
/**
|
|
73
|
-
* Track response time for rate limiting
|
|
74
|
-
*/
|
|
75
|
-
protected postResponse(discussionId: string, content: string): Promise<void>;
|
|
76
|
-
/**
|
|
77
|
-
* Get specialist status
|
|
78
|
-
*/
|
|
79
|
-
getSpecialistStatus(): {
|
|
80
|
-
name: string;
|
|
81
|
-
expertise: string[];
|
|
82
|
-
conversationState: ReturnType<ChatAgentDaemon["getConversationState"]>;
|
|
83
|
-
lastResponseTime: number;
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
//# sourceMappingURL=specialist.d.ts.map
|
|
@@ -1,340 +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 base_1 = require("./base");
|
|
17
|
-
const logger_1 = require("../../lib/logger");
|
|
18
|
-
class SpecialistDaemon extends base_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
|
-
* Specialist gets more tools for complex operations
|
|
62
|
-
*/
|
|
63
|
-
getToolWhitelist() {
|
|
64
|
-
return [
|
|
65
|
-
// All orchestrator tools
|
|
66
|
-
"list_workflows",
|
|
67
|
-
"list_workflow_phases",
|
|
68
|
-
"get_workflow_schema",
|
|
69
|
-
"list_workflows_minimal",
|
|
70
|
-
"list_activities",
|
|
71
|
-
"show_activity_by_id",
|
|
72
|
-
"count_activities",
|
|
73
|
-
"create_activity",
|
|
74
|
-
"update_activity",
|
|
75
|
-
"join_discussion",
|
|
76
|
-
"add_discussion_message",
|
|
77
|
-
"invite_discussion_members",
|
|
78
|
-
"fetch_discussion_messages",
|
|
79
|
-
"get_activity_from_discussion",
|
|
80
|
-
"list_my_discussions",
|
|
81
|
-
"search_workspace_users",
|
|
82
|
-
// Insight tools
|
|
83
|
-
"list_insights",
|
|
84
|
-
"get_insight_data",
|
|
85
|
-
"preview_insight",
|
|
86
|
-
"create_insight",
|
|
87
|
-
"update_insight",
|
|
88
|
-
"remove_insight",
|
|
89
|
-
// Workflow config
|
|
90
|
-
"update_workflow_field",
|
|
91
|
-
"update_workflow_phase",
|
|
92
|
-
"install_workflow",
|
|
93
|
-
"remove_workflow",
|
|
94
|
-
// Template tools
|
|
95
|
-
"list_templates",
|
|
96
|
-
"get_template",
|
|
97
|
-
"create_template",
|
|
98
|
-
"install_template",
|
|
99
|
-
// Other
|
|
100
|
-
"upload_files",
|
|
101
|
-
"test_function_field",
|
|
102
|
-
];
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Force compact output for schema tools (avoid verbose field dumps in discussions)
|
|
106
|
-
*/
|
|
107
|
-
preprocessToolInput(toolName, input) {
|
|
108
|
-
if (toolName === "get_workflow_schema") {
|
|
109
|
-
return { ...input, compact: true };
|
|
110
|
-
}
|
|
111
|
-
return input;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Override to only process messages where we're @mentioned
|
|
115
|
-
*/
|
|
116
|
-
async extractIncomingMessage(signal) {
|
|
117
|
-
// Get base message extraction
|
|
118
|
-
const message = await super.extractIncomingMessage(signal);
|
|
119
|
-
if (!message)
|
|
120
|
-
return null;
|
|
121
|
-
// Specialists only respond when mentioned
|
|
122
|
-
if (!this.isMentionedInMessage(message)) {
|
|
123
|
-
this.specialistLogger.debug("Message doesn't mention specialist, ignoring", {
|
|
124
|
-
discussion: message.discussionId,
|
|
125
|
-
from: message.senderName,
|
|
126
|
-
});
|
|
127
|
-
return null;
|
|
128
|
-
}
|
|
129
|
-
// Rate limit responses
|
|
130
|
-
const now = Date.now();
|
|
131
|
-
if (now - this.lastResponseTime < this.minResponseGap) {
|
|
132
|
-
this.specialistLogger.debug("Rate limiting specialist response", {
|
|
133
|
-
timeSinceLastResponse: now - this.lastResponseTime,
|
|
134
|
-
});
|
|
135
|
-
return null;
|
|
136
|
-
}
|
|
137
|
-
// Mark as high priority since we're explicitly mentioned
|
|
138
|
-
message.priority = "high";
|
|
139
|
-
message.priorityReason = `Specialist ${this.specialist.name} was tagged`;
|
|
140
|
-
this.specialistLogger.info("Specialist mentioned, processing message", {
|
|
141
|
-
discussion: message.discussionId,
|
|
142
|
-
from: message.senderName,
|
|
143
|
-
preview: message.content.substring(0, 50),
|
|
144
|
-
});
|
|
145
|
-
return message;
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Check if this specialist is mentioned in the message
|
|
149
|
-
* Supports various mention formats:
|
|
150
|
-
* - @"Specialist Name"
|
|
151
|
-
* - @SpecialistName (no spaces)
|
|
152
|
-
* - Direct user tag [hailerTag|Name](userId)
|
|
153
|
-
*/
|
|
154
|
-
isMentionedInMessage(message) {
|
|
155
|
-
const content = message.content;
|
|
156
|
-
const name = this.specialist.name;
|
|
157
|
-
const userId = this.botClient.userId;
|
|
158
|
-
// Check for hailerTag mention (most reliable)
|
|
159
|
-
const hailerTagPattern = new RegExp(`\\[hailerTag\\|[^\\]]*\\]\\(${userId}\\)`, "i");
|
|
160
|
-
if (hailerTagPattern.test(content)) {
|
|
161
|
-
return true;
|
|
162
|
-
}
|
|
163
|
-
// Check for @"Name" mention
|
|
164
|
-
if (content.includes(`@"${name}"`)) {
|
|
165
|
-
return true;
|
|
166
|
-
}
|
|
167
|
-
// Check for @Name (no spaces version)
|
|
168
|
-
const nameNoSpaces = name.replace(/\s+/g, "");
|
|
169
|
-
if (content.includes(`@${nameNoSpaces}`)) {
|
|
170
|
-
return true;
|
|
171
|
-
}
|
|
172
|
-
// Check for @Name (first word)
|
|
173
|
-
const firstName = name.split(" ")[0];
|
|
174
|
-
if (content.includes(`@${firstName}`)) {
|
|
175
|
-
return true;
|
|
176
|
-
}
|
|
177
|
-
// Check message.isMention (set by parent class)
|
|
178
|
-
if (message.isMention) {
|
|
179
|
-
return true;
|
|
180
|
-
}
|
|
181
|
-
return false;
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Override system prompt with specialist-specific prompt
|
|
185
|
-
*/
|
|
186
|
-
getSystemPrompt() {
|
|
187
|
-
const now = new Date();
|
|
188
|
-
return `${this.specialist.systemPrompt}
|
|
189
|
-
|
|
190
|
-
<current_time>${now.toISOString()}</current_time>
|
|
191
|
-
|
|
192
|
-
<bot_info>
|
|
193
|
-
Bot ID: ${this.botClient.userId}
|
|
194
|
-
Name: ${this.specialist.name}
|
|
195
|
-
</bot_info>
|
|
196
|
-
|
|
197
|
-
<response_rules>
|
|
198
|
-
- You were invited to this discussion to help with a specific task
|
|
199
|
-
- Read HAL's handoff message to understand what's needed
|
|
200
|
-
- Use MCP tools to complete the task - NEVER fabricate data
|
|
201
|
-
- Respond with clear, structured results
|
|
202
|
-
- Include activity links using #activityId format
|
|
203
|
-
- Be concise and technical - data first, explanation second
|
|
204
|
-
</response_rules>
|
|
205
|
-
|
|
206
|
-
<tool_parameters>
|
|
207
|
-
<context_ids>
|
|
208
|
-
Extract IDs from the incoming tag and HAL's handoff:
|
|
209
|
-
- activityId attribute → show_activity_by_id, update_activity
|
|
210
|
-
- discussionId attribute → get_activity_from_discussion
|
|
211
|
-
- workflowId, fieldId → insight tools
|
|
212
|
-
</context_ids>
|
|
213
|
-
|
|
214
|
-
<never_do>
|
|
215
|
-
- Call tools with empty parameters {}
|
|
216
|
-
- Use field LABELS as fieldIds (fieldId must be 24-char hex)
|
|
217
|
-
- Guess IDs - always extract from context
|
|
218
|
-
</never_do>
|
|
219
|
-
|
|
220
|
-
<update_activity_formats>
|
|
221
|
-
- Single mode: use activityId parameter
|
|
222
|
-
- Bulk mode: use _id inside activities array (NOT activityId)
|
|
223
|
-
</update_activity_formats>
|
|
224
|
-
|
|
225
|
-
<field_values>
|
|
226
|
-
- numericunit: 78 (NOT {"type":"numericunit","value":78})
|
|
227
|
-
- activitylink: "abc123..." (NOT {"_id":"abc123","name":"..."})
|
|
228
|
-
</field_values>
|
|
229
|
-
</tool_parameters>
|
|
230
|
-
|
|
231
|
-
<insight_tools>
|
|
232
|
-
<critical>
|
|
233
|
-
- fieldId MUST be 24-character hex ID, NOT the field label!
|
|
234
|
-
- Field names must be SQL-safe: no spaces (use camelCase)
|
|
235
|
-
</critical>
|
|
236
|
-
|
|
237
|
-
<create_insight_format>
|
|
238
|
-
sources: [{
|
|
239
|
-
name: "tableAlias",
|
|
240
|
-
workflowId: "691ffdf84217e9e8434e56ad",
|
|
241
|
-
fields: [
|
|
242
|
-
{ name: "playerName", fieldId: "691ffdf84217e9e8434e56b1" },
|
|
243
|
-
{ name: "injuryType", fieldId: "691ffdf84217e9e8434e56b2" }
|
|
244
|
-
]
|
|
245
|
-
}]
|
|
246
|
-
</create_insight_format>
|
|
247
|
-
|
|
248
|
-
<hailer_sql_syntax>
|
|
249
|
-
Hailer insights: fields are mapped in sources.fields, then referenced by ALIAS in query.
|
|
250
|
-
|
|
251
|
-
HOW IT WORKS:
|
|
252
|
-
1. Define fields in sources: { name: "playerName", fieldId: "691fff..." }
|
|
253
|
-
2. Use the NAME (alias) in SQL: SELECT playerName FROM tableName
|
|
254
|
-
|
|
255
|
-
SELECT columns - use the field ALIAS names you defined:
|
|
256
|
-
- playerName, injuryType ← custom fields (by alias)
|
|
257
|
-
- name ← built-in activity name
|
|
258
|
-
|
|
259
|
-
Column aliases with spaces need quotes:
|
|
260
|
-
- playerName as "Player Name"
|
|
261
|
-
- injuryType as "Injury Type"
|
|
262
|
-
|
|
263
|
-
LIMITATIONS - DO NOT USE:
|
|
264
|
-
- Phase filtering (no _phase column)
|
|
265
|
-
- Date functions like NOW(), date('now'), CURRENT_DATE
|
|
266
|
-
- Complex WHERE clauses with dates
|
|
267
|
-
|
|
268
|
-
Keep queries SIMPLE: SELECT, FROM, basic WHERE (string comparisons), ORDER BY.
|
|
269
|
-
Users can filter via UI "Show Filters" button.
|
|
270
|
-
</hailer_sql_syntax>
|
|
271
|
-
|
|
272
|
-
<correct_query_example>
|
|
273
|
-
sources: [{
|
|
274
|
-
name: "injuries",
|
|
275
|
-
workflowId: "691ffdf84217e9e8434e56ad",
|
|
276
|
-
fields: [
|
|
277
|
-
{ name: "playerName", fieldId: "691ffdf84217e9e8434e5694" },
|
|
278
|
-
{ name: "injuryType", fieldId: "691ffdf84217e9e8434e5695" }
|
|
279
|
-
]
|
|
280
|
-
}]
|
|
281
|
-
|
|
282
|
-
query: "SELECT playerName as \\"Player\\", injuryType as \\"Injury Type\\" FROM injuries ORDER BY playerName ASC"
|
|
283
|
-
|
|
284
|
-
WRONG (will fail):
|
|
285
|
-
- WHERE expectedRecovery > date('now')
|
|
286
|
-
- WHERE _phase = 'phaseId'
|
|
287
|
-
- SELECT FIELD(fieldId) as column
|
|
288
|
-
</correct_query_example>
|
|
289
|
-
|
|
290
|
-
<where_to_get_ids>
|
|
291
|
-
HAL's handoff contains workflowId, fieldIds, and phaseIds. Use them exactly.
|
|
292
|
-
If not provided, call get_workflow_schema AND list_workflow_phases.
|
|
293
|
-
</where_to_get_ids>
|
|
294
|
-
</insight_tools>
|
|
295
|
-
|
|
296
|
-
<response_format>
|
|
297
|
-
When you complete a task, respond with:
|
|
298
|
-
<respond discussion="DISCUSSION_ID">
|
|
299
|
-
[Status emoji] [Brief summary]
|
|
300
|
-
|
|
301
|
-
**What I did:**
|
|
302
|
-
- Step 1: ...
|
|
303
|
-
- Step 2: ...
|
|
304
|
-
|
|
305
|
-
**Results:**
|
|
306
|
-
[Data, links, or confirmation]
|
|
307
|
-
|
|
308
|
-
**Next steps (if applicable):**
|
|
309
|
-
[Suggestions for follow-up]
|
|
310
|
-
</respond>
|
|
311
|
-
|
|
312
|
-
If you need clarification:
|
|
313
|
-
<respond discussion="DISCUSSION_ID">
|
|
314
|
-
I need more information to complete this task:
|
|
315
|
-
- Question 1?
|
|
316
|
-
- Question 2?
|
|
317
|
-
</respond>
|
|
318
|
-
</response_format>`;
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Track response time for rate limiting
|
|
322
|
-
*/
|
|
323
|
-
async postResponse(discussionId, content) {
|
|
324
|
-
await super.postResponse(discussionId, content);
|
|
325
|
-
this.lastResponseTime = Date.now();
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* Get specialist status
|
|
329
|
-
*/
|
|
330
|
-
getSpecialistStatus() {
|
|
331
|
-
return {
|
|
332
|
-
name: this.specialist.name,
|
|
333
|
-
expertise: this.specialist.expertise,
|
|
334
|
-
conversationState: this.getConversationState(),
|
|
335
|
-
lastResponseTime: this.lastResponseTime,
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
exports.SpecialistDaemon = SpecialistDaemon;
|
|
340
|
-
//# sourceMappingURL=specialist.js.map
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Bot Entry Point - Single workspace, single bot
|
|
4
|
-
*
|
|
5
|
-
* Uses API key authentication via UserContextCache (which resolves to email/password internally)
|
|
6
|
-
*/
|
|
7
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
-
if (k2 === undefined) k2 = k;
|
|
9
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
-
}
|
|
13
|
-
Object.defineProperty(o, k2, desc);
|
|
14
|
-
}) : (function(o, m, k, k2) {
|
|
15
|
-
if (k2 === undefined) k2 = k;
|
|
16
|
-
o[k2] = m[k];
|
|
17
|
-
}));
|
|
18
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
-
}) : function(o, v) {
|
|
21
|
-
o["default"] = v;
|
|
22
|
-
});
|
|
23
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
-
var ownKeys = function(o) {
|
|
25
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
-
var ar = [];
|
|
27
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
-
return ar;
|
|
29
|
-
};
|
|
30
|
-
return ownKeys(o);
|
|
31
|
-
};
|
|
32
|
-
return function (mod) {
|
|
33
|
-
if (mod && mod.__esModule) return mod;
|
|
34
|
-
var result = {};
|
|
35
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
-
__setModuleDefault(result, mod);
|
|
37
|
-
return result;
|
|
38
|
-
};
|
|
39
|
-
})();
|
|
40
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
const logger_1 = require("../lib/logger");
|
|
42
|
-
const workspaceId = process.env.BOT_WORKSPACE_ID || 'unknown';
|
|
43
|
-
const botId = process.env.BOT_ID || 'unknown';
|
|
44
|
-
const logger = (0, logger_1.createLogger)({ component: `bot-${workspaceId}-${botId}` });
|
|
45
|
-
async function main() {
|
|
46
|
-
const apiKey = process.env.BOT_API_KEY;
|
|
47
|
-
const workspaceName = process.env.BOT_WORKSPACE_NAME || workspaceId;
|
|
48
|
-
if (!apiKey) {
|
|
49
|
-
throw new Error('Missing BOT_API_KEY');
|
|
50
|
-
}
|
|
51
|
-
logger.info('Bot starting', { workspaceId, workspaceName, botId });
|
|
52
|
-
try {
|
|
53
|
-
// Dynamic import based on bot ID
|
|
54
|
-
if (botId === 'giuseppe') {
|
|
55
|
-
// Import UserContextCache and Bug Reports module
|
|
56
|
-
const { UserContextCache } = await Promise.resolve().then(() => __importStar(require('../mcp/UserContextCache')));
|
|
57
|
-
const { BugReportsModule } = await Promise.resolve().then(() => __importStar(require('../modules/bug-reports')));
|
|
58
|
-
// Get user context via API key (handles Hailer connection internally)
|
|
59
|
-
const userContext = await UserContextCache.getContext(apiKey);
|
|
60
|
-
logger.info('Connected to Hailer', { workspaceId });
|
|
61
|
-
// Start Giuseppe
|
|
62
|
-
const bugReports = new BugReportsModule(userContext);
|
|
63
|
-
await bugReports.start();
|
|
64
|
-
logger.info('Giuseppe bot started', { workspaceId });
|
|
65
|
-
// Notify parent
|
|
66
|
-
if (process.send) {
|
|
67
|
-
process.send({ type: 'ready' });
|
|
68
|
-
}
|
|
69
|
-
// Handle shutdown
|
|
70
|
-
process.on('message', async (msg) => {
|
|
71
|
-
if (msg.type === 'shutdown') {
|
|
72
|
-
logger.info('Shutting down');
|
|
73
|
-
await bugReports.stop();
|
|
74
|
-
process.exit(0);
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
else if (botId === 'vastuullisuus') {
|
|
79
|
-
// TODO: Implement Vastuullisuus bot
|
|
80
|
-
logger.info('Vastuullisuus bot not yet implemented');
|
|
81
|
-
if (process.send) {
|
|
82
|
-
process.send({ type: 'ready' });
|
|
83
|
-
}
|
|
84
|
-
process.on('message', async (msg) => {
|
|
85
|
-
if (msg.type === 'shutdown') {
|
|
86
|
-
process.exit(0);
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
throw new Error(`Unknown bot: ${botId}`);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
catch (error) {
|
|
95
|
-
logger.error('Bot failed', { error });
|
|
96
|
-
if (process.send) {
|
|
97
|
-
process.send({ type: 'error', error: error instanceof Error ? error.message : String(error) });
|
|
98
|
-
}
|
|
99
|
-
process.exit(1);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
main();
|
|
103
|
-
//# sourceMappingURL=bot-entrypoint.js.map
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Multi-Bot Client Manager
|
|
3
|
-
* Manages multiple bot clients, each with their own Hailer connection
|
|
4
|
-
*/
|
|
5
|
-
import { HailerClient } from "../mcp/hailer-clients";
|
|
6
|
-
import { SignalHandler } from "../mcp/signal-handler";
|
|
7
|
-
import { BotClientConfig } from "./types";
|
|
8
|
-
import { WorkspaceCache, UserInfo } from "../mcp/workspace-cache";
|
|
9
|
-
export interface BotClient {
|
|
10
|
-
userId: string;
|
|
11
|
-
firstName: string;
|
|
12
|
-
lastName: string;
|
|
13
|
-
config: BotClientConfig;
|
|
14
|
-
client: HailerClient;
|
|
15
|
-
signalHandler: SignalHandler;
|
|
16
|
-
workspaceCache?: WorkspaceCache;
|
|
17
|
-
}
|
|
18
|
-
export declare class MultiBotManager {
|
|
19
|
-
private botConfigs;
|
|
20
|
-
private botClients;
|
|
21
|
-
constructor(botConfigs: BotClientConfig[]);
|
|
22
|
-
initializeAllHailerClientsFromConfig(): Promise<void>;
|
|
23
|
-
getBotClient(userId: string): BotClient | undefined;
|
|
24
|
-
getAllBotClients(): BotClient[];
|
|
25
|
-
getBotIds(): string[];
|
|
26
|
-
private userNameCache;
|
|
27
|
-
private static USER_CACHE_TTL;
|
|
28
|
-
/**
|
|
29
|
-
* Look up a user's full name by their user ID
|
|
30
|
-
* Uses workspace cache first, then falls back to socket API call
|
|
31
|
-
*/
|
|
32
|
-
getUserName(userId: string): string | undefined;
|
|
33
|
-
/**
|
|
34
|
-
* Look up a user's full name by their user ID (async version)
|
|
35
|
-
* Falls back to socket API if not in cache
|
|
36
|
-
*/
|
|
37
|
-
getUserNameAsync(userId: string): Promise<string | undefined>;
|
|
38
|
-
/**
|
|
39
|
-
* Get user info by ID (returns full UserInfo object)
|
|
40
|
-
*/
|
|
41
|
-
getUserInfo(userId: string): UserInfo | undefined;
|
|
42
|
-
shutdown(): Promise<void>;
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=bot-manager.d.ts.map
|