Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
ZIC-245: fix custom Oh-My-Pi runtime profile identity and discovery (#8576)
ZIce2aa20b0353fd
diff --git a/CLI_AND_DAEMON.md b/CLI_AND_DAEMON.mdindex b5cf40e00a..b3eba47daf 100644--- a/CLI_AND_DAEMON.md+++ b/CLI_AND_DAEMON.md@@ -1101,3 +1101,12 @@ On the API, both endpoints accept `?include=content` and `?include=metadata`.A request that sends neither still gets `content`, on both endpoints, so aserver upgrade never changes what an un-upgraded client receives — it is theCLI that asks for the smaller shape.++### Custom runtime compatibility targets++Create custom Oh-My-Pi profiles with `multica runtime profile create --runtime-type omp --command-name omp --display-name "Custom Oh-My-Pi"`.+The immutable `runtime_type` selects model discovery, skills paths, and launch behavior;+the server derives `protocol_family` (`pi` for `omp`). Custom command/path overrides and+fixed arguments still apply, and the runtime retains its custom-profile provenance.+Existing profiles and the legacy `--protocol-family` flag retain their original target.+To move a Pi profile to Oh-My-Pi, create a new profile and rebind its agents.diff --git a/packages/core/api/client.ts b/packages/core/api/client.tsindex edbba008c8..91a7723017 100644--- a/packages/core/api/client.ts+++ b/packages/core/api/client.ts@@ -240,6 +240,8 @@ import { createRequestId, createSafeId } from "../utils";import { getCurrentSlug } from "../platform/workspace-storage";import { parseWithFallback } from "./schema";import {+ RuntimeProfileSchema,+ RuntimeProfileListSchema,AgentTaskListSchema,AgentActivityBucketListSchema,AttachmentResponseSchema,@@ -2184,25 +2186,39 @@ export class ApiClient {const res = await this.fetch<{ runtime_profiles?: RuntimeProfile[] }>(`/api/workspaces/${workspaceId}/runtime-profiles`,);- return res.runtime_profiles ?? [];+ return parseWithFallback(+ res.runtime_profiles ?? [],+ RuntimeProfileListSchema,+ [] as RuntimeProfile[],+ { endpoint: "listRuntimeProfiles" },+ );}async getRuntimeProfile(workspaceId: string,profileId: string,): Promise<RuntimeProfile> {- return this.fetch(+ const result = await this.fetch<RuntimeProfile>(`/api/workspaces/${workspaceId}/runtime-profiles/${profileId}`,);+ return parseWithFallback(result, RuntimeProfileSchema, result, {+ endpoint: "runtimeProfile",+ });}async createRuntimeProfile(workspaceId: string,body: CreateRuntimeProfileRequest,): Promise<RuntimeProfile> {- return this.fetch(`/api/workspaces/${workspaceId}/runtime-profiles`, {- method: "POST",- body: JSON.stringify(body),+ const result = await this.fetch<RuntimeProfile>(+ `/api/workspaces/${workspaceId}/runtime-profiles`,+ {+ method: "POST",+ body: JSON.stringify(body),+ },+ );+ return parseWithFallback(result, RuntimeProfileSchema, result, {+ endpoint: "runtimeProfile",});}@@ -2211,13 +2227,16 @@ export class ApiClient {profileId: string,patch: UpdateRuntimeProfileRequest,): Promise<RuntimeProfile> {- return this.fetch(+ const result = await this.fetch<RuntimeProfile>(`/api/workspaces/${workspaceId}/runtime-profiles/${profileId}`,{method: "PATCH",body: JSON.stringify(patch),},);+ return parseWithFallback(result, RuntimeProfileSchema, result, {+ endpoint: "runtimeProfile",+ });}async deleteRuntimeProfile(diff --git a/packages/core/api/runtime-profile-schema.test.ts b/packages/core/api/runtime-profile-schema.test.tsnew file mode 100644index 0000000000..a1a48bc700--- /dev/null+++ b/packages/core/api/runtime-profile-schema.test.ts@@ -0,0 +1,37 @@+// @vitest-environment node+import { describe, it, expect } from "vitest";+import { RuntimeProfileSchema } from "./schemas";+import { parseWithFallback } from "./schema";+const profile = {+ id: "p",+ workspace_id: "ws",+ display_name: "Custom",+ protocol_family: "pi",+ command_name: "wrapper",+};+describe("runtime profile response compatibility", () => {+ it("defaults old or malformed identities to the protocol", () => {+ for (const runtime_type of [undefined, null, 42, ""]) {+ expect(+ RuntimeProfileSchema.parse({ ...profile, runtime_type }).runtime_type,+ ).toBe("pi");+ }+ });+ it("preserves runtime identities including future targets", () => {+ for (const runtime_type of ["omp", "future-runtime"]) {+ expect(+ RuntimeProfileSchema.parse({ ...profile, runtime_type }).runtime_type,+ ).toBe(runtime_type);+ }+ });+ it("uses a safe fallback for malformed responses", () => {+ expect(+ parseWithFallback(+ { ...profile, command_name: 42 },+ RuntimeProfileSchema,+ null,+ { endpoint: "runtimeProfile" },+ ),+ ).toBeNull();+ });+});diff --git a/packages/core/api/schemas.ts b/packages/core/api/schemas.tsindex a1c8b3d130..a7446aeeb3 100644--- a/packages/core/api/schemas.ts+++ b/packages/core/api/schemas.ts@@ -3476,3 +3476,27 @@ export const EMPTY_JOIN_SHARE_LINK_RESPONSE: {workspace_id: "",workspace_slug: "",};++// Older servers omit runtime_type; the protocol remains their compatibility target.+export const RuntimeProfileSchema = z+ .object({+ id: z.string(),+ workspace_id: z.string(),+ display_name: z.string(),+ protocol_family: z.string(),+ runtime_type: z.string().nullish().catch(undefined),+ command_name: z.string(),+ description: z.string().nullable().catch(null),+ fixed_args: z.array(z.string()).catch([]),+ visibility: z.string().catch("workspace"),+ created_by: z.string().nullable().catch(null),+ enabled: z.boolean().catch(true),+ created_at: z.string().catch(""),+ updated_at: z.string().catch(""),+ })+ .passthrough()+ .transform((profile) => ({+ ...profile,+ runtime_type: profile.runtime_type || profile.protocol_family,+ }));+export const RuntimeProfileListSchema = z.array(RuntimeProfileSchema);diff --git a/packages/core/types/agent.ts b/packages/core/types/agent.tsindex 8828c27cf7..c442643677 100644--- a/packages/core/types/agent.ts+++ b/packages/core/types/agent.ts@@ -138,6 +138,12 @@ export const RUNTIME_PROFILE_PROTOCOL_FAMILIES = [export type RuntimeProtocolFamily =(typeof RUNTIME_PROFILE_PROTOCOL_FAMILIES)[number];+export const RUNTIME_PROFILE_RUNTIME_TYPES = [+ ...RUNTIME_PROFILE_PROTOCOL_FAMILIES,+ "omp",+] as const;+export type RuntimeProfileType = (typeof RUNTIME_PROFILE_RUNTIME_TYPES)[number];+// Profile visibility mirrors RuntimeVisibility's vocabulary but uses the// workspace/private axis the server documents for profiles.export type RuntimeProfileVisibility = "workspace" | "private";@@ -147,6 +153,7 @@ export interface RuntimeProfile {workspace_id: string;display_name: string;protocol_family: RuntimeProtocolFamily;+ runtime_type?: RuntimeProfileType;command_name: string;description: string | null;fixed_args: string[];@@ -157,12 +164,14 @@ export interface RuntimeProfile {updated_at: string;}-// POST body. `protocol_family` is required and immutable after creation.+// POST body. runtime_type is the immutable compatibility target; the server+// derives protocol_family. Older clients may still send protocol_family alone.// Optional fields are omitted entirely when unset (never sent as null/empty)// so the server applies its own defaults.export interface CreateRuntimeProfileRequest {display_name: string;- protocol_family: RuntimeProtocolFamily;+ protocol_family?: RuntimeProtocolFamily;+ runtime_type?: RuntimeProfileType;command_name: string;description?: string;fixed_args?: string[];diff --git a/packages/core/types/index.ts b/packages/core/types/index.tsindex f070e2284f..61c113596c 100644--- a/packages/core/types/index.ts+++ b/packages/core/types/index.ts@@ -32,6 +32,7 @@ export type {RuntimeDevice,RuntimeProfile,RuntimeProtocolFamily,+ RuntimeProfileType,RuntimeProfileVisibility,CreateRuntimeProfileRequest,UpdateRuntimeProfileRequest,@@ -87,7 +88,7 @@ export type {IssueUsageSummary,MikaBootstrapResponse,} from "./agent";-export { RUNTIME_PROFILE_PROTOCOL_FAMILIES } from "./agent";+export { RUNTIME_PROFILE_PROTOCOL_FAMILIES, RUNTIME_PROFILE_RUNTIME_TYPES } from "./agent";export type { Workspace, WorkspaceRepo, WorkspaceMcpServer, Member, MemberRole, User, MemberWithUser, Invitation, ShareLink, ShareLinkInfo } from "./workspace";export type {PluginInstallation,diff --git a/packages/views/locales/en/runtimes.json b/packages/views/locales/en/runtimes.jsonindex 587293bfd8..491ca56fb7 100644--- a/packages/views/locales/en/runtimes.json+++ b/packages/views/locales/en/runtimes.json@@ -348,7 +348,7 @@"read_only": "Read-only"},"detail": {- "base_family": "Base protocol family",+ "base_family": "Base runtime","command": "Command","description": "Description","no_description": "No description",@@ -360,12 +360,12 @@"form": {"create_title": "New custom runtime","edit_title": "Edit custom runtime",- "step_family_label": "Choose a base protocol family",- "step_family_hint": "The underlying CLI protocol this runtime speaks.",+ "step_family_label": "Choose a base runtime",+ "step_family_hint": "Select the CLI this command is compatible with.","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.",+ "family_label": "Base runtime",+ "family_locked_hint": "The base runtime cannot be changed after creation.","display_name_label": "Display name","display_name_placeholder": "e.g. My custom Claude…","command_name_label": "Command",diff --git a/packages/views/locales/fr/runtimes.json b/packages/views/locales/fr/runtimes.jsonindex a8804812ac..ed74ddd05a 100644--- a/packages/views/locales/fr/runtimes.json+++ b/packages/views/locales/fr/runtimes.json@@ -348,7 +348,7 @@"read_only": "Lecture seule"},"detail": {- "base_family": "Famille de protocoles de base",+ "base_family": "Runtime de base","command": "Commande","description": "Description","no_description": "Aucune description",@@ -360,12 +360,12 @@"form": {"create_title": "Nouveau runtime personnalisé","edit_title": "Modifier le runtime personnalisé",- "step_family_label": "Choisissez une famille de protocoles de base",- "step_family_hint": "Le protocole CLI sous-jacent que parle ce runtime.",+ "step_family_label": "Choisissez un runtime de base",+ "step_family_hint": "Sélectionnez le CLI compatible avec cette commande.","step_details_label": "Configurez le runtime","step_progress": "Étape {{current}} sur {{total}}",- "family_label": "Famille de protocoles de base",- "family_locked_hint": "La famille de protocoles de base ne peut pas être modifiée après création.",+ "family_label": "Runtime de base",+ "family_locked_hint": "Le runtime de base ne peut pas être modifié après la création.","display_name_label": "Nom affiché","display_name_placeholder": "ex. Mon Claude personnalisé…","command_name_label": "Commande",diff --git a/packages/views/locales/ja/runtimes.json b/packages/views/locales/ja/runtimes.jsonindex 7ee94ca279..39304befcf 100644--- a/packages/views/locales/ja/runtimes.json+++ b/packages/views/locales/ja/runtimes.json@@ -335,7 +335,7 @@"read_only": "読み取り専用"},"detail": {- "base_family": "ベースプロトコルファミリー",+ "base_family": "ベースランタイム","command": "コマンド","description": "説明","no_description": "説明なし",@@ -347,12 +347,12 @@"form": {"create_title": "新しいカスタムランタイム","edit_title": "カスタムランタイムを編集",- "step_family_label": "ベースプロトコルファミリーを選択",- "step_family_hint": "このランタイムが使用する基盤の CLI プロトコル。",+ "step_family_label": "ベースランタイムを選択",+ "step_family_hint": "このコマンドと互換性のある CLI を選択します。","step_details_label": "ランタイムを設定","step_progress": "ステップ {{current}} / {{total}}",- "family_label": "ベースプロトコルファミリー",- "family_locked_hint": "作成後はベースプロトコルファミリーを変更できません。",+ "family_label": "ベースランタイム",+ "family_locked_hint": "作成後はベースランタイムを変更できません。","display_name_label": "表示名","display_name_placeholder": "例:マイカスタム Claude…","command_name_label": "コマンド",diff --git a/packages/views/locales/ko/runtimes.json b/packages/views/locales/ko/runtimes.jsonindex 206e3f89dc..f9184284e9 100644--- a/packages/views/locales/ko/runtimes.json+++ b/packages/views/locales/ko/runtimes.json@@ -335,7 +335,7 @@"read_only": "읽기 전용"},"detail": {- "base_family": "기본 프로토콜 제품군",+ "base_family": "기본 런타임","command": "명령","description": "설명","no_description": "설명 없음",@@ -347,12 +347,12 @@"form": {"create_title": "새 사용자 지정 런타임","edit_title": "사용자 지정 런타임 편집",- "step_family_label": "기본 프로토콜 제품군 선택",- "step_family_hint": "이 런타임이 사용하는 기반 CLI 프로토콜입니다.",+ "step_family_label": "기본 런타임 선택",+ "step_family_hint": "이 명령과 호환되는 CLI를 선택하세요.","step_details_label": "런타임 구성","step_progress": "{{current}} / {{total}}단계",- "family_label": "기본 프로토콜 제품군",- "family_locked_hint": "생성 후에는 기본 프로토콜 제품군을 변경할 수 없습니다.",+ "family_label": "기본 런타임",+ "family_locked_hint": "생성 후에는 기본 런타임을 변경할 수 없습니다.","display_name_label": "표시 이름","display_name_placeholder": "예: 내 사용자 지정 Claude…","command_name_label": "명령",diff --git a/packages/views/locales/zh-Hans/runtimes.json b/packages/views/locales/zh-Hans/runtimes.jsonindex 823eae705c..0578f2619e 100644--- a/packages/views/locales/zh-Hans/runtimes.json+++ b/packages/views/locales/zh-Hans/runtimes.json@@ -335,7 +335,7 @@"read_only": "只读"},"detail": {- "base_family": "基础协议类型",+ "base_family": "基础运行时","command": "命令","description": "描述","no_description": "无描述",@@ -347,12 +347,12 @@"form": {"create_title": "新建自定义运行时","edit_title": "编辑自定义运行时",- "step_family_label": "选择基础协议类型",- "step_family_hint": "此运行时使用的底层 CLI 协议。",+ "step_family_label": "选择基础运行时",+ "step_family_hint": "选择此命令兼容的 CLI。","step_details_label": "配置运行时","step_progress": "第 {{current}} / {{total}} 步",- "family_label": "基础协议类型",- "family_locked_hint": "创建后无法更改基础协议类型。",+ "family_label": "基础运行时",+ "family_locked_hint": "创建后无法更改基础运行时。","display_name_label": "显示名称","display_name_placeholder": "例如:我的自定义 Claude...","command_name_label": "命令",diff --git a/packages/views/runtimes/components/runtime-profile-catalog.test.ts b/packages/views/runtimes/components/runtime-profile-catalog.test.tsindex cab94f34ee..ab0fb81804 100644--- a/packages/views/runtimes/components/runtime-profile-catalog.test.ts+++ b/packages/views/runtimes/components/runtime-profile-catalog.test.ts@@ -5,7 +5,8 @@ import {buildRuntimeCatalog,formatCommandLine,parseCommandLine,- PROTOCOL_FAMILIES,+ runtimeTypeLabel,+ RUNTIME_TYPES,} from "./runtime-profile-catalog";function profile(@@ -42,11 +43,11 @@ describe("buildRuntimeCatalog", () => {id: "prof-1",protocolFamily: "codex",});- expect(catalog.builtins).toHaveLength(PROTOCOL_FAMILIES.length);+ expect(catalog.builtins).toHaveLength(RUNTIME_TYPES.length);expect(catalog.builtins[0]).toMatchObject({kind: "builtin",- id: `builtin:${PROTOCOL_FAMILIES[0]}`,- protocolFamily: PROTOCOL_FAMILIES[0],+ id: `builtin:${RUNTIME_TYPES[0]}`,+ protocolFamily: RUNTIME_TYPES[0],});});@@ -67,6 +68,24 @@ describe("buildRuntimeCatalog", () => {});});+describe("runtimeTypeLabel", () => {+ // The picker and the profile it creates must not disagree about what the+ // target is called: every surface reads the label from here.+ it("names a target whose product name differs from its stored id", () => {+ expect(runtimeTypeLabel("omp")).toBe("Oh-My-Pi");+ });++ it("passes through ids that are their own label", () => {+ expect(runtimeTypeLabel("pi")).toBe("pi");+ expect(runtimeTypeLabel("claude")).toBe("claude");+ });++ // A target the client does not recognise still has to render as something.+ it("falls back to the raw value for an unknown target", () => {+ expect(runtimeTypeLabel("future-runtime")).toBe("future-runtime");+ });+});+describe("parseCommandLine", () => {it("splits a pasted executable and fixed args", () => {expect(parseCommandLine("agent --model composer-2.5")).toEqual({@@ -77,7 +96,9 @@ describe("parseCommandLine", () => {});it("preserves quoted whitespace and escaped characters", () => {- expect(parseCommandLine(`agent --flag "a b c" path\\ with\\ spaces`)).toEqual({+ expect(+ parseCommandLine(`agent --flag "a b c" path\\ with\\ spaces`),+ ).toEqual({ok: true,commandName: "agent",fixedArgs: ["--flag", "a b c", "path with spaces"],diff --git a/packages/views/runtimes/components/runtime-profile-catalog.ts b/packages/views/runtimes/components/runtime-profile-catalog.tsindex 6076bf904f..7c96c038d8 100644--- a/packages/views/runtimes/components/runtime-profile-catalog.ts+++ b/packages/views/runtimes/components/runtime-profile-catalog.ts@@ -1,23 +1,23 @@import {- RUNTIME_PROFILE_PROTOCOL_FAMILIES,+ RUNTIME_PROFILE_RUNTIME_TYPES,type RuntimeProfile,- type RuntimeProtocolFamily,+ type RuntimeProfileType,} from "@multica/core/types";// A single row in the runtimes catalog the management dialog renders: the-// built-in protocol families ship as read-only reference rows, while custom+// built-in runtime targets ship as read-only reference rows, while custom// profiles are the user's editable assets.export type RuntimeCatalogEntry =| {kind: "builtin";// Stable row id — the protocol family doubles as the key for built-ins.id: string;- protocolFamily: RuntimeProtocolFamily;+ protocolFamily: RuntimeProfileType;}| {kind: "custom";id: string;- protocolFamily: RuntimeProtocolFamily;+ protocolFamily: RuntimeProfileType;profile: RuntimeProfile;};@@ -28,16 +28,36 @@ export interface RuntimeCatalogSections {// Re-export the whitelist as a typed array so callers (the family picker,// the catalog builder) share the single source of truth.-export const PROTOCOL_FAMILIES: readonly RuntimeProtocolFamily[] =- RUNTIME_PROFILE_PROTOCOL_FAMILIES;+export const RUNTIME_TYPES = RUNTIME_PROFILE_RUNTIME_TYPES;++// A runtime id is its own label for every target whose product name is just+// the id — `capitalize` at the render site turns "claude" into "Claude". Only+// targets whose product name differs from the stored id need an entry here.+const RUNTIME_TYPE_LABELS: Partial<Record<RuntimeProfileType, string>> = {+ omp: "Oh-My-Pi",+};++// runtimeTypeLabel is what the user should read for a runtime target. Every+// surface that shows one goes through it, so the picker and the profile it+// creates cannot disagree about what the target is called.+export function runtimeTypeLabel(runtimeType: string): string {+ return RUNTIME_TYPE_LABELS[runtimeType as RuntimeProfileType] ?? runtimeType;+}++// profileRuntimeType is the target a profile was created against. Profiles+// written before the server stored an identity carry only a protocol family,+// which was their target (see RuntimeProfileSchema).+export function profileRuntimeType(profile: RuntimeProfile): RuntimeProfileType {+ return profile.runtime_type ?? profile.protocol_family;+}// buildRuntimeCatalog keeps user-owned custom profiles separate from built-in-// protocol families. The dialog renders customs as the primary management+// runtime targets. The dialog renders customs as the primary management// surface and built-ins as a collapsed reference section.export function buildRuntimeCatalog(profiles: RuntimeProfile[],): RuntimeCatalogSections {- const builtins: RuntimeCatalogEntry[] = PROTOCOL_FAMILIES.map((family) => ({+ const builtins: RuntimeCatalogEntry[] = RUNTIME_TYPES.map((family) => ({kind: "builtin" as const,id: `builtin:${family}`,protocolFamily: family,@@ -56,7 +76,7 @@ export function buildRuntimeCatalog(.map((profile) => ({kind: "custom" as const,id: profile.id,- protocolFamily: profile.protocol_family,+ protocolFamily: profileRuntimeType(profile),profile,}));@@ -168,7 +188,10 @@ export function parseCommandLine(input: string): ParsedCommandLine {return { ok: true, commandName: tokens[0], fixedArgs: tokens.slice(1) };}-export function formatCommandLine(commandName: string, fixedArgs: string[]): string {+export function formatCommandLine(+ commandName: string,+ fixedArgs: string[],+): string {return [commandName, ...fixedArgs].filter(Boolean).map(quoteArg).join(" ");}diff --git a/packages/views/runtimes/components/runtime-profiles-dialog.test.tsx b/packages/views/runtimes/components/runtime-profiles-dialog.test.tsxindex 5c16606bd4..6a4cfe45f9 100644--- a/packages/views/runtimes/components/runtime-profiles-dialog.test.tsx+++ b/packages/views/runtimes/components/runtime-profiles-dialog.test.tsx@@ -17,10 +17,9 @@ const mutationState = vi.hoisted(() => ({}));vi.mock("@tanstack/react-query", async () => {- const actual =- await vi.importActual<typeof import("@tanstack/react-query")>(- "@tanstack/react-query",- );+ const actual = await vi.importActual<typeof import("@tanstack/react-query")>(+ "@tanstack/react-query",+ );return {...actual,useQuery: vi.fn(() => ({@@ -126,9 +125,7 @@ describe("RuntimeProfilesDialog", () => {expect(screen.getByText("Create your first custom runtime"),).toBeInTheDocument();- expect(- screen.getByText(/Pick a base protocol family/),- ).toBeInTheDocument();+ expect(screen.getByText(/Pick a base protocol family/)).toBeInTheDocument();const builtinsToggle = screen.getByRole("button", {name: /Supported base protocols/,@@ -188,6 +185,26 @@ describe("RuntimeProfilesDialog", () => {).not.toBeInTheDocument();});+ it("creates an Oh-My-Pi compatibility target without a client protocol mapping", async () => {+ renderDialog({ intent: "create" });+ fireEvent.click(screen.getByRole("button", { name: "Oh-My-Pi" }));+ fireEvent.change(screen.getByLabelText("Display name"), {+ target: { value: "Custom OMP" },+ });+ fireEvent.change(screen.getByLabelText("Command"), {+ target: { value: "wrapper launch" },+ });+ fireEvent.click(screen.getByRole("button", { name: "Create runtime" }));+ await waitFor(() =>+ expect(mutationState.createProfile).toHaveBeenCalledWith({+ display_name: "Custom OMP",+ runtime_type: "omp",+ command_name: "wrapper",+ fixed_args: ["launch"],+ }),+ );+ });+it("parses a pasted command line into fixed_args on create", async () => {renderDialog();@@ -214,7 +231,7 @@ describe("RuntimeProfilesDialog", () => {await waitFor(() =>expect(mutationState.createProfile).toHaveBeenCalledWith({display_name: "Composer Agent",- protocol_family: "codex",+ runtime_type: "codex",command_name: "agent",fixed_args: ["--model", "composer-2.5"],}),@@ -235,7 +252,9 @@ describe("RuntimeProfilesDialog", () => {screen.getByRole("heading", { name: "New custom runtime" }),).toBeInTheDocument();expect(screen.getByText(/from Studio Mac/)).toBeInTheDocument();- expect(screen.getByRole("link", { name: "View setup guide" })).toHaveAttribute(+ expect(+ screen.getByRole("link", { name: "View setup guide" }),+ ).toHaveAttribute("href","https://multica.ai/docs/daemon-runtimes#custom-runtime-profiles",);@@ -243,7 +262,9 @@ describe("RuntimeProfilesDialog", () => {expect(screen.queryByText("Create your first custom runtime"),).not.toBeInTheDocument();- expect(screen.queryByRole("button", { name: "Back" })).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();diff --git a/packages/views/runtimes/components/runtime-profiles-dialog.tsx b/packages/views/runtimes/components/runtime-profiles-dialog.tsxindex c801e4c281..320696682d 100644--- a/packages/views/runtimes/components/runtime-profiles-dialog.tsx+++ b/packages/views/runtimes/components/runtime-profiles-dialog.tsx@@ -18,7 +18,7 @@ import { useQuery } from "@tanstack/react-query";import { ApiError } from "@multica/core/api";import type {RuntimeProfile,- RuntimeProtocolFamily,+ RuntimeProfileType,} from "@multica/core/types";import {runtimeProfileListOptions,@@ -41,10 +41,12 @@ import { cn } from "@multica/ui/lib/utils";import { ProviderLogo } from "./provider-logo";import { DeleteRuntimeProfileDialog } from "./delete-runtime-profile-dialog";import {- PROTOCOL_FAMILIES,+ RUNTIME_TYPES,buildRuntimeCatalog,formatCommandLine,parseCommandLine,+ profileRuntimeType,+ runtimeTypeLabel,validateProfileForm,type ProfileFormErrorField,type ProfileFormValues,@@ -94,7 +96,7 @@ export function RuntimeProfilesDialog({const [selectedId, setSelectedId] = useState<string | null>(null);// Carries the chosen family from create-step-1 into the form.const [draftFamily, setDraftFamily] =- useState<RuntimeProtocolFamily>(PROTOCOL_FAMILIES[0] ?? "claude");+ useState<RuntimeProfileType>(RUNTIME_TYPES[0] ?? "claude");const catalog = useMemo(() => buildRuntimeCatalog(profiles), [profiles]);const entries = useMemo(@@ -185,7 +187,9 @@ export function RuntimeProfilesDialog({mode={state.mode}step={state.mode === "create" ? state.step : "details"}family={- state.mode === "edit" ? state.profile.protocol_family : draftFamily+ state.mode === "edit"+ ? profileRuntimeType(state.profile)+ : draftFamily}profile={state.mode === "edit" ? state.profile : null}standaloneCreate={intent === "create"}@@ -413,7 +417,9 @@ function CatalogRow({}) {const { t } = useT("runtimes");const label =- entry.kind === "custom" ? entry.profile.display_name : entry.protocolFamily;+ entry.kind === "custom"+ ? entry.profile.display_name+ : runtimeTypeLabel(entry.protocolFamily);const disabled = entry.kind === "custom" && !entry.profile.enabled;const isBuiltin = entry.kind === "builtin";return (@@ -453,7 +459,7 @@ function CatalogRow({</span>{entry.kind === "custom" && (<span className="block truncate text-caption capitalize text-muted-foreground">- {entry.protocolFamily}+ {runtimeTypeLabel(entry.protocolFamily)}</span>)}</span>@@ -512,7 +518,7 @@ function DetailPanel({</span><div className="min-w-0"><h3 className="truncate text-title-sm font-semibold capitalize">- {entry.protocolFamily}+ {runtimeTypeLabel(entry.protocolFamily)}</h3><span className="text-caption text-muted-foreground">{t(($) => $.profiles.builtin_detail.read_only)}@@ -521,7 +527,7 @@ function DetailPanel({</div><p className="mt-4 text-body text-muted-foreground">{t(($) => $.profiles.builtin_detail.description, {- family: entry.protocolFamily,+ family: runtimeTypeLabel(entry.protocolFamily),})}</p></div>@@ -541,7 +547,7 @@ function DetailPanel({<div className="flex min-w-0 items-center gap-3"><span className="flex h-10 w-10 items-center justify-center rounded-md border bg-background"><ProviderLogo- provider={profile.protocol_family}+ provider={profileRuntimeType(profile)}className="h-5 w-5"/></span>@@ -550,7 +556,7 @@ function DetailPanel({{profile.display_name}</h3><span className="text-caption capitalize text-muted-foreground">- {profile.protocol_family}+ {runtimeTypeLabel(profileRuntimeType(profile))}</span></div></div>@@ -558,7 +564,9 @@ function DetailPanel({<dl className="mt-5 space-y-4"><DetailRow label={t(($) => $.profiles.detail.base_family)}>- <span className="capitalize">{profile.protocol_family}</span>+ <span className="capitalize">+ {runtimeTypeLabel(profileRuntimeType(profile))}+ </span></DetailRow><DetailRow label={t(($) => $.profiles.detail.command)}><span className="font-mono text-caption">{commandLine}</span>@@ -648,11 +656,11 @@ function ProfileFormView({wsId: string;mode: "create" | "edit";step: "family" | "details";- family: RuntimeProtocolFamily;+ family: RuntimeProfileType;profile: RuntimeProfile | null;standaloneCreate: boolean;standaloneEdit: boolean;- onPickFamily: (family: RuntimeProtocolFamily) => void;+ onPickFamily: (family: RuntimeProfileType) => void;onBack: () => void;onCancel: () => void;onSaved: (profile: RuntimeProfile) => void;@@ -676,7 +684,7 @@ function ProfileFormView({className="mt-4 grid grid-cols-2 gap-2 sm:grid-cols-3"aria-label={t(($) => $.profiles.form.family_label)}>- {PROTOCOL_FAMILIES.map((option) => (+ {RUNTIME_TYPES.map((option) => (<buttonkey={option}type="button"@@ -684,7 +692,9 @@ function ProfileFormView({className="flex items-center gap-2 rounded-md border bg-background px-3 py-2.5 text-left text-body transition-colors hover:bg-accent/50 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none"><ProviderLogo provider={option} className="h-4 w-4 shrink-0" />- <span className="truncate capitalize">{option}</span>+ <span className="truncate capitalize">+ {runtimeTypeLabel(option)}+ </span></button>))}</div>@@ -736,7 +746,7 @@ function ProfileDetailsForm({}: {wsId: string;mode: "create" | "edit";- family: RuntimeProtocolFamily;+ family: RuntimeProfileType;profile: RuntimeProfile | null;hideEditHeading: boolean;onBack: () => void;@@ -791,7 +801,7 @@ function ProfileDetailsForm({if (mode === "create") {const created = await createProfile.mutateAsync({display_name: values.displayName.trim(),- protocol_family: family,+ runtime_type: family,command_name: commandName,fixed_args: fixedArgs,...(description ? { description } : {}),@@ -870,7 +880,9 @@ function ProfileDetailsForm({</Label><div className="flex items-center gap-2 rounded-md border bg-muted/30 px-3 py-2"><ProviderLogo provider={family} className="h-4 w-4 shrink-0" />- <span className="text-body capitalize">{family}</span>+ <span className="text-body capitalize">+ {runtimeTypeLabel(family)}+ </span></div><p className="text-micro text-muted-foreground">{t(($) => $.profiles.form.family_locked_hint)}diff --git a/server/cmd/multica/cmd_runtime_profile.go b/server/cmd/multica/cmd_runtime_profile.goindex c24d6867f8..3c268f3ce7 100644--- a/server/cmd/multica/cmd_runtime_profile.go+++ b/server/cmd/multica/cmd_runtime_profile.go@@ -90,7 +90,8 @@ func init() {runtimeProfileListCmd.Flags().String("output", "table", "Output format: table or json")// create- runtimeProfileCreateCmd.Flags().String("protocol-family", "", "Supported backend the profile routes to (required)")+ runtimeProfileCreateCmd.Flags().String("runtime-type", "", "Base runtime compatibility target (e.g. pi or omp)")+ runtimeProfileCreateCmd.Flags().String("protocol-family", "", "Legacy base protocol family (use --runtime-type for Oh-My-Pi)")runtimeProfileCreateCmd.Flags().String("command-name", "", "Executable the daemon resolves on PATH (required)")runtimeProfileCreateCmd.Flags().String("display-name", "", "Human-readable profile name (required)")runtimeProfileCreateCmd.Flags().String("description", "", "Optional description")@@ -166,8 +167,20 @@ func runRuntimeProfileCreate(cmd *cobra.Command, _ []string) error {displayName, _ := cmd.Flags().GetString("display-name")description, _ := cmd.Flags().GetString("description")- if strings.TrimSpace(family) == "" {- return fmt.Errorf("--protocol-family is required")+ runtimeType, _ := cmd.Flags().GetString("runtime-type")+ runtimeType = strings.TrimSpace(runtimeType)+ if runtimeType == "" && strings.TrimSpace(family) == "" {+ return fmt.Errorf("--runtime-type or --protocol-family is required")+ }+ if runtimeType != "" {+ resolved, ok := agent.RuntimeProtocolFamily(runtimeType)+ if !ok {+ return fmt.Errorf("unsupported --runtime-type %q", runtimeType)+ }+ if family != "" && family != resolved {+ return fmt.Errorf("--protocol-family does not match --runtime-type")+ }+ family = resolved}if strings.TrimSpace(commandName) == "" {return fmt.Errorf("--command-name is required")@@ -193,6 +206,10 @@ func runRuntimeProfileCreate(cmd *cobra.Command, _ []string) error {"protocol_family": family,"command_name": commandName,}+ if runtimeType != "" {+ body["runtime_type"] = runtimeType+ delete(body, "protocol_family")+ }if description != "" {body["description"] = description}diff --git a/server/cmd/multica/cmd_runtime_profile_test.go b/server/cmd/multica/cmd_runtime_profile_test.goindex 9c1569ff6e..a42ac5ef72 100644--- a/server/cmd/multica/cmd_runtime_profile_test.go+++ b/server/cmd/multica/cmd_runtime_profile_test.go@@ -35,6 +35,7 @@ func newProfileCreateTestCmd() *cobra.Command {cmd := &cobra.Command{Use: "create"}addCommonProfileFlags(cmd)cmd.Flags().String("protocol-family", "", "")+ cmd.Flags().String("runtime-type", "", "")cmd.Flags().String("command-name", "", "")cmd.Flags().String("display-name", "", "")cmd.Flags().String("description", "", "")@@ -374,3 +375,30 @@ func TestRuntimeProfilePathMutationFailsClosedInTaskContext(t *testing.T) {t.Fatalf("owner config content changed: got %q", after)}}++func TestRunRuntimeProfileCreateOmpTarget(t *testing.T) {+ t.Setenv("HOME", t.TempDir())+ t.Setenv("MULTICA_TOKEN", "test-token")+ t.Setenv("MULTICA_WORKSPACE_ID", "ws-123")+ var body map[string]any+ srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ _ = json.NewDecoder(r.Body).Decode(&body)+ w.WriteHeader(http.StatusCreated)+ _ = json.NewEncoder(w).Encode(map[string]any{"id": "prof-1"})+ }))+ defer srv.Close()+ t.Setenv("MULTICA_SERVER_URL", srv.URL)+ cmd := newProfileCreateTestCmd()+ _ = cmd.Flags().Set("runtime-type", "omp")+ _ = cmd.Flags().Set("command-name", "wrapper")+ _ = cmd.Flags().Set("display-name", "Custom OMP")+ if err := runRuntimeProfileCreate(cmd, nil); err != nil {+ t.Fatal(err)+ }+ if body["runtime_type"] != "omp" || body["command_name"] != "wrapper" {+ t.Fatalf("incorrect target: %+v", body)+ }+ if _, ok := body["protocol_family"]; ok {+ t.Fatal("server must derive the protocol family")+ }+}diff --git a/server/internal/daemon/client.go b/server/internal/daemon/client.goindex 6b290e411d..3e770fcef1 100644--- a/server/internal/daemon/client.go+++ b/server/internal/daemon/client.go@@ -1019,8 +1019,8 @@ func (c *Client) GetWorkspaceRepos(ctx context.Context, workspaceID string) (*Wo}// RuntimeProfile mirrors the server's workspace custom runtime profile-// (MUL-3284). protocol_family is the provider used for task routing (it-// selects the agent backend), while command_name is the actual executable+// (MUL-3284). runtime_type selects the compatibility target, while+// protocol_family identifies its execution backend. command_name is the executable// the daemon resolves on PATH and launches. fixed_args are launch arguments// every agent on this runtime inherits.type RuntimeProfile struct {@@ -1028,6 +1028,7 @@ type RuntimeProfile struct {WorkspaceID string `json:"workspace_id"`DisplayName string `json:"display_name"`ProtocolFamily string `json:"protocol_family"`+ RuntimeType string `json:"runtime_type"`CommandName string `json:"command_name"`Description *string `json:"description"`FixedArgs []string `json:"fixed_args"`diff --git a/server/internal/daemon/daemon.go b/server/internal/daemon/daemon.goindex 69b0251bed..30601888c3 100644--- a/server/internal/daemon/daemon.go+++ b/server/internal/daemon/daemon.go@@ -3044,7 +3044,7 @@ func (d *Daemon) registerBuiltinRuntimesForWorkspaceLocked(ctx context.Context,//// The registration entry mirrors the built-in shape: name = display_name// (suffixed with the device name like the built-in path), type =-// protocol_family (the routing provider), version = best-effort detected+// runtime_type (the compatibility target), version = best-effort detected// version, status = "online", plus the profile_id the server validates.//// Returns a content signature of the fetched profile list (MUL-3332). The@@ -3070,14 +3070,15 @@ func (d *Daemon) appendProfileRuntimes(ctx context.Context, workspaceID string,return profileSetSignature(nil)}for _, profile := range resp.RuntimeProfiles {+ runtimeType := agent.ProfileRuntimeType(profile.RuntimeType, profile.ProtocolFamily)if profile.CommandName == "" || profile.ProtocolFamily == "" {d.logger.Warn("skip custom runtime profile: missing command_name or protocol_family","workspace_id", workspaceID, "profile_id", profile.ID, "display_name", profile.DisplayName)continue}- if !agent.IsSupportedType(profile.ProtocolFamily) {- reason := "unsupported protocol_family: " + profile.ProtocolFamily- d.logger.Warn("skip custom runtime profile: unsupported protocol_family",+ if _, supported := agent.RuntimeProtocolFamily(runtimeType); !supported {+ reason := "unsupported runtime_type: " + runtimeType+ d.logger.Warn("skip custom runtime profile: unsupported runtime_type","workspace_id", workspaceID, "profile_id", profile.ID,"display_name", profile.DisplayName, "protocol_family", profile.ProtocolFamily)*failedProfiles = append(*failedProfiles, map[string]string{@@ -3116,7 +3117,7 @@ func (d *Daemon) appendProfileRuntimes(ctx context.Context, workspaceID string,if resolved == "" {r, err := lookPath(profile.CommandName)if err != nil {- if discovered, ok := d.agents()[profile.ProtocolFamily]; ok && discovered.Command == profile.CommandName && discovered.Path != "" {+ if discovered, ok := d.agents()[runtimeType]; ok && discovered.Command == profile.CommandName && discovered.Path != "" {resolved = discovered.Pathd.logger.Info("custom runtime profile: using discovered provider command path","workspace_id", workspaceID, "profile_id", profile.ID,@@ -3149,7 +3150,7 @@ func (d *Daemon) appendProfileRuntimes(ctx context.Context, workspaceID string,// wrapper's, and only the former means anything to the min-version// gate (GH #7046).version, verErr := detectAgentVersion(ctx, agent.NewCommand(resolved,- agent.FilterLaunchPrefix(profile.ProtocolFamily, profile.FixedArgs, d.logger)))+ agent.FilterLaunchPrefix(runtimeType, profile.FixedArgs, d.logger)))if verErr != nil {d.logger.Debug("custom runtime profile: version probe failed (registering with empty version)","workspace_id", workspaceID, "profile_id", profile.ID, "path", resolved, "error", verErr)@@ -3165,7 +3166,7 @@ func (d *Daemon) appendProfileRuntimes(ctx context.Context, workspaceID string,"protocol_family", profile.ProtocolFamily, "command_path", resolved)*runtimes = append(*runtimes, map[string]string{"name": displayName,- "type": profile.ProtocolFamily,+ "type": runtimeType,"version": version,"status": "online","profile_id": profile.ID,@@ -3181,7 +3182,7 @@ func (d *Daemon) appendProfileRuntimes(ctx context.Context, workspaceID string,// without a restart.//// The hashed projection covers exactly the fields that affect what the-// daemon sends in a Register call: ID, Enabled, ProtocolFamily, CommandName,+// daemon sends in a Register call: ID, Enabled, runtime identity, CommandName,// FixedArgs (the launch args every agent on this runtime inherits) and// Visibility (so a hypothetical future per-creator filter still triggers// drift). Profiles are sorted by ID first so the digest is order-independent@@ -3199,7 +3200,7 @@ func profileSetSignature(profiles []RuntimeProfile) string {fmt.Fprintf(h, "%s%s%t%s%s%s%s%s%s%s",p.ID, sep,p.Enabled, sep,- p.ProtocolFamily, sep,+ agent.ProfileRuntimeType(p.RuntimeType, p.ProtocolFamily), sep,p.CommandName, sep,p.Visibility, sep,)@@ -7682,8 +7683,8 @@ func (d *Daemon) runTask(ctx context.Context, task Task, provider string, slot ientry, ok := d.agents()[provider]// A custom runtime profile (MUL-3284) overrides the executable path: the- // runtime's protocol_family is the provider (so agent.New still selects- // the right backend), but the actual binary on PATH is the profile's+ // runtime identity is the provider (so ResolveBackend applies its descriptor),+ // but the actual binary on PATH is the profile's// command_name, resolved at registration time and keyed by RuntimeID here.// Critically, a custom runtime can live on a host that has NO built-in// agent of the same provider installed, so when the runtime is custom wediff --git a/server/internal/daemon/model_list_binary_test.go b/server/internal/daemon/model_list_binary_test.goindex 80ef724e54..420986f87b 100644--- a/server/internal/daemon/model_list_binary_test.go+++ b/server/internal/daemon/model_list_binary_test.go@@ -7,6 +7,7 @@ import ("net/http/httptest""os""path/filepath"+ "runtime""strings""sync""testing"@@ -308,3 +309,46 @@ func TestHandleModelList_FixedArgsFilteredBeforeDiscovery(t *testing.T) {t.Fatalf("discovery prefix = %v, want the protocol flag filtered out", prefix)}}++func TestHandleModelList_CustomOmpCompatibilityTarget(t *testing.T) {+ if runtime.GOOS == "windows" {+ t.Skip("POSIX fixture")+ }+ fx := newModelListFixture(t)+ listModels = agent.ListModels+ path := fakeExecutable(t, "omp-wrapper")+ script := `#!/bin/sh+[ "$1" = "launch" ] || exit 3+shift+if [ "$1 $2" = "models --json" ]; then+ echo '{"models":[{"provider":"commandcode","id":"deepseek/model","selector":"commandcode/deepseek/model"}]}'+ exit 0+fi+echo "Error: unknown flags: $*" >&2+exit 2+`+ if err := os.WriteFile(path, []byte(script), 0755); err != nil {+ t.Fatal(err)+ }+ d := fx.daemon+ d.cfg.Agents = map[string]AgentEntry{}+ rt := Runtime{ID: "rt-custom", Provider: "omp", ProfileID: "prof-1"}+ d.runtimeIndex[rt.ID] = rt+ d.profileLaunchSpecs[rt.ProfileID] = profileLaunchSpec{path: path, fixedArgs: []string{"launch"}}+ d.handleModelList(context.Background(), rt, "req-omp")+ _, _, _, report := fx.snapshot()+ if report["status"] != "completed" {+ t.Fatalf("OMP discovery: %+v", report)+ }+ models, _ := report["models"].([]any)+ if len(models) != 1 || models[0].(map[string]any)["id"] != "commandcode/deepseek/model" {+ t.Fatalf("lost provider-qualified selector: %+v", report)+ }+ rt.Provider = "pi"+ d.handleModelList(context.Background(), rt, "req-pi")+ _, _, _, report = fx.snapshot()+ reason, _ := report["error"].(string)+ if report["status"] != "failed" || !strings.Contains(reason, "unknown flags") {+ t.Fatalf("failed probes must report a reason: %+v", report)+ }+}diff --git a/server/internal/daemon/runtime_profile_drift_test.go b/server/internal/daemon/runtime_profile_drift_test.goindex fa512d22ba..37031ce51b 100644--- a/server/internal/daemon/runtime_profile_drift_test.go+++ b/server/internal/daemon/runtime_profile_drift_test.go@@ -68,6 +68,11 @@ func TestProfileSetSignature_DetectsRegistrationAffectingChanges(t *testing.T) {out[0].CommandName = "different-bin"return out}},+ {"change runtime_type", func(in []RuntimeProfile) []RuntimeProfile {+ out := append([]RuntimeProfile(nil), in...)+ out[0].RuntimeType = "omp"+ return out+ }},{"change protocol_family", func(in []RuntimeProfile) []RuntimeProfile {out := append([]RuntimeProfile(nil), in...)out[0].ProtocolFamily = "claude"diff --git a/server/internal/daemon/runtime_profile_test.go b/server/internal/daemon/runtime_profile_test.goindex 3ccbfdd196..41d75aa593 100644--- a/server/internal/daemon/runtime_profile_test.go+++ b/server/internal/daemon/runtime_profile_test.go@@ -381,8 +381,8 @@ func TestRegisterRuntimes_SkipsUnsupportedProfileFamily(t *testing.T) {t.Errorf("failure command_name = %v, want gemini", failure["command_name"])}reason, _ := failure["reason"].(string)- if !strings.Contains(reason, "unsupported protocol_family: gemini") {- t.Errorf("failure reason = %q, want unsupported protocol_family: gemini", reason)+ if !strings.Contains(reason, "unsupported runtime_type: gemini") {+ t.Errorf("failure reason = %q, want unsupported runtime_type: gemini", reason)}}@@ -519,3 +519,26 @@ func TestCustomCommandPathForRuntime(t *testing.T) {t.Errorf("unresolved profile: got (%+v, %v), want empty false", spec, ok)}}++func TestRegisterRuntimes_ProfileCompatibilityTarget(t *testing.T) {+ t.Cleanup(stubAgentVersion(t))+ stubLookPath(t, map[string]string{"wrapper": "/opt/bin/wrapper"})+ for _, target := range []string{"", "pi", "omp"} {+ t.Run("target="+target, func(t *testing.T) {+ fx := newProfileRegisterFixture(t, []RuntimeProfile{{ID: "prof-1", ProtocolFamily: "pi", RuntimeType: target, CommandName: "wrapper", FixedArgs: []string{"launch"}, Enabled: true}}, http.StatusOK)+ fx.daemon.cfg.Agents = map[string]AgentEntry{}+ resp, _, _, err := fx.daemon.registerRuntimesForWorkspaceLocked(context.Background(), "ws-1")+ want := target+ if want == "" {+ want = "pi"+ }+ if err != nil || len(resp.Runtimes) != 1 || resp.Runtimes[0].Provider != want || resp.Runtimes[0].ProfileID != "prof-1" {+ t.Fatalf("lost compatibility target or provenance: %+v, %v", resp, err)+ }+ spec := fx.daemon.profileLaunchSpecs["prof-1"]+ if spec.path != "/opt/bin/wrapper" || strings.Join(spec.fixedArgs, " ") != "launch" {+ t.Fatalf("lost custom command: %+v", spec)+ }+ })+ }+}diff --git a/server/internal/handler/daemon.go b/server/internal/handler/daemon.goindex 96d40d75fe..4f21ab707a 100644--- a/server/internal/handler/daemon.go+++ b/server/internal/handler/daemon.go@@ -30,6 +30,7 @@ import ("github.com/multica-ai/multica/server/internal/runtimeapps""github.com/multica-ai/multica/server/internal/service""github.com/multica-ai/multica/server/internal/util"+ "github.com/multica-ai/multica/server/pkg/agent"db "github.com/multica-ai/multica/server/pkg/db/generated""github.com/multica-ai/multica/server/pkg/dbid""github.com/multica-ai/multica/server/pkg/protocol"@@ -499,7 +500,7 @@ func (h *Handler) DaemonRegister(w http.ResponseWriter, r *http.Request) {return}// The profile must exist in this workspace and be enabled. Trust- // the profile's stored protocol_family over the daemon-sent type so+ // the profile's stored runtime identity over the daemon-sent type so// the provider used for task routing cannot drift from the profile.prow, profile, err := h.upsertRuntimeWithProfile(r.Context(),@@ -511,7 +512,7 @@ func (h *Handler) DaemonRegister(w http.ResponseWriter, r *http.Request) {DaemonID: strToText(req.DaemonID),Name: name,RuntimeMode: "local",- Provider: profile.ProtocolFamily,+ Provider: agent.ProfileRuntimeType(profile.RuntimeType, profile.ProtocolFamily),Status: status,DeviceInfo: deviceInfo,Metadata: metadata,@@ -541,7 +542,7 @@ func (h *Handler) DaemonRegister(w http.ResponseWriter, r *http.Request) {writeError(w, http.StatusInternalServerError, "failed to register runtime: "+err.Error())return}- provider = profile.ProtocolFamily+ provider = agent.ProfileRuntimeType(profile.RuntimeType, profile.ProtocolFamily)inserted = prow.Insertedregistered = db.AgentRuntime{ID: prow.ID,@@ -702,7 +703,7 @@ func (h *Handler) DaemonRegister(w http.ResponseWriter, r *http.Request) {DaemonID: strToText(req.DaemonID),Name: name,RuntimeMode: "local",- Provider: profile.ProtocolFamily,+ Provider: agent.ProfileRuntimeType(profile.RuntimeType, profile.ProtocolFamily),Status: "offline",DeviceInfo: strings.TrimSpace(req.DeviceName),Metadata: metadata,diff --git a/server/internal/handler/daemon_test.go b/server/internal/handler/daemon_test.goindex f91eb3d083..0f0cb63ce9 100644--- a/server/internal/handler/daemon_test.go+++ b/server/internal/handler/daemon_test.go@@ -4716,3 +4716,25 @@ func TestBatchIssueGCCheckReadsNoCatalogForBuiltInStatuses(t *testing.T) {counter.entryReads, counter.keyReads)}}++func TestDaemonRegister_ProfileUsesStoredRuntimeIdentity(t *testing.T) {+ if testHandler == nil {+ t.Skip("database not available")+ }+ ctx := context.Background()+ profileID := insertRuntimeProfileFixture(t, ctx, "Custom OMP", "pi", "wrapper")+ if _, err := testPool.Exec(ctx, `UPDATE runtime_profile SET runtime_type = 'omp' WHERE id = $1`, profileID); err != nil {+ t.Fatal(err)+ }+ req := newDaemonTokenRequest("POST", "/api/daemon/register", map[string]any{+ "workspace_id": testWorkspaceID, "daemon_id": "test-omp-profile", "device_name": "test-device",+ "runtimes": []map[string]any{{"name": "Custom OMP", "type": "pi", "profile_id": profileID, "status": "online"}},+ }, testWorkspaceID, "test-omp-profile")+ testutil.Call(t, testHandler.DaemonRegister, req).Want(http.StatusOK)+ t.Cleanup(func() { testPool.Exec(ctx, `DELETE FROM agent_runtime WHERE profile_id = $1`, profileID) })+ var provider string+ dbfx.QueryRow(t, `SELECT provider FROM agent_runtime WHERE profile_id = $1`, profileID).Scan(&provider)+ if provider != "omp" {+ t.Fatalf("provider = %q, want stored omp identity", provider)+ }+}diff --git a/server/internal/handler/runtime_profile.go b/server/internal/handler/runtime_profile.goindex 8adb4b62a3..b9a3d55c1a 100644--- a/server/internal/handler/runtime_profile.go+++ b/server/internal/handler/runtime_profile.go@@ -24,8 +24,8 @@ import (// runtime — e.g. an in-house Codex wrapper. Daemons pull the enabled profiles// for their workspace, resolve command_name on PATH, and register an// agent_runtime instance carrying the profile_id. The profile only changes how-// a runtime is launched/displayed; the underlying protocol_family must be a-// backend Multica officially supports (validated against agent.SupportedTypes).+// a runtime is launched/displayed. runtime_type selects a supported compatibility+// target, and its descriptor determines the underlying protocol_family.//// Iron rule: a profile carries NO generic per-agent args. Per-agent launch args// stay on agent.custom_args. The only args field is fixed_args — args every@@ -37,6 +37,7 @@ type RuntimeProfileResponse struct {WorkspaceID string `json:"workspace_id"`DisplayName string `json:"display_name"`ProtocolFamily string `json:"protocol_family"`+ RuntimeType string `json:"runtime_type"`CommandName string `json:"command_name"`Description *string `json:"description"`FixedArgs []string `json:"fixed_args"`@@ -60,6 +61,7 @@ func runtimeProfileToResponse(p db.RuntimeProfile) RuntimeProfileResponse {WorkspaceID: uuidToString(p.WorkspaceID),DisplayName: p.DisplayName,ProtocolFamily: p.ProtocolFamily,+ RuntimeType: agent.ProfileRuntimeType(p.RuntimeType, p.ProtocolFamily),CommandName: p.CommandName,Description: textToPtr(p.Description),FixedArgs: args,@@ -118,6 +120,7 @@ func validateRuntimeProfileCommandName(commandName string) error {type createRuntimeProfileRequest struct {DisplayName string `json:"display_name"`ProtocolFamily string `json:"protocol_family"`+ RuntimeType string `json:"runtime_type"`CommandName string `json:"command_name"`Description *string `json:"description"`FixedArgs []string `json:"fixed_args"`@@ -151,10 +154,17 @@ func (h *Handler) CreateRuntimeProfile(w http.ResponseWriter, r *http.Request) {writeError(w, http.StatusBadRequest, "display_name is required")return}- if !agent.IsSupportedType(req.ProtocolFamily) {- writeError(w, http.StatusBadRequest, "unsupported protocol_family: must be one of "+strings.Join(agent.SupportedTypes, ", "))+ req.RuntimeType = agent.ProfileRuntimeType(strings.TrimSpace(req.RuntimeType), req.ProtocolFamily)+ family, supported := agent.RuntimeProtocolFamily(req.RuntimeType)+ if !supported {+ writeError(w, http.StatusBadRequest, "unsupported runtime_type: "+req.RuntimeType)return}+ if req.ProtocolFamily != "" && req.ProtocolFamily != family {+ writeError(w, http.StatusBadRequest, "protocol_family does not match runtime_type")+ return+ }+ req.ProtocolFamily = familyif req.CommandName == "" {writeError(w, http.StatusBadRequest, "command_name is required")return@@ -177,6 +187,7 @@ func (h *Handler) CreateRuntimeProfile(w http.ResponseWriter, r *http.Request) {WorkspaceID: wsUUID,DisplayName: req.DisplayName,ProtocolFamily: req.ProtocolFamily,+ RuntimeType: req.RuntimeType,CommandName: req.CommandName,Description: ptrToText(req.Description),FixedArgs: fixedArgs,@@ -254,14 +265,16 @@ func (h *Handler) GetRuntimeProfile(w http.ResponseWriter, r *http.Request) {}type updateRuntimeProfileRequest struct {- DisplayName *string `json:"display_name"`- CommandName *string `json:"command_name"`- Description *string `json:"description"`- FixedArgs *[]string `json:"fixed_args"`- Enabled *bool `json:"enabled"`+ RuntimeType *string `json:"runtime_type"`+ ProtocolFamily *string `json:"protocol_family"`+ DisplayName *string `json:"display_name"`+ CommandName *string `json:"command_name"`+ Description *string `json:"description"`+ FixedArgs *[]string `json:"fixed_args"`+ Enabled *bool `json:"enabled"`}-// UpdateRuntimeProfile applies a partial update. protocol_family is immutable+// UpdateRuntimeProfile applies a partial update. runtime_type and protocol_family are immutable// (changing it would silently repoint bound agents onto a different backend).// Admin-gated by the router.func (h *Handler) UpdateRuntimeProfile(w http.ResponseWriter, r *http.Request) {@@ -285,6 +298,11 @@ func (h *Handler) UpdateRuntimeProfile(w http.ResponseWriter, r *http.Request) {return}+ if req.RuntimeType != nil || req.ProtocolFamily != nil {+ writeError(w, http.StatusBadRequest, "runtime_type and protocol_family are immutable; create a new profile")+ return+ }+params := db.UpdateRuntimeProfileParams{ID: profileUUID, WorkspaceID: wsUUID}if req.DisplayName != nil {name := strings.TrimSpace(*req.DisplayName)diff --git a/server/internal/handler/runtime_profile_handler_test.go b/server/internal/handler/runtime_profile_handler_test.goindex 5d00f4ffd0..628d4fc3b6 100644--- a/server/internal/handler/runtime_profile_handler_test.go+++ b/server/internal/handler/runtime_profile_handler_test.go@@ -438,3 +438,64 @@ func TestCreateRuntimeProfile_ValidatesCommandAndFixedArgs(t *testing.T) {})}}++func TestCreateRuntimeProfile_RuntimeIdentity(t *testing.T) {+ if testHandler == nil {+ t.Skip("database not available")+ }+ for _, tc := range []struct {+ name, target, family string+ status int+ }{+ {"omp", "omp", "", http.StatusCreated},+ {"legacy pi", "", "pi", http.StatusCreated},+ {"mismatch", "omp", "codex", http.StatusBadRequest},+ {"unknown", "unknown", "", http.StatusBadRequest},+ } {+ t.Run(tc.name, func(t *testing.T) {+ req := withURLParam(newRequest("POST", "/", map[string]any{+ "display_name": "Identity " + tc.name, "runtime_type": tc.target,+ "protocol_family": tc.family, "command_name": "wrapper", "fixed_args": []string{"launch"},+ }), "id", testWorkspaceID)+ w := httptest.NewRecorder()+ testHandler.CreateRuntimeProfile(w, req)+ if w.Code != tc.status {+ t.Fatalf("status %d: %s", w.Code, w.Body.String())+ }+ if tc.status != http.StatusCreated {+ return+ }+ var resp RuntimeProfileResponse+ if err := json.Unmarshal(w.Body.Bytes(), &resp); err != nil {+ t.Fatal(err)+ }+ t.Cleanup(func() { testPool.Exec(context.Background(), `DELETE FROM runtime_profile WHERE id = $1`, resp.ID) })+ want := tc.target+ if want == "" {+ want = tc.family+ }+ if resp.RuntimeType != want || resp.ProtocolFamily != "pi" || resp.CommandName != "wrapper" || len(resp.FixedArgs) != 1 {+ t.Fatalf("incorrect identity: %+v", resp)+ }+ })+ }+}++func TestUpdateRuntimeProfile_RejectsIdentityChange(t *testing.T) {+ if testHandler == nil {+ t.Skip("database not available")+ }+ id := insertRuntimeProfileFixture(t, context.Background(), "Immutable Pi", "pi", "wrapper")+ for _, field := range []string{"runtime_type", "protocol_family"} {+ // withURLParams, not two nested withURLParam calls: the singular helper+ // installs a fresh chi route context each time, so the outer call would+ // drop "id" and the handler would reject on workspace id before ever+ // reaching the immutability check this test exists for.+ req := withURLParams(newRequest("PATCH", "/", map[string]any{field: "omp"}), "id", testWorkspaceID, "profileId", id)+ w := httptest.NewRecorder()+ testHandler.UpdateRuntimeProfile(w, req)+ if w.Code != http.StatusBadRequest || !strings.Contains(w.Body.String(), "immutable") {+ t.Fatalf("identity update: %d %s", w.Code, w.Body.String())+ }+ }+}diff --git a/server/migrations/501_runtime_profile_runtime_type.down.sql b/server/migrations/501_runtime_profile_runtime_type.down.sqlnew file mode 100644index 0000000000..a6a2c90364--- /dev/null+++ b/server/migrations/501_runtime_profile_runtime_type.down.sql@@ -0,0 +1 @@+ALTER TABLE runtime_profile DROP COLUMN runtime_type;diff --git a/server/migrations/501_runtime_profile_runtime_type.up.sql b/server/migrations/501_runtime_profile_runtime_type.up.sqlnew file mode 100644index 0000000000..55ce7367ad--- /dev/null+++ b/server/migrations/501_runtime_profile_runtime_type.up.sql@@ -0,0 +1,3 @@+-- Empty defaults support older servers writing profiles during rollout.+ALTER TABLE runtime_profile ADD COLUMN runtime_type text NOT NULL DEFAULT '';+UPDATE runtime_profile SET runtime_type = protocol_family;diff --git a/server/pkg/agent/builtin_runtimes.go b/server/pkg/agent/builtin_runtimes.goindex 43fed8437d..717d424b3e 100644--- a/server/pkg/agent/builtin_runtimes.go+++ b/server/pkg/agent/builtin_runtimes.go@@ -71,9 +71,8 @@ type BuiltinRuntime struct {// ModelDiscoveryFunc discovers available models for a runtime identity.// It receives the context and the resolved command — executable plus the-// runtime's launch prefix — and returns a model catalog. When the binary is-// missing or too old, it returns an empty slice (ListModels swallows the-// error and degrades to manual entry).+// runtime's launch prefix — and returns a model catalog. Discovery failures+// propagate to the picker, which shows the reason and supports manual entry.type ModelDiscoveryFunc func(ctx context.Context, runtimeCmd Command) ([]Model, error)// BuiltinRuntimes is the registry of built-in runtime identities that are@@ -185,3 +184,20 @@ func NewRuntime(runtimeID string, cfg Config) (Backend, error) {applicator.applyBuiltinRuntimeOverrides(desc)return backend, nil}++// ProfileRuntimeType preserves profiles authored before runtime identity was stored.+func ProfileRuntimeType(runtimeType, protocolFamily string) string {+ if runtimeType != "" {+ return runtimeType+ }+ return protocolFamily+}++// RuntimeProtocolFamily resolves the compatibility target using the same registry+// as backend construction and model discovery.+func RuntimeProtocolFamily(runtimeType string) (string, bool) {+ if desc, ok := BuiltinRuntimeByID(runtimeType); ok {+ return desc.ProtocolFamily, true+ }+ return runtimeType, IsSupportedType(runtimeType)+}diff --git a/server/pkg/agent/launch.go b/server/pkg/agent/launch.goindex 8248da2f9f..22a26feeb6 100644--- a/server/pkg/agent/launch.go+++ b/server/pkg/agent/launch.go@@ -473,6 +473,9 @@ var launchPrefixBlockedArgs = map[string]map[string]blockedArgMode{// Without it a `--version` probe and a task launch would disagree about what// the runtime's prefix is.func FilterLaunchPrefix(agentType string, prefix []string, logger *slog.Logger) []string {+ if family, ok := RuntimeProtocolFamily(agentType); ok {+ agentType = family+ }return filterLaunchPrefix(prefix, agentType, logger)}diff --git a/server/pkg/agent/models.go b/server/pkg/agent/models.goindex fa29f69d7a..b601341763 100644--- a/server/pkg/agent/models.go+++ b/server/pkg/agent/models.go@@ -1013,7 +1013,7 @@ func discoverPiModelsWithin(ctx context.Context, runtimeCmd Command, rpcTimeout,}lookedUp, err := exec.LookPath(runtimeCmd.Path)if err != nil {- return []Model{}, nil+ return nil, fmt.Errorf("pi model discovery: %w", err)}// Split the established 15-second discovery budget so an RPC surface that// accepts the mode but never answers cannot starve the compatibility table@@ -1216,14 +1216,16 @@ func discoverPiModelsTable(ctx context.Context, runtimeCmd Command) ([]Model, ervar stderr strings.Buildercmd.Stderr = &stderrstdout, err := outputOwned(cmd, runtimeCmd.logger)- if err != nil && len(stdout) == 0 && stderr.Len() == 0 {- return []Model{}, nil- }+text := string(stdout)if strings.TrimSpace(text) == "" {text = stderr.String()}- return parsePiModels(text), nil+ models := parsePiModels(text)+ if len(models) == 0 && err != nil {+ return nil, fmt.Errorf("pi model discovery: RPC probe failed; --list-models: %w: %s", err, strings.TrimSpace(text))+ }+ return models, nil}// parsePiModels accepts the `pi --list-models` output. Pi historically@@ -1341,15 +1343,17 @@ func discoverOmpModels(ctx context.Context, runtimeCmd Command) ([]Model, error)runtimeCmd.Path = "omp"}if _, err := exec.LookPath(runtimeCmd.Path); err != nil {- return []Model{}, nil+ return nil, fmt.Errorf("omp model discovery: %w", err)}runCtx, cancel := context.WithTimeout(ctx, 15*time.Second)defer cancel()cmd := runtimeCmd.exec(runCtx, "models", "--json")hideAgentWindow(cmd)+ var stderr strings.Builder+ cmd.Stderr = &stderrstdout, err := outputOwned(cmd, runtimeCmd.logger)- if err != nil || len(stdout) == 0 {- return []Model{}, nil+ if err != nil {+ return nil, fmt.Errorf("omp models --json: %w: %s", err, strings.TrimSpace(stderr.String()))}return parseOmpModels(stdout)}diff --git a/server/pkg/agent/models_test.go b/server/pkg/agent/models_test.goindex 9b898d91d7..7a7bf7e515 100644--- a/server/pkg/agent/models_test.go+++ b/server/pkg/agent/models_test.go@@ -1877,3 +1877,38 @@ func TestModelSelectorMustBeProviderQualifiedIsAnExecutionContract(t *testing.T)})}}++// This fixture accepts OMP's discovery surface and rejects Pi-only flags (#8379).+func TestCustomOmpCompatibilityTargetDiscovery(t *testing.T) {+ if runtime.GOOS == "windows" {+ t.Skip("POSIX fixture")+ }+ path := filepath.Join(t.TempDir(), "custom-wrapper")+ writeTestExecutable(t, path, []byte(`#!/bin/sh+[ "$1" = "launch" ] || exit 3+shift+if [ "$1 $2" = "models --json" ]; then+ echo '{"models":[{"provider":"commandcode","id":"deepseek/deepseek-v4.1-flash","selector":"commandcode/deepseek/deepseek-v4.1-flash"}]}'+ exit 0+fi+echo "Error: unknown flags: $*" >&2+exit 2+`))+ cmd := NewCommand(path, []string{"launch"})+ if _, err := ListModels(context.Background(), "pi", cmd); err == nil || !strings.Contains(err.Error(), "unknown flags") {+ t.Fatalf("Pi compatibility target must report failed probes, got %v", err)+ }+ catalog, err := ListModels(context.Background(), "omp", cmd)+ if err != nil || len(catalog.Models) != 1 || catalog.Models[0].ID != "commandcode/deepseek/deepseek-v4.1-flash" {+ t.Fatalf("OMP discovery lost selector or command prefix: %+v, %v", catalog, err)+ }+}++func TestOmpProfileLaunchPrefixUsesProtocolBlocklist(t *testing.T) {+ prefix := []string{"launch", "--mode", "text", "--model", "commandcode/deepseek/model"}+ got := FilterLaunchPrefix("omp", prefix, nil)+ want := FilterLaunchPrefix("pi", prefix, nil)+ if strings.Join(got, " ") != strings.Join(want, " ") || len(got) == len(prefix) || got[0] != "launch" {+ t.Fatalf("OMP prefix = %v; Pi prefix = %v", got, want)+ }+}diff --git a/server/pkg/agent/omp_test.go b/server/pkg/agent/omp_test.goindex 65a2ede638..48327b734e 100644--- a/server/pkg/agent/omp_test.go+++ b/server/pkg/agent/omp_test.go@@ -388,7 +388,7 @@ func TestOmpAndPiCanCoexist(t *testing.T) {}// TestDiscoverOmpModelsNonZeroExit verifies that discoverOmpModels returns-// an empty catalog when the omp binary exits non-zero (e.g. an old omp that+// a discovery error when the omp binary exits non-zero (e.g. an old omp that// doesn't support `models --json` and prints usage to stderr). This is the// fake-executable integration test the review asked for.func TestDiscoverOmpModelsNonZeroExit(t *testing.T) {@@ -406,8 +406,8 @@ func TestDiscoverOmpModelsNonZeroExit(t *testing.T) {ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)defer cancel()models, err := discoverOmpModels(ctx, Command{Path: fakePath})- if err != nil {- t.Fatalf("discoverOmpModels: %v", err)+ if err == nil {+ t.Fatal("expected model discovery failure with a reason")}if len(models) != 0 {t.Fatalf("expected 0 models for non-zero-exit omp, got %d", len(models))@@ -415,13 +415,13 @@ func TestDiscoverOmpModelsNonZeroExit(t *testing.T) {}// TestDiscoverOmpModelsMissingBinary verifies that a missing omp binary-// degrades to an empty catalog, not an error.+// reports a discovery error.func TestDiscoverOmpModelsMissingBinary(t *testing.T) {ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)defer cancel()models, err := discoverOmpModels(ctx, Command{Path: "/nonexistent/omp-binary"})- if err != nil {- t.Fatalf("discoverOmpModels: %v", err)+ if err == nil {+ t.Fatal("expected model discovery failure with a reason")}if len(models) != 0 {t.Fatalf("expected 0 models for missing binary, got %d", len(models))diff --git a/server/pkg/db/generated/models.go b/server/pkg/db/generated/models.goindex e68f17864d..54b24b4377 100644--- a/server/pkg/db/generated/models.go+++ b/server/pkg/db/generated/models.go@@ -1253,6 +1253,7 @@ type RuntimeProfile struct {Enabled bool `json:"enabled"`CreatedAt pgtype.Timestamptz `json:"created_at"`UpdatedAt pgtype.Timestamptz `json:"updated_at"`+ RuntimeType string `json:"runtime_type"`}type SeatCapacityOutbox struct {diff --git a/server/pkg/db/generated/runtime.sql.go b/server/pkg/db/generated/runtime.sql.goindex a75d16f9c2..361a2f5cc6 100644--- a/server/pkg/db/generated/runtime.sql.go+++ b/server/pkg/db/generated/runtime.sql.go@@ -1735,9 +1735,9 @@ type UpsertAgentRuntimeWithProfileRow struct {// command_name on PATH and is registering an instance of it. The arbiter is the// partial unique index from migration 120 (WHERE profile_id IS NOT NULL), so a// single daemon can host the built-in provider AND any number of custom-// profiles of the same protocol family. provider stays the protocol family so-// task routing (agent.New(provider)) is unchanged; profile_id is the stable-// identity. (xmax = 0) AS inserted mirrors UpsertAgentRuntime.+// profiles of the same protocol family. provider carries the base runtime+// identity so ResolveBackend applies its descriptor; profile_id preserves+// custom-profile provenance. (xmax = 0) AS inserted mirrors UpsertAgentRuntime.func (q *Queries) UpsertAgentRuntimeWithProfile(ctx context.Context, arg UpsertAgentRuntimeWithProfileParams) (UpsertAgentRuntimeWithProfileRow, error) {row := q.db.QueryRow(ctx, upsertAgentRuntimeWithProfile,arg.WorkspaceID,diff --git a/server/pkg/db/generated/runtime_profile.sql.go b/server/pkg/db/generated/runtime_profile.sql.goindex 2dbdc6447c..d3a72d2e21 100644--- a/server/pkg/db/generated/runtime_profile.sql.go+++ b/server/pkg/db/generated/runtime_profile.sql.go@@ -22,9 +22,10 @@ INSERT INTO runtime_profile (fixed_args,visibility,created_by,- enabled-) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)-RETURNING id, workspace_id, display_name, protocol_family, command_name, description, fixed_args, visibility, created_by, enabled, created_at, updated_at+ enabled,+ runtime_type+) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)+RETURNING id, workspace_id, display_name, protocol_family, command_name, description, fixed_args, visibility, created_by, enabled, created_at, updated_at, runtime_type`type CreateRuntimeProfileParams struct {@@ -37,6 +38,7 @@ type CreateRuntimeProfileParams struct {Visibility string `json:"visibility"`CreatedBy pgtype.UUID `json:"created_by"`Enabled bool `json:"enabled"`+ RuntimeType string `json:"runtime_type"`}// Custom Runtime profiles (MUL-3284). Workspace-level definitions of a custom@@ -53,6 +55,7 @@ func (q *Queries) CreateRuntimeProfile(ctx context.Context, arg CreateRuntimeProarg.Visibility,arg.CreatedBy,arg.Enabled,+ arg.RuntimeType,)var i RuntimeProfileerr := row.Scan(@@ -68,6 +71,7 @@ func (q *Queries) CreateRuntimeProfile(ctx context.Context, arg CreateRuntimePro&i.Enabled,&i.CreatedAt,&i.UpdatedAt,+ &i.RuntimeType,)return i, err}@@ -137,7 +141,7 @@ func (q *Queries) DeleteRuntimeProfile(ctx context.Context, arg DeleteRuntimePro}const getRuntimeProfile = `-- name: GetRuntimeProfile :one-SELECT id, workspace_id, display_name, protocol_family, command_name, description, fixed_args, visibility, created_by, enabled, created_at, updated_at FROM runtime_profile+SELECT id, workspace_id, display_name, protocol_family, command_name, description, fixed_args, visibility, created_by, enabled, created_at, updated_at, runtime_type FROM runtime_profileWHERE id = $1`@@ -157,12 +161,13 @@ func (q *Queries) GetRuntimeProfile(ctx context.Context, id pgtype.UUID) (Runtim&i.Enabled,&i.CreatedAt,&i.UpdatedAt,+ &i.RuntimeType,)return i, err}const getRuntimeProfileForWorkspace = `-- name: GetRuntimeProfileForWorkspace :one-SELECT id, workspace_id, display_name, protocol_family, command_name, description, fixed_args, visibility, created_by, enabled, created_at, updated_at FROM runtime_profile+SELECT id, workspace_id, display_name, protocol_family, command_name, description, fixed_args, visibility, created_by, enabled, created_at, updated_at, runtime_type FROM runtime_profileWHERE id = $1 AND workspace_id = $2`@@ -187,6 +192,7 @@ func (q *Queries) GetRuntimeProfileForWorkspace(ctx context.Context, arg GetRunt&i.Enabled,&i.CreatedAt,&i.UpdatedAt,+ &i.RuntimeType,)return i, err}@@ -371,7 +377,7 @@ func (q *Queries) ListAgentRuntimeIDsByProfile(ctx context.Context, arg ListAgen}const listEnabledRuntimeProfilesForWorkspace = `-- name: ListEnabledRuntimeProfilesForWorkspace :many-SELECT id, workspace_id, display_name, protocol_family, command_name, description, fixed_args, visibility, created_by, enabled, created_at, updated_at FROM runtime_profile+SELECT id, workspace_id, display_name, protocol_family, command_name, description, fixed_args, visibility, created_by, enabled, created_at, updated_at, runtime_type FROM runtime_profileWHERE workspace_id = $1 AND enabled = trueORDER BY created_at ASC`@@ -400,6 +406,7 @@ func (q *Queries) ListEnabledRuntimeProfilesForWorkspace(ctx context.Context, wo&i.Enabled,&i.CreatedAt,&i.UpdatedAt,+ &i.RuntimeType,); err != nil {return nil, err}@@ -412,7 +419,7 @@ func (q *Queries) ListEnabledRuntimeProfilesForWorkspace(ctx context.Context, wo}const listRuntimeProfiles = `-- name: ListRuntimeProfiles :many-SELECT id, workspace_id, display_name, protocol_family, command_name, description, fixed_args, visibility, created_by, enabled, created_at, updated_at FROM runtime_profile+SELECT id, workspace_id, display_name, protocol_family, command_name, description, fixed_args, visibility, created_by, enabled, created_at, updated_at, runtime_type FROM runtime_profileWHERE workspace_id = $1ORDER BY created_at ASC`@@ -439,6 +446,7 @@ func (q *Queries) ListRuntimeProfiles(ctx context.Context, workspaceID pgtype.UU&i.Enabled,&i.CreatedAt,&i.UpdatedAt,+ &i.RuntimeType,); err != nil {return nil, err}@@ -451,7 +459,7 @@ func (q *Queries) ListRuntimeProfiles(ctx context.Context, workspaceID pgtype.UU}const lockRuntimeProfileForDelete = `-- name: LockRuntimeProfileForDelete :one-SELECT id, workspace_id, display_name, protocol_family, command_name, description, fixed_args, visibility, created_by, enabled, created_at, updated_at FROM runtime_profile+SELECT id, workspace_id, display_name, protocol_family, command_name, description, fixed_args, visibility, created_by, enabled, created_at, updated_at, runtime_type FROM runtime_profileWHERE id = $1 AND workspace_id = $2FOR UPDATE`@@ -479,12 +487,13 @@ func (q *Queries) LockRuntimeProfileForDelete(ctx context.Context, arg LockRunti&i.Enabled,&i.CreatedAt,&i.UpdatedAt,+ &i.RuntimeType,)return i, err}const lockRuntimeProfileForRegistration = `-- name: LockRuntimeProfileForRegistration :one-SELECT id, workspace_id, display_name, protocol_family, command_name, description, fixed_args, visibility, created_by, enabled, created_at, updated_at FROM runtime_profile+SELECT id, workspace_id, display_name, protocol_family, command_name, description, fixed_args, visibility, created_by, enabled, created_at, updated_at, runtime_type FROM runtime_profileWHERE id = $1 AND workspace_id = $2FOR KEY SHARE`@@ -514,6 +523,7 @@ func (q *Queries) LockRuntimeProfileForRegistration(ctx context.Context, arg Loc&i.Enabled,&i.CreatedAt,&i.UpdatedAt,+ &i.RuntimeType,)return i, err}@@ -528,7 +538,7 @@ SET display_name = COALESCE($1, display_name),enabled = COALESCE($6, enabled),updated_at = now()WHERE id = $7 AND workspace_id = $8-RETURNING id, workspace_id, display_name, protocol_family, command_name, description, fixed_args, visibility, created_by, enabled, created_at, updated_at+RETURNING id, workspace_id, display_name, protocol_family, command_name, description, fixed_args, visibility, created_by, enabled, created_at, updated_at, runtime_type`type UpdateRuntimeProfileParams struct {@@ -571,6 +581,7 @@ func (q *Queries) UpdateRuntimeProfile(ctx context.Context, arg UpdateRuntimePro&i.Enabled,&i.CreatedAt,&i.UpdatedAt,+ &i.RuntimeType,)return i, err}diff --git a/server/pkg/db/queries/runtime.sql b/server/pkg/db/queries/runtime.sqlindex 081b71b192..f38213541a 100644--- a/server/pkg/db/queries/runtime.sql+++ b/server/pkg/db/queries/runtime.sql@@ -97,9 +97,9 @@ RETURNING *, (xmax = 0) AS inserted;-- command_name on PATH and is registering an instance of it. The arbiter is the-- partial unique index from migration 120 (WHERE profile_id IS NOT NULL), so a-- single daemon can host the built-in provider AND any number of custom--- profiles of the same protocol family. provider stays the protocol family so--- task routing (agent.New(provider)) is unchanged; profile_id is the stable--- identity. (xmax = 0) AS inserted mirrors UpsertAgentRuntime.+-- profiles of the same protocol family. provider carries the base runtime+-- identity so ResolveBackend applies its descriptor; profile_id preserves+-- custom-profile provenance. (xmax = 0) AS inserted mirrors UpsertAgentRuntime.INSERT INTO agent_runtime (workspace_id,daemon_id,diff --git a/server/pkg/db/queries/runtime_profile.sql b/server/pkg/db/queries/runtime_profile.sqlindex 84691d19fb..e6a86e591b 100644--- a/server/pkg/db/queries/runtime_profile.sql+++ b/server/pkg/db/queries/runtime_profile.sql@@ -12,8 +12,9 @@ INSERT INTO runtime_profile (fixed_args,visibility,created_by,- enabled-) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)+ enabled,+ runtime_type+) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)RETURNING *;-- name: GetRuntimeProfile :one