Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(runtimes): machine-level rename + fix picker search copy (MUL-4217) (#5087)
Bohan Jiangbcb111dbd9a2
diff --git a/packages/views/agents/components/runtime-picker.tsx b/packages/views/agents/components/runtime-picker.tsxindex 0bba620768..9893b38b8c 100644--- a/packages/views/agents/components/runtime-picker.tsx+++ b/packages/views/agents/components/runtime-picker.tsx@@ -72,7 +72,6 @@ export function RuntimePicker({}, [filteredRuntimes, search, currentUserId]);const showSearch = runtimes.length > SEARCH_THRESHOLD;- const showGroupHeaders = machines.length > 1;const selectedRuntime =runtimes.find((d) => d.id === selectedRuntimeId) ?? null;@@ -210,17 +209,19 @@ export function RuntimePicker({) : (machines.map((machine) => (<div key={machine.id}>- {showGroupHeaders && (- <div className="flex items-center justify-between gap-2 px-2 pb-0.5 pt-2 text-[11px] font-medium text-muted-foreground">- <span className="truncate">{machine.title}</span>- <span className="shrink-0 tabular-nums">- {t(($) => $.create_dialog.runtime_group_online, {- online: machine.onlineCount,- total: machine.runtimes.length,- })}- </span>- </div>- )}+ {/* Always show the machine header — even when a search or a+ single-machine workspace narrows it to one group — so the+ grouping stays consistent instead of collapsing to a flat+ list. */}+ <div className="flex items-center justify-between gap-2 px-2 pb-0.5 pt-2 text-[11px] font-medium text-muted-foreground">+ <span className="truncate">{machine.title}</span>+ <span className="shrink-0 tabular-nums">+ {t(($) => $.create_dialog.runtime_group_online, {+ online: machine.onlineCount,+ total: machine.runtimes.length,+ })}+ </span>+ </div>{machine.runtimes.map((device) => {const ownerMember = getOwnerMember(device.owner_id);const disabled = !isRuntimeUsableForUser(diff --git a/packages/views/locales/en/agents.json b/packages/views/locales/en/agents.jsonindex 0173b03b35..80df3b0139 100644--- a/packages/views/locales/en/agents.json+++ b/packages/views/locales/en/agents.json@@ -255,8 +255,8 @@"runtime_cloud_badge": "Cloud","runtime_private_badge": "Private","runtime_private_locked_tooltip": "Private runtime — only its owner or a workspace admin can create agents on it. Ask the owner to switch it to Public to share.",- "runtime_search_placeholder": "Search runtimes…",- "runtime_no_results": "No matching runtimes",+ "runtime_search_placeholder": "Search machines…",+ "runtime_no_results": "No matching machines","runtime_group_online": "{{online}}/{{total}} online","duplicate_copy_suffix": " (Copy)","create": "Create",diff --git a/packages/views/locales/en/runtimes.json b/packages/views/locales/en/runtimes.jsonindex d60965bd48..dc5a03f20a 100644--- a/packages/views/locales/en/runtimes.json+++ b/packages/views/locales/en/runtimes.json@@ -62,6 +62,19 @@"cli": "CLI","cloud_worker": "Cloud worker","local_daemon": "Local daemon"+ },+ "rename": "Rename machine",+ "rename_dialog": {+ "title": "Rename machine",+ "description": "Give this machine a name you'll recognize. It applies to every runtime on this machine and shows up when you pick a runtime for an agent.",+ "placeholder": "e.g. Bohan's MacBook",+ "hint": "Leave empty to use the device's default name.",+ "cancel": "Cancel",+ "save": "Save",+ "saving": "Saving...",+ "toast_saved": "Machine renamed",+ "toast_cleared": "Machine name cleared",+ "toast_failed": "Failed to rename machine"}},"health": {@@ -86,7 +99,6 @@"all_runtimes": "All runtimes","read_only": "Read-only","delete_button": "Delete runtime",- "rename_button": "Rename","last_seen": "last seen {{when}}","fact_owner": "Owner","fact_device": "Device",@@ -111,18 +123,6 @@},"visibility_toast_updated": "Visibility set to {{visibility}}","visibility_toast_failed": "Failed to update visibility",- "rename_dialog": {- "title": "Rename runtime",- "description": "Give this runtime a custom name so it's easier to find when creating agents.",- "hint": "Leave empty to use the default name.",- "apply_to_machine": "Apply to every runtime on this machine",- "cancel": "Cancel",- "save": "Save",- "saving": "Saving...",- "toast_saved": "Runtime renamed",- "toast_cleared": "Custom name cleared",- "toast_failed": "Failed to rename runtime"- },"delete_dialog": {"self_heal_notice": "This runtime is managed by a running local daemon. Deleting it will succeed, but the daemon will re-register a fresh runtime within seconds — stop the daemon process first to remove it permanently.","profile_backed_notice": "This runtime was registered from a custom runtime profile. Deleting it removes only the current runtime instance; a running daemon can register it again while the profile remains. Delete the custom runtime profile from Custom runtimes to remove it permanently.",diff --git a/packages/views/locales/ja/agents.json b/packages/views/locales/ja/agents.jsonindex 0ae45dde7c..7067ae7de3 100644--- a/packages/views/locales/ja/agents.json+++ b/packages/views/locales/ja/agents.json@@ -239,8 +239,8 @@"runtime_cloud_badge": "クラウド","runtime_private_badge": "非公開","runtime_private_locked_tooltip": "非公開ランタイムです。オーナーまたはワークスペースの admin のみがこのランタイム上にエージェントを作成できます。共有するには、オーナーに公開へ切り替えるよう依頼してください。",- "runtime_search_placeholder": "ランタイムを検索…",- "runtime_no_results": "一致するランタイムがありません",+ "runtime_search_placeholder": "マシンを検索…",+ "runtime_no_results": "一致するマシンがありません","runtime_group_online": "{{online}}/{{total}} オンライン","duplicate_copy_suffix": " (コピー)","create": "作成",diff --git a/packages/views/locales/ja/runtimes.json b/packages/views/locales/ja/runtimes.jsonindex 993fb408e1..e838bac5dc 100644--- a/packages/views/locales/ja/runtimes.json+++ b/packages/views/locales/ja/runtimes.json@@ -58,6 +58,19 @@"cli": "CLI","cloud_worker": "クラウドワーカー","local_daemon": "ローカルデーモン"+ },+ "rename": "マシンの名前を変更",+ "rename_dialog": {+ "title": "マシンの名前を変更",+ "description": "このマシンに分かりやすい名前を付けます。このマシン上のすべてのランタイムに適用され、エージェントのランタイム選択時にも表示されます。",+ "placeholder": "例:私の MacBook",+ "hint": "空欄にするとデバイスのデフォルト名を使用します。",+ "cancel": "キャンセル",+ "save": "保存",+ "saving": "保存中...",+ "toast_saved": "マシンの名前を変更しました",+ "toast_cleared": "マシン名をクリアしました",+ "toast_failed": "マシンの名前変更に失敗しました"}},"health": {@@ -82,7 +95,6 @@"all_runtimes": "すべてのランタイム","read_only": "読み取り専用","delete_button": "ランタイムを削除",- "rename_button": "名前を変更","last_seen": "最終確認 {{when}}","fact_owner": "所有者","fact_device": "デバイス",@@ -106,18 +118,6 @@},"visibility_toast_updated": "公開範囲を {{visibility}} に設定しました","visibility_toast_failed": "公開範囲を更新できませんでした",- "rename_dialog": {- "title": "ランタイムの名前を変更",- "description": "エージェント作成時に見つけやすいよう、このランタイムにカスタム名を付けます。",- "hint": "空欄にするとデフォルト名を使用します。",- "apply_to_machine": "このマシン上のすべてのランタイムに適用",- "cancel": "キャンセル",- "save": "保存",- "saving": "保存中...",- "toast_saved": "ランタイムの名前を変更しました",- "toast_cleared": "カスタム名をクリアしました",- "toast_failed": "ランタイムの名前変更に失敗しました"- },"delete_dialog": {"self_heal_notice": "このランタイムは実行中のローカルデーモンに管理されています。削除自体は成功しますが、デーモンプロセスを停止しない限り、数秒以内に新しいランタイムとして再登録されます。完全に削除するには先にデーモンを停止してください。","profile_backed_notice": "このランタイムはカスタムランタイムプロファイルから登録されています。ここで削除しても現在のランタイムインスタンスだけが削除され、プロファイルが残っている間は実行中のデーモンが再登録できます。完全に削除するには、Custom runtimes からカスタムランタイムプロファイルを削除してください。",diff --git a/packages/views/locales/ko/agents.json b/packages/views/locales/ko/agents.jsonindex dc23e36b04..fa294ebd51 100644--- a/packages/views/locales/ko/agents.json+++ b/packages/views/locales/ko/agents.json@@ -247,8 +247,8 @@"runtime_cloud_badge": "클라우드","runtime_private_badge": "비공개","runtime_private_locked_tooltip": "비공개 런타임입니다. 소유자 또는 워크스페이스 관리자만 이 런타임에 에이전트를 만들 수 있습니다. 공유하려면 소유자에게 공개로 전환해 달라고 요청하세요.",- "runtime_search_placeholder": "런타임 검색…",- "runtime_no_results": "일치하는 런타임이 없습니다",+ "runtime_search_placeholder": "기기 검색…",+ "runtime_no_results": "일치하는 기기가 없습니다","runtime_group_online": "{{online}}/{{total}} 온라인","duplicate_copy_suffix": " (사본)","create": "만들기",diff --git a/packages/views/locales/ko/runtimes.json b/packages/views/locales/ko/runtimes.jsonindex 88b0f46c96..30685d44c9 100644--- a/packages/views/locales/ko/runtimes.json+++ b/packages/views/locales/ko/runtimes.json@@ -58,6 +58,19 @@"cli": "CLI","cloud_worker": "클라우드 워커","local_daemon": "로컬 데몬"+ },+ "rename": "기기 이름 변경",+ "rename_dialog": {+ "title": "기기 이름 변경",+ "description": "이 기기에 알아보기 쉬운 이름을 지정합니다. 이 기기의 모든 런타임에 적용되며 에이전트의 런타임을 선택할 때 표시됩니다.",+ "placeholder": "예: 내 MacBook",+ "hint": "비워 두면 기기의 기본 이름을 사용합니다.",+ "cancel": "취소",+ "save": "저장",+ "saving": "저장 중...",+ "toast_saved": "기기 이름을 변경했습니다",+ "toast_cleared": "기기 이름을 지웠습니다",+ "toast_failed": "기기 이름 변경에 실패했습니다"}},"health": {@@ -82,7 +95,6 @@"all_runtimes": "모든 런타임","read_only": "읽기 전용","delete_button": "런타임 삭제",- "rename_button": "이름 변경","last_seen": "마지막 확인 {{when}}","fact_owner": "소유자","fact_device": "기기",@@ -106,18 +118,6 @@},"visibility_toast_updated": "공개 범위를 {{visibility}}(으)로 설정했습니다","visibility_toast_failed": "공개 범위를 업데이트하지 못했습니다",- "rename_dialog": {- "title": "런타임 이름 변경",- "description": "에이전트를 만들 때 쉽게 찾을 수 있도록 이 런타임에 사용자 지정 이름을 지정합니다.",- "hint": "비워 두면 기본 이름을 사용합니다.",- "apply_to_machine": "이 컴퓨터의 모든 런타임에 적용",- "cancel": "취소",- "save": "저장",- "saving": "저장 중...",- "toast_saved": "런타임 이름을 변경했습니다",- "toast_cleared": "사용자 지정 이름을 지웠습니다",- "toast_failed": "런타임 이름 변경에 실패했습니다"- },"delete_dialog": {"self_heal_notice": "이 런타임은 실행 중인 로컬 데몬이 관리합니다. 삭제는 성공하지만, 데몬 프로세스를 멈추지 않으면 몇 초 안에 새 런타임이 다시 등록됩니다. 완전히 제거하려면 먼저 데몬을 중지하세요.","profile_backed_notice": "이 런타임은 사용자 지정 런타임 프로필에서 등록되었습니다. 여기서 삭제하면 현재 런타임 인스턴스만 제거되며, 프로필이 남아 있는 동안 실행 중인 데몬이 다시 등록할 수 있습니다. 완전히 제거하려면 Custom runtimes에서 사용자 지정 런타임 프로필을 삭제하세요.",diff --git a/packages/views/locales/zh-Hans/agents.json b/packages/views/locales/zh-Hans/agents.jsonindex 55434da251..116dee6c86 100644--- a/packages/views/locales/zh-Hans/agents.json+++ b/packages/views/locales/zh-Hans/agents.json@@ -247,8 +247,8 @@"runtime_cloud_badge": "云端","runtime_private_badge": "私有","runtime_private_locked_tooltip": "私有运行时——只有 runtime 所有者或工作区管理员可在其上创建智能体。如果需要共享,请联系所有者切换为「公开」。",- "runtime_search_placeholder": "搜索运行时…",- "runtime_no_results": "没有匹配的运行时",+ "runtime_search_placeholder": "搜索机器…",+ "runtime_no_results": "没有匹配的机器","runtime_group_online": "{{online}}/{{total}} 在线","duplicate_copy_suffix": "(副本)","create": "创建",diff --git a/packages/views/locales/zh-Hans/runtimes.json b/packages/views/locales/zh-Hans/runtimes.jsonindex cb261b9252..20798af365 100644--- a/packages/views/locales/zh-Hans/runtimes.json+++ b/packages/views/locales/zh-Hans/runtimes.json@@ -58,6 +58,19 @@"cli": "CLI","cloud_worker": "云端 worker","local_daemon": "本地守护进程"+ },+ "rename": "重命名机器",+ "rename_dialog": {+ "title": "重命名机器",+ "description": "给这台机器起一个你能认出来的名字。会应用到这台机器上的所有运行时,并在给 agent 选择运行时时显示。",+ "placeholder": "例如:我的 MacBook",+ "hint": "留空则使用设备的默认名称。",+ "cancel": "取消",+ "save": "保存",+ "saving": "保存中...",+ "toast_saved": "已重命名机器",+ "toast_cleared": "已清除机器名称",+ "toast_failed": "重命名机器失败"}},"health": {@@ -82,7 +95,6 @@"all_runtimes": "全部运行时","read_only": "只读","delete_button": "删除运行时",- "rename_button": "重命名","last_seen": "最后活跃 {{when}}","fact_owner": "所有者","fact_device": "设备",@@ -106,18 +118,6 @@},"visibility_toast_updated": "可见性已设为「{{visibility}}」","visibility_toast_failed": "更新可见性失败",- "rename_dialog": {- "title": "重命名运行时",- "description": "为该运行时设置一个自定义名称,方便在创建 agent 时查找。",- "hint": "留空则使用默认名称。",- "apply_to_machine": "应用到这台机器上的所有运行时",- "cancel": "取消",- "save": "保存",- "saving": "保存中...",- "toast_saved": "已重命名运行时",- "toast_cleared": "已清除自定义名称",- "toast_failed": "重命名运行时失败"- },"delete_dialog": {"self_heal_notice": "该运行时由正在运行的本地守护进程托管。删除会成功,但守护进程会在数秒内重新注册一个新的运行时——若想彻底移除,请先停止守护进程。","profile_backed_notice": "该运行时来自自定义运行时配置。删除它只会移除当前运行时实例;只要配置仍存在,运行中的守护进程就可以再次注册它。若要彻底移除,请在“自定义运行时”中删除对应配置。",diff --git a/packages/views/runtimes/components/rename-runtime-dialog.tsx b/packages/views/runtimes/components/rename-machine-dialog.tsxsimilarity index 52%rename from packages/views/runtimes/components/rename-runtime-dialog.tsxrename to packages/views/runtimes/components/rename-machine-dialog.tsxindex 692284e24f..744b22e10d 100644--- a/packages/views/runtimes/components/rename-runtime-dialog.tsx+++ b/packages/views/runtimes/components/rename-machine-dialog.tsx@@ -2,7 +2,6 @@import { useEffect, useState } from "react";import { toast } from "sonner";-import type { AgentRuntime } from "@multica/core/types";import { useUpdateRuntime } from "@multica/core/runtimes/mutations";import {AlertDialog,@@ -10,48 +9,43 @@ import {} from "@multica/ui/components/ui/alert-dialog";import { Button } from "@multica/ui/components/ui/button";import { Input } from "@multica/ui/components/ui/input";-import { Checkbox } from "@multica/ui/components/ui/checkbox";import { useT } from "../../i18n";-// RenameRuntimeDialog lets a runtime owner (or workspace admin) set a custom-// display name (MUL-4217). The name overrides the daemon-proposed default for-// display everywhere; clearing it reverts to the default. When the runtime is-// a local/remote daemon (has a daemon_id), it can host one runtime per-// provider, so the dialog offers to apply the name to the whole machine — the-// common intent behind "name my machine".-export interface RenameRuntimeDialogProps {+// RenameMachineDialog names a whole machine (MUL-4217). A machine hosts one+// runtime per provider, so the name is applied to every runtime on the daemon+// (apply_to_machine) rather than to a single runtime — that was the confusing+// part of the first cut. Clearing reverts to the device's default name.+//+// `runtimeId` is any runtime on the machine the current user is allowed to+// edit; the server fans the name out across the daemon (or, for a cloud worker+// with no daemon_id, just renames that one worker, which is its own machine).+export interface RenameMachineDialogProps {open: boolean;onOpenChange: (open: boolean) => void;- runtime: AgentRuntime;wsId: string;+ runtimeId: string;+ /** The machine's current custom name, or "" when it still uses the default. */+ currentName: string;}-export function RenameRuntimeDialog({+export function RenameMachineDialog({open,onOpenChange,- runtime,wsId,-}: RenameRuntimeDialogProps) {+ runtimeId,+ currentName,+}: RenameMachineDialogProps) {const { t } = useT("runtimes");const updateRuntime = useUpdateRuntime(wsId);- // Machine-level naming only makes sense for daemon-backed runtimes; cloud- // workers have no shared host to fan out across.- const canApplyToMachine =- !!runtime.daemon_id && runtime.runtime_mode !== "cloud";-- const [value, setValue] = useState(runtime.custom_name ?? "");- const [applyToMachine, setApplyToMachine] = useState(canApplyToMachine);+ const [value, setValue] = useState(currentName);const submitting = updateRuntime.isPending;- // Reset the form each time the dialog opens so a cancelled edit doesn't- // leak into the next one.+ // Reset the form each time the dialog opens so a cancelled edit doesn't leak+ // into the next one.useEffect(() => {- if (open) {- setValue(runtime.custom_name ?? "");- setApplyToMachine(canApplyToMachine);- }- }, [open, runtime.custom_name, canApplyToMachine]);+ if (open) setValue(currentName);+ }, [open, currentName]);const handleOpenChange = (next: boolean) => {if (submitting) return;@@ -62,21 +56,17 @@ export function RenameRuntimeDialog({const trimmed = value.trim();updateRuntime.mutate({- runtimeId: runtime.id,- // Empty string clears the override server-side.- patch: {- custom_name: trimmed,- ...(canApplyToMachine && applyToMachine- ? { apply_to_machine: true }- : {}),- },+ runtimeId,+ // Empty string clears the name (reverts to the default); the machine+ // fan-out is always on — this dialog only ever names the machine.+ patch: { custom_name: trimmed, apply_to_machine: true },},{onSuccess: () => {toast.success(trimmed- ? t(($) => $.detail.rename_dialog.toast_saved)- : t(($) => $.detail.rename_dialog.toast_cleared),+ ? t(($) => $.machine.rename_dialog.toast_saved)+ : t(($) => $.machine.rename_dialog.toast_cleared),);onOpenChange(false);},@@ -84,7 +74,7 @@ export function RenameRuntimeDialog({toast.error(err instanceof Error && err.message? err.message- : t(($) => $.detail.rename_dialog.toast_failed),+ : t(($) => $.machine.rename_dialog.toast_failed),),},);@@ -98,10 +88,10 @@ export function RenameRuntimeDialog({><div className="px-5 pb-4 pt-5"><h2 className="text-base font-semibold">- {t(($) => $.detail.rename_dialog.title)}+ {t(($) => $.machine.rename_dialog.title)}</h2><p className="mt-1 text-sm leading-5 text-muted-foreground">- {t(($) => $.detail.rename_dialog.description)}+ {t(($) => $.machine.rename_dialog.description)}</p><Input@@ -109,7 +99,7 @@ export function RenameRuntimeDialog({autoFocusvalue={value}maxLength={100}- placeholder={runtime.name}+ placeholder={t(($) => $.machine.rename_dialog.placeholder)}onChange={(e) => setValue(e.target.value)}onKeyDown={(e) => {if (e.key === "Enter" && !submitting) {@@ -119,22 +109,8 @@ export function RenameRuntimeDialog({}}/><p className="mt-1.5 text-xs text-muted-foreground">- {t(($) => $.detail.rename_dialog.hint)}+ {t(($) => $.machine.rename_dialog.hint)}</p>-- {canApplyToMachine && (- <label className="mt-3 flex cursor-pointer items-start gap-2 text-sm text-foreground">- <Checkbox- className="mt-0.5"- checked={applyToMachine}- onCheckedChange={(next) => setApplyToMachine(next === true)}- disabled={submitting}- />- <span className="leading-5">- {t(($) => $.detail.rename_dialog.apply_to_machine)}- </span>- </label>- )}</div><div className="border-t bg-muted/25 px-5 py-3">@@ -146,7 +122,7 @@ export function RenameRuntimeDialog({onClick={() => handleOpenChange(false)}disabled={submitting}>- {t(($) => $.detail.rename_dialog.cancel)}+ {t(($) => $.machine.rename_dialog.cancel)}</Button><Buttontype="button"@@ -155,8 +131,8 @@ export function RenameRuntimeDialog({disabled={submitting}>{submitting- ? t(($) => $.detail.rename_dialog.saving)- : t(($) => $.detail.rename_dialog.save)}+ ? t(($) => $.machine.rename_dialog.saving)+ : t(($) => $.machine.rename_dialog.save)}</Button></div></div>diff --git a/packages/views/runtimes/components/runtime-detail.tsx b/packages/views/runtimes/components/runtime-detail.tsxindex 098e6542ba..9e606a5cbd 100644--- a/packages/views/runtimes/components/runtime-detail.tsx+++ b/packages/views/runtimes/components/runtime-detail.tsx@@ -7,7 +7,6 @@ import {Cpu,Globe,Lock,- Pencil,} from "lucide-react";import { toast } from "sonner";import { useQuery } from "@tanstack/react-query";@@ -48,7 +47,6 @@ import { UpdateSection } from "./update-section";import { UsageSection } from "./usage-section";import { DeleteRuntimeDialog } from "./delete-runtime-dialog";import { DeleteRuntimeProfileDialog } from "./delete-runtime-profile-dialog";-import { RenameRuntimeDialog } from "./rename-runtime-dialog";import { useT } from "../../i18n";function getCliVersion(metadata: Record<string, unknown>): string | null {@@ -111,7 +109,6 @@ export function RuntimeDetail({ runtime }: { runtime: AgentRuntime }) {const now = useNowTick();const [deleteOpen, setDeleteOpen] = useState(false);- const [renameOpen, setRenameOpen] = useState(false);const health = deriveRuntimeHealth(runtime, now);const ownerMember = runtime.owner_id@@ -189,8 +186,6 @@ export function RuntimeDetail({ runtime }: { runtime: AgentRuntime }) {ownerMember={ownerMember}cliVersion={cliVersion}daemonShort={daemonShort}- canEdit={!!canEditRuntime}- onRename={() => setRenameOpen(true)}/><UsageSection runtime={runtime} /></div>@@ -231,15 +226,6 @@ export function RuntimeDetail({ runtime }: { runtime: AgentRuntime }) {onDeleted={handleRuntimeDeleted}/>)}-- {canEditRuntime && (- <RenameRuntimeDialog- open={renameOpen}- onOpenChange={setRenameOpen}- runtime={runtime}- wsId={wsId}- />- )}</div>);}@@ -265,8 +251,6 @@ function HeroCard({ownerMember,cliVersion,daemonShort,- canEdit,- onRename,}: {runtime: AgentRuntime;health: ReturnType<typeof deriveRuntimeHealth>;@@ -274,8 +258,6 @@ function HeroCard({ownerMember: MemberWithUser | null;cliVersion: string | null;daemonShort: string | null;- canEdit: boolean;- onRename: () => void;}) {const { t } = useT("runtimes");const [showDetails, setShowDetails] = useState(false);@@ -294,25 +276,6 @@ function HeroCard({<h2 className="truncate text-base font-semibold tracking-tight">{runtimeDisplayName(runtime)}</h2>- {canEdit && (- <Tooltip>- <TooltipTrigger- render={- <button- type="button"- onClick={onRename}- className="inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"- aria-label={t(($) => $.detail.rename_button)}- >- <Pencil className="h-3.5 w-3.5" />- </button>- }- />- <TooltipContent>- {t(($) => $.detail.rename_button)}- </TooltipContent>- </Tooltip>- )}<HealthBadge health={health} /><span className="text-xs text-muted-foreground">{t(($) => $.detail.last_seen, { when: lastSeen })}diff --git a/packages/views/runtimes/components/runtime-machines.test.ts b/packages/views/runtimes/components/runtime-machines.test.tsindex 0218822222..b2887f338f 100644--- a/packages/views/runtimes/components/runtime-machines.test.ts+++ b/packages/views/runtimes/components/runtime-machines.test.ts@@ -4,6 +4,7 @@ import {buildRuntimeMachines,filterRuntimeMachines,runtimeMachineCounts,+ sharedCustomName,splitRuntimeName,} from "./runtime-machines";@@ -349,3 +350,33 @@ describe("splitRuntimeName", () => {});});});++describe("sharedCustomName", () => {+ it("returns the name when every runtime shares one non-empty custom_name", () => {+ expect(+ sharedCustomName([+ makeRuntime({ id: "a", custom_name: "Bohan's MacBook" }),+ makeRuntime({ id: "b", custom_name: "Bohan's MacBook" }),+ ]),+ ).toBe("Bohan's MacBook");+ });++ it("returns null when only some runtimes are named (a lone per-runtime name is not the machine name)", () => {+ expect(+ sharedCustomName([+ makeRuntime({ id: "a", custom_name: "just this one" }),+ makeRuntime({ id: "b", custom_name: null }),+ ]),+ ).toBeNull();+ });++ it("returns null when the names disagree, or the set is empty", () => {+ expect(+ sharedCustomName([+ makeRuntime({ id: "a", custom_name: "Air" }),+ makeRuntime({ id: "b", custom_name: "Pro" }),+ ]),+ ).toBeNull();+ expect(sharedCustomName([])).toBeNull();+ });+});diff --git a/packages/views/runtimes/components/runtime-machines.ts b/packages/views/runtimes/components/runtime-machines.tsindex dcc1cc2463..bd123bac8b 100644--- a/packages/views/runtimes/components/runtime-machines.ts+++ b/packages/views/runtimes/components/runtime-machines.ts@@ -274,7 +274,7 @@ function runtimeDeviceName(runtime: AgentRuntime): string | null {// daemon, so a name shared by all of them is the machine's label. A one-off// per-runtime rename (not shared) is deliberately ignored here so it can't// masquerade as the whole machine's name.-function sharedCustomName(runtimes: AgentRuntime[]): string | null {+export function sharedCustomName(runtimes: AgentRuntime[]): string | null {if (runtimes.length === 0) return null;const names = runtimes.map((r) => r.custom_name?.trim() ?? "");const first = names[0];diff --git a/packages/views/runtimes/components/runtimes-page.tsx b/packages/views/runtimes/components/runtimes-page.tsxindex ee0cf6b9c6..acff03dfed 100644--- a/packages/views/runtimes/components/runtimes-page.tsx+++ b/packages/views/runtimes/components/runtimes-page.tsx@@ -5,6 +5,7 @@ import { useDefaultLayout } from "react-resizable-panels";import {Cloud,Monitor,+ Pencil,Plus,Search,Server,@@ -32,6 +33,7 @@ import { PageHeader } from "../../layout/page-header";import { ConnectRemoteDialog } from "./connect-remote-dialog";import { CloudRuntimeDialog } from "./cloud-runtime-dialog";import { RuntimeProfilesDialog } from "./runtime-profiles-dialog";+import { RenameMachineDialog } from "./rename-machine-dialog";import { ProviderLogo } from "./provider-logo";import { RuntimeList, buildWorkloadIndex } from "./runtime-list";import {@@ -42,6 +44,7 @@ import {buildRuntimeMachines,filterRuntimeMachines,runtimeMachineCounts,+ sharedCustomName,type RuntimeMachine,type RuntimeMachineFilter,} from "./runtime-machines";@@ -140,6 +143,7 @@ export function RuntimesPage({const canManageProfiles =currentMember?.role === "owner" || currentMember?.role === "admin";const [showProfilesDialog, setShowProfilesDialog] = useState(false);+ const [renameOpen, setRenameOpen] = useState(false);const handleDaemonEvent = useCallback(() => {qc.invalidateQueries({ queryKey: runtimeKeys.all(wsId) });@@ -240,6 +244,24 @@ export function RuntimesPage({filteredMachines[0] ??null;+ // Rename is a machine-level action: it names the whole machine (all runtimes+ // on the daemon). Pick a runtime on the selected machine the current user is+ // allowed to edit — admins can use any; others must own it — and derive the+ // machine's current custom name (shared across its runtimes when named).+ const renameTarget = useMemo(() => {+ const m = selectedMachine;+ if (!m || m.runtimes.length === 0) return null;+ const editable = canManageProfiles+ ? m.runtimes[0]+ : m.runtimes.find((r) => r.owner_id === currentUserId);+ if (!editable) return null;+ // Pre-fill only a real machine name — the same rule the machine title uses+ // (every runtime shares one non-empty custom_name). A lone per-runtime+ // custom name must NOT masquerade as the machine's current name.+ const currentName = sharedCustomName(m.runtimes) ?? "";+ return { runtimeId: editable.id, currentName };+ }, [selectedMachine, canManageProfiles, currentUserId]);+if (isLoading || fetching) return <RuntimesPageSkeleton />;const totalCount = visibleRuntimes.length;@@ -280,6 +302,8 @@ export function RuntimesPage({updatableIds={updatableIds}now={now}bootstrapping={bootstrapping}+ canRename={!!renameTarget}+ onRename={() => setRenameOpen(true)}actions={selectedMachine?.isCurrent ? localMachineActions : undefined}@@ -320,6 +344,8 @@ export function RuntimesPage({updatableIds={updatableIds}now={now}bootstrapping={bootstrapping}+ canRename={!!renameTarget}+ onRename={() => setRenameOpen(true)}actions={selectedMachine?.isCurrent ? localMachineActions : undefined}@@ -347,6 +373,15 @@ export function RuntimesPage({onClose={() => setShowProfilesDialog(false)}/>)}+ {renameTarget && (+ <RenameMachineDialog+ open={renameOpen}+ onOpenChange={setRenameOpen}+ wsId={wsId}+ runtimeId={renameTarget.runtimeId}+ currentName={renameTarget.currentName}+ />+ )}</div>);}@@ -680,12 +715,16 @@ function MachineDetail({updatableIds,now,bootstrapping,+ canRename,+ onRename,actions,}: {machine: RuntimeMachine | null;updatableIds: Set<string>;now: number;bootstrapping?: boolean;+ canRename?: boolean;+ onRename?: () => void;actions?: React.ReactNode;}) {const { t } = useT("runtimes");@@ -766,6 +805,17 @@ function MachineDetail({<h2 className="truncate text-xl font-semibold tracking-tight">{machine.title}</h2>+ {canRename && onRename && (+ <button+ type="button"+ onClick={onRename}+ aria-label={t(($) => $.machine.rename)}+ title={t(($) => $.machine.rename)}+ className="inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"+ >+ <Pencil className="h-3.5 w-3.5" />+ </button>+ )}<span className="inline-flex items-center gap-1 rounded-md border bg-background px-2 py-0.5 text-xs text-muted-foreground"><HealthIcon health={machine.health} />{healthLabel(machine.health)}