@koush/chatsh 1.0.10 → 1.0.11
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/main.js +6 -2
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -174,7 +174,8 @@ async function main() {
|
|
|
174
174
|
await once(server, 'listening');
|
|
175
175
|
const address = server.address();
|
|
176
176
|
const port = address && typeof address === 'object' ? address.port : 0;
|
|
177
|
-
const
|
|
177
|
+
const shell = process.env.SHELL || '/bin/zsh';
|
|
178
|
+
const ptyProcess = spawn(shell, ['-i'], {
|
|
178
179
|
name: process.env.TERM || 'xterm',
|
|
179
180
|
cols: process.stdout.columns || 80,
|
|
180
181
|
rows: process.stdout.rows || 24,
|
|
@@ -184,7 +185,7 @@ async function main() {
|
|
|
184
185
|
process.stdin.setRawMode(true);
|
|
185
186
|
process.stdin.resume();
|
|
186
187
|
process.stdin.on('data', (data) => {
|
|
187
|
-
ptyProcess.write(data
|
|
188
|
+
ptyProcess.write(data);
|
|
188
189
|
});
|
|
189
190
|
ptyProcess.onData((data) => {
|
|
190
191
|
const clearSeq = '\x1b[2J';
|
|
@@ -200,6 +201,9 @@ async function main() {
|
|
|
200
201
|
process.stdout.write(data);
|
|
201
202
|
});
|
|
202
203
|
ptyProcess.write('help() { curl -s -X POST -d "$*" http://localhost:$LLMSH_PORT }\n');
|
|
204
|
+
if (shell.includes('zsh')) {
|
|
205
|
+
ptyProcess.write('bindkey "^R" history-incremental-search-backward\n');
|
|
206
|
+
}
|
|
203
207
|
ptyProcess.onExit(({ exitCode }) => {
|
|
204
208
|
process.exit(exitCode);
|
|
205
209
|
});
|