@robota-sdk/agent-cli 3.0.0-beta.39 → 3.0.0-beta.40

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
@@ -1717,6 +1717,8 @@ var import_ink4 = require("ink");
1717
1717
  var import_chalk = __toESM(require("chalk"), 1);
1718
1718
  var import_string_width = __toESM(require("string-width"), 1);
1719
1719
  var import_jsx_runtime4 = require("react/jsx-runtime");
1720
+ var PASTE_START = "[200~";
1721
+ var PASTE_END = "[201~";
1720
1722
  function filterPrintable(input) {
1721
1723
  if (!input || input.length === 0) return "";
1722
1724
  return input.replace(/[\x00-\x1f\x7f]/g, "");
@@ -1759,6 +1761,8 @@ function CjkTextInput({
1759
1761
  const valueRef = (0, import_react8.useRef)(value);
1760
1762
  const cursorRef = (0, import_react8.useRef)(value.length);
1761
1763
  const [, forceRender] = (0, import_react8.useState)(0);
1764
+ const isPastingRef = (0, import_react8.useRef)(false);
1765
+ const pasteBufferRef = (0, import_react8.useRef)("");
1762
1766
  if (value !== valueRef.current) {
1763
1767
  valueRef.current = value;
1764
1768
  if (cursorRef.current > value.length) {
@@ -1768,6 +1772,39 @@ function CjkTextInput({
1768
1772
  (0, import_ink4.useInput)(
1769
1773
  (input, key) => {
1770
1774
  try {
1775
+ if (input === PASTE_START || input.startsWith(PASTE_START)) {
1776
+ isPastingRef.current = true;
1777
+ const afterMarker = input.slice(PASTE_START.length);
1778
+ if (afterMarker.length > 0) {
1779
+ pasteBufferRef.current += afterMarker;
1780
+ }
1781
+ return;
1782
+ }
1783
+ if (isPastingRef.current) {
1784
+ if (input === PASTE_END || input.includes(PASTE_END)) {
1785
+ const beforeMarker = input.split(PASTE_END)[0] ?? "";
1786
+ pasteBufferRef.current += beforeMarker;
1787
+ const text = pasteBufferRef.current.replace(/\r\n?/g, "\n");
1788
+ pasteBufferRef.current = "";
1789
+ isPastingRef.current = false;
1790
+ if (text.length > 0) {
1791
+ if (text.includes("\n") && onPaste) {
1792
+ onPaste(text);
1793
+ } else {
1794
+ const printable2 = filterPrintable(text);
1795
+ if (printable2.length > 0) {
1796
+ const result2 = insertAtCursor(valueRef.current, cursorRef.current, printable2);
1797
+ cursorRef.current = result2.cursor;
1798
+ valueRef.current = result2.value;
1799
+ onChange(result2.value);
1800
+ }
1801
+ }
1802
+ }
1803
+ } else {
1804
+ pasteBufferRef.current += input;
1805
+ }
1806
+ return;
1807
+ }
1771
1808
  if (key.ctrl && input === "c" || key.tab || key.shift && key.tab) {
1772
1809
  return;
1773
1810
  }
@@ -1917,7 +1954,7 @@ function computeScrollOffset(selectedIndex, total) {
1917
1954
  }
1918
1955
 
1919
1956
  // src/utils/paste-labels.ts
1920
- var PASTE_LABEL_RE = /\[Pasted text #(\d+) \+\d+ lines\]/g;
1957
+ var PASTE_LABEL_RE = /\[Pasted text #(\d+)(?: \+\d+ lines)?\]/g;
1921
1958
  function expandPasteLabels(text, store) {
1922
1959
  return text.replace(PASTE_LABEL_RE, (_, id) => store.get(Number(id)) ?? "");
1923
1960
  }
@@ -2911,10 +2948,16 @@ function renderApp(options) {
2911
2948
  `);
2912
2949
  }
2913
2950
  });
2951
+ if (process.stdin.isTTY && process.stdout.isTTY) {
2952
+ process.stdout.write("\x1B[?2004h");
2953
+ }
2914
2954
  const instance = (0, import_ink14.render)(/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(App, { ...options }), {
2915
2955
  exitOnCtrlC: true
2916
2956
  });
2917
2957
  instance.waitUntilExit().then(() => {
2958
+ if (process.stdout.isTTY) {
2959
+ process.stdout.write("\x1B[?2004l");
2960
+ }
2918
2961
  process.exit(0);
2919
2962
  }).catch((err) => {
2920
2963
  if (err) {
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-GWN5C72P.js";
4
+ } from "./chunk-CRPNSO52.js";
5
5
 
6
6
  // src/bin.ts
7
7
  process.on("uncaughtException", (err) => {
@@ -1714,6 +1714,8 @@ import { Text as Text4, useInput } from "ink";
1714
1714
  import chalk from "chalk";
1715
1715
  import stringWidth from "string-width";
1716
1716
  import { jsx as jsx3 } from "react/jsx-runtime";
1717
+ var PASTE_START = "[200~";
1718
+ var PASTE_END = "[201~";
1717
1719
  function filterPrintable(input) {
1718
1720
  if (!input || input.length === 0) return "";
1719
1721
  return input.replace(/[\x00-\x1f\x7f]/g, "");
@@ -1756,6 +1758,8 @@ function CjkTextInput({
1756
1758
  const valueRef = useRef3(value);
1757
1759
  const cursorRef = useRef3(value.length);
1758
1760
  const [, forceRender] = useState3(0);
1761
+ const isPastingRef = useRef3(false);
1762
+ const pasteBufferRef = useRef3("");
1759
1763
  if (value !== valueRef.current) {
1760
1764
  valueRef.current = value;
1761
1765
  if (cursorRef.current > value.length) {
@@ -1765,6 +1769,39 @@ function CjkTextInput({
1765
1769
  useInput(
1766
1770
  (input, key) => {
1767
1771
  try {
1772
+ if (input === PASTE_START || input.startsWith(PASTE_START)) {
1773
+ isPastingRef.current = true;
1774
+ const afterMarker = input.slice(PASTE_START.length);
1775
+ if (afterMarker.length > 0) {
1776
+ pasteBufferRef.current += afterMarker;
1777
+ }
1778
+ return;
1779
+ }
1780
+ if (isPastingRef.current) {
1781
+ if (input === PASTE_END || input.includes(PASTE_END)) {
1782
+ const beforeMarker = input.split(PASTE_END)[0] ?? "";
1783
+ pasteBufferRef.current += beforeMarker;
1784
+ const text = pasteBufferRef.current.replace(/\r\n?/g, "\n");
1785
+ pasteBufferRef.current = "";
1786
+ isPastingRef.current = false;
1787
+ if (text.length > 0) {
1788
+ if (text.includes("\n") && onPaste) {
1789
+ onPaste(text);
1790
+ } else {
1791
+ const printable2 = filterPrintable(text);
1792
+ if (printable2.length > 0) {
1793
+ const result2 = insertAtCursor(valueRef.current, cursorRef.current, printable2);
1794
+ cursorRef.current = result2.cursor;
1795
+ valueRef.current = result2.value;
1796
+ onChange(result2.value);
1797
+ }
1798
+ }
1799
+ }
1800
+ } else {
1801
+ pasteBufferRef.current += input;
1802
+ }
1803
+ return;
1804
+ }
1768
1805
  if (key.ctrl && input === "c" || key.tab || key.shift && key.tab) {
1769
1806
  return;
1770
1807
  }
@@ -1914,7 +1951,7 @@ function computeScrollOffset(selectedIndex, total) {
1914
1951
  }
1915
1952
 
1916
1953
  // src/utils/paste-labels.ts
1917
- var PASTE_LABEL_RE = /\[Pasted text #(\d+) \+\d+ lines\]/g;
1954
+ var PASTE_LABEL_RE = /\[Pasted text #(\d+)(?: \+\d+ lines)?\]/g;
1918
1955
  function expandPasteLabels(text, store) {
1919
1956
  return text.replace(PASTE_LABEL_RE, (_, id) => store.get(Number(id)) ?? "");
1920
1957
  }
@@ -2908,10 +2945,16 @@ function renderApp(options) {
2908
2945
  `);
2909
2946
  }
2910
2947
  });
2948
+ if (process.stdin.isTTY && process.stdout.isTTY) {
2949
+ process.stdout.write("\x1B[?2004h");
2950
+ }
2911
2951
  const instance = render(/* @__PURE__ */ jsx14(App, { ...options }), {
2912
2952
  exitOnCtrlC: true
2913
2953
  });
2914
2954
  instance.waitUntilExit().then(() => {
2955
+ if (process.stdout.isTTY) {
2956
+ process.stdout.write("\x1B[?2004l");
2957
+ }
2915
2958
  process.exit(0);
2916
2959
  }).catch((err) => {
2917
2960
  if (err) {
@@ -1733,6 +1733,8 @@ var import_ink4 = require("ink");
1733
1733
  var import_chalk = __toESM(require("chalk"), 1);
1734
1734
  var import_string_width = __toESM(require("string-width"), 1);
1735
1735
  var import_jsx_runtime4 = require("react/jsx-runtime");
1736
+ var PASTE_START = "[200~";
1737
+ var PASTE_END = "[201~";
1736
1738
  function filterPrintable(input) {
1737
1739
  if (!input || input.length === 0) return "";
1738
1740
  return input.replace(/[\x00-\x1f\x7f]/g, "");
@@ -1775,6 +1777,8 @@ function CjkTextInput({
1775
1777
  const valueRef = (0, import_react8.useRef)(value);
1776
1778
  const cursorRef = (0, import_react8.useRef)(value.length);
1777
1779
  const [, forceRender] = (0, import_react8.useState)(0);
1780
+ const isPastingRef = (0, import_react8.useRef)(false);
1781
+ const pasteBufferRef = (0, import_react8.useRef)("");
1778
1782
  if (value !== valueRef.current) {
1779
1783
  valueRef.current = value;
1780
1784
  if (cursorRef.current > value.length) {
@@ -1784,6 +1788,39 @@ function CjkTextInput({
1784
1788
  (0, import_ink4.useInput)(
1785
1789
  (input, key) => {
1786
1790
  try {
1791
+ if (input === PASTE_START || input.startsWith(PASTE_START)) {
1792
+ isPastingRef.current = true;
1793
+ const afterMarker = input.slice(PASTE_START.length);
1794
+ if (afterMarker.length > 0) {
1795
+ pasteBufferRef.current += afterMarker;
1796
+ }
1797
+ return;
1798
+ }
1799
+ if (isPastingRef.current) {
1800
+ if (input === PASTE_END || input.includes(PASTE_END)) {
1801
+ const beforeMarker = input.split(PASTE_END)[0] ?? "";
1802
+ pasteBufferRef.current += beforeMarker;
1803
+ const text = pasteBufferRef.current.replace(/\r\n?/g, "\n");
1804
+ pasteBufferRef.current = "";
1805
+ isPastingRef.current = false;
1806
+ if (text.length > 0) {
1807
+ if (text.includes("\n") && onPaste) {
1808
+ onPaste(text);
1809
+ } else {
1810
+ const printable2 = filterPrintable(text);
1811
+ if (printable2.length > 0) {
1812
+ const result2 = insertAtCursor(valueRef.current, cursorRef.current, printable2);
1813
+ cursorRef.current = result2.cursor;
1814
+ valueRef.current = result2.value;
1815
+ onChange(result2.value);
1816
+ }
1817
+ }
1818
+ }
1819
+ } else {
1820
+ pasteBufferRef.current += input;
1821
+ }
1822
+ return;
1823
+ }
1787
1824
  if (key.ctrl && input === "c" || key.tab || key.shift && key.tab) {
1788
1825
  return;
1789
1826
  }
@@ -1933,7 +1970,7 @@ function computeScrollOffset(selectedIndex, total) {
1933
1970
  }
1934
1971
 
1935
1972
  // src/utils/paste-labels.ts
1936
- var PASTE_LABEL_RE = /\[Pasted text #(\d+) \+\d+ lines\]/g;
1973
+ var PASTE_LABEL_RE = /\[Pasted text #(\d+)(?: \+\d+ lines)?\]/g;
1937
1974
  function expandPasteLabels(text, store) {
1938
1975
  return text.replace(PASTE_LABEL_RE, (_, id) => store.get(Number(id)) ?? "");
1939
1976
  }
@@ -2927,10 +2964,16 @@ function renderApp(options) {
2927
2964
  `);
2928
2965
  }
2929
2966
  });
2967
+ if (process.stdin.isTTY && process.stdout.isTTY) {
2968
+ process.stdout.write("\x1B[?2004h");
2969
+ }
2930
2970
  const instance = (0, import_ink14.render)(/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(App, { ...options }), {
2931
2971
  exitOnCtrlC: true
2932
2972
  });
2933
2973
  instance.waitUntilExit().then(() => {
2974
+ if (process.stdout.isTTY) {
2975
+ process.stdout.write("\x1B[?2004l");
2976
+ }
2934
2977
  process.exit(0);
2935
2978
  }).catch((err) => {
2936
2979
  if (err) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  startCli
3
- } from "./chunk-GWN5C72P.js";
3
+ } from "./chunk-CRPNSO52.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.39",
3
+ "version": "3.0.0-beta.40",
4
4
  "description": "AI coding assistant CLI built on Robota SDK",
5
5
  "type": "module",
6
6
  "bin": {