@letta-ai/letta-code 0.24.13 → 0.25.0
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 +128419 -82983
- package/package.json +4 -1
- package/vendor/ink-text-input/build/index.js +14 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@letta-ai/letta-code",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
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": {
|
|
@@ -48,12 +48,15 @@
|
|
|
48
48
|
"@vscode/ripgrep": "^1.17.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
+
"@ai-sdk/anthropic": "^3.0.73",
|
|
52
|
+
"@ai-sdk/openai": "^3.0.55",
|
|
51
53
|
"@slack/bolt": "^4.7.0",
|
|
52
54
|
"@types/bun": "^1.3.7",
|
|
53
55
|
"@types/diff": "^8.0.0",
|
|
54
56
|
"@types/picomatch": "^4.0.2",
|
|
55
57
|
"@types/react": "^19.2.9",
|
|
56
58
|
"@types/ws": "^8.18.1",
|
|
59
|
+
"ai": "^6.0.171",
|
|
57
60
|
"diff": "^8.0.2",
|
|
58
61
|
"grammy": "^1.42.0",
|
|
59
62
|
"husky": "9.1.7",
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
import { Text, useInput } from 'ink';
|
|
2
|
+
import { Text, Transform, useInput } from 'ink';
|
|
3
3
|
import React, { useEffect, useState } from 'react';
|
|
4
4
|
|
|
5
|
+
// Use a private-use sentinel while Ink/wrap-ansi measure and wrap text.
|
|
6
|
+
// wrap-ansi with trim:true strips inverse ASCII spaces at line boundaries, but
|
|
7
|
+
// rendering an inverse NBSP can show a visible glyph in some terminals/fonts.
|
|
8
|
+
// The Transform below converts this sentinel back to an inverse ASCII space
|
|
9
|
+
// after wrapping has completed, before anything is written to the terminal.
|
|
10
|
+
const CURSOR_SENTINEL = '\u{10FFFD}';
|
|
11
|
+
|
|
5
12
|
/**
|
|
6
13
|
* Determines if the input should be treated as a control sequence (not inserted as text).
|
|
7
14
|
* This centralizes escape sequence filtering to prevent garbage characters from being inserted.
|
|
@@ -70,21 +77,21 @@ function TextInput({ value: originalValue, placeholder = '', focus = true, mask,
|
|
|
70
77
|
let renderedValue = value;
|
|
71
78
|
let renderedPlaceholder = placeholder ? chalk.grey(placeholder) : undefined;
|
|
72
79
|
if (showCursor && focus) {
|
|
73
|
-
renderedPlaceholder = placeholder.length > 0 ? chalk.inverse(placeholder[0]) + chalk.grey(placeholder.slice(1)) :
|
|
74
|
-
renderedValue = value.length > 0 ? '' :
|
|
80
|
+
renderedPlaceholder = placeholder.length > 0 ? chalk.inverse(placeholder[0]) + chalk.grey(placeholder.slice(1)) : CURSOR_SENTINEL;
|
|
81
|
+
renderedValue = value.length > 0 ? '' : CURSOR_SENTINEL;
|
|
75
82
|
let i = 0;
|
|
76
83
|
for (const char of value) {
|
|
77
84
|
const isCursorPosition = i >= cursorOffset - cursorActualWidth && i <= cursorOffset;
|
|
78
85
|
if (isCursorPosition && char === '\n') {
|
|
79
86
|
// Newline at cursor: show inverted space (visible cursor) then the newline
|
|
80
|
-
renderedValue +=
|
|
87
|
+
renderedValue += CURSOR_SENTINEL + char;
|
|
81
88
|
} else {
|
|
82
89
|
renderedValue += isCursorPosition ? chalk.inverse(char) : char;
|
|
83
90
|
}
|
|
84
91
|
i++;
|
|
85
92
|
}
|
|
86
93
|
if (value.length > 0 && cursorOffset === value.length) {
|
|
87
|
-
renderedValue +=
|
|
94
|
+
renderedValue += CURSOR_SENTINEL;
|
|
88
95
|
}
|
|
89
96
|
}
|
|
90
97
|
useInput((input, key) => {
|
|
@@ -173,7 +180,8 @@ function TextInput({ value: originalValue, placeholder = '', focus = true, mask,
|
|
|
173
180
|
onChange(nextValue);
|
|
174
181
|
}
|
|
175
182
|
}, { isActive: focus });
|
|
176
|
-
return (React.createElement(
|
|
183
|
+
return (React.createElement(Transform, { transform: line => line.replaceAll(CURSOR_SENTINEL, chalk.inverse(' ')) },
|
|
184
|
+
React.createElement(Text, null, placeholder ? (value.length > 0 ? renderedValue : renderedPlaceholder) : renderedValue)));
|
|
177
185
|
}
|
|
178
186
|
export default TextInput;
|
|
179
187
|
export function UncontrolledTextInput({ initialValue = '', ...props }) {
|