@bike4mind/cli 0.2.49-prod.21090 → 0.2.49

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.
@@ -1638,10 +1638,10 @@ You can use:
1638
1638
  }
1639
1639
  };
1640
1640
 
1641
- // ../../b4m-core/packages/agents/src/ReActAgent.ts
1641
+ // ../../b4m-core/packages/agents/dist/src/ReActAgent.js
1642
1642
  import { EventEmitter } from "events";
1643
1643
 
1644
- // ../../b4m-core/packages/agents/src/toolParallelizer.ts
1644
+ // ../../b4m-core/packages/agents/dist/src/toolParallelizer.js
1645
1645
  var DEFAULT_WRITE_TOOLS = /* @__PURE__ */ new Set([
1646
1646
  "edit_file",
1647
1647
  "edit_local_file",
@@ -1760,17 +1760,18 @@ function shouldUseParallelExecution(toolsUsed, isReadOnly = defaultIsReadOnlyToo
1760
1760
  return readOnlyCount >= 2;
1761
1761
  }
1762
1762
 
1763
- // ../../b4m-core/packages/agents/src/ReActAgent.ts
1763
+ // ../../b4m-core/packages/agents/dist/src/ReActAgent.js
1764
1764
  var ReActAgent = class extends EventEmitter {
1765
+ context;
1766
+ steps = [];
1767
+ totalTokens = 0;
1768
+ totalInputTokens = 0;
1769
+ totalOutputTokens = 0;
1770
+ totalCredits = 0;
1771
+ toolCallCount = 0;
1772
+ observationQueue = [];
1765
1773
  constructor(context) {
1766
1774
  super();
1767
- this.steps = [];
1768
- this.totalTokens = 0;
1769
- this.totalInputTokens = 0;
1770
- this.totalOutputTokens = 0;
1771
- this.totalCredits = 0;
1772
- this.toolCallCount = 0;
1773
- this.observationQueue = [];
1774
1775
  this.context = {
1775
1776
  ...context,
1776
1777
  maxIterations: context.maxIterations ?? 5,
@@ -1844,116 +1845,105 @@ ${options.context}` : this.getSystemPrompt()
1844
1845
  let currentText = "";
1845
1846
  const processedToolIds = /* @__PURE__ */ new Set();
1846
1847
  let hadToolCalls = false;
1847
- await this.context.llm.complete(
1848
- this.context.model,
1849
- messages,
1850
- {
1851
- stream: false,
1852
- tools: this.context.tools,
1853
- maxTokens,
1854
- temperature,
1855
- abortSignal: options.signal,
1856
- tool_choice: this.context.toolChoice,
1857
- executeTools: false,
1858
- thinking: this.context.thinking
1859
- },
1860
- async (texts, completionInfo) => {
1861
- for (const text of texts) {
1862
- if (text) {
1863
- currentText += text;
1864
- }
1848
+ await this.context.llm.complete(this.context.model, messages, {
1849
+ stream: false,
1850
+ tools: this.context.tools,
1851
+ maxTokens,
1852
+ temperature,
1853
+ abortSignal: options.signal,
1854
+ tool_choice: this.context.toolChoice,
1855
+ executeTools: false,
1856
+ thinking: this.context.thinking
1857
+ }, async (texts, completionInfo) => {
1858
+ for (const text of texts) {
1859
+ if (text) {
1860
+ currentText += text;
1865
1861
  }
1866
- if (completionInfo) {
1867
- const inputTokens = completionInfo.inputTokens || 0;
1868
- const outputTokens = completionInfo.outputTokens || 0;
1869
- this.totalTokens += inputTokens + outputTokens;
1870
- this.totalInputTokens += inputTokens;
1871
- this.totalOutputTokens += outputTokens;
1872
- if (completionInfo.creditsUsed) {
1873
- this.totalCredits += completionInfo.creditsUsed;
1874
- }
1875
- if (currentText.trim() && completionInfo.toolsUsed?.length) {
1876
- const thoughtStep = {
1877
- type: "thought",
1878
- content: currentText.trim(),
1879
- metadata: {
1880
- timestamp: Date.now()
1881
- }
1882
- };
1883
- this.steps.push(thoughtStep);
1884
- this.emit("thought", thoughtStep);
1885
- }
1886
- if (!completionInfo.toolsUsed?.length && currentText.trim()) {
1887
- finalAnswer = currentText.trim();
1888
- const finalStep = {
1889
- type: "final_answer",
1890
- content: finalAnswer,
1891
- metadata: {
1892
- timestamp: Date.now(),
1893
- tokenUsage: {
1894
- prompt: inputTokens,
1895
- completion: outputTokens,
1896
- total: inputTokens + outputTokens
1897
- }
1862
+ }
1863
+ if (completionInfo) {
1864
+ const inputTokens = completionInfo.inputTokens || 0;
1865
+ const outputTokens = completionInfo.outputTokens || 0;
1866
+ this.totalTokens += inputTokens + outputTokens;
1867
+ this.totalInputTokens += inputTokens;
1868
+ this.totalOutputTokens += outputTokens;
1869
+ if (completionInfo.creditsUsed) {
1870
+ this.totalCredits += completionInfo.creditsUsed;
1871
+ }
1872
+ if (currentText.trim() && completionInfo.toolsUsed?.length) {
1873
+ const thoughtStep = {
1874
+ type: "thought",
1875
+ content: currentText.trim(),
1876
+ metadata: {
1877
+ timestamp: Date.now()
1878
+ }
1879
+ };
1880
+ this.steps.push(thoughtStep);
1881
+ this.emit("thought", thoughtStep);
1882
+ }
1883
+ if (!completionInfo.toolsUsed?.length && currentText.trim()) {
1884
+ finalAnswer = currentText.trim();
1885
+ const finalStep = {
1886
+ type: "final_answer",
1887
+ content: finalAnswer,
1888
+ metadata: {
1889
+ timestamp: Date.now(),
1890
+ tokenUsage: {
1891
+ prompt: inputTokens,
1892
+ completion: outputTokens,
1893
+ total: inputTokens + outputTokens
1898
1894
  }
1899
- };
1900
- this.steps.push(finalStep);
1901
- this.emit("final_answer", finalStep);
1902
- iterationComplete = true;
1895
+ }
1896
+ };
1897
+ this.steps.push(finalStep);
1898
+ this.emit("final_answer", finalStep);
1899
+ iterationComplete = true;
1900
+ }
1901
+ if (completionInfo.toolsUsed && completionInfo.toolsUsed.length > 0) {
1902
+ hadToolCalls = true;
1903
+ const thinkingBlocks = completionInfo.thinking || [];
1904
+ const unprocessedTools = [];
1905
+ for (const toolUse of completionInfo.toolsUsed) {
1906
+ const toolCallIdStr = getToolId(toolUse);
1907
+ if (!processedToolIds.has(toolCallIdStr)) {
1908
+ processedToolIds.add(toolCallIdStr);
1909
+ unprocessedTools.push(toolUse);
1910
+ }
1903
1911
  }
1904
- if (completionInfo.toolsUsed && completionInfo.toolsUsed.length > 0) {
1905
- hadToolCalls = true;
1906
- const thinkingBlocks = completionInfo.thinking || [];
1907
- const unprocessedTools = [];
1908
- for (const toolUse of completionInfo.toolsUsed) {
1909
- const toolCallIdStr = getToolId(toolUse);
1910
- if (!processedToolIds.has(toolCallIdStr)) {
1911
- processedToolIds.add(toolCallIdStr);
1912
- unprocessedTools.push(toolUse);
1913
- }
1912
+ if (unprocessedTools.length === 0) {
1913
+ } else if (options.parallelExecution && shouldUseParallelExecution(unprocessedTools, options.isReadOnlyTool ?? defaultIsReadOnlyTool)) {
1914
+ this.context.logger.debug(`[ReActAgent] Parallel execution enabled for ${unprocessedTools.length} tools`);
1915
+ for (const toolUse of unprocessedTools) {
1916
+ this.emitActionStep(toolUse);
1914
1917
  }
1915
- if (unprocessedTools.length === 0) {
1916
- } else if (options.parallelExecution && shouldUseParallelExecution(unprocessedTools, options.isReadOnlyTool ?? defaultIsReadOnlyTool)) {
1917
- this.context.logger.debug(
1918
- `[ReActAgent] Parallel execution enabled for ${unprocessedTools.length} tools`
1919
- );
1920
- for (const toolUse of unprocessedTools) {
1921
- this.emitActionStep(toolUse);
1922
- }
1923
- const plan = categorizeTools(unprocessedTools, options.isReadOnlyTool ?? defaultIsReadOnlyTool);
1924
- const results = await executeToolsInParallel(
1925
- plan,
1926
- (toolUse) => this.executeToolWithQueueFallback(toolUse),
1927
- options.signal
1928
- );
1929
- for (const toolUse of unprocessedTools) {
1930
- const toolIdStr = getToolId(toolUse);
1931
- const result2 = results.get(toolIdStr);
1932
- const observation = result2?.status === "fulfilled" ? result2.result ?? "" : `Error: ${result2?.error?.message ?? "Unknown error"}`;
1918
+ const plan = categorizeTools(unprocessedTools, options.isReadOnlyTool ?? defaultIsReadOnlyTool);
1919
+ const results = await executeToolsInParallel(plan, (toolUse) => this.executeToolWithQueueFallback(toolUse), options.signal);
1920
+ for (const toolUse of unprocessedTools) {
1921
+ const toolIdStr = getToolId(toolUse);
1922
+ const result2 = results.get(toolIdStr);
1923
+ const observation = result2?.status === "fulfilled" ? result2.result ?? "" : `Error: ${result2?.error?.message ?? "Unknown error"}`;
1924
+ this.appendToolMessages(messages, toolUse, observation, thinkingBlocks);
1925
+ this.emitObservationStep(toolUse.name, observation);
1926
+ }
1927
+ } else {
1928
+ for (const toolUse of unprocessedTools) {
1929
+ this.emitActionStep(toolUse);
1930
+ const queuedObs = this.observationQueue.find((obs) => obs.toolId === getToolId(toolUse));
1931
+ let observation;
1932
+ if (queuedObs) {
1933
+ const result2 = queuedObs.result;
1934
+ const index = this.observationQueue.indexOf(queuedObs);
1935
+ this.observationQueue.splice(index, 1);
1936
+ observation = typeof result2 === "string" ? result2 : JSON.stringify(result2);
1937
+ } else {
1938
+ observation = await this.executeToolWithQueueFallback(toolUse);
1933
1939
  this.appendToolMessages(messages, toolUse, observation, thinkingBlocks);
1934
- this.emitObservationStep(toolUse.name, observation);
1935
- }
1936
- } else {
1937
- for (const toolUse of unprocessedTools) {
1938
- this.emitActionStep(toolUse);
1939
- const queuedObs = this.observationQueue.find((obs) => obs.toolId === getToolId(toolUse));
1940
- let observation;
1941
- if (queuedObs) {
1942
- const result2 = queuedObs.result;
1943
- const index = this.observationQueue.indexOf(queuedObs);
1944
- this.observationQueue.splice(index, 1);
1945
- observation = typeof result2 === "string" ? result2 : JSON.stringify(result2);
1946
- } else {
1947
- observation = await this.executeToolWithQueueFallback(toolUse);
1948
- this.appendToolMessages(messages, toolUse, observation, thinkingBlocks);
1949
- }
1950
- this.emitObservationStep(toolUse.name, observation);
1951
1940
  }
1941
+ this.emitObservationStep(toolUse.name, observation);
1952
1942
  }
1953
1943
  }
1954
1944
  }
1955
1945
  }
1956
- );
1946
+ });
1957
1947
  if (iterationComplete && finalAnswer) {
1958
1948
  break;
1959
1949
  }
@@ -1997,9 +1987,7 @@ ${options.context}` : this.getSystemPrompt()
1997
1987
  return result;
1998
1988
  } catch (error) {
1999
1989
  if (error instanceof PermissionDeniedError) {
2000
- this.context.logger.info(
2001
- `[ReActAgent] Permission denied for tool '${error.toolName}' - ending session gracefully`
2002
- );
1990
+ this.context.logger.info(`[ReActAgent] Permission denied for tool '${error.toolName}' - ending session gracefully`);
2003
1991
  const result = {
2004
1992
  finalAnswer: `Permission denied for tool '${error.toolName}'. You can use /trust ${error.toolName} to trust this tool permanently, or rephrase your request.`,
2005
1993
  steps: this.steps,
@@ -2163,12 +2151,7 @@ Remember: You are an autonomous AGENT. Act independently and solve problems proa
2163
2151
  const params = this.parseToolArguments(toolUse.arguments);
2164
2152
  const toolId = toolUse.id || `${toolUse.name}_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
2165
2153
  const parameters = typeof toolUse.arguments === "string" ? toolUse.arguments : JSON.stringify(params);
2166
- this.context.llm.pushToolMessages(
2167
- messages,
2168
- { id: toolId, name: toolUse.name, parameters },
2169
- observation,
2170
- thinkingBlocks
2171
- );
2154
+ this.context.llm.pushToolMessages(messages, { id: toolId, name: toolUse.name, parameters }, observation, thinkingBlocks);
2172
2155
  }
2173
2156
  };
2174
2157
 
@@ -3,7 +3,7 @@
3
3
  // package.json
4
4
  var package_default = {
5
5
  name: "@bike4mind/cli",
6
- version: "0.2.49-prod.21090+4ff436a32",
6
+ version: "0.2.49",
7
7
  type: "module",
8
8
  description: "Interactive CLI tool for Bike4Mind with ReAct agents",
9
9
  license: "UNLICENSED",
@@ -118,10 +118,10 @@ var package_default = {
118
118
  },
119
119
  devDependencies: {
120
120
  "@bike4mind/agents": "0.1.0",
121
- "@bike4mind/common": "2.67.1-prod.21090+4ff436a32",
122
- "@bike4mind/mcp": "1.33.11-prod.21090+4ff436a32",
123
- "@bike4mind/services": "2.63.1-prod.21090+4ff436a32",
124
- "@bike4mind/utils": "2.15.4-prod.21090+4ff436a32",
121
+ "@bike4mind/common": "2.68.0",
122
+ "@bike4mind/mcp": "1.33.11",
123
+ "@bike4mind/services": "2.63.1",
124
+ "@bike4mind/utils": "2.15.4",
125
125
  "@types/better-sqlite3": "^7.6.13",
126
126
  "@types/diff": "^5.0.9",
127
127
  "@types/jsonwebtoken": "^9.0.4",
@@ -140,7 +140,7 @@ var package_default = {
140
140
  optionalDependencies: {
141
141
  "@vscode/ripgrep": "^1.17.0"
142
142
  },
143
- gitHead: "4ff436a32269365aba08bda30e846fad8c6142ee"
143
+ gitHead: "57bd5d0fb946b8a8e27e0f3096f46282f85559b5"
144
144
  };
145
145
 
146
146
  // src/utils/updateChecker.ts
@@ -3,7 +3,7 @@ import {
3
3
  fetchLatestVersion,
4
4
  forceCheckForUpdate,
5
5
  package_default
6
- } from "../chunk-DVVQ3AZN.js";
6
+ } from "../chunk-ZGHPHONE.js";
7
7
 
8
8
  // src/commands/doctorCommand.ts
9
9
  import { execSync } from "child_process";
@@ -36,7 +36,7 @@ import {
36
36
  isReadOnlyTool,
37
37
  loadContextFiles,
38
38
  setWebSocketToolExecutor
39
- } from "../chunk-ZCOPMHYC.js";
39
+ } from "../chunk-ST2Y3ZP7.js";
40
40
  import "../chunk-BDQBOLYG.js";
41
41
  import "../chunk-2K6DFEPJ.js";
42
42
  import "../chunk-GQGOWACU.js";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  forceCheckForUpdate,
4
4
  package_default
5
- } from "../chunk-DVVQ3AZN.js";
5
+ } from "../chunk-ZGHPHONE.js";
6
6
 
7
7
  // src/commands/updateCommand.ts
8
8
  import { execSync } from "child_process";
package/dist/index.js CHANGED
@@ -46,7 +46,7 @@ import {
46
46
  setWebSocketToolExecutor,
47
47
  substituteArguments,
48
48
  warmFileCache
49
- } from "./chunk-ZCOPMHYC.js";
49
+ } from "./chunk-ST2Y3ZP7.js";
50
50
  import "./chunk-BDQBOLYG.js";
51
51
  import "./chunk-2K6DFEPJ.js";
52
52
  import "./chunk-GQGOWACU.js";
@@ -64,7 +64,7 @@ import {
64
64
  import {
65
65
  checkForUpdate,
66
66
  package_default
67
- } from "./chunk-DVVQ3AZN.js";
67
+ } from "./chunk-ZGHPHONE.js";
68
68
  import {
69
69
  selectActiveBackgroundAgents,
70
70
  useCliStore
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bike4mind/cli",
3
- "version": "0.2.49-prod.21090+4ff436a32",
3
+ "version": "0.2.49",
4
4
  "type": "module",
5
5
  "description": "Interactive CLI tool for Bike4Mind with ReAct agents",
6
6
  "license": "UNLICENSED",
@@ -115,10 +115,10 @@
115
115
  },
116
116
  "devDependencies": {
117
117
  "@bike4mind/agents": "0.1.0",
118
- "@bike4mind/common": "2.67.1-prod.21090+4ff436a32",
119
- "@bike4mind/mcp": "1.33.11-prod.21090+4ff436a32",
120
- "@bike4mind/services": "2.63.1-prod.21090+4ff436a32",
121
- "@bike4mind/utils": "2.15.4-prod.21090+4ff436a32",
118
+ "@bike4mind/common": "2.68.0",
119
+ "@bike4mind/mcp": "1.33.11",
120
+ "@bike4mind/services": "2.63.1",
121
+ "@bike4mind/utils": "2.15.4",
122
122
  "@types/better-sqlite3": "^7.6.13",
123
123
  "@types/diff": "^5.0.9",
124
124
  "@types/jsonwebtoken": "^9.0.4",
@@ -137,5 +137,5 @@
137
137
  "optionalDependencies": {
138
138
  "@vscode/ripgrep": "^1.17.0"
139
139
  },
140
- "gitHead": "4ff436a32269365aba08bda30e846fad8c6142ee"
140
+ "gitHead": "57bd5d0fb946b8a8e27e0f3096f46282f85559b5"
141
141
  }