bc-code-intelligence-mcp 1.1.1 → 1.2.0
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/README.md +99 -9
- package/dist/cli/bc-code-intel-cli.js +0 -1
- package/dist/cli/bc-code-intel-cli.js.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +82 -5
- package/dist/index.js.map +1 -1
- package/dist/layers/embedded-layer.d.ts +74 -0
- package/dist/layers/embedded-layer.d.ts.map +1 -1
- package/dist/layers/embedded-layer.js +287 -3
- package/dist/layers/embedded-layer.js.map +1 -1
- package/dist/layers/layer-service.d.ts +6 -0
- package/dist/layers/layer-service.d.ts.map +1 -1
- package/dist/layers/layer-service.js +13 -0
- package/dist/layers/layer-service.js.map +1 -1
- package/dist/services/agent-onboarding-service.d.ts +45 -0
- package/dist/services/agent-onboarding-service.d.ts.map +1 -0
- package/dist/services/agent-onboarding-service.js +372 -0
- package/dist/services/agent-onboarding-service.js.map +1 -0
- package/dist/services/enhanced-prompt-service.d.ts +60 -0
- package/dist/services/enhanced-prompt-service.d.ts.map +1 -0
- package/dist/services/enhanced-prompt-service.js +162 -0
- package/dist/services/enhanced-prompt-service.js.map +1 -0
- package/dist/services/multi-content-layer-service.d.ts +92 -0
- package/dist/services/multi-content-layer-service.d.ts.map +1 -0
- package/dist/services/multi-content-layer-service.js +407 -0
- package/dist/services/multi-content-layer-service.js.map +1 -0
- package/dist/services/roleplay-engine.d.ts +121 -0
- package/dist/services/roleplay-engine.d.ts.map +1 -0
- package/dist/services/roleplay-engine.js +672 -0
- package/dist/services/roleplay-engine.js.map +1 -0
- package/dist/services/session-storage/file-storage.d.ts +30 -0
- package/dist/services/session-storage/file-storage.d.ts.map +1 -0
- package/dist/services/session-storage/file-storage.js +229 -0
- package/dist/services/session-storage/file-storage.js.map +1 -0
- package/dist/services/session-storage/in-memory-storage.d.ts +31 -0
- package/dist/services/session-storage/in-memory-storage.d.ts.map +1 -0
- package/dist/services/session-storage/in-memory-storage.js +142 -0
- package/dist/services/session-storage/in-memory-storage.js.map +1 -0
- package/dist/services/specialist-discovery.d.ts +76 -0
- package/dist/services/specialist-discovery.d.ts.map +1 -0
- package/dist/services/specialist-discovery.js +270 -0
- package/dist/services/specialist-discovery.js.map +1 -0
- package/dist/services/specialist-handoff-service.d.ts +81 -0
- package/dist/services/specialist-handoff-service.d.ts.map +1 -0
- package/dist/services/specialist-handoff-service.js +470 -0
- package/dist/services/specialist-handoff-service.js.map +1 -0
- package/dist/services/specialist-loader.d.ts +101 -0
- package/dist/services/specialist-loader.d.ts.map +1 -0
- package/dist/services/specialist-loader.js +249 -0
- package/dist/services/specialist-loader.js.map +1 -0
- package/dist/services/specialist-session-manager.d.ts +76 -0
- package/dist/services/specialist-session-manager.d.ts.map +1 -0
- package/dist/services/specialist-session-manager.js +255 -0
- package/dist/services/specialist-session-manager.js.map +1 -0
- package/dist/tools/specialist-discovery-tools.d.ts +27 -0
- package/dist/tools/specialist-discovery-tools.d.ts.map +1 -0
- package/dist/tools/specialist-discovery-tools.js +287 -0
- package/dist/tools/specialist-discovery-tools.js.map +1 -0
- package/dist/tools/specialist-tools.d.ts +38 -0
- package/dist/tools/specialist-tools.d.ts.map +1 -0
- package/dist/tools/specialist-tools.js +322 -0
- package/dist/tools/specialist-tools.js.map +1 -0
- package/dist/types/config-types.d.ts +2 -0
- package/dist/types/config-types.d.ts.map +1 -1
- package/dist/types/config-types.js.map +1 -1
- package/dist/types/enhanced-layer-types.d.ts +193 -0
- package/dist/types/enhanced-layer-types.d.ts.map +1 -0
- package/dist/types/enhanced-layer-types.js +9 -0
- package/dist/types/enhanced-layer-types.js.map +1 -0
- package/dist/types/layer-types.d.ts +2 -0
- package/dist/types/layer-types.d.ts.map +1 -1
- package/dist/types/layer-types.js.map +1 -1
- package/dist/types/roleplay-types.d.ts +149 -0
- package/dist/types/roleplay-types.d.ts.map +1 -0
- package/dist/types/roleplay-types.js +8 -0
- package/dist/types/roleplay-types.js.map +1 -0
- package/dist/types/session-types.d.ts +111 -0
- package/dist/types/session-types.d.ts.map +1 -0
- package/dist/types/session-types.js +8 -0
- package/dist/types/session-types.js.map +1 -0
- package/embedded-knowledge/AGENTS.md +119 -10
- package/embedded-knowledge/README.md +20 -3
- package/embedded-knowledge/specialists/alex-architect.md +216 -0
- package/embedded-knowledge/specialists/casey-copilot.md +226 -0
- package/embedded-knowledge/specialists/dean-debug.md +222 -0
- package/embedded-knowledge/specialists/eva-errors.md +235 -0
- package/embedded-knowledge/specialists/jordan-bridge.md +235 -0
- package/embedded-knowledge/specialists/logan-legacy.md +209 -0
- package/embedded-knowledge/specialists/maya-mentor.md +211 -0
- package/embedded-knowledge/specialists/morgan-market.md +226 -0
- package/embedded-knowledge/specialists/quinn-tester.md +235 -0
- package/embedded-knowledge/specialists/roger-reviewer.md +234 -0
- package/embedded-knowledge/specialists/sam-coder.md +181 -0
- package/embedded-knowledge/specialists/seth-security.md +235 -0
- package/embedded-knowledge/specialists/taylor-docs.md +257 -0
- package/embedded-knowledge/specialists/uma-ux.md +235 -0
- package/package.json +3 -3
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Specialist Loader Service
|
|
3
|
+
*
|
|
4
|
+
* Loads and parses specialist persona definitions from markdown files
|
|
5
|
+
* with rich YAML frontmatter including personality traits, collaboration
|
|
6
|
+
* patterns, and roleplay information.
|
|
7
|
+
*/
|
|
8
|
+
import * as fs from 'fs/promises';
|
|
9
|
+
import * as path from 'path';
|
|
10
|
+
import * as yaml from 'yaml';
|
|
11
|
+
export class SpecialistLoader {
|
|
12
|
+
specialistsPath;
|
|
13
|
+
specialistCache = new Map();
|
|
14
|
+
loaded = false;
|
|
15
|
+
constructor(specialistsPath) {
|
|
16
|
+
this.specialistsPath = specialistsPath;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Load all specialist definitions from the specialists folder
|
|
20
|
+
*/
|
|
21
|
+
async loadAllSpecialists() {
|
|
22
|
+
if (this.loaded && this.specialistCache.size > 0) {
|
|
23
|
+
return this.specialistCache;
|
|
24
|
+
}
|
|
25
|
+
console.error('📋 Loading specialist personas...');
|
|
26
|
+
try {
|
|
27
|
+
const specialistFiles = await fs.readdir(this.specialistsPath);
|
|
28
|
+
const markdownFiles = specialistFiles.filter(file => file.endsWith('.md'));
|
|
29
|
+
console.error(`📋 Found ${markdownFiles.length} specialist files`);
|
|
30
|
+
for (const file of markdownFiles) {
|
|
31
|
+
const filePath = path.join(this.specialistsPath, file);
|
|
32
|
+
const specialist = await this.loadSpecialist(filePath);
|
|
33
|
+
if (specialist) {
|
|
34
|
+
this.specialistCache.set(specialist.specialist_id, specialist);
|
|
35
|
+
console.error(`✅ Loaded specialist: ${specialist.specialist_id} (${specialist.title})`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
this.loaded = true;
|
|
39
|
+
console.error(`🎭 Successfully loaded ${this.specialistCache.size} specialists`);
|
|
40
|
+
return this.specialistCache;
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
console.error('❌ Failed to load specialists:', error);
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Load a single specialist from a markdown file
|
|
49
|
+
*/
|
|
50
|
+
async loadSpecialist(filePath) {
|
|
51
|
+
try {
|
|
52
|
+
const fileContent = await fs.readFile(filePath, 'utf-8');
|
|
53
|
+
return this.parseSpecialistFile(fileContent, filePath);
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
console.error(`❌ Failed to load specialist from ${filePath}:`, error);
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Parse specialist markdown file with YAML frontmatter
|
|
62
|
+
*/
|
|
63
|
+
parseSpecialistFile(content, filePath) {
|
|
64
|
+
try {
|
|
65
|
+
// Extract frontmatter and content
|
|
66
|
+
const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
67
|
+
if (!frontmatterMatch) {
|
|
68
|
+
console.error(`⚠️ No frontmatter found in ${filePath}`);
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
const [, frontmatterStr, markdownContent] = frontmatterMatch;
|
|
72
|
+
// Parse YAML frontmatter
|
|
73
|
+
const frontmatter = yaml.parse(frontmatterStr);
|
|
74
|
+
// Validate required fields
|
|
75
|
+
if (!frontmatter.specialist_id || !frontmatter.title) {
|
|
76
|
+
console.error(`⚠️ Missing required fields in ${filePath}`);
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
// Create specialist definition
|
|
80
|
+
const specialist = {
|
|
81
|
+
title: frontmatter.title,
|
|
82
|
+
specialist_id: frontmatter.specialist_id,
|
|
83
|
+
emoji: frontmatter.emoji || '🤖',
|
|
84
|
+
role: frontmatter.role || 'Specialist',
|
|
85
|
+
team: frontmatter.team || 'General',
|
|
86
|
+
persona: {
|
|
87
|
+
personality: frontmatter.persona?.personality || [],
|
|
88
|
+
communication_style: frontmatter.persona?.communication_style || '',
|
|
89
|
+
greeting: frontmatter.persona?.greeting || `${frontmatter.emoji || '🤖'} Hello!`
|
|
90
|
+
},
|
|
91
|
+
expertise: {
|
|
92
|
+
primary: frontmatter.expertise?.primary || [],
|
|
93
|
+
secondary: frontmatter.expertise?.secondary || []
|
|
94
|
+
},
|
|
95
|
+
domains: frontmatter.domains || [],
|
|
96
|
+
when_to_use: frontmatter.when_to_use || [],
|
|
97
|
+
collaboration: {
|
|
98
|
+
natural_handoffs: frontmatter.collaboration?.natural_handoffs || [],
|
|
99
|
+
team_consultations: frontmatter.collaboration?.team_consultations || []
|
|
100
|
+
},
|
|
101
|
+
related_specialists: frontmatter.related_specialists || [],
|
|
102
|
+
content: markdownContent.trim()
|
|
103
|
+
};
|
|
104
|
+
return specialist;
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
console.error(`❌ Failed to parse specialist file ${filePath}:`, error);
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Get a specific specialist by ID
|
|
113
|
+
*/
|
|
114
|
+
async getSpecialist(specialistId) {
|
|
115
|
+
if (!this.loaded) {
|
|
116
|
+
await this.loadAllSpecialists();
|
|
117
|
+
}
|
|
118
|
+
return this.specialistCache.get(specialistId) || null;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Get all loaded specialists
|
|
122
|
+
*/
|
|
123
|
+
async getAllSpecialists() {
|
|
124
|
+
if (!this.loaded) {
|
|
125
|
+
await this.loadAllSpecialists();
|
|
126
|
+
}
|
|
127
|
+
return Array.from(this.specialistCache.values());
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Get specialists by team
|
|
131
|
+
*/
|
|
132
|
+
async getSpecialistsByTeam(team) {
|
|
133
|
+
const specialists = await this.getAllSpecialists();
|
|
134
|
+
return specialists.filter(s => s.team === team);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Get specialists by domain expertise
|
|
138
|
+
*/
|
|
139
|
+
async getSpecialistsByDomain(domain) {
|
|
140
|
+
const specialists = await this.getAllSpecialists();
|
|
141
|
+
return specialists.filter(s => s.domains.includes(domain));
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Extract character guide sections from specialist content
|
|
145
|
+
*/
|
|
146
|
+
extractCharacterGuide(specialist) {
|
|
147
|
+
const content = specialist.content;
|
|
148
|
+
// Extract major sections using markdown headers
|
|
149
|
+
const sections = content.split(/(?=^##\s)/m);
|
|
150
|
+
return {
|
|
151
|
+
identity_section: this.extractSection(sections, 'Character Identity') || '',
|
|
152
|
+
process_section: this.extractSection(sections, 'Process') || '',
|
|
153
|
+
examples_section: this.extractSection(sections, 'Examples') || '',
|
|
154
|
+
collaboration_section: this.extractSection(sections, 'Collaboration') || ''
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
extractSection(sections, sectionName) {
|
|
158
|
+
const section = sections.find(s => s.toLowerCase().includes(sectionName.toLowerCase()));
|
|
159
|
+
return section ? section.trim() : '';
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Find specialists who can collaborate with the given specialist
|
|
163
|
+
*/
|
|
164
|
+
async getCollaborators(specialistId) {
|
|
165
|
+
const specialist = await this.getSpecialist(specialistId);
|
|
166
|
+
if (!specialist) {
|
|
167
|
+
return { handoffs: [], consultations: [], related: [] };
|
|
168
|
+
}
|
|
169
|
+
const allSpecialists = await this.getAllSpecialists();
|
|
170
|
+
const handoffs = specialist.collaboration.natural_handoffs
|
|
171
|
+
.map(id => allSpecialists.find(s => s.specialist_id === id))
|
|
172
|
+
.filter(s => s);
|
|
173
|
+
const consultations = specialist.collaboration.team_consultations
|
|
174
|
+
.map(id => allSpecialists.find(s => s.specialist_id === id))
|
|
175
|
+
.filter(s => s);
|
|
176
|
+
const related = specialist.related_specialists
|
|
177
|
+
.map(id => allSpecialists.find(s => s.specialist_id === id))
|
|
178
|
+
.filter(s => s);
|
|
179
|
+
return { handoffs, consultations, related };
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Get specialist suggestions for a given context or problem
|
|
183
|
+
*/
|
|
184
|
+
async suggestSpecialist(context, problemType) {
|
|
185
|
+
const specialists = await this.getAllSpecialists();
|
|
186
|
+
const suggestions = [];
|
|
187
|
+
for (const specialist of specialists) {
|
|
188
|
+
let score = 0;
|
|
189
|
+
// Check when_to_use scenarios
|
|
190
|
+
for (const scenario of specialist.when_to_use) {
|
|
191
|
+
if (context.toLowerCase().includes(scenario.toLowerCase()) ||
|
|
192
|
+
scenario.toLowerCase().includes(context.toLowerCase())) {
|
|
193
|
+
score += 10;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
// Check expertise areas
|
|
197
|
+
for (const expertise of [...specialist.expertise.primary, ...specialist.expertise.secondary]) {
|
|
198
|
+
if (context.toLowerCase().includes(expertise.toLowerCase()) ||
|
|
199
|
+
expertise.toLowerCase().includes(context.toLowerCase())) {
|
|
200
|
+
score += specialist.expertise.primary.includes(expertise) ? 8 : 5;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
// Check domains
|
|
204
|
+
for (const domain of specialist.domains) {
|
|
205
|
+
if (context.toLowerCase().includes(domain.toLowerCase()) ||
|
|
206
|
+
domain.toLowerCase().includes(context.toLowerCase())) {
|
|
207
|
+
score += 6;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
if (score > 0) {
|
|
211
|
+
suggestions.push({ specialist, score });
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
// Sort by score and return top suggestions
|
|
215
|
+
return suggestions
|
|
216
|
+
.sort((a, b) => b.score - a.score)
|
|
217
|
+
.slice(0, 5)
|
|
218
|
+
.map(s => s.specialist);
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Get statistics about loaded specialists
|
|
222
|
+
*/
|
|
223
|
+
getStatistics() {
|
|
224
|
+
const specialists = Array.from(this.specialistCache.values());
|
|
225
|
+
const teams = {};
|
|
226
|
+
const domains = {};
|
|
227
|
+
let totalCollaborators = 0;
|
|
228
|
+
for (const specialist of specialists) {
|
|
229
|
+
// Count teams
|
|
230
|
+
teams[specialist.team] = (teams[specialist.team] || 0) + 1;
|
|
231
|
+
// Count domains
|
|
232
|
+
for (const domain of specialist.domains) {
|
|
233
|
+
domains[domain] = (domains[domain] || 0) + 1;
|
|
234
|
+
}
|
|
235
|
+
// Count collaborators
|
|
236
|
+
totalCollaborators +=
|
|
237
|
+
specialist.collaboration.natural_handoffs.length +
|
|
238
|
+
specialist.collaboration.team_consultations.length +
|
|
239
|
+
specialist.related_specialists.length;
|
|
240
|
+
}
|
|
241
|
+
return {
|
|
242
|
+
total_specialists: specialists.length,
|
|
243
|
+
teams,
|
|
244
|
+
domains,
|
|
245
|
+
average_collaborators: specialists.length > 0 ? totalCollaborators / specialists.length : 0
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
//# sourceMappingURL=specialist-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"specialist-loader.js","sourceRoot":"","sources":["../../src/services/specialist-loader.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAwC7B,MAAM,OAAO,gBAAgB;IAIP;IAHZ,eAAe,GAAG,IAAI,GAAG,EAAgC,CAAC;IAC1D,MAAM,GAAG,KAAK,CAAC;IAEvB,YAAoB,eAAuB;QAAvB,oBAAe,GAAf,eAAe,CAAQ;IAAG,CAAC;IAE/C;;OAEG;IACH,KAAK,CAAC,kBAAkB;QACtB,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;YACjD,OAAO,IAAI,CAAC,eAAe,CAAC;QAC9B,CAAC;QAED,OAAO,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;QAEnD,IAAI,CAAC;YACH,MAAM,eAAe,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YAC/D,MAAM,aAAa,GAAG,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;YAE3E,OAAO,CAAC,KAAK,CAAC,YAAY,aAAa,CAAC,MAAM,mBAAmB,CAAC,CAAC;YAEnE,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE,CAAC;gBACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;gBACvD,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,c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* Specialist Session Manager
|
|
3
|
+
*
|
|
4
|
+
* Manages persistent, contextual conversations with BC specialist personas.
|
|
5
|
+
* Supports in-memory sessions by default with layer-configurable persistence.
|
|
6
|
+
*/
|
|
7
|
+
import { SpecialistSession, SessionSummary, SessionMessage, SessionContext, SessionManager, SessionStorageConfig, SessionEvents } from '../types/session-types.js';
|
|
8
|
+
import { MultiContentLayerService } from './multi-content-layer-service.js';
|
|
9
|
+
export declare class SpecialistSessionManager implements SessionManager {
|
|
10
|
+
private storage;
|
|
11
|
+
private layerService;
|
|
12
|
+
private events;
|
|
13
|
+
constructor(layerService: MultiContentLayerService, storageConfig?: SessionStorageConfig);
|
|
14
|
+
/**
|
|
15
|
+
* Start a new specialist session
|
|
16
|
+
*/
|
|
17
|
+
startSession(specialistId: string, userId: string, initialMessage?: string): Promise<SpecialistSession>;
|
|
18
|
+
/**
|
|
19
|
+
* Get existing session
|
|
20
|
+
*/
|
|
21
|
+
getSession(sessionId: string): Promise<SpecialistSession | null>;
|
|
22
|
+
/**
|
|
23
|
+
* Continue existing session with new message
|
|
24
|
+
*/
|
|
25
|
+
continueSession(sessionId: string, message: string): Promise<SpecialistSession>;
|
|
26
|
+
/**
|
|
27
|
+
* Transfer session to different specialist
|
|
28
|
+
*/
|
|
29
|
+
transferSession(sessionId: string, toSpecialistId: string): Promise<SpecialistSession>;
|
|
30
|
+
/**
|
|
31
|
+
* End session
|
|
32
|
+
*/
|
|
33
|
+
endSession(sessionId: string): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* List user's sessions
|
|
36
|
+
*/
|
|
37
|
+
listUserSessions(userId: string): Promise<SessionSummary[]>;
|
|
38
|
+
/**
|
|
39
|
+
* List user's active sessions
|
|
40
|
+
*/
|
|
41
|
+
listActiveSessions(userId: string): Promise<SessionSummary[]>;
|
|
42
|
+
/**
|
|
43
|
+
* Add message to session
|
|
44
|
+
*/
|
|
45
|
+
addMessage(sessionId: string, message: SessionMessage): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Update session context
|
|
48
|
+
*/
|
|
49
|
+
updateContext(sessionId: string, context: Partial<SessionContext>): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Cleanup expired sessions
|
|
52
|
+
*/
|
|
53
|
+
cleanupSessions(): Promise<number>;
|
|
54
|
+
/**
|
|
55
|
+
* Subscribe to session events
|
|
56
|
+
*/
|
|
57
|
+
on<K extends keyof SessionEvents>(event: K, handler: SessionEvents[K]): void;
|
|
58
|
+
/**
|
|
59
|
+
* Get session statistics
|
|
60
|
+
*/
|
|
61
|
+
getSessionStats(userId?: string): Promise<{
|
|
62
|
+
totalSessions: number;
|
|
63
|
+
activeSessions: number;
|
|
64
|
+
totalMessages: number;
|
|
65
|
+
averageSessionLength: number;
|
|
66
|
+
}>;
|
|
67
|
+
/**
|
|
68
|
+
* Initialize storage based on configuration
|
|
69
|
+
*/
|
|
70
|
+
private initializeStorage;
|
|
71
|
+
/**
|
|
72
|
+
* Get all session summaries (for stats)
|
|
73
|
+
*/
|
|
74
|
+
private getAllSessionSummaries;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=specialist-session-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"specialist-session-manager.d.ts","sourceRoot":"","sources":["../../src/services/specialist-session-manager.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EAEd,oBAAoB,EACpB,aAAa,EACd,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,qBAAa,wBAAyB,YAAW,cAAc;IAC7D,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,MAAM,CAA8B;gBAG1C,YAAY,EAAE,wBAAwB,EACtC,aAAa,CAAC,EAAE,oBAAoB;IAQtC;;OAEG;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QACvB,aAAa,EAAE,MAAM,CAAC;QACtB,oBAAoB,EAAE,MAAM,CAAC;KAC9B,CAAC;IAkBF;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAwBzB;;OAEG;YACW,sBAAsB;CAUrC"}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Specialist Session Manager
|
|
3
|
+
*
|
|
4
|
+
* Manages persistent, contextual conversations with BC specialist personas.
|
|
5
|
+
* Supports in-memory sessions by default with layer-configurable persistence.
|
|
6
|
+
*/
|
|
7
|
+
import { randomUUID } from 'crypto';
|
|
8
|
+
import { InMemorySessionStorage } from './session-storage/in-memory-storage.js';
|
|
9
|
+
import { FileSessionStorage } from './session-storage/file-storage.js';
|
|
10
|
+
export class SpecialistSessionManager {
|
|
11
|
+
storage;
|
|
12
|
+
layerService;
|
|
13
|
+
events = {};
|
|
14
|
+
constructor(layerService, storageConfig) {
|
|
15
|
+
this.layerService = layerService;
|
|
16
|
+
// Initialize storage based on configuration
|
|
17
|
+
this.storage = this.initializeStorage(storageConfig);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Start a new specialist session
|
|
21
|
+
*/
|
|
22
|
+
async startSession(specialistId, userId, initialMessage) {
|
|
23
|
+
// Validate specialist exists
|
|
24
|
+
const specialists = await this.layerService.getAllSpecialists();
|
|
25
|
+
const specialist = specialists.find(s => s.specialist_id === specialistId);
|
|
26
|
+
if (!specialist) {
|
|
27
|
+
throw new Error(`Specialist '${specialistId}' not found`);
|
|
28
|
+
}
|
|
29
|
+
const sessionId = randomUUID();
|
|
30
|
+
const now = new Date();
|
|
31
|
+
const session = {
|
|
32
|
+
sessionId,
|
|
33
|
+
specialistId,
|
|
34
|
+
userId,
|
|
35
|
+
startTime: now,
|
|
36
|
+
lastActivity: now,
|
|
37
|
+
status: 'active',
|
|
38
|
+
messages: [],
|
|
39
|
+
messageCount: 0,
|
|
40
|
+
context: {
|
|
41
|
+
solutions: [],
|
|
42
|
+
recommendations: [],
|
|
43
|
+
nextSteps: [],
|
|
44
|
+
userPreferences: {}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
// Add initial message if provided
|
|
48
|
+
if (initialMessage) {
|
|
49
|
+
const initialMsg = {
|
|
50
|
+
id: randomUUID(),
|
|
51
|
+
timestamp: now,
|
|
52
|
+
type: 'user',
|
|
53
|
+
content: initialMessage
|
|
54
|
+
};
|
|
55
|
+
session.messages.push(initialMsg);
|
|
56
|
+
session.messageCount = 1;
|
|
57
|
+
}
|
|
58
|
+
await this.storage.createSession(session);
|
|
59
|
+
// Emit event
|
|
60
|
+
this.events.sessionStarted?.(session);
|
|
61
|
+
return session;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get existing session
|
|
65
|
+
*/
|
|
66
|
+
async getSession(sessionId) {
|
|
67
|
+
return await this.storage.getSession(sessionId);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Continue existing session with new message
|
|
71
|
+
*/
|
|
72
|
+
async continueSession(sessionId, message) {
|
|
73
|
+
const session = await this.storage.getSession(sessionId);
|
|
74
|
+
if (!session) {
|
|
75
|
+
throw new Error(`Session '${sessionId}' not found`);
|
|
76
|
+
}
|
|
77
|
+
// Add user message
|
|
78
|
+
const userMessage = {
|
|
79
|
+
id: randomUUID(),
|
|
80
|
+
timestamp: new Date(),
|
|
81
|
+
type: 'user',
|
|
82
|
+
content: message
|
|
83
|
+
};
|
|
84
|
+
await this.addMessage(sessionId, userMessage);
|
|
85
|
+
return await this.storage.getSession(sessionId);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Transfer session to different specialist
|
|
89
|
+
*/
|
|
90
|
+
async transferSession(sessionId, toSpecialistId) {
|
|
91
|
+
const session = await this.storage.getSession(sessionId);
|
|
92
|
+
if (!session) {
|
|
93
|
+
throw new Error(`Session '${sessionId}' not found`);
|
|
94
|
+
}
|
|
95
|
+
// Validate target specialist exists
|
|
96
|
+
const specialists = await this.layerService.getAllSpecialists();
|
|
97
|
+
const targetSpecialist = specialists.find(s => s.specialist_id === toSpecialistId);
|
|
98
|
+
if (!targetSpecialist) {
|
|
99
|
+
throw new Error(`Target specialist '${toSpecialistId}' not found`);
|
|
100
|
+
}
|
|
101
|
+
const fromSpecialistId = session.specialistId;
|
|
102
|
+
// Update session
|
|
103
|
+
session.transferredFrom = session.specialistId;
|
|
104
|
+
session.specialistId = toSpecialistId;
|
|
105
|
+
session.transferredTo = toSpecialistId;
|
|
106
|
+
session.lastActivity = new Date();
|
|
107
|
+
// Add transfer message
|
|
108
|
+
const transferMessage = {
|
|
109
|
+
id: randomUUID(),
|
|
110
|
+
timestamp: new Date(),
|
|
111
|
+
type: 'specialist',
|
|
112
|
+
specialistId: 'system',
|
|
113
|
+
content: `Session transferred from ${fromSpecialistId} to ${toSpecialistId}`
|
|
114
|
+
};
|
|
115
|
+
session.messages.push(transferMessage);
|
|
116
|
+
session.messageCount++;
|
|
117
|
+
await this.storage.updateSession(session);
|
|
118
|
+
// Emit event
|
|
119
|
+
this.events.sessionTransferred?.(sessionId, fromSpecialistId, toSpecialistId);
|
|
120
|
+
return session;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* End session
|
|
124
|
+
*/
|
|
125
|
+
async endSession(sessionId) {
|
|
126
|
+
const session = await this.storage.getSession(sessionId);
|
|
127
|
+
if (!session) {
|
|
128
|
+
throw new Error(`Session '${sessionId}' not found`);
|
|
129
|
+
}
|
|
130
|
+
session.status = 'completed';
|
|
131
|
+
session.lastActivity = new Date();
|
|
132
|
+
await this.storage.updateSession(session);
|
|
133
|
+
// Emit event
|
|
134
|
+
this.events.sessionEnded?.(sessionId);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* List user's sessions
|
|
138
|
+
*/
|
|
139
|
+
async listUserSessions(userId) {
|
|
140
|
+
return await this.storage.getUserSessions(userId);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* List user's active sessions
|
|
144
|
+
*/
|
|
145
|
+
async listActiveSessions(userId) {
|
|
146
|
+
return await this.storage.getActiveSessions(userId);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Add message to session
|
|
150
|
+
*/
|
|
151
|
+
async addMessage(sessionId, message) {
|
|
152
|
+
const session = await this.storage.getSession(sessionId);
|
|
153
|
+
if (!session) {
|
|
154
|
+
throw new Error(`Session '${sessionId}' not found`);
|
|
155
|
+
}
|
|
156
|
+
session.messages.push(message);
|
|
157
|
+
session.messageCount++;
|
|
158
|
+
session.lastActivity = new Date();
|
|
159
|
+
// Update session status to active if it was paused
|
|
160
|
+
if (session.status === 'paused') {
|
|
161
|
+
session.status = 'active';
|
|
162
|
+
}
|
|
163
|
+
await this.storage.updateSession(session);
|
|
164
|
+
// Emit event
|
|
165
|
+
this.events.messageAdded?.(sessionId, message);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Update session context
|
|
169
|
+
*/
|
|
170
|
+
async updateContext(sessionId, context) {
|
|
171
|
+
const session = await this.storage.getSession(sessionId);
|
|
172
|
+
if (!session) {
|
|
173
|
+
throw new Error(`Session '${sessionId}' not found`);
|
|
174
|
+
}
|
|
175
|
+
// Merge context updates
|
|
176
|
+
session.context = {
|
|
177
|
+
...session.context,
|
|
178
|
+
...context,
|
|
179
|
+
// Handle array merging properly
|
|
180
|
+
solutions: [...(session.context.solutions || []), ...(context.solutions || [])],
|
|
181
|
+
recommendations: [...(session.context.recommendations || []), ...(context.recommendations || [])],
|
|
182
|
+
nextSteps: [...(session.context.nextSteps || []), ...(context.nextSteps || [])],
|
|
183
|
+
userPreferences: {
|
|
184
|
+
...session.context.userPreferences,
|
|
185
|
+
...context.userPreferences
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
session.lastActivity = new Date();
|
|
189
|
+
await this.storage.updateSession(session);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Cleanup expired sessions
|
|
193
|
+
*/
|
|
194
|
+
async cleanupSessions() {
|
|
195
|
+
return await this.storage.cleanupExpiredSessions();
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Subscribe to session events
|
|
199
|
+
*/
|
|
200
|
+
on(event, handler) {
|
|
201
|
+
this.events[event] = handler;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Get session statistics
|
|
205
|
+
*/
|
|
206
|
+
async getSessionStats(userId) {
|
|
207
|
+
const sessions = userId
|
|
208
|
+
? await this.storage.getUserSessions(userId)
|
|
209
|
+
: await this.getAllSessionSummaries();
|
|
210
|
+
const totalSessions = sessions.length;
|
|
211
|
+
const activeSessions = sessions.filter(s => s.status === 'active' || s.status === 'paused').length;
|
|
212
|
+
const totalMessages = sessions.reduce((sum, s) => sum + s.messageCount, 0);
|
|
213
|
+
const averageSessionLength = totalSessions > 0 ? totalMessages / totalSessions : 0;
|
|
214
|
+
return {
|
|
215
|
+
totalSessions,
|
|
216
|
+
activeSessions,
|
|
217
|
+
totalMessages,
|
|
218
|
+
averageSessionLength: Math.round(averageSessionLength * 100) / 100
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Initialize storage based on configuration
|
|
223
|
+
*/
|
|
224
|
+
initializeStorage(config) {
|
|
225
|
+
console.error(`🗄️ Initializing session storage: ${config?.type || 'memory'}`);
|
|
226
|
+
switch (config?.type || 'memory') {
|
|
227
|
+
case 'memory':
|
|
228
|
+
return new InMemorySessionStorage(config);
|
|
229
|
+
case 'file':
|
|
230
|
+
return new FileSessionStorage(config);
|
|
231
|
+
case 'database':
|
|
232
|
+
// TODO: Implement DatabaseSessionStorage
|
|
233
|
+
throw new Error('Database storage not yet implemented. Use memory or file storage for now.');
|
|
234
|
+
case 'mcp':
|
|
235
|
+
// TODO: Implement MCPSessionStorage
|
|
236
|
+
throw new Error('MCP storage not yet implemented. Use memory or file storage for now.');
|
|
237
|
+
default:
|
|
238
|
+
console.warn(`Unknown storage type '${config?.type}', falling back to memory storage`);
|
|
239
|
+
return new InMemorySessionStorage(config);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Get all session summaries (for stats)
|
|
244
|
+
*/
|
|
245
|
+
async getAllSessionSummaries() {
|
|
246
|
+
// This is a bit of a hack since we don't have a "get all sessions" method
|
|
247
|
+
// In practice, this would be implemented differently for each storage backend
|
|
248
|
+
if (this.storage instanceof InMemorySessionStorage) {
|
|
249
|
+
// For in-memory storage, we can access the internal data
|
|
250
|
+
return []; // Simplified for now
|
|
251
|
+
}
|
|
252
|
+
return [];
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
//# sourceMappingURL=specialist-session-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"specialist-session-manager.js","sourceRoot":"","sources":["../../src/services/specialist-session-manager.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAWpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAGvE,MAAM,OAAO,wBAAwB;IAC3B,OAAO,CAAiB;IACxB,YAAY,CAA2B;IACvC,MAAM,GAA2B,EAAE,CAAC;IAE5C,YACE,YAAsC,EACtC,aAAoC;QAEpC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QAEjC,4CAA4C;QAC5C,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC;IACvD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY,CAChB,YAAoB,EACpB,MAAc,EACd,cAAuB;QAEvB,6BAA6B;QAC7B,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,iBAAiB,EAAE,CAAC;QAChE,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC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I,IAAI,CAAC,OAAO,YAAY,sBAAsB,EAAE,CAAC;YACnD,yDAAyD;YACzD,OAAO,EAAE,CAAC,CAAE,qBAAqB;QACnC,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;CACF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tools for Specialist Discovery and Management
|
|
3
|
+
*
|
|
4
|
+
* Provides tools for discovering specialists, getting recommendations,
|
|
5
|
+
* and managing specialist interactions.
|
|
6
|
+
*/
|
|
7
|
+
import { CallToolRequest, CallToolResult, Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
8
|
+
import { SpecialistDiscoveryService } from '../services/specialist-discovery.js';
|
|
9
|
+
import { SpecialistSessionManager } from '../services/specialist-session-manager.js';
|
|
10
|
+
import { MultiContentLayerService } from '../services/multi-content-layer-service.js';
|
|
11
|
+
export declare const SPECIALIST_DISCOVERY_TOOLS: Tool[];
|
|
12
|
+
export declare class SpecialistDiscoveryTools {
|
|
13
|
+
private discoveryService;
|
|
14
|
+
private sessionManager;
|
|
15
|
+
private layerService;
|
|
16
|
+
constructor(discoveryService: SpecialistDiscoveryService, sessionManager: SpecialistSessionManager, layerService: MultiContentLayerService);
|
|
17
|
+
/**
|
|
18
|
+
* Get tool definitions for MCP registration
|
|
19
|
+
*/
|
|
20
|
+
getToolDefinitions(): Tool[];
|
|
21
|
+
handleToolCall(request: CallToolRequest): Promise<CallToolResult>;
|
|
22
|
+
private discoverSpecialists;
|
|
23
|
+
private browseSpecialists;
|
|
24
|
+
private getSpecialistInfo;
|
|
25
|
+
private generateExampleQuery;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=specialist-discovery-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"specialist-discovery-tools.d.ts","sourceRoot":"","sources":["../../src/tools/specialist-discovery-tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAE3F,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAmBtF,eAAO,MAAM,0BAA0B,EAAE,IAAI,EA+D5C,CAAC;AAEF,qBAAa,wBAAwB;IAEjC,OAAO,CAAC,gBAAgB;IACxB,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,YAAY;gBAFZ,gBAAgB,EAAE,0BAA0B,EAC5C,cAAc,EAAE,wBAAwB,EACxC,YAAY,EAAE,wBAAwB;IAGhD;;OAEG;IACH,kBAAkB,IAAI,IAAI,EAAE;IAItB,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;YAyBzD,mBAAmB;YA2DnB,iBAAiB;YAwDjB,iBAAiB;IAqE/B,OAAO,CAAC,oBAAoB;CAW7B"}
|