@bike4mind/cli 0.2.13 → 0.2.14-feat-auto-context-customization.17477

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.
File without changes
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CurationArtifactType
4
- } from "./chunk-A7POWM75.js";
4
+ } from "./chunk-PGQJWOFR.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-SZXO7HOF.js";
5
+ } from "./chunk-TJAFO6U3.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-A7POWM75.js";
14
+ } from "./chunk-PGQJWOFR.js";
15
15
 
16
16
  // ../../b4m-core/packages/services/dist/src/creditService/subtractCredits.js
17
17
  import { z } from "zod";
File without changes
File without changes
@@ -6,12 +6,12 @@ import {
6
6
  getSettingsByNames,
7
7
  obfuscateApiKey,
8
8
  secureParameters
9
- } from "./chunk-SZXO7HOF.js";
9
+ } from "./chunk-TJAFO6U3.js";
10
10
  import {
11
11
  ApiKeyType,
12
12
  MementoTier,
13
13
  isSupportedEmbeddingModel
14
- } from "./chunk-A7POWM75.js";
14
+ } from "./chunk-PGQJWOFR.js";
15
15
 
16
16
  // ../../b4m-core/packages/services/dist/src/apiKeyService/get.js
17
17
  import { z } from "zod";
File without changes
@@ -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
  ]);
@@ -7,11 +7,11 @@ import {
7
7
  getSettingsMap,
8
8
  getSettingsValue,
9
9
  secureParameters
10
- } from "./chunk-SZXO7HOF.js";
10
+ } from "./chunk-TJAFO6U3.js";
11
11
  import {
12
12
  KnowledgeType,
13
13
  SupportedFabFileMimeTypes
14
- } from "./chunk-A7POWM75.js";
14
+ } from "./chunk-PGQJWOFR.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-A7POWM75.js";
19
+ } from "./chunk-PGQJWOFR.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-K44CDTQN.js";
6
- import "./chunk-SZXO7HOF.js";
5
+ } from "./chunk-QPYHK4UF.js";
6
+ import "./chunk-TJAFO6U3.js";
7
7
  import "./chunk-OCYRD7D6.js";
8
- import "./chunk-A7POWM75.js";
8
+ import "./chunk-PGQJWOFR.js";
9
9
  export {
10
10
  createFabFile,
11
11
  createFabFileSchema
File without changes
package/dist/index.js CHANGED
@@ -4,9 +4,9 @@ import {
4
4
  getEffectiveApiKey,
5
5
  getOpenWeatherKey,
6
6
  getSerperKey
7
- } from "./chunk-3MT5HI3G.js";
8
- import "./chunk-PMY7IPOC.js";
9
- import "./chunk-K44CDTQN.js";
7
+ } from "./chunk-NR4J636Y.js";
8
+ import "./chunk-7CKPTTMR.js";
9
+ import "./chunk-QPYHK4UF.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-SZXO7HOF.js";
18
+ } from "./chunk-TJAFO6U3.js";
19
19
  import {
20
20
  Logger
21
21
  } from "./chunk-OCYRD7D6.js";
@@ -73,7 +73,7 @@ import {
73
73
  XAI_IMAGE_MODELS,
74
74
  b4mLLMTools,
75
75
  getMcpProviderMetadata
76
- } from "./chunk-A7POWM75.js";
76
+ } from "./chunk-PGQJWOFR.js";
77
77
 
78
78
  // src/index.tsx
79
79
  import React17, { useState as useState8, useEffect as useEffect3, useCallback, useRef as useRef2 } from "react";
@@ -4395,7 +4395,9 @@ var updateSchema = z77.object({
4395
4395
  name: z77.string().optional(),
4396
4396
  description: z77.string().optional(),
4397
4397
  billingContact: z77.string().optional(),
4398
- currentCredits: z77.coerce.number().optional()
4398
+ currentCredits: z77.coerce.number().optional(),
4399
+ systemPrompt: z77.string().max(1e4).optional()
4400
+ // ~2500 tokens
4399
4401
  });
4400
4402
 
4401
4403
  // ../../b4m-core/packages/services/dist/src/organizationService/delete.js
@@ -9172,6 +9174,92 @@ var deleteFileTool = {
9172
9174
  })
