@letta-ai/letta-code 0.18.0 → 0.18.1
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/letta.js +18533 -4114
- package/package.json +3 -1
- package/scripts/postinstall-patches.js +1 -0
- package/vendor/ink/build/wrap-text.js +31 -0
- package/vendor/ink-text-input/build/index.js +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@letta-ai/letta-code",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.1",
|
|
4
4
|
"description": "Letta Code is a CLI tool for interacting with stateful Letta agents from the terminal.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -35,7 +35,9 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@letta-ai/letta-client": "^1.7.12",
|
|
37
37
|
"glob": "^13.0.0",
|
|
38
|
+
"highlight.js": "^11.11.1",
|
|
38
39
|
"ink-link": "^5.0.0",
|
|
40
|
+
"lowlight": "^3.3.0",
|
|
39
41
|
"open": "^10.2.0",
|
|
40
42
|
"sharp": "^0.34.5",
|
|
41
43
|
"ws": "^8.19.0"
|
|
@@ -101,6 +101,7 @@ await copyToResolved(
|
|
|
101
101
|
);
|
|
102
102
|
await copyToResolved("vendor/ink/build/devtools.js", "ink/build/devtools.js");
|
|
103
103
|
await copyToResolved("vendor/ink/build/log-update.js", "ink/build/log-update.js");
|
|
104
|
+
await copyToResolved("vendor/ink/build/wrap-text.js", "ink/build/wrap-text.js");
|
|
104
105
|
|
|
105
106
|
// ink-text-input (optional vendor with externalCursorOffset support)
|
|
106
107
|
await copyToResolved(
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import wrapAnsi from 'wrap-ansi';
|
|
2
|
+
import cliTruncate from 'cli-truncate';
|
|
3
|
+
const cache = {};
|
|
4
|
+
const wrapText = (text, maxWidth, wrapType) => {
|
|
5
|
+
const cacheKey = text + String(maxWidth) + String(wrapType);
|
|
6
|
+
const cachedText = cache[cacheKey];
|
|
7
|
+
if (cachedText) {
|
|
8
|
+
return cachedText;
|
|
9
|
+
}
|
|
10
|
+
let wrappedText = text;
|
|
11
|
+
if (wrapType === 'wrap') {
|
|
12
|
+
wrappedText = wrapAnsi(text, maxWidth, {
|
|
13
|
+
trim: true,
|
|
14
|
+
hard: true,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
if (wrapType.startsWith('truncate')) {
|
|
18
|
+
let position = 'end';
|
|
19
|
+
if (wrapType === 'truncate-middle') {
|
|
20
|
+
position = 'middle';
|
|
21
|
+
}
|
|
22
|
+
if (wrapType === 'truncate-start') {
|
|
23
|
+
position = 'start';
|
|
24
|
+
}
|
|
25
|
+
wrappedText = cliTruncate(text, maxWidth, { position });
|
|
26
|
+
}
|
|
27
|
+
cache[cacheKey] = wrappedText;
|
|
28
|
+
return wrappedText;
|
|
29
|
+
};
|
|
30
|
+
export default wrapText;
|
|
31
|
+
//# sourceMappingURL=wrap-text.js.map
|
|
@@ -70,21 +70,21 @@ function TextInput({ value: originalValue, placeholder = '', focus = true, mask,
|
|
|
70
70
|
let renderedValue = value;
|
|
71
71
|
let renderedPlaceholder = placeholder ? chalk.grey(placeholder) : undefined;
|
|
72
72
|
if (showCursor && focus) {
|
|
73
|
-
renderedPlaceholder = placeholder.length > 0 ? chalk.inverse(placeholder[0]) + chalk.grey(placeholder.slice(1)) : chalk.inverse('
|
|
74
|
-
renderedValue = value.length > 0 ? '' : chalk.inverse('
|
|
73
|
+
renderedPlaceholder = placeholder.length > 0 ? chalk.inverse(placeholder[0]) + chalk.grey(placeholder.slice(1)) : chalk.inverse('\u00A0');
|
|
74
|
+
renderedValue = value.length > 0 ? '' : chalk.inverse('\u00A0');
|
|
75
75
|
let i = 0;
|
|
76
76
|
for (const char of value) {
|
|
77
77
|
const isCursorPosition = i >= cursorOffset - cursorActualWidth && i <= cursorOffset;
|
|
78
78
|
if (isCursorPosition && char === '\n') {
|
|
79
79
|
// Newline at cursor: show inverted space (visible cursor) then the newline
|
|
80
|
-
renderedValue += chalk.inverse('
|
|
80
|
+
renderedValue += chalk.inverse('\u00A0') + char;
|
|
81
81
|
} else {
|
|
82
82
|
renderedValue += isCursorPosition ? chalk.inverse(char) : char;
|
|
83
83
|
}
|
|
84
84
|
i++;
|
|
85
85
|
}
|
|
86
86
|
if (value.length > 0 && cursorOffset === value.length) {
|
|
87
|
-
renderedValue += chalk.inverse('
|
|
87
|
+
renderedValue += chalk.inverse('\u00A0');
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
useInput((input, key) => {
|