Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

Merge origin/main into remote-host-onboarding-rewrite (CHOO-1809)

Louis Amaudruz102d50d9dfbe
diff --cc dash/apps/switchdash-desktop/src/main/core/switch-setup/switch-setup-service.ts
index ae81c3c6c,836abdf7f..7e811f83b
--- a/dash/apps/switchdash-desktop/src/main/core/switch-setup/switch-setup-service.ts
+++ b/dash/apps/switchdash-desktop/src/main/core/switch-setup/switch-setup-service.ts
@@@ -1,11 -1,10 +1,11 @@@
import { readFile } from 'node:fs/promises';
import { join } from 'node:path';
import { resolveCommandPath } from '@switchdash/core/deps/runtime';
- import semver from 'semver';
import { LocalExecutionContext } from '@main/core/execution-context/local-execution-context';
import { log } from '@main/lib/logger';
+ import { isNewerVersion } from '@main/lib/semver';
import { READ_PACKAGES_SCOPE } from '@shared/core/npm-registry';
+import type { AgentTypeAvailability } from '@shared/core/switch-setup/agent-type-availability';
import { getPlugin, listPlugins } from '../providers/plugin-registry';
import { probeLocalGhAuth } from './local-gh-auth';
import {
diff --cc dash/apps/switchdash-desktop/src/renderer/features/locations/components/add-agent-modal/add-agent-modal.tsx
index b9d377714,47a653791..20f622b6c
--- a/dash/apps/switchdash-desktop/src/renderer/features/locations/components/add-agent-modal/add-agent-modal.tsx
+++ b/dash/apps/switchdash-desktop/src/renderer/features/locations/components/add-agent-modal/add-agent-modal.tsx
@@@ -542,11 -563,20 +598,21 @@@ export const AddAgentModal = observer(f
const handleConfigure = () => createNewAgent(configureForm);
const handleConfigureRemote = () => createNewAgent(remoteConfigureForm);
- /** Onboard (or adopt) the selected agents already defined in the picked
- * directory — importing those already registered on the gateway and minting a
- * fresh identity for plain provider definitions. */
+ /**
+ * Bring in the selected agents. Definitions go through the onboard path
+ * (importing a registered identity, minting one for a plain definition);
+ * credentials-only agents go through the attach path, which adopts the
+ * identity already on disk and writes nothing to the directory (CHOO-1937).
+ */
const handleOnboard = async () => {
- if (!canOnboard || !pickState.providerId || !pickState.serverId) return;
- if (!pickState.serverId || selectedNames.size === 0) return;
++ // `canOnboard` already requires a server; repeated so the calls below narrow.
++ if (!canOnboard || !pickState.serverId) return;
+ const attachSelected = [...selectedNames].flatMap((name) => {
+ const providerId = attachByName.get(name);
+ return providerId ? [{ name, providerId }] : [];
+ });
+ const onboardSelected = [...selectedNames].filter((name) => !attachByName.has(name));
+ if (onboardSelected.length > 0 && !pickState.providerId) return;
setSubmitState('creating');
setCloseGuard(true);
try {
@@@ -580,15 -632,14 +668,19 @@@
}
};
+ // A definition still needs the picked agent type to run under; an attach row
+ // carries its own (inferred from disk, or the picked one as a fallback).
+ const selectionNeedsProviderPick = [...selectedNames].some((name) => !attachByName.has(name));
+ // Adopting agents that already exist in the directory still puts them on this
+ // host, so it answers to the same gates as creating one. Omitting them here
+ // let you onboard onto a host that was unreachable or missing prerequisites.
const canOnboard =
hasOnboardable &&
selectedNames.size > 0 &&
!!pickState.serverId &&
+ (!selectionNeedsProviderPick || !!pickState.providerId) &&
+ runHostReachable &&
+ runHostReady &&
submitState === 'idle';
const submitLabel = submitState === 'creating' ? 'Adding...' : 'Add Agent';
diff --cc dash/apps/switchdash-desktop/vitest.config.ts
index 7cbe3a771,5f53b9fa1..07bd4ef91
--- a/dash/apps/switchdash-desktop/vitest.config.ts
+++ b/dash/apps/switchdash-desktop/vitest.config.ts
@@@ -82,15 -82,9 +82,9 @@@ export default defineConfig(
},
},
{
- // Renderer terminal tests that need a real browser environment
- // (real CSS layout, ResizeObserver, requestAnimationFrame, WebGL).
+ // Renderer tests that need a real browser environment (real CSS
+ // layout, ResizeObserver, requestAnimationFrame, WebGL).
extends: true,
- // Tailwind runs here for the same reason it runs in the app build:
- // without it every utility class resolves to nothing, so anything
- // rendered in these tests is unstyled and no test can say a word about
- // how it looks. `electron.vite.config.ts` is the app's build and does
- // not apply to Vitest.
- plugins: [tailwindcss()],
// Crawl the browser tests when deps are first optimized. Without this
// their imports are only discovered once the page loads them, so Vite
// re-optimizes and reloads mid-run — which vitest reports as flaky and
@@@ -103,6 -97,10 +97,11 @@@
entries: ['src/renderer/tests/browser/**/*.test.{ts,tsx}'],
include: ['react/jsx-dev-runtime'],
},
+ // Layout assertions need the real utility classes, not just the class
+ // strings. Only the renderer build carries this plugin, so a browser
- // test importing index.css would otherwise get no Tailwind output.
++ // test importing index.css would otherwise get no Tailwind output —
++ // `electron.vite.config.ts` is the app's build and does not apply here.
+ plugins: [tailwindcss()],
test: {
name: 'browser',
browser: {