Skip to content

Commit 9709315

Browse files
authored
Merge pull request #129 from kbwo/feature/gemini-2025-11-24
feat: update state detection strategy for gemini
2 parents 2f1ba96 + a281ada commit 9709315

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/services/__tests__/stateDetector.gemini.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,21 @@ describe('GeminiStateDetector', () => {
5757
expect(state).toBe('waiting_input');
5858
});
5959

60+
it('should detect waiting_input for multiline confirmation ending with "yes"', () => {
61+
// Arrange
62+
terminal = createMockTerminal([
63+
'Apply this change to the workspace?',
64+
'The operation will modify several files.',
65+
' yes',
66+
]);
67+
68+
// Act
69+
const state = detector.detectState(terminal, 'idle');
70+
71+
// Assert
72+
expect(state).toBe('waiting_input');
73+
});
74+
6075
it('should detect busy when "esc to cancel" is present', () => {
6176
// Arrange
6277
terminal = createMockTerminal([

src/services/stateDetector.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,15 @@ export class GeminiStateDetector extends BaseStateDetector {
128128
return 'waiting_input';
129129
}
130130

131+
// Check for multiline confirmation prompts ending with "yes"
132+
if (
133+
/(allow execution|do you want to|apply this change)[\s\S]*?\n+[\s\S]*?\byes\b/.test(
134+
lowerContent,
135+
)
136+
) {
137+
return 'waiting_input';
138+
}
139+
131140
// Check for busy state
132141
if (lowerContent.includes('esc to cancel')) {
133142
return 'busy';

0 commit comments

Comments
 (0)