@robota-sdk/agent-cli 3.0.0-beta.37 → 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 CHANGED
@@ -1940,8 +1940,10 @@ function useAutocomplete(value, registry) {
1940
1940
  }
1941
1941
  function InputArea({
1942
1942
  onSubmit,
1943
+ onCancelQueue,
1943
1944
  isDisabled,
1944
1945
  isAborting,
1946
+ pendingPrompt,
1945
1947
  registry
1946
1948
  }) {
1947
1949
  const [value, setValue] = (0, import_react10.useState)("");
@@ -2014,6 +2016,14 @@ function InputArea({
2014
2016
  },
2015
2017
  { isActive: showPopup && !isDisabled }
2016
2018
  );
2019
+ (0, import_ink7.useInput)(
2020
+ (_input, key) => {
2021
+ if ((key.backspace || key.delete) && pendingPrompt) {
2022
+ onCancelQueue?.();
2023
+ }
2024
+ },
2025
+ { isActive: !!pendingPrompt }
2026
+ );
2017
2027
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_ink7.Box, { flexDirection: "column", children: [
2018
2028
  showPopup && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2019
2029
  SlashAutocomplete,
@@ -2028,9 +2038,15 @@ function InputArea({
2028
2038
  import_ink7.Box,
2029
2039
  {
2030
2040
  borderStyle: "single",
2031
- borderColor: isAborting ? "yellow" : isDisabled ? "gray" : "green",
2041
+ borderColor: isAborting ? "yellow" : pendingPrompt ? "cyan" : isDisabled ? "gray" : "green",
2032
2042
  paddingLeft: 1,
2033
- children: isDisabled ? isAborting ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ink7.Text, { color: "yellow", children: " Interrupting..." }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(WaveText, { text: " Waiting for response... (ESC to interrupt)" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_ink7.Box, { children: [
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: [
2034
2050
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ink7.Text, { color: "green", bold: true, children: "> " }),
2035
2051
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2036
2052
  CjkTextInput,
@@ -2693,6 +2709,8 @@ function App(props) {
2693
2709
  const [pendingModelId, setPendingModelId] = (0, import_react16.useState)(null);
2694
2710
  const [showPluginTUI, setShowPluginTUI] = (0, import_react16.useState)(false);
2695
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);
2696
2714
  const pluginCallbacks = usePluginCallbacks(props.cwd ?? process.cwd());
2697
2715
  const handleSlashCommand = useSlashCommands(
2698
2716
  session,
@@ -2705,7 +2723,7 @@ function App(props) {
2705
2723
  pluginCallbacks,
2706
2724
  setShowPluginTUI
2707
2725
  );
2708
- const handleSubmit = useSubmitHandler(
2726
+ const executePrompt = useSubmitHandler(
2709
2727
  session,
2710
2728
  addMessage,
2711
2729
  handleSlashCommand,
@@ -2714,18 +2732,39 @@ function App(props) {
2714
2732
  setContextState,
2715
2733
  registry
2716
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
+ );
2717
2746
  (0, import_ink13.useInput)(
2718
2747
  (_input, key) => {
2719
2748
  if (key.escape && isThinking) {
2720
2749
  setIsAborting(true);
2750
+ setPendingPrompt(null);
2751
+ pendingPromptRef.current = null;
2721
2752
  session.abort();
2722
2753
  }
2723
2754
  },
2724
2755
  { isActive: !permissionRequest && !showPluginTUI }
2725
2756
  );
2726
2757
  (0, import_react16.useEffect)(() => {
2727
- if (!isThinking) setIsAborting(false);
2728
- }, [isThinking]);
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]);
2729
2768
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_ink13.Box, { flexDirection: "column", children: [
2730
2769
  /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_ink13.Box, { flexDirection: "column", paddingX: 1, marginBottom: 1, children: [
2731
2770
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_ink13.Text, { color: "cyan", bold: true, children: `
@@ -2800,8 +2839,13 @@ function App(props) {
2800
2839
  InputArea,
2801
2840
  {
2802
2841
  onSubmit: handleSubmit,
2803
- isDisabled: isThinking || !!permissionRequest || showPluginTUI,
2842
+ onCancelQueue: () => {
2843
+ setPendingPrompt(null);
2844
+ pendingPromptRef.current = null;
2845
+ },
2846
+ isDisabled: !!permissionRequest || showPluginTUI || isThinking && !!pendingPrompt,
2804
2847
  isAborting,
2848
+ pendingPrompt,
2805
2849
  registry
2806
2850
  }
2807
2851
  ),
package/dist/node/bin.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  startCli
4
- } from "./chunk-P323ORQX.js";
4
+ } from "./chunk-7C5IYOJG.js";
5
5
 
6
6
  // src/bin.ts
7
7
  process.on("uncaughtException", (err) => {
@@ -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, useEffect as useEffect3 } 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";
@@ -1937,8 +1937,10 @@ function useAutocomplete(value, registry) {
1937
1937
  }
1938
1938
  function InputArea({
1939
1939
  onSubmit,
1940
+ onCancelQueue,
1940
1941
  isDisabled,
1941
1942
  isAborting,
1943
+ pendingPrompt,
1942
1944
  registry
1943
1945
  }) {
1944
1946
  const [value, setValue] = useState5("");
@@ -2011,6 +2013,14 @@ function InputArea({
2011
2013
  },
2012
2014
  { isActive: showPopup && !isDisabled }
2013
2015
  );
2016
+ useInput2(
2017
+ (_input, key) => {
2018
+ if ((key.backspace || key.delete) && pendingPrompt) {
2019
+ onCancelQueue?.();
2020
+ }
2021
+ },
2022
+ { isActive: !!pendingPrompt }
2023
+ );
2014
2024
  return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
2015
2025
  showPopup && /* @__PURE__ */ jsx6(
2016
2026
  SlashAutocomplete,
@@ -2025,9 +2035,15 @@ function InputArea({
2025
2035
  Box5,
2026
2036
  {
2027
2037
  borderStyle: "single",
2028
- borderColor: isAborting ? "yellow" : isDisabled ? "gray" : "green",
2038
+ borderColor: isAborting ? "yellow" : pendingPrompt ? "cyan" : isDisabled ? "gray" : "green",
2029
2039
  paddingLeft: 1,
2030
- children: isDisabled ? isAborting ? /* @__PURE__ */ jsx6(Text7, { color: "yellow", children: " Interrupting..." }) : /* @__PURE__ */ jsx6(WaveText, { text: " Waiting for response... (ESC to interrupt)" }) : /* @__PURE__ */ jsxs5(Box5, { children: [
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: [
2031
2047
  /* @__PURE__ */ jsx6(Text7, { color: "green", bold: true, children: "> " }),
2032
2048
  /* @__PURE__ */ jsx6(
2033
2049
  CjkTextInput,
@@ -2690,6 +2706,8 @@ function App(props) {
2690
2706
  const [pendingModelId, setPendingModelId] = useState10(null);
2691
2707
  const [showPluginTUI, setShowPluginTUI] = useState10(false);
2692
2708
  const [isAborting, setIsAborting] = useState10(false);
2709
+ const [pendingPrompt, setPendingPrompt] = useState10(null);
2710
+ const pendingPromptRef = useRef8(null);
2693
2711
  const pluginCallbacks = usePluginCallbacks(props.cwd ?? process.cwd());
2694
2712
  const handleSlashCommand = useSlashCommands(
2695
2713
  session,
@@ -2702,7 +2720,7 @@ function App(props) {
2702
2720
  pluginCallbacks,
2703
2721
  setShowPluginTUI
2704
2722
  );
2705
- const handleSubmit = useSubmitHandler(
2723
+ const executePrompt = useSubmitHandler(
2706
2724
  session,
2707
2725
  addMessage,
2708
2726
  handleSlashCommand,
@@ -2711,18 +2729,39 @@ function App(props) {
2711
2729
  setContextState,
2712
2730
  registry
2713
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
+ );
2714
2743
  useInput7(
2715
2744
  (_input, key) => {
2716
2745
  if (key.escape && isThinking) {
2717
2746
  setIsAborting(true);
2747
+ setPendingPrompt(null);
2748
+ pendingPromptRef.current = null;
2718
2749
  session.abort();
2719
2750
  }
2720
2751
  },
2721
2752
  { isActive: !permissionRequest && !showPluginTUI }
2722
2753
  );
2723
2754
  useEffect3(() => {
2724
- if (!isThinking) setIsAborting(false);
2725
- }, [isThinking]);
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]);
2726
2765
  return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", children: [
2727
2766
  /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", paddingX: 1, marginBottom: 1, children: [
2728
2767
  /* @__PURE__ */ jsx13(Text13, { color: "cyan", bold: true, children: `
@@ -2797,8 +2836,13 @@ function App(props) {
2797
2836
  InputArea,
2798
2837
  {
2799
2838
  onSubmit: handleSubmit,
2800
- isDisabled: isThinking || !!permissionRequest || showPluginTUI,
2839
+ onCancelQueue: () => {
2840
+ setPendingPrompt(null);
2841
+ pendingPromptRef.current = null;
2842
+ },
2843
+ isDisabled: !!permissionRequest || showPluginTUI || isThinking && !!pendingPrompt,
2801
2844
  isAborting,
2845
+ pendingPrompt,
2802
2846
  registry
2803
2847
  }
2804
2848
  ),
@@ -1956,8 +1956,10 @@ function useAutocomplete(value, registry) {
1956
1956
  }
1957
1957
  function InputArea({
1958
1958
  onSubmit,
1959
+ onCancelQueue,
1959
1960
  isDisabled,
1960
1961
  isAborting,
1962
+ pendingPrompt,
1961
1963
  registry
1962
1964
  }) {
1963
1965
  const [value, setValue] = (0, import_react10.useState)("");
@@ -2030,6 +2032,14 @@ function InputArea({
2030
2032
  },
2031
2033
  { isActive: showPopup && !isDisabled }
2032
2034
  );
2035
+ (0, import_ink7.useInput)(
2036
+ (_input, key) => {
2037
+ if ((key.backspace || key.delete) && pendingPrompt) {
2038
+ onCancelQueue?.();
2039
+ }
2040
+ },
2041
+ { isActive: !!pendingPrompt }
2042
+ );
2033
2043
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_ink7.Box, { flexDirection: "column", children: [
2034
2044
  showPopup && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2035
2045
  SlashAutocomplete,
@@ -2044,9 +2054,15 @@ function InputArea({
2044
2054
  import_ink7.Box,
2045
2055
  {
2046
2056
  borderStyle: "single",
2047
- borderColor: isAborting ? "yellow" : isDisabled ? "gray" : "green",
2057
+ borderColor: isAborting ? "yellow" : pendingPrompt ? "cyan" : isDisabled ? "gray" : "green",
2048
2058
  paddingLeft: 1,
2049
- children: isDisabled ? isAborting ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ink7.Text, { color: "yellow", children: " Interrupting..." }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(WaveText, { text: " Waiting for response... (ESC to interrupt)" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_ink7.Box, { children: [
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: [
2050
2066
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ink7.Text, { color: "green", bold: true, children: "> " }),
2051
2067
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2052
2068
  CjkTextInput,
@@ -2709,6 +2725,8 @@ function App(props) {
2709
2725
  const [pendingModelId, setPendingModelId] = (0, import_react16.useState)(null);
2710
2726
  const [showPluginTUI, setShowPluginTUI] = (0, import_react16.useState)(false);
2711
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);
2712
2730
  const pluginCallbacks = usePluginCallbacks(props.cwd ?? process.cwd());
2713
2731
  const handleSlashCommand = useSlashCommands(
2714
2732
  session,
@@ -2721,7 +2739,7 @@ function App(props) {
2721
2739
  pluginCallbacks,
2722
2740
  setShowPluginTUI
2723
2741
  );
2724
- const handleSubmit = useSubmitHandler(
2742
+ const executePrompt = useSubmitHandler(
2725
2743
  session,
2726
2744
  addMessage,
2727
2745
  handleSlashCommand,
@@ -2730,18 +2748,39 @@ function App(props) {
2730
2748
  setContextState,
2731
2749
  registry
2732
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
+ );
2733
2762
  (0, import_ink13.useInput)(
2734
2763
  (_input, key) => {
2735
2764
  if (key.escape && isThinking) {
2736
2765
  setIsAborting(true);
2766
+ setPendingPrompt(null);
2767
+ pendingPromptRef.current = null;
2737
2768
  session.abort();
2738
2769
  }
2739
2770
  },
2740
2771
  { isActive: !permissionRequest && !showPluginTUI }
2741
2772
  );
2742
2773
  (0, import_react16.useEffect)(() => {
2743
- if (!isThinking) setIsAborting(false);
2744
- }, [isThinking]);
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]);
2745
2784
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_ink13.Box, { flexDirection: "column", children: [
2746
2785
  /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_ink13.Box, { flexDirection: "column", paddingX: 1, marginBottom: 1, children: [
2747
2786
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_ink13.Text, { color: "cyan", bold: true, children: `
@@ -2816,8 +2855,13 @@ function App(props) {
2816
2855
  InputArea,
2817
2856
  {
2818
2857
  onSubmit: handleSubmit,
2819
- isDisabled: isThinking || !!permissionRequest || showPluginTUI,
2858
+ onCancelQueue: () => {
2859
+ setPendingPrompt(null);
2860
+ pendingPromptRef.current = null;
2861
+ },
2862
+ isDisabled: !!permissionRequest || showPluginTUI || isThinking && !!pendingPrompt,
2820
2863
  isAborting,
2864
+ pendingPrompt,
2821
2865
  registry
2822
2866
  }
2823
2867
  ),
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  startCli
3
- } from "./chunk-P323ORQX.js";
3
+ } from "./chunk-7C5IYOJG.js";
4
4
 
5
5
  // src/index.ts
6
6
  import { Session, SessionStore, query, TRUST_TO_MODE } from "@robota-sdk/agent-sdk";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robota-sdk/agent-cli",
3
- "version": "3.0.0-beta.37",
3
+ "version": "3.0.0-beta.38",
4
4
  "description": "AI coding assistant CLI built on Robota SDK",
5
5
  "type": "module",
6
6
  "bin": {
@@ -35,8 +35,8 @@
35
35
  "marked-terminal": "^7.3.0",
36
36
  "react": "19.2.4",
37
37
  "string-width": "^8.2.0",
38
- "@robota-sdk/agent-sdk": "3.0.0-beta.33",
39
- "@robota-sdk/agent-core": "3.0.0-beta.33"
38
+ "@robota-sdk/agent-core": "3.0.0-beta.33",
39
+ "@robota-sdk/agent-sdk": "3.0.0-beta.33"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/marked": "^6.0.0",