diff --git a/src/main/sessionToolingConfig.ts b/src/main/sessionToolingConfig.ts new file mode 100644 index 0000000..81cfdc3 --- /dev/null +++ b/src/main/sessionToolingConfig.ts @@ -0,0 +1,100 @@ +import type { + RunTurnLspProfileConfig, + RunTurnMcpServerConfig, + RunTurnToolingConfig, +} from '@shared/contracts/sidecar'; +import type { + LspProfileDefinition, + McpServerDefinition, + SessionToolingSelection, + WorkspaceToolingSettings, +} from '@shared/domain/tooling'; + +export function validateSessionToolingSelectionIds( + tooling: WorkspaceToolingSettings, + selection: SessionToolingSelection, +): void { + const knownMcpServerIds = new Set(tooling.mcpServers.map((server) => server.id)); + const unknownMcpServerIds = selection.enabledMcpServerIds.filter((id) => !knownMcpServerIds.has(id)); + if (unknownMcpServerIds.length > 0) { + throw new Error(`Unknown MCP server "${unknownMcpServerIds[0]}".`); + } + + const knownLspProfileIds = new Set(tooling.lspProfiles.map((profile) => profile.id)); + const unknownLspProfileIds = selection.enabledLspProfileIds.filter((id) => !knownLspProfileIds.has(id)); + if (unknownLspProfileIds.length > 0) { + throw new Error(`Unknown LSP profile "${unknownLspProfileIds[0]}".`); + } +} + +export function buildRunTurnToolingConfig( + tooling: WorkspaceToolingSettings, + selection: SessionToolingSelection, +): RunTurnToolingConfig | undefined { + const mcpServersById = new Map( + tooling.mcpServers.map((server) => [server.id, server]), + ); + const lspProfilesById = new Map( + tooling.lspProfiles.map((profile) => [profile.id, profile]), + ); + + const mcpServers = selection.enabledMcpServerIds.flatMap((id): RunTurnMcpServerConfig[] => { + const server = mcpServersById.get(id); + if (!server) { + return []; + } + + if (server.transport === 'local') { + return [ + { + id: server.id, + name: server.name, + transport: 'local', + tools: [...server.tools], + timeoutMs: server.timeoutMs, + command: server.command, + args: [...server.args], + cwd: server.cwd, + }, + ]; + } + + return [ + { + id: server.id, + name: server.name, + transport: server.transport, + tools: [...server.tools], + timeoutMs: server.timeoutMs, + url: server.url, + }, + ]; + }); + + const lspProfiles = selection.enabledLspProfileIds.flatMap((id): RunTurnLspProfileConfig[] => { + const profile = lspProfilesById.get(id); + if (!profile) { + return []; + } + + return [ + { + id: profile.id, + name: profile.name, + command: profile.command, + args: [...profile.args], + languageId: profile.languageId, + fileExtensions: [...profile.fileExtensions], + }, + ]; + }); + + if (mcpServers.length === 0 && lspProfiles.length === 0) { + return undefined; + } + + return { + mcpServers, + lspProfiles, + }; +} diff --git a/src/renderer/components/Sidebar.tsx b/src/renderer/components/Sidebar.tsx index 91b8166..c13b2d9 100644 --- a/src/renderer/components/Sidebar.tsx +++ b/src/renderer/components/Sidebar.tsx @@ -528,7 +528,7 @@ export function Sidebar({
eryx - BETA + ALPHA
diff --git a/src/renderer/styles.css b/src/renderer/styles.css index 58b3ef7..e44ed78 100644 --- a/src/renderer/styles.css +++ b/src/renderer/styles.css @@ -10,8 +10,8 @@ --color-accent: #6366f1; --color-accent-hover: #818cf8; --color-accent-muted: rgba(99, 102, 241, 0.15); - --text-pill: 0.5rem; - --text-pill--line-height: 1; + --text-pill: 0.6875rem; + --text-pill--line-height: 1.2; } :root { @@ -71,13 +71,6 @@ body { min-height: 100vh; } -button, -input, -select, -textarea { - font: inherit; -} - /* Scrollbar styling */ ::-webkit-scrollbar { width: 6px;