9173
9175
  };
9174
9176
 
9177
+ // ../../b4m-core/packages/services/dist/src/llm/tools/implementation/knowledgeBaseSearch/index.js
9178
+ function formatSearchResults(files) {
9179
+ if (files.length === 0) {
9180
+ return "No documents found matching your search query in your knowledge base.";
9181
+ }
9182
+ const formattedFiles = files.map((file, index) => {
9183
+ const tags = file.tags?.map((t) => t.name).join(", ") || "none";
9184
+ const notes = file.notes ? `
9185
+ Notes: ${file.notes}` : "";
9186
+ const fileType = file.type || "FILE";
9187
+ return `${index + 1}. **${file.fileName}**
9188
+ Type: ${fileType} | MIME: ${file.mimeType}
9189
+ Tags: ${tags}${notes}`;
9190
+ });
9191
+ return `Found ${files.length} document(s) in your knowledge base:
9192
+
9193
+ ` + formattedFiles.join("\n\n") + "\n\n*To use these documents in your conversation, you can ask me to reference specific files by name.*";
9194
+ }
9195
+ var knowledgeBaseSearchTool = {
9196
+ name: "search_knowledge_base",
9197
+ implementation: (context) => ({
9198
+ toolFn: async (value) => {
9199
+ const params = value;
9200
+ const { query, tags, file_type, max_results = 5 } = params;
9201
+ console.log("\u{1F4DA} Knowledge Base Search: Starting search for query:", query);
9202
+ if (!context.db.fabfiles) {
9203
+ console.error("\u274C Knowledge Base Search: fabfiles repository not available");
9204
+ return "Knowledge base search is not available at this time.";
9205
+ }
9206
+ try {
9207
+ const searchResults = await context.db.fabfiles.search(context.userId, query, {
9208
+ tags: tags || [],
9209
+ type: file_type,
9210
+ shared: false
9211
+ // Search all accessible files, not just shared
9212
+ }, {
9213
+ page: 1,
9214
+ limit: Math.min(max_results, 10)
9215
+ // Cap at 10 results
9216
+ }, {
9217
+ by: "fileName",
9218
+ direction: "asc"
9219
+ }, {
9220
+ includeShared: true
9221
+ // Include organization and explicitly shared files
9222
+ });
9223
+ console.log("\u{1F4DA} Knowledge Base Search: Found", searchResults.data.length, "results");
9224
+ return formatSearchResults(searchResults.data);
9225
+ } catch (error) {
9226
+ console.error("\u274C Knowledge Base Search: Error during search:", error);
9227
+ return "An error occurred while searching your knowledge base. Please try again.";
9228
+ }
9229
+ },
9230
+ toolSchema: {
9231
+ name: "search_knowledge_base",
9232
+ 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.",
9233
+ parameters: {
9234
+ type: "object",
9235
+ properties: {
9236
+ query: {
9237
+ type: "string",
9238
+ description: "The search query to find relevant documents by filename or content"
9239
+ },
9240
+ tags: {
9241
+ type: "array",
9242
+ items: { type: "string" },
9243
+ description: "Optional: filter results to only include files with these tags"
9244
+ },
9245
+ file_type: {
9246
+ type: "string",
9247
+ enum: ["pdf", "text", "image", "excel", "word", "json", "csv", "markdown", "code", "url"],
9248
+ description: "Optional: filter results by file type"
9249
+ },
9250
+ max_results: {
9251
+ type: "number",
9252
+ description: "Maximum number of results to return (default: 5, max: 10)",
9253
+ minimum: 1,
9254
+ maximum: 10
9255
+ }
9256
+ },
9257
+ required: ["query"]
9258
+ }
9259
+ }
9260
+ })
9261
+ };
9262
+
9175
9263
  // ../../b4m-core/packages/services/dist/src/llm/tools/implementation/bashExecute/index.js
9176
9264
  import { spawn } from "child_process";
9177
9265
  import path12 from "path";
