Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.
Python agent-orchestrationaiai-agentschatopsdiscordlangchainmcpmicrosoft-teamsmulti-agentopen-sourceopenaiself-hostedslack
Switch Console: remove the dead UI and RPC surface (CHOO-2323) (#526)
Christian McDermotta845fafdc6bd
diff --git a/console/apps/switch-console-desktop/src/main/core/agents/controller.ts b/console/apps/switch-console-desktop/src/main/core/agents/controller.tsindex 32d894c96..952451f5c 100644--- a/console/apps/switch-console-desktop/src/main/core/agents/controller.ts+++ b/console/apps/switch-console-desktop/src/main/core/agents/controller.ts@@ -1,5 +1,4 @@import type { RepoAgentAttributes } from '@switch-console/core/agents/plugins';-import type { CreateAgentParams, RenameAgentParams } from '@shared/core/agents/agents';import type { OnboardAgentParams } from '@shared/core/agents/onboarding';import type { AgentProviderId } from '@shared/core/providers/agent-provider-registry';import type { AgentVerifyResult } from '@shared/core/switch-servers/switch-servers';@@ -16,30 +15,24 @@ import {readAgentTemplateOrigin,setAgentInstructions,} from './agent-config';-import { readAgentDefinition, updateAgentDefinition } from './agent-definition';import { getAgentModelCatalogue, getProviderReadiness } from './agent-model-catalogue';import { assignAgentServer } from './assignAgentServer';import {attachConfiguredAgents,type AttachConfiguredAgentsParams,} from './attach-configured-agents';-import { createAgent } from './createAgent';import { getAgentDefinitionFields } from './definition-fields';import { deleteAgent, type DeleteAgentOptions } from './deleteAgent';-import { discoverConfiguredAgents } from './discover-configured-agents';import {discoverLoadableAgentsInDir,discoverLoadableAgentsOnHost,type DiscoverLoadableAgentsParams,} from './discover-loadable-agents';-import { discoverLocationAgents } from './discover-location-agents';import { getAgentById } from './getAgentById';import { getAgents } from './getAgents';import { onboardAgent } from './onboard-agent';-import { onboardLocationAgents, type OnboardLocationParams } from './onboard-location-agents';import type { RemoveLoadableAgentConfigParams } from './remove-loadable-agent-config';import { removeLoadableAgentConfig } from './remove-loadable-agent-config';-import { renameAgent } from './renameAgent';import { resetRemoteAgent } from './reset-remote-agent';import { setAgentAutoApprove, type AgentAutoApproveParams } from './setAgentAutoApprove';import {@@ -47,17 +40,11 @@ import {setAgentAutoSession,type AgentAutoSessionParams,} from './setAgentAutoSession';-import { setAgentProviderConfig, type AgentProviderConfigParams } from './setAgentProviderConfig';-import { updateAgent, type UpdateAgentParams } from './updateAgent';export const agentsController = createRPCController({- createAgent: (params: CreateAgentParams) => createAgent(params),addAgent: (params: AddAgentParams) => addAgent(params),definitionFields: (params: { providerId: AgentProviderId }) =>Promise.resolve(getAgentDefinitionFields(params.providerId)),- readAgentDefinition: (params: { agentId: string }) => readAgentDefinition(params.agentId),- updateAgentDefinition: (params: { agentId: string; attributes: RepoAgentAttributes }) =>- updateAgentDefinition(params),/*** The per-agent advanced configuration, wherever the provider keeps it —* a repo-agent definition (Claude) or a launch profile (Codex). One form,@@ -93,15 +80,6 @@ export const agentsController = createRPCController({updateAdvancedConfig: (params: { agentId: string; attributes: RepoAgentAttributes }) =>updateAgentAdvancedConfig(params),onboardAgent: (params: OnboardAgentParams) => onboardAgent(params),- onboardLocationAgents: (params: OnboardLocationParams) => onboardLocationAgents(params),- discoverLocationAgents: (params: {- sshHost: string | null;- dir: string;- providerId: AgentProviderId;- serverId: string;- }) => discoverLocationAgents(params),- discoverConfiguredAgents: (params: { sshHost: string | null; dir: string; serverId: string }) =>- discoverConfiguredAgents(params),discoverLoadableAgentsOnHost: (params: DiscoverLoadableAgentsParams) =>discoverLoadableAgentsOnHost(params),discoverLoadableAgentsInDir: (params: { sshHost: string; dir: string; serverId: string }) =>@@ -111,7 +89,6 @@ export const agentsController = createRPCController({removeLoadableAgentConfig(params),getAgents: (locationId?: string) => getAgents(locationId),getAgentById: (agentId: string) => getAgentById(agentId),- renameAgent: (params: RenameAgentParams) => renameAgent(params),deleteAgent: (params: { agentId: string } & DeleteAgentOptions) =>deleteAgent(params.agentId, {deleteInSwitch: params.deleteInSwitch,@@ -119,15 +96,12 @@ export const agentsController = createRPCController({trigger: params.trigger,}),resetRemoteAgent: (params: { agentId: string }) => resetRemoteAgent(params.agentId),- updateAgent: (params: UpdateAgentParams) => updateAgent(params),assignServer: (params: { agentId: string; serverId: string }): Promise<AgentVerifyResult> =>assignAgentServer(params),setAgentAutoSession: (params: AgentAutoSessionParams): Promise<void> =>setAgentAutoSession(params),setAgentAutoApprove: (params: AgentAutoApproveParams): Promise<void> =>setAgentAutoApprove(params),- setAgentProviderConfig: (params: AgentProviderConfigParams): Promise<void> =>- setAgentProviderConfig(params),getAgentAutoSession: (params: { agentId: string }): Promise<boolean> =>getAgentAutoSession(params),});diff --git a/console/apps/switch-console-desktop/src/main/core/agents/createAgent.ts b/console/apps/switch-console-desktop/src/main/core/agents/createAgent.tsindex 8cdebcabb..d6a28b0c3 100644--- a/console/apps/switch-console-desktop/src/main/core/agents/createAgent.ts+++ b/console/apps/switch-console-desktop/src/main/core/agents/createAgent.ts@@ -4,6 +4,13 @@ import { agents } from '@main/db/schema';import type { Agent, CreateAgentParams } from '@shared/core/agents/agents';import { mapAgentRowToAgent } from './utils';+/**+ * Insert an agent row. Main-process internal, and deliberately not an RPC+ * method: it validates nothing and emits no `agent:created`, so a row made+ * this way is one the rest of the app never hears about. Callers come in+ * through `addAgent`, `onboardAgent`, `attachConfiguredAgents` or+ * `adoptSubagent`, which own the checks and the lifecycle event.+ */export async function createAgent(params: CreateAgentParams): Promise<Agent> {const [row] = await db.insert(agents)diff --git a/console/apps/switch-console-desktop/src/main/core/app/controller.ts b/console/apps/switch-console-desktop/src/main/core/app/controller.tsindex d34c171a7..3b51cb81c 100644--- a/console/apps/switch-console-desktop/src/main/core/app/controller.ts+++ b/console/apps/switch-console-desktop/src/main/core/app/controller.ts@@ -12,33 +12,6 @@ export const appController = createRPCController({return { success: false, error: error instanceof Error ? error.message : String(error) };}},- openPath: async (path: string) => {- try {- await appService.openPath(path);- return { success: true };- } catch (error) {- return { success: false, error: error instanceof Error ? error.message : String(error) };- }- },- readUserFile: async (path: string) => {- try {- const result = await appService.readUserFile(path);- return { success: true as const, ...result };- } catch (error) {- return {- success: false as const,- error: error instanceof Error ? error.message : String(error),- };- }- },- clipboardWriteText: async (text: string) => {- try {- appService.clipboardWriteText(text);- return { success: true };- } catch (error) {- return { success: false, error: error instanceof Error ? error.message : String(error) };- }- },quit: () => {try {appService.quit();@@ -79,7 +52,6 @@ export const appController = createRPCController({}},getAppVersion: () => appService.getCachedAppVersion(),- getElectronVersion: () => process.versions.electron,getPlatform: () => process.platform,getDiagnosticLogAttachment,});diff --git a/console/apps/switch-console-desktop/src/main/core/app/service.ts b/console/apps/switch-console-desktop/src/main/core/app/service.tsindex bc83bafd3..3239e4a2d 100644--- a/console/apps/switch-console-desktop/src/main/core/app/service.ts+++ b/console/apps/switch-console-desktop/src/main/core/app/service.ts@@ -1,9 +1,9 @@import { exec } from 'node:child_process';import { readFile, realpath, stat, writeFile } from 'node:fs/promises';import { homedir } from 'node:os';-import { extname, isAbsolute, join, resolve, sep } from 'node:path';+import { extname, resolve, sep } from 'node:path';import type { IDisposable, IInitializable } from '@switch-console/shared';-import { app, clipboard, dialog, shell } from 'electron';+import { app, dialog, shell } from 'electron';import { getMainWindow } from '@main/app/window';import { events } from '@main/lib/events';import { log } from '@main/lib/logger';@@ -41,24 +41,6 @@ const AUDIO_MIME_TYPES: Record<string, string> = {'.webm': 'audio/webm',};-function expandAbsoluteOrTildePath(rawPath: string): string {- if (!rawPath || typeof rawPath !== 'string') throw new Error('Invalid path');- const expanded = rawPath.startsWith('~/') ? join(homedir(), rawPath.slice(2)) : rawPath;- if (!isAbsolute(expanded)) throw new Error('Path must be absolute or start with ~/');- return expanded;-}--async function resolveHomeJailedPath(rawPath: string): Promise<string> {- const expanded = expandAbsoluteOrTildePath(rawPath);- const realPath = await realpath(expanded);- const realHome = await realpath(homedir());- const realHomeWithSep = realHome.endsWith(sep) ? realHome : realHome + sep;- if (realPath !== realHome && !realPath.startsWith(realHomeWithSep)) {- throw new Error('Path must be inside the user home directory');- }- return realPath;-}-class AppService implements IInitializable, IDisposable {private cachedAppVersion: string | null = null;private cachedAppVersionPromise: Promise<string> | null = null;@@ -195,32 +177,6 @@ class AppService implements IInitializable, IDisposable {await shell.openExternal(url);}- async openPath(rawPath: string): Promise<void> {- const realPath = await resolveHomeJailedPath(rawPath);- const errorMessage = await shell.openPath(realPath);- if (errorMessage) throw new Error(errorMessage);- }-- /**- * Restricted to the user home directory: terminal output drives these reads,- * and AI-injected paths must not be a vector for reading e.g. `/etc/passwd`.- * Symlinks are resolved before the home-jail check so they can't escape.- */- async readUserFile(rawPath: string, maxBytes = 1_048_576): Promise<{ content: string }> {- const realPath = await resolveHomeJailedPath(rawPath);- const stats = await stat(realPath);- if (stats.size > maxBytes) {- throw new Error(`File too large (${stats.size} bytes, max ${maxBytes})`);- }- const buffer = await readFile(realPath);- return { content: buffer.toString('utf8') };- }-- clipboardWriteText(text: string): void {- if (typeof text !== 'string') throw new Error('Invalid clipboard text');- clipboard.writeText(text);- }-quit(): void {app.quit();}diff --git a/console/apps/switch-console-desktop/src/main/core/locations/controller.ts b/console/apps/switch-console-desktop/src/main/core/locations/controller.tsindex 4f0323b82..87d2687d2 100644--- a/console/apps/switch-console-desktop/src/main/core/locations/controller.ts+++ b/console/apps/switch-console-desktop/src/main/core/locations/controller.ts@@ -1,7 +1,6 @@import { createRPCController } from '@shared/lib/ipc/rpc';import { inspectLocationPath } from './operations/inspect-location-path';import { openLocation } from './operations/open-location';-import { countLocationsUsingGithubAccount } from './settings/count-locations-using-github-account';import { locationSettingsService } from './settings/location-settings-service';import { getLocations } from './store';@@ -13,11 +12,8 @@ export const locationsController = createRPCController({locationSettingsService.getLocationSettingsPage(locationId),updateLocationSettings: (locationId, settings) =>locationSettingsService.updateLocationSettings(locationId, settings),- patchLocationSettings: (locationId, patch) =>- locationSettingsService.patchLocationSettings(locationId, patch),shareLocationSettingsToConfig: (locationId, request) =>locationSettingsService.shareLocationSettingsToConfig(locationId, request),migrateLocationConfig: (locationId, request) =>locationSettingsService.migrateLocationConfig(locationId, request),- countLocationsUsingGithubAccount,});diff --git a/console/apps/switch-console-desktop/src/main/core/locations/location-runtime-settings-controller.ts b/console/apps/switch-console-desktop/src/main/core/locations/location-runtime-settings-controller.tsdeleted file mode 100644index 0db6d3851..000000000--- a/console/apps/switch-console-desktop/src/main/core/locations/location-runtime-settings-controller.ts+++ /dev/null@@ -1,20 +0,0 @@-import { locationRuntimeRegistry } from '@main/core/locations/location-runtime-registry';-import { getEffectiveSessionSettings } from '@main/core/locations/settings/effective-session-settings';-import type { LocationSettings } from '@shared/core/location-settings/location-settings';-import { createRPCController } from '@shared/lib/ipc/rpc';--async function getSettings(locationId: string): Promise<LocationSettings> {- const runtime = locationRuntimeRegistry.get(locationId);- if (!runtime) {- throw new Error(`No live runtime for location ${locationId}`);- }-- return getEffectiveSessionSettings({- locationSettings: runtime.settings,- sessionFs: runtime.fs,- });-}--export const locationRuntimeSettingsController = createRPCController({- getSettings,-});diff --git a/console/apps/switch-console-desktop/src/main/core/locations/settings/count-locations-using-github-account.db.test.ts b/console/apps/switch-console-desktop/src/main/core/locations/settings/count-locations-using-github-account.db.test.tsdeleted file mode 100644index 2c28ed957..000000000--- a/console/apps/switch-console-desktop/src/main/core/locations/settings/count-locations-using-github-account.db.test.ts+++ /dev/null@@ -1,99 +0,0 @@-import { openFixture } from '@tooling/utils/db';-import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';-import type { AppDb } from '@main/db/client';-import { locations, locationSettings } from '@main/db/schema';-import { countLocationsUsingGithubAccount } from './count-locations-using-github-account';--const mocks = vi.hoisted(() => ({- db: undefined as AppDb | undefined,-}));--vi.mock('@main/db/client', () => ({- get db() {- if (!mocks.db) throw new Error('Test database not initialized');- return mocks.db;- },-}));--const TARGET_ACCOUNT_ID = 'github.com:42';-const OTHER_ACCOUNT_ID = 'github.com:99';--function baseSettingsJson(githubAccountId?: string | null): string {- const settings: Record<string, unknown> = {- defaultBranch: 'main',- baseRemote: 'origin',- };- if (githubAccountId !== undefined) {- settings.githubAccountId = githubAccountId;- }- return JSON.stringify(settings);-}--describe('countLocationsUsingGithubAccount', () => {- let fixture: Awaited<ReturnType<typeof openFixture>>;-- beforeEach(async () => {- fixture = await openFixture('empty');- mocks.db = fixture.db;- });-- afterEach(() => {- fixture.close();- mocks.db = undefined;- });-- it('counts only persisted locations pinned to the target account', async () => {- await fixture.db.insert(locations).values([- { id: 'loc-match-1', name: 'Match 1', sshHost: '', dir: '/repo/match-1' },- { id: 'loc-match-2', name: 'Match 2', sshHost: '', dir: '/repo/match-2' },- { id: 'loc-null', name: 'Null', sshHost: '', dir: '/repo/null' },- { id: 'loc-other', name: 'Other', sshHost: '', dir: '/repo/other' },- { id: 'loc-unconfigured', name: 'Unconfigured', sshHost: '', dir: '/repo/unconfigured' },- ]);- await fixture.db.insert(locationSettings).values([- {- locationId: 'loc-match-1',- baseSettingsJson: baseSettingsJson(TARGET_ACCOUNT_ID),- },- {- locationId: 'loc-match-2',- baseSettingsJson: baseSettingsJson(` ${TARGET_ACCOUNT_ID} `),- },- {- locationId: 'loc-null',- baseSettingsJson: baseSettingsJson(null),- },- {- locationId: 'loc-other',- baseSettingsJson: baseSettingsJson(OTHER_ACCOUNT_ID),- },- {- locationId: 'loc-unconfigured',- baseSettingsJson: baseSettingsJson(),- },- ]);-- await expect(countLocationsUsingGithubAccount(TARGET_ACCOUNT_ID)).resolves.toBe(2);- await expect(countLocationsUsingGithubAccount(OTHER_ACCOUNT_ID)).resolves.toBe(1);- await expect(countLocationsUsingGithubAccount('github.com:missing')).resolves.toBe(0);- });-- it('skips malformed base settings JSON', async () => {- await fixture.db.insert(locations).values([- { id: 'loc-malformed', name: 'Malformed', sshHost: '', dir: '/repo/malformed' },- { id: 'loc-valid', name: 'Valid', sshHost: '', dir: '/repo/valid' },- ]);- await fixture.db.insert(locationSettings).values([- {- locationId: 'loc-malformed',- baseSettingsJson: '{not-json',- },- {- locationId: 'loc-valid',- baseSettingsJson: baseSettingsJson(TARGET_ACCOUNT_ID),- },- ]);-- await expect(countLocationsUsingGithubAccount(TARGET_ACCOUNT_ID)).resolves.toBe(1);- });-});diff --git a/console/apps/switch-console-desktop/src/main/core/locations/settings/count-locations-using-github-account.ts b/console/apps/switch-console-desktop/src/main/core/locations/settings/count-locations-using-github-account.tsdeleted file mode 100644index bb30e820c..000000000--- a/console/apps/switch-console-desktop/src/main/core/locations/settings/count-locations-using-github-account.ts+++ /dev/null@@ -1,33 +0,0 @@-import { db } from '@main/db/client';-import { locationSettings as locationSettingsTable } from '@main/db/schema';-import { parseJsonObject } from './location-settings-json';--function readPinnedGithubAccountId(raw: string): string | undefined {- try {- const parsed = parseJsonObject(raw) as Record<string, unknown>;- const value = parsed.githubAccountId;- if (typeof value !== 'string') return undefined;- const trimmed = value.trim();- return trimmed.length > 0 ? trimmed : undefined;- } catch {- return undefined;- }-}--export async function countLocationsUsingGithubAccount(accountId: string): Promise<number> {- const targetAccountId = accountId.trim();- if (!targetAccountId) return 0;-- const rows = db- .select({ baseSettingsJson: locationSettingsTable.baseSettingsJson })- .from(locationSettingsTable)- .all();-- let count = 0;- for (const row of rows) {- if (readPinnedGithubAccountId(row.baseSettingsJson) === targetAccountId) {- count += 1;- }- }- return count;-}diff --git a/console/apps/switch-console-desktop/src/main/core/prompt-library/controller.ts b/console/apps/switch-console-desktop/src/main/core/prompt-library/controller.tsdeleted file mode 100644index 56c0f588e..000000000--- a/console/apps/switch-console-desktop/src/main/core/prompt-library/controller.ts+++ /dev/null@@ -1,9 +0,0 @@-import { createRPCController } from '@shared/lib/ipc/rpc';-import { type PromptLibraryPrompt } from '@shared/prompt-library';-import { promptLibraryService } from './service';--export const promptLibraryController = createRPCController({- get: (): Promise<PromptLibraryPrompt[]> => promptLibraryService.getPrompts(),- update: (prompts: PromptLibraryPrompt[]): Promise<void> =>- promptLibraryService.updatePrompts(prompts),-});diff --git a/console/apps/switch-console-desktop/src/main/core/prompt-library/service.ts b/console/apps/switch-console-desktop/src/main/core/prompt-library/service.tsdeleted file mode 100644index 99024d57d..000000000--- a/console/apps/switch-console-desktop/src/main/core/prompt-library/service.ts+++ /dev/null@@ -1,130 +0,0 @@-import type { IInitializable } from '@switch-console/shared';-import { eq } from 'drizzle-orm';-import { db } from '@main/db/client';-import { KV } from '@main/db/kv';-import { appSettings } from '@main/db/schema';-import {- DEFAULT_PROMPT_LIBRARY,- PROMPT_LIBRARY_SEED_VERSION,- promptLibrarySchema,- type PromptLibraryPrompt,-} from '@shared/prompt-library';--type PromptLibraryKV = {- prompts: PromptLibraryPrompt[];- seedVersion: number;-};--const promptLibraryKV = new KV<PromptLibraryKV>('prompt-library');--export class PromptLibraryService implements IInitializable {- private seedPromise: Promise<void> | null = null;-- private async readPrompts(): Promise<PromptLibraryPrompt[]> {- const prompts = await promptLibraryKV.get('prompts');- const parsed = promptLibrarySchema.safeParse(prompts ?? []);- return parsed.success ? parsed.data : [];- }-- private async readLegacyAppSetting(key: string): Promise<unknown | null> {- const rows = await db- .select({ value: appSettings.value })- .from(appSettings)- .where(eq(appSettings.key, key))- .limit(1);- const raw = rows[0]?.value;- if (!raw) return null;-- try {- return JSON.parse(raw) as unknown;- } catch {- return null;- }- }-- private async deleteLegacyPromptSettings(): Promise<void> {- await db.delete(appSettings).where(eq(appSettings.key, 'promptLibrary'));- await db.delete(appSettings).where(eq(appSettings.key, 'promptLibrarySeedVersion'));- await db.delete(appSettings).where(eq(appSettings.key, 'reviewPrompt'));- }-- private async seedIfNeeded(): Promise<void> {- if (this.seedPromise) return this.seedPromise;-- this.seedPromise = (async () => {- const seedVersion = await promptLibraryKV.get('seedVersion');- if ((seedVersion ?? 0) >= PROMPT_LIBRARY_SEED_VERSION) {- await this.deleteLegacyPromptSettings();- return;- }-- const existingPrompts = await this.readPrompts();- const legacyPromptLibrary = promptLibrarySchema.safeParse(- await this.readLegacyAppSetting('promptLibrary')- );- const legacyReviewPrompt = await this.readLegacyAppSetting('reviewPrompt');- const prompts = [...existingPrompts];- if (legacyPromptLibrary.success) {- for (const legacyPrompt of legacyPromptLibrary.data) {- if (!prompts.some((prompt) => prompt.id === legacyPrompt.id)) {- prompts.push(legacyPrompt);- }- }- }- const defaultPrompts = DEFAULT_PROMPT_LIBRARY.map((prompt) =>- prompt.id === 'review-prompt' && typeof legacyReviewPrompt === 'string'- ? { ...prompt, prompt: legacyReviewPrompt }- : prompt- );- const missingSeedPrompts = defaultPrompts.filter(- (seedPrompt) => !prompts.some((prompt) => prompt.id === seedPrompt.id)- );- const nextPrompts = [...missingSeedPrompts, ...prompts];-- if (nextPrompts.length > 0) {- await promptLibraryKV.set('prompts', nextPrompts);- }- await promptLibraryKV.set('seedVersion', PROMPT_LIBRARY_SEED_VERSION);- await this.deleteLegacyPromptSettings();- })().finally(() => {- this.seedPromise = null;- });-- await this.seedPromise;- }-- async initialize(): Promise<void> {- await this.seedIfNeeded();- }-- async getPrompts(): Promise<PromptLibraryPrompt[]> {- await this.seedIfNeeded();- return this.readPrompts();- }-- async updatePrompts(prompts: PromptLibraryPrompt[]): Promise<void> {- const validated = promptLibrarySchema.parse(prompts);- await promptLibraryKV.set('prompts', validated);- }-- async upsertReviewPrompt(prompt: string): Promise<void> {- const trimmedPrompt = prompt.trim();- if (!trimmedPrompt) return;-- await this.seedIfNeeded();- const prompts = await this.readPrompts();- const reviewPrompt = {- id: 'review-prompt',- title: 'Review prompt',- prompt: trimmedPrompt,- };- const exists = prompts.some((item) => item.id === reviewPrompt.id);- const nextPrompts = exists- ? prompts.map((item) => (item.id === reviewPrompt.id ? reviewPrompt : item))- : [reviewPrompt, ...prompts];-- await promptLibraryKV.set('prompts', nextPrompts);- }-}--export const promptLibraryService = new PromptLibraryService();diff --git a/console/apps/switch-console-desktop/src/main/core/providers/agent-payload-builder.ts b/console/apps/switch-console-desktop/src/main/core/providers/agent-payload-builder.tsindex 8bd3eb1e0..57677a405 100644--- a/console/apps/switch-console-desktop/src/main/core/providers/agent-payload-builder.ts+++ b/console/apps/switch-console-desktop/src/main/core/providers/agent-payload-builder.ts@@ -25,7 +25,7 @@ import {} from '@shared/core/providers/agent-provider-registry';import { getDependencyDescriptor } from '../dependencies/registry';import { providerOverrideSettings } from '../settings/provider-settings-service';-import { getPlugin, listPlugins } from './plugin-registry';+import { getPlugin } from './plugin-registry';/*** Optional callback injected by the controller so the builder can enrich the@@ -124,10 +124,6 @@ export async function buildAgentPayloads(return results.filter((r): r is AgentPayload => r !== null);}-export function buildAgentMetadataList(): AgentMetadata[] {- return listPlugins().map(buildMetadata);-}-/*** Maps manager state for a single agent to the renderer-facing AgentInstallationStatus DTO.* Top-level latestVersion/updateAvailable are derived from the used installation whendiff --git a/console/apps/switch-console-desktop/src/main/core/providers/controller.ts b/console/apps/switch-console-desktop/src/main/core/providers/controller.tsindex ffc9a18b8..08d48662d 100644--- a/console/apps/switch-console-desktop/src/main/core/providers/controller.ts+++ b/console/apps/switch-console-desktop/src/main/core/providers/controller.ts@@ -19,7 +19,6 @@ import { getDependencyManager } from '../dependencies/dependency-managers';import { hostDependencyStore } from '../dependencies/host-dependency-store';import { providerOverrideSettings } from '../settings/provider-settings-service';import {- buildAgentMetadataList,buildAgentPayload,buildAgentPayloads,toAgentInstallationStatus,@@ -83,17 +82,6 @@ export const providersController = createRPCController({});},- getAgentInstallationStatus: async (id: string, connectionId?: string) => {- const mgr = await getDependencyManager(connectionId);- const state = mgr.get(id as DependencyId);- if (!state) return null;- const rawHostDep = mgr.getHostDependency(id as DependencyId);- const hostDep = rawHostDep- ? agentUpdateService.enrichHostDependency(id as DependencyId, rawHostDep)- : undefined;- return toAgentInstallationStatus(id, connectionId, state, hostDep);- },-// ── Install / update ─────────────────────────────────────────────────────────install: async (id: AgentProviderId, connectionId?: string, method?: InstallMethod) => {@@ -157,11 +145,6 @@ export const providersController = createRPCController({await agentUpdateService.refreshLatestVersion(id, connectionId);},- probe: async (id: DependencyId, connectionId?: string) => {- const mgr = await getDependencyManager(connectionId);- return mgr.probe(id);- },-probeOverride: async (id: DependencyId,selection: { path?: string; cli?: string },@@ -175,8 +158,4 @@ export const providersController = createRPCController({const mgr = await getDependencyManager(connectionId);return mgr.probeAll(options);},-- listMetadata: async () => {- return buildAgentMetadataList();- },});diff --git a/console/apps/switch-console-desktop/src/main/core/remote-hosts/controller.ts b/console/apps/switch-console-desktop/src/main/core/remote-hosts/controller.tsindex b7c8769ac..f0307b1d3 100644--- a/console/apps/switch-console-desktop/src/main/core/remote-hosts/controller.ts+++ b/console/apps/switch-console-desktop/src/main/core/remote-hosts/controller.ts@@ -1,27 +1,8 @@-import type { InstallMethod } from '@switch-console/core/deps';-import type {- DependencyCategory,- DependencyInstallResult,- DependencyStatus,- DependencyUninstallResult,- DependencyUpdateResult,-} from '@switch-console/core/deps/runtime';-import { detectSwitchAgentRemote } from '@main/core/agents/detect-remote';-import {- evictRemoteDependencyManager,- getRemoteDependencyManager,- remoteDependencyDescriptor,-} from '@main/core/dependencies/remote-dependency-manager';-import { getRemoteSwitchSetupService } from '@main/core/switch-setup/remote-switch-setup';-import { agentTypeOf } from '@main/core/telemetry/agent-type';-import { cliFailureReason } from '@main/core/telemetry/cli-failure';-import type { TelemetryCliAction } from '@main/core/telemetry/events';-import { installMethodOf } from '@main/core/telemetry/narrow';+import { evictRemoteDependencyManager } from '@main/core/dependencies/remote-dependency-manager';import { trackEvent } from '@main/core/telemetry/telemetry-service';import { hostBlockedReason, type HostReachability } from '@shared/core/remote-hosts/reachability';import type { HostSetupPlan } from '@shared/core/remote-hosts/setup';import { createRPCController } from '@shared/lib/ipc/rpc';-import type { SwitchAgentConfig } from '@shared/switch-agents';import { listSshConfigHosts } from './list-ssh-config-hosts';import { hostReachabilityService } from './production-host-reachability';import { deletePersistedReachability } from './reachability-store';@@ -38,20 +19,6 @@ import {} from './setup/host-setup-service';import { listRemoteHosts, removeRemoteHost, upsertRemoteHost, type RemoteHost } from './store';-/** A single dependency's status on a remote host, enriched for the UI. */-export type RemoteDependencyView = {- id: string;- name: string;- category: DependencyCategory;- status: DependencyStatus;- version: string | null;- path: string | null;- error?: string;- docUrl?: string;- /** True when Switch Console has an install command for this host's platform. */- canInstall: boolean;-};-export type TestConnectionResult = { ok: true } | { ok: false; message: string };/**@@ -66,54 +33,6 @@ async function testConnection(sshHost: string): Promise<TestConnectionResult> {return { ok: false, message: reachability.lastError ?? hostBlockedReason(reachability) };}-async function probeDeps(sshHost: string): Promise<RemoteDependencyView[]> {- const manager = await getRemoteDependencyManager(sshHost);- await manager.probeAll();- const views = [...manager.getAll().values()].map((state): RemoteDependencyView => {- const descriptor = remoteDependencyDescriptor(state.id);- return {- id: state.id,- name: descriptor?.name ?? state.id,- category: state.category,- status: state.status,- version: state.version,- path: state.path,- error: state.error,- docUrl: descriptor?.docUrl,- canInstall: manager.getInstallOptions(state.id).length > 0,- };- });-- return views;-}--/**- * Report a CLI action that really did run on a remote host.- *- * The local controller's equivalent always reports `local`; this one always- * reports `remote`, which is the only difference between them. The host is never- * named — `remote` is the whole of what is said about where.- *- * The id here is a dependency id, which may be a core dependency rather than an- * agent, so it goes through the same narrowing as anywhere else and reports- * `unknown` when it is not a provider we know.- */-function reportRemoteCliAction(- action: TelemetryCliAction,- id: string,- method: InstallMethod | undefined,- result: { success: boolean; error?: { type?: string } }-): void {- trackEvent('agent_cli_action', {- agent_type: agentTypeOf(id),- target: 'remote',- install_method: installMethodOf(method),- action,- outcome: result.success ? 'success' : 'failure',- failure_reason: cliFailureReason(result),- });-}-export const remoteHostsController = createRPCController({/** SSH aliases from ~/.ssh/config, for the onboarding picker. */listSshConfigHosts: (): Promise<string[]> => listSshConfigHosts(),@@ -121,12 +40,6 @@ export const remoteHostsController = createRPCController({/** Onboarded remote hosts. */listHosts: (): Promise<RemoteHost[]> => listRemoteHosts(),- testConnection: (sshHost: string): Promise<TestConnectionResult> => testConnection(sshHost),-- /** Modeled reachability for one host — the state the UI gates its display on. */- getReachability: (sshHost: string): Promise<HostReachability> =>- Promise.resolve(hostReachabilityService.get(sshHost)),-/** Every host the reachability model knows about, for the initial UI hydrate. */listReachability: (): Promise<HostReachability[]> =>Promise.resolve(hostReachabilityService.getAll()),@@ -217,66 +130,4 @@ export const remoteHostsController = createRPCController({/** Move past a step the user has chosen not to fix, unblocking the rest. */skipSetupStep: (params: { sshHost: string; stepId: string }): Promise<HostSetupPlan> =>skipSetupStep(params.sshHost, params.stepId),-- /**- * Detect the Switch agent configured in a remote working directory (reads its- * `.claude/settings.local.json` over SSH). Used by the add-agent modal to- * detect + server-verify a remote agent without any local directory.- */- detectRemoteAgent: (params: {- sshHost: string;- remoteRepoDir: string;- }): Promise<SwitchAgentConfig | null> =>- detectSwitchAgentRemote(params.sshHost, params.remoteRepoDir),-- probeDeps: (sshHost: string): Promise<RemoteDependencyView[]> => probeDeps(sshHost),-- installDep: async (params: {- sshHost: string;- id: string;- method?: InstallMethod;- }): Promise<DependencyInstallResult> => {- const manager = await getRemoteDependencyManager(params.sshHost);- const result = await manager.install(params.id, params.method);- reportRemoteCliAction('install', params.id, params.method, result);- return result;- },-- updateDep: async (params: { sshHost: string; id: string }): Promise<DependencyUpdateResult> => {- const manager = await getRemoteDependencyManager(params.sshHost);- const result = await manager.update(params.id);- reportRemoteCliAction('update', params.id, undefined, result);- return result;- },-- uninstallDep: async (params: {- sshHost: string;- id: string;- }): Promise<DependencyUninstallResult> => {- const manager = await getRemoteDependencyManager(params.sshHost);- const result = await manager.uninstall(params.id);- reportRemoteCliAction('uninstall', params.id, undefined, result);- return result;- },-- /** Switch connector plugin status for every Switch-supported agent type on the host. */- listAgentTypePlugins: async (sshHost: string) => {- const service = await getRemoteSwitchSetupService(sshHost);- return service.listAgentTypeStatuses();- },-- checkAgentPluginUpdates: async (params: { sshHost: string; agentId: string }) => {- const service = await getRemoteSwitchSetupService(params.sshHost);- return service.checkForUpdates(params.agentId);- },-- installAgentPlugin: async (params: { sshHost: string; agentId: string }) => {- const service = await getRemoteSwitchSetupService(params.sshHost);- return service.install(params.agentId);- },-- updateAgentPlugin: async (params: { sshHost: string; agentId: string }) => {- const service = await getRemoteSwitchSetupService(params.sshHost);- return service.update(params.agentId);- },});diff --git a/console/apps/switch-console-desktop/src/main/core/sdk-host/controller.ts b/console/apps/switch-console-desktop/src/main/core/sdk-host/controller.tsindex 0f11ef298..ad2e2db33 100644--- a/console/apps/switch-console-desktop/src/main/core/sdk-host/controller.ts+++ b/console/apps/switch-console-desktop/src/main/core/sdk-host/controller.ts@@ -6,7 +6,6 @@ import { remoteSessionReconciler } from '@main/core/agents/remote-session-reconcimport { sessionRuntimeManager } from '@main/core/sessions/session-runtime-manager';import { createRPCController } from '@shared/lib/ipc/rpc';import {- fetchSdkSessions,uploadSdkAttachment,fetchSdkSnapshot,fetchSdkEvents,@@ -45,7 +44,6 @@ export const sdkHostController = createRPCController({if (!agent?.serverId) throw new Error('This agent has no Switch server.');return agent.serverId;},- sharedList: async (serverId: string) => fetchSdkSessions(await sharedServer(serverId)),sharedSnapshot: async (serverId: string, sessionId: string) => {const snapshot = snapshotSchema.parse(await fetchSdkSnapshot(await sharedServer(serverId), sessionId)diff --git a/console/apps/switch-console-desktop/src/main/core/sessions/controller.ts b/console/apps/switch-console-desktop/src/main/core/sessions/controller.tsindex df3e18fec..ff748b658 100644--- a/console/apps/switch-console-desktop/src/main/core/sessions/controller.ts+++ b/console/apps/switch-console-desktop/src/main/core/sessions/controller.ts@@ -2,7 +2,6 @@ import { provisionTriggerOf } from '@main/core/telemetry/narrow';import type { CreateSessionParams, SessionLifecycleStatus } from '@shared/core/sessions/sessions';import type { SessionProvisionTrigger } from '@shared/core/telemetry/reporting';import { createRPCController } from '@shared/lib/ipc/rpc';-import { generateSessionName } from './name-generation/generateSessionName';import { dehydrateSession } from './operations/dehydrateSession';import { getSession } from './operations/getSession';import { hydrateSession } from './operations/hydrateSession';@@ -61,5 +60,4 @@ export const sessionController = createRPCController({// falls back to `initial`, which reports nothing.return sessionService.provisionSession(params.sessionId, provisionTriggerOf(params.trigger));},- generateSessionName,});diff --git a/console/apps/switch-console-desktop/src/main/core/sessions/name-generation/generateSessionName.test.ts b/console/apps/switch-console-desktop/src/main/core/sessions/name-generation/generateSessionName.test.tsdeleted file mode 100644index 9be37735e..000000000--- a/console/apps/switch-console-desktop/src/main/core/sessions/name-generation/generateSessionName.test.ts+++ /dev/null@@ -1,52 +0,0 @@-import { describe, expect, it } from 'vitest';-import { generateSessionName } from './generateSessionName';--describe('generateSessionName', () => {- describe('heuristic generation (with title)', () => {- it('generates a branch-style name from a title', () => {- const result = generateSessionName({ title: 'Fix the login page crash on mobile' });- expect(result).toBeTruthy();- expect(result).not.toContain('/');- expect(result).toMatch(/^[a-z0-9-]+$/);- });-- it('generates from title and description', () => {- const result = generateSessionName({- title: 'Add OAuth2 support',- description: 'We need SSO integration for enterprise customers',- });- expect(result).toBeTruthy();- expect(result).toMatch(/^[a-z0-9-]+$/);- });-- it('respects max session name length of 64', () => {- const result = generateSessionName({- title:- 'Implement a comprehensive authentication and authorization system with OAuth2 PKCE flow and SAML support',- });- expect(result.length).toBeLessThanOrEqual(64);- });-- it('handles issue identifiers in title', () => {- const result = generateSessionName({ title: 'Fix login bug #891' });- expect(result).toBeTruthy();- expect(result).toMatch(/^[a-z0-9-]+$/);- });- });-- describe('random generation (no title)', () => {- it('generates a random friendly name when no input provided', () => {- const result = generateSessionName({});- expect(result).toBeTruthy();- expect(result).toMatch(/^[a-z0-9-]+$/);- });-- it('generates different names on subsequent calls', () => {- const results = new Set<string>();- for (let i = 0; i < 5; i++) {- results.add(generateSessionName({}));- }- expect(results.size).toBeGreaterThanOrEqual(2);- });- });-});diff --git a/console/apps/switch-console-desktop/src/main/core/sessions/name-generation/generateSessionName.ts b/console/apps/switch-console-desktop/src/main/core/sessions/name-generation/generateSessionName.tsdeleted file mode 100644index e9165ce95..000000000--- a/console/apps/switch-console-desktop/src/main/core/sessions/name-generation/generateSessionName.ts+++ /dev/null@@ -1,35 +0,0 @@-import { humanId } from 'human-id';-import { generateBranchName } from 'nbranch';--const MAX_SESSION_NAME_LENGTH = 64;--function sanitize(raw: string): string {- return raw- .toLowerCase()- .replace(/[^a-z0-9-]/g, '-')- .replace(/-+/g, '-')- .replace(/^-+|-+$/g, '')- .slice(0, MAX_SESSION_NAME_LENGTH);-}--export function generateRandom(): string {- return sanitize(humanId({ separator: '-', capitalize: false }));-}--function generateFromInput(title: string, description?: string): string {- const input = description ? `${title}\n\n${description}` : title;- const raw = generateBranchName(input, {- addRandomSuffix: false,- separator: '-',- maxLength: MAX_SESSION_NAME_LENGTH,- });- return sanitize(raw);-}--export function generateSessionName(params: { title?: string; description?: string }): string {- const { title, description } = params;- if (title && title.trim().length > 0) {- return generateFromInput(title.trim(), description?.trim());- }- return generateRandom();-}diff --git a/console/apps/switch-console-desktop/src/main/core/settings/controller.ts b/console/apps/switch-console-desktop/src/main/core/settings/controller.tsindex 99ab58fc9..a8ba13462 100644--- a/console/apps/switch-console-desktop/src/main/core/settings/controller.ts+++ b/console/apps/switch-console-desktop/src/main/core/settings/controller.ts@@ -27,10 +27,6 @@ function reportConsent(previous: TelemetrySettings, next: TelemetrySettings): vo}export const appSettingsController = createRPCController({- get: <T extends AppSettingsKey>(key: T): Promise<AppSettings[T]> => appSettingsService.get(key),-- getAll: (): Promise<AppSettings> => appSettingsService.getAll(),-getWithMeta: <T extends AppSettingsKey>(key: T): Promise<{diff --git a/console/apps/switch-console-desktop/src/main/core/settings/provider-settings-controller.ts b/console/apps/switch-console-desktop/src/main/core/settings/provider-settings-controller.tsdeleted file mode 100644index 41a45ccf8..000000000--- a/console/apps/switch-console-desktop/src/main/core/settings/provider-settings-controller.ts+++ /dev/null@@ -1,25 +0,0 @@-import type { ProviderCustomConfig } from '@shared/core/app-settings';-import { createRPCController } from '@shared/lib/ipc/rpc';-import { providerOverrideSettings } from './provider-settings-service';--export const providerSettingsController = createRPCController({- getAll: (): Promise<Record<string, ProviderCustomConfig>> => providerOverrideSettings.getAll(),-- getItem: (id: string): Promise<ProviderCustomConfig | undefined> =>- providerOverrideSettings.getItem(id),-- getItemWithMeta: (- id: string- ): Promise<{- value: ProviderCustomConfig;- defaults: ProviderCustomConfig;- overrides: Partial<ProviderCustomConfig>;- } | null> => providerOverrideSettings.getItemWithMeta(id),-- updateItem: (id: string, config: Partial<ProviderCustomConfig>): Promise<void> =>- providerOverrideSettings.updateItem(id, config),-- resetItem: (id: string): Promise<void> => providerOverrideSettings.resetItem(id),-- resetAll: (): Promise<void> => providerOverrideSettings.resetAll(),-});diff --git a/console/apps/switch-console-desktop/src/main/core/switch-servers/controller.ts b/console/apps/switch-console-desktop/src/main/core/switch-servers/controller.tsindex d34fadc41..ff872e675 100644--- a/console/apps/switch-console-desktop/src/main/core/switch-servers/controller.ts+++ b/console/apps/switch-console-desktop/src/main/core/switch-servers/controller.ts@@ -1,24 +1,11 @@import type { Result } from '@switch-console/shared';-import { foreignCredentialsOwner } from '@main/core/agents/agent-credentials-slot';-import { suggestAgentDefaults } from '@main/core/agents/agent-defaults';-import { resolveWorkspaceFsFor } from '@main/core/agents/agent-workspace-fs';-import { knownAgentTypeForProvider } from '@main/core/agents/known-agent-type';import { propagateServerApiUrl } from '@main/core/agents/propagate-server-api-url';-import { registerAgentIdentity } from '@main/core/agents/register-agent-identity';import { resolveAgentServers } from '@main/core/agents/resolve-servers';-import { writeRemoteSwitchSettings } from '@main/core/agents/write-remote-switch-settings';-import {- writeNeutralAgentSettingsFs,- writeSwitchSettings,-} from '@main/core/agents/write-switch-settings';import { appService } from '@main/core/app/service';-import { SshFileSystem } from '@main/core/fs/impl/ssh-fs';-import { sshConnectionIdForHost } from '@main/core/locations/location-transport';import {isManagedServerRunning,managedServerHostBlocked,} from '@main/core/managed-switch-server/managed-server-status';-import { ensureSshConnected } from '@main/core/ssh/connect/connect-agent-ssh';import { bridgePlatformOfType } from '@main/core/telemetry/bridge-platform';import type {TelemetryAuthMethod,@@ -33,13 +20,10 @@ import type {import { roomAgentsDirectionOf } from '@main/core/telemetry/narrow';import { trackEvent } from '@main/core/telemetry/telemetry-service';import { log } from '@main/lib/logger';-import { agentAvatarUrlForName } from '@shared/core/agents/agent-avatar';-import type { AgentProviderId } from '@shared/core/providers/agent-provider-registry';import { HostUnreachableError } from '@shared/core/remote-hosts/reachability';import type {AddressingPolicy,AddServerParams,- AgentDefaults,AgentVerifyResult,BridgeDirectorySearchResult,AgentIconBackfill,@@ -54,9 +38,6 @@ import type {DeleteBridgeResult,LinkedIdentity,PasswordLoginParams,- ProvisionAgentParams,- ProvisionAgentResult,- ProvisionRemoteAgentParams,RemoteAgentRoom,RemoteAgentSummary,RemoteBridge,@@ -89,7 +70,6 @@ import {deleteBridge,deleteRoom,fetchAddressingPolicy,- fetchAgentDetail,fetchAgentRooms,fetchAgents,fetchAllExternalUsers,@@ -424,12 +404,6 @@ export const switchServersController = createRPCController({listRemoteAgents: async (serverId: string): Promise<RemoteAgentSummary[]> =>fetchAgents(await requireServer(serverId)),- getRemoteAgent: async (params: {- serverId: string;- agentId: string;- }): Promise<RemoteAgentSummary> =>- fetchAgentDetail(await requireServer(params.serverId), params.agentId),-listRemoteRooms: async (serverId: string): Promise<RemoteRoomSummary[]> =>fetchRooms(await requireServer(serverId)),@@ -813,122 +787,4 @@ export const switchServersController = createRPCController({throw cause;}},-- suggestAgentDefaults: async (params: {- dir: string;- providerId: AgentProviderId;- }): Promise<AgentDefaults> => suggestAgentDefaults(params.dir, params.providerId),-- /**- * Register a new agent on the chosen server (owned by the signed-in user) and- * write its credentials into the directory's `.claude/settings.local.json`.- * This is the desktop equivalent of running the switch-connector `configure`- * skill. Recoverable gateway failures are mapped to a typed result; the minted- * token is written to disk and never returned.- */- provisionAgent: async (params: ProvisionAgentParams): Promise<ProvisionAgentResult> => {- const server = await requireServer(params.serverId);-- const conflict = await foreignCredentialsOwner(null, params.dir, params.name, server.apiUrl);- if (conflict !== null) return { kind: 'credentials-conflict', endpoint: conflict };-- const registered = await registerAgentIdentity(server, {- name: params.name,- description: params.description,- repoDir: params.dir,- autoSession: params.autoSession,- iconUrl: agentAvatarUrlForName(params.name),- // This flow asks for a name and nothing else, so there is no label to send.- displayName: null,- // Provisioning writes `.claude/settings.local.json` — this is the Claude- // Code path by construction, not a fallback.- agentType: knownAgentTypeForProvider('claude'),- });- if (registered.kind !== 'created') return registered;-- // The connector's SWITCH_API_ENDPOINT must point at the Switch core (agent- // bridge), which is a distinct endpoint from the gateway.- await writeSwitchSettings({- dir: params.dir,- apiEndpoint: server.apiUrl,- agentId: registered.id,- });-- // The settings file above carries no token (CHOO-1962), so the per-agent- // credentials file is what actually provisions this agent.- const workspace = await resolveWorkspaceFsFor(null, params.dir);- try {- await writeNeutralAgentSettingsFs(workspace.fs, {- slug: params.name,- apiEndpoint: server.apiUrl,- apiToken: registered.apiKey,- agentId: registered.id,- });- } finally {- workspace.close();- }-- return { kind: 'created', agentId: registered.id };- },-- /**- * Register a new Claude Code agent and write its credentials into a REMOTE- * working directory over SSH — the remote-host equivalent of `provisionAgent`.- * The agent has no local directory: its `.claude/settings.local.json` is- * written on the host, where the runtime sidecar reads it (CHOO-1059).- */- provisionRemoteAgent: async (- params: ProvisionRemoteAgentParams- ): Promise<ProvisionAgentResult> => {- const server = await requireServer(params.serverId);-- const conflict = await foreignCredentialsOwner(- params.sshHost,- params.remoteRepoDir,- params.name,- server.apiUrl- );- if (conflict !== null) return { kind: 'credentials-conflict', endpoint: conflict };-- const registered = await registerAgentIdentity(server, {- name: params.name,- description: params.description,- repoDir: params.remoteRepoDir,- autoSession: params.autoSession,- iconUrl: agentAvatarUrlForName(params.name),- // As locally: a name is all this flow collects.- displayName: null,- // Remote provisioning likewise writes `.claude/settings.local.json`.- agentType: knownAgentTypeForProvider('claude'),- });- if (registered.kind !== 'created') return registered;-- const proxy = await ensureSshConnected(sshConnectionIdForHost(params.sshHost), params.sshHost);- const fs = new SshFileSystem(proxy, params.remoteRepoDir);- try {- await writeRemoteSwitchSettings(fs, {- apiEndpoint: server.apiUrl,- agentId: registered.id,- });- } finally {- fs.close();- }-- // As locally: the settings file names the agent, the per-agent credentials- // file carries its token — here in the VM's own working directory, which is- // where its sessions will look.- const workspace = await resolveWorkspaceFsFor(params.sshHost, params.remoteRepoDir);- try {- await writeNeutralAgentSettingsFs(workspace.fs, {- slug: params.name,- apiEndpoint: server.apiUrl,- apiToken: registered.apiKey,- agentId: registered.id,- });- } finally {- workspace.close();- }-- return { kind: 'created', agentId: registered.id };- },});diff --git a/console/apps/switch-console-desktop/src/main/core/updates/controller.ts b/console/apps/switch-console-desktop/src/main/core/updates/controller.tsindex 08fb7b2b4..9106ce75e 100644--- a/console/apps/switch-console-desktop/src/main/core/updates/controller.ts+++ b/console/apps/switch-console-desktop/src/main/core/updates/controller.ts@@ -55,13 +55,4 @@ export const updateController = createRPCController({return { success: false, error: formatUpdaterError(error) };}},-- getReleaseNotes: async () => {- try {- const notes = await updateService.fetchReleaseNotes();- return { success: true, data: notes };- } catch (error) {- return { success: false, error: formatUpdaterError(error) };- }- },});diff --git a/console/apps/switch-console-desktop/src/main/core/view-state/controller.ts b/console/apps/switch-console-desktop/src/main/core/view-state/controller.tsindex d00d64741..87b5cf94f 100644--- a/console/apps/switch-console-desktop/src/main/core/view-state/controller.ts+++ b/console/apps/switch-console-desktop/src/main/core/view-state/controller.ts@@ -7,6 +7,5 @@ export const viewStateController = createRPCController({},get: (key: string): Promise<unknown> => viewStateService.get(key),getAll: (): Promise<Record<string, unknown>> => viewStateService.getAll(),- del: (key: string): Promise<void> => viewStateService.del(key),reset: (): Promise<void> => viewStateService.reset(),});diff --git a/console/apps/switch-console-desktop/src/main/index.ts b/console/apps/switch-console-desktop/src/main/index.tsindex 2d376e3d4..2f965879c 100644--- a/console/apps/switch-console-desktop/src/main/index.ts+++ b/console/apps/switch-console-desktop/src/main/index.ts@@ -23,7 +23,6 @@ import { locationManager } from './core/locations/location-manager';import { locationSettingsService } from './core/locations/settings/location-settings-service';import { localServerService } from './core/managed-switch-server/local-server-service';import { remoteServerService } from './core/managed-switch-server/remote-server-service';-import { promptLibraryService } from './core/prompt-library/service';import { initializeHostReachability } from './core/remote-hosts/host-reachability-startup';import { hostReachabilityService } from './core/remote-hosts/production-host-reachability';import {@@ -143,7 +142,6 @@ void app.whenReady().then(async () => {locationSettingsService.initialize();appService.initialize();await appSettingsService.initialize();- await promptLibraryService.initialize();// After the settings store, which owns the consent gate every event asks// before it is sent, and never before the database it is read from.diff --git a/console/apps/switch-console-desktop/src/main/rpc.ts b/console/apps/switch-console-desktop/src/main/rpc.tsindex de16b72d5..37359ccd1 100644--- a/console/apps/switch-console-desktop/src/main/rpc.ts+++ b/console/apps/switch-console-desktop/src/main/rpc.ts@@ -4,10 +4,8 @@ import { agentsController } from './core/agents/controller';import { appController } from './core/app/controller';import { filesController } from './core/fs/controller';import { locationsController } from './core/locations/controller';-import { locationRuntimeSettingsController } from './core/locations/location-runtime-settings-controller';import { localSwitchServerController } from './core/managed-switch-server/controller';import { remoteSwitchServerController } from './core/managed-switch-server/remote-controller';-import { promptLibraryController } from './core/prompt-library/controller';import { providersController } from './core/providers/controller';import { remoteHostsController } from './core/remote-hosts/controller';import { resourceMonitorController } from './core/resource-monitor/controller';@@ -16,7 +14,6 @@ import { sdkHostController } from './core/sdk-host/controller';import { searchController } from './core/search/controller';import { sessionController } from './core/sessions/controller';import { appSettingsController } from './core/settings/controller';-import { providerSettingsController } from './core/settings/provider-settings-controller';import { switchRoomsController } from './core/switch-rooms/controller';import { switchServersController } from './core/switch-servers/controller';import { switchSetupController } from './core/switch-setup/controller';@@ -31,16 +28,13 @@ export const rpcRouter = createRPCRouter({agentTemplates: agentTemplatesController,app: appController,appSettings: appSettingsController,- providerSettings: providerSettingsController,update: updateController,resourceMonitor: resourceMonitorController,- promptLibrary: promptLibraryController,locations: locationsController,sessions: sessionController,viewState: viewStateController,search: searchController,switchRooms: switchRoomsController,- locationRuntimeSettings: locationRuntimeSettingsController,switchServers: switchServersController,switchSetup: switchSetupController,localSwitchServer: localSwitchServerController,diff --git a/console/apps/switch-console-desktop/src/renderer/features/command-palette/command-palette-modal.tsx b/console/apps/switch-console-desktop/src/renderer/features/command-palette/command-palette-modal.tsxindex 062f7a00c..42ee93357 100644--- a/console/apps/switch-console-desktop/src/renderer/features/command-palette/command-palette-modal.tsx+++ b/console/apps/switch-console-desktop/src/renderer/features/command-palette/command-palette-modal.tsx@@ -103,9 +103,12 @@ const GROUP_CLASS = cn(// Ordered allowlists for the "Suggested Actions" empty-state group. Defined at// module scope so the arrays keep stable references across renders.-const SESSION_SUGGESTED = ['session.sidebarChanges', 'session.sidebarFiles', 'resource-monitor'];-const LOCATION_SUGGESTED = ['app.newSession', 'app.settings', 'resource-monitor'];-const APP_SUGGESTED = ['app.newLocation', 'app.settings', 'resource-monitor'];+//+// Every id here must be one a CommandProvider actually produces, or the+// resource monitor: the list is filtered against the live registry, so an id+// nothing implements silently shortens the group rather than failing.+const SESSION_SUGGESTED = ['session.pin', 'app.settings', 'resource-monitor'];+const DEFAULT_SUGGESTED = ['app.newLocation', 'app.addServer', 'app.settings', 'resource-monitor'];function PaletteItem({value,@@ -254,16 +257,12 @@ export function CommandPaletteModal({const actions = useMemo(() => {// Empty state: show the ordered context-specific suggested actions only.- const suggestedIds = sessionId- ? SESSION_SUGGESTED- : locationId- ? LOCATION_SUGGESTED- : APP_SUGGESTED;+ const suggestedIds = sessionId ? SESSION_SUGGESTED : DEFAULT_SUGGESTED;return [...registryActions, resourceMonitorAction].filter((a) => suggestedIds.includes(a.id)).sort((a, b) => suggestedIds.indexOf(a.id) - suggestedIds.indexOf(b.id)).slice(0, 7);- }, [registryActions, resourceMonitorAction, locationId, sessionId]);+ }, [registryActions, resourceMonitorAction, sessionId]);const rankedDb = applyContextAffinity(searchResult.items, { locationId });const actionResults = actions;diff --git a/console/apps/switch-console-desktop/src/renderer/features/locations/components/main-panel/agent-page-header.tsx b/console/apps/switch-console-desktop/src/renderer/features/locations/components/main-panel/agent-page-header.tsxindex d81d8da8e..ee7380ce1 100644--- a/console/apps/switch-console-desktop/src/renderer/features/locations/components/main-panel/agent-page-header.tsx+++ b/console/apps/switch-console-desktop/src/renderer/features/locations/components/main-panel/agent-page-header.tsx@@ -11,7 +11,6 @@ import { useShowModal } from '@renderer/lib/modal/modal-provider';import { remoteAgentsQueryKey, useRemoteAgents } from '@renderer/lib/stores/use-remote-agents';import { Badge } from '@renderer/lib/ui/badge';import { Button } from '@renderer/lib/ui/button';-import { BoundShortcut } from '@renderer/lib/ui/shortcut';import { providerDisplayName } from '@shared/core/providers/agent-provider-registry';/**@@ -111,7 +110,7 @@ export const AgentPageHeader = observer(function AgentPageHeader() {showCreateSessionModal({ locationId, agentName, entryPoint: 'agent_page' })}>- New Session <BoundShortcut settingsKey="newSession" />+ New Session</Button>{roomable && (<Buttondiff --git a/console/apps/switch-console-desktop/src/renderer/features/locations/components/session-view/session-row.tsx b/console/apps/switch-console-desktop/src/renderer/features/locations/components/session-view/session-row.tsxindex 23d84a9b1..5cea43e78 100644--- a/console/apps/switch-console-desktop/src/renderer/features/locations/components/session-view/session-row.tsx+++ b/console/apps/switch-console-desktop/src/renderer/features/locations/components/session-view/session-row.tsx@@ -64,7 +64,6 @@ export const SessionRow = observer(function SessionRow({onRename={handleRename}onArchive={handleArchive}onRestore={handleRestore}- onConvertAutomation={undefined}onDelete={handleDelete}><buttondiff --git a/console/apps/switch-console-desktop/src/renderer/features/sessions/components/session-actions.tsx b/console/apps/switch-console-desktop/src/renderer/features/sessions/components/session-actions.tsxindex 0805a9915..78c4bba51 100644--- a/console/apps/switch-console-desktop/src/renderer/features/sessions/components/session-actions.tsx+++ b/console/apps/switch-console-desktop/src/renderer/features/sessions/components/session-actions.tsx@@ -1,4 +1,4 @@-import { Archive, Copy, MessageSquare, Pencil, Pin, PinOff, RotateCcw, Trash2 } from 'lucide-react';+import { Archive, Copy, Pencil, Pin, PinOff, RotateCcw, Trash2 } from 'lucide-react';import type { ReactNode } from 'react';import { toast } from '@renderer/lib/hooks/use-toast';@@ -22,8 +22,6 @@ export interface SessionActionsProps {onRename: () => void;onArchive: () => void;onRestore?: () => void;- onReconnect?: () => void;- onConvertAutomation?: () => void;onDelete: () => void;}@@ -60,8 +58,6 @@ export function sessionActions({onRename,onArchive,onRestore,- onReconnect,- onConvertAutomation,onDelete,}: SessionActionsProps): SessionAction[] {const actions: SessionAction[] = [];@@ -84,22 +80,6 @@ export function sessionActions({label: 'Rename',run: onRename,});- if (onReconnect) {- actions.push({- key: 'reconnect',- icon: <RotateCcw className="size-4" />,- label: 'Reconnect',- run: onReconnect,- });- }- if (onConvertAutomation) {- actions.push({- key: 'convert',- icon: <MessageSquare className="size-4" />,- label: 'Convert to regular session',- run: onConvertAutomation,- });- }if (!isArchived) {actions.push({key: 'archive',diff --git a/console/apps/switch-console-desktop/src/renderer/features/sessions/use-session-actions.ts b/console/apps/switch-console-desktop/src/renderer/features/sessions/use-session-actions.tsindex b131a92e9..867db528d 100644--- a/console/apps/switch-console-desktop/src/renderer/features/sessions/use-session-actions.ts+++ b/console/apps/switch-console-desktop/src/renderer/features/sessions/use-session-actions.ts@@ -45,8 +45,6 @@ export function useSessionActionProps(if (isActive) navigate('location', { locationId });void sessionManager?.archiveSession(sessionId);},- onReconnect: undefined,- onConvertAutomation: undefined,onDelete: () =>showDeleteSession({locationId,diff --git a/console/apps/switch-console-desktop/src/renderer/features/sidebar/agent-item.tsx b/console/apps/switch-console-desktop/src/renderer/features/sidebar/agent-item.tsxindex d73c5e9aa..98d06ac9b 100644--- a/console/apps/switch-console-desktop/src/renderer/features/sidebar/agent-item.tsx+++ b/console/apps/switch-console-desktop/src/renderer/features/sidebar/agent-item.tsx@@ -28,7 +28,6 @@ import {ContextMenuItem,ContextMenuTrigger,} from '@renderer/lib/ui/context-menu';-import { BoundShortcut } from '@renderer/lib/ui/shortcut';import { Tooltip, TooltipContent, TooltipTrigger } from '@renderer/lib/ui/tooltip';import { cn } from '@renderer/utils/utils';import type { Agent } from '@shared/core/agents/agents';@@ -205,10 +204,7 @@ export const SidebarAgentItem = observer(function SidebarAgentItem({</SidebarItemMiniButton>}/>- <TooltipContent>- New Session- <BoundShortcut settingsKey="newSession" variant="badge" />- </TooltipContent>+ <TooltipContent>New Session</TooltipContent></Tooltip>{hasSessions && (<SidebarItemMiniButtondiff --git a/console/apps/switch-console-desktop/src/shared/commands.ts b/console/apps/switch-console-desktop/src/shared/commands.tsindex 441680c84..5ebc27af9 100644--- a/console/apps/switch-console-desktop/src/shared/commands.ts+++ b/console/apps/switch-console-desktop/src/shared/commands.ts@@ -5,7 +5,7 @@ export interface CommandDef {label: string;description?: string;group?: string;- scope: 'app' | 'location' | 'session' | 'session-sub';+ scope: 'app' | 'session';shortcutKey?: ShortcutSettingsKey;/** Token resolved to a LucideIcon by the renderer's COMMAND_ICONS map. */iconKey?: string;@@ -29,15 +29,6 @@ export const APP_COMMAND_DEFS = defineCommandDefs([group: 'App',iconKey: 'settings',},- {- id: 'app.library',- label: 'Open Library',- description: 'Open the Library',- scope: 'app',- shortcutKey: 'library',- group: 'App',- iconKey: 'library',- },{id: 'app.newLocation',label: 'Add Switch Agent',@@ -55,15 +46,6 @@ export const APP_COMMAND_DEFS = defineCommandDefs([group: 'App',iconKey: 'server',},- {- id: 'app.newSession',- label: 'New Session',- description: 'Spawn a new session for this agent',- scope: 'app',- shortcutKey: 'newSession',- group: 'App',- iconKey: 'square-plus',- },{id: 'app.toggleTheme',label: 'Toggle Theme',@@ -93,123 +75,6 @@ export const APP_COMMAND_DEFS = defineCommandDefs([] as const);export const SESSION_COMMAND_DEFS = defineCommandDefs([- {- id: 'session.sidebarChanges',- label: 'View Changes',- description: 'Open the Changes panel in the right sidebar',- scope: 'session',- shortcutKey: 'sidebarChanges',- group: 'View',- iconKey: 'file-diff',- },- {- id: 'session.sidebarFiles',- label: 'View Files',- description: 'Open the Files panel in the right sidebar',- scope: 'session',- shortcutKey: 'sidebarFiles',- group: 'View',- iconKey: 'folder-open',- },- {- id: 'session.viewTerminals',- label: 'View Terminals',- description: 'Open the terminal drawer',- scope: 'session',- group: 'View',- iconKey: 'terminal',- },- {- id: 'session.toggleRightSidebar',- label: 'Toggle Right Sidebar',- description: 'Show or hide the right sidebar',- scope: 'session',- shortcutKey: 'toggleRightSidebar',- group: 'Panel',- iconKey: 'panel-right',- },- {- id: 'session.openBrowser',- label: 'Open Browser',- description: 'Open an in-app browser for this session',- scope: 'session',- shortcutKey: 'openBrowser',- group: 'Browser',- iconKey: 'globe',- },- {- id: 'session.browserGoBack',- label: 'Browser Back',- description: 'Go back in the active browser tab',- scope: 'session',- group: 'Browser',- iconKey: 'arrow-left',- },- {- id: 'session.browserGoForward',- label: 'Browser Forward',- description: 'Go forward in the active browser tab',- scope: 'session',- group: 'Browser',- iconKey: 'arrow-right',- },- {- id: 'session.browserReload',- label: 'Reload Browser',- description: 'Reload the active browser tab',- scope: 'session',- group: 'Browser',- iconKey: 'refresh-cw',- },- {- id: 'session.browserFocusUrl',- label: 'Focus Browser URL',- description: 'Focus the URL field in the active browser tab',- scope: 'session',- group: 'Browser',- iconKey: 'text-cursor-input',- },- {- id: 'session.browserOpenExternal',- label: 'Open Browser URL Externally',- description: 'Open the active browser URL in the system browser',- scope: 'session',- group: 'Browser',- iconKey: 'external-link',- },- {- id: 'session.browserCopyUrl',- label: 'Copy Browser URL',- description: 'Copy the active browser URL',- scope: 'session',- shortcutKey: 'browserCopyUrl',- group: 'Browser',- iconKey: 'copy',- },- {- id: 'session.gitFetch',- label: 'Git Fetch',- description: 'Fetch latest changes from remote',- scope: 'session',- group: 'Git',- iconKey: 'git-pull-request',- },- {- id: 'session.gitPull',- label: 'Git Pull',- description: 'Pull latest changes from remote',- scope: 'session',- group: 'Git',- iconKey: 'arrow-down-to-line',- },- {- id: 'session.gitPush',- label: 'Git Push',- description: 'Push commits to remote',- scope: 'session',- group: 'Git',- iconKey: 'arrow-up-to-line',- },{id: 'session.pin',label: 'Pin Session',@@ -218,14 +83,6 @@ export const SESSION_COMMAND_DEFS = defineCommandDefs([group: 'Session',iconKey: 'pin',},- {- id: 'session.convertAutomation',- label: 'Convert to Regular Session',- description: 'Detach this session from its automation run',- scope: 'session',- group: 'Session',- iconKey: 'message-square',- },{id: 'session.nextSession',label: 'Next Session',diff --git a/console/apps/switch-console-desktop/src/shared/prompt-library.ts b/console/apps/switch-console-desktop/src/shared/prompt-library.tsdeleted file mode 100644index 2cfb6aed9..000000000--- a/console/apps/switch-console-desktop/src/shared/prompt-library.ts+++ /dev/null@@ -1,24 +0,0 @@-import z from 'zod';--export const DEFAULT_REVIEW_PROMPT =- 'Review all changes in this worktree. Focus on correctness, regressions, edge cases, and missing tests. List concrete issues first, then note residual risks.';--export const promptLibraryPromptSchema = z.object({- id: z.string().min(1),- title: z.string().min(1),- prompt: z.string().min(1),-});--export const promptLibrarySchema = z.array(promptLibraryPromptSchema);--export type PromptLibraryPrompt = z.infer<typeof promptLibraryPromptSchema>;--export const DEFAULT_PROMPT_LIBRARY: PromptLibraryPrompt[] = [- {- id: 'review-prompt',- title: 'Review prompt',- prompt: DEFAULT_REVIEW_PROMPT,- },-];--export const PROMPT_LIBRARY_SEED_VERSION = 1;diff --git a/console/apps/switch-console-desktop/src/shared/shortcuts.ts b/console/apps/switch-console-desktop/src/shared/shortcuts.tsindex ad703301c..e3c6ae691 100644--- a/console/apps/switch-console-desktop/src/shared/shortcuts.ts+++ b/console/apps/switch-console-desktop/src/shared/shortcuts.ts@@ -11,7 +11,6 @@ export interface AppShortcutDef {label: string;description: string;category: string;- hideFromSettings?: boolean;conflictBehavior?: 'prevent' | 'allow';ignoreWhenMonacoFocused?: boolean;}@@ -108,36 +107,17 @@ export const APP_SHORTCUTS = defineShortcuts({description: 'Open application settings',category: 'Navigation',},- library: {- defaultHotkey: 'Mod+L',- label: 'Library',- description: 'Open the Library',- category: 'Navigation',- },toggleLeftSidebar: {defaultHotkey: 'Mod+B',label: 'Toggle Left Sidebar',description: 'Show or hide the left sidebar',category: 'View',},- toggleRightSidebar: {- defaultHotkey: 'Mod+.',- label: 'Toggle Right Sidebar',- description: 'Show or hide the right sidebar',- category: 'View',- },closeModal: {defaultHotkey: 'Escape',label: 'Close Modal',description: 'Close the current modal or dialog',category: 'Navigation',- hideFromSettings: true,- },- newSession: {- defaultHotkey: 'Mod+N',- label: 'New Session',- description: 'Create a new session',- category: 'Navigation',},deleteSelectedSessions: {defaultHotkey: 'Mod+Backspace',@@ -157,32 +137,6 @@ export const APP_SHORTCUTS = defineShortcuts({description: 'Open the location in the default editor',category: 'Navigation',},- sidebarChanges: {- defaultHotkey: 'Mod+Shift+1',- label: 'View Changes',- description: 'Open the right sidebar to the Changes panel',- category: 'Session View',- },- sidebarFiles: {- defaultHotkey: 'Mod+Shift+2',- label: 'View Files',- description: 'Open the right sidebar to the Files panel',- category: 'Session View',- },- tabNext: {- defaultHotkey: 'Mod+Alt+ArrowRight',- label: 'Next Tab',- description: 'Switch to the next tab',- category: 'Tab Navigation',- conflictBehavior: 'allow',- },- tabPrev: {- defaultHotkey: 'Mod+Alt+ArrowLeft',- label: 'Previous Tab',- description: 'Switch to the previous tab',- category: 'Tab Navigation',- conflictBehavior: 'allow',- },sessionNext: {defaultHotkey: 'Mod+Alt+ArrowDown',label: 'Next Session',@@ -197,18 +151,6 @@ export const APP_SHORTCUTS = defineShortcuts({category: 'Session View',ignoreWhenMonacoFocused: true,},- openBrowser: {- defaultHotkey: 'Mod+Shift+B',- label: 'Open Browser',- description: 'Open an in-app browser in the current session',- category: 'Session View',- },- browserCopyUrl: {- defaultHotkey: 'Mod+Shift+C',- label: 'Copy Browser URL',- description: 'Copy the current in-app browser URL',- category: 'Session View',- },confirm: {defaultHotkey: 'Mod+Enter',label: 'Confirm',@@ -233,13 +175,6 @@ export const APP_SHORTCUTS = defineShortcuts({description: 'Navigate to the next location',category: 'Navigation',},- splitPane: {- defaultHotkey: 'Mod+\\',- label: 'Split Pane',- description: 'Move the active tab to a new pane on the right',- category: 'Tab Navigation',- conflictBehavior: 'allow',- },});export type ShortcutSettingsKey = keyof typeof APP_SHORTCUTS;