@bike4mind/cli 0.2.11-fix-number-option-recorded.17312 → 0.2.11-fix-tool-pairing-integrity.17312
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-VZU4Z7WI.js → chunk-A3VAT7TT.js} +1 -1
- package/dist/{chunk-AQBZVAYO.js → chunk-CQW42LY2.js} +1 -1
- package/dist/{chunk-GO75FMLY.js → chunk-MU4EEXAL.js} +1 -1
- package/dist/{chunk-GCVIRGIN.js → chunk-TFONTTOE.js} +83 -35
- package/dist/{create-ZDOTF7XD.js → create-GE45KYWN.js} +2 -2
- package/dist/index.js +59 -64
- package/dist/{mementoService-TURUS3OH.js → mementoService-GIDVVHNG.js} +2 -2
- package/dist/{src-6ZRXGE5J.js → src-XCR4PATL.js} +1 -1
- package/dist/{subtractCredits-GOVKM3IR.js → subtractCredits-HDHG6FFY.js} +2 -2
- package/package.json +6 -6
|
@@ -6248,6 +6248,8 @@ var ensureToolPairingIntegrity = (messages, logger) => {
|
|
|
6248
6248
|
return messages;
|
|
6249
6249
|
}
|
|
6250
6250
|
const toolUseIds = /* @__PURE__ */ new Set();
|
|
6251
|
+
const toolResultIds = /* @__PURE__ */ new Set();
|
|
6252
|
+
let hasToolUseBlocks = false;
|
|
6251
6253
|
let hasToolResultBlocks = false;
|
|
6252
6254
|
for (let i = 0; i < messages.length; i++) {
|
|
6253
6255
|
const message = messages[i];
|
|
@@ -6257,65 +6259,111 @@ var ensureToolPairingIntegrity = (messages, logger) => {
|
|
|
6257
6259
|
const block = content[j];
|
|
6258
6260
|
if (block.type === "tool_use" && "id" in block) {
|
|
6259
6261
|
toolUseIds.add(block.id);
|
|
6262
|
+
hasToolUseBlocks = true;
|
|
6260
6263
|
}
|
|
6261
6264
|
}
|
|
6262
6265
|
} else if (message.role === "user" && Array.isArray(message.content)) {
|
|
6263
6266
|
const content = message.content;
|
|
6264
6267
|
for (let j = 0; j < content.length; j++) {
|
|
6265
|
-
|
|
6268
|
+
const block = content[j];
|
|
6269
|
+
if (block.type === "tool_result" && "tool_use_id" in block) {
|
|
6270
|
+
toolResultIds.add(block.tool_use_id);
|
|
6266
6271
|
hasToolResultBlocks = true;
|
|
6267
|
-
break;
|
|
6268
6272
|
}
|
|
6269
6273
|
}
|
|
6270
6274
|
}
|
|
6271
6275
|
}
|
|
6272
|
-
if (!hasToolResultBlocks) {
|
|
6276
|
+
if (!hasToolUseBlocks && !hasToolResultBlocks) {
|
|
6273
6277
|
return messages;
|
|
6274
6278
|
}
|
|
6275
|
-
let
|
|
6279
|
+
let orphanedToolResultCount = 0;
|
|
6280
|
+
let orphanedToolUseCount = 0;
|
|
6276
6281
|
const result = [];
|
|
6277
6282
|
for (let i = 0; i < messages.length; i++) {
|
|
6278
6283
|
const message = messages[i];
|
|
6279
|
-
if (message.role
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
hasOrphans = true;
|
|
6290
|
-
break;
|
|
6284
|
+
if (message.role === "assistant" && Array.isArray(message.content)) {
|
|
6285
|
+
const content = message.content;
|
|
6286
|
+
let hasOrphanedToolUse = false;
|
|
6287
|
+
for (let j = 0; j < content.length; j++) {
|
|
6288
|
+
const block = content[j];
|
|
6289
|
+
if (block.type === "tool_use" && "id" in block) {
|
|
6290
|
+
if (!toolResultIds.has(block.id)) {
|
|
6291
|
+
hasOrphanedToolUse = true;
|
|
6292
|
+
break;
|
|
6293
|
+
}
|
|
6291
6294
|
}
|
|
6292
6295
|
}
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
+
if (!hasOrphanedToolUse) {
|
|
6297
|
+
result.push(message);
|
|
6298
|
+
continue;
|
|
6299
|
+
}
|
|
6300
|
+
const filteredContent = [];
|
|
6301
|
+
for (let j = 0; j < content.length; j++) {
|
|
6302
|
+
const block = content[j];
|
|
6303
|
+
if (block.type === "tool_use" && "id" in block) {
|
|
6304
|
+
const toolId = block.id;
|
|
6305
|
+
if (!toolResultIds.has(toolId)) {
|
|
6306
|
+
orphanedToolUseCount++;
|
|
6307
|
+
if (logger) {
|
|
6308
|
+
logger.warn(`Removing orphaned tool_use block with id: ${toolId} (no matching tool_result)`);
|
|
6309
|
+
}
|
|
6310
|
+
continue;
|
|
6311
|
+
}
|
|
6312
|
+
}
|
|
6313
|
+
filteredContent.push(block);
|
|
6314
|
+
}
|
|
6315
|
+
if (filteredContent.length > 0) {
|
|
6316
|
+
result.push({ ...message, content: filteredContent });
|
|
6317
|
+
}
|
|
6296
6318
|
continue;
|
|
6297
6319
|
}
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
const
|
|
6303
|
-
if (
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6320
|
+
if (message.role === "user" && Array.isArray(message.content)) {
|
|
6321
|
+
const content = message.content;
|
|
6322
|
+
let hasOrphanedToolResult = false;
|
|
6323
|
+
for (let j = 0; j < content.length; j++) {
|
|
6324
|
+
const block = content[j];
|
|
6325
|
+
if (block.type === "tool_result" && "tool_use_id" in block) {
|
|
6326
|
+
if (!toolUseIds.has(block.tool_use_id)) {
|
|
6327
|
+
hasOrphanedToolResult = true;
|
|
6328
|
+
break;
|
|
6307
6329
|
}
|
|
6308
|
-
continue;
|
|
6309
6330
|
}
|
|
6310
6331
|
}
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
|
|
6314
|
-
|
|
6332
|
+
if (!hasOrphanedToolResult) {
|
|
6333
|
+
result.push(message);
|
|
6334
|
+
continue;
|
|
6335
|
+
}
|
|
6336
|
+
const filteredContent = [];
|
|
6337
|
+
for (let j = 0; j < content.length; j++) {
|
|
6338
|
+
const block = content[j];
|
|
6339
|
+
if (block.type === "tool_result" && "tool_use_id" in block) {
|
|
6340
|
+
const toolUseId = block.tool_use_id;
|
|
6341
|
+
if (!toolUseIds.has(toolUseId)) {
|
|
6342
|
+
orphanedToolResultCount++;
|
|
6343
|
+
if (logger) {
|
|
6344
|
+
logger.warn(`Removing orphaned tool_result block referencing missing tool_use_id: ${toolUseId}`);
|
|
6345
|
+
}
|
|
6346
|
+
continue;
|
|
6347
|
+
}
|
|
6348
|
+
}
|
|
6349
|
+
filteredContent.push(block);
|
|
6350
|
+
}
|
|
6351
|
+
if (filteredContent.length > 0) {
|
|
6352
|
+
result.push({ ...message, content: filteredContent });
|
|
6353
|
+
}
|
|
6354
|
+
continue;
|
|
6315
6355
|
}
|
|
6356
|
+
result.push(message);
|
|
6316
6357
|
}
|
|
6317
|
-
if (
|
|
6318
|
-
|
|
6358
|
+
if ((orphanedToolResultCount > 0 || orphanedToolUseCount > 0) && logger) {
|
|
6359
|
+
const parts = [];
|
|
6360
|
+
if (orphanedToolResultCount > 0) {
|
|
6361
|
+
parts.push(`${orphanedToolResultCount} orphaned tool_result block(s)`);
|
|
6362
|
+
}
|
|
6363
|
+
if (orphanedToolUseCount > 0) {
|
|
6364
|
+
parts.push(`${orphanedToolUseCount} orphaned tool_use block(s)`);
|
|
6365
|
+
}
|
|
6366
|
+
logger.log(`Tool pairing integrity: removed ${parts.join(" and ")} after truncation`);
|
|
6319
6367
|
}
|
|
6320
6368
|
return result;
|
|
6321
6369
|
};
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createFabFile,
|
|
4
4
|
createFabFileSchema
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-CQW42LY2.js";
|
|
6
|
+
import "./chunk-TFONTTOE.js";
|
|
7
7
|
import "./chunk-AMDXHL6S.js";
|
|
8
8
|
import "./chunk-DJPXSSP4.js";
|
|
9
9
|
import "./chunk-PDX44BCA.js";
|
package/dist/index.js
CHANGED
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
getEffectiveApiKey,
|
|
5
5
|
getOpenWeatherKey,
|
|
6
6
|
getSerperKey
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-MU4EEXAL.js";
|
|
8
|
+
import "./chunk-A3VAT7TT.js";
|
|
9
|
+
import "./chunk-CQW42LY2.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-
|
|
18
|
+
} from "./chunk-TFONTTOE.js";
|
|
19
19
|
import {
|
|
20
20
|
Logger
|
|
21
21
|
} from "./chunk-AMDXHL6S.js";
|
|
@@ -107,8 +107,7 @@ function CustomTextInput({
|
|
|
107
107
|
onChange,
|
|
108
108
|
onSubmit,
|
|
109
109
|
placeholder = "",
|
|
110
|
-
showCursor = true
|
|
111
|
-
disabled = false
|
|
110
|
+
showCursor = true
|
|
112
111
|
}) {
|
|
113
112
|
const [cursorOffset, setCursorOffset] = useState(value.length);
|
|
114
113
|
useInput(
|
|
@@ -189,7 +188,7 @@ function CustomTextInput({
|
|
|
189
188
|
setCursorOffset(cursorOffset + 1);
|
|
190
189
|
}
|
|
191
190
|
},
|
|
192
|
-
{ isActive:
|
|
191
|
+
{ isActive: true }
|
|
193
192
|
);
|
|
194
193
|
const hasValue = value.length > 0;
|
|
195
194
|
if (!hasValue) {
|
|
@@ -828,59 +827,56 @@ function InputPrompt({
|
|
|
828
827
|
useEffect(() => {
|
|
829
828
|
setFileSelectedIndex(0);
|
|
830
829
|
}, [filteredFiles]);
|
|
831
|
-
useInput2(
|
|
832
|
-
(
|
|
833
|
-
if (
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
insertSelectedFile(selectedFile);
|
|
844
|
-
}
|
|
845
|
-
return;
|
|
846
|
-
} else if (key.escape) {
|
|
847
|
-
setFileAutocomplete(null);
|
|
848
|
-
return;
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
if (shouldShowCommandAutocomplete && filteredCommands.length > 0) {
|
|
852
|
-
if (key.upArrow) {
|
|
853
|
-
setSelectedIndex((prev) => prev > 0 ? prev - 1 : filteredCommands.length - 1);
|
|
854
|
-
} else if (key.downArrow) {
|
|
855
|
-
setSelectedIndex((prev) => prev < filteredCommands.length - 1 ? prev + 1 : 0);
|
|
830
|
+
useInput2((_input, key) => {
|
|
831
|
+
if (fileAutocomplete?.active && filteredFiles.length > 0) {
|
|
832
|
+
if (key.upArrow) {
|
|
833
|
+
setFileSelectedIndex((prev) => prev > 0 ? prev - 1 : filteredFiles.length - 1);
|
|
834
|
+
return;
|
|
835
|
+
} else if (key.downArrow) {
|
|
836
|
+
setFileSelectedIndex((prev) => prev < filteredFiles.length - 1 ? prev + 1 : 0);
|
|
837
|
+
return;
|
|
838
|
+
} else if (key.tab) {
|
|
839
|
+
const selectedFile = filteredFiles[fileSelectedIndex];
|
|
840
|
+
if (selectedFile) {
|
|
841
|
+
insertSelectedFile(selectedFile);
|
|
856
842
|
}
|
|
857
843
|
return;
|
|
844
|
+
} else if (key.escape) {
|
|
845
|
+
setFileAutocomplete(null);
|
|
846
|
+
return;
|
|
858
847
|
}
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
848
|
+
}
|
|
849
|
+
if (shouldShowCommandAutocomplete && filteredCommands.length > 0) {
|
|
850
|
+
if (key.upArrow) {
|
|
851
|
+
setSelectedIndex((prev) => prev > 0 ? prev - 1 : filteredCommands.length - 1);
|
|
852
|
+
} else if (key.downArrow) {
|
|
853
|
+
setSelectedIndex((prev) => prev < filteredCommands.length - 1 ? prev + 1 : 0);
|
|
854
|
+
}
|
|
855
|
+
return;
|
|
856
|
+
}
|
|
857
|
+
if (!shouldShowCommandAutocomplete && !fileAutocomplete?.active && history.length > 0) {
|
|
858
|
+
if (key.upArrow) {
|
|
859
|
+
if (historyIndex === -1) {
|
|
860
|
+
setTempInput(value);
|
|
861
|
+
setHistoryIndex(0);
|
|
862
|
+
setValue(history[0]);
|
|
863
|
+
} else if (historyIndex < history.length - 1) {
|
|
864
|
+
const newIndex = historyIndex + 1;
|
|
865
|
+
setHistoryIndex(newIndex);
|
|
866
|
+
setValue(history[newIndex]);
|
|
867
|
+
}
|
|
868
|
+
} else if (key.downArrow) {
|
|
869
|
+
if (historyIndex > 0) {
|
|
870
|
+
const newIndex = historyIndex - 1;
|
|
871
|
+
setHistoryIndex(newIndex);
|
|
872
|
+
setValue(history[newIndex]);
|
|
873
|
+
} else if (historyIndex === 0) {
|
|
874
|
+
setHistoryIndex(-1);
|
|
875
|
+
setValue(tempInput);
|
|
879
876
|
}
|
|
880
877
|
}
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
);
|
|
878
|
+
}
|
|
879
|
+
});
|
|
884
880
|
const insertSelectedFile = (file) => {
|
|
885
881
|
if (!fileAutocomplete) return;
|
|
886
882
|
const beforeAt = value.slice(0, fileAutocomplete.startIndex);
|
|
@@ -974,8 +970,7 @@ function InputPrompt({
|
|
|
974
970
|
onChange: handleChange,
|
|
975
971
|
onSubmit: handleSubmit,
|
|
976
972
|
placeholder: getPlaceholder(),
|
|
977
|
-
showCursor: !disabled
|
|
978
|
-
disabled
|
|
973
|
+
showCursor: !disabled
|
|
979
974
|
}
|
|
980
975
|
)), shouldShowCommandAutocomplete && /* @__PURE__ */ React5.createElement(CommandAutocomplete, { commands: filteredCommands, selectedIndex }), fileAutocomplete?.active && /* @__PURE__ */ React5.createElement(FileAutocomplete, { files: filteredFiles, selectedIndex: fileSelectedIndex, query: fileAutocomplete.query }));
|
|
981
976
|
}
|
|
@@ -1543,7 +1538,7 @@ ${errorBlock}`;
|
|
|
1543
1538
|
onSubmit: handleSubmit,
|
|
1544
1539
|
onBashCommand,
|
|
1545
1540
|
onImageDetected,
|
|
1546
|
-
disabled: isThinking
|
|
1541
|
+
disabled: isThinking,
|
|
1547
1542
|
history: commandHistory,
|
|
1548
1543
|
commands,
|
|
1549
1544
|
prefillInput,
|
|
@@ -11532,7 +11527,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
|
|
|
11532
11527
|
// package.json
|
|
11533
11528
|
var package_default = {
|
|
11534
11529
|
name: "@bike4mind/cli",
|
|
11535
|
-
version: "0.2.11-fix-
|
|
11530
|
+
version: "0.2.11-fix-tool-pairing-integrity.17312+7bfc5c80f",
|
|
11536
11531
|
type: "module",
|
|
11537
11532
|
description: "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
11538
11533
|
license: "UNLICENSED",
|
|
@@ -11636,10 +11631,10 @@ var package_default = {
|
|
|
11636
11631
|
},
|
|
11637
11632
|
devDependencies: {
|
|
11638
11633
|
"@bike4mind/agents": "0.1.0",
|
|
11639
|
-
"@bike4mind/common": "2.40.1-fix-
|
|
11640
|
-
"@bike4mind/mcp": "1.20.5-fix-
|
|
11641
|
-
"@bike4mind/services": "2.35.1-fix-
|
|
11642
|
-
"@bike4mind/utils": "2.1.5-fix-
|
|
11634
|
+
"@bike4mind/common": "2.40.1-fix-tool-pairing-integrity.17312+7bfc5c80f",
|
|
11635
|
+
"@bike4mind/mcp": "1.20.5-fix-tool-pairing-integrity.17312+7bfc5c80f",
|
|
11636
|
+
"@bike4mind/services": "2.35.1-fix-tool-pairing-integrity.17312+7bfc5c80f",
|
|
11637
|
+
"@bike4mind/utils": "2.1.5-fix-tool-pairing-integrity.17312+7bfc5c80f",
|
|
11643
11638
|
"@types/better-sqlite3": "^7.6.13",
|
|
11644
11639
|
"@types/diff": "^5.0.9",
|
|
11645
11640
|
"@types/jsonwebtoken": "^9.0.4",
|
|
@@ -11652,7 +11647,7 @@ var package_default = {
|
|
|
11652
11647
|
typescript: "^5.9.3",
|
|
11653
11648
|
vitest: "^3.2.4"
|
|
11654
11649
|
},
|
|
11655
|
-
gitHead: "
|
|
11650
|
+
gitHead: "7bfc5c80fed342996ecbfb0c7974795bdaa75132"
|
|
11656
11651
|
};
|
|
11657
11652
|
|
|
11658
11653
|
// src/config/constants.ts
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import {
|
|
3
3
|
findMostSimilarMemento,
|
|
4
4
|
getRelevantMementos
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-MU4EEXAL.js";
|
|
6
|
+
import "./chunk-TFONTTOE.js";
|
|
7
7
|
import "./chunk-AMDXHL6S.js";
|
|
8
8
|
import "./chunk-DJPXSSP4.js";
|
|
9
9
|
import "./chunk-PDX44BCA.js";
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import {
|
|
3
3
|
SubtractCreditsSchema,
|
|
4
4
|
subtractCredits
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-A3VAT7TT.js";
|
|
6
|
+
import "./chunk-TFONTTOE.js";
|
|
7
7
|
import "./chunk-AMDXHL6S.js";
|
|
8
8
|
import "./chunk-DJPXSSP4.js";
|
|
9
9
|
import "./chunk-PDX44BCA.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bike4mind/cli",
|
|
3
|
-
"version": "0.2.11-fix-
|
|
3
|
+
"version": "0.2.11-fix-tool-pairing-integrity.17312+7bfc5c80f",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -104,10 +104,10 @@
|
|
|
104
104
|
},
|
|
105
105
|
"devDependencies": {
|
|
106
106
|
"@bike4mind/agents": "0.1.0",
|
|
107
|
-
"@bike4mind/common": "2.40.1-fix-
|
|
108
|
-
"@bike4mind/mcp": "1.20.5-fix-
|
|
109
|
-
"@bike4mind/services": "2.35.1-fix-
|
|
110
|
-
"@bike4mind/utils": "2.1.5-fix-
|
|
107
|
+
"@bike4mind/common": "2.40.1-fix-tool-pairing-integrity.17312+7bfc5c80f",
|
|
108
|
+
"@bike4mind/mcp": "1.20.5-fix-tool-pairing-integrity.17312+7bfc5c80f",
|
|
109
|
+
"@bike4mind/services": "2.35.1-fix-tool-pairing-integrity.17312+7bfc5c80f",
|
|
110
|
+
"@bike4mind/utils": "2.1.5-fix-tool-pairing-integrity.17312+7bfc5c80f",
|
|
111
111
|
"@types/better-sqlite3": "^7.6.13",
|
|
112
112
|
"@types/diff": "^5.0.9",
|
|
113
113
|
"@types/jsonwebtoken": "^9.0.4",
|
|
@@ -120,5 +120,5 @@
|
|
|
120
120
|
"typescript": "^5.9.3",
|
|
121
121
|
"vitest": "^3.2.4"
|
|
122
122
|
},
|
|
123
|
-
"gitHead": "
|
|
123
|
+
"gitHead": "7bfc5c80fed342996ecbfb0c7974795bdaa75132"
|
|
124
124
|
}
|