@nomad-e/bluma-cli 0.1.2 → 0.1.4
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 +49 -30
- 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 } from "ink";
|
|
338
|
+
import { Box as Box17, Text as Text16, Static as Static2 } 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 { useState as useState4, useEffect as useEffect4, memo as memo5 } from "react";
|
|
5897
|
+
import React4, { 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
|
+
}, 150);
|
|
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 shineText = React4.useMemo(() => {
|
|
5930
|
+
const chars = displayAction.split("");
|
|
5931
|
+
const textLen = displayAction.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
|
+
}, [displayAction, shinePosition]);
|
|
5942
5942
|
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 1, children: [
|
|
5943
|
-
/* @__PURE__ */ jsx7(Box7, { children:
|
|
5943
|
+
/* @__PURE__ */ jsx7(Box7, { children: shineText }),
|
|
5944
5944
|
taskName && /* @__PURE__ */ jsx7(Box7, { paddingLeft: 2, children: /* @__PURE__ */ jsxs7(Text7, { dimColor: true, children: [
|
|
5945
5945
|
"\u203A ",
|
|
5946
5946
|
taskName
|
|
@@ -6883,22 +6883,37 @@ 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 } from "ink";
|
|
6887
|
-
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
6886
|
+
import { Box as Box16, Text as Text15, Static } from "ink";
|
|
6887
|
+
import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
6888
6888
|
var StreamingTextComponent = ({ eventBus: eventBus2, onReasoningComplete }) => {
|
|
6889
|
-
const [
|
|
6889
|
+
const [completedLines, setCompletedLines] = useState6([]);
|
|
6890
|
+
const [currentLine, setCurrentLine] = useState6("");
|
|
6890
6891
|
const [isStreaming, setIsStreaming] = useState6(false);
|
|
6891
6892
|
const reasoningRef = useRef4("");
|
|
6893
|
+
const lastProcessedLength = useRef4(0);
|
|
6892
6894
|
useEffect5(() => {
|
|
6893
6895
|
const handleStart = () => {
|
|
6894
|
-
|
|
6896
|
+
setCompletedLines([]);
|
|
6897
|
+
setCurrentLine("");
|
|
6895
6898
|
reasoningRef.current = "";
|
|
6899
|
+
lastProcessedLength.current = 0;
|
|
6896
6900
|
setIsStreaming(true);
|
|
6897
6901
|
};
|
|
6898
6902
|
const handleReasoningChunk = (data) => {
|
|
6899
6903
|
if (data.delta) {
|
|
6900
6904
|
reasoningRef.current += data.delta;
|
|
6901
|
-
|
|
6905
|
+
const fullText = reasoningRef.current;
|
|
6906
|
+
const lastNewlineIndex = fullText.lastIndexOf("\n");
|
|
6907
|
+
if (lastNewlineIndex > lastProcessedLength.current) {
|
|
6908
|
+
const newCompleteText = fullText.substring(0, lastNewlineIndex);
|
|
6909
|
+
const lines = newCompleteText.split("\n");
|
|
6910
|
+
setCompletedLines(lines.map((line, i) => ({ id: i, content: line })));
|
|
6911
|
+
setCurrentLine(fullText.substring(lastNewlineIndex + 1));
|
|
6912
|
+
lastProcessedLength.current = lastNewlineIndex + 1;
|
|
6913
|
+
} else {
|
|
6914
|
+
const startIdx = lastProcessedLength.current > 0 ? lastProcessedLength.current : fullText.lastIndexOf("\n") + 1;
|
|
6915
|
+
setCurrentLine(fullText.substring(startIdx));
|
|
6916
|
+
}
|
|
6902
6917
|
}
|
|
6903
6918
|
};
|
|
6904
6919
|
const handleEnd = () => {
|
|
@@ -6907,8 +6922,10 @@ var StreamingTextComponent = ({ eventBus: eventBus2, onReasoningComplete }) => {
|
|
|
6907
6922
|
if (finalReasoning && onReasoningComplete) {
|
|
6908
6923
|
onReasoningComplete(finalReasoning);
|
|
6909
6924
|
}
|
|
6910
|
-
|
|
6925
|
+
setCompletedLines([]);
|
|
6926
|
+
setCurrentLine("");
|
|
6911
6927
|
reasoningRef.current = "";
|
|
6928
|
+
lastProcessedLength.current = 0;
|
|
6912
6929
|
};
|
|
6913
6930
|
eventBus2.on("stream_start", handleStart);
|
|
6914
6931
|
eventBus2.on("stream_reasoning_chunk", handleReasoningChunk);
|
|
@@ -6919,16 +6936,18 @@ var StreamingTextComponent = ({ eventBus: eventBus2, onReasoningComplete }) => {
|
|
|
6919
6936
|
eventBus2.off("stream_end", handleEnd);
|
|
6920
6937
|
};
|
|
6921
6938
|
}, [eventBus2, onReasoningComplete]);
|
|
6922
|
-
if (!isStreaming || !
|
|
6939
|
+
if (!isStreaming || completedLines.length === 0 && !currentLine) {
|
|
6923
6940
|
return null;
|
|
6924
6941
|
}
|
|
6925
|
-
|
|
6926
|
-
|
|
6942
|
+
return /* @__PURE__ */ jsx16(Box16, { flexDirection: "column", paddingX: 1, marginBottom: 1, marginTop: 1, children: /* @__PURE__ */ jsxs15(Box16, { paddingLeft: 2, flexDirection: "column", children: [
|
|
6943
|
+
/* @__PURE__ */ jsx16(Static, { items: completedLines, children: (item) => /* @__PURE__ */ jsx16(Text15, { color: "gray", dimColor: true, children: item.content }, item.id) }),
|
|
6944
|
+
currentLine && /* @__PURE__ */ jsx16(Text15, { color: "gray", dimColor: true, children: currentLine })
|
|
6945
|
+
] }) });
|
|
6927
6946
|
};
|
|
6928
6947
|
var StreamingText = memo10(StreamingTextComponent);
|
|
6929
6948
|
|
|
6930
6949
|
// src/app/ui/App.tsx
|
|
6931
|
-
import { jsx as jsx17, jsxs as
|
|
6950
|
+
import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
6932
6951
|
var SAFE_AUTO_APPROVE_TOOLS = [
|
|
6933
6952
|
// Comunicação/UI
|
|
6934
6953
|
"message",
|
|
@@ -7026,7 +7045,7 @@ var AppComponent = ({ eventBus: eventBus2, sessionId: sessionId2 }) => {
|
|
|
7026
7045
|
...prev,
|
|
7027
7046
|
{
|
|
7028
7047
|
id: prev.length,
|
|
7029
|
-
component: /* @__PURE__ */
|
|
7048
|
+
component: /* @__PURE__ */ jsxs16(Box17, { marginBottom: 1, children: [
|
|
7030
7049
|
/* @__PURE__ */ jsx17(Text16, { color: "white", bold: true, children: "$ " }),
|
|
7031
7050
|
/* @__PURE__ */ jsx17(Text16, { color: "white", children: command })
|
|
7032
7051
|
] })
|
|
@@ -7047,7 +7066,7 @@ Please use command_status to check the result and report back to the user.`;
|
|
|
7047
7066
|
...prev,
|
|
7048
7067
|
{
|
|
7049
7068
|
id: prev.length,
|
|
7050
|
-
component: /* @__PURE__ */
|
|
7069
|
+
component: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
|
|
7051
7070
|
"Failed to execute: ",
|
|
7052
7071
|
result.error || result.message
|
|
7053
7072
|
] })
|
|
@@ -7060,7 +7079,7 @@ Please use command_status to check the result and report back to the user.`;
|
|
|
7060
7079
|
...prev,
|
|
7061
7080
|
{
|
|
7062
7081
|
id: prev.length,
|
|
7063
|
-
component: /* @__PURE__ */
|
|
7082
|
+
component: /* @__PURE__ */ jsxs16(Text16, { color: "red", children: [
|
|
7064
7083
|
"Error: ",
|
|
7065
7084
|
err.message
|
|
7066
7085
|
] })
|
|
@@ -7079,8 +7098,8 @@ Please use command_status to check the result and report back to the user.`;
|
|
|
7079
7098
|
id: prev.length,
|
|
7080
7099
|
component: (
|
|
7081
7100
|
// Uma única Box para o espaçamento
|
|
7082
|
-
/* @__PURE__ */ jsx17(Box17, { marginBottom: 1, children: /* @__PURE__ */
|
|
7083
|
-
/* @__PURE__ */
|
|
7101
|
+
/* @__PURE__ */ jsx17(Box17, { marginBottom: 1, children: /* @__PURE__ */ jsxs16(Text16, { color: "white", dimColor: true, children: [
|
|
7102
|
+
/* @__PURE__ */ jsxs16(Text16, { color: "white", children: [
|
|
7084
7103
|
">",
|
|
7085
7104
|
" "
|
|
7086
7105
|
] }),
|
|
@@ -7197,7 +7216,7 @@ Please use command_status to check the result and report back to the user.`;
|
|
|
7197
7216
|
if (parsed.type === "debug") {
|
|
7198
7217
|
newComponent = /* @__PURE__ */ jsx17(Text16, { color: "gray", children: parsed.message });
|
|
7199
7218
|
} else if (parsed.type === "protocol_violation") {
|
|
7200
|
-
newComponent = /* @__PURE__ */
|
|
7219
|
+
newComponent = /* @__PURE__ */ jsxs16(
|
|
7201
7220
|
Box17,
|
|
7202
7221
|
{
|
|
7203
7222
|
borderStyle: "round",
|
|
@@ -7240,8 +7259,8 @@ Please use command_status to check the result and report back to the user.`;
|
|
|
7240
7259
|
}
|
|
7241
7260
|
);
|
|
7242
7261
|
} else if (parsed.type === "user_overlay") {
|
|
7243
|
-
newComponent = /* @__PURE__ */ jsx17(Box17, { marginBottom: 1, children: /* @__PURE__ */
|
|
7244
|
-
/* @__PURE__ */
|
|
7262
|
+
newComponent = /* @__PURE__ */ jsx17(Box17, { marginBottom: 1, children: /* @__PURE__ */ jsxs16(Text16, { color: "gray", children: [
|
|
7263
|
+
/* @__PURE__ */ jsxs16(Text16, { color: "magenta", children: [
|
|
7245
7264
|
">",
|
|
7246
7265
|
" "
|
|
7247
7266
|
] }),
|
|
@@ -7250,7 +7269,7 @@ Please use command_status to check the result and report back to the user.`;
|
|
|
7250
7269
|
} else if (parsed.type === "reasoning") {
|
|
7251
7270
|
newComponent = /* @__PURE__ */ jsx17(ReasoningDisplay, { reasoning: parsed.content });
|
|
7252
7271
|
} else if (parsed.type === "log") {
|
|
7253
|
-
newComponent = /* @__PURE__ */
|
|
7272
|
+
newComponent = /* @__PURE__ */ jsxs16(Text16, { color: "gray", children: [
|
|
7254
7273
|
"\u2139\uFE0F ",
|
|
7255
7274
|
parsed.message,
|
|
7256
7275
|
parsed.payload ? `: ${parsed.payload}` : ""
|
|
@@ -7295,7 +7314,7 @@ Please use command_status to check the result and report back to the user.`;
|
|
|
7295
7314
|
}
|
|
7296
7315
|
);
|
|
7297
7316
|
}
|
|
7298
|
-
return /* @__PURE__ */
|
|
7317
|
+
return /* @__PURE__ */ jsxs16(Box17, { flexDirection: "column", children: [
|
|
7299
7318
|
isProcessing && !pendingConfirmation && /* @__PURE__ */ jsx17(WorkingTimer, { eventBus: eventBus2 }),
|
|
7300
7319
|
/* @__PURE__ */ jsx17(
|
|
7301
7320
|
InputPrompt,
|
|
@@ -7308,8 +7327,8 @@ Please use command_status to check the result and report back to the user.`;
|
|
|
7308
7327
|
)
|
|
7309
7328
|
] });
|
|
7310
7329
|
};
|
|
7311
|
-
return /* @__PURE__ */
|
|
7312
|
-
/* @__PURE__ */ jsx17(
|
|
7330
|
+
return /* @__PURE__ */ jsxs16(Box17, { flexDirection: "column", children: [
|
|
7331
|
+
/* @__PURE__ */ jsx17(Static2, { items: history, children: (item) => /* @__PURE__ */ jsx17(Box17, { children: item.component }, item.id) }),
|
|
7313
7332
|
/* @__PURE__ */ jsx17(
|
|
7314
7333
|
StreamingText,
|
|
7315
7334
|
{
|