Files
hakorune/tools/codex-tmux-driver/send-enter-first.js

30 lines
775 B
JavaScript
Raw Normal View History

const WebSocket = require('ws');
const ws = new WebSocket('ws://localhost:8770');
ws.on('open', async () => {
console.log('✨ Sending Enter key first, then message...');
// まずEnterキーを送信して現在の入力を実行
ws.send(JSON.stringify({
type: 'inject-input',
data: '' // 空文字列 + Enterで現在の行を実行
}));
// 少し待ってから新しいメッセージ
setTimeout(() => {
ws.send(JSON.stringify({
type: 'inject-input',
data: 'Nyashプロジェクトから挨拶だにゃJIT開発頑張ってるにゃ🐱'
}));
setTimeout(() => {
ws.close();
console.log('✅ Complete!');
}, 500);
}, 1000);
});
ws.on('error', (err) => {
console.error('Error:', err);
});