ccmanager 2.3.0 → 2.4.0
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.
|
@@ -76,13 +76,13 @@ export class CodexStateDetector extends BaseStateDetector {
|
|
|
76
76
|
const content = this.getTerminalContent(terminal);
|
|
77
77
|
const lowerContent = content.toLowerCase();
|
|
78
78
|
// Check for waiting prompts
|
|
79
|
-
if (
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
if (lowerContent.includes('allow command?') ||
|
|
80
|
+
lowerContent.includes('[y/n]') ||
|
|
81
|
+
lowerContent.includes('yes (y)')) {
|
|
82
82
|
return 'waiting_input';
|
|
83
83
|
}
|
|
84
84
|
// Check for busy state
|
|
85
|
-
if (
|
|
85
|
+
if (/esc.*interrupt/i.test(lowerContent)) {
|
|
86
86
|
return 'busy';
|
|
87
87
|
}
|
|
88
88
|
// Otherwise idle
|
|
@@ -295,38 +295,38 @@ describe('CodexStateDetector', () => {
|
|
|
295
295
|
beforeEach(() => {
|
|
296
296
|
detector = new CodexStateDetector();
|
|
297
297
|
});
|
|
298
|
-
it('should detect waiting_input state for
|
|
298
|
+
it('should detect waiting_input state for Allow command? pattern', () => {
|
|
299
299
|
// Arrange
|
|
300
|
-
terminal = createMockTerminal(['Some output', '
|
|
300
|
+
terminal = createMockTerminal(['Some output', 'Allow command?', '│ > ']);
|
|
301
301
|
// Act
|
|
302
302
|
const state = detector.detectState(terminal, 'idle');
|
|
303
303
|
// Assert
|
|
304
304
|
expect(state).toBe('waiting_input');
|
|
305
305
|
});
|
|
306
|
-
it('should detect waiting_input state for [y/
|
|
306
|
+
it('should detect waiting_input state for [y/n] pattern', () => {
|
|
307
307
|
// Arrange
|
|
308
|
-
terminal = createMockTerminal(['Some output', 'Continue? [y/
|
|
308
|
+
terminal = createMockTerminal(['Some output', 'Continue? [y/n]', '> ']);
|
|
309
309
|
// Act
|
|
310
310
|
const state = detector.detectState(terminal, 'idle');
|
|
311
311
|
// Assert
|
|
312
312
|
expect(state).toBe('waiting_input');
|
|
313
313
|
});
|
|
314
|
-
it('should detect waiting_input state for
|
|
314
|
+
it('should detect waiting_input state for yes (y) pattern', () => {
|
|
315
315
|
// Arrange
|
|
316
316
|
terminal = createMockTerminal([
|
|
317
317
|
'Some output',
|
|
318
|
-
'
|
|
318
|
+
'Apply changes? yes (y) / no (n)',
|
|
319
319
|
]);
|
|
320
320
|
// Act
|
|
321
321
|
const state = detector.detectState(terminal, 'idle');
|
|
322
322
|
// Assert
|
|
323
323
|
expect(state).toBe('waiting_input');
|
|
324
324
|
});
|
|
325
|
-
it('should detect busy state for
|
|
325
|
+
it('should detect busy state for Esc to interrupt pattern', () => {
|
|
326
326
|
// Arrange
|
|
327
327
|
terminal = createMockTerminal([
|
|
328
328
|
'Processing...',
|
|
329
|
-
'
|
|
329
|
+
'Esc to interrupt',
|
|
330
330
|
'Working...',
|
|
331
331
|
]);
|
|
332
332
|
// Act
|
|
@@ -334,11 +334,11 @@ describe('CodexStateDetector', () => {
|
|
|
334
334
|
// Assert
|
|
335
335
|
expect(state).toBe('busy');
|
|
336
336
|
});
|
|
337
|
-
it('should detect busy state for
|
|
337
|
+
it('should detect busy state for ESC INTERRUPT (uppercase)', () => {
|
|
338
338
|
// Arrange
|
|
339
339
|
terminal = createMockTerminal([
|
|
340
340
|
'Processing...',
|
|
341
|
-
'PRESS ESC
|
|
341
|
+
'PRESS ESC TO INTERRUPT',
|
|
342
342
|
'Working...',
|
|
343
343
|
]);
|
|
344
344
|
// Act
|
|
@@ -356,7 +356,7 @@ describe('CodexStateDetector', () => {
|
|
|
356
356
|
});
|
|
357
357
|
it('should prioritize waiting_input over busy', () => {
|
|
358
358
|
// Arrange
|
|
359
|
-
terminal = createMockTerminal(['press esc to
|
|
359
|
+
terminal = createMockTerminal(['press esc to interrupt', '[y/n]']);
|
|
360
360
|
// Act
|
|
361
361
|
const state = detector.detectState(terminal, 'idle');
|
|
362
362
|
// Assert
|