@bike4mind/cli 0.2.5-feat-server-side-tool-execution.17093 → 0.2.5-feat-auto-context-customization.17095

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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CurationArtifactType
4
- } from "./chunk-WR6YZRQV.js";
4
+ } from "./chunk-2RFX62SX.js";
5
5
  import "./chunk-PDX44BCA.js";
6
6
 
7
7
  // ../../b4m-core/packages/services/dist/src/notebookCurationService/artifactExtractor.js
@@ -230,7 +230,9 @@ var b4mLLMTools = z3.enum([
230
230
  "create_file",
231
231
  "glob_files",
232
232
  "grep_search",
233
- "delete_file"
233
+ "delete_file",
234
+ // Knowledge base search
235
+ "search_knowledge_base"
234
236
  ]);
235
237
  var B4MLLMToolsList = b4mLLMTools.options.map((tool) => tool);
236
238
  var RechartsChartTypeSchema = z3.enum([
@@ -6,12 +6,12 @@ import {
6
6
  getSettingsByNames,
7
7
  obfuscateApiKey,
8
8
  secureParameters
9
- } from "./chunk-LYNNVNEC.js";
9
+ } from "./chunk-RM2KFSVU.js";
10
10
  import {
11
11
  ApiKeyType,
12
12
  MementoTier,
13
13
  isSupportedEmbeddingModel
14
- } from "./chunk-WR6YZRQV.js";
14
+ } from "./chunk-2RFX62SX.js";
15
15
 
16
16
  // ../../b4m-core/packages/services/dist/src/apiKeyService/get.js
17
17
  import { z } from "zod";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  BadRequestError,
4
4
  secureParameters
5
- } from "./chunk-LYNNVNEC.js";
5
+ } from "./chunk-RM2KFSVU.js";
6
6
  import {
7
7
  GenericCreditDeductTransaction,
8
8
  ImageEditUsageTransaction,
@@ -10,7 +10,7 @@ import {
10
10
  RealtimeVoiceUsageTransaction,
11
11
  TextGenerationUsageTransaction,
12
12
  TransferCreditTransaction
13
- } from "./chunk-WR6YZRQV.js";
13
+ } from "./chunk-2RFX62SX.js";
14
14
 
15
15
  // ../../b4m-core/packages/services/dist/src/creditService/subtractCredits.js
16
16
  import { z } from "zod";
@@ -7,11 +7,11 @@ import {
7
7
  getSettingsMap,
8
8
  getSettingsValue,
9
9
  secureParameters
10
- } from "./chunk-LYNNVNEC.js";
10
+ } from "./chunk-RM2KFSVU.js";
11
11
  import {
12
12
  KnowledgeType,
13
13
  SupportedFabFileMimeTypes
14
- } from "./chunk-WR6YZRQV.js";
14
+ } from "./chunk-2RFX62SX.js";
15
15
 
16
16
  // ../../b4m-core/packages/services/dist/src/fabFileService/create.js
17
17
  import { z } from "zod";
@@ -16,7 +16,7 @@ import {
16
16
  dayjsConfig_default,
17
17
  extractSnippetMeta,
18
18
  settingsMap
19
- } from "./chunk-WR6YZRQV.js";
19
+ } from "./chunk-2RFX62SX.js";
20
20
 
21
21
  // ../../b4m-core/packages/utils/dist/src/storage/S3Storage.js
22
22
  import { S3Client, PutObjectCommand, DeleteObjectCommand, GetObjectCommand, HeadObjectCommand } from "@aws-sdk/client-s3";
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  createFabFile,
4
4
  createFabFileSchema
5
- } from "./chunk-6AJODFPC.js";
6
- import "./chunk-LYNNVNEC.js";
5
+ } from "./chunk-QFDR3XXO.js";
6
+ import "./chunk-RM2KFSVU.js";
7
7
  import "./chunk-AMDXHL6S.js";
8
- import "./chunk-WR6YZRQV.js";
8
+ import "./chunk-2RFX62SX.js";
9
9
  import "./chunk-PDX44BCA.js";
