@bike4mind/cli 0.2.29-feat-quantum-optimize-architecture.18865 → 0.2.29-feat-quantum-optimize-architecture.18869
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-YXCWF7C7.js → artifactExtractor-IYOLLKMT.js} +1 -1
- package/dist/{chunk-KE4B2ZGF.js → chunk-37LP5TEX.js} +2 -2
- package/dist/{chunk-ONMTYHC2.js → chunk-DYLBOIMW.js} +1 -0
- package/dist/{chunk-O5LNKJED.js → chunk-EAPDBTJW.js} +2 -2
- package/dist/{chunk-MXMR4O3A.js → chunk-RAFO24PB.js} +2 -2
- package/dist/{chunk-ZFLZILSJ.js → chunk-XOFV7PRQ.js} +1 -1
- package/dist/{create-2UZMTRWL.js → create-6W6R35C3.js} +3 -3
- package/dist/index.js +129 -14
- package/dist/{llmMarkdownGenerator-DZSVGJTA.js → llmMarkdownGenerator-A3CINLZN.js} +1 -1
- package/dist/{markdownGenerator-JQGXHXXU.js → markdownGenerator-OKTMUYNY.js} +1 -1
- package/dist/{mementoService-CX3ID5C7.js → mementoService-QAP4FVAF.js} +3 -3
- package/dist/{src-XL5LD7DM.js → src-XDUIA23H.js} +2 -2
- package/dist/{src-IRF6HQ4C.js → src-ZK4FDRJT.js} +1 -1
- package/dist/{subtractCredits-SEKKZNZI.js → subtractCredits-F4ERHRDC.js} +3 -3
- package/package.json +6 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
CurationArtifactType
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DYLBOIMW.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;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
BadRequestError,
|
|
4
4
|
secureParameters
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-XOFV7PRQ.js";
|
|
6
6
|
import {
|
|
7
7
|
CompletionApiUsageTransaction,
|
|
8
8
|
GenericCreditDeductTransaction,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
TextGenerationUsageTransaction,
|
|
13
13
|
TransferCreditTransaction,
|
|
14
14
|
VideoGenerationUsageTransaction
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-DYLBOIMW.js";
|
|
16
16
|
|
|
17
17
|
// ../../b4m-core/packages/services/dist/src/creditService/subtractCredits.js
|
|
18
18
|
import { z } from "zod";
|
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
getSettingsByNames,
|
|
7
7
|
obfuscateApiKey,
|
|
8
8
|
secureParameters
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-XOFV7PRQ.js";
|
|
10
10
|
import {
|
|
11
11
|
ApiKeyType,
|
|
12
12
|
MementoTier,
|
|
13
13
|
isSupportedEmbeddingModel
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-DYLBOIMW.js";
|
|
15
15
|
|
|
16
16
|
// ../../b4m-core/packages/services/dist/src/apiKeyService/get.js
|
|
17
17
|
import { z } from "zod";
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
getSettingsMap,
|
|
8
8
|
getSettingsValue,
|
|
9
9
|
secureParameters
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-XOFV7PRQ.js";
|
|
11
11
|
import {
|
|
12
12
|
KnowledgeType,
|
|
13
13
|
SupportedFabFileMimeTypes
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-DYLBOIMW.js";
|
|
15
15
|
|
|
16
16
|
// ../../b4m-core/packages/services/dist/src/fabFileService/create.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-RAFO24PB.js";
|
|
6
|
+
import "./chunk-XOFV7PRQ.js";
|
|
7
|
+
import "./chunk-DYLBOIMW.js";
|
|
8
8
|
import "./chunk-OCYRD7D6.js";
|
|
9
9
|
export {
|
|
10
10
|
createFabFile,
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
getEffectiveApiKey,
|
|
6
6
|
getOpenWeatherKey,
|
|
7
7
|
getSerperKey
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-EAPDBTJW.js";
|
|
9
9
|
import {
|
|
10
10
|
ConfigStore,
|
|
11
11
|
logger
|
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
selectActiveBackgroundAgents,
|
|
15
15
|
useCliStore
|
|
16
16
|
} from "./chunk-TVW4ZESU.js";
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-37LP5TEX.js";
|
|
18
|
+
import "./chunk-RAFO24PB.js";
|
|
19
19
|
import {
|
|
20
20
|
BFLImageService,
|
|
21
21
|
BaseStorage,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
OpenAIBackend,
|
|
28
28
|
OpenAIImageService,
|
|
29
29
|
XAIImageService
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-XOFV7PRQ.js";
|
|
31
31
|
import {
|
|
32
32
|
AiEvents,
|
|
33
33
|
ApiKeyEvents,
|
|
@@ -83,7 +83,7 @@ import {
|
|
|
83
83
|
XAI_IMAGE_MODELS,
|
|
84
84
|
b4mLLMTools,
|
|
85
85
|
getMcpProviderMetadata
|
|
86
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-DYLBOIMW.js";
|
|
87
87
|
import {
|
|
88
88
|
Logger
|
|
89
89
|
} from "./chunk-OCYRD7D6.js";
|
|
@@ -9664,13 +9664,13 @@ function formatSearchResults(files) {
|
|
|
9664
9664
|
const notes = file.notes ? `
|
|
9665
9665
|
Notes: ${file.notes}` : "";
|
|
9666
9666
|
const fileType = file.type || "FILE";
|
|
9667
|
-
return `${index + 1}. **${file.fileName}**
|
|
9667
|
+
return `${index + 1}. **${file.fileName}** (ID: ${file.id})
|
|
9668
9668
|
Type: ${fileType} | MIME: ${file.mimeType}
|
|
9669
9669
|
Tags: ${tags}${notes}`;
|
|
9670
9670
|
});
|
|
9671
9671
|
return `Found ${files.length} document(s) in your knowledge base:
|
|
9672
9672
|
|
|
9673
|
-
` + formattedFiles.join("\n\n") + "\n\n*
|
|
9673
|
+
` + formattedFiles.join("\n\n") + "\n\n*Use retrieve_knowledge_content with a file ID or tags to read the actual document content.*";
|
|
9674
9674
|
}
|
|
9675
9675
|
var knowledgeBaseSearchTool = {
|
|
9676
9676
|
name: "search_knowledge_base",
|
|
@@ -9744,6 +9744,120 @@ var knowledgeBaseSearchTool = {
|
|
|
9744
9744
|
})
|
|
9745
9745
|
};
|
|
9746
9746
|
|
|
9747
|
+
// ../../b4m-core/packages/services/dist/src/llm/tools/implementation/knowledgeBaseRetrieve/index.js
|
|
9748
|
+
var DEFAULT_MAX_CHARS = 8e3;
|
|
9749
|
+
var ABSOLUTE_MAX_CHARS = 16e3;
|
|
9750
|
+
var knowledgeBaseRetrieveTool = {
|
|
9751
|
+
name: "retrieve_knowledge_content",
|
|
9752
|
+
implementation: (context) => ({
|
|
9753
|
+
toolFn: async (value) => {
|
|
9754
|
+
const params = value;
|
|
9755
|
+
const { file_id, tags, query, max_chars } = params;
|
|
9756
|
+
const charBudget = Math.min(max_chars ?? DEFAULT_MAX_CHARS, ABSOLUTE_MAX_CHARS);
|
|
9757
|
+
context.logger.log("\u{1F4D6} Knowledge Retrieve: params", { file_id, tags, query, max_chars: charBudget });
|
|
9758
|
+
if (!file_id && !tags?.length && !query) {
|
|
9759
|
+
return "Error: You must provide at least one of file_id, tags, or query.";
|
|
9760
|
+
}
|
|
9761
|
+
if (!context.db.fabfiles) {
|
|
9762
|
+
context.logger.error("\u274C Knowledge Retrieve: fabfiles repository not available");
|
|
9763
|
+
return "Knowledge base retrieval is not available at this time.";
|
|
9764
|
+
}
|
|
9765
|
+
if (!context.db.fabfilechunks) {
|
|
9766
|
+
context.logger.error("\u274C Knowledge Retrieve: fabfilechunks repository not available");
|
|
9767
|
+
return "Knowledge base retrieval is not available at this time (chunk reader unavailable).";
|
|
9768
|
+
}
|
|
9769
|
+
try {
|
|
9770
|
+
let files = [];
|
|
9771
|
+
if (file_id) {
|
|
9772
|
+
const file = await context.db.fabfiles.findByIdAndUserId(file_id, context.userId);
|
|
9773
|
+
if (file) {
|
|
9774
|
+
files = [file];
|
|
9775
|
+
} else {
|
|
9776
|
+
const searchResults = await context.db.fabfiles.search(context.userId, file_id, { tags: [], shared: false }, { page: 1, limit: 1 }, { by: "fileName", direction: "asc" }, { textSearch: true, includeShared: true, userGroups: context.user.groups || [] });
|
|
9777
|
+
files = searchResults.data;
|
|
9778
|
+
}
|
|
9779
|
+
if (files.length === 0) {
|
|
9780
|
+
return `No document found with ID "${file_id}". The file may not exist or you may not have access to it. Try using search_knowledge_base to find the correct file ID.`;
|
|
9781
|
+
}
|
|
9782
|
+
}
|
|
9783
|
+
if (files.length === 0 && (tags?.length || query)) {
|
|
9784
|
+
const searchResults = await context.db.fabfiles.search(context.userId, query || "", { tags: tags || [], shared: false }, { page: 1, limit: 5 }, { by: "fileName", direction: "asc" }, { textSearch: true, includeShared: true, userGroups: context.user.groups || [] });
|
|
9785
|
+
files = searchResults.data;
|
|
9786
|
+
if (files.length === 0) {
|
|
9787
|
+
const searchDesc = [
|
|
9788
|
+
query && `query "${query}"`,
|
|
9789
|
+
tags?.length && `tags [${tags.join(", ")}]`
|
|
9790
|
+
].filter(Boolean).join(" and ");
|
|
9791
|
+
return `No documents found matching ${searchDesc}. Try broadening your search with search_knowledge_base.`;
|
|
9792
|
+
}
|
|
9793
|
+
}
|
|
9794
|
+
let totalCharsUsed = 0;
|
|
9795
|
+
const sections = [];
|
|
9796
|
+
let filesRetrieved = 0;
|
|
9797
|
+
for (const file of files) {
|
|
9798
|
+
if (totalCharsUsed >= charBudget)
|
|
9799
|
+
break;
|
|
9800
|
+
const chunks = await context.db.fabfilechunks.findByFabFileId(file.id);
|
|
9801
|
+
if (chunks.length === 0) {
|
|
9802
|
+
context.logger.log(`\u{1F4D6} Knowledge Retrieve: No chunks for file ${file.fileName} (${file.id})`);
|
|
9803
|
+
continue;
|
|
9804
|
+
}
|
|
9805
|
+
const fullText = chunks.map((c) => c.text).join("\n");
|
|
9806
|
+
const remainingBudget = charBudget - totalCharsUsed;
|
|
9807
|
+
const truncated = fullText.length > remainingBudget;
|
|
9808
|
+
const content = truncated ? fullText.slice(0, remainingBudget) : fullText;
|
|
9809
|
+
const fileTags = file.tags?.map((t) => t.name).join(", ") || "none";
|
|
9810
|
+
const charLabel = truncated ? `${content.length} (truncated from ${fullText.length})` : `${content.length}`;
|
|
9811
|
+
sections.push(`### ${file.fileName} (ID: ${file.id})
|
|
9812
|
+
Tags: ${fileTags}
|
|
9813
|
+
Chunks: ${chunks.length} | Characters: ${charLabel}
|
|
9814
|
+
---
|
|
9815
|
+
` + content);
|
|
9816
|
+
totalCharsUsed += content.length;
|
|
9817
|
+
filesRetrieved++;
|
|
9818
|
+
}
|
|
9819
|
+
if (filesRetrieved === 0) {
|
|
9820
|
+
return "Found matching documents but they have no indexed content. The files may not have been processed yet.";
|
|
9821
|
+
}
|
|
9822
|
+
const header = `Retrieved content from ${filesRetrieved} of ${files.length} document(s):
|
|
9823
|
+
`;
|
|
9824
|
+
return header + "\n" + sections.join("\n\n---\n\n");
|
|
9825
|
+
} catch (error) {
|
|
9826
|
+
context.logger.error("\u274C Knowledge Retrieve: Error during retrieval:", error);
|
|
9827
|
+
return "An error occurred while retrieving document content. Please try again.";
|
|
9828
|
+
}
|
|
9829
|
+
},
|
|
9830
|
+
toolSchema: {
|
|
9831
|
+
name: "retrieve_knowledge_content",
|
|
9832
|
+
description: "Read the actual text content of knowledge base documents. Use this after search_knowledge_base to read documents by file ID, or provide tags/query to find and read documents in one step. Returns the full text content (up to the character budget) for grounding your responses in the user's curated knowledge.",
|
|
9833
|
+
parameters: {
|
|
9834
|
+
type: "object",
|
|
9835
|
+
properties: {
|
|
9836
|
+
file_id: {
|
|
9837
|
+
type: "string",
|
|
9838
|
+
description: "The file ID to retrieve (from search_knowledge_base results). Most efficient for single-document retrieval."
|
|
9839
|
+
},
|
|
9840
|
+
tags: {
|
|
9841
|
+
type: "array",
|
|
9842
|
+
items: { type: "string" },
|
|
9843
|
+
description: 'Filter documents by tags. For optimization docs, use tags like "opti:family:scheduling", "opti:solver:highs", etc.'
|
|
9844
|
+
},
|
|
9845
|
+
query: {
|
|
9846
|
+
type: "string",
|
|
9847
|
+
description: "Search query to find documents. Can be combined with tags for more targeted retrieval."
|
|
9848
|
+
},
|
|
9849
|
+
max_chars: {
|
|
9850
|
+
type: "number",
|
|
9851
|
+
description: "Maximum characters of content to return (default: 8000, max: 16000). Lower values for quick lookups, higher for detailed reading.",
|
|
9852
|
+
minimum: 500,
|
|
9853
|
+
maximum: 16e3
|
|
9854
|
+
}
|
|
9855
|
+
}
|
|
9856
|
+
}
|
|
9857
|
+
}
|
|
9858
|
+
})
|
|
9859
|
+
};
|
|
9860
|
+
|
|
9747
9861
|
// ../../b4m-core/packages/quantum/dist/src/types.js
|
|
9748
9862
|
import { z as z139 } from "zod";
|
|
9749
9863
|
var OperationSchema = z139.object({
|
|
@@ -11630,8 +11744,9 @@ var b4mTools = {
|
|
|
11630
11744
|
sunrise_sunset: sunriseSunsetTool,
|
|
11631
11745
|
iss_tracker: issTrackerTool,
|
|
11632
11746
|
planet_visibility: planetVisibilityTool,
|
|
11633
|
-
// Knowledge base
|
|
11747
|
+
// Knowledge base tools
|
|
11634
11748
|
search_knowledge_base: knowledgeBaseSearchTool,
|
|
11749
|
+
retrieve_knowledge_content: knowledgeBaseRetrieveTool,
|
|
11635
11750
|
// Quantum optimization tools
|
|
11636
11751
|
quantum_schedule: quantumScheduleTool,
|
|
11637
11752
|
quantum_formulate: quantumFormulateTool
|
|
@@ -14620,7 +14735,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
|
|
|
14620
14735
|
// package.json
|
|
14621
14736
|
var package_default = {
|
|
14622
14737
|
name: "@bike4mind/cli",
|
|
14623
|
-
version: "0.2.29-feat-quantum-optimize-architecture.
|
|
14738
|
+
version: "0.2.29-feat-quantum-optimize-architecture.18869+3e839a2c8",
|
|
14624
14739
|
type: "module",
|
|
14625
14740
|
description: "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
14626
14741
|
license: "UNLICENSED",
|
|
@@ -14730,10 +14845,10 @@ var package_default = {
|
|
|
14730
14845
|
},
|
|
14731
14846
|
devDependencies: {
|
|
14732
14847
|
"@bike4mind/agents": "0.1.0",
|
|
14733
|
-
"@bike4mind/common": "2.50.1-feat-quantum-optimize-architecture.
|
|
14734
|
-
"@bike4mind/mcp": "1.29.1-feat-quantum-optimize-architecture.
|
|
14735
|
-
"@bike4mind/services": "2.48.1-feat-quantum-optimize-architecture.
|
|
14736
|
-
"@bike4mind/utils": "2.5.1-feat-quantum-optimize-architecture.
|
|
14848
|
+
"@bike4mind/common": "2.50.1-feat-quantum-optimize-architecture.18869+3e839a2c8",
|
|
14849
|
+
"@bike4mind/mcp": "1.29.1-feat-quantum-optimize-architecture.18869+3e839a2c8",
|
|
14850
|
+
"@bike4mind/services": "2.48.1-feat-quantum-optimize-architecture.18869+3e839a2c8",
|
|
14851
|
+
"@bike4mind/utils": "2.5.1-feat-quantum-optimize-architecture.18869+3e839a2c8",
|
|
14737
14852
|
"@types/better-sqlite3": "^7.6.13",
|
|
14738
14853
|
"@types/diff": "^5.0.9",
|
|
14739
14854
|
"@types/jsonwebtoken": "^9.0.4",
|
|
@@ -14750,7 +14865,7 @@ var package_default = {
|
|
|
14750
14865
|
optionalDependencies: {
|
|
14751
14866
|
"@vscode/ripgrep": "^1.17.0"
|
|
14752
14867
|
},
|
|
14753
|
-
gitHead: "
|
|
14868
|
+
gitHead: "3e839a2c8a21d5d1c2682e9bdb97dff3fbaaff4e"
|
|
14754
14869
|
};
|
|
14755
14870
|
|
|
14756
14871
|
// src/config/constants.ts
|
|
@@ -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-EAPDBTJW.js";
|
|
6
|
+
import "./chunk-XOFV7PRQ.js";
|
|
7
|
+
import "./chunk-DYLBOIMW.js";
|
|
8
8
|
import "./chunk-OCYRD7D6.js";
|
|
9
9
|
export {
|
|
10
10
|
findMostSimilarMemento,
|
|
@@ -134,8 +134,8 @@ import {
|
|
|
134
134
|
validateMermaidSyntax,
|
|
135
135
|
warmUpSettingsCache,
|
|
136
136
|
withRetry
|
|
137
|
-
} from "./chunk-
|
|
138
|
-
import "./chunk-
|
|
137
|
+
} from "./chunk-XOFV7PRQ.js";
|
|
138
|
+
import "./chunk-DYLBOIMW.js";
|
|
139
139
|
import {
|
|
140
140
|
Logger,
|
|
141
141
|
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-37LP5TEX.js";
|
|
6
|
+
import "./chunk-XOFV7PRQ.js";
|
|
7
|
+
import "./chunk-DYLBOIMW.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.29-feat-quantum-optimize-architecture.
|
|
3
|
+
"version": "0.2.29-feat-quantum-optimize-architecture.18869+3e839a2c8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -110,10 +110,10 @@
|
|
|
110
110
|
},
|
|
111
111
|
"devDependencies": {
|
|
112
112
|
"@bike4mind/agents": "0.1.0",
|
|
113
|
-
"@bike4mind/common": "2.50.1-feat-quantum-optimize-architecture.
|
|
114
|
-
"@bike4mind/mcp": "1.29.1-feat-quantum-optimize-architecture.
|
|
115
|
-
"@bike4mind/services": "2.48.1-feat-quantum-optimize-architecture.
|
|
116
|
-
"@bike4mind/utils": "2.5.1-feat-quantum-optimize-architecture.
|
|
113
|
+
"@bike4mind/common": "2.50.1-feat-quantum-optimize-architecture.18869+3e839a2c8",
|
|
114
|
+
"@bike4mind/mcp": "1.29.1-feat-quantum-optimize-architecture.18869+3e839a2c8",
|
|
115
|
+
"@bike4mind/services": "2.48.1-feat-quantum-optimize-architecture.18869+3e839a2c8",
|
|
116
|
+
"@bike4mind/utils": "2.5.1-feat-quantum-optimize-architecture.18869+3e839a2c8",
|
|
117
117
|
"@types/better-sqlite3": "^7.6.13",
|
|
118
118
|
"@types/diff": "^5.0.9",
|
|
119
119
|
"@types/jsonwebtoken": "^9.0.4",
|
|
@@ -130,5 +130,5 @@
|
|
|
130
130
|
"optionalDependencies": {
|
|
131
131
|
"@vscode/ripgrep": "^1.17.0"
|
|
132
132
|
},
|
|
133
|
-
"gitHead": "
|
|
133
|
+
"gitHead": "3e839a2c8a21d5d1c2682e9bdb97dff3fbaaff4e"
|
|
134
134
|
}
|