@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.
- package/dist/{chunk-ZCOPMHYC.js → chunk-ST2Y3ZP7.js} +102 -119
- package/dist/{chunk-DVVQ3AZN.js → chunk-ZGHPHONE.js} +6 -6
- package/dist/commands/doctorCommand.js +1 -1
- package/dist/commands/headlessCommand.js +1 -1
- package/dist/commands/updateCommand.js +1 -1
- package/dist/index.js +2 -2
- package/package.json +6 -6
|
@@ -1638,10 +1638,10 @@ You can use:
|
|
|
1638
1638
|
}
|
|
1639
1639
|
};
|
|
1640
1640
|
|
|
1641
|
-
// ../../b4m-core/packages/agents/src/ReActAgent.
|
|
1641
|
+
// ../../b4m-core/packages/agents/dist/src/ReActAgent.js
|
|
1642
1642
|
import { EventEmitter } from "events";
|
|
1643
1643
|
|
|
1644
|
-
// ../../b4m-core/packages/agents/src/toolParallelizer.
|
|
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.
|
|
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
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
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
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
}
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
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
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
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 (
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
const unprocessedTools
|
|
1908
|
-
|
|
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
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
);
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
const
|
|
1931
|
-
const
|
|
1932
|
-
|
|
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
|
|
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.
|
|
122
|
-
"@bike4mind/mcp": "1.33.11
|
|
123
|
-
"@bike4mind/services": "2.63.1
|
|
124
|
-
"@bike4mind/utils": "2.15.4
|
|
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: "
|
|
143
|
+
gitHead: "57bd5d0fb946b8a8e27e0f3096f46282f85559b5"
|
|
144
144
|
};
|
|
145
145
|
|
|
146
146
|
// src/utils/updateChecker.ts
|
package/dist/index.js
CHANGED
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
setWebSocketToolExecutor,
|
|
47
47
|
substituteArguments,
|
|
48
48
|
warmFileCache
|
|
49
|
-
} from "./chunk-
|
|
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-
|
|
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
|
|
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.
|
|
119
|
-
"@bike4mind/mcp": "1.33.11
|
|
120
|
-
"@bike4mind/services": "2.63.1
|
|
121
|
-
"@bike4mind/utils": "2.15.4
|
|
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": "
|
|
140
|
+
"gitHead": "57bd5d0fb946b8a8e27e0f3096f46282f85559b5"
|
|
141
141
|
}
|