(proc, operations)
| 155 | } |
| 156 | |
| 157 | async function executePtyOperations(proc, operations) { |
| 158 | if (!proc) throw new Error('Claude is not running'); |
| 159 | for (const operation of operations) { |
| 160 | if (!proc) throw new Error('Claude is not running'); |
| 161 | if (operation.type === 'delay') { |
| 162 | await sleep(operation.ms); |
| 163 | continue; |
| 164 | } |
| 165 | if (operation.type === 'input') { |
| 166 | proc.write(operation.data); |
| 167 | continue; |
| 168 | } |
| 169 | if (operation.type === 'text') { |
| 170 | proc.write(operation.data); |
| 171 | await sleep(CHAT_SUBMIT_DELAY_MS); |
| 172 | proc.write('\r'); |
| 173 | } |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | module.exports = { |
| 178 | normalizeAskUserQuestionSubmission, |
no test coverage detected