fluxflow-cli 1.17.2 → 1.17.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/fluxflow.js +683 -310
- package/package.json +2 -3
package/dist/fluxflow.js
CHANGED
|
@@ -9,6 +9,364 @@ var __export = (target, all) => {
|
|
|
9
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
+
// src/components/MultilineInput.jsx
|
|
13
|
+
import React, { useState, useEffect, useMemo, useCallback, useRef } from "react";
|
|
14
|
+
import { Box, Spacer, Text, useInput, measureElement } from "ink";
|
|
15
|
+
function expandTabs(text, tabSize) {
|
|
16
|
+
return text.replace(/\t/g, " ".repeat(tabSize));
|
|
17
|
+
}
|
|
18
|
+
function normalizeLineEndings(text) {
|
|
19
|
+
if (text == null) return "";
|
|
20
|
+
return text.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
21
|
+
}
|
|
22
|
+
var MeasureBox, ControlledMultilineInput, MultilineInput;
|
|
23
|
+
var init_MultilineInput = __esm({
|
|
24
|
+
"src/components/MultilineInput.jsx"() {
|
|
25
|
+
MeasureBox = ({ children, onHeightChange }) => {
|
|
26
|
+
const ref = useRef(null);
|
|
27
|
+
const lastHeightRef = useRef(void 0);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (ref.current) {
|
|
30
|
+
const { height } = measureElement(ref.current);
|
|
31
|
+
if (lastHeightRef.current !== height) {
|
|
32
|
+
lastHeightRef.current = height;
|
|
33
|
+
onHeightChange?.(height);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return /* @__PURE__ */ React.createElement(Box, { ref, flexShrink: 0, flexGrow: 0, width: "100%" }, children);
|
|
38
|
+
};
|
|
39
|
+
ControlledMultilineInput = ({
|
|
40
|
+
value,
|
|
41
|
+
rows,
|
|
42
|
+
maxRows,
|
|
43
|
+
highlightStyle,
|
|
44
|
+
textStyle,
|
|
45
|
+
placeholder = "",
|
|
46
|
+
mask,
|
|
47
|
+
showCursor = true,
|
|
48
|
+
focus = true,
|
|
49
|
+
tabSize = 4,
|
|
50
|
+
cursorIndex = 0,
|
|
51
|
+
highlight,
|
|
52
|
+
refreshKey
|
|
53
|
+
}) => {
|
|
54
|
+
const [scrollOffset, setScrollOffset] = useState(0);
|
|
55
|
+
const [contentHeight, setContentHeight] = useState(0);
|
|
56
|
+
const [markerHeight, setMarkerHeight] = useState(0);
|
|
57
|
+
const formatText = useCallback(
|
|
58
|
+
(text, isPlaceholder = false) => {
|
|
59
|
+
const normalized = normalizeLineEndings(text);
|
|
60
|
+
if (!isPlaceholder && mask) {
|
|
61
|
+
return normalized.replace(/[^\n]/g, mask);
|
|
62
|
+
}
|
|
63
|
+
const expanded = expandTabs(normalized, tabSize);
|
|
64
|
+
if (isPlaceholder) return expanded;
|
|
65
|
+
return expanded.replace(/@\[(.*?)\]/g, (match, p1) => {
|
|
66
|
+
const hashIdx = p1.indexOf("#");
|
|
67
|
+
const colonIdx = p1.indexOf(":L");
|
|
68
|
+
let pathOnly = p1;
|
|
69
|
+
let suffix = "";
|
|
70
|
+
if (hashIdx !== -1) {
|
|
71
|
+
pathOnly = p1.slice(0, hashIdx);
|
|
72
|
+
suffix = p1.slice(hashIdx);
|
|
73
|
+
} else if (colonIdx !== -1) {
|
|
74
|
+
pathOnly = p1.slice(0, colonIdx);
|
|
75
|
+
suffix = p1.slice(colonIdx);
|
|
76
|
+
}
|
|
77
|
+
let rel = pathOnly.replace(/\\/g, "/");
|
|
78
|
+
const cwd = (process.cwd() || "").replace(/\\/g, "/");
|
|
79
|
+
if (cwd && rel.toLowerCase().startsWith(cwd.toLowerCase() + "/")) {
|
|
80
|
+
rel = rel.slice(cwd.length + 1);
|
|
81
|
+
} else if (rel.startsWith("./")) {
|
|
82
|
+
rel = rel.slice(2);
|
|
83
|
+
}
|
|
84
|
+
const parts = rel.split("/");
|
|
85
|
+
const basename = parts[parts.length - 1];
|
|
86
|
+
return `[${basename}${suffix}]`;
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
[tabSize, mask]
|
|
90
|
+
);
|
|
91
|
+
const { preCursor, postCursor } = useMemo(() => {
|
|
92
|
+
if (!value) {
|
|
93
|
+
if (placeholder && !focus) {
|
|
94
|
+
return {
|
|
95
|
+
preCursor: [{ value: formatText(placeholder, true), type: "placeholder" }],
|
|
96
|
+
postCursor: []
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
preCursor: [{ value: " ", type: "cursor" }],
|
|
101
|
+
postCursor: []
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
const textBefore = value.slice(0, cursorIndex);
|
|
105
|
+
const textAfter = value.slice(cursorIndex);
|
|
106
|
+
if (!focus) {
|
|
107
|
+
return {
|
|
108
|
+
preCursor: [{ value: formatText(value) }],
|
|
109
|
+
postCursor: []
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
const hasValidHighlight = highlight && highlight.end > highlight.start && highlight.start >= 0 && highlight.end <= value.length;
|
|
113
|
+
if (!hasValidHighlight) {
|
|
114
|
+
const formattedBefore = formatText(textBefore);
|
|
115
|
+
const formattedAfter = formatText(textAfter);
|
|
116
|
+
const lineStart = formattedBefore.lastIndexOf("\n") + 1;
|
|
117
|
+
const lineEnd = formattedAfter.indexOf("\n");
|
|
118
|
+
return {
|
|
119
|
+
preCursor: [
|
|
120
|
+
{ value: formattedBefore.slice(0, lineStart) },
|
|
121
|
+
{ value: formattedBefore.slice(lineStart), type: "highlight" },
|
|
122
|
+
{ value: showCursor && focus ? " " : "", type: "cursor" }
|
|
123
|
+
],
|
|
124
|
+
postCursor: [
|
|
125
|
+
{ value: formattedAfter.slice(0, lineEnd), type: "highlight" },
|
|
126
|
+
{ value: formattedAfter.slice(lineEnd) }
|
|
127
|
+
]
|
|
128
|
+
};
|
|
129
|
+
} else {
|
|
130
|
+
return {
|
|
131
|
+
preCursor: [
|
|
132
|
+
{ value: formatText(textBefore.slice(0, highlight.start)) },
|
|
133
|
+
{
|
|
134
|
+
value: formatText(textBefore.slice(highlight.start, Math.min(highlight.end, cursorIndex))),
|
|
135
|
+
type: "highlight"
|
|
136
|
+
},
|
|
137
|
+
{ value: formatText(textBefore.slice(highlight.end)) },
|
|
138
|
+
{ value: " ", type: "cursor" }
|
|
139
|
+
],
|
|
140
|
+
postCursor: [
|
|
141
|
+
{
|
|
142
|
+
value: formatText(textAfter.slice(0, Math.max(highlight.start - cursorIndex, 0)))
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
value: formatText(textAfter.slice(Math.max(highlight.start - cursorIndex, 0), Math.max(highlight.end - cursorIndex, 0))),
|
|
146
|
+
type: "highlight"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
value: formatText(textAfter.slice(Math.max(highlight.end - cursorIndex, 0)))
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
}, [cursorIndex, showCursor, focus, value, placeholder, mask, highlight, formatText, refreshKey]);
|
|
155
|
+
const visibleRows = useMemo(() => {
|
|
156
|
+
if (contentHeight !== void 0) {
|
|
157
|
+
return Math.max(rows ?? maxRows ?? 1, Math.min(maxRows ?? rows ?? 1, contentHeight));
|
|
158
|
+
}
|
|
159
|
+
return 1;
|
|
160
|
+
}, [rows, maxRows, contentHeight]);
|
|
161
|
+
useEffect(() => {
|
|
162
|
+
if (markerHeight !== void 0 && visibleRows !== void 0) {
|
|
163
|
+
const cursorLineEnd = markerHeight;
|
|
164
|
+
setScrollOffset((prevOffset) => {
|
|
165
|
+
const viewportStart = prevOffset;
|
|
166
|
+
const viewportEnd = prevOffset + visibleRows;
|
|
167
|
+
if (cursorLineEnd <= viewportStart) {
|
|
168
|
+
return Math.max(0, cursorLineEnd - 1);
|
|
169
|
+
} else if (cursorLineEnd > viewportEnd) {
|
|
170
|
+
return cursorLineEnd - visibleRows;
|
|
171
|
+
} else if (contentHeight) {
|
|
172
|
+
if (contentHeight < visibleRows) {
|
|
173
|
+
return 0;
|
|
174
|
+
} else if (contentHeight < viewportEnd) {
|
|
175
|
+
return contentHeight - visibleRows;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return prevOffset;
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}, [markerHeight, visibleRows, contentHeight]);
|
|
182
|
+
const getStyle = useCallback(
|
|
183
|
+
(type) => {
|
|
184
|
+
switch (type) {
|
|
185
|
+
case "placeholder":
|
|
186
|
+
return { ...textStyle, dimColor: true };
|
|
187
|
+
case "highlight":
|
|
188
|
+
return highlightStyle ?? textStyle;
|
|
189
|
+
case "cursor":
|
|
190
|
+
return {
|
|
191
|
+
...highlightStyle ?? textStyle,
|
|
192
|
+
inverse: showCursor && focus
|
|
193
|
+
};
|
|
194
|
+
default:
|
|
195
|
+
return textStyle;
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
[textStyle, highlightStyle, showCursor, focus]
|
|
199
|
+
);
|
|
200
|
+
return /* @__PURE__ */ React.createElement(Box, { height: visibleRows, overflow: "hidden", flexDirection: "column", flexGrow: 0, flexShrink: 0 }, /* @__PURE__ */ React.createElement(Box, { flexDirection: "column" }, /* @__PURE__ */ React.createElement(Box, { height: visibleRows, overflowY: "hidden", flexShrink: 0, flexDirection: "column" }, /* @__PURE__ */ React.createElement(Box, { marginTop: -scrollOffset, flexDirection: "column" }, /* @__PURE__ */ React.createElement(MeasureBox, { onHeightChange: setContentHeight }, /* @__PURE__ */ React.createElement(Text, null, preCursor?.map((segment, idx) => /* @__PURE__ */ React.createElement(Text, { key: idx, ...getStyle(segment.type) }, segment.value)), postCursor?.map((segment, idx) => /* @__PURE__ */ React.createElement(Text, { key: idx, ...getStyle(segment.type) }, segment.value))))), /* @__PURE__ */ React.createElement(Spacer, null)), /* @__PURE__ */ React.createElement(MeasureBox, { onHeightChange: setMarkerHeight }, /* @__PURE__ */ React.createElement(Text, null, preCursor?.map((segment, idx) => /* @__PURE__ */ React.createElement(Text, { key: idx, ...getStyle(segment.type) }, segment.value))))));
|
|
201
|
+
};
|
|
202
|
+
MultilineInput = ({
|
|
203
|
+
value,
|
|
204
|
+
onChange,
|
|
205
|
+
onSubmit,
|
|
206
|
+
keyBindings,
|
|
207
|
+
showCursor = true,
|
|
208
|
+
highlightPastedText = false,
|
|
209
|
+
focus = true,
|
|
210
|
+
useCustomInput = (inputHandler, isActive) => useInput(inputHandler, { isActive }),
|
|
211
|
+
...controlledProps
|
|
212
|
+
}) => {
|
|
213
|
+
const [cursorIndex, setCursorIndex] = useState(value.length);
|
|
214
|
+
const [pasteLength, setPasteLength] = useState(0);
|
|
215
|
+
useEffect(() => {
|
|
216
|
+
if (cursorIndex > value.length) {
|
|
217
|
+
setCursorIndex(value.length);
|
|
218
|
+
}
|
|
219
|
+
}, [value, cursorIndex]);
|
|
220
|
+
useCustomInput((input, key) => {
|
|
221
|
+
const submitKey = keyBindings?.submit ?? ((key2) => key2.return && key2.ctrl);
|
|
222
|
+
const newlineKey = keyBindings?.newline ?? ((key2) => key2.return);
|
|
223
|
+
if (submitKey(key)) {
|
|
224
|
+
onSubmit?.(value);
|
|
225
|
+
return;
|
|
226
|
+
} else if (newlineKey(key)) {
|
|
227
|
+
const newValue = value.slice(0, cursorIndex) + "\n" + value.slice(cursorIndex);
|
|
228
|
+
onChange(newValue);
|
|
229
|
+
setCursorIndex(cursorIndex + 1);
|
|
230
|
+
setPasteLength(0);
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
if (key.tab || key.shift && key.tab || key.ctrl && input === "c") {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
if (keyBindings?.newline?.(key)) {
|
|
237
|
+
const newValue = value.slice(0, cursorIndex) + "\n" + value.slice(cursorIndex);
|
|
238
|
+
onChange(newValue);
|
|
239
|
+
setCursorIndex(cursorIndex + 1);
|
|
240
|
+
setPasteLength(0);
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
let nextPasteLength = 0;
|
|
244
|
+
if (input.length > 1) {
|
|
245
|
+
nextPasteLength = input.length;
|
|
246
|
+
}
|
|
247
|
+
if (key.upArrow) {
|
|
248
|
+
if (showCursor) {
|
|
249
|
+
const lines = normalizeLineEndings(value).split("\n");
|
|
250
|
+
let currentLineIndex = 0;
|
|
251
|
+
let currentPos = 0;
|
|
252
|
+
let col = 0;
|
|
253
|
+
for (let i = 0; i < lines.length; i++) {
|
|
254
|
+
const line = lines[i];
|
|
255
|
+
if (line === void 0) continue;
|
|
256
|
+
const lineLen = line.length;
|
|
257
|
+
const lineEnd = currentPos + lineLen;
|
|
258
|
+
if (cursorIndex >= currentPos && cursorIndex <= lineEnd) {
|
|
259
|
+
currentLineIndex = i;
|
|
260
|
+
col = cursorIndex - currentPos;
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
currentPos = lineEnd + 1;
|
|
264
|
+
}
|
|
265
|
+
if (currentLineIndex > 0) {
|
|
266
|
+
const targetLineIndex = currentLineIndex - 1;
|
|
267
|
+
const targetLine = lines[targetLineIndex];
|
|
268
|
+
if (targetLine !== void 0) {
|
|
269
|
+
const targetLineLen = targetLine.length;
|
|
270
|
+
const newCol = Math.min(col, targetLineLen);
|
|
271
|
+
let newIndex = 0;
|
|
272
|
+
for (let i = 0; i < targetLineIndex; i++) {
|
|
273
|
+
newIndex += lines[i].length + 1;
|
|
274
|
+
}
|
|
275
|
+
newIndex += newCol;
|
|
276
|
+
setCursorIndex(newIndex);
|
|
277
|
+
setPasteLength(0);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
} else if (key.downArrow) {
|
|
282
|
+
if (showCursor) {
|
|
283
|
+
const lines = normalizeLineEndings(value).split("\n");
|
|
284
|
+
let currentLineIndex = 0;
|
|
285
|
+
let currentPos = 0;
|
|
286
|
+
let col = 0;
|
|
287
|
+
for (let i = 0; i < lines.length; i++) {
|
|
288
|
+
const line = lines[i];
|
|
289
|
+
if (line === void 0) continue;
|
|
290
|
+
const lineLen = line.length;
|
|
291
|
+
const lineEnd = currentPos + lineLen;
|
|
292
|
+
if (cursorIndex >= currentPos && cursorIndex <= lineEnd) {
|
|
293
|
+
currentLineIndex = i;
|
|
294
|
+
col = cursorIndex - currentPos;
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
297
|
+
currentPos = lineEnd + 1;
|
|
298
|
+
}
|
|
299
|
+
if (currentLineIndex < lines.length - 1) {
|
|
300
|
+
const targetLineIndex = currentLineIndex + 1;
|
|
301
|
+
const targetLine = lines[targetLineIndex];
|
|
302
|
+
if (targetLine !== void 0) {
|
|
303
|
+
const targetLineLen = targetLine.length;
|
|
304
|
+
const newCol = Math.min(col, targetLineLen);
|
|
305
|
+
let newIndex = 0;
|
|
306
|
+
for (let i = 0; i < targetLineIndex; i++) {
|
|
307
|
+
newIndex += lines[i].length + 1;
|
|
308
|
+
}
|
|
309
|
+
newIndex += newCol;
|
|
310
|
+
setCursorIndex(newIndex);
|
|
311
|
+
setPasteLength(0);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
} else if (key.leftArrow) {
|
|
316
|
+
if (showCursor) {
|
|
317
|
+
setCursorIndex(Math.max(0, cursorIndex - 1));
|
|
318
|
+
setPasteLength(0);
|
|
319
|
+
}
|
|
320
|
+
} else if (key.rightArrow) {
|
|
321
|
+
if (showCursor) {
|
|
322
|
+
setCursorIndex(Math.min(value.length, cursorIndex + 1));
|
|
323
|
+
setPasteLength(0);
|
|
324
|
+
}
|
|
325
|
+
} else if (key.return) {
|
|
326
|
+
const newValue = value.slice(0, cursorIndex) + "\n" + value.slice(cursorIndex);
|
|
327
|
+
onChange(newValue);
|
|
328
|
+
setCursorIndex(cursorIndex + 1);
|
|
329
|
+
setPasteLength(0);
|
|
330
|
+
} else if (key.backspace || key.delete) {
|
|
331
|
+
if (cursorIndex > 0) {
|
|
332
|
+
const newValue = value.slice(0, cursorIndex - 1) + value.slice(cursorIndex);
|
|
333
|
+
onChange(newValue);
|
|
334
|
+
setCursorIndex(cursorIndex - 1);
|
|
335
|
+
setPasteLength(0);
|
|
336
|
+
}
|
|
337
|
+
} else {
|
|
338
|
+
if (input) {
|
|
339
|
+
const newValue = value.slice(0, cursorIndex) + input + value.slice(cursorIndex);
|
|
340
|
+
onChange(newValue);
|
|
341
|
+
setCursorIndex(cursorIndex + input.length);
|
|
342
|
+
setPasteLength(nextPasteLength);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}, focus);
|
|
346
|
+
const highlight = useMemo(() => {
|
|
347
|
+
if (highlightPastedText && pasteLength > 1) {
|
|
348
|
+
return {
|
|
349
|
+
start: Math.max(0, cursorIndex - pasteLength),
|
|
350
|
+
end: cursorIndex
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
return void 0;
|
|
354
|
+
}, [cursorIndex, pasteLength, highlightPastedText]);
|
|
355
|
+
return /* @__PURE__ */ React.createElement(
|
|
356
|
+
ControlledMultilineInput,
|
|
357
|
+
{
|
|
358
|
+
...controlledProps,
|
|
359
|
+
value,
|
|
360
|
+
cursorIndex,
|
|
361
|
+
highlight,
|
|
362
|
+
showCursor,
|
|
363
|
+
focus
|
|
364
|
+
}
|
|
365
|
+
);
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
|
|
12
370
|
// src/utils/text.js
|
|
13
371
|
import os from "os";
|
|
14
372
|
var wrapText, formatTokens, truncatePath;
|
|
@@ -99,16 +457,16 @@ var init_text = __esm({
|
|
|
99
457
|
});
|
|
100
458
|
|
|
101
459
|
// src/components/TerminalBox.jsx
|
|
102
|
-
import
|
|
103
|
-
import { Box, Text } from "ink";
|
|
460
|
+
import React2 from "react";
|
|
461
|
+
import { Box as Box2, Text as Text2 } from "ink";
|
|
104
462
|
var TerminalBox;
|
|
105
463
|
var init_TerminalBox = __esm({
|
|
106
464
|
"src/components/TerminalBox.jsx"() {
|
|
107
465
|
init_text();
|
|
108
|
-
TerminalBox =
|
|
466
|
+
TerminalBox = React2.memo(({ command, output, completed = false, isFocused = false, columns = 80 }) => {
|
|
109
467
|
const cleanOutput = (output || "").replace(/\r/g, "").trim();
|
|
110
468
|
const wrappedOutput = cleanOutput ? wrapText(cleanOutput, columns - 6) : "";
|
|
111
|
-
return /* @__PURE__ */
|
|
469
|
+
return /* @__PURE__ */ React2.createElement(Box2, { flexDirection: "column", borderStyle: isFocused ? "double" : "round", borderColor: completed ? "#334155" : isFocused ? "yellow" : "cyan", paddingX: 2, paddingY: completed ? 0 : 1, width: "100%" }, /* @__PURE__ */ React2.createElement(Box2, { marginBottom: 1 }, /* @__PURE__ */ React2.createElement(Text2, { color: completed ? "gray" : isFocused ? "yellow" : "cyan", bold: true }, completed ? "\u{1F3C1} FINISHED:" : "\u26A1 EXECUTING:", " "), /* @__PURE__ */ React2.createElement(Text2, { color: completed ? "gray" : "white" }, command)), wrappedOutput ? /* @__PURE__ */ React2.createElement(Box2, { marginTop: completed ? 0 : 1, backgroundColor: "#0a0a0a", paddingX: 1 }, /* @__PURE__ */ React2.createElement(Text2, { color: completed ? "gray" : "green" }, wrappedOutput)) : !completed && /* @__PURE__ */ React2.createElement(Box2, { marginTop: 1, backgroundColor: "#0a0a0a", paddingX: 1 }, /* @__PURE__ */ React2.createElement(Text2, { color: "gray", italic: true }, "Waiting for output...")), /* @__PURE__ */ React2.createElement(Box2, { justifyContent: "space-between", marginTop: 1 }, !completed ? /* @__PURE__ */ React2.createElement(Text2, { color: "gray", dimColor: true, italic: true }, "Double-press ESC to terminate if hanging.") : /* @__PURE__ */ React2.createElement(Box2, null), /* @__PURE__ */ React2.createElement(Text2, { color: completed ? "#475569" : isFocused ? "yellow" : "cyan", bold: true }, completed ? "\u25CF ARCHIVED" : isFocused ? "\u25B6 TERMINAL FOCUSED" : "\u25CF LIVE (Press TAB to focus)")));
|
|
112
470
|
});
|
|
113
471
|
}
|
|
114
472
|
});
|
|
@@ -136,8 +494,8 @@ var init_terminal = __esm({
|
|
|
136
494
|
});
|
|
137
495
|
|
|
138
496
|
// src/components/ChatLayout.jsx
|
|
139
|
-
import
|
|
140
|
-
import { Box as
|
|
497
|
+
import React3, { useState as useState2, useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
498
|
+
import { Box as Box3, Text as Text3 } from "ink";
|
|
141
499
|
var TOOL_LABELS, cleanSignals, formatThinkText, parseMathSymbols, InlineMarkdown, TableRenderer, MarkdownText, DiffLine, DiffBlock, CodeRenderer, formatThinkingDuration, MessageItem, ChatLayout, ChatLayout_default;
|
|
142
500
|
var init_ChatLayout = __esm({
|
|
143
501
|
"src/components/ChatLayout.jsx"() {
|
|
@@ -231,37 +589,42 @@ var init_ChatLayout = __esm({
|
|
|
231
589
|
if (!cleaned) return null;
|
|
232
590
|
const availableWidth = columns - 10;
|
|
233
591
|
const wrapped = wrapText(cleaned.trim(), availableWidth);
|
|
234
|
-
return /* @__PURE__ */
|
|
592
|
+
return /* @__PURE__ */ React3.createElement(Box3, { width: "100%" }, /* @__PURE__ */ React3.createElement(Text3, { italic: true, color: "gray" }, wrapped));
|
|
235
593
|
};
|
|
236
594
|
parseMathSymbols = (content) => {
|
|
237
595
|
return content.replace(/\\multiply|\\mul|\\times/g, "\xD7").replace(/\\div/g, "\xF7").replace(/\\cdot/g, "\u22C5").replace(/\\infty/g, "\u221E").replace(/\\pm/g, "\xB1").replace(/\\leq/g, "\u2264").replace(/\\geq/g, "\u2265").replace(/\\neq/g, "\u2260").replace(/\\sqrt\{?(.*?)\}?/g, (_, p1) => `\u221A(${p1})`).replace(/\\alpha/g, "\u03B1").replace(/\\beta/g, "\u03B2").replace(/\\theta/g, "\u03B8").replace(/\\pi/g, "\u03C0").replace(/\\approx/g, "\u2248").replace(/\\Delta/g, "\u0394").replace(/\\sigma/g, "\u03C3").replace(/\\sum/g, "\u03A3").replace(/\\prod/g, "\u03A0").replace(/\\rightarrow|\\to/g, "\u2192").replace(/\\leftarrow/g, "\u2190").replace(/\\leftrightarrow/g, "\u2194").replace(/\\left\(|\\right\)/g, (match) => match.includes("left") ? "(" : ")").replace(/\\left\[|\\right\]/g, (match) => match.includes("left") ? "[" : "]").replace(/\\\{|\\\}/g, (match) => match.includes("{") ? "{" : "}").replace(/\\text\{?(.*?)\}?/g, "$1");
|
|
238
596
|
};
|
|
239
|
-
InlineMarkdown =
|
|
597
|
+
InlineMarkdown = React3.memo(({ text, color }) => {
|
|
240
598
|
if (!text) return null;
|
|
241
599
|
const parts = text.split(/(```[\s\S]*?```|`[^`]+`|@\[.*?\]|\*\*.*?\*\*|\*.*?\*|\$.*?\$|\[.*?\]\s*\(.*?\)|\[.*?\]\s*\[.*?\]|https?:\/\/[^\s]+)/g);
|
|
242
|
-
return /* @__PURE__ */
|
|
600
|
+
return /* @__PURE__ */ React3.createElement(Text3, { color, wrap: "anywhere" }, parts.map((part, j) => {
|
|
243
601
|
if (!part) return null;
|
|
244
602
|
if (part.startsWith("```") && part.endsWith("```")) {
|
|
245
|
-
return /* @__PURE__ */
|
|
603
|
+
return /* @__PURE__ */ React3.createElement(CodeRenderer, { key: j, text: part });
|
|
246
604
|
}
|
|
247
605
|
if (part.startsWith("**") && part.endsWith("**")) {
|
|
248
|
-
return /* @__PURE__ */
|
|
606
|
+
return /* @__PURE__ */ React3.createElement(Text3, { key: j, bold: true, color: "white" }, /* @__PURE__ */ React3.createElement(InlineMarkdown, { text: part.slice(2, -2), color: "white" }));
|
|
249
607
|
}
|
|
250
608
|
if (part.startsWith("*") && part.endsWith("*")) {
|
|
251
|
-
return /* @__PURE__ */
|
|
609
|
+
return /* @__PURE__ */ React3.createElement(Text3, { key: j, italic: true, color: "gray" }, /* @__PURE__ */ React3.createElement(InlineMarkdown, { text: part.slice(1, -1), color: "gray" }));
|
|
252
610
|
}
|
|
253
611
|
if (part.startsWith("`") && part.endsWith("`")) {
|
|
254
|
-
|
|
612
|
+
const content = part.slice(1, -1);
|
|
613
|
+
const formatted = content.replace(/@\[(.*?)\]/g, (match, p1) => {
|
|
614
|
+
return p1.split("/").pop().split("\\").pop().replace(/:L/gi, "#L");
|
|
615
|
+
});
|
|
616
|
+
const hasFileRef = content.includes("@[");
|
|
617
|
+
return /* @__PURE__ */ React3.createElement(Text3, { key: j, color: "cyan", bold: hasFileRef, backgroundColor: hasFileRef ? "#111124" : "#003333" }, " ", formatted, " ");
|
|
255
618
|
}
|
|
256
619
|
if (part.startsWith("@[") && part.endsWith("]")) {
|
|
257
620
|
const filePath = part.slice(2, -1);
|
|
258
|
-
const basename = filePath.split("/").pop().split("\\").pop();
|
|
259
|
-
return /* @__PURE__ */
|
|
621
|
+
const basename = filePath.split("/").pop().split("\\").pop().replace(/:L/gi, "#L");
|
|
622
|
+
return /* @__PURE__ */ React3.createElement(Text3, { key: j, color: "cyan", bold: true, backgroundColor: "#111124" }, " ", basename, " ");
|
|
260
623
|
}
|
|
261
624
|
if (part.startsWith("$") && part.endsWith("$")) {
|
|
262
625
|
const content = part.slice(1, -1);
|
|
263
626
|
const latexParts = content.split(/(\\(?:mathbf|textbf|textit|underline|text|mathrm|textsf|texttt)\{.*?\})/g);
|
|
264
|
-
return /* @__PURE__ */
|
|
627
|
+
return /* @__PURE__ */ React3.createElement(Text3, { key: j, color: "yellow" }, latexParts.map((lp, lpi) => {
|
|
265
628
|
if (lp.startsWith("\\")) {
|
|
266
629
|
const match = lp.match(/\\(\w+)\{(.*?)\}/);
|
|
267
630
|
if (match) {
|
|
@@ -271,27 +634,27 @@ var init_ChatLayout = __esm({
|
|
|
271
634
|
const isItalic = cmd === "textit";
|
|
272
635
|
const isUnderline = cmd === "underline";
|
|
273
636
|
const isMono = cmd === "texttt";
|
|
274
|
-
return /* @__PURE__ */
|
|
637
|
+
return /* @__PURE__ */ React3.createElement(Text3, { key: lpi, bold: isBold, italic: isItalic, underline: isUnderline, color: isMono ? "cyan" : void 0 }, parseMathSymbols(inner));
|
|
275
638
|
}
|
|
276
639
|
}
|
|
277
|
-
return /* @__PURE__ */
|
|
640
|
+
return /* @__PURE__ */ React3.createElement(Text3, { key: lpi }, parseMathSymbols(lp));
|
|
278
641
|
}));
|
|
279
642
|
}
|
|
280
643
|
if (part.startsWith("[") && (part.includes("](") || part.includes("] ("))) {
|
|
281
644
|
const match = part.match(/\[(.*?)\]\s*\((.*?)\)/);
|
|
282
|
-
if (match) return /* @__PURE__ */
|
|
645
|
+
if (match) return /* @__PURE__ */ React3.createElement(Text3, { key: j }, /* @__PURE__ */ React3.createElement(Text3, { color: "cyan", underline: true, bold: true }, match[1]), /* @__PURE__ */ React3.createElement(Text3, { color: "gray", dimColor: true, italic: true }, " (", match[2], ")"));
|
|
283
646
|
}
|
|
284
647
|
if (part.startsWith("[") && (part.includes("][") || part.includes("] ["))) {
|
|
285
648
|
const match = part.match(/\[(.*?)\]\s*\[(.*?)\]/);
|
|
286
|
-
if (match) return /* @__PURE__ */
|
|
649
|
+
if (match) return /* @__PURE__ */ React3.createElement(Text3, { key: j }, /* @__PURE__ */ React3.createElement(Text3, { color: "cyan", underline: true, bold: true }, match[1]), /* @__PURE__ */ React3.createElement(Text3, { color: "gray", dimColor: true, italic: true }, " [", match[2], "]"));
|
|
287
650
|
}
|
|
288
651
|
if (part.startsWith("http")) {
|
|
289
|
-
return /* @__PURE__ */
|
|
652
|
+
return /* @__PURE__ */ React3.createElement(Text3, { key: j, color: "cyan", underline: true, italic: true }, part);
|
|
290
653
|
}
|
|
291
654
|
return part;
|
|
292
655
|
}));
|
|
293
656
|
});
|
|
294
|
-
TableRenderer =
|
|
657
|
+
TableRenderer = React3.memo(({ buffer, terminalWidth = 80 }) => {
|
|
295
658
|
if (buffer.length < 2) return null;
|
|
296
659
|
const rows = buffer.map((line) => {
|
|
297
660
|
const parts = line.split("|");
|
|
@@ -306,10 +669,10 @@ var init_ChatLayout = __esm({
|
|
|
306
669
|
const colChars = Math.floor(availableWidth / header.length) - 2;
|
|
307
670
|
return (
|
|
308
671
|
// Table MarginY here
|
|
309
|
-
/* @__PURE__ */
|
|
672
|
+
/* @__PURE__ */ React3.createElement(Box3, { flexDirection: "column", borderStyle: "round", borderColor: "#454545ff", paddingX: 1, marginY: 0, width: "100%", flexGrow: 1 }, /* @__PURE__ */ React3.createElement(Box3, { flexDirection: "row", borderStyle: "single", borderBottom: true, borderTop: false, borderLeft: false, borderRight: false, borderColor: "#444", marginBottom: 1, paddingBottom: 0, width: "100%" }, header.map((cell, i) => /* @__PURE__ */ React3.createElement(Box3, { key: i, flexBasis: `${colPercentage}%`, flexGrow: 1, flexShrink: 0, paddingRight: 2 }, /* @__PURE__ */ React3.createElement(InlineMarkdown, { text: wrapText(cell, colChars), color: "cyan" })))), data.map((row, ri) => /* @__PURE__ */ React3.createElement(Box3, { key: ri, flexDirection: "row", marginBottom: ri === data.length - 1 ? 0 : 1, width: "100%" }, row.map((cell, ci) => /* @__PURE__ */ React3.createElement(Box3, { key: ci, flexBasis: `${colPercentage}%`, flexGrow: 1, flexShrink: 0, paddingRight: 2, flexDirection: "column" }, /* @__PURE__ */ React3.createElement(InlineMarkdown, { text: wrapText(cell, colChars), color: "white" }))))))
|
|
310
673
|
);
|
|
311
674
|
});
|
|
312
|
-
MarkdownText =
|
|
675
|
+
MarkdownText = React3.memo(({ text, color = "white", columns = 80 }) => {
|
|
313
676
|
if (!text) return null;
|
|
314
677
|
const lines = text.split("\n");
|
|
315
678
|
const result = [];
|
|
@@ -317,12 +680,12 @@ var init_ChatLayout = __esm({
|
|
|
317
680
|
let quoteBuffer = [];
|
|
318
681
|
const flushBuffers = (key) => {
|
|
319
682
|
if (tableBuffer.length > 0) {
|
|
320
|
-
result.push(/* @__PURE__ */
|
|
683
|
+
result.push(/* @__PURE__ */ React3.createElement(TableRenderer, { key: `table-${key}`, buffer: [...tableBuffer], terminalWidth: columns }));
|
|
321
684
|
tableBuffer = [];
|
|
322
685
|
}
|
|
323
686
|
if (quoteBuffer.length > 0) {
|
|
324
687
|
result.push(
|
|
325
|
-
/* @__PURE__ */
|
|
688
|
+
/* @__PURE__ */ React3.createElement(Box3, { key: `quote-${key}`, borderStyle: "bold", borderLeft: true, borderRight: false, borderTop: false, borderBottom: false, borderColor: "gray", paddingLeft: 1, marginY: 1, flexDirection: "column" }, quoteBuffer.map((line, qi) => /* @__PURE__ */ React3.createElement(InlineMarkdown, { key: qi, text: line, color: "gray" })))
|
|
326
689
|
);
|
|
327
690
|
quoteBuffer = [];
|
|
328
691
|
}
|
|
@@ -340,11 +703,11 @@ var init_ChatLayout = __esm({
|
|
|
340
703
|
} else {
|
|
341
704
|
flushBuffers(i);
|
|
342
705
|
if (trimmed === "") {
|
|
343
|
-
result.push(/* @__PURE__ */
|
|
706
|
+
result.push(/* @__PURE__ */ React3.createElement(Box3, { key: i, height: 1 }));
|
|
344
707
|
return;
|
|
345
708
|
}
|
|
346
709
|
if (trimmed === "---" || trimmed === "***" || trimmed === "___") {
|
|
347
|
-
result.push(/* @__PURE__ */
|
|
710
|
+
result.push(/* @__PURE__ */ React3.createElement(Box3, { key: i, marginY: 1, borderStyle: "single", borderTop: true, borderBottom: false, borderLeft: false, borderRight: false, width: "100%", borderColor: "#333" }));
|
|
348
711
|
return;
|
|
349
712
|
}
|
|
350
713
|
const headingMatch = trimmed.match(/^(#{1,6})\s+(.*)/);
|
|
@@ -352,7 +715,7 @@ var init_ChatLayout = __esm({
|
|
|
352
715
|
const level = headingMatch[1].length;
|
|
353
716
|
const hText = headingMatch[2];
|
|
354
717
|
result.push(
|
|
355
|
-
/* @__PURE__ */
|
|
718
|
+
/* @__PURE__ */ React3.createElement(Box3, { key: i, marginTop: 1, marginBottom: 1, width: "100%" }, /* @__PURE__ */ React3.createElement(Text3, { bold: true, color: level === 1 ? "cyan" : level === 2 ? "magenta" : level === 3 ? "yellow" : level === 4 ? "green" : level === 5 ? "blue" : "white", underline: true }, hText.toUpperCase()))
|
|
356
719
|
);
|
|
357
720
|
return;
|
|
358
721
|
}
|
|
@@ -371,14 +734,14 @@ var init_ChatLayout = __esm({
|
|
|
371
734
|
content = wrapText(trimmed, columns - 4);
|
|
372
735
|
}
|
|
373
736
|
result.push(
|
|
374
|
-
/* @__PURE__ */
|
|
737
|
+
/* @__PURE__ */ React3.createElement(Box3, { key: i, width: "100%" }, /* @__PURE__ */ React3.createElement(InlineMarkdown, { text: content, color }))
|
|
375
738
|
);
|
|
376
739
|
}
|
|
377
740
|
});
|
|
378
741
|
flushBuffers("final");
|
|
379
|
-
return /* @__PURE__ */
|
|
742
|
+
return /* @__PURE__ */ React3.createElement(Box3, { flexDirection: "column", width: columns - 2 }, result);
|
|
380
743
|
});
|
|
381
|
-
DiffLine =
|
|
744
|
+
DiffLine = React3.memo(({ line, columns = 80 }) => {
|
|
382
745
|
const isContext = line.includes("[UI_CONTEXT]");
|
|
383
746
|
const cleanLine = line.replace("[UI_CONTEXT]", "");
|
|
384
747
|
const isRemoval = cleanLine.startsWith("-");
|
|
@@ -388,18 +751,18 @@ var init_ChatLayout = __esm({
|
|
|
388
751
|
const content = parts.slice(1).join("|");
|
|
389
752
|
const bgColor = isRemoval ? "#3a0c0c" : isAddition ? "#0c3a1a" : "#1a1a1a";
|
|
390
753
|
const textColor = isRemoval ? "#ff4d4d" : isAddition ? "#4dff88" : "white";
|
|
391
|
-
return /* @__PURE__ */
|
|
754
|
+
return /* @__PURE__ */ React3.createElement(Box3, { backgroundColor: bgColor, paddingX: 1, width: "100%" }, /* @__PURE__ */ React3.createElement(Box3, { width: 5, flexShrink: 0 }, /* @__PURE__ */ React3.createElement(Text3, { color: isRemoval ? "#cf3a3a" : isAddition ? "#3acf65" : "gray", dimColor: true }, lineNum)), /* @__PURE__ */ React3.createElement(Box3, { width: 2, flexShrink: 0, marginLeft: 1 }, /* @__PURE__ */ React3.createElement(Text3, { color: textColor, bold: true }, isRemoval ? "-" : isAddition ? "+" : " ")), /* @__PURE__ */ React3.createElement(Box3, { flexGrow: 1, marginLeft: 1 }, /* @__PURE__ */ React3.createElement(Text3, { color: textColor }, wrapText(content, columns - 10))));
|
|
392
755
|
});
|
|
393
|
-
DiffBlock =
|
|
756
|
+
DiffBlock = React3.memo(({ text, columns = 80 }) => {
|
|
394
757
|
const match = text.match(/\[DIFF_START\]([\s\S]*?)\[DIFF_END\]/);
|
|
395
758
|
const diffBody = match ? match[1].trim() : "";
|
|
396
759
|
const diffLines = diffBody.split("\n");
|
|
397
|
-
return /* @__PURE__ */
|
|
760
|
+
return /* @__PURE__ */ React3.createElement(Box3, { flexDirection: "column", width: "100%", marginBottom: 0 }, /* @__PURE__ */ React3.createElement(Box3, { flexDirection: "column", backgroundColor: "#1a1a1a", paddingY: 0, width: "100%" }, diffLines.map((line, i) => /* @__PURE__ */ React3.createElement(DiffLine, { key: i, line, columns }))));
|
|
398
761
|
});
|
|
399
|
-
CodeRenderer =
|
|
762
|
+
CodeRenderer = React3.memo(({ text, columns = 80 }) => {
|
|
400
763
|
if (!text) return null;
|
|
401
764
|
if (text.includes("[DIFF_START]")) {
|
|
402
|
-
return /* @__PURE__ */
|
|
765
|
+
return /* @__PURE__ */ React3.createElement(DiffBlock, { text, columns });
|
|
403
766
|
}
|
|
404
767
|
if (text.includes("- Content Preview:")) {
|
|
405
768
|
const mainParts = text.split("- Content Preview:");
|
|
@@ -411,18 +774,18 @@ var init_ChatLayout = __esm({
|
|
|
411
774
|
const footer = contentAndFooter[1] ? `${footerMarker}${contentAndFooter[1]}` : "";
|
|
412
775
|
const codeLines = content.split("\n");
|
|
413
776
|
const gutterWidth = String(codeLines.length).length;
|
|
414
|
-
return /* @__PURE__ */
|
|
777
|
+
return /* @__PURE__ */ React3.createElement(Box3, { flexDirection: "column", width: "100%" }, /* @__PURE__ */ React3.createElement(Box3, { flexDirection: "column", borderStyle: "round", borderColor: "#444", paddingX: 1, width: "100%" }, /* @__PURE__ */ React3.createElement(Box3, { alignSelf: "flex-end", marginTop: -1, marginRight: 1 }, /* @__PURE__ */ React3.createElement(Text3, { backgroundColor: "#444", color: "white" }, " FILE SNAPSHOT ")), /* @__PURE__ */ React3.createElement(Box3, { flexDirection: "column", paddingY: 1, width: "100%" }, codeLines.map((line, idx) => /* @__PURE__ */ React3.createElement(Box3, { key: idx, width: "100%" }, /* @__PURE__ */ React3.createElement(Box3, { width: gutterWidth + 2, flexShrink: 0 }, /* @__PURE__ */ React3.createElement(Text3, { color: "gray", dimColor: true }, String(idx + 1).padStart(gutterWidth, " "), " ")), /* @__PURE__ */ React3.createElement(Box3, { flexGrow: 1 }, /* @__PURE__ */ React3.createElement(Text3, { color: "white" }, line)))))));
|
|
415
778
|
}
|
|
416
779
|
if (text.includes("```")) {
|
|
417
780
|
const parts = text.split(/(```\w*\n?[\s\S]*?(?:```|$))/g);
|
|
418
|
-
return /* @__PURE__ */
|
|
781
|
+
return /* @__PURE__ */ React3.createElement(Box3, { flexDirection: "column", width: "100%" }, parts.map((part, i) => {
|
|
419
782
|
if (part.startsWith("```")) {
|
|
420
783
|
const match = part.match(/```(\w*)\n?([\s\S]*?)(?:```|$)/);
|
|
421
784
|
const lang = match ? match[1] : "code";
|
|
422
785
|
const code = match ? match[2] : part.replace(/^```\w*\n?/, "").replace(/```$/, "");
|
|
423
786
|
const codeLines = code.trimEnd().split("\n");
|
|
424
787
|
const gutterWidth = String(codeLines.length).length;
|
|
425
|
-
return /* @__PURE__ */
|
|
788
|
+
return /* @__PURE__ */ React3.createElement(Box3, { key: i, flexDirection: "column", marginY: 0, backgroundColor: "#111", borderStyle: "round", borderColor: "#333", paddingX: 1, width: "100%" }, /* @__PURE__ */ React3.createElement(Box3, { alignSelf: "flex-end", marginTop: -1, marginRight: 1 }, /* @__PURE__ */ React3.createElement(Text3, { backgroundColor: "#333", color: "white" }, " ", lang.toUpperCase(), " ")), /* @__PURE__ */ React3.createElement(Box3, { flexDirection: "column", paddingY: 1, width: "100%" }, codeLines.map((line, idx) => /* @__PURE__ */ React3.createElement(Box3, { key: idx, width: "100%" }, /* @__PURE__ */ React3.createElement(Box3, { width: gutterWidth + 2, flexShrink: 0 }, /* @__PURE__ */ React3.createElement(Text3, { color: "gray", dimColor: true }, String(idx + 1).padStart(gutterWidth, " "), " ")), /* @__PURE__ */ React3.createElement(Box3, { flexGrow: 1 }, /* @__PURE__ */ React3.createElement(Text3, { color: "cyan" }, line))))));
|
|
426
789
|
}
|
|
427
790
|
let cleanPart = part;
|
|
428
791
|
if (i > 0) {
|
|
@@ -432,10 +795,10 @@ var init_ChatLayout = __esm({
|
|
|
432
795
|
cleanPart = cleanPart.replace(/[\r\n]+$/, "");
|
|
433
796
|
}
|
|
434
797
|
if (!cleanPart) return null;
|
|
435
|
-
return /* @__PURE__ */
|
|
798
|
+
return /* @__PURE__ */ React3.createElement(MarkdownText, { key: i, text: cleanPart, columns });
|
|
436
799
|
}));
|
|
437
800
|
}
|
|
438
|
-
return /* @__PURE__ */
|
|
801
|
+
return /* @__PURE__ */ React3.createElement(MarkdownText, { text, columns });
|
|
439
802
|
});
|
|
440
803
|
formatThinkingDuration = (ms) => {
|
|
441
804
|
const totalSecs = Math.round(ms / 1e3);
|
|
@@ -447,44 +810,44 @@ var init_ChatLayout = __esm({
|
|
|
447
810
|
}
|
|
448
811
|
return `${totalSecs}s`;
|
|
449
812
|
};
|
|
450
|
-
MessageItem =
|
|
813
|
+
MessageItem = React3.memo(({ msg, showFullThinking, columns = 80 }) => {
|
|
451
814
|
const isDiffResult = msg.role === "system" && (msg.text?.includes("[DIFF_START]") || msg.text?.includes("- Content Preview:"));
|
|
452
815
|
const isPatchError = msg.role === "system" && msg.text?.includes("[TOOL RESULT]: ERROR:") && (msg.toolName === "update_file" || msg.text?.includes("Could not find exact match"));
|
|
453
816
|
const isTerminalRecord = msg.isTerminalRecord;
|
|
454
817
|
const isHomeWarning = msg.isHomeWarning;
|
|
455
818
|
if (isHomeWarning) {
|
|
456
|
-
return /* @__PURE__ */
|
|
819
|
+
return /* @__PURE__ */ React3.createElement(Box3, { marginBottom: 1, paddingX: 1, width: "100%" }, /* @__PURE__ */ React3.createElement(Box3, { flexDirection: "column", borderStyle: "round", borderColor: "red", padding: 0, width: "100%" }, /* @__PURE__ */ React3.createElement(Box3, { paddingX: 1, backgroundColor: "#3a0000" }, /* @__PURE__ */ React3.createElement(Text3, { color: "red", bold: true }, msg.text)), /* @__PURE__ */ React3.createElement(Box3, { paddingX: 1, marginTop: 1, marginBottom: 1 }, /* @__PURE__ */ React3.createElement(Text3, { color: "white" }, msg.subText))));
|
|
457
820
|
}
|
|
458
821
|
if (msg.isLogo) {
|
|
459
|
-
return /* @__PURE__ */
|
|
822
|
+
return /* @__PURE__ */ React3.createElement(Box3, { flexDirection: "column", alignItems: "center", width: "100%", marginY: 1 }, /* @__PURE__ */ React3.createElement(Text3, null, msg.text));
|
|
460
823
|
}
|
|
461
824
|
if (msg.id && String(msg.id).startsWith("welcome")) {
|
|
462
|
-
return /* @__PURE__ */
|
|
825
|
+
return /* @__PURE__ */ React3.createElement(Box3, { flexDirection: "column", alignItems: "center", width: "100%", marginY: 1 }, /* @__PURE__ */ React3.createElement(Box3, { borderStyle: "round", borderColor: "gray", paddingX: 3, paddingY: 0 }, /* @__PURE__ */ React3.createElement(Text3, { color: "cyan", bold: true }, msg.text.trim())));
|
|
463
826
|
}
|
|
464
827
|
if (msg.isVisualFeedback) {
|
|
465
828
|
return (
|
|
466
829
|
// [SPACE POINT]
|
|
467
|
-
/* @__PURE__ */
|
|
830
|
+
/* @__PURE__ */ React3.createElement(Box3, { marginBottom: 0, marginTop: 0, paddingX: 1, width: "100%" }, /* @__PURE__ */ React3.createElement(Text3, { color: "white" }, msg.text))
|
|
468
831
|
);
|
|
469
832
|
}
|
|
470
833
|
if (isPatchError) {
|
|
471
|
-
return /* @__PURE__ */
|
|
834
|
+
return /* @__PURE__ */ React3.createElement(Box3, { marginBottom: 1 }, /* @__PURE__ */ React3.createElement(Box3, { flexDirection: "column", borderStyle: "round", borderColor: "red", paddingX: 1, paddingY: 0 }, /* @__PURE__ */ React3.createElement(Text3, { color: "red", bold: true, underline: true }, "\u274C PATCH FAILED"), /* @__PURE__ */ React3.createElement(Box3, { marginTop: 1 }, /* @__PURE__ */ React3.createElement(Text3, { color: "red" }, "Patch failed: ", /* @__PURE__ */ React3.createElement(Text3, { color: "white", bold: true }, "Model generated malformed edit.")))));
|
|
472
835
|
}
|
|
473
836
|
if (msg.role === "system" && msg.text?.includes("[TOOL RESULT]") && !isDiffResult && !isTerminalRecord && !isPatchError) return null;
|
|
474
837
|
if (msg.isImageStats) {
|
|
475
|
-
return /* @__PURE__ */
|
|
838
|
+
return /* @__PURE__ */ React3.createElement(Box3, { marginBottom: 1, paddingX: 1, width: "100%" }, /* @__PURE__ */ React3.createElement(Box3, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", padding: 0, width: "100%" }, /* @__PURE__ */ React3.createElement(Box3, { paddingX: 1, backgroundColor: "#0e1b21" }, /* @__PURE__ */ React3.createElement(Text3, { color: "cyan", bold: true }, "\u{1F4B3} IMAGE STATS")), /* @__PURE__ */ React3.createElement(Box3, { paddingX: 1, marginTop: 1, marginBottom: 1, flexDirection: "column" }, msg.text.split("\n").map((line, i) => /* @__PURE__ */ React3.createElement(Text3, { key: i, color: "white" }, line)))));
|
|
476
839
|
}
|
|
477
840
|
if (msg.isAskRecord) {
|
|
478
841
|
const selectionMatch = msg.text.match(/Selection: (.*)/);
|
|
479
842
|
const selection = selectionMatch ? selectionMatch[1] : "No selection";
|
|
480
843
|
const s = emojiSpace(2);
|
|
481
|
-
return /* @__PURE__ */
|
|
844
|
+
return /* @__PURE__ */ React3.createElement(Box3, { marginBottom: 1, paddingX: 1, width: "100%" }, /* @__PURE__ */ React3.createElement(Box3, { flexDirection: "column", borderStyle: "round", borderColor: "gray", padding: 0, width: "100%" }, /* @__PURE__ */ React3.createElement(Box3, { paddingX: 1 }, /* @__PURE__ */ React3.createElement(Text3, { color: "cyan", bold: true }, "\u{1F4AC} AGENT REQUEST: RESOLVED")), /* @__PURE__ */ React3.createElement(Box3, { paddingX: 1, marginTop: 1, marginBottom: 1 }, /* @__PURE__ */ React3.createElement(Text3, { color: "white" }, "Selection: ", /* @__PURE__ */ React3.createElement(Text3, { color: "yellow", bold: true }, selection)))));
|
|
482
845
|
}
|
|
483
846
|
if (msg.isAboutRecord) {
|
|
484
|
-
return /* @__PURE__ */
|
|
847
|
+
return /* @__PURE__ */ React3.createElement(Box3, { marginBottom: 1, paddingX: 1, width: "100%" }, /* @__PURE__ */ React3.createElement(Box3, { flexDirection: "column", borderStyle: "round", borderColor: "gray", padding: 0, width: "100%" }, /* @__PURE__ */ React3.createElement(Box3, { paddingX: 1 }, /* @__PURE__ */ React3.createElement(Text3, { color: "cyan", bold: true }, "\u{1F4A0} ABOUT FLUX FLOW")), /* @__PURE__ */ React3.createElement(Box3, { paddingX: 1, marginTop: 1, marginBottom: 1 }, /* @__PURE__ */ React3.createElement(Text3, null, msg.text))));
|
|
485
848
|
}
|
|
486
849
|
if (msg.isUpdateNotification) {
|
|
487
|
-
return /* @__PURE__ */
|
|
850
|
+
return /* @__PURE__ */ React3.createElement(Box3, { marginBottom: 1, paddingX: 1, width: "100%" }, /* @__PURE__ */ React3.createElement(Box3, { flexDirection: "column", borderStyle: "round", borderColor: "gray", padding: 0, width: "100%" }, /* @__PURE__ */ React3.createElement(Box3, { paddingX: 1 }, /* @__PURE__ */ React3.createElement(Text3, { color: "cyan", bold: true }, "\u{1F680} FLUX FLOW UPDATE AVAILABLE")), /* @__PURE__ */ React3.createElement(Box3, { paddingX: 1, marginTop: 1, marginBottom: 1 }, /* @__PURE__ */ React3.createElement(CodeRenderer, { text: msg.text, columns }))));
|
|
488
851
|
}
|
|
489
852
|
if (msg.isHelpRecord) {
|
|
490
853
|
const commandList = [
|
|
@@ -511,21 +874,21 @@ var init_ChatLayout = __esm({
|
|
|
511
874
|
{ cmd: "/fluxflow", desc: "Project management" },
|
|
512
875
|
{ cmd: "/update", desc: "Check/Install updates" }
|
|
513
876
|
];
|
|
514
|
-
return /* @__PURE__ */
|
|
877
|
+
return /* @__PURE__ */ React3.createElement(Box3, { marginBottom: 1, paddingX: 1, width: "100%" }, /* @__PURE__ */ React3.createElement(Box3, { flexDirection: "column", borderStyle: "round", borderColor: "magenta", paddingX: 2, paddingY: 1, width: "100%" }, /* @__PURE__ */ React3.createElement(Text3, { color: "magenta", bold: true, underline: true }, "\u{1F4DC} COMMAND REFERENCE"), /* @__PURE__ */ React3.createElement(Box3, { flexDirection: "column", marginTop: 1 }, commandList.map((c, i) => /* @__PURE__ */ React3.createElement(Box3, { key: i, flexDirection: "row" }, /* @__PURE__ */ React3.createElement(Box3, { width: 15 }, /* @__PURE__ */ React3.createElement(Text3, { color: "cyan", bold: true }, c.cmd)), /* @__PURE__ */ React3.createElement(Text3, { color: "gray" }, " - ", c.desc))))));
|
|
515
878
|
}
|
|
516
879
|
if (isTerminalRecord) {
|
|
517
880
|
const cmdMatch = msg.text.match(/COMMAND: (.*)\n/);
|
|
518
881
|
const outputMatch = msg.text.match(/OUTPUT: ([\s\S]*)$/);
|
|
519
882
|
const cmd = cmdMatch ? cmdMatch[1] : "Unknown";
|
|
520
883
|
const outputList = outputMatch ? outputMatch[1] : "";
|
|
521
|
-
return /* @__PURE__ */
|
|
884
|
+
return /* @__PURE__ */ React3.createElement(Box3, { marginBottom: 1, paddingX: 1, width: "100%" }, /* @__PURE__ */ React3.createElement(TerminalBox, { command: cmd, output: outputList, completed: true, columns }));
|
|
522
885
|
}
|
|
523
|
-
const [animationDone, setAnimationDone] =
|
|
524
|
-
const content =
|
|
525
|
-
|
|
886
|
+
const [animationDone, setAnimationDone] = React3.useState(!msg.isStreaming);
|
|
887
|
+
const content = React3.useMemo(() => cleanSignals(msg.text), [msg.text]);
|
|
888
|
+
React3.useEffect(() => {
|
|
526
889
|
if (msg.isStreaming) setAnimationDone(false);
|
|
527
890
|
}, [msg.id]);
|
|
528
|
-
const finalContent =
|
|
891
|
+
const finalContent = React3.useMemo(() => {
|
|
529
892
|
if (msg.role === "think" && !showFullThinking) {
|
|
530
893
|
return "Thinking...";
|
|
531
894
|
}
|
|
@@ -533,8 +896,8 @@ var init_ChatLayout = __esm({
|
|
|
533
896
|
}, [content, msg.role, showFullThinking, msg.isStreaming]);
|
|
534
897
|
return (
|
|
535
898
|
// [SPACE POINT]
|
|
536
|
-
/* @__PURE__ */
|
|
537
|
-
|
|
899
|
+
/* @__PURE__ */ React3.createElement(Box3, { marginBottom: msg.role === "think" ? 0 : msg.role === "user" ? 1 : msg.role === "agent" ? 0 : 1, marginTop: msg.role === "think" ? 0 : msg.role === "user" ? 0 : msg.role === "agent" ? 0 : 0, flexDirection: "column", flexShrink: 0, width: "100%", flexGrow: 1 }, msg.role === "user" ? /* @__PURE__ */ React3.createElement(
|
|
900
|
+
Box3,
|
|
538
901
|
{
|
|
539
902
|
backgroundColor: "#262626",
|
|
540
903
|
paddingX: 1,
|
|
@@ -545,12 +908,12 @@ var init_ChatLayout = __esm({
|
|
|
545
908
|
wrapText(
|
|
546
909
|
finalContent.replace(/\r\n/g, "\n").replace(/\r/g, "\n").replace(/\\\n/g, "\n").replace(/\\$/, ""),
|
|
547
910
|
columns - 6
|
|
548
|
-
).split("\n").map((line, lineIdx) => /* @__PURE__ */
|
|
549
|
-
) : msg.role === "think" ? /* @__PURE__ */
|
|
911
|
+
).split("\n").map((line, lineIdx) => /* @__PURE__ */ React3.createElement(Box3, { key: lineIdx, flexDirection: "row", width: "100%" }, /* @__PURE__ */ React3.createElement(Box3, { flexShrink: 0, width: 2 }, /* @__PURE__ */ React3.createElement(Text3, { bold: true, color: "white" }, lineIdx === 0 ? "\u276F" : " ")), /* @__PURE__ */ React3.createElement(Box3, { flexGrow: 1, marginLeft: 1 }, /* @__PURE__ */ React3.createElement(InlineMarkdown, { text: line, color: msg.color || "white" }))))
|
|
912
|
+
) : msg.role === "think" ? /* @__PURE__ */ React3.createElement(Box3, { flexDirection: "column", marginTop: 0, marginBottom: 0, paddingX: 1, width: "100%" }, msg.isStreaming && !msg.duration ? /* @__PURE__ */ React3.createElement(Text3, { bold: true, color: "white" }, "\u2727 Thinking...") : /* @__PURE__ */ React3.createElement(Text3, { bold: true, color: "white" }, "\u2726 Thought", msg.duration ? /* @__PURE__ */ React3.createElement(Text3, { color: "gray" }, " for ", /* @__PURE__ */ React3.createElement(Text3, { bold: true, color: "cyan" }, formatThinkingDuration(msg.duration))) : ""), /* @__PURE__ */ React3.createElement(Box3, { borderStyle: "single", borderLeft: true, borderRight: false, borderTop: false, borderBottom: false, paddingLeft: 2, paddingTop: 1, paddingBottom: 1, flexDirection: "column", width: "100%" }, formatThinkText(finalContent, columns))) : /* @__PURE__ */ React3.createElement(Box3, { flexDirection: "column", paddingX: 1, marginTop: 0, width: "100%" }, /* @__PURE__ */ React3.createElement(CodeRenderer, { text: finalContent.replace(/ \|\n\n/g, " |\n"), columns }), msg.memoryUpdated && /* @__PURE__ */ React3.createElement(Box3, { marginTop: 1, width: "100%" }, /* @__PURE__ */ React3.createElement(Text3, { color: "yellow", italic: true }, "\u2728 [Memory Updated]")), msg.role === "agent" && msg.workedDuration ? /* @__PURE__ */ React3.createElement(Box3, { marginTop: 1, marginBottom: 2, width: "100%" }, /* @__PURE__ */ React3.createElement(Text3, null, "["), /* @__PURE__ */ React3.createElement(Text3, { color: "gray" }, "\u26A1 Worked for ", /* @__PURE__ */ React3.createElement(Text3, { bold: true, color: "cyan" }, formatThinkingDuration(msg.workedDuration))), /* @__PURE__ */ React3.createElement(Text3, null, "]")) : null))
|
|
550
913
|
);
|
|
551
914
|
});
|
|
552
|
-
ChatLayout =
|
|
553
|
-
return /* @__PURE__ */
|
|
915
|
+
ChatLayout = React3.memo(({ messages, showFullThinking, columns = 80 }) => {
|
|
916
|
+
return /* @__PURE__ */ React3.createElement(Box3, { flexDirection: "column", width: "100%" }, messages.map((msg, idx) => /* @__PURE__ */ React3.createElement(
|
|
554
917
|
MessageItem,
|
|
555
918
|
{
|
|
556
919
|
key: msg.id || idx,
|
|
@@ -565,17 +928,17 @@ var init_ChatLayout = __esm({
|
|
|
565
928
|
});
|
|
566
929
|
|
|
567
930
|
// src/components/StatusBar.jsx
|
|
568
|
-
import
|
|
569
|
-
import { Box as
|
|
931
|
+
import React4 from "react";
|
|
932
|
+
import { Box as Box4, Text as Text4 } from "ink";
|
|
570
933
|
var StatusBar, StatusBar_default;
|
|
571
934
|
var init_StatusBar = __esm({
|
|
572
935
|
"src/components/StatusBar.jsx"() {
|
|
573
936
|
init_text();
|
|
574
|
-
StatusBar =
|
|
937
|
+
StatusBar = React4.memo(({ mode, thinkingLevel, tokens = "0.0k", tokensTotal = "0.0k", chatId = "NEW-SESSION", isMemoryEnabled = true }) => {
|
|
575
938
|
const modeColor = mode === "Flux" ? "yellow" : "cyan";
|
|
576
939
|
const modeIcon = mode === "Flux" ? "\u26A1" : "\u{1F30A}";
|
|
577
|
-
return /* @__PURE__ */
|
|
578
|
-
|
|
940
|
+
return /* @__PURE__ */ React4.createElement(
|
|
941
|
+
Box4,
|
|
579
942
|
{
|
|
580
943
|
borderStyle: "round",
|
|
581
944
|
borderColor: "gray",
|
|
@@ -584,9 +947,9 @@ var init_StatusBar = __esm({
|
|
|
584
947
|
paddingX: 1,
|
|
585
948
|
width: "100%"
|
|
586
949
|
},
|
|
587
|
-
/* @__PURE__ */
|
|
588
|
-
/* @__PURE__ */
|
|
589
|
-
/* @__PURE__ */
|
|
950
|
+
/* @__PURE__ */ React4.createElement(Box4, null, /* @__PURE__ */ React4.createElement(Box4, { marginRight: 1 }, /* @__PURE__ */ React4.createElement(Text4, { color: modeColor, bold: true }, modeIcon, " ", mode.toUpperCase())), /* @__PURE__ */ React4.createElement(Text4, { color: "gray", dimColor: true }, "\u2503 "), /* @__PURE__ */ React4.createElement(Box4, { marginX: 1 }, /* @__PURE__ */ React4.createElement(Text4, { color: "magenta" }, "\u{1F9E0} ", thinkingLevel)), /* @__PURE__ */ React4.createElement(Text4, { color: "gray", dimColor: true }, "\u2503 "), /* @__PURE__ */ React4.createElement(Box4, { marginX: 1 }, /* @__PURE__ */ React4.createElement(Text4, { color: "gray" }, "MEM: "), /* @__PURE__ */ React4.createElement(Text4, { color: isMemoryEnabled ? "green" : "red", bold: true }, isMemoryEnabled ? "ON" : "OFF"))),
|
|
951
|
+
/* @__PURE__ */ React4.createElement(Box4, { flexGrow: 1, justifyContent: "center", paddingX: 2 }, /* @__PURE__ */ React4.createElement(Text4, null, "\u{1F4C1}"), /* @__PURE__ */ React4.createElement(Text4, { color: "gray", italic: true }, " ", truncatePath(process.cwd(), 35))),
|
|
952
|
+
/* @__PURE__ */ React4.createElement(Box4, null, /* @__PURE__ */ React4.createElement(Text4, { color: "gray", dimColor: true }, "\u2503 "), /* @__PURE__ */ React4.createElement(Box4, { marginX: 1 }, /* @__PURE__ */ React4.createElement(Text4, null, "\u2728"), /* @__PURE__ */ React4.createElement(Text4, { color: "blue" }, " ", formatTokens(tokensTotal), " ", /* @__PURE__ */ React4.createElement(Text4, { dimColor: true }, "(", (tokens / 254e3 * 100).toFixed(0), "%)"))), /* @__PURE__ */ React4.createElement(Text4, { color: "gray", dimColor: true }, "\u2503 "), /* @__PURE__ */ React4.createElement(Box4, { marginLeft: 1 }, /* @__PURE__ */ React4.createElement(Text4, null, "\u{1F194}"), /* @__PURE__ */ React4.createElement(Text4, { color: "gray", dimColor: true, italic: true }, " ", chatId)))
|
|
590
953
|
);
|
|
591
954
|
});
|
|
592
955
|
StatusBar_default = StatusBar;
|
|
@@ -594,12 +957,12 @@ var init_StatusBar = __esm({
|
|
|
594
957
|
});
|
|
595
958
|
|
|
596
959
|
// src/components/CommandMenu.jsx
|
|
597
|
-
import
|
|
598
|
-
import { Box as
|
|
960
|
+
import React5 from "react";
|
|
961
|
+
import { Box as Box5, Text as Text5 } from "ink";
|
|
599
962
|
import SelectInput from "ink-select-input";
|
|
600
963
|
function CommandMenu({ title, subtitle, items, onSelect }) {
|
|
601
|
-
return /* @__PURE__ */
|
|
602
|
-
|
|
964
|
+
return /* @__PURE__ */ React5.createElement(
|
|
965
|
+
Box5,
|
|
603
966
|
{
|
|
604
967
|
flexDirection: "column",
|
|
605
968
|
borderStyle: "round",
|
|
@@ -609,9 +972,9 @@ function CommandMenu({ title, subtitle, items, onSelect }) {
|
|
|
609
972
|
flexShrink: 0,
|
|
610
973
|
width: "100%"
|
|
611
974
|
},
|
|
612
|
-
/* @__PURE__ */
|
|
613
|
-
subtitle && /* @__PURE__ */
|
|
614
|
-
/* @__PURE__ */
|
|
975
|
+
/* @__PURE__ */ React5.createElement(Box5, { paddingX: 1, paddingY: 0, marginBottom: subtitle ? 0 : 1 }, /* @__PURE__ */ React5.createElement(Text5, { color: "magenta", bold: true }, "\u{1F527} ", title.toUpperCase())),
|
|
976
|
+
subtitle && /* @__PURE__ */ React5.createElement(Box5, { paddingX: 1, marginBottom: 1 }, /* @__PURE__ */ React5.createElement(Text5, { color: "yellow", dimColor: true, italic: true }, " ", subtitle)),
|
|
977
|
+
/* @__PURE__ */ React5.createElement(Box5, { flexDirection: "column", width: "100%" }, /* @__PURE__ */ React5.createElement(
|
|
615
978
|
SelectInput,
|
|
616
979
|
{
|
|
617
980
|
items,
|
|
@@ -620,7 +983,7 @@ function CommandMenu({ title, subtitle, items, onSelect }) {
|
|
|
620
983
|
indicatorComponent: () => null
|
|
621
984
|
}
|
|
622
985
|
)),
|
|
623
|
-
/* @__PURE__ */
|
|
986
|
+
/* @__PURE__ */ React5.createElement(Box5, { paddingX: 1, marginTop: 1 }, /* @__PURE__ */ React5.createElement(Text5, { color: "gray", dimColor: true, italic: true }, "(Arrows to select \u2022 Enter to confirm)"))
|
|
624
987
|
);
|
|
625
988
|
}
|
|
626
989
|
var CustomItem;
|
|
@@ -628,23 +991,23 @@ var init_CommandMenu = __esm({
|
|
|
628
991
|
"src/components/CommandMenu.jsx"() {
|
|
629
992
|
CustomItem = ({ label, isSelected }) => {
|
|
630
993
|
const isCancel = label === "Cancel" || label === "Back" || label.toLowerCase().includes("exit") || label.toLowerCase().includes("back");
|
|
631
|
-
return /* @__PURE__ */
|
|
632
|
-
|
|
994
|
+
return /* @__PURE__ */ React5.createElement(
|
|
995
|
+
Box5,
|
|
633
996
|
{
|
|
634
997
|
marginTop: isCancel ? 1 : 0,
|
|
635
998
|
backgroundColor: isSelected ? "#2a2a2a" : void 0,
|
|
636
999
|
paddingX: 1,
|
|
637
1000
|
width: "100%"
|
|
638
1001
|
},
|
|
639
|
-
/* @__PURE__ */
|
|
1002
|
+
/* @__PURE__ */ React5.createElement(Text5, { color: isSelected ? "cyan" : "white", bold: isSelected }, isSelected ? "\u276F " : " ", label)
|
|
640
1003
|
);
|
|
641
1004
|
};
|
|
642
1005
|
}
|
|
643
1006
|
});
|
|
644
1007
|
|
|
645
1008
|
// src/components/SettingsMenu.jsx
|
|
646
|
-
import
|
|
647
|
-
import { Box as
|
|
1009
|
+
import React6, { useState as useState3 } from "react";
|
|
1010
|
+
import { Box as Box6, Text as Text6, useInput as useInput2 } from "ink";
|
|
648
1011
|
import TextInput from "ink-text-input";
|
|
649
1012
|
function SettingsMenu({
|
|
650
1013
|
systemSettings,
|
|
@@ -656,11 +1019,11 @@ function SettingsMenu({
|
|
|
656
1019
|
quotas,
|
|
657
1020
|
setMessages
|
|
658
1021
|
}) {
|
|
659
|
-
const [activeColumn, setActiveColumn] =
|
|
660
|
-
const [selectedCategoryIndex, setSelectedCategoryIndex] =
|
|
661
|
-
const [selectedItemIndex, setSelectedItemIndex] =
|
|
662
|
-
const [editingItem, setEditingItem] =
|
|
663
|
-
const [editValue, setEditValue] =
|
|
1022
|
+
const [activeColumn, setActiveColumn] = useState3("categories");
|
|
1023
|
+
const [selectedCategoryIndex, setSelectedCategoryIndex] = useState3(0);
|
|
1024
|
+
const [selectedItemIndex, setSelectedItemIndex] = useState3(0);
|
|
1025
|
+
const [editingItem, setEditingItem] = useState3(null);
|
|
1026
|
+
const [editValue, setEditValue] = useState3("");
|
|
664
1027
|
const getCategoryItems = (catId) => {
|
|
665
1028
|
switch (catId) {
|
|
666
1029
|
case "memory":
|
|
@@ -696,7 +1059,7 @@ function SettingsMenu({
|
|
|
696
1059
|
};
|
|
697
1060
|
const currentCatId = CATEGORIES[selectedCategoryIndex].id;
|
|
698
1061
|
const currentItems = getCategoryItems(currentCatId);
|
|
699
|
-
|
|
1062
|
+
useInput2((input, key) => {
|
|
700
1063
|
if (editingItem) {
|
|
701
1064
|
if (key.escape) {
|
|
702
1065
|
setEditingItem(null);
|
|
@@ -832,19 +1195,19 @@ function SettingsMenu({
|
|
|
832
1195
|
setActiveView("updateManager");
|
|
833
1196
|
}
|
|
834
1197
|
};
|
|
835
|
-
return /* @__PURE__ */
|
|
1198
|
+
return /* @__PURE__ */ React6.createElement(Box6, { flexDirection: "column", borderStyle: "round", borderColor: "gray", padding: 0, width: "100%" }, /* @__PURE__ */ React6.createElement(Box6, { paddingX: 1, paddingY: 0, marginBottom: 1, borderStyle: "single", borderColor: "magenta", width: "100%" }, /* @__PURE__ */ React6.createElement(Text6, { color: "magenta", bold: true }, "\u{1F527} SYSTEM CONFIGURATION")), /* @__PURE__ */ React6.createElement(Box6, { flexDirection: "row", width: "100%", minHeight: 8 }, /* @__PURE__ */ React6.createElement(Box6, { flexDirection: "column", width: "30%", borderStyle: "round", borderColor: activeColumn === "categories" ? "cyan" : "gray", padding: 1 }, /* @__PURE__ */ React6.createElement(Box6, { marginBottom: 1 }, /* @__PURE__ */ React6.createElement(Text6, { color: activeColumn === "categories" ? "cyan" : "white", bold: true, underline: true }, "CATEGORIES")), CATEGORIES.map((cat, index) => {
|
|
836
1199
|
const isSelected = selectedCategoryIndex === index;
|
|
837
1200
|
const isExit = cat.id === "exit";
|
|
838
|
-
return /* @__PURE__ */
|
|
839
|
-
|
|
1201
|
+
return /* @__PURE__ */ React6.createElement(
|
|
1202
|
+
Box6,
|
|
840
1203
|
{
|
|
841
1204
|
key: cat.id,
|
|
842
1205
|
marginTop: isExit ? 1 : 0,
|
|
843
1206
|
backgroundColor: isSelected ? activeColumn === "categories" ? "#2a2a2a" : "#1e1e1e" : void 0,
|
|
844
1207
|
paddingX: 1
|
|
845
1208
|
},
|
|
846
|
-
/* @__PURE__ */
|
|
847
|
-
|
|
1209
|
+
/* @__PURE__ */ React6.createElement(
|
|
1210
|
+
Text6,
|
|
848
1211
|
{
|
|
849
1212
|
color: isSelected ? activeColumn === "categories" ? "cyan" : "yellow" : "white",
|
|
850
1213
|
bold: isSelected
|
|
@@ -853,7 +1216,7 @@ function SettingsMenu({
|
|
|
853
1216
|
cat.label
|
|
854
1217
|
)
|
|
855
1218
|
);
|
|
856
|
-
})), /* @__PURE__ */
|
|
1219
|
+
})), /* @__PURE__ */ React6.createElement(Box6, { flexDirection: "column", width: "70%", borderStyle: "round", borderColor: activeColumn === "items" ? "cyan" : "gray", padding: 1, marginLeft: 1 }, /* @__PURE__ */ React6.createElement(Box6, { marginBottom: 1 }, /* @__PURE__ */ React6.createElement(Text6, { color: activeColumn === "items" ? "cyan" : "white", bold: true, underline: true }, CATEGORIES[selectedCategoryIndex].label.toUpperCase(), " SETTINGS")), currentItems.length > 0 ? (() => {
|
|
857
1220
|
let lastSection = null;
|
|
858
1221
|
const elements = [];
|
|
859
1222
|
const getListItems = (val) => (val || "").split(",").map((s) => s.trim().toLowerCase()).filter(Boolean);
|
|
@@ -880,21 +1243,21 @@ function SettingsMenu({
|
|
|
880
1243
|
if (item.section && item.section !== lastSection) {
|
|
881
1244
|
lastSection = item.section;
|
|
882
1245
|
elements.push(
|
|
883
|
-
/* @__PURE__ */
|
|
1246
|
+
/* @__PURE__ */ React6.createElement(Box6, { key: `sec-hdr-${item.section}`, marginTop: elements.length > 0 ? 1 : 0, marginBottom: 0, paddingX: 1 }, /* @__PURE__ */ React6.createElement(Text6, { color: "magenta", bold: true, underline: true }, "\u{1F4C2} ", item.section.toUpperCase()))
|
|
884
1247
|
);
|
|
885
1248
|
}
|
|
886
1249
|
const isEditingThis = isSelected && editingItem && (editingItem === "alwaysAskCommands" && item.value === "alwaysAsk" || editingItem === "autoApproveCommands" && item.value === "autoApprove" || editingItem === "autoDisallowCommands" && item.value === "autoDisallow");
|
|
887
1250
|
const isCommandListItem = item.value === "alwaysAsk" || item.value === "autoApprove" || item.value === "autoDisallow";
|
|
888
1251
|
elements.push(
|
|
889
|
-
/* @__PURE__ */
|
|
890
|
-
|
|
1252
|
+
/* @__PURE__ */ React6.createElement(Box6, { key: item.value, flexDirection: "column" }, /* @__PURE__ */ React6.createElement(Box6, { backgroundColor: isSelected && !isEditingThis ? "#2a2a2a" : void 0, paddingX: 2 }, /* @__PURE__ */ React6.createElement(
|
|
1253
|
+
Text6,
|
|
891
1254
|
{
|
|
892
1255
|
color: isSelected ? "cyan" : "white",
|
|
893
1256
|
bold: isSelected
|
|
894
1257
|
},
|
|
895
1258
|
isSelected ? "\u276F " : " ",
|
|
896
1259
|
item.label
|
|
897
|
-
), !isCommandListItem && /* @__PURE__ */
|
|
1260
|
+
), !isCommandListItem && /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(Text6, { color: "gray", dimColor: true }, dots), /* @__PURE__ */ React6.createElement(Text6, { color: getStatusColor(item), bold: true }, "[ ", item.status, " ]"))), isCommandListItem && !isEditingThis && item.status !== "None" && /* @__PURE__ */ React6.createElement(Box6, { paddingX: 4, marginBottom: 1 }, /* @__PURE__ */ React6.createElement(Text6, { color: "gray", dimColor: true }, "\u21B3 ", item.status)), isEditingThis && /* @__PURE__ */ React6.createElement(Box6, { flexDirection: "column", marginLeft: 4, marginBottom: 1 }, /* @__PURE__ */ React6.createElement(Box6, { paddingX: 1, borderStyle: "single", borderColor: "cyan", flexDirection: "row" }, /* @__PURE__ */ React6.createElement(Text6, { color: "cyan", bold: true }, "> ", " "), /* @__PURE__ */ React6.createElement(
|
|
898
1261
|
TextInput,
|
|
899
1262
|
{
|
|
900
1263
|
value: editValue,
|
|
@@ -906,16 +1269,16 @@ function SettingsMenu({
|
|
|
906
1269
|
setEditingItem(null);
|
|
907
1270
|
}
|
|
908
1271
|
}
|
|
909
|
-
)), /* @__PURE__ */
|
|
1272
|
+
)), /* @__PURE__ */ React6.createElement(Text6, { color: "gray", dimColor: true, italic: true }, " Comma separated \u2022 Press Enter to save, Esc to cancel")))
|
|
910
1273
|
);
|
|
911
1274
|
});
|
|
912
1275
|
if (hasConflict) {
|
|
913
1276
|
elements.push(
|
|
914
|
-
/* @__PURE__ */
|
|
1277
|
+
/* @__PURE__ */ React6.createElement(Box6, { key: "conflict-warning", marginTop: 1, paddingX: 1 }, /* @__PURE__ */ React6.createElement(Text6, { color: "red", dimColor: true, italic: true }, "* Conflicting commands will be ignored and defaulted to highest priority"))
|
|
915
1278
|
);
|
|
916
1279
|
}
|
|
917
1280
|
return elements;
|
|
918
|
-
})() : /* @__PURE__ */
|
|
1281
|
+
})() : /* @__PURE__ */ React6.createElement(Box6, { paddingX: 1 }, /* @__PURE__ */ React6.createElement(Text6, { color: "gray", italic: true }, CATEGORIES[selectedCategoryIndex].desc)))), /* @__PURE__ */ React6.createElement(Box6, { paddingX: 1, marginTop: 1, flexDirection: "row", justifyContent: "space-between" }, /* @__PURE__ */ React6.createElement(Text6, { color: "gray", dimColor: true, italic: true }, activeColumn === "categories" ? "\u25B2\u25BC Select Category \u2022 Enter/\u25BA to configure" : "\u25B2\u25BC Select Option \u2022 Enter to Toggle \u2022 \u25C4/ESC to go back"), activeColumn === "categories" && /* @__PURE__ */ React6.createElement(Text6, { color: "gray", dimColor: true }, CATEGORIES[selectedCategoryIndex].desc)));
|
|
919
1282
|
}
|
|
920
1283
|
var CATEGORIES, getActivePreset, truncateCSV;
|
|
921
1284
|
var init_SettingsMenu = __esm({
|
|
@@ -948,13 +1311,13 @@ var init_SettingsMenu = __esm({
|
|
|
948
1311
|
});
|
|
949
1312
|
|
|
950
1313
|
// src/components/ProfileForm.jsx
|
|
951
|
-
import
|
|
952
|
-
import { Box as
|
|
1314
|
+
import React7, { useState as useState4, useEffect as useEffect3 } from "react";
|
|
1315
|
+
import { Box as Box7, Text as Text7 } from "ink";
|
|
953
1316
|
import TextInput2 from "ink-text-input";
|
|
954
1317
|
function ProfileForm({ initialData, onSave, onCancel }) {
|
|
955
|
-
const [step, setStep] =
|
|
956
|
-
const [currentInput, setCurrentInput] =
|
|
957
|
-
const [profile, setProfile] =
|
|
1318
|
+
const [step, setStep] = useState4(0);
|
|
1319
|
+
const [currentInput, setCurrentInput] = useState4("");
|
|
1320
|
+
const [profile, setProfile] = useState4(() => ({
|
|
958
1321
|
name: initialData?.name || "",
|
|
959
1322
|
nickname: initialData?.nickname || "",
|
|
960
1323
|
instructions: initialData?.instructions || ""
|
|
@@ -964,7 +1327,7 @@ function ProfileForm({ initialData, onSave, onCancel }) {
|
|
|
964
1327
|
{ key: "nickname", label: "Enter a Nickname (Agent will use this): " },
|
|
965
1328
|
{ key: "instructions", label: "System Instructions (Persona overrides): " }
|
|
966
1329
|
];
|
|
967
|
-
|
|
1330
|
+
useEffect3(() => {
|
|
968
1331
|
const currentKey = steps[step].key;
|
|
969
1332
|
setCurrentInput(profile[currentKey] || "");
|
|
970
1333
|
}, [step, profile]);
|
|
@@ -983,8 +1346,8 @@ function ProfileForm({ initialData, onSave, onCancel }) {
|
|
|
983
1346
|
onSave(newProfile);
|
|
984
1347
|
}
|
|
985
1348
|
};
|
|
986
|
-
return /* @__PURE__ */
|
|
987
|
-
|
|
1349
|
+
return /* @__PURE__ */ React7.createElement(
|
|
1350
|
+
Box7,
|
|
988
1351
|
{
|
|
989
1352
|
borderStyle: "round",
|
|
990
1353
|
borderColor: "gray",
|
|
@@ -994,16 +1357,16 @@ function ProfileForm({ initialData, onSave, onCancel }) {
|
|
|
994
1357
|
flexDirection: "column",
|
|
995
1358
|
width: "100%"
|
|
996
1359
|
},
|
|
997
|
-
/* @__PURE__ */
|
|
998
|
-
/* @__PURE__ */
|
|
1360
|
+
/* @__PURE__ */ React7.createElement(Box7, { paddingX: 1, marginBottom: 1 }, /* @__PURE__ */ React7.createElement(Text7, { color: "magenta", bold: true }, "\u{1F464} DEVELOPER PROFILE CONFIGURATION")),
|
|
1361
|
+
/* @__PURE__ */ React7.createElement(Box7, { paddingX: 1, flexDirection: "column" }, /* @__PURE__ */ React7.createElement(Box7, null, /* @__PURE__ */ React7.createElement(Text7, { color: "cyan", bold: true }, steps[step].label), /* @__PURE__ */ React7.createElement(
|
|
999
1362
|
TextInput2,
|
|
1000
1363
|
{
|
|
1001
1364
|
value: currentInput,
|
|
1002
1365
|
onChange: setCurrentInput,
|
|
1003
1366
|
onSubmit: handleSubmit
|
|
1004
1367
|
}
|
|
1005
|
-
)), /* @__PURE__ */
|
|
1006
|
-
/* @__PURE__ */
|
|
1368
|
+
)), /* @__PURE__ */ React7.createElement(Box7, { marginTop: 1 }, /* @__PURE__ */ React7.createElement(Text7, { color: "gray", dimColor: true, italic: true }, "Step ", step + 1, " of ", steps.length))),
|
|
1369
|
+
/* @__PURE__ */ React7.createElement(Box7, { paddingX: 1, marginTop: 1 }, /* @__PURE__ */ React7.createElement(Text7, { color: "gray", dimColor: true, italic: true }, "(Enter to submit \u2022 Type /cancel to abort)"))
|
|
1007
1370
|
);
|
|
1008
1371
|
}
|
|
1009
1372
|
var init_ProfileForm = __esm({
|
|
@@ -1012,19 +1375,19 @@ var init_ProfileForm = __esm({
|
|
|
1012
1375
|
});
|
|
1013
1376
|
|
|
1014
1377
|
// src/components/AskUserModal.jsx
|
|
1015
|
-
import
|
|
1016
|
-
import { Box as
|
|
1378
|
+
import React8, { useState as useState5 } from "react";
|
|
1379
|
+
import { Box as Box8, Text as Text8, useInput as useInput3 } from "ink";
|
|
1017
1380
|
import TextInput3 from "ink-text-input";
|
|
1018
1381
|
var AskUserModal, AskUserModal_default;
|
|
1019
1382
|
var init_AskUserModal = __esm({
|
|
1020
1383
|
"src/components/AskUserModal.jsx"() {
|
|
1021
1384
|
init_terminal();
|
|
1022
1385
|
AskUserModal = ({ question, options, onResolve }) => {
|
|
1023
|
-
const [isSuggestingElse, setIsSuggestingElse] =
|
|
1024
|
-
const [customInput, setCustomInput] =
|
|
1025
|
-
const [selectedIndex, setSelectedIndex] =
|
|
1386
|
+
const [isSuggestingElse, setIsSuggestingElse] = useState5(false);
|
|
1387
|
+
const [customInput, setCustomInput] = useState5("");
|
|
1388
|
+
const [selectedIndex, setSelectedIndex] = useState5(0);
|
|
1026
1389
|
const allOptions = [...options, { id: "CUSTOM", label: "Suggest something else...", description: "Provide a custom response" }];
|
|
1027
|
-
|
|
1390
|
+
useInput3((input, key) => {
|
|
1028
1391
|
if (isSuggestingElse) return;
|
|
1029
1392
|
if (key.leftArrow || key.upArrow) {
|
|
1030
1393
|
setSelectedIndex((prev) => Math.max(0, prev - 1));
|
|
@@ -1043,19 +1406,19 @@ var init_AskUserModal = __esm({
|
|
|
1043
1406
|
});
|
|
1044
1407
|
const s = emojiSpace(2);
|
|
1045
1408
|
if (isSuggestingElse) {
|
|
1046
|
-
return /* @__PURE__ */
|
|
1409
|
+
return /* @__PURE__ */ React8.createElement(Box8, { flexDirection: "column", borderStyle: "round", borderColor: "gray", padding: 0, width: "100%" }, /* @__PURE__ */ React8.createElement(Box8, { paddingX: 1 }, /* @__PURE__ */ React8.createElement(Text8, { color: "cyan", bold: true }, "\u{1F4AC} SUGGEST SOMETHING ELSE")), /* @__PURE__ */ React8.createElement(Box8, { marginTop: 1, paddingX: 1 }, /* @__PURE__ */ React8.createElement(Text8, { italic: true, color: "gray" }, "Replying to: ", question)), /* @__PURE__ */ React8.createElement(Box8, { marginTop: 1, paddingX: 1, flexDirection: "row" }, /* @__PURE__ */ React8.createElement(Text8, { color: "cyan", bold: true }, "\u{1F4A0} "), /* @__PURE__ */ React8.createElement(
|
|
1047
1410
|
TextInput3,
|
|
1048
1411
|
{
|
|
1049
1412
|
value: customInput,
|
|
1050
1413
|
onChange: setCustomInput,
|
|
1051
1414
|
onSubmit: () => onResolve(customInput)
|
|
1052
1415
|
}
|
|
1053
|
-
)), /* @__PURE__ */
|
|
1416
|
+
)), /* @__PURE__ */ React8.createElement(Box8, { marginTop: 1, paddingX: 1, marginBottom: 1 }, /* @__PURE__ */ React8.createElement(Text8, { color: "gray", dimColor: true, italic: true }, "(Press Enter to send)")));
|
|
1054
1417
|
}
|
|
1055
|
-
return /* @__PURE__ */
|
|
1418
|
+
return /* @__PURE__ */ React8.createElement(Box8, { flexDirection: "column", borderStyle: "round", borderColor: "gray", padding: 0, width: "100%" }, /* @__PURE__ */ React8.createElement(Box8, { paddingX: 1, marginBottom: 1 }, /* @__PURE__ */ React8.createElement(Text8, { color: "cyan", bold: true }, "\u{1F4AC} AGENT REQUEST: ACTION REQUIRED")), /* @__PURE__ */ React8.createElement(Box8, { paddingX: 1, marginBottom: 1 }, /* @__PURE__ */ React8.createElement(Text8, { bold: true, color: "white" }, question)), /* @__PURE__ */ React8.createElement(Box8, { flexDirection: "column", width: "100%" }, allOptions.map((opt, idx) => {
|
|
1056
1419
|
const isSelected = idx === selectedIndex;
|
|
1057
|
-
return /* @__PURE__ */
|
|
1058
|
-
|
|
1420
|
+
return /* @__PURE__ */ React8.createElement(
|
|
1421
|
+
Box8,
|
|
1059
1422
|
{
|
|
1060
1423
|
key: opt.id,
|
|
1061
1424
|
flexDirection: "column",
|
|
@@ -1064,10 +1427,10 @@ var init_AskUserModal = __esm({
|
|
|
1064
1427
|
paddingX: 1,
|
|
1065
1428
|
marginBottom: idx === allOptions.length - 1 ? 0 : 1
|
|
1066
1429
|
},
|
|
1067
|
-
/* @__PURE__ */
|
|
1068
|
-
opt.description && /* @__PURE__ */
|
|
1430
|
+
/* @__PURE__ */ React8.createElement(Text8, { color: isSelected ? "cyan" : "white", bold: isSelected }, isSelected ? "\u276F " : " ", opt.label),
|
|
1431
|
+
opt.description && /* @__PURE__ */ React8.createElement(Box8, { marginLeft: 4 }, /* @__PURE__ */ React8.createElement(Text8, { color: "gray", italic: true, dimColor: true }, opt.description))
|
|
1069
1432
|
);
|
|
1070
|
-
})), /* @__PURE__ */
|
|
1433
|
+
})), /* @__PURE__ */ React8.createElement(Box8, { paddingX: 1, marginTop: 1, marginBottom: 1 }, /* @__PURE__ */ React8.createElement(Text8, { color: "gray", dimColor: true, italic: true }, "(Use Arrows to navigate, Enter to confirm)")));
|
|
1071
1434
|
};
|
|
1072
1435
|
AskUserModal_default = AskUserModal;
|
|
1073
1436
|
}
|
|
@@ -5549,13 +5912,13 @@ ${timestamp}`;
|
|
|
5549
5912
|
});
|
|
5550
5913
|
|
|
5551
5914
|
// src/components/ResumeModal.jsx
|
|
5552
|
-
import
|
|
5553
|
-
import { Box as
|
|
5915
|
+
import React9, { useState as useState6, useEffect as useEffect4 } from "react";
|
|
5916
|
+
import { Box as Box9, Text as Text9, useInput as useInput4 } from "ink";
|
|
5554
5917
|
function ResumeModal({ onSelect, onDelete, onClose }) {
|
|
5555
|
-
const [history, setHistory] =
|
|
5556
|
-
const [keys, setKeys] =
|
|
5557
|
-
const [selectedIndex, setSelectedIndex] =
|
|
5558
|
-
|
|
5918
|
+
const [history, setHistory] = useState6({});
|
|
5919
|
+
const [keys, setKeys] = useState6([]);
|
|
5920
|
+
const [selectedIndex, setSelectedIndex] = useState6(0);
|
|
5921
|
+
useEffect4(() => {
|
|
5559
5922
|
const fetchHistory = async () => {
|
|
5560
5923
|
const h = await loadHistory();
|
|
5561
5924
|
setHistory(h);
|
|
@@ -5563,7 +5926,7 @@ function ResumeModal({ onSelect, onDelete, onClose }) {
|
|
|
5563
5926
|
};
|
|
5564
5927
|
fetchHistory();
|
|
5565
5928
|
}, []);
|
|
5566
|
-
|
|
5929
|
+
useInput4((input, key) => {
|
|
5567
5930
|
if (key.escape) onClose();
|
|
5568
5931
|
if (key.upArrow) setSelectedIndex((prev) => Math.max(0, prev - 1));
|
|
5569
5932
|
if (key.downArrow) setSelectedIndex((prev) => Math.min(keys.length - 1, prev + 1));
|
|
@@ -5592,24 +5955,24 @@ function ResumeModal({ onSelect, onDelete, onClose }) {
|
|
|
5592
5955
|
}
|
|
5593
5956
|
}
|
|
5594
5957
|
const visibleKeys = keys.slice(startIndex, startIndex + MAX_VISIBLE);
|
|
5595
|
-
return /* @__PURE__ */
|
|
5958
|
+
return /* @__PURE__ */ React9.createElement(Box9, { flexDirection: "column", borderStyle: "round", borderColor: "gray", padding: 0, width: "100%" }, /* @__PURE__ */ React9.createElement(Box9, { paddingX: 1, marginBottom: 1 }, /* @__PURE__ */ React9.createElement(Text9, { color: "cyan", bold: true }, "\u{1F4A0} CHAT HISTORY: RESUME CONVERSATION")), keys.length === 0 ? /* @__PURE__ */ React9.createElement(Box9, { paddingX: 2, paddingY: 1 }, /* @__PURE__ */ React9.createElement(Text9, { italic: true, color: "gray" }, "No saved chats found.")) : /* @__PURE__ */ React9.createElement(Box9, { flexDirection: "column", width: "100%" }, startIndex > 0 && /* @__PURE__ */ React9.createElement(Box9, { paddingX: 2, marginBottom: 1 }, /* @__PURE__ */ React9.createElement(Text9, { color: "gray", dimColor: true }, "\u25B2 (+", startIndex, " more chats above)")), visibleKeys.map((id, index) => {
|
|
5596
5959
|
const chat2 = history[id];
|
|
5597
5960
|
const actualIndex = startIndex + index;
|
|
5598
5961
|
const isSelected = actualIndex === selectedIndex;
|
|
5599
5962
|
const dateStr = formatDate(chat2?.updatedAt);
|
|
5600
|
-
return /* @__PURE__ */
|
|
5601
|
-
|
|
5963
|
+
return /* @__PURE__ */ React9.createElement(
|
|
5964
|
+
Box9,
|
|
5602
5965
|
{
|
|
5603
5966
|
key: id,
|
|
5604
5967
|
paddingX: 1,
|
|
5605
5968
|
backgroundColor: isSelected ? "#2a2a2a" : void 0,
|
|
5606
5969
|
width: "100%"
|
|
5607
5970
|
},
|
|
5608
|
-
/* @__PURE__ */
|
|
5609
|
-
isSelected && /* @__PURE__ */
|
|
5971
|
+
/* @__PURE__ */ React9.createElement(Box9, { flexGrow: 1 }, /* @__PURE__ */ React9.createElement(Text9, { color: isSelected ? "cyan" : "white", bold: isSelected }, isSelected ? "\u276F " : " ", chat2?.name || id, /* @__PURE__ */ React9.createElement(Text9, { color: "gray", dimColor: !isSelected }, " [", dateStr, " \u2022 ", id.slice(5), "]"))),
|
|
5972
|
+
isSelected && /* @__PURE__ */ React9.createElement(Box9, { flexShrink: 0 }, /* @__PURE__ */ React9.createElement(Text9, { color: "red", bold: true }, "[X] DELETE "))
|
|
5610
5973
|
);
|
|
5611
|
-
}), startIndex + MAX_VISIBLE < keys.length && /* @__PURE__ */
|
|
5612
|
-
|
|
5974
|
+
}), startIndex + MAX_VISIBLE < keys.length && /* @__PURE__ */ React9.createElement(Box9, { paddingX: 2, marginTop: 1 }, /* @__PURE__ */ React9.createElement(Text9, { color: "gray", dimColor: true }, "\u25BC (+", keys.length - (startIndex + MAX_VISIBLE), " more chats below)"))), /* @__PURE__ */ React9.createElement(
|
|
5975
|
+
Box9,
|
|
5613
5976
|
{
|
|
5614
5977
|
marginTop: 1,
|
|
5615
5978
|
paddingX: 1,
|
|
@@ -5619,7 +5982,7 @@ function ResumeModal({ onSelect, onDelete, onClose }) {
|
|
|
5619
5982
|
borderBottom: false,
|
|
5620
5983
|
borderColor: "gray"
|
|
5621
5984
|
},
|
|
5622
|
-
/* @__PURE__ */
|
|
5985
|
+
/* @__PURE__ */ React9.createElement(Text9, { dimColor: true, italic: true }, "\u2191\u2193 navigate \u2022 Enter select \u2022 x delete \u2022 Esc close")
|
|
5623
5986
|
));
|
|
5624
5987
|
}
|
|
5625
5988
|
function formatDate(timestamp) {
|
|
@@ -5641,12 +6004,12 @@ var init_ResumeModal = __esm({
|
|
|
5641
6004
|
});
|
|
5642
6005
|
|
|
5643
6006
|
// src/components/MemoryModal.jsx
|
|
5644
|
-
import
|
|
5645
|
-
import { Box as
|
|
6007
|
+
import React10, { useState as useState7, useEffect as useEffect5 } from "react";
|
|
6008
|
+
import { Box as Box10, Text as Text10, useInput as useInput5 } from "ink";
|
|
5646
6009
|
function MemoryModal({ onClose }) {
|
|
5647
|
-
const [memories, setMemories] =
|
|
5648
|
-
const [selectedIndex, setSelectedIndex] =
|
|
5649
|
-
const [isMemoryOn, setIsMemoryOn] =
|
|
6010
|
+
const [memories, setMemories] = useState7([]);
|
|
6011
|
+
const [selectedIndex, setSelectedIndex] = useState7(0);
|
|
6012
|
+
const [isMemoryOn, setIsMemoryOn] = useState7(true);
|
|
5650
6013
|
const loadMemories = () => {
|
|
5651
6014
|
const data = readEncryptedJson(MEMORIES_FILE, []);
|
|
5652
6015
|
setMemories(data);
|
|
@@ -5658,10 +6021,10 @@ function MemoryModal({ onClose }) {
|
|
|
5658
6021
|
setIsMemoryOn(true);
|
|
5659
6022
|
}
|
|
5660
6023
|
};
|
|
5661
|
-
|
|
6024
|
+
useEffect5(() => {
|
|
5662
6025
|
loadMemories();
|
|
5663
6026
|
}, []);
|
|
5664
|
-
|
|
6027
|
+
useInput5((input, key) => {
|
|
5665
6028
|
if (key.escape) onClose();
|
|
5666
6029
|
if (key.upArrow) setSelectedIndex((prev) => Math.max(0, prev - 1));
|
|
5667
6030
|
if (key.downArrow) setSelectedIndex((prev) => Math.min(memories.length - 1, prev + 1));
|
|
@@ -5691,21 +6054,21 @@ function MemoryModal({ onClose }) {
|
|
|
5691
6054
|
return "red";
|
|
5692
6055
|
};
|
|
5693
6056
|
const s = emojiSpace(2);
|
|
5694
|
-
return /* @__PURE__ */
|
|
6057
|
+
return /* @__PURE__ */ React10.createElement(Box10, { flexDirection: "column", borderStyle: "round", borderColor: "gray", padding: 0, width: "100%" }, /* @__PURE__ */ React10.createElement(Box10, { paddingX: 1, marginBottom: 1, justifyContent: "space-between" }, /* @__PURE__ */ React10.createElement(Text10, { color: "cyan", bold: true }, "\u{1F9E0} AGENT MEMORY: LONG-TERM KNOWLEDGE"), /* @__PURE__ */ React10.createElement(Box10, null, /* @__PURE__ */ React10.createElement(Text10, { color: "gray" }, "Vault: "), /* @__PURE__ */ React10.createElement(Text10, { color: getBarColor() }, barStr), /* @__PURE__ */ React10.createElement(Text10, { color: "white", bold: true }, " ", usagePercent, "%"))), !isMemoryOn && memories.length > 0 ? /* @__PURE__ */ React10.createElement(Box10, { paddingX: 2, paddingY: 1 }, /* @__PURE__ */ React10.createElement(Text10, { italic: true, color: "gray" }, "Memory is currently Off...")) : memories.length === 0 ? /* @__PURE__ */ React10.createElement(Box10, { paddingX: 2, paddingY: 1 }, /* @__PURE__ */ React10.createElement(Text10, { italic: true, color: "gray" }, isMemoryOn ? "Learning..." : "Memory not available...")) : /* @__PURE__ */ React10.createElement(Box10, { flexDirection: "column" }, memories.map((mem, idx) => {
|
|
5695
6058
|
const isSelected = idx === selectedIndex;
|
|
5696
|
-
return /* @__PURE__ */
|
|
5697
|
-
|
|
6059
|
+
return /* @__PURE__ */ React10.createElement(
|
|
6060
|
+
Box10,
|
|
5698
6061
|
{
|
|
5699
6062
|
key: mem.id,
|
|
5700
6063
|
paddingX: 1,
|
|
5701
6064
|
backgroundColor: isSelected ? "#2a2a2a" : void 0,
|
|
5702
6065
|
width: "100%"
|
|
5703
6066
|
},
|
|
5704
|
-
/* @__PURE__ */
|
|
5705
|
-
isSelected && /* @__PURE__ */
|
|
6067
|
+
/* @__PURE__ */ React10.createElement(Box10, { flexGrow: 1 }, /* @__PURE__ */ React10.createElement(Text10, { color: isSelected ? "cyan" : "white", bold: isSelected }, isSelected ? "\u276F " : " ", idx + 1, ". ", cleanDisplay(mem.memory))),
|
|
6068
|
+
isSelected && /* @__PURE__ */ React10.createElement(Box10, { flexShrink: 0 }, /* @__PURE__ */ React10.createElement(Text10, { color: "red", bold: true }, "[X] WIPE "))
|
|
5706
6069
|
);
|
|
5707
|
-
})), /* @__PURE__ */
|
|
5708
|
-
|
|
6070
|
+
})), /* @__PURE__ */ React10.createElement(
|
|
6071
|
+
Box10,
|
|
5709
6072
|
{
|
|
5710
6073
|
marginTop: 1,
|
|
5711
6074
|
paddingX: 1,
|
|
@@ -5715,7 +6078,7 @@ function MemoryModal({ onClose }) {
|
|
|
5715
6078
|
borderBottom: false,
|
|
5716
6079
|
borderColor: "gray"
|
|
5717
6080
|
},
|
|
5718
|
-
/* @__PURE__ */
|
|
6081
|
+
/* @__PURE__ */ React10.createElement(Text10, { dimColor: true, italic: true }, "\u2191\u2193 navigate \u2022 x wipe memory \u2022 Esc close")
|
|
5719
6082
|
));
|
|
5720
6083
|
}
|
|
5721
6084
|
var init_MemoryModal = __esm({
|
|
@@ -5727,18 +6090,18 @@ var init_MemoryModal = __esm({
|
|
|
5727
6090
|
});
|
|
5728
6091
|
|
|
5729
6092
|
// src/components/UpdateProcessor.jsx
|
|
5730
|
-
import
|
|
5731
|
-
import { Box as
|
|
6093
|
+
import React11, { useState as useState8, useEffect as useEffect6 } from "react";
|
|
6094
|
+
import { Box as Box11, Text as Text11 } from "ink";
|
|
5732
6095
|
import Spinner from "ink-spinner";
|
|
5733
6096
|
import { exec as exec2 } from "child_process";
|
|
5734
6097
|
var UpdateProcessor, UpdateProcessor_default;
|
|
5735
6098
|
var init_UpdateProcessor = __esm({
|
|
5736
6099
|
"src/components/UpdateProcessor.jsx"() {
|
|
5737
6100
|
UpdateProcessor = ({ latest, current, settings, onClose, onUpdateSettings, onSuccess }) => {
|
|
5738
|
-
const [status, setStatus] =
|
|
5739
|
-
const [log, setLog] =
|
|
5740
|
-
const [error, setError] =
|
|
5741
|
-
|
|
6101
|
+
const [status, setStatus] = useState8("initializing");
|
|
6102
|
+
const [log, setLog] = useState8("");
|
|
6103
|
+
const [error, setError] = useState8(null);
|
|
6104
|
+
useEffect6(() => {
|
|
5742
6105
|
let child;
|
|
5743
6106
|
const runUpdate = async () => {
|
|
5744
6107
|
const manager = settings.updateManager || "npm";
|
|
@@ -5778,13 +6141,13 @@ var init_UpdateProcessor = __esm({
|
|
|
5778
6141
|
};
|
|
5779
6142
|
}, []);
|
|
5780
6143
|
if (status === "initializing" || status === "downloading") {
|
|
5781
|
-
return /* @__PURE__ */
|
|
6144
|
+
return /* @__PURE__ */ React11.createElement(Box11, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 2, paddingY: 1 }, /* @__PURE__ */ React11.createElement(Box11, null, /* @__PURE__ */ React11.createElement(Text11, { color: "cyan" }, /* @__PURE__ */ React11.createElement(Spinner, { type: "dots" })), /* @__PURE__ */ React11.createElement(Text11, { marginLeft: 1, bold: true }, " Updating Flux Flow to v", latest, "...")), /* @__PURE__ */ React11.createElement(Box11, { marginTop: 1, paddingX: 1, borderStyle: "single", borderColor: "#333" }, /* @__PURE__ */ React11.createElement(Text11, { color: "gray", dimColor: true, italic: true }, log || "Preparing environment...")), /* @__PURE__ */ React11.createElement(Text11, { marginTop: 1, dimColor: true }, "(Please do not close the terminal)"));
|
|
5782
6145
|
}
|
|
5783
6146
|
if (status === "success") {
|
|
5784
|
-
return /* @__PURE__ */
|
|
6147
|
+
return /* @__PURE__ */ React11.createElement(Box11, { flexDirection: "column", borderStyle: "round", borderColor: "green", paddingX: 2, paddingY: 1 }, /* @__PURE__ */ React11.createElement(Text11, { color: "green", bold: true }, "\u2705 UPDATE SUCCESSFUL!"), /* @__PURE__ */ React11.createElement(Text11, { marginTop: 1 }, "Flux Flow has been updated to ", /* @__PURE__ */ React11.createElement(Text11, { color: "cyan" }, "v", latest), "."), /* @__PURE__ */ React11.createElement(Text11, { marginTop: 1, color: "yellow", bold: true }, "CRITICAL: Please restart your terminal session to apply changes."), /* @__PURE__ */ React11.createElement(Box11, { marginTop: 1 }, /* @__PURE__ */ React11.createElement(Text11, { dimColor: true }, "(Press ESC to return to chat)")));
|
|
5785
6148
|
}
|
|
5786
6149
|
if (status === "error") {
|
|
5787
|
-
return /* @__PURE__ */
|
|
6150
|
+
return /* @__PURE__ */ React11.createElement(Box11, { flexDirection: "column", borderStyle: "round", borderColor: "red", paddingX: 2, paddingY: 1 }, /* @__PURE__ */ React11.createElement(Text11, { color: "red", bold: true }, "\u274C UPDATE FAILED"), /* @__PURE__ */ React11.createElement(Box11, { marginTop: 1, paddingX: 1, borderStyle: "single", borderColor: "red" }, /* @__PURE__ */ React11.createElement(Text11, { color: "red" }, error)), /* @__PURE__ */ React11.createElement(Text11, { marginTop: 1 }, "Possible causes:"), /* @__PURE__ */ React11.createElement(Text11, null, "\u2022 Missing permissions (Try running as Administrator/Sudo)"), /* @__PURE__ */ React11.createElement(Text11, null, "\u2022 Package manager (", settings.updateManager, ") not found"), /* @__PURE__ */ React11.createElement(Text11, null, "\u2022 Network failure"), /* @__PURE__ */ React11.createElement(Box11, { marginTop: 1 }, /* @__PURE__ */ React11.createElement(Text11, { dimColor: true }, "(Press ESC to return to chat)")));
|
|
5788
6151
|
}
|
|
5789
6152
|
return null;
|
|
5790
6153
|
};
|
|
@@ -5793,11 +6156,11 @@ var init_UpdateProcessor = __esm({
|
|
|
5793
6156
|
});
|
|
5794
6157
|
|
|
5795
6158
|
// src/components/RevertModal.jsx
|
|
5796
|
-
import
|
|
5797
|
-
import { Box as
|
|
6159
|
+
import React12, { useState as useState9 } from "react";
|
|
6160
|
+
import { Box as Box12, Text as Text12, useInput as useInput6 } from "ink";
|
|
5798
6161
|
function RevertModal({ prompts, onSelect, onClose }) {
|
|
5799
|
-
const [selectedIndex, setSelectedIndex] =
|
|
5800
|
-
|
|
6162
|
+
const [selectedIndex, setSelectedIndex] = useState9(0);
|
|
6163
|
+
useInput6((input, key) => {
|
|
5801
6164
|
if (key.escape) onClose();
|
|
5802
6165
|
if (key.upArrow) setSelectedIndex((prev) => Math.max(0, prev - 1));
|
|
5803
6166
|
if (key.downArrow) setSelectedIndex((prev) => Math.min(prompts.length - 1, prev + 1));
|
|
@@ -5816,23 +6179,23 @@ function RevertModal({ prompts, onSelect, onClose }) {
|
|
|
5816
6179
|
}
|
|
5817
6180
|
}
|
|
5818
6181
|
const visiblePrompts = prompts.slice(startIndex, startIndex + MAX_VISIBLE);
|
|
5819
|
-
return /* @__PURE__ */
|
|
6182
|
+
return /* @__PURE__ */ React12.createElement(Box12, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", padding: 0, width: "100%" }, /* @__PURE__ */ React12.createElement(Box12, { paddingX: 1, marginBottom: 1 }, /* @__PURE__ */ React12.createElement(Text12, { color: "cyan", bold: true }, "\u{1F504} CODEBASE TIME TRAVEL: SELECT UNDO POINT")), /* @__PURE__ */ React12.createElement(Box12, { paddingX: 2, marginBottom: 1 }, /* @__PURE__ */ React12.createElement(Text12, null, "Select a prompt to revert the codebase back to the state ", /* @__PURE__ */ React12.createElement(Text12, { bold: true, color: "blue" }, "immediately before"), " it was executed:")), prompts.length === 0 ? /* @__PURE__ */ React12.createElement(Box12, { paddingX: 2, paddingY: 1 }, /* @__PURE__ */ React12.createElement(Text12, { italic: true, color: "gray" }, "No prompt checkpoints found for this session.")) : /* @__PURE__ */ React12.createElement(Box12, { flexDirection: "column", width: "100%" }, startIndex > 0 && /* @__PURE__ */ React12.createElement(Box12, { paddingX: 2, marginBottom: 1 }, /* @__PURE__ */ React12.createElement(Text12, { color: "gray", dimColor: true }, "\u25B2 (+", startIndex, " more prompts above)")), visiblePrompts.map((p, index) => {
|
|
5820
6183
|
const actualIndex = startIndex + index;
|
|
5821
6184
|
const isSelected = actualIndex === selectedIndex;
|
|
5822
6185
|
const dateStr = formatDate2(p.timestamp);
|
|
5823
6186
|
const fileCount = p.changes ? p.changes.length : 0;
|
|
5824
|
-
return /* @__PURE__ */
|
|
5825
|
-
|
|
6187
|
+
return /* @__PURE__ */ React12.createElement(
|
|
6188
|
+
Box12,
|
|
5826
6189
|
{
|
|
5827
6190
|
key: p.id,
|
|
5828
6191
|
paddingX: 1,
|
|
5829
6192
|
backgroundColor: isSelected ? "#1a2a3a" : void 0,
|
|
5830
6193
|
width: "100%"
|
|
5831
6194
|
},
|
|
5832
|
-
/* @__PURE__ */
|
|
6195
|
+
/* @__PURE__ */ React12.createElement(Box12, { flexGrow: 1 }, /* @__PURE__ */ React12.createElement(Text12, { color: isSelected ? "cyan" : "white", bold: isSelected }, isSelected ? "\u276F " : " ", '"', formatPromptPreview(p.prompt), '"', /* @__PURE__ */ React12.createElement(Text12, { color: "gray", dimColor: !isSelected }, " [", dateStr, " \u2022 ", fileCount, " file(s) changed]")))
|
|
5833
6196
|
);
|
|
5834
|
-
}), startIndex + MAX_VISIBLE < prompts.length && /* @__PURE__ */
|
|
5835
|
-
|
|
6197
|
+
}), startIndex + MAX_VISIBLE < prompts.length && /* @__PURE__ */ React12.createElement(Box12, { paddingX: 2, marginTop: 1 }, /* @__PURE__ */ React12.createElement(Text12, { color: "gray", dimColor: true }, "\u25BC (+", prompts.length - (startIndex + MAX_VISIBLE), " more prompts below)"))), /* @__PURE__ */ React12.createElement(
|
|
6198
|
+
Box12,
|
|
5836
6199
|
{
|
|
5837
6200
|
marginTop: 1,
|
|
5838
6201
|
paddingX: 1,
|
|
@@ -5842,20 +6205,23 @@ function RevertModal({ prompts, onSelect, onClose }) {
|
|
|
5842
6205
|
borderBottom: false,
|
|
5843
6206
|
borderColor: "cyan"
|
|
5844
6207
|
},
|
|
5845
|
-
/* @__PURE__ */
|
|
6208
|
+
/* @__PURE__ */ React12.createElement(Text12, { dimColor: true, italic: true }, "\u2191\u2193 navigate \u2022 Enter select undo point \u2022 Esc close")
|
|
5846
6209
|
));
|
|
5847
6210
|
}
|
|
5848
6211
|
function formatPromptPreview(prompt) {
|
|
5849
6212
|
if (!prompt) return "";
|
|
5850
6213
|
const firstLine = prompt.split("\n")[0] || "";
|
|
5851
|
-
const
|
|
5852
|
-
|
|
5853
|
-
return
|
|
6214
|
+
const formatted = firstLine.replace(/@\[(.*?)\]/g, (match, p1) => {
|
|
6215
|
+
const parts = p1.replace(/\\/g, "/").split("/");
|
|
6216
|
+
return `[${parts[parts.length - 1]}]`;
|
|
6217
|
+
});
|
|
6218
|
+
if (formatted.length > 69) {
|
|
6219
|
+
return formatted.slice(0, 67) + "...";
|
|
5854
6220
|
}
|
|
5855
6221
|
if (prompt.includes("\n")) {
|
|
5856
|
-
return
|
|
6222
|
+
return formatted + "...";
|
|
5857
6223
|
}
|
|
5858
|
-
return
|
|
6224
|
+
return formatted;
|
|
5859
6225
|
}
|
|
5860
6226
|
function formatDate2(timestamp) {
|
|
5861
6227
|
if (!timestamp) return "N/A";
|
|
@@ -5916,31 +6282,31 @@ __export(app_exports, {
|
|
|
5916
6282
|
default: () => App
|
|
5917
6283
|
});
|
|
5918
6284
|
import os4 from "os";
|
|
5919
|
-
import
|
|
5920
|
-
import { Box as
|
|
6285
|
+
import React13, { useState as useState10, useEffect as useEffect7, useRef as useRef3, useMemo as useMemo2 } from "react";
|
|
6286
|
+
import { Box as Box13, Text as Text13, useInput as useInput7, useStdout } from "ink";
|
|
5921
6287
|
import Spinner2 from "ink-spinner";
|
|
5922
6288
|
import fs18 from "fs-extra";
|
|
5923
6289
|
import path16 from "path";
|
|
5924
6290
|
import { exec as exec4 } from "child_process";
|
|
5925
6291
|
import { fileURLToPath } from "url";
|
|
5926
|
-
import { MultilineInput } from "ink-multiline-input";
|
|
5927
6292
|
import TextInput4 from "ink-text-input";
|
|
5928
6293
|
import gradient from "gradient-string";
|
|
5929
6294
|
function App({ args = [] }) {
|
|
5930
|
-
const [confirmExit, setConfirmExit] =
|
|
5931
|
-
const [exitCountdown, setExitCountdown] =
|
|
6295
|
+
const [confirmExit, setConfirmExit] = useState10(false);
|
|
6296
|
+
const [exitCountdown, setExitCountdown] = useState10(10);
|
|
5932
6297
|
const { stdout } = useStdout();
|
|
5933
|
-
const [input, setInput] =
|
|
5934
|
-
const [
|
|
5935
|
-
const [
|
|
5936
|
-
const [
|
|
6298
|
+
const [input, setInput] = useState10("");
|
|
6299
|
+
const [inputKey, setInputKey] = useState10(0);
|
|
6300
|
+
const [isExpanded, setIsExpanded] = useState10(false);
|
|
6301
|
+
const [mode, setMode] = useState10("Flux");
|
|
6302
|
+
const [terminalSize, setTerminalSize] = useState10({
|
|
5937
6303
|
columns: stdout?.columns || 80,
|
|
5938
6304
|
rows: stdout?.rows || 24
|
|
5939
6305
|
});
|
|
5940
|
-
const [selectedIndex, setSelectedIndex] =
|
|
5941
|
-
const [isFilePickerDismissed, setIsFilePickerDismissed] =
|
|
5942
|
-
const persistedModelRef =
|
|
5943
|
-
const parsedArgs =
|
|
6306
|
+
const [selectedIndex, setSelectedIndex] = useState10(0);
|
|
6307
|
+
const [isFilePickerDismissed, setIsFilePickerDismissed] = useState10(false);
|
|
6308
|
+
const persistedModelRef = useRef3(null);
|
|
6309
|
+
const parsedArgs = useMemo2(() => {
|
|
5944
6310
|
const parsed = {};
|
|
5945
6311
|
for (let i = 0; i < args.length; i++) {
|
|
5946
6312
|
const arg = args[i];
|
|
@@ -6029,7 +6395,7 @@ function App({ args = [] }) {
|
|
|
6029
6395
|
}
|
|
6030
6396
|
}
|
|
6031
6397
|
};
|
|
6032
|
-
|
|
6398
|
+
useEffect7(() => {
|
|
6033
6399
|
const handleResize = () => {
|
|
6034
6400
|
stdout.write("\x1Bc");
|
|
6035
6401
|
setTerminalSize({
|
|
@@ -6042,38 +6408,38 @@ function App({ args = [] }) {
|
|
|
6042
6408
|
stdout.off("resize", handleResize);
|
|
6043
6409
|
};
|
|
6044
6410
|
}, [stdout]);
|
|
6045
|
-
const [thinkingLevel, setThinkingLevel] =
|
|
6046
|
-
const [latestVer, setLatestVer] =
|
|
6047
|
-
const [showFullThinking, setShowFullThinking] =
|
|
6048
|
-
const [activeModel, setActiveModel] =
|
|
6049
|
-
const [janitorModel, setJanitorModel] =
|
|
6050
|
-
const [isInitializing, setIsInitializing] =
|
|
6051
|
-
const [apiKey, setApiKey] =
|
|
6052
|
-
const [tempKey, setTempKey] =
|
|
6053
|
-
const [activeView, setActiveView] =
|
|
6054
|
-
const [apiTier, setApiTier] =
|
|
6055
|
-
const [quotas, setQuotas] =
|
|
6056
|
-
const [inputConfig, setInputConfig] =
|
|
6057
|
-
const [systemSettings, setSystemSettings] =
|
|
6058
|
-
const [profileData, setProfileData] =
|
|
6059
|
-
const [imageSettings, setImageSettings] =
|
|
6060
|
-
const [sessionStats, setSessionStats] =
|
|
6061
|
-
const [sessionAgentCalls, setSessionAgentCalls] =
|
|
6062
|
-
const [sessionBackgroundCalls, setSessionBackgroundCalls] =
|
|
6063
|
-
const [sessionTotalTokens, setSessionTotalTokens] =
|
|
6064
|
-
const [sessionToolSuccess, setSessionToolSuccess] =
|
|
6065
|
-
const [sessionToolFailure, setSessionToolFailure] =
|
|
6066
|
-
const [sessionToolDenied, setSessionToolDenied] =
|
|
6067
|
-
const [sessionApiTime, setSessionApiTime] =
|
|
6068
|
-
const [sessionToolTime, setSessionToolTime] =
|
|
6069
|
-
const [sessionImageCount, setSessionImageCount] =
|
|
6070
|
-
const [sessionImageCredits, setSessionImageCredits] =
|
|
6071
|
-
const [dailyUsage, setDailyUsage] =
|
|
6072
|
-
const [chatId, setChatId] =
|
|
6073
|
-
const [activeCommand, setActiveCommand] =
|
|
6074
|
-
const [execOutput, setExecOutput] =
|
|
6075
|
-
const [isTerminalFocused, setIsTerminalFocused] =
|
|
6076
|
-
|
|
6411
|
+
const [thinkingLevel, setThinkingLevel] = useState10("Medium");
|
|
6412
|
+
const [latestVer, setLatestVer] = useState10(null);
|
|
6413
|
+
const [showFullThinking, setShowFullThinking] = useState10(false);
|
|
6414
|
+
const [activeModel, setActiveModel] = useState10("gemma-4-31b-it");
|
|
6415
|
+
const [janitorModel, setJanitorModel] = useState10("gemma-4-26b-a4b-it");
|
|
6416
|
+
const [isInitializing, setIsInitializing] = useState10(true);
|
|
6417
|
+
const [apiKey, setApiKey] = useState10(null);
|
|
6418
|
+
const [tempKey, setTempKey] = useState10("");
|
|
6419
|
+
const [activeView, setActiveView] = useState10("chat");
|
|
6420
|
+
const [apiTier, setApiTier] = useState10("Free");
|
|
6421
|
+
const [quotas, setQuotas] = useState10({ agentLimit: 1500, backgroundLimit: 1500, searchLimit: 100, customModelId: "", customLimit: 0 });
|
|
6422
|
+
const [inputConfig, setInputConfig] = useState10(null);
|
|
6423
|
+
const [systemSettings, setSystemSettings] = useState10({ memory: true, compression: 0, autoExec: false, autoDeleteHistory: "7d", autoUpdate: false, updateManager: "npm", customUpdateCommand: "" });
|
|
6424
|
+
const [profileData, setProfileData] = useState10({ name: null, nickname: null, instructions: null });
|
|
6425
|
+
const [imageSettings, setImageSettings] = useState10({ keyType: "Default", quality: "Low-High", apiKey: "" });
|
|
6426
|
+
const [sessionStats, setSessionStats] = useState10({ tokens: 0 });
|
|
6427
|
+
const [sessionAgentCalls, setSessionAgentCalls] = useState10(0);
|
|
6428
|
+
const [sessionBackgroundCalls, setSessionBackgroundCalls] = useState10(0);
|
|
6429
|
+
const [sessionTotalTokens, setSessionTotalTokens] = useState10(0);
|
|
6430
|
+
const [sessionToolSuccess, setSessionToolSuccess] = useState10(0);
|
|
6431
|
+
const [sessionToolFailure, setSessionToolFailure] = useState10(0);
|
|
6432
|
+
const [sessionToolDenied, setSessionToolDenied] = useState10(0);
|
|
6433
|
+
const [sessionApiTime, setSessionApiTime] = useState10(0);
|
|
6434
|
+
const [sessionToolTime, setSessionToolTime] = useState10(0);
|
|
6435
|
+
const [sessionImageCount, setSessionImageCount] = useState10(0);
|
|
6436
|
+
const [sessionImageCredits, setSessionImageCredits] = useState10(0);
|
|
6437
|
+
const [dailyUsage, setDailyUsage] = useState10(null);
|
|
6438
|
+
const [chatId, setChatId] = useState10(generateChatId());
|
|
6439
|
+
const [activeCommand, setActiveCommand] = useState10(null);
|
|
6440
|
+
const [execOutput, setExecOutput] = useState10("");
|
|
6441
|
+
const [isTerminalFocused, setIsTerminalFocused] = useState10(false);
|
|
6442
|
+
useEffect7(() => {
|
|
6077
6443
|
if (apiTier !== "Free" && activeModel === "gemma-4-31b-it") {
|
|
6078
6444
|
setActiveModel("gemini-3-flash-preview");
|
|
6079
6445
|
setMessages((prev) => {
|
|
@@ -6087,24 +6453,24 @@ function App({ args = [] }) {
|
|
|
6087
6453
|
});
|
|
6088
6454
|
}
|
|
6089
6455
|
}, [apiTier, activeModel]);
|
|
6090
|
-
const terminalEnv =
|
|
6456
|
+
const terminalEnv = useMemo2(() => {
|
|
6091
6457
|
const isIDE = process.env.TERM_PROGRAM === "vscode" || !!process.env.VSC_TERMINAL_URL || !!process.env.INTELLIJ_TERMINAL_COMMAND_BLOCKS;
|
|
6092
6458
|
return {
|
|
6093
6459
|
isIDE,
|
|
6094
6460
|
shortcut: isIDE ? "Shift + Enter" : "Ctrl + Enter"
|
|
6095
6461
|
};
|
|
6096
6462
|
}, []);
|
|
6097
|
-
const activeCommandRef =
|
|
6098
|
-
const execOutputRef =
|
|
6099
|
-
|
|
6463
|
+
const activeCommandRef = useRef3(null);
|
|
6464
|
+
const execOutputRef = useRef3("");
|
|
6465
|
+
useEffect7(() => {
|
|
6100
6466
|
activeCommandRef.current = activeCommand;
|
|
6101
6467
|
}, [activeCommand]);
|
|
6102
|
-
|
|
6468
|
+
useEffect7(() => {
|
|
6103
6469
|
execOutputRef.current = execOutput;
|
|
6104
6470
|
}, [execOutput]);
|
|
6105
|
-
const [autoAcceptWrites, setAutoAcceptWrites] =
|
|
6106
|
-
const [pendingApproval, setPendingApproval] =
|
|
6107
|
-
const [pendingAsk, setPendingAsk] =
|
|
6471
|
+
const [autoAcceptWrites, setAutoAcceptWrites] = useState10(false);
|
|
6472
|
+
const [pendingApproval, setPendingApproval] = useState10(null);
|
|
6473
|
+
const [pendingAsk, setPendingAsk] = useState10(null);
|
|
6108
6474
|
const formatDuration = (totalSecs) => {
|
|
6109
6475
|
const h = Math.floor(totalSecs / 3600);
|
|
6110
6476
|
const m = Math.floor(totalSecs % 3600 / 60);
|
|
@@ -6119,18 +6485,18 @@ function App({ args = [] }) {
|
|
|
6119
6485
|
if (ms < 1e3) return `${ms}ms`;
|
|
6120
6486
|
return formatDuration(Math.floor(ms / 1e3));
|
|
6121
6487
|
};
|
|
6122
|
-
const [statusText, setStatusText] =
|
|
6123
|
-
const [isSpinnerActive, setIsSpinnerActive] =
|
|
6124
|
-
const [isProcessing, setIsProcessing] =
|
|
6125
|
-
const [escPressed, setEscPressed] =
|
|
6126
|
-
const [escTimer, setEscTimer] =
|
|
6127
|
-
const [escPressCount, setEscPressCount] =
|
|
6128
|
-
const [recentPrompts, setRecentPrompts] =
|
|
6129
|
-
const escDoubleTimerRef =
|
|
6130
|
-
const [queuedPrompt, setQueuedPrompt] =
|
|
6131
|
-
const [resolutionData, setResolutionData] =
|
|
6132
|
-
const [tempModelOverride, setTempModelOverride] =
|
|
6133
|
-
const [messages, setMessages] =
|
|
6488
|
+
const [statusText, setStatusText] = useState10(null);
|
|
6489
|
+
const [isSpinnerActive, setIsSpinnerActive] = useState10(true);
|
|
6490
|
+
const [isProcessing, setIsProcessing] = useState10(false);
|
|
6491
|
+
const [escPressed, setEscPressed] = useState10(false);
|
|
6492
|
+
const [escTimer, setEscTimer] = useState10(null);
|
|
6493
|
+
const [escPressCount, setEscPressCount] = useState10(0);
|
|
6494
|
+
const [recentPrompts, setRecentPrompts] = useState10([]);
|
|
6495
|
+
const escDoubleTimerRef = useRef3(null);
|
|
6496
|
+
const [queuedPrompt, setQueuedPrompt] = useState10(null);
|
|
6497
|
+
const [resolutionData, setResolutionData] = useState10(null);
|
|
6498
|
+
const [tempModelOverride, setTempModelOverride] = useState10(null);
|
|
6499
|
+
const [messages, setMessages] = useState10(() => {
|
|
6134
6500
|
const logoMsg = { id: "logo-" + Date.now(), role: "system", text: FLUX_LOGO, isLogo: true, isMeta: true };
|
|
6135
6501
|
const welcomeMsg = { id: "welcome", role: "system", text: "\u{1F30A}\u26A1 Welcome to Flux Flow! Type /help for commands.", isMeta: true };
|
|
6136
6502
|
const isHomeDir = process.cwd() === os4.homedir();
|
|
@@ -6168,9 +6534,9 @@ function App({ args = [] }) {
|
|
|
6168
6534
|
}
|
|
6169
6535
|
return msgs;
|
|
6170
6536
|
});
|
|
6171
|
-
const queuedPromptRef =
|
|
6172
|
-
const [completedIndex, setCompletedIndex] =
|
|
6173
|
-
const windowedHistory =
|
|
6537
|
+
const queuedPromptRef = useRef3(null);
|
|
6538
|
+
const [completedIndex, setCompletedIndex] = useState10(messages.length);
|
|
6539
|
+
const windowedHistory = useMemo2(() => {
|
|
6174
6540
|
const MAX_HISTORY_LINES = 2e3;
|
|
6175
6541
|
const width = terminalSize.columns || 80;
|
|
6176
6542
|
let totalLines = 0;
|
|
@@ -6204,7 +6570,7 @@ function App({ args = [] }) {
|
|
|
6204
6570
|
return acc + Math.max(1, Math.ceil(line.length / wrapWidth));
|
|
6205
6571
|
}, 0);
|
|
6206
6572
|
const maxLines = Math.max(1, wrappedLinesCount);
|
|
6207
|
-
|
|
6573
|
+
useInput7((inputText, key) => {
|
|
6208
6574
|
if (key.tab && activeCommand) {
|
|
6209
6575
|
setIsTerminalFocused((prev) => !prev);
|
|
6210
6576
|
return;
|
|
@@ -6317,7 +6683,7 @@ function App({ args = [] }) {
|
|
|
6317
6683
|
setInput((prev) => prev.replace(/\\\r?$/, "").replace(/\r?$/, "") + "\n");
|
|
6318
6684
|
}
|
|
6319
6685
|
});
|
|
6320
|
-
|
|
6686
|
+
useEffect7(() => {
|
|
6321
6687
|
async function init() {
|
|
6322
6688
|
if (process.stdout.isTTY) {
|
|
6323
6689
|
process.stdout.write(`\x1B]0;FluxFlow | Ready\x07`);
|
|
@@ -6422,7 +6788,7 @@ function App({ args = [] }) {
|
|
|
6422
6788
|
}
|
|
6423
6789
|
init();
|
|
6424
6790
|
}, []);
|
|
6425
|
-
|
|
6791
|
+
useEffect7(() => {
|
|
6426
6792
|
let timer;
|
|
6427
6793
|
if (confirmExit) {
|
|
6428
6794
|
setExitCountdown(10);
|
|
@@ -6440,7 +6806,7 @@ function App({ args = [] }) {
|
|
|
6440
6806
|
if (timer) clearInterval(timer);
|
|
6441
6807
|
};
|
|
6442
6808
|
}, [confirmExit]);
|
|
6443
|
-
|
|
6809
|
+
useEffect7(() => {
|
|
6444
6810
|
if (!isInitializing) {
|
|
6445
6811
|
const modelToSave = parsedArgs.model && activeModel === parsedArgs.model ? persistedModelRef.current : activeModel;
|
|
6446
6812
|
saveSettings({
|
|
@@ -6466,8 +6832,8 @@ function App({ args = [] }) {
|
|
|
6466
6832
|
setTempKey("");
|
|
6467
6833
|
}
|
|
6468
6834
|
};
|
|
6469
|
-
const lastSavedTimeRef =
|
|
6470
|
-
|
|
6835
|
+
const lastSavedTimeRef = useRef3(SESSION_START_TIME);
|
|
6836
|
+
useEffect7(() => {
|
|
6471
6837
|
if (activeView === "exit") {
|
|
6472
6838
|
const flush = async () => {
|
|
6473
6839
|
const now = Date.now();
|
|
@@ -6485,7 +6851,7 @@ function App({ args = [] }) {
|
|
|
6485
6851
|
return () => clearTimeout(timer);
|
|
6486
6852
|
}
|
|
6487
6853
|
}, [activeView]);
|
|
6488
|
-
|
|
6854
|
+
useEffect7(() => {
|
|
6489
6855
|
const interval = setInterval(async () => {
|
|
6490
6856
|
if (!isInitializing) {
|
|
6491
6857
|
const now = Date.now();
|
|
@@ -6605,6 +6971,7 @@ function App({ args = [] }) {
|
|
|
6605
6971
|
setInput(parentParts.join(" ") + " " + nextMatch.cmd + " ");
|
|
6606
6972
|
}
|
|
6607
6973
|
setSelectedIndex(0);
|
|
6974
|
+
setInputKey((prev) => prev + 1);
|
|
6608
6975
|
return;
|
|
6609
6976
|
}
|
|
6610
6977
|
const normalizedValue = value.replace(/\r\n/g, "\n").replace(/\r/g, "\n").trimEnd();
|
|
@@ -7566,7 +7933,7 @@ Selection: ${val}`,
|
|
|
7566
7933
|
setInput("");
|
|
7567
7934
|
setIsExpanded(false);
|
|
7568
7935
|
};
|
|
7569
|
-
const suggestions =
|
|
7936
|
+
const suggestions = useMemo2(() => {
|
|
7570
7937
|
if (input.startsWith("/") && !isFilePickerDismissed) {
|
|
7571
7938
|
const parts2 = input.split(" ");
|
|
7572
7939
|
const query = parts2[parts2.length - 1].toLowerCase();
|
|
@@ -7609,13 +7976,13 @@ Selection: ${val}`,
|
|
|
7609
7976
|
}
|
|
7610
7977
|
return [];
|
|
7611
7978
|
}, [input, isFilePickerDismissed]);
|
|
7612
|
-
|
|
7979
|
+
useEffect7(() => {
|
|
7613
7980
|
setSelectedIndex(0);
|
|
7614
7981
|
}, [suggestions]);
|
|
7615
7982
|
const renderActiveView = () => {
|
|
7616
7983
|
switch (activeView) {
|
|
7617
7984
|
case "settings":
|
|
7618
|
-
return /* @__PURE__ */
|
|
7985
|
+
return /* @__PURE__ */ React13.createElement(
|
|
7619
7986
|
SettingsMenu,
|
|
7620
7987
|
{
|
|
7621
7988
|
systemSettings,
|
|
@@ -7629,7 +7996,7 @@ Selection: ${val}`,
|
|
|
7629
7996
|
}
|
|
7630
7997
|
);
|
|
7631
7998
|
case "apiTier":
|
|
7632
|
-
return /* @__PURE__ */
|
|
7999
|
+
return /* @__PURE__ */ React13.createElement(
|
|
7633
8000
|
CommandMenu,
|
|
7634
8001
|
{
|
|
7635
8002
|
title: `API Tier: ${apiTier}`,
|
|
@@ -7662,7 +8029,7 @@ Selection: ${val}`,
|
|
|
7662
8029
|
}
|
|
7663
8030
|
);
|
|
7664
8031
|
case "input":
|
|
7665
|
-
return /* @__PURE__ */
|
|
8032
|
+
return /* @__PURE__ */ React13.createElement(Box13, { flexDirection: "column", borderStyle: "round", borderColor: "gray", padding: 0, width: "100%" }, /* @__PURE__ */ React13.createElement(Box13, { paddingX: 1 }, /* @__PURE__ */ React13.createElement(Text13, { color: "magenta", bold: true }, "\u{1F527} DATA CONFIGURATION")), inputConfig?.note && /* @__PURE__ */ React13.createElement(Box13, { paddingX: 1, marginBottom: 1 }, /* @__PURE__ */ React13.createElement(Text13, { color: "yellow", dimColor: true, italic: true }, inputConfig.note)), /* @__PURE__ */ React13.createElement(Box13, { paddingX: 1, flexDirection: "row" }, /* @__PURE__ */ React13.createElement(Text13, { color: "cyan", bold: true }, inputConfig?.label, " "), /* @__PURE__ */ React13.createElement(
|
|
7666
8033
|
TextInput4,
|
|
7667
8034
|
{
|
|
7668
8035
|
value: inputConfig?.value || "",
|
|
@@ -7719,11 +8086,11 @@ Selection: ${val}`,
|
|
|
7719
8086
|
}
|
|
7720
8087
|
}
|
|
7721
8088
|
}
|
|
7722
|
-
)), /* @__PURE__ */
|
|
8089
|
+
)), /* @__PURE__ */ React13.createElement(Box13, { paddingX: 1, marginTop: 1 }, /* @__PURE__ */ React13.createElement(Text13, { color: "gray", dimColor: true, italic: true }, "(Press Enter to confirm selection)")));
|
|
7723
8090
|
case "stats":
|
|
7724
|
-
return /* @__PURE__ */
|
|
8091
|
+
return /* @__PURE__ */ React13.createElement(Box13, { flexDirection: "column", borderStyle: "round", paddingX: 3, paddingY: 1, width: Math.min(100, (stdout?.columns || 100) - 2) }, /* @__PURE__ */ React13.createElement(Box13, { marginBottom: 1 }, /* @__PURE__ */ React13.createElement(Text13, { color: "white", bold: true, underline: true }, "SESSION TELEMETRY")), /* @__PURE__ */ React13.createElement(Box13, { flexDirection: "column" }, /* @__PURE__ */ React13.createElement(Box13, null, /* @__PURE__ */ React13.createElement(Box13, { width: 25 }, /* @__PURE__ */ React13.createElement(Text13, { color: "blue" }, "Session Duration:")), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, formatMsDuration(Date.now() - SESSION_START_TIME))), /* @__PURE__ */ React13.createElement(Box13, null, /* @__PURE__ */ React13.createElement(Box13, { width: 25 }, /* @__PURE__ */ React13.createElement(Text13, { color: "blue" }, "Agent Interactions:")), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, sessionAgentCalls)), /* @__PURE__ */ React13.createElement(Box13, { marginLeft: 2 }, /* @__PURE__ */ React13.createElement(Box13, { width: 23 }, /* @__PURE__ */ React13.createElement(Text13, { color: "blue", dimColor: true }, "\xBB API Time:")), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, formatMsDuration(sessionApiTime))), /* @__PURE__ */ React13.createElement(Box13, { marginLeft: 2 }, /* @__PURE__ */ React13.createElement(Box13, { width: 23 }, /* @__PURE__ */ React13.createElement(Text13, { color: "blue", dimColor: true }, "\xBB Tool Time:")), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, formatMsDuration(sessionToolTime))), /* @__PURE__ */ React13.createElement(Box13, null, /* @__PURE__ */ React13.createElement(Box13, { width: 25 }, /* @__PURE__ */ React13.createElement(Text13, { color: "blue" }, "Background Tasks:")), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, sessionBackgroundCalls)), /* @__PURE__ */ React13.createElement(Box13, null, /* @__PURE__ */ React13.createElement(Box13, { width: 25 }, /* @__PURE__ */ React13.createElement(Text13, { color: "blue" }, "Tokens Consumed:")), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, formatTokens(sessionTotalTokens))), /* @__PURE__ */ React13.createElement(Box13, null, /* @__PURE__ */ React13.createElement(Box13, { width: 25 }, /* @__PURE__ */ React13.createElement(Text13, { color: "blue" }, "Images Made:")), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, sessionImageCount || 0)), /* @__PURE__ */ React13.createElement(Box13, null, /* @__PURE__ */ React13.createElement(Box13, { width: 25 }, /* @__PURE__ */ React13.createElement(Text13, { color: "blue" }, "Image Credits:")), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, Number(((sessionImageCredits || 0) * 1e3).toFixed(0)), " credits")), /* @__PURE__ */ React13.createElement(Box13, null, /* @__PURE__ */ React13.createElement(Box13, { width: 25 }, /* @__PURE__ */ React13.createElement(Text13, { color: "blue" }, "Code Changes (Sess):")), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, /* @__PURE__ */ React13.createElement(Text13, { color: "green" }, "+", linesAdded), " ", /* @__PURE__ */ React13.createElement(Text13, { color: "red" }, "-", linesRemoved))), /* @__PURE__ */ React13.createElement(Box13, null, /* @__PURE__ */ React13.createElement(Box13, { width: 25 }, /* @__PURE__ */ React13.createElement(Text13, { color: "blue" }, "Tool Calls (Sess):")), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, sessionToolSuccess + sessionToolFailure + sessionToolDenied, " ( "), /* @__PURE__ */ React13.createElement(Text13, { color: "green" }, "\u2713 ", sessionToolSuccess), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, " "), /* @__PURE__ */ React13.createElement(Text13, { color: "yellow" }, "\u2298 ", sessionToolDenied), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, " "), /* @__PURE__ */ React13.createElement(Text13, { color: "red" }, "\u2715 ", sessionToolFailure), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, " )"))), /* @__PURE__ */ React13.createElement(Box13, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React13.createElement(Text13, { color: "white", bold: true, underline: true }, "DAILY USAGE TRACKER"), /* @__PURE__ */ React13.createElement(Box13, { marginTop: 1 }, /* @__PURE__ */ React13.createElement(Box13, { width: 25 }, /* @__PURE__ */ React13.createElement(Text13, { color: "blue" }, "Wall Time Today:")), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, formatDuration(dailyUsage?.duration || 0))), /* @__PURE__ */ React13.createElement(Box13, null, /* @__PURE__ */ React13.createElement(Box13, { width: 25 }, /* @__PURE__ */ React13.createElement(Text13, { color: "blue" }, "Agent Interactions:")), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, dailyUsage?.agent || 0)), /* @__PURE__ */ React13.createElement(Box13, null, /* @__PURE__ */ React13.createElement(Box13, { width: 25 }, /* @__PURE__ */ React13.createElement(Text13, { color: "blue" }, "Background Tasks:")), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, dailyUsage?.background || 0)), /* @__PURE__ */ React13.createElement(Box13, null, /* @__PURE__ */ React13.createElement(Box13, { width: 25 }, /* @__PURE__ */ React13.createElement(Text13, { color: "blue" }, "Tokens Used Today:")), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, formatTokens(dailyUsage?.tokens || 0))), /* @__PURE__ */ React13.createElement(Box13, null, /* @__PURE__ */ React13.createElement(Box13, { width: 25 }, /* @__PURE__ */ React13.createElement(Text13, { color: "blue" }, "Images Made Today:")), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, dailyUsage?.imageCalls?.length || 0)), /* @__PURE__ */ React13.createElement(Box13, null, /* @__PURE__ */ React13.createElement(Box13, { width: 25 }, /* @__PURE__ */ React13.createElement(Text13, { color: "blue" }, "Image Credits Today:")), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, Number(((dailyUsage?.imageCalls?.reduce((sum, c) => sum + c.cost, 0) || 0) * 1e3).toFixed(0)), " credits")), /* @__PURE__ */ React13.createElement(Box13, null, /* @__PURE__ */ React13.createElement(Box13, { width: 25 }, /* @__PURE__ */ React13.createElement(Text13, { color: "blue" }, "Code Changes Today:")), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, /* @__PURE__ */ React13.createElement(Text13, { color: "green" }, "+", dailyUsage?.linesAdded || 0), " ", /* @__PURE__ */ React13.createElement(Text13, { color: "red" }, "-", dailyUsage?.linesRemoved || 0))), /* @__PURE__ */ React13.createElement(Box13, null, /* @__PURE__ */ React13.createElement(Box13, { width: 25 }, /* @__PURE__ */ React13.createElement(Text13, { color: "blue" }, "Tool Calls Today:")), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, (dailyUsage?.toolSuccess || 0) + (dailyUsage?.toolFailure || 0) + (dailyUsage?.toolDenied || 0), " ( "), /* @__PURE__ */ React13.createElement(Text13, { color: "green" }, "\u2713 ", dailyUsage?.toolSuccess || 0), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, " "), /* @__PURE__ */ React13.createElement(Text13, { color: "yellow" }, "\u2298 ", dailyUsage?.toolDenied || 0), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, " "), /* @__PURE__ */ React13.createElement(Text13, { color: "red" }, "\u2715 ", dailyUsage?.toolFailure || 0), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, " )"))), /* @__PURE__ */ React13.createElement(Text13, { dimColor: true, marginTop: 1, italic: true }, "(Press ESC to return to chat)"));
|
|
7725
8092
|
case "autoExecDanger":
|
|
7726
|
-
return /* @__PURE__ */
|
|
8093
|
+
return /* @__PURE__ */ React13.createElement(Box13, { flexDirection: "column", borderStyle: "round", borderColor: "yellow", paddingX: 2, paddingY: 1, width: "100%" }, /* @__PURE__ */ React13.createElement(Text13, { color: "yellow", bold: true, underline: true }, "\u26A0\uFE0F SECURITY WARNING: AUTO EXECUTE MODE"), /* @__PURE__ */ React13.createElement(Text13, { marginTop: 1 }, "Turning this ON allows the agent to execute terminal commands automatically without requiring your approval for each step."), /* @__PURE__ */ React13.createElement(Text13, { marginTop: 1, color: "yellow" }, "RISKS INVOLVED:"), /* @__PURE__ */ React13.createElement(Text13, null, "\u2022 The agent may execute destructive commands (rm -rf, etc.) by mistake."), /* @__PURE__ */ React13.createElement(Text13, null, "\u2022 Unintended system changes if the agent hallucinates a path or command."), /* @__PURE__ */ React13.createElement(Text13, null, "\u2022 Reduced control over the agent's step-by-step decision making."), /* @__PURE__ */ React13.createElement(Box13, { marginTop: 1 }, /* @__PURE__ */ React13.createElement(
|
|
7727
8094
|
CommandMenu,
|
|
7728
8095
|
{
|
|
7729
8096
|
title: "Confirm Intent",
|
|
@@ -7740,7 +8107,7 @@ Selection: ${val}`,
|
|
|
7740
8107
|
}
|
|
7741
8108
|
)));
|
|
7742
8109
|
case "externalDanger":
|
|
7743
|
-
return /* @__PURE__ */
|
|
8110
|
+
return /* @__PURE__ */ React13.createElement(Box13, { flexDirection: "column", borderStyle: "round", borderColor: "red", paddingX: 2, paddingY: 1, width: "100%" }, /* @__PURE__ */ React13.createElement(Text13, { color: "red", bold: true, underline: true }, "\u26A0\uFE0F SECURITY WARNING: EXTERNAL WORKSPACE ACCESS"), /* @__PURE__ */ React13.createElement(Text13, { marginTop: 1 }, "Turning this ON allows the agent to execute tools (Read/Write/Exec) outside of the current active workspace directory."), /* @__PURE__ */ React13.createElement(Text13, { marginTop: 1, color: "yellow" }, "RISKS INVOLVED:"), /* @__PURE__ */ React13.createElement(Text13, null, "\u2022 Access to sensitive system files (SSH keys, Browser data, etc.)"), /* @__PURE__ */ React13.createElement(Text13, null, "\u2022 Potential for accidental or malicious deletion of OS-critical files."), /* @__PURE__ */ React13.createElement(Text13, null, "\u2022 Unauthorized script execution across your entire file system."), /* @__PURE__ */ React13.createElement(Box13, { marginTop: 1 }, /* @__PURE__ */ React13.createElement(
|
|
7744
8111
|
CommandMenu,
|
|
7745
8112
|
{
|
|
7746
8113
|
title: "Confirm Intent",
|
|
@@ -7757,7 +8124,7 @@ Selection: ${val}`,
|
|
|
7757
8124
|
}
|
|
7758
8125
|
)));
|
|
7759
8126
|
case "doubleDanger":
|
|
7760
|
-
return /* @__PURE__ */
|
|
8127
|
+
return /* @__PURE__ */ React13.createElement(Box13, { flexDirection: "column", borderStyle: "round", borderColor: "red", paddingX: 2, paddingY: 1, width: "100%" }, /* @__PURE__ */ React13.createElement(Text13, { color: "red", bold: true, underline: true }, "\u26D4 CRITICAL SECURITY WARNING: COMBINED SYSTEM RISK"), /* @__PURE__ */ React13.createElement(Text13, { marginTop: 1 }, "You are attempting to enable BOTH [Auto Execute] and [External Workspace Access] simultaneously."), /* @__PURE__ */ React13.createElement(Text13, { marginTop: 1, color: "red", bold: true }, "THIS IS NOT RECOMMENDED."), /* @__PURE__ */ React13.createElement(Text13, { marginTop: 1, color: "yellow" }, "THE CRITICAL RISK:"), /* @__PURE__ */ React13.createElement(Text13, null, "The agent will have the power to execute any command across your entire system WITHOUT your approval or supervision."), /* @__PURE__ */ React13.createElement(Text13, { color: "red", italic: true, marginTop: 1 }, "A single hallucination or error could result in full system wipe or data theft."), /* @__PURE__ */ React13.createElement(Box13, { marginTop: 1 }, /* @__PURE__ */ React13.createElement(
|
|
7761
8128
|
CommandMenu,
|
|
7762
8129
|
{
|
|
7763
8130
|
title: "Final Confirmation",
|
|
@@ -7774,7 +8141,7 @@ Selection: ${val}`,
|
|
|
7774
8141
|
}
|
|
7775
8142
|
)));
|
|
7776
8143
|
case "key":
|
|
7777
|
-
return /* @__PURE__ */
|
|
8144
|
+
return /* @__PURE__ */ React13.createElement(
|
|
7778
8145
|
CommandMenu,
|
|
7779
8146
|
{
|
|
7780
8147
|
title: "\u{1F511} API KEY MANAGEMENT",
|
|
@@ -7798,10 +8165,10 @@ Selection: ${val}`,
|
|
|
7798
8165
|
}
|
|
7799
8166
|
);
|
|
7800
8167
|
case "deleteKey":
|
|
7801
|
-
return /* @__PURE__ */
|
|
8168
|
+
return /* @__PURE__ */ React13.createElement(Box13, { flexDirection: "column", borderStyle: "round", borderColor: "red", paddingX: 2, paddingY: 1 }, (() => {
|
|
7802
8169
|
const s = emojiSpace(2);
|
|
7803
|
-
return /* @__PURE__ */
|
|
7804
|
-
})(), /* @__PURE__ */
|
|
8170
|
+
return /* @__PURE__ */ React13.createElement(Text13, { color: "red", bold: true }, "\u26D4", s, "DANGER: PURGE API KEY");
|
|
8171
|
+
})(), /* @__PURE__ */ React13.createElement(Text13, { marginTop: 1 }, "This will permanently delete the saved API key from the project vault. You will need to enter it again to use Flux."), /* @__PURE__ */ React13.createElement(Box13, { marginTop: 1 }, /* @__PURE__ */ React13.createElement(
|
|
7805
8172
|
CommandMenu,
|
|
7806
8173
|
{
|
|
7807
8174
|
title: "Are you absolutely sure?",
|
|
@@ -7825,7 +8192,7 @@ Selection: ${val}`,
|
|
|
7825
8192
|
case "exit":
|
|
7826
8193
|
return null;
|
|
7827
8194
|
case "ask":
|
|
7828
|
-
return /* @__PURE__ */
|
|
8195
|
+
return /* @__PURE__ */ React13.createElement(Box13, { width: "100%" }, /* @__PURE__ */ React13.createElement(
|
|
7829
8196
|
AskUserModal_default,
|
|
7830
8197
|
{
|
|
7831
8198
|
question: pendingAsk?.question,
|
|
@@ -7840,7 +8207,7 @@ Selection: ${val}`,
|
|
|
7840
8207
|
}
|
|
7841
8208
|
));
|
|
7842
8209
|
case "revert":
|
|
7843
|
-
return /* @__PURE__ */
|
|
8210
|
+
return /* @__PURE__ */ React13.createElement(Box13, { width: "100%", alignItems: "center", justifyContent: "center" }, /* @__PURE__ */ React13.createElement(
|
|
7844
8211
|
RevertModal,
|
|
7845
8212
|
{
|
|
7846
8213
|
prompts: recentPrompts,
|
|
@@ -7894,7 +8261,7 @@ Selection: ${val}`,
|
|
|
7894
8261
|
}
|
|
7895
8262
|
));
|
|
7896
8263
|
case "resume":
|
|
7897
|
-
return /* @__PURE__ */
|
|
8264
|
+
return /* @__PURE__ */ React13.createElement(Box13, { width: "100%", alignItems: "center", justifyContent: "center" }, /* @__PURE__ */ React13.createElement(
|
|
7898
8265
|
ResumeModal,
|
|
7899
8266
|
{
|
|
7900
8267
|
onSelect: async (id) => {
|
|
@@ -7924,9 +8291,9 @@ Selection: ${val}`,
|
|
|
7924
8291
|
}
|
|
7925
8292
|
));
|
|
7926
8293
|
case "memory":
|
|
7927
|
-
return /* @__PURE__ */
|
|
8294
|
+
return /* @__PURE__ */ React13.createElement(Box13, { width: "100%", alignItems: "center", justifyContent: "center" }, /* @__PURE__ */ React13.createElement(MemoryModal, { onClose: () => setActiveView("chat") }));
|
|
7928
8295
|
case "profile":
|
|
7929
|
-
return /* @__PURE__ */
|
|
8296
|
+
return /* @__PURE__ */ React13.createElement(
|
|
7930
8297
|
ProfileForm,
|
|
7931
8298
|
{
|
|
7932
8299
|
initialData: profileData,
|
|
@@ -7939,7 +8306,7 @@ Selection: ${val}`,
|
|
|
7939
8306
|
}
|
|
7940
8307
|
);
|
|
7941
8308
|
case "resolution":
|
|
7942
|
-
return /* @__PURE__ */
|
|
8309
|
+
return /* @__PURE__ */ React13.createElement(Box13, { width: "100%", alignItems: "center", justifyContent: "center" }, /* @__PURE__ */ React13.createElement(
|
|
7943
8310
|
ResolutionModal,
|
|
7944
8311
|
{
|
|
7945
8312
|
data: resolutionData,
|
|
@@ -7958,15 +8325,15 @@ Selection: ${val}`,
|
|
|
7958
8325
|
}
|
|
7959
8326
|
));
|
|
7960
8327
|
case "approval":
|
|
7961
|
-
return /* @__PURE__ */
|
|
8328
|
+
return /* @__PURE__ */ React13.createElement(Box13, { flexDirection: "column", borderStyle: "round", borderColor: "yellow", paddingX: 2, paddingY: 1, width: "100%" }, /* @__PURE__ */ React13.createElement(Text13, { color: "yellow", bold: true, underline: true }, "\u{1F510} SECURITY GATE: FILE WRITE PERMISSION"), /* @__PURE__ */ React13.createElement(Text13, { marginTop: 1 }, "The agent is attempting to modify: ", /* @__PURE__ */ React13.createElement(Text13, { color: "cyan" }, parseArgs(pendingApproval?.args || "{}").path || "Unknown File")), /* @__PURE__ */ React13.createElement(Box13, { marginTop: 1, borderStyle: "single", borderColor: "#333", paddingX: 1, flexDirection: "column" }, /* @__PURE__ */ React13.createElement(Text13, { color: "gray" }, "--- PROPOSED CONTENT / DIFF ---"), (() => {
|
|
7962
8329
|
const args2 = parseArgs(pendingApproval?.args || "{}");
|
|
7963
8330
|
const oldVal = args2.TargetContent || args2.content_to_replace || args2.replaceContent || null;
|
|
7964
8331
|
const newVal = args2.content || args2.ReplacementContent || args2.content_to_add || args2.replacementContent || args2.newContent || null;
|
|
7965
8332
|
if (oldVal && newVal) {
|
|
7966
|
-
return /* @__PURE__ */
|
|
8333
|
+
return /* @__PURE__ */ React13.createElement(Box13, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React13.createElement(Box13, null, /* @__PURE__ */ React13.createElement(Text13, { color: "red", wrap: "anywhere", bold: true }, "- ", oldVal)), /* @__PURE__ */ React13.createElement(Box13, { marginTop: 1 }, /* @__PURE__ */ React13.createElement(Text13, { color: "green", wrap: "anywhere", bold: true }, "+ ", newVal.replace(/\[\/n\]?/g, "\\n"))));
|
|
7967
8334
|
}
|
|
7968
|
-
return /* @__PURE__ */
|
|
7969
|
-
})()), /* @__PURE__ */
|
|
8335
|
+
return /* @__PURE__ */ React13.createElement(Text13, { color: "white", wrap: "anywhere" }, (newVal ? newVal.replace(/\[\/n\]?/g, "\\n") : null) || "Updating file content...");
|
|
8336
|
+
})()), /* @__PURE__ */ React13.createElement(Box13, { marginTop: 1 }, /* @__PURE__ */ React13.createElement(
|
|
7970
8337
|
CommandMenu,
|
|
7971
8338
|
{
|
|
7972
8339
|
title: "Action Required",
|
|
@@ -7985,7 +8352,7 @@ Selection: ${val}`,
|
|
|
7985
8352
|
}
|
|
7986
8353
|
)));
|
|
7987
8354
|
case "updateManager":
|
|
7988
|
-
return /* @__PURE__ */
|
|
8355
|
+
return /* @__PURE__ */ React13.createElement(
|
|
7989
8356
|
CommandMenu,
|
|
7990
8357
|
{
|
|
7991
8358
|
title: "Select Preferred Update Manager",
|
|
@@ -8022,7 +8389,7 @@ Selection: ${val}`,
|
|
|
8022
8389
|
}
|
|
8023
8390
|
);
|
|
8024
8391
|
case "update":
|
|
8025
|
-
return /* @__PURE__ */
|
|
8392
|
+
return /* @__PURE__ */ React13.createElement(
|
|
8026
8393
|
UpdateProcessor_default,
|
|
8027
8394
|
{
|
|
8028
8395
|
latest: latestVer,
|
|
@@ -8048,7 +8415,7 @@ Selection: ${val}`,
|
|
|
8048
8415
|
}
|
|
8049
8416
|
);
|
|
8050
8417
|
case "terminalApproval":
|
|
8051
|
-
return /* @__PURE__ */
|
|
8418
|
+
return /* @__PURE__ */ React13.createElement(Box13, { flexDirection: "column", borderStyle: "round", borderColor: "red", paddingX: 2, paddingY: 1, width: "100%" }, /* @__PURE__ */ React13.createElement(Text13, { color: "red", bold: true, underline: true }, "\u{1F510} SECURITY GATE: TERMINAL COMMAND OVERSIGHT"), /* @__PURE__ */ React13.createElement(Box13, { marginTop: 1 }, /* @__PURE__ */ React13.createElement(Text13, null, "Agent requested to run: ", /* @__PURE__ */ React13.createElement(Text13, { color: "yellow", bold: true }, parseArgs(pendingApproval?.args || "{}").command || "Unknown Command"))), /* @__PURE__ */ React13.createElement(Box13, { marginTop: 1 }, /* @__PURE__ */ React13.createElement(
|
|
8052
8419
|
CommandMenu,
|
|
8053
8420
|
{
|
|
8054
8421
|
title: "Risk Assessment Required",
|
|
@@ -8064,8 +8431,8 @@ Selection: ${val}`,
|
|
|
8064
8431
|
}
|
|
8065
8432
|
)));
|
|
8066
8433
|
default:
|
|
8067
|
-
return /* @__PURE__ */
|
|
8068
|
-
|
|
8434
|
+
return /* @__PURE__ */ React13.createElement(Box13, { flexDirection: "column", marginTop: 1, flexShrink: 0, width: "100%" }, /* @__PURE__ */ React13.createElement(Box13, { paddingX: 1, marginBottom: 0, justifyContent: "space-between", width: "100%" }, /* @__PURE__ */ React13.createElement(Box13, null, statusText ? /* @__PURE__ */ React13.createElement(Box13, null, isSpinnerActive && /* @__PURE__ */ React13.createElement(Text13, { color: "magenta" }, /* @__PURE__ */ React13.createElement(Spinner2, { type: "dots" })), /* @__PURE__ */ React13.createElement(Text13, { color: "magenta", bold: true, italic: true }, isSpinnerActive ? " " : "", statusText.toUpperCase())) : /* @__PURE__ */ React13.createElement(Text13, { color: "cyan", dimColor: true, italic: true }, "READY FOR COMMAND...")), /* @__PURE__ */ React13.createElement(Box13, null, /* @__PURE__ */ React13.createElement(Text13, { color: "gray", bold: true }, "[ "), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, tempModelOverride || activeModel), /* @__PURE__ */ React13.createElement(Text13, { color: "gray", bold: true }, " ]"))), /* @__PURE__ */ React13.createElement(
|
|
8435
|
+
Box13,
|
|
8069
8436
|
{
|
|
8070
8437
|
borderStyle: "round",
|
|
8071
8438
|
borderColor: isProcessing ? "magenta" : "cyan",
|
|
@@ -8073,7 +8440,7 @@ Selection: ${val}`,
|
|
|
8073
8440
|
paddingY: 0,
|
|
8074
8441
|
width: "100%"
|
|
8075
8442
|
},
|
|
8076
|
-
/* @__PURE__ */
|
|
8443
|
+
/* @__PURE__ */ React13.createElement(Box13, { flexDirection: "column", width: "100%" }, maxLines > 2 && !isExpanded ? /* @__PURE__ */ React13.createElement(Box13, { flexDirection: "row", width: "100%", paddingY: 0, height: 1, overflow: "hidden" }, /* @__PURE__ */ React13.createElement(Box13, { flexShrink: 0, width: 4 }, /* @__PURE__ */ React13.createElement(Text13, { color: "cyan", bold: true }, "\u{1F4A0} ")), /* @__PURE__ */ React13.createElement(Box13, { flexGrow: 1, flexDirection: "row" }, /* @__PURE__ */ React13.createElement(Box13, { flexShrink: 0 }, /* @__PURE__ */ React13.createElement(Text13, { color: "magenta", bold: true }, "[PASTED ", maxLines, " LINES]")), /* @__PURE__ */ React13.createElement(Box13, { flexGrow: 1, marginLeft: 1 }, /* @__PURE__ */ React13.createElement(
|
|
8077
8444
|
MultilineInput,
|
|
8078
8445
|
{
|
|
8079
8446
|
value: "",
|
|
@@ -8090,9 +8457,10 @@ Selection: ${val}`,
|
|
|
8090
8457
|
newline: (key) => key.return && key.shift || key.return && key.ctrl || key.return && key.leftAlt || key.return && key.rightAlt
|
|
8091
8458
|
}
|
|
8092
8459
|
}
|
|
8093
|
-
)))) : /* @__PURE__ */
|
|
8460
|
+
)))) : /* @__PURE__ */ React13.createElement(Box13, { flexDirection: "row", width: "100%", paddingY: 0 }, /* @__PURE__ */ React13.createElement(Box13, { flexShrink: 0, width: 4 }, /* @__PURE__ */ React13.createElement(Text13, { color: isProcessing ? "magenta" : "cyan", bold: true }, isProcessing ? "\u2726 " : "\u{1F4A0} ")), /* @__PURE__ */ React13.createElement(Box13, { flexGrow: 1 }, /* @__PURE__ */ React13.createElement(Box13, { flexGrow: 1, position: "relative" }, input === "" && /* @__PURE__ */ React13.createElement(Box13, { position: "absolute", paddingLeft: 0 }, activeCommand && !isTerminalFocused ? /* @__PURE__ */ React13.createElement(Text13, { color: "yellow" }, " Press TAB to interact with terminal...") : activeCommand && isTerminalFocused ? /* @__PURE__ */ React13.createElement(Text13, { color: "yellow", bold: true }, " [ TERMINAL FOCUSED ] Type to interact, press TAB to exit...") : escPressCount === 1 ? /* @__PURE__ */ React13.createElement(Text13, { color: "cyan", bold: true }, " Press ESC again to revert codebase to checkpoint...") : /* @__PURE__ */ React13.createElement(Text13, { color: "gray" }, escPressed ? " Press ESC again to cancel the request." : !isProcessing ? ` Send message or /cmd... (${terminalEnv.shortcut} for newline)` : " Enter a prompt to steer the agent.")), /* @__PURE__ */ React13.createElement(
|
|
8094
8461
|
MultilineInput,
|
|
8095
8462
|
{
|
|
8463
|
+
key: `input-${inputKey}`,
|
|
8096
8464
|
focus: !isTerminalFocused,
|
|
8097
8465
|
value: input,
|
|
8098
8466
|
onChange: (val) => {
|
|
@@ -8111,14 +8479,14 @@ Selection: ${val}`,
|
|
|
8111
8479
|
));
|
|
8112
8480
|
}
|
|
8113
8481
|
};
|
|
8114
|
-
return /* @__PURE__ */
|
|
8482
|
+
return /* @__PURE__ */ React13.createElement(Box13, { flexDirection: "column", width: "100%" }, /* @__PURE__ */ React13.createElement(Box13, { flexDirection: "column", width: "100%", flexGrow: 1 }, windowedHistory.items.map((msg, idx) => /* @__PURE__ */ React13.createElement(MessageItem, { key: msg.id || idx, msg, showFullThinking, columns: stdout?.columns || 80 }))), /* @__PURE__ */ React13.createElement(Box13, { flexDirection: "column", padding: 1, width: "100%" }, (activeView === "chat" || ["ask", "approval", "terminalApproval"].includes(activeView)) && /* @__PURE__ */ React13.createElement(Box13, { flexDirection: "column", width: "100%" }, /* @__PURE__ */ React13.createElement(
|
|
8115
8483
|
ChatLayout_default,
|
|
8116
8484
|
{
|
|
8117
8485
|
messages: messages.slice(completedIndex),
|
|
8118
8486
|
showFullThinking,
|
|
8119
8487
|
columns: Math.max(20, (stdout?.columns || 80) - 1)
|
|
8120
8488
|
}
|
|
8121
|
-
), activeCommand && /* @__PURE__ */
|
|
8489
|
+
), activeCommand && /* @__PURE__ */ React13.createElement(Box13, { marginTop: 1 }, /* @__PURE__ */ React13.createElement(TerminalBox, { command: activeCommand, output: execOutput, isFocused: isTerminalFocused }))), isInitializing ? /* @__PURE__ */ React13.createElement(Box13, { borderStyle: "double", borderColor: "magenta", padding: 1, flexShrink: 0 }, /* @__PURE__ */ React13.createElement(Text13, { color: "magenta" }, "\u{1F30A} Starting Flux Flow...")) : !apiKey ? /* @__PURE__ */ React13.createElement(Box13, { borderStyle: "round", borderColor: "gray", padding: 0, flexDirection: "column", flexShrink: 0, width: "100%" }, /* @__PURE__ */ React13.createElement(Box13, { paddingX: 1, marginBottom: 1 }, /* @__PURE__ */ React13.createElement(Text13, { color: "yellow", bold: true }, "\u{1F511}", emojiSpace(2), "API KEY REQUIRED")), /* @__PURE__ */ React13.createElement(Box13, { paddingX: 1, flexDirection: "column" }, /* @__PURE__ */ React13.createElement(Text13, null, "Please enter your Gemini API Key to initialize the agent."), /* @__PURE__ */ React13.createElement(Box13, { marginTop: 1 }, /* @__PURE__ */ React13.createElement(Text13, { color: "cyan", bold: true }, "\u{1F4A0} "), /* @__PURE__ */ React13.createElement(
|
|
8122
8490
|
TextInput4,
|
|
8123
8491
|
{
|
|
8124
8492
|
value: tempKey,
|
|
@@ -8126,7 +8494,7 @@ Selection: ${val}`,
|
|
|
8126
8494
|
onSubmit: handleSetup,
|
|
8127
8495
|
mask: "*"
|
|
8128
8496
|
}
|
|
8129
|
-
))), /* @__PURE__ */
|
|
8497
|
+
))), /* @__PURE__ */ React13.createElement(Box13, { paddingX: 1, marginTop: 1 }, /* @__PURE__ */ React13.createElement(Text13, { color: "gray", dimColor: true, italic: true }, "(Press Enter to confirm and initialize)"))) : renderActiveView(), confirmExit && /* @__PURE__ */ React13.createElement(Box13, { borderStyle: "round", borderColor: "red", paddingX: 2, marginY: 0, width: "100%" }, /* @__PURE__ */ React13.createElement(Text13, { color: "red", bold: true }, "\u{1F534} EXIT CONFIRMATION: "), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, "Press "), /* @__PURE__ */ React13.createElement(Text13, { color: "red", bold: true }, "CTRL + C"), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, " again to exit (", exitCountdown, "s). Press "), /* @__PURE__ */ React13.createElement(Text13, { color: "cyan", bold: true }, "ESC"), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, " to cancel.")), /* @__PURE__ */ React13.createElement(Box13, { flexShrink: 0, width: "100%" }, /* @__PURE__ */ React13.createElement(
|
|
8130
8498
|
StatusBar_default,
|
|
8131
8499
|
{
|
|
8132
8500
|
mode,
|
|
@@ -8143,14 +8511,14 @@ Selection: ${val}`,
|
|
|
8143
8511
|
const agentActiveMs = sessionApiTime + sessionToolTime;
|
|
8144
8512
|
const apiPercent = agentActiveMs > 0 ? (sessionApiTime / agentActiveMs * 100).toFixed(1) : "0.0";
|
|
8145
8513
|
const toolPercent = agentActiveMs > 0 ? (sessionToolTime / agentActiveMs * 100).toFixed(1) : "0.0";
|
|
8146
|
-
return /* @__PURE__ */
|
|
8514
|
+
return /* @__PURE__ */ React13.createElement(Box13, { flexDirection: "column", borderStyle: "round", paddingX: 3, paddingY: 1, borderColor: "red", width: Math.min(100, (stdout?.columns || 100) - 2), marginTop: 0, marginBottom: 1 }, /* @__PURE__ */ React13.createElement(Box13, { marginBottom: 1 }, /* @__PURE__ */ React13.createElement(Text13, { color: "cyan", bold: true }, "Agent powering down. ", /* @__PURE__ */ React13.createElement(Text13, { color: "magenta" }, "Goodbye!"))), /* @__PURE__ */ React13.createElement(Box13, { flexDirection: "column" }, /* @__PURE__ */ React13.createElement(Text13, { color: "white", bold: true, underline: true }, "Interaction Summary"), /* @__PURE__ */ React13.createElement(Box13, { marginTop: 1 }, /* @__PURE__ */ React13.createElement(Box13, { width: 20 }, /* @__PURE__ */ React13.createElement(Text13, { color: "blue" }, "Session ID:")), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, chatId)), /* @__PURE__ */ React13.createElement(Box13, null, /* @__PURE__ */ React13.createElement(Box13, { width: 20 }, /* @__PURE__ */ React13.createElement(Text13, { color: "blue" }, "Tool Calls:")), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, sessionToolSuccess + sessionToolFailure + sessionToolDenied, " ( ", /* @__PURE__ */ React13.createElement(Text13, { color: "green" }, "\u2713 ", sessionToolSuccess), " ", /* @__PURE__ */ React13.createElement(Text13, { color: "yellow" }, "\u2298 ", sessionToolDenied), " ", /* @__PURE__ */ React13.createElement(Text13, { color: "red" }, "\u2715 ", sessionToolFailure), " )")), /* @__PURE__ */ React13.createElement(Box13, null, /* @__PURE__ */ React13.createElement(Box13, { width: 20 }, /* @__PURE__ */ React13.createElement(Text13, { color: "blue" }, "Success Rate:")), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, successRate, "%")), /* @__PURE__ */ React13.createElement(Box13, null, /* @__PURE__ */ React13.createElement(Box13, { width: 20 }, /* @__PURE__ */ React13.createElement(Text13, { color: "blue" }, "Code Changes:")), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, /* @__PURE__ */ React13.createElement(Text13, { color: "green" }, "+", linesAdded), " ", /* @__PURE__ */ React13.createElement(Text13, { color: "red" }, "-", linesRemoved))), /* @__PURE__ */ React13.createElement(Box13, null, /* @__PURE__ */ React13.createElement(Box13, { width: 20 }, /* @__PURE__ */ React13.createElement(Text13, { color: "blue" }, "Tokens Consumed:")), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, formatTokens(sessionTotalTokens))), /* @__PURE__ */ React13.createElement(Box13, null, /* @__PURE__ */ React13.createElement(Box13, { width: 20 }, /* @__PURE__ */ React13.createElement(Text13, { color: "blue" }, "Images Made:")), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, sessionImageCount || 0)), /* @__PURE__ */ React13.createElement(Box13, null, /* @__PURE__ */ React13.createElement(Box13, { width: 20 }, /* @__PURE__ */ React13.createElement(Text13, { color: "blue" }, "Image Credits:")), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, Number(((sessionImageCredits || 0) * 1e3).toFixed(0)), " credits"))), /* @__PURE__ */ React13.createElement(Box13, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React13.createElement(Text13, { color: "white", bold: true, underline: true }, "Performance"), /* @__PURE__ */ React13.createElement(Box13, { marginTop: 1 }, /* @__PURE__ */ React13.createElement(Box13, { width: 20 }, /* @__PURE__ */ React13.createElement(Text13, { color: "blue" }, "Wall Time:")), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, formatMsDuration(wallTimeMs))), /* @__PURE__ */ React13.createElement(Box13, null, /* @__PURE__ */ React13.createElement(Box13, { width: 20 }, /* @__PURE__ */ React13.createElement(Text13, { color: "blue" }, "Agent Active:")), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, formatMsDuration(agentActiveMs))), /* @__PURE__ */ React13.createElement(Box13, { marginLeft: 2 }, /* @__PURE__ */ React13.createElement(Box13, { width: 18 }, /* @__PURE__ */ React13.createElement(Text13, { color: "blue", dimColor: true }, "\xBB API Time:")), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, formatMsDuration(sessionApiTime), " (", apiPercent, "%)")), /* @__PURE__ */ React13.createElement(Box13, { marginLeft: 2 }, /* @__PURE__ */ React13.createElement(Box13, { width: 18 }, /* @__PURE__ */ React13.createElement(Text13, { color: "blue", dimColor: true }, "\xBB Tool Time:")), /* @__PURE__ */ React13.createElement(Text13, { color: "white" }, formatMsDuration(sessionToolTime), " (", toolPercent, "%)"))));
|
|
8147
8515
|
})(), suggestions.length > 0 && (() => {
|
|
8148
8516
|
const windowSize = 5;
|
|
8149
8517
|
const startIdx = Math.max(0, Math.min(selectedIndex - 2, suggestions.length - windowSize));
|
|
8150
8518
|
const visible = suggestions.slice(startIdx, startIdx + windowSize);
|
|
8151
8519
|
const remaining = suggestions.length - (startIdx + visible.length);
|
|
8152
|
-
return /* @__PURE__ */
|
|
8153
|
-
|
|
8520
|
+
return /* @__PURE__ */ React13.createElement(
|
|
8521
|
+
Box13,
|
|
8154
8522
|
{
|
|
8155
8523
|
flexDirection: "column",
|
|
8156
8524
|
borderStyle: "round",
|
|
@@ -8159,39 +8527,44 @@ Selection: ${val}`,
|
|
|
8159
8527
|
paddingY: 0,
|
|
8160
8528
|
width: "100%"
|
|
8161
8529
|
},
|
|
8162
|
-
/* @__PURE__ */
|
|
8530
|
+
/* @__PURE__ */ React13.createElement(Box13, { paddingX: 1, marginBottom: 0, justifyContent: "space-between", width: "100%" }, /* @__PURE__ */ React13.createElement(Text13, { color: "gray", bold: true, dimColor: true }, suggestions[0]?.cmd?.startsWith("@") ? "\u{1F4C1} FILE SUGGESTIONS" : "\u{1F50D} COMMAND SUGGESTIONS"), suggestions[0]?.cmd?.startsWith("@") && /* @__PURE__ */ React13.createElement(Text13, { color: "gray", dimColor: true, italic: true }, "(Use '#Lstart-Lend' to specify line numbers)")),
|
|
8163
8531
|
visible.map((s, i) => {
|
|
8164
8532
|
const actualIdx = startIdx + i;
|
|
8165
8533
|
const isActive = actualIdx === selectedIndex;
|
|
8166
8534
|
const isGemmaDisabled = s.cmd === "gemma-4-31b-it" && apiTier !== "Free";
|
|
8167
|
-
return /* @__PURE__ */
|
|
8168
|
-
|
|
8535
|
+
return /* @__PURE__ */ React13.createElement(
|
|
8536
|
+
Box13,
|
|
8169
8537
|
{
|
|
8170
8538
|
key: s.cmd,
|
|
8171
8539
|
flexDirection: "row",
|
|
8172
8540
|
backgroundColor: isActive ? "#2a2a2a" : void 0,
|
|
8173
8541
|
paddingX: 1
|
|
8174
8542
|
},
|
|
8175
|
-
/* @__PURE__ */
|
|
8176
|
-
/* @__PURE__ */
|
|
8177
|
-
|
|
8543
|
+
/* @__PURE__ */ React13.createElement(Box13, { width: 3 }, /* @__PURE__ */ React13.createElement(Text13, { color: isActive ? "cyan" : "gray", bold: isActive }, isActive ? " \u276F" : " ")),
|
|
8544
|
+
/* @__PURE__ */ React13.createElement(Box13, { width: 32 }, /* @__PURE__ */ React13.createElement(
|
|
8545
|
+
Text13,
|
|
8178
8546
|
{
|
|
8179
8547
|
color: isGemmaDisabled ? "gray" : isActive ? "yellow" : "white",
|
|
8180
8548
|
bold: isActive,
|
|
8181
8549
|
dimColor: isGemmaDisabled && !isActive
|
|
8182
8550
|
},
|
|
8183
|
-
s.cmd
|
|
8551
|
+
s.cmd?.startsWith("@[") && s.cmd?.endsWith("]") ? (() => {
|
|
8552
|
+
const pathPart = s.cmd.slice(2, -1);
|
|
8553
|
+
const parts = pathPart.split(/[/\\]/);
|
|
8554
|
+
return parts[parts.length - 1];
|
|
8555
|
+
})() : s.cmd
|
|
8184
8556
|
)),
|
|
8185
|
-
/* @__PURE__ */
|
|
8557
|
+
/* @__PURE__ */ React13.createElement(Box13, { flexGrow: 1 }, /* @__PURE__ */ React13.createElement(Text13, { color: "gray", italic: true, dimColor: !isActive }, s.desc))
|
|
8186
8558
|
);
|
|
8187
8559
|
}),
|
|
8188
|
-
suggestions.length > 5 && /* @__PURE__ */
|
|
8560
|
+
suggestions.length > 5 && /* @__PURE__ */ React13.createElement(Box13, { paddingX: 1, height: 1 }, remaining > 0 ? /* @__PURE__ */ React13.createElement(Text13, { color: "gray", dimColor: true, italic: true }, " ... (", remaining, " more commands available)") : /* @__PURE__ */ React13.createElement(Text13, { color: "gray", dimColor: true, italic: true }, " (End of list)"))
|
|
8189
8561
|
);
|
|
8190
8562
|
})()));
|
|
8191
8563
|
}
|
|
8192
8564
|
var SESSION_START_TIME, CHANGELOG_URL, linesAdded, linesRemoved, packageJsonPath, packageJson, versionFluxflow, updatedOn, ResolutionModal, FLUX_LOGO, parseAgentText, getProjectFiles;
|
|
8193
8565
|
var init_app = __esm({
|
|
8194
8566
|
"src/app.jsx"() {
|
|
8567
|
+
init_MultilineInput();
|
|
8195
8568
|
init_ChatLayout();
|
|
8196
8569
|
init_StatusBar();
|
|
8197
8570
|
init_CommandMenu();
|
|
@@ -8223,7 +8596,7 @@ var init_app = __esm({
|
|
|
8223
8596
|
packageJson = JSON.parse(fs18.readFileSync(packageJsonPath, "utf8"));
|
|
8224
8597
|
versionFluxflow = packageJson.version;
|
|
8225
8598
|
updatedOn = packageJson.date || "2026-05-20";
|
|
8226
|
-
ResolutionModal = ({ data, onResolve, onEdit }) => /* @__PURE__ */
|
|
8599
|
+
ResolutionModal = ({ data, onResolve, onEdit }) => /* @__PURE__ */ React13.createElement(Box13, { flexDirection: "column", borderStyle: "round", borderColor: "gray", padding: 0, width: "100%" }, /* @__PURE__ */ React13.createElement(Box13, { paddingX: 1 }, /* @__PURE__ */ React13.createElement(Text13, { color: "magenta", bold: true, underline: true }, "\u{1F7E3} STEERING HINT RESOLUTION")), /* @__PURE__ */ React13.createElement(Box13, { paddingX: 1, marginTop: 1 }, /* @__PURE__ */ React13.createElement(Text13, null, "The agent already finished the task before your hint was consumed.")), /* @__PURE__ */ React13.createElement(Box13, { marginTop: 1, backgroundColor: "#222", paddingX: 2, width: "100%" }, /* @__PURE__ */ React13.createElement(Text13, { italic: true, color: "gray" }, '"', data, '"')), /* @__PURE__ */ React13.createElement(Box13, { paddingX: 1, marginTop: 1 }, /* @__PURE__ */ React13.createElement(Text13, { color: "cyan" }, "How would you like to proceed?")), /* @__PURE__ */ React13.createElement(Box13, { marginTop: 0 }, /* @__PURE__ */ React13.createElement(
|
|
8227
8600
|
CommandMenu,
|
|
8228
8601
|
{
|
|
8229
8602
|
title: "Select Action",
|
|
@@ -8362,7 +8735,7 @@ if (isBundled && !process.execArgv.some((arg) => arg.includes("max-old-space-siz
|
|
|
8362
8735
|
], { stdio: "inherit" });
|
|
8363
8736
|
cp.on("exit", (code) => process.exit(code || 0));
|
|
8364
8737
|
} else {
|
|
8365
|
-
const { default:
|
|
8738
|
+
const { default: React14 } = await import("react");
|
|
8366
8739
|
const { render } = await import("ink");
|
|
8367
8740
|
const { default: App2 } = await Promise.resolve().then(() => (init_app(), app_exports));
|
|
8368
8741
|
process.env.NODE_NO_WARNINGS = "1";
|
|
@@ -8385,5 +8758,5 @@ if (isBundled && !process.execArgv.some((arg) => arg.includes("max-old-space-siz
|
|
|
8385
8758
|
console.warn = (...args) => !isNoise(args) && originalWarn(...args);
|
|
8386
8759
|
console.error = (...args) => !isNoise(args) && originalError(...args);
|
|
8387
8760
|
process.stdout.write("\x1Bc");
|
|
8388
|
-
render(/* @__PURE__ */
|
|
8761
|
+
render(/* @__PURE__ */ React14.createElement(App2, { args: process.argv.slice(2) }), { exitOnCtrlC: false });
|
|
8389
8762
|
}
|