Merge pull request #15 from joey-david/fix/local-agent-deselection

fix: local agent deselection
This commit is contained in:
pliny authored and GitHub committed 2026-07-05 13:57:48 -04:00
commit 2f2f6678f4
4 files changed
+59 -7

No files matched your search

@@ -0,0 +1,37 @@
import { describe, expect, it } from 'vitest';
import { syncLocalAgentSelection } from '../agent/local-agents.js';
describe('syncLocalAgentSelection', () => {
it('disconnects agents omitted from the bulk selection', () => {
const connected = new Map([
['codex', { id: 'codex' }],
['hermes', { id: 'hermes' }],
]);
syncLocalAgentSelection(connected, ['hermes'], true);
expect([...connected.keys()]).toEqual(['hermes']);
});
it('preserves existing agents for an additive single-agent connect', () => {
const connected = new Map([
['codex', { id: 'codex' }],
['hermes', { id: 'hermes' }],
]);
syncLocalAgentSelection(connected, ['hermes'], false);
expect([...connected.keys()]).toEqual(['codex', 'hermes']);
});
it('disconnects every agent when the bulk selection is empty', () => {
const connected = new Map([
['codex', { id: 'codex' }],
['hermes', { id: 'hermes' }],
]);
syncLocalAgentSelection(connected, [], true);
expect(connected.size).toBe(0);
});
});