bc-code-intelligence-mcp 1.7.1 → 1.7.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/dist/cli.js +45 -44
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +330 -302
- package/dist/index.js.map +1 -1
- package/dist/layers/embedded-layer.d.ts +4 -4
- package/dist/layers/embedded-layer.d.ts.map +1 -1
- package/dist/layers/embedded-layer.js +118 -96
- package/dist/layers/embedded-layer.js.map +1 -1
- package/dist/layers/git-layer.d.ts +3 -3
- package/dist/layers/git-layer.d.ts.map +1 -1
- package/dist/layers/git-layer.js +115 -98
- package/dist/layers/git-layer.js.map +1 -1
- package/dist/layers/project-layer.d.ts +2 -2
- package/dist/layers/project-layer.d.ts.map +1 -1
- package/dist/layers/project-layer.js +44 -40
- package/dist/layers/project-layer.js.map +1 -1
- package/dist/sdk/bc-code-intel-client.d.ts +1 -1
- package/dist/sdk/bc-code-intel-client.js +40 -40
- package/dist/tools/ask_bc_expert/handler.d.ts.map +1 -1
- package/dist/tools/ask_bc_expert/handler.js +71 -50
- package/dist/tools/ask_bc_expert/handler.js.map +1 -1
- package/dist/types/bc-knowledge.d.ts +1 -1
- package/dist/types/bc-knowledge.d.ts.map +1 -1
- package/dist/types/bc-knowledge.js +105 -33
- package/dist/types/bc-knowledge.js.map +1 -1
- package/dist/types/config-types.d.ts +9 -9
- package/dist/types/config-types.d.ts.map +1 -1
- package/dist/types/config-types.js +38 -38
- package/dist/types/config-types.js.map +1 -1
- package/package.json +1 -1
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Loads project-specific knowledge overrides from ./bckb-overrides/ directory.
|
|
5
5
|
* This is the highest priority layer that can override any embedded knowledge.
|
|
6
6
|
*/
|
|
7
|
-
import { LayerLoadResult } from
|
|
8
|
-
import { BaseKnowledgeLayer } from
|
|
7
|
+
import { LayerLoadResult } from "../types/layer-types.js";
|
|
8
|
+
import { BaseKnowledgeLayer } from "./base-layer.js";
|
|
9
9
|
export declare class ProjectKnowledgeLayer extends BaseKnowledgeLayer {
|
|
10
10
|
private readonly projectPath;
|
|
11
11
|
constructor(projectPath?: string);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-layer.d.ts","sourceRoot":"","sources":["../../src/layers/project-layer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"project-layer.d.ts","sourceRoot":"","sources":["../../src/layers/project-layer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,OAAO,EAAiB,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,qBAAa,qBAAsB,SAAQ,kBAAkB;IAC/C,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,GAAE,MAA2B;IAIrE;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,eAAe,CAAC;IA2D5C;;OAEG;YACW,2BAA2B;IASzC;;OAEG;cACa,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IA0D7C;;OAEG;cACa,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IA0C9C;;OAEG;cACa,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC;IAalD;;OAEG;cACa,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAwDhD;;OAEG;YACW,YAAY;IAuB1B;;OAEG;YACW,eAAe;IAqE7B;;OAEG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAIrC;;OAEG;IACH,iBAAiB,IAAI;QACnB,CAAC,OAAO,EAAE,MAAM,GAAG;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC;KACzD;IAcD;;OAEG;IACH,MAAM,CAAC,uBAAuB,IAAI,MAAM;CAoCzC"}
|
|
@@ -4,17 +4,17 @@
|
|
|
4
4
|
* Loads project-specific knowledge overrides from ./bckb-overrides/ directory.
|
|
5
5
|
* This is the highest priority layer that can override any embedded knowledge.
|
|
6
6
|
*/
|
|
7
|
-
import { readFile, stat, access } from
|
|
8
|
-
import { join, basename } from
|
|
9
|
-
import * as yaml from
|
|
10
|
-
import glob from
|
|
11
|
-
import { AtomicTopicFrontmatterSchema } from
|
|
12
|
-
import { LayerPriority } from
|
|
13
|
-
import { BaseKnowledgeLayer } from
|
|
7
|
+
import { readFile, stat, access } from "fs/promises";
|
|
8
|
+
import { join, basename } from "path";
|
|
9
|
+
import * as yaml from "yaml";
|
|
10
|
+
import glob from "fast-glob";
|
|
11
|
+
import { AtomicTopicFrontmatterSchema, } from "../types/bc-knowledge.js";
|
|
12
|
+
import { LayerPriority } from "../types/layer-types.js";
|
|
13
|
+
import { BaseKnowledgeLayer } from "./base-layer.js";
|
|
14
14
|
export class ProjectKnowledgeLayer extends BaseKnowledgeLayer {
|
|
15
15
|
projectPath;
|
|
16
|
-
constructor(projectPath =
|
|
17
|
-
super(
|
|
16
|
+
constructor(projectPath = "./bckb-overrides") {
|
|
17
|
+
super("project", LayerPriority.PROJECT, true);
|
|
18
18
|
this.projectPath = projectPath;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
@@ -41,7 +41,7 @@ export class ProjectKnowledgeLayer extends BaseKnowledgeLayer {
|
|
|
41
41
|
this.loadTopics(),
|
|
42
42
|
this.loadSpecialists(),
|
|
43
43
|
this.loadWorkflows(),
|
|
44
|
-
this.loadIndexes()
|
|
44
|
+
this.loadIndexes(),
|
|
45
45
|
]);
|
|
46
46
|
const loadTimeMs = Date.now() - startTime;
|
|
47
47
|
this.initialized = true;
|
|
@@ -75,16 +75,16 @@ export class ProjectKnowledgeLayer extends BaseKnowledgeLayer {
|
|
|
75
75
|
async loadTopics() {
|
|
76
76
|
// Look for markdown files in various potential structures
|
|
77
77
|
const patterns = [
|
|
78
|
-
join(this.projectPath,
|
|
79
|
-
join(this.projectPath,
|
|
80
|
-
join(this.projectPath,
|
|
81
|
-
join(this.projectPath,
|
|
78
|
+
join(this.projectPath, "**", "*.md"),
|
|
79
|
+
join(this.projectPath, "domains", "**", "*.md"),
|
|
80
|
+
join(this.projectPath, "topics", "**", "*.md"),
|
|
81
|
+
join(this.projectPath, "overrides", "**", "*.md"),
|
|
82
82
|
];
|
|
83
83
|
let allTopicFiles = [];
|
|
84
84
|
for (const pattern of patterns) {
|
|
85
85
|
try {
|
|
86
|
-
const files = await glob(pattern.replace(/\\/g,
|
|
87
|
-
ignore: [
|
|
86
|
+
const files = await glob(pattern.replace(/\\/g, "/"), {
|
|
87
|
+
ignore: ["**/samples/**", "**/node_modules/**", "**/.git/**"],
|
|
88
88
|
});
|
|
89
89
|
allTopicFiles.push(...files);
|
|
90
90
|
}
|
|
@@ -125,22 +125,22 @@ export class ProjectKnowledgeLayer extends BaseKnowledgeLayer {
|
|
|
125
125
|
*/
|
|
126
126
|
async loadIndexes() {
|
|
127
127
|
const indexPaths = [
|
|
128
|
-
join(this.projectPath,
|
|
129
|
-
join(this.projectPath,
|
|
128
|
+
join(this.projectPath, "indexes"),
|
|
129
|
+
join(this.projectPath, "config"),
|
|
130
130
|
];
|
|
131
131
|
let loadedIndexes = 0;
|
|
132
132
|
for (const indexesPath of indexPaths) {
|
|
133
133
|
try {
|
|
134
134
|
await access(indexesPath);
|
|
135
135
|
// Load any JSON files as indexes
|
|
136
|
-
const jsonFiles = await glob(
|
|
136
|
+
const jsonFiles = await glob("*.json", { cwd: indexesPath });
|
|
137
137
|
for (const jsonFile of jsonFiles) {
|
|
138
138
|
try {
|
|
139
139
|
const filePath = join(indexesPath, jsonFile);
|
|
140
|
-
const content = await readFile(filePath,
|
|
141
|
-
const cleanContent = content.replace(/^\uFEFF/,
|
|
140
|
+
const content = await readFile(filePath, "utf-8");
|
|
141
|
+
const cleanContent = content.replace(/^\uFEFF/, ""); // Remove BOM
|
|
142
142
|
const indexData = JSON.parse(cleanContent);
|
|
143
|
-
const indexName = `project:${basename(jsonFile,
|
|
143
|
+
const indexName = `project:${basename(jsonFile, ".json")}`;
|
|
144
144
|
this.indexes.set(indexName, indexData);
|
|
145
145
|
loadedIndexes++;
|
|
146
146
|
console.error(`📋 Project index loaded: ${indexName}`);
|
|
@@ -160,7 +160,7 @@ export class ProjectKnowledgeLayer extends BaseKnowledgeLayer {
|
|
|
160
160
|
* Load project-specific specialists
|
|
161
161
|
*/
|
|
162
162
|
async loadSpecialists() {
|
|
163
|
-
const specialistsPath = join(this.projectPath,
|
|
163
|
+
const specialistsPath = join(this.projectPath, "specialists");
|
|
164
164
|
try {
|
|
165
165
|
await access(specialistsPath);
|
|
166
166
|
// TODO: Implement specialist loading when needed
|
|
@@ -175,8 +175,8 @@ export class ProjectKnowledgeLayer extends BaseKnowledgeLayer {
|
|
|
175
175
|
*/
|
|
176
176
|
async loadWorkflows() {
|
|
177
177
|
// Prefer workflows/, fall back to methodologies/ for backward compatibility
|
|
178
|
-
const workflowsPath = join(this.projectPath,
|
|
179
|
-
const legacyPath = join(this.projectPath,
|
|
178
|
+
const workflowsPath = join(this.projectPath, "workflows");
|
|
179
|
+
const legacyPath = join(this.projectPath, "methodologies");
|
|
180
180
|
let activePath = null;
|
|
181
181
|
try {
|
|
182
182
|
await access(workflowsPath);
|
|
@@ -198,7 +198,7 @@ export class ProjectKnowledgeLayer extends BaseKnowledgeLayer {
|
|
|
198
198
|
return 0;
|
|
199
199
|
}
|
|
200
200
|
// Load workflow files
|
|
201
|
-
const workflowFiles = await glob(
|
|
201
|
+
const workflowFiles = await glob("*.yaml", { cwd: activePath });
|
|
202
202
|
console.error(`📋 Found ${workflowFiles.length} workflow files in project layer`);
|
|
203
203
|
let loadedCount = 0;
|
|
204
204
|
for (const workflowFile of workflowFiles) {
|
|
@@ -206,7 +206,7 @@ export class ProjectKnowledgeLayer extends BaseKnowledgeLayer {
|
|
|
206
206
|
const filePath = join(activePath, workflowFile);
|
|
207
207
|
const workflow = await this.loadWorkflow(filePath);
|
|
208
208
|
if (workflow) {
|
|
209
|
-
const workflowId = workflow.type || basename(workflowFile,
|
|
209
|
+
const workflowId = workflow.type || basename(workflowFile, ".yaml");
|
|
210
210
|
this.workflows.set(workflowId, workflow);
|
|
211
211
|
loadedCount++;
|
|
212
212
|
}
|
|
@@ -223,8 +223,10 @@ export class ProjectKnowledgeLayer extends BaseKnowledgeLayer {
|
|
|
223
223
|
*/
|
|
224
224
|
async loadWorkflow(filePath) {
|
|
225
225
|
try {
|
|
226
|
-
const content = await readFile(filePath,
|
|
227
|
-
const normalizedContent = content
|
|
226
|
+
const content = await readFile(filePath, "utf-8");
|
|
227
|
+
const normalizedContent = content
|
|
228
|
+
.replace(/^\uFEFF/, "")
|
|
229
|
+
.replace(/\r\n/g, "\n");
|
|
228
230
|
// Parse YAML content
|
|
229
231
|
const workflowData = yaml.parse(normalizedContent);
|
|
230
232
|
// Validate required fields
|
|
@@ -255,10 +257,12 @@ export class ProjectKnowledgeLayer extends BaseKnowledgeLayer {
|
|
|
255
257
|
console.error(`Failed to stat file ${filePath}:`, error instanceof Error ? error.message : String(error));
|
|
256
258
|
return null;
|
|
257
259
|
}
|
|
258
|
-
const content = await readFile(filePath,
|
|
260
|
+
const content = await readFile(filePath, "utf-8");
|
|
259
261
|
const stats = await stat(filePath);
|
|
260
262
|
// Normalize line endings
|
|
261
|
-
const normalizedContent = content
|
|
263
|
+
const normalizedContent = content
|
|
264
|
+
.replace(/\r\n/g, "\n")
|
|
265
|
+
.replace(/\r/g, "\n");
|
|
262
266
|
// Extract YAML frontmatter
|
|
263
267
|
const frontmatterMatch = normalizedContent.match(/^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/);
|
|
264
268
|
if (!frontmatterMatch) {
|
|
@@ -266,16 +270,16 @@ export class ProjectKnowledgeLayer extends BaseKnowledgeLayer {
|
|
|
266
270
|
}
|
|
267
271
|
const [, frontmatterContent, markdownContent] = frontmatterMatch;
|
|
268
272
|
// Parse and validate frontmatter
|
|
269
|
-
const frontmatterData = yaml.parse(frontmatterContent ||
|
|
273
|
+
const frontmatterData = yaml.parse(frontmatterContent || "");
|
|
270
274
|
const frontmatter = AtomicTopicFrontmatterSchema.parse(frontmatterData);
|
|
271
275
|
// Generate topic ID from file path relative to project root
|
|
272
276
|
const topicId = this.normalizeTopicId(filePath, this.projectPath);
|
|
273
277
|
// Load companion sample file if exists
|
|
274
278
|
let samples;
|
|
275
279
|
if (frontmatter.samples) {
|
|
276
|
-
const samplesPath = join(filePath,
|
|
280
|
+
const samplesPath = join(filePath, "..", frontmatter.samples);
|
|
277
281
|
try {
|
|
278
|
-
const sampleContent = await readFile(samplesPath,
|
|
282
|
+
const sampleContent = await readFile(samplesPath, "utf-8");
|
|
279
283
|
samples = { filePath: samplesPath, content: sampleContent };
|
|
280
284
|
}
|
|
281
285
|
catch {
|
|
@@ -284,17 +288,17 @@ export class ProjectKnowledgeLayer extends BaseKnowledgeLayer {
|
|
|
284
288
|
}
|
|
285
289
|
return {
|
|
286
290
|
id: topicId,
|
|
287
|
-
title: frontmatter.title || topicId.replace(/-/g,
|
|
291
|
+
title: frontmatter.title || topicId.replace(/-/g, " "),
|
|
288
292
|
filePath,
|
|
289
293
|
frontmatter: {
|
|
290
294
|
...frontmatter,
|
|
291
295
|
// Mark as override for identification
|
|
292
|
-
tags: [...(frontmatter.tags || []),
|
|
296
|
+
tags: [...(frontmatter.tags || []), "project-override"],
|
|
293
297
|
},
|
|
294
|
-
content: markdownContent?.trim() ||
|
|
298
|
+
content: markdownContent?.trim() || "",
|
|
295
299
|
wordCount: markdownContent?.split(/\s+/).length || 0,
|
|
296
300
|
lastModified: stats.mtime,
|
|
297
|
-
samples: samples || undefined
|
|
301
|
+
samples: samples || undefined,
|
|
298
302
|
};
|
|
299
303
|
}
|
|
300
304
|
/**
|
|
@@ -310,8 +314,8 @@ export class ProjectKnowledgeLayer extends BaseKnowledgeLayer {
|
|
|
310
314
|
const config = {};
|
|
311
315
|
for (const topicId of this.getTopicIds()) {
|
|
312
316
|
config[topicId] = {
|
|
313
|
-
strategy:
|
|
314
|
-
source: this.name
|
|
317
|
+
strategy: "replace",
|
|
318
|
+
source: this.name,
|
|
315
319
|
};
|
|
316
320
|
}
|
|
317
321
|
return config;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-layer.js","sourceRoot":"","sources":["../../src/layers/project-layer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAW,IAAI,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,
|
|
1
|
+
{"version":3,"file":"project-layer.js","sourceRoot":"","sources":["../../src/layers/project-layer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAW,IAAI,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAEL,4BAA4B,GAC7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAmB,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,OAAO,qBAAsB,SAAQ,kBAAkB;IAC9B;IAA7B,YAA6B,cAAsB,kBAAkB;QACnE,KAAK,CAAC,SAAS,EAAE,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QADnB,gBAAW,GAAX,WAAW,CAA6B;IAErE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU;QACd,IAAI,IAAI,CAAC,WAAW,EAAE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AAC,MAAM,CAAC;gBACP,yCAAyC;YAC3C,CAAC;QACH,CAAC;QAED,OAAO;YACL,EAAE,EAAE,OAAO;YACX,KAAK,EAAE,WAAW,CAAC,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;YACtD,QAAQ;YACR,WAAW,EAAE;gBACX,GAAG,WAAW;gBACd,sCAAsC;gBACtC,IAAI,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,IAAI,EAAE,CAAC,EAAE,kBAAkB,CAAC;aACxD;YACD,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,EAAE;YACtC,SAAS,EAAE,eAAe,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC;YACpD,YAAY,EAAE,KAAK,CAAC,KAAK;YACzB,OAAO,EAAE,OAAO,IAAI,SAAS;SAC9B,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,WAAW,CAAC,OAAe;QACzB,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,iBAAiB;QAGf,MAAM,MAAM,GACV,EAAE,CAAC;QAEL,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACzC,MAAM,CAAC,OAAO,CAAC,GAAG;gBAChB,QAAQ,EAAE,SAAS;gBACnB,MAAM,EAAE,IAAI,CAAC,IAAI;aAClB,CAAC;QACJ,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,uBAAuB;QAC5B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCV,CAAC,IAAI,EAAE,CAAC;IACP,CAAC;CACF"}
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* Programmatic access to BC specialists without MCP registration.
|
|
5
5
|
* Provides methods for CLI and other programmatic use cases.
|
|
6
6
|
*/
|
|
7
|
-
import { Client } from
|
|
8
|
-
import { StdioClientTransport } from
|
|
9
|
-
import { fileURLToPath } from
|
|
10
|
-
import { dirname, join } from
|
|
7
|
+
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
8
|
+
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
9
|
+
import { fileURLToPath } from "url";
|
|
10
|
+
import { dirname, join } from "path";
|
|
11
11
|
const __filename = fileURLToPath(import.meta.url);
|
|
12
12
|
const __dirname = dirname(__filename);
|
|
13
13
|
/**
|
|
@@ -21,19 +21,19 @@ export class BCCodeIntelClient {
|
|
|
21
21
|
*/
|
|
22
22
|
async connect() {
|
|
23
23
|
// Spawn the MCP server as a child process
|
|
24
|
-
const serverPath = join(__dirname,
|
|
24
|
+
const serverPath = join(__dirname, "..", "index.js");
|
|
25
25
|
// Create MCP client
|
|
26
26
|
this.client = new Client({
|
|
27
|
-
name:
|
|
28
|
-
version:
|
|
27
|
+
name: "bc-code-intel-cli",
|
|
28
|
+
version: "1.0.0",
|
|
29
29
|
}, {
|
|
30
30
|
capabilities: {},
|
|
31
31
|
});
|
|
32
32
|
// Create stdio transport using the server process stdio streams
|
|
33
33
|
this.transport = new StdioClientTransport({
|
|
34
|
-
command:
|
|
34
|
+
command: "node",
|
|
35
35
|
args: [serverPath],
|
|
36
|
-
env: { ...process.env, MCP_SERVER_MODE:
|
|
36
|
+
env: { ...process.env, MCP_SERVER_MODE: "stdio" },
|
|
37
37
|
});
|
|
38
38
|
// Connect
|
|
39
39
|
await this.client.connect(this.transport);
|
|
@@ -56,32 +56,32 @@ export class BCCodeIntelClient {
|
|
|
56
56
|
*/
|
|
57
57
|
async askExpert(question, options = {}) {
|
|
58
58
|
if (!this.client) {
|
|
59
|
-
throw new Error(
|
|
59
|
+
throw new Error("Client not connected. Call connect() first.");
|
|
60
60
|
}
|
|
61
61
|
const response = await this.client.callTool({
|
|
62
|
-
name:
|
|
62
|
+
name: "ask_bc_expert",
|
|
63
63
|
arguments: {
|
|
64
64
|
question,
|
|
65
|
-
context: options.context ||
|
|
65
|
+
context: options.context || "",
|
|
66
66
|
bc_version: options.bcVersion,
|
|
67
67
|
autonomous_mode: true, // Get full structured response
|
|
68
68
|
},
|
|
69
69
|
});
|
|
70
70
|
if (response.isError) {
|
|
71
|
-
throw new Error(response.content[0]?.text ||
|
|
71
|
+
throw new Error(response.content[0]?.text || "Unknown error");
|
|
72
72
|
}
|
|
73
73
|
// Parse the response
|
|
74
|
-
const resultText = response.content[0]?.text ||
|
|
74
|
+
const resultText = response.content[0]?.text || "{}";
|
|
75
75
|
const result = JSON.parse(resultText);
|
|
76
76
|
return {
|
|
77
77
|
specialist: {
|
|
78
|
-
id: result.specialist_used ||
|
|
79
|
-
name: result.specialist_name ||
|
|
80
|
-
role: result.specialist_role ||
|
|
81
|
-
emoji: result.specialist_emoji ||
|
|
78
|
+
id: result.specialist_used || "unknown",
|
|
79
|
+
name: result.specialist_name || "Unknown Specialist",
|
|
80
|
+
role: result.specialist_role || "",
|
|
81
|
+
emoji: result.specialist_emoji || "🤖",
|
|
82
82
|
expertise: result.specialist_expertise || [],
|
|
83
83
|
},
|
|
84
|
-
response: result.response || result.answer ||
|
|
84
|
+
response: result.response || result.answer || "",
|
|
85
85
|
recommended_topics: result.recommended_topics || [],
|
|
86
86
|
follow_up_suggestions: result.follow_up_suggestions || [],
|
|
87
87
|
};
|
|
@@ -91,21 +91,21 @@ export class BCCodeIntelClient {
|
|
|
91
91
|
*/
|
|
92
92
|
async suggestSpecialist(question) {
|
|
93
93
|
if (!this.client) {
|
|
94
|
-
throw new Error(
|
|
94
|
+
throw new Error("Client not connected. Call connect() first.");
|
|
95
95
|
}
|
|
96
96
|
const response = await this.client.callTool({
|
|
97
|
-
name:
|
|
97
|
+
name: "discover_specialists",
|
|
98
98
|
arguments: {
|
|
99
99
|
query: question,
|
|
100
100
|
},
|
|
101
101
|
});
|
|
102
102
|
if (response.isError) {
|
|
103
|
-
throw new Error(response.content[0]?.text ||
|
|
103
|
+
throw new Error(response.content[0]?.text || "Unknown error");
|
|
104
104
|
}
|
|
105
|
-
const resultText = response.content[0]?.text ||
|
|
105
|
+
const resultText = response.content[0]?.text || "{}";
|
|
106
106
|
const result = JSON.parse(resultText);
|
|
107
107
|
if (!result.specialists || result.specialists.length === 0) {
|
|
108
|
-
throw new Error(
|
|
108
|
+
throw new Error("No specialists found for this question");
|
|
109
109
|
}
|
|
110
110
|
const topSpecialist = result.specialists[0];
|
|
111
111
|
const alternatives = result.specialists.slice(1, 4).map((s) => s.name);
|
|
@@ -114,7 +114,7 @@ export class BCCodeIntelClient {
|
|
|
114
114
|
id: topSpecialist.id,
|
|
115
115
|
name: topSpecialist.name,
|
|
116
116
|
role: topSpecialist.role,
|
|
117
|
-
emoji: topSpecialist.emoji ||
|
|
117
|
+
emoji: topSpecialist.emoji || "🤖",
|
|
118
118
|
expertise: topSpecialist.expertise || [],
|
|
119
119
|
specializations: topSpecialist.specializations || [],
|
|
120
120
|
},
|
|
@@ -127,32 +127,32 @@ export class BCCodeIntelClient {
|
|
|
127
127
|
*/
|
|
128
128
|
async getSpecialistAdvice(specialistId, question, options = {}) {
|
|
129
129
|
if (!this.client) {
|
|
130
|
-
throw new Error(
|
|
130
|
+
throw new Error("Client not connected. Call connect() first.");
|
|
131
131
|
}
|
|
132
132
|
const response = await this.client.callTool({
|
|
133
|
-
name:
|
|
133
|
+
name: "ask_bc_expert",
|
|
134
134
|
arguments: {
|
|
135
135
|
question,
|
|
136
136
|
specialist_id: specialistId,
|
|
137
|
-
context: options.context ||
|
|
137
|
+
context: options.context || "",
|
|
138
138
|
bc_version: options.bcVersion,
|
|
139
139
|
autonomous_mode: true,
|
|
140
140
|
},
|
|
141
141
|
});
|
|
142
142
|
if (response.isError) {
|
|
143
|
-
throw new Error(response.content[0]?.text ||
|
|
143
|
+
throw new Error(response.content[0]?.text || "Unknown error");
|
|
144
144
|
}
|
|
145
|
-
const resultText = response.content[0]?.text ||
|
|
145
|
+
const resultText = response.content[0]?.text || "{}";
|
|
146
146
|
const result = JSON.parse(resultText);
|
|
147
147
|
return {
|
|
148
148
|
specialist: {
|
|
149
149
|
id: result.specialist_used || specialistId,
|
|
150
|
-
name: result.specialist_name ||
|
|
151
|
-
role: result.specialist_role ||
|
|
152
|
-
emoji: result.specialist_emoji ||
|
|
150
|
+
name: result.specialist_name || "Unknown Specialist",
|
|
151
|
+
role: result.specialist_role || "",
|
|
152
|
+
emoji: result.specialist_emoji || "🤖",
|
|
153
153
|
expertise: result.specialist_expertise || [],
|
|
154
154
|
},
|
|
155
|
-
response: result.response || result.answer ||
|
|
155
|
+
response: result.response || result.answer || "",
|
|
156
156
|
recommended_topics: result.recommended_topics || [],
|
|
157
157
|
follow_up_suggestions: result.follow_up_suggestions || [],
|
|
158
158
|
};
|
|
@@ -162,18 +162,18 @@ export class BCCodeIntelClient {
|
|
|
162
162
|
*/
|
|
163
163
|
async discoverSpecialists(query) {
|
|
164
164
|
if (!this.client) {
|
|
165
|
-
throw new Error(
|
|
165
|
+
throw new Error("Client not connected. Call connect() first.");
|
|
166
166
|
}
|
|
167
167
|
const response = await this.client.callTool({
|
|
168
|
-
name:
|
|
168
|
+
name: "discover_specialists",
|
|
169
169
|
arguments: {
|
|
170
|
-
query: query ||
|
|
170
|
+
query: query || "*", // Use wildcard to get all specialists
|
|
171
171
|
},
|
|
172
172
|
});
|
|
173
173
|
if (response.isError) {
|
|
174
|
-
throw new Error(response.content[0]?.text ||
|
|
174
|
+
throw new Error(response.content[0]?.text || "Unknown error");
|
|
175
175
|
}
|
|
176
|
-
const resultText = response.content[0]?.text ||
|
|
176
|
+
const resultText = response.content[0]?.text || "{}";
|
|
177
177
|
const result = JSON.parse(resultText);
|
|
178
178
|
if (!result.specialists) {
|
|
179
179
|
return [];
|
|
@@ -182,7 +182,7 @@ export class BCCodeIntelClient {
|
|
|
182
182
|
id: s.id,
|
|
183
183
|
name: s.name,
|
|
184
184
|
role: s.role,
|
|
185
|
-
emoji: s.emoji ||
|
|
185
|
+
emoji: s.emoji || "🤖",
|
|
186
186
|
expertise: s.expertise || [],
|
|
187
187
|
specializations: s.specializations || [],
|
|
188
188
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/tools/ask_bc_expert/handler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,GAAG,IAGtC,MAAM,GAAG;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/tools/ask_bc_expert/handler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,GAAG,IAGtC,MAAM,GAAG;;;;;;;;;;;;;;GAwNxB"}
|