@robota-sdk/agent-cli 3.0.0-beta.38 → 3.0.0-beta.39
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
|
@@ -1715,6 +1715,7 @@ var import_ink7 = require("ink");
|
|
|
1715
1715
|
var import_react8 = require("react");
|
|
1716
1716
|
var import_ink4 = require("ink");
|
|
1717
1717
|
var import_chalk = __toESM(require("chalk"), 1);
|
|
1718
|
+
var import_string_width = __toESM(require("string-width"), 1);
|
|
1718
1719
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1719
1720
|
function filterPrintable(input) {
|
|
1720
1721
|
if (!input || input.length === 0) return "";
|
|
@@ -1724,6 +1725,27 @@ function insertAtCursor(value, cursor, input) {
|
|
|
1724
1725
|
const next = value.slice(0, cursor) + input + value.slice(cursor);
|
|
1725
1726
|
return { value: next, cursor: cursor + input.length };
|
|
1726
1727
|
}
|
|
1728
|
+
function displayOffset(chars, charIndex, width) {
|
|
1729
|
+
let offset = 0;
|
|
1730
|
+
for (let i = 0; i < charIndex && i < chars.length; i++) {
|
|
1731
|
+
const w = (0, import_string_width.default)(chars[i]);
|
|
1732
|
+
const col = offset % width;
|
|
1733
|
+
if (col + w > width) offset += width - col;
|
|
1734
|
+
offset += w;
|
|
1735
|
+
}
|
|
1736
|
+
return offset;
|
|
1737
|
+
}
|
|
1738
|
+
function charIndexAtDisplayOffset(chars, target, width) {
|
|
1739
|
+
let offset = 0;
|
|
1740
|
+
for (let i = 0; i < chars.length; i++) {
|
|
1741
|
+
if (offset >= target) return i;
|
|
1742
|
+
const w = (0, import_string_width.default)(chars[i]);
|
|
1743
|
+
const col = offset % width;
|
|
1744
|
+
if (col + w > width) offset += width - col;
|
|
1745
|
+
offset += w;
|
|
1746
|
+
}
|
|
1747
|
+
return chars.length;
|
|
1748
|
+
}
|
|
1727
1749
|
function CjkTextInput({
|
|
1728
1750
|
value,
|
|
1729
1751
|
onChange,
|
|
@@ -1731,7 +1753,8 @@ function CjkTextInput({
|
|
|
1731
1753
|
onPaste,
|
|
1732
1754
|
placeholder = "",
|
|
1733
1755
|
focus = true,
|
|
1734
|
-
showCursor = true
|
|
1756
|
+
showCursor = true,
|
|
1757
|
+
availableWidth
|
|
1735
1758
|
}) {
|
|
1736
1759
|
const valueRef = (0, import_react8.useRef)(value);
|
|
1737
1760
|
const cursorRef = (0, import_react8.useRef)(value.length);
|
|
@@ -1745,7 +1768,22 @@ function CjkTextInput({
|
|
|
1745
1768
|
(0, import_ink4.useInput)(
|
|
1746
1769
|
(input, key) => {
|
|
1747
1770
|
try {
|
|
1748
|
-
if (key.
|
|
1771
|
+
if (key.ctrl && input === "c" || key.tab || key.shift && key.tab) {
|
|
1772
|
+
return;
|
|
1773
|
+
}
|
|
1774
|
+
if (key.upArrow || key.downArrow) {
|
|
1775
|
+
if (availableWidth && availableWidth > 0) {
|
|
1776
|
+
const chars = [...valueRef.current];
|
|
1777
|
+
const offset = displayOffset(chars, cursorRef.current, availableWidth);
|
|
1778
|
+
const target = key.upArrow ? offset - availableWidth : offset + availableWidth;
|
|
1779
|
+
if (target >= 0) {
|
|
1780
|
+
const newCursor = charIndexAtDisplayOffset(chars, target, availableWidth);
|
|
1781
|
+
if (newCursor !== cursorRef.current) {
|
|
1782
|
+
cursorRef.current = newCursor;
|
|
1783
|
+
forceRender((n) => n + 1);
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1749
1787
|
return;
|
|
1750
1788
|
}
|
|
1751
1789
|
if (key.return) {
|
|
@@ -1938,6 +1976,10 @@ function useAutocomplete(value, registry) {
|
|
|
1938
1976
|
}
|
|
1939
1977
|
};
|
|
1940
1978
|
}
|
|
1979
|
+
var BORDER_HORIZONTAL = 2;
|
|
1980
|
+
var PADDING_LEFT = 1;
|
|
1981
|
+
var PROMPT_WIDTH = 2;
|
|
1982
|
+
var INPUT_AREA_OVERHEAD = BORDER_HORIZONTAL + PADDING_LEFT + PROMPT_WIDTH;
|
|
1941
1983
|
function InputArea({
|
|
1942
1984
|
onSubmit,
|
|
1943
1985
|
onCancelQueue,
|
|
@@ -1948,6 +1990,9 @@ function InputArea({
|
|
|
1948
1990
|
}) {
|
|
1949
1991
|
const [value, setValue] = (0, import_react10.useState)("");
|
|
1950
1992
|
const pasteStore = (0, import_react10.useRef)(/* @__PURE__ */ new Map());
|
|
1993
|
+
const { stdout } = (0, import_ink7.useStdout)();
|
|
1994
|
+
const terminalColumns = stdout?.columns ?? 80;
|
|
1995
|
+
const availableWidth = Math.max(1, terminalColumns - INPUT_AREA_OVERHEAD);
|
|
1951
1996
|
const pasteIdRef = (0, import_react10.useRef)(0);
|
|
1952
1997
|
const {
|
|
1953
1998
|
showPopup,
|
|
@@ -2055,7 +2100,8 @@ function InputArea({
|
|
|
2055
2100
|
onChange: setValue,
|
|
2056
2101
|
onSubmit: handleSubmit,
|
|
2057
2102
|
onPaste: handlePaste,
|
|
2058
|
-
placeholder: "Type a message or /help"
|
|
2103
|
+
placeholder: "Type a message or /help",
|
|
2104
|
+
availableWidth
|
|
2059
2105
|
}
|
|
2060
2106
|
)
|
|
2061
2107
|
] })
|
package/dist/node/bin.js
CHANGED
|
@@ -1706,12 +1706,13 @@ function StatusBar({
|
|
|
1706
1706
|
|
|
1707
1707
|
// src/ui/InputArea.tsx
|
|
1708
1708
|
import React5, { useState as useState5, useCallback as useCallback5, useMemo as useMemo2, useRef as useRef4 } from "react";
|
|
1709
|
-
import { Box as Box5, Text as Text7, useInput as useInput2 } from "ink";
|
|
1709
|
+
import { Box as Box5, Text as Text7, useInput as useInput2, useStdout } from "ink";
|
|
1710
1710
|
|
|
1711
1711
|
// src/ui/CjkTextInput.tsx
|
|
1712
1712
|
import { useRef as useRef3, useState as useState3 } from "react";
|
|
1713
1713
|
import { Text as Text4, useInput } from "ink";
|
|
1714
1714
|
import chalk from "chalk";
|
|
1715
|
+
import stringWidth from "string-width";
|
|
1715
1716
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
1716
1717
|
function filterPrintable(input) {
|
|
1717
1718
|
if (!input || input.length === 0) return "";
|
|
@@ -1721,6 +1722,27 @@ function insertAtCursor(value, cursor, input) {
|
|
|
1721
1722
|
const next = value.slice(0, cursor) + input + value.slice(cursor);
|
|
1722
1723
|
return { value: next, cursor: cursor + input.length };
|
|
1723
1724
|
}
|
|
1725
|
+
function displayOffset(chars, charIndex, width) {
|
|
1726
|
+
let offset = 0;
|
|
1727
|
+
for (let i = 0; i < charIndex && i < chars.length; i++) {
|
|
1728
|
+
const w = stringWidth(chars[i]);
|
|
1729
|
+
const col = offset % width;
|
|
1730
|
+
if (col + w > width) offset += width - col;
|
|
1731
|
+
offset += w;
|
|
1732
|
+
}
|
|
1733
|
+
return offset;
|
|
1734
|
+
}
|
|
1735
|
+
function charIndexAtDisplayOffset(chars, target, width) {
|
|
1736
|
+
let offset = 0;
|
|
1737
|
+
for (let i = 0; i < chars.length; i++) {
|
|
1738
|
+
if (offset >= target) return i;
|
|
1739
|
+
const w = stringWidth(chars[i]);
|
|
1740
|
+
const col = offset % width;
|
|
1741
|
+
if (col + w > width) offset += width - col;
|
|
1742
|
+
offset += w;
|
|
1743
|
+
}
|
|
1744
|
+
return chars.length;
|
|
1745
|
+
}
|
|
1724
1746
|
function CjkTextInput({
|
|
1725
1747
|
value,
|
|
1726
1748
|
onChange,
|
|
@@ -1728,7 +1750,8 @@ function CjkTextInput({
|
|
|
1728
1750
|
onPaste,
|
|
1729
1751
|
placeholder = "",
|
|
1730
1752
|
focus = true,
|
|
1731
|
-
showCursor = true
|
|
1753
|
+
showCursor = true,
|
|
1754
|
+
availableWidth
|
|
1732
1755
|
}) {
|
|
1733
1756
|
const valueRef = useRef3(value);
|
|
1734
1757
|
const cursorRef = useRef3(value.length);
|
|
@@ -1742,7 +1765,22 @@ function CjkTextInput({
|
|
|
1742
1765
|
useInput(
|
|
1743
1766
|
(input, key) => {
|
|
1744
1767
|
try {
|
|
1745
|
-
if (key.
|
|
1768
|
+
if (key.ctrl && input === "c" || key.tab || key.shift && key.tab) {
|
|
1769
|
+
return;
|
|
1770
|
+
}
|
|
1771
|
+
if (key.upArrow || key.downArrow) {
|
|
1772
|
+
if (availableWidth && availableWidth > 0) {
|
|
1773
|
+
const chars = [...valueRef.current];
|
|
1774
|
+
const offset = displayOffset(chars, cursorRef.current, availableWidth);
|
|
1775
|
+
const target = key.upArrow ? offset - availableWidth : offset + availableWidth;
|
|
1776
|
+
if (target >= 0) {
|
|
1777
|
+
const newCursor = charIndexAtDisplayOffset(chars, target, availableWidth);
|
|
1778
|
+
if (newCursor !== cursorRef.current) {
|
|
1779
|
+
cursorRef.current = newCursor;
|
|
1780
|
+
forceRender((n) => n + 1);
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1746
1784
|
return;
|
|
1747
1785
|
}
|
|
1748
1786
|
if (key.return) {
|
|
@@ -1935,6 +1973,10 @@ function useAutocomplete(value, registry) {
|
|
|
1935
1973
|
}
|
|
1936
1974
|
};
|
|
1937
1975
|
}
|
|
1976
|
+
var BORDER_HORIZONTAL = 2;
|
|
1977
|
+
var PADDING_LEFT = 1;
|
|
1978
|
+
var PROMPT_WIDTH = 2;
|
|
1979
|
+
var INPUT_AREA_OVERHEAD = BORDER_HORIZONTAL + PADDING_LEFT + PROMPT_WIDTH;
|
|
1938
1980
|
function InputArea({
|
|
1939
1981
|
onSubmit,
|
|
1940
1982
|
onCancelQueue,
|
|
@@ -1945,6 +1987,9 @@ function InputArea({
|
|
|
1945
1987
|
}) {
|
|
1946
1988
|
const [value, setValue] = useState5("");
|
|
1947
1989
|
const pasteStore = useRef4(/* @__PURE__ */ new Map());
|
|
1990
|
+
const { stdout } = useStdout();
|
|
1991
|
+
const terminalColumns = stdout?.columns ?? 80;
|
|
1992
|
+
const availableWidth = Math.max(1, terminalColumns - INPUT_AREA_OVERHEAD);
|
|
1948
1993
|
const pasteIdRef = useRef4(0);
|
|
1949
1994
|
const {
|
|
1950
1995
|
showPopup,
|
|
@@ -2052,7 +2097,8 @@ function InputArea({
|
|
|
2052
2097
|
onChange: setValue,
|
|
2053
2098
|
onSubmit: handleSubmit,
|
|
2054
2099
|
onPaste: handlePaste,
|
|
2055
|
-
placeholder: "Type a message or /help"
|
|
2100
|
+
placeholder: "Type a message or /help",
|
|
2101
|
+
availableWidth
|
|
2056
2102
|
}
|
|
2057
2103
|
)
|
|
2058
2104
|
] })
|
package/dist/node/index.cjs
CHANGED
|
@@ -1731,6 +1731,7 @@ var import_ink7 = require("ink");
|
|
|
1731
1731
|
var import_react8 = require("react");
|
|
1732
1732
|
var import_ink4 = require("ink");
|
|
1733
1733
|
var import_chalk = __toESM(require("chalk"), 1);
|
|
1734
|
+
var import_string_width = __toESM(require("string-width"), 1);
|
|
1734
1735
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1735
1736
|
function filterPrintable(input) {
|
|
1736
1737
|
if (!input || input.length === 0) return "";
|
|
@@ -1740,6 +1741,27 @@ function insertAtCursor(value, cursor, input) {
|
|
|
1740
1741
|
const next = value.slice(0, cursor) + input + value.slice(cursor);
|
|
1741
1742
|
return { value: next, cursor: cursor + input.length };
|
|
1742
1743
|
}
|
|
1744
|
+
function displayOffset(chars, charIndex, width) {
|
|
1745
|
+
let offset = 0;
|
|
1746
|
+
for (let i = 0; i < charIndex && i < chars.length; i++) {
|
|
1747
|
+
const w = (0, import_string_width.default)(chars[i]);
|
|
1748
|
+
const col = offset % width;
|
|
1749
|
+
if (col + w > width) offset += width - col;
|
|
1750
|
+
offset += w;
|
|
1751
|
+
}
|
|
1752
|
+
return offset;
|
|
1753
|
+
}
|
|
1754
|
+
function charIndexAtDisplayOffset(chars, target, width) {
|
|
1755
|
+
let offset = 0;
|
|
1756
|
+
for (let i = 0; i < chars.length; i++) {
|
|
1757
|
+
if (offset >= target) return i;
|
|
1758
|
+
const w = (0, import_string_width.default)(chars[i]);
|
|
1759
|
+
const col = offset % width;
|
|
1760
|
+
if (col + w > width) offset += width - col;
|
|
1761
|
+
offset += w;
|
|
1762
|
+
}
|
|
1763
|
+
return chars.length;
|
|
1764
|
+
}
|
|
1743
1765
|
function CjkTextInput({
|
|
1744
1766
|
value,
|
|
1745
1767
|
onChange,
|
|
@@ -1747,7 +1769,8 @@ function CjkTextInput({
|
|
|
1747
1769
|
onPaste,
|
|
1748
1770
|
placeholder = "",
|
|
1749
1771
|
focus = true,
|
|
1750
|
-
showCursor = true
|
|
1772
|
+
showCursor = true,
|
|
1773
|
+
availableWidth
|
|
1751
1774
|
}) {
|
|
1752
1775
|
const valueRef = (0, import_react8.useRef)(value);
|
|
1753
1776
|
const cursorRef = (0, import_react8.useRef)(value.length);
|
|
@@ -1761,7 +1784,22 @@ function CjkTextInput({
|
|
|
1761
1784
|
(0, import_ink4.useInput)(
|
|
1762
1785
|
(input, key) => {
|
|
1763
1786
|
try {
|
|
1764
|
-
if (key.
|
|
1787
|
+
if (key.ctrl && input === "c" || key.tab || key.shift && key.tab) {
|
|
1788
|
+
return;
|
|
1789
|
+
}
|
|
1790
|
+
if (key.upArrow || key.downArrow) {
|
|
1791
|
+
if (availableWidth && availableWidth > 0) {
|
|
1792
|
+
const chars = [...valueRef.current];
|
|
1793
|
+
const offset = displayOffset(chars, cursorRef.current, availableWidth);
|
|
1794
|
+
const target = key.upArrow ? offset - availableWidth : offset + availableWidth;
|
|
1795
|
+
if (target >= 0) {
|
|
1796
|
+
const newCursor = charIndexAtDisplayOffset(chars, target, availableWidth);
|
|
1797
|
+
if (newCursor !== cursorRef.current) {
|
|
1798
|
+
cursorRef.current = newCursor;
|
|
1799
|
+
forceRender((n) => n + 1);
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1765
1803
|
return;
|
|
1766
1804
|
}
|
|
1767
1805
|
if (key.return) {
|
|
@@ -1954,6 +1992,10 @@ function useAutocomplete(value, registry) {
|
|
|
1954
1992
|
}
|
|
1955
1993
|
};
|
|
1956
1994
|
}
|
|
1995
|
+
var BORDER_HORIZONTAL = 2;
|
|
1996
|
+
var PADDING_LEFT = 1;
|
|
1997
|
+
var PROMPT_WIDTH = 2;
|
|
1998
|
+
var INPUT_AREA_OVERHEAD = BORDER_HORIZONTAL + PADDING_LEFT + PROMPT_WIDTH;
|
|
1957
1999
|
function InputArea({
|
|
1958
2000
|
onSubmit,
|
|
1959
2001
|
onCancelQueue,
|
|
@@ -1964,6 +2006,9 @@ function InputArea({
|
|
|
1964
2006
|
}) {
|
|
1965
2007
|
const [value, setValue] = (0, import_react10.useState)("");
|
|
1966
2008
|
const pasteStore = (0, import_react10.useRef)(/* @__PURE__ */ new Map());
|
|
2009
|
+
const { stdout } = (0, import_ink7.useStdout)();
|
|
2010
|
+
const terminalColumns = stdout?.columns ?? 80;
|
|
2011
|
+
const availableWidth = Math.max(1, terminalColumns - INPUT_AREA_OVERHEAD);
|
|
1967
2012
|
const pasteIdRef = (0, import_react10.useRef)(0);
|
|
1968
2013
|
const {
|
|
1969
2014
|
showPopup,
|
|
@@ -2071,7 +2116,8 @@ function InputArea({
|
|
|
2071
2116
|
onChange: setValue,
|
|
2072
2117
|
onSubmit: handleSubmit,
|
|
2073
2118
|
onPaste: handlePaste,
|
|
2074
|
-
placeholder: "Type a message or /help"
|
|
2119
|
+
placeholder: "Type a message or /help",
|
|
2120
|
+
availableWidth
|
|
2075
2121
|
}
|
|
2076
2122
|
)
|
|
2077
2123
|
] })
|
package/dist/node/index.js
CHANGED