@nomad-e/bluma-cli 0.1.4 → 0.1.5
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/main.js +46 -48
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -335,7 +335,7 @@ import { v4 as uuidv43 } from "uuid";
|
|
|
335
335
|
|
|
336
336
|
// src/app/ui/App.tsx
|
|
337
337
|
import { useState as useState7, useEffect as useEffect6, useRef as useRef5, useCallback as useCallback2, memo as memo11 } from "react";
|
|
338
|
-
import { Box as Box17, Text as Text16, Static
|
|
338
|
+
import { Box as Box17, Text as Text16, Static } from "ink";
|
|
339
339
|
|
|
340
340
|
// src/app/ui/layout.tsx
|
|
341
341
|
import { Box, Text } from "ink";
|
|
@@ -5894,7 +5894,7 @@ var Agent = class {
|
|
|
5894
5894
|
};
|
|
5895
5895
|
|
|
5896
5896
|
// src/app/ui/WorkingTimer.tsx
|
|
5897
|
-
import
|
|
5897
|
+
import { useState as useState4, useEffect as useEffect4, memo as memo5 } from "react";
|
|
5898
5898
|
import { Box as Box7, Text as Text7 } from "ink";
|
|
5899
5899
|
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
5900
5900
|
var WorkingTimerComponent = ({ eventBus: eventBus2, taskName, taskStatus }) => {
|
|
@@ -5916,7 +5916,7 @@ var WorkingTimerComponent = ({ eventBus: eventBus2, taskName, taskStatus }) => {
|
|
|
5916
5916
|
useEffect4(() => {
|
|
5917
5917
|
const shineTimer = setInterval(() => {
|
|
5918
5918
|
setShinePosition((prev) => (prev + 1) % 30);
|
|
5919
|
-
},
|
|
5919
|
+
}, 120);
|
|
5920
5920
|
return () => clearInterval(shineTimer);
|
|
5921
5921
|
}, []);
|
|
5922
5922
|
useEffect4(() => {
|
|
@@ -5926,9 +5926,9 @@ var WorkingTimerComponent = ({ eventBus: eventBus2, taskName, taskStatus }) => {
|
|
|
5926
5926
|
return () => clearInterval(dotsTimer);
|
|
5927
5927
|
}, []);
|
|
5928
5928
|
const displayAction = taskStatus || currentAction;
|
|
5929
|
-
const
|
|
5930
|
-
const chars =
|
|
5931
|
-
const textLen =
|
|
5929
|
+
const renderShineText = (text) => {
|
|
5930
|
+
const chars = text.split("");
|
|
5931
|
+
const textLen = text.length;
|
|
5932
5932
|
const shineIdx = shinePosition % (textLen + 6);
|
|
5933
5933
|
return chars.map((char, i) => {
|
|
5934
5934
|
const distance = Math.abs(i - shineIdx);
|
|
@@ -5938,9 +5938,9 @@ var WorkingTimerComponent = ({ eventBus: eventBus2, taskName, taskStatus }) => {
|
|
|
5938
5938
|
return /* @__PURE__ */ jsx7(Text7, { color: "gray", dimColor: true, children: char }, i);
|
|
5939
5939
|
}
|
|
5940
5940
|
});
|
|
5941
|
-
}
|
|
5941
|
+
};
|
|
5942
5942
|
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 1, children: [
|
|
5943
|
-
/* @__PURE__ */ jsx7(Box7, { children:
|
|
5943
|
+
/* @__PURE__ */ jsx7(Box7, { children: renderShineText(displayAction) }),
|
|
5944
5944
|
taskName && /* @__PURE__ */ jsx7(Box7, { paddingLeft: 2, children: /* @__PURE__ */ jsxs7(Text7, { dimColor: true, children: [
|
|
5945
5945
|
"\u203A ",
|
|
5946
5946
|
taskName
|
|
@@ -6883,49 +6883,49 @@ var ReasoningDisplay = memo9(ReasoningDisplayComponent);
|
|
|
6883
6883
|
|
|
6884
6884
|
// src/app/ui/components/StreamingText.tsx
|
|
6885
6885
|
import { useState as useState6, useEffect as useEffect5, useRef as useRef4, memo as memo10 } from "react";
|
|
6886
|
-
import { Box as Box16, Text as Text15
|
|
6887
|
-
import { jsx as jsx16
|
|
6886
|
+
import { Box as Box16, Text as Text15 } from "ink";
|
|
6887
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
6888
6888
|
var StreamingTextComponent = ({ eventBus: eventBus2, onReasoningComplete }) => {
|
|
6889
|
-
const [
|
|
6890
|
-
const [currentLine, setCurrentLine] = useState6("");
|
|
6889
|
+
const [reasoning, setReasoning] = useState6("");
|
|
6891
6890
|
const [isStreaming, setIsStreaming] = useState6(false);
|
|
6892
6891
|
const reasoningRef = useRef4("");
|
|
6893
|
-
const
|
|
6892
|
+
const lastUpdateRef = useRef4(0);
|
|
6893
|
+
const pendingUpdateRef = useRef4(null);
|
|
6894
6894
|
useEffect5(() => {
|
|
6895
6895
|
const handleStart = () => {
|
|
6896
|
-
|
|
6897
|
-
setCurrentLine("");
|
|
6896
|
+
setReasoning("");
|
|
6898
6897
|
reasoningRef.current = "";
|
|
6899
|
-
|
|
6898
|
+
lastUpdateRef.current = 0;
|
|
6900
6899
|
setIsStreaming(true);
|
|
6901
6900
|
};
|
|
6902
6901
|
const handleReasoningChunk = (data) => {
|
|
6903
6902
|
if (data.delta) {
|
|
6904
6903
|
reasoningRef.current += data.delta;
|
|
6905
|
-
const
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
-
|
|
6915
|
-
setCurrentLine(fullText.substring(startIdx));
|
|
6904
|
+
const now = Date.now();
|
|
6905
|
+
if (now - lastUpdateRef.current >= 50) {
|
|
6906
|
+
lastUpdateRef.current = now;
|
|
6907
|
+
setReasoning(reasoningRef.current);
|
|
6908
|
+
} else if (!pendingUpdateRef.current) {
|
|
6909
|
+
pendingUpdateRef.current = setTimeout(() => {
|
|
6910
|
+
lastUpdateRef.current = Date.now();
|
|
6911
|
+
setReasoning(reasoningRef.current);
|
|
6912
|
+
pendingUpdateRef.current = null;
|
|
6913
|
+
}, 50 - (now - lastUpdateRef.current));
|
|
6916
6914
|
}
|
|
6917
6915
|
}
|
|
6918
6916
|
};
|
|
6919
6917
|
const handleEnd = () => {
|
|
6920
6918
|
setIsStreaming(false);
|
|
6919
|
+
if (pendingUpdateRef.current) {
|
|
6920
|
+
clearTimeout(pendingUpdateRef.current);
|
|
6921
|
+
pendingUpdateRef.current = null;
|
|
6922
|
+
}
|
|
6921
6923
|
const finalReasoning = reasoningRef.current;
|
|
6922
6924
|
if (finalReasoning && onReasoningComplete) {
|
|
6923
6925
|
onReasoningComplete(finalReasoning);
|
|
6924
6926
|
}
|
|
6925
|
-
|
|
6926
|
-
setCurrentLine("");
|
|
6927
|
+
setReasoning("");
|
|
6927
6928
|
reasoningRef.current = "";
|
|
6928
|
-
lastProcessedLength.current = 0;
|
|
6929
6929
|
};
|
|
6930
6930
|
eventBus2.on("stream_start", handleStart);
|
|
6931
6931
|
eventBus2.on("stream_reasoning_chunk", handleReasoningChunk);
|
|
@@ -6936,18 +6936,16 @@ var StreamingTextComponent = ({ eventBus: eventBus2, onReasoningComplete }) => {
|
|
|
6936
6936
|
eventBus2.off("stream_end", handleEnd);
|
|
6937
6937
|
};
|
|
6938
6938
|
}, [eventBus2, onReasoningComplete]);
|
|
6939
|
-
if (!isStreaming ||
|
|
6939
|
+
if (!isStreaming || !reasoning) {
|
|
6940
6940
|
return null;
|
|
6941
6941
|
}
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
currentLine && /* @__PURE__ */ jsx16(Text15, { color: "gray", dimColor: true, children: currentLine })
|
|
6945
|
-
] }) });
|
|
6942
|
+
const lines = reasoning.split("\n");
|
|
6943
|
+
return /* @__PURE__ */ jsx16(Box16, { flexDirection: "column", paddingX: 1, marginBottom: 1, marginTop: 1, children: /* @__PURE__ */ jsx16(Box16, { paddingLeft: 2, flexDirection: "column", children: lines.map((line, i) => /* @__PURE__ */ jsx16(Text15, { color: "gray", dimColor: true, children: line }, i)) }) });
|
|
6946
6944
|
};
|
|
6947
6945
|
var StreamingText = memo10(StreamingTextComponent);
|
|
6948
6946
|
|
|
6949
6947
|
// src/app/ui/App.tsx
|
|
6950
|
-
import { jsx as jsx17, jsxs as
|
|
6948
|
+
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
6951
6949
|
var SAFE_AUTO_APPROVE_TOOLS = [
|
|
6952
6950
|
// Comunicação/UI
|
|
6953
6951
|
"message",
|
|
@@ -7045,7 +7043,7 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
7045
7043
|
...prev,
|
|
7046
7044
|
{
|
|
7047
7045
|
id: prev.length,
|
|
7048
|
-
component: /* @__PURE__ */
|
|
7046
|
+
component: /* @__PURE__ */ jsxs15(Box17, { marginBottom: 1, children: [
|
|
7049
7047
|
/* @__PURE__ */ jsx17(Text16, { color: "white", bold: true, children: "$ " }),
|
|
7050
7048
|
/* @__PURE__ */ jsx17(Text16, { color: "white", children: command })
|
|
7051
7049
|
] })
|
|
@@ -7066,7 +7064,7 @@ Please use command_status to check the result and report back to the user.`;
|
|
|
7066
7064
|
...prev,
|
|
7067
7065
|
{
|
|
7068
7066
|
id: prev.length,
|
|
7069
|
-
component: /* @__PURE__ */
|
|
7067
|
+
component: /* @__PURE__ */ jsxs15(Text16, { color: "red", children: [
|
|
7070
7068
|
"Failed to execute: ",
|
|
7071
7069
|
result.error || result.message
|
|
7072
7070
|
] })
|
|
@@ -7079,7 +7077,7 @@ Please use command_status to check the result and report back to the user.`;
|
|
|
7079
7077
|
...prev,
|
|
7080
7078
|
{
|
|
7081
7079
|
id: prev.length,
|
|
7082
|
-
component: /* @__PURE__ */
|
|
7080
|
+
component: /* @__PURE__ */ jsxs15(Text16, { color: "red", children: [
|
|
7083
7081
|
"Error: ",
|
|
7084
7082
|
err.message
|
|
7085
7083
|
] })
|
|
@@ -7098,8 +7096,8 @@ Please use command_status to check the result and report back to the user.`;
|
|
|
7098
7096
|
id: prev.length,
|
|
7099
7097
|
component: (
|
|
7100
7098
|
// Uma única Box para o espaçamento
|
|
7101
|
-
/* @__PURE__ */ jsx17(Box17, { marginBottom: 1, children: /* @__PURE__ */
|
|
7102
|
-
/* @__PURE__ */
|
|
7099
|
+
/* @__PURE__ */ jsx17(Box17, { marginBottom: 1, children: /* @__PURE__ */ jsxs15(Text16, { color: "white", dimColor: true, children: [
|
|
7100
|
+
/* @__PURE__ */ jsxs15(Text16, { color: "white", children: [
|
|
7103
7101
|
">",
|
|
7104
7102
|
" "
|
|
7105
7103
|
] }),
|
|
@@ -7216,7 +7214,7 @@ Please use command_status to check the result and report back to the user.`;
|
|
|
7216
7214
|
if (parsed.type === "debug") {
|
|
7217
7215
|
newComponent = /* @__PURE__ */ jsx17(Text16, { color: "gray", children: parsed.message });
|
|
7218
7216
|
} else if (parsed.type === "protocol_violation") {
|
|
7219
|
-
newComponent = /* @__PURE__ */
|
|
7217
|
+
newComponent = /* @__PURE__ */ jsxs15(
|
|
7220
7218
|
Box17,
|
|
7221
7219
|
{
|
|
7222
7220
|
borderStyle: "round",
|
|
@@ -7259,8 +7257,8 @@ Please use command_status to check the result and report back to the user.`;
|
|
|
7259
7257
|
}
|
|
7260
7258
|
);
|
|
7261
7259
|
} else if (parsed.type === "user_overlay") {
|
|
7262
|
-
newComponent = /* @__PURE__ */ jsx17(Box17, { marginBottom: 1, children: /* @__PURE__ */
|
|
7263
|
-
/* @__PURE__ */
|
|
7260
|
+
newComponent = /* @__PURE__ */ jsx17(Box17, { marginBottom: 1, children: /* @__PURE__ */ jsxs15(Text16, { color: "gray", children: [
|
|
7261
|
+
/* @__PURE__ */ jsxs15(Text16, { color: "magenta", children: [
|
|
7264
7262
|
">",
|
|
7265
7263
|
" "
|
|
7266
7264
|
] }),
|
|
@@ -7269,7 +7267,7 @@ Please use command_status to check the result and report back to the user.`;
|
|
|
7269
7267
|
} else if (parsed.type === "reasoning") {
|
|
7270
7268
|
newComponent = /* @__PURE__ */ jsx17(ReasoningDisplay, { reasoning: parsed.content });
|
|
7271
7269
|
} else if (parsed.type === "log") {
|
|
7272
|
-
newComponent = /* @__PURE__ */
|
|
7270
|
+
newComponent = /* @__PURE__ */ jsxs15(Text16, { color: "gray", children: [
|
|
7273
7271
|
"\u2139\uFE0F ",
|
|
7274
7272
|
parsed.message,
|
|
7275
7273
|
parsed.payload ? `: ${parsed.payload}` : ""
|
|
@@ -7314,7 +7312,7 @@ Please use command_status to check the result and report back to the user.`;
|
|
|
7314
7312
|
}
|
|
7315
7313
|
);
|
|
7316
7314
|
}
|
|
7317
|
-
return /* @__PURE__ */
|
|
7315
|
+
return /* @__PURE__ */ jsxs15(Box17, { flexDirection: "column", children: [
|
|
7318
7316
|
isProcessing && !pendingConfirmation && /* @__PURE__ */ jsx17(WorkingTimer, { eventBus: eventBus2 }),
|
|
7319
7317
|
/* @__PURE__ */ jsx17(
|
|
7320
7318
|
InputPrompt,
|
|
@@ -7327,8 +7325,8 @@ Please use command_status to check the result and report back to the user.`;
|
|
|
7327
7325
|
)
|
|
7328
7326
|
] });
|
|
7329
7327
|
};
|
|
7330
|
-
return /* @__PURE__ */
|
|
7331
|
-
/* @__PURE__ */ jsx17(
|
|
7328
|
+
return /* @__PURE__ */ jsxs15(Box17, { flexDirection: "column", children: [
|
|
7329
|
+
/* @__PURE__ */ jsx17(Static, { items: history, children: (item) => /* @__PURE__ */ jsx17(Box17, { children: item.component }, item.id) }),
|
|
7332
7330
|
/* @__PURE__ */ jsx17(
|
|
7333
7331
|
StreamingText,
|
|
7334
7332
|
{
|