@hailer/mcp 1.1.2 → 1.1.3
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.
|
@@ -2,7 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SignalHandler = void 0;
|
|
4
4
|
const logger_1 = require("../lib/logger");
|
|
5
|
-
|
|
5
|
+
// Optional: bot-config only available in bot server mode, not MCP terminal
|
|
6
|
+
let reloadConfigFromHailer = null;
|
|
7
|
+
let setActiveWorkspace = null;
|
|
8
|
+
try {
|
|
9
|
+
const botConfig = require('../bot-config');
|
|
10
|
+
reloadConfigFromHailer = botConfig.reloadConfigFromHailer;
|
|
11
|
+
setActiveWorkspace = botConfig.setActiveWorkspace;
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
// Not available in MCP-only installs — safe to skip
|
|
15
|
+
}
|
|
6
16
|
const logger = (0, logger_1.createLogger)({ component: 'signal-handler' });
|
|
7
17
|
class SignalHandler {
|
|
8
18
|
client;
|
|
@@ -247,9 +257,11 @@ class SignalHandler {
|
|
|
247
257
|
if (hasAgentDirectory) {
|
|
248
258
|
logger.debug('Agent Directory workflow detected after cache refresh, triggering bot config reload');
|
|
249
259
|
// Async reload - don't await to avoid blocking signal handling
|
|
250
|
-
(
|
|
251
|
-
|
|
252
|
-
|
|
260
|
+
if (reloadConfigFromHailer) {
|
|
261
|
+
reloadConfigFromHailer().catch(err => {
|
|
262
|
+
logger.warn('Bot config reload failed after Agent Directory detection', { error: err });
|
|
263
|
+
});
|
|
264
|
+
}
|
|
253
265
|
}
|
|
254
266
|
}
|
|
255
267
|
if (init.users) {
|
|
@@ -301,11 +313,13 @@ class SignalHandler {
|
|
|
301
313
|
await this.client.socket.request('core.switch_ecosystem', [invite.cid]);
|
|
302
314
|
logger.info('Switched to workspace successfully', { workspaceId: invite.cid });
|
|
303
315
|
// Update active workspace for bot-config
|
|
304
|
-
(
|
|
316
|
+
if (setActiveWorkspace)
|
|
317
|
+
setActiveWorkspace(invite.cid);
|
|
305
318
|
// Trigger Agent Directory discovery and bot initialization
|
|
306
319
|
try {
|
|
307
320
|
logger.debug('Triggering bot config reload for new workspace');
|
|
308
|
-
|
|
321
|
+
if (reloadConfigFromHailer)
|
|
322
|
+
await reloadConfigFromHailer();
|
|
309
323
|
logger.debug('Bot config reload completed');
|
|
310
324
|
}
|
|
311
325
|
catch (reloadError) {
|
|
@@ -52,7 +52,14 @@ const path = __importStar(require("path"));
|
|
|
52
52
|
const crypto = __importStar(require("crypto"));
|
|
53
53
|
const logger_1 = require("../lib/logger");
|
|
54
54
|
const config_1 = require("../config");
|
|
55
|
-
|
|
55
|
+
// Optional: bot-config only available in bot server mode, not MCP terminal
|
|
56
|
+
let invalidateConfigCache = null;
|
|
57
|
+
try {
|
|
58
|
+
invalidateConfigCache = require('../bot-config').invalidateConfigCache;
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
// Not available in MCP-only installs — safe to skip
|
|
62
|
+
}
|
|
56
63
|
const logger = (0, logger_1.createLogger)({ component: 'webhook-handler' });
|
|
57
64
|
const BOT_CONFIG_DIR = '.bot-config';
|
|
58
65
|
const WEBHOOK_SECRET_FILE = 'webhook-secret.txt';
|
|
@@ -309,7 +316,8 @@ function handleBotConfigWebhook(payload) {
|
|
|
309
316
|
// Save config
|
|
310
317
|
saveWorkspaceConfig(config);
|
|
311
318
|
// Invalidate config cache so loadBotConfigs() reads fresh data
|
|
312
|
-
(
|
|
319
|
+
if (invalidateConfigCache)
|
|
320
|
+
invalidateConfigCache();
|
|
313
321
|
// Trigger callback for hot reload
|
|
314
322
|
if (botUpdateCallback) {
|
|
315
323
|
botUpdateCallback(workspaceId, botEntry, action);
|