@hailer/mcp 0.1.15 → 0.1.17
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/agents/agent-giuseppe-app-builder.md +7 -6
- package/.claude/agents/agent-lars-code-inspector.md +26 -14
- package/dist/agents/bot-manager.d.ts +48 -0
- package/dist/agents/bot-manager.js +254 -0
- package/dist/agents/factory.d.ts +150 -0
- package/dist/agents/factory.js +650 -0
- package/dist/agents/giuseppe/ai.d.ts +83 -0
- package/dist/agents/giuseppe/ai.js +466 -0
- package/dist/agents/giuseppe/bot.d.ts +110 -0
- package/dist/agents/giuseppe/bot.js +780 -0
- package/dist/agents/giuseppe/config.d.ts +25 -0
- package/dist/agents/giuseppe/config.js +227 -0
- package/dist/agents/giuseppe/files.d.ts +52 -0
- package/dist/agents/giuseppe/files.js +338 -0
- package/dist/agents/giuseppe/git.d.ts +48 -0
- package/dist/agents/giuseppe/git.js +298 -0
- package/dist/agents/giuseppe/index.d.ts +97 -0
- package/dist/agents/giuseppe/index.js +258 -0
- package/dist/agents/giuseppe/lsp.d.ts +113 -0
- package/dist/agents/giuseppe/lsp.js +485 -0
- package/dist/agents/giuseppe/monitor.d.ts +118 -0
- package/dist/agents/giuseppe/monitor.js +621 -0
- package/dist/agents/giuseppe/prompt.d.ts +5 -0
- package/dist/agents/giuseppe/prompt.js +94 -0
- package/dist/agents/giuseppe/registries/pending-classification.d.ts +28 -0
- package/dist/agents/giuseppe/registries/pending-classification.js +50 -0
- package/dist/agents/giuseppe/registries/pending-fix.d.ts +30 -0
- package/dist/agents/giuseppe/registries/pending-fix.js +42 -0
- package/dist/agents/giuseppe/registries/pending.d.ts +27 -0
- package/dist/agents/giuseppe/registries/pending.js +49 -0
- package/dist/agents/giuseppe/specialist.d.ts +47 -0
- package/dist/agents/giuseppe/specialist.js +237 -0
- package/dist/agents/giuseppe/types.d.ts +123 -0
- package/dist/agents/giuseppe/types.js +9 -0
- package/dist/agents/hailer-expert/index.d.ts +8 -0
- package/dist/agents/hailer-expert/index.js +14 -0
- package/dist/agents/hal/daemon.d.ts +142 -0
- package/dist/agents/hal/daemon.js +1103 -0
- package/dist/agents/hal/definitions.d.ts +55 -0
- package/dist/agents/hal/definitions.js +263 -0
- package/dist/agents/hal/index.d.ts +3 -0
- package/dist/agents/hal/index.js +8 -0
- package/dist/agents/index.d.ts +18 -0
- package/dist/agents/index.js +48 -0
- package/dist/agents/shared/base.d.ts +216 -0
- package/dist/agents/shared/base.js +846 -0
- package/dist/agents/shared/services/agent-registry.d.ts +107 -0
- package/dist/agents/shared/services/agent-registry.js +629 -0
- package/dist/agents/shared/services/conversation-manager.d.ts +50 -0
- package/dist/agents/shared/services/conversation-manager.js +136 -0
- package/dist/agents/shared/services/mcp-client.d.ts +56 -0
- package/dist/agents/shared/services/mcp-client.js +124 -0
- package/dist/agents/shared/services/message-classifier.d.ts +37 -0
- package/dist/agents/shared/services/message-classifier.js +187 -0
- package/dist/agents/shared/services/message-formatter.d.ts +89 -0
- package/dist/agents/shared/services/message-formatter.js +371 -0
- package/dist/agents/shared/services/session-logger.d.ts +106 -0
- package/dist/agents/shared/services/session-logger.js +446 -0
- package/dist/agents/shared/services/tool-executor.d.ts +41 -0
- package/dist/agents/shared/services/tool-executor.js +169 -0
- package/dist/agents/shared/services/workspace-schema-cache.d.ts +125 -0
- package/dist/agents/shared/services/workspace-schema-cache.js +578 -0
- package/dist/agents/shared/specialist.d.ts +91 -0
- package/dist/agents/shared/specialist.js +399 -0
- package/dist/agents/shared/tool-schema-loader.d.ts +62 -0
- package/dist/agents/shared/tool-schema-loader.js +232 -0
- package/dist/agents/shared/types.d.ts +327 -0
- package/dist/agents/shared/types.js +121 -0
- package/dist/app.js +21 -4
- package/dist/cli.js +0 -0
- package/dist/client/agents/orchestrator.d.ts +1 -0
- package/dist/client/agents/orchestrator.js +12 -1
- package/dist/commands/seed-config.d.ts +9 -0
- package/dist/commands/seed-config.js +372 -0
- package/dist/config.d.ts +10 -0
- package/dist/config.js +61 -1
- package/dist/core.d.ts +8 -0
- package/dist/core.js +137 -6
- package/dist/lib/discussion-lock.d.ts +42 -0
- package/dist/lib/discussion-lock.js +110 -0
- package/dist/mcp/UserContextCache.js +2 -2
- package/dist/mcp/hailer-clients.d.ts +15 -0
- package/dist/mcp/hailer-clients.js +100 -6
- package/dist/mcp/signal-handler.d.ts +16 -5
- package/dist/mcp/signal-handler.js +173 -122
- package/dist/mcp/tools/activity.js +9 -1
- package/dist/mcp/tools/bot-config.d.ts +184 -9
- package/dist/mcp/tools/bot-config.js +2177 -163
- package/dist/mcp/tools/giuseppe-tools.d.ts +21 -0
- package/dist/mcp/tools/giuseppe-tools.js +525 -0
- package/dist/mcp/utils/hailer-api-client.d.ts +42 -1
- package/dist/mcp/utils/hailer-api-client.js +128 -2
- package/dist/mcp/webhook-handler.d.ts +87 -0
- package/dist/mcp/webhook-handler.js +345 -0
- package/dist/mcp/workspace-cache.d.ts +5 -0
- package/dist/mcp/workspace-cache.js +11 -0
- package/dist/mcp-server.js +60 -5
- package/dist/modules/bug-reports/giuseppe-agent.d.ts +58 -0
- package/dist/modules/bug-reports/giuseppe-agent.js +467 -0
- package/dist/modules/bug-reports/giuseppe-ai.d.ts +25 -1
- package/dist/modules/bug-reports/giuseppe-ai.js +133 -2
- package/dist/modules/bug-reports/giuseppe-bot.d.ts +2 -2
- package/dist/modules/bug-reports/giuseppe-bot.js +66 -42
- package/dist/modules/bug-reports/giuseppe-daemon.d.ts +80 -0
- package/dist/modules/bug-reports/giuseppe-daemon.js +617 -0
- package/dist/modules/bug-reports/giuseppe-files.d.ts +12 -0
- package/dist/modules/bug-reports/giuseppe-files.js +37 -0
- package/dist/modules/bug-reports/giuseppe-lsp.d.ts +84 -13
- package/dist/modules/bug-reports/giuseppe-lsp.js +403 -61
- package/dist/modules/bug-reports/index.d.ts +1 -0
- package/dist/modules/bug-reports/index.js +31 -29
- package/package.json +3 -2
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Tool Schema Loader
|
|
4
|
+
*
|
|
5
|
+
* Manages MCP tool discovery, schema loading, and filtering.
|
|
6
|
+
* Shared between all LLM providers (Anthropic, OpenAI, etc.)
|
|
7
|
+
*
|
|
8
|
+
* Key Features:
|
|
9
|
+
* - Load lightweight tool index from MCP server
|
|
10
|
+
* - Filter tools by groups (READ, WRITE, PLAYGROUND)
|
|
11
|
+
* - Load full schemas on-demand (token-efficient)
|
|
12
|
+
* - Cache loaded schemas
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.ToolSchemaLoader = void 0;
|
|
16
|
+
const logger_1 = require("../../lib/logger");
|
|
17
|
+
const logger = (0, logger_1.createLogger)({ component: 'ToolSchemaLoader' });
|
|
18
|
+
/**
|
|
19
|
+
* Recursively add additionalProperties: false to all object schemas
|
|
20
|
+
* Required for Anthropic structured outputs (betas: ['structured-outputs-2025-11-13'])
|
|
21
|
+
*/
|
|
22
|
+
function addAdditionalPropertiesFalse(schema) {
|
|
23
|
+
if (!schema || typeof schema !== 'object')
|
|
24
|
+
return schema;
|
|
25
|
+
// Create a shallow copy to avoid mutating the original
|
|
26
|
+
const result = { ...schema };
|
|
27
|
+
// If this is an object type, ensure additionalProperties is false
|
|
28
|
+
if (result.type === 'object') {
|
|
29
|
+
result.additionalProperties = false;
|
|
30
|
+
// Recursively process properties
|
|
31
|
+
if (result.properties && typeof result.properties === 'object') {
|
|
32
|
+
result.properties = { ...result.properties };
|
|
33
|
+
for (const key of Object.keys(result.properties)) {
|
|
34
|
+
result.properties[key] = addAdditionalPropertiesFalse(result.properties[key]);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// Recursively process patternProperties
|
|
38
|
+
if (result.patternProperties && typeof result.patternProperties === 'object') {
|
|
39
|
+
result.patternProperties = { ...result.patternProperties };
|
|
40
|
+
for (const key of Object.keys(result.patternProperties)) {
|
|
41
|
+
result.patternProperties[key] = addAdditionalPropertiesFalse(result.patternProperties[key]);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// Handle array items
|
|
46
|
+
if (result.items) {
|
|
47
|
+
result.items = addAdditionalPropertiesFalse(result.items);
|
|
48
|
+
}
|
|
49
|
+
// Handle oneOf, anyOf, allOf
|
|
50
|
+
if (result.oneOf) {
|
|
51
|
+
result.oneOf = result.oneOf.map((s) => addAdditionalPropertiesFalse(s));
|
|
52
|
+
}
|
|
53
|
+
if (result.anyOf) {
|
|
54
|
+
result.anyOf = result.anyOf.map((s) => addAdditionalPropertiesFalse(s));
|
|
55
|
+
}
|
|
56
|
+
if (result.allOf) {
|
|
57
|
+
result.allOf = result.allOf.map((s) => addAdditionalPropertiesFalse(s));
|
|
58
|
+
}
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
class ToolSchemaLoader {
|
|
62
|
+
toolSchemaCache = new Map(); // In-memory cache for tool schemas
|
|
63
|
+
/**
|
|
64
|
+
* Load tool index with filtering
|
|
65
|
+
* Returns lightweight tool list with optional exclusions
|
|
66
|
+
*/
|
|
67
|
+
async loadToolIndex(options) {
|
|
68
|
+
const { mcpServerUrl, mcpServerApiKey, allowedGroups, allowedTools, excludeMessageFetchTools } = options;
|
|
69
|
+
// Fetch tool index from MCP server with group filtering
|
|
70
|
+
let toolIndex = await this.fetchMcpToolIndex(mcpServerUrl, mcpServerApiKey, allowedGroups);
|
|
71
|
+
// Filter by explicit whitelist if provided (overrides group filtering)
|
|
72
|
+
if (allowedTools && allowedTools.length > 0) {
|
|
73
|
+
toolIndex = toolIndex.filter(tool => allowedTools.includes(tool.name));
|
|
74
|
+
logger.debug("Filtered tools by whitelist", {
|
|
75
|
+
allowedTools,
|
|
76
|
+
resultCount: toolIndex.length
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
// Optionally exclude message fetch tools if explicitly requested
|
|
80
|
+
if (excludeMessageFetchTools) {
|
|
81
|
+
const excludedTools = ['fetch_discussion_messages', 'fetch_previous_discussion_messages'];
|
|
82
|
+
toolIndex = toolIndex.filter(tool => !excludedTools.includes(tool.name));
|
|
83
|
+
logger.debug("Excluded message fetch tools (explicitly requested)", { excludedTools });
|
|
84
|
+
}
|
|
85
|
+
logger.debug("Loaded tool index", {
|
|
86
|
+
toolCount: toolIndex.length,
|
|
87
|
+
allowedGroups: allowedGroups.join(', ')
|
|
88
|
+
});
|
|
89
|
+
return toolIndex;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Load full schema for a specific tool on-demand
|
|
93
|
+
*/
|
|
94
|
+
async loadToolSchema(mcpServerUrl, mcpServerApiKey, toolName) {
|
|
95
|
+
// Check cache first
|
|
96
|
+
if (this.toolSchemaCache.has(toolName)) {
|
|
97
|
+
logger.debug("Using cached tool schema", { toolName });
|
|
98
|
+
return this.toolSchemaCache.get(toolName);
|
|
99
|
+
}
|
|
100
|
+
// Fetch from MCP server
|
|
101
|
+
logger.debug("Fetching full schema for tool on-demand", { toolName });
|
|
102
|
+
const url = `${mcpServerUrl}${mcpServerUrl.includes("?") ? "&" : "?"}apiKey=${mcpServerApiKey}`;
|
|
103
|
+
const response = await fetch(url, {
|
|
104
|
+
method: "POST",
|
|
105
|
+
headers: {
|
|
106
|
+
"Content-Type": "application/json",
|
|
107
|
+
Accept: "application/json, text/event-stream",
|
|
108
|
+
},
|
|
109
|
+
body: JSON.stringify({
|
|
110
|
+
jsonrpc: "2.0",
|
|
111
|
+
id: 1,
|
|
112
|
+
method: "tools/get_schema",
|
|
113
|
+
params: { name: toolName },
|
|
114
|
+
}),
|
|
115
|
+
});
|
|
116
|
+
if (!response.ok) {
|
|
117
|
+
throw new Error(`MCP server responded with ${response.status}: ${response.statusText}`);
|
|
118
|
+
}
|
|
119
|
+
// Parse SSE response
|
|
120
|
+
const responseText = await response.text();
|
|
121
|
+
const lines = responseText.split("\n");
|
|
122
|
+
let jsonData = null;
|
|
123
|
+
for (const line of lines) {
|
|
124
|
+
if (line.startsWith("data: ")) {
|
|
125
|
+
try {
|
|
126
|
+
jsonData = JSON.parse(line.substring(6));
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
catch (e) {
|
|
130
|
+
// Skip non-JSON lines
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (!jsonData) {
|
|
135
|
+
throw new Error("Failed to parse MCP server response");
|
|
136
|
+
}
|
|
137
|
+
if (jsonData.error) {
|
|
138
|
+
throw new Error(`MCP server error: ${jsonData.error.message || jsonData.error}`);
|
|
139
|
+
}
|
|
140
|
+
let schema = jsonData.result;
|
|
141
|
+
// Apply additionalProperties: false recursively for Anthropic structured outputs
|
|
142
|
+
if (schema.inputSchema) {
|
|
143
|
+
schema.inputSchema = addAdditionalPropertiesFalse(schema.inputSchema);
|
|
144
|
+
}
|
|
145
|
+
// Cache the schema
|
|
146
|
+
this.toolSchemaCache.set(toolName, schema);
|
|
147
|
+
logger.debug("Cached tool schema", { toolName });
|
|
148
|
+
return schema;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Convert tool index to minimal tool definitions (stubs)
|
|
152
|
+
* Full schemas will be loaded on-demand when needed
|
|
153
|
+
*/
|
|
154
|
+
toMinimalToolDefinitions(toolIndex) {
|
|
155
|
+
return toolIndex.map((tool, index) => {
|
|
156
|
+
const toolDef = {
|
|
157
|
+
name: tool.name,
|
|
158
|
+
description: tool.description,
|
|
159
|
+
input_schema: addAdditionalPropertiesFalse({
|
|
160
|
+
type: "object",
|
|
161
|
+
properties: {},
|
|
162
|
+
required: [],
|
|
163
|
+
}),
|
|
164
|
+
};
|
|
165
|
+
// Add cache control to last tool for Anthropic prompt caching
|
|
166
|
+
if (index === toolIndex.length - 1) {
|
|
167
|
+
toolDef.cache_control = { type: "ephemeral" };
|
|
168
|
+
}
|
|
169
|
+
return toolDef;
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Get count of loaded schemas
|
|
174
|
+
*/
|
|
175
|
+
getLoadedSchemaCount() {
|
|
176
|
+
return this.toolSchemaCache.size;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Clear schema cache
|
|
180
|
+
*/
|
|
181
|
+
clearCache() {
|
|
182
|
+
this.toolSchemaCache.clear();
|
|
183
|
+
logger.debug("Tool schema cache cleared");
|
|
184
|
+
}
|
|
185
|
+
// ===== PRIVATE METHODS =====
|
|
186
|
+
/**
|
|
187
|
+
* Fetch tool index from MCP server
|
|
188
|
+
*/
|
|
189
|
+
async fetchMcpToolIndex(mcpServerUrl, mcpServerApiKey, allowedGroups) {
|
|
190
|
+
const url = `${mcpServerUrl}${mcpServerUrl.includes("?") ? "&" : "?"}apiKey=${mcpServerApiKey}`;
|
|
191
|
+
const response = await fetch(url, {
|
|
192
|
+
method: "POST",
|
|
193
|
+
headers: {
|
|
194
|
+
"Content-Type": "application/json",
|
|
195
|
+
Accept: "application/json, text/event-stream",
|
|
196
|
+
},
|
|
197
|
+
body: JSON.stringify({
|
|
198
|
+
jsonrpc: "2.0",
|
|
199
|
+
id: 1,
|
|
200
|
+
method: "tools/list",
|
|
201
|
+
params: allowedGroups ? { groups: allowedGroups } : {},
|
|
202
|
+
}),
|
|
203
|
+
});
|
|
204
|
+
if (!response.ok) {
|
|
205
|
+
throw new Error(`MCP server responded with ${response.status}: ${response.statusText}`);
|
|
206
|
+
}
|
|
207
|
+
// Parse SSE response format
|
|
208
|
+
const responseText = await response.text();
|
|
209
|
+
const lines = responseText.split("\n");
|
|
210
|
+
let jsonData = null;
|
|
211
|
+
for (const line of lines) {
|
|
212
|
+
if (line.startsWith("data: ")) {
|
|
213
|
+
try {
|
|
214
|
+
jsonData = JSON.parse(line.substring(6));
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
catch (e) {
|
|
218
|
+
// Skip non-JSON lines
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
if (!jsonData) {
|
|
223
|
+
throw new Error("Failed to parse MCP server response");
|
|
224
|
+
}
|
|
225
|
+
if (jsonData.error) {
|
|
226
|
+
throw new Error(`MCP server error: ${jsonData.error.message || jsonData.error}`);
|
|
227
|
+
}
|
|
228
|
+
return jsonData.result.tools;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
exports.ToolSchemaLoader = ToolSchemaLoader;
|
|
232
|
+
//# sourceMappingURL=tool-schema-loader.js.map
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client Types
|
|
3
|
+
* All interfaces and types for the agent system
|
|
4
|
+
*/
|
|
5
|
+
import { BotClient } from "../bot-manager";
|
|
6
|
+
export interface BotClientConfig {
|
|
7
|
+
email: string;
|
|
8
|
+
password: string;
|
|
9
|
+
apiBaseUrl: string;
|
|
10
|
+
mcpServerApiKey: string;
|
|
11
|
+
}
|
|
12
|
+
export interface AgentDaemonConfig {
|
|
13
|
+
botClient: BotClient;
|
|
14
|
+
mcpServerUrl: string;
|
|
15
|
+
anthropicApiKey: string;
|
|
16
|
+
model?: string;
|
|
17
|
+
maxContextMessages?: number;
|
|
18
|
+
}
|
|
19
|
+
/** JSON Schema definition for tool input schemas */
|
|
20
|
+
export interface JsonSchema {
|
|
21
|
+
type?: string;
|
|
22
|
+
properties?: Record<string, JsonSchema>;
|
|
23
|
+
required?: string[];
|
|
24
|
+
items?: JsonSchema;
|
|
25
|
+
oneOf?: JsonSchema[];
|
|
26
|
+
anyOf?: JsonSchema[];
|
|
27
|
+
allOf?: JsonSchema[];
|
|
28
|
+
additionalProperties?: boolean | JsonSchema;
|
|
29
|
+
patternProperties?: Record<string, JsonSchema>;
|
|
30
|
+
description?: string;
|
|
31
|
+
enum?: Array<string | number | boolean>;
|
|
32
|
+
const?: unknown;
|
|
33
|
+
default?: unknown;
|
|
34
|
+
minimum?: number;
|
|
35
|
+
maximum?: number;
|
|
36
|
+
minLength?: number;
|
|
37
|
+
maxLength?: number;
|
|
38
|
+
pattern?: string;
|
|
39
|
+
format?: string;
|
|
40
|
+
$ref?: string;
|
|
41
|
+
$schema?: string;
|
|
42
|
+
}
|
|
43
|
+
/** Hailer discussion message from API */
|
|
44
|
+
export interface HailerMessage {
|
|
45
|
+
_id: string;
|
|
46
|
+
msg?: string;
|
|
47
|
+
content?: string;
|
|
48
|
+
uid: string;
|
|
49
|
+
userName?: string;
|
|
50
|
+
type?: string;
|
|
51
|
+
replyTo?: string;
|
|
52
|
+
created?: number;
|
|
53
|
+
}
|
|
54
|
+
/** Hailer discussion data from API */
|
|
55
|
+
export interface HailerDiscussion {
|
|
56
|
+
_id: string;
|
|
57
|
+
name?: string;
|
|
58
|
+
participants?: string[];
|
|
59
|
+
linked_activity?: string;
|
|
60
|
+
}
|
|
61
|
+
/** Hailer user from search/workspace cache */
|
|
62
|
+
export interface HailerUser {
|
|
63
|
+
_id: string;
|
|
64
|
+
firstname?: string;
|
|
65
|
+
lastname?: string;
|
|
66
|
+
fullName?: string;
|
|
67
|
+
email?: string;
|
|
68
|
+
}
|
|
69
|
+
/** MCP tool definition from tool index */
|
|
70
|
+
export interface ToolDefinition {
|
|
71
|
+
name: string;
|
|
72
|
+
description?: string;
|
|
73
|
+
inputSchema?: {
|
|
74
|
+
type: string;
|
|
75
|
+
properties?: Record<string, unknown>;
|
|
76
|
+
required?: string[];
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/** MCP tool result from server */
|
|
80
|
+
export interface McpToolResult {
|
|
81
|
+
content?: Array<{
|
|
82
|
+
text?: string;
|
|
83
|
+
type?: string;
|
|
84
|
+
}>;
|
|
85
|
+
}
|
|
86
|
+
/** Callback type for MCP tool calls - used by services */
|
|
87
|
+
export type McpToolCallback = (name: string, args: ToolInput) => Promise<McpToolResult>;
|
|
88
|
+
/** Tool input - all fields optional since different tools use different fields */
|
|
89
|
+
export interface ToolInput {
|
|
90
|
+
name?: string;
|
|
91
|
+
activityId?: string;
|
|
92
|
+
discussionId?: string;
|
|
93
|
+
insightId?: string;
|
|
94
|
+
workflowId?: string;
|
|
95
|
+
phaseId?: string;
|
|
96
|
+
fields?: Record<string, string | number | boolean> | string[];
|
|
97
|
+
search?: string;
|
|
98
|
+
query?: string;
|
|
99
|
+
limit?: number;
|
|
100
|
+
filters?: Record<string, {
|
|
101
|
+
operator: string;
|
|
102
|
+
value: string;
|
|
103
|
+
}>;
|
|
104
|
+
sortBy?: string;
|
|
105
|
+
sortOrder?: "asc" | "desc";
|
|
106
|
+
content?: string;
|
|
107
|
+
userIds?: string[];
|
|
108
|
+
inviteUserId?: string;
|
|
109
|
+
sourceActivityId?: string;
|
|
110
|
+
welcomeReason?: string;
|
|
111
|
+
compact?: boolean;
|
|
112
|
+
teamId?: string;
|
|
113
|
+
workspace?: string;
|
|
114
|
+
workspaceId?: string;
|
|
115
|
+
templateId?: string;
|
|
116
|
+
publicOnly?: boolean;
|
|
117
|
+
}
|
|
118
|
+
export type MessagePriority = "high" | "normal" | "low";
|
|
119
|
+
export interface IncomingMessage {
|
|
120
|
+
id: string;
|
|
121
|
+
discussionId: string;
|
|
122
|
+
workspaceId: string;
|
|
123
|
+
discussionName?: string;
|
|
124
|
+
linkedActivityId?: string;
|
|
125
|
+
linkedActivityName?: string;
|
|
126
|
+
senderId: string;
|
|
127
|
+
senderName: string;
|
|
128
|
+
content: string;
|
|
129
|
+
timestamp: number;
|
|
130
|
+
priority: MessagePriority;
|
|
131
|
+
priorityReason: string;
|
|
132
|
+
isReplyToBot: boolean;
|
|
133
|
+
isMention: boolean;
|
|
134
|
+
isDirectMessage: boolean;
|
|
135
|
+
}
|
|
136
|
+
export type LlmDecision = {
|
|
137
|
+
action: "respond";
|
|
138
|
+
discussionId: string;
|
|
139
|
+
content: string;
|
|
140
|
+
} | {
|
|
141
|
+
action: "ignore";
|
|
142
|
+
reason: string;
|
|
143
|
+
} | {
|
|
144
|
+
action: "tool_call";
|
|
145
|
+
toolName: string;
|
|
146
|
+
args: ToolInput;
|
|
147
|
+
} | {
|
|
148
|
+
action: "thinking";
|
|
149
|
+
content: string;
|
|
150
|
+
};
|
|
151
|
+
/** State returned by getConversationState() */
|
|
152
|
+
export interface ConversationState {
|
|
153
|
+
discussionCount: number;
|
|
154
|
+
currentDiscussion: string | null;
|
|
155
|
+
currentMessageCount: number;
|
|
156
|
+
queueLength: number;
|
|
157
|
+
lastMessages: Array<{
|
|
158
|
+
role: string;
|
|
159
|
+
preview: string;
|
|
160
|
+
}>;
|
|
161
|
+
isProcessing: boolean;
|
|
162
|
+
}
|
|
163
|
+
export interface SessionMetrics {
|
|
164
|
+
inputTokens: number;
|
|
165
|
+
outputTokens: number;
|
|
166
|
+
toolCalls: number;
|
|
167
|
+
writeOperations: number;
|
|
168
|
+
messagesProcessed: number;
|
|
169
|
+
responsesPosted: number;
|
|
170
|
+
}
|
|
171
|
+
export interface ActivitySession {
|
|
172
|
+
activityId: string;
|
|
173
|
+
activityName: string;
|
|
174
|
+
discussionId: string;
|
|
175
|
+
workspaceId: string;
|
|
176
|
+
startTime: number;
|
|
177
|
+
lastActivityTime: number;
|
|
178
|
+
metrics: SessionMetrics;
|
|
179
|
+
actions: string[];
|
|
180
|
+
previousLogId: string | null;
|
|
181
|
+
conversation: string[];
|
|
182
|
+
writeDetails: WriteDetail[];
|
|
183
|
+
triggerRequest: string | null;
|
|
184
|
+
requestedBy: string | null;
|
|
185
|
+
requestedById: string | null;
|
|
186
|
+
}
|
|
187
|
+
/** Detail about a write operation */
|
|
188
|
+
export interface WriteDetail {
|
|
189
|
+
tool: string;
|
|
190
|
+
what: string;
|
|
191
|
+
targetId?: string;
|
|
192
|
+
}
|
|
193
|
+
export declare const AGENT_DIRECTORY: {
|
|
194
|
+
readonly workflowId: "694a35b5b8b5c5f8030788e3";
|
|
195
|
+
readonly phases: {
|
|
196
|
+
readonly agentBuilder: "694a35b5b8b5c5f8030788f7";
|
|
197
|
+
readonly deployed: "694a35b5b8b5c5f8030788fb";
|
|
198
|
+
readonly retired: "694a35b5b8b5c5f8030788fc";
|
|
199
|
+
};
|
|
200
|
+
readonly fields: {
|
|
201
|
+
readonly firstName: "694a35b5b8b5c5f8030788ea";
|
|
202
|
+
readonly lastName: "694a35b5b8b5c5f8030788eb";
|
|
203
|
+
readonly description: "694a35b5b8b5c5f8030788f6";
|
|
204
|
+
readonly hailerProfile: "694a35b5b8b5c5f8030788f2";
|
|
205
|
+
readonly email: "694a35b5b8b5c5f8030788f3";
|
|
206
|
+
readonly password: "694a35b5b8b5c5f8030788f4";
|
|
207
|
+
readonly team: "694a35b5b8b5c5f8030788e7";
|
|
208
|
+
readonly supervisor: "694a35b5b8b5c5f8030788e8";
|
|
209
|
+
readonly memory: "694a35b5b8b5c5f8030788f5";
|
|
210
|
+
readonly position: "694a35b5b8b5c5f8030788e5";
|
|
211
|
+
readonly startDate: "694a35b5b8b5c5f8030788ec";
|
|
212
|
+
};
|
|
213
|
+
};
|
|
214
|
+
export declare const SESSION_LOG: {
|
|
215
|
+
readonly workflowId: "694a35b5b8b5c5f803078915";
|
|
216
|
+
readonly phases: {
|
|
217
|
+
readonly active: "694a35b5b8b5c5f803078941";
|
|
218
|
+
readonly archive: "694a35b5b8b5c5f803078942";
|
|
219
|
+
};
|
|
220
|
+
readonly fields: {
|
|
221
|
+
readonly contextSummary: "694a35b5b8b5c5f80307893c";
|
|
222
|
+
readonly previousLog: "694a35b5b8b5c5f80307893d";
|
|
223
|
+
readonly linkedWork: "694a35b5b8b5c5f80307893e";
|
|
224
|
+
readonly cost: "694a35b5b8b5c5f80307893f";
|
|
225
|
+
readonly madeBy: "694a35b5b8b5c5f803078940";
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
export declare const POSITIONS: {
|
|
229
|
+
readonly workflowId: "694a35b5b8b5c5f8030788e4";
|
|
230
|
+
readonly phases: {
|
|
231
|
+
readonly active: "694a35b5b8b5c5f80307890f";
|
|
232
|
+
};
|
|
233
|
+
readonly fields: {
|
|
234
|
+
readonly purpose: "694a35b5b8b5c5f803078901";
|
|
235
|
+
readonly personaTone: "694a35b5b8b5c5f803078903";
|
|
236
|
+
readonly coreCapabilities: "694a35b5b8b5c5f803078904";
|
|
237
|
+
readonly contextAwareness: "694a35b5b8b5c5f803078905";
|
|
238
|
+
readonly taskHandling: "694a35b5b8b5c5f803078906";
|
|
239
|
+
readonly infoRetrieval: "694a35b5b8b5c5f803078907";
|
|
240
|
+
readonly boundaries: "694a35b5b8b5c5f803078908";
|
|
241
|
+
readonly userInteraction: "694a35b5b8b5c5f803078909";
|
|
242
|
+
readonly errorHandling: "694a35b5b8b5c5f80307890a";
|
|
243
|
+
readonly learning: "694a35b5b8b5c5f80307890b";
|
|
244
|
+
readonly escalation: "694a35b5b8b5c5f80307890c";
|
|
245
|
+
readonly auditLogging: "694a35b5b8b5c5f80307890d";
|
|
246
|
+
readonly agentCount: "694a35b5b8b5c5f803078902";
|
|
247
|
+
readonly multiAllowed: "694a35b5b8b5c5f80307890e";
|
|
248
|
+
};
|
|
249
|
+
};
|
|
250
|
+
export declare const TEAMS: {
|
|
251
|
+
readonly workflowId: "694a35b5b8b5c5f8030788e6";
|
|
252
|
+
readonly phases: {
|
|
253
|
+
readonly active: "694a35b5b8b5c5f80307891a";
|
|
254
|
+
};
|
|
255
|
+
readonly fields: {
|
|
256
|
+
readonly info: "694a35b5b8b5c5f803078919";
|
|
257
|
+
readonly leader: "694a35b5b8b5c5f8030788e9";
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
export declare const TOOL_REGISTRY: {
|
|
261
|
+
readonly workflowId: "694a35b5b8b5c5f803078922";
|
|
262
|
+
readonly phases: {
|
|
263
|
+
readonly active: "694a35b5b8b5c5f803078927";
|
|
264
|
+
};
|
|
265
|
+
readonly fields: {
|
|
266
|
+
readonly baseUrl: "694a35b5b8b5c5f803078923";
|
|
267
|
+
readonly protocolVersion: "694a35b5b8b5c5f803078924";
|
|
268
|
+
readonly toolRegistry: "694a35b5b8b5c5f803078925";
|
|
269
|
+
readonly logEntryBy: "694a35b5b8b5c5f803078926";
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
export declare const MCP_CONFIG: {
|
|
273
|
+
readonly workflowId: "694a35b5b8b5c5f803078928";
|
|
274
|
+
readonly phases: {
|
|
275
|
+
readonly active: "694a35b5b8b5c5f80307893b";
|
|
276
|
+
};
|
|
277
|
+
readonly fields: {
|
|
278
|
+
readonly agentName: "694a35b5b8b5c5f803078929";
|
|
279
|
+
readonly agentId: "694a35b5b8b5c5f80307892a";
|
|
280
|
+
readonly publicKey: "694a35b5b8b5c5f80307892c";
|
|
281
|
+
readonly accessTo: "694a35b5b8b5c5f80307892b";
|
|
282
|
+
readonly authToken: "694a35b5b8b5c5f80307892d";
|
|
283
|
+
readonly apiKey: "694a35b5b8b5c5f80307892e";
|
|
284
|
+
readonly workspaceId: "694a35b5b8b5c5f803078934";
|
|
285
|
+
readonly permissions: "694a35b5b8b5c5f803078935";
|
|
286
|
+
readonly sessionId: "694a35b5b8b5c5f803078936";
|
|
287
|
+
readonly resourceLimits: "694a35b5b8b5c5f803078937";
|
|
288
|
+
readonly loggingEndpoint: "694a35b5b8b5c5f803078938";
|
|
289
|
+
readonly callbackUrl: "694a35b5b8b5c5f803078939";
|
|
290
|
+
readonly customContext: "694a35b5b8b5c5f80307893a";
|
|
291
|
+
readonly permCreate: "694a35b5b8b5c5f803078930";
|
|
292
|
+
readonly permRead: "694a35b5b8b5c5f803078931";
|
|
293
|
+
readonly permUpdate: "694a35b5b8b5c5f803078932";
|
|
294
|
+
readonly permDelete: "694a35b5b8b5c5f803078933";
|
|
295
|
+
};
|
|
296
|
+
};
|
|
297
|
+
export declare const SESSION_IDLE_TIMEOUT = 60000;
|
|
298
|
+
export interface BotDefinition {
|
|
299
|
+
id: string;
|
|
300
|
+
name: string;
|
|
301
|
+
description: string;
|
|
302
|
+
icon: string;
|
|
303
|
+
}
|
|
304
|
+
export { AVAILABLE_BOTS } from '../../mcp/tools/bot-config';
|
|
305
|
+
export interface WorkspaceConfig {
|
|
306
|
+
id: string;
|
|
307
|
+
name: string;
|
|
308
|
+
apiKey: string;
|
|
309
|
+
enabledBots: string[];
|
|
310
|
+
registeredAt: string;
|
|
311
|
+
lastSeen?: string;
|
|
312
|
+
}
|
|
313
|
+
export interface WorkspacesState {
|
|
314
|
+
workspaces: Record<string, WorkspaceConfig>;
|
|
315
|
+
}
|
|
316
|
+
export interface WorkspaceStatus {
|
|
317
|
+
id: string;
|
|
318
|
+
name: string;
|
|
319
|
+
registered: boolean;
|
|
320
|
+
bots: Array<{
|
|
321
|
+
id: string;
|
|
322
|
+
name: string;
|
|
323
|
+
enabled: boolean;
|
|
324
|
+
running: boolean;
|
|
325
|
+
}>;
|
|
326
|
+
}
|
|
327
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Client Types
|
|
4
|
+
* All interfaces and types for the agent system
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.AVAILABLE_BOTS = exports.SESSION_IDLE_TIMEOUT = exports.MCP_CONFIG = exports.TOOL_REGISTRY = exports.TEAMS = exports.POSITIONS = exports.SESSION_LOG = exports.AGENT_DIRECTORY = void 0;
|
|
8
|
+
// ===== WORKFLOW CONSTANTS =====
|
|
9
|
+
// DEPRECATED: These IDs are for ONE workspace only!
|
|
10
|
+
// Use WorkspaceSchemaCacheService for dynamic per-workspace lookup.
|
|
11
|
+
// These will be removed in a future version.
|
|
12
|
+
exports.AGENT_DIRECTORY = {
|
|
13
|
+
workflowId: "694a35b5b8b5c5f8030788e3",
|
|
14
|
+
phases: {
|
|
15
|
+
agentBuilder: "694a35b5b8b5c5f8030788f7",
|
|
16
|
+
deployed: "694a35b5b8b5c5f8030788fb",
|
|
17
|
+
retired: "694a35b5b8b5c5f8030788fc",
|
|
18
|
+
},
|
|
19
|
+
fields: {
|
|
20
|
+
firstName: "694a35b5b8b5c5f8030788ea",
|
|
21
|
+
lastName: "694a35b5b8b5c5f8030788eb",
|
|
22
|
+
description: "694a35b5b8b5c5f8030788f6",
|
|
23
|
+
hailerProfile: "694a35b5b8b5c5f8030788f2",
|
|
24
|
+
email: "694a35b5b8b5c5f8030788f3",
|
|
25
|
+
password: "694a35b5b8b5c5f8030788f4",
|
|
26
|
+
team: "694a35b5b8b5c5f8030788e7",
|
|
27
|
+
supervisor: "694a35b5b8b5c5f8030788e8",
|
|
28
|
+
memory: "694a35b5b8b5c5f8030788f5",
|
|
29
|
+
position: "694a35b5b8b5c5f8030788e5",
|
|
30
|
+
startDate: "694a35b5b8b5c5f8030788ec",
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
exports.SESSION_LOG = {
|
|
34
|
+
workflowId: "694a35b5b8b5c5f803078915",
|
|
35
|
+
phases: {
|
|
36
|
+
active: "694a35b5b8b5c5f803078941",
|
|
37
|
+
archive: "694a35b5b8b5c5f803078942",
|
|
38
|
+
},
|
|
39
|
+
fields: {
|
|
40
|
+
contextSummary: "694a35b5b8b5c5f80307893c",
|
|
41
|
+
previousLog: "694a35b5b8b5c5f80307893d",
|
|
42
|
+
linkedWork: "694a35b5b8b5c5f80307893e",
|
|
43
|
+
cost: "694a35b5b8b5c5f80307893f",
|
|
44
|
+
madeBy: "694a35b5b8b5c5f803078940",
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
exports.POSITIONS = {
|
|
48
|
+
workflowId: "694a35b5b8b5c5f8030788e4",
|
|
49
|
+
phases: {
|
|
50
|
+
active: "694a35b5b8b5c5f80307890f",
|
|
51
|
+
},
|
|
52
|
+
fields: {
|
|
53
|
+
purpose: "694a35b5b8b5c5f803078901",
|
|
54
|
+
personaTone: "694a35b5b8b5c5f803078903",
|
|
55
|
+
coreCapabilities: "694a35b5b8b5c5f803078904",
|
|
56
|
+
contextAwareness: "694a35b5b8b5c5f803078905",
|
|
57
|
+
taskHandling: "694a35b5b8b5c5f803078906",
|
|
58
|
+
infoRetrieval: "694a35b5b8b5c5f803078907",
|
|
59
|
+
boundaries: "694a35b5b8b5c5f803078908",
|
|
60
|
+
userInteraction: "694a35b5b8b5c5f803078909",
|
|
61
|
+
errorHandling: "694a35b5b8b5c5f80307890a",
|
|
62
|
+
learning: "694a35b5b8b5c5f80307890b",
|
|
63
|
+
escalation: "694a35b5b8b5c5f80307890c",
|
|
64
|
+
auditLogging: "694a35b5b8b5c5f80307890d",
|
|
65
|
+
agentCount: "694a35b5b8b5c5f803078902",
|
|
66
|
+
multiAllowed: "694a35b5b8b5c5f80307890e",
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
exports.TEAMS = {
|
|
70
|
+
workflowId: "694a35b5b8b5c5f8030788e6",
|
|
71
|
+
phases: {
|
|
72
|
+
active: "694a35b5b8b5c5f80307891a",
|
|
73
|
+
},
|
|
74
|
+
fields: {
|
|
75
|
+
info: "694a35b5b8b5c5f803078919",
|
|
76
|
+
leader: "694a35b5b8b5c5f8030788e9",
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
exports.TOOL_REGISTRY = {
|
|
80
|
+
workflowId: "694a35b5b8b5c5f803078922",
|
|
81
|
+
phases: {
|
|
82
|
+
active: "694a35b5b8b5c5f803078927",
|
|
83
|
+
},
|
|
84
|
+
fields: {
|
|
85
|
+
baseUrl: "694a35b5b8b5c5f803078923",
|
|
86
|
+
protocolVersion: "694a35b5b8b5c5f803078924",
|
|
87
|
+
toolRegistry: "694a35b5b8b5c5f803078925",
|
|
88
|
+
logEntryBy: "694a35b5b8b5c5f803078926",
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
exports.MCP_CONFIG = {
|
|
92
|
+
workflowId: "694a35b5b8b5c5f803078928",
|
|
93
|
+
phases: {
|
|
94
|
+
active: "694a35b5b8b5c5f80307893b",
|
|
95
|
+
},
|
|
96
|
+
fields: {
|
|
97
|
+
agentName: "694a35b5b8b5c5f803078929",
|
|
98
|
+
agentId: "694a35b5b8b5c5f80307892a",
|
|
99
|
+
publicKey: "694a35b5b8b5c5f80307892c",
|
|
100
|
+
accessTo: "694a35b5b8b5c5f80307892b",
|
|
101
|
+
authToken: "694a35b5b8b5c5f80307892d",
|
|
102
|
+
apiKey: "694a35b5b8b5c5f80307892e",
|
|
103
|
+
workspaceId: "694a35b5b8b5c5f803078934",
|
|
104
|
+
permissions: "694a35b5b8b5c5f803078935",
|
|
105
|
+
sessionId: "694a35b5b8b5c5f803078936",
|
|
106
|
+
resourceLimits: "694a35b5b8b5c5f803078937",
|
|
107
|
+
loggingEndpoint: "694a35b5b8b5c5f803078938",
|
|
108
|
+
callbackUrl: "694a35b5b8b5c5f803078939",
|
|
109
|
+
customContext: "694a35b5b8b5c5f80307893a",
|
|
110
|
+
permCreate: "694a35b5b8b5c5f803078930",
|
|
111
|
+
permRead: "694a35b5b8b5c5f803078931",
|
|
112
|
+
permUpdate: "694a35b5b8b5c5f803078932",
|
|
113
|
+
permDelete: "694a35b5b8b5c5f803078933",
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
// ===== CONSTANTS =====
|
|
117
|
+
exports.SESSION_IDLE_TIMEOUT = 60_000; // 60 seconds
|
|
118
|
+
// Export AVAILABLE_BOTS from bot-config tools (single source of truth)
|
|
119
|
+
var bot_config_1 = require("../../mcp/tools/bot-config");
|
|
120
|
+
Object.defineProperty(exports, "AVAILABLE_BOTS", { enumerable: true, get: function () { return bot_config_1.AVAILABLE_BOTS; } });
|
|
121
|
+
//# sourceMappingURL=types.js.map
|