Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.
Python agent-orchestrationaiai-agentschatopsdiscordlangchainmcpmicrosoft-teamsmulti-agentopen-sourceopenaiself-hostedslack
Devices: louder localhost note, and say why a filter is empty
Petr Bauchbefdb7cfc46c
diff --git a/console/apps/switch-console-desktop/src/renderer/features/machines/add-machine-modal.tsx b/console/apps/switch-console-desktop/src/renderer/features/machines/add-machine-modal.tsxindex ef973ffbb..473a6fb9d 100644--- a/console/apps/switch-console-desktop/src/renderer/features/machines/add-machine-modal.tsx+++ b/console/apps/switch-console-desktop/src/renderer/features/machines/add-machine-modal.tsx@@ -108,10 +108,12 @@ export function AddMachineModal({ serverId, onClose }: Props) {</FieldGroup>{issued.loopback ? (- <p className="rounded-md border border-border bg-background-1 px-3 py-2 text-xs text-foreground-muted">- This server is at {issued.serverUrl}, which only this computer can reach. Another- device needs an address it can reach Switch at: change <code>--server</code> to- that.+ <p+ role="status"+ className="rounded-md border border-border-warning bg-background-warning px-3 py-2 text-xs text-foreground-warning"+ >+ These commands use {issued.serverUrl}, which only this computer can reach. On+ another device, change <code>--server</code> to an address it reaches Switch at.</p>) : (issued.fallback && (@@ -162,10 +164,11 @@ export function AddMachineModal({ serverId, onClose }: Props) {</Button></p><p className="text-xs text-foreground-muted">- The device shows up in Settings → Your devices once its controller reports; if it does- not, run <code>switch-agent-controller doctor</code> on it. A computer you reach over- SSH can also join without this: create an agent on it, and Switch Console sets its- controller up.+ Nothing is saved until the device enrolls: closing this discards the code, and the+ device shows up in Your devices only once its controller reports. If it does not, run{' '}+ <code>switch-agent-controller doctor</code> on it. A computer you reach over SSH can+ also join without this: create an agent on it, and Switch Console sets its controller+ up.</p></>)}diff --git a/console/apps/switch-console-desktop/src/renderer/features/machines/devices-settings-page.tsx b/console/apps/switch-console-desktop/src/renderer/features/machines/devices-settings-page.tsxindex 9abdd81fc..b90e2d937 100644--- a/console/apps/switch-console-desktop/src/renderer/features/machines/devices-settings-page.tsx+++ b/console/apps/switch-console-desktop/src/renderer/features/machines/devices-settings-page.tsx@@ -7,6 +7,7 @@ import { switchServersStore } from '@renderer/features/switch-servers/switch-serimport { workspacesStore } from '@renderer/features/workspaces/workspaces-store';import { PageHeader } from '@renderer/lib/components/page-header';import { failureText } from '@renderer/lib/errors/describe-failure';+import { useFeatureFlags } from '@renderer/lib/hooks/useFeatureFlags';import { useNavigate } from '@renderer/lib/layout/navigation-provider';import { useShowModal } from '@renderer/lib/modal/modal-provider';import { Button } from '@renderer/lib/ui/button';@@ -21,12 +22,14 @@ import { Spinner } from '@renderer/lib/ui/spinner';import { ToggleGroup, ToggleGroupItem } from '@renderer/lib/ui/toggle-group';import { cn } from '@renderer/utils/utils';import type { MachineDetail } from '@shared/core/managed-agents/managed-agents';+import type { SwitchServer } from '@shared/core/switch-servers/switch-servers';import { MachineIcon, TONE_DOT } from './machine-marks';import {arrangeMachines,controllerRelease,MACHINE_CATEGORY_LABELS,type MachineCategory,+ emptyCategoryText,machineCategory,machineConnection,} from './machine-state';@@ -47,6 +50,12 @@ export const DevicesSettingsPage = observer(function DevicesSettingsPage() {const serverId = workspacesStore.activeServerId;const server = switchServersStore.servers.find((s) => s.id === serverId);const [filter, setFilter] = useState<Filter>('all');+ // The Cloud filter is shown only where the server runs Switch cloud machines.+ const cloudOffered = useFeatureFlags(serverId)['hosted_agents'] ?? false;+ const categories = (Object.keys(MACHINE_CATEGORY_LABELS) as MachineCategory[]).filter(+ (category) => category !== 'cloud' || cloudOffered+ );+ const shownFilter: Filter = filter === 'cloud' && !cloudOffered ? 'all' : filter;const showAddMachineModal = useShowModal('addMachineModal');return (@@ -59,13 +68,13 @@ export const DevicesSettingsPage = observer(function DevicesSettingsPage() {<div className="flex items-center justify-between gap-2"><ToggleGroupmultiple={false}- value={[filter]}+ value={[shownFilter]}onValueChange={([value]) => {if (value) setFilter(value as Filter);}}><ToggleGroupItem value="all">All</ToggleGroupItem>- {(Object.keys(MACHINE_CATEGORY_LABELS) as MachineCategory[]).map((category) => (+ {categories.map((category) => (<ToggleGroupItem key={category} value={category}>{MACHINE_CATEGORY_LABELS[category]}</ToggleGroupItem>@@ -79,13 +88,14 @@ export const DevicesSettingsPage = observer(function DevicesSettingsPage() {)}</div></PageHeader>- {serverId === null ? (+ {serverId === null || !server ? (<p className="pt-4 text-sm text-foreground-muted">Pick a workspace to see its devices.</p>) : (<DevicesBodyserverId={serverId}- filter={filter}- frozen={!!server && isFrozenServer(server)}+ server={server}+ filter={shownFilter}+ frozen={isFrozenServer(server)}/>)}</>@@ -94,10 +104,12 @@ export const DevicesSettingsPage = observer(function DevicesSettingsPage() {function DevicesBody({serverId,+ server,filter,frozen,}: {serverId: string;+ server: SwitchServer;filter: Filter;frozen: boolean;}) {@@ -140,7 +152,7 @@ function DevicesBody({? 'No devices yet. This computer joins when you run a managed agent on it, and so does an SSH host; a standalone machine joins once it is enrolled.': filter === 'all'? 'No devices.'- : `Nothing under ${MACHINE_CATEGORY_LABELS[filter as MachineCategory]}.`}+ : emptyCategoryText(filter, server)}</p>) : (<div className="grid grid-cols-2 gap-3">diff --git a/console/apps/switch-console-desktop/src/renderer/features/machines/machine-state.test.ts b/console/apps/switch-console-desktop/src/renderer/features/machines/machine-state.test.tsindex 9fee18d29..b348d289b 100644--- a/console/apps/switch-console-desktop/src/renderer/features/machines/machine-state.test.ts+++ b/console/apps/switch-console-desktop/src/renderer/features/machines/machine-state.test.ts@@ -7,6 +7,7 @@ import type {import {arrangeMachines,controllerRelease,+ emptyCategoryText,lastContact,machineCategory,machineConnection,@@ -313,3 +314,40 @@ describe('placedAgents', () => {expect(placedAgents({ data: undefined, isError: true }, 'm1')).toEqual({ kind: 'unreadable' });});});++describe('emptyCategoryText', () => {+ const external = {+ name: 'Acme',+ url: 'https://switch.example.com',+ managed: false,+ managementKind: null,+ sshHost: null,+ };++ it('says an SSH host joins when an agent is created on it, on a server it can reach', () => {+ expect(emptyCategoryText('ssh-host', external)).toMatch(/joins when you create an agent/);+ });++ it('says no SSH host can run agents for a server only this computer reaches', () => {+ for (const server of [+ { ...external, managed: true, managementKind: 'local' as const },+ { ...external, url: 'http://localhost:8001' },+ ])+ expect(emptyCategoryText('ssh-host', server)).toMatch(/an SSH host cannot run its agents/);+ });++ it('names the one host that can run agents for a server Console runs on it', () => {+ expect(+ emptyCategoryText('ssh-host', {+ ...external,+ managed: true,+ managementKind: 'remote',+ sshHost: 'build-box',+ })+ ).toMatch(/only that host/);+ });++ it('says how a cloud device appears', () => {+ expect(emptyCategoryText('cloud', external)).toMatch(/Switch cloud as its run location/);+ });+});diff --git a/console/apps/switch-console-desktop/src/renderer/features/machines/machine-state.ts b/console/apps/switch-console-desktop/src/renderer/features/machines/machine-state.tsindex 59c879b02..bc648c790 100644--- a/console/apps/switch-console-desktop/src/renderer/features/machines/machine-state.ts+++ b/console/apps/switch-console-desktop/src/renderer/features/machines/machine-state.ts@@ -4,6 +4,8 @@ import type {OwnedMachine,} from '@shared/core/managed-agents/managed-agents';import { providerDisplayName } from '@shared/core/providers/agent-provider-registry';+import { isLoopbackUrl } from '@shared/core/switch-servers/loopback';+import type { SwitchServer } from '@shared/core/switch-servers/switch-servers';export type MachineTone = 'ok' | 'warning' | 'problem' | 'idle';@@ -322,6 +324,30 @@ export function machineCategory(machine: Pick<MachineDetail, 'local' | 'cloud'>)return 'computer';}+/**+ * What an empty filter says: how a device of that kind joins, or why none can.+ * New agent offers an SSH host only where the server is reachable from it: a+ * server Console runs on this computer, or any server at a loopback address,+ * from no SSH host; one Console runs on a host, from that host only.+ */+export function emptyCategoryText(+ category: MachineCategory,+ server: Pick<SwitchServer, 'name' | 'url' | 'managed' | 'managementKind' | 'sshHost'>+): string {+ switch (category) {+ case 'cloud':+ return 'Your Switch cloud device shows here once you create an agent with Switch cloud as its run location.';+ case 'computer':+ return 'This computer joins when you run a managed agent on it, and another computer once it is enrolled with Add device.';+ case 'ssh-host':+ if (server.managed && server.managementKind === 'remote')+ return `${server.name} runs on ${server.sshHost}, so only that host can run its agents over SSH. It joins when you create an agent on it.`;+ if (server.managed || isLoopbackUrl(server.url))+ return `${server.name} runs on this computer and only this computer can reach it, so an SSH host cannot run its agents. To run agents on another computer, use a server it can reach.`;+ return 'An SSH host joins when you create an agent with it as the run location, and Switch Console sets its controller up.';+ }+}+/*** How many of the person's agents are placed on a device, as far as their* agent list says: not yet read, could not be read, or a count. Removing a