10
10
  export {
11
11
  createFabFile,
package/dist/index.js CHANGED
@@ -4,9 +4,9 @@ import {
4
4
  getEffectiveApiKey,
5
5
  getOpenWeatherKey,
6
6
  getSerperKey
7
- } from "./chunk-WNBKV4FX.js";
8
- import "./chunk-LEG2UM5Q.js";
9
- import "./chunk-6AJODFPC.js";
7
+ } from "./chunk-55PRVW6C.js";
8
+ import "./chunk-GXADX53I.js";
9
+ import "./chunk-QFDR3XXO.js";
10
10
  import {
11
11
  BFLImageService,
12
12
  BaseStorage,
@@ -15,7 +15,7 @@ import {
15
15
  OpenAIBackend,
16
16
  OpenAIImageService,
17
17
  XAIImageService
18
- } from "./chunk-LYNNVNEC.js";
18
+ } from "./chunk-RM2KFSVU.js";
19
19
  import {
20
20
  Logger
21
21
  } from "./chunk-AMDXHL6S.js";
@@ -73,7 +73,7 @@ import {
73
73
  XAI_IMAGE_MODELS,
74
74
  b4mLLMTools,
75
75
  getMcpProviderMetadata
76
- } from "./chunk-WR6YZRQV.js";
76
+ } from "./chunk-2RFX62SX.js";
77
77
  import {
78
78
  __require
79
79
  } from "./chunk-PDX44BCA.js";
@@ -3087,7 +3087,9 @@ var updateSchema = z76.object({
3087
3087
  name: z76.string().optional(),
3088
3088
  description: z76.string().optional(),
3089
3089
  billingContact: z76.string().optional(),
3090
- currentCredits: z76.coerce.number().optional()
3090
+ currentCredits: z76.coerce.number().optional(),
3091
+ systemPrompt: z76.string().max(1e4).optional()
3092
+ // ~2500 tokens
3091
3093
  });
3092
3094
 
3093
3095
  // ../../b4m-core/packages/services/dist/src/organizationService/delete.js
@@ -7879,6 +7881,92 @@ var deleteFileTool = {
7879
7881
  })
7880
7882
  };
7881
7883
 
7884
+ // ../../b4m-core/packages/services/dist/src/llm/tools/implementation/knowledgeBaseSearch/index.js
7885
+ function formatSearchResults(files) {
7886
+ if (files.length === 0) {
7887
+ return "No documents found matching your search query in your knowledge base.";
7888
+ }
7889
+ const formattedFiles = files.map((file, index) => {
7890
+ const tags = file.tags?.map((t) => t.name).join(", ") || "none";
7891
+ const notes = file.notes ? `
7892
+ Notes: ${file.notes}` : "";
7893
+ const fileType = file.type || "FILE";
7894
+ return `${index + 1}. **${file.fileName}**
7895
+ Type: ${fileType} | MIME: ${file.mimeType}
7896
+ Tags: ${tags}${notes}`;
7897
+ });
7898
+ return `Found ${files.length} document(s) in your knowledge base:
7899
+
7900
+ ` + formattedFiles.join("\n\n") + "\n\n*To use these documents in your conversation, you can ask me to reference specific files by name.*";
7901
+ }
7902
+ var knowledgeBaseSearchTool = {
7903
+ name: "search_knowledge_base",
7904
+ implementation: (context) => ({
7905
+ toolFn: async (value) => {
7906
+ const params = value;
7907
+ const { query, tags, file_type, max_results = 5 } = params;
7908
+ console.log("\u{1F4DA} Knowledge Base Search: Starting search for query:", query);
7909
+ if (!context.db.fabfiles) {
7910
+ console.error("\u274C Knowledge Base Search: fabfiles repository not available");
7911
+ return "Knowledge base search is not available at this time.";
7912
+ }
7913
+ try {
7914
+ const searchResults = await context.db.fabfiles.search(context.userId, query, {
7915
+ tags: tags || [],
7916
+ type: file_type,
7917
+ shared: false
7918
+ // Search all accessible files, not just shared
7919
+ }, {
7920
+ page: 1,
7921
+ limit: Math.min(max_results, 10)
7922
+ // Cap at 10 results
7923
+ }, {
7924
+ by: "fileName",
7925
+ direction: "asc"
7926
+ }, {
7927
+ includeShared: true
7928
+ // Include organization and explicitly shared files
7929
+ });
7930
+ console.log("\u{1F4DA} Knowledge Base Search: Found", searchResults.data.length, "results");
7931
+ return formatSearchResults(searchResults.data);
7932
+ } catch (error) {
7933
+ console.error("\u274C Knowledge Base Search: Error during search:", error);
7934
+ return "An error occurred while searching your knowledge base. Please try again.";
7935
+ }
7936
+ },
7937
+ toolSchema: {
7938
+ name: "search_knowledge_base",
7939
+ 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.",
7940
+ parameters: {
7941
+ type: "object",
7942
+ properties: {
7943
+ query: {
7944
+ type: "string",
7945
+ description: "The search query to find relevant documents by filename or content"
7946
+ },
7947
+ tags: {
7948
+ type: "array",
7949
+ items: { type: "string" },
7950
+ description: "Optional: filter results to only include files with these tags"
7951
+ },
7952
+ file_type: {
7953
+ type: "string",
7954
+ enum: ["pdf", "text", "image", "excel", "word", "json", "csv", "markdown", "code", "url"],
7955
+ description: "Optional: filter results by file type"
7956
+ },
7957
+ max_results: {
7958
+ type: "number",
7959
+ description: "Maximum number of results to return (default: 5, max: 10)",
7960
+ minimum: 1,
7961
+ maximum: 10
7962
+ }
7963
+ },
7964
+ required: ["query"]
7965
+ }
7966
+ }
7967
+ })
7968
+ };
7969
+
7882
7970
  // ../../b4m-core/packages/services/dist/src/llm/tools/index.js
