ccmanager 0.0.5 → 0.0.6

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.
@@ -18,7 +18,8 @@ export class SessionManager extends EventEmitter {
18
18
  }
19
19
  detectSessionState(cleanData, currentState, sessionId) {
20
20
  const hasBottomBorder = includesPromptBoxBottomBorder(cleanData);
21
- const hasWaitingPrompt = cleanData.includes('│ Do you want');
21
+ const hasWaitingPrompt = cleanData.includes('│ Do you want') ||
22
+ cleanData.includes('│ Would you like');
22
23
  const wasWaitingWithBottomBorder = this.waitingWithBottomBorder.get(sessionId) || false;
23
24
  const hasEscToInterrupt = cleanData
24
25
  .toLowerCase()
@@ -55,21 +56,6 @@ export class SessionManager extends EventEmitter {
55
56
  this.busyTimers.delete(sessionId);
56
57
  }
57
58
  }
58
- else if (currentState === 'waiting_input' &&
59
- hasBottomBorder &&
60
- !hasWaitingPrompt &&
61
- wasWaitingWithBottomBorder) {
62
- // We've already seen the bottom border for this waiting prompt,
63
- // so transition to idle
64
- newState = 'idle';
65
- this.waitingWithBottomBorder.set(sessionId, false);
66
- // Clear any pending busy timer
67
- const existingTimer = this.busyTimers.get(sessionId);
68
- if (existingTimer) {
69
- clearTimeout(existingTimer);
70
- this.busyTimers.delete(sessionId);
71
- }
72
- }
73
59
  else if (hasEscToInterrupt) {
74
60
  // If "esc to interrupt" is present, set state to busy
75
61
  newState = 'busy';
@@ -99,18 +85,6 @@ export class SessionManager extends EventEmitter {
99
85
  // Keep current busy state for now
100
86
  newState = 'busy';
101
87
  }
102
- else if (currentState === 'waiting_input') {
103
- // If we're in waiting_input but no special patterns detected,
104
- // transition to idle and clear the flag
105
- newState = 'idle';
106
- this.waitingWithBottomBorder.set(sessionId, false);
107
- // Clear any pending busy timer
108
- const existingTimer = this.busyTimers.get(sessionId);
109
- if (existingTimer) {
110
- clearTimeout(existingTimer);
111
- this.busyTimers.delete(sessionId);
112
- }
113
- }
114
88
  return newState;
115
89
  }
116
90
  constructor() {
@@ -20,6 +20,13 @@ describe('SessionManager', () => {
20
20
  const newState = sessionManager.detectSessionState(cleanData, currentState, mockSessionId);
21
21
  expect(newState).toBe('waiting_input');
22
22
  });
23
+ it('should detect waiting_input state when "Would you like" prompt is present', () => {
24
+ const cleanData = '│ Would you like to proceed?';
25
+ const currentState = 'idle';
26
+ vi.mocked(includesPromptBoxBottomBorder).mockReturnValue(false);
27
+ const newState = sessionManager.detectSessionState(cleanData, currentState, mockSessionId);
28
+ expect(newState).toBe('waiting_input');
29
+ });
23
30
  it('should set waitingWithBottomBorder when waiting prompt and bottom border are both present', () => {
24
31
  const cleanData = '│ Do you want to continue?\n└───────────────────────┘';
25
32
  const currentState = 'idle';
@@ -62,16 +69,6 @@ describe('SessionManager', () => {
62
69
  const newState = sessionManager.detectSessionState(cleanData, currentState, mockSessionId);
63
70
  expect(newState).toBe('busy');
64
71
  });
65
- it('should not change from waiting_input when bottom border was already seen', () => {
66
- const cleanData = '└───────────────────────┘';
67
- const currentState = 'waiting_input';
68
- vi.mocked(includesPromptBoxBottomBorder).mockReturnValue(true);
69
- // First, simulate seeing waiting prompt with bottom border
70
- sessionManager.detectSessionState('│ Do you want to continue?\n└───────────────────────┘', 'idle', mockSessionId);
71
- // Now another bottom border appears
72
- const newState = sessionManager.detectSessionState(cleanData, currentState, mockSessionId);
73
- expect(newState).toBe('idle'); // Should change to idle since we already saw the bottom border
74
- });
75
72
  it('should clear waitingWithBottomBorder flag when transitioning to busy', () => {
76
73
  const cleanData = 'Processing... Press ESC to interrupt';
77
74
  const currentState = 'waiting_input';
@@ -84,18 +81,6 @@ describe('SessionManager', () => {
84
81
  const newState = sessionManager.detectSessionState(cleanData, currentState, mockSessionId);
85
82
  expect(newState).toBe('busy');
86
83
  });
87
- it('should clear waitingWithBottomBorder flag when transitioning to idle', () => {
88
- const cleanData = 'Task completed successfully';
89
- const currentState = 'waiting_input';
90
- vi.mocked(includesPromptBoxBottomBorder).mockReturnValue(false);
91
- // First set up waiting state with bottom border
92
- vi.mocked(includesPromptBoxBottomBorder).mockReturnValue(true);
93
- sessionManager.detectSessionState('│ Do you want to continue?\n└───────────────────────┘', 'idle', mockSessionId);
94
- // Now transition to idle
95
- vi.mocked(includesPromptBoxBottomBorder).mockReturnValue(false);
96
- const newState = sessionManager.detectSessionState(cleanData, currentState, mockSessionId);
97
- expect(newState).toBe('idle');
98
- });
99
84
  it('should transition from busy to idle after 500ms timer when no "esc to interrupt"', async () => {
100
85
  // Create a mock session for the timer test
101
86
  const mockWorktreePath = '/test/worktree';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccmanager",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "TUI application for managing multiple Claude Code sessions across Git worktrees",
5
5
  "license": "MIT",
6
6
  "author": "Kodai Kabasawa",