@hailer/mcp 0.1.16 → 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/webhook-handler.d.ts +2 -2
- package/dist/mcp/webhook-handler.js +5 -3
- package/dist/mcp-server.d.ts +2 -2
- package/dist/mcp-server.js +167 -140
- 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
package/dist/client/server.js
DELETED
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Bot Control Server - API for AI Hub app
|
|
4
|
-
*
|
|
5
|
-
* Uses API key authentication (resolved to email/password internally via CLIENT_CONFIGS)
|
|
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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
41
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
42
|
-
};
|
|
43
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
-
exports.app = void 0;
|
|
45
|
-
const express_1 = __importDefault(require("express"));
|
|
46
|
-
const cors_1 = __importDefault(require("cors"));
|
|
47
|
-
const fs = __importStar(require("fs"));
|
|
48
|
-
const path = __importStar(require("path"));
|
|
49
|
-
const logger_1 = require("../lib/logger");
|
|
50
|
-
const bot_runner_1 = require("./bot-runner");
|
|
51
|
-
const types_1 = require("./types");
|
|
52
|
-
const logger = (0, logger_1.createLogger)({ component: 'bot-server' });
|
|
53
|
-
const app = (0, express_1.default)();
|
|
54
|
-
exports.app = app;
|
|
55
|
-
const runner = new bot_runner_1.BotRunner();
|
|
56
|
-
// State file
|
|
57
|
-
const STATE_FILE = path.join(__dirname, 'workspaces.json');
|
|
58
|
-
// Load/save state
|
|
59
|
-
function loadState() {
|
|
60
|
-
try {
|
|
61
|
-
if (fs.existsSync(STATE_FILE)) {
|
|
62
|
-
return JSON.parse(fs.readFileSync(STATE_FILE, 'utf-8'));
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
logger.warn('Failed to load state', { error });
|
|
67
|
-
}
|
|
68
|
-
return { workspaces: {} };
|
|
69
|
-
}
|
|
70
|
-
function saveState(state) {
|
|
71
|
-
fs.writeFileSync(STATE_FILE, JSON.stringify(state, null, 2));
|
|
72
|
-
}
|
|
73
|
-
let state = loadState();
|
|
74
|
-
// Middleware
|
|
75
|
-
app.use((0, cors_1.default)());
|
|
76
|
-
app.use(express_1.default.json());
|
|
77
|
-
// Request logging
|
|
78
|
-
app.use((req, res, next) => {
|
|
79
|
-
logger.info(`${req.method} ${req.path}`, { body: req.body });
|
|
80
|
-
next();
|
|
81
|
-
});
|
|
82
|
-
/**
|
|
83
|
-
* GET /bots - List available bots
|
|
84
|
-
*/
|
|
85
|
-
app.get('/bots', (req, res) => {
|
|
86
|
-
res.json({ bots: types_1.AVAILABLE_BOTS });
|
|
87
|
-
});
|
|
88
|
-
/**
|
|
89
|
-
* POST /workspaces/register - Register a new workspace
|
|
90
|
-
*/
|
|
91
|
-
app.post('/workspaces/register', (req, res) => {
|
|
92
|
-
const { id, name, apiKey } = req.body;
|
|
93
|
-
if (!id || !apiKey) {
|
|
94
|
-
return res.status(400).json({ error: 'Missing required fields: id, apiKey' });
|
|
95
|
-
}
|
|
96
|
-
const workspace = {
|
|
97
|
-
id,
|
|
98
|
-
name: name || id,
|
|
99
|
-
apiKey, // Single API key - email/password resolved internally via CLIENT_CONFIGS
|
|
100
|
-
enabledBots: [],
|
|
101
|
-
registeredAt: new Date().toISOString()
|
|
102
|
-
};
|
|
103
|
-
state.workspaces[id] = workspace;
|
|
104
|
-
saveState(state);
|
|
105
|
-
logger.info('Workspace registered', { id, name });
|
|
106
|
-
res.json({ success: true, workspace: { id, name } });
|
|
107
|
-
});
|
|
108
|
-
/**
|
|
109
|
-
* DELETE /workspaces/:id - Unregister a workspace
|
|
110
|
-
*/
|
|
111
|
-
app.delete('/workspaces/:id', async (req, res) => {
|
|
112
|
-
const { id } = req.params;
|
|
113
|
-
const workspace = state.workspaces[id];
|
|
114
|
-
if (!workspace) {
|
|
115
|
-
return res.status(404).json({ error: 'Workspace not found' });
|
|
116
|
-
}
|
|
117
|
-
// Stop all bots first
|
|
118
|
-
for (const botId of workspace.enabledBots) {
|
|
119
|
-
await runner.stopBot(id, botId);
|
|
120
|
-
}
|
|
121
|
-
delete state.workspaces[id];
|
|
122
|
-
saveState(state);
|
|
123
|
-
logger.info('Workspace unregistered', { id });
|
|
124
|
-
res.json({ success: true });
|
|
125
|
-
});
|
|
126
|
-
/**
|
|
127
|
-
* GET /workspaces/:id/status - Get workspace status
|
|
128
|
-
*/
|
|
129
|
-
app.get('/workspaces/:id/status', (req, res) => {
|
|
130
|
-
const { id } = req.params;
|
|
131
|
-
const workspace = state.workspaces[id];
|
|
132
|
-
if (!workspace) {
|
|
133
|
-
return res.status(404).json({ error: 'Workspace not found' });
|
|
134
|
-
}
|
|
135
|
-
const status = {
|
|
136
|
-
id: workspace.id,
|
|
137
|
-
name: workspace.name,
|
|
138
|
-
registered: true,
|
|
139
|
-
bots: types_1.AVAILABLE_BOTS.map(bot => ({
|
|
140
|
-
id: bot.id,
|
|
141
|
-
name: bot.name,
|
|
142
|
-
enabled: workspace.enabledBots.includes(bot.id),
|
|
143
|
-
running: runner.isRunning(id, bot.id)
|
|
144
|
-
}))
|
|
145
|
-
};
|
|
146
|
-
res.json(status);
|
|
147
|
-
});
|
|
148
|
-
/**
|
|
149
|
-
* POST /workspaces/:id/bots/:botId/enable - Enable and start a bot
|
|
150
|
-
*/
|
|
151
|
-
app.post('/workspaces/:id/bots/:botId/enable', async (req, res) => {
|
|
152
|
-
const { id, botId } = req.params;
|
|
153
|
-
const workspace = state.workspaces[id];
|
|
154
|
-
if (!workspace) {
|
|
155
|
-
return res.status(404).json({ error: 'Workspace not found' });
|
|
156
|
-
}
|
|
157
|
-
if (!types_1.AVAILABLE_BOTS.find(b => b.id === botId)) {
|
|
158
|
-
return res.status(404).json({ error: 'Bot not found' });
|
|
159
|
-
}
|
|
160
|
-
// Add to enabled list
|
|
161
|
-
if (!workspace.enabledBots.includes(botId)) {
|
|
162
|
-
workspace.enabledBots.push(botId);
|
|
163
|
-
saveState(state);
|
|
164
|
-
}
|
|
165
|
-
// Start the bot
|
|
166
|
-
const started = await runner.startBot(workspace, botId);
|
|
167
|
-
if (!started) {
|
|
168
|
-
return res.status(500).json({ error: 'Failed to start bot' });
|
|
169
|
-
}
|
|
170
|
-
logger.info('Bot enabled', { workspaceId: id, botId });
|
|
171
|
-
res.json({ success: true, running: true });
|
|
172
|
-
});
|
|
173
|
-
/**
|
|
174
|
-
* POST /workspaces/:id/bots/:botId/disable - Disable and stop a bot
|
|
175
|
-
*/
|
|
176
|
-
app.post('/workspaces/:id/bots/:botId/disable', async (req, res) => {
|
|
177
|
-
const { id, botId } = req.params;
|
|
178
|
-
const workspace = state.workspaces[id];
|
|
179
|
-
if (!workspace) {
|
|
180
|
-
return res.status(404).json({ error: 'Workspace not found' });
|
|
181
|
-
}
|
|
182
|
-
// Remove from enabled list
|
|
183
|
-
workspace.enabledBots = workspace.enabledBots.filter(b => b !== botId);
|
|
184
|
-
saveState(state);
|
|
185
|
-
// Stop the bot
|
|
186
|
-
await runner.stopBot(id, botId);
|
|
187
|
-
logger.info('Bot disabled', { workspaceId: id, botId });
|
|
188
|
-
res.json({ success: true, running: false });
|
|
189
|
-
});
|
|
190
|
-
/**
|
|
191
|
-
* POST /workspaces/:id/start-all - Start all enabled bots
|
|
192
|
-
*/
|
|
193
|
-
app.post('/workspaces/:id/start-all', async (req, res) => {
|
|
194
|
-
const { id } = req.params;
|
|
195
|
-
const workspace = state.workspaces[id];
|
|
196
|
-
if (!workspace) {
|
|
197
|
-
return res.status(404).json({ error: 'Workspace not found' });
|
|
198
|
-
}
|
|
199
|
-
const results = {};
|
|
200
|
-
for (const botId of workspace.enabledBots) {
|
|
201
|
-
results[botId] = await runner.startBot(workspace, botId);
|
|
202
|
-
}
|
|
203
|
-
res.json({ success: true, results });
|
|
204
|
-
});
|
|
205
|
-
/**
|
|
206
|
-
* GET /status - Overall server status
|
|
207
|
-
*/
|
|
208
|
-
app.get('/status', (req, res) => {
|
|
209
|
-
const workspaceCount = Object.keys(state.workspaces).length;
|
|
210
|
-
const runningBots = [];
|
|
211
|
-
for (const workspace of Object.values(state.workspaces)) {
|
|
212
|
-
for (const botId of workspace.enabledBots) {
|
|
213
|
-
if (runner.isRunning(workspace.id, botId)) {
|
|
214
|
-
runningBots.push({ workspace: workspace.id, bot: botId });
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
res.json({
|
|
219
|
-
status: 'running',
|
|
220
|
-
workspaces: workspaceCount,
|
|
221
|
-
runningBots: runningBots.length,
|
|
222
|
-
bots: runningBots
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
// Start server
|
|
226
|
-
const PORT = process.env.BOT_SERVER_PORT || 4000;
|
|
227
|
-
// Graceful shutdown
|
|
228
|
-
process.on('SIGINT', async () => {
|
|
229
|
-
logger.info('Shutting down...');
|
|
230
|
-
await runner.stopAll();
|
|
231
|
-
process.exit(0);
|
|
232
|
-
});
|
|
233
|
-
process.on('SIGTERM', async () => {
|
|
234
|
-
logger.info('Shutting down...');
|
|
235
|
-
await runner.stopAll();
|
|
236
|
-
process.exit(0);
|
|
237
|
-
});
|
|
238
|
-
// Auto-start enabled bots on server start
|
|
239
|
-
async function startEnabledBots() {
|
|
240
|
-
for (const workspace of Object.values(state.workspaces)) {
|
|
241
|
-
for (const botId of workspace.enabledBots) {
|
|
242
|
-
logger.info('Auto-starting bot', { workspaceId: workspace.id, botId });
|
|
243
|
-
await runner.startBot(workspace, botId);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
app.listen(PORT, async () => {
|
|
248
|
-
logger.info(`Bot Control Server running on port ${PORT}`);
|
|
249
|
-
await startEnabledBots();
|
|
250
|
-
});
|
|
251
|
-
//# sourceMappingURL=server.js.map
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent Registry Service
|
|
3
|
-
*
|
|
4
|
-
* Handles registration of agents in Hailer workspace workflows:
|
|
5
|
-
* - Agent Directory: Main registry of all bots
|
|
6
|
-
* - Positions: Job descriptions/roles
|
|
7
|
-
* - Teams: Groups of agents
|
|
8
|
-
* - Tool Registry: MCP server configurations
|
|
9
|
-
* - MCP Config: Per-agent MCP configuration
|
|
10
|
-
*
|
|
11
|
-
* WORKSPACE ISOLATION: Uses WorkspaceSchemaCacheService for dynamic ID lookup.
|
|
12
|
-
* Never relies on hardcoded IDs - each workspace has its own workflow IDs.
|
|
13
|
-
*/
|
|
14
|
-
import { Logger } from "../../lib/logger";
|
|
15
|
-
import { McpToolCallback, ToolDefinition } from "../types";
|
|
16
|
-
import { WorkspaceSchemaCacheService } from "./workspace-schema-cache";
|
|
17
|
-
export interface AgentInfo {
|
|
18
|
-
firstName: string;
|
|
19
|
-
lastName: string;
|
|
20
|
-
description: string;
|
|
21
|
-
email: string;
|
|
22
|
-
userId: string;
|
|
23
|
-
}
|
|
24
|
-
export interface PositionDetails {
|
|
25
|
-
name: string;
|
|
26
|
-
purpose: string;
|
|
27
|
-
personaTone: string;
|
|
28
|
-
coreCapabilities: string;
|
|
29
|
-
boundaries: string;
|
|
30
|
-
}
|
|
31
|
-
export declare class AgentRegistryService {
|
|
32
|
-
private schemaCache;
|
|
33
|
-
private logger;
|
|
34
|
-
private callMcpTool;
|
|
35
|
-
private getDefaultTeamId;
|
|
36
|
-
private agentDirectoryId;
|
|
37
|
-
private positionId;
|
|
38
|
-
private teamId;
|
|
39
|
-
private toolRegistryId;
|
|
40
|
-
private mcpConfigId;
|
|
41
|
-
private currentWorkspaceId;
|
|
42
|
-
constructor(schemaCache: WorkspaceSchemaCacheService, logger: Logger, callMcpTool: McpToolCallback, getDefaultTeamId: () => string | undefined);
|
|
43
|
-
/**
|
|
44
|
-
* Load registration data - always returns false to force fresh Hailer lookup
|
|
45
|
-
* Kept for API compatibility with base.ts
|
|
46
|
-
*/
|
|
47
|
-
loadFromCache(_userId: string, _workspaceId: string): Promise<boolean>;
|
|
48
|
-
/**
|
|
49
|
-
* Get agent directory ID
|
|
50
|
-
*/
|
|
51
|
-
getAgentDirectoryId(): string | null;
|
|
52
|
-
/**
|
|
53
|
-
* Get position ID
|
|
54
|
-
*/
|
|
55
|
-
getPositionId(): string | null;
|
|
56
|
-
/**
|
|
57
|
-
* Get team ID
|
|
58
|
-
*/
|
|
59
|
-
getTeamId(): string | null;
|
|
60
|
-
/**
|
|
61
|
-
* Register all agent data across all workflows
|
|
62
|
-
* Uses schemaCache for dynamic workflow ID lookup
|
|
63
|
-
*/
|
|
64
|
-
registerAllAgentData(agentInfo: AgentInfo, positionDetails: PositionDetails, mcpServerUrl: string, toolIndex: ToolDefinition[], workspaceId: string): Promise<void>;
|
|
65
|
-
/**
|
|
66
|
-
* Register this agent in the Agent Directory
|
|
67
|
-
* Uses dynamic schema lookup for workflow/field IDs
|
|
68
|
-
*/
|
|
69
|
-
private registerAgentInDirectory;
|
|
70
|
-
/**
|
|
71
|
-
* Find phase ID by trying multiple names (case insensitive, partial match)
|
|
72
|
-
*/
|
|
73
|
-
private findPhaseId;
|
|
74
|
-
/**
|
|
75
|
-
* Find existing agent entry by hailerProfile (userId) - most reliable method
|
|
76
|
-
*/
|
|
77
|
-
private findAgentByUserId;
|
|
78
|
-
/**
|
|
79
|
-
* Parse first activity from list_activities response
|
|
80
|
-
*/
|
|
81
|
-
private parseFirstActivity;
|
|
82
|
-
/**
|
|
83
|
-
* Register/find shared Team for AI agents
|
|
84
|
-
*/
|
|
85
|
-
private registerTeam;
|
|
86
|
-
/**
|
|
87
|
-
* Register MCP server in Tool Registry (per-agent)
|
|
88
|
-
*/
|
|
89
|
-
private registerToolRegistry;
|
|
90
|
-
/**
|
|
91
|
-
* Register Position for this agent
|
|
92
|
-
*/
|
|
93
|
-
private registerPosition;
|
|
94
|
-
/**
|
|
95
|
-
* Register MCP Config for this agent
|
|
96
|
-
*/
|
|
97
|
-
private registerMcpConfig;
|
|
98
|
-
/**
|
|
99
|
-
* Link Agent Directory entry to Position and Team
|
|
100
|
-
*/
|
|
101
|
-
private linkAgentToPositionAndTeam;
|
|
102
|
-
/**
|
|
103
|
-
* Extract activity ID from MCP tool response text
|
|
104
|
-
* Specifically looks for created activity IDs, not workflow IDs
|
|
105
|
-
*/
|
|
106
|
-
private extractActivityId;
|
|
107
|
-
}
|
|
108
|
-
//# sourceMappingURL=agent-registry.d.ts.map
|