@@ -9674,6 +9762,8 @@ var tools = {
9674
9762
  glob_files: globFilesTool,
9675
9763
  grep_search: grepSearchTool,
9676
9764
  delete_file: deleteFileTool,
9765
+ // Knowledge base search
9766
+ search_knowledge_base: knowledgeBaseSearchTool,
9677
9767
  // Shell execution
9678
9768
  bash_execute: bashExecuteTool
9679
9769
  };
@@ -11828,7 +11918,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
11828
11918
  // package.json
11829
11919
  var package_default = {
11830
11920
  name: "@bike4mind/cli",
11831
- version: "0.2.13",
11921
+ version: "0.2.14-feat-auto-context-customization.17477+d37aab404",
11832
11922
  type: "module",
11833
11923
  description: "Interactive CLI tool for Bike4Mind with ReAct agents",
11834
11924
  license: "UNLICENSED",
@@ -11933,11 +12023,11 @@ var package_default = {
11933
12023
  zustand: "^4.5.4"
11934
12024
  },
11935
12025
  devDependencies: {
11936
- "@bike4mind/agents": "workspace:*",
11937
- "@bike4mind/common": "workspace:*",
11938
- "@bike4mind/mcp": "workspace:*",
11939
- "@bike4mind/services": "workspace:*",
11940
- "@bike4mind/utils": "workspace:*",
12026
+ "@bike4mind/agents": "0.1.0",
12027
+ "@bike4mind/common": "2.42.1-feat-auto-context-customization.17477+d37aab404",
12028
+ "@bike4mind/mcp": "1.21.3-feat-auto-context-customization.17477+d37aab404",
12029
+ "@bike4mind/services": "2.37.1-feat-auto-context-customization.17477+d37aab404",
12030
+ "@bike4mind/utils": "2.1.8-feat-auto-context-customization.17477+d37aab404",
11941
12031
  "@types/better-sqlite3": "^7.6.13",
11942
12032
  "@types/diff": "^5.0.9",
11943
12033
  "@types/jsonwebtoken": "^9.0.4",
@@ -11950,7 +12040,8 @@ var package_default = {
11950
12040
  tsx: "^4.21.0",
11951
12041
  typescript: "^5.9.3",
11952
12042
  vitest: "^3.2.4"
11953
- }
12043
+ },
12044
+ gitHead: "d37aab40411dfc92c084c715054d5ea3aaaff579"
11954
12045
  };
11955
12046
 
11956
12047
  // src/config/constants.ts
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CurationArtifactType
4
- } from "./chunk-A7POWM75.js";
4
+ } from "./chunk-PGQJWOFR.js";
5
5
 
6
6
  // ../../b4m-core/packages/services/dist/src/notebookCurationService/llmMarkdownGenerator.js
7
7
  var DEFAULT_OPTIONS = {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CurationArtifactType
4
- } from "./chunk-A7POWM75.js";
4
+ } from "./chunk-PGQJWOFR.js";
5
5
 
6
6
  // ../../b4m-core/packages/services/dist/src/notebookCurationService/markdownGenerator.js
7
7
  var DEFAULT_OPTIONS = {
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  findMostSimilarMemento,
4
4
  getRelevantMementos
5
- } from "./chunk-3MT5HI3G.js";
6
- import "./chunk-SZXO7HOF.js";
5
+ } from "./chunk-NR4J636Y.js";
6
+ import "./chunk-TJAFO6U3.js";
7
7
  import "./chunk-OCYRD7D6.js";
8
- import "./chunk-A7POWM75.js";
8
+ import "./chunk-PGQJWOFR.js";
9
9
  export {
10
10
  findMostSimilarMemento,
11
11
  getRelevantMementos
File without changes
@@ -120,7 +120,7 @@ import {
120
120
  validateMermaidSyntax,
121
121
  warmUpSettingsCache,
122
122
  withRetry
123
- } from "./chunk-SZXO7HOF.js";
123
+ } from "./chunk-TJAFO6U3.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-OCYRD7D6.js";
132
- import "./chunk-A7POWM75.js";
132
+ import "./chunk-PGQJWOFR.js";
133
133
  export {
134
134
  AWSBackend,
135
135
  AdminSettingsCache,
@@ -296,7 +296,7 @@ import {
296
296
  validateReactArtifactV2,
297
297
  validateSvgArtifactV2,
298
298
  wikiMarkupToAdf
299
- } from "./chunk-A7POWM75.js";
299
+ } from "./chunk-PGQJWOFR.js";
300
300
  export {
301
301
  ALL_IMAGE_MODELS,
302
302
  ALL_IMAGE_SIZES,
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  SubtractCreditsSchema,
4
4
  subtractCredits
5
- } from "./chunk-PMY7IPOC.js";
6
- import "./chunk-SZXO7HOF.js";
5
+ } from "./chunk-7CKPTTMR.js";
6
+ import "./chunk-TJAFO6U3.js";
7
7
  import "./chunk-OCYRD7D6.js";
