@hailer/mcp 1.0.29 → 1.1.2
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/.claude/.session-checked +1 -0
- package/.claude/agents/agent-ada-skill-builder.md +10 -2
- package/.claude/agents/agent-alejandro-function-fields.md +104 -37
- package/.claude/agents/agent-bjorn-config-audit.md +41 -21
- package/.claude/agents/agent-builder-agent-creator.md +13 -3
- package/.claude/agents/agent-code-simplifier.md +53 -0
- package/.claude/agents/agent-dmitri-activity-crud.md +126 -11
- package/.claude/agents/agent-giuseppe-app-builder.md +212 -22
- package/.claude/agents/agent-gunther-mcp-tools.md +7 -36
- package/.claude/agents/agent-helga-workflow-config.md +75 -10
- package/.claude/agents/agent-igor-activity-mover-automation.md +125 -0
- package/.claude/agents/agent-ingrid-doc-templates.md +164 -36
- package/.claude/agents/agent-ivan-monolith.md +154 -0
- package/.claude/agents/agent-kenji-data-reader.md +15 -8
- package/.claude/agents/agent-lars-code-inspector.md +56 -8
- package/.claude/agents/agent-marco-mockup-builder.md +110 -0
- package/.claude/agents/agent-marcus-api-documenter.md +323 -0
- package/.claude/agents/agent-marketplace-publisher.md +232 -72
- package/.claude/agents/agent-marketplace-reviewer.md +255 -79
- package/.claude/agents/agent-permissions-handler.md +208 -0
- package/.claude/agents/agent-simple-writer.md +48 -0
- package/.claude/agents/agent-svetlana-code-review.md +127 -14
- package/.claude/agents/agent-tanya-test-runner.md +333 -0
- package/.claude/agents/agent-ui-designer.md +100 -0
- package/.claude/agents/agent-viktor-sql-insights.md +19 -6
- package/.claude/agents/agent-web-search.md +55 -0
- package/.claude/agents/agent-yevgeni-discussions.md +7 -1
- package/.claude/agents/agent-zara-zapier.md +159 -0
- package/.claude/commands/app-squad.md +135 -0
- package/.claude/commands/audit-squad.md +158 -0
- package/.claude/commands/autoplan.md +563 -0
- package/.claude/commands/cleanup-squad.md +98 -0
- package/.claude/commands/config-squad.md +106 -0
- package/.claude/commands/crud-squad.md +87 -0
- package/.claude/commands/data-squad.md +97 -0
- package/.claude/commands/debug-squad.md +303 -0
- package/.claude/commands/doc-squad.md +65 -0
- package/.claude/commands/handoff.md +137 -0
- package/.claude/commands/health.md +49 -0
- package/.claude/commands/help.md +2 -1
- package/.claude/commands/help:agents.md +96 -16
- package/.claude/commands/help:commands.md +55 -11
- package/.claude/commands/help:faq.md +16 -1
- package/.claude/commands/help:skills.md +93 -0
- package/.claude/commands/hotfix-squad.md +112 -0
- package/.claude/commands/integration-squad.md +82 -0
- package/.claude/commands/janitor-squad.md +167 -0
- package/.claude/commands/learn-auto.md +120 -0
- package/.claude/commands/learn.md +120 -0
- package/.claude/commands/mcp-list.md +27 -0
- package/.claude/commands/onboard-squad.md +140 -0
- package/.claude/commands/plan-workspace.md +732 -0
- package/.claude/commands/prd.md +131 -0
- package/.claude/commands/project-status.md +82 -0
- package/.claude/commands/publish.md +138 -0
- package/.claude/commands/recap.md +69 -0
- package/.claude/commands/restore.md +64 -0
- package/.claude/commands/review-squad.md +152 -0
- package/.claude/commands/save.md +24 -0
- package/.claude/commands/stats.md +19 -0
- package/.claude/commands/swarm.md +210 -0
- package/.claude/commands/tool-builder.md +3 -1
- package/.claude/commands/ws-pull.md +1 -1
- package/.claude/commands/yolo-off.md +17 -0
- package/.claude/commands/yolo.md +82 -0
- package/.claude/hooks/_shared-memory.cjs +305 -0
- package/.claude/hooks/_utils.cjs +134 -0
- package/.claude/hooks/agent-failure-detector.cjs +164 -79
- package/.claude/hooks/agent-usage-logger.cjs +204 -0
- package/.claude/hooks/app-edit-guard.cjs +20 -4
- package/.claude/hooks/auto-learn.cjs +316 -0
- package/.claude/hooks/bash-guard.cjs +282 -0
- package/.claude/hooks/builder-mode-manager.cjs +183 -54
- package/.claude/hooks/bulk-activity-guard.cjs +283 -0
- package/.claude/hooks/context-watchdog.cjs +292 -0
- package/.claude/hooks/delegation-reminder.cjs +478 -0
- package/.claude/hooks/design-system-lint.cjs +283 -0
- package/.claude/hooks/post-scaffold-hook.cjs +16 -3
- package/.claude/hooks/prompt-guard.cjs +366 -0
- package/.claude/hooks/publish-template-guard.cjs +16 -0
- package/.claude/hooks/session-start.cjs +35 -0
- package/.claude/hooks/shared-memory-writer.cjs +147 -0
- package/.claude/hooks/skill-injector.cjs +140 -0
- package/.claude/hooks/skill-usage-logger.cjs +258 -0
- package/.claude/hooks/src-edit-guard.cjs +16 -1
- package/.claude/hooks/sync-marketplace-agents.cjs +53 -8
- package/.claude/scripts/yolo-toggle.cjs +142 -0
- package/.claude/settings.json +141 -14
- package/.claude/skills/SDK-activity-patterns/SKILL.md +428 -0
- package/.claude/skills/SDK-document-templates/SKILL.md +1033 -0
- package/.claude/skills/SDK-function-fields/SKILL.md +542 -0
- package/.claude/skills/SDK-generate-skill/SKILL.md +92 -0
- package/.claude/skills/SDK-init-skill/SKILL.md +127 -0
- package/.claude/skills/SDK-insight-queries/SKILL.md +787 -0
- package/.claude/skills/SDK-ws-config-skill/SKILL.md +1139 -0
- package/.claude/skills/agent-structure/SKILL.md +98 -0
- package/.claude/skills/api-documentation-patterns/SKILL.md +474 -0
- package/.claude/skills/chrome-mcp-reference/SKILL.md +370 -0
- package/.claude/skills/delegation-routing/SKILL.md +202 -0
- package/.claude/skills/frontend-design/SKILL.md +254 -0
- package/.claude/skills/hailer-activity-mover/SKILL.md +213 -0
- package/.claude/skills/hailer-api-client/SKILL.md +518 -0
- package/.claude/skills/hailer-app-builder/SKILL.md +939 -11
- package/.claude/skills/hailer-apps-pictures/SKILL.md +269 -0
- package/.claude/skills/hailer-design-system/SKILL.md +235 -0
- package/.claude/skills/hailer-monolith-automations/SKILL.md +686 -0
- package/.claude/skills/hailer-permissions-system/SKILL.md +121 -0
- package/.claude/skills/hailer-project-protocol/SKILL.md +488 -0
- package/.claude/skills/hailer-rest-api/SKILL.md +61 -0
- package/.claude/skills/hailer-rest-api/hailer-activities.md +184 -0
- package/.claude/skills/hailer-rest-api/hailer-admin.md +473 -0
- package/.claude/skills/hailer-rest-api/hailer-calendar.md +256 -0
- package/.claude/skills/hailer-rest-api/hailer-feed.md +249 -0
- package/.claude/skills/hailer-rest-api/hailer-insights.md +195 -0
- package/.claude/skills/hailer-rest-api/hailer-messaging.md +276 -0
- package/.claude/skills/hailer-rest-api/hailer-workflows.md +283 -0
- package/.claude/skills/insight-join-patterns/SKILL.md +3 -0
- package/.claude/skills/integration-patterns/SKILL.md +421 -0
- package/.claude/skills/json-only-output/SKILL.md +52 -12
- package/.claude/skills/lsp-setup/SKILL.md +160 -0
- package/.claude/skills/mcp-direct-tools/SKILL.md +153 -0
- package/.claude/skills/optional-parameters/SKILL.md +32 -23
- package/.claude/skills/publish-hailer-app/SKILL.md +76 -12
- package/.claude/skills/testing-patterns/SKILL.md +630 -0
- package/.claude/skills/tool-builder/SKILL.md +250 -0
- package/.claude/skills/tool-parameter-usage/SKILL.md +59 -45
- package/.claude/skills/tool-response-verification/SKILL.md +82 -48
- package/.claude/skills/zapier-hailer-patterns/SKILL.md +581 -0
- package/.env.example +26 -7
- package/CLAUDE.md +290 -224
- package/dist/CLAUDE.md +370 -0
- package/dist/app.d.ts +1 -1
- package/dist/app.js +101 -101
- package/dist/bot/bot-config.d.ts +26 -0
- package/dist/bot/bot-config.js +135 -0
- package/dist/bot/bot-manager.d.ts +40 -0
- package/dist/bot/bot-manager.js +137 -0
- package/dist/bot/bot.d.ts +127 -0
- package/dist/bot/bot.js +1328 -0
- package/dist/bot/operation-logger.d.ts +28 -0
- package/dist/bot/operation-logger.js +132 -0
- package/dist/bot/services/conversation-manager.d.ts +60 -0
- package/dist/bot/services/conversation-manager.js +246 -0
- package/dist/bot/services/index.d.ts +9 -0
- package/dist/bot/services/index.js +18 -0
- package/dist/bot/services/message-classifier.d.ts +42 -0
- package/dist/bot/services/message-classifier.js +228 -0
- package/dist/bot/services/message-formatter.d.ts +88 -0
- package/dist/bot/services/message-formatter.js +411 -0
- package/dist/bot/services/session-logger.d.ts +162 -0
- package/dist/bot/services/session-logger.js +724 -0
- package/dist/bot/services/token-billing.d.ts +78 -0
- package/dist/bot/services/token-billing.js +233 -0
- package/dist/bot/services/types.d.ts +169 -0
- package/dist/bot/services/types.js +12 -0
- package/dist/bot/services/typing-indicator.d.ts +23 -0
- package/dist/bot/services/typing-indicator.js +60 -0
- package/dist/bot/services/workspace-schema-cache.d.ts +122 -0
- package/dist/bot/services/workspace-schema-cache.js +506 -0
- package/dist/bot/tool-executor.d.ts +28 -0
- package/dist/bot/tool-executor.js +48 -0
- package/dist/bot/workspace-overview.d.ts +12 -0
- package/dist/bot/workspace-overview.js +94 -0
- package/dist/cli.d.ts +1 -8
- package/dist/cli.js +1 -253
- package/dist/config.d.ts +96 -3
- package/dist/config.js +148 -37
- package/dist/core.d.ts +5 -0
- package/dist/core.js +61 -8
- package/dist/lib/discussion-lock.d.ts +42 -0
- package/dist/lib/discussion-lock.js +110 -0
- package/dist/lib/logger.d.ts +0 -1
- package/dist/lib/logger.js +39 -23
- package/dist/lib/request-logger.d.ts +77 -0
- package/dist/lib/request-logger.js +147 -0
- package/dist/mcp/UserContextCache.js +16 -13
- package/dist/mcp/hailer-clients.js +18 -17
- package/dist/mcp/signal-handler.js +29 -13
- package/dist/mcp/tool-registry.d.ts +4 -15
- package/dist/mcp/tool-registry.js +94 -32
- package/dist/mcp/tools/activity.js +28 -69
- package/dist/mcp/tools/app-core.js +9 -4
- package/dist/mcp/tools/app-marketplace.js +22 -12
- package/dist/mcp/tools/app-member.js +5 -2
- package/dist/mcp/tools/app-scaffold.js +32 -18
- 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/core.d.ts +253 -0
- package/dist/mcp/tools/bot-config/core.js +2456 -0
- 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/discussion.js +107 -77
- package/dist/mcp/tools/document.d.ts +11 -0
- package/dist/mcp/tools/document.js +741 -0
- package/dist/mcp/tools/file.js +5 -2
- package/dist/mcp/tools/insight.js +36 -12
- package/dist/mcp/tools/investigate.d.ts +9 -0
- package/dist/mcp/tools/investigate.js +254 -0
- package/dist/mcp/tools/user.d.ts +2 -4
- package/dist/mcp/tools/user.js +9 -50
- package/dist/mcp/tools/workflow.d.ts +1 -0
- package/dist/mcp/tools/workflow.js +164 -52
- package/dist/mcp/utils/hailer-api-client.js +26 -17
- package/dist/mcp/webhook-handler.d.ts +64 -3
- package/dist/mcp/webhook-handler.js +219 -9
- package/dist/mcp-server.d.ts +4 -0
- package/dist/mcp-server.js +237 -25
- package/dist/plugins/bug-fixer/index.d.ts +2 -0
- package/dist/plugins/bug-fixer/index.js +18 -0
- package/dist/plugins/bug-fixer/tools.d.ts +45 -0
- package/dist/plugins/bug-fixer/tools.js +1096 -0
- package/package.json +10 -10
- package/scripts/test-hal-tools.ts +154 -0
- package/.claude/agents/agent-nora-name-functions.md +0 -123
- package/.claude/assistant-knowledge.md +0 -23
- package/.claude/commands/install-plugin.md +0 -261
- package/.claude/commands/list-plugins.md +0 -42
- package/.claude/commands/marketplace-setup.md +0 -33
- package/.claude/commands/publish-plugin.md +0 -55
- package/.claude/commands/uninstall-plugin.md +0 -87
- package/.claude/hooks/interactive-mode.cjs +0 -87
- package/.claude/hooks/mcp-server-guard.cjs +0 -108
- package/.claude/skills/marketplace-publishing.md +0 -155
- package/dist/bot/chat-bot.d.ts +0 -31
- package/dist/bot/chat-bot.js +0 -357
- package/dist/mcp/tools/metrics.d.ts +0 -13
- package/dist/mcp/tools/metrics.js +0 -546
- package/dist/stdio-server.d.ts +0 -14
- package/dist/stdio-server.js +0 -114
package/dist/cli.d.ts
CHANGED
package/dist/cli.js
CHANGED
|
@@ -1,257 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
/**
|
|
4
|
-
* Hailer MCP CLI
|
|
5
|
-
*
|
|
6
|
-
* Commands:
|
|
7
|
-
* setup - Interactive setup for Claude Desktop
|
|
8
|
-
* (none) - Start MCP server (auto-detects stdio/http mode)
|
|
9
|
-
*/
|
|
10
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15
|
-
}
|
|
16
|
-
Object.defineProperty(o, k2, desc);
|
|
17
|
-
}) : (function(o, m, k, k2) {
|
|
18
|
-
if (k2 === undefined) k2 = k;
|
|
19
|
-
o[k2] = m[k];
|
|
20
|
-
}));
|
|
21
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
22
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
23
|
-
}) : function(o, v) {
|
|
24
|
-
o["default"] = v;
|
|
25
|
-
});
|
|
26
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
27
|
-
var ownKeys = function(o) {
|
|
28
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
29
|
-
var ar = [];
|
|
30
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
31
|
-
return ar;
|
|
32
|
-
};
|
|
33
|
-
return ownKeys(o);
|
|
34
|
-
};
|
|
35
|
-
return function (mod) {
|
|
36
|
-
if (mod && mod.__esModule) return mod;
|
|
37
|
-
var result = {};
|
|
38
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
39
|
-
__setModuleDefault(result, mod);
|
|
40
|
-
return result;
|
|
41
|
-
};
|
|
42
|
-
})();
|
|
43
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
-
|
|
45
|
-
const path = __importStar(require("path"));
|
|
46
|
-
const os = __importStar(require("os"));
|
|
47
|
-
const readline = __importStar(require("readline"));
|
|
48
|
-
const CLAUDE_CONFIG_DIR = path.join(os.homedir(), 'Library', 'Application Support', 'Claude');
|
|
49
|
-
const CLAUDE_CONFIG_FILE = path.join(CLAUDE_CONFIG_DIR, 'claude_desktop_config.json');
|
|
50
|
-
/**
|
|
51
|
-
* Muted output stream for password input
|
|
52
|
-
*/
|
|
53
|
-
class MutedStream {
|
|
54
|
-
writable = true;
|
|
55
|
-
muted = false;
|
|
56
|
-
write() { return true; }
|
|
57
|
-
end() { }
|
|
58
|
-
on() { return this; }
|
|
59
|
-
once() { return this; }
|
|
60
|
-
emit() { return true; }
|
|
61
|
-
removeListener() { return this; }
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Prompt user for input
|
|
65
|
-
*/
|
|
66
|
-
function prompt(question, isPassword = false) {
|
|
67
|
-
return new Promise((resolve) => {
|
|
68
|
-
if (isPassword) {
|
|
69
|
-
// Use muted stream to hide password - most reliable cross-terminal approach
|
|
70
|
-
const mutedOutput = new MutedStream();
|
|
71
|
-
const rl = readline.createInterface({
|
|
72
|
-
input: process.stdin,
|
|
73
|
-
output: mutedOutput,
|
|
74
|
-
terminal: true,
|
|
75
|
-
});
|
|
76
|
-
process.stdout.write(question);
|
|
77
|
-
rl.question('', (answer) => {
|
|
78
|
-
rl.close();
|
|
79
|
-
process.stdout.write('\n');
|
|
80
|
-
resolve(answer);
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
const rl = readline.createInterface({
|
|
85
|
-
input: process.stdin,
|
|
86
|
-
output: process.stdout,
|
|
87
|
-
});
|
|
88
|
-
rl.question(question, (answer) => {
|
|
89
|
-
rl.close();
|
|
90
|
-
resolve(answer.trim());
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Find Node.js executable path
|
|
97
|
-
*/
|
|
98
|
-
function findNodePath() {
|
|
99
|
-
// Use current Node.js path (the one running this script)
|
|
100
|
-
return process.execPath;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Find the hailer-mcp package location
|
|
104
|
-
*/
|
|
105
|
-
function findPackagePath() {
|
|
106
|
-
// When installed globally via npm, __dirname will be in the package
|
|
107
|
-
// When running from source, we're in src/
|
|
108
|
-
const distPath = path.resolve(__dirname, '..', 'dist', 'app.js');
|
|
109
|
-
const srcPath = path.resolve(__dirname, 'app.js');
|
|
110
|
-
if (fs.existsSync(distPath)) {
|
|
111
|
-
return distPath;
|
|
112
|
-
}
|
|
113
|
-
if (fs.existsSync(srcPath)) {
|
|
114
|
-
return srcPath;
|
|
115
|
-
}
|
|
116
|
-
// For global npm install, find in node_modules
|
|
117
|
-
try {
|
|
118
|
-
const globalPath = require.resolve('@hailer/mcp/dist/app.js');
|
|
119
|
-
return globalPath;
|
|
120
|
-
}
|
|
121
|
-
catch {
|
|
122
|
-
// Fallback to current directory
|
|
123
|
-
return path.resolve(process.cwd(), 'dist', 'app.js');
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Setup command - configure Claude Desktop
|
|
128
|
-
*/
|
|
129
|
-
async function runSetup() {
|
|
130
|
-
console.log('\n🔧 Hailer MCP Setup for Claude Desktop\n');
|
|
131
|
-
console.log('This will configure Claude Desktop to use Hailer MCP tools.\n');
|
|
132
|
-
// Check if macOS
|
|
133
|
-
if (process.platform !== 'darwin') {
|
|
134
|
-
console.log('⚠️ This setup is designed for macOS. For other platforms, please configure manually.');
|
|
135
|
-
console.log(' See: https://github.com/hailer/hailer-mcp#claude-desktop-setup\n');
|
|
136
|
-
}
|
|
137
|
-
// Get credentials
|
|
138
|
-
const email = await prompt('Hailer email: ');
|
|
139
|
-
if (!email) {
|
|
140
|
-
console.log('❌ Email is required');
|
|
141
|
-
process.exit(1);
|
|
142
|
-
}
|
|
143
|
-
const password = await prompt('Hailer password: ', true);
|
|
144
|
-
if (!password) {
|
|
145
|
-
console.log('❌ Password is required');
|
|
146
|
-
process.exit(1);
|
|
147
|
-
}
|
|
148
|
-
// Get API URL (optional)
|
|
149
|
-
const apiUrlInput = await prompt('Hailer API URL (press Enter for default https://api.hailer.com): ');
|
|
150
|
-
const apiUrl = apiUrlInput || 'https://api.hailer.com';
|
|
151
|
-
// Find paths
|
|
152
|
-
const nodePath = findNodePath();
|
|
153
|
-
const appPath = findPackagePath();
|
|
154
|
-
console.log('\n📍 Detected paths:');
|
|
155
|
-
console.log(` Node.js: ${nodePath}`);
|
|
156
|
-
console.log(` Hailer MCP: ${appPath}`);
|
|
157
|
-
// Check if app.js exists
|
|
158
|
-
if (!fs.existsSync(appPath)) {
|
|
159
|
-
console.log(`\n❌ Could not find app.js at ${appPath}`);
|
|
160
|
-
console.log(' Please run "npm run build" first if using from source.');
|
|
161
|
-
process.exit(1);
|
|
162
|
-
}
|
|
163
|
-
// Create config
|
|
164
|
-
const hailerConfig = {
|
|
165
|
-
command: nodePath,
|
|
166
|
-
args: [appPath],
|
|
167
|
-
env: {
|
|
168
|
-
MCP_CLIENT_API_KEY: 'claude-desktop',
|
|
169
|
-
HAILER_EMAIL: email,
|
|
170
|
-
HAILER_PASSWORD: password,
|
|
171
|
-
HAILER_API_URL: apiUrl,
|
|
172
|
-
},
|
|
173
|
-
};
|
|
174
|
-
// Read existing config or create new
|
|
175
|
-
let config = { mcpServers: {} };
|
|
176
|
-
if (fs.existsSync(CLAUDE_CONFIG_FILE)) {
|
|
177
|
-
try {
|
|
178
|
-
const existingContent = fs.readFileSync(CLAUDE_CONFIG_FILE, 'utf-8');
|
|
179
|
-
config = JSON.parse(existingContent);
|
|
180
|
-
if (!config.mcpServers) {
|
|
181
|
-
config.mcpServers = {};
|
|
182
|
-
}
|
|
183
|
-
console.log('\n📄 Found existing Claude Desktop config');
|
|
184
|
-
}
|
|
185
|
-
catch (error) {
|
|
186
|
-
console.log('\n⚠️ Could not parse existing config, creating new one');
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
// Check if hailer already configured
|
|
190
|
-
if (config.mcpServers.hailer) {
|
|
191
|
-
const overwrite = await prompt('\n⚠️ Hailer MCP is already configured. Overwrite? (y/N): ');
|
|
192
|
-
if (overwrite.toLowerCase() !== 'y') {
|
|
193
|
-
console.log('Setup cancelled.');
|
|
194
|
-
process.exit(0);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
// Add hailer config
|
|
198
|
-
config.mcpServers.hailer = hailerConfig;
|
|
199
|
-
// Ensure directory exists
|
|
200
|
-
if (!fs.existsSync(CLAUDE_CONFIG_DIR)) {
|
|
201
|
-
fs.mkdirSync(CLAUDE_CONFIG_DIR, { recursive: true });
|
|
202
|
-
console.log(`\n📁 Created directory: ${CLAUDE_CONFIG_DIR}`);
|
|
203
|
-
}
|
|
204
|
-
// Write config
|
|
205
|
-
fs.writeFileSync(CLAUDE_CONFIG_FILE, JSON.stringify(config, null, 2));
|
|
206
|
-
console.log('\n✅ Configuration saved!');
|
|
207
|
-
console.log(` File: ${CLAUDE_CONFIG_FILE}`);
|
|
208
|
-
console.log('\n🚀 Next steps:');
|
|
209
|
-
console.log(' 1. Quit Claude Desktop completely (Cmd+Q)');
|
|
210
|
-
console.log(' 2. Reopen Claude Desktop');
|
|
211
|
-
console.log(' 3. Look for "hailer" in the MCP tools list');
|
|
212
|
-
console.log('\n💡 Tip: Use a dedicated bot account, not your personal account.\n');
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* Main entry point
|
|
216
|
-
*/
|
|
217
|
-
async function main() {
|
|
218
|
-
const args = process.argv.slice(2);
|
|
219
|
-
const command = args[0];
|
|
220
|
-
switch (command) {
|
|
221
|
-
case 'setup':
|
|
222
|
-
await runSetup();
|
|
223
|
-
break;
|
|
224
|
-
case 'help':
|
|
225
|
-
case '--help':
|
|
226
|
-
case '-h':
|
|
227
|
-
console.log(`
|
|
228
|
-
Hailer MCP - Model Context Protocol server for Hailer
|
|
229
|
-
|
|
230
|
-
Usage:
|
|
231
|
-
hailer-mcp Start MCP server (auto-detects stdio/http mode)
|
|
232
|
-
hailer-mcp setup Interactive setup for Claude Desktop
|
|
233
|
-
hailer-mcp help Show this help message
|
|
234
|
-
|
|
235
|
-
Environment variables:
|
|
236
|
-
MCP_CLIENT_API_KEY Client identifier (required for stdio mode)
|
|
237
|
-
HAILER_EMAIL Hailer account email
|
|
238
|
-
HAILER_PASSWORD Hailer account password
|
|
239
|
-
HAILER_API_URL API URL (default: https://api.hailer.com)
|
|
240
|
-
MCP_TRANSPORT Force transport: 'stdio' or 'http'
|
|
241
|
-
ENABLE_NUCLEAR_TOOLS Enable destructive operations (default: false)
|
|
242
|
-
|
|
243
|
-
For more information, see:
|
|
244
|
-
https://github.com/hailer/hailer-mcp
|
|
245
|
-
`);
|
|
246
|
-
break;
|
|
247
|
-
default:
|
|
248
|
-
// Start the server (default behavior)
|
|
249
|
-
await Promise.resolve().then(() => __importStar(require('./app')));
|
|
250
|
-
break;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
main().catch((error) => {
|
|
254
|
-
console.error('Error:', error.message);
|
|
255
|
-
process.exit(1);
|
|
256
|
-
});
|
|
4
|
+
require("./app");
|
|
257
5
|
//# sourceMappingURL=cli.js.map
|
package/dist/config.d.ts
CHANGED
|
@@ -14,13 +14,15 @@
|
|
|
14
14
|
* - Development defaults for seamless local setup
|
|
15
15
|
*/
|
|
16
16
|
import { ToolGroup } from './mcp/tool-registry';
|
|
17
|
+
export declare const APP_VERSION: string;
|
|
17
18
|
/**
|
|
18
19
|
* Validated environment - single source of truth
|
|
19
20
|
*/
|
|
20
21
|
export declare const environment: {
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
NODE_ENV: "development" | "production" | "test";
|
|
23
|
+
LOG_LEVEL: "debug" | "info" | "warn" | "error";
|
|
23
24
|
DISABLE_MCP_SERVER: boolean;
|
|
25
|
+
MCP_CLIENT_ENABLED: boolean;
|
|
24
26
|
ENABLE_NUCLEAR_TOOLS: boolean;
|
|
25
27
|
PORT: number;
|
|
26
28
|
CORS_ORIGINS: string[];
|
|
@@ -29,8 +31,32 @@ export declare const environment: {
|
|
|
29
31
|
password: string;
|
|
30
32
|
apiBaseUrl: string;
|
|
31
33
|
}>;
|
|
34
|
+
MCP_SERVER_URL: string;
|
|
35
|
+
MCP_CLIENT_API_KEY: string;
|
|
36
|
+
MCP_CLIENT_AGENT_IDS: string[];
|
|
37
|
+
TOKEN_USAGE_BOT_ENABLED: boolean;
|
|
38
|
+
AGENT_ACTIVITY_BOT_ENABLED: boolean;
|
|
39
|
+
CHAT_BOT_MODE: "full" | "minimal" | "assistant";
|
|
40
|
+
ADAPTIVE_DOCUMENTATION_BOT_ENABLED: boolean;
|
|
41
|
+
ADAPTIVE_AUTO_UPDATE: boolean;
|
|
42
|
+
ADAPTIVE_UPDATE_INTERVAL: number;
|
|
43
|
+
ADAPTIVE_MIN_ERROR_COUNT: number;
|
|
44
|
+
ADAPTIVE_SKILL_GENERATION: boolean;
|
|
45
|
+
BOT_API_BASE_URL: string;
|
|
46
|
+
MCP_EXCLUDE_TRANSLATIONS: boolean;
|
|
47
|
+
MCP_COMPACT_DATA: boolean;
|
|
48
|
+
MCP_INCLUDE_WORKSPACE_NAMES: boolean;
|
|
49
|
+
CONTEXT_SAFETY_MARGIN_PERCENT: number;
|
|
50
|
+
CONTEXT_ENABLE_AUTO_SUMMARIZATION: boolean;
|
|
51
|
+
CONTEXT_MAX_SUMMARIZATION_CHUNKS: number;
|
|
52
|
+
TOKEN_BILLING_ENABLED: boolean;
|
|
32
53
|
WORKSPACE_CONFIG_PATH?: string | undefined;
|
|
33
54
|
DEV_APPS_PATH?: string | undefined;
|
|
55
|
+
DEV_APPS_PATHS?: string | undefined;
|
|
56
|
+
OPENAI_API_KEY?: string | undefined;
|
|
57
|
+
OPENAI_API_BASE?: string | undefined;
|
|
58
|
+
OPENAI_MODEL?: string | undefined;
|
|
59
|
+
ANTHROPIC_API_KEY?: string | undefined;
|
|
34
60
|
};
|
|
35
61
|
/**
|
|
36
62
|
* Mask sensitive data for safe logging
|
|
@@ -49,12 +75,21 @@ export interface HailerAccount {
|
|
|
49
75
|
allowedTools?: string[];
|
|
50
76
|
allowedGroups?: ToolGroup[];
|
|
51
77
|
}
|
|
78
|
+
export interface LlmProvider {
|
|
79
|
+
name: string;
|
|
80
|
+
type: 'openai' | 'anthropic' | 'assistant';
|
|
81
|
+
apiKey: string;
|
|
82
|
+
baseURL?: string;
|
|
83
|
+
model: string;
|
|
84
|
+
enabled: boolean;
|
|
85
|
+
}
|
|
52
86
|
export interface ServerConfig {
|
|
53
87
|
port: number;
|
|
54
88
|
corsOrigins: string[];
|
|
55
89
|
enableMcpServer: boolean;
|
|
90
|
+
enableClient: boolean;
|
|
56
91
|
}
|
|
57
|
-
/** MCP context optimization settings */
|
|
92
|
+
/** MCP context optimization settings (replaces mcp-config.ts exports) */
|
|
58
93
|
export interface McpConfig {
|
|
59
94
|
excludeTranslations: boolean;
|
|
60
95
|
excludeSystemMessages: boolean;
|
|
@@ -62,6 +97,31 @@ export interface McpConfig {
|
|
|
62
97
|
compactUserData: boolean;
|
|
63
98
|
includeWorkspaceNamesInTools: boolean;
|
|
64
99
|
}
|
|
100
|
+
/** Context management configuration */
|
|
101
|
+
export interface ContextConfig {
|
|
102
|
+
safetyMarginPercent: number;
|
|
103
|
+
enableAutoSummarization: boolean;
|
|
104
|
+
maxSummarizationChunks: number;
|
|
105
|
+
}
|
|
106
|
+
/** MCP Client configuration (replaces client/config.ts exports) */
|
|
107
|
+
export interface McpClientConfig {
|
|
108
|
+
enabled: boolean;
|
|
109
|
+
mcpServerUrl: string;
|
|
110
|
+
mcpServerApiKey: string;
|
|
111
|
+
providers: LlmProvider[];
|
|
112
|
+
mcpAgentIds: string[];
|
|
113
|
+
botConfigs: BotClientConfig[];
|
|
114
|
+
enableDirectMessages: boolean;
|
|
115
|
+
tokenUsageBotEnabled: boolean;
|
|
116
|
+
agentActivityBotEnabled: boolean;
|
|
117
|
+
}
|
|
118
|
+
/** Bot client configuration for MultiBotManager compatibility */
|
|
119
|
+
export interface BotClientConfig {
|
|
120
|
+
email: string;
|
|
121
|
+
password: string;
|
|
122
|
+
apiBaseUrl: string;
|
|
123
|
+
mcpServerApiKey: string;
|
|
124
|
+
}
|
|
65
125
|
/**
|
|
66
126
|
* Universal Application Configuration
|
|
67
127
|
*
|
|
@@ -75,10 +135,39 @@ export declare class ApplicationConfig {
|
|
|
75
135
|
* Efficient Map-based Hailer accounts (replaces CLIENT_CONFIGS array)
|
|
76
136
|
*/
|
|
77
137
|
get hailerAccounts(): Record<string, HailerAccount>;
|
|
138
|
+
get llmProviders(): LlmProvider[];
|
|
78
139
|
/**
|
|
79
140
|
* MCP context optimization settings
|
|
80
141
|
*/
|
|
81
142
|
get mcpConfig(): McpConfig;
|
|
143
|
+
/**
|
|
144
|
+
* Context management settings for token limits and summarization
|
|
145
|
+
*/
|
|
146
|
+
get contextConfig(): ContextConfig;
|
|
147
|
+
/**
|
|
148
|
+
* Adaptive Documentation Bot configuration
|
|
149
|
+
*/
|
|
150
|
+
get adaptiveDocumentation(): {
|
|
151
|
+
enabled: boolean;
|
|
152
|
+
autoUpdate: boolean;
|
|
153
|
+
updateInterval: number;
|
|
154
|
+
minErrorCount: number;
|
|
155
|
+
skillGeneration: boolean;
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* Token billing configuration for real-time usage billing per workspace
|
|
159
|
+
*/
|
|
160
|
+
get tokenBilling(): {
|
|
161
|
+
enabled: boolean;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Bot API base URL for daemon/bot connections
|
|
165
|
+
*/
|
|
166
|
+
get botApiBaseUrl(): string;
|
|
167
|
+
/**
|
|
168
|
+
* Create MCP Client configuration (replaces createMcpClientConfig())
|
|
169
|
+
*/
|
|
170
|
+
get mcpClient(): McpClientConfig | null;
|
|
82
171
|
/**
|
|
83
172
|
* Find account by API key - O(1) lookup (replaces getClientConfig())
|
|
84
173
|
* This is the key efficiency improvement that eliminates array filtering
|
|
@@ -88,6 +177,10 @@ export declare class ApplicationConfig {
|
|
|
88
177
|
* Alternative method with null return (safer)
|
|
89
178
|
*/
|
|
90
179
|
findAccountByApiKey(apiKey: string): HailerAccount | null;
|
|
180
|
+
/**
|
|
181
|
+
* Get enabled LLM providers only
|
|
182
|
+
*/
|
|
183
|
+
getEnabledLlmProviders(): LlmProvider[];
|
|
91
184
|
}
|
|
92
185
|
/**
|
|
93
186
|
* Create application configuration
|
package/dist/config.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* - Development defaults for seamless local setup
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.ApplicationConfig = exports.environment = void 0;
|
|
18
|
+
exports.ApplicationConfig = exports.environment = exports.APP_VERSION = void 0;
|
|
19
19
|
exports.maskSensitiveData = maskSensitiveData;
|
|
20
20
|
exports.maskEmail = maskEmail;
|
|
21
21
|
exports.createApplicationConfig = createApplicationConfig;
|
|
@@ -23,6 +23,9 @@ const zod_1 = require("zod");
|
|
|
23
23
|
const dotenv_1 = require("dotenv");
|
|
24
24
|
// Load environment variables
|
|
25
25
|
(0, dotenv_1.config)({ path: '.env.local' });
|
|
26
|
+
// Package version - read dynamically to avoid hardcoding
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
28
|
+
exports.APP_VERSION = require('../package.json').version;
|
|
26
29
|
// ================================================================================
|
|
27
30
|
// ENVIRONMENT VALIDATION
|
|
28
31
|
// ================================================================================
|
|
@@ -34,44 +37,15 @@ const hailerAccountSchema = zod_1.z.object({
|
|
|
34
37
|
password: zod_1.z.string().min(1),
|
|
35
38
|
apiBaseUrl: zod_1.z.string().url().default('https://api.hailer.com'),
|
|
36
39
|
});
|
|
37
|
-
/**
|
|
38
|
-
* Build CLIENT_CONFIGS from individual environment variables
|
|
39
|
-
* Supports Claude Desktop configuration style:
|
|
40
|
-
* MCP_CLIENT_API_KEY + HAILER_EMAIL + HAILER_PASSWORD + HAILER_API_URL
|
|
41
|
-
*/
|
|
42
|
-
function buildConfigFromIndividualEnvVars() {
|
|
43
|
-
const apiKey = process.env.MCP_CLIENT_API_KEY;
|
|
44
|
-
const email = process.env.HAILER_EMAIL;
|
|
45
|
-
const password = process.env.HAILER_PASSWORD;
|
|
46
|
-
const apiUrl = process.env.HAILER_API_URL || 'https://api.hailer.com';
|
|
47
|
-
if (apiKey && email && password) {
|
|
48
|
-
return {
|
|
49
|
-
[apiKey]: {
|
|
50
|
-
email,
|
|
51
|
-
password,
|
|
52
|
-
apiBaseUrl: apiUrl,
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
40
|
/**
|
|
59
41
|
* Transform CLIENT_CONFIGS to efficient Map format
|
|
60
|
-
* Supports
|
|
61
|
-
*
|
|
62
|
-
* 2. JSON object format: { "api-key": { email, password, apiBaseUrl } }
|
|
63
|
-
* 3. Legacy array format: [{ email, password, mcpServerApiKey, apiBaseUrl }]
|
|
42
|
+
* Supports both legacy array and new object formats
|
|
43
|
+
* Optional with default empty object for hot-reload support
|
|
64
44
|
*/
|
|
65
45
|
const clientConfigsSchema = zod_1.z.string()
|
|
66
46
|
.optional()
|
|
67
47
|
.default('{}')
|
|
68
48
|
.transform((value, ctx) => {
|
|
69
|
-
// First, try to build from individual env vars (Claude Desktop style)
|
|
70
|
-
const fromIndividualVars = buildConfigFromIndividualEnvVars();
|
|
71
|
-
if (fromIndividualVars) {
|
|
72
|
-
return fromIndividualVars;
|
|
73
|
-
}
|
|
74
|
-
// Otherwise, parse CLIENT_CONFIGS JSON
|
|
75
49
|
try {
|
|
76
50
|
const parsed = JSON.parse(value);
|
|
77
51
|
// Convert legacy array format: [{ email, password, mcpServerApiKey, apiBaseUrl }]
|
|
@@ -123,6 +97,7 @@ const environmentSchema = zod_1.z.object({
|
|
|
123
97
|
LOG_LEVEL: zod_1.z.enum(['debug', 'info', 'warn', 'error']).default('info'),
|
|
124
98
|
// Service control
|
|
125
99
|
DISABLE_MCP_SERVER: zod_1.z.string().transform(v => v === 'true').default('false'),
|
|
100
|
+
MCP_CLIENT_ENABLED: zod_1.z.string().transform(v => v === 'true').default('false'),
|
|
126
101
|
ENABLE_NUCLEAR_TOOLS: zod_1.z.string().transform(v => v === 'true').default('false'),
|
|
127
102
|
// Server
|
|
128
103
|
PORT: zod_1.z.string().transform(v => parseInt(v) || 3030).default('3030'),
|
|
@@ -133,6 +108,40 @@ const environmentSchema = zod_1.z.object({
|
|
|
133
108
|
WORKSPACE_CONFIG_PATH: zod_1.z.string().optional(),
|
|
134
109
|
// Development apps path (for scaffolding Hailer apps outside the repo)
|
|
135
110
|
DEV_APPS_PATH: zod_1.z.string().optional(),
|
|
111
|
+
// Multiple app directories for Bug Fixer - comma-separated paths
|
|
112
|
+
// Example: DEV_APPS_PATHS=/path/to/apps,/path/to/other/apps
|
|
113
|
+
DEV_APPS_PATHS: zod_1.z.string().optional(),
|
|
114
|
+
// LLM providers
|
|
115
|
+
OPENAI_API_KEY: zod_1.z.string().min(1).optional(),
|
|
116
|
+
OPENAI_API_BASE: zod_1.z.string().url().optional(),
|
|
117
|
+
OPENAI_MODEL: zod_1.z.string().optional(),
|
|
118
|
+
ANTHROPIC_API_KEY: zod_1.z.string().min(1).optional(),
|
|
119
|
+
// MCP client settings
|
|
120
|
+
MCP_SERVER_URL: zod_1.z.string().url().default('http://localhost:3030/api/mcp'),
|
|
121
|
+
MCP_CLIENT_API_KEY: zod_1.z.string(),
|
|
122
|
+
MCP_CLIENT_AGENT_IDS: jsonArraySchema(zod_1.z.string()).default('[]'),
|
|
123
|
+
// Bot features
|
|
124
|
+
TOKEN_USAGE_BOT_ENABLED: zod_1.z.string().transform(v => v !== 'false').default('true'),
|
|
125
|
+
AGENT_ACTIVITY_BOT_ENABLED: zod_1.z.string().transform(v => v !== 'false').default('true'),
|
|
126
|
+
// Chat bot mode: 'full' = all tools, 'minimal' = chat tools only, 'assistant' = no tools (knowledge-based help)
|
|
127
|
+
CHAT_BOT_MODE: zod_1.z.enum(['full', 'minimal', 'assistant']).default('full'),
|
|
128
|
+
ADAPTIVE_DOCUMENTATION_BOT_ENABLED: zod_1.z.string().transform(v => v === 'true').default('false'),
|
|
129
|
+
ADAPTIVE_AUTO_UPDATE: zod_1.z.string().transform(v => v === 'true').default('false'),
|
|
130
|
+
ADAPTIVE_UPDATE_INTERVAL: zod_1.z.string().transform(v => parseInt(v) || 60000).default('60000'),
|
|
131
|
+
ADAPTIVE_MIN_ERROR_COUNT: zod_1.z.string().transform(v => parseInt(v) || 3).default('3'),
|
|
132
|
+
ADAPTIVE_SKILL_GENERATION: zod_1.z.string().transform(v => v === 'true').default('false'), // Chat bot can't use skills
|
|
133
|
+
// Bot API Base URL (for daemon/bot connections)
|
|
134
|
+
BOT_API_BASE_URL: zod_1.z.string().url().default('https://api.hailer.com'),
|
|
135
|
+
// MCP context optimization (replaces mcp-config.ts)
|
|
136
|
+
MCP_EXCLUDE_TRANSLATIONS: zod_1.z.string().transform(v => v !== 'false').default('true'),
|
|
137
|
+
MCP_COMPACT_DATA: zod_1.z.string().transform(v => v !== 'false').default('true'),
|
|
138
|
+
MCP_INCLUDE_WORKSPACE_NAMES: zod_1.z.string().transform(v => v !== 'false').default('true'),
|
|
139
|
+
// Context management & token limits
|
|
140
|
+
CONTEXT_SAFETY_MARGIN_PERCENT: zod_1.z.string().transform(v => parseInt(v) || 25).default('25'),
|
|
141
|
+
CONTEXT_ENABLE_AUTO_SUMMARIZATION: zod_1.z.string().transform(v => v !== 'false').default('true'),
|
|
142
|
+
CONTEXT_MAX_SUMMARIZATION_CHUNKS: zod_1.z.string().transform(v => parseInt(v) || 10).default('10'),
|
|
143
|
+
// Token billing (real-time usage billing per workspace via Hailer API)
|
|
144
|
+
TOKEN_BILLING_ENABLED: zod_1.z.string().transform(v => v === 'true').default('false'),
|
|
136
145
|
});
|
|
137
146
|
/**
|
|
138
147
|
* Get process environment
|
|
@@ -218,6 +227,7 @@ class ApplicationConfig {
|
|
|
218
227
|
port: exports.environment.PORT,
|
|
219
228
|
corsOrigins: exports.environment.CORS_ORIGINS,
|
|
220
229
|
enableMcpServer: !exports.environment.DISABLE_MCP_SERVER,
|
|
230
|
+
enableClient: exports.environment.MCP_CLIENT_ENABLED,
|
|
221
231
|
};
|
|
222
232
|
}
|
|
223
233
|
/**
|
|
@@ -226,16 +236,111 @@ class ApplicationConfig {
|
|
|
226
236
|
get hailerAccounts() {
|
|
227
237
|
return exports.environment.CLIENT_CONFIGS;
|
|
228
238
|
}
|
|
239
|
+
get llmProviders() {
|
|
240
|
+
const providers = [];
|
|
241
|
+
if (exports.environment.OPENAI_API_KEY || exports.environment.OPENAI_API_BASE) {
|
|
242
|
+
const isAssistantMode = exports.environment.CHAT_BOT_MODE === 'assistant';
|
|
243
|
+
providers.push({
|
|
244
|
+
name: isAssistantMode ? 'mcp-assistant' : (exports.environment.OPENAI_API_BASE ? 'local-llm' : 'openai-gpt4o'),
|
|
245
|
+
type: isAssistantMode ? 'assistant' : 'openai',
|
|
246
|
+
apiKey: exports.environment.OPENAI_API_KEY || 'not-needed',
|
|
247
|
+
baseURL: exports.environment.OPENAI_API_BASE,
|
|
248
|
+
model: exports.environment.OPENAI_MODEL || 'gpt-4o',
|
|
249
|
+
enabled: true,
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
if (exports.environment.ANTHROPIC_API_KEY) {
|
|
253
|
+
providers.push({
|
|
254
|
+
name: 'anthropic-claude',
|
|
255
|
+
type: 'anthropic',
|
|
256
|
+
apiKey: exports.environment.ANTHROPIC_API_KEY,
|
|
257
|
+
model: 'claude-haiku-4-5-20251001', // Haiku 4.5 - fast and cheap
|
|
258
|
+
enabled: true,
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
return providers;
|
|
262
|
+
}
|
|
263
|
+
// ===== MCP CONFIGURATION (replaces mcp-config.ts) =====
|
|
229
264
|
/**
|
|
230
265
|
* MCP context optimization settings
|
|
231
266
|
*/
|
|
232
267
|
get mcpConfig() {
|
|
233
268
|
return {
|
|
234
|
-
excludeTranslations:
|
|
235
|
-
excludeSystemMessages: true,
|
|
236
|
-
excludeEmptyFields: true,
|
|
237
|
-
compactUserData:
|
|
238
|
-
includeWorkspaceNamesInTools:
|
|
269
|
+
excludeTranslations: exports.environment.MCP_EXCLUDE_TRANSLATIONS,
|
|
270
|
+
excludeSystemMessages: true, // Always enabled for cleaner responses
|
|
271
|
+
excludeEmptyFields: true, // Always enabled to reduce context
|
|
272
|
+
compactUserData: exports.environment.MCP_COMPACT_DATA,
|
|
273
|
+
includeWorkspaceNamesInTools: exports.environment.MCP_INCLUDE_WORKSPACE_NAMES,
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Context management settings for token limits and summarization
|
|
278
|
+
*/
|
|
279
|
+
get contextConfig() {
|
|
280
|
+
return {
|
|
281
|
+
safetyMarginPercent: exports.environment.CONTEXT_SAFETY_MARGIN_PERCENT,
|
|
282
|
+
enableAutoSummarization: exports.environment.CONTEXT_ENABLE_AUTO_SUMMARIZATION,
|
|
283
|
+
maxSummarizationChunks: exports.environment.CONTEXT_MAX_SUMMARIZATION_CHUNKS,
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Adaptive Documentation Bot configuration
|
|
288
|
+
*/
|
|
289
|
+
get adaptiveDocumentation() {
|
|
290
|
+
return {
|
|
291
|
+
enabled: exports.environment.ADAPTIVE_DOCUMENTATION_BOT_ENABLED,
|
|
292
|
+
autoUpdate: exports.environment.ADAPTIVE_AUTO_UPDATE,
|
|
293
|
+
updateInterval: exports.environment.ADAPTIVE_UPDATE_INTERVAL,
|
|
294
|
+
minErrorCount: exports.environment.ADAPTIVE_MIN_ERROR_COUNT,
|
|
295
|
+
skillGeneration: exports.environment.ADAPTIVE_SKILL_GENERATION,
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Token billing configuration for real-time usage billing per workspace
|
|
300
|
+
*/
|
|
301
|
+
get tokenBilling() {
|
|
302
|
+
return {
|
|
303
|
+
enabled: exports.environment.TOKEN_BILLING_ENABLED,
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Bot API base URL for daemon/bot connections
|
|
308
|
+
*/
|
|
309
|
+
get botApiBaseUrl() {
|
|
310
|
+
return exports.environment.BOT_API_BASE_URL;
|
|
311
|
+
}
|
|
312
|
+
// ===== CLIENT CONFIGURATION (replaces client/config.ts) =====
|
|
313
|
+
/**
|
|
314
|
+
* Create MCP Client configuration (replaces createMcpClientConfig())
|
|
315
|
+
*/
|
|
316
|
+
get mcpClient() {
|
|
317
|
+
const accounts = this.hailerAccounts;
|
|
318
|
+
const providers = this.llmProviders;
|
|
319
|
+
if (Object.keys(accounts).length === 0) {
|
|
320
|
+
console.warn('No Hailer accounts configured - MCP Client will be disabled');
|
|
321
|
+
return null;
|
|
322
|
+
}
|
|
323
|
+
if (providers.length === 0) {
|
|
324
|
+
console.warn('No LLM providers configured - MCP Client will be disabled');
|
|
325
|
+
return null;
|
|
326
|
+
}
|
|
327
|
+
// Convert Map format to BotClientConfig array for MultiBotManager compatibility
|
|
328
|
+
const botConfigs = Object.entries(accounts).map(([apiKey, account]) => ({
|
|
329
|
+
email: account.email,
|
|
330
|
+
password: account.password,
|
|
331
|
+
apiBaseUrl: account.apiBaseUrl,
|
|
332
|
+
mcpServerApiKey: apiKey,
|
|
333
|
+
}));
|
|
334
|
+
return {
|
|
335
|
+
enabled: exports.environment.MCP_CLIENT_ENABLED,
|
|
336
|
+
mcpServerUrl: exports.environment.MCP_SERVER_URL,
|
|
337
|
+
mcpServerApiKey: exports.environment.MCP_CLIENT_API_KEY,
|
|
338
|
+
providers,
|
|
339
|
+
mcpAgentIds: exports.environment.MCP_CLIENT_AGENT_IDS,
|
|
340
|
+
botConfigs,
|
|
341
|
+
enableDirectMessages: true,
|
|
342
|
+
tokenUsageBotEnabled: exports.environment.TOKEN_USAGE_BOT_ENABLED,
|
|
343
|
+
agentActivityBotEnabled: exports.environment.AGENT_ACTIVITY_BOT_ENABLED,
|
|
239
344
|
};
|
|
240
345
|
}
|
|
241
346
|
// ===== UTILITY METHODS =====
|
|
@@ -259,6 +364,12 @@ class ApplicationConfig {
|
|
|
259
364
|
findAccountByApiKey(apiKey) {
|
|
260
365
|
return this.hailerAccounts[apiKey] || null;
|
|
261
366
|
}
|
|
367
|
+
/**
|
|
368
|
+
* Get enabled LLM providers only
|
|
369
|
+
*/
|
|
370
|
+
getEnabledLlmProviders() {
|
|
371
|
+
return this.llmProviders.filter(provider => provider.enabled);
|
|
372
|
+
}
|
|
262
373
|
}
|
|
263
374
|
exports.ApplicationConfig = ApplicationConfig;
|
|
264
375
|
// ================================================================================
|