@hailer/mcp 0.1.8 → 0.1.9

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 (135) hide show
  1. package/.claude/agents/agent-dmitri-activity-crud.md +3 -1
  2. package/.claude/agents/agent-giuseppe-app-builder.md +11 -12
  3. package/.claude/agents/agent-kenji-data-reader.md +5 -3
  4. package/.claude/skills/hailer-app-builder/SKILL.md +506 -0
  5. package/.claude/skills/publish-hailer-app/SKILL.md +169 -0
  6. package/.claude/skills/tool-parameter-usage/SKILL.md +112 -0
  7. package/CLAUDE.md +6 -2
  8. package/REFACTOR_STATUS.md +127 -0
  9. package/dist/cli.js +0 -0
  10. package/dist/client/agents/base.d.ts +202 -0
  11. package/dist/client/agents/base.js +737 -0
  12. package/dist/client/agents/definitions.d.ts +53 -0
  13. package/dist/client/agents/definitions.js +178 -0
  14. package/dist/client/agents/orchestrator.d.ts +119 -0
  15. package/dist/client/agents/orchestrator.js +760 -0
  16. package/dist/client/agents/specialist.d.ts +86 -0
  17. package/dist/client/agents/specialist.js +340 -0
  18. package/dist/client/bot-manager.d.ts +44 -0
  19. package/dist/client/bot-manager.js +173 -0
  20. package/dist/client/chat-agent-daemon.d.ts +464 -0
  21. package/dist/client/chat-agent-daemon.js +1774 -0
  22. package/dist/client/daemon-factory.d.ts +106 -0
  23. package/dist/client/daemon-factory.js +301 -0
  24. package/dist/client/factory.d.ts +107 -0
  25. package/dist/client/factory.js +304 -0
  26. package/dist/client/index.d.ts +17 -0
  27. package/dist/client/index.js +38 -0
  28. package/dist/client/multi-bot-manager.d.ts +18 -0
  29. package/dist/client/multi-bot-manager.js +88 -1
  30. package/dist/client/orchestrator-daemon.d.ts +87 -0
  31. package/dist/client/orchestrator-daemon.js +444 -0
  32. package/dist/client/services/agent-registry.d.ts +108 -0
  33. package/dist/client/services/agent-registry.js +630 -0
  34. package/dist/client/services/conversation-manager.d.ts +50 -0
  35. package/dist/client/services/conversation-manager.js +136 -0
  36. package/dist/client/services/mcp-client.d.ts +48 -0
  37. package/dist/client/services/mcp-client.js +105 -0
  38. package/dist/client/services/message-classifier.d.ts +37 -0
  39. package/dist/client/services/message-classifier.js +187 -0
  40. package/dist/client/services/message-formatter.d.ts +84 -0
  41. package/dist/client/services/message-formatter.js +353 -0
  42. package/dist/client/services/session-logger.d.ts +106 -0
  43. package/dist/client/services/session-logger.js +446 -0
  44. package/dist/client/services/tool-executor.d.ts +41 -0
  45. package/dist/client/services/tool-executor.js +169 -0
  46. package/dist/client/services/workspace-schema-cache.d.ts +149 -0
  47. package/dist/client/services/workspace-schema-cache.js +732 -0
  48. package/dist/client/specialist-daemon.d.ts +77 -0
  49. package/dist/client/specialist-daemon.js +197 -0
  50. package/dist/client/specialists.d.ts +53 -0
  51. package/dist/client/specialists.js +178 -0
  52. package/dist/client/tool-schema-loader.d.ts +4 -3
  53. package/dist/client/tool-schema-loader.js +54 -8
  54. package/dist/client/types.d.ts +283 -55
  55. package/dist/client/types.js +113 -2
  56. package/dist/config.d.ts +1 -1
  57. package/dist/config.js +1 -1
  58. package/dist/core.d.ts +10 -2
  59. package/dist/core.js +43 -27
  60. package/dist/lib/logger.js +15 -3
  61. package/dist/mcp/UserContextCache.js +2 -2
  62. package/dist/mcp/hailer-clients.js +5 -5
  63. package/dist/mcp/signal-handler.js +27 -5
  64. package/dist/mcp/tools/activity.js +137 -65
  65. package/dist/mcp/tools/app-core.js +4 -140
  66. package/dist/mcp/tools/app-marketplace.js +15 -260
  67. package/dist/mcp/tools/app-member.js +2 -73
  68. package/dist/mcp/tools/app-scaffold.js +146 -87
  69. package/dist/mcp/tools/discussion.js +348 -73
  70. package/dist/mcp/tools/insight.js +74 -190
  71. package/dist/mcp/tools/workflow.js +20 -94
  72. package/dist/mcp/utils/hailer-api-client.d.ts +4 -2
  73. package/dist/mcp/utils/hailer-api-client.js +24 -10
  74. package/dist/mcp-server.d.ts +4 -0
  75. package/dist/mcp-server.js +24 -4
  76. package/dist/routes/agents.d.ts +44 -0
  77. package/dist/routes/agents.js +311 -0
  78. package/dist/services/agent-credential-store.d.ts +73 -0
  79. package/dist/services/agent-credential-store.js +212 -0
  80. package/lineup-manager/dist/assets/index-8ce6041d.css +1 -0
  81. package/lineup-manager/dist/assets/index-e168f265.js +600 -0
  82. package/lineup-manager/dist/index.html +15 -0
  83. package/lineup-manager/dist/manifest.json +17 -0
  84. package/lineup-manager/dist/vite.svg +1 -0
  85. package/package.json +1 -1
  86. package/dist/client/adaptive-documentation-bot.d.ts +0 -106
  87. package/dist/client/adaptive-documentation-bot.js +0 -464
  88. package/dist/client/adaptive-documentation-types.d.ts +0 -66
  89. package/dist/client/adaptive-documentation-types.js +0 -9
  90. package/dist/client/agent-activity-bot.d.ts +0 -51
  91. package/dist/client/agent-activity-bot.js +0 -166
  92. package/dist/client/agent-tracker.d.ts +0 -499
  93. package/dist/client/agent-tracker.js +0 -659
  94. package/dist/client/description-updater.d.ts +0 -56
  95. package/dist/client/description-updater.js +0 -259
  96. package/dist/client/log-parser.d.ts +0 -72
  97. package/dist/client/log-parser.js +0 -387
  98. package/dist/client/mcp-assistant.d.ts +0 -21
  99. package/dist/client/mcp-assistant.js +0 -58
  100. package/dist/client/mcp-client.d.ts +0 -50
  101. package/dist/client/mcp-client.js +0 -538
  102. package/dist/client/message-processor.d.ts +0 -35
  103. package/dist/client/message-processor.js +0 -357
  104. package/dist/client/providers/anthropic-provider.d.ts +0 -19
  105. package/dist/client/providers/anthropic-provider.js +0 -645
  106. package/dist/client/providers/assistant-provider.d.ts +0 -17
  107. package/dist/client/providers/assistant-provider.js +0 -51
  108. package/dist/client/providers/llm-provider.d.ts +0 -47
  109. package/dist/client/providers/llm-provider.js +0 -367
  110. package/dist/client/providers/openai-provider.d.ts +0 -23
  111. package/dist/client/providers/openai-provider.js +0 -630
  112. package/dist/client/simple-llm-caller.d.ts +0 -19
  113. package/dist/client/simple-llm-caller.js +0 -100
  114. package/dist/client/skill-generator.d.ts +0 -81
  115. package/dist/client/skill-generator.js +0 -386
  116. package/dist/client/test-adaptive-bot.d.ts +0 -9
  117. package/dist/client/test-adaptive-bot.js +0 -82
  118. package/dist/client/token-pricing.d.ts +0 -38
  119. package/dist/client/token-pricing.js +0 -127
  120. package/dist/client/token-tracker.d.ts +0 -232
  121. package/dist/client/token-tracker.js +0 -457
  122. package/dist/client/token-usage-bot.d.ts +0 -53
  123. package/dist/client/token-usage-bot.js +0 -153
  124. package/dist/client/tool-executor.d.ts +0 -69
  125. package/dist/client/tool-executor.js +0 -159
  126. package/dist/lib/materialize.d.ts +0 -3
  127. package/dist/lib/materialize.js +0 -101
  128. package/dist/lib/normalizedName.d.ts +0 -7
  129. package/dist/lib/normalizedName.js +0 -48
  130. package/dist/lib/terminal-prompt.d.ts +0 -9
  131. package/dist/lib/terminal-prompt.js +0 -108
  132. package/dist/mcp/tools/skill.d.ts +0 -10
  133. package/dist/mcp/tools/skill.js +0 -279
  134. package/dist/mcp/tools/workflow-template.d.ts +0 -19
  135. package/dist/mcp/tools/workflow-template.js +0 -822
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Daemon Factory
3
+ *
4
+ * Creates and manages agent daemons in orchestrator mode:
5
+ * - One orchestrator (HAL) handles general conversation
6
+ * - Specialist daemons handle complex domain-specific tasks
7
+ */
8
+ import { ChatAgentDaemon } from "./chat-agent-daemon";
9
+ import { OrchestratorDaemon } from "./orchestrator-daemon";
10
+ import { SpecialistDaemon } from "./specialist-daemon";
11
+ import { MultiBotManager } from "./multi-bot-manager";
12
+ export interface DaemonManagerOptions {
13
+ mcpServerUrl: string;
14
+ anthropicApiKey: string;
15
+ model?: string;
16
+ /**
17
+ * Enable orchestrator mode (default: true)
18
+ * Set to false only for legacy compatibility
19
+ */
20
+ orchestratorMode?: boolean;
21
+ /**
22
+ * Email of the bot to use as orchestrator (defaults to first bot)
23
+ */
24
+ orchestratorEmail?: string;
25
+ /**
26
+ * Map of specialist key to bot email (e.g., { hailerExpert: "expert@bot.com" })
27
+ */
28
+ specialistEmails?: Record<string, string>;
29
+ }
30
+ /**
31
+ * Manages orchestrator + specialist daemons
32
+ */
33
+ export declare class DaemonManager {
34
+ private daemons;
35
+ private orchestrator;
36
+ private specialists;
37
+ private botManager;
38
+ private options;
39
+ constructor(botManager: MultiBotManager, options: DaemonManagerOptions);
40
+ /**
41
+ * Start all daemons (orchestrator + specialists)
42
+ */
43
+ startAll(): Promise<void>;
44
+ /**
45
+ * Orchestrator mode: one orchestrator (HAL) + specialist daemons
46
+ */
47
+ private startOrchestratorMode;
48
+ /**
49
+ * Stop all daemons
50
+ * Flushes session logs for each daemon before stopping
51
+ */
52
+ stopAll(): Promise<void>;
53
+ /**
54
+ * Get daemon for a specific bot
55
+ */
56
+ getDaemon(botId: string): ChatAgentDaemon | undefined;
57
+ /**
58
+ * Get status of all daemons
59
+ */
60
+ getStatus(): Array<{
61
+ botId: string;
62
+ state: any;
63
+ }>;
64
+ /**
65
+ * Log current status to console (for monitoring)
66
+ */
67
+ logStatus(): void;
68
+ /**
69
+ * Get orchestrator instance (only in orchestrator mode)
70
+ */
71
+ getOrchestrator(): OrchestratorDaemon | null;
72
+ /**
73
+ * Get specialist by key (only in orchestrator mode)
74
+ */
75
+ getSpecialist(key: string): SpecialistDaemon | undefined;
76
+ /**
77
+ * Check if running in orchestrator mode
78
+ */
79
+ isOrchestratorMode(): boolean;
80
+ /**
81
+ * Start periodic status logging
82
+ */
83
+ startStatusLogging(intervalMs?: number): NodeJS.Timeout;
84
+ }
85
+ export interface CreateDaemonManagerOptions {
86
+ /** Enable orchestrator mode */
87
+ orchestratorMode?: boolean;
88
+ /** Email of orchestrator bot (defaults to first) */
89
+ orchestratorEmail?: string;
90
+ /** Map specialist keys to bot emails */
91
+ specialistEmails?: Record<string, string>;
92
+ }
93
+ /**
94
+ * Create and start the daemon manager
95
+ * This is the main entry point for daemon mode
96
+ *
97
+ * @param options - Optional settings for orchestrator mode
98
+ */
99
+ export declare function createDaemonManager(options?: CreateDaemonManagerOptions): Promise<DaemonManager | null>;
100
+ /**
101
+ * Quick start function for testing
102
+ *
103
+ * @param orchestratorMode - Enable orchestrator mode (default: true)
104
+ */
105
+ export declare function startDaemonMode(orchestratorMode?: boolean): Promise<void>;
106
+ //# sourceMappingURL=daemon-factory.d.ts.map
@@ -0,0 +1,301 @@
1
+ "use strict";
2
+ /**
3
+ * Daemon Factory
4
+ *
5
+ * Creates and manages agent daemons in orchestrator mode:
6
+ * - One orchestrator (HAL) handles general conversation
7
+ * - Specialist daemons handle complex domain-specific tasks
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.DaemonManager = void 0;
11
+ exports.createDaemonManager = createDaemonManager;
12
+ exports.startDaemonMode = startDaemonMode;
13
+ const orchestrator_daemon_1 = require("./orchestrator-daemon");
14
+ const specialist_daemon_1 = require("./specialist-daemon");
15
+ const specialists_1 = require("./specialists");
16
+ const multi_bot_manager_1 = require("./multi-bot-manager");
17
+ const config_1 = require("../config");
18
+ const logger_1 = require("../lib/logger");
19
+ const logger = (0, logger_1.createLogger)({ component: "DaemonFactory" });
20
+ /**
21
+ * Manages orchestrator + specialist daemons
22
+ */
23
+ class DaemonManager {
24
+ daemons = new Map();
25
+ orchestrator = null;
26
+ specialists = new Map();
27
+ botManager;
28
+ options;
29
+ constructor(botManager, options) {
30
+ this.botManager = botManager;
31
+ this.options = options;
32
+ }
33
+ /**
34
+ * Start all daemons (orchestrator + specialists)
35
+ */
36
+ async startAll() {
37
+ await this.startOrchestratorMode();
38
+ }
39
+ /**
40
+ * Orchestrator mode: one orchestrator (HAL) + specialist daemons
41
+ */
42
+ async startOrchestratorMode() {
43
+ const botClients = this.botManager.getAllBotClients();
44
+ logger.info("Starting daemons in ORCHESTRATOR mode", {
45
+ botCount: botClients.length,
46
+ });
47
+ // Find orchestrator bot
48
+ let orchestratorClient;
49
+ const specialistClients = new Map();
50
+ for (const botClient of botClients) {
51
+ const email = botClient.config.email;
52
+ // Check if this is the orchestrator
53
+ if (this.options.orchestratorEmail === email ||
54
+ (!this.options.orchestratorEmail && !orchestratorClient)) {
55
+ orchestratorClient = botClient;
56
+ continue;
57
+ }
58
+ // Check if this matches a specialist
59
+ if (this.options.specialistEmails) {
60
+ for (const [specialistKey, specialistEmail] of Object.entries(this.options.specialistEmails)) {
61
+ if (email === specialistEmail) {
62
+ specialistClients.set(specialistKey, botClient);
63
+ break;
64
+ }
65
+ }
66
+ }
67
+ else {
68
+ // Auto-assign to first available specialist
69
+ for (const specialistKey of Object.keys(specialists_1.SPECIALISTS)) {
70
+ if (!specialistClients.has(specialistKey)) {
71
+ specialistClients.set(specialistKey, botClient);
72
+ break;
73
+ }
74
+ }
75
+ }
76
+ }
77
+ if (!orchestratorClient) {
78
+ throw new Error("No orchestrator bot found");
79
+ }
80
+ // Create specialist user ID map for orchestrator
81
+ const specialistUserIds = new Map();
82
+ for (const [key, client] of specialistClients) {
83
+ specialistUserIds.set(key, client.userId);
84
+ }
85
+ // Start orchestrator
86
+ const orchestratorConfig = {
87
+ botClient: orchestratorClient,
88
+ mcpServerUrl: this.options.mcpServerUrl,
89
+ anthropicApiKey: this.options.anthropicApiKey,
90
+ model: this.options.model,
91
+ specialistUserIds,
92
+ };
93
+ this.orchestrator = new orchestrator_daemon_1.OrchestratorDaemon(orchestratorConfig);
94
+ await this.orchestrator.initialize();
95
+ // Register specialist user IDs with orchestrator
96
+ for (const [key, userId] of specialistUserIds) {
97
+ this.orchestrator.registerSpecialistUserId(key, userId);
98
+ }
99
+ this.daemons.set(orchestratorClient.userId, this.orchestrator);
100
+ logger.info("Orchestrator started", {
101
+ botId: orchestratorClient.userId,
102
+ email: orchestratorClient.config.email,
103
+ specialistCount: specialistClients.size,
104
+ });
105
+ // Start specialist daemons
106
+ for (const [specialistKey, botClient] of specialistClients) {
107
+ const specialist = specialists_1.SPECIALISTS[specialistKey];
108
+ if (!specialist) {
109
+ logger.warn("Unknown specialist key", { key: specialistKey });
110
+ continue;
111
+ }
112
+ // Set the bot user ID on the specialist config
113
+ specialist.botUserId = botClient.userId;
114
+ const specialistConfig = {
115
+ botClient,
116
+ mcpServerUrl: this.options.mcpServerUrl,
117
+ anthropicApiKey: this.options.anthropicApiKey,
118
+ model: specialist.model || this.options.model,
119
+ specialist,
120
+ };
121
+ const specialistDaemon = new specialist_daemon_1.SpecialistDaemon(specialistConfig);
122
+ await specialistDaemon.initialize();
123
+ this.specialists.set(specialistKey, specialistDaemon);
124
+ this.daemons.set(botClient.userId, specialistDaemon);
125
+ logger.info("Specialist daemon started", {
126
+ key: specialistKey,
127
+ name: specialist.name,
128
+ botId: botClient.userId,
129
+ email: botClient.config.email,
130
+ });
131
+ }
132
+ logger.info("Orchestrator mode started", {
133
+ orchestratorId: orchestratorClient.userId,
134
+ specialistCount: this.specialists.size,
135
+ totalDaemons: this.daemons.size,
136
+ });
137
+ }
138
+ /**
139
+ * Stop all daemons
140
+ * Flushes session logs for each daemon before stopping
141
+ */
142
+ async stopAll() {
143
+ const stopPromises = Array.from(this.daemons.entries()).map(async ([botId, daemon]) => {
144
+ await daemon.stop();
145
+ logger.info("Daemon stopped", { botId });
146
+ });
147
+ await Promise.all(stopPromises);
148
+ this.daemons.clear();
149
+ }
150
+ /**
151
+ * Get daemon for a specific bot
152
+ */
153
+ getDaemon(botId) {
154
+ return this.daemons.get(botId);
155
+ }
156
+ /**
157
+ * Get status of all daemons
158
+ */
159
+ getStatus() {
160
+ return Array.from(this.daemons.entries()).map(([botId, daemon]) => ({
161
+ botId,
162
+ state: daemon.getConversationState(),
163
+ }));
164
+ }
165
+ /**
166
+ * Log current status to console (for monitoring)
167
+ */
168
+ logStatus() {
169
+ const status = this.getStatus();
170
+ if (this.options.orchestratorMode) {
171
+ logger.info("=== ORCHESTRATOR MODE STATUS ===");
172
+ // Log orchestrator
173
+ if (this.orchestrator) {
174
+ const orchStatus = this.orchestrator.getOrchestratorStatus();
175
+ logger.info("ORCHESTRATOR (HAL):", {
176
+ messages: orchStatus.conversationState.messageCount,
177
+ queue: orchStatus.conversationState.queueLength,
178
+ processing: orchStatus.conversationState.isProcessing,
179
+ specialists: orchStatus.specialists.filter(s => s.available).length,
180
+ });
181
+ }
182
+ // Log specialists
183
+ for (const [key, specialist] of this.specialists) {
184
+ const specStatus = specialist.getSpecialistStatus();
185
+ logger.info(`SPECIALIST [${key}] ${specStatus.name}:`, {
186
+ messages: specStatus.conversationState.messageCount,
187
+ queue: specStatus.conversationState.queueLength,
188
+ processing: specStatus.conversationState.isProcessing,
189
+ });
190
+ }
191
+ }
192
+ else {
193
+ logger.info("=== DAEMON STATUS ===");
194
+ for (const { botId, state } of status) {
195
+ logger.info(`Bot ${botId.substring(0, 8)}...`, {
196
+ messages: state.messageCount,
197
+ queue: state.queueLength,
198
+ processing: state.isProcessing,
199
+ });
200
+ if (state.lastMessages.length > 0) {
201
+ logger.info("Last messages:");
202
+ for (const msg of state.lastMessages) {
203
+ logger.info(` [${msg.role}] ${msg.preview}`);
204
+ }
205
+ }
206
+ }
207
+ }
208
+ logger.info("=====================");
209
+ }
210
+ /**
211
+ * Get orchestrator instance (only in orchestrator mode)
212
+ */
213
+ getOrchestrator() {
214
+ return this.orchestrator;
215
+ }
216
+ /**
217
+ * Get specialist by key (only in orchestrator mode)
218
+ */
219
+ getSpecialist(key) {
220
+ return this.specialists.get(key);
221
+ }
222
+ /**
223
+ * Check if running in orchestrator mode
224
+ */
225
+ isOrchestratorMode() {
226
+ return !!this.options.orchestratorMode;
227
+ }
228
+ /**
229
+ * Start periodic status logging
230
+ */
231
+ startStatusLogging(intervalMs = 30000) {
232
+ return setInterval(() => {
233
+ this.logStatus();
234
+ }, intervalMs);
235
+ }
236
+ }
237
+ exports.DaemonManager = DaemonManager;
238
+ /**
239
+ * Create and start the daemon manager
240
+ * This is the main entry point for daemon mode
241
+ *
242
+ * @param options - Optional settings for orchestrator mode
243
+ */
244
+ async function createDaemonManager(options) {
245
+ const appConfig = (0, config_1.createApplicationConfig)();
246
+ const mcpClientConfig = appConfig.mcpClient;
247
+ if (!mcpClientConfig) {
248
+ logger.error("MCP Client not configured - cannot start daemon mode");
249
+ return null;
250
+ }
251
+ // Find Anthropic API key from providers
252
+ const anthropicProvider = mcpClientConfig.providers.find(p => p.type === "anthropic");
253
+ if (!anthropicProvider) {
254
+ logger.error("Anthropic provider not configured - daemon mode requires Anthropic");
255
+ return null;
256
+ }
257
+ // Create bot manager
258
+ const botManager = new multi_bot_manager_1.MultiBotManager(mcpClientConfig.botConfigs);
259
+ await botManager.initializeAllHailerClientsFromConfig();
260
+ // Check environment for orchestrator mode (defaults to TRUE)
261
+ const orchestratorMode = options?.orchestratorMode ??
262
+ process.env.DAEMON_ORCHESTRATOR_MODE !== "false";
263
+ // Create daemon manager
264
+ const daemonManager = new DaemonManager(botManager, {
265
+ mcpServerUrl: mcpClientConfig.mcpServerUrl,
266
+ anthropicApiKey: anthropicProvider.apiKey,
267
+ model: anthropicProvider.model,
268
+ orchestratorMode,
269
+ orchestratorEmail: options?.orchestratorEmail,
270
+ specialistEmails: options?.specialistEmails,
271
+ });
272
+ // Start all daemons
273
+ await daemonManager.startAll();
274
+ return daemonManager;
275
+ }
276
+ /**
277
+ * Quick start function for testing
278
+ *
279
+ * @param orchestratorMode - Enable orchestrator mode (default: true)
280
+ */
281
+ async function startDaemonMode(orchestratorMode = true) {
282
+ logger.info("Starting Chat Agent Daemon Mode (ORCHESTRATOR)...");
283
+ const manager = await createDaemonManager({ orchestratorMode });
284
+ if (!manager) {
285
+ logger.error("Failed to create daemon manager");
286
+ process.exit(1);
287
+ }
288
+ // Handle shutdown - await async stopAll() to flush session logs
289
+ process.on("SIGINT", () => {
290
+ logger.info("Shutting down daemons...");
291
+ manager.stopAll().then(() => process.exit(0));
292
+ });
293
+ process.on("SIGTERM", () => {
294
+ logger.info("Shutting down daemons...");
295
+ manager.stopAll().then(() => process.exit(0));
296
+ });
297
+ logger.info("Chat Agent Daemon Mode (ORCHESTRATOR) running. Press Ctrl+C to stop.");
298
+ // Start periodic status logging
299
+ manager.startStatusLogging(60000);
300
+ }
301
+ //# sourceMappingURL=daemon-factory.js.map
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Daemon Factory
3
+ *
4
+ * Creates and manages agent daemons in orchestrator mode:
5
+ * - One orchestrator (HAL) handles general conversation
6
+ * - Specialist daemons handle complex domain-specific tasks
7
+ */
8
+ import { ChatAgentDaemon } from "./agents/base";
9
+ import { OrchestratorDaemon } from "./agents/orchestrator";
10
+ import { SpecialistDaemon } from "./agents/specialist";
11
+ import { MultiBotManager } from "./bot-manager";
12
+ import { ConversationState } from "./types";
13
+ export interface DaemonManagerOptions {
14
+ mcpServerUrl: string;
15
+ anthropicApiKey: string;
16
+ model?: string;
17
+ /**
18
+ * Enable orchestrator mode (default: true)
19
+ * Set to false only for legacy compatibility
20
+ */
21
+ orchestratorMode?: boolean;
22
+ /**
23
+ * Email of the bot to use as orchestrator (defaults to first bot)
24
+ */
25
+ orchestratorEmail?: string;
26
+ /**
27
+ * Map of specialist key to bot email (e.g., { hailerExpert: "expert@bot.com" })
28
+ */
29
+ specialistEmails?: Record<string, string>;
30
+ }
31
+ /**
32
+ * Manages orchestrator + specialist daemons
33
+ */
34
+ export declare class DaemonManager {
35
+ private daemons;
36
+ private orchestrator;
37
+ private specialists;
38
+ private botManager;
39
+ private options;
40
+ constructor(botManager: MultiBotManager, options: DaemonManagerOptions);
41
+ /**
42
+ * Start all daemons (orchestrator + specialists)
43
+ */
44
+ startAll(): Promise<void>;
45
+ /**
46
+ * Orchestrator mode: one orchestrator (HAL) + specialist daemons
47
+ */
48
+ private startOrchestratorMode;
49
+ /**
50
+ * Stop all daemons
51
+ * Flushes session logs for each daemon before stopping
52
+ */
53
+ stopAll(): Promise<void>;
54
+ /**
55
+ * Get daemon for a specific bot
56
+ */
57
+ getDaemon(botId: string): ChatAgentDaemon | undefined;
58
+ /**
59
+ * Get status of all daemons
60
+ */
61
+ getStatus(): Array<{
62
+ botId: string;
63
+ state: ConversationState;
64
+ }>;
65
+ /**
66
+ * Log current status to console (for monitoring)
67
+ */
68
+ logStatus(): void;
69
+ /**
70
+ * Get orchestrator instance (only in orchestrator mode)
71
+ */
72
+ getOrchestrator(): OrchestratorDaemon | null;
73
+ /**
74
+ * Get specialist by key (only in orchestrator mode)
75
+ */
76
+ getSpecialist(key: string): SpecialistDaemon | undefined;
77
+ /**
78
+ * Check if running in orchestrator mode
79
+ */
80
+ isOrchestratorMode(): boolean;
81
+ /**
82
+ * Start periodic status logging
83
+ */
84
+ startStatusLogging(intervalMs?: number): NodeJS.Timeout;
85
+ }
86
+ export interface CreateDaemonManagerOptions {
87
+ /** Enable orchestrator mode */
88
+ orchestratorMode?: boolean;
89
+ /** Email of orchestrator bot (defaults to first) */
90
+ orchestratorEmail?: string;
91
+ /** Map specialist keys to bot emails */
92
+ specialistEmails?: Record<string, string>;
93
+ }
94
+ /**
95
+ * Create and start the daemon manager
96
+ * This is the main entry point for daemon mode
97
+ *
98
+ * @param options - Optional settings for orchestrator mode
99
+ */
100
+ export declare function createDaemonManager(options?: CreateDaemonManagerOptions): Promise<DaemonManager | null>;
101
+ /**
102
+ * Quick start function for testing
103
+ *
104
+ * @param orchestratorMode - Enable orchestrator mode (default: true)
105
+ */
106
+ export declare function startDaemonMode(orchestratorMode?: boolean): Promise<void>;
107
+ //# sourceMappingURL=factory.d.ts.map