ccmanager 3.5.0 → 3.5.1

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.
@@ -13,6 +13,7 @@ export declare const STATUS_LABELS: {
13
13
  export declare const STATUS_TAGS: {
14
14
  readonly BACKGROUND_TASK: "\u001B[2m[BG]\u001B[0m";
15
15
  };
16
+ export declare const getBackgroundTaskTag: (count: number) => string;
16
17
  export declare const MENU_ICONS: {
17
18
  readonly NEW_WORKTREE: "⊕";
18
19
  readonly MERGE_WORKTREE: "⇄";
@@ -20,4 +21,4 @@ export declare const MENU_ICONS: {
20
21
  readonly CONFIGURE_SHORTCUTS: "⌨";
21
22
  readonly EXIT: "⏻";
22
23
  };
23
- export declare const getStatusDisplay: (status: SessionState, hasBackgroundTask?: boolean) => string;
24
+ export declare const getStatusDisplay: (status: SessionState, backgroundTaskCount?: number) => string;
@@ -12,6 +12,16 @@ export const STATUS_LABELS = {
12
12
  export const STATUS_TAGS = {
13
13
  BACKGROUND_TASK: '\x1b[2m[BG]\x1b[0m',
14
14
  };
15
+ export const getBackgroundTaskTag = (count) => {
16
+ if (count <= 0) {
17
+ return '';
18
+ }
19
+ if (count === 1) {
20
+ return STATUS_TAGS.BACKGROUND_TASK;
21
+ }
22
+ // count >= 2: show [BG:N]
23
+ return `\x1b[2m[BG:${count}]\x1b[0m`;
24
+ };
15
25
  export const MENU_ICONS = {
16
26
  NEW_WORKTREE: '⊕',
17
27
  MERGE_WORKTREE: '⇄',
@@ -31,9 +41,8 @@ const getBaseStatusDisplay = (status) => {
31
41
  return `${STATUS_ICONS.IDLE} ${STATUS_LABELS.IDLE}`;
32
42
  }
33
43
  };
34
- export const getStatusDisplay = (status, hasBackgroundTask = false) => {
44
+ export const getStatusDisplay = (status, backgroundTaskCount = 0) => {
35
45
  const display = getBaseStatusDisplay(status);
36
- return hasBackgroundTask
37
- ? `${display} ${STATUS_TAGS.BACKGROUND_TASK}`
38
- : display;
46
+ const bgTag = getBackgroundTaskTag(backgroundTaskCount);
47
+ return bgTag ? `${display} ${bgTag}` : display;
39
48
  };
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { getStatusDisplay, STATUS_ICONS, STATUS_LABELS, STATUS_TAGS, } from './statusIcons.js';
2
+ import { getStatusDisplay, getBackgroundTaskTag, STATUS_ICONS, STATUS_LABELS, STATUS_TAGS, } from './statusIcons.js';
3
3
  describe('getStatusDisplay', () => {
4
4
  it('should return busy display for busy state', () => {
5
5
  const result = getStatusDisplay('busy');
@@ -18,25 +18,55 @@ describe('getStatusDisplay', () => {
18
18
  expect(result).toBe(`${STATUS_ICONS.IDLE} ${STATUS_LABELS.IDLE}`);
19
19
  });
20
20
  describe('background task indicator', () => {
21
- it('should append [BG] badge when idle and hasBackgroundTask is true', () => {
22
- const result = getStatusDisplay('idle', true);
21
+ it('should append [BG] badge when idle and backgroundTaskCount is 1', () => {
22
+ const result = getStatusDisplay('idle', 1);
23
23
  expect(result).toBe(`${STATUS_ICONS.IDLE} ${STATUS_LABELS.IDLE} ${STATUS_TAGS.BACKGROUND_TASK}`);
24
24
  });
25
- it('should not append [BG] badge when idle and hasBackgroundTask is false', () => {
26
- const result = getStatusDisplay('idle', false);
25
+ it('should not append [BG] badge when idle and backgroundTaskCount is 0', () => {
26
+ const result = getStatusDisplay('idle', 0);
27
27
  expect(result).toBe(`${STATUS_ICONS.IDLE} ${STATUS_LABELS.IDLE}`);
28
28
  });
29
- it('should append [BG] badge when busy and hasBackgroundTask is true', () => {
30
- const result = getStatusDisplay('busy', true);
29
+ it('should append [BG] badge when busy and backgroundTaskCount is 1', () => {
30
+ const result = getStatusDisplay('busy', 1);
31
31
  expect(result).toBe(`${STATUS_ICONS.BUSY} ${STATUS_LABELS.BUSY} ${STATUS_TAGS.BACKGROUND_TASK}`);
32
32
  });
33
- it('should append [BG] badge when waiting_input and hasBackgroundTask is true', () => {
34
- const result = getStatusDisplay('waiting_input', true);
33
+ it('should append [BG] badge when waiting_input and backgroundTaskCount is 1', () => {
34
+ const result = getStatusDisplay('waiting_input', 1);
35
35
  expect(result).toBe(`${STATUS_ICONS.WAITING} ${STATUS_LABELS.WAITING} ${STATUS_TAGS.BACKGROUND_TASK}`);
36
36
  });
37
- it('should append [BG] badge when pending_auto_approval and hasBackgroundTask is true', () => {
38
- const result = getStatusDisplay('pending_auto_approval', true);
37
+ it('should append [BG] badge when pending_auto_approval and backgroundTaskCount is 1', () => {
38
+ const result = getStatusDisplay('pending_auto_approval', 1);
39
39
  expect(result).toBe(`${STATUS_ICONS.WAITING} ${STATUS_LABELS.PENDING_AUTO_APPROVAL} ${STATUS_TAGS.BACKGROUND_TASK}`);
40
40
  });
41
+ it('should append [BG:2] badge when backgroundTaskCount is 2', () => {
42
+ const result = getStatusDisplay('idle', 2);
43
+ expect(result).toBe(`${STATUS_ICONS.IDLE} ${STATUS_LABELS.IDLE} \x1b[2m[BG:2]\x1b[0m`);
44
+ });
45
+ it('should append [BG:5] badge when backgroundTaskCount is 5', () => {
46
+ const result = getStatusDisplay('busy', 5);
47
+ expect(result).toBe(`${STATUS_ICONS.BUSY} ${STATUS_LABELS.BUSY} \x1b[2m[BG:5]\x1b[0m`);
48
+ });
49
+ });
50
+ });
51
+ describe('getBackgroundTaskTag', () => {
52
+ it('should return empty string when count is 0', () => {
53
+ const result = getBackgroundTaskTag(0);
54
+ expect(result).toBe('');
55
+ });
56
+ it('should return empty string when count is negative', () => {
57
+ expect(getBackgroundTaskTag(-1)).toBe('');
58
+ expect(getBackgroundTaskTag(-100)).toBe('');
59
+ });
60
+ it('should return [BG] when count is 1', () => {
61
+ const result = getBackgroundTaskTag(1);
62
+ expect(result).toBe(STATUS_TAGS.BACKGROUND_TASK);
63
+ });
64
+ it('should return [BG:2] when count is 2', () => {
65
+ const result = getBackgroundTaskTag(2);
66
+ expect(result).toBe('\x1b[2m[BG:2]\x1b[0m');
67
+ });
68
+ it('should return [BG:10] when count is 10', () => {
69
+ const result = getBackgroundTaskTag(10);
70
+ expect(result).toBe('\x1b[2m[BG:10]\x1b[0m');
41
71
  });
42
72
  });
@@ -16,7 +16,7 @@ export declare class SessionManager extends EventEmitter implements ISessionMana
16
16
  private busyTimers;
17
17
  private spawn;
18
18
  detectTerminalState(session: Session): SessionState;
19
- detectBackgroundTask(session: Session): boolean;
19
+ detectBackgroundTask(session: Session): number;
20
20
  private getTerminalContent;
21
21
  private handleAutoApproval;
22
22
  private cancelAutoApprovalVerification;
@@ -13,7 +13,7 @@ import { ProcessError, ConfigError } from '../types/errors.js';
13
13
  import { autoApprovalVerifier } from './autoApprovalVerifier.js';
14
14
  import { logger } from '../utils/logger.js';
15
15
  import { Mutex, createInitialSessionStateData } from '../utils/mutex.js';
16
- import { STATUS_TAGS } from '../constants/statusIcons.js';
16
+ import { getBackgroundTaskTag } from '../constants/statusIcons.js';
17
17
  import { getTerminalScreenContent } from '../utils/screenCapture.js';
18
18
  const { Terminal } = pkg;
19
19
  const execAsync = promisify(exec);
@@ -418,12 +418,12 @@ export class SessionManager extends EventEmitter {
418
418
  !currentStateData.autoApprovalAbortController) {
419
419
  this.handleAutoApproval(session);
420
420
  }
421
- // Detect and update background task flag
422
- const hasBackgroundTask = this.detectBackgroundTask(session);
423
- if (currentStateData.hasBackgroundTask !== hasBackgroundTask) {
421
+ // Detect and update background task count
422
+ const backgroundTaskCount = this.detectBackgroundTask(session);
423
+ if (currentStateData.backgroundTaskCount !== backgroundTaskCount) {
424
424
  void session.stateMutex.update(data => ({
425
425
  ...data,
426
- hasBackgroundTask,
426
+ backgroundTaskCount,
427
427
  }));
428
428
  }
429
429
  }, STATE_CHECK_INTERVAL_MS);
@@ -690,9 +690,7 @@ export class SessionManager extends EventEmitter {
690
690
  counts.pending_auto_approval++;
691
691
  break;
692
692
  }
693
- if (stateData.hasBackgroundTask) {
694
- counts.backgroundTasks++;
695
- }
693
+ counts.backgroundTasks += stateData.backgroundTaskCount;
696
694
  });
697
695
  return counts;
698
696
  }
@@ -713,7 +711,8 @@ export class SessionManager extends EventEmitter {
713
711
  if (parts.length === 0) {
714
712
  return '';
715
713
  }
716
- const bgTag = counts.backgroundTasks > 0 ? ` ${STATUS_TAGS.BACKGROUND_TASK}` : '';
717
- return ` (${parts.join(' / ')}${bgTag})`;
714
+ const bgTag = getBackgroundTaskTag(counts.backgroundTasks);
715
+ const bgSuffix = bgTag ? ` ${bgTag}` : '';
716
+ return ` (${parts.join(' / ')}${bgSuffix})`;
718
717
  }
719
718
  }
@@ -725,10 +725,10 @@ describe('SessionManager', () => {
725
725
  describe('static methods', () => {
726
726
  describe('getSessionCounts', () => {
727
727
  // Helper to create mock session with stateMutex
728
- const createMockSession = (id, state, hasBackgroundTask = false) => ({
728
+ const createMockSession = (id, state, backgroundTaskCount = 0) => ({
729
729
  id,
730
730
  stateMutex: {
731
- getSnapshot: () => ({ state, hasBackgroundTask }),
731
+ getSnapshot: () => ({ state, backgroundTaskCount }),
732
732
  },
733
733
  });
734
734
  it('should count sessions by state', () => {
@@ -764,6 +764,16 @@ describe('SessionManager', () => {
764
764
  expect(counts.waiting_input).toBe(0);
765
765
  expect(counts.total).toBe(3);
766
766
  });
767
+ it('should sum background task counts across sessions', () => {
768
+ const sessions = [
769
+ createMockSession('1', 'idle', 0),
770
+ createMockSession('2', 'busy', 2),
771
+ createMockSession('3', 'busy', 3),
772
+ createMockSession('4', 'waiting_input', 1),
773
+ ];
774
+ const counts = SessionManager.getSessionCounts(sessions);
775
+ expect(counts.backgroundTasks).toBe(6);
776
+ });
767
777
  });
768
778
  describe('formatSessionCounts', () => {
769
779
  it('should format counts with all states', () => {
@@ -814,7 +824,7 @@ describe('SessionManager', () => {
814
824
  const formatted = SessionManager.formatSessionCounts(counts);
815
825
  expect(formatted).toBe('');
816
826
  });
817
- it('should append [BG] tag when background tasks exist', () => {
827
+ it('should append [BG] tag when backgroundTasks is 1', () => {
818
828
  const counts = {
819
829
  idle: 1,
820
830
  busy: 1,
@@ -827,6 +837,32 @@ describe('SessionManager', () => {
827
837
  expect(formatted).toContain('[BG]');
828
838
  expect(formatted).toBe(' (1 Idle / 1 Busy \x1b[2m[BG]\x1b[0m)');
829
839
  });
840
+ it('should append [BG:N] tag when backgroundTasks is 2+', () => {
841
+ const counts = {
842
+ idle: 1,
843
+ busy: 1,
844
+ waiting_input: 0,
845
+ pending_auto_approval: 0,
846
+ total: 2,
847
+ backgroundTasks: 5,
848
+ };
849
+ const formatted = SessionManager.formatSessionCounts(counts);
850
+ expect(formatted).toContain('[BG:5]');
851
+ expect(formatted).toBe(' (1 Idle / 1 Busy \x1b[2m[BG:5]\x1b[0m)');
852
+ });
853
+ it('should not append BG tag when backgroundTasks is 0', () => {
854
+ const counts = {
855
+ idle: 1,
856
+ busy: 1,
857
+ waiting_input: 0,
858
+ pending_auto_approval: 0,
859
+ total: 2,
860
+ backgroundTasks: 0,
861
+ };
862
+ const formatted = SessionManager.formatSessionCounts(counts);
863
+ expect(formatted).not.toContain('[BG');
864
+ expect(formatted).toBe(' (1 Idle / 1 Busy)');
865
+ });
830
866
  });
831
867
  });
832
868
  });
@@ -4,5 +4,5 @@ export declare abstract class BaseStateDetector implements StateDetector {
4
4
  abstract detectState(terminal: Terminal, currentState: SessionState): SessionState;
5
5
  protected getTerminalLines(terminal: Terminal, maxLines?: number): string[];
6
6
  protected getTerminalContent(terminal: Terminal, maxLines?: number): string;
7
- abstract detectBackgroundTask(terminal: Terminal): boolean;
7
+ abstract detectBackgroundTask(terminal: Terminal): number;
8
8
  }
@@ -2,5 +2,5 @@ import { SessionState, Terminal } from '../../types/index.js';
2
2
  import { BaseStateDetector } from './base.js';
3
3
  export declare class ClaudeStateDetector extends BaseStateDetector {
4
4
  detectState(terminal: Terminal, currentState: SessionState): SessionState;
5
- detectBackgroundTask(terminal: Terminal): boolean;
5
+ detectBackgroundTask(terminal: Terminal): number;
6
6
  }
@@ -27,9 +27,16 @@ export class ClaudeStateDetector extends BaseStateDetector {
27
27
  detectBackgroundTask(terminal) {
28
28
  const lines = this.getTerminalLines(terminal, 3);
29
29
  const content = lines.join('\n').toLowerCase();
30
- // Detect background task patterns:
31
- // - "N background task(s)" in status bar
32
- // - "(running)" in status bar for active background commands
33
- return content.includes('background task') || content.includes('(running)');
30
+ // Check for "N background task(s)" pattern first (content already lowercased)
31
+ const countMatch = content.match(/(\d+)\s+background\s+task/);
32
+ if (countMatch?.[1]) {
33
+ return parseInt(countMatch[1], 10);
34
+ }
35
+ // Check for "(running)" pattern - indicates at least 1 background task
36
+ if (content.includes('(running)')) {
37
+ return 1;
38
+ }
39
+ // No background task detected
40
+ return 0;
34
41
  }
35
42
  }
@@ -223,7 +223,7 @@ describe('ClaudeStateDetector', () => {
223
223
  });
224
224
  });
225
225
  describe('detectBackgroundTask', () => {
226
- it('should detect background task when pattern is in last 3 lines (status bar)', () => {
226
+ it('should return count 1 when "1 background task" is in status bar', () => {
227
227
  // Arrange
228
228
  terminal = createMockTerminal([
229
229
  'Previous conversation content',
@@ -232,11 +232,11 @@ describe('ClaudeStateDetector', () => {
232
232
  '1 background task | api-call',
233
233
  ]);
234
234
  // Act
235
- const hasBackgroundTask = detector.detectBackgroundTask(terminal);
235
+ const count = detector.detectBackgroundTask(terminal);
236
236
  // Assert
237
- expect(hasBackgroundTask).toBe(true);
237
+ expect(count).toBe(1);
238
238
  });
239
- it('should detect background task with plural "background tasks"', () => {
239
+ it('should return count 2 when "2 background tasks" is in status bar', () => {
240
240
  // Arrange
241
241
  terminal = createMockTerminal([
242
242
  'Some output',
@@ -244,11 +244,23 @@ describe('ClaudeStateDetector', () => {
244
244
  '2 background tasks running',
245
245
  ]);
246
246
  // Act
247
- const hasBackgroundTask = detector.detectBackgroundTask(terminal);
247
+ const count = detector.detectBackgroundTask(terminal);
248
248
  // Assert
249
- expect(hasBackgroundTask).toBe(true);
249
+ expect(count).toBe(2);
250
250
  });
251
- it('should detect background task case-insensitively', () => {
251
+ it('should return count 3 when "3 background tasks" is in status bar', () => {
252
+ // Arrange
253
+ terminal = createMockTerminal([
254
+ 'Some output',
255
+ 'More output',
256
+ '3 background tasks | build, test, lint',
257
+ ]);
258
+ // Act
259
+ const count = detector.detectBackgroundTask(terminal);
260
+ // Assert
261
+ expect(count).toBe(3);
262
+ });
263
+ it('should detect background task count case-insensitively', () => {
252
264
  // Arrange
253
265
  terminal = createMockTerminal([
254
266
  'Output line 1',
@@ -256,11 +268,11 @@ describe('ClaudeStateDetector', () => {
256
268
  '1 BACKGROUND TASK running',
257
269
  ]);
258
270
  // Act
259
- const hasBackgroundTask = detector.detectBackgroundTask(terminal);
271
+ const count = detector.detectBackgroundTask(terminal);
260
272
  // Assert
261
- expect(hasBackgroundTask).toBe(true);
273
+ expect(count).toBe(1);
262
274
  });
263
- it('should return false when no background task pattern in last 3 lines', () => {
275
+ it('should return 0 when no background task pattern in last 3 lines', () => {
264
276
  // Arrange
265
277
  terminal = createMockTerminal([
266
278
  'Command completed successfully',
@@ -268,9 +280,9 @@ describe('ClaudeStateDetector', () => {
268
280
  '> ',
269
281
  ]);
270
282
  // Act
271
- const hasBackgroundTask = detector.detectBackgroundTask(terminal);
283
+ const count = detector.detectBackgroundTask(terminal);
272
284
  // Assert
273
- expect(hasBackgroundTask).toBe(false);
285
+ expect(count).toBe(0);
274
286
  });
275
287
  it('should not detect background task when pattern is in conversation content (not status bar)', () => {
276
288
  // Arrange - "background task" mentioned earlier in conversation, but not in last 3 lines
@@ -283,27 +295,27 @@ describe('ClaudeStateDetector', () => {
283
295
  'Ready',
284
296
  ]);
285
297
  // Act
286
- const hasBackgroundTask = detector.detectBackgroundTask(terminal);
298
+ const count = detector.detectBackgroundTask(terminal);
287
299
  // Assert - should only check last 3 lines, not the conversation content
288
- expect(hasBackgroundTask).toBe(false);
300
+ expect(count).toBe(0);
289
301
  });
290
- it('should handle empty terminal', () => {
302
+ it('should return 0 for empty terminal', () => {
291
303
  // Arrange
292
304
  terminal = createMockTerminal([]);
293
305
  // Act
294
- const hasBackgroundTask = detector.detectBackgroundTask(terminal);
306
+ const count = detector.detectBackgroundTask(terminal);
295
307
  // Assert
296
- expect(hasBackgroundTask).toBe(false);
308
+ expect(count).toBe(0);
297
309
  });
298
310
  it('should handle terminal with fewer than 3 lines', () => {
299
311
  // Arrange
300
312
  terminal = createMockTerminal(['1 background task']);
301
313
  // Act
302
- const hasBackgroundTask = detector.detectBackgroundTask(terminal);
314
+ const count = detector.detectBackgroundTask(terminal);
303
315
  // Assert
304
- expect(hasBackgroundTask).toBe(true);
316
+ expect(count).toBe(1);
305
317
  });
306
- it('should detect "(running)" status bar indicator', () => {
318
+ it('should return 1 when "(running)" status bar indicator is present', () => {
307
319
  // Arrange
308
320
  terminal = createMockTerminal([
309
321
  'Some conversation output',
@@ -311,17 +323,28 @@ describe('ClaudeStateDetector', () => {
311
323
  'bypass permissions on - uv run pytest tests/integration/e2e/tes... (running)',
312
324
  ]);
313
325
  // Act
314
- const hasBackgroundTask = detector.detectBackgroundTask(terminal);
326
+ const count = detector.detectBackgroundTask(terminal);
315
327
  // Assert
316
- expect(hasBackgroundTask).toBe(true);
328
+ expect(count).toBe(1);
317
329
  });
318
330
  it('should detect "(running)" case-insensitively', () => {
319
331
  // Arrange
320
332
  terminal = createMockTerminal(['Some output', 'command name (RUNNING)']);
321
333
  // Act
322
- const hasBackgroundTask = detector.detectBackgroundTask(terminal);
334
+ const count = detector.detectBackgroundTask(terminal);
335
+ // Assert
336
+ expect(count).toBe(1);
337
+ });
338
+ it('should prioritize count from "N background task" over "(running)"', () => {
339
+ // Arrange - both patterns present, count should be from explicit pattern
340
+ terminal = createMockTerminal([
341
+ 'Some output',
342
+ '3 background tasks | task1, task2 (running)',
343
+ ]);
344
+ // Act
345
+ const count = detector.detectBackgroundTask(terminal);
323
346
  // Assert
324
- expect(hasBackgroundTask).toBe(true);
347
+ expect(count).toBe(3);
325
348
  });
326
349
  });
327
350
  });
@@ -2,5 +2,5 @@ import { SessionState, Terminal } from '../../types/index.js';
2
2
  import { BaseStateDetector } from './base.js';
3
3
  export declare class ClineStateDetector extends BaseStateDetector {
4
4
  detectState(terminal: Terminal, _currentState: SessionState): SessionState;
5
- detectBackgroundTask(_terminal: Terminal): boolean;
5
+ detectBackgroundTask(_terminal: Terminal): number;
6
6
  }
@@ -22,6 +22,6 @@ export class ClineStateDetector extends BaseStateDetector {
22
22
  return 'busy';
23
23
  }
24
24
  detectBackgroundTask(_terminal) {
25
- return false;
25
+ return 0;
26
26
  }
27
27
  }
@@ -2,5 +2,5 @@ import { SessionState, Terminal } from '../../types/index.js';
2
2
  import { BaseStateDetector } from './base.js';
3
3
  export declare class CodexStateDetector extends BaseStateDetector {
4
4
  detectState(terminal: Terminal, _currentState: SessionState): SessionState;
5
- detectBackgroundTask(_terminal: Terminal): boolean;
5
+ detectBackgroundTask(_terminal: Terminal): number;
6
6
  }
@@ -25,6 +25,6 @@ export class CodexStateDetector extends BaseStateDetector {
25
25
  return 'idle';
26
26
  }
27
27
  detectBackgroundTask(_terminal) {
28
- return false;
28
+ return 0;
29
29
  }
30
30
  }
@@ -2,5 +2,5 @@ import { SessionState, Terminal } from '../../types/index.js';
2
2
  import { BaseStateDetector } from './base.js';
3
3
  export declare class CursorStateDetector extends BaseStateDetector {
4
4
  detectState(terminal: Terminal, _currentState: SessionState): SessionState;
5
- detectBackgroundTask(_terminal: Terminal): boolean;
5
+ detectBackgroundTask(_terminal: Terminal): number;
6
6
  }
@@ -17,6 +17,6 @@ export class CursorStateDetector extends BaseStateDetector {
17
17
  return 'idle';
18
18
  }
19
19
  detectBackgroundTask(_terminal) {
20
- return false;
20
+ return 0;
21
21
  }
22
22
  }
@@ -2,5 +2,5 @@ import { SessionState, Terminal } from '../../types/index.js';
2
2
  import { BaseStateDetector } from './base.js';
3
3
  export declare class GeminiStateDetector extends BaseStateDetector {
4
4
  detectState(terminal: Terminal, _currentState: SessionState): SessionState;
5
- detectBackgroundTask(_terminal: Terminal): boolean;
5
+ detectBackgroundTask(_terminal: Terminal): number;
6
6
  }
@@ -26,6 +26,6 @@ export class GeminiStateDetector extends BaseStateDetector {
26
26
  return 'idle';
27
27
  }
28
28
  detectBackgroundTask(_terminal) {
29
- return false;
29
+ return 0;
30
30
  }
31
31
  }
@@ -2,5 +2,5 @@ import { SessionState, Terminal } from '../../types/index.js';
2
2
  import { BaseStateDetector } from './base.js';
3
3
  export declare class GitHubCopilotStateDetector extends BaseStateDetector {
4
4
  detectState(terminal: Terminal, _currentState: SessionState): SessionState;
5
- detectBackgroundTask(_terminal: Terminal): boolean;
5
+ detectBackgroundTask(_terminal: Terminal): number;
6
6
  }
@@ -19,6 +19,6 @@ export class GitHubCopilotStateDetector extends BaseStateDetector {
19
19
  return 'idle';
20
20
  }
21
21
  detectBackgroundTask(_terminal) {
22
- return false;
22
+ return 0;
23
23
  }
24
24
  }
@@ -2,5 +2,5 @@ import { SessionState, Terminal } from '../../types/index.js';
2
2
  import { BaseStateDetector } from './base.js';
3
3
  export declare class OpenCodeStateDetector extends BaseStateDetector {
4
4
  detectState(terminal: Terminal, _currentState: SessionState): SessionState;
5
- detectBackgroundTask(_terminal: Terminal): boolean;
5
+ detectBackgroundTask(_terminal: Terminal): number;
6
6
  }
@@ -15,6 +15,6 @@ export class OpenCodeStateDetector extends BaseStateDetector {
15
15
  return 'idle';
16
16
  }
17
17
  detectBackgroundTask(_terminal) {
18
- return false;
18
+ return 0;
19
19
  }
20
20
  }
@@ -1,5 +1,5 @@
1
1
  import { SessionState, Terminal } from '../../types/index.js';
2
2
  export interface StateDetector {
3
3
  detectState(terminal: Terminal, currentState: SessionState): SessionState;
4
- detectBackgroundTask(terminal: Terminal): boolean;
4
+ detectBackgroundTask(terminal: Terminal): number;
5
5
  }
@@ -47,7 +47,7 @@ export interface SessionStateData {
47
47
  autoApprovalFailed: boolean;
48
48
  autoApprovalReason: string | undefined;
49
49
  autoApprovalAbortController: AbortController | undefined;
50
- hasBackgroundTask: boolean;
50
+ backgroundTaskCount: number;
51
51
  }
52
52
  /**
53
53
  * Create initial session state data with default values.
@@ -100,6 +100,6 @@ export function createInitialSessionStateData() {
100
100
  autoApprovalFailed: false,
101
101
  autoApprovalReason: undefined,
102
102
  autoApprovalAbortController: undefined,
103
- hasBackgroundTask: false,
103
+ backgroundTaskCount: 0,
104
104
  };
105
105
  }
@@ -73,7 +73,7 @@ export function prepareWorktreeItems(worktrees, sessions) {
73
73
  const session = sessions.find(s => s.worktreePath === wt.path);
74
74
  const stateData = session?.stateMutex.getSnapshot();
75
75
  const status = stateData
76
- ? ` [${getStatusDisplay(stateData.state, stateData.hasBackgroundTask)}]`
76
+ ? ` [${getStatusDisplay(stateData.state, stateData.backgroundTaskCount)}]`
77
77
  : '';
78
78
  const fullBranchName = wt.branch
79
79
  ? wt.branch.replace('refs/heads/', '')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccmanager",
3
- "version": "3.5.0",
3
+ "version": "3.5.1",
4
4
  "description": "TUI application for managing multiple Claude Code sessions across Git worktrees",
5
5
  "license": "MIT",
6
6
  "author": "Kodai Kabasawa",
@@ -41,11 +41,11 @@
41
41
  "bin"
42
42
  ],
43
43
  "optionalDependencies": {
44
- "@kodaikabasawa/ccmanager-darwin-arm64": "3.5.0",
45
- "@kodaikabasawa/ccmanager-darwin-x64": "3.5.0",
46
- "@kodaikabasawa/ccmanager-linux-arm64": "3.5.0",
47
- "@kodaikabasawa/ccmanager-linux-x64": "3.5.0",
48
- "@kodaikabasawa/ccmanager-win32-x64": "3.5.0"
44
+ "@kodaikabasawa/ccmanager-darwin-arm64": "3.5.1",
45
+ "@kodaikabasawa/ccmanager-darwin-x64": "3.5.1",
46
+ "@kodaikabasawa/ccmanager-linux-arm64": "3.5.1",
47
+ "@kodaikabasawa/ccmanager-linux-x64": "3.5.1",
48
+ "@kodaikabasawa/ccmanager-win32-x64": "3.5.1"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@eslint/js": "^9.28.0",