@robota-sdk/agent-cli 3.0.0-beta.12 → 3.0.0-beta.13
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 +17 -23
- package/dist/node/bin.js +1 -1
- package/dist/node/{chunk-CT2VGJIF.js → chunk-73QW5EEP.js} +18 -24
- package/dist/node/index.cjs +17 -23
- package/dist/node/index.js +1 -1
- package/package.json +3 -3
package/dist/node/bin.cjs
CHANGED
|
@@ -306,9 +306,16 @@ var import_ink6 = require("ink");
|
|
|
306
306
|
// src/ui/CjkTextInput.tsx
|
|
307
307
|
var import_react = require("react");
|
|
308
308
|
var import_ink3 = require("ink");
|
|
309
|
-
var import_string_width = __toESM(require("string-width"), 1);
|
|
310
309
|
var import_chalk = __toESM(require("chalk"), 1);
|
|
311
310
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
311
|
+
function filterPrintable(input) {
|
|
312
|
+
if (!input || input.length === 0) return "";
|
|
313
|
+
return input.replace(/[\x00-\x1f\x7f]/g, "");
|
|
314
|
+
}
|
|
315
|
+
function insertAtCursor(value, cursor, input) {
|
|
316
|
+
const next = value.slice(0, cursor) + input + value.slice(cursor);
|
|
317
|
+
return { value: next, cursor: cursor + input.length };
|
|
318
|
+
}
|
|
312
319
|
function CjkTextInput({
|
|
313
320
|
value,
|
|
314
321
|
onChange,
|
|
@@ -320,7 +327,6 @@ function CjkTextInput({
|
|
|
320
327
|
const valueRef = (0, import_react.useRef)(value);
|
|
321
328
|
const cursorRef = (0, import_react.useRef)(value.length);
|
|
322
329
|
const [, forceRender] = (0, import_react.useState)(0);
|
|
323
|
-
const { setCursorPosition } = (0, import_ink3.useCursor)();
|
|
324
330
|
if (value !== valueRef.current) {
|
|
325
331
|
valueRef.current = value;
|
|
326
332
|
if (cursorRef.current > value.length) {
|
|
@@ -353,37 +359,25 @@ function CjkTextInput({
|
|
|
353
359
|
}
|
|
354
360
|
if (key.backspace || key.delete) {
|
|
355
361
|
if (cursorRef.current > 0) {
|
|
356
|
-
const
|
|
357
|
-
const
|
|
362
|
+
const v = valueRef.current;
|
|
363
|
+
const next = v.slice(0, cursorRef.current - 1) + v.slice(cursorRef.current);
|
|
358
364
|
cursorRef.current -= 1;
|
|
359
|
-
valueRef.current =
|
|
360
|
-
onChange(
|
|
365
|
+
valueRef.current = next;
|
|
366
|
+
onChange(next);
|
|
361
367
|
}
|
|
362
368
|
return;
|
|
363
369
|
}
|
|
364
|
-
|
|
365
|
-
const printable = input.replace(/[\x00-\x1f\x7f]/g, "");
|
|
370
|
+
const printable = filterPrintable(input);
|
|
366
371
|
if (printable.length === 0) return;
|
|
367
|
-
const
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
valueRef.current = next;
|
|
372
|
-
onChange(next);
|
|
372
|
+
const result = insertAtCursor(valueRef.current, cursorRef.current, printable);
|
|
373
|
+
cursorRef.current = result.cursor;
|
|
374
|
+
valueRef.current = result.value;
|
|
375
|
+
onChange(result.value);
|
|
373
376
|
} catch {
|
|
374
377
|
}
|
|
375
378
|
},
|
|
376
379
|
{ isActive: focus }
|
|
377
380
|
);
|
|
378
|
-
if (showCursor && focus) {
|
|
379
|
-
try {
|
|
380
|
-
const textBeforeCursor = [...valueRef.current].slice(0, cursorRef.current).join("");
|
|
381
|
-
const cursorX = 4 + (0, import_string_width.default)(textBeforeCursor);
|
|
382
|
-
setCursorPosition({ x: cursorX, y: 0 });
|
|
383
|
-
} catch {
|
|
384
|
-
setCursorPosition({ x: 4, y: 0 });
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
381
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ink3.Text, { children: renderWithCursor(valueRef.current, cursorRef.current, placeholder, showCursor && focus) });
|
|
388
382
|
}
|
|
389
383
|
function renderWithCursor(value, cursorOffset, placeholder, showCursor) {
|
package/dist/node/bin.js
CHANGED
|
@@ -288,10 +288,17 @@ import { Box as Box4, Text as Text6, useInput as useInput2 } from "ink";
|
|
|
288
288
|
|
|
289
289
|
// src/ui/CjkTextInput.tsx
|
|
290
290
|
import { useRef, useState } from "react";
|
|
291
|
-
import { Text as Text3, useInput
|
|
292
|
-
import stringWidth from "string-width";
|
|
291
|
+
import { Text as Text3, useInput } from "ink";
|
|
293
292
|
import chalk from "chalk";
|
|
294
293
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
294
|
+
function filterPrintable(input) {
|
|
295
|
+
if (!input || input.length === 0) return "";
|
|
296
|
+
return input.replace(/[\x00-\x1f\x7f]/g, "");
|
|
297
|
+
}
|
|
298
|
+
function insertAtCursor(value, cursor, input) {
|
|
299
|
+
const next = value.slice(0, cursor) + input + value.slice(cursor);
|
|
300
|
+
return { value: next, cursor: cursor + input.length };
|
|
301
|
+
}
|
|
295
302
|
function CjkTextInput({
|
|
296
303
|
value,
|
|
297
304
|
onChange,
|
|
@@ -303,7 +310,6 @@ function CjkTextInput({
|
|
|
303
310
|
const valueRef = useRef(value);
|
|
304
311
|
const cursorRef = useRef(value.length);
|
|
305
312
|
const [, forceRender] = useState(0);
|
|
306
|
-
const { setCursorPosition } = useCursor();
|
|
307
313
|
if (value !== valueRef.current) {
|
|
308
314
|
valueRef.current = value;
|
|
309
315
|
if (cursorRef.current > value.length) {
|
|
@@ -336,37 +342,25 @@ function CjkTextInput({
|
|
|
336
342
|
}
|
|
337
343
|
if (key.backspace || key.delete) {
|
|
338
344
|
if (cursorRef.current > 0) {
|
|
339
|
-
const
|
|
340
|
-
const
|
|
345
|
+
const v = valueRef.current;
|
|
346
|
+
const next = v.slice(0, cursorRef.current - 1) + v.slice(cursorRef.current);
|
|
341
347
|
cursorRef.current -= 1;
|
|
342
|
-
valueRef.current =
|
|
343
|
-
onChange(
|
|
348
|
+
valueRef.current = next;
|
|
349
|
+
onChange(next);
|
|
344
350
|
}
|
|
345
351
|
return;
|
|
346
352
|
}
|
|
347
|
-
|
|
348
|
-
const printable = input.replace(/[\x00-\x1f\x7f]/g, "");
|
|
353
|
+
const printable = filterPrintable(input);
|
|
349
354
|
if (printable.length === 0) return;
|
|
350
|
-
const
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
valueRef.current = next;
|
|
355
|
-
onChange(next);
|
|
355
|
+
const result = insertAtCursor(valueRef.current, cursorRef.current, printable);
|
|
356
|
+
cursorRef.current = result.cursor;
|
|
357
|
+
valueRef.current = result.value;
|
|
358
|
+
onChange(result.value);
|
|
356
359
|
} catch {
|
|
357
360
|
}
|
|
358
361
|
},
|
|
359
362
|
{ isActive: focus }
|
|
360
363
|
);
|
|
361
|
-
if (showCursor && focus) {
|
|
362
|
-
try {
|
|
363
|
-
const textBeforeCursor = [...valueRef.current].slice(0, cursorRef.current).join("");
|
|
364
|
-
const cursorX = 4 + stringWidth(textBeforeCursor);
|
|
365
|
-
setCursorPosition({ x: cursorX, y: 0 });
|
|
366
|
-
} catch {
|
|
367
|
-
setCursorPosition({ x: 4, y: 0 });
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
364
|
return /* @__PURE__ */ jsx3(Text3, { children: renderWithCursor(valueRef.current, cursorRef.current, placeholder, showCursor && focus) });
|
|
371
365
|
}
|
|
372
366
|
function renderWithCursor(value, cursorOffset, placeholder, showCursor) {
|
package/dist/node/index.cjs
CHANGED
|
@@ -322,9 +322,16 @@ var import_ink6 = require("ink");
|
|
|
322
322
|
// src/ui/CjkTextInput.tsx
|
|
323
323
|
var import_react = require("react");
|
|
324
324
|
var import_ink3 = require("ink");
|
|
325
|
-
var import_string_width = __toESM(require("string-width"), 1);
|
|
326
325
|
var import_chalk = __toESM(require("chalk"), 1);
|
|
327
326
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
327
|
+
function filterPrintable(input) {
|
|
328
|
+
if (!input || input.length === 0) return "";
|
|
329
|
+
return input.replace(/[\x00-\x1f\x7f]/g, "");
|
|
330
|
+
}
|
|
331
|
+
function insertAtCursor(value, cursor, input) {
|
|
332
|
+
const next = value.slice(0, cursor) + input + value.slice(cursor);
|
|
333
|
+
return { value: next, cursor: cursor + input.length };
|
|
334
|
+
}
|
|
328
335
|
function CjkTextInput({
|
|
329
336
|
value,
|
|
330
337
|
onChange,
|
|
@@ -336,7 +343,6 @@ function CjkTextInput({
|
|
|
336
343
|
const valueRef = (0, import_react.useRef)(value);
|
|
337
344
|
const cursorRef = (0, import_react.useRef)(value.length);
|
|
338
345
|
const [, forceRender] = (0, import_react.useState)(0);
|
|
339
|
-
const { setCursorPosition } = (0, import_ink3.useCursor)();
|
|
340
346
|
if (value !== valueRef.current) {
|
|
341
347
|
valueRef.current = value;
|
|
342
348
|
if (cursorRef.current > value.length) {
|
|
@@ -369,37 +375,25 @@ function CjkTextInput({
|
|
|
369
375
|
}
|
|
370
376
|
if (key.backspace || key.delete) {
|
|
371
377
|
if (cursorRef.current > 0) {
|
|
372
|
-
const
|
|
373
|
-
const
|
|
378
|
+
const v = valueRef.current;
|
|
379
|
+
const next = v.slice(0, cursorRef.current - 1) + v.slice(cursorRef.current);
|
|
374
380
|
cursorRef.current -= 1;
|
|
375
|
-
valueRef.current =
|
|
376
|
-
onChange(
|
|
381
|
+
valueRef.current = next;
|
|
382
|
+
onChange(next);
|
|
377
383
|
}
|
|
378
384
|
return;
|
|
379
385
|
}
|
|
380
|
-
|
|
381
|
-
const printable = input.replace(/[\x00-\x1f\x7f]/g, "");
|
|
386
|
+
const printable = filterPrintable(input);
|
|
382
387
|
if (printable.length === 0) return;
|
|
383
|
-
const
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
valueRef.current = next;
|
|
388
|
-
onChange(next);
|
|
388
|
+
const result = insertAtCursor(valueRef.current, cursorRef.current, printable);
|
|
389
|
+
cursorRef.current = result.cursor;
|
|
390
|
+
valueRef.current = result.value;
|
|
391
|
+
onChange(result.value);
|
|
389
392
|
} catch {
|
|
390
393
|
}
|
|
391
394
|
},
|
|
392
395
|
{ isActive: focus }
|
|
393
396
|
);
|
|
394
|
-
if (showCursor && focus) {
|
|
395
|
-
try {
|
|
396
|
-
const textBeforeCursor = [...valueRef.current].slice(0, cursorRef.current).join("");
|
|
397
|
-
const cursorX = 4 + (0, import_string_width.default)(textBeforeCursor);
|
|
398
|
-
setCursorPosition({ x: cursorX, y: 0 });
|
|
399
|
-
} catch {
|
|
400
|
-
setCursorPosition({ x: 4, y: 0 });
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
397
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ink3.Text, { children: renderWithCursor(valueRef.current, cursorRef.current, placeholder, showCursor && focus) });
|
|
404
398
|
}
|
|
405
399
|
function renderWithCursor(value, cursorOffset, placeholder, showCursor) {
|
package/dist/node/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@robota-sdk/agent-cli",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.13",
|
|
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-core": "3.0.0-beta.
|
|
39
|
-
"@robota-sdk/agent-sdk": "3.0.0-beta.
|
|
38
|
+
"@robota-sdk/agent-core": "3.0.0-beta.13",
|
|
39
|
+
"@robota-sdk/agent-sdk": "3.0.0-beta.13"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/marked": "^6.0.0",
|