@bike4mind/cli 0.2.17-feat-ripgrep-integration.17676 → 0.2.17-feat-auto-context-customization.17674
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/{artifactExtractor-MNVIKVBH.js → artifactExtractor-6OWA6GIP.js} +1 -1
- package/dist/{chunk-NMWRXDTN.js → chunk-AZ7I44K7.js} +2 -2
- package/dist/{chunk-CHBAKX4C.js → chunk-D2RBSVLE.js} +14 -1
- package/dist/{chunk-6EEN6XHK.js → chunk-E4K7LPQC.js} +2 -2
- package/dist/{chunk-QDWMIP2Q.js → chunk-GRCMDIFP.js} +1 -1
- package/dist/{chunk-WULZDTLD.js → chunk-KZNSOBD6.js} +2 -2
- package/dist/{create-SR7Q7HAF.js → create-WVVHEPCQ.js} +3 -3
- package/dist/index.js +176 -136
- package/dist/{llmMarkdownGenerator-2APZC4H3.js → llmMarkdownGenerator-PYQLOSEU.js} +1 -1
- package/dist/{markdownGenerator-S7OHONSP.js → markdownGenerator-LFZJI3XC.js} +1 -1
- package/dist/{mementoService-UMJ5BYDO.js → mementoService-PUP3VFSA.js} +3 -3
- package/dist/{src-NBBLECSQ.js → src-CZKPMIOS.js} +1 -1
- package/dist/{src-VEJGC5KU.js → src-KALIUGCJ.js} +2 -2
- package/dist/{subtractCredits-N7Y27C34.js → subtractCredits-2HDKUWLJ.js} +3 -3
- package/package.json +6 -9
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
CurationArtifactType
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-D2RBSVLE.js";
|
|
5
5
|
|
|
6
6
|
// ../../b4m-core/packages/services/dist/src/notebookCurationService/artifactExtractor.js
|
|
7
7
|
var ARTIFACT_TAG_REGEX = /<artifact\s+(.*?)>([\s\S]*?)<\/artifact>/gi;
|
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
getSettingsByNames,
|
|
7
7
|
obfuscateApiKey,
|
|
8
8
|
secureParameters
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-GRCMDIFP.js";
|
|
10
10
|
import {
|
|
11
11
|
ApiKeyType,
|
|
12
12
|
MementoTier,
|
|
13
13
|
isSupportedEmbeddingModel
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-D2RBSVLE.js";
|
|
15
15
|
|
|
16
16
|
// ../../b4m-core/packages/services/dist/src/apiKeyService/get.js
|
|
17
17
|
import { z } from "zod";
|
|
@@ -232,6 +232,8 @@ var b4mLLMTools = z3.enum([
|
|
|
232
232
|
"glob_files",
|
|
233
233
|
"grep_search",
|
|
234
234
|
"delete_file",
|
|
235
|
+
// Knowledge base search
|
|
236
|
+
"search_knowledge_base",
|
|
235
237
|
// Shell execution
|
|
236
238
|
"bash_execute"
|
|
237
239
|
]);
|
|
@@ -2018,6 +2020,7 @@ var SettingKeySchema = z19.enum([
|
|
|
2018
2020
|
"voyageApiKey",
|
|
2019
2021
|
"FirecrawlApiKey",
|
|
2020
2022
|
"EnableDeepResearch",
|
|
2023
|
+
"EnableKnowledgeBaseSearch",
|
|
2021
2024
|
"DefaultChunkSize",
|
|
2022
2025
|
"DefaultAPIModel",
|
|
2023
2026
|
"AutoNameNotebook",
|
|
@@ -2495,7 +2498,8 @@ var API_SERVICE_GROUPS = {
|
|
|
2495
2498
|
{ key: "EnableRapidReply", order: 7 },
|
|
2496
2499
|
{ key: "EnableResearchEngine", order: 8 },
|
|
2497
2500
|
{ key: "EnableReactViewer", order: 9 },
|
|
2498
|
-
{ key: "EnableDeepResearch", order: 10 }
|
|
2501
|
+
{ key: "EnableDeepResearch", order: 10 },
|
|
2502
|
+
{ key: "EnableKnowledgeBaseSearch", order: 11 }
|
|
2499
2503
|
]
|
|
2500
2504
|
},
|
|
2501
2505
|
NOTEBOOK: {
|
|
@@ -3397,6 +3401,15 @@ var settingsMap = {
|
|
|
3397
3401
|
group: API_SERVICE_GROUPS.EXPERIMENTAL.id,
|
|
3398
3402
|
order: 9
|
|
3399
3403
|
}),
|
|
3404
|
+
EnableKnowledgeBaseSearch: makeBooleanSetting({
|
|
3405
|
+
key: "EnableKnowledgeBaseSearch",
|
|
3406
|
+
name: "Enable Knowledge Base Search",
|
|
3407
|
+
defaultValue: false,
|
|
3408
|
+
description: "Allow AI to search user uploaded documents. When enabled, users can toggle the Knowledge Base Search tool in AI Settings.",
|
|
3409
|
+
category: "Experimental",
|
|
3410
|
+
group: API_SERVICE_GROUPS.EXPERIMENTAL.id,
|
|
3411
|
+
order: 11
|
|
3412
|
+
}),
|
|
3400
3413
|
enableVoiceSession: makeBooleanSetting({
|
|
3401
3414
|
key: "enableVoiceSession",
|
|
3402
3415
|
name: "Enable Voice Session",
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
getSettingsMap,
|
|
8
8
|
getSettingsValue,
|
|
9
9
|
secureParameters
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-GRCMDIFP.js";
|
|
11
11
|
import {
|
|
12
12
|
KnowledgeType,
|
|
13
13
|
SupportedFabFileMimeTypes
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-D2RBSVLE.js";
|
|
15
15
|
|
|
16
16
|
// ../../b4m-core/packages/services/dist/src/fabFileService/create.js
|
|
17
17
|
import { z } from "zod";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
BadRequestError,
|
|
4
4
|
secureParameters
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-GRCMDIFP.js";
|
|
6
6
|
import {
|
|
7
7
|
CompletionApiUsageTransaction,
|
|
8
8
|
GenericCreditDeductTransaction,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
RealtimeVoiceUsageTransaction,
|
|
12
12
|
TextGenerationUsageTransaction,
|
|
13
13
|
TransferCreditTransaction
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-D2RBSVLE.js";
|
|
15
15
|
|
|
16
16
|
// ../../b4m-core/packages/services/dist/src/creditService/subtractCredits.js
|
|
17
17
|
import { z } from "zod";
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createFabFile,
|
|
4
4
|
createFabFileSchema
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-E4K7LPQC.js";
|
|
6
|
+
import "./chunk-GRCMDIFP.js";
|
|
7
|
+
import "./chunk-D2RBSVLE.js";
|
|
8
8
|
import "./chunk-OCYRD7D6.js";
|
|
9
9
|
export {
|
|
10
10
|
createFabFile,
|
package/dist/index.js
CHANGED
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
getEffectiveApiKey,
|
|
5
5
|
getOpenWeatherKey,
|
|
6
6
|
getSerperKey
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-AZ7I44K7.js";
|
|
8
8
|
import {
|
|
9
9
|
ConfigStore
|
|
10
10
|
} from "./chunk-FFJX3FF3.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-KZNSOBD6.js";
|
|
12
|
+
import "./chunk-E4K7LPQC.js";
|
|
13
13
|
import {
|
|
14
14
|
BFLImageService,
|
|
15
15
|
BaseStorage,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
OpenAIBackend,
|
|
22
22
|
OpenAIImageService,
|
|
23
23
|
XAIImageService
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-GRCMDIFP.js";
|
|
25
25
|
import {
|
|
26
26
|
AiEvents,
|
|
27
27
|
ApiKeyEvents,
|
|
@@ -75,7 +75,7 @@ import {
|
|
|
75
75
|
XAI_IMAGE_MODELS,
|
|
76
76
|
b4mLLMTools,
|
|
77
77
|
getMcpProviderMetadata
|
|
78
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-D2RBSVLE.js";
|
|
79
79
|
import {
|
|
80
80
|
Logger
|
|
81
81
|
} from "./chunk-OCYRD7D6.js";
|
|
@@ -3022,39 +3022,6 @@ SUBAGENT DELEGATION:
|
|
|
3022
3022
|
- Subagents keep the main conversation clean and run faster with optimized models
|
|
3023
3023
|
- Delegate when you need to search extensively or analyze code structure
|
|
3024
3024
|
|
|
3025
|
-
CODE SEARCH BEST PRACTICES:
|
|
3026
|
-
When searching code, follow this hierarchy for speed and efficiency:
|
|
3027
|
-
|
|
3028
|
-
1. Start Narrow \u2192 Go Broad
|
|
3029
|
-
\u2705 Efficient: ${TOOL_GLOB_FILES}("src/**/*.test.ts") \u2192 ${TOOL_GREP_SEARCH}("test('user login'") \u2192 ${TOOL_FILE_READ}("src/auth/login.test.ts")
|
|
3030
|
-
\u274C Inefficient: ${TOOL_GREP_SEARCH}("login") \u2192 Read 50 files individually \u2192 Repeat with different term
|
|
3031
|
-
|
|
3032
|
-
2. Leverage Git Information
|
|
3033
|
-
Before searching, check recent changes:
|
|
3034
|
-
- ${TOOL_BASH_EXECUTE}("git log --name-only --oneline -20")
|
|
3035
|
-
- ${TOOL_BASH_EXECUTE}("git log --oneline -10 -- src/auth/")
|
|
3036
|
-
|
|
3037
|
-
3. File Patterns
|
|
3038
|
-
Use specific patterns instead of broad searches:
|
|
3039
|
-
\u2705 Good: ${TOOL_GLOB_FILES}("**/*.{ts,tsx}"), ${TOOL_GLOB_FILES}("src/components/**/Button*")
|
|
3040
|
-
\u274C Bad: ${TOOL_GLOB_FILES}("**/*"), ${TOOL_GREP_SEARCH}("auth")
|
|
3041
|
-
|
|
3042
|
-
4. Test Files as Documentation
|
|
3043
|
-
When learning about a feature, check tests first:
|
|
3044
|
-
${TOOL_GLOB_FILES}("**/*.test.{ts,tsx}") \u2192 ${TOOL_GREP_SEARCH}("describe('AuthProvider'") \u2192 ${TOOL_FILE_READ} test file \u2192 Read implementation
|
|
3045
|
-
|
|
3046
|
-
5. Batch Operations
|
|
3047
|
-
Prefer glob patterns over multiple calls:
|
|
3048
|
-
\u2705 ${TOOL_GLOB_FILES}("src/**/*.{ts,tsx,js,jsx}") (one call)
|
|
3049
|
-
\u274C 4 separate ${TOOL_GLOB_FILES} calls for each extension
|
|
3050
|
-
|
|
3051
|
-
6. Tool Selection Decision Tree
|
|
3052
|
-
Goal: Find where "AuthProvider" is defined
|
|
3053
|
-
\u2192 ${TOOL_GLOB_FILES}("**/*Auth*.{ts,tsx}") (narrow the search)
|
|
3054
|
-
\u2192 ${TOOL_GREP_SEARCH}("(class|interface|type) AuthProvider") (find exact location)
|
|
3055
|
-
\u2192 ${TOOL_FILE_READ}("src/auth/AuthProvider.tsx") (read only that file)
|
|
3056
|
-
Result: 3 tool calls instead of 10-15
|
|
3057
|
-
|
|
3058
3025
|
FOR GENERAL TASKS:
|
|
3059
3026
|
- Use available tools to get information (weather, web search, calculations, etc.)
|
|
3060
3027
|
- When user asks follow-up questions, use conversation context to understand what they're referring to
|
|
@@ -4019,7 +3986,9 @@ var updateSchema = z76.object({
|
|
|
4019
3986
|
name: z76.string().optional(),
|
|
4020
3987
|
description: z76.string().optional(),
|
|
4021
3988
|
billingContact: z76.string().optional(),
|
|
4022
|
-
currentCredits: z76.coerce.number().optional()
|
|
3989
|
+
currentCredits: z76.coerce.number().optional(),
|
|
3990
|
+
systemPrompt: z76.string().max(1e4).optional()
|
|
3991
|
+
// ~2500 tokens
|
|
4023
3992
|
});
|
|
4024
3993
|
|
|
4025
3994
|
// ../../b4m-core/packages/services/dist/src/organizationService/delete.js
|
|
@@ -8542,39 +8511,40 @@ var globFilesTool = {
|
|
|
8542
8511
|
};
|
|
8543
8512
|
|
|
8544
8513
|
// ../../b4m-core/packages/services/dist/src/llm/tools/implementation/grepSearch/index.js
|
|
8545
|
-
import {
|
|
8514
|
+
import { globStream } from "glob";
|
|
8515
|
+
import { readFile, stat as stat2 } from "fs/promises";
|
|
8546
8516
|
import path9 from "path";
|
|
8547
|
-
|
|
8548
|
-
|
|
8549
|
-
|
|
8550
|
-
|
|
8551
|
-
|
|
8552
|
-
|
|
8517
|
+
var MAX_FILE_SIZE3 = 10 * 1024 * 1024;
|
|
8518
|
+
var DEFAULT_IGNORE_PATTERNS3 = [
|
|
8519
|
+
"**/node_modules/**",
|
|
8520
|
+
"**/.git/**",
|
|
8521
|
+
"**/dist/**",
|
|
8522
|
+
"**/build/**",
|
|
8523
|
+
"**/.next/**",
|
|
8524
|
+
"**/coverage/**",
|
|
8525
|
+
"**/*.min.js",
|
|
8526
|
+
"**/*.min.css",
|
|
8527
|
+
"**/package-lock.json",
|
|
8528
|
+
"**/pnpm-lock.yaml",
|
|
8529
|
+
"**/yarn.lock"
|
|
8530
|
+
];
|
|
8531
|
+
async function isBinaryFile2(filePath) {
|
|
8553
8532
|
try {
|
|
8554
|
-
const
|
|
8555
|
-
const
|
|
8556
|
-
const
|
|
8557
|
-
|
|
8558
|
-
|
|
8559
|
-
|
|
8533
|
+
const { openSync, readSync, closeSync } = await import("fs");
|
|
8534
|
+
const buffer = Buffer.alloc(8192);
|
|
8535
|
+
const fd = openSync(filePath, "r");
|
|
8536
|
+
const bytesRead = readSync(fd, buffer, 0, 8192, 0);
|
|
8537
|
+
closeSync(fd);
|
|
8538
|
+
const chunk = buffer.slice(0, bytesRead);
|
|
8539
|
+
return chunk.includes(0);
|
|
8540
|
+
} catch {
|
|
8541
|
+
return true;
|
|
8560
8542
|
}
|
|
8561
8543
|
}
|
|
8562
8544
|
function isPathWithinWorkspace(targetPath, baseCwd) {
|
|
8563
8545
|
const resolvedTarget = path9.resolve(targetPath);
|
|
8564
8546
|
const resolvedBase = path9.resolve(baseCwd);
|
|
8565
|
-
|
|
8566
|
-
return !relativePath.startsWith("..") && !path9.isAbsolute(relativePath);
|
|
8567
|
-
}
|
|
8568
|
-
function convertGlobToRipgrepGlobs(globPattern) {
|
|
8569
|
-
if (!globPattern || globPattern === "**/*") {
|
|
8570
|
-
return [];
|
|
8571
|
-
}
|
|
8572
|
-
const braceMatch = globPattern.match(/\*\.{([^}]+)}/);
|
|
8573
|
-
if (braceMatch) {
|
|
8574
|
-
const extensions = braceMatch[1].split(",");
|
|
8575
|
-
return extensions.map((ext) => `*.${ext.trim()}`);
|
|
8576
|
-
}
|
|
8577
|
-
return [globPattern];
|
|
8547
|
+
return resolvedTarget.startsWith(resolvedBase);
|
|
8578
8548
|
}
|
|
8579
8549
|
async function searchFiles2(params) {
|
|
8580
8550
|
const { pattern, dir_path, include } = params;
|
|
@@ -8594,69 +8564,59 @@ async function searchFiles2(params) {
|
|
|
8594
8564
|
}
|
|
8595
8565
|
throw error;
|
|
8596
8566
|
}
|
|
8597
|
-
|
|
8598
|
-
const rgArgs = [
|
|
8599
|
-
"--json",
|
|
8600
|
-
// Machine-readable output
|
|
8601
|
-
"--max-count",
|
|
8602
|
-
"500",
|
|
8603
|
-
// Limit matches per file
|
|
8604
|
-
"--ignore-case",
|
|
8605
|
-
// Case-insensitive search
|
|
8606
|
-
"--max-filesize",
|
|
8607
|
-
"10M"
|
|
8608
|
-
// Skip files larger than 10MB
|
|
8609
|
-
];
|
|
8610
|
-
const globs = convertGlobToRipgrepGlobs(include || "");
|
|
8611
|
-
if (globs.length > 0) {
|
|
8612
|
-
globs.forEach((glob2) => {
|
|
8613
|
-
rgArgs.push("--glob", glob2);
|
|
8614
|
-
});
|
|
8615
|
-
}
|
|
8616
|
-
rgArgs.push(pattern, targetDir);
|
|
8617
|
-
let stdout;
|
|
8567
|
+
let searchRegex;
|
|
8618
8568
|
try {
|
|
8619
|
-
|
|
8620
|
-
maxBuffer: 50 * 1024 * 1024
|
|
8621
|
-
// 50MB buffer for large results
|
|
8622
|
-
});
|
|
8623
|
-
stdout = result2.stdout;
|
|
8569
|
+
searchRegex = new RegExp(pattern, "i");
|
|
8624
8570
|
} catch (error) {
|
|
8625
|
-
|
|
8626
|
-
if (execError.code === 1 && execError.stdout) {
|
|
8627
|
-
stdout = execError.stdout;
|
|
8628
|
-
} else if (execError.code === 2) {
|
|
8629
|
-
const errorMsg = execError.stderr || "Unknown ripgrep error";
|
|
8630
|
-
throw new Error(`Ripgrep error: ${errorMsg}`);
|
|
8631
|
-
} else {
|
|
8632
|
-
throw error;
|
|
8633
|
-
}
|
|
8571
|
+
throw new Error(`Invalid regex pattern: ${pattern}`);
|
|
8634
8572
|
}
|
|
8635
|
-
const
|
|
8573
|
+
const globPattern = include || "**/*";
|
|
8574
|
+
const filesStream = globStream(globPattern, {
|
|
8575
|
+
cwd: targetDir,
|
|
8576
|
+
dot: false,
|
|
8577
|
+
// Skip hidden files
|
|
8578
|
+
ignore: DEFAULT_IGNORE_PATTERNS3,
|
|
8579
|
+
absolute: true,
|
|
8580
|
+
nodir: true
|
|
8581
|
+
// Only match files, not directories
|
|
8582
|
+
});
|
|
8636
8583
|
const allMatches = [];
|
|
8637
8584
|
let filesSearched = 0;
|
|
8638
|
-
|
|
8585
|
+
const maxMatches = 500;
|
|
8586
|
+
for await (const filePath of filesStream) {
|
|
8587
|
+
if (allMatches.length >= maxMatches) {
|
|
8588
|
+
break;
|
|
8589
|
+
}
|
|
8590
|
+
const fileAbsPath = filePath;
|
|
8639
8591
|
try {
|
|
8640
|
-
const
|
|
8641
|
-
if (
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
|
|
8651
|
-
|
|
8592
|
+
const stats = await stat2(fileAbsPath);
|
|
8593
|
+
if (stats.size > MAX_FILE_SIZE3) {
|
|
8594
|
+
continue;
|
|
8595
|
+
}
|
|
8596
|
+
if (await isBinaryFile2(fileAbsPath)) {
|
|
8597
|
+
continue;
|
|
8598
|
+
}
|
|
8599
|
+
filesSearched++;
|
|
8600
|
+
const content = await readFile(fileAbsPath, "utf8");
|
|
8601
|
+
const lines = content.split(/\r?\n/);
|
|
8602
|
+
lines.forEach((line, index) => {
|
|
8603
|
+
if (allMatches.length < maxMatches && searchRegex.test(line)) {
|
|
8604
|
+
allMatches.push({
|
|
8605
|
+
filePath: path9.relative(targetDir, fileAbsPath) || path9.basename(fileAbsPath),
|
|
8606
|
+
lineNumber: index + 1,
|
|
8607
|
+
line
|
|
8608
|
+
});
|
|
8609
|
+
}
|
|
8610
|
+
});
|
|
8611
|
+
} catch (readError) {
|
|
8612
|
+
const errCode = readError.code;
|
|
8613
|
+
if (errCode !== "ENOENT" && errCode !== "EACCES") {
|
|
8614
|
+
console.debug(`Could not read ${fileAbsPath}: ${readError.message}`);
|
|
8652
8615
|
}
|
|
8653
|
-
} catch {
|
|
8654
|
-
continue;
|
|
8655
8616
|
}
|
|
8656
8617
|
}
|
|
8657
8618
|
const searchDirDisplay = dir_path || ".";
|
|
8658
8619
|
const filterInfo = include ? ` (filter: "${include}")` : "";
|
|
8659
|
-
const maxMatches = 500;
|
|
8660
8620
|
if (allMatches.length === 0) {
|
|
8661
8621
|
return `No matches found for pattern "${pattern}" in "${searchDirDisplay}"${filterInfo}.
|
|
8662
8622
|
Searched ${filesSearched} file(s).`;
|
|
@@ -8666,6 +8626,7 @@ Searched ${filesSearched} file(s).`;
|
|
|
8666
8626
|
acc[match.filePath] = [];
|
|
8667
8627
|
}
|
|
8668
8628
|
acc[match.filePath].push(match);
|
|
8629
|
+
acc[match.filePath].sort((a, b) => a.lineNumber - b.lineNumber);
|
|
8669
8630
|
return acc;
|
|
8670
8631
|
}, {});
|
|
8671
8632
|
const matchCount = allMatches.length;
|
|
@@ -8804,6 +8765,94 @@ var deleteFileTool = {
|
|
|
8804
8765
|
})
|
|
8805
8766
|
};
|
|
8806
8767
|
|
|
8768
|
+
// ../../b4m-core/packages/services/dist/src/llm/tools/implementation/knowledgeBaseSearch/index.js
|
|
8769
|
+
function formatSearchResults(files) {
|
|
8770
|
+
if (files.length === 0) {
|
|
8771
|
+
return "No documents found matching your search query in your knowledge base.";
|
|
8772
|
+
}
|
|
8773
|
+
const formattedFiles = files.map((file, index) => {
|
|
8774
|
+
const tags = file.tags?.map((t) => t.name).join(", ") || "none";
|
|
8775
|
+
const notes = file.notes ? `
|
|
8776
|
+
Notes: ${file.notes}` : "";
|
|
8777
|
+
const fileType = file.type || "FILE";
|
|
8778
|
+
return `${index + 1}. **${file.fileName}**
|
|
8779
|
+
Type: ${fileType} | MIME: ${file.mimeType}
|
|
8780
|
+
Tags: ${tags}${notes}`;
|
|
8781
|
+
});
|
|
8782
|
+
return `Found ${files.length} document(s) in your knowledge base:
|
|
8783
|
+
|
|
8784
|
+
` + formattedFiles.join("\n\n") + "\n\n*To use these documents in your conversation, you can ask me to reference specific files by name.*";
|
|
8785
|
+
}
|
|
8786
|
+
var knowledgeBaseSearchTool = {
|
|
8787
|
+
name: "search_knowledge_base",
|
|
8788
|
+
implementation: (context) => ({
|
|
8789
|
+
toolFn: async (value) => {
|
|
8790
|
+
const params = value;
|
|
8791
|
+
const { query, tags, file_type, max_results = 5 } = params;
|
|
8792
|
+
context.logger.log("\u{1F4DA} Knowledge Base Search: Starting search for query:", query);
|
|
8793
|
+
if (!context.db.fabfiles) {
|
|
8794
|
+
context.logger.error("\u274C Knowledge Base Search: fabfiles repository not available");
|
|
8795
|
+
return "Knowledge base search is not available at this time.";
|
|
8796
|
+
}
|
|
8797
|
+
try {
|
|
8798
|
+
const searchResults = await context.db.fabfiles.search(context.userId, query, {
|
|
8799
|
+
tags: tags || [],
|
|
8800
|
+
type: file_type,
|
|
8801
|
+
shared: false
|
|
8802
|
+
// Not filtering to ONLY shared files
|
|
8803
|
+
}, {
|
|
8804
|
+
page: 1,
|
|
8805
|
+
limit: Math.min(max_results, 10)
|
|
8806
|
+
// Cap at 10 results
|
|
8807
|
+
}, {
|
|
8808
|
+
by: "fileName",
|
|
8809
|
+
direction: "asc"
|
|
8810
|
+
}, {
|
|
8811
|
+
includeShared: true,
|
|
8812
|
+
// Include owned + explicitly shared + org-shared files
|
|
8813
|
+
userGroups: context.user.groups || []
|
|
8814
|
+
// Pass user's groups for org-level sharing
|
|
8815
|
+
});
|
|
8816
|
+
context.logger.log("\u{1F4DA} Knowledge Base Search: Found", searchResults.data.length, "results");
|
|
8817
|
+
return formatSearchResults(searchResults.data);
|
|
8818
|
+
} catch (error) {
|
|
8819
|
+
context.logger.error("\u274C Knowledge Base Search: Error during search:", error);
|
|
8820
|
+
return "An error occurred while searching your knowledge base. Please try again.";
|
|
8821
|
+
}
|
|
8822
|
+
},
|
|
8823
|
+
toolSchema: {
|
|
8824
|
+
name: "search_knowledge_base",
|
|
8825
|
+
description: "Search the user's uploaded knowledge base (fab files). Returns relevant documents from the user's own files, organization-shared files, and files explicitly shared with them. Use this tool when the user asks about their own documents, uploaded files, or organization knowledge.",
|
|
8826
|
+
parameters: {
|
|
8827
|
+
type: "object",
|
|
8828
|
+
properties: {
|
|
8829
|
+
query: {
|
|
8830
|
+
type: "string",
|
|
8831
|
+
description: "The search query to find relevant documents by filename or content"
|
|
8832
|
+
},
|
|
8833
|
+
tags: {
|
|
8834
|
+
type: "array",
|
|
8835
|
+
items: { type: "string" },
|
|
8836
|
+
description: "Optional: filter results to only include files with these tags"
|
|
8837
|
+
},
|
|
8838
|
+
file_type: {
|
|
8839
|
+
type: "string",
|
|
8840
|
+
enum: ["pdf", "text", "image", "excel", "word", "json", "csv", "markdown", "code", "url"],
|
|
8841
|
+
description: "Optional: filter results by file type"
|
|
8842
|
+
},
|
|
8843
|
+
max_results: {
|
|
8844
|
+
type: "number",
|
|
8845
|
+
description: "Maximum number of results to return (default: 5, max: 10)",
|
|
8846
|
+
minimum: 1,
|
|
8847
|
+
maximum: 10
|
|
8848
|
+
}
|
|
8849
|
+
},
|
|
8850
|
+
required: ["query"]
|
|
8851
|
+
}
|
|
8852
|
+
}
|
|
8853
|
+
})
|
|
8854
|
+
};
|
|
8855
|
+
|
|
8807
8856
|
// ../../b4m-core/packages/services/dist/src/llm/tools/implementation/bashExecute/index.js
|
|
8808
8857
|
import { spawn } from "child_process";
|
|
8809
8858
|
import path11 from "path";
|
|
@@ -9306,6 +9355,8 @@ var tools = {
|
|
|
9306
9355
|
glob_files: globFilesTool,
|
|
9307
9356
|
grep_search: grepSearchTool,
|
|
9308
9357
|
delete_file: deleteFileTool,
|
|
9358
|
+
// Knowledge base search
|
|
9359
|
+
search_knowledge_base: knowledgeBaseSearchTool,
|
|
9309
9360
|
// Shell execution
|
|
9310
9361
|
bash_execute: bashExecuteTool
|
|
9311
9362
|
};
|
|
@@ -9545,7 +9596,7 @@ var ToolErrorType;
|
|
|
9545
9596
|
|
|
9546
9597
|
// src/utils/diffPreview.ts
|
|
9547
9598
|
import * as Diff from "diff";
|
|
9548
|
-
import { readFile } from "fs/promises";
|
|
9599
|
+
import { readFile as readFile2 } from "fs/promises";
|
|
9549
9600
|
import { existsSync as existsSync7 } from "fs";
|
|
9550
9601
|
async function generateFileDiffPreview(args) {
|
|
9551
9602
|
try {
|
|
@@ -9560,7 +9611,7 @@ ${preview}${hasMore ? `
|
|
|
9560
9611
|
|
|
9561
9612
|
... (${lines2.length - 20} more lines)` : ""}`;
|
|
9562
9613
|
}
|
|
9563
|
-
const currentContent = await
|
|
9614
|
+
const currentContent = await readFile2(args.path, "utf-8");
|
|
9564
9615
|
const patch = Diff.createPatch(
|
|
9565
9616
|
args.path,
|
|
9566
9617
|
currentContent,
|
|
@@ -11471,7 +11522,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
|
|
|
11471
11522
|
// package.json
|
|
11472
11523
|
var package_default = {
|
|
11473
11524
|
name: "@bike4mind/cli",
|
|
11474
|
-
version: "0.2.17-feat-
|
|
11525
|
+
version: "0.2.17-feat-auto-context-customization.17674+de27108a8",
|
|
11475
11526
|
type: "module",
|
|
11476
11527
|
description: "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
11477
11528
|
license: "UNLICENSED",
|
|
@@ -11578,10 +11629,10 @@ var package_default = {
|
|
|
11578
11629
|
},
|
|
11579
11630
|
devDependencies: {
|
|
11580
11631
|
"@bike4mind/agents": "0.1.0",
|
|
11581
|
-
"@bike4mind/common": "2.43.1-feat-
|
|
11582
|
-
"@bike4mind/mcp": "1.22.3-feat-
|
|
11583
|
-
"@bike4mind/services": "2.40.1-feat-
|
|
11584
|
-
"@bike4mind/utils": "2.2.1-feat-
|
|
11632
|
+
"@bike4mind/common": "2.43.1-feat-auto-context-customization.17674+de27108a8",
|
|
11633
|
+
"@bike4mind/mcp": "1.22.3-feat-auto-context-customization.17674+de27108a8",
|
|
11634
|
+
"@bike4mind/services": "2.40.1-feat-auto-context-customization.17674+de27108a8",
|
|
11635
|
+
"@bike4mind/utils": "2.2.1-feat-auto-context-customization.17674+de27108a8",
|
|
11585
11636
|
"@types/better-sqlite3": "^7.6.13",
|
|
11586
11637
|
"@types/diff": "^5.0.9",
|
|
11587
11638
|
"@types/jsonwebtoken": "^9.0.4",
|
|
@@ -11595,10 +11646,7 @@ var package_default = {
|
|
|
11595
11646
|
typescript: "^5.9.3",
|
|
11596
11647
|
vitest: "^3.2.4"
|
|
11597
11648
|
},
|
|
11598
|
-
|
|
11599
|
-
"@vscode/ripgrep": "^1.17.0"
|
|
11600
|
-
},
|
|
11601
|
-
gitHead: "0f83d84dbabacf4d4a783634589cac64d45df2a2"
|
|
11649
|
+
gitHead: "de27108a84fd8f6310728664242ea7179915090d"
|
|
11602
11650
|
};
|
|
11603
11651
|
|
|
11604
11652
|
// src/config/constants.ts
|
|
@@ -11798,14 +11846,6 @@ Focus on:
|
|
|
11798
11846
|
|
|
11799
11847
|
You have read-only access. Use file_read, grep_search, and glob_files to explore.
|
|
11800
11848
|
|
|
11801
|
-
CODE SEARCH EFFICIENCY:
|
|
11802
|
-
1. Start narrow with glob_files using specific patterns (e.g., "**/*Auth*.ts")
|
|
11803
|
-
2. Then use grep_search with precise regex on narrowed results
|
|
11804
|
-
3. Finally use file_read only on relevant files
|
|
11805
|
-
4. Leverage git log to find recent changes
|
|
11806
|
-
5. Check test files first to understand feature usage
|
|
11807
|
-
6. Batch glob operations instead of multiple separate calls
|
|
11808
|
-
|
|
11809
11849
|
When you find what you're looking for, provide a clear summary including:
|
|
11810
11850
|
1. What you found (files, functions, patterns)
|
|
11811
11851
|
2. Key insights or observations
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
findMostSimilarMemento,
|
|
4
4
|
getRelevantMementos
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-AZ7I44K7.js";
|
|
6
|
+
import "./chunk-GRCMDIFP.js";
|
|
7
|
+
import "./chunk-D2RBSVLE.js";
|
|
8
8
|
import "./chunk-OCYRD7D6.js";
|
|
9
9
|
export {
|
|
10
10
|
findMostSimilarMemento,
|
|
@@ -129,8 +129,8 @@ import {
|
|
|
129
129
|
validateMermaidSyntax,
|
|
130
130
|
warmUpSettingsCache,
|
|
131
131
|
withRetry
|
|
132
|
-
} from "./chunk-
|
|
133
|
-
import "./chunk-
|
|
132
|
+
} from "./chunk-GRCMDIFP.js";
|
|
133
|
+
import "./chunk-D2RBSVLE.js";
|
|
134
134
|
import {
|
|
135
135
|
Logger,
|
|
136
136
|
NotificationDeduplicator,
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
SubtractCreditsSchema,
|
|
4
4
|
subtractCredits
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-KZNSOBD6.js";
|
|
6
|
+
import "./chunk-GRCMDIFP.js";
|
|
7
|
+
import "./chunk-D2RBSVLE.js";
|
|
8
8
|
import "./chunk-OCYRD7D6.js";
|
|
9
9
|
export {
|
|
10
10
|
SubtractCreditsSchema,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bike4mind/cli",
|
|
3
|
-
"version": "0.2.17-feat-
|
|
3
|
+
"version": "0.2.17-feat-auto-context-customization.17674+de27108a8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -107,10 +107,10 @@
|
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
109
|
"@bike4mind/agents": "0.1.0",
|
|
110
|
-
"@bike4mind/common": "2.43.1-feat-
|
|
111
|
-
"@bike4mind/mcp": "1.22.3-feat-
|
|
112
|
-
"@bike4mind/services": "2.40.1-feat-
|
|
113
|
-
"@bike4mind/utils": "2.2.1-feat-
|
|
110
|
+
"@bike4mind/common": "2.43.1-feat-auto-context-customization.17674+de27108a8",
|
|
111
|
+
"@bike4mind/mcp": "1.22.3-feat-auto-context-customization.17674+de27108a8",
|
|
112
|
+
"@bike4mind/services": "2.40.1-feat-auto-context-customization.17674+de27108a8",
|
|
113
|
+
"@bike4mind/utils": "2.2.1-feat-auto-context-customization.17674+de27108a8",
|
|
114
114
|
"@types/better-sqlite3": "^7.6.13",
|
|
115
115
|
"@types/diff": "^5.0.9",
|
|
116
116
|
"@types/jsonwebtoken": "^9.0.4",
|
|
@@ -124,8 +124,5 @@
|
|
|
124
124
|
"typescript": "^5.9.3",
|
|
125
125
|
"vitest": "^3.2.4"
|
|
126
126
|
},
|
|
127
|
-
"
|
|
128
|
-
"@vscode/ripgrep": "^1.17.0"
|
|
129
|
-
},
|
|
130
|
-
"gitHead": "0f83d84dbabacf4d4a783634589cac64d45df2a2"
|
|
127
|
+
"gitHead": "de27108a84fd8f6310728664242ea7179915090d"
|
|
131
128
|
}
|