@bike4mind/cli 0.2.14-fix-gemini-img-generation.17480 → 0.2.14-fix-cli-backspace-deletion.17486
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/index.js +95 -78
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -82,7 +82,7 @@ import {
|
|
|
82
82
|
import "./chunk-BPFEGDC7.js";
|
|
83
83
|
|
|
84
84
|
// src/index.tsx
|
|
85
|
-
import React18, { useState as useState8, useEffect as
|
|
85
|
+
import React18, { useState as useState8, useEffect as useEffect4, useCallback, useRef as useRef3 } from "react";
|
|
86
86
|
import { render, Box as Box17, Text as Text17, useApp, useInput as useInput7 } from "ink";
|
|
87
87
|
import { execSync } from "child_process";
|
|
88
88
|
import { v4 as uuidv49 } from "uuid";
|
|
@@ -99,11 +99,11 @@ var StatusBar = React.memo(function StatusBar2({ sessionName, model, tokenUsage
|
|
|
99
99
|
});
|
|
100
100
|
|
|
101
101
|
// src/components/InputPrompt.tsx
|
|
102
|
-
import React5, { useState as useState2, useMemo, useEffect, useRef } from "react";
|
|
102
|
+
import React5, { useState as useState2, useMemo, useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
103
103
|
import { Box as Box4, Text as Text5, useInput as useInput2 } from "ink";
|
|
104
104
|
|
|
105
105
|
// src/components/CustomTextInput.tsx
|
|
106
|
-
import React2, { useState } from "react";
|
|
106
|
+
import React2, { useEffect, useRef, useState } from "react";
|
|
107
107
|
import { Text as Text2, useInput } from "ink";
|
|
108
108
|
function CustomTextInput({
|
|
109
109
|
value,
|
|
@@ -114,6 +114,13 @@ function CustomTextInput({
|
|
|
114
114
|
disabled = false
|
|
115
115
|
}) {
|
|
116
116
|
const [cursorOffset, setCursorOffset] = useState(value.length);
|
|
117
|
+
const prevValueRef = useRef(value);
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
if (value !== prevValueRef.current) {
|
|
120
|
+
setCursorOffset(value.length);
|
|
121
|
+
prevValueRef.current = value;
|
|
122
|
+
}
|
|
123
|
+
}, [value]);
|
|
117
124
|
useInput(
|
|
118
125
|
(input, key) => {
|
|
119
126
|
if (key.return && !key.meta && !key.shift) {
|
|
@@ -784,6 +791,66 @@ var ImageInputDetector = class {
|
|
|
784
791
|
}
|
|
785
792
|
};
|
|
786
793
|
|
|
794
|
+
// src/store/index.ts
|
|
795
|
+
import { create } from "zustand";
|
|
796
|
+
var useCliStore = create((set) => ({
|
|
797
|
+
// Session state
|
|
798
|
+
session: null,
|
|
799
|
+
setSession: (session) => set({ session }),
|
|
800
|
+
addMessage: (message) => set((state) => {
|
|
801
|
+
if (!state.session) return state;
|
|
802
|
+
return {
|
|
803
|
+
session: {
|
|
804
|
+
...state.session,
|
|
805
|
+
messages: [...state.session.messages, message],
|
|
806
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
807
|
+
}
|
|
808
|
+
};
|
|
809
|
+
}),
|
|
810
|
+
// Pending messages
|
|
811
|
+
pendingMessages: [],
|
|
812
|
+
addPendingMessage: (message) => set((state) => ({ pendingMessages: [...state.pendingMessages, message] })),
|
|
813
|
+
updatePendingMessage: (index, message) => set((state) => {
|
|
814
|
+
const updated = [...state.pendingMessages];
|
|
815
|
+
updated[index] = message;
|
|
816
|
+
return { pendingMessages: updated };
|
|
817
|
+
}),
|
|
818
|
+
clearPendingMessages: () => set({ pendingMessages: [] }),
|
|
819
|
+
completePendingMessage: (index, finalMessage) => set((state) => {
|
|
820
|
+
const pending = [...state.pendingMessages];
|
|
821
|
+
pending.splice(index, 1);
|
|
822
|
+
const session = state.session;
|
|
823
|
+
if (!session) return { pendingMessages: pending };
|
|
824
|
+
return {
|
|
825
|
+
pendingMessages: pending,
|
|
826
|
+
session: {
|
|
827
|
+
...session,
|
|
828
|
+
messages: [...session.messages, finalMessage],
|
|
829
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
830
|
+
}
|
|
831
|
+
};
|
|
832
|
+
}),
|
|
833
|
+
// UI state
|
|
834
|
+
isThinking: false,
|
|
835
|
+
setIsThinking: (thinking) => set({ isThinking: thinking }),
|
|
836
|
+
// Input state (for Ctrl+C clearing)
|
|
837
|
+
inputValue: "",
|
|
838
|
+
setInputValue: (value) => set({ inputValue: value }),
|
|
839
|
+
clearInput: () => set({ inputValue: "" }),
|
|
840
|
+
// Permission prompt
|
|
841
|
+
permissionPrompt: null,
|
|
842
|
+
setPermissionPrompt: (prompt) => set({ permissionPrompt: prompt }),
|
|
843
|
+
// Config editor
|
|
844
|
+
showConfigEditor: false,
|
|
845
|
+
setShowConfigEditor: (show) => set({ showConfigEditor: show }),
|
|
846
|
+
// MCP viewer
|
|
847
|
+
showMcpViewer: false,
|
|
848
|
+
setShowMcpViewer: (show) => set({ showMcpViewer: show }),
|
|
849
|
+
// Exit handling
|
|
850
|
+
exitRequested: false,
|
|
851
|
+
setExitRequested: (requested) => set({ exitRequested: requested })
|
|
852
|
+
}));
|
|
853
|
+
|
|
787
854
|
// src/components/InputPrompt.tsx
|
|
788
855
|
function looksLikeFilePath(input) {
|
|
789
856
|
const trimmed = input.trim();
|
|
@@ -821,12 +888,14 @@ function InputPrompt({
|
|
|
821
888
|
onPrefillConsumed,
|
|
822
889
|
onBashModeChange
|
|
823
890
|
}) {
|
|
824
|
-
const
|
|
891
|
+
const value = useCliStore((state) => state.inputValue);
|
|
892
|
+
const setInputValue = useCliStore((state) => state.setInputValue);
|
|
893
|
+
const setValue = setInputValue;
|
|
825
894
|
const [selectedIndex, setSelectedIndex] = useState2(0);
|
|
826
895
|
const [historyIndex, setHistoryIndex] = useState2(-1);
|
|
827
896
|
const [tempInput, setTempInput] = useState2("");
|
|
828
|
-
const inputKey =
|
|
829
|
-
|
|
897
|
+
const inputKey = useRef2(0);
|
|
898
|
+
useEffect2(() => {
|
|
830
899
|
if (prefillInput) {
|
|
831
900
|
setValue(prefillInput);
|
|
832
901
|
onPrefillConsumed?.();
|
|
@@ -835,7 +904,7 @@ function InputPrompt({
|
|
|
835
904
|
const [fileAutocomplete, setFileAutocomplete] = useState2(null);
|
|
836
905
|
const [fileSelectedIndex, setFileSelectedIndex] = useState2(0);
|
|
837
906
|
const isBashMode = value.startsWith("!");
|
|
838
|
-
|
|
907
|
+
useEffect2(() => {
|
|
839
908
|
onBashModeChange?.(isBashMode);
|
|
840
909
|
}, [isBashMode, onBashModeChange]);
|
|
841
910
|
const shouldShowCommandAutocomplete = value.startsWith("/") && !disabled && !fileAutocomplete?.active && !looksLikeFilePath(value);
|
|
@@ -848,10 +917,10 @@ function InputPrompt({
|
|
|
848
917
|
if (!fileAutocomplete?.active) return [];
|
|
849
918
|
return searchFiles(fileAutocomplete.query);
|
|
850
919
|
}, [fileAutocomplete?.active, fileAutocomplete?.query]);
|
|
851
|
-
|
|
920
|
+
useEffect2(() => {
|
|
852
921
|
setSelectedIndex(0);
|
|
853
922
|
}, [filteredCommands]);
|
|
854
|
-
|
|
923
|
+
useEffect2(() => {
|
|
855
924
|
setFileSelectedIndex(0);
|
|
856
925
|
}, [filteredFiles]);
|
|
857
926
|
useInput2(
|
|
@@ -1019,62 +1088,6 @@ var ThoughtStream = React6.memo(function ThoughtStream2({ isThinking }) {
|
|
|
1019
1088
|
return /* @__PURE__ */ React6.createElement(Box5, { flexDirection: "column", gap: 1 }, isThinking && /* @__PURE__ */ React6.createElement(Box5, null, /* @__PURE__ */ React6.createElement(Text6, { color: "yellow" }, /* @__PURE__ */ React6.createElement(Spinner, { type: "dots" })), /* @__PURE__ */ React6.createElement(Text6, null, " Thinking...")));
|
|
1020
1089
|
});
|
|
1021
1090
|
|
|
1022
|
-
// src/store/index.ts
|
|
1023
|
-
import { create } from "zustand";
|
|
1024
|
-
var useCliStore = create((set) => ({
|
|
1025
|
-
// Session state
|
|
1026
|
-
session: null,
|
|
1027
|
-
setSession: (session) => set({ session }),
|
|
1028
|
-
addMessage: (message) => set((state) => {
|
|
1029
|
-
if (!state.session) return state;
|
|
1030
|
-
return {
|
|
1031
|
-
session: {
|
|
1032
|
-
...state.session,
|
|
1033
|
-
messages: [...state.session.messages, message],
|
|
1034
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1035
|
-
}
|
|
1036
|
-
};
|
|
1037
|
-
}),
|
|
1038
|
-
// Pending messages
|
|
1039
|
-
pendingMessages: [],
|
|
1040
|
-
addPendingMessage: (message) => set((state) => ({ pendingMessages: [...state.pendingMessages, message] })),
|
|
1041
|
-
updatePendingMessage: (index, message) => set((state) => {
|
|
1042
|
-
const updated = [...state.pendingMessages];
|
|
1043
|
-
updated[index] = message;
|
|
1044
|
-
return { pendingMessages: updated };
|
|
1045
|
-
}),
|
|
1046
|
-
clearPendingMessages: () => set({ pendingMessages: [] }),
|
|
1047
|
-
completePendingMessage: (index, finalMessage) => set((state) => {
|
|
1048
|
-
const pending = [...state.pendingMessages];
|
|
1049
|
-
pending.splice(index, 1);
|
|
1050
|
-
const session = state.session;
|
|
1051
|
-
if (!session) return { pendingMessages: pending };
|
|
1052
|
-
return {
|
|
1053
|
-
pendingMessages: pending,
|
|
1054
|
-
session: {
|
|
1055
|
-
...session,
|
|
1056
|
-
messages: [...session.messages, finalMessage],
|
|
1057
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1058
|
-
}
|
|
1059
|
-
};
|
|
1060
|
-
}),
|
|
1061
|
-
// UI state
|
|
1062
|
-
isThinking: false,
|
|
1063
|
-
setIsThinking: (thinking) => set({ isThinking: thinking }),
|
|
1064
|
-
// Permission prompt
|
|
1065
|
-
permissionPrompt: null,
|
|
1066
|
-
setPermissionPrompt: (prompt) => set({ permissionPrompt: prompt }),
|
|
1067
|
-
// Config editor
|
|
1068
|
-
showConfigEditor: false,
|
|
1069
|
-
setShowConfigEditor: (show) => set({ showConfigEditor: show }),
|
|
1070
|
-
// MCP viewer
|
|
1071
|
-
showMcpViewer: false,
|
|
1072
|
-
setShowMcpViewer: (show) => set({ showMcpViewer: show }),
|
|
1073
|
-
// Exit handling
|
|
1074
|
-
exitRequested: false,
|
|
1075
|
-
setExitRequested: (requested) => set({ exitRequested: requested })
|
|
1076
|
-
}));
|
|
1077
|
-
|
|
1078
1091
|
// src/components/AgentThinking.tsx
|
|
1079
1092
|
var AgentThinking = React7.memo(function AgentThinking2() {
|
|
1080
1093
|
const isThinking = useCliStore((state) => state.isThinking);
|
|
@@ -1850,7 +1863,7 @@ function SessionSelector({ sessions, currentSession, onSelect, onCancel }) {
|
|
|
1850
1863
|
}
|
|
1851
1864
|
|
|
1852
1865
|
// src/components/LoginFlow.tsx
|
|
1853
|
-
import React17, { useState as useState7, useEffect as
|
|
1866
|
+
import React17, { useState as useState7, useEffect as useEffect3 } from "react";
|
|
1854
1867
|
import { Box as Box16, Text as Text16 } from "ink";
|
|
1855
1868
|
import Spinner2 from "ink-spinner";
|
|
1856
1869
|
import jwt from "jsonwebtoken";
|
|
@@ -1971,7 +1984,7 @@ function LoginFlow({ apiUrl = "http://localhost:3000", configStore, onSuccess, o
|
|
|
1971
1984
|
const [deviceFlow, setDeviceFlow] = useState7(null);
|
|
1972
1985
|
const [statusMessage, setStatusMessage] = useState7("Initiating device authorization...");
|
|
1973
1986
|
const [error, setError] = useState7(null);
|
|
1974
|
-
|
|
1987
|
+
useEffect3(() => {
|
|
1975
1988
|
const runLoginFlow = async () => {
|
|
1976
1989
|
const oauth = new OAuthClient(apiUrl);
|
|
1977
1990
|
try {
|
|
@@ -2006,7 +2019,7 @@ function LoginFlow({ apiUrl = "http://localhost:3000", configStore, onSuccess, o
|
|
|
2006
2019
|
};
|
|
2007
2020
|
runLoginFlow();
|
|
2008
2021
|
}, [apiUrl, configStore, onSuccess, onError]);
|
|
2009
|
-
|
|
2022
|
+
useEffect3(() => {
|
|
2010
2023
|
if (deviceFlow && status === "waiting") {
|
|
2011
2024
|
open(deviceFlow.verification_uri_complete).catch((err) => {
|
|
2012
2025
|
console.error("Failed to auto-open browser:", err);
|
|
@@ -11313,7 +11326,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
|
|
|
11313
11326
|
// package.json
|
|
11314
11327
|
var package_default = {
|
|
11315
11328
|
name: "@bike4mind/cli",
|
|
11316
|
-
version: "0.2.14-fix-
|
|
11329
|
+
version: "0.2.14-fix-cli-backspace-deletion.17486+fb666cf3a",
|
|
11317
11330
|
type: "module",
|
|
11318
11331
|
description: "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
11319
11332
|
license: "UNLICENSED",
|
|
@@ -11419,10 +11432,10 @@ var package_default = {
|
|
|
11419
11432
|
},
|
|
11420
11433
|
devDependencies: {
|
|
11421
11434
|
"@bike4mind/agents": "0.1.0",
|
|
11422
|
-
"@bike4mind/common": "2.42.1-fix-
|
|
11423
|
-
"@bike4mind/mcp": "1.21.3-fix-
|
|
11424
|
-
"@bike4mind/services": "2.37.1-fix-
|
|
11425
|
-
"@bike4mind/utils": "2.1.8-fix-
|
|
11435
|
+
"@bike4mind/common": "2.42.1-fix-cli-backspace-deletion.17486+fb666cf3a",
|
|
11436
|
+
"@bike4mind/mcp": "1.21.3-fix-cli-backspace-deletion.17486+fb666cf3a",
|
|
11437
|
+
"@bike4mind/services": "2.37.1-fix-cli-backspace-deletion.17486+fb666cf3a",
|
|
11438
|
+
"@bike4mind/utils": "2.1.8-fix-cli-backspace-deletion.17486+fb666cf3a",
|
|
11426
11439
|
"@types/better-sqlite3": "^7.6.13",
|
|
11427
11440
|
"@types/diff": "^5.0.9",
|
|
11428
11441
|
"@types/jsonwebtoken": "^9.0.4",
|
|
@@ -11436,7 +11449,7 @@ var package_default = {
|
|
|
11436
11449
|
typescript: "^5.9.3",
|
|
11437
11450
|
vitest: "^3.2.4"
|
|
11438
11451
|
},
|
|
11439
|
-
gitHead: "
|
|
11452
|
+
gitHead: "fb666cf3a0f70c46307c5dbe7194894e86104b9e"
|
|
11440
11453
|
};
|
|
11441
11454
|
|
|
11442
11455
|
// src/config/constants.ts
|
|
@@ -11954,7 +11967,7 @@ function CliApp() {
|
|
|
11954
11967
|
const [isInitialized, setIsInitialized] = useState8(false);
|
|
11955
11968
|
const [initError, setInitError] = useState8(null);
|
|
11956
11969
|
const [commandHistory, setCommandHistory] = useState8([]);
|
|
11957
|
-
const imageStoreInitPromise =
|
|
11970
|
+
const imageStoreInitPromise = useRef3(null);
|
|
11958
11971
|
const setStoreSession = useCliStore((state2) => state2.setSession);
|
|
11959
11972
|
const setPermissionPrompt = useCliStore((state2) => state2.setPermissionPrompt);
|
|
11960
11973
|
const setShowConfigEditor = useCliStore((state2) => state2.setShowConfigEditor);
|
|
@@ -12008,12 +12021,16 @@ function CliApp() {
|
|
|
12008
12021
|
if (key.ctrl && input === "c") {
|
|
12009
12022
|
const now = Date.now();
|
|
12010
12023
|
if (exitTimestamp && now - exitTimestamp < EXIT_TIMEOUT_MS) {
|
|
12011
|
-
logger.debug("[EXIT Second Ctrl+C - cleaning up and exiting...");
|
|
12024
|
+
logger.debug("[EXIT] Second Ctrl+C - cleaning up and exiting...");
|
|
12012
12025
|
performCleanup().then(() => {
|
|
12013
12026
|
exit();
|
|
12014
12027
|
});
|
|
12015
12028
|
} else {
|
|
12016
|
-
logger.debug("[EXIT First Ctrl+C - press again to exit");
|
|
12029
|
+
logger.debug("[EXIT] First Ctrl+C - press again to exit");
|
|
12030
|
+
const currentInput = useCliStore.getState().inputValue;
|
|
12031
|
+
if (currentInput.length > 0) {
|
|
12032
|
+
useCliStore.getState().clearInput();
|
|
12033
|
+
}
|
|
12017
12034
|
exitTimestamp = now;
|
|
12018
12035
|
setExitRequested(true);
|
|
12019
12036
|
setTimeout(() => {
|
|
@@ -12299,7 +12316,7 @@ ${contextResult.mergedContent}` : "";
|
|
|
12299
12316
|
setStoreSession,
|
|
12300
12317
|
setState
|
|
12301
12318
|
]);
|
|
12302
|
-
|
|
12319
|
+
useEffect4(() => {
|
|
12303
12320
|
init();
|
|
12304
12321
|
}, [init]);
|
|
12305
12322
|
const handleCustomCommandMessage = async (fullTemplate, displayMessage) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bike4mind/cli",
|
|
3
|
-
"version": "0.2.14-fix-
|
|
3
|
+
"version": "0.2.14-fix-cli-backspace-deletion.17486+fb666cf3a",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -106,10 +106,10 @@
|
|
|
106
106
|
},
|
|
107
107
|
"devDependencies": {
|
|
108
108
|
"@bike4mind/agents": "0.1.0",
|
|
109
|
-
"@bike4mind/common": "2.42.1-fix-
|
|
110
|
-
"@bike4mind/mcp": "1.21.3-fix-
|
|
111
|
-
"@bike4mind/services": "2.37.1-fix-
|
|
112
|
-
"@bike4mind/utils": "2.1.8-fix-
|
|
109
|
+
"@bike4mind/common": "2.42.1-fix-cli-backspace-deletion.17486+fb666cf3a",
|
|
110
|
+
"@bike4mind/mcp": "1.21.3-fix-cli-backspace-deletion.17486+fb666cf3a",
|
|
111
|
+
"@bike4mind/services": "2.37.1-fix-cli-backspace-deletion.17486+fb666cf3a",
|
|
112
|
+
"@bike4mind/utils": "2.1.8-fix-cli-backspace-deletion.17486+fb666cf3a",
|
|
113
113
|
"@types/better-sqlite3": "^7.6.13",
|
|
114
114
|
"@types/diff": "^5.0.9",
|
|
115
115
|
"@types/jsonwebtoken": "^9.0.4",
|
|
@@ -123,5 +123,5 @@
|
|
|
123
123
|
"typescript": "^5.9.3",
|
|
124
124
|
"vitest": "^3.2.4"
|
|
125
125
|
},
|
|
126
|
-
"gitHead": "
|
|
126
|
+
"gitHead": "fb666cf3a0f70c46307c5dbe7194894e86104b9e"
|
|
127
127
|
}
|