diff --git a/console/src/main.ts b/console/src/main.ts index 6d81158..814f81e 100644 --- a/console/src/main.ts +++ b/console/src/main.ts @@ -219,11 +219,22 @@ async function refreshRemote(): Promise { if (!remoteEl) return; try { remoteConfig = await source.remoteConfig(); - renderRemote(remoteEl, remoteConfig); + // The panel labels the file "Edit config" opens — the registry + // (`agents.toml`), not the deprecated `remote.toml`. Load it best-effort so a + // registry read error never blanks the connection panel; a later edit/save + // refreshes the cache. + if (!registryConfig) { + try { + registryConfig = await source.registryConfig(); + } catch { + /* no path label until it loads — better than mislabelling remote.toml */ + } + } + renderRemote(remoteEl, remoteConfig, registryConfig?.path); } catch (e) { note("error", `config: remote load failed — ${errText(e)}`); remoteConfig = null; - renderRemote(remoteEl, null); + renderRemote(remoteEl, null, registryConfig?.path); } } @@ -655,7 +666,7 @@ async function bindRemoteStatus(): Promise { // The legacy remote panel shows only the management connection's status. if (agent === managementName && remoteConfig) { remoteConfig = { ...remoteConfig, status }; - if (remoteEl) renderRemote(remoteEl, remoteConfig); + if (remoteEl) renderRemote(remoteEl, remoteConfig, registryConfig?.path); } // Route the live state to the owning chat panel — it re-enables its input on // `connected` and, on a mid-turn drop, closes the open turn so it doesn't diff --git a/console/src/render.test.ts b/console/src/render.test.ts index 5749a31..214832b 100644 --- a/console/src/render.test.ts +++ b/console/src/render.test.ts @@ -330,6 +330,24 @@ describe("remoteHtml", () => { ); }); + it("labels the registry path (agents.toml) that Edit config opens, not remote.toml", () => { + const html = remoteHtml( + { ...FIXTURE_REMOTE_CONFIG, path: "~/.config/oab-studio/remote.toml" }, + "~/.config/oab-studio/agents.toml", + ); + expect(html).toContain("agents.toml"); + expect(html).not.toContain("remote.toml"); + }); + + it("omits the path label when no registry path is known (no mislabel)", () => { + const html = remoteHtml({ + ...FIXTURE_REMOTE_CONFIG, + path: "~/.config/oab-studio/remote.toml", + }); + expect(html).not.toContain("cfg-path"); + expect(html).not.toContain("remote.toml"); + }); + it("renders an unavailable state for null", () => { expect(remoteHtml(null)).toContain("remote connection unavailable"); }); diff --git a/console/src/render.ts b/console/src/render.ts index b71aede..a2ff99d 100644 --- a/console/src/render.ts +++ b/console/src/render.ts @@ -256,8 +256,10 @@ export function renderFleetConfig( // ---- Remote reverse-MCP connection panel (Part B) --------------------------- // The "activate the remote connection" surface: the /acp endpoint, live status, -// an explicit Activate/Disconnect button, and Edit config (the same editor as -// fleets.toml, over remote.toml). +// an explicit Activate/Disconnect button, and Edit config. Since #69 the editor +// opens the registry (`agents.toml`, the source of truth), not the deprecated +// `remote.toml`, so the panel labels the registry path — passed in, since it +// lives in a different view-model (`RegistryConfig`) than the connection view. const REMOTE_STATUS_CLASS: Record = { connected: "rm-connected", @@ -274,8 +276,13 @@ function remoteStatusBadge(status: string): string { // Pure: the remote-connection view -> the panel HTML. `null` renders an // unavailable state. The button is Disconnect while connected/connecting, else -// Activate — disabled until a URL + token are configured. -export function remoteHtml(view: RemoteConfig | null): string { +// Activate — disabled until a URL + token are configured. `registryPath` is the +// `agents.toml` path "Edit config" opens; omitted/empty ⇒ the path label is +// hidden (better than labelling a file the button no longer edits). +export function remoteHtml( + view: RemoteConfig | null, + registryPath?: string | null, +): string { if (!view) { return `
remote connection unavailable
`; } @@ -286,8 +293,8 @@ export function remoteHtml(view: RemoteConfig | null): string { const target = view.configured ? `${escapeHtml(view.url)}` : `not configured — set url + token in the config`; - const path = view.path - ? `${escapeHtml(view.path)}` + const path = registryPath + ? `${escapeHtml(registryPath)}` : ""; return `
@@ -303,8 +310,12 @@ export function remoteHtml(view: RemoteConfig | null): string {
`; } -export function renderRemote(el: HTMLElement, view: RemoteConfig | null): void { - el.innerHTML = remoteHtml(view); +export function renderRemote( + el: HTMLElement, + view: RemoteConfig | null, + registryPath?: string | null, +): void { + el.innerHTML = remoteHtml(view, registryPath); } // ---- Agent consoles (ADR agent-consoles, Parts B/C) --------------------------