@wrongstack/tui 0.5.3 → 0.5.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/index.js +53 -7
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -497,10 +497,21 @@ function History({ entries, streamingText, toolStream }) {
|
|
|
497
497
|
const toolTail = toolStream?.text ? tailForDisplay(toolStream.text, MAX_STREAM_DISPLAY_CHARS) : "";
|
|
498
498
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
499
499
|
/* @__PURE__ */ jsx(Static, { items: entries, children: (entry) => /* @__PURE__ */ jsx(Box, { marginBottom: entry.kind === "turn-summary" ? 1 : 0, children: /* @__PURE__ */ jsx(Entry, { entry, termWidth }) }, entry.id) }),
|
|
500
|
-
tail ? /* @__PURE__ */ jsxs(
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
500
|
+
tail ? /* @__PURE__ */ jsxs(
|
|
501
|
+
Box,
|
|
502
|
+
{
|
|
503
|
+
flexDirection: "column",
|
|
504
|
+
borderStyle: "round",
|
|
505
|
+
borderColor: "blue",
|
|
506
|
+
paddingX: 2,
|
|
507
|
+
paddingY: 0,
|
|
508
|
+
marginY: 1,
|
|
509
|
+
children: [
|
|
510
|
+
/* @__PURE__ */ jsx(Box, { flexDirection: "row", marginBottom: 1, children: /* @__PURE__ */ jsx(Text, { bold: true, color: "blue", children: " ASISTANT (streaming...) " }) }),
|
|
511
|
+
/* @__PURE__ */ jsx(Text, { children: tail })
|
|
512
|
+
]
|
|
513
|
+
}
|
|
514
|
+
) : null,
|
|
504
515
|
toolTail ? /* @__PURE__ */ jsx(
|
|
505
516
|
ToolStreamBox,
|
|
506
517
|
{
|
|
@@ -603,7 +614,21 @@ function Entry({
|
|
|
603
614
|
entry.queued ? /* @__PURE__ */ jsx(Text, { dimColor: true, children: " (queued)" }) : null
|
|
604
615
|
] });
|
|
605
616
|
case "assistant":
|
|
606
|
-
return /* @__PURE__ */
|
|
617
|
+
return /* @__PURE__ */ jsxs(
|
|
618
|
+
Box,
|
|
619
|
+
{
|
|
620
|
+
flexDirection: "column",
|
|
621
|
+
borderStyle: "round",
|
|
622
|
+
borderColor: "blue",
|
|
623
|
+
paddingX: 2,
|
|
624
|
+
paddingY: 0,
|
|
625
|
+
marginY: 1,
|
|
626
|
+
children: [
|
|
627
|
+
/* @__PURE__ */ jsx(Box, { flexDirection: "row", marginBottom: 1, children: /* @__PURE__ */ jsx(Text, { bold: true, color: "blue", children: " ASISTANT " }) }),
|
|
628
|
+
/* @__PURE__ */ jsx(Text, { children: renderMarkdownTables(entry.text, termWidth) })
|
|
629
|
+
]
|
|
630
|
+
}
|
|
631
|
+
);
|
|
607
632
|
case "tool": {
|
|
608
633
|
const argSummary = formatToolArgs(entry.name, entry.input);
|
|
609
634
|
const outLines = formatToolOutput(
|
|
@@ -2101,6 +2126,9 @@ function reducer(state, action) {
|
|
|
2101
2126
|
return { ...state, buffer: action.buffer, cursor: action.cursor };
|
|
2102
2127
|
case "addPlaceholder":
|
|
2103
2128
|
return { ...state, placeholders: [...state.placeholders, action.ph] };
|
|
2129
|
+
case "removeLastPlaceholder":
|
|
2130
|
+
if (state.placeholders.length === 0) return state;
|
|
2131
|
+
return { ...state, placeholders: state.placeholders.slice(0, -1) };
|
|
2104
2132
|
case "clearInput":
|
|
2105
2133
|
return {
|
|
2106
2134
|
...state,
|
|
@@ -3880,7 +3908,7 @@ function App({
|
|
|
3880
3908
|
if (cursor === 0) return;
|
|
3881
3909
|
const beforeCursor = buffer.slice(0, cursor);
|
|
3882
3910
|
const lastWordStart = beforeCursor.lastIndexOf(" ") + 1;
|
|
3883
|
-
const next3 =
|
|
3911
|
+
const next3 = beforeCursor.slice(0, lastWordStart) + buffer.slice(cursor);
|
|
3884
3912
|
setDraft(next3, lastWordStart);
|
|
3885
3913
|
} else {
|
|
3886
3914
|
if (cursor >= buffer.length) return;
|
|
@@ -3892,6 +3920,15 @@ function App({
|
|
|
3892
3920
|
}
|
|
3893
3921
|
return;
|
|
3894
3922
|
}
|
|
3923
|
+
if (key.backspace && cursor === buffer.length && state.placeholders.length > 0) {
|
|
3924
|
+
const BLOCK_PH_RE = /\[pasted(?: #\d+)?\]$/;
|
|
3925
|
+
if (BLOCK_PH_RE.test(buffer)) {
|
|
3926
|
+
const newBuffer = buffer.replace(BLOCK_PH_RE, "").replace(/\s+$/, "");
|
|
3927
|
+
dispatch({ type: "removeLastPlaceholder" });
|
|
3928
|
+
setDraft(newBuffer, newBuffer.length);
|
|
3929
|
+
return;
|
|
3930
|
+
}
|
|
3931
|
+
}
|
|
3895
3932
|
if (cursor === 0) return;
|
|
3896
3933
|
const next2 = buffer.slice(0, cursor - 1) + buffer.slice(cursor);
|
|
3897
3934
|
setDraft(next2, cursor - 1);
|
|
@@ -3968,19 +4005,28 @@ function App({
|
|
|
3968
4005
|
cleanInput = input.replace(/\x1b\[200~/g, "").replace(/\x1b\[201~/g, "");
|
|
3969
4006
|
bracketedPaste = true;
|
|
3970
4007
|
}
|
|
3971
|
-
if (bracketedPaste || cleanInput.length > PASTE_THRESHOLD_CHARS
|
|
4008
|
+
if (bracketedPaste || cleanInput.length > PASTE_THRESHOLD_CHARS) {
|
|
3972
4009
|
const builder = builderRef.current;
|
|
3973
4010
|
if (!builder) return;
|
|
3974
4011
|
const ph = await builder.appendPaste(cleanInput);
|
|
3975
4012
|
if (ph) {
|
|
3976
4013
|
const lineCount = cleanInput.split("\n").length;
|
|
3977
4014
|
dispatch({ type: "addPlaceholder", ph: `${ph} (${lineCount} lines)` });
|
|
4015
|
+
} else if (cleanInput.includes("\n")) {
|
|
4016
|
+
const lineCount = cleanInput.split("\n").length;
|
|
4017
|
+
dispatch({ type: "addPlaceholder", ph: `[pasted] (${lineCount} lines)` });
|
|
3978
4018
|
} else {
|
|
3979
4019
|
const next2 = buffer.slice(0, cursor) + cleanInput + buffer.slice(cursor);
|
|
3980
4020
|
setDraft(next2, cursor + cleanInput.length);
|
|
3981
4021
|
}
|
|
3982
4022
|
return;
|
|
3983
4023
|
}
|
|
4024
|
+
if (cleanInput.includes("\n")) {
|
|
4025
|
+
const normalized = cleanInput.replace(/\r?\n/g, " ");
|
|
4026
|
+
const next2 = buffer.slice(0, cursor) + normalized + buffer.slice(cursor);
|
|
4027
|
+
setDraft(next2, cursor + normalized.length);
|
|
4028
|
+
return;
|
|
4029
|
+
}
|
|
3984
4030
|
const next = buffer.slice(0, cursor) + cleanInput + buffer.slice(cursor);
|
|
3985
4031
|
setDraft(next, cursor + cleanInput.length);
|
|
3986
4032
|
};
|