@sickr/cli 0.9.12 → 0.9.13
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/run.js +8 -1
- package/package.json +1 -1
package/dist/run.js
CHANGED
|
@@ -143,6 +143,7 @@ export function stripAnsi(input) {
|
|
|
143
143
|
export function cleanPtyResponse(input, lastPrompt = '') {
|
|
144
144
|
const prompt = lastPrompt.trim();
|
|
145
145
|
return stripAnsi(input)
|
|
146
|
+
.replace(/[\u2800-\u28ff]/g, '')
|
|
146
147
|
.replace(/\r/g, '\n')
|
|
147
148
|
.split('\n')
|
|
148
149
|
.map((line) => line.replace(/^>+\s?/, '').trimEnd())
|
|
@@ -152,7 +153,7 @@ export function cleanPtyResponse(input, lastPrompt = '') {
|
|
|
152
153
|
return false;
|
|
153
154
|
if (prompt && trimmed === prompt)
|
|
154
155
|
return false;
|
|
155
|
-
if (trimmed
|
|
156
|
+
if (trimmed.includes('Send a message (/? for help)'))
|
|
156
157
|
return false;
|
|
157
158
|
return true;
|
|
158
159
|
})
|
|
@@ -166,6 +167,7 @@ export class HooklessPtyEventSynth {
|
|
|
166
167
|
inputBuffer = '';
|
|
167
168
|
outputBuffer = '';
|
|
168
169
|
lastPrompt = '';
|
|
170
|
+
awaitingResponse = false;
|
|
169
171
|
responseTimer = null;
|
|
170
172
|
constructor(identity, send, responseDelayMs = 700) {
|
|
171
173
|
this.identity = identity;
|
|
@@ -193,9 +195,13 @@ export class HooklessPtyEventSynth {
|
|
|
193
195
|
if (!prompt)
|
|
194
196
|
return;
|
|
195
197
|
this.lastPrompt = prompt;
|
|
198
|
+
this.outputBuffer = '';
|
|
199
|
+
this.awaitingResponse = true;
|
|
196
200
|
this.sendEvent('prompt', 'Prompt', prompt);
|
|
197
201
|
}
|
|
198
202
|
observeOutput(chunk) {
|
|
203
|
+
if (!this.awaitingResponse)
|
|
204
|
+
return;
|
|
199
205
|
this.outputBuffer += chunk;
|
|
200
206
|
if (this.responseTimer)
|
|
201
207
|
clearTimeout(this.responseTimer);
|
|
@@ -210,6 +216,7 @@ export class HooklessPtyEventSynth {
|
|
|
210
216
|
this.outputBuffer = '';
|
|
211
217
|
if (!detail)
|
|
212
218
|
return;
|
|
219
|
+
this.awaitingResponse = false;
|
|
213
220
|
this.sendEvent('response', this.identity.agent, detail);
|
|
214
221
|
}
|
|
215
222
|
sendEvent(kind, label, detail) {
|