Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

refactor(runtimes): organize runtime management by machine (#5297)

Jiayuan Zhangb47e835d7d6b
diff --git a/apps/desktop/src/renderer/src/components/desktop-runtimes-page.tsx b/apps/desktop/src/renderer/src/components/desktop-runtimes-page.tsx
index cc8f10ad44..a66d949e5d 100644
--- a/apps/desktop/src/renderer/src/components/desktop-runtimes-page.tsx
+++ b/apps/desktop/src/renderer/src/components/desktop-runtimes-page.tsx
@@ -1,7 +1,6 @@
-import { useEffect, useState } from "react";
import { RuntimesPage } from "@multica/views/runtimes";
import { DaemonRuntimeActions } from "./daemon-runtime-card";
-import type { DaemonStatus } from "../../../shared/daemon-types";
+import { useDesktopRuntimeContext } from "./use-desktop-runtime-context";
/**
* Desktop wrapper around the shared `RuntimesPage`. Bridges the Electron
@@ -18,53 +17,19 @@ import type { DaemonStatus } from "../../../shared/daemon-types";
* has no visible effect.
*/
export function DesktopRuntimesPage() {
- const [status, setStatus] = useState<DaemonStatus>({ state: "stopped" });
- // Remember the last known daemonId/deviceName. After the daemon is
- // stopped, `status.daemonId` goes back to undefined — without this
- // sticky cache the local row would either disappear or get reclassified
- // as a remote machine (since `isCurrent` requires a daemonId match),
- // taking the Start button with it.
- const [lastIdentity, setLastIdentity] = useState<{
- daemonId: string | null;
- deviceName: string | null;
- }>({ daemonId: null, deviceName: null });
- // The host's OS hostname, independent of any daemon. Used as the last
- // fallback for the local machine name so consolidation still works when
- // the app doesn't manage the running daemon (e.g. it lives in WSL2) and
- // thus never reports a device name.
- const [hostName, setHostName] = useState<string | null>(null);
-
- useEffect(() => {
- const apply = (s: DaemonStatus) => {
- setStatus(s);
- if (s.daemonId) {
- setLastIdentity({
- daemonId: s.daemonId,
- deviceName: s.deviceName ?? null,
- });
- }
- };
- window.daemonAPI.getStatus().then(apply);
- window.daemonAPI.getHostName().then((name) => setHostName(name || null));
- return window.daemonAPI.onStatusChange(apply);
- }, []);
-
- const bootstrapping =
- status.state === "installing_cli" ||
- status.state === "starting" ||
- status.state === "running";
+ const context = useDesktopRuntimeContext();
return (
<RuntimesPage
- localDaemonId={status.daemonId ?? lastIdentity.daemonId}
- localMachineName={status.deviceName ?? lastIdentity.deviceName ?? hostName}
+ localDaemonId={context.localDaemonId}
+ localMachineName={context.localMachineName}
localMachineActions={<DaemonRuntimeActions />}
// Desktop owns a local machine for the lifetime of the app, even
// while the daemon is stopped or hasn't registered yet. The shared
// page synthesizes a placeholder local row when no real runtime
// matches, so the Start button is always reachable.
hasLocalMachine
- bootstrapping={bootstrapping}
+ bootstrapping={context.bootstrapping}
/>
);
}
diff --git a/apps/desktop/src/renderer/src/components/use-desktop-runtime-context.test.tsx b/apps/desktop/src/renderer/src/components/use-desktop-runtime-context.test.tsx
new file mode 100644
index 0000000000..271d601f38
--- /dev/null
+++ b/apps/desktop/src/renderer/src/components/use-desktop-runtime-context.test.tsx
@@ -0,0 +1,44 @@
+// @vitest-environment jsdom
+
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import { renderHook, waitFor } from "@testing-library/react";
+import type { DaemonStatus } from "../../../shared/daemon-types";
+
+describe("useDesktopRuntimeContext", () => {
+ beforeEach(() => {
+ vi.resetModules();
+ });
+
+ it("keeps daemon identity when the hook remounts on another route", async () => {
+ const getStatus = vi.fn<() => Promise<DaemonStatus>>().mockResolvedValue({
+ state: "running",
+ daemonId: "daemon-local",
+ deviceName: "Studio Mac",
+ });
+ const daemonAPI = {
+ getStatus,
+ getHostName: vi.fn().mockResolvedValue("host.local"),
+ onStatusChange: vi.fn(() => () => {}),
+ };
+ Object.defineProperty(window, "daemonAPI", {
+ configurable: true,
+ value: daemonAPI,
+ });
+
+ const { useDesktopRuntimeContext } = await import(
+ "./use-desktop-runtime-context"
+ );
+ const firstRoute = renderHook(() => useDesktopRuntimeContext());
+ await waitFor(() =>
+ expect(firstRoute.result.current.localDaemonId).toBe("daemon-local"),
+ );
+ firstRoute.unmount();
+
+ getStatus.mockResolvedValue({ state: "stopped" });
+ const secondRoute = renderHook(() => useDesktopRuntimeContext());
+ await waitFor(() =>
+ expect(secondRoute.result.current.localMachineName).toBe("Studio Mac"),
+ );
+ expect(secondRoute.result.current.localDaemonId).toBe("daemon-local");
+ });
+});
diff --git a/apps/desktop/src/renderer/src/components/use-desktop-runtime-context.ts b/apps/desktop/src/renderer/src/components/use-desktop-runtime-context.ts
new file mode 100644
index 0000000000..da63adff0f
--- /dev/null
+++ b/apps/desktop/src/renderer/src/components/use-desktop-runtime-context.ts
@@ -0,0 +1,56 @@
+import { useEffect, useState } from "react";
+import type { DaemonStatus } from "../../../shared/daemon-types";
+
+export interface DesktopRuntimeContext {
+ localDaemonId: string | null;
+ localMachineName: string | null;
+ bootstrapping: boolean;
+}
+
+interface DaemonIdentity {
+ daemonId: string | null;
+ deviceName: string | null;
+}
+
+// Route transitions remount this hook. Keep the last daemon identity at the
+// desktop platform boundary so a stopped daemon still maps to the same local
+// machine on both the collection and detail routes.
+let lastDaemonIdentity: DaemonIdentity = {
+ daemonId: null,
+ deviceName: null,
+};
+
+/** Shared desktop bridge for both the machine list and machine detail route. */
+export function useDesktopRuntimeContext(): DesktopRuntimeContext {
+ const [status, setStatus] = useState<DaemonStatus>({ state: "stopped" });
+ const [lastIdentity, setLastIdentity] =
+ useState<DaemonIdentity>(lastDaemonIdentity);
+ const [hostName, setHostName] = useState<string | null>(null);
+
+ useEffect(() => {
+ const apply = (next: DaemonStatus) => {
+ setStatus(next);
+ if (next.daemonId) {
+ const identity = {
+ daemonId: next.daemonId,
+ deviceName: next.deviceName ?? null,
+ };
+ lastDaemonIdentity = identity;
+ setLastIdentity(identity);
+ }
+ };
+ window.daemonAPI.getStatus().then(apply);
+ window.daemonAPI.getHostName().then((name) => setHostName(name || null));
+ return window.daemonAPI.onStatusChange(apply);
+ }, []);
+
+ return {
+ localDaemonId: status.daemonId ?? lastIdentity.daemonId,
+ localMachineName:
+ status.deviceName ?? lastIdentity.deviceName ?? hostName,
+ bootstrapping:
+ status.state === "installing_cli" ||
+ status.state === "starting" ||
+ status.state === "running",
+ };
+}
diff --git a/apps/desktop/src/renderer/src/pages/runtime-detail-page.tsx b/apps/desktop/src/renderer/src/pages/runtime-detail-page.tsx
index 4e31e1ac09..50202f11f4 100644
--- a/apps/desktop/src/renderer/src/pages/runtime-detail-page.tsx
+++ b/apps/desktop/src/renderer/src/pages/runtime-detail-page.tsx
@@ -1,18 +1,48 @@
import { useParams } from "react-router-dom";
import { useQuery } from "@tanstack/react-query";
-import { RuntimeDetailPage as SharedRuntimeDetailPage } from "@multica/views/runtimes";
+import {
+ RuntimeDetailPage as SharedRuntimeDetailPage,
+ RuntimeSettingsPage as SharedRuntimeSettingsPage,
+} from "@multica/views/runtimes";
import { useWorkspaceId } from "@multica/core/hooks";
import { runtimeListOptions } from "@multica/core/runtimes/queries";
import { useDocumentTitle } from "@/hooks/use-document-title";
+import { DaemonRuntimeActions } from "../components/daemon-runtime-card";
+import { useDesktopRuntimeContext } from "../components/use-desktop-runtime-context";
export function RuntimeDetailPage() {
const { id } = useParams<{ id: string }>();
const wsId = useWorkspaceId();
const { data: runtimes } = useQuery(runtimeListOptions(wsId));
- const runtime = runtimes?.find((r) => r.id === id);
+ const runtime = runtimes?.find((candidate) => candidate.id === id);
+ const context = useDesktopRuntimeContext();
- useDocumentTitle(runtime?.name ?? "Runtime");
+ useDocumentTitle(runtime?.name ?? "Runtimes");
if (!id) return null;
- return <SharedRuntimeDetailPage runtimeId={id} />;
+ return (
+ <SharedRuntimeDetailPage
+ runtimeId={id}
+ localDaemonId={context.localDaemonId}
+ localMachineName={context.localMachineName}
+ localMachineActions={<DaemonRuntimeActions />}
+ hasLocalMachine
+ bootstrapping={context.bootstrapping}
+ />
+ );
+}
+
+export function RuntimeSettingsPage() {
+ const { id, runtimeId } = useParams<{
+ id: string;
+ runtimeId: string;
+ }>();
+ const wsId = useWorkspaceId();
+ const { data: runtimes } = useQuery(runtimeListOptions(wsId));
+ const runtime = runtimes?.find((candidate) => candidate.id === runtimeId);
+
+ useDocumentTitle(runtime?.name ?? "Runtime");
+
+ if (!id || !runtimeId) return null;
+ return <SharedRuntimeSettingsPage machineId={id} runtimeId={runtimeId} />;
}
diff --git a/apps/desktop/src/renderer/src/routes.tsx b/apps/desktop/src/renderer/src/routes.tsx
index 929a43ff9d..7c8faa950f 100644
--- a/apps/desktop/src/renderer/src/routes.tsx
+++ b/apps/desktop/src/renderer/src/routes.tsx
@@ -12,7 +12,10 @@ import { AutopilotDetailPage } from "./pages/autopilot-detail-page";
import { SkillDetailPage } from "./pages/skill-detail-page";
import { AgentDetailPage } from "./pages/agent-detail-page";
import { MemberDetailPage } from "./pages/member-detail-page";
-import { RuntimeDetailPage } from "./pages/runtime-detail-page";
+import {
+ RuntimeDetailPage,
+ RuntimeSettingsPage,
+} from "./pages/runtime-detail-page";
import { AttachmentPreviewRoute } from "./pages/attachment-preview-page";
import { IssuesPage } from "@multica/views/issues/components";
import { ProjectsPage } from "@multica/views/projects/components";
@@ -162,6 +165,11 @@ export const appRoutes: RouteObject[] = [
{
path: "runtimes/:id",
element: <RuntimeDetailPage />,
+ handle: { title: "Machine" },
+ },
+ {
+ path: "runtimes/:id/runtime/:runtimeId",
+ element: <RuntimeSettingsPage />,
handle: { title: "Runtime" },
},
{ path: "skills", element: <SkillsPage />, handle: { title: "Skills" } },
diff --git a/apps/docs/content/docs/daemon-runtimes.ja.mdx b/apps/docs/content/docs/daemon-runtimes.ja.mdx
index 2c2b749312..d75f14572b 100644
--- a/apps/docs/content/docs/daemon-runtimes.ja.mdx
+++ b/apps/docs/content/docs/daemon-runtimes.ja.mdx
@@ -60,7 +60,31 @@ graph TD
## カスタムランタイムプロファイル
-組み込み provider 検出は一般的なツールを対象にしていますが、Multica が対応するプロトコルファミリーで動作し、ワークスペース固有の起動コマンドが必要な AI CLI には **custom runtime profile** を定義できます。Runtimes UI か CLI で管理します。
+組み込み provider 検出は一般的なツールを対象にしています。Multica が対応するプロトコルファミリーで動作し、別の起動コマンドが必要な AI CLI には **custom runtime profile** を定義できます。たとえば、Codex の社内 wrapper、バージョンを固定した実行ファイル、モデル引数を事前設定したチーム CLI などです。
+
+Claude Code、Codex、Kimi などの組み込み provider を通常のコマンドで使うだけなら、カスタムプロファイルは不要です。デーモンが自動的に検出します。
+
+### 作成前の確認
+
+- Multica デーモンが動作する少なくとも 1 台のマシンにカスタムコマンドをインストールし、同じコマンドがそのマシンのターミナルで動くことを確認します。
+- ツールが UI に表示されるベースプロトコルファミリーのいずれかを実装していることを確認します。ファミリーの選択は Multica に通信方法を伝えるもので、互換性のない CLI を互換にするものではありません。
+- プロファイルを作成、編集、削除できるのはワークスペースの owner または admin だけです。
+
+### Runtimes UI から作成する
+
+1. **Runtimes** を開き、コマンドをインストールしたマシンを選択します。
+2. **カスタムランタイムを追加**を選択します。
+3. コマンドが実装しているベースプロトコルファミリーを選びます。
+4. 表示名と、固定引数を含むターミナルで実行するコマンドを入力します。チーム向けに用途の説明も追加できます。
+5. **ランタイムを作成**を選択します。
+
+プロファイル定義はワークスペース全体に属し、接続済みのすべてのデーモンへ同期されます。各マシンはそのコマンドを解決できる場合にだけ独自のランタイムを登録します。作成を開始したマシンには待機中の **登録中** 行が一時的に表示されます。オンラインにならない場合は、そのマシンでコマンドがインストールされ、デーモンから見えることを確認してください。
+
+プロファイルを作成しても CLI のインストール、認証、他のマシンへのコピーは行われません。このランタイムを提供する各マシンで、基盤となるツールを個別にインストールしてログインしてください。
+
+### CLI から管理する
+
+同じワークスペースプロファイルを CLI から管理できます。
```bash
multica runtime profile list
@@ -69,6 +93,8 @@ multica runtime profile update <profile-id> --command-name agent
multica runtime profile delete <profile-id>
```
+組み込みランタイムとカスタムランタイムは同じマシン一覧に表示されます。カスタムランタイム行の操作メニューから、プロファイルを編集または削除できます。プロファイルを削除すると、デーモンの同期後に登録済みランタイムインスタンスも削除されます。エージェントがまだ依存している場合、削除はブロックされることがあります。
+
入力するコマンドは shell 文字列ではなく argv 形式です。Multica は実行ファイル名と固定引数を保存し、デーモンは `exec.Command(command_name, fixed_args...)` で直接起動します。通常の引数、引用符、バックスラッシュエスケープは使えますが、パイプ、リダイレクト、`&&`、`;`、バッククォート、`$VAR` / `$(...)` 展開は使えません。shell の動作が必要な場合は wrapper script を使ってください。
現在、コマンドと引数の解析は Runtimes UI が担当します。CLI の profile コマンドは profile 行とローカルのパス上書きを管理します。
diff --git a/apps/docs/content/docs/daemon-runtimes.ko.mdx b/apps/docs/content/docs/daemon-runtimes.ko.mdx
index 7796edcbc3..73055320e4 100644
--- a/apps/docs/content/docs/daemon-runtimes.ko.mdx
+++ b/apps/docs/content/docs/daemon-runtimes.ko.mdx
@@ -60,7 +60,31 @@ graph TD
## 사용자 지정 런타임 프로필
-기본 provider 감지는 일반적인 도구를 다룹니다. 팀에서 Multica가 지원하는 프로토콜 패밀리로 동작하지만 워크스페이스별 실행 명령이 필요한 AI CLI를 쓰는 경우에는 **custom runtime profile**을 정의할 수 있습니다. Runtimes UI 또는 CLI에서 관리합니다.
+기본 provider 감지는 일반적인 도구를 다룹니다. Multica가 지원하는 프로토콜 패밀리로 동작하지만 다른 실행 명령이 필요한 AI CLI에는 **custom runtime profile**을 정의할 수 있습니다. 예를 들면 Codex용 사내 wrapper, 버전을 고정한 실행 파일, 모델 인수를 미리 추가하는 팀 CLI가 있습니다.
+
+Claude Code, Codex, Kimi 같은 기본 제공 provider를 기본 명령으로 사용하는 경우에는 사용자 지정 프로필이 필요하지 않습니다. 데몬이 자동으로 감지합니다.
+
+### 만들기 전에 확인할 사항
+
+- Multica 데몬을 실행하는 기기 중 하나 이상에 사용자 지정 명령을 설치하고, 같은 명령이 해당 기기의 터미널에서 실행되는지 확인합니다.
+- 도구가 UI에 표시되는 기본 프로토콜 패밀리 중 하나를 구현하는지 확인합니다. 패밀리를 선택하는 것은 Multica에 프로세스와 통신하는 방법을 알려 줄 뿐, 호환되지 않는 CLI를 호환되게 만들지는 않습니다.
+- 프로필을 만들고 수정하고 삭제하려면 워크스페이스 owner 또는 admin이어야 합니다.
+
+### Runtimes UI에서 만들기
+
+1. **Runtimes**를 열고 명령을 설치한 기기를 선택합니다.
+2. **사용자 지정 런타임 추가**를 선택합니다.
+3. 명령이 실제로 구현하는 기본 프로토콜 패밀리를 선택합니다.
+4. 표시 이름과 터미널에서 실행할 명령을 고정 인수와 함께 입력합니다. 팀원이 용도를 알 수 있도록 설명을 추가할 수도 있습니다.
+5. **런타임 생성**을 선택합니다.
+
+프로필 정의는 워크스페이스 전체에 속하며 연결된 모든 데몬에 동기화됩니다. 각 기기는 해당 명령을 찾을 수 있을 때만 자체 런타임을 등록합니다. 만들기를 시작한 기기에는 기다리는 동안 임시 **등록 중** 행이 표시됩니다. 온라인으로 바뀌지 않으면 해당 기기에 명령이 설치되어 있고 데몬에서 찾을 수 있는지 확인하세요.
+
+프로필을 만들어도 CLI가 설치되거나 인증되거나 다른 기기로 복사되지는 않습니다. 이 런타임을 제공할 각 기기에서 기반 도구를 별도로 설치하고 로그인해야 합니다.
+
+### CLI에서 관리하기
+
+같은 워크스페이스 프로필을 CLI에서도 관리할 수 있습니다.
```bash
multica runtime profile list
@@ -69,6 +93,8 @@ multica runtime profile update <profile-id> --command-name agent
multica runtime profile delete <profile-id>
```
+기본 제공 런타임과 사용자 지정 런타임은 같은 기기 목록에 표시됩니다. 사용자 지정 런타임 행의 작업 메뉴에서 프로필을 수정하거나 삭제할 수 있습니다. 프로필을 삭제하면 데몬이 동기화된 뒤 등록된 런타임 인스턴스도 제거됩니다. 에이전트가 아직 이 프로필에 의존하면 삭제가 차단될 수 있습니다.
+
명령은 shell 문자열이 아니라 argv 형식입니다. Multica는 실행 파일 이름과 고정 인수를 저장하고, 데몬은 `exec.Command(command_name, fixed_args...)`로 직접 실행합니다. 일반 인수, 따옴표, 백슬래시 이스케이프는 지원하지만 파이프, 리다이렉션, `&&`, `;`, 백틱, `$VAR` / `$(...)` 확장은 지원하지 않습니다. shell 동작이 필요하면 wrapper script를 사용하세요.
현재 명령과 인수 파싱은 Runtimes UI가 담당합니다. CLI의 profile 명령은 profile 행과 로컬 경로 override를 관리합니다.
diff --git a/apps/docs/content/docs/daemon-runtimes.mdx b/apps/docs/content/docs/daemon-runtimes.mdx
index 13d909a62f..605bfe6cb7 100644
--- a/apps/docs/content/docs/daemon-runtimes.mdx
+++ b/apps/docs/content/docs/daemon-runtimes.mdx
@@ -62,8 +62,46 @@ Key points:
Built-in provider detection covers the common tools, but teams can also define
**custom runtime profiles** for AI CLIs that speak one of Multica's supported
-protocol families and need a workspace-specific launch command. Profiles are
-managed from the Runtimes UI or the CLI:
+protocol families and need a different launch command. Typical examples include
+an internal wrapper around Codex, a version-pinned executable, or a team CLI
+that adds fixed model arguments.
+
+Do not create a custom profile just to use Claude Code, Codex, Kimi, or another
+built-in provider with its normal command. The daemon detects those tools
+automatically.
+
+### Before you create one
+
+- Install the custom command on at least one machine running a Multica daemon,
+ and confirm the same command works in that machine's terminal.
+- Confirm the tool speaks one of the base protocol families shown in the UI.
+ Choosing a family tells Multica how to communicate with the process; it does
+ not make an incompatible CLI compatible.
+- You must be a workspace owner or admin to create, edit, or delete a profile.
+
+### Create one from the Runtimes UI
+
+1. Open **Runtimes**, then select the machine where you installed the command.
+2. Select **Add custom runtime**.
+3. Choose the base protocol family implemented by the command.
+4. Enter a display name and the command you would run in a terminal, including
+ any fixed arguments. Add an optional description so teammates know what it
+ is for.
+5. Select **Create runtime**.
+
+The profile definition belongs to the whole workspace and syncs to every
+connected daemon. Each machine registers its own runtime only when it can
+resolve that command. The machine where you started the flow shows a temporary
+**Registering** row while it waits. If the row does not become online, check
+that the command is installed and available to the daemon on that machine.
+
+Creating a profile does not install the CLI, authenticate it, or copy it to
+other machines. Install and sign in to the underlying tool separately on every
+machine that should provide this runtime.
+
+### Manage profiles from the CLI
+
+The same workspace profiles can be managed from the CLI:
```bash
multica runtime profile list
@@ -72,6 +110,11 @@ multica runtime profile update <profile-id> --command-name agent
multica runtime profile delete <profile-id>
```
+Custom and built-in runtimes share the same machine list. Use a custom runtime
+row's actions menu to edit or delete its profile. Deleting a profile removes its
+registered runtime instances after the daemons synchronize; it can be blocked
+while agents still depend on it.
+
The command is argv-oriented, not a shell string. Multica stores an executable
name plus fixed arguments, then the daemon launches it directly with
`exec.Command(command_name, fixed_args...)`. Plain arguments, quotes, and
diff --git a/apps/docs/content/docs/daemon-runtimes.zh.mdx b/apps/docs/content/docs/daemon-runtimes.zh.mdx
index 51cab0a75c..8cdae3f3d1 100644
--- a/apps/docs/content/docs/daemon-runtimes.zh.mdx
+++ b/apps/docs/content/docs/daemon-runtimes.zh.mdx
@@ -60,7 +60,31 @@ graph TD
## 自定义运行时配置
-内置 provider 探测覆盖常见工具;如果团队有一款兼容 Multica 已支持协议族、但需要工作区级启动命令的 AI CLI,可以定义 **custom runtime profile**。你可以在 Runtimes UI 里管理,也可以用 CLI:
+内置 provider 探测覆盖常见工具;如果团队的 AI CLI 兼容 Multica 已支持的协议族、但需要不同的启动命令,可以定义**自定义运行时配置(custom runtime profile)**。常见场景包括:给 Codex 套一层团队内部 wrapper、固定使用某个版本的可执行文件,或者为团队 CLI 预设模型参数。
+
+如果只是按默认命令使用 Claude Code、Codex、Kimi 或其他内置 provider,不需要创建自定义配置;守护进程会自动探测它们。
+
+### 创建前确认
+
+- 至少在一台运行 Multica 守护进程的机器上安装好自定义命令,并确认同一条命令能在这台机器的终端中运行。
+- 确认这个工具实现了界面中某一种基础协议。选择协议族只是告诉 Multica 如何与进程通信,并不能让不兼容的 CLI 自动变得兼容。
+- 只有工作区所有者或管理员可以创建、编辑和删除自定义运行时配置。
+
+### 从 Runtimes 界面创建
+
+1. 打开 **运行时(Runtimes)**,进入已经安装该命令的机器。
+2. 点击**添加自定义运行时**。
+3. 选择这个命令实际实现的基础协议类型。
+4. 填写显示名称,以及你会在终端中执行的命令;命令可以带固定参数。建议补充用途描述,方便其他成员识别。
+5. 点击**创建运行时**。
+
+配置定义属于整个工作区,会同步到所有已连接的守护进程;每台机器只有在本机能找到对应命令时,才会注册自己的运行时。从哪台机器发起创建,该机器就会先显示一条临时的**注册中**记录。如果它迟迟没有变成在线,请确认命令已安装,并且该机器的守护进程能找到它。
+
+创建配置不会自动安装 CLI、完成登录,也不会把命令复制到其他机器。每一台需要提供该运行时的机器,都必须单独安装并登录底层工具。
+
+### 使用 CLI 管理
+
+同一组工作区配置也可以通过 CLI 管理:
```bash
multica runtime profile list
@@ -69,6 +93,8 @@ multica runtime profile update <profile-id> --command-name agent
multica runtime profile delete <profile-id>
```
+内置和自定义运行时都显示在同一份机器列表里。打开自定义运行时所在行的操作菜单,即可编辑或删除配置。删除配置后,各机器上由它注册的运行时实例会在守护进程同步后移除;如果仍有智能体依赖它,删除操作可能会被阻止。
+
这里填写的是 argv 风格命令,不是 shell 字符串。Multica 存的是可执行文件名和固定参数,守护进程会直接用 `exec.Command(command_name, fixed_args...)` 启动。支持普通参数、引号和反斜杠转义;不支持管道、重定向、`&&`、`;`、反引号、`$VAR` / `$(...)` 展开。需要 shell 行为时,用 wrapper script 包一层。
目前命令和参数的解析入口在 Runtimes UI;CLI 的 profile 命令负责管理 profile 记录和本机路径覆盖。
diff --git a/apps/web/app/[workspaceSlug]/(dashboard)/runtimes/[id]/runtime/[runtimeId]/page.tsx b/apps/web/app/[workspaceSlug]/(dashboard)/runtimes/[id]/runtime/[runtimeId]/page.tsx
new file mode 100644
index 0000000000..bb37134134
--- /dev/null
+++ b/apps/web/app/[workspaceSlug]/(dashboard)/runtimes/[id]/runtime/[runtimeId]/page.tsx
@@ -0,0 +1,13 @@
+"use client";
+
+import { use } from "react";
+import { RuntimeSettingsPage } from "@multica/views/runtimes";
+
+export default function RuntimeSettingsRoute({
+ params,
+}: {
+ params: Promise<{ id: string; runtimeId: string }>;
+}) {
+ const { id, runtimeId } = use(params);
+ return <RuntimeSettingsPage machineId={id} runtimeId={runtimeId} />;
+}
diff --git a/packages/core/paths/paths.test.ts b/packages/core/paths/paths.test.ts
index de43b106ca..2b09355421 100644
--- a/packages/core/paths/paths.test.ts
+++ b/packages/core/paths/paths.test.ts
@@ -18,6 +18,9 @@ describe("paths.workspace(slug)", () => {
expect(ws.inbox()).toBe("/acme/inbox");
expect(ws.myIssues()).toBe("/acme/my-issues");
expect(ws.runtimes()).toBe("/acme/runtimes");
+ expect(ws.runtimeSettings("machine/runtime", "runtime one")).toBe(
+ "/acme/runtimes/machine%2Fruntime/runtime/runtime%20one",
+ );
expect(ws.skills()).toBe("/acme/skills");
expect(ws.skillDetail("skl_123")).toBe("/acme/skills/skl_123");
expect(ws.squads()).toBe("/acme/squads");
diff --git a/packages/core/paths/paths.ts b/packages/core/paths/paths.ts
index 61d95144ab..1c141daf06 100644
--- a/packages/core/paths/paths.ts
+++ b/packages/core/paths/paths.ts
@@ -36,6 +36,8 @@ function workspaceScoped(slug: string) {
myIssues: () => `${ws}/my-issues`,
runtimes: () => `${ws}/runtimes`,
runtimeDetail: (id: string) => `${ws}/runtimes/${encode(id)}`,
+ runtimeSettings: (machineId: string, runtimeId: string) =>
+ `${ws}/runtimes/${encode(machineId)}/runtime/${encode(runtimeId)}`,
skills: () => `${ws}/skills`,
skillDetail: (id: string) => `${ws}/skills/${encode(id)}`,
settings: () => `${ws}/settings`,
diff --git a/packages/views/locales/en/runtimes.json b/packages/views/locales/en/runtimes.json
index dc5a03f20a..adbdc2a693 100644
--- a/packages/views/locales/en/runtimes.json
+++ b/packages/views/locales/en/runtimes.json
@@ -47,6 +47,11 @@
"no_matches_title": "No machines",
"no_matches_hint": "No machines match the current search or filter.",
"select_machine": "Select a machine to inspect its runtimes.",
+ "select_runtime": "Built-in runtimes appear automatically. Select one for settings, or add a custom command.",
+ "no_runtimes_title": "No runtimes registered",
+ "no_runtimes_hint": "Start or reconnect this machine's daemon. Its installed CLI runtimes will appear here automatically.",
+ "not_found_title": "Machine not found",
+ "not_found_hint": "It may be offline, removed, or no longer available to you.",
"metrics": {
"runtimes": "Runtimes",
"runtimes_hint_one": "{{count}} online",
@@ -100,6 +105,7 @@
"read_only": "Read-only",
"delete_button": "Delete runtime",
"last_seen": "last seen {{when}}",
+ "never_seen": "never connected",
"fact_owner": "Owner",
"fact_device": "Device",
"fact_runtime": "Runtime",
@@ -276,21 +282,31 @@
"cost_delta_flat": "flat",
"cli_managed_badge": "Desktop",
"row_actions_aria": "Row actions",
+ "edit_action": "Edit custom runtime",
"delete_action": "Delete",
+ "delete_profile_action": "Delete from workspace",
"delete_permission_hint": "Only the runtime owner and workspace admins can delete this runtime",
"delete_admin_hint": "Only the runtime owner and workspace admins can delete a runtime.",
"badge_builtin": "Built-in",
"badge_custom": "Custom",
"badge_registering": "Registering",
+ "badge_disabled": "Disabled",
"pending_health": "Registering with daemon",
"pending_health_warning": "Waiting for daemon sync",
"pending_health_error": "Registration error",
+ "pending_health_disabled": "Disabled",
"pending_cli_unknown": "waiting"
},
"profiles": {
"cta": "Add runtime",
+ "add_custom": "Add custom runtime",
+ "this_machine": "this machine",
+ "unassigned_title": "Custom runtimes without a machine",
+ "unassigned_description": "These workspace runtimes are not connected to any machine. Connect a machine with the matching commands, or use a row's actions to edit or delete them.",
"dialog_title": "Custom runtimes",
- "dialog_description": "Workspace-specific commands built on the supported protocol families below.",
+ "dialog_description": "Custom runtime definitions are workspace-wide and sync to every connected machine. A machine registers the runtime when the command is available there.",
+ "create_dialog_description": "Set up a custom command from {{machine}}. The definition syncs workspace-wide and registers only on machines where that command is available.",
+ "learn_more": "View setup guide",
"close": "Close",
"add_new": "New custom runtime",
"list_title": "Runtime backends",
@@ -326,14 +342,15 @@
"step_family_label": "Choose a base protocol family",
"step_family_hint": "The underlying CLI protocol this runtime speaks.",
"step_details_label": "Configure the runtime",
+ "step_progress": "Step {{current}} of {{total}}",
"family_label": "Base protocol family",
"family_locked_hint": "The base protocol family can't be changed after creation.",
"display_name_label": "Display name",
- "display_name_placeholder": "My custom Claude",
+ "display_name_placeholder": "e.g. My custom Claude…",
"command_name_label": "Command",
- "command_name_placeholder": "agent --model composer-2.5",
+ "command_name_placeholder": "e.g. agent --model composer-2.5…",
"description_label": "Description",
- "description_placeholder": "Optional — what this runtime is for",
+ "description_placeholder": "What this runtime is for (optional)…",
"error_display_name_required": "Display name is required.",
"error_command_required": "Command is required.",
"error_command_unclosed_quote": "Close the quote before saving.",
@@ -355,12 +372,12 @@
"error_generic": "Failed to save the runtime."
},
"delete_dialog": {
- "title": "Delete custom runtime?",
- "description": "Delete \"{{name}}\"? This can't be undone.",
- "confirm": "Delete",
+ "title": "Delete custom runtime from workspace?",
+ "description": "\"{{name}}\" will be removed from this workspace and every machine where it is registered. This can't be undone.",
+ "confirm": "Delete from workspace",
"cancel": "Cancel",
"deleting": "Deleting…",
- "toast_deleted": "Custom runtime deleted",
+ "toast_deleted": "Custom runtime deleted from workspace",
"error_bound": "This runtime can't be deleted while agents are still using it.",
"error_generic": "Failed to delete the runtime."
}
diff --git a/packages/views/locales/ja/runtimes.json b/packages/views/locales/ja/runtimes.json
index e838bac5dc..4aa3605e50 100644
--- a/packages/views/locales/ja/runtimes.json
+++ b/packages/views/locales/ja/runtimes.json
@@ -45,6 +45,11 @@
"no_matches_title": "マシンなし",
"no_matches_hint": "現在の検索またはフィルターに一致するマシンがありません。",
"select_machine": "マシンを選択して、そのランタイムを確認してください。",
+ "select_runtime": "組み込みランタイムは自動的に表示されます。設定を見るか、カスタムコマンドを追加してください。",
+ "no_runtimes_title": "登録済みのランタイムがありません",
+ "no_runtimes_hint": "このマシンのデーモンを起動または再接続してください。インストール済みの CLI ランタイムが自動的に表示されます。",
+ "not_found_title": "マシンが見つかりません",
+ "not_found_hint": "オフライン、削除済み、またはアクセスできなくなった可能性があります。",
"metrics": {
"runtimes": "ランタイム",
"runtimes_hint_other": "オンライン {{count}} 個",
@@ -96,6 +101,7 @@
"read_only": "読み取り専用",
"delete_button": "ランタイムを削除",
"last_seen": "最終確認 {{when}}",
+ "never_seen": "未接続",
"fact_owner": "所有者",
"fact_device": "デバイス",
"fact_runtime": "ランタイム",
@@ -264,21 +270,31 @@
"cost_delta_flat": "変化なし",
"cli_managed_badge": "デスクトップ",
"row_actions_aria": "行の操作",
+ "edit_action": "カスタムランタイムを編集",
"delete_action": "削除",
+ "delete_profile_action": "ワークスペースから削除",
"delete_permission_hint": "ランタイムの所有者とワークスペース管理者のみが、このランタイムを削除できます",
"delete_admin_hint": "ランタイムの所有者とワークスペース管理者のみが、ランタイムを削除できます。",
"badge_builtin": "組み込み",
"badge_custom": "カスタム",
"badge_registering": "登録中",
+ "badge_disabled": "無効",
"pending_health": "Daemon に登録中",
"pending_health_warning": "Daemon 同期待ち",
"pending_health_error": "登録エラー",
+ "pending_health_disabled": "無効",
"pending_cli_unknown": "待機中"
},
"profiles": {
"cta": "ランタイムを追加",
+ "add_custom": "カスタムランタイムを追加",
+ "this_machine": "このマシン",
+ "unassigned_title": "マシンに接続されていないカスタムランタイム",
+ "unassigned_description": "これらのワークスペースランタイムは、どのマシンにも接続されていません。対応するコマンドがあるマシンを接続するか、行の操作から編集または削除できます。",
"dialog_title": "カスタムランタイム",
- "dialog_description": "下記のサポートされているプロトコルファミリー上に作るワークスペース固有のコマンド。",
+ "dialog_description": "カスタムランタイム定義はワークスペース全体に適用され、接続済みのすべてのマシンへ同期されます。コマンドが利用可能なマシンでのみランタイムが登録されます。",
+ "create_dialog_description": "{{machine}} からカスタムコマンドを設定します。定義はワークスペース全体に同期され、そのコマンドを利用できるマシンでのみ登録されます。",
+ "learn_more": "設定ガイドを見る",
"close": "閉じる",
"add_new": "新しいカスタムランタイム",
"list_title": "ランタイムバックエンド",
@@ -314,14 +330,15 @@
"step_family_label": "ベースプロトコルファミリーを選択",
"step_family_hint": "このランタイムが使用する基盤の CLI プロトコル。",
"step_details_label": "ランタイムを設定",
+ "step_progress": "ステップ {{current}} / {{total}}",
"family_label": "ベースプロトコルファミリー",
"family_locked_hint": "作成後はベースプロトコルファミリーを変更できません。",
"display_name_label": "表示名",
- "display_name_placeholder": "マイカスタム Claude",
+ "display_name_placeholder": "例:マイカスタム Claude…",
"command_name_label": "コマンド",
- "command_name_placeholder": "agent --model composer-2.5",
+ "command_name_placeholder": "例:agent --model composer-2.5…",
"description_label": "説明",
- "description_placeholder": "任意 — このランタイムの用途",
+ "description_placeholder": "このランタイムの用途(任意)…",
"error_display_name_required": "表示名は必須です。",
"error_command_required": "コマンドは必須です。",
"error_command_unclosed_quote": "保存する前に引用符を閉じてください。",
@@ -343,12 +360,12 @@
"error_generic": "ランタイムの保存に失敗しました。"
},
"delete_dialog": {
- "title": "カスタムランタイムを削除しますか?",
- "description": "「{{name}}」を削除しますか?この操作は元に戻せません。",
- "confirm": "削除",
+ "title": "カスタムランタイムをワークスペースから削除しますか?",
+ "description": "「{{name}}」はこのワークスペースと、登録されているすべてのマシンから削除されます。この操作は元に戻せません。",
+ "confirm": "ワークスペースから削除",
"cancel": "キャンセル",
"deleting": "削除中…",
- "toast_deleted": "カスタムランタイムを削除しました",
+ "toast_deleted": "カスタムランタイムをワークスペースから削除しました",
"error_bound": "まだエージェントが使用しているため、このランタイムは削除できません。",
"error_generic": "ランタイムの削除に失敗しました。"
}
diff --git a/packages/views/locales/ko/runtimes.json b/packages/views/locales/ko/runtimes.json
index 30685d44c9..94f79c410f 100644
--- a/packages/views/locales/ko/runtimes.json
+++ b/packages/views/locales/ko/runtimes.json
@@ -45,6 +45,11 @@
"no_matches_title": "기기 없음",
"no_matches_hint": "현재 검색 또는 필터와 일치하는 기기가 없습니다.",
"select_machine": "기기를 선택해 런타임을 확인하세요.",
+ "select_runtime": "기본 제공 런타임은 자동으로 표시됩니다. 설정을 보거나 사용자 지정 명령을 추가하세요.",
+ "no_runtimes_title": "등록된 런타임이 없습니다",
+ "no_runtimes_hint": "이 기기의 데몬을 시작하거나 다시 연결하세요. 설치된 CLI 런타임이 자동으로 여기에 표시됩니다.",
+ "not_found_title": "기기를 찾을 수 없음",
+ "not_found_hint": "오프라인이거나 삭제되었거나 더 이상 접근할 수 없을 수 있습니다.",
"metrics": {
"runtimes": "런타임",
"runtimes_hint_other": "온라인 {{count}}개",
@@ -96,6 +101,7 @@
"read_only": "읽기 전용",
"delete_button": "런타임 삭제",
"last_seen": "마지막 확인 {{when}}",
+ "never_seen": "연결 기록 없음",
"fact_owner": "소유자",
"fact_device": "기기",
"fact_runtime": "런타임",
@@ -264,21 +270,31 @@
"cost_delta_flat": "변화 없음",
"cli_managed_badge": "데스크톱",
"row_actions_aria": "행 작업",
+ "edit_action": "사용자 지정 런타임 편집",
"delete_action": "삭제",
+ "delete_profile_action": "워크스페이스에서 삭제",
"delete_permission_hint": "런타임 소유자와 워크스페이스 관리자만 이 런타임을 삭제할 수 있습니다",
"delete_admin_hint": "런타임 소유자와 워크스페이스 관리자만 런타임을 삭제할 수 있습니다.",
"badge_builtin": "기본 제공",
"badge_custom": "사용자 지정",
"badge_registering": "등록 중",
+ "badge_disabled": "비활성화됨",
"pending_health": "Daemon에 등록 중",
"pending_health_warning": "Daemon 동기화 대기 중",
"pending_health_error": "등록 오류",
+ "pending_health_disabled": "비활성화됨",
"pending_cli_unknown": "대기 중"
},
"profiles": {
"cta": "런타임 추가",
+ "add_custom": "사용자 지정 런타임 추가",
+ "this_machine": "이 기기",
+ "unassigned_title": "기기에 연결되지 않은 사용자 지정 런타임",
+ "unassigned_description": "이 워크스페이스 런타임은 현재 어떤 기기에도 연결되어 있지 않습니다. 해당 명령이 있는 기기를 연결하거나 행 작업에서 수정 또는 삭제할 수 있습니다.",
"dialog_title": "사용자 지정 런타임",
- "dialog_description": "아래 지원되는 프로토콜 제품군 위에 만드는 워크스페이스별 명령입니다.",
+ "dialog_description": "사용자 지정 런타임 정의는 워크스페이스 전체에 적용되며 연결된 모든 기기에 동기화됩니다. 해당 명령을 사용할 수 있는 기기에서만 런타임이 등록됩니다.",
+ "create_dialog_description": "{{machine}}에서 사용자 지정 명령을 설정합니다. 정의는 워크스페이스 전체에 동기화되며 해당 명령을 사용할 수 있는 기기에만 등록됩니다.",
+ "learn_more": "설정 가이드 보기",
"close": "닫기",
"add_new": "새 사용자 지정 런타임",
"list_title": "런타임 백엔드",
@@ -314,14 +330,15 @@
"step_family_label": "기본 프로토콜 제품군 선택",
"step_family_hint": "이 런타임이 사용하는 기반 CLI 프로토콜입니다.",
"step_details_label": "런타임 구성",
+ "step_progress": "{{current}} / {{total}}단계",
"family_label": "기본 프로토콜 제품군",
"family_locked_hint": "생성 후에는 기본 프로토콜 제품군을 변경할 수 없습니다.",
"display_name_label": "표시 이름",
- "display_name_placeholder": "내 사용자 지정 Claude",
+ "display_name_placeholder": "예: 내 사용자 지정 Claude…",
"command_name_label": "명령",
- "command_name_placeholder": "agent --model composer-2.5",
+ "command_name_placeholder": "예: agent --model composer-2.5…",
"description_label": "설명",
- "description_placeholder": "선택 사항 — 이 런타임의 용도",
+ "description_placeholder": "이 런타임의 용도(선택 사항)…",
"error_display_name_required": "표시 이름은 필수입니다.",
"error_command_required": "명령은 필수입니다.",
"error_command_unclosed_quote": "저장하기 전에 따옴표를 닫으세요.",
@@ -343,12 +360,12 @@
"error_generic": "런타임 저장에 실패했습니다."
},
"delete_dialog": {
- "title": "사용자 지정 런타임을 삭제하시겠습니까?",
- "description": "\"{{name}}\"을(를) 삭제하시겠습니까? 이 작업은 되돌릴 수 없습니다.",
- "confirm": "삭제",
+ "title": "사용자 지정 런타임을 워크스페이스에서 삭제하시겠습니까?",
+ "description": "\"{{name}}\"은(는) 이 워크스페이스와 등록된 모든 기기에서 제거됩니다. 이 작업은 되돌릴 수 없습니다.",
+ "confirm": "워크스페이스에서 삭제",
"cancel": "취소",
"deleting": "삭제 중…",
- "toast_deleted": "사용자 지정 런타임이 삭제되었습니다",
+ "toast_deleted": "사용자 지정 런타임이 워크스페이스에서 삭제되었습니다",
"error_bound": "아직 에이전트가 사용 중이어서 이 런타임을 삭제할 수 없습니다.",
"error_generic": "런타임 삭제에 실패했습니다."
}
diff --git a/packages/views/locales/zh-Hans/runtimes.json b/packages/views/locales/zh-Hans/runtimes.json
index 20798af365..f2769ceb09 100644
--- a/packages/views/locales/zh-Hans/runtimes.json
+++ b/packages/views/locales/zh-Hans/runtimes.json
@@ -45,6 +45,11 @@
"no_matches_title": "没有机器",
"no_matches_hint": "没有机器匹配当前搜索或筛选。",
"select_machine": "选择一台机器查看它的运行时。",
+ "select_runtime": "内置运行时会自动出现。选择一项查看设置,或添加自定义命令。",
+ "no_runtimes_title": "还没有注册运行时",
+ "no_runtimes_hint": "启动或重新连接这台机器的守护进程。检测到已安装的 CLI 后,运行时会自动出现在这里。",
+ "not_found_title": "未找到机器",
+ "not_found_hint": "它可能已离线、被移除,或你已无权访问。",
"metrics": {
"runtimes": "运行时",
"runtimes_hint_other": "{{count}} 个在线",
@@ -96,6 +101,7 @@
"read_only": "只读",
"delete_button": "删除运行时",
"last_seen": "最后活跃 {{when}}",
+ "never_seen": "从未连接",
"fact_owner": "所有者",
"fact_device": "设备",
"fact_runtime": "运行时",
@@ -264,21 +270,31 @@
"cost_delta_flat": "持平",
"cli_managed_badge": "桌面端",
"row_actions_aria": "行操作",
+ "edit_action": "编辑自定义运行时",
"delete_action": "删除",
+ "delete_profile_action": "从工作区删除",
"delete_permission_hint": "只有运行时所有者和工作区管理员可以删除这个运行时",
"delete_admin_hint": "只有运行时所有者和工作区管理员可以删除运行时。",
"badge_builtin": "内置",
"badge_custom": "自定义",
"badge_registering": "注册中",
+ "badge_disabled": "已禁用",
"pending_health": "正在向守护进程注册",
"pending_health_warning": "等待守护进程同步",
"pending_health_error": "注册错误",
+ "pending_health_disabled": "已禁用",
"pending_cli_unknown": "等待中"
},
"profiles": {
"cta": "添加运行时",
+ "add_custom": "添加自定义运行时",
+ "this_machine": "这台机器",
+ "unassigned_title": "尚未连接到机器的自定义运行时",
+ "unassigned_description": "这些工作区运行时目前没有连接到任何机器。你可以连接装有对应命令的机器,或通过行操作编辑、删除配置。",
"dialog_title": "自定义运行时",
- "dialog_description": "基于下方支持的协议族构建的工作区专属命令。",
+ "dialog_description": "自定义运行时定义属于整个工作区,会同步到所有已连接的机器。只有机器上能找到对应命令时,才会注册该运行时。",
+ "create_dialog_description": "从 {{machine}} 配置一个自定义命令。定义会同步到整个工作区,但只会在能找到该命令的机器上注册。",
+ "learn_more": "查看配置指南",
"close": "关闭",
"add_new": "新建自定义运行时",
"list_title": "运行时后端",
@@ -314,14 +330,15 @@
"step_family_label": "选择基础协议类型",
"step_family_hint": "此运行时使用的底层 CLI 协议。",
"step_details_label": "配置运行时",
+ "step_progress": "第 {{current}} / {{total}} 步",
"family_label": "基础协议类型",
"family_locked_hint": "创建后无法更改基础协议类型。",
"display_name_label": "显示名称",
- "display_name_placeholder": "我的自定义 Claude",
+ "display_name_placeholder": "例如:我的自定义 Claude...",
"command_name_label": "命令",
- "command_name_placeholder": "agent --model composer-2.5",
+ "command_name_placeholder": "例如:agent --model composer-2.5...",
"description_label": "描述",
- "description_placeholder": "可选 — 此运行时的用途",
+ "description_placeholder": "描述此运行时的用途(可选)...",
"error_display_name_required": "显示名称为必填项。",
"error_command_required": "命令为必填项。",
"error_command_unclosed_quote": "保存前请先闭合引号。",
@@ -334,21 +351,21 @@
"cancel": "取消",
"next": "下一步",
"create": "创建运行时",
- "creating": "正在创建…",
+ "creating": "正在创建...",
"save": "保存更改",
- "saving": "正在保存…",
+ "saving": "正在保存...",
"toast_created": "自定义运行时已创建",
"toast_updated": "自定义运行时已更新",
"error_duplicate_name": "已存在使用此显示名称的运行时。",
"error_generic": "保存运行时失败。"
},
"delete_dialog": {
- "title": "删除自定义运行时?",
- "description": "确定删除“{{name}}”?此操作无法撤销。",
- "confirm": "删除",
+ "title": "从工作区删除自定义运行时?",
+ "description": "\"{{name}}\" 将从此工作区及所有已注册的机器中移除。此操作无法撤销。",
+ "confirm": "从工作区删除",
"cancel": "取消",
- "deleting": "正在删除…",
- "toast_deleted": "自定义运行时已删除",
+ "deleting": "正在删除...",
+ "toast_deleted": "已从工作区删除自定义运行时",
"error_bound": "仍有智能体在使用此运行时,无法删除。",
"error_generic": "删除运行时失败。"
}
diff --git a/packages/views/runtimes/components/delete-runtime-profile-dialog.tsx b/packages/views/runtimes/components/delete-runtime-profile-dialog.tsx
index fe8ac7c525..c1ca27b7ef 100644
--- a/packages/views/runtimes/components/delete-runtime-profile-dialog.tsx
+++ b/packages/views/runtimes/components/delete-runtime-profile-dialog.tsx
@@ -11,6 +11,8 @@ import {
import {
AlertDialog,
AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogTitle,
} from "@multica/ui/components/ui/alert-dialog";
import { Button } from "@multica/ui/components/ui/button";
import { useT } from "../../i18n";
@@ -86,20 +88,23 @@ export function DeleteRuntimeProfileDialog({
onClick={(e) => e.stopPropagation()}
>
<div className="px-5 pb-4 pt-5">
- <h2 className="text-base font-semibold">
+ <AlertDialogTitle className="font-sans text-base font-semibold">
{t(($) => $.profiles.delete_dialog.title)}
- </h2>
- <p className="mt-1 text-sm leading-5 text-muted-foreground">
+ </AlertDialogTitle>
+ <AlertDialogDescription className="mt-1 text-left text-sm leading-5 text-pretty">
{t(($) => $.profiles.delete_dialog.description, {
name: profile.display_name,
})}
- </p>
+ </AlertDialogDescription>
{boundMessage && (
<div
role="alert"
className="mt-3 flex items-start gap-2 rounded-md border border-warning/40 bg-warning/5 px-3 py-2 text-xs"
>
- <AlertTriangle className="mt-0.5 size-3.5 shrink-0 text-warning" />
+ <AlertTriangle
+ aria-hidden="true"
+ className="mt-0.5 size-3.5 shrink-0 text-warning"
+ />
<span className="text-foreground">{boundMessage}</span>
</div>
)}
diff --git a/packages/views/runtimes/components/index.ts b/packages/views/runtimes/components/index.ts
index 4534a4c14e..776cc9a846 100644
--- a/packages/views/runtimes/components/index.ts
+++ b/packages/views/runtimes/components/index.ts
@@ -1,2 +1,3 @@
export { default as RuntimesPage } from "./runtimes-page";
export { RuntimeDetailPage } from "./runtime-detail-page";
+export { RuntimeSettingsPage } from "./runtime-settings-page";
diff --git a/packages/views/runtimes/components/pending-runtime.test.ts b/packages/views/runtimes/components/pending-runtime.test.ts
index 8c1bd1b387..fe9ef796c4 100644
--- a/packages/views/runtimes/components/pending-runtime.test.ts
+++ b/packages/views/runtimes/components/pending-runtime.test.ts
@@ -2,6 +2,7 @@ import { describe, expect, it } from "vitest";
import type { AgentRuntime, RuntimeProfile } from "@multica/core/types";
import {
PENDING_RUNTIME_WARNING_MS,
+ isDisabledCustomRuntime,
isPendingCustomRuntime,
isPendingCustomRuntimeWarning,
pendingRuntimeCommandName,
@@ -66,6 +67,7 @@ describe("pending custom runtime rows", () => {
expect(pending.daemon_id).toBe("daemon-1");
expect(pending.profile_id).toBe("profile-1");
expect(pending.provider).toBe("codex");
+ expect(pending.owner_id).toBe("user-1");
expect(isPendingCustomRuntime(pending)).toBe(true);
expect(pendingRuntimeCommandName(pending)).toBe("team-codex");
});
@@ -120,4 +122,14 @@ describe("pending custom runtime rows", () => {
),
).toBe(true);
});
+
+ it("keeps disabled profiles visible without treating them as registering", () => {
+ const pending = pendingRuntimeFromProfile({
+ profile: profile({ enabled: false }),
+ createdAt: Date.parse("2026-01-01T00:00:00Z"),
+ });
+
+ expect(isPendingCustomRuntime(pending)).toBe(true);
+ expect(isDisabledCustomRuntime(pending)).toBe(true);
+ });
});
diff --git a/packages/views/runtimes/components/pending-runtime.ts b/packages/views/runtimes/components/pending-runtime.ts
index b87729c808..bb1f21799a 100644
--- a/packages/views/runtimes/components/pending-runtime.ts
+++ b/packages/views/runtimes/components/pending-runtime.ts
@@ -7,6 +7,7 @@ const PENDING_RUNTIME_ID_PREFIX = "pending-runtime-profile:";
interface PendingRuntimeMetadata extends Record<string, unknown> {
pending_custom_runtime: true;
runtime_profile_id: string;
+ runtime_profile_enabled: boolean;
command_name: string;
pending_since: string;
}
@@ -24,6 +25,13 @@ export function isPendingCustomRuntime(runtime: AgentRuntime): boolean {
return runtime.metadata?.pending_custom_runtime === true;
}
+export function isDisabledCustomRuntime(runtime: AgentRuntime): boolean {
+ return (
+ isPendingCustomRuntime(runtime) &&
+ runtime.metadata?.runtime_profile_enabled === false
+ );
+}
+
export function pendingRuntimeCommandName(runtime: AgentRuntime): string | null {
const command = runtime.metadata?.command_name;
return typeof command === "string" && command.trim() ? command : null;
@@ -72,6 +80,7 @@ export function pendingRuntimeFromProfile({
const metadata: PendingRuntimeMetadata = {
pending_custom_runtime: true,
runtime_profile_id: profile.id,
+ runtime_profile_enabled: profile.enabled,
command_name: profile.command_name,
pending_since: pendingSince,
};
@@ -87,7 +96,7 @@ export function pendingRuntimeFromProfile({
status: "offline",
device_info: machineName,
metadata,
- owner_id: ownerId ?? null,
+ owner_id: ownerId ?? profile.created_by ?? null,
visibility: "private",
profile_id: profile.id,
last_seen_at: pendingSince,
diff --git a/packages/views/runtimes/components/runtime-detail-page.tsx b/packages/views/runtimes/components/runtime-detail-page.tsx
index 2b0d3ffb94..e4e9b4e2e6 100644
--- a/packages/views/runtimes/components/runtime-detail-page.tsx
+++ b/packages/views/runtimes/components/runtime-detail-page.tsx
@@ -1,52 +1,390 @@
"use client";
-import { Server } from "lucide-react";
-import { useQuery } from "@tanstack/react-query";
+import { useCallback, useEffect, useMemo, useState } from "react";
+import { AlertCircle, Cloud, Monitor, Pencil, Plus, Server } from "lucide-react";
+import { useQuery, useQueryClient } from "@tanstack/react-query";
+import { useAuthStore } from "@multica/core/auth";
import { useWorkspaceId } from "@multica/core/hooks";
-import { runtimeListOptions } from "@multica/core/runtimes/queries";
+import { useWorkspacePaths } from "@multica/core/paths";
+import { agentTaskSnapshotOptions } from "@multica/core/agents";
+import { runtimeProfileListOptions } from "@multica/core/runtimes";
+import { runtimeKeys, runtimeListOptions } from "@multica/core/runtimes/queries";
+import { useUpdatableRuntimeIds } from "@multica/core/runtimes/hooks";
+import { useWSEvent } from "@multica/core/realtime";
+import {
+ agentListOptions,
+ memberListOptions,
+} from "@multica/core/workspace/queries";
+import { Button } from "@multica/ui/components/ui/button";
import { Skeleton } from "@multica/ui/components/ui/skeleton";
-import { RuntimeDetail } from "./runtime-detail";
-import { useT } from "../../i18n";
+import { AppLink, useNavigation } from "../../navigation";
+import { buildWorkloadIndex, RuntimeList } from "./runtime-list";
+import {
+ buildRuntimeMachines,
+ sharedCustomName,
+} from "./runtime-machines";
+import { RenameMachineDialog } from "./rename-machine-dialog";
+import { RuntimeProfilesDialog } from "./runtime-profiles-dialog";
+import { pendingRuntimesForProfiles } from "./pending-runtime";
+import { HealthIcon, useHealthLabel } from "./shared";
+import { useT, useTimeAgo } from "../../i18n";
+
+export interface RuntimeDetailPageProps {
+ /** A machine id, or a legacy runtime id that locates its machine. */
+ runtimeId: string;
+ localDaemonId?: string | null;
+ localMachineName?: string | null;
+ localMachineActions?: React.ReactNode;
+ hasLocalMachine?: boolean;
+ bootstrapping?: boolean;
+}
+
+function useNowTick(intervalMs = 30_000): number {
+ const [now, setNow] = useState(() => Date.now());
+ useEffect(() => {
+ const id = setInterval(() => setNow(Date.now()), intervalMs);
+ return () => clearInterval(id);
+ }, [intervalMs]);
+ return now;
+}
+
+function decodeRouteParam(value: string): string {
+ try {
+ return decodeURIComponent(value);
+ } catch {
+ return value;
+ }
+}
+
+function findMachine(
+ machines: ReturnType<typeof buildRuntimeMachines>,
+ locator: string,
+) {
+ return (
+ machines.find(
+ (candidate) =>
+ candidate.id === locator ||
+ candidate.runtimes.some((runtime) => runtime.id === locator),
+ ) ??
+ (locator === "local:placeholder"
+ ? machines.find((candidate) => candidate.isCurrent) ?? null
+ : null)
+ );
+}
/**
- * Routed entry for `/{slug}/runtimes/{id}`. Reads the workspace runtime list
- * from cache (the list page already populated it), finds the matching
- * runtime, and renders the shared detail surface. We deliberately avoid
- * adding a per-runtime fetch endpoint — the list query is already keyed
- * per-workspace and is the source of truth for membership; reading from it
- * keeps cache invariants simple (one cache, one update path).
+ * Machine-level detail route. New links use the daemon-level machine id;
+ * legacy links that still carry a runtime id remain valid and are expanded
+ * to their containing machine before child runtime settings are exposed.
*/
-export function RuntimeDetailPage({ runtimeId }: { runtimeId: string }) {
+export function RuntimeDetailPage({
+ runtimeId,
+ localDaemonId,
+ localMachineName,
+ localMachineActions,
+ hasLocalMachine,
+ bootstrapping,
+}: RuntimeDetailPageProps) {
const { t } = useT("runtimes");
const wsId = useWorkspaceId();
- const { data: runtimes, isLoading } = useQuery(runtimeListOptions(wsId));
+ const paths = useWorkspacePaths();
+ const navigation = useNavigation();
+ const qc = useQueryClient();
+ const healthLabel = useHealthLabel();
+ const timeAgo = useTimeAgo();
+ const currentUserId = useAuthStore((state) => state.user?.id);
+ const { data: runtimes = [], isLoading } = useQuery(runtimeListOptions(wsId));
+ const { data: agents = [] } = useQuery(agentListOptions(wsId));
+ const { data: tasks = [] } = useQuery(agentTaskSnapshotOptions(wsId));
+ const { data: members = [] } = useQuery(memberListOptions(wsId));
+ const { data: runtimeProfiles = [] } = useQuery(
+ runtimeProfileListOptions(wsId),
+ );
+ const updatableIds = useUpdatableRuntimeIds(wsId);
+ const now = useNowTick();
+ const machineLocator = decodeRouteParam(runtimeId);
+ const [renameOpen, setRenameOpen] = useState(false);
+ const [createProfileOpen, setCreateProfileOpen] = useState(false);
+ const workloadIndex = useMemo(
+ () => buildWorkloadIndex(agents, tasks),
+ [agents, tasks],
+ );
+ const baseMachines = useMemo(
+ () =>
+ buildRuntimeMachines(runtimes, {
+ now,
+ localDaemonId,
+ localMachineName,
+ currentUserId,
+ workloadByRuntimeId: workloadIndex,
+ ensureLocalMachine: hasLocalMachine,
+ }),
+ [
+ runtimes,
+ now,
+ localDaemonId,
+ localMachineName,
+ currentUserId,
+ workloadIndex,
+ hasLocalMachine,
+ ],
+ );
+ const baseMachine = findMachine(baseMachines, machineLocator);
+ const profileRows = useMemo(
+ () =>
+ runtimeProfiles.map((profile) => {
+ const createdAt = Date.parse(profile.created_at);
+ return {
+ profile,
+ createdAt: Number.isFinite(createdAt) ? createdAt : 0,
+ };
+ }),
+ [runtimeProfiles],
+ );
+ const machineRuntimes = useMemo(() => {
+ if (!baseMachine) return [];
+ if (baseMachine.mode !== "local") return baseMachine.runtimes;
+ return pendingRuntimesForProfiles({
+ pendingProfiles: profileRows,
+ runtimes: baseMachine.runtimes,
+ localDaemonId: baseMachine.daemonId,
+ localMachineName: baseMachine.title,
+ fallbackMachineName: baseMachine.title,
+ });
+ }, [baseMachine, profileRows]);
+ const machine = baseMachine;
+ const handleDaemonEvent = useCallback(() => {
+ qc.invalidateQueries({ queryKey: runtimeKeys.all(wsId) });
+ }, [qc, wsId]);
+ useWSEvent("daemon:register", handleDaemonEvent);
+
+ const currentMember = currentUserId
+ ? members.find((member) => member.user_id === currentUserId)
+ : null;
+ const isAdmin =
+ currentMember?.role === "owner" || currentMember?.role === "admin";
+ const canAddRuntime =
+ isAdmin && machine?.mode === "local" && !!machine.daemonId;
+ const renameTarget = useMemo(() => {
+ if (!machine || machine.runtimes.length === 0) return null;
+ const editable = isAdmin
+ ? machine.runtimes[0]
+ : machine.runtimes.find((runtime) => runtime.owner_id === currentUserId);
+ if (!editable) return null;
+ return {
+ runtimeId: editable.id,
+ currentName: sharedCustomName(machine.runtimes) ?? "",
+ };
+ }, [machine, isAdmin, currentUserId]);
- if (isLoading) {
+ if (isLoading) return <MachineDetailSkeleton />;
+
+ if (!machine) {
return (
- <div className="flex h-full flex-col p-6">
- <Skeleton className="h-12 w-1/2" />
- <div className="mt-6 grid grid-cols-3 gap-3">
- <Skeleton className="h-20 rounded-lg" />
- <Skeleton className="h-20 rounded-lg" />
- <Skeleton className="h-20 rounded-lg" />
+ <div className="flex min-h-0 flex-1 flex-col">
+ <div className="flex flex-1 flex-col items-center justify-center gap-3 px-6 py-16 text-center">
+ <AlertCircle className="h-8 w-8 text-destructive" />
+ <div>
+ <p className="text-sm font-medium">
+ {t(($) => $.machine.not_found_title)}
+ </p>
+ <p className="mt-1 text-xs text-muted-foreground">
+ {t(($) => $.machine.not_found_hint)}
+ </p>
+ </div>
+ <Button size="sm" onClick={() => navigation.push(paths.runtimes())}>
+ {t(($) => $.detail.all_runtimes)}
+ </Button>
</div>
- <Skeleton className="mt-4 h-48 w-full rounded-lg" />
</div>
);
}
- const runtime = runtimes?.find((r) => r.id === runtimeId);
- if (!runtime) {
- return (
- <div className="flex h-full flex-col items-center justify-center text-muted-foreground">
- <Server className="h-10 w-10 text-muted-foreground/30" />
- <p className="mt-3 text-sm">{t(($) => $.detail_page.not_found_title)}</p>
- <p className="mt-1 text-xs text-muted-foreground/70">
- {t(($) => $.detail_page.not_found_hint)}
- </p>
+ const Icon = machine.section === "cloud" ? Cloud : Monitor;
+ const busyCount = machine.runningCount + machine.queuedCount;
+ return (
+ <div className="flex min-h-0 flex-1 flex-col">
+ <header className="shrink-0 border-b bg-background px-4 pb-5 pt-3 sm:px-6">
+ <div className="mx-auto max-w-[1440px]">
+ <div className="flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground">
+ <AppLink
+ href={paths.runtimes()}
+ className="rounded-sm transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ >
+ {t(($) => $.page.title)}
+ </AppLink>
+ <span aria-hidden="true">/</span>
+ <span className="truncate text-foreground">{machine.title}</span>
+ </div>
+
+ <div className="mt-4 flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between">
+ <div className="flex min-w-0 items-start gap-4">
+ <div className="flex h-12 w-12 shrink-0 items-center justify-center rounded-xl border bg-card sm:h-14 sm:w-14">
+ <Icon
+ aria-hidden="true"
+ className="h-5 w-5 text-muted-foreground sm:h-6 sm:w-6"
+ />
+ </div>
+ <div className="min-w-0 pt-0.5">
+ <div className="flex flex-wrap items-center gap-x-3 gap-y-1.5">
+ <h1 className="min-w-0 text-balance text-xl font-semibold tracking-tight sm:text-2xl">
+ {machine.title}
+ </h1>
+ <span className="inline-flex items-center gap-1.5 text-xs">
+ <HealthIcon health={machine.health} />
+ {healthLabel(machine.health)}
+ </span>
+ {machine.isCurrent && (
+ <span className="rounded bg-foreground px-1.5 py-0.5 text-[10px] font-medium text-background">
+ {t(($) => $.machine.this_machine)}
+ </span>
+ )}
+ </div>
+ {machine.subtitle && (
+ <p className="mt-1 text-sm text-muted-foreground">
+ {machine.subtitle}
+ </p>
+ )}
+ <div className="mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-xs text-muted-foreground">
+ <span>
+ {t(($) => $.machine.runtime_count, {
+ count: machineRuntimes.length,
+ })}
+ </span>
+ <span>
+ {busyCount > 0
+ ? t(($) => $.machine.metrics.workload_hint, {
+ running: machine.runningCount,
+ queued: machine.queuedCount,
+ })
+ : t(($) => $.machine.metrics.workload_idle)}
+ </span>
+ {machine.cliVersion && (
+ <span className="font-mono">CLI {machine.cliVersion}</span>
+ )}
+ {machine.lastSeenAt && (
+ <span>{timeAgo(machine.lastSeenAt)}</span>
+ )}
+ </div>
+ </div>
+ </div>
+
+ <div className="flex shrink-0 items-center gap-2 self-end lg:self-start">
+ {renameTarget && (
+ <Button
+ type="button"
+ size="sm"
+ variant="outline"
+ onClick={() => setRenameOpen(true)}
+ >
+ <Pencil aria-hidden="true" className="h-3.5 w-3.5" />
+ {t(($) => $.machine.rename)}
+ </Button>
+ )}
+ {machine.isCurrent && localMachineActions}
+ </div>
+ </div>
+ </div>
+ </header>
+
+ <div className="min-h-0 flex-1 overflow-y-auto bg-background">
+ <div className="mx-auto w-full max-w-[1440px] p-4 sm:p-6">
+ <div className="mb-4 flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between">
+ <div className="min-w-0">
+ <h2 className="text-sm font-semibold">
+ {t(($) => $.machine.metrics.runtimes)}
+ </h2>
+ <p className="mt-1 text-xs text-muted-foreground">
+ {t(($) => $.machine.select_runtime)}
+ </p>
+ </div>
+ {canAddRuntime && (
+ <Button
+ type="button"
+ size="sm"
+ onClick={() => setCreateProfileOpen(true)}
+ >
+ <Plus aria-hidden="true" className="h-3.5 w-3.5" />
+ {t(($) => $.profiles.add_custom)}
+ </Button>
+ )}
+ </div>
+ {machineRuntimes.length > 0 ? (
+ <div className="overflow-hidden rounded-lg border bg-card">
+ <RuntimeList
+ runtimes={machineRuntimes}
+ updatableIds={updatableIds}
+ now={now}
+ runtimeHref={(childRuntimeId) =>
+ paths.runtimeSettings(machine.id, childRuntimeId)
+ }
+ />
+ </div>
+ ) : (
+ <div className="flex min-h-48 flex-col items-center justify-center rounded-lg border border-dashed px-6 text-center">
+ <Server
+ aria-hidden="true"
+ className="h-7 w-7 text-muted-foreground/40"
+ />
+ <p className="mt-3 text-sm font-medium">
+ {bootstrapping
+ ? t(($) => $.page.bootstrapping.title)
+ : t(($) => $.machine.no_runtimes_title)}
+ </p>
+ <p className="mt-1 max-w-sm text-xs text-muted-foreground">
+ {bootstrapping
+ ? t(($) => $.page.bootstrapping.hint)
+ : t(($) => $.machine.no_runtimes_hint)}
+ </p>
+ </div>
+ )}
+ </div>
</div>
- );
- }
- return <RuntimeDetail runtime={runtime} />;
+ {renameTarget && (
+ <RenameMachineDialog
+ open={renameOpen}
+ onOpenChange={setRenameOpen}
+ wsId={wsId}
+ runtimeId={renameTarget.runtimeId}
+ currentName={renameTarget.currentName}
+ />
+ )}
+ {canAddRuntime && createProfileOpen && (
+ <RuntimeProfilesDialog
+ wsId={wsId}
+ intent="create"
+ machineName={machine.title}
+ onClose={() => setCreateProfileOpen(false)}
+ />
+ )}
+ </div>
+ );
+}
+
+function MachineDetailSkeleton() {
+ return (
+ <div className="flex min-h-0 flex-1 flex-col">
+ <div className="border-b px-6 pb-5 pt-3">
+ <Skeleton className="h-3 w-36" />
+ <div className="mt-4 flex items-start gap-4">
+ <Skeleton className="h-14 w-14 rounded-xl" />
+ <div className="flex-1">
+ <Skeleton className="h-7 w-64" />
+ <Skeleton className="mt-2 h-4 w-40" />
+ <Skeleton className="mt-3 h-3 w-72" />
+ </div>
+ </div>
+ </div>
+ <div className="mx-auto w-full max-w-[1440px] p-6">
+ <Skeleton className="h-4 w-24" />
+ <Skeleton className="mt-2 h-3 w-72" />
+ <div className="mt-4 overflow-hidden rounded-lg border">
+ {Array.from({ length: 4 }).map((_, index) => (
+ <Skeleton key={index} className="h-14 w-full rounded-none border-b last:border-b-0" />
+ ))}
+ </div>
+ </div>
+ </div>
+ );
}
diff --git a/packages/views/runtimes/components/runtime-detail-visibility.test.tsx b/packages/views/runtimes/components/runtime-detail-visibility.test.tsx
index d38b201ff8..af5b2fdefa 100644
--- a/packages/views/runtimes/components/runtime-detail-visibility.test.tsx
+++ b/packages/views/runtimes/components/runtime-detail-visibility.test.tsx
@@ -262,9 +262,18 @@ describe("RuntimeDetail visibility section", () => {
);
fireEvent.click(screen.getByRole("button", { name: /Delete runtime/i }));
- expect(screen.getByText("Delete custom runtime?")).toBeInTheDocument();
+ expect(
+ screen.getByText("Delete custom runtime from workspace?"),
+ ).toBeInTheDocument();
+ expect(
+ screen.getByRole("alertdialog", {
+ name: "Delete custom runtime from workspace?",
+ }),
+ ).toBeInTheDocument();
- fireEvent.click(screen.getByRole("button", { name: "Delete" }));
+ fireEvent.click(
+ screen.getByRole("button", { name: "Delete from workspace" }),
+ );
await waitFor(() =>
expect(mockDeleteRuntimeProfile).toHaveBeenCalledWith(profile.id),
);
diff --git a/packages/views/runtimes/components/runtime-detail.tsx b/packages/views/runtimes/components/runtime-detail.tsx
index a552a9f37f..c152fe2901 100644
--- a/packages/views/runtimes/components/runtime-detail.tsx
+++ b/packages/views/runtimes/components/runtime-detail.tsx
@@ -40,14 +40,13 @@ import { ActorAvatar } from "../../common/actor-avatar";
import { BreadcrumbHeader } from "../../layout/breadcrumb-header";
import { AppLink, useNavigation } from "../../navigation";
import { availabilityConfig, workloadConfig } from "../../agents/presence";
-import { formatLastSeen } from "../utils";
import { HealthBadge } from "./shared";
import { ProviderLogo } from "./provider-logo";
import { UpdateSection } from "./update-section";
import { UsageSection } from "./usage-section";
import { DeleteRuntimeDialog } from "./delete-runtime-dialog";
import { DeleteRuntimeProfileDialog } from "./delete-runtime-profile-dialog";
-import { useT } from "../../i18n";
+import { useT, useTimeAgo } from "../../i18n";
function getCliVersion(metadata: Record<string, unknown>): string | null {
if (
@@ -91,8 +90,19 @@ function useNowTick(intervalMs = 30_000): number {
return now;
}
-export function RuntimeDetail({ runtime }: { runtime: AgentRuntime }) {
+export function RuntimeDetail({
+ runtime,
+ machineHref,
+ machineLabel,
+ afterDeleteHref,
+}: {
+ runtime: AgentRuntime;
+ machineHref?: string;
+ machineLabel?: string;
+ afterDeleteHref?: string;
+}) {
const { t } = useT("runtimes");
+ const timeAgo = useTimeAgo();
const cliVersion =
runtime.runtime_mode === "local" ? getCliVersion(runtime.metadata) : null;
const launchedBy =
@@ -135,27 +145,33 @@ export function RuntimeDetail({ runtime }: { runtime: AgentRuntime }) {
(a) => a.runtime_id === runtime.id && !a.archived_at,
);
- // Successful delete (light or cascade) closes the dialog and navigates
- // back to the runtimes list. Toast lives here so the cascade-mode count
- // and the light-mode "Runtime deleted" share one entry point.
+ const deleteDestination = afterDeleteHref ?? paths.runtimes();
+
const handleRuntimeDeleted = () => {
setDeleteOpen(false);
- navigation.replace(paths.runtimes());
+ navigation.replace(deleteDestination);
toast.success(t(($) => $.detail.toast_deleted));
};
const handleProfileDeleted = () => {
setDeleteOpen(false);
- navigation.replace(paths.runtimes());
+ navigation.replace(deleteDestination);
};
const daemonShort = shortDaemonId(runtime.daemon_id);
- const lastSeen = formatLastSeen(runtime.last_seen_at);
+ const lastSeen = runtime.last_seen_at
+ ? timeAgo(runtime.last_seen_at)
+ : t(($) => $.detail.never_seen);
return (
<div className="flex h-full flex-col">
<BreadcrumbHeader
- segments={[{ href: paths.runtimes(), label: t(($) => $.page.title) }]}
+ segments={[
+ { href: paths.runtimes(), label: t(($) => $.page.title) },
+ ...(machineHref && machineLabel
+ ? [{ href: machineHref, label: machineLabel }]
+ : []),
+ ]}
leaf={
<span className="truncate font-mono text-xs text-foreground">
{runtimeDisplayName(runtime)}
@@ -288,7 +304,7 @@ function HeroCard({
Replaces the older dense `·`-separated meta strip that mixed
everything (including dev-only IDs) at the same visual weight. */}
<dl className="grid grid-cols-1 divide-y sm:grid-cols-3 sm:divide-x sm:divide-y-0">
- <Fact label="Owner">
+ <Fact label={t(($) => $.detail.fact_owner)}>
{ownerMember ? (
<span className="inline-flex min-w-0 items-center gap-1.5">
<ActorAvatar
@@ -303,7 +319,7 @@ function HeroCard({
<span className="text-sm text-muted-foreground">—</span>
)}
</Fact>
- <Fact label="Device">
+ <Fact label={t(($) => $.detail.fact_device)}>
{device?.hostname ? (
<Tooltip>
<TooltipTrigger
@@ -319,7 +335,7 @@ function HeroCard({
<span className="text-sm text-muted-foreground">—</span>
)}
</Fact>
- <Fact label="Runtime">
+ <Fact label={t(($) => $.detail.fact_runtime)}>
<span className="block truncate text-sm">
{device?.runtime ?? (
<span className="capitalize">{runtime.provider}</span>
@@ -336,7 +352,7 @@ function HeroCard({
<button
type="button"
onClick={() => setShowDetails((v) => !v)}
- className="flex w-full items-center gap-1 px-4 py-2 text-xs text-muted-foreground transition-colors hover:text-foreground"
+ className="flex w-full items-center gap-1 px-4 py-2 text-xs text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring"
>
<ChevronRight
className={`h-3 w-3 transition-transform ${
@@ -348,12 +364,12 @@ function HeroCard({
{showDetails && (
<dl className="grid grid-cols-1 gap-y-2 border-t bg-muted/30 px-4 py-3 sm:grid-cols-2">
{cliVersion && (
- <Fact label="Daemon CLI" mono compact>
+ <Fact label={t(($) => $.detail.fact_daemon_cli)} mono compact>
{cliVersion}
</Fact>
)}
{daemonShort && (
- <Fact label="Daemon ID" mono compact>
+ <Fact label={t(($) => $.detail.fact_daemon_id)} mono compact>
{daemonShort}
</Fact>
)}
diff --git a/packages/views/runtimes/components/runtime-docs.test.ts b/packages/views/runtimes/components/runtime-docs.test.ts
new file mode 100644
index 0000000000..b1dfe26379
--- /dev/null
+++ b/packages/views/runtimes/components/runtime-docs.test.ts
@@ -0,0 +1,22 @@
+import { describe, expect, it } from "vitest";
+import {
+ customRuntimeDocsHref,
+ daemonRuntimesDocsHref,
+} from "./runtime-docs";
+
+describe("runtime docs links", () => {
+ it.each([
+ ["en", "https://multica.ai/docs/daemon-runtimes"],
+ ["zh-Hans", "https://multica.ai/docs/zh/daemon-runtimes"],
+ ["ja", "https://multica.ai/docs/ja/daemon-runtimes"],
+ ["ko", "https://multica.ai/docs/ko/daemon-runtimes"],
+ ])("localizes the daemon guide for %s", (language, expected) => {
+ expect(daemonRuntimesDocsHref(language)).toBe(expected);
+ });
+
+ it("adds the localized custom runtime section", () => {
+ expect(customRuntimeDocsHref("zh-Hans")).toBe(
+ `https://multica.ai/docs/zh/daemon-runtimes#${encodeURIComponent("自定义运行时配置")}`,
+ );
+ });
+});
diff --git a/packages/views/runtimes/components/runtime-docs.ts b/packages/views/runtimes/components/runtime-docs.ts
new file mode 100644
index 0000000000..9efc37de52
--- /dev/null
+++ b/packages/views/runtimes/components/runtime-docs.ts
@@ -0,0 +1,24 @@
+function docsLocaleSegment(language?: string): string {
+ if (language?.startsWith("zh")) return "/zh";
+ if (language?.startsWith("ja")) return "/ja";
+ if (language?.startsWith("ko")) return "/ko";
+ return "";
+}
+
+export function daemonRuntimesDocsHref(language?: string): string {
+ return `https://multica.ai/docs${docsLocaleSegment(language)}/daemon-runtimes`;
+}
+
+export function customRuntimeDocsHref(language?: string): string {
+ const base = daemonRuntimesDocsHref(language);
+ if (language?.startsWith("zh")) {
+ return `${base}#${encodeURIComponent("自定义运行时配置")}`;
+ }
+ if (language?.startsWith("ja")) {
+ return `${base}#${encodeURIComponent("カスタムランタイムプロファイル")}`;
+ }
+ if (language?.startsWith("ko")) {
+ return `${base}#${encodeURIComponent("사용자-지정-런타임-프로필")}`;
+ }
+ return `${base}#custom-runtime-profiles`;
+}
diff --git a/packages/views/runtimes/components/runtime-list.tsx b/packages/views/runtimes/components/runtime-list.tsx
index ee0dd638d0..851edb0f3b 100644
--- a/packages/views/runtimes/components/runtime-list.tsx
+++ b/packages/views/runtimes/components/runtime-list.tsx
@@ -6,6 +6,7 @@ import {
Globe,
Loader2,
MoreHorizontal,
+ Pencil,
Trash2,
} from "lucide-react";
import { toast } from "sonner";
@@ -55,19 +56,20 @@ import { ProviderLogo } from "./provider-logo";
import { HealthIcon, useHealthLabel } from "./shared";
import { DeleteRuntimeDialog } from "./delete-runtime-dialog";
import { DeleteRuntimeProfileDialog } from "./delete-runtime-profile-dialog";
+import { RuntimeProfilesDialog } from "./runtime-profiles-dialog";
import {
computeCostInWindow,
- formatLastSeen,
pctChange,
} from "../utils";
import { splitRuntimeName } from "./runtime-machines";
import {
customRuntimeRegistrationFailure,
+ isDisabledCustomRuntime,
isPendingCustomRuntime,
isPendingCustomRuntimeWarning,
pendingRuntimeCommandName,
} from "./pending-runtime";
-import { useT } from "../../i18n";
+import { useT, useTimeAgo } from "../../i18n";
// The machine detail's runtimes table on the shared ListGrid. Paradigm
// pieces are taken À LA CARTE here: subgrid template + var-width tracks +
@@ -226,6 +228,13 @@ function RuntimeKindBadge({ runtime }: { runtime: AgentRuntime }) {
function PendingRuntimeBadge({ runtime }: { runtime: AgentRuntime }) {
const { t } = useT("runtimes");
if (!isPendingCustomRuntime(runtime)) return null;
+ if (isDisabledCustomRuntime(runtime)) {
+ return (
+ <span className="inline-flex shrink-0 items-center rounded bg-muted px-1 text-[10px] font-medium text-muted-foreground">
+ {t(($) => $.list.badge_disabled)}
+ </span>
+ );
+ }
return (
<span className="inline-flex shrink-0 items-center rounded bg-warning/10 px-1 text-[10px] font-medium text-warning">
{t(($) => $.list.badge_registering)}
@@ -274,6 +283,16 @@ function HealthCell({
const { t } = useT("runtimes");
const { t: tAgents } = useT("agents");
const labelOf = useHealthLabel();
+ const timeAgo = useTimeAgo();
+ if (isDisabledCustomRuntime(runtime)) {
+ return (
+ <ListGridCell>
+ <span className="text-xs text-muted-foreground">
+ {t(($) => $.list.pending_health_disabled)}
+ </span>
+ </ListGridCell>
+ );
+ }
const registrationFailure = customRuntimeRegistrationFailure(runtime);
if (registrationFailure) {
return (
@@ -308,7 +327,7 @@ function HealthCell({
const health = deriveRuntimeHealth(runtime, now);
const offline = health === "offline" || health === "about_to_gc";
- const lastSeen = formatLastSeen(runtime.last_seen_at);
+ const lastSeen = runtime.last_seen_at ? timeAgo(runtime.last_seen_at) : null;
const active = workload.runningCount + workload.queuedCount;
return (
@@ -316,7 +335,7 @@ function HealthCell({
<HealthIcon health={health} />
<span className="block min-w-0 truncate text-xs">
{labelOf(health)}
- {health !== "online" && runtime.last_seen_at && (
+ {health !== "online" && lastSeen && (
<span className="text-muted-foreground"> · {lastSeen}</span>
)}
{!offline && active > 0 && (
@@ -502,6 +521,7 @@ export function RuntimeRowMenu({
}) {
const { t } = useT("runtimes");
const [deleteOpen, setDeleteOpen] = useState(false);
+ const [editOpen, setEditOpen] = useState(false);
const isCustomRuntime = !!runtime.profile_id;
// Delete is currently the only row action; if the row can't run it, drop
// the kebab entirely so the column doesn't render an empty popover. We
@@ -523,23 +543,39 @@ export function RuntimeRowMenu({
<button
type="button"
aria-label={t(($) => $.list.row_actions_aria)}
- className="flex size-7 items-center justify-center rounded-md text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-accent-foreground group-hover/row:opacity-100 data-popup-open:bg-accent data-popup-open:opacity-100 data-popup-open:text-accent-foreground"
+ className="flex size-7 items-center justify-center rounded-md text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-accent-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover/row:opacity-100 data-popup-open:bg-accent data-popup-open:opacity-100 data-popup-open:text-accent-foreground"
>
<MoreHorizontal className="size-4" />
</button>
}
/>
<DropdownMenuContent align="end" className="w-40">
+ {isCustomRuntime && profile && (
+ <DropdownMenuItem onClick={() => setEditOpen(true)}>
+ <Pencil aria-hidden="true" className="h-3.5 w-3.5" />
+ {t(($) => $.list.edit_action)}
+ </DropdownMenuItem>
+ )}
<DropdownMenuItem
variant="destructive"
onClick={() => setDeleteOpen(true)}
title={t(($) => $.list.delete_permission_hint)}
>
- <Trash2 className="h-3.5 w-3.5" />
- {t(($) => $.list.delete_action)}
+ <Trash2 aria-hidden="true" className="h-3.5 w-3.5" />
+ {isCustomRuntime
+ ? t(($) => $.list.delete_profile_action)
+ : t(($) => $.list.delete_action)}
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
+ {isCustomRuntime && profile && editOpen && (
+ <RuntimeProfilesDialog
+ wsId={wsId}
+ intent="edit"
+ initialProfile={profile}
+ onClose={() => setEditOpen(false)}
+ />
+ )}
{isCustomRuntime && profile ? (
<DeleteRuntimeProfileDialog
open={deleteOpen}
@@ -572,6 +608,7 @@ export function RuntimeList({
runtimes,
updatableIds,
now,
+ runtimeHref,
}: {
runtimes: AgentRuntime[];
// Kept on the API surface for callers, but unused here: the CLI column
@@ -581,6 +618,8 @@ export function RuntimeList({
// on the page-level wrapper that still computes the set.
updatableIds?: Set<string>;
now: number;
+ /** Machine-detail pages keep runtime settings nested under the machine. */
+ runtimeHref?: (runtimeId: string) => string;
}) {
void updatableIds;
@@ -643,11 +682,10 @@ export function RuntimeList({
? memberById.get(runtime.owner_id) ?? null
: null,
workload: workloadIndex.get(runtime.id) ?? EMPTY_WORKLOAD,
- canDelete:
- !isPendingCustomRuntime(runtime) &&
- (isCustomRuntime
- ? isAdmin && !!profile
- : isAdmin || (!!user && runtime.owner_id === user.id)),
+ canDelete: isCustomRuntime
+ ? isAdmin && !!profile
+ : !isPendingCustomRuntime(runtime) &&
+ (isAdmin || (!!user && runtime.owner_id === user.id)),
};
});
}, [runtimes, profileById, memberById, workloadIndex, isAdmin, user]);
@@ -692,7 +730,10 @@ export function RuntimeList({
key={row.runtime.id}
className={pending ? "cursor-default" : "cursor-pointer"}
{...(!pending
- ? rowLink(wsPaths.runtimeDetail(row.runtime.id))
+ ? rowLink(
+ runtimeHref?.(row.runtime.id) ??
+ wsPaths.runtimeDetail(row.runtime.id),
+ )
: {})}
>
<RuntimeNameCell runtime={row.runtime} />
diff --git a/packages/views/runtimes/components/runtime-profiles-dialog.test.tsx b/packages/views/runtimes/components/runtime-profiles-dialog.test.tsx
index 743900f7a1..5c16606bd4 100644
--- a/packages/views/runtimes/components/runtime-profiles-dialog.test.tsx
+++ b/packages/views/runtimes/components/runtime-profiles-dialog.test.tsx
@@ -78,12 +78,32 @@ function profile(overrides: Partial<RuntimeProfile> = {}): RuntimeProfile {
};
}
-function renderDialog() {
- return render(
+function renderDialog({
+ intent,
+ machineName,
+ initialProfile,
+ onClose = vi.fn(),
+ onProfileCreated,
+}: {
+ intent?: "create" | "edit" | "manage";
+ machineName?: string;
+ initialProfile?: RuntimeProfile;
+ onClose?: () => void;
+ onProfileCreated?: (profile: RuntimeProfile) => void;
+} = {}) {
+ const view = render(
<I18nProvider locale="en" resources={TEST_RESOURCES}>
- <RuntimeProfilesDialog wsId="ws-1" onClose={vi.fn()} />
+ <RuntimeProfilesDialog
+ wsId="ws-1"
+ intent={intent}
+ machineName={machineName}
+ initialProfile={initialProfile}
+ onClose={onClose}
+ onProfileCreated={onProfileCreated}
+ />
</I18nProvider>,
);
+ return { ...view, onClose };
}
describe("RuntimeProfilesDialog", () => {
@@ -117,7 +137,7 @@ describe("RuntimeProfilesDialog", () => {
expect(screen.queryByText("claude")).not.toBeInTheDocument();
expect(
screen.getAllByRole("button", { name: "New custom runtime" }),
- ).toHaveLength(2);
+ ).toHaveLength(1);
});
it("renders custom profiles before the collapsed built-in reference section", () => {
@@ -176,7 +196,7 @@ describe("RuntimeProfilesDialog", () => {
});
expect(newRuntimeButtons[0]).toBeDefined();
fireEvent.click(newRuntimeButtons[0]!);
- fireEvent.click(screen.getByRole("radio", { name: /codex/i }));
+ fireEvent.click(screen.getByRole("button", { name: /codex/i }));
fireEvent.change(screen.getByLabelText("Display name"), {
target: { value: "Composer Agent" },
});
@@ -200,4 +220,62 @@ describe("RuntimeProfilesDialog", () => {
}),
);
});
+
+ it("opens the focused create flow from a machine and closes after creation", async () => {
+ const onClose = vi.fn();
+ const onProfileCreated = vi.fn();
+ renderDialog({
+ intent: "create",
+ machineName: "Studio Mac",
+ onClose,
+ onProfileCreated,
+ });
+
+ expect(
+ screen.getByRole("heading", { name: "New custom runtime" }),
+ ).toBeInTheDocument();
+ expect(screen.getByText(/from Studio Mac/)).toBeInTheDocument();
+ expect(screen.getByRole("link", { name: "View setup guide" })).toHaveAttribute(
+ "href",
+ "https://multica.ai/docs/daemon-runtimes#custom-runtime-profiles",
+ );
+ expect(screen.getByText("Step 1 of 2")).toBeInTheDocument();
+ expect(
+ screen.queryByText("Create your first custom runtime"),
+ ).not.toBeInTheDocument();
+ expect(screen.queryByRole("button", { name: "Back" })).not.toBeInTheDocument();
+
+ fireEvent.click(screen.getByRole("button", { name: /codex/i }));
+ expect(screen.getByText("Step 2 of 2")).toBeInTheDocument();
+ fireEvent.change(screen.getByLabelText("Display name"), {
+ target: { value: "Composer Agent" },
+ });
+ fireEvent.change(screen.getByLabelText("Command"), {
+ target: { value: "agent --model composer-2.5" },
+ });
+ fireEvent.click(screen.getByRole("button", { name: "Create runtime" }));
+
+ await waitFor(() => {
+ expect(onProfileCreated).toHaveBeenCalledWith(
+ expect.objectContaining({ id: "prof-1" }),
+ );
+ expect(onClose).toHaveBeenCalledTimes(1);
+ });
+ });
+
+ it("opens a custom runtime directly in edit mode", () => {
+ renderDialog({
+ intent: "edit",
+ initialProfile: profile(),
+ });
+
+ expect(
+ screen.getByRole("heading", { name: "Edit custom runtime" }),
+ ).toBeInTheDocument();
+ expect(screen.getByLabelText("Display name")).toHaveValue("Team Codex");
+ expect(screen.getByLabelText("Command")).toHaveValue("codex");
+ expect(
+ screen.queryByText("Create your first custom runtime"),
+ ).not.toBeInTheDocument();
+ });
});
diff --git a/packages/views/runtimes/components/runtime-profiles-dialog.tsx b/packages/views/runtimes/components/runtime-profiles-dialog.tsx
index 630641844f..28ae65f376 100644
--- a/packages/views/runtimes/components/runtime-profiles-dialog.tsx
+++ b/packages/views/runtimes/components/runtime-profiles-dialog.tsx
@@ -5,6 +5,7 @@ import type { FormEvent } from "react";
import {
ChevronDown,
ChevronLeft,
+ ExternalLink,
Loader2,
Pencil,
Plus,
@@ -51,6 +52,7 @@ import {
type RuntimeCatalogSections,
} from "./runtime-profile-catalog";
import { useT } from "../../i18n";
+import { customRuntimeDocsHref } from "./runtime-docs";
// The dialog runs in two surfaces that swap inside one Popup:
// - "browse": custom-first master list + adaptive detail
@@ -62,19 +64,33 @@ type DialogState =
export function RuntimeProfilesDialog({
wsId,
+ intent = "manage",
+ machineName,
+ initialProfile,
onProfileCreated,
onClose,
}: {
wsId: string;
+ intent?: "create" | "edit" | "manage";
+ machineName?: string;
+ initialProfile?: RuntimeProfile;
onProfileCreated?: (profile: RuntimeProfile) => void;
onClose: () => void;
}) {
- const { t } = useT("runtimes");
+ const { t, i18n } = useT("runtimes");
const { data: profiles = [], isLoading } = useQuery(
runtimeProfileListOptions(wsId),
);
- const [state, setState] = useState<DialogState>({ surface: "browse" });
+ const [state, setState] = useState<DialogState>(() => {
+ if (intent === "create") {
+ return { surface: "form", mode: "create", step: "family" };
+ }
+ if (intent === "edit" && initialProfile) {
+ return { surface: "form", mode: "edit", profile: initialProfile };
+ }
+ return { surface: "browse" };
+ });
const [selectedId, setSelectedId] = useState<string | null>(null);
// Carries the chosen family from create-step-1 into the form.
const [draftFamily, setDraftFamily] =
@@ -89,28 +105,41 @@ export function RuntimeProfilesDialog({
entries.find((entry) => entry.id === selectedId) ?? null;
const openCreateForm = () =>
setState({ surface: "form", mode: "create", step: "family" });
+ const docsHref = customRuntimeDocsHref(i18n.language);
return (
<Dialog open onOpenChange={(open) => !open && onClose()}>
<DialogContent
- className="flex max-h-[88vh] flex-col gap-0 p-0 sm:max-w-3xl"
+ className={cn(
+ "flex max-h-[88vh] flex-col gap-0 overscroll-contain p-0",
+ intent === "manage" ? "sm:max-w-3xl" : "sm:max-w-2xl",
+ )}
showCloseButton={false}
>
<DialogHeader className="border-b px-6 py-5">
<div className="flex items-start justify-between gap-3">
<DialogTitle className="flex min-w-0 items-center gap-2 text-base">
- <Server className="h-4 w-4 shrink-0 text-muted-foreground" />
- <span className="truncate">{t(($) => $.profiles.dialog_title)}</span>
+ <Server
+ aria-hidden="true"
+ className="h-4 w-4 shrink-0 text-muted-foreground"
+ />
+ <span className="truncate">
+ {intent === "create"
+ ? t(($) => $.profiles.form.create_title)
+ : intent === "edit"
+ ? t(($) => $.profiles.form.edit_title)
+ : t(($) => $.profiles.dialog_title)}
+ </span>
</DialogTitle>
<div className="flex shrink-0 items-center gap-2">
- {state.surface === "browse" && (
+ {state.surface === "browse" && catalog.customs.length > 0 && (
<Button
type="button"
size="sm"
className="h-8 px-2.5"
onClick={openCreateForm}
>
- <Plus className="h-3.5 w-3.5" />
+ <Plus aria-hidden="true" className="h-3.5 w-3.5" />
{t(($) => $.profiles.add_new)}
</Button>
)}
@@ -125,13 +154,28 @@ export function RuntimeProfilesDialog({
/>
}
>
- <X className="h-4 w-4" />
+ <X aria-hidden="true" className="h-4 w-4" />
<span className="sr-only">{t(($) => $.profiles.close)}</span>
</DialogClose>
</div>
</div>
<DialogDescription className="text-xs">
- {t(($) => $.profiles.dialog_description)}
+ <span className="block">
+ {intent === "create"
+ ? t(($) => $.profiles.create_dialog_description, {
+ machine: machineName ?? t(($) => $.profiles.this_machine),
+ })
+ : t(($) => $.profiles.dialog_description)}
+ </span>{" "}
+ <a
+ href={docsHref}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="mt-1 inline-flex items-center gap-1 rounded-sm font-medium text-foreground underline underline-offset-2 transition-colors hover:text-foreground/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ >
+ {t(($) => $.profiles.learn_more)}
+ <ExternalLink aria-hidden="true" className="h-3 w-3" />
+ </a>
</DialogDescription>
</DialogHeader>
@@ -144,6 +188,8 @@ export function RuntimeProfilesDialog({
state.mode === "edit" ? state.profile.protocol_family : draftFamily
}
profile={state.mode === "edit" ? state.profile : null}
+ standaloneCreate={intent === "create"}
+ standaloneEdit={intent === "edit"}
onPickFamily={(family) => {
setDraftFamily(family);
setState({ surface: "form", mode: "create", step: "details" });
@@ -155,11 +201,21 @@ export function RuntimeProfilesDialog({
setState({ surface: "browse" });
}
}}
- onCancel={() => setState({ surface: "browse" })}
+ onCancel={() => {
+ if (intent !== "manage") {
+ onClose();
+ } else {
+ setState({ surface: "browse" });
+ }
+ }}
onSaved={(profile) => {
if (state.surface === "form" && state.mode === "create") {
onProfileCreated?.(profile);
}
+ if (intent !== "manage") {
+ onClose();
+ return;
+ }
setSelectedId(profile.id);
setState({ surface: "browse" });
}}
@@ -324,7 +380,7 @@ function EmptyCustomState({ onAddNew }: { onAddNew: () => void }) {
<div className="rounded-md border bg-muted/20 p-4">
<div className="flex items-start gap-3">
<span className="flex h-9 w-9 shrink-0 items-center justify-center rounded-md border bg-background">
- <Server className="h-4 w-4 text-muted-foreground" />
+ <Server aria-hidden="true" className="h-4 w-4 text-muted-foreground" />
</span>
<div className="min-w-0 flex-1">
<h5 className="text-sm font-medium">{t(($) => $.profiles.empty_title)}</h5>
@@ -337,7 +393,7 @@ function EmptyCustomState({ onAddNew }: { onAddNew: () => void }) {
className="mt-3 h-8 px-2.5"
onClick={onAddNew}
>
- <Plus className="h-3.5 w-3.5" />
+ <Plus aria-hidden="true" className="h-3.5 w-3.5" />
{t(($) => $.profiles.add_new)}
</Button>
</div>
@@ -582,6 +638,8 @@ function ProfileFormView({
step,
family,
profile,
+ standaloneCreate,
+ standaloneEdit,
onPickFamily,
onBack,
onCancel,
@@ -592,6 +650,8 @@ function ProfileFormView({
step: "family" | "details";
family: RuntimeProtocolFamily;
profile: RuntimeProfile | null;
+ standaloneCreate: boolean;
+ standaloneEdit: boolean;
onPickFamily: (family: RuntimeProtocolFamily) => void;
onBack: () => void;
onCancel: () => void;
@@ -603,6 +663,9 @@ function ProfileFormView({
return (
<div className="flex min-h-0 flex-1 flex-col">
<div className="min-h-0 flex-1 overflow-y-auto px-6 py-5">
+ <p className="text-[11px] font-medium uppercase tracking-wide text-muted-foreground">
+ {t(($) => $.profiles.form.step_progress, { current: 1, total: 2 })}
+ </p>
<h3 className="text-sm font-medium">
{t(($) => $.profiles.form.step_family_label)}
</h3>
@@ -611,15 +674,12 @@ function ProfileFormView({
</p>
<div
className="mt-4 grid grid-cols-2 gap-2 sm:grid-cols-3"
- role="radiogroup"
aria-label={t(($) => $.profiles.form.family_label)}
>
{PROTOCOL_FAMILIES.map((option) => (
<button
key={option}
type="button"
- role="radio"
- aria-checked={option === family}
onClick={() => onPickFamily(option)}
className="flex items-center gap-2 rounded-md border bg-background px-3 py-2.5 text-left text-sm transition-colors hover:bg-accent/50 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none"
>
@@ -629,14 +689,22 @@ function ProfileFormView({
))}
</div>
</div>
- <div className="flex shrink-0 justify-between gap-2 border-t bg-muted/30 px-6 py-3">
- <Button type="button" variant="ghost" size="sm" onClick={onBack}>
- <ChevronLeft className="h-3.5 w-3.5" />
- {t(($) => $.profiles.form.back)}
- </Button>
- <Button type="button" variant="outline" size="sm" onClick={onCancel}>
- {t(($) => $.profiles.form.cancel)}
- </Button>
+ <div
+ className={cn(
+ "flex shrink-0 gap-2 border-t bg-muted/30 px-6 py-3",
+ standaloneCreate ? "justify-end" : "justify-start",
+ )}
+ >
+ {standaloneCreate ? (
+ <Button type="button" variant="outline" size="sm" onClick={onCancel}>
+ {t(($) => $.profiles.form.cancel)}
+ </Button>
+ ) : (
+ <Button type="button" variant="ghost" size="sm" onClick={onBack}>
+ <ChevronLeft aria-hidden="true" className="h-3.5 w-3.5" />
+ {t(($) => $.profiles.form.back)}
+ </Button>
+ )}
</div>
</div>
);
@@ -648,6 +716,7 @@ function ProfileFormView({
mode={mode}
family={family}
profile={profile}
+ hideEditHeading={standaloneEdit}
onBack={onBack}
onCancel={onCancel}
onSaved={onSaved}
@@ -660,6 +729,7 @@ function ProfileDetailsForm({
mode,
family,
profile,
+ hideEditHeading,
onBack,
onCancel,
onSaved,
@@ -668,6 +738,7 @@ function ProfileDetailsForm({
mode: "create" | "edit";
family: RuntimeProtocolFamily;
profile: RuntimeProfile | null;
+ hideEditHeading: boolean;
onBack: () => void;
onCancel: () => void;
onSaved: (profile: RuntimeProfile) => void;
@@ -780,11 +851,18 @@ function ProfileDetailsForm({
onSubmit={handleSubmit}
className="min-h-0 flex-1 space-y-4 overflow-y-auto px-6 py-5"
>
- <h3 className="text-sm font-medium">
- {mode === "create"
- ? t(($) => $.profiles.form.step_details_label)
- : t(($) => $.profiles.form.edit_title)}
- </h3>
+ {mode === "create" && (
+ <p className="text-[11px] font-medium uppercase tracking-wide text-muted-foreground">
+ {t(($) => $.profiles.form.step_progress, { current: 2, total: 2 })}
+ </p>
+ )}
+ {(mode === "create" || !hideEditHeading) && (
+ <h3 className="text-sm font-medium">
+ {mode === "create"
+ ? t(($) => $.profiles.form.step_details_label)
+ : t(($) => $.profiles.form.edit_title)}
+ </h3>
+ )}
<div className="space-y-1.5">
<Label className="text-xs text-muted-foreground">
@@ -808,6 +886,8 @@ function ProfileDetailsForm({
</Label>
<Input
id={`${idPrefix}-display-name`}
+ name="displayName"
+ autoComplete="off"
value={values.displayName}
onChange={(e) => setField("displayName", e.target.value)}
placeholder={t(($) => $.profiles.form.display_name_placeholder)}
@@ -846,6 +926,9 @@ function ProfileDetailsForm({
</Label>
<Input
id={`${idPrefix}-command`}
+ name="command"
+ autoComplete="off"
+ spellCheck={false}
value={values.commandLine}
onChange={(e) => setField("commandLine", e.target.value)}
placeholder={t(($) => $.profiles.form.command_name_placeholder)}
@@ -894,6 +977,8 @@ function ProfileDetailsForm({
</Label>
<Textarea
id={`${idPrefix}-description`}
+ name="description"
+ autoComplete="off"
value={values.description}
onChange={(e) => setField("description", e.target.value)}
placeholder={t(($) => $.profiles.form.description_placeholder)}
@@ -916,16 +1001,22 @@ function ProfileDetailsForm({
</form>
<div className="flex shrink-0 justify-between gap-2 border-t bg-muted/30 px-6 py-3">
- <Button type="button" variant="ghost" size="sm" onClick={onBack}>
- <ChevronLeft className="h-3.5 w-3.5" />
- {t(($) => $.profiles.form.back)}
- </Button>
+ {mode === "create" ? (
+ <Button type="button" variant="ghost" size="sm" onClick={onBack}>
+ <ChevronLeft aria-hidden="true" className="h-3.5 w-3.5" />
+ {t(($) => $.profiles.form.back)}
+ </Button>
+ ) : (
+ <span />
+ )}
<div className="flex gap-2">
<Button type="button" variant="outline" size="sm" onClick={onCancel}>
{t(($) => $.profiles.form.cancel)}
</Button>
<Button type="submit" size="sm" form={formId} disabled={submitting}>
- {submitting && <Loader2 className="h-3.5 w-3.5 animate-spin" />}
+ {submitting && (
+ <Loader2 aria-hidden="true" className="h-3.5 w-3.5 animate-spin" />
+ )}
{mode === "create"
? submitting
? t(($) => $.profiles.form.creating)
diff --git a/packages/views/runtimes/components/runtime-row-menu.test.tsx b/packages/views/runtimes/components/runtime-row-menu.test.tsx
index 1443458a55..0ad252ba2b 100644
--- a/packages/views/runtimes/components/runtime-row-menu.test.tsx
+++ b/packages/views/runtimes/components/runtime-row-menu.test.tsx
@@ -2,7 +2,7 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
-import { render, screen } from "@testing-library/react";
+import { fireEvent, render, screen } from "@testing-library/react";
import type { AgentRuntime, RuntimeProfile } from "@multica/core/types";
import { I18nProvider } from "@multica/core/i18n/react";
import enCommon from "../../locales/en/common.json";
@@ -46,6 +46,14 @@ vi.mock("@multica/core/runtimes", () => ({
isPending: false,
mutateAsync: vi.fn(),
}),
+ useCreateRuntimeProfile: () => ({
+ isPending: false,
+ mutateAsync: vi.fn(),
+ }),
+ useUpdateRuntimeProfile: () => ({
+ isPending: false,
+ mutateAsync: vi.fn(),
+ }),
}));
vi.mock("@multica/core/agents", () => ({
@@ -196,6 +204,25 @@ describe("runtime list row menu", () => {
expect(screen.getByLabelText("Row actions")).toBeInTheDocument();
});
+ it("opens custom runtime editing from the unified row menu", () => {
+ const profile = makeProfile();
+ renderActionsCell(
+ makeRow(
+ makeRuntime({ runtime_mode: "local", profile_id: profile.id }),
+ true,
+ profile,
+ ),
+ );
+
+ fireEvent.click(screen.getByLabelText("Row actions"));
+ fireEvent.click(screen.getByText("Edit custom runtime"));
+
+ expect(
+ screen.getByRole("heading", { name: "Edit custom runtime" }),
+ ).toBeInTheDocument();
+ expect(screen.getByLabelText("Display name")).toHaveValue("Custom Codex");
+ });
+
it("hides the kebab menu when the caller lacks delete permission", () => {
// Pre-existing behavior — re-asserted so the new self-healing guard
// doesn't accidentally regress it (both paths return the same empty
diff --git a/packages/views/runtimes/components/runtime-settings-page.test.ts b/packages/views/runtimes/components/runtime-settings-page.test.ts
new file mode 100644
index 0000000000..4178865485
--- /dev/null
+++ b/packages/views/runtimes/components/runtime-settings-page.test.ts
@@ -0,0 +1,55 @@
+import { describe, expect, it } from "vitest";
+import type { AgentRuntime } from "@multica/core/types";
+import { resolveRuntimeSettingsTarget } from "./runtime-settings-page";
+
+function runtime(
+ id: string,
+ daemonId: string,
+ provider: string,
+): AgentRuntime {
+ return {
+ id,
+ workspace_id: "ws-1",
+ daemon_id: daemonId,
+ name: `${provider} (${daemonId})`,
+ runtime_mode: "local",
+ provider,
+ launch_header: provider,
+ status: "online",
+ device_info: daemonId,
+ metadata: {},
+ owner_id: "user-1",
+ visibility: "private",
+ profile_id: null,
+ last_seen_at: "2026-01-01T00:00:00Z",
+ created_at: "2026-01-01T00:00:00Z",
+ updated_at: "2026-01-01T00:00:00Z",
+ };
+}
+
+describe("resolveRuntimeSettingsTarget", () => {
+ const machineARuntime = runtime("runtime-a", "daemon-a", "codex");
+ const machineBRuntime = runtime("runtime-b", "daemon-b", "claude");
+ const runtimes = [machineARuntime, machineBRuntime];
+
+ it("resolves a runtime inside its owning machine", () => {
+ const target = resolveRuntimeSettingsTarget(
+ runtimes,
+ "local:daemon-a",
+ "runtime-a",
+ );
+
+ expect(target?.runtime.id).toBe("runtime-a");
+ expect(target?.machine.id).toBe("local:daemon-a");
+ });
+
+ it("rejects a runtime that belongs to a different machine", () => {
+ expect(
+ resolveRuntimeSettingsTarget(
+ runtimes,
+ "local:daemon-a",
+ "runtime-b",
+ ),
+ ).toBeNull();
+ });
+});
diff --git a/packages/views/runtimes/components/runtime-settings-page.tsx b/packages/views/runtimes/components/runtime-settings-page.tsx
new file mode 100644
index 0000000000..d3903c823b
--- /dev/null
+++ b/packages/views/runtimes/components/runtime-settings-page.tsx
@@ -0,0 +1,97 @@
+"use client";
+
+import { Server } from "lucide-react";
+import { useQuery } from "@tanstack/react-query";
+import type { AgentRuntime } from "@multica/core/types";
+import { useWorkspaceId } from "@multica/core/hooks";
+import { useWorkspacePaths } from "@multica/core/paths";
+import { runtimeListOptions } from "@multica/core/runtimes/queries";
+import { Skeleton } from "@multica/ui/components/ui/skeleton";
+import { RuntimeDetail } from "./runtime-detail";
+import { buildRuntimeMachines } from "./runtime-machines";
+import { useT } from "../../i18n";
+
+export function RuntimeSettingsPage({
+ machineId,
+ runtimeId,
+}: {
+ machineId: string;
+ runtimeId: string;
+}) {
+ const { t } = useT("runtimes");
+ const wsId = useWorkspaceId();
+ const paths = useWorkspacePaths();
+ const { data: runtimes = [], isLoading } = useQuery(runtimeListOptions(wsId));
+ const decodedMachineId = decodeRouteParam(machineId);
+ const decodedRuntimeId = decodeRouteParam(runtimeId);
+
+ if (isLoading) {
+ return (
+ <div className="flex h-full flex-col p-6">
+ <Skeleton className="h-12 w-1/2" />
+ <div className="mt-6 grid grid-cols-3 gap-3">
+ <Skeleton className="h-20 rounded-lg" />
+ <Skeleton className="h-20 rounded-lg" />
+ <Skeleton className="h-20 rounded-lg" />
+ </div>
+ <Skeleton className="mt-4 h-48 w-full rounded-lg" />
+ </div>
+ );
+ }
+
+ const target = resolveRuntimeSettingsTarget(
+ runtimes,
+ decodedMachineId,
+ decodedRuntimeId,
+ );
+ if (!target) {
+ return (
+ <div className="flex h-full flex-col items-center justify-center text-muted-foreground">
+ <Server
+ aria-hidden="true"
+ className="h-10 w-10 text-muted-foreground/30"
+ />
+ <p className="mt-3 text-sm">{t(($) => $.detail_page.not_found_title)}</p>
+ <p className="mt-1 text-xs text-muted-foreground/70">
+ {t(($) => $.detail_page.not_found_hint)}
+ </p>
+ </div>
+ );
+ }
+ const { machine, runtime } = target;
+
+ return (
+ <RuntimeDetail
+ runtime={runtime}
+ machineHref={paths.runtimeDetail(decodedMachineId)}
+ machineLabel={machine.title}
+ afterDeleteHref={
+ machine.runtimes.length > 1
+ ? paths.runtimeDetail(decodedMachineId)
+ : paths.runtimes()
+ }
+ />
+ );
+}
+
+export function resolveRuntimeSettingsTarget(
+ runtimes: AgentRuntime[],
+ machineId: string,
+ runtimeId: string,
+) {
+ const machine = buildRuntimeMachines(runtimes, { now: Date.now() }).find(
+ (candidate) =>
+ candidate.id === machineId ||
+ candidate.runtimes.some((item) => item.id === machineId),
+ );
+ const runtime = machine?.runtimes.find((candidate) => candidate.id === runtimeId);
+ return machine && runtime ? { machine, runtime } : null;
+}
+
+function decodeRouteParam(value: string): string {
+ try {
+ return decodeURIComponent(value);
+ } catch {
+ return value;
+ }
+}
diff --git a/packages/views/runtimes/components/runtimes-page.tsx b/packages/views/runtimes/components/runtimes-page.tsx
index 4ba3a94dac..492277cecf 100644
--- a/packages/views/runtimes/components/runtimes-page.tsx
+++ b/packages/views/runtimes/components/runtimes-page.tsx
@@ -1,91 +1,56 @@
"use client";
-import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
-import { useDefaultLayout } from "react-resizable-panels";
+import { useCallback, useEffect, useMemo, useState } from "react";
import {
+ ChevronRight,
Cloud,
Monitor,
- Pencil,
Plus,
- Search,
Server,
} from "lucide-react";
import { useQuery, useQueryClient } from "@tanstack/react-query";
import { useAuthStore } from "@multica/core/auth";
import { useWorkspaceId } from "@multica/core/hooks";
+import { useWorkspacePaths } from "@multica/core/paths";
import { agentTaskSnapshotOptions } from "@multica/core/agents";
+import { runtimeProfileListOptions } from "@multica/core/runtimes";
import { runtimeListOptions, runtimeKeys } from "@multica/core/runtimes/queries";
-import { useUpdatableRuntimeIds } from "@multica/core/runtimes/hooks";
import { useWSEvent } from "@multica/core/realtime";
import { agentListOptions } from "@multica/core/workspace/queries";
-import { memberListOptions } from "@multica/core/workspace/queries";
import { Button } from "@multica/ui/components/ui/button";
-import { Input } from "@multica/ui/components/ui/input";
-import {
- ResizableHandle,
- ResizablePanel,
- ResizablePanelGroup,
-} from "@multica/ui/components/ui/resizable";
import { Skeleton } from "@multica/ui/components/ui/skeleton";
-import { useIsMobile } from "@multica/ui/hooks/use-mobile";
-import { cn } from "@multica/ui/lib/utils";
import {
CollectionPageHeader,
CollectionPageHeaderAction,
CollectionPageState,
} from "../../layout/collection-page";
import { PageHeader } from "../../layout/page-header";
+import { AppLink } from "../../navigation";
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 {
- pendingRuntimesForProfiles,
- type PendingRuntimeProfile,
-} from "./pending-runtime";
-import {
- buildRuntimeMachines,
- filterRuntimeMachines,
- runtimeMachineCounts,
- sharedCustomName,
- type RuntimeMachine,
- type RuntimeMachineFilter,
-} from "./runtime-machines";
+import { buildWorkloadIndex, RuntimeList } from "./runtime-list";
+import { pendingRuntimeFromProfile } from "./pending-runtime";
+import { buildRuntimeMachines, type RuntimeMachine } from "./runtime-machines";
import { HealthDot, HealthIcon, useHealthLabel } from "./shared";
-import { useT } from "../../i18n";
+import { useT, useTimeAgo } from "../../i18n";
+import { daemonRuntimesDocsHref } from "./runtime-docs";
-const MACHINE_FILTERS: RuntimeMachineFilter[] = ["all", "online", "issues"];
-
-interface RuntimesPageProps {
- /** Desktop-only daemon id used to mark the row for this Mac. */
+export interface RuntimesPageProps {
+ /** Desktop-only daemon id used to identify this device. */
localDaemonId?: string | null;
/** Desktop-only friendly device name for the local daemon. */
localMachineName?: string | null;
- /** Desktop-only controls shown when the local machine is selected. */
+ /** Desktop-only daemon controls attached to the local machine row. */
localMachineActions?: React.ReactNode;
- /**
- * Desktop-only signal: this host always owns a local machine, even
- * when no runtime is currently registered (daemon stopped, not yet
- * started, or runtime GC'd). When true, a placeholder local row is
- * synthesized so `localMachineActions` (the daemon Start button) is
- * always reachable. Web omits this.
- */
+ /** Keep the local device visible even before its first runtime registers. */
hasLocalMachine?: boolean;
- /**
- * Desktop-only signal: the bundled daemon is still booting / hasn't
- * registered with the server yet. Forwarded so the empty state can show
- * a "starting" indicator instead of the static "register a runtime" hint
- * during the boot window. Web omits this.
- */
+ /** The bundled daemon is starting but has not registered yet. */
bootstrapping?: boolean;
- /** Web SaaS-only Cloud Runtime entrypoint. Defaults off for self-hosted builds. */
+ /** Web SaaS-only Cloud Runtime entrypoint. */
cloudRuntimeEnabled?: boolean;
}
-// Re-render every 30s so derived health (recently_lost → offline transitions)
-// catches up even when no underlying query data has changed.
function useNowTick(intervalMs = 30_000): number {
const [now, setNow] = useState(() => Date.now());
useEffect(() => {
@@ -103,105 +68,35 @@ export function RuntimesPage({
bootstrapping,
cloudRuntimeEnabled = false,
}: RuntimesPageProps = {}) {
- const isLoading = useAuthStore((s) => s.isLoading);
- const { t } = useT("runtimes");
- const pendingMachineName = t(($) => $.machine.pending_custom_runtimes);
- const currentUserId = useAuthStore((s) => s.user?.id);
+ const isAuthLoading = useAuthStore((state) => state.isLoading);
+ const currentUserId = useAuthStore((state) => state.user?.id);
const wsId = useWorkspaceId();
const qc = useQueryClient();
- const [machineFilter, setMachineFilter] =
- useState<RuntimeMachineFilter>("all");
- const [machineSearch, setMachineSearch] = useState("");
- const [selectedMachineId, setSelectedMachineId] = useState<string | null>(
- null,
- );
- // Tracks whether the user has explicitly picked a machine. Until then,
- // auto-default keeps preferring the Local section (which on desktop may
- // appear later than remotes — `localDaemonId` is fetched async).
- const userSelectedRef = useRef(false);
- const handleSelectMachine = useCallback((id: string) => {
- userSelectedRef.current = true;
- setSelectedMachineId(id);
- }, []);
const [showConnectDialog, setShowConnectDialog] = useState(false);
const [showCloudRuntimeDialog, setShowCloudRuntimeDialog] = useState(false);
- const [pendingProfiles, setPendingProfiles] = useState<PendingRuntimeProfile[]>(
- [],
- );
- const { defaultLayout, onLayoutChanged } = useDefaultLayout({
- id: "multica_runtimes_layout",
- });
- const isMobile = useIsMobile();
- const { data: runtimes = [], isLoading: fetching } = useQuery(
+ const { data: runtimes = [], isLoading: runtimesLoading } = useQuery(
runtimeListOptions(wsId),
);
+ const { data: runtimeProfiles = [], isLoading: profilesLoading } = useQuery(
+ runtimeProfileListOptions(wsId),
+ );
const { data: agents = [] } = useQuery(agentListOptions(wsId));
const { data: snapshot = [] } = useQuery(agentTaskSnapshotOptions(wsId));
- const { data: members = [] } = useQuery(memberListOptions(wsId));
-
- // Custom runtime management is an admin-only affordance, gated the same
- // way the runtime list gates delete: workspace owner/admin role.
- const currentMember = currentUserId
- ? members.find((m) => m.user_id === currentUserId)
- : null;
- 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) });
}, [qc, wsId]);
useWSEvent("daemon:register", handleDaemonEvent);
- const updatableIds = useUpdatableRuntimeIds(wsId);
- const now = useNowTick();
-
- useEffect(() => {
- if (pendingProfiles.length === 0) return;
- const registeredProfileIds = new Set(
- runtimes
- .map((runtime) => runtime.profile_id)
- .filter((profileId): profileId is string => !!profileId),
- );
- if (registeredProfileIds.size === 0) return;
- setPendingProfiles((current) => {
- const next = current.filter(
- ({ profile }) => !registeredProfileIds.has(profile.id),
- );
- return next.length === current.length ? current : next;
- });
- }, [pendingProfiles.length, runtimes]);
-
- const visibleRuntimes = useMemo(
- () =>
- pendingRuntimesForProfiles({
- pendingProfiles,
- runtimes,
- ownerId: currentUserId,
- localDaemonId,
- localMachineName,
- fallbackMachineName: pendingMachineName,
- }),
- [
- pendingProfiles,
- runtimes,
- currentUserId,
- localDaemonId,
- localMachineName,
- pendingMachineName,
- ],
- );
-
const workloadIndex = useMemo(
() => buildWorkloadIndex(agents, snapshot),
[agents, snapshot],
);
-
+ const now = useNowTick();
const machines = useMemo(
() =>
- buildRuntimeMachines(visibleRuntimes, {
+ buildRuntimeMachines(runtimes, {
now,
localDaemonId,
localMachineName,
@@ -210,7 +105,7 @@ export function RuntimesPage({
ensureLocalMachine: hasLocalMachine,
}),
[
- visibleRuntimes,
+ runtimes,
now,
localDaemonId,
localMachineName,
@@ -219,144 +114,59 @@ export function RuntimesPage({
hasLocalMachine,
],
);
+ const orphanProfileRuntimes = useMemo(() => {
+ if (machines.some((machine) => machine.mode === "local")) return [];
+ return runtimeProfiles.map((profile) => {
+ const createdAt = Date.parse(profile.created_at);
+ return pendingRuntimeFromProfile({
+ profile,
+ createdAt: Number.isFinite(createdAt) ? createdAt : 0,
+ fallbackMachineName: "Unassigned",
+ });
+ });
+ }, [machines, runtimeProfiles]);
- const machineCounts = useMemo(() => runtimeMachineCounts(machines), [machines]);
-
- const filteredMachines = useMemo(
- () => filterRuntimeMachines(machines, machineSearch, machineFilter),
- [machines, machineSearch, machineFilter],
- );
-
- useEffect(() => {
- if (filteredMachines.length === 0) {
- if (selectedMachineId !== null) setSelectedMachineId(null);
- return;
- }
- const stillValid =
- !!selectedMachineId &&
- filteredMachines.some((m) => m.id === selectedMachineId);
- // Honor an explicit user pick. Otherwise re-evaluate the default so the
- // Local machine wins as soon as it shows up, even if a remote was the
- // first-paint default.
- if (userSelectedRef.current && stillValid) return;
- const local = filteredMachines.find((m) => m.section === "local");
- const nextId = local?.id ?? filteredMachines[0]?.id ?? null;
- if (nextId !== selectedMachineId) setSelectedMachineId(nextId);
- }, [filteredMachines, selectedMachineId]);
-
- const selectedMachine =
- machines.find((machine) => machine.id === selectedMachineId) ??
- 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 />;
+ if (isAuthLoading || runtimesLoading || profilesLoading) {
+ return <RuntimesPageSkeleton />;
+ }
- const totalCount = visibleRuntimes.length;
- // Desktop always has a synthesized local machine row, so the
- // "register a runtime" empty state would hide the Start button.
- const showEmpty = totalCount === 0 && !bootstrapping && !hasLocalMachine;
+ const showEmpty =
+ machines.length === 0 &&
+ orphanProfileRuntimes.length === 0 &&
+ !bootstrapping &&
+ hasLocalMachine !== true;
return (
- <div className="flex flex-1 min-h-0 flex-col">
+ <div className="flex min-h-0 flex-1 flex-col">
<PageHeaderBar
- totalCount={totalCount}
+ totalCount={machines.length}
onConnectRemote={() => setShowConnectDialog(true)}
cloudRuntimeEnabled={cloudRuntimeEnabled}
onOpenCloudRuntime={() => setShowCloudRuntimeDialog(true)}
- canManageProfiles={canManageProfiles}
- onAddRuntime={() => setShowProfilesDialog(true)}
/>
{showEmpty ? (
<div className="flex flex-1 items-center justify-center p-6">
<EmptyState onConnectRemote={() => setShowConnectDialog(true)} />
</div>
- ) : isMobile ? (
- <div className="flex min-h-0 flex-1 flex-col bg-background">
- <MachineSidebar
- machines={filteredMachines}
- totalMachines={machines.length}
- counts={machineCounts}
- selectedMachineId={selectedMachine?.id ?? null}
- search={machineSearch}
- setSearch={setMachineSearch}
- filter={machineFilter}
- setFilter={setMachineFilter}
- onSelect={handleSelectMachine}
- />
- <MachineDetail
- machine={selectedMachine}
- updatableIds={updatableIds}
- now={now}
- bootstrapping={bootstrapping}
- canRename={!!renameTarget}
- onRename={() => setRenameOpen(true)}
- actions={
- selectedMachine?.isCurrent ? localMachineActions : undefined
- }
- />
- </div>
) : (
- <div className="min-h-0 flex-1 bg-background">
- <ResizablePanelGroup
- orientation="horizontal"
- className="min-h-0 flex-1"
- defaultLayout={defaultLayout}
- onLayoutChanged={onLayoutChanged}
- >
- <ResizablePanel
- id="machines"
- defaultSize={300}
- minSize={240}
- maxSize={420}
- groupResizeBehavior="preserve-pixel-size"
- >
- <MachineSidebar
- machines={filteredMachines}
- totalMachines={machines.length}
- counts={machineCounts}
- selectedMachineId={selectedMachine?.id ?? null}
- search={machineSearch}
- setSearch={setMachineSearch}
- filter={machineFilter}
- setFilter={setMachineFilter}
- onSelect={handleSelectMachine}
- className="h-full border-b-0 border-r"
+ <div className="min-h-0 flex-1 overflow-y-auto">
+ <div className="mx-auto flex w-full max-w-[1440px] flex-col p-4 sm:p-6">
+ {(machines.length > 0 || bootstrapping) && (
+ <MachineList
+ machines={machines}
+ bootstrapping={bootstrapping}
+ localMachineActions={localMachineActions}
/>
- </ResizablePanel>
- <ResizableHandle />
- <ResizablePanel id="detail" minSize="45%">
- <MachineDetail
- machine={selectedMachine}
- updatableIds={updatableIds}
+ )}
+ {orphanProfileRuntimes.length > 0 && (
+ <OrphanRuntimeProfiles
+ runtimes={orphanProfileRuntimes}
now={now}
- bootstrapping={bootstrapping}
- canRename={!!renameTarget}
- onRename={() => setRenameOpen(true)}
- actions={
- selectedMachine?.isCurrent ? localMachineActions : undefined
- }
+ hasMachines={machines.length > 0}
/>
- </ResizablePanel>
- </ResizablePanelGroup>
+ )}
+ </div>
</div>
)}
@@ -366,66 +176,61 @@ export function RuntimesPage({
{cloudRuntimeEnabled && showCloudRuntimeDialog && (
<CloudRuntimeDialog onClose={() => setShowCloudRuntimeDialog(false)} />
)}
- {canManageProfiles && showProfilesDialog && (
- <RuntimeProfilesDialog
- wsId={wsId}
- onProfileCreated={(profile) =>
- setPendingProfiles((current) => [
- ...current.filter((item) => item.profile.id !== profile.id),
- { profile, createdAt: Date.now() },
- ])
- }
- onClose={() => setShowProfilesDialog(false)}
- />
- )}
- {renameTarget && (
- <RenameMachineDialog
- open={renameOpen}
- onOpenChange={setRenameOpen}
- wsId={wsId}
- runtimeId={renameTarget.runtimeId}
- currentName={renameTarget.currentName}
- />
- )}
</div>
);
}
-// ---------------------------------------------------------------------------
-// Header bar — minimal: only icon + title + count, matching Skills.
-// Page-level actions (Search, scope, filter) live in the card below.
-// ---------------------------------------------------------------------------
+function OrphanRuntimeProfiles({
+ runtimes,
+ now,
+ hasMachines,
+}: {
+ runtimes: ReturnType<typeof pendingRuntimeFromProfile>[];
+ now: number;
+ hasMachines: boolean;
+}) {
+ const { t } = useT("runtimes");
+ return (
+ <section className={hasMachines ? "mt-6" : undefined}>
+ <div className="mb-3">
+ <h2 className="text-sm font-semibold">
+ {t(($) => $.profiles.unassigned_title)}
+ </h2>
+ <p className="mt-1 text-xs text-muted-foreground">
+ {t(($) => $.profiles.unassigned_description)}
+ </p>
+ </div>
+ <div className="overflow-hidden rounded-lg border bg-card">
+ <RuntimeList runtimes={runtimes} now={now} />
+ </div>
+ </section>
+ );
+}
function PageHeaderBar({
totalCount,
onConnectRemote,
cloudRuntimeEnabled,
onOpenCloudRuntime,
- canManageProfiles,
- onAddRuntime,
}: {
totalCount: number;
onConnectRemote: () => void;
cloudRuntimeEnabled: boolean;
onOpenCloudRuntime: () => void;
- canManageProfiles: boolean;
- onAddRuntime: () => void;
}) {
- const { t } = useT("runtimes");
+ const { t, i18n } = useT("runtimes");
return (
<CollectionPageHeader
icon={Server}
title={t(($) => $.page.title)}
count={totalCount}
+ description={t(($) => $.page.tagline)}
+ learnMore={{
+ href: daemonRuntimesDocsHref(i18n.language),
+ label: t(($) => $.page.learn_more),
+ }}
actions={
<>
- {canManageProfiles && (
- <CollectionPageHeaderAction
- icon={Plus}
- label={t(($) => $.profiles.cta)}
- onClick={onAddRuntime}
- />
- )}
{cloudRuntimeEnabled && (
<CollectionPageHeaderAction
icon={Cloud}
@@ -444,227 +249,138 @@ function PageHeaderBar({
);
}
-function MachineSidebar({
+function MachineList({
machines,
- totalMachines,
- counts,
- selectedMachineId,
- search,
- setSearch,
- filter,
- setFilter,
- onSelect,
- className,
+ bootstrapping,
+ localMachineActions,
}: {
machines: RuntimeMachine[];
- totalMachines: number;
- counts: { all: number; online: number; issues: number };
- selectedMachineId: string | null;
- search: string;
- setSearch: (value: string) => void;
- filter: RuntimeMachineFilter;
- setFilter: (value: RuntimeMachineFilter) => void;
- onSelect: (id: string) => void;
- className?: string;
+ bootstrapping?: boolean;
+ localMachineActions?: React.ReactNode;
}) {
const { t } = useT("runtimes");
- const sections = [
- {
- key: "local" as const,
- label: t(($) => $.machine.section_local),
- machines: machines.filter((machine) => machine.section === "local"),
- },
- {
- key: "remote" as const,
- label: t(($) => $.machine.section_remote),
- machines: machines.filter((machine) => machine.section === "remote"),
- },
- {
- key: "cloud" as const,
- label: t(($) => $.machine.section_cloud),
- machines: machines.filter((machine) => machine.section === "cloud"),
- },
- ].filter((section) => section.machines.length > 0);
+ if (machines.length === 0) {
+ return (
+ <CollectionPageState
+ icon={Server}
+ title={
+ bootstrapping
+ ? t(($) => $.page.bootstrapping.title)
+ : t(($) => $.page.empty.title)
+ }
+ description={
+ bootstrapping
+ ? t(($) => $.page.bootstrapping.hint)
+ : t(($) => $.page.empty.hint)
+ }
+ />
+ );
+ }
return (
- <aside
- className={cn(
- "flex min-h-0 shrink-0 flex-col border-b bg-muted/20",
- className,
- )}
- >
- <div className="shrink-0 border-b bg-background p-3">
- <div className="relative">
- <Search className="pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" />
- <Input
- value={search}
- onChange={(event) => setSearch(event.target.value)}
- aria-label={t(($) => $.machine.search_placeholder)}
- placeholder={t(($) => $.machine.search_placeholder)}
- className="h-9 pl-8 text-sm"
+ <div className="overflow-hidden rounded-lg border bg-card">
+ <div className="divide-y">
+ {machines.map((machine) => (
+ <MachineRow
+ key={machine.id}
+ machine={machine}
+ actions={machine.isCurrent ? localMachineActions : undefined}
/>
- </div>
- <div className="mt-2 flex items-center gap-1.5 overflow-x-auto">
- {MACHINE_FILTERS.map((key) => (
- <MachineFilterChip
- key={key}
- active={filter === key}
- onClick={() => setFilter(key)}
- label={t(($) => $.machine.filters[key])}
- count={counts[key]}
- tone={key}
- />
- ))}
- </div>
- </div>
-
- <div className="min-h-0 flex-1 overflow-auto py-2">
- {sections.length > 0 ? (
- sections.map((section) => (
- <div key={section.key} className="mb-3 last:mb-0">
- <div className="mb-1 flex items-center gap-2 px-4 text-[11px] font-medium uppercase tracking-wider text-muted-foreground">
- <span>{section.label}</span>
- <span className="h-px flex-1 bg-border" />
- </div>
- <div>
- {section.machines.map((machine) => (
- <MachineRow
- key={machine.id}
- machine={machine}
- active={machine.id === selectedMachineId}
- onClick={() => onSelect(machine.id)}
- />
- ))}
- </div>
- </div>
- ))
- ) : (
- <div className="flex h-full flex-col items-center justify-center px-6 text-center">
- <Search className="h-8 w-8 text-muted-foreground/40" />
- <p className="mt-3 text-sm font-medium">
- {t(($) => $.machine.no_matches_title)}
- </p>
- <p className="mt-1 text-xs text-muted-foreground">
- {totalMachines > 0
- ? t(($) => $.machine.no_matches_hint)
- : t(($) => $.page.bootstrapping.hint)}
- </p>
- </div>
- )}
+ ))}
</div>
- </aside>
- );
-}
-
-function MachineFilterChip({
- active,
- onClick,
- label,
- count,
- tone,
-}: {
- active: boolean;
- onClick: () => void;
- label: string;
- count: number;
- tone: RuntimeMachineFilter;
-}) {
- const dotClass =
- tone === "online"
- ? "bg-success"
- : tone === "issues"
- ? "bg-warning"
- : "bg-muted-foreground/40";
- return (
- <Button
- variant="outline"
- size="sm"
- onClick={onClick}
- className={cn(
- "h-7 gap-1.5 px-2 text-xs",
- active
- ? "bg-accent text-accent-foreground hover:bg-accent/80"
- : "bg-background text-muted-foreground",
- )}
- >
- {tone !== "all" && <span className={cn("h-1.5 w-1.5 rounded-full", dotClass)} />}
- <span>{label}</span>
- <span className="font-mono tabular-nums text-muted-foreground/70">
- {count}
- </span>
- </Button>
+ </div>
);
}
function MachineRow({
machine,
- active,
- onClick,
+ actions,
}: {
machine: RuntimeMachine;
- active: boolean;
- onClick: () => void;
+ actions?: React.ReactNode;
}) {
const { t } = useT("runtimes");
+ const healthLabel = useHealthLabel();
+ const timeAgo = useTimeAgo();
+ const paths = useWorkspacePaths();
const Icon = machine.section === "cloud" ? Cloud : Monitor;
+ const locator = machine.id;
const busyCount = machine.runningCount + machine.queuedCount;
- const runtimeCount = t(($) => $.machine.runtime_count, {
- count: machine.runtimes.length,
- });
- return (
- <button
- type="button"
- onClick={onClick}
- className={cn(
- "group flex w-full min-w-0 items-start gap-3 px-4 py-2.5 text-left transition-colors",
- active ? "bg-accent" : "hover:bg-accent/50",
- )}
- >
- <span className="relative mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-md border bg-background">
- <Icon className="h-3.5 w-3.5 text-muted-foreground" />
+ const body = (
+ <>
+ <span className="relative flex h-10 w-10 shrink-0 items-center justify-center rounded-lg border bg-background">
+ <Icon aria-hidden="true" className="h-4 w-4 text-muted-foreground" />
<HealthDot
health={machine.health}
className="absolute -bottom-0.5 -right-0.5 ring-2 ring-background"
/>
</span>
<span className="min-w-0 flex-1">
- <span className="flex min-w-0 items-center gap-1.5">
- <span
- className="truncate text-sm font-medium"
- title={
- machine.daemonId
- ? `daemon ${machine.daemonId}`
- : (machine.subtitle ?? undefined)
- }
- >
- {machine.title}
- </span>
+ <span className="flex min-w-0 flex-wrap items-center gap-2">
+ <span className="truncate text-sm font-medium">{machine.title}</span>
{machine.isCurrent && (
<span className="shrink-0 rounded bg-foreground px-1.5 py-0.5 text-[10px] font-medium text-background">
{t(($) => $.machine.this_machine)}
</span>
)}
</span>
- <span className="mt-1.5 flex min-w-0 items-center gap-1.5">
- <ProviderIconStack providers={machine.providerNames} />
- {busyCount > 0 ? (
- <span className="ml-auto shrink-0 text-xs font-medium text-primary">
- {t(($) => $.machine.busy_count, { count: busyCount })}
- </span>
- ) : (
- <span className="ml-auto shrink-0 text-xs text-muted-foreground">
- {runtimeCount}
- </span>
- )}
+ <span className="mt-1 block truncate text-xs text-muted-foreground">
+ {machine.subtitle ??
+ (machine.section === "cloud"
+ ? t(($) => $.machine.metrics.cloud_worker)
+ : t(($) => $.machine.metrics.local_daemon))}
+ </span>
+ </span>
+
+ <span className="hidden w-36 shrink-0 items-center gap-1.5 text-xs md:flex">
+ <HealthIcon health={machine.health} />
+ <span>{healthLabel(machine.health)}</span>
+ </span>
+ <span className="hidden w-40 shrink-0 flex-col gap-1 lg:flex">
+ <span className="text-xs text-muted-foreground">
+ {t(($) => $.machine.runtime_count, {
+ count: machine.runtimes.length,
+ })}
</span>
+ <ProviderIconStack providers={machine.providerNames} />
</span>
- </button>
+ <span className="hidden w-36 shrink-0 text-xs text-muted-foreground xl:block">
+ {busyCount > 0
+ ? t(($) => $.machine.metrics.workload_hint, {
+ running: machine.runningCount,
+ queued: machine.queuedCount,
+ })
+ : t(($) => $.machine.metrics.workload_idle)}
+ </span>
+ <span className="hidden w-28 shrink-0 text-right text-xs text-muted-foreground lg:block">
+ {machine.lastSeenAt ? timeAgo(machine.lastSeenAt) : "—"}
+ </span>
+ {locator && (
+ <ChevronRight
+ aria-hidden="true"
+ className="h-4 w-4 shrink-0 text-muted-foreground/50 transition-transform group-hover:translate-x-0.5 group-hover:text-muted-foreground"
+ />
+ )}
+ </>
+ );
+
+ return (
+ <div className="flex min-w-0 items-center">
+ <AppLink
+ href={paths.runtimeDetail(locator)}
+ className="group flex min-w-0 flex-1 items-center gap-3 px-4 py-3.5 transition-colors hover:bg-accent/40 focus-visible:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring"
+ >
+ {body}
+ </AppLink>
+ {actions && <div className="shrink-0 pr-4">{actions}</div>}
+ </div>
);
}
function ProviderIconStack({ providers }: { providers: string[] }) {
const visible = providers.slice(0, 4);
const extra = providers.length - visible.length;
+ if (visible.length === 0) return null;
return (
<span className="flex min-w-0 items-center -space-x-1">
{visible.map((provider) => (
@@ -684,151 +400,6 @@ function ProviderIconStack({ providers }: { providers: string[] }) {
);
}
-function MachineDetail({
- machine,
- 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");
- const healthLabel = useHealthLabel();
-
- if (!machine) {
- return (
- <main className="flex min-h-0 flex-1 flex-col items-center justify-center px-6 text-center">
- {bootstrapping ? (
- <>
- <Server className="h-8 w-8 animate-pulse text-muted-foreground/40" />
- <p className="mt-3 text-sm text-muted-foreground">
- {t(($) => $.page.bootstrapping.title)}
- </p>
- <p className="mt-1 max-w-xs text-xs text-muted-foreground/70">
- {t(($) => $.page.bootstrapping.hint)}
- </p>
- </>
- ) : (
- <>
- <Monitor className="h-8 w-8 text-muted-foreground/40" />
- <p className="mt-3 text-sm text-muted-foreground">
- {t(($) => $.machine.select_machine)}
- </p>
- </>
- )}
- </main>
- );
- }
-
- const runtimeTotal = machine.runtimes.length;
- const busyCount = machine.runningCount + machine.queuedCount;
- const workloadLabel =
- busyCount > 0
- ? t(($) => $.machine.metrics.workload_hint, {
- running: machine.runningCount,
- queued: machine.queuedCount,
- })
- : t(($) => $.machine.metrics.workload_idle);
- const runtimesMeta = t(($) => $.machine.metrics.runtimes_hint, {
- count: machine.onlineCount,
- });
- // Single inline meta strip replaces the old 4-card grid. Health is already
- // shown as a chip in the title row; CLI / daemon id are scanning-grade
- // info, not headline numbers — they belong in muted secondary text.
- const metaParts: React.ReactNode[] = [
- <span key="runtimes">
- <span className="font-medium tabular-nums text-foreground">
- {t(($) => $.machine.runtime_count, { count: runtimeTotal })}
- </span>
- {runtimeTotal > 0 && <> · {runtimesMeta}</>}
- </span>,
- <span key="workload" className={busyCount > 0 ? "text-primary" : undefined}>
- {workloadLabel}
- </span>,
- ];
- if (machine.cliVersion) {
- metaParts.push(
- <span key="cli" className="font-mono">
- {machine.cliVersion}
- </span>,
- );
- }
- if (machine.subtitle) {
- metaParts.push(
- <span key="subtitle" className="truncate font-mono">
- {machine.subtitle}
- </span>,
- );
- }
-
- return (
- <main className="flex min-w-0 flex-1 flex-col overflow-hidden">
- <div className="shrink-0 border-b bg-background px-5 py-4">
- <div className="flex min-w-0 flex-col gap-3 lg:flex-row lg:items-start lg:justify-between">
- <div className="min-w-0">
- <div className="flex min-w-0 flex-wrap items-center gap-2">
- <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)}
- </span>
- {machine.isCurrent && (
- <span className="rounded-md bg-foreground px-2 py-0.5 text-xs font-medium text-background">
- {t(($) => $.machine.local_badge)}
- </span>
- )}
- </div>
- <div className="mt-2 flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground">
- {metaParts.map((part, idx) => (
- <React.Fragment key={idx}>
- {idx > 0 && (
- <span className="text-muted-foreground/40">·</span>
- )}
- {part}
- </React.Fragment>
- ))}
- </div>
- </div>
- {actions && <div className="shrink-0">{actions}</div>}
- </div>
- </div>
-
- <RuntimeList
- runtimes={machine.runtimes}
- updatableIds={updatableIds}
- now={now}
- />
- </main>
- );
-}
-
-// ---------------------------------------------------------------------------
-// Empty state — shown when zero runtimes have ever registered in this
-// workspace.
-// ---------------------------------------------------------------------------
-
function EmptyState({ onConnectRemote }: { onConnectRemote: () => void }) {
const { t } = useT("runtimes");
return (
@@ -846,44 +417,25 @@ function EmptyState({ onConnectRemote }: { onConnectRemote: () => void }) {
);
}
-// ---------------------------------------------------------------------------
-// Loading skeleton — laid out like the split runtime page so the layout
-// does not jump on first paint.
-// ---------------------------------------------------------------------------
-
function RuntimesPageSkeleton() {
return (
- <div className="flex flex-1 min-h-0 flex-col">
+ <div className="flex min-h-0 flex-1 flex-col">
<PageHeader className="justify-between px-5">
<Skeleton className="h-4 w-24" />
</PageHeader>
- <div className="flex min-h-0 flex-1">
- <div className="hidden w-[300px] shrink-0 border-r p-3 md:block">
- <Skeleton className="h-9 w-full rounded-md" />
- <div className="mt-3 flex gap-2">
- <Skeleton className="h-7 w-16 rounded-md" />
- <Skeleton className="h-7 w-20 rounded-md" />
- <Skeleton className="h-7 w-20 rounded-md" />
- </div>
- <div className="mt-5 space-y-2">
- {Array.from({ length: 6 }).map((_, i) => (
- <Skeleton key={i} className="h-20 w-full rounded-lg" />
- ))}
- </div>
- </div>
- <div className="flex min-w-0 flex-1 flex-col">
- <div className="border-b p-5">
- <Skeleton className="h-6 w-64 rounded-md" />
- <Skeleton className="mt-3 h-4 w-full max-w-md rounded-md" />
- </div>
- <div className="h-12 border-b px-4 py-2">
- <Skeleton className="h-8 w-40 rounded-full" />
- </div>
- <div className="space-y-2 p-4">
- {Array.from({ length: 6 }).map((_, i) => (
- <Skeleton key={i} className="h-14 w-full rounded-md" />
- ))}
- </div>
+ <div className="mx-auto w-full max-w-[1440px] p-6">
+ <div className="overflow-hidden rounded-lg border">
+ {Array.from({ length: 5 }).map((_, index) => (
+ <div key={index} className="flex h-[76px] items-center gap-3 border-b px-4 last:border-b-0">
+ <Skeleton className="h-10 w-10 rounded-lg" />
+ <div className="flex-1">
+ <Skeleton className="h-4 w-44" />
+ <Skeleton className="mt-2 h-3 w-28" />
+ </div>
+ <Skeleton className="hidden h-4 w-24 md:block" />
+ <Skeleton className="hidden h-4 w-28 lg:block" />
+ </div>
+ ))}
</div>
</div>
</div>
@@ -891,4 +443,3 @@ function RuntimesPageSkeleton() {
}
export default RuntimesPage;
-export type { RuntimesPageProps };
diff --git a/packages/views/runtimes/index.ts b/packages/views/runtimes/index.ts
index c534b94c43..ef738128fe 100644
--- a/packages/views/runtimes/index.ts
+++ b/packages/views/runtimes/index.ts
@@ -1 +1,5 @@
-export { RuntimesPage, RuntimeDetailPage } from "./components";
+export {
+ RuntimesPage,
+ RuntimeDetailPage,
+ RuntimeSettingsPage,
+} from "./components";