@bike4mind/cli 0.2.23 → 0.2.24-cli-file-read-offset.18477

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.
Files changed (2) hide show
  1. package/dist/index.js +57 -34
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -5585,15 +5585,6 @@ var llmAnalysisResponseSchema = z136.object({
5585
5585
  suggestedTags: z136.array(z136.string()).default([])
5586
5586
  });
5587
5587
 
5588
- // ../../b4m-core/packages/services/dist/src/llm/ChatCompletion.js
5589
- import { z as z138 } from "zod";
5590
-
5591
- // ../../b4m-core/packages/services/dist/src/llm/ChatCompletionInvoke.js
5592
- import { fromZodError } from "zod-validation-error";
5593
-
5594
- // ../../b4m-core/packages/services/dist/src/llm/tools/toolManager.js
5595
- var BUILT_IN_TOOL_SET = new Set(b4mLLMTools.options);
5596
-
5597
5588
  // ../../b4m-core/packages/services/dist/src/llm/tools/ToolCacheManager.js
5598
5589
  var DEFAULT_CONFIG = {
5599
5590
  ttl: 5 * 60 * 1e3,
@@ -8859,7 +8850,7 @@ import { existsSync as existsSync3, statSync as statSync4 } from "fs";
8859
8850
  import path7 from "path";
8860
8851
  var MAX_FILE_SIZE2 = 10 * 1024 * 1024;
8861
8852
  async function readFileContent(params) {
8862
- const { path: filePath, encoding = "utf-8", maxLines } = params;
8853
+ const { path: filePath, encoding = "utf-8", offset = 0, limit } = params;
8863
8854
  const normalizedPath = path7.normalize(filePath);
8864
8855
  const resolvedPath = path7.resolve(process.cwd(), normalizedPath);
8865
8856
  const cwd = path7.resolve(process.cwd());
@@ -8881,16 +8872,39 @@ async function readFileContent(params) {
8881
8872
  throw new Error(`File appears to be binary. Use encoding 'base64' to read binary files, or specify a different encoding.`);
8882
8873
  }
8883
8874
  const content = await fs8.readFile(resolvedPath, encoding);
8884
- if (maxLines && typeof content === "string") {
8875
+ if (typeof content === "string") {
8885
8876
  const lines = content.split("\n");
8886
- if (lines.length > maxLines) {
8887
- const truncatedContent = lines.slice(0, maxLines).join("\n");
8888
- return `${truncatedContent}
8877
+ const totalLines = lines.length;
8878
+ if (offset < 0) {
8879
+ throw new Error(`Invalid offset: ${offset}. Offset must be 0 or greater.`);
8880
+ }
8881
+ if (offset >= totalLines) {
8882
+ return `No content to show. File has ${totalLines} lines, but offset is ${offset}.
8883
+ (offset is 0-based, so valid range is 0-${Math.max(0, totalLines - 1)})`;
8884
+ }
8885
+ if (limit !== void 0 && limit > 0) {
8886
+ const endLine = Math.min(offset + limit, totalLines);
8887
+ const paginatedContent = lines.slice(offset, endLine).join("\n");
8888
+ if (endLine < totalLines) {
8889
+ const nextOffset = endLine;
8890
+ return `${paginatedContent}
8889
8891
 
8890
- ... (truncated: ${lines.length - maxLines} more lines, ${stats.size} bytes total)`;
8892
+ ... Showing lines ${offset + 1}-${endLine} of ${totalLines} total lines (${stats.size} bytes total).
8893
+ To read more, use offset: ${nextOffset}`;
8894
+ }
8895
+ return `${paginatedContent}
8896
+
8897
+ ... Showing lines ${offset + 1}-${endLine} of ${totalLines} total lines (${stats.size} bytes total). End of file reached.`;
8891
8898
  }
8899
+ if (offset > 0) {
8900
+ const paginatedContent = lines.slice(offset).join("\n");
8901
+ return `${paginatedContent}
8902
+
8903
+ ... Showing lines ${offset + 1}-${totalLines} of ${totalLines} total lines (${stats.size} bytes total).`;
8904
+ }
8905
+ return content;
8892
8906
  }
8893
- return typeof content === "string" ? content : `[Binary content, ${stats.size} bytes, base64 encoded]
8907
+ return `[Binary content, ${stats.size} bytes, base64 encoded]
8894
8908
  ${content}`;
8895
8909
  }
8896
8910
  async function checkIfBinary(filePath) {
@@ -8927,7 +8941,7 @@ var fileReadTool = {
8927
8941
  },
8928
8942
  toolSchema: {
8929
8943
  name: "file_read",
8930
- description: "Read the contents of a file from the local filesystem. Supports text files with various encodings. Files are restricted to the current working directory and subdirectories for security.",
8944
+ description: "Read the contents of a file from the local filesystem. Supports text files with various encodings. Files are restricted to the current working directory and subdirectories for security. Use offset and limit to paginate through large files.",
8931
8945
  parameters: {
8932
8946
  type: "object",
8933
8947
  properties: {
@@ -8940,9 +8954,13 @@ var fileReadTool = {
8940
8954
  description: "File encoding (default: utf-8). Use base64 for binary files.",
8941
8955
  enum: ["utf-8", "ascii", "base64"]
8942
8956
  },
8943
- maxLines: {
8957
+ offset: {
8958
+ type: "number",
8959
+ description: "For text files, the 0-based line number to start reading from (default: 0). Use with limit to paginate through large files."
8960
+ },
8961
+ limit: {
8944
8962
  type: "number",
8945
- description: "Maximum number of lines to return (optional). Useful for previewing large files. Returns full file by default."
8963
+ description: "For text files, maximum number of lines to read. Use with offset to paginate through large files. If not specified, reads all lines from offset to end of file."
8946
8964
  }
8947
8965
  },
8948
8966
  required: ["path"]
@@ -10097,16 +10115,8 @@ var generateMcpTools = async (mcpData) => {
10097
10115
  import throttle2 from "lodash/throttle.js";
10098
10116
 
10099
10117
  // ../../b4m-core/packages/services/dist/src/llm/ChatCompletionFeatures.js
10118
+ import { z as z138 } from "zod";
10100
10119
  import uniq4 from "lodash/uniq.js";
10101
-
10102
- // ../../b4m-core/packages/services/dist/src/llm/StatusManager.js
10103
- import throttle from "lodash/throttle.js";
10104
-
10105
- // ../../b4m-core/packages/services/dist/src/llm/ChatCompletionProcess.js
10106
- var DISABLE_SERVER_THROTTLING = process.env.DISABLE_SERVER_THROTTLING === "true";
10107
- var questSaveMutex = new Mutex();
10108
-
10109
- // ../../b4m-core/packages/services/dist/src/llm/ChatCompletion.js
10110
10120
  var QuestStartBodySchema = z138.object({
10111
10121
  userId: z138.string(),
10112
10122
  sessionId: z138.string(),
@@ -10148,6 +10158,19 @@ var QuestStartBodySchema = z138.object({
10148
10158
  timezone: z138.string().optional()
10149
10159
  });
10150
10160
 
10161
+ // ../../b4m-core/packages/services/dist/src/llm/StatusManager.js
10162
+ import throttle from "lodash/throttle.js";
10163
+
10164
+ // ../../b4m-core/packages/services/dist/src/llm/ChatCompletionProcess.js
10165
+ var DISABLE_SERVER_THROTTLING = process.env.DISABLE_SERVER_THROTTLING === "true";
10166
+ var questSaveMutex = new Mutex();
10167
+
10168
+ // ../../b4m-core/packages/services/dist/src/llm/ChatCompletionInvoke.js
10169
+ import { fromZodError } from "zod-validation-error";
10170
+
10171
+ // ../../b4m-core/packages/services/dist/src/llm/tools/toolManager.js
10172
+ var BUILT_IN_TOOL_SET = new Set(b4mLLMTools.options);
10173
+
10151
10174
  // ../../b4m-core/packages/services/dist/src/llm/ImageGeneration.js
10152
10175
  import axios8 from "axios";
10153
10176
  import { fileTypeFromBuffer as fileTypeFromBuffer4 } from "file-type";
@@ -12513,7 +12536,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
12513
12536
  // package.json
12514
12537
  var package_default = {
12515
12538
  name: "@bike4mind/cli",
12516
- version: "0.2.23",
12539
+ version: "0.2.24-cli-file-read-offset.18477+b8a15fff7",
12517
12540
  type: "module",
12518
12541
  description: "Interactive CLI tool for Bike4Mind with ReAct agents",
12519
12542
  license: "UNLICENSED",
@@ -12621,10 +12644,10 @@ var package_default = {
12621
12644
  },
12622
12645
  devDependencies: {
12623
12646
  "@bike4mind/agents": "0.1.0",
12624
- "@bike4mind/common": "2.47.0",
12625
- "@bike4mind/mcp": "1.27.0",
12626
- "@bike4mind/services": "2.45.0",
12627
- "@bike4mind/utils": "2.3.2",
12647
+ "@bike4mind/common": "2.47.1-cli-file-read-offset.18477+b8a15fff7",
12648
+ "@bike4mind/mcp": "1.27.1-cli-file-read-offset.18477+b8a15fff7",
12649
+ "@bike4mind/services": "2.45.1-cli-file-read-offset.18477+b8a15fff7",
12650
+ "@bike4mind/utils": "2.3.3-cli-file-read-offset.18477+b8a15fff7",
12628
12651
  "@types/better-sqlite3": "^7.6.13",
12629
12652
  "@types/diff": "^5.0.9",
12630
12653
  "@types/jsonwebtoken": "^9.0.4",
@@ -12641,7 +12664,7 @@ var package_default = {
12641
12664
  optionalDependencies: {
12642
12665
  "@vscode/ripgrep": "^1.17.0"
12643
12666
  },
12644
- gitHead: "ad52049ef04e434ab45416bed8e4754b4b232c0d"
12667
+ gitHead: "b8a15fff785b52f5eb33933284e362331d5f8b1a"
12645
12668
  };
12646
12669
 
12647
12670
  // src/config/constants.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bike4mind/cli",
3
- "version": "0.2.23",
3
+ "version": "0.2.24-cli-file-read-offset.18477+b8a15fff7",
4
4
  "type": "module",
5
5
  "description": "Interactive CLI tool for Bike4Mind with ReAct agents",
6
6
  "license": "UNLICENSED",
@@ -108,10 +108,10 @@
108
108
  },
109
109
  "devDependencies": {
110
110
  "@bike4mind/agents": "0.1.0",
111
- "@bike4mind/common": "2.47.0",
112
- "@bike4mind/mcp": "1.27.0",
113
- "@bike4mind/services": "2.45.0",
114
- "@bike4mind/utils": "2.3.2",
111
+ "@bike4mind/common": "2.47.1-cli-file-read-offset.18477+b8a15fff7",
112
+ "@bike4mind/mcp": "1.27.1-cli-file-read-offset.18477+b8a15fff7",
113
+ "@bike4mind/services": "2.45.1-cli-file-read-offset.18477+b8a15fff7",
114
+ "@bike4mind/utils": "2.3.3-cli-file-read-offset.18477+b8a15fff7",
115
115
  "@types/better-sqlite3": "^7.6.13",
116
116
  "@types/diff": "^5.0.9",
117
117
  "@types/jsonwebtoken": "^9.0.4",
@@ -128,5 +128,5 @@
128
128
  "optionalDependencies": {
129
129
  "@vscode/ripgrep": "^1.17.0"
130
130
  },
131
- "gitHead": "ad52049ef04e434ab45416bed8e4754b4b232c0d"
131
+ "gitHead": "b8a15fff785b52f5eb33933284e362331d5f8b1a"
132
132
  }