7883
7971
  var tools = {
7884
7972
  dice_roll: diceRollTool,
@@ -7906,7 +7994,9 @@ var tools = {
7906
7994
  create_file: createFileTool,
7907
7995
  glob_files: globFilesTool,
7908
7996
  grep_search: grepSearchTool,
7909
- delete_file: deleteFileTool
7997
+ delete_file: deleteFileTool,
7998
+ // Knowledge base search
7999
+ search_knowledge_base: knowledgeBaseSearchTool
7910
8000
  };
7911
8001
  var generateTools = (userId, user, logger2, { db }, storage, imageGenerateStorage, statusUpdate, onStart, onFinish, llm, config, model) => {
7912
8002
  const context = {
@@ -9402,7 +9492,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
9402
9492
  // package.json
9403
9493
  var package_default = {
9404
9494
  name: "@bike4mind/cli",
9405
- version: "0.2.5-feat-server-side-tool-execution.17093+db1662b89",
9495
+ version: "0.2.5-feat-auto-context-customization.17095+87596453c",
9406
9496
  type: "module",
9407
9497
  description: "Interactive CLI tool for Bike4Mind with ReAct agents",
9408
9498
  license: "UNLICENSED",
@@ -9504,10 +9594,10 @@ var package_default = {
9504
9594
  },
9505
9595
  devDependencies: {
9506
9596
  "@bike4mind/agents": "0.1.0",
9507
- "@bike4mind/common": "2.37.1-feat-server-side-tool-execution.17093+db1662b89",
9508
- "@bike4mind/mcp": "1.19.6-feat-server-side-tool-execution.17093+db1662b89",
9509
- "@bike4mind/services": "2.32.2-feat-server-side-tool-execution.17093+db1662b89",
9510
- "@bike4mind/utils": "2.1.1-feat-server-side-tool-execution.17093+db1662b89",
9597
+ "@bike4mind/common": "2.37.1-feat-auto-context-customization.17095+87596453c",
9598
+ "@bike4mind/mcp": "1.19.6-feat-auto-context-customization.17095+87596453c",
9599
+ "@bike4mind/services": "2.32.2-feat-auto-context-customization.17095+87596453c",
9600
+ "@bike4mind/utils": "2.1.1-feat-auto-context-customization.17095+87596453c",
9511
9601
  "@types/diff": "^5.0.9",
9512
9602
  "@types/jsonwebtoken": "^9.0.4",
9513
9603
  "@types/node": "^22.9.0",
@@ -9519,7 +9609,7 @@ var package_default = {
9519
9609
  typescript: "^5.9.3",
9520
9610
  vitest: "^3.2.4"
9521
9611
  },
9522
- gitHead: "db1662b8926451c7fdba8eb99245b75f6fae6693"
9612
+ gitHead: "87596453cb00639e899f648a585324f86425ab17"
9523
9613
  };
9524
9614
 
9525
9615
  // src/config/constants.ts
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CurationArtifactType
4
- } from "./chunk-WR6YZRQV.js";
4
+ } from "./chunk-2RFX62SX.js";
5
5
  import "./chunk-PDX44BCA.js";
6
6
 
7
7
  // ../../b4m-core/packages/services/dist/src/notebookCurationService/llmMarkdownGenerator.js
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CurationArtifactType
4
- } from "./chunk-WR6YZRQV.js";
4
+ } from "./chunk-2RFX62SX.js";
5
5
  import "./chunk-PDX44BCA.js";
