Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions main/src/ipc/daemonRegistryBindings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { registerPanelHandlers } from './panels';
import { registerProjectHandlers } from './project';
import { registerPromptHandlers } from './prompt';
import { registerScriptHandlers } from './script';
import { registerSessionHandlers } from './session';
import type { AppServices } from './types';

vi.mock('../index', () => ({
Expand Down Expand Up @@ -122,6 +123,43 @@ const SCRIPT_CHANNELS = [
'logs:isRunning',
] as const;

const SESSION_CHANNELS = [
'sessions:get-all',
'sessions:get',
'sessions:get-all-with-projects',
'sessions:get-archived-with-projects',
'sessions:create',
'sessions:delete',
'sessions:input',
'sessions:get-or-create-main-repo',
'sessions:continue',
'sessions:get-output',
'sessions:get-conversation',
'sessions:get-conversation-messages',
'sessions:get-conversation-message-count',
'sessions:generate-compacted-context',
'sessions:get-json-messages',
'sessions:mark-viewed',
'sessions:stop',
'sessions:generate-name',
'sessions:rename',
'sessions:toggle-favorite',
'sessions:reorder',
'sessions:save-images',
'sessions:save-large-text',
'sessions:restore',
'sessions:get-statistics',
'sessions:get-resumable',
'sessions:resume-interrupted',
'sessions:dismiss-interrupted',
'panels:get-output',
'panels:get-conversation-messages',
'panels:get-json-messages',
'panels:get-prompts',
'panels:send-input',
'panels:continue',
] as const;

interface IpcMainStub {
boundChannels: string[];
handle(channel: string, listener: (_event: unknown, ...args: unknown[]) => unknown): void;
Expand All @@ -146,6 +184,13 @@ function createServicesStub(): AppServices {
databaseService: {},
worktreeManager: {},
analyticsManager: {},
taskQueue: {},
cliManagerFactory: {},
claudeCodeManager: {},
worktreeNameGenerator: {},
archiveProgressManager: {},
spotlightManager: {},
runCommandManager: {},
} as AppServices;
}

Expand Down Expand Up @@ -214,4 +259,25 @@ describe('daemon registry IPC bindings', () => {
);
expect(registry.has('sessions:open-ide')).toBe(false);
});

it('keeps active-session polling hints outside the daemon registry surface', () => {
const registry = new PaneCommandRegistry();
const ipcMain = createIpcMainStub();

registerSessionHandlers(ipcMain, createServicesStub(), registry);

expect(registry.listChannels()).toEqual([...SESSION_CHANNELS].sort());
expect(ipcMain.boundChannels).toContain('sessions:set-active-session');
expect(ipcMain.boundChannels).toContain('debug:get-table-structure');
expect(ipcMain.boundChannels).toContain('archive:get-progress');
expect(
ipcMain.boundChannels.filter(
channel =>
channel !== 'sessions:set-active-session' &&
channel !== 'debug:get-table-structure' &&
channel !== 'archive:get-progress',
).sort(),
).toEqual([...SESSION_CHANNELS].sort());
expect(registry.has('sessions:set-active-session')).toBe(false);
});
});
2 changes: 1 addition & 1 deletion main/src/ipc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function registerIpcHandlers(services: AppServices): PaneCommandRegistry

registerAppHandlers(ipcMain, services);
registerUpdaterHandlers(ipcMain, services);
registerSessionHandlers(ipcMain, services);
registerSessionHandlers(ipcMain, services, commandRegistry);
registerProjectHandlers(ipcMain, services, commandRegistry);
registerConfigHandlers(ipcMain, services);
registerDialogHandlers(ipcMain, services);
Expand Down
Loading