@robota-sdk/agent-cli 3.0.0-beta.51 → 3.0.0-beta.52

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.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  startCli
4
- } from "./chunk-7EBJI2DW.js";
4
+ } from "./chunk-QZUCO4ZK.js";
5
5
 
6
6
  // src/bin.ts
7
7
  process.on("uncaughtException", (err) => {
@@ -942,7 +942,8 @@ function CjkTextInput({
942
942
  placeholder = "",
943
943
  focus = true,
944
944
  showCursor = true,
945
- availableWidth
945
+ availableWidth,
946
+ cursorHint = null
946
947
  }) {
947
948
  const valueRef = useRef2(value);
948
949
  const cursorRef = useRef2(value.length);
@@ -951,7 +952,7 @@ function CjkTextInput({
951
952
  const pasteBufferRef = useRef2("");
952
953
  if (value !== valueRef.current) {
953
954
  valueRef.current = value;
954
- cursorRef.current = value.length;
955
+ cursorRef.current = cursorHint != null ? Math.min(cursorHint, value.length) : value.length;
955
956
  }
956
957
  useInput(
957
958
  (input, key) => {
@@ -973,7 +974,7 @@ function CjkTextInput({
973
974
  isPastingRef.current = false;
974
975
  if (text.length > 0) {
975
976
  if (text.includes("\n") && onPaste) {
976
- onPaste(text);
977
+ onPaste(text, cursorRef.current);
977
978
  } else {
978
979
  const printable2 = filterPrintable(text);
979
980
  if (printable2.length > 0) {
@@ -1012,7 +1013,7 @@ function CjkTextInput({
1012
1013
  return;
1013
1014
  }
1014
1015
  if (input.length > 1 && (input.includes("\n") || input.includes("\r")) && onPaste) {
1015
- onPaste(input.replace(/\r\n?/g, "\n"));
1016
+ onPaste(input.replace(/\r\n?/g, "\n"), cursorRef.current);
1016
1017
  return;
1017
1018
  }
1018
1019
  if (key.leftArrow) {
@@ -1211,6 +1212,7 @@ function InputArea({
1211
1212
  sessionName
1212
1213
  }) {
1213
1214
  const [value, setValue] = useState4("");
1215
+ const [cursorHint, setCursorHint] = useState4(null);
1214
1216
  const pasteStore = useRef3(/* @__PURE__ */ new Map());
1215
1217
  const { stdout } = useStdout();
1216
1218
  const terminalColumns = stdout?.columns ?? 80;
@@ -1224,13 +1226,15 @@ function InputArea({
1224
1226
  isSubcommandMode,
1225
1227
  setShowPopup
1226
1228
  } = useAutocomplete(value, registry);
1227
- const handlePaste = useCallback2((text) => {
1229
+ const handlePaste = useCallback2((text, cursorPosition) => {
1228
1230
  pasteIdRef.current += 1;
1229
1231
  const id = pasteIdRef.current;
1230
1232
  pasteStore.current.set(id, text);
1231
1233
  const lineCount = text.split("\n").length;
1232
1234
  const label = `[Pasted text #${id} +${lineCount} lines]`;
1233
- setValue((prev) => prev ? `${prev} ${label}` : label);
1235
+ const newCursorPos = cursorPosition + label.length;
1236
+ setCursorHint(newCursorPos);
1237
+ setValue((prev) => prev.slice(0, cursorPosition) + label + prev.slice(cursorPosition));
1234
1238
  }, []);
1235
1239
  const tabCompleteCommand = useCallback2(
1236
1240
  (cmd) => {
@@ -1345,11 +1349,15 @@ function InputArea({
1345
1349
  CjkTextInput,
1346
1350
  {
1347
1351
  value,
1348
- onChange: setValue,
1352
+ onChange: (v) => {
1353
+ setValue(v);
1354
+ setCursorHint(null);
1355
+ },
1349
1356
  onSubmit: handleSubmit,
1350
1357
  onPaste: handlePaste,
1351
1358
  placeholder: "Type a message or /help",
1352
- availableWidth
1359
+ availableWidth,
1360
+ cursorHint
1353
1361
  }
1354
1362
  )
1355
1363
  ] }) })
@@ -965,7 +965,8 @@ function CjkTextInput({
965
965
  placeholder = "",
966
966
  focus = true,
967
967
  showCursor = true,
968
- availableWidth
968
+ availableWidth,
969
+ cursorHint = null
969
970
  }) {
970
971
  const valueRef = (0, import_react4.useRef)(value);
971
972
  const cursorRef = (0, import_react4.useRef)(value.length);
@@ -974,7 +975,7 @@ function CjkTextInput({
974
975
  const pasteBufferRef = (0, import_react4.useRef)("");
975
976
  if (value !== valueRef.current) {
976
977
  valueRef.current = value;
977
- cursorRef.current = value.length;
978
+ cursorRef.current = cursorHint != null ? Math.min(cursorHint, value.length) : value.length;
978
979
  }
979
980
  (0, import_ink4.useInput)(
980
981
  (input, key) => {
@@ -996,7 +997,7 @@ function CjkTextInput({
996
997
  isPastingRef.current = false;
997
998
  if (text.length > 0) {
998
999
  if (text.includes("\n") && onPaste) {
999
- onPaste(text);
1000
+ onPaste(text, cursorRef.current);
1000
1001
  } else {
1001
1002
  const printable2 = filterPrintable(text);
1002
1003
  if (printable2.length > 0) {
@@ -1035,7 +1036,7 @@ function CjkTextInput({
1035
1036
  return;
1036
1037
  }
1037
1038
  if (input.length > 1 && (input.includes("\n") || input.includes("\r")) && onPaste) {
1038
- onPaste(input.replace(/\r\n?/g, "\n"));
1039
+ onPaste(input.replace(/\r\n?/g, "\n"), cursorRef.current);
1039
1040
  return;
1040
1041
  }
1041
1042
  if (key.leftArrow) {
@@ -1234,6 +1235,7 @@ function InputArea({
1234
1235
  sessionName
1235
1236
  }) {
1236
1237
  const [value, setValue] = (0, import_react6.useState)("");
1238
+ const [cursorHint, setCursorHint] = (0, import_react6.useState)(null);
1237
1239
  const pasteStore = (0, import_react6.useRef)(/* @__PURE__ */ new Map());
1238
1240
  const { stdout } = (0, import_ink7.useStdout)();
1239
1241
  const terminalColumns = stdout?.columns ?? 80;
@@ -1247,13 +1249,15 @@ function InputArea({
1247
1249
  isSubcommandMode,
1248
1250
  setShowPopup
1249
1251
  } = useAutocomplete(value, registry);
1250
- const handlePaste = (0, import_react6.useCallback)((text) => {
1252
+ const handlePaste = (0, import_react6.useCallback)((text, cursorPosition) => {
1251
1253
  pasteIdRef.current += 1;
1252
1254
  const id = pasteIdRef.current;
1253
1255
  pasteStore.current.set(id, text);
1254
1256
  const lineCount = text.split("\n").length;
1255
1257
  const label = `[Pasted text #${id} +${lineCount} lines]`;
1256
- setValue((prev) => prev ? `${prev} ${label}` : label);
1258
+ const newCursorPos = cursorPosition + label.length;
1259
+ setCursorHint(newCursorPos);
1260
+ setValue((prev) => prev.slice(0, cursorPosition) + label + prev.slice(cursorPosition));
1257
1261
  }, []);
1258
1262
  const tabCompleteCommand = (0, import_react6.useCallback)(
1259
1263
  (cmd) => {
@@ -1368,11 +1372,15 @@ function InputArea({
1368
1372
  CjkTextInput,
1369
1373
  {
1370
1374
  value,
1371
- onChange: setValue,
1375
+ onChange: (v) => {
1376
+ setValue(v);
1377
+ setCursorHint(null);
1378
+ },
1372
1379
  onSubmit: handleSubmit,
1373
1380
  onPaste: handlePaste,
1374
1381
  placeholder: "Type a message or /help",
1375
- availableWidth
1382
+ availableWidth,
1383
+ cursorHint
1376
1384
  }
1377
1385
  )
1378
1386
  ] }) })
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  startCli
3
- } from "./chunk-7EBJI2DW.js";
3
+ } from "./chunk-QZUCO4ZK.js";
4
4
  export {
5
5
  startCli
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robota-sdk/agent-cli",
3
- "version": "3.0.0-beta.51",
3
+ "version": "3.0.0-beta.52",
4
4
  "description": "AI coding assistant CLI built on Robota SDK",
5
5
  "type": "module",
6
6
  "bin": {
@@ -33,7 +33,7 @@
33
33
  "dist"
34
34
  ],
35
35
  "dependencies": {
36
- "@robota-sdk/agent-sessions": "3.0.0-beta.51",
36
+ "@robota-sdk/agent-sessions": "3.0.0-beta.52",
37
37
  "chalk": "^5.3.0",
38
38
  "cli-highlight": "^2.1.0",
39
39
  "ink": "^6.8.0",
@@ -44,10 +44,10 @@
44
44
  "marked-terminal": "^7.3.0",
45
45
  "react": "19.2.4",
46
46
  "string-width": "^8.2.0",
47
- "@robota-sdk/agent-core": "3.0.0-beta.51",
48
- "@robota-sdk/agent-provider-anthropic": "3.0.0-beta.51",
49
- "@robota-sdk/agent-sdk": "3.0.0-beta.51",
50
- "@robota-sdk/agent-transport-headless": "3.0.0-beta.51"
47
+ "@robota-sdk/agent-core": "3.0.0-beta.52",
48
+ "@robota-sdk/agent-transport-headless": "3.0.0-beta.52",
49
+ "@robota-sdk/agent-sdk": "3.0.0-beta.52",
50
+ "@robota-sdk/agent-provider-anthropic": "3.0.0-beta.52"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/marked": "^6.0.0",