6
6
 
7
7
  // ../../b4m-core/packages/services/dist/src/notebookCurationService/markdownGenerator.js
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  findMostSimilarMemento,
4
4
  getRelevantMementos
5
- } from "./chunk-WNBKV4FX.js";
6
- import "./chunk-LYNNVNEC.js";
5
+ } from "./chunk-55PRVW6C.js";
6
+ import "./chunk-RM2KFSVU.js";
7
7
  import "./chunk-AMDXHL6S.js";
8
- import "./chunk-WR6YZRQV.js";
8
+ import "./chunk-2RFX62SX.js";
9
9
  import "./chunk-PDX44BCA.js";
10
10
  export {
11
11
  findMostSimilarMemento,
@@ -120,7 +120,7 @@ import {
120
120
  validateMermaidSyntax,
121
121
  warmUpSettingsCache,
122
122
  withRetry
123
- } from "./chunk-LYNNVNEC.js";
123
+ } from "./chunk-RM2KFSVU.js";
124
124
  import {
125
125
  Logger,
126
126
  NotificationDeduplicator,
@@ -129,7 +129,7 @@ import {
129
129
  postLowCreditsNotificationToSlack,
130
130
  postMessageToSlack
131
131
  } from "./chunk-AMDXHL6S.js";
132
- import "./chunk-WR6YZRQV.js";
132
+ import "./chunk-2RFX62SX.js";
133
133
  import "./chunk-PDX44BCA.js";
134
134
  export {
135
135
  AWSBackend,
@@ -291,7 +291,7 @@ import {
291
291
  validateQuestMasterArtifactV2,
292
292
  validateReactArtifactV2,
293
293
  validateSvgArtifactV2
294
- } from "./chunk-WR6YZRQV.js";
294
+ } from "./chunk-2RFX62SX.js";
295
295
  import "./chunk-PDX44BCA.js";
296
296
  export {
297
297
  ALL_IMAGE_MODELS,
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  SubtractCreditsSchema,
4
4
  subtractCredits
5
- } from "./chunk-LEG2UM5Q.js";
6
- import "./chunk-LYNNVNEC.js";
5
+ } from "./chunk-GXADX53I.js";
6
+ import "./chunk-RM2KFSVU.js";
7
7
  import "./chunk-AMDXHL6S.js";
8
- import "./chunk-WR6YZRQV.js";
8
+ import "./chunk-2RFX62SX.js";
9
9
  import "./chunk-PDX44BCA.js";
10
10
  export {
11
11
  SubtractCreditsSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bike4mind/cli",
3
- "version": "0.2.5-feat-server-side-tool-execution.17093+db1662b89",
3
+ "version": "0.2.5-feat-auto-context-customization.17095+87596453c",
4
4
  "type": "module",
5
5
  "description": "Interactive CLI tool for Bike4Mind with ReAct agents",
6
6
  "license": "UNLICENSED",
@@ -102,10 +102,10 @@
102
102
  },
103
103
  "devDependencies": {
104
104
  "@bike4mind/agents": "0.1.0",
105
- "@bike4mind/common": "2.37.1-feat-server-side-tool-execution.17093+db1662b89",
106
- "@bike4mind/mcp": "1.19.6-feat-server-side-tool-execution.17093+db1662b89",
107
- "@bike4mind/services": "2.32.2-feat-server-side-tool-execution.17093+db1662b89",
108
- "@bike4mind/utils": "2.1.1-feat-server-side-tool-execution.17093+db1662b89",
105
+ "@bike4mind/common": "2.37.1-feat-auto-context-customization.17095+87596453c",
106
+ "@bike4mind/mcp": "1.19.6-feat-auto-context-customization.17095+87596453c",
107
+ "@bike4mind/services": "2.32.2-feat-auto-context-customization.17095+87596453c",
108
+ "@bike4mind/utils": "2.1.1-feat-auto-context-customization.17095+87596453c",
109
109
  "@types/diff": "^5.0.9",
110
110
  "@types/jsonwebtoken": "^9.0.4",
111
111
  "@types/node": "^22.9.0",
@@ -117,5 +117,5 @@
117
117
  "typescript": "^5.9.3",
118
118
  "vitest": "^3.2.4"
119
119
  },
120
- "gitHead": "db1662b8926451c7fdba8eb99245b75f6fae6693"
120
+ "gitHead": "87596453cb00639e899f648a585324f86425ab17"
121
121
  }