🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
import { describe, expect, it } from 'vitest';
import { shouldShowHeteroModelSelector } from './shouldShowHeteroModelSelector';
describe('shouldShowHeteroModelSelector', () => {
it.each(['auto', 'sandbox', 'none', 'local', 'device'] as const)(
'keeps Codex model and effort controls available on %s even without a catalog target',
(executionTarget) => {
expect(
shouldShowHeteroModelSelector({
executionTarget,
isDesktopClient: false,
providerType: 'codex',
}),
).toBe(true);
},
);
it('shows for sandbox-backed web runs', () => {
expect(
shouldShowHeteroModelSelector({
executionTarget: 'sandbox',
isDesktopClient: false,
}),
).toBe(true);
});
it('shows for desktop-local runs even when the desktop device id is persisted', () => {
expect(
shouldShowHeteroModelSelector({
boundDeviceId: 'desktop-device',
executionTarget: 'local',
isDesktopClient: true,
}),
).toBe(true);
});
it('shows for explicit device runs because dispatch forwards --model/--effort to the device', () => {
expect(
shouldShowHeteroModelSelector({
boundDeviceId: 'remote-device',
executionTarget: 'device',
isDesktopClient: false,
}),
).toBe(true);
});
it('shows for desktop-local selections opened from web (device dispatch forwards selector args)', () => {
expect(
shouldShowHeteroModelSelector({
boundDeviceId: 'desktop-device',
executionTarget: 'local',
isDesktopClient: false,
}),
).toBe(true);
});
it('shows for auto device routing because the auto-resolved device dispatch carries selector args', () => {
expect(
shouldShowHeteroModelSelector({
executionTarget: 'auto',
isDesktopClient: false,
}),
).toBe(true);
});
it('shows OpenCode models for desktop-local execution', () => {
expect(
shouldShowHeteroModelSelector({
executionTarget: 'local',
isDesktopClient: true,
providerType: 'opencode',
}),
).toBe(true);
});
it('shows OpenCode models for an explicit bound device', () => {
expect(
shouldShowHeteroModelSelector({
boundDeviceId: 'remote-device',
executionTarget: 'device',
isDesktopClient: false,
providerType: 'opencode',
}),
).toBe(true);
});
it('shows CodeBuddy models only on a concrete runtime that can query its CLI', () => {
expect(
shouldShowHeteroModelSelector({
executionTarget: 'local',
isDesktopClient: true,
providerType: 'codebuddy',
}),
).toBe(true);
expect(
shouldShowHeteroModelSelector({
boundDeviceId: 'remote-device',
executionTarget: 'device',
isDesktopClient: false,
providerType: 'codebuddy',
}),
).toBe(true);
expect(
shouldShowHeteroModelSelector({
executionTarget: 'none',
isDesktopClient: false,
providerType: 'codebuddy',
}),
).toBe(false);
});
it('shows Cursor models only on a concrete runtime that can query its CLI', () => {
expect(
shouldShowHeteroModelSelector({
executionTarget: 'local',
isDesktopClient: true,
providerType: 'cursor',
}),
).toBe(true);
expect(
shouldShowHeteroModelSelector({
boundDeviceId: 'remote-device',
executionTarget: 'device',
isDesktopClient: false,
providerType: 'cursor',
}),
).toBe(true);
expect(
shouldShowHeteroModelSelector({
executionTarget: 'auto',
isDesktopClient: false,
providerType: 'cursor',
}),
).toBe(false);
});
it('shows Pi models for desktop-local execution and an explicit bound device', () => {
expect(
shouldShowHeteroModelSelector({
executionTarget: 'local',
isDesktopClient: true,
providerType: 'pi',
}),
).toBe(true);
expect(
shouldShowHeteroModelSelector({
boundDeviceId: 'remote-device',
executionTarget: 'device',
isDesktopClient: false,
providerType: 'pi',
}),
).toBe(true);
});
it('hides Pi models without a concrete supported target', () => {
expect(
shouldShowHeteroModelSelector({
executionTarget: 'auto',
isDesktopClient: false,
providerType: 'pi',
}),
).toBe(false);
});
it('shows Qoder models only when a concrete catalog target is available', () => {
expect(
shouldShowHeteroModelSelector({
executionTarget: 'local',
isDesktopClient: true,
providerType: 'qoder',
}),
).toBe(true);
expect(
shouldShowHeteroModelSelector({
boundDeviceId: 'remote-device',
executionTarget: 'device',
isDesktopClient: false,
providerType: 'qoder',
}),
).toBe(true);
expect(
shouldShowHeteroModelSelector({
executionTarget: 'auto',
isDesktopClient: false,
providerType: 'qoder',
}),
).toBe(false);
});
it.each([
['device', undefined],
['auto', 'remote-device'],
['none', 'remote-device'],
['sandbox', 'remote-device'],
] as const)(
'hides OpenCode models for unsupported target %s',
(executionTarget, boundDeviceId) => {
expect(
shouldShowHeteroModelSelector({
boundDeviceId,
executionTarget,
isDesktopClient: false,
providerType: 'opencode',
}),
).toBe(false);
},
);
});