@sickr/cli 0.9.14 → 0.9.15

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.
Files changed (2) hide show
  1. package/dist/run.js +14 -3
  2. package/package.json +1 -1
package/dist/run.js CHANGED
@@ -160,6 +160,10 @@ export function cleanPtyResponse(input, lastPrompt = '') {
160
160
  .join('\n')
161
161
  .trim();
162
162
  }
163
+ function hasPtyPromptMarker(input) {
164
+ const clean = stripAnsi(input).replace(/[\u2800-\u28ff]/g, '');
165
+ return clean.includes('>>> Send a message (/? for help)') || /(?:^|\n)\s*>>>\s*$/.test(clean);
166
+ }
163
167
  export class HooklessPtyEventSynth {
164
168
  identity;
165
169
  send;
@@ -169,7 +173,7 @@ export class HooklessPtyEventSynth {
169
173
  lastPrompt = '';
170
174
  awaitingResponse = false;
171
175
  responseTimer = null;
172
- constructor(identity, send, responseDelayMs = 700) {
176
+ constructor(identity, send, responseDelayMs = 2500) {
173
177
  this.identity = identity;
174
178
  this.send = send;
175
179
  this.responseDelayMs = responseDelayMs;
@@ -191,18 +195,25 @@ export class HooklessPtyEventSynth {
191
195
  this.recordPrompt(submitted);
192
196
  }
193
197
  recordPrompt(text) {
198
+ this.prepareResponse(text);
199
+ this.sendEvent('prompt', 'Prompt', this.lastPrompt);
200
+ }
201
+ prepareResponse(text) {
194
202
  const prompt = stripAnsi(text).replace(/\r/g, '\n').trim();
195
203
  if (!prompt)
196
204
  return;
197
205
  this.lastPrompt = prompt;
198
206
  this.outputBuffer = '';
199
207
  this.awaitingResponse = true;
200
- this.sendEvent('prompt', 'Prompt', prompt);
201
208
  }
202
209
  observeOutput(chunk) {
203
210
  if (!this.awaitingResponse)
204
211
  return;
205
212
  this.outputBuffer += chunk;
213
+ if (hasPtyPromptMarker(this.outputBuffer)) {
214
+ this.flushResponse();
215
+ return;
216
+ }
206
217
  if (this.responseTimer)
207
218
  clearTimeout(this.responseTimer);
208
219
  this.responseTimer = setTimeout(() => this.flushResponse(), this.responseDelayMs);
@@ -640,7 +651,7 @@ export async function startRun(opts) {
640
651
  pty.write('\r');
641
652
  }
642
653
  catch { /* pty exited */ } }, 80);
643
- hooklessSynth?.recordPrompt(m.text);
654
+ hooklessSynth?.prepareResponse(m.text);
644
655
  }
645
656
  catch { /* PTY may have exited */ }
646
657
  if (opts.verbose)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sickr/cli",
3
- "version": "0.9.14",
3
+ "version": "0.9.15",
4
4
  "type": "module",
5
5
  "description": "npx @sickr/cli - replay, live look, and workflow orchestration for AI coding agents.",
6
6
  "bin": {