8
- import "./chunk-A7POWM75.js";
8
+ import "./chunk-PGQJWOFR.js";
9
9
  export {
10
10
  SubtractCreditsSchema,
11
11
  subtractCredits
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bike4mind/cli",
3
- "version": "0.2.13",
3
+ "version": "0.2.14-feat-auto-context-customization.17477+d37aab404",
4
4
  "type": "module",
5
5
  "description": "Interactive CLI tool for Bike4Mind with ReAct agents",
6
6
  "license": "UNLICENSED",
@@ -30,6 +30,16 @@
30
30
  "dist",
31
31
  "bin"
32
32
  ],
33
+ "scripts": {
34
+ "dev": "tsx src/index.tsx",
35
+ "build": "tsup",
36
+ "typecheck": "tsc --noEmit",
37
+ "test": "vitest run",
38
+ "test:watch": "vitest",
39
+ "start": "node dist/index.js",
40
+ "prepublishOnly": "pnpm build",
41
+ "postinstall": "node -e \"try { require('better-sqlite3') } catch(e) { if(e.message.includes('bindings')) { console.log('\\n⚠️ Rebuilding better-sqlite3 native bindings...'); require('child_process').execSync('pnpm rebuild better-sqlite3', {stdio:'inherit'}) } }\""
42
+ },
33
43
  "dependencies": {
34
44
  "@anthropic-ai/sdk": "^0.22.0",
35
45
  "@aws-sdk/client-apigatewaymanagementapi": "3.654.0",
@@ -95,6 +105,11 @@
95
105
  "zustand": "^4.5.4"
96
106
  },
97
107
  "devDependencies": {
108
+ "@bike4mind/agents": "0.1.0",
109
+ "@bike4mind/common": "2.42.1-feat-auto-context-customization.17477+d37aab404",
110
+ "@bike4mind/mcp": "1.21.3-feat-auto-context-customization.17477+d37aab404",
111
+ "@bike4mind/services": "2.37.1-feat-auto-context-customization.17477+d37aab404",
112
+ "@bike4mind/utils": "2.1.8-feat-auto-context-customization.17477+d37aab404",
98
113
  "@types/better-sqlite3": "^7.6.13",
99
114
  "@types/diff": "^5.0.9",
100
115
  "@types/jsonwebtoken": "^9.0.4",
@@ -106,20 +121,7 @@
106
121
  "tsup": "^8.5.1",
107
122
  "tsx": "^4.21.0",
108
123
  "typescript": "^5.9.3",
109
- "vitest": "^3.2.4",
110
- "@bike4mind/agents": "0.1.0",
111
- "@bike4mind/common": "2.42.0",
112
- "@bike4mind/mcp": "1.21.2",
113
- "@bike4mind/services": "2.37.0",
114
- "@bike4mind/utils": "2.1.7"
124
+ "vitest": "^3.2.4"
115
125
  },
116
- "scripts": {
117
- "dev": "tsx src/index.tsx",
118
- "build": "tsup",
119
- "typecheck": "tsc --noEmit",
120
- "test": "vitest run",
121
- "test:watch": "vitest",
122
- "start": "node dist/index.js",
123
- "postinstall": "node -e \"try { require('better-sqlite3') } catch(e) { if(e.message.includes('bindings')) { console.log('\\n⚠️ Rebuilding better-sqlite3 native bindings...'); require('child_process').execSync('pnpm rebuild better-sqlite3', {stdio:'inherit'}) } }\""
124
- }
125
- }
126
+ "gitHead": "d37aab40411dfc92c084c715054d5ea3aaaff579"
127
+ }