@robota-sdk/agent-cli 3.0.0-beta.36 → 3.0.0-beta.38
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/node/bin.cjs +86 -19
- package/dist/node/bin.js +1 -1
- package/dist/node/{chunk-ERF646KY.js → chunk-7C5IYOJG.js} +87 -20
- package/dist/node/index.cjs +86 -19
- package/dist/node/index.js +1 -1
- package/package.json +1 -1
package/dist/node/bin.cjs
CHANGED
|
@@ -1938,7 +1938,14 @@ function useAutocomplete(value, registry) {
|
|
|
1938
1938
|
}
|
|
1939
1939
|
};
|
|
1940
1940
|
}
|
|
1941
|
-
function InputArea({
|
|
1941
|
+
function InputArea({
|
|
1942
|
+
onSubmit,
|
|
1943
|
+
onCancelQueue,
|
|
1944
|
+
isDisabled,
|
|
1945
|
+
isAborting,
|
|
1946
|
+
pendingPrompt,
|
|
1947
|
+
registry
|
|
1948
|
+
}) {
|
|
1942
1949
|
const [value, setValue] = (0, import_react10.useState)("");
|
|
1943
1950
|
const pasteStore = (0, import_react10.useRef)(/* @__PURE__ */ new Map());
|
|
1944
1951
|
const pasteIdRef = (0, import_react10.useRef)(0);
|
|
@@ -2009,6 +2016,14 @@ function InputArea({ onSubmit, isDisabled, registry }) {
|
|
|
2009
2016
|
},
|
|
2010
2017
|
{ isActive: showPopup && !isDisabled }
|
|
2011
2018
|
);
|
|
2019
|
+
(0, import_ink7.useInput)(
|
|
2020
|
+
(_input, key) => {
|
|
2021
|
+
if ((key.backspace || key.delete) && pendingPrompt) {
|
|
2022
|
+
onCancelQueue?.();
|
|
2023
|
+
}
|
|
2024
|
+
},
|
|
2025
|
+
{ isActive: !!pendingPrompt }
|
|
2026
|
+
);
|
|
2012
2027
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_ink7.Box, { flexDirection: "column", children: [
|
|
2013
2028
|
showPopup && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2014
2029
|
SlashAutocomplete,
|
|
@@ -2019,19 +2034,33 @@ function InputArea({ onSubmit, isDisabled, registry }) {
|
|
|
2019
2034
|
isSubcommandMode
|
|
2020
2035
|
}
|
|
2021
2036
|
),
|
|
2022
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2037
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2038
|
+
import_ink7.Box,
|
|
2039
|
+
{
|
|
2040
|
+
borderStyle: "single",
|
|
2041
|
+
borderColor: isAborting ? "yellow" : pendingPrompt ? "cyan" : isDisabled ? "gray" : "green",
|
|
2042
|
+
paddingLeft: 1,
|
|
2043
|
+
children: isAborting ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ink7.Text, { color: "yellow", children: " Interrupting..." }) : pendingPrompt ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_ink7.Text, { color: "cyan", children: [
|
|
2044
|
+
" ",
|
|
2045
|
+
"Queued: ",
|
|
2046
|
+
pendingPrompt.length > 50 ? pendingPrompt.slice(0, 47) + "..." : pendingPrompt,
|
|
2047
|
+
" ",
|
|
2048
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ink7.Text, { dimColor: true, children: "(Backspace to cancel)" })
|
|
2049
|
+
] }) : isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(WaveText, { text: " Waiting for response... (ESC to interrupt)" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_ink7.Box, { children: [
|
|
2050
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ink7.Text, { color: "green", bold: true, children: "> " }),
|
|
2051
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2052
|
+
CjkTextInput,
|
|
2053
|
+
{
|
|
2054
|
+
value,
|
|
2055
|
+
onChange: setValue,
|
|
2056
|
+
onSubmit: handleSubmit,
|
|
2057
|
+
onPaste: handlePaste,
|
|
2058
|
+
placeholder: "Type a message or /help"
|
|
2059
|
+
}
|
|
2060
|
+
)
|
|
2061
|
+
] })
|
|
2062
|
+
}
|
|
2063
|
+
)
|
|
2035
2064
|
] });
|
|
2036
2065
|
}
|
|
2037
2066
|
|
|
@@ -2679,6 +2708,9 @@ function App(props) {
|
|
|
2679
2708
|
const pendingModelChangeRef = (0, import_react16.useRef)(null);
|
|
2680
2709
|
const [pendingModelId, setPendingModelId] = (0, import_react16.useState)(null);
|
|
2681
2710
|
const [showPluginTUI, setShowPluginTUI] = (0, import_react16.useState)(false);
|
|
2711
|
+
const [isAborting, setIsAborting] = (0, import_react16.useState)(false);
|
|
2712
|
+
const [pendingPrompt, setPendingPrompt] = (0, import_react16.useState)(null);
|
|
2713
|
+
const pendingPromptRef = (0, import_react16.useRef)(null);
|
|
2682
2714
|
const pluginCallbacks = usePluginCallbacks(props.cwd ?? process.cwd());
|
|
2683
2715
|
const handleSlashCommand = useSlashCommands(
|
|
2684
2716
|
session,
|
|
@@ -2691,7 +2723,7 @@ function App(props) {
|
|
|
2691
2723
|
pluginCallbacks,
|
|
2692
2724
|
setShowPluginTUI
|
|
2693
2725
|
);
|
|
2694
|
-
const
|
|
2726
|
+
const executePrompt = useSubmitHandler(
|
|
2695
2727
|
session,
|
|
2696
2728
|
addMessage,
|
|
2697
2729
|
handleSlashCommand,
|
|
@@ -2700,13 +2732,39 @@ function App(props) {
|
|
|
2700
2732
|
setContextState,
|
|
2701
2733
|
registry
|
|
2702
2734
|
);
|
|
2735
|
+
const handleSubmit = (0, import_react16.useCallback)(
|
|
2736
|
+
async (input) => {
|
|
2737
|
+
if (isThinking) {
|
|
2738
|
+
setPendingPrompt(input);
|
|
2739
|
+
pendingPromptRef.current = input;
|
|
2740
|
+
return;
|
|
2741
|
+
}
|
|
2742
|
+
await executePrompt(input);
|
|
2743
|
+
},
|
|
2744
|
+
[isThinking, executePrompt]
|
|
2745
|
+
);
|
|
2703
2746
|
(0, import_ink13.useInput)(
|
|
2704
2747
|
(_input, key) => {
|
|
2705
|
-
if (key.
|
|
2706
|
-
|
|
2748
|
+
if (key.escape && isThinking) {
|
|
2749
|
+
setIsAborting(true);
|
|
2750
|
+
setPendingPrompt(null);
|
|
2751
|
+
pendingPromptRef.current = null;
|
|
2752
|
+
session.abort();
|
|
2753
|
+
}
|
|
2707
2754
|
},
|
|
2708
2755
|
{ isActive: !permissionRequest && !showPluginTUI }
|
|
2709
2756
|
);
|
|
2757
|
+
(0, import_react16.useEffect)(() => {
|
|
2758
|
+
if (!isThinking) {
|
|
2759
|
+
setIsAborting(false);
|
|
2760
|
+
if (pendingPromptRef.current) {
|
|
2761
|
+
const prompt = pendingPromptRef.current;
|
|
2762
|
+
setPendingPrompt(null);
|
|
2763
|
+
pendingPromptRef.current = null;
|
|
2764
|
+
setTimeout(() => executePrompt(prompt), 0);
|
|
2765
|
+
}
|
|
2766
|
+
}
|
|
2767
|
+
}, [isThinking, pendingPrompt, executePrompt]);
|
|
2710
2768
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_ink13.Box, { flexDirection: "column", children: [
|
|
2711
2769
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_ink13.Box, { flexDirection: "column", paddingX: 1, marginBottom: 1, children: [
|
|
2712
2770
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_ink13.Text, { color: "cyan", bold: true, children: `
|
|
@@ -2781,7 +2839,13 @@ function App(props) {
|
|
|
2781
2839
|
InputArea,
|
|
2782
2840
|
{
|
|
2783
2841
|
onSubmit: handleSubmit,
|
|
2784
|
-
|
|
2842
|
+
onCancelQueue: () => {
|
|
2843
|
+
setPendingPrompt(null);
|
|
2844
|
+
pendingPromptRef.current = null;
|
|
2845
|
+
},
|
|
2846
|
+
isDisabled: !!permissionRequest || showPluginTUI || isThinking && !!pendingPrompt,
|
|
2847
|
+
isAborting,
|
|
2848
|
+
pendingPrompt,
|
|
2785
2849
|
registry
|
|
2786
2850
|
}
|
|
2787
2851
|
),
|
|
@@ -2804,12 +2868,15 @@ function renderApp(options) {
|
|
|
2804
2868
|
const instance = (0, import_ink14.render)(/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(App, { ...options }), {
|
|
2805
2869
|
exitOnCtrlC: true
|
|
2806
2870
|
});
|
|
2807
|
-
instance.waitUntilExit().
|
|
2871
|
+
instance.waitUntilExit().then(() => {
|
|
2872
|
+
process.exit(0);
|
|
2873
|
+
}).catch((err) => {
|
|
2808
2874
|
if (err) {
|
|
2809
2875
|
process.stderr.write(`
|
|
2810
2876
|
[EXIT ERROR] ${err}
|
|
2811
2877
|
`);
|
|
2812
2878
|
}
|
|
2879
|
+
process.exit(1);
|
|
2813
2880
|
});
|
|
2814
2881
|
}
|
|
2815
2882
|
|
package/dist/node/bin.js
CHANGED
|
@@ -149,7 +149,7 @@ var PrintTerminal = class {
|
|
|
149
149
|
import { render } from "ink";
|
|
150
150
|
|
|
151
151
|
// src/ui/App.tsx
|
|
152
|
-
import { useState as useState10, useRef as useRef8 } from "react";
|
|
152
|
+
import { useState as useState10, useRef as useRef8, useEffect as useEffect3, useCallback as useCallback10 } from "react";
|
|
153
153
|
import { Box as Box11, Text as Text13, useApp, useInput as useInput7 } from "ink";
|
|
154
154
|
import { getModelName } from "@robota-sdk/agent-core";
|
|
155
155
|
import { createSystemMessage as createSystemMessage3 } from "@robota-sdk/agent-core";
|
|
@@ -1935,7 +1935,14 @@ function useAutocomplete(value, registry) {
|
|
|
1935
1935
|
}
|
|
1936
1936
|
};
|
|
1937
1937
|
}
|
|
1938
|
-
function InputArea({
|
|
1938
|
+
function InputArea({
|
|
1939
|
+
onSubmit,
|
|
1940
|
+
onCancelQueue,
|
|
1941
|
+
isDisabled,
|
|
1942
|
+
isAborting,
|
|
1943
|
+
pendingPrompt,
|
|
1944
|
+
registry
|
|
1945
|
+
}) {
|
|
1939
1946
|
const [value, setValue] = useState5("");
|
|
1940
1947
|
const pasteStore = useRef4(/* @__PURE__ */ new Map());
|
|
1941
1948
|
const pasteIdRef = useRef4(0);
|
|
@@ -2006,6 +2013,14 @@ function InputArea({ onSubmit, isDisabled, registry }) {
|
|
|
2006
2013
|
},
|
|
2007
2014
|
{ isActive: showPopup && !isDisabled }
|
|
2008
2015
|
);
|
|
2016
|
+
useInput2(
|
|
2017
|
+
(_input, key) => {
|
|
2018
|
+
if ((key.backspace || key.delete) && pendingPrompt) {
|
|
2019
|
+
onCancelQueue?.();
|
|
2020
|
+
}
|
|
2021
|
+
},
|
|
2022
|
+
{ isActive: !!pendingPrompt }
|
|
2023
|
+
);
|
|
2009
2024
|
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
|
|
2010
2025
|
showPopup && /* @__PURE__ */ jsx6(
|
|
2011
2026
|
SlashAutocomplete,
|
|
@@ -2016,19 +2031,33 @@ function InputArea({ onSubmit, isDisabled, registry }) {
|
|
|
2016
2031
|
isSubcommandMode
|
|
2017
2032
|
}
|
|
2018
2033
|
),
|
|
2019
|
-
/* @__PURE__ */ jsx6(
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2034
|
+
/* @__PURE__ */ jsx6(
|
|
2035
|
+
Box5,
|
|
2036
|
+
{
|
|
2037
|
+
borderStyle: "single",
|
|
2038
|
+
borderColor: isAborting ? "yellow" : pendingPrompt ? "cyan" : isDisabled ? "gray" : "green",
|
|
2039
|
+
paddingLeft: 1,
|
|
2040
|
+
children: isAborting ? /* @__PURE__ */ jsx6(Text7, { color: "yellow", children: " Interrupting..." }) : pendingPrompt ? /* @__PURE__ */ jsxs5(Text7, { color: "cyan", children: [
|
|
2041
|
+
" ",
|
|
2042
|
+
"Queued: ",
|
|
2043
|
+
pendingPrompt.length > 50 ? pendingPrompt.slice(0, 47) + "..." : pendingPrompt,
|
|
2044
|
+
" ",
|
|
2045
|
+
/* @__PURE__ */ jsx6(Text7, { dimColor: true, children: "(Backspace to cancel)" })
|
|
2046
|
+
] }) : isDisabled ? /* @__PURE__ */ jsx6(WaveText, { text: " Waiting for response... (ESC to interrupt)" }) : /* @__PURE__ */ jsxs5(Box5, { children: [
|
|
2047
|
+
/* @__PURE__ */ jsx6(Text7, { color: "green", bold: true, children: "> " }),
|
|
2048
|
+
/* @__PURE__ */ jsx6(
|
|
2049
|
+
CjkTextInput,
|
|
2050
|
+
{
|
|
2051
|
+
value,
|
|
2052
|
+
onChange: setValue,
|
|
2053
|
+
onSubmit: handleSubmit,
|
|
2054
|
+
onPaste: handlePaste,
|
|
2055
|
+
placeholder: "Type a message or /help"
|
|
2056
|
+
}
|
|
2057
|
+
)
|
|
2058
|
+
] })
|
|
2059
|
+
}
|
|
2060
|
+
)
|
|
2032
2061
|
] });
|
|
2033
2062
|
}
|
|
2034
2063
|
|
|
@@ -2676,6 +2705,9 @@ function App(props) {
|
|
|
2676
2705
|
const pendingModelChangeRef = useRef8(null);
|
|
2677
2706
|
const [pendingModelId, setPendingModelId] = useState10(null);
|
|
2678
2707
|
const [showPluginTUI, setShowPluginTUI] = useState10(false);
|
|
2708
|
+
const [isAborting, setIsAborting] = useState10(false);
|
|
2709
|
+
const [pendingPrompt, setPendingPrompt] = useState10(null);
|
|
2710
|
+
const pendingPromptRef = useRef8(null);
|
|
2679
2711
|
const pluginCallbacks = usePluginCallbacks(props.cwd ?? process.cwd());
|
|
2680
2712
|
const handleSlashCommand = useSlashCommands(
|
|
2681
2713
|
session,
|
|
@@ -2688,7 +2720,7 @@ function App(props) {
|
|
|
2688
2720
|
pluginCallbacks,
|
|
2689
2721
|
setShowPluginTUI
|
|
2690
2722
|
);
|
|
2691
|
-
const
|
|
2723
|
+
const executePrompt = useSubmitHandler(
|
|
2692
2724
|
session,
|
|
2693
2725
|
addMessage,
|
|
2694
2726
|
handleSlashCommand,
|
|
@@ -2697,13 +2729,39 @@ function App(props) {
|
|
|
2697
2729
|
setContextState,
|
|
2698
2730
|
registry
|
|
2699
2731
|
);
|
|
2732
|
+
const handleSubmit = useCallback10(
|
|
2733
|
+
async (input) => {
|
|
2734
|
+
if (isThinking) {
|
|
2735
|
+
setPendingPrompt(input);
|
|
2736
|
+
pendingPromptRef.current = input;
|
|
2737
|
+
return;
|
|
2738
|
+
}
|
|
2739
|
+
await executePrompt(input);
|
|
2740
|
+
},
|
|
2741
|
+
[isThinking, executePrompt]
|
|
2742
|
+
);
|
|
2700
2743
|
useInput7(
|
|
2701
2744
|
(_input, key) => {
|
|
2702
|
-
if (key.
|
|
2703
|
-
|
|
2745
|
+
if (key.escape && isThinking) {
|
|
2746
|
+
setIsAborting(true);
|
|
2747
|
+
setPendingPrompt(null);
|
|
2748
|
+
pendingPromptRef.current = null;
|
|
2749
|
+
session.abort();
|
|
2750
|
+
}
|
|
2704
2751
|
},
|
|
2705
2752
|
{ isActive: !permissionRequest && !showPluginTUI }
|
|
2706
2753
|
);
|
|
2754
|
+
useEffect3(() => {
|
|
2755
|
+
if (!isThinking) {
|
|
2756
|
+
setIsAborting(false);
|
|
2757
|
+
if (pendingPromptRef.current) {
|
|
2758
|
+
const prompt = pendingPromptRef.current;
|
|
2759
|
+
setPendingPrompt(null);
|
|
2760
|
+
pendingPromptRef.current = null;
|
|
2761
|
+
setTimeout(() => executePrompt(prompt), 0);
|
|
2762
|
+
}
|
|
2763
|
+
}
|
|
2764
|
+
}, [isThinking, pendingPrompt, executePrompt]);
|
|
2707
2765
|
return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", children: [
|
|
2708
2766
|
/* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", paddingX: 1, marginBottom: 1, children: [
|
|
2709
2767
|
/* @__PURE__ */ jsx13(Text13, { color: "cyan", bold: true, children: `
|
|
@@ -2778,7 +2836,13 @@ function App(props) {
|
|
|
2778
2836
|
InputArea,
|
|
2779
2837
|
{
|
|
2780
2838
|
onSubmit: handleSubmit,
|
|
2781
|
-
|
|
2839
|
+
onCancelQueue: () => {
|
|
2840
|
+
setPendingPrompt(null);
|
|
2841
|
+
pendingPromptRef.current = null;
|
|
2842
|
+
},
|
|
2843
|
+
isDisabled: !!permissionRequest || showPluginTUI || isThinking && !!pendingPrompt,
|
|
2844
|
+
isAborting,
|
|
2845
|
+
pendingPrompt,
|
|
2782
2846
|
registry
|
|
2783
2847
|
}
|
|
2784
2848
|
),
|
|
@@ -2801,12 +2865,15 @@ function renderApp(options) {
|
|
|
2801
2865
|
const instance = render(/* @__PURE__ */ jsx14(App, { ...options }), {
|
|
2802
2866
|
exitOnCtrlC: true
|
|
2803
2867
|
});
|
|
2804
|
-
instance.waitUntilExit().
|
|
2868
|
+
instance.waitUntilExit().then(() => {
|
|
2869
|
+
process.exit(0);
|
|
2870
|
+
}).catch((err) => {
|
|
2805
2871
|
if (err) {
|
|
2806
2872
|
process.stderr.write(`
|
|
2807
2873
|
[EXIT ERROR] ${err}
|
|
2808
2874
|
`);
|
|
2809
2875
|
}
|
|
2876
|
+
process.exit(1);
|
|
2810
2877
|
});
|
|
2811
2878
|
}
|
|
2812
2879
|
|
package/dist/node/index.cjs
CHANGED
|
@@ -1954,7 +1954,14 @@ function useAutocomplete(value, registry) {
|
|
|
1954
1954
|
}
|
|
1955
1955
|
};
|
|
1956
1956
|
}
|
|
1957
|
-
function InputArea({
|
|
1957
|
+
function InputArea({
|
|
1958
|
+
onSubmit,
|
|
1959
|
+
onCancelQueue,
|
|
1960
|
+
isDisabled,
|
|
1961
|
+
isAborting,
|
|
1962
|
+
pendingPrompt,
|
|
1963
|
+
registry
|
|
1964
|
+
}) {
|
|
1958
1965
|
const [value, setValue] = (0, import_react10.useState)("");
|
|
1959
1966
|
const pasteStore = (0, import_react10.useRef)(/* @__PURE__ */ new Map());
|
|
1960
1967
|
const pasteIdRef = (0, import_react10.useRef)(0);
|
|
@@ -2025,6 +2032,14 @@ function InputArea({ onSubmit, isDisabled, registry }) {
|
|
|
2025
2032
|
},
|
|
2026
2033
|
{ isActive: showPopup && !isDisabled }
|
|
2027
2034
|
);
|
|
2035
|
+
(0, import_ink7.useInput)(
|
|
2036
|
+
(_input, key) => {
|
|
2037
|
+
if ((key.backspace || key.delete) && pendingPrompt) {
|
|
2038
|
+
onCancelQueue?.();
|
|
2039
|
+
}
|
|
2040
|
+
},
|
|
2041
|
+
{ isActive: !!pendingPrompt }
|
|
2042
|
+
);
|
|
2028
2043
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_ink7.Box, { flexDirection: "column", children: [
|
|
2029
2044
|
showPopup && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2030
2045
|
SlashAutocomplete,
|
|
@@ -2035,19 +2050,33 @@ function InputArea({ onSubmit, isDisabled, registry }) {
|
|
|
2035
2050
|
isSubcommandMode
|
|
2036
2051
|
}
|
|
2037
2052
|
),
|
|
2038
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2053
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2054
|
+
import_ink7.Box,
|
|
2055
|
+
{
|
|
2056
|
+
borderStyle: "single",
|
|
2057
|
+
borderColor: isAborting ? "yellow" : pendingPrompt ? "cyan" : isDisabled ? "gray" : "green",
|
|
2058
|
+
paddingLeft: 1,
|
|
2059
|
+
children: isAborting ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ink7.Text, { color: "yellow", children: " Interrupting..." }) : pendingPrompt ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_ink7.Text, { color: "cyan", children: [
|
|
2060
|
+
" ",
|
|
2061
|
+
"Queued: ",
|
|
2062
|
+
pendingPrompt.length > 50 ? pendingPrompt.slice(0, 47) + "..." : pendingPrompt,
|
|
2063
|
+
" ",
|
|
2064
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ink7.Text, { dimColor: true, children: "(Backspace to cancel)" })
|
|
2065
|
+
] }) : isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(WaveText, { text: " Waiting for response... (ESC to interrupt)" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_ink7.Box, { children: [
|
|
2066
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ink7.Text, { color: "green", bold: true, children: "> " }),
|
|
2067
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2068
|
+
CjkTextInput,
|
|
2069
|
+
{
|
|
2070
|
+
value,
|
|
2071
|
+
onChange: setValue,
|
|
2072
|
+
onSubmit: handleSubmit,
|
|
2073
|
+
onPaste: handlePaste,
|
|
2074
|
+
placeholder: "Type a message or /help"
|
|
2075
|
+
}
|
|
2076
|
+
)
|
|
2077
|
+
] })
|
|
2078
|
+
}
|
|
2079
|
+
)
|
|
2051
2080
|
] });
|
|
2052
2081
|
}
|
|
2053
2082
|
|
|
@@ -2695,6 +2724,9 @@ function App(props) {
|
|
|
2695
2724
|
const pendingModelChangeRef = (0, import_react16.useRef)(null);
|
|
2696
2725
|
const [pendingModelId, setPendingModelId] = (0, import_react16.useState)(null);
|
|
2697
2726
|
const [showPluginTUI, setShowPluginTUI] = (0, import_react16.useState)(false);
|
|
2727
|
+
const [isAborting, setIsAborting] = (0, import_react16.useState)(false);
|
|
2728
|
+
const [pendingPrompt, setPendingPrompt] = (0, import_react16.useState)(null);
|
|
2729
|
+
const pendingPromptRef = (0, import_react16.useRef)(null);
|
|
2698
2730
|
const pluginCallbacks = usePluginCallbacks(props.cwd ?? process.cwd());
|
|
2699
2731
|
const handleSlashCommand = useSlashCommands(
|
|
2700
2732
|
session,
|
|
@@ -2707,7 +2739,7 @@ function App(props) {
|
|
|
2707
2739
|
pluginCallbacks,
|
|
2708
2740
|
setShowPluginTUI
|
|
2709
2741
|
);
|
|
2710
|
-
const
|
|
2742
|
+
const executePrompt = useSubmitHandler(
|
|
2711
2743
|
session,
|
|
2712
2744
|
addMessage,
|
|
2713
2745
|
handleSlashCommand,
|
|
@@ -2716,13 +2748,39 @@ function App(props) {
|
|
|
2716
2748
|
setContextState,
|
|
2717
2749
|
registry
|
|
2718
2750
|
);
|
|
2751
|
+
const handleSubmit = (0, import_react16.useCallback)(
|
|
2752
|
+
async (input) => {
|
|
2753
|
+
if (isThinking) {
|
|
2754
|
+
setPendingPrompt(input);
|
|
2755
|
+
pendingPromptRef.current = input;
|
|
2756
|
+
return;
|
|
2757
|
+
}
|
|
2758
|
+
await executePrompt(input);
|
|
2759
|
+
},
|
|
2760
|
+
[isThinking, executePrompt]
|
|
2761
|
+
);
|
|
2719
2762
|
(0, import_ink13.useInput)(
|
|
2720
2763
|
(_input, key) => {
|
|
2721
|
-
if (key.
|
|
2722
|
-
|
|
2764
|
+
if (key.escape && isThinking) {
|
|
2765
|
+
setIsAborting(true);
|
|
2766
|
+
setPendingPrompt(null);
|
|
2767
|
+
pendingPromptRef.current = null;
|
|
2768
|
+
session.abort();
|
|
2769
|
+
}
|
|
2723
2770
|
},
|
|
2724
2771
|
{ isActive: !permissionRequest && !showPluginTUI }
|
|
2725
2772
|
);
|
|
2773
|
+
(0, import_react16.useEffect)(() => {
|
|
2774
|
+
if (!isThinking) {
|
|
2775
|
+
setIsAborting(false);
|
|
2776
|
+
if (pendingPromptRef.current) {
|
|
2777
|
+
const prompt = pendingPromptRef.current;
|
|
2778
|
+
setPendingPrompt(null);
|
|
2779
|
+
pendingPromptRef.current = null;
|
|
2780
|
+
setTimeout(() => executePrompt(prompt), 0);
|
|
2781
|
+
}
|
|
2782
|
+
}
|
|
2783
|
+
}, [isThinking, pendingPrompt, executePrompt]);
|
|
2726
2784
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_ink13.Box, { flexDirection: "column", children: [
|
|
2727
2785
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_ink13.Box, { flexDirection: "column", paddingX: 1, marginBottom: 1, children: [
|
|
2728
2786
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_ink13.Text, { color: "cyan", bold: true, children: `
|
|
@@ -2797,7 +2855,13 @@ function App(props) {
|
|
|
2797
2855
|
InputArea,
|
|
2798
2856
|
{
|
|
2799
2857
|
onSubmit: handleSubmit,
|
|
2800
|
-
|
|
2858
|
+
onCancelQueue: () => {
|
|
2859
|
+
setPendingPrompt(null);
|
|
2860
|
+
pendingPromptRef.current = null;
|
|
2861
|
+
},
|
|
2862
|
+
isDisabled: !!permissionRequest || showPluginTUI || isThinking && !!pendingPrompt,
|
|
2863
|
+
isAborting,
|
|
2864
|
+
pendingPrompt,
|
|
2801
2865
|
registry
|
|
2802
2866
|
}
|
|
2803
2867
|
),
|
|
@@ -2820,12 +2884,15 @@ function renderApp(options) {
|
|
|
2820
2884
|
const instance = (0, import_ink14.render)(/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(App, { ...options }), {
|
|
2821
2885
|
exitOnCtrlC: true
|
|
2822
2886
|
});
|
|
2823
|
-
instance.waitUntilExit().
|
|
2887
|
+
instance.waitUntilExit().then(() => {
|
|
2888
|
+
process.exit(0);
|
|
2889
|
+
}).catch((err) => {
|
|
2824
2890
|
if (err) {
|
|
2825
2891
|
process.stderr.write(`
|
|
2826
2892
|
[EXIT ERROR] ${err}
|
|
2827
2893
|
`);
|
|
2828
2894
|
}
|
|
2895
|
+
process.exit(1);
|
|
2829
2896
|
});
|
|
2830
2897
|
}
|
|
2831
2898
|
|
package/dist/node/index.js
CHANGED