Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

Console machines: short working folders, move targets ordered, sign-in source wording

Massimo Cairo6d3dbd29510e
diff --git a/console/apps/switch-console-desktop/src/renderer/features/machines/machine-details.tsx b/console/apps/switch-console-desktop/src/renderer/features/machines/machine-details.tsx
index ea0da444d..58e2078c9 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/machines/machine-details.tsx
+++ b/console/apps/switch-console-desktop/src/renderer/features/machines/machine-details.tsx
@@ -272,7 +272,7 @@ function AgentsSection({
className="min-w-0 flex-1 truncate font-[Menlo,ui-monospace,monospace] text-[11.5px] text-[var(--fg-dim)]"
title={folder ?? undefined}
>
- {folder ?? ''}
+ {folder ? shortFolder(folder, machine.workspacesDir) : ''}
</span>
<span className="shrink-0 text-[var(--fg-dim)]">
{providerDisplayName(agent.definition.provider) ?? agent.definition.provider}
@@ -414,3 +414,14 @@ function Fact({ label, children }: { label: string; children: React.ReactNode })
</div>
);
}
+
+/**
+ * An agent's working folder as its row shows it: inside the machine's
+ * workspaces folder, which the page shows once above, only the part after it;
+ * anywhere else, the whole path.
+ */
+export function shortFolder(folder: string, workspacesDir: string | null): string {
+ if (workspacesDir && folder.startsWith(`${workspacesDir}/`))
+ return `…/${folder.slice(workspacesDir.length + 1)}`;
+ return folder;
+}
diff --git a/console/apps/switch-console-desktop/src/renderer/features/machines/machine-providers.tsx b/console/apps/switch-console-desktop/src/renderer/features/machines/machine-providers.tsx
index d2b00e3db..47bf2bd03 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/machines/machine-providers.tsx
+++ b/console/apps/switch-console-desktop/src/renderer/features/machines/machine-providers.tsx
@@ -226,8 +226,8 @@ function MachineProviderRow({
/** Where a provider's sign-in on the machine comes from, in a few words. */
function signInSource(source: 'local' | 'sealed', machine: MachineDetail): string {
- if (source === 'sealed') return 'sent from Switch Console';
+ if (source === 'sealed') return 'login sent from Switch Console';
return machine.local?.kind === 'this-computer'
- ? "this computer's sign-in"
- : 'signed in on the machine';
+ ? "this computer's own login"
+ : "the machine's own login";
}
diff --git a/console/apps/switch-console-desktop/src/renderer/features/machines/move-agent-modal.tsx b/console/apps/switch-console-desktop/src/renderer/features/machines/move-agent-modal.tsx
index d9b2167bd..d8144e7d6 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/machines/move-agent-modal.tsx
+++ b/console/apps/switch-console-desktop/src/renderer/features/machines/move-agent-modal.tsx
@@ -22,7 +22,7 @@ import { Spinner } from '@renderer/lib/ui/spinner';
import { cn } from '@renderer/utils/utils';
import type { ManagedAgentView, OwnedMachine } from '@shared/core/managed-agents/managed-agents';
import { MachineIcon, TonePill } from './machine-marks';
-import { machineKindLabel, moveTarget } from './machine-state';
+import { machineKindLabel, type MoveTarget, moveTarget } from './machine-state';
type Props = BaseModalProps<void> & { agent: ManagedAgentView };
@@ -46,9 +46,17 @@ export function MoveAgentModal({ agent, onSuccess, onClose }: Props) {
const [error, setError] = useState<string | null>(null);
const label = managedAgentLabel(agent);
const provider = agent.definition.provider;
- const others = (machines.data ?? []).filter(
- (machine) => machine.id !== agent.machine?.id && machine.state !== 'revoked'
- );
+ // The ones it can go to first: with fifty machines, the offline ones would bury them.
+ const others = (machines.data ?? [])
+ .filter((machine) => machine.id !== agent.machine?.id && machine.state !== 'revoked')
+ .map((machine) => ({ machine, target: moveTarget(machine, provider) }))
+ .sort(
+ (a, b) =>
+ Number(b.target.selectable) - Number(a.target.selectable) ||
+ Number(b.machine.local?.kind === 'this-computer') -
+ Number(a.machine.local?.kind === 'this-computer') ||
+ a.machine.name.localeCompare(b.machine.name)
+ );
const folder = agent.status?.directory ?? agent.definition.directory;
const move = async () => {
@@ -89,11 +97,11 @@ export function MoveAgentModal({ agent, onSuccess, onClose }: Props) {
<p className="text-sm text-foreground-muted">You have no other machine to move it to.</p>
) : (
<div role="radiogroup" className="max-h-[360px] space-y-2 overflow-y-auto">
- {others.map((machine) => (
+ {others.map(({ machine, target }) => (
<TargetRow
key={machine.id}
machine={machine}
- provider={provider}
+ target={target}
picked={picked === machine.id}
onPick={() => setPicked(machine.id)}
/>
@@ -127,16 +135,16 @@ export function MoveAgentModal({ agent, onSuccess, onClose }: Props) {
function TargetRow({
machine,
- provider,
+ target,
picked,
onPick,
}: {
machine: OwnedMachine;
- provider: string;
+ target: MoveTarget;
picked: boolean;
onPick: () => void;
}) {
- const target = moveTarget(machine, provider);
+ const thisComputer = machine.local?.kind === 'this-computer';
const online = machine.state === 'online';
return (
<button
@@ -166,9 +174,11 @@ function TargetRow({
<span className="min-w-0 flex-1">
<span className="flex min-w-0 items-center gap-2">
<span className="truncate text-sm text-foreground">
- {machine.local?.kind === 'this-computer' ? 'This computer' : machine.name}
+ {thisComputer ? 'This computer' : machine.name}
</span>
- <TonePill tone="idle" dot={false} label={machineKindLabel(machine).split(' · ')[0]!} />
+ {!thisComputer && (
+ <TonePill tone="idle" dot={false} label={machineKindLabel(machine).split(' · ')[0]!} />
+ )}
<TonePill tone={online ? 'ok' : 'problem'} label={online ? 'Online' : 'Offline'} />
</span>
<span className={cn('mt-0.5 block truncate text-xs', LINE_TEXT[target.tone])}>