Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

app: add Connect your apps experience (#17900)

Eva H30019c87c490
diff --git a/app/cmd/app/app.go b/app/cmd/app/app.go
index 495af3dd0..e770b064c 100644
--- a/app/cmd/app/app.go
+++ b/app/cmd/app/app.go
@@ -372,7 +372,7 @@ func runInitialWindowsUI(
urlSchemeRequest string,
startHiddenFn func(),
handleURLFn func(string),
- showOnboardingFn func(),
+ showUIFn func(string),
) {
if urlSchemeRequest != "" {
handleURLFn(urlSchemeRequest)
@@ -383,8 +383,10 @@ func runInitialWindowsUI(
return
}
if showOnboarding {
- showOnboardingFn()
+ showUIFn("/")
+ return
}
+ showUIFn("/connect")
}
func startHiddenTasks() {
diff --git a/app/cmd/app/app_darwin.go b/app/cmd/app/app_darwin.go
index 401cdbef4..3cede88f8 100644
--- a/app/cmd/app/app_darwin.go
+++ b/app/cmd/app/app_darwin.go
@@ -88,6 +88,11 @@ func ShowUI() {
openUI("/")
}
+//export IsOnboardingActive
+func IsOnboardingActive() C.bool {
+ return C._Bool(wv.OnboardingActive())
+}
+
func openUI(path string) {
if wv.IsRunning() && wv.webview != nil {
showWindow(wv.webview.Window())
@@ -455,6 +460,74 @@ func claudeGatewayPortConflict() bool {
return claudeProxyFail == claudeProxyFailurePortConflict
}
+func getClaudeDesktopConnectionStatus() claudeDesktopStatus {
+ claudeProxyMu.Lock()
+ proxyErr := claudeProxyErr
+ claudeProxyMu.Unlock()
+
+ installed := claudeDesktopInstalled()
+ configured := installed && claudeDesktop.UsesOllamaGateway()
+ return claudeDesktopConnectionStatus(installed, configured, launch.ClaudeDesktopRunning(), proxyErr)
+}
+
+func claudeDesktopConnectionStatus(installed, configured, running bool, proxyErr error) claudeDesktopStatus {
+ return claudeDesktopStatus{
+ Installed: installed,
+ Configured: configured,
+ Connected: configured && proxyErr == nil,
+ Running: running,
+ StartFailed: proxyErr != nil,
+ }
+}
+
+func setClaudeDesktopConnection(enabled bool) error {
+ if !claudeDesktopInstalled() {
+ return errors.New("Claude Desktop is not installed")
+ }
+ return setClaudeGatewayInstalled(enabled, launch.ClaudeDesktopRunning())
+}
+
+func prepareClaudeDesktopConnection() error {
+ if !claudeDesktopInstalled() {
+ return errors.New("Claude Desktop is not installed")
+ }
+ if err := startClaudeAppProxy(); err != nil {
+ return err
+ }
+ err := claudeDesktop.ConfigureAutodiscovery()
+ if !claudeDesktop.UsesOllamaGateway() {
+ stopClaudeAppProxy()
+ }
+ return err
+}
+
+func openClaudeDesktopApplication() error {
+ return launch.OpenClaudeDesktop()
+}
+
+func requestClaudeDesktopInstall() claudeDesktopInstallResult {
+ return claudeDesktopInstallResultFromCode(int(C.installClaudeDesktop()))
+}
+
+func getShowAppsInMenu() bool {
+ return bool(C.ShowAppsInMenu())
+}
+
+func setShowAppsInMenu(visible bool) {
+ C.SetShowAppsInMenu(C._Bool(visible))
+}
+
+func claudeDesktopInstallResultFromCode(code int) claudeDesktopInstallResult {
+ switch code {
+ case int(C.ClaudeInstallerOpened):
+ return claudeDesktopInstallerOpened
+ case int(C.ClaudeInstallCancelled):
+ return claudeDesktopInstallCancelled
+ default:
+ return claudeDesktopInstallFailed
+ }
+}
+
//export RefreshClaudeProxyMenu
func RefreshClaudeProxyMenu() {
claudeProxyMu.Lock()
diff --git a/app/cmd/app/app_darwin.h b/app/cmd/app/app_darwin.h
index 7e553bcd6..025570d6e 100644
--- a/app/cmd/app/app_darwin.h
+++ b/app/cmd/app/app_darwin.h
@@ -26,6 +26,7 @@ extern void Restart();
// extern void Quit();
void StartUI(const char *path);
void ShowUI();
+bool IsOnboardingActive(void);
void StopUI();
void StartUpdate();
void darwinStartHiddenTasks();
@@ -53,3 +54,12 @@ bool ClaudeGatewayPortConflict(void);
int ClaudeGatewayPort(void);
void RefreshClaudeProxyMenu(void);
void updateClaudeProxyMenu(unsigned long long routed);
+bool ShowAppsInMenu(void);
+void SetShowAppsInMenu(bool visible);
+enum ClaudeInstallResult
+{
+ ClaudeInstallCancelled,
+ ClaudeInstallerOpened,
+ ClaudeInstallFailed,
+};
+enum ClaudeInstallResult installClaudeDesktop(void);
diff --git a/app/cmd/app/app_darwin.m b/app/cmd/app/app_darwin.m
index 51e833398..703e43699 100644
--- a/app/cmd/app/app_darwin.m
+++ b/app/cmd/app/app_darwin.m
@@ -14,8 +14,17 @@ extern NSString *SystemWidePath;
static NSString *const ClaudeDownloadURL =
@"https://claude.ai/api/desktop/darwin/universal/dmg/latest/redirect";
static NSString *const ClaudeDownloadPageURL = @"https://claude.com/download";
+static NSString *const ShowAppsInMenuDefaultsKey = @"ShowAppsInMenu";
static NSBundle *OllamaResourceBundle(void);
+static BOOL shouldShowAppsInMenu(void) {
+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+ if ([defaults objectForKey:ShowAppsInMenuDefaultsKey] == nil) {
+ return YES;
+ }
+ return [defaults boolForKey:ShowAppsInMenuDefaultsKey];
+}
+
static NSImage *integrationAppIcon(NSString *appName,
NSString *fallbackSymbolName) {
NSArray<NSString *> *candidates = @[
@@ -316,6 +325,8 @@ static NSImage *integrationAppIcon(NSString *appName,
@property(assign, nonatomic) BOOL claudeAppEnabled;
@property(assign, nonatomic) BOOL claudeAppReady;
@property(strong, nonatomic) IntegrationMenuRow *claudeAppRow;
+@property(strong, nonatomic) NSMenuItem *claudeMenuItem;
+@property(strong, nonatomic) NSMenuItem *claudeMenuSeparatorItem;
@property(strong, nonatomic) NSURLSession *claudeDownloadSession;
@property(strong, nonatomic) NSURLSessionDownloadTask *claudeDownloadTask;
@property(strong, nonatomic) NSAlert *claudeDownloadAlert;
@@ -329,11 +340,12 @@ static NSImage *integrationAppIcon(NSString *appName,
@property(assign, nonatomic) BOOL systemTerminationReplyPending;
@property(strong, nonatomic) NSApplication *systemTerminationApplication;
- (void)openClaudeApp:(id)sender;
-- (void)downloadClaude;
-- (void)finishClaudeDownload;
+- (enum ClaudeInstallResult)downloadClaude;
+- (enum ClaudeInstallResult)finishClaudeDownload;
- (void)showClaudeDownloadFailure:(NSError *)error;
- (void)toggleClaudeAppProxy:(NSButton *)sender;
- (void)refreshClaudeAppState;
+- (void)applyShowAppsInMenu:(BOOL)visible;
- (void)requestQuit;
- (void)completeSystemTermination;
@end
@@ -410,29 +422,31 @@ static NSImage *ollamaApplicationIcon(void) {
[menu setDelegate:self];
[menu setAutoenablesItems:NO];
- NSMenuItem *claudeMenuItem = [[NSMenuItem alloc] initWithTitle:@"Claude"
- action:nil
- keyEquivalent:@""];
- [claudeMenuItem setEnabled:YES];
+ self.claudeMenuItem = [[NSMenuItem alloc] initWithTitle:@"Claude"
+ action:nil
+ keyEquivalent:@""];
+ [self.claudeMenuItem setEnabled:YES];
self.claudeAppRow = [[IntegrationMenuRow alloc]
initWithTitle:@"Claude"
symbolName:@"sparkles"
target:self
openAction:@selector(openClaudeApp:)
toggleAction:@selector(toggleClaudeAppProxy:)];
- [claudeMenuItem setView:self.claudeAppRow];
- [menu addItem:claudeMenuItem];
+ [self.claudeMenuItem setView:self.claudeAppRow];
+ [menu addItem:self.claudeMenuItem];
[self refreshClaudeAppState];
- [menu addItem:[NSMenuItem separatorItem]];
+ self.claudeMenuSeparatorItem = [NSMenuItem separatorItem];
+ [menu addItem:self.claudeMenuSeparatorItem];
+ [self applyShowAppsInMenu:shouldShowAppsInMenu()];
- NSMenuItem *openMenuItem =
- [[NSMenuItem alloc] initWithTitle:@"Open Chat"
- action:@selector(openUI)
+ NSMenuItem *appsMenuItem =
+ [[NSMenuItem alloc] initWithTitle:@"Open Ollama"
+ action:@selector(appsUI)
keyEquivalent:@""];
- [openMenuItem setTarget:self];
- [menu addItem:openMenuItem];
+ [appsMenuItem setTarget:self];
+ [menu addItem:appsMenuItem];
- [menu addItemWithTitle:@"Settings..."
+ [menu addItemWithTitle:@"Settings"
action:@selector(settingsUI)
keyEquivalent:@","];
[menu addItem:[NSMenuItem separatorItem]];
@@ -577,6 +591,8 @@ static NSImage *ollamaApplicationIcon(void) {
darwinStartHiddenTasks();
} else if (showOnboarding) {
StartUI("/");
+ } else {
+ StartUI("/connect");
}
});
}
@@ -597,7 +613,12 @@ static NSImage *ollamaApplicationIcon(void) {
}
- (BOOL)applicationShouldHandleReopen:(NSApplication *)sender hasVisibleWindows:(BOOL)hasVisibleWindows {
- [self openUI];
+ if (IsOnboardingActive()) {
+ ShowUI();
+ return YES;
+ }
+
+ [self appsUI];
return YES;
}
@@ -627,6 +648,11 @@ static NSImage *ollamaApplicationIcon(void) {
RefreshClaudeProxyMenu();
}
+- (void)applyShowAppsInMenu:(BOOL)visible {
+ [self.claudeMenuItem setHidden:!visible];
+ [self.claudeMenuSeparatorItem setHidden:!visible];
+}
+
- (void)menuDidClose:(NSMenu *)menu {
if (menu == self.statusItem.menu) {
[self.claudeAppRow resetHover];
@@ -715,9 +741,9 @@ static NSImage *ollamaApplicationIcon(void) {
}
}
-- (void)downloadClaude {
+- (enum ClaudeInstallResult)downloadClaude {
if (self.claudeDownloadTask != nil) {
- return;
+ return ClaudeInstallCancelled;
}
[self.claudeAppRow setInactiveStatusText:@"Downloading Claude…"];
@@ -761,11 +787,12 @@ static NSImage *ollamaApplicationIcon(void) {
!self.claudeDownloadCompleted) {
self.claudeDownloadCancelled = YES;
[self.claudeDownloadTask cancel];
- return;
+ return ClaudeInstallCancelled;
}
if (self.claudeDownloadCompleted) {
- [self finishClaudeDownload];
+ return [self finishClaudeDownload];
}
+ return ClaudeInstallCancelled;
}
- (void)URLSession:(NSURLSession *)session
@@ -859,7 +886,7 @@ didCompleteWithError:(NSError *)error {
[self finishClaudeDownload];
}
-- (void)finishClaudeDownload {
+- (enum ClaudeInstallResult)finishClaudeDownload {
BOOL cancelled = self.claudeDownloadCancelled;
[self.claudeDownloadProgress stopAnimation:nil];
@@ -877,7 +904,7 @@ didCompleteWithError:(NSError *)error {
self.claudeDownloadedInstallerURL = nil;
self.claudeDownloadCancelled = NO;
self.claudeDownloadCompleted = NO;
- return;
+ return ClaudeInstallCancelled;
}
if (self.claudeDownloadError != nil ||
self.claudeDownloadedInstallerURL == nil) {
@@ -893,10 +920,11 @@ didCompleteWithError:(NSError *)error {
self.claudeDownloadedInstallerURL = nil;
self.claudeDownloadCancelled = NO;
self.claudeDownloadCompleted = NO;
- return;
+ return ClaudeInstallFailed;
}
- if (![[NSWorkspace sharedWorkspace]
- openURL:self.claudeDownloadedInstallerURL]) {
+ BOOL installerOpened = [[NSWorkspace sharedWorkspace]
+ openURL:self.claudeDownloadedInstallerURL];
+ if (!installerOpened) {
NSError *openError = [NSError
errorWithDomain:@"com.ollama.app"
code:4
@@ -908,6 +936,7 @@ didCompleteWithError:(NSError *)error {
self.claudeDownloadedInstallerURL = nil;
self.claudeDownloadCancelled = NO;
self.claudeDownloadCompleted = NO;
+ return installerOpened ? ClaudeInstallerOpened : ClaudeInstallFailed;
}
- (void)toggleClaudeAppProxy:(NSButton *)sender {
@@ -985,6 +1014,10 @@ didCompleteWithError:(NSError *)error {
});
}
+- (void)appsUI {
+ [self uiRequest:@"/connect"];
+}
+
- (void)newChat {
[self uiRequest:@"/c/new"];
}
@@ -1304,16 +1337,29 @@ decidePolicyForNavigationAction:(WKNavigationAction *)action
return nil;
}
-// TODO (jmorganca): the confirm button is always "Confirm"
-// it should be customizable in the future
- (void)webView:(WKWebView *)webView
runJavaScriptConfirmPanelWithMessage:(NSString *)message
initiatedByFrame:(WKFrameInfo *)frame
completionHandler:(void (^)(BOOL))completionHandler {
NSAlert *alert = [[NSAlert alloc] init];
- [alert setMessageText:message];
- [alert addButtonWithTitle:@"Confirm"];
+ [alert setAlertStyle:NSAlertStyleWarning];
+ [alert setIcon:ollamaApplicationIcon()];
+
+ if ([message isEqualToString:@"Restart Claude Desktop to use Ollama? Any running task will stop."]) {
+ [alert setMessageText:@"Restart Claude Desktop to use Ollama?"];
+ [alert setInformativeText:
+ @"Claude Desktop must restart to use Ollama. Any running task will stop."];
+ [alert addButtonWithTitle:@"Restart Claude Desktop"];
+ } else if ([message isEqualToString:@"Restart Claude Desktop to remove Ollama? Any running task will stop."]) {
+ [alert setMessageText:@"Restart Claude Desktop to remove Ollama?"];
+ [alert setInformativeText:
+ @"Claude Desktop must restart to remove Ollama. Any running task will stop."];
+ [alert addButtonWithTitle:@"Restart Claude Desktop"];
+ } else {
+ [alert setMessageText:message];
+ [alert addButtonWithTitle:@"Confirm"];
+ }
[alert addButtonWithTitle:@"Cancel"];
completionHandler([alert runModal] == NSAlertFirstButtonReturn);
@@ -1418,6 +1464,7 @@ decidePolicyForNavigationAction:(WKNavigationAction *)action
AppDelegate *appDelegate;
void run(bool so, bool sh) {
[NSApplication sharedApplication];
+ [NSApp setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameAqua]];
[NSApp setActivationPolicy:NSApplicationActivationPolicyAccessory];
appDelegate = [[AppDelegate alloc] init];
[NSApp setDelegate:appDelegate];
@@ -1815,6 +1862,34 @@ void updateClaudeProxyMenu(unsigned long long routed) {
}
}
+bool ShowAppsInMenu(void) {
+ return shouldShowAppsInMenu();
+}
+
+void SetShowAppsInMenu(bool visible) {
+ [[NSUserDefaults standardUserDefaults]
+ setBool:visible
+ forKey:ShowAppsInMenuDefaultsKey];
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [appDelegate applyShowAppsInMenu:visible];
+ });
+}
+
+enum ClaudeInstallResult installClaudeDesktop(void) {
+ __block enum ClaudeInstallResult result = ClaudeInstallFailed;
+ void (^install)(void) = ^{
+ if (appDelegate != nil) {
+ result = [appDelegate downloadClaude];
+ }
+ };
+ if ([NSThread isMainThread]) {
+ install();
+ } else {
+ dispatch_sync(dispatch_get_main_queue(), install);
+ }
+ return result;
+}
+
void quit() {
dispatch_async(dispatch_get_main_queue(), ^{
[appDelegate quit];
diff --git a/app/cmd/app/app_darwin_test.go b/app/cmd/app/app_darwin_test.go
index 43b26823c..86d234a11 100644
--- a/app/cmd/app/app_darwin_test.go
+++ b/app/cmd/app/app_darwin_test.go
@@ -181,6 +181,48 @@ func TestSetClaudeGatewayInstalledRejectsMissingClaude(t *testing.T) {
}
}
+func TestClaudeDesktopConnectionStatusReportsMissingApp(t *testing.T) {
+ previousInstalled := claudeDesktopInstalled
+ claudeDesktopInstalled = func() bool { return false }
+ t.Cleanup(func() {
+ claudeDesktopInstalled = previousInstalled
+ })
+
+ status := getClaudeDesktopConnectionStatus()
+ if status.Installed || status.Configured || status.Connected {
+ t.Fatalf("Claude status = %+v, want missing and disconnected", status)
+ }
+ if err := setClaudeDesktopConnection(true); err == nil || !strings.Contains(err.Error(), "not installed") {
+ t.Fatalf("setClaudeDesktopConnection error = %v, want missing Claude error", err)
+ }
+ if err := prepareClaudeDesktopConnection(); err == nil || !strings.Contains(err.Error(), "not installed") {
+ t.Fatalf("prepareClaudeDesktopConnection error = %v, want missing Claude error", err)
+ }
+}
+
+func TestClaudeDesktopConnectionStatusSeparatesConfigurationFromGatewayHealth(t *testing.T) {
+ status := claudeDesktopConnectionStatus(true, true, false, errors.New("gateway failed"))
+ if !status.Configured || status.Connected || !status.StartFailed {
+ t.Fatalf("Claude status = %+v, want configured with failed gateway", status)
+ }
+}
+
+func TestClaudeDesktopInstallResultFromCode(t *testing.T) {
+ for _, tt := range []struct {
+ code int
+ want claudeDesktopInstallResult
+ }{
+ {code: 0, want: claudeDesktopInstallCancelled},
+ {code: 1, want: claudeDesktopInstallerOpened},
+ {code: 2, want: claudeDesktopInstallFailed},
+ {code: 99, want: claudeDesktopInstallFailed},
+ } {
+ if got := claudeDesktopInstallResultFromCode(tt.code); got != tt.want {
+ t.Errorf("claudeDesktopInstallResultFromCode(%d) = %q, want %q", tt.code, got, tt.want)
+ }
+ }
+}
+
func TestClaudeGatewayRejectsOllamaHostPortConflict(t *testing.T) {
t.Setenv("OLLAMA_HOST", "0.0.0.0:11435")
diff --git a/app/cmd/app/app_test.go b/app/cmd/app/app_test.go
index 6023d731d..8404688c3 100644
--- a/app/cmd/app/app_test.go
+++ b/app/cmd/app/app_test.go
@@ -94,7 +94,9 @@ func TestRunInitialWindowsUIWithBareURL(t *testing.T) {
t.Fatalf("dispatchURLSchemeRequest() error = %v", err)
}
},
- func() { onboardingCalls++ },
+ func(path string) {
+ onboardingCalls++
+ },
)
if urlCalls != 1 {
@@ -110,3 +112,29 @@ func TestRunInitialWindowsUIWithBareURL(t *testing.T) {
t.Errorf("onboarding opened %d times, want 0", onboardingCalls)
}
}
+
+func TestRunInitialWindowsUIRoutesInteractiveLaunch(t *testing.T) {
+ for _, tt := range []struct {
+ name string
+ showOnboarding bool
+ wantPath string
+ }{
+ {name: "fresh install preserves onboarding", showOnboarding: true, wantPath: "/"},
+ {name: "returning launch opens apps", wantPath: "/connect"},
+ } {
+ t.Run(tt.name, func(t *testing.T) {
+ var gotPath string
+ runInitialWindowsUI(
+ false,
+ tt.showOnboarding,
+ "",
+ func() { t.Fatal("unexpected hidden startup") },
+ func(string) { t.Fatal("unexpected URL handling") },
+ func(path string) { gotPath = path },
+ )
+ if gotPath != tt.wantPath {
+ t.Fatalf("initial UI path = %q, want %q", gotPath, tt.wantPath)
+ }
+ })
+ }
+}
diff --git a/app/cmd/app/app_windows.go b/app/cmd/app/app_windows.go
index 6f32aac32..a1031f9e6 100644
--- a/app/cmd/app/app_windows.go
+++ b/app/cmd/app/app_windows.go
@@ -114,6 +114,10 @@ func (*appCallbacks) UIRunning() bool {
return wv.IsRunning()
}
+func (*appCallbacks) UIOnboarding() bool {
+ return wv.OnboardingActive()
+}
+
func (app *appCallbacks) Quit() {
app.t.Quit()
wv.Terminate()
@@ -197,8 +201,8 @@ func osRun(shutdown func(), hasCompletedFirstRun, startHidden, showOnboarding bo
}
}
}
- runInitialWindowsUI(startHidden, showOnboarding, urlSchemeRequest, startHiddenTasks, handleURLSchemeInCurrentInstance, func() {
- ptr := wv.Run("/")
+ runInitialWindowsUI(startHidden, showOnboarding, urlSchemeRequest, startHiddenTasks, handleURLSchemeInCurrentInstance, func(path string) {
+ ptr := wv.Run(path)
// Set the window icon using the tray icon
if ptr != nil {
diff --git a/app/cmd/app/claude_desktop_bindings_darwin.go b/app/cmd/app/claude_desktop_bindings_darwin.go
new file mode 100644
index 000000000..3015f41ff
--- /dev/null
+++ b/app/cmd/app/claude_desktop_bindings_darwin.go
@@ -0,0 +1,52 @@
+//go:build darwin
+
+package main
+
+import "github.com/ollama/ollama/app/webview"
+
+func bindClaudeDesktop(wv webview.WebView) {
+ wv.Bind("getClaudeDesktopStatus", func() claudeDesktopStatus {
+ return getClaudeDesktopConnectionStatus()
+ })
+
+ wv.Bind("setClaudeDesktopConnected", func(enabled bool) claudeDesktopActionResult {
+ err := setClaudeDesktopConnection(enabled)
+ result := claudeDesktopActionResult{
+ Status: getClaudeDesktopConnectionStatus(),
+ }
+ if err != nil {
+ result.Error = err.Error()
+ }
+ return result
+ })
+
+ wv.Bind("prepareClaudeDesktopConnection", func() claudeDesktopActionResult {
+ err := prepareClaudeDesktopConnection()
+ result := claudeDesktopActionResult{
+ Status: getClaudeDesktopConnectionStatus(),
+ }
+ if err != nil {
+ result.Error = err.Error()
+ }
+ return result
+ })
+
+ wv.Bind("openClaudeDesktop", func() string {
+ if err := openClaudeDesktopApplication(); err != nil {
+ return err.Error()
+ }
+ return ""
+ })
+
+ wv.Bind("installClaudeDesktop", func() claudeDesktopInstallResult {
+ return requestClaudeDesktopInstall()
+ })
+
+ wv.Bind("getShowAppsInMenu", func() bool {
+ return getShowAppsInMenu()
+ })
+
+ wv.Bind("setShowAppsInMenu", func(visible bool) {
+ setShowAppsInMenu(visible)
+ })
+}
diff --git a/app/cmd/app/claude_desktop_bindings_windows.go b/app/cmd/app/claude_desktop_bindings_windows.go
new file mode 100644
index 000000000..a041b9350
--- /dev/null
+++ b/app/cmd/app/claude_desktop_bindings_windows.go
@@ -0,0 +1,7 @@
+//go:build windows
+
+package main
+
+import "github.com/ollama/ollama/app/webview"
+
+func bindClaudeDesktop(_ webview.WebView) {}
diff --git a/app/cmd/app/claude_desktop_status.go b/app/cmd/app/claude_desktop_status.go
new file mode 100644
index 000000000..fd82bbdc9
--- /dev/null
+++ b/app/cmd/app/claude_desktop_status.go
@@ -0,0 +1,24 @@
+//go:build darwin
+
+package main
+
+type claudeDesktopInstallResult string
+
+const (
+ claudeDesktopInstallCancelled claudeDesktopInstallResult = "cancelled"
+ claudeDesktopInstallerOpened claudeDesktopInstallResult = "opened"
+ claudeDesktopInstallFailed claudeDesktopInstallResult = "failed"
+)
+
+type claudeDesktopStatus struct {
+ Installed bool `json:"installed"`
+ Configured bool `json:"configured"`
+ Connected bool `json:"connected"`
+ Running bool `json:"running"`
+ StartFailed bool `json:"startFailed"`
+}
+
+type claudeDesktopActionResult struct {
+ Status claudeDesktopStatus `json:"status"`
+ Error string `json:"error,omitempty"`
+}
diff --git a/app/cmd/app/webview.go b/app/cmd/app/webview.go
index 9178a1119..bf02b15ed 100644
--- a/app/cmd/app/webview.go
+++ b/app/cmd/app/webview.go
@@ -16,6 +16,7 @@ import (
"runtime"
"strings"
"sync"
+ "sync/atomic"
"time"
"unsafe"
@@ -29,13 +30,16 @@ const (
defaultWindowHeight = 960
onboardingWindowWidth = 900
onboardingWindowHeight = 660
+ minimumWindowWidth = onboardingWindowWidth
+ minimumWindowHeight = onboardingWindowHeight
)
type Webview struct {
- port int
- token string
- webview webview.WebView
- mutex sync.Mutex
+ port int
+ token string
+ webview webview.WebView
+ mutex sync.Mutex
+ onboarding atomic.Bool
Store *store.Store
}
@@ -95,85 +99,32 @@ func (w *Webview) Run(path string) unsafe.Pointer {
// Windows-specific scrollbar styling
if runtime.GOOS == "windows" {
init += `
- // Fix scrollbar styling for Edge WebView2 on Windows only
+ // Keep Edge WebView2 scrollbars aligned with the light-only app theme.
function updateScrollbarStyles() {
- const isDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
const existingStyle = document.getElementById('scrollbar-style');
if (existingStyle) existingStyle.remove();
-
+
const style = document.createElement('style');
style.id = 'scrollbar-style';
-
- if (isDark) {
- style.textContent = ` + "`" + `
- ::-webkit-scrollbar { width: 6px !important; height: 6px !important; }
- ::-webkit-scrollbar-track { background: #1a1a1a !important; }
- ::-webkit-scrollbar-thumb { background: #404040 !important; border-radius: 6px !important; }
- ::-webkit-scrollbar-thumb:hover { background: #505050 !important; }
- ::-webkit-scrollbar-corner { background: #1a1a1a !important; }
- ::-webkit-scrollbar-button {
- background: transparent !important;
- border: none !important;
- width: 0px !important;
- height: 0px !important;
- margin: 0 !important;
- padding: 0 !important;
- }
- ::-webkit-scrollbar-button:vertical:start:decrement {
- background: transparent !important;
- height: 0px !important;
- }
- ::-webkit-scrollbar-button:vertical:end:increment {
- background: transparent !important;
- height: 0px !important;
- }
- ::-webkit-scrollbar-button:horizontal:start:decrement {
- background: transparent !important;
- width: 0px !important;
- }
- ::-webkit-scrollbar-button:horizontal:end:increment {
- background: transparent !important;
- width: 0px !important;
- }
- ` + "`" + `;
- } else {
- style.textContent = ` + "`" + `
- ::-webkit-scrollbar { width: 6px !important; height: 6px !important; }
- ::-webkit-scrollbar-track { background: #f0f0f0 !important; }
- ::-webkit-scrollbar-thumb { background: #c0c0c0 !important; border-radius: 6px !important; }
- ::-webkit-scrollbar-thumb:hover { background: #a0a0a0 !important; }
- ::-webkit-scrollbar-corner { background: #f0f0f0 !important; }
- ::-webkit-scrollbar-button {
- background: transparent !important;
- border: none !important;
- width: 0px !important;
- height: 0px !important;
- margin: 0 !important;
- padding: 0 !important;
- }
- ::-webkit-scrollbar-button:vertical:start:decrement {
- background: transparent !important;
- height: 0px !important;
- }
- ::-webkit-scrollbar-button:vertical:end:increment {
- background: transparent !important;
- height: 0px !important;
- }
- ::-webkit-scrollbar-button:horizontal:start:decrement {
- background: transparent !important;
- width: 0px !important;
- }
- ::-webkit-scrollbar-button:horizontal:end:increment {
- background: transparent !important;
- width: 0px !important;
- }
- ` + "`" + `;
- }
+ style.textContent = ` + "`" + `
+ ::-webkit-scrollbar { width: 6px !important; height: 6px !important; }
+ ::-webkit-scrollbar-track { background: #f0f0f0 !important; }
+ ::-webkit-scrollbar-thumb { background: #c0c0c0 !important; border-radius: 6px !important; }
+ ::-webkit-scrollbar-thumb:hover { background: #a0a0a0 !important; }
+ ::-webkit-scrollbar-corner { background: #f0f0f0 !important; }
+ ::-webkit-scrollbar-button {
+ background: transparent !important;
+ border: none !important;
+ width: 0px !important;
+ height: 0px !important;
+ margin: 0 !important;
+ padding: 0 !important;
+ }
+ ` + "`" + `;
document.head.appendChild(style);
}
-
+
window.addEventListener('load', updateScrollbarStyles);
- window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', updateScrollbarStyles);
`
}
// on windows make ctrl+n open new chat
@@ -194,9 +145,10 @@ func (w *Webview) Run(path string) unsafe.Pointer {
`
}
- init += `
+ init += fmt.Sprintf(`
+ window.OLLAMA_PLATFORM = %q;
window.OLLAMA_WEBSEARCH = true;
- `
+ `, runtime.GOOS)
wv.Init(init)
@@ -209,8 +161,11 @@ func (w *Webview) Run(path string) unsafe.Pointer {
e.code === 'NumpadAdd' || e.code === 'NumpadSubtract'
);
- // Keep the fixed onboarding experience at its intended scale.
- if (window.location.pathname === '/onboarding' && isZoomShortcut) {
+ // Keep fixed-scale onboarding and apps pages at their intended size.
+ const isFixedScalePage =
+ window.location.pathname === '/onboarding' ||
+ window.location.pathname === '/connect';
+ if (isFixedScalePage && isZoomShortcut) {
e.preventDefault();
e.stopImmediatePropagation();
return false;
@@ -261,11 +216,14 @@ func (w *Webview) Run(path string) unsafe.Pointer {
showWindow(wv.Window())
})
+ bindClaudeDesktop(wv)
+
wv.Bind("close", func() {
hideWindow(wv.Window())
})
wv.Bind("setOnboardingWindow", func(enabled bool) {
+ w.onboarding.Store(enabled)
wv.Dispatch(func() {
if enabled {
wv.SetSize(onboardingWindowWidth, onboardingWindowHeight, webview.HintFixed)
@@ -284,7 +242,7 @@ func (w *Webview) Run(path string) unsafe.Pointer {
}
wv.SetSize(width, height, webview.HintNone)
- wv.SetSize(800, 600, webview.HintMin)
+ wv.SetSize(minimumWindowWidth, minimumWindowHeight, webview.HintMin)
setOnboardingWindowStyle(wv.Window(), false)
})
})
@@ -509,7 +467,7 @@ func (w *Webview) Run(path string) unsafe.Pointer {
}
}
wv.SetSize(width, height, webview.HintNone)
- wv.SetSize(800, 600, webview.HintMin)
+ wv.SetSize(minimumWindowWidth, minimumWindowHeight, webview.HintMin)
w.webview = wv
w.webview.Navigate(url)
@@ -524,6 +482,7 @@ func (w *Webview) Run(path string) unsafe.Pointer {
}
func (w *Webview) Terminate() {
+ w.onboarding.Store(false)
w.mutex.Lock()
if w.webview == nil {
w.mutex.Unlock()
@@ -537,6 +496,10 @@ func (w *Webview) Terminate() {
wv.Destroy()
}
+func (w *Webview) OnboardingActive() bool {
+ return w.onboarding.Load()
+}
+
func (w *Webview) IsRunning() bool {
w.mutex.Lock()
defer w.mutex.Unlock()
diff --git a/app/ui/app/index.html b/app/ui/app/index.html
index 9e74109ad..6ce0a8477 100644
--- a/app/ui/app/index.html
+++ b/app/ui/app/index.html
@@ -1,13 +1,14 @@
<!doctype html>
-<html lang="en" style="overflow: hidden">
+<html lang="en" style="overflow: hidden; color-scheme: light">
<head>
<meta charset="UTF-8" />
+ <meta name="color-scheme" content="light" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/src/index.css" />
<title>Ollama</title>
</head>
- <body class="dark:bg-neutral-900 select-text">
+ <body class="bg-white select-text">
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
<script>
diff --git a/app/ui/app/public/claude-connected.png b/app/ui/app/public/claude-connected.png
new file mode 100644
index 000000000..02c5fe8b4
Binary files /dev/null and b/app/ui/app/public/claude-connected.png differ
diff --git a/app/ui/app/public/launch-icons/cline.svg b/app/ui/app/public/launch-icons/cline.svg
new file mode 100644
index 000000000..35de6492d
--- /dev/null
+++ b/app/ui/app/public/launch-icons/cline.svg
@@ -0,0 +1,8 @@
+<svg width="92" height="96" viewBox="0 0 92 96" xmlns="http://www.w3.org/2000/svg">
+ <g fill="#24292F">
+ <path fill-rule="evenodd" d="M65.45 16.8c10.89 0 19.71 8.86 19.71 19.8v6.6l5.74 11.46a4 4 0 0 1-.01 3.6l-5.73 11.34v6.6c0 10.94-8.82 19.8-19.71 19.8H26.02C15.13 96 6.31 87.14 6.31 76.2v-6.6L.45 58.3a4 4 0 0 1-.01-3.67l5.87-11.43v-6.6c0-10.94 8.82-19.8 19.71-19.8h39.43Zm-2.52 5.7H29.19c-9.32 0-16.87 7.56-16.87 16.88V45L7.44 54.46a4 4 0 0 0 .01 3.68L12.32 67.5v5.63c0 9.32 7.55 16.87 16.87 16.87h33.74c9.32 0 16.87-7.55 16.87-16.87V67.5l4.77-9.39a4 4 0 0 0 .01-3.61L79.8 45v-5.62c0-9.32-7.55-16.88-16.87-16.88Z"/>
+ <circle cx="45.73" cy="11.5" r="11"/>
+ <rect x="27" y="41" width="13" height="30" rx="6.5"/>
+ <rect x="51" y="41" width="13" height="30" rx="6.5"/>
+ </g>
+</svg>
diff --git a/app/ui/app/public/launch-icons/oh-my-pi.svg b/app/ui/app/public/launch-icons/oh-my-pi.svg
new file mode 100644
index 000000000..97cf27226
--- /dev/null
+++ b/app/ui/app/public/launch-icons/oh-my-pi.svg
@@ -0,0 +1,11 @@
+<svg viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg">
+ <defs>
+ <linearGradient id="omp-gradient" x1="0" y1="0" x2="1" y2="1">
+ <stop offset="0" stop-color="#ed4abf"/>
+ <stop offset=".5" stop-color="#9b4dff"/>
+ <stop offset="1" stop-color="#5ad8e6"/>
+ </linearGradient>
+ </defs>
+ <rect width="64" height="64" rx="12" fill="#0f0a14"/>
+ <path fill="url(#omp-gradient)" d="M14 16h36v8H40v32h-8V24h-6v22h-8V24h-4z"/>
+</svg>
diff --git a/app/ui/app/public/launch-icons/poolside.svg b/app/ui/app/public/launch-icons/poolside.svg
new file mode 100644
index 000000000..a96b03b04
--- /dev/null
+++ b/app/ui/app/public/launch-icons/poolside.svg
@@ -0,0 +1,11 @@
+<svg viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg">
+ <defs>
+ <linearGradient id="poolside-gradient" x1="8" y1="5" x2="55" y2="59" gradientUnits="userSpaceOnUse">
+ <stop stop-color="#6c5cff"/>
+ <stop offset="1" stop-color="#3c2cff"/>
+ </linearGradient>
+ </defs>
+ <rect width="64" height="64" rx="13" fill="url(#poolside-gradient)"/>
+ <path d="M13 32c0-10.5 8.5-19 19-19 10.49 0 19 8.5 19 19s-8.51 19-19 19c-10.5 0-19-8.5-19-19Z" fill="none" stroke="#fff" stroke-width="4"/>
+ <path d="M16 24c8-4.1 17.1-.9 22.6 7.1 4.3-1.2 8.6.5 11 4.1M23.5 47.5 38 17.5" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="4"/>
+</svg>
diff --git a/app/ui/app/public/launch-icons/qwen-code.svg b/app/ui/app/public/launch-icons/qwen-code.svg
new file mode 100644
index 000000000..73610a640
--- /dev/null
+++ b/app/ui/app/public/launch-icons/qwen-code.svg
@@ -0,0 +1,3 @@
+<svg viewBox="0 0 141.38 140" xmlns="http://www.w3.org/2000/svg">
+ <path fill="#6D44E8" d="m140.93 85-16.35-28.33-1.93-3.34 8.66-15a3.32 3.32 0 0 0 0-3.34l-9.62-16.67a3.34 3.34 0 0 0-2.89-1.67H82.23l-8.66-15A3.33 3.33 0 0 0 70.68-.02H51.43a3.33 3.33 0 0 0-2.88 1.67L32.19 29.98l-1.92 3.33H12.96a3.34 3.34 0 0 0-2.88 1.67L.45 51.66a3.32 3.32 0 0 0 0 3.34l18.28 31.67-8.66 15a3.32 3.32 0 0 0 0 3.34l9.62 16.67a3.34 3.34 0 0 0 2.89 1.67h36.56l8.66 15a3.35 3.35 0 0 0 2.89 1.67h19.25a3.34 3.34 0 0 0 2.89-1.67l18.28-31.67h17.32a3.34 3.34 0 0 0 2.89-1.67l9.62-16.67a3.32 3.32 0 0 0-.01-3.34ZM51.44 3.33 61.07 20l-9.63 16.66h76.98l-9.62 16.66H45.67l-11.54-20zM57.21 120H22.58l9.63-16.67h19.25l-38.5-66.67h19.25l9.62 16.67L68.78 100l-11.55 20Zm61.59-33.34-9.62-16.67-38.49 66.67-9.63-16.67 9.63-16.66 26.94-46.67h23.1l17.32 30z"/>
+</svg>
diff --git a/app/ui/app/src/api.test.ts b/app/ui/app/src/api.test.ts
index 456286bca..202886316 100644
--- a/app/ui/app/src/api.test.ts
+++ b/app/ui/app/src/api.test.ts
@@ -1,5 +1,5 @@
import { afterEach, describe, expect, it, vi } from "vitest";
-import { fetchConnectUrl } from "./api";
+import { fetchConnectUrl, getIntegrationStatuses } from "./api";
describe("fetchConnectUrl", () => {
afterEach(() => {
@@ -25,3 +25,50 @@ describe("fetchConnectUrl", () => {
);
});
});
+
+describe("getIntegrationStatuses", () => {
+ afterEach(() => {
+ vi.unstubAllGlobals();
+ });
+
+ it("returns desktop and launcher integration metadata", async () => {
+ const fetch = vi.fn().mockResolvedValue(
+ new Response(
+ JSON.stringify([
+ {
+ id: "claude-desktop",
+ name: "Claude",
+ description: "Use Ollama models in Claude Desktop",
+ installed: true,
+ },
+ {
+ id: "opencode",
+ name: "OpenCode",
+ description: "Open-source coding agent",
+ command: "ollama launch opencode",
+ },
+ ]),
+ { status: 200 },
+ ),
+ );
+ vi.stubGlobal("fetch", fetch);
+
+ await expect(getIntegrationStatuses()).resolves.toEqual([
+ {
+ id: "claude-desktop",
+ name: "Claude",
+ description: "Use Ollama models in Claude Desktop",
+ installed: true,
+ },
+ {
+ id: "opencode",
+ name: "OpenCode",
+ description: "Open-source coding agent",
+ command: "ollama launch opencode",
+ },
+ ]);
+ expect(fetch).toHaveBeenCalledWith(
+ "http://127.0.0.1:3001/api/v1/integrations",
+ );
+ });
+});
diff --git a/app/ui/app/src/api.ts b/app/ui/app/src/api.ts
index 8490e7c07..5459e2d4b 100644
--- a/app/ui/app/src/api.ts
+++ b/app/ui/app/src/api.ts
@@ -32,6 +32,24 @@ export interface CloudStatusResponse {
disabled: boolean;
source: CloudStatusSource;
}
+
+export interface IntegrationStatus {
+ id: string;
+ name: string;
+ description: string;
+ installed?: boolean;
+ command?: string;
+}
+
+export type IntegrationStatuses = IntegrationStatus[];
+
+export async function getIntegrationStatuses(): Promise<IntegrationStatuses> {
+ const response = await fetch(`${API_BASE}/api/v1/integrations`);
+ if (!response.ok) {
+ throw new Error(`Failed to fetch integration statuses: ${response.status}`);
+ }
+ return response.json();
+}
// Helper function to convert Uint8Array to base64
function uint8ArrayToBase64(uint8Array: Uint8Array): string {
const chunkSize = 0x8000; // 32KB chunks to avoid stack overflow
diff --git a/app/ui/app/src/components/AppSidebar.tsx b/app/ui/app/src/components/AppSidebar.tsx
new file mode 100644
index 000000000..81edcfd2d
--- /dev/null
+++ b/app/ui/app/src/components/AppSidebar.tsx
@@ -0,0 +1,43 @@
+import { Link } from "@/components/ui/link";
+import { ChatIcon } from "@/components/ChatIcon";
+import { Cog6ToothIcon, RectangleGroupIcon } from "@heroicons/react/24/outline";
+
+type AppSection = "apps" | "chat" | "settings";
+
+export function AppNavigation({ current }: { current: AppSection }) {
+ const itemClass = (section: AppSection) =>
+ `flex w-full items-center gap-3 rounded-lg px-2 py-2 text-left text-sm text-neutral-700 hover:bg-neutral-100 dark:text-neutral-100 dark:hover:bg-neutral-800 ${
+ current === section ? "bg-neutral-100 dark:bg-neutral-800" : ""
+ }`;
+
+ return (
+ <div className="flex flex-col gap-0.5">
+ <Link to="/connect" className={itemClass("apps")} draggable={false}>
+ <RectangleGroupIcon className="h-5 w-5 stroke-current" />
+ <span className="truncate">Apps</span>
+ </Link>
+ <Link
+ to="/c/$chatId"
+ params={{ chatId: "new" }}
+ mask={{ to: "/" }}
+ className={itemClass("chat")}
+ draggable={false}
+ >
+ <ChatIcon />
+ <span className="truncate">Chat</span>
+ </Link>
+ <Link to="/settings" className={itemClass("settings")} draggable={false}>
+ <Cog6ToothIcon className="h-5 w-5 stroke-current" />
+ <span className="truncate">Settings</span>
+ </Link>
+ </div>
+ );
+}
+
+export function AppSidebar({ current }: { current: AppSection }) {
+ return (
+ <nav className="flex flex-1 flex-col px-4 pb-4 select-none">
+ <AppNavigation current={current} />
+ </nav>
+ );
+}
diff --git a/app/ui/app/src/components/ChatIcon.tsx b/app/ui/app/src/components/ChatIcon.tsx
new file mode 100644
index 000000000..4911cd263
--- /dev/null
+++ b/app/ui/app/src/components/ChatIcon.tsx
@@ -0,0 +1,14 @@
+export function ChatIcon({ className = "h-5 w-5" }: { className?: string }) {
+ return (
+ <svg
+ aria-hidden="true"
+ className={`${className} fill-current`}
+ viewBox="0 0 24 24"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path d="M17.0859 3.39949L15.2135 5.27196H7.27028C5.78649 5.27196 4.94684 6.11336 4.94684 7.59716V16.664C4.94684 18.1558 5.78649 18.9892 7.27028 18.9892H16.3406C17.8324 18.9892 18.6623 18.1558 18.6623 16.664V8.79514L20.5428 6.9115C20.567 7.11532 20.5773 7.33066 20.5773 7.55419V16.7149C20.5773 19.4069 19.0818 20.9024 16.3898 20.9024H7.22107C4.53708 20.9024 3.03357 19.4069 3.03357 16.7149V7.55419C3.03357 4.8622 4.53708 3.35869 7.22107 3.35869H16.3898C16.6329 3.35869 16.8662 3.37094 17.0859 3.39949Z" />
+ <path d="M9.92714 14.381L11.914 13.5403L20.8312 4.63114L19.3404 3.1581L10.433 12.0655L9.55234 13.9964C9.45664 14.2169 9.70293 14.4714 9.92714 14.381ZM21.5767 3.89364L22.2588 3.19384C22.6347 2.80184 22.6435 2.2663 22.2711 1.90536L22.0148 1.64287C21.6822 1.31377 21.1334 1.36513 20.7689 1.72158L20.0859 2.39833L21.5767 3.89364Z" />
+ </svg>
+ );
+}
diff --git a/app/ui/app/src/components/ChatSidebar.tsx b/app/ui/app/src/components/ChatSidebar.tsx
index cd9533e3e..c51ebc86a 100644
--- a/app/ui/app/src/components/ChatSidebar.tsx
+++ b/app/ui/app/src/components/ChatSidebar.tsx
@@ -6,7 +6,7 @@ import { getChat } from "@/api";
import { Link } from "@/components/ui/link";
import { useState, useRef, useEffect, useCallback, useMemo } from "react";
import { ChatsResponse } from "@/gotypes";
-import { CogIcon } from "@heroicons/react/24/outline";
+import { AppNavigation } from "@/components/AppSidebar";
// there's a hidden debug feature to copy a chat's data to the clipboard by
// holding shift and clicking this many times within this many seconds
@@ -258,40 +258,10 @@ export function ChatSidebar({ currentChatId }: ChatSidebarProps) {
);
}
- const isWindows = navigator.platform.toLowerCase().includes("win");
-
return (
<nav className="flex flex-1 flex-col min-h-0 select-none">
<header className="flex flex-col gap-0.5 px-4 pb-2">
- <Link
- href="/c/new"
- mask={{ to: "/" }}
- className={`flex w-full items-center gap-3 rounded-lg px-2 py-2 text-left text-sm text-neutral-700 hover:bg-neutral-100 dark:hover:bg-neutral-800 dark:text-neutral-100 ${
- currentChatId === "new" ? "bg-neutral-100 dark:bg-neutral-800" : ""
- }`}
- draggable={false}
- >
- <svg
- className="h-5 w-5 fill-current"
- viewBox="0 0 24 24"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
- <path d="M17.0859 3.39949L15.2135 5.27196H7.27028C5.78649 5.27196 4.94684 6.11336 4.94684 7.59716V16.664C4.94684 18.1558 5.78649 18.9892 7.27028 18.9892H16.3406C17.8324 18.9892 18.6623 18.1558 18.6623 16.664V8.79514L20.5428 6.9115C20.567 7.11532 20.5773 7.33066 20.5773 7.55419V16.7149C20.5773 19.4069 19.0818 20.9024 16.3898 20.9024H7.22107C4.53708 20.9024 3.03357 19.4069 3.03357 16.7149V7.55419C3.03357 4.8622 4.53708 3.35869 7.22107 3.35869H16.3898C16.6329 3.35869 16.8662 3.37094 17.0859 3.39949Z" />
- <path d="M9.92714 14.381L11.914 13.5403L20.8312 4.63114L19.3404 3.1581L10.433 12.0655L9.55234 13.9964C9.45664 14.2169 9.70293 14.4714 9.92714 14.381ZM21.5767 3.89364L22.2588 3.19384C22.6347 2.80184 22.6435 2.2663 22.2711 1.90536L22.0148 1.64287C21.6822 1.31377 21.1334 1.36513 20.7689 1.72158L20.0859 2.39833L21.5767 3.89364Z" />
- </svg>
- <span className="truncate">New Chat</span>
- </Link>
- {isWindows && (
- <Link
- href="/settings"
- className={`flex w-full items-center gap-3 rounded-lg px-2 py-2 text-left text-sm text-neutral-700 hover:bg-neutral-100 dark:hover:bg-neutral-800 dark:text-neutral-300`}
- draggable={false}
- >
- <CogIcon className="h-5 w-5 stroke-current" />
- <span className="truncate">Settings</span>
- </Link>
- )}
+ <AppNavigation current="chat" />
</header>
<div className="flex flex-1 flex-col px-4 py-1 overflow-y-auto overscroll-auto scrollbar-gutter">
<div className="flex flex-col gap-3 pt-4">
diff --git a/app/ui/app/src/components/Onboarding.test.tsx b/app/ui/app/src/components/Onboarding.test.tsx
index dca3b6767..066089950 100644
--- a/app/ui/app/src/components/Onboarding.test.tsx
+++ b/app/ui/app/src/components/Onboarding.test.tsx
@@ -2,17 +2,25 @@ import { renderToStaticMarkup } from "react-dom/server";
import { describe, expect, it, vi } from "vitest";
import {
FIRST_MODEL_COMMAND,
+ ConnectAppsScreen,
IntroScreen,
default as Onboarding,
RunOllamaScreen,
+ terminalRowsForWindowHeight,
WelcomeScreen,
} from "./Onboarding";
+import {
+ CLAUDE_INSTALL_TIMEOUT_MS,
+ isClaudeConnectionComplete,
+ scheduleClaudeInstallTimeout,
+} from "@/lib/claudeDesktop";
+import { isWindowsPlatform } from "@/lib/platform";
import {
authenticationTimeoutAction,
- isOnboardingZoomShortcut,
nextOnboardingStep,
onboardingConnectUrl,
} from "@/lib/onboarding";
+import type { IntegrationStatuses } from "@/api";
describe("Onboarding", () => {
it("explains what Ollama is before asking the user to choose a path", () => {
@@ -38,44 +46,64 @@ describe("Onboarding", () => {
expect(html).not.toContain("Skip");
});
- it("blocks browser zoom shortcuts during onboarding", () => {
- expect(
- isOnboardingZoomShortcut({
- metaKey: true,
- ctrlKey: false,
- key: "=",
- code: "Equal",
- }),
- ).toBe(true);
- expect(
- isOnboardingZoomShortcut({
- metaKey: false,
- ctrlKey: true,
- key: "-",
- code: "Minus",
- }),
- ).toBe(true);
- expect(
- isOnboardingZoomShortcut({
- metaKey: false,
- ctrlKey: false,
- key: "+",
- code: "Equal",
- }),
- ).toBe(false);
- expect(
- isOnboardingZoomShortcut({
- metaKey: true,
- ctrlKey: false,
- key: "0",
- code: "Digit0",
- }),
- ).toBe(false);
+ it("shows more terminal integrations as the window gets taller", () => {
+ expect(terminalRowsForWindowHeight(400)).toBe(1);
+ expect(terminalRowsForWindowHeight(660)).toBe(4);
+ expect(terminalRowsForWindowHeight(960)).toBe(8);
+ });
+
+ it("renders the apps screen without browser platform globals", () => {
+ vi.stubGlobal("navigator", undefined);
+ try {
+ expect(() =>
+ renderToStaticMarkup(<ConnectAppsScreen initialIntegrations={[]} />),
+ ).not.toThrow();
+ } finally {
+ vi.unstubAllGlobals();
+ }
+ });
+
+ it("hides the Claude application on Windows", () => {
+ vi.stubGlobal("window", {
+ OLLAMA_PLATFORM: "windows",
+ innerHeight: 660,
+ });
+ vi.stubGlobal("navigator", { platform: "MacIntel" });
+ try {
+ expect(isWindowsPlatform()).toBe(true);
+ const html = renderToStaticMarkup(
+ <ConnectAppsScreen
+ initialIntegrations={[
+ {
+ id: "claude-desktop",
+ name: "Claude",
+ description: "Use Ollama models in Claude Desktop",
+ installed: true,
+ },
+ {
+ id: "claude",
+ name: "Claude Code",
+ description: "Anthropic's coding tool with subagents",
+ command: "ollama launch claude",
+ },
+ ]}
+ />,
+ );
+
+ expect(html).not.toContain('id="applications-heading"');
+ expect(html).not.toContain("Use Ollama models in Claude Desktop");
+ expect(html).toContain('id="terminal-heading"');
+ expect(html).toContain("ollama launch claude");
+ } finally {
+ vi.unstubAllGlobals();
+ }
});
it("shows the account choice only to signed-out users", () => {
expect(nextOnboardingStep("intro", "continue", false)).toBe("welcome");
- expect(nextOnboardingStep("intro", "continue", true)).toBe("run");
+ expect(nextOnboardingStep("intro", "continue", true)).toBe("apps");
+ expect(nextOnboardingStep("welcome", "authenticated", true)).toBe("apps");
+ expect(nextOnboardingStep("apps", "continue", true)).toBe("apps");
expect(nextOnboardingStep("welcome", "local", false)).toBe("run");
});
@@ -85,6 +113,48 @@ describe("Onboarding", () => {
expect(authenticationTimeoutAction(true, true)).toBe("ignore");
});
+ it("finishes Claude connection states from the native status hook", () => {
+ const status = {
+ installed: true,
+ configured: true,
+ connected: true,
+ running: false,
+ startFailed: false,
+ };
+
+ expect(isClaudeConnectionComplete(true, status)).toBe(true);
+ expect(
+ isClaudeConnectionComplete(true, { ...status, connected: false }),
+ ).toBe(false);
+ expect(
+ isClaudeConnectionComplete(true, { ...status, startFailed: true }),
+ ).toBe(false);
+ expect(
+ isClaudeConnectionComplete(false, {
+ ...status,
+ configured: false,
+ connected: false,
+ }),
+ ).toBe(true);
+ });
+
+ it("bounds the Claude installer wait", () => {
+ vi.useFakeTimers();
+ vi.stubGlobal("window", { setTimeout: globalThis.setTimeout });
+ const onTimeout = vi.fn();
+
+ try {
+ scheduleClaudeInstallTimeout(onTimeout);
+ vi.advanceTimersByTime(CLAUDE_INSTALL_TIMEOUT_MS - 1);
+ expect(onTimeout).not.toHaveBeenCalled();
+ vi.advanceTimersByTime(1);
+ expect(onTimeout).toHaveBeenCalledOnce();
+ } finally {
+ vi.useRealTimers();
+ vi.unstubAllGlobals();
+ }
+ });
+
it("opens the device connection flow without relaunching the app", () => {
expect(
onboardingConnectUrl(
@@ -102,25 +172,218 @@ describe("Onboarding", () => {
);
});
- it("shows Run Ollama after a successful connection and hides sign in", () => {
+ it("preserves the intro for a device that is already connected", () => {
const html = renderToStaticMarkup(
<Onboarding
isAuthenticated
isSigningIn={false}
signInError={null}
completionError={null}
+ onOpenApps={vi.fn().mockResolvedValue(true)}
onSignIn={vi.fn()}
+ onSignUp={vi.fn()}
onRetryCompletion={vi.fn()}
onUseLocal={vi.fn()}
- showRun
/>,
);
- expect(html).toContain("Run Ollama");
- expect(html).not.toContain("Welcome to Ollama");
+ expect(html).toContain("Welcome to Ollama");
+ expect(html).not.toContain("Run Ollama");
expect(html).not.toContain("Sign up");
});
+ it("groups disconnected Claude with applications and terminal separately", () => {
+ const integrations: IntegrationStatuses = [
+ {
+ id: "claude-desktop",
+ name: "Claude",
+ description: "Use Ollama models in Claude Desktop",
+ installed: true,
+ },
+ {
+ id: "claude",
+ name: "Claude Code",
+ description: "Anthropic's coding tool with subagents",
+ command: "ollama launch claude",
+ },
+ {
+ id: "codex",
+ name: "Codex",
+ description: "OpenAI's open-source coding agent",
+ command: "ollama launch codex",
+ },
+ {
+ id: "openclaw",
+ name: "OpenClaw",
+ description: "Personal AI with 100+ skills",
+ command: "ollama launch openclaw",
+ },
+ {
+ id: "opencode",
+ name: "OpenCode",
+ description: "Anomaly's open-source coding agent",
+ command: "ollama launch opencode",
+ },
+ {
+ id: "droid",
+ name: "Droid",
+ description: "AI software engineering agent",
+ command: "ollama launch droid",
+ },
+ {
+ id: "terminal",
+ name: "Terminal",
+ description: "Run local models from your terminal",
+ command: "ollama",
+ },
+ ];
+ const html = renderToStaticMarkup(
+ <ConnectAppsScreen initialIntegrations={integrations} />,
+ );
+
+ expect(html).toContain('id="applications-heading"');
+ expect(html).toContain('id="terminal-heading"');
+ expect(html.indexOf("Application")).toBeLessThan(
+ html.indexOf("Use Ollama models in Claude Desktop"),
+ );
+ expect(html).toContain('aria-label="Connect Claude"');
+ expect(html).toContain('role="switch"');
+ expect(html).toContain('aria-checked="false"');
+ expect(html).not.toContain("Inactive");
+ expect(html).not.toContain("Active");
+ expect(html).toContain('aria-label="Copy OpenCode command"');
+ expect(html).toContain('aria-label="Copy Terminal command"');
+ expect(html).not.toContain("ChatGPT");
+ expect(html).toContain('aria-label="Show more apps"');
+ expect(html).toContain('aria-expanded="false"');
+ expect(html).toContain("grid-rows-[0fr]");
+ expect(html).toContain("/launch-icons/claude.svg");
+ expect(html).toContain("/launch-icons/claude-code.svg");
+ expect(html).toContain("Run local models from your terminal");
+ });
+
+ it("keeps connected Claude in Application without an idle status", () => {
+ const html = renderToStaticMarkup(
+ <ConnectAppsScreen
+ initialClaudeStatus={{
+ installed: true,
+ configured: true,
+ connected: true,
+ running: false,
+ startFailed: false,
+ }}
+ initialIntegrations={[
+ {
+ id: "claude-desktop",
+ name: "Claude",
+ description: "Use Ollama models in Claude Desktop",
+ installed: true,
+ },
+ {
+ id: "codex",
+ name: "Codex",
+ description: "OpenAI's open-source coding agent",
+ command: "ollama launch codex",
+ },
+ ]}
+ />,
+ );
+
+ expect(html).toContain('id="applications-heading"');
+ expect(html).not.toContain('id="claude-apps-heading"');
+ expect(html).not.toContain("Ready to launch");
+ expect(html).not.toContain("Active");
+ expect(html).not.toContain("Inactive");
+ expect(html).toContain('aria-checked="true"');
+ expect(html).toContain('aria-label="Disconnect Claude"');
+ });
+
+ it("keeps failed configured Claude disconnectable", () => {
+ const html = renderToStaticMarkup(
+ <ConnectAppsScreen
+ initialClaudeStatus={{
+ installed: true,
+ configured: true,
+ connected: false,
+ running: false,
+ startFailed: true,
+ }}
+ initialIntegrations={[
+ {
+ id: "claude-desktop",
+ name: "Claude",
+ description: "Use Ollama models in Claude Desktop",
+ installed: true,
+ },
+ ]}
+ />,
+ );
+
+ expect(html).toContain('aria-checked="true"');
+ expect(html).toContain('aria-label="Disconnect Claude"');
+ expect(html).toContain("Ollama couldn’t start the Claude connection.");
+ });
+
+ it("keeps Claude available without a separate not-installed group", () => {
+ const html = renderToStaticMarkup(
+ <ConnectAppsScreen
+ initialIntegrations={[
+ {
+ id: "claude-desktop",
+ name: "Claude",
+ description: "Use Ollama models in Claude Desktop",
+ installed: false,
+ },
+ ]}
+ />,
+ );
+
+ expect(html).toContain("Use Ollama models in Claude Desktop");
+ expect(html).toContain('aria-label="Connect Claude"');
+ expect(html).toContain("Download &amp; connect");
+ expect(html).not.toContain("Inactive");
+ expect(html).not.toContain("Not installed");
+ expect(html).not.toContain('disabled=""');
+ });
+
+ it("uses branded icons for the remaining launcher integrations", () => {
+ const html = renderToStaticMarkup(
+ <ConnectAppsScreen
+ initialIntegrations={[
+ {
+ id: "cline",
+ name: "Cline",
+ description: "Autonomous coding agent",
+ command: "ollama launch cline",
+ },
+ {
+ id: "omp",
+ name: "Oh My Pi",
+ description: "AI coding agent",
+ command: "ollama launch omp",
+ },
+ {
+ id: "pool",
+ name: "Poolside",
+ description: "Poolside's coding agent",
+ command: "ollama launch pool",
+ },
+ {
+ id: "qwen",
+ name: "Qwen Code",
+ description: "Qwen's coding agent",
+ command: "ollama launch qwen",
+ },
+ ]}
+ />,
+ );
+
+ expect(html).toContain("/launch-icons/cline.svg");
+ expect(html).toContain("/launch-icons/oh-my-pi.svg");
+ expect(html).toContain("/launch-icons/poolside.svg");
+ expect(html).toContain("/launch-icons/qwen-code.svg");
+ });
+
it("offers cloud sign-up, local setup, and sign in on the welcome screen", () => {
const html = renderToStaticMarkup(
<WelcomeScreen
diff --git a/app/ui/app/src/components/Onboarding.tsx b/app/ui/app/src/components/Onboarding.tsx
index a451c7fdf..9ca79bf9f 100644
--- a/app/ui/app/src/components/Onboarding.tsx
+++ b/app/ui/app/src/components/Onboarding.tsx
@@ -1,19 +1,80 @@
import CopyButton from "@/components/CopyButton";
import Logo from "@/components/Logo";
+import { nextOnboardingStep, type OnboardingStep } from "@/lib/onboarding";
import {
- isOnboardingZoomShortcut,
- nextOnboardingStep,
- type OnboardingStep,
-} from "@/lib/onboarding";
+ getIntegrationStatuses,
+ type IntegrationStatus,
+ type IntegrationStatuses,
+} from "@/api";
+import { INTEGRATION_ICONS } from "@/lib/launchCommands";
import {
+ isClaudeConnectionComplete,
+ scheduleClaudeInstallTimeout,
+} from "@/lib/claudeDesktop";
+import { isWindowsPlatform } from "@/lib/platform";
+import type { ClaudeDesktopStatus } from "@/types/webview";
+import { copyTextToClipboard } from "@/utils/clipboard";
+import {
+ ArrowPathIcon,
ArrowsRightLeftIcon,
CommandLineIcon,
ShieldCheckIcon,
+ Square2StackIcon,
+ XMarkIcon,
} from "@heroicons/react/24/outline";
-import { useEffect, useState, type ReactNode } from "react";
+import {
+ CheckIcon,
+ ChevronDownIcon,
+ ChevronUpIcon,
+} from "@heroicons/react/20/solid";
+import {
+ useCallback,
+ useEffect,
+ useRef,
+ useState,
+ type ReactNode,
+} from "react";
export const FIRST_MODEL_COMMAND = "ollama";
+type ClaudeConnectPhase =
+ | "idle"
+ | "installing"
+ | "waiting-for-install"
+ | "connecting"
+ | "launching"
+ | "disconnecting";
+
+const CLAUDE_CONNECTION_POLL_INTERVAL_MS = 500;
+const CLAUDE_CONNECTION_TIMEOUT_MS = 45_000;
+const CLAUDE_CONNECTED_INTRO_KEY = "ollama.claude-connected-intro-seen";
+const MINIMUM_APP_WINDOW_HEIGHT = 660;
+const TERMINAL_ROW_HEIGHT_WITH_GAP = 80;
+const TERMINAL_LIST_RESERVED_HEIGHT = 296;
+
+function hasSeenClaudeConnectedIntro() {
+ return window.localStorage.getItem(CLAUDE_CONNECTED_INTRO_KEY) === "true";
+}
+
+function setClaudeConnection(enabled: boolean, deferLaunch = false) {
+ if (enabled && deferLaunch && window.prepareClaudeDesktopConnection) {
+ return window.prepareClaudeDesktopConnection();
+ }
+ if (!window.setClaudeDesktopConnected) {
+ throw new Error("Claude Desktop connection is unavailable");
+ }
+ return window.setClaudeDesktopConnected(enabled);
+}
+
+export function terminalRowsForWindowHeight(height: number): number {
+ return Math.max(
+ 1,
+ Math.floor(
+ (height - TERMINAL_LIST_RESERVED_HEIGHT) / TERMINAL_ROW_HEIGHT_WITH_GAP,
+ ),
+ );
+}
+
interface ScreenProps {
isSigningIn: boolean;
signInError: string | null;
@@ -22,6 +83,8 @@ interface ScreenProps {
interface WelcomeScreenProps extends ScreenProps {
isAuthenticated: boolean;
+ completionError?: string | null;
+ onRetryCompletion?: () => void;
onLocal: () => void;
onSignUp: () => void;
}
@@ -31,6 +94,11 @@ interface RunOllamaScreenProps {
onRetryCompletion: () => void;
}
+interface ConnectAppsScreenProps {
+ initialIntegrations?: IntegrationStatuses;
+ initialClaudeStatus?: ClaudeDesktopStatus;
+}
+
function TitleBar({ onSignIn }: { onSignIn?: () => void }) {
const isMacOS =
typeof navigator !== "undefined" &&
@@ -96,7 +164,15 @@ const OLLAMA_FEATURES = [
},
];
-export function IntroScreen({ onContinue }: { onContinue: () => void }) {
+export function IntroScreen({
+ completionError = null,
+ onContinue,
+ onRetryCompletion,
+}: {
+ completionError?: string | null;
+ onContinue: () => void;
+ onRetryCompletion?: () => void;
+}) {
return (
<main className="flex h-screen w-full flex-col overflow-hidden bg-white text-neutral-950">
<TitleBar />
@@ -145,6 +221,16 @@ export function IntroScreen({ onContinue }: { onContinue: () => void }) {
>
Continue
</button>
+ <InlineError message={completionError} />
+ {completionError && onRetryCompletion && (
+ <button
+ type="button"
+ className="mt-2 cursor-pointer rounded-md px-3 py-1 text-sm font-normal text-neutral-600 underline decoration-neutral-300 underline-offset-4 hover:text-neutral-950 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-500"
+ onClick={onRetryCompletion}
+ >
+ Try again
+ </button>
+ )}
</div>
</section>
</main>
@@ -171,9 +257,11 @@ export function WelcomeScreen({
isAuthenticated,
isSigningIn,
signInError,
+ completionError = null,
onSignIn,
onSignUp,
onLocal,
+ onRetryCompletion,
}: WelcomeScreenProps) {
return (
<main className="flex min-h-screen w-full flex-col bg-white text-neutral-950">
@@ -207,7 +295,16 @@ export function WelcomeScreen({
>
No thanks, I&apos;ll use Ollama locally
</button>
- <InlineError message={signInError} />
+ <InlineError message={signInError ?? completionError} />
+ {completionError && onRetryCompletion && (
+ <button
+ type="button"
+ className="mt-2 cursor-pointer rounded-md px-3 py-1 text-sm font-normal text-neutral-600 underline decoration-neutral-300 underline-offset-4 hover:text-neutral-950 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-500"
+ onClick={onRetryCompletion}
+ >
+ Try again
+ </button>
+ )}
</div>
</OnboardingCard>
</main>
@@ -258,17 +355,685 @@ export function RunOllamaScreen({
);
}
+function LaunchCommandIcon({ item }: { item: IntegrationStatus }) {
+ const icon = INTEGRATION_ICONS[item.id];
+
+ return (
+ <div className="flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-xl bg-transparent">
+ {icon ? (
+ <img
+ src={icon.src}
+ alt=""
+ className={`${icon.className ?? "h-7 w-7"} rounded-sm object-contain`}
+ />
+ ) : (
+ <CommandLineIcon className="h-6 w-6 stroke-[1.5] text-neutral-700" />
+ )}
+ </div>
+ );
+}
+
+export function ConnectAppsScreen({
+ initialIntegrations,
+ initialClaudeStatus,
+}: ConnectAppsScreenProps) {
+ const isWindows = isWindowsPlatform();
+ const [copiedCommand, setCopiedCommand] = useState<string | null>(null);
+ const [claudeError, setClaudeError] = useState<string | null>(null);
+ const [claudeStatus, setClaudeStatus] = useState<ClaudeDesktopStatus | null>(
+ initialClaudeStatus ?? null,
+ );
+ const [claudePhase, setClaudePhase] = useState<ClaudeConnectPhase>("idle");
+ const [showClaudeConnectedIntro, setShowClaudeConnectedIntro] =
+ useState(false);
+ const claudeConnectedIntroPending = useRef(false);
+ const [integrationStatuses, setIntegrationStatuses] =
+ useState<IntegrationStatuses | null>(initialIntegrations ?? null);
+ const [showAllIntegrations, setShowAllIntegrations] = useState(false);
+ const [collapsedIntegrationCount, setCollapsedIntegrationCount] = useState(
+ () =>
+ terminalRowsForWindowHeight(
+ typeof window === "undefined"
+ ? MINIMUM_APP_WINDOW_HEIGHT
+ : window.innerHeight,
+ ),
+ );
+ const [statusError, setStatusError] = useState(false);
+
+ useEffect(() => {
+ const updateCollapsedIntegrationCount = () => {
+ setCollapsedIntegrationCount(
+ terminalRowsForWindowHeight(window.innerHeight),
+ );
+ };
+
+ window.addEventListener("resize", updateCollapsedIntegrationCount);
+ return () => {
+ window.removeEventListener("resize", updateCollapsedIntegrationCount);
+ };
+ }, []);
+
+ useEffect(() => {
+ if (initialIntegrations) return;
+
+ let active = true;
+ getIntegrationStatuses()
+ .then((statuses) => {
+ if (active) setIntegrationStatuses(statuses);
+ })
+ .catch(() => {
+ if (active) setStatusError(true);
+ });
+
+ return () => {
+ active = false;
+ };
+ }, [initialIntegrations]);
+
+ useEffect(() => {
+ if (!copiedCommand && !claudeError) return;
+
+ const timeout = window.setTimeout(() => {
+ setCopiedCommand(null);
+ setClaudeError(null);
+ }, 5000);
+
+ return () => window.clearTimeout(timeout);
+ }, [claudeError, copiedCommand]);
+
+ const refreshClaudeStatus = useCallback(async () => {
+ if (isWindows) return null;
+ if (!window.getClaudeDesktopStatus) return null;
+ try {
+ const status = await window.getClaudeDesktopStatus();
+ setClaudeStatus(status);
+ return status;
+ } catch {
+ setClaudeError("Ollama could not read the Claude connection status.");
+ return null;
+ }
+ }, [isWindows]);
+
+ const openConnectedClaude = useCallback(
+ async (status: ClaudeDesktopStatus) => {
+ if (!status.connected || status.running || !window.openClaudeDesktop) {
+ return null;
+ }
+ try {
+ return (await window.openClaudeDesktop()) || null;
+ } catch {
+ return "Ollama connected Claude, but could not open the app.";
+ }
+ },
+ [],
+ );
+
+ const finishClaudeConnection = useCallback(
+ async (status: ClaudeDesktopStatus) => {
+ if (claudeConnectedIntroPending.current) return null;
+ if (
+ status.connected &&
+ !status.startFailed &&
+ !hasSeenClaudeConnectedIntro()
+ ) {
+ claudeConnectedIntroPending.current = true;
+ setShowClaudeConnectedIntro(true);
+ window.activateOllama?.();
+ return null;
+ }
+
+ return openConnectedClaude(status);
+ },
+ [openConnectedClaude],
+ );
+
+ const dismissClaudeConnectedIntro = async () => {
+ claudeConnectedIntroPending.current = false;
+ window.localStorage.setItem(CLAUDE_CONNECTED_INTRO_KEY, "true");
+ setShowClaudeConnectedIntro(false);
+ if (!window.setClaudeDesktopConnected) return;
+ setClaudePhase("launching");
+ try {
+ const result = await window.setClaudeDesktopConnected(true);
+ setClaudeStatus(result.status);
+ setClaudeError(result.error || null);
+ } catch {
+ setClaudeError("Ollama connected Claude, but could not open the app.");
+ } finally {
+ setClaudePhase("idle");
+ }
+ };
+
+ useEffect(() => {
+ void refreshClaudeStatus();
+ const handleFocus = () => void refreshClaudeStatus();
+ window.addEventListener("focus", handleFocus);
+ return () => window.removeEventListener("focus", handleFocus);
+ }, [refreshClaudeStatus]);
+
+ useEffect(() => {
+ if (claudePhase !== "connecting" && claudePhase !== "disconnecting") {
+ return;
+ }
+ if (!window.getClaudeDesktopStatus) return;
+
+ const enabling = claudePhase === "connecting";
+ let active = true;
+ let checking = false;
+
+ const checkConnection = async () => {
+ if (!active || checking || !window.getClaudeDesktopStatus) return;
+ checking = true;
+ try {
+ const status = await window.getClaudeDesktopStatus();
+ if (!active) return;
+ setClaudeStatus(status);
+ if (!isClaudeConnectionComplete(enabling, status)) return;
+
+ const openError = enabling
+ ? await finishClaudeConnection(status)
+ : null;
+ if (!active) return;
+ setClaudeError(openError);
+ setClaudePhase("idle");
+ } catch {
+ // Keep polling until the native action completes or the timeout fires.
+ } finally {
+ checking = false;
+ }
+ };
+
+ void checkConnection();
+ const interval = window.setInterval(
+ checkConnection,
+ CLAUDE_CONNECTION_POLL_INTERVAL_MS,
+ );
+ const timeout = window.setTimeout(() => {
+ if (!active) return;
+ setClaudeError(
+ enabling
+ ? "Claude is taking too long to connect. Check Claude and try again."
+ : "Claude is taking too long to disconnect. Try again.",
+ );
+ setClaudePhase("idle");
+ }, CLAUDE_CONNECTION_TIMEOUT_MS);
+
+ return () => {
+ active = false;
+ window.clearInterval(interval);
+ window.clearTimeout(timeout);
+ };
+ }, [claudePhase, finishClaudeConnection]);
+
+ useEffect(() => {
+ if (claudePhase !== "waiting-for-install") return;
+
+ let active = true;
+ let completing = false;
+ const checkForInstall = async () => {
+ if (!window.getClaudeDesktopStatus || !window.setClaudeDesktopConnected) {
+ return;
+ }
+ try {
+ const status = await window.getClaudeDesktopStatus();
+ if (!active) return;
+ setClaudeStatus(status);
+ if (!status.installed || completing) return;
+ completing = true;
+
+ if (status.running) {
+ setClaudePhase("idle");
+ setClaudeError(
+ "Claude is installed. Turn on Connect to restart it with Ollama.",
+ );
+ return;
+ }
+
+ setClaudePhase("connecting");
+ const result = await setClaudeConnection(
+ true,
+ !hasSeenClaudeConnectedIntro(),
+ );
+ if (!active) return;
+ setClaudeStatus(result.status);
+ let actionError = result.error || null;
+ if (!actionError && result.status.connected) {
+ actionError = await finishClaudeConnection(result.status);
+ } else if (!actionError) {
+ actionError = "Ollama could not connect to Claude.";
+ }
+ setClaudeError(actionError);
+ setClaudePhase("idle");
+ } catch {
+ if (!active) return;
+ setClaudePhase("idle");
+ setClaudeError("Ollama could not finish connecting Claude.");
+ }
+ };
+
+ void checkForInstall();
+ const interval = window.setInterval(checkForInstall, 1000);
+ const timeout = scheduleClaudeInstallTimeout(() => {
+ if (!active) return;
+ setClaudePhase("idle");
+ setClaudeError("Claude installation wasn’t detected. Try again.");
+ });
+ return () => {
+ active = false;
+ window.clearInterval(interval);
+ window.clearTimeout(timeout);
+ };
+ }, [claudePhase, finishClaudeConnection]);
+
+ const copyLaunchCommand = async (item: IntegrationStatus) => {
+ if (item.command && (await copyTextToClipboard(item.command))) {
+ setClaudeError(null);
+ setCopiedCommand(item.command);
+ }
+ };
+
+ const connectClaude = async () => {
+ if (claudePhase !== "idle") return;
+ if (!window.getClaudeDesktopStatus || !window.setClaudeDesktopConnected) {
+ setClaudeError("Claude connection is available in the Ollama macOS app.");
+ return;
+ }
+
+ setCopiedCommand(null);
+ setClaudeError(null);
+ const status = await refreshClaudeStatus();
+ if (!status) return;
+ const enabling = !status.configured;
+ if (enabling && !status.installed) {
+ if (!window.installClaudeDesktop) {
+ setClaudeError("Ollama could not open the Claude installer.");
+ return;
+ }
+ setClaudePhase("installing");
+ let installResult: "opened" | "cancelled" | "failed" = "failed";
+ try {
+ installResult = await window.installClaudeDesktop();
+ } catch {
+ // The error below is shared with a rejected native install request.
+ }
+ if (installResult === "cancelled") {
+ setClaudePhase("idle");
+ return;
+ }
+ if (installResult !== "opened") {
+ setClaudePhase("idle");
+ setClaudeError("Ollama could not open the Claude installer.");
+ return;
+ }
+ setClaudePhase("waiting-for-install");
+ return;
+ }
+
+ if (status.running) {
+ const confirmed = window.confirm(
+ enabling
+ ? "Restart Claude Desktop to use Ollama? Any running task will stop."
+ : "Restart Claude Desktop to remove Ollama? Any running task will stop.",
+ );
+ if (!confirmed) return;
+ }
+
+ setClaudePhase(enabling ? "connecting" : "disconnecting");
+ try {
+ const result = await setClaudeConnection(
+ enabling,
+ enabling && !hasSeenClaudeConnectedIntro(),
+ );
+ setClaudeStatus(result.status);
+ let actionError = result.error || null;
+ if (!actionError && enabling && result.status.connected) {
+ const openError = await finishClaudeConnection(result.status);
+ actionError = openError;
+ } else if (
+ !actionError &&
+ (enabling ? !result.status.connected : result.status.configured)
+ ) {
+ actionError = enabling
+ ? "Ollama could not connect to Claude."
+ : "Ollama could not disconnect from Claude.";
+ }
+ setClaudeError(actionError);
+ } catch {
+ setClaudeError(
+ enabling
+ ? "Ollama could not connect to Claude."
+ : "Ollama could not disconnect from Claude.",
+ );
+ } finally {
+ setClaudePhase("idle");
+ }
+ };
+
+ const claudeIntegration = isWindows
+ ? undefined
+ : integrationStatuses?.find((item) => item.id === "claude-desktop");
+ const launchIntegrations =
+ integrationStatuses?.filter(
+ (item) => item.id !== "claude-desktop" && item.command,
+ ) ?? [];
+ const claudeConfigured = claudeStatus?.configured ?? false;
+ const claudeConnected = claudeStatus?.connected ?? false;
+ const claudeInstalled =
+ claudeStatus?.installed ?? claudeIntegration?.installed ?? false;
+ const isConnectingClaude = claudePhase !== "idle";
+ const initialLaunchIntegrations = launchIntegrations.slice(
+ 0,
+ collapsedIntegrationCount,
+ );
+ const additionalLaunchIntegrations = launchIntegrations.slice(
+ collapsedIntegrationCount,
+ );
+ const canToggleIntegrations =
+ launchIntegrations.length > collapsedIntegrationCount;
+ const claudeStatusLabel =
+ claudePhase === "installing"
+ ? "Downloading…"
+ : claudePhase === "waiting-for-install"
+ ? "Finish installing…"
+ : claudePhase === "connecting"
+ ? "Connecting…"
+ : claudePhase === "launching"
+ ? "Opening…"
+ : claudePhase === "disconnecting"
+ ? "Disconnecting…"
+ : !claudeConfigured && !claudeInstalled
+ ? "Download & connect"
+ : null;
+ const launchIntegrationRow = (item: IntegrationStatus) => {
+ const copied = copiedCommand === item.command;
+ return (
+ <div
+ key={item.id}
+ className="flex min-h-18 items-center justify-between gap-4 px-4 py-3"
+ >
+ <div className="flex min-w-0 items-center gap-3">
+ <LaunchCommandIcon item={item} />
+ <div className="min-w-0">
+ <p className="text-sm font-medium text-neutral-950">{item.name}</p>
+ <p className="truncate text-xs leading-5 text-neutral-500">
+ {item.description}
+ </p>
+ </div>
+ </div>
+ <div className="ml-auto flex min-w-0 shrink-0 items-center overflow-hidden rounded-lg bg-neutral-100 pl-3">
+ <code className="block flex-1 whitespace-nowrap py-2 pr-2 font-mono text-[13px] text-neutral-500">
+ {item.command}
+ </code>
+ <button
+ type="button"
+ className="inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-neutral-500 transition-colors hover:text-neutral-950 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-500"
+ onClick={() => copyLaunchCommand(item)}
+ aria-label={
+ copied
+ ? `${item.name} command copied`
+ : `Copy ${item.name} command`
+ }
+ title={copied ? "Copied" : "Copy command"}
+ >
+ {copied ? (
+ <CheckIcon className="h-4 w-4 text-green-600" />
+ ) : (
+ <Square2StackIcon className="h-4 w-4" />
+ )}
+ </button>
+ </div>
+ </div>
+ );
+ };
+ const claudeRow = claudeIntegration ? (
+ <div className="flex min-h-18 items-center justify-between gap-4 bg-white px-4 py-3">
+ <div className="flex min-w-0 items-center gap-3">
+ <LaunchCommandIcon item={claudeIntegration} />
+ <div className="min-w-0">
+ <p className="text-sm font-medium text-neutral-950">
+ {claudeIntegration.name}
+ </p>
+ <p
+ role={claudeError ? "alert" : undefined}
+ className={`truncate text-xs leading-5 ${claudeError ? "text-red-600" : "text-neutral-500"}`}
+ >
+ {claudeError ??
+ (claudeConfigured && claudeStatus?.startFailed
+ ? "Ollama couldn’t start the Claude connection."
+ : claudeConnected
+ ? "Connected to Ollama"
+ : claudePhase === "installing"
+ ? "Ollama is downloading the Claude installer…"
+ : claudePhase === "waiting-for-install"
+ ? "Finish installing Claude. Ollama will connect it automatically."
+ : claudePhase === "connecting"
+ ? "Connecting Claude to Ollama…"
+ : claudePhase === "launching"
+ ? "Opening Claude…"
+ : claudePhase === "disconnecting"
+ ? "Restoring Claude’s usual connection…"
+ : claudeIntegration.description)}
+ </p>
+ </div>
+ </div>
+ <div className="ml-auto flex shrink-0 items-center gap-2.5">
+ {claudeStatusLabel && (
+ <span
+ role="status"
+ aria-live="polite"
+ className="inline-flex items-center gap-1.5 whitespace-nowrap text-xs text-neutral-500"
+ >
+ {isConnectingClaude && (
+ <ArrowPathIcon className="h-3.5 w-3.5 animate-spin" />
+ )}
+ {claudeStatusLabel}
+ </span>
+ )}
+ <button
+ type="button"
+ role="switch"
+ aria-checked={claudeConfigured}
+ aria-busy={isConnectingClaude || undefined}
+ aria-label={
+ claudeConfigured
+ ? "Disconnect Claude"
+ : isConnectingClaude
+ ? "Connecting Claude"
+ : "Connect Claude"
+ }
+ title={claudeConfigured ? "Disconnect" : "Connect"}
+ disabled={isConnectingClaude}
+ onClick={connectClaude}
+ className={`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-500 disabled:cursor-wait ${claudeConfigured ? "bg-neutral-950" : "bg-neutral-300"}`}
+ >
+ <span
+ aria-hidden="true"
+ className={`inline-block h-4 w-4 rounded-full bg-white shadow-sm transition-transform ${isConnectingClaude ? "animate-pulse" : ""} ${claudeConfigured ? "translate-x-4.5" : "translate-x-0.5"}`}
+ />
+ </button>
+ </div>
+ </div>
+ ) : null;
+
+ return (
+ <main className="flex min-h-0 w-full flex-1 flex-col overflow-hidden bg-white text-neutral-950">
+ <div className="flex min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain p-6">
+ <section className="min-h-0 flex-1">
+ <div className="mx-auto w-full max-w-4xl text-left">
+ {integrationStatuses ? (
+ <div className="space-y-7 pb-4 pt-2">
+ {claudeIntegration && (
+ <section aria-labelledby="applications-heading">
+ <h2
+ id="applications-heading"
+ className="px-4 text-xs font-medium uppercase tracking-wider text-neutral-400"
+ >
+ Application
+ </h2>
+ <div className="mt-2 bg-white">{claudeRow}</div>
+ </section>
+ )}
+
+ {launchIntegrations.length > 0 && (
+ <section aria-labelledby="terminal-heading">
+ <h2
+ id="terminal-heading"
+ className="px-4 text-xs font-medium uppercase tracking-wider text-neutral-400"
+ >
+ Terminal
+ </h2>
+ <div className="mt-2 overflow-hidden bg-white">
+ <div className="space-y-2">
+ {initialLaunchIntegrations.map(launchIntegrationRow)}
+ </div>
+ {canToggleIntegrations && (
+ <div
+ aria-hidden={!showAllIntegrations}
+ inert={!showAllIntegrations}
+ className={`grid transition-[grid-template-rows] ease-in-out motion-reduce:duration-0 ${
+ showAllIntegrations
+ ? "duration-[750ms]"
+ : "duration-[825ms]"
+ } ${
+ showAllIntegrations
+ ? "grid-rows-[1fr]"
+ : "grid-rows-[0fr]"
+ }`}
+ >
+ <div className="min-h-0 overflow-hidden">
+ <div className="space-y-2 pt-2">
+ {additionalLaunchIntegrations.map(
+ launchIntegrationRow,
+ )}
+ </div>
+ </div>
+ </div>
+ )}
+ {canToggleIntegrations && (
+ <button
+ type="button"
+ aria-label={
+ showAllIntegrations
+ ? "Collapse apps"
+ : "Show more apps"
+ }
+ aria-expanded={showAllIntegrations}
+ className="mx-auto mt-3 flex h-10 w-10 items-center justify-center rounded-full text-neutral-600 transition-colors hover:text-neutral-950 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-500"
+ onClick={() =>
+ setShowAllIntegrations((current) => !current)
+ }
+ >
+ {showAllIntegrations ? (
+ <ChevronUpIcon
+ aria-hidden="true"
+ className="h-5 w-5"
+ />
+ ) : (
+ <ChevronDownIcon
+ aria-hidden="true"
+ className="h-5 w-5"
+ />
+ )}
+ </button>
+ )}
+ </div>
+ </section>
+ )}
+
+ {!claudeIntegration && launchIntegrations.length === 0 && (
+ <p className="py-12 text-center text-sm text-neutral-400">
+ No apps found.
+ </p>
+ )}
+ </div>
+ ) : statusError ? (
+ <p role="alert" className="mt-8 text-sm text-red-600">
+ Couldn&apos;t load integrations.
+ </p>
+ ) : (
+ <p className="mt-8 text-sm text-neutral-400">
+ Checking integrations…
+ </p>
+ )}
+ </div>
+ </section>
+ </div>
+ {showClaudeConnectedIntro && (
+ <div className="claude-connected-backdrop fixed inset-0 z-50 flex items-center justify-center bg-black/20 p-6">
+ <section
+ role="dialog"
+ aria-modal="true"
+ aria-labelledby="claude-connected-title"
+ aria-describedby="claude-connected-description"
+ className="claude-connected-dialog relative w-full max-w-md overflow-hidden rounded-2xl bg-white font-sans shadow-2xl ring-1 ring-black/10"
+ >
+ <button
+ type="button"
+ aria-label="Close"
+ className="absolute right-3 top-3 z-10 flex h-8 w-8 items-center justify-center rounded-full bg-white/90 text-neutral-500 transition-colors hover:text-neutral-950 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-500"
+ onClick={() => void dismissClaudeConnectedIntro()}
+ >
+ <XMarkIcon aria-hidden="true" className="h-5 w-5" />
+ </button>
+ <img
+ src="/claude-connected.png"
+ alt="Ollama models in the Claude model picker"
+ width={900}
+ height={761}
+ className="h-auto w-full object-contain"
+ draggable={false}
+ />
+ <div className="p-6">
+ <h2
+ id="claude-connected-title"
+ className="font-rounded text-lg font-medium leading-6 text-neutral-950"
+ >
+ Ollama models are now available in Claude
+ </h2>
+ <p
+ id="claude-connected-description"
+ className="mt-2 text-[13px] leading-5 text-neutral-500"
+ >
+ Choose an Ollama model from Claude&apos;s model selector.
+ </p>
+ <div className="mt-5 flex justify-end">
+ <button
+ type="button"
+ autoFocus
+ className="min-w-24 rounded-full bg-neutral-100 px-6 py-2 text-sm font-normal text-neutral-950 transition-colors hover:bg-neutral-200 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-500"
+ onClick={() => void dismissClaudeConnectedIntro()}
+ >
+ Done
+ </button>
+ </div>
+ </div>
+ </section>
+ </div>
+ )}
+ </main>
+ );
+}
+
interface OnboardingProps extends ScreenProps {
completionError: string | null;
isAuthenticated: boolean;
+ onOpenApps: () => Promise<boolean>;
onRetryCompletion: () => void;
onSignUp: () => void;
onUseLocal: () => void;
- showRun: boolean;
}
export default function Onboarding(props: OnboardingProps) {
const [step, setStep] = useState<OnboardingStep>("intro");
+ const appsOpeningRef = useRef(false);
+ const { onOpenApps } = props;
+
+ const openApps = useCallback(async () => {
+ if (appsOpeningRef.current) return;
+ appsOpeningRef.current = true;
+ const opened = await onOpenApps();
+ if (!opened) appsOpeningRef.current = false;
+ }, [onOpenApps]);
useEffect(() => {
window.setOnboardingWindow?.(true);
@@ -276,15 +1041,16 @@ export default function Onboarding(props: OnboardingProps) {
}, []);
useEffect(() => {
- const preventZoom = (event: KeyboardEvent) => {
- if (isOnboardingZoomShortcut(event)) event.preventDefault();
- };
-
- window.addEventListener("keydown", preventZoom, true);
- return () => window.removeEventListener("keydown", preventZoom, true);
- }, []);
+ if (!props.isAuthenticated) return;
+ const nextStep = nextOnboardingStep(step, "authenticated", true);
+ if (nextStep === "apps") {
+ void openApps();
+ return;
+ }
+ setStep(nextStep);
+ }, [openApps, props.isAuthenticated, step]);
- if (props.showRun || step === "run") {
+ if (step === "run") {
return (
<RunOllamaScreen
completionError={props.completionError}
@@ -296,13 +1062,18 @@ export default function Onboarding(props: OnboardingProps) {
if (step === "intro") {
return (
<IntroScreen
+ completionError={props.completionError}
+ onRetryCompletion={() => void openApps()}
onContinue={() => {
const nextStep = nextOnboardingStep(
step,
"continue",
props.isAuthenticated,
);
- if (nextStep === "run") props.onUseLocal();
+ if (nextStep === "apps") {
+ void openApps();
+ return;
+ }
setStep(nextStep);
}}
/>
@@ -312,6 +1083,7 @@ export default function Onboarding(props: OnboardingProps) {
return (
<WelcomeScreen
{...props}
+ onRetryCompletion={() => void openApps()}
onLocal={() => {
props.onUseLocal();
setStep((current) =>
diff --git a/app/ui/app/src/components/Settings.tsx b/app/ui/app/src/components/Settings.tsx
index 80ccf8a77..d97443d0e 100644
--- a/app/ui/app/src/components/Settings.tsx
+++ b/app/ui/app/src/components/Settings.tsx
@@ -14,8 +14,10 @@ import {
CloudIcon,
CogIcon,
ArrowDownTrayIcon,
+ Squares2X2Icon,
} from "@heroicons/react/20/solid";
import { Settings as SettingsType } from "@/gotypes";
+import { isWindowsPlatform } from "@/lib/platform";
import { useUser } from "@/hooks/useUser";
import { useCloudStatus } from "@/hooks/useCloudStatus";
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
@@ -45,6 +47,8 @@ export default function Settings() {
const queryClient = useQueryClient();
const [showSaved, setShowSaved] = useState(false);
const [restartMessage, setRestartMessage] = useState(false);
+ const [showAppsInMenu, setShowAppsInMenuState] = useState(true);
+ const [showAppsInMenuPending, setShowAppsInMenuPending] = useState(false);
const {
user,
isAuthenticated,
@@ -139,6 +143,15 @@ export default function Settings() {
refetchUser();
}, []); // eslint-disable-line react-hooks/exhaustive-deps
+ useEffect(() => {
+ window
+ .getShowAppsInMenu?.()
+ .then(setShowAppsInMenuState)
+ .catch((error) =>
+ console.error("Failed to load menu app visibility:", error),
+ );
+ }, []);
+
useEffect(() => {
const handleFocus = () => {
if (isAwaitingConnection && pollingInterval) {
@@ -216,6 +229,22 @@ export default function Settings() {
}
};
+ const handleShowAppsInMenu = async (checked: boolean) => {
+ const previous = showAppsInMenu;
+ setShowAppsInMenuState(checked);
+ setShowAppsInMenuPending(true);
+ try {
+ await window.setShowAppsInMenu?.(checked);
+ setShowSaved(true);
+ setTimeout(() => setShowSaved(false), 1500);
+ } catch (error) {
+ setShowAppsInMenuState(previous);
+ console.error("Failed to update menu app visibility:", error);
+ } finally {
+ setShowAppsInMenuPending(false);
+ }
+ };
+
const cloudOverriddenByEnv =
cloudStatus?.source === "env" || cloudStatus?.source === "both";
const cloudToggleDisabled =
@@ -262,29 +291,18 @@ export default function Settings() {
if (error || !settings) {
return (
- <div className="flex min-h-screen items-center justify-center">
+ <div className="flex flex-1 items-center justify-center">
<div className="text-red-500">Failed to load settings</div>
</div>
);
}
- const isWindows = navigator.platform.toLowerCase().includes("win");
+ const isWindows = isWindowsPlatform();
return (
- <main className="flex h-screen w-full flex-col select-none dark:bg-neutral-900">
- <header
- className="w-full flex flex-none justify-between h-[52px] py-2.5 items-center border-b border-neutral-200 dark:border-neutral-800 select-none"
- onMouseDown={() => window.drag && window.drag()}
- onDoubleClick={() => window.doubleClick && window.doubleClick()}
- >
- <h1
- className={`${isWindows ? "pl-4" : "pl-24"} flex items-center font-rounded text-md font-medium dark:text-white`}
- >
- Settings
- </h1>
- </header>
+ <main className="flex min-h-0 w-full flex-1 flex-col select-none dark:bg-neutral-900">
<div className="w-full p-6 overflow-y-auto flex-1 overscroll-contain">
- <div className="space-y-4 max-w-2xl mx-auto">
+ <div className="mx-auto max-w-4xl space-y-4">
{/* Connect Ollama Account */}
<div className="overflow-hidden rounded-xl bg-white dark:bg-neutral-800">
<div className="p-4">
@@ -422,6 +440,29 @@ export default function Settings() {
</div>
</Field>
+ {!isWindows && (
+ <Field>
+ <div className="flex items-start justify-between gap-4">
+ <div className="flex flex-1 items-start space-x-3">
+ <Squares2X2Icon className="mt-1 h-5 w-5 flex-shrink-0 text-black dark:text-neutral-100" />
+ <div>
+ <Label>Show apps in menu</Label>
+ <Description>
+ Show connected apps at the top of the Ollama menu.
+ </Description>
+ </div>
+ </div>
+ <div className="flex-shrink-0">
+ <Switch
+ checked={showAppsInMenu}
+ disabled={showAppsInMenuPending}
+ onChange={handleShowAppsInMenu}
+ />
+ </div>
+ </div>
+ </Field>
+ )}
+
{/* Auto Update */}
<Field>
<div className="flex items-start justify-between gap-4">
diff --git a/app/ui/app/src/components/layout/layout.tsx b/app/ui/app/src/components/layout/layout.tsx
index bffb05716..576a00e53 100644
--- a/app/ui/app/src/components/layout/layout.tsx
+++ b/app/ui/app/src/components/layout/layout.tsx
@@ -1,30 +1,39 @@
import { Link } from "@tanstack/react-router";
-import { useSettings } from "@/hooks/useSettings";
+import { ChatIcon } from "@/components/ChatIcon";
+import { isWindowsPlatform } from "@/lib/platform";
+import { useState } from "react";
+
+let sessionSidebarOpen = false;
export function SidebarLayout({
sidebar,
+ title,
children,
}: React.PropsWithChildren<{
sidebar: React.ReactNode;
- collapsible?: boolean;
- chatId?: string;
+ title?: string;
}>) {
- const { settings, setSettings } = useSettings();
- const isWindows = navigator.platform.toLowerCase().includes("win");
+ const [sidebarOpen, setSidebarOpen] = useState(sessionSidebarOpen);
+ const isWindows = isWindowsPlatform();
+
+ const toggleSidebar = () => {
+ sessionSidebarOpen = !sidebarOpen;
+ setSidebarOpen(sessionSidebarOpen);
+ };
return (
- <div className={`flex transition-[width] duration-300 dark:bg-neutral-900`}>
+ <div className="flex h-screen w-full overflow-hidden dark:bg-neutral-900">
<div
- className={`absolute flex mx-2 py-2 z-20 items-center transition-[left] duration-375 text-neutral-500 dark:text-neutral-400 ${settings.sidebarOpen ? (isWindows ? "left-2" : "left-[204px]") : isWindows ? "left-2" : "left-20"}`}
+ className={`absolute flex mx-2 py-2 z-20 items-center transition-[left] duration-375 text-neutral-500 dark:text-neutral-400 ${sidebarOpen ? (isWindows ? "left-2" : "left-[140px]") : isWindows ? "left-2" : "left-20"}`}
>
<button
- onClick={() => setSettings({ SidebarOpen: !settings.sidebarOpen })}
+ onClick={toggleSidebar}
onMouseDown={(e) => {
e.stopPropagation();
}}
className="h-9 w-9 flex items-center justify-center rounded-full hover:bg-neutral-100 dark:hover:bg-neutral-700/75 cursor-pointer"
- aria-label={settings.sidebarOpen ? "Hide sidebar" : "Show sidebar"}
- title={settings.sidebarOpen ? "Hide sidebar" : "Show sidebar"}
+ aria-label={sidebarOpen ? "Hide sidebar" : "Show sidebar"}
+ title={sidebarOpen ? "Hide sidebar" : "Show sidebar"}
>
<svg
className="h-5 w-5 fill-current"
@@ -35,45 +44,47 @@ export function SidebarLayout({
<path d="M7.76132 16.6344H9.58103V1.59842H7.76132V16.6344ZM4.20898 18.2316H19.124C21.6518 18.2316 23.1293 16.6963 23.1293 14.0209V4.2205C23.1293 1.54512 21.6518 0.00351715 19.124 0.00351715H4.20898C1.54336 0.00351715 0 1.54512 0 4.2205V14.0209C0 16.6963 1.54336 18.2316 4.20898 18.2316ZM4.31191 16.3184C2.79628 16.3184 1.91327 15.4434 1.91327 13.926V4.31542C1.91327 2.79979 2.79628 1.91678 4.31191 1.91678H18.8174C20.333 1.91678 21.216 2.79979 21.216 4.31542V13.926C21.216 15.4434 20.333 16.3184 18.8174 16.3184H4.31191ZM5.85116 5.50038C6.1951 5.50038 6.49217 5.20507 6.49217 4.87968C6.49217 4.54628 6.1951 4.25722 5.85116 4.25722H3.8412C3.49725 4.25722 3.20819 4.54628 3.20819 4.87968C3.20819 5.20507 3.49725 5.50038 3.8412 5.50038H5.85116ZM5.85116 8.1158C6.1951 8.1158 6.49217 7.82049 6.49217 7.4871C6.49217 7.1537 6.1951 6.8744 5.85116 6.8744H3.8412C3.49725 6.8744 3.20819 7.1537 3.20819 7.4871C3.20819 7.82049 3.49725 8.1158 3.8412 8.1158H5.85116ZM5.85116 10.725C6.1951 10.725 6.49217 10.4439 6.49217 10.1105C6.49217 9.77713 6.1951 9.48983 5.85116 9.48983H3.8412C3.49725 9.48983 3.20819 9.77713 3.20819 10.1105C3.20819 10.4439 3.49725 10.725 3.8412 10.725H5.85116Z" />
</svg>
</button>
- <Link
- to="/c/$chatId"
- params={{ chatId: "new" }}
- title="New chat"
- className={`flex ml-1 items-center justify-center rounded-full transition-opacity duration-375 h-9 w-9 hover:bg-neutral-100 dark:hover:bg-neutral-700 ${
- settings.sidebarOpen
- ? "opacity-0 pointer-events-none"
- : "opacity-100"
- }`}
- >
- <svg
- className="h-5 w-5 fill-current"
- viewBox="0 0 24 24"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
+ {!title && (
+ <Link
+ to="/c/$chatId"
+ params={{ chatId: "new" }}
+ title="New chat"
+ className={`flex ml-1 items-center justify-center rounded-full transition-opacity duration-375 h-9 w-9 hover:bg-neutral-100 dark:hover:bg-neutral-700 ${
+ sidebarOpen ? "opacity-0 pointer-events-none" : "opacity-100"
+ }`}
>
- <path d="M17.0859 3.39949L15.2135 5.27196H7.27028C5.78649 5.27196 4.94684 6.11336 4.94684 7.59716V16.664C4.94684 18.1558 5.78649 18.9892 7.27028 18.9892H16.3406C17.8324 18.9892 18.6623 18.1558 18.6623 16.664V8.79514L20.5428 6.9115C20.567 7.11532 20.5773 7.33066 20.5773 7.55419V16.7149C20.5773 19.4069 19.0818 20.9024 16.3898 20.9024H7.22107C4.53708 20.9024 3.03357 19.4069 3.03357 16.7149V7.55419C3.03357 4.8622 4.53708 3.35869 7.22107 3.35869H16.3898C16.6329 3.35869 16.8662 3.37094 17.0859 3.39949Z" />
- <path d="M9.92714 14.381L11.914 13.5403L20.8312 4.63114L19.3404 3.1581L10.433 12.0655L9.55234 13.9964C9.45664 14.2169 9.70293 14.4714 9.92714 14.381ZM21.5767 3.89364L22.2588 3.19384C22.6347 2.80184 22.6435 2.2663 22.2711 1.90536L22.0148 1.64287C21.6822 1.31377 21.1334 1.36513 20.7689 1.72158L20.0859 2.39833L21.5767 3.89364Z" />
- </svg>
- </Link>
+ <ChatIcon />
+ </Link>
+ )}
</div>
<div
- className={`flex flex-col transition-[width] duration-300 max-h-screen ${settings.sidebarOpen ? "w-64" : "w-0"}`}
+ className={`flex max-h-screen flex-col transition-[width] duration-300 ${
+ sidebarOpen
+ ? "w-48 border-r border-neutral-200 bg-neutral-50 dark:border-neutral-800 dark:bg-neutral-950/40"
+ : "w-0"
+ }`}
>
<div
onDoubleClick={() => window.doubleClick && window.doubleClick()}
onMouseDown={() => window.drag && window.drag()}
className="flex-none h-13 w-full"
></div>
- {settings.sidebarOpen && sidebar}
+ {sidebarOpen && sidebar}
</div>
- <main
- className={`flex flex-1 flex-col min-w-0 transition-all duration-300`}
- >
+ <main className="flex min-w-0 flex-1 flex-col transition-all duration-300">
<div
- className={`h-13 flex-none w-full z-10 flex items-center bg-white dark:bg-neutral-900 ${isWindows ? "xl:hidden" : "xl:fixed xl:bg-transparent xl:dark:bg-transparent"}`}
+ className={`h-13 z-10 flex w-full flex-none items-center bg-white dark:bg-neutral-900 ${title ? "" : isWindows ? "xl:hidden" : "xl:fixed xl:bg-transparent xl:dark:bg-transparent"}`}
onDoubleClick={() => window.doubleClick && window.doubleClick()}
onMouseDown={() => window.drag && window.drag()}
- ></div>
+ >
+ {title && (
+ <h1
+ className={`${sidebarOpen ? "pl-6" : isWindows ? "pl-16" : "pl-36"} font-rounded text-md font-medium dark:text-white`}
+ >
+ {title}
+ </h1>
+ )}
+ </div>
{children}
</main>
</div>
diff --git a/app/ui/app/src/index.css b/app/ui/app/src/index.css
index eaaa8bd89..bae499e10 100644
--- a/app/ui/app/src/index.css
+++ b/app/ui/app/src/index.css
@@ -2,6 +2,9 @@
@plugin "@tailwindcss/typography";
@import "katex/dist/katex.min.css";
+/* Retain component class names while making the dark variant unreachable. */
+@custom-variant dark (@media not all);
+
@theme {
--font-sans: ui-sans-serif, system-ui, "Segoe UI", sans-serif;
--font-rounded:
@@ -9,6 +12,16 @@
}
@layer base {
+ :root {
+ color-scheme: light;
+ }
+
+ html,
+ body,
+ #root {
+ background-color: #fff;
+ }
+
a[href],
button:not(:disabled),
[role="button"]:not([aria-disabled="true"]) {
@@ -21,15 +34,6 @@
}
}
-@media (prefers-color-scheme: dark) {
- /* Dark mode styles go here */
- :root {
- /* Example dark mode variables */
- --bg-color: #1a1a1a;
- --text-color: #ffffff;
- }
-}
-
/* messaging-style typing indicator animation */
@keyframes typing {
0%,
@@ -41,3 +45,32 @@
opacity: 1;
}
}
+
+@keyframes claude-connected-backdrop-in {
+ from {
+ opacity: 0;
+ }
+}
+
+@keyframes claude-connected-dialog-in {
+ from {
+ opacity: 0;
+ transform: translateY(6px) scale(0.98);
+ }
+}
+
+.claude-connected-backdrop {
+ animation: claude-connected-backdrop-in 280ms ease-in-out both;
+}
+
+.claude-connected-dialog {
+ animation: claude-connected-dialog-in 345ms cubic-bezier(0.4, 0, 0.2, 1) both;
+ will-change: opacity, transform;
+}
+
+@media (prefers-reduced-motion: reduce) {
+ .claude-connected-backdrop,
+ .claude-connected-dialog {
+ animation: none;
+ }
+}
diff --git a/app/ui/app/src/lib/claudeDesktop.ts b/app/ui/app/src/lib/claudeDesktop.ts
new file mode 100644
index 000000000..46743b3e9
--- /dev/null
+++ b/app/ui/app/src/lib/claudeDesktop.ts
@@ -0,0 +1,14 @@
+import type { ClaudeDesktopStatus } from "@/types/webview";
+
+export const CLAUDE_INSTALL_TIMEOUT_MS = 120_000;
+
+export function isClaudeConnectionComplete(
+ enabled: boolean,
+ status: ClaudeDesktopStatus,
+) {
+ return enabled ? status.connected && !status.startFailed : !status.configured;
+}
+
+export function scheduleClaudeInstallTimeout(onTimeout: () => void) {
+ return window.setTimeout(onTimeout, CLAUDE_INSTALL_TIMEOUT_MS);
+}
diff --git a/app/ui/app/src/lib/launchCommands.ts b/app/ui/app/src/lib/launchCommands.ts
new file mode 100644
index 000000000..f075ee158
--- /dev/null
+++ b/app/ui/app/src/lib/launchCommands.ts
@@ -0,0 +1,25 @@
+export interface IntegrationIcon {
+ src: string;
+ className?: string;
+}
+
+export const INTEGRATION_ICONS: Record<string, IntegrationIcon> = {
+ "claude-desktop": { src: "/launch-icons/claude.svg" },
+ claude: { src: "/launch-icons/claude-code.svg" },
+ hermes: { src: "/launch-icons/hermes-agent.svg" },
+ "hermes-desktop": { src: "/launch-icons/hermes-agent.svg" },
+ openclaw: { src: "/launch-icons/openclaw.svg" },
+ opencode: {
+ src: "/launch-icons/opencode.svg",
+ className: "h-7 w-7 rounded",
+ },
+ codex: { src: "/launch-icons/codex.svg" },
+ copilot: { src: "/launch-icons/copilot.svg" },
+ droid: { src: "/launch-icons/droid.svg" },
+ dsh: { src: "/launch-icons/deepseek-harness.svg" },
+ pi: { src: "/launch-icons/pi.svg" },
+ cline: { src: "/launch-icons/cline.svg" },
+ omp: { src: "/launch-icons/oh-my-pi.svg" },
+ pool: { src: "/launch-icons/poolside.svg" },
+ qwen: { src: "/launch-icons/qwen-code.svg" },
+};
diff --git a/app/ui/app/src/lib/onboarding.ts b/app/ui/app/src/lib/onboarding.ts
index 704a5b4ee..04d69ca9a 100644
--- a/app/ui/app/src/lib/onboarding.ts
+++ b/app/ui/app/src/lib/onboarding.ts
@@ -19,19 +19,9 @@ export function onboardingConnectUrl(
export const AUTHENTICATION_TIMEOUT_MS = 5 * 60 * 1000;
-export type OnboardingStep = "intro" | "welcome" | "run";
+export type OnboardingStep = "intro" | "welcome" | "apps" | "run";
-export function isOnboardingZoomShortcut(
- event: Pick<KeyboardEvent, "metaKey" | "ctrlKey" | "key" | "code">,
-) {
- if (!event.metaKey && !event.ctrlKey) return false;
-
- return (
- ["+", "-", "=", "_"].includes(event.key) ||
- ["Equal", "Minus", "NumpadAdd", "NumpadSubtract"].includes(event.code)
- );
-}
-export type OnboardingAction = "continue" | "local";
+export type OnboardingAction = "continue" | "authenticated" | "local";
export type AuthenticationTimeoutAction = "ignore" | "defer" | "fail";
export function nextOnboardingStep(
@@ -40,7 +30,10 @@ export function nextOnboardingStep(
isAuthenticated: boolean,
): OnboardingStep {
if (action === "local") return "run";
- if (step === "intro") return isAuthenticated ? "run" : "welcome";
+ if (step === "intro" && action === "continue") {
+ return isAuthenticated ? "apps" : "welcome";
+ }
+ if (step === "welcome" && action === "authenticated") return "apps";
return step;
}
diff --git a/app/ui/app/src/lib/platform.ts b/app/ui/app/src/lib/platform.ts
new file mode 100644
index 000000000..c9a90f960
--- /dev/null
+++ b/app/ui/app/src/lib/platform.ts
@@ -0,0 +1,10 @@
+export function isWindowsPlatform(): boolean {
+ if (typeof window !== "undefined" && window.OLLAMA_PLATFORM) {
+ return window.OLLAMA_PLATFORM === "windows";
+ }
+
+ return (
+ typeof navigator !== "undefined" &&
+ navigator.platform.toLowerCase().includes("win")
+ );
+}
diff --git a/app/ui/app/src/routeTree.gen.ts b/app/ui/app/src/routeTree.gen.ts
index 4c877293f..78fdd5d21 100644
--- a/app/ui/app/src/routeTree.gen.ts
+++ b/app/ui/app/src/routeTree.gen.ts
@@ -13,6 +13,7 @@
import { Route as rootRoute } from './routes/__root'
import { Route as SettingsImport } from './routes/settings'
import { Route as OnboardingImport } from './routes/onboarding'
+import { Route as ConnectImport } from './routes/connect'
import { Route as IndexImport } from './routes/index'
import { Route as CChatIdImport } from './routes/c.$chatId'
@@ -30,6 +31,12 @@ const OnboardingRoute = OnboardingImport.update({
getParentRoute: () => rootRoute,
} as any)
+const ConnectRoute = ConnectImport.update({
+ id: '/connect',
+ path: '/connect',
+ getParentRoute: () => rootRoute,
+} as any)
+
const IndexRoute = IndexImport.update({
id: '/',
path: '/',
@@ -53,6 +60,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof IndexImport
parentRoute: typeof rootRoute
}
+ '/connect': {
+ id: '/connect'
+ path: '/connect'
+ fullPath: '/connect'
+ preLoaderRoute: typeof ConnectImport
+ parentRoute: typeof rootRoute
+ }
'/onboarding': {
id: '/onboarding'
path: '/onboarding'
@@ -81,6 +95,7 @@ declare module '@tanstack/react-router' {
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
+ '/connect': typeof ConnectRoute
'/onboarding': typeof OnboardingRoute
'/settings': typeof SettingsRoute
'/c/$chatId': typeof CChatIdRoute
@@ -88,6 +103,7 @@ export interface FileRoutesByFullPath {
export interface FileRoutesByTo {
'/': typeof IndexRoute
+ '/connect': typeof ConnectRoute
'/onboarding': typeof OnboardingRoute
'/settings': typeof SettingsRoute
'/c/$chatId': typeof CChatIdRoute
@@ -96,6 +112,7 @@ export interface FileRoutesByTo {
export interface FileRoutesById {
__root__: typeof rootRoute
'/': typeof IndexRoute
+ '/connect': typeof ConnectRoute
'/onboarding': typeof OnboardingRoute
'/settings': typeof SettingsRoute
'/c/$chatId': typeof CChatIdRoute
@@ -103,15 +120,16 @@ export interface FileRoutesById {
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths: '/' | '/onboarding' | '/settings' | '/c/$chatId'
+ fullPaths: '/' | '/connect' | '/onboarding' | '/settings' | '/c/$chatId'
fileRoutesByTo: FileRoutesByTo
- to: '/' | '/onboarding' | '/settings' | '/c/$chatId'
- id: '__root__' | '/' | '/onboarding' | '/settings' | '/c/$chatId'
+ to: '/' | '/connect' | '/onboarding' | '/settings' | '/c/$chatId'
+ id: '__root__' | '/' | '/connect' | '/onboarding' | '/settings' | '/c/$chatId'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
IndexRoute: typeof IndexRoute
+ ConnectRoute: typeof ConnectRoute
OnboardingRoute: typeof OnboardingRoute
SettingsRoute: typeof SettingsRoute
CChatIdRoute: typeof CChatIdRoute
@@ -119,6 +137,7 @@ export interface RootRouteChildren {
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
+ ConnectRoute: ConnectRoute,
OnboardingRoute: OnboardingRoute,
SettingsRoute: SettingsRoute,
CChatIdRoute: CChatIdRoute,
@@ -135,6 +154,7 @@ export const routeTree = rootRoute
"filePath": "__root.tsx",
"children": [
"/",
+ "/connect",
"/onboarding",
"/settings",
"/c/$chatId"
@@ -143,6 +163,9 @@ export const routeTree = rootRoute
"/": {
"filePath": "index.tsx"
},
+ "/connect": {
+ "filePath": "connect.tsx"
+ },
"/onboarding": {
"filePath": "onboarding.tsx"
},
diff --git a/app/ui/app/src/routes/connect.tsx b/app/ui/app/src/routes/connect.tsx
new file mode 100644
index 000000000..1ce1202a4
--- /dev/null
+++ b/app/ui/app/src/routes/connect.tsx
@@ -0,0 +1,19 @@
+import { AppSidebar } from "@/components/AppSidebar";
+import { ConnectAppsScreen } from "@/components/Onboarding";
+import { SidebarLayout } from "@/components/layout/layout";
+import { createFileRoute } from "@tanstack/react-router";
+
+export const Route = createFileRoute("/connect")({
+ component: ConnectRoute,
+});
+
+function ConnectRoute() {
+ return (
+ <SidebarLayout
+ title="Connect your apps"
+ sidebar={<AppSidebar current="apps" />}
+ >
+ <ConnectAppsScreen />
+ </SidebarLayout>
+ );
+}
diff --git a/app/ui/app/src/routes/onboarding.tsx b/app/ui/app/src/routes/onboarding.tsx
index 51532e38a..0c3313f54 100644
--- a/app/ui/app/src/routes/onboarding.tsx
+++ b/app/ui/app/src/routes/onboarding.tsx
@@ -10,7 +10,7 @@ import {
onboardingConnectUrl,
type OnboardingAuthMode,
} from "@/lib/onboarding";
-import { createFileRoute, redirect } from "@tanstack/react-router";
+import { createFileRoute, redirect, useNavigate } from "@tanstack/react-router";
import { useCallback, useEffect, useRef, useState } from "react";
export const Route = createFileRoute("/onboarding")({
@@ -41,10 +41,10 @@ export const Route = createFileRoute("/onboarding")({
});
function OnboardingRoute() {
+ const navigate = useNavigate();
const { settingsData, setSettings } = useSettings();
const { fetchConnectUrl, refetchUser, isAuthenticated } = useUser();
const [isAwaitingAuth, setIsAwaitingAuth] = useState(false);
- const [showRun, setShowRun] = useState(false);
const [signInError, setSignInError] = useState<string | null>(null);
const [completionError, setCompletionError] = useState<string | null>(null);
const authAttemptRef = useRef(0);
@@ -68,11 +68,16 @@ function OnboardingRoute() {
}
}, [setSettings, settingsData]);
- const showRunScreen = useCallback(() => {
- setShowRun(true);
+ const finishSetup = useCallback(() => {
void completeOnboarding();
}, [completeOnboarding]);
+ const openApps = useCallback(async (): Promise<boolean> => {
+ if (!(await completeOnboarding())) return false;
+ await navigate({ to: "/connect" });
+ return true;
+ }, [completeOnboarding, navigate]);
+
const retryCompletion = useCallback(() => {
void completeOnboarding();
}, [completeOnboarding]);
@@ -82,7 +87,6 @@ function OnboardingRoute() {
setSignInError(null);
if (isAuthenticated) {
- showRunScreen();
return;
}
@@ -104,7 +108,7 @@ function OnboardingRoute() {
setSignInError("Unable to start sign in. Please try again.");
}
},
- [fetchConnectUrl, isAuthenticated, showRunScreen],
+ [fetchConnectUrl, isAuthenticated],
);
const signIn = useCallback(() => authenticate("signin"), [authenticate]);
@@ -114,8 +118,8 @@ function OnboardingRoute() {
authAttemptRef.current += 1;
setIsAwaitingAuth(false);
setSignInError(null);
- showRunScreen();
- }, [showRunScreen]);
+ finishSetup();
+ }, [finishSetup]);
useEffect(() => {
if (!isAwaitingAuth) return;
@@ -147,7 +151,6 @@ function OnboardingRoute() {
) {
settled = true;
setIsAwaitingAuth(false);
- showRunScreen();
window.activateOllama?.();
}
} catch (error) {
@@ -177,7 +180,7 @@ function OnboardingRoute() {
window.clearTimeout(timeout);
window.removeEventListener("focus", checkConnection);
};
- }, [isAwaitingAuth, refetchUser, showRunScreen]);
+ }, [isAwaitingAuth, refetchUser]);
return (
<Onboarding
@@ -185,11 +188,11 @@ function OnboardingRoute() {
isAuthenticated={isAuthenticated}
isSigningIn={isAwaitingAuth}
signInError={signInError}
+ onOpenApps={openApps}
onSignIn={signIn}
onSignUp={signUp}
onRetryCompletion={retryCompletion}
onUseLocal={useLocal}
- showRun={showRun}
/>
);
}
diff --git a/app/ui/app/src/routes/settings.tsx b/app/ui/app/src/routes/settings.tsx
index 6ae232ae7..16672e73e 100644
--- a/app/ui/app/src/routes/settings.tsx
+++ b/app/ui/app/src/routes/settings.tsx
@@ -1,6 +1,16 @@
+import { AppSidebar } from "@/components/AppSidebar";
+import { SidebarLayout } from "@/components/layout/layout";
import { createFileRoute } from "@tanstack/react-router";
import Settings from "@/components/Settings";
export const Route = createFileRoute("/settings")({
- component: Settings,
+ component: SettingsRoute,
});
+
+function SettingsRoute() {
+ return (
+ <SidebarLayout title="Settings" sidebar={<AppSidebar current="settings" />}>
+ <Settings />
+ </SidebarLayout>
+ );
+}
diff --git a/app/ui/app/src/types/webview.d.ts b/app/ui/app/src/types/webview.d.ts
index 03283504a..ae0920507 100644
--- a/app/ui/app/src/types/webview.d.ts
+++ b/app/ui/app/src/types/webview.d.ts
@@ -12,6 +12,21 @@ interface MenuItem {
separator?: boolean;
}
+interface ClaudeDesktopStatus {
+ installed: boolean;
+ configured: boolean;
+ connected: boolean;
+ running: boolean;
+ startFailed: boolean;
+}
+
+interface ClaudeDesktopActionResult {
+ status: ClaudeDesktopStatus;
+ error?: string;
+}
+
+type ClaudeDesktopInstallResult = "opened" | "cancelled" | "failed";
+
interface WebviewAPI {
selectFile: () => Promise<ImageData | null>;
selectMultipleFiles: () => Promise<ImageData[] | null>;
@@ -25,10 +40,20 @@ declare global {
drag?: () => void;
doubleClick?: () => void;
activateOllama?: () => void;
+ getClaudeDesktopStatus?: () => Promise<ClaudeDesktopStatus>;
+ setClaudeDesktopConnected?: (
+ enabled: boolean,
+ ) => Promise<ClaudeDesktopActionResult>;
+ prepareClaudeDesktopConnection?: () => Promise<ClaudeDesktopActionResult>;
+ openClaudeDesktop?: () => Promise<string>;
+ installClaudeDesktop?: () => Promise<ClaudeDesktopInstallResult>;
+ getShowAppsInMenu?: () => Promise<boolean>;
+ setShowAppsInMenu?: (visible: boolean) => Promise<void>;
setOnboardingWindow?: (enabled: boolean) => void;
menu: (items: MenuItem[]) => Promise<string | null>;
OLLAMA_TOOLS?: boolean;
OLLAMA_WEBSEARCH?: boolean;
+ OLLAMA_PLATFORM?: "darwin" | "windows";
}
namespace JSX {
@@ -48,4 +73,12 @@ declare global {
}
}
-export type { ImageData, WebviewAPI, ContextMenuItem, ContextMenuResult };
+export type {
+ ClaudeDesktopActionResult,
+ ClaudeDesktopInstallResult,
+ ClaudeDesktopStatus,
+ ContextMenuItem,
+ ContextMenuResult,
+ ImageData,
+ WebviewAPI,
+};
diff --git a/app/ui/ui.go b/app/ui/ui.go
index 1c07b1d56..8ed2561b6 100644
--- a/app/ui/ui.go
+++ b/app/ui/ui.go
@@ -31,6 +31,7 @@ import (
"github.com/ollama/ollama/app/updater"
"github.com/ollama/ollama/app/version"
ollamaAuth "github.com/ollama/ollama/auth"
+ "github.com/ollama/ollama/cmd/launch"
"github.com/ollama/ollama/envconfig"
"github.com/ollama/ollama/manifest"
"github.com/ollama/ollama/types/model"
@@ -110,8 +111,9 @@ type Server struct {
Dev bool
// Updater for checking and downloading updates
- Updater *updater.Updater
- UpdateAvailableFunc func()
+ Updater *updater.Updater
+ UpdateAvailableFunc func()
+ ClaudeDesktopInstalled func() bool
}
func (s *Server) log() *slog.Logger {
@@ -292,6 +294,7 @@ func (s *Server) Handler() http.Handler {
mux.Handle("POST /api/v1/settings", handle(s.settings))
mux.Handle("GET /api/v1/cloud", handle(s.getCloudSetting))
mux.Handle("POST /api/v1/cloud", handle(s.cloudSetting))
+ mux.Handle("GET /api/v1/integrations", handle(s.getIntegrationStatuses))
// Ollama proxy endpoints
ollamaProxy := s.ollamaProxy()
@@ -314,6 +317,76 @@ func (s *Server) Handler() http.Handler {
return mux
}
+func supportsClaudeDesktopIntegration(goos string) bool {
+ return goos == "darwin"
+}
+
+func (s *Server) getIntegrationStatuses(w http.ResponseWriter, _ *http.Request) error {
+ type integrationStatus struct {
+ ID string `json:"id"`
+ Name string `json:"name"`
+ Description string `json:"description"`
+ Installed *bool `json:"installed,omitempty"`
+ Command string `json:"command,omitempty"`
+ }
+
+ infos := launch.ListIntegrationInfos()
+ statuses := make([]integrationStatus, 0, len(infos)+2)
+ if supportsClaudeDesktopIntegration(runtime.GOOS) {
+ var claudeDesktopInstalled bool
+ if s.ClaudeDesktopInstalled != nil {
+ claudeDesktopInstalled = s.ClaudeDesktopInstalled()
+ } else {
+ claudeDesktopInstalled = launch.IsIntegrationInstalled("claude-desktop")
+ }
+ statuses = append(statuses, integrationStatus{
+ ID: "claude-desktop",
+ Name: "Claude",
+ Description: "Use Ollama models in Claude Desktop",
+ Installed: &claudeDesktopInstalled,
+ })
+ }
+
+ byName := make(map[string]launch.IntegrationInfo, len(infos))
+ for _, info := range infos {
+ byName[info.Name] = info
+ }
+ // Apps prioritizes the primary terminal agents; unlisted entries retain launcher order.
+ preferredOrder := []string{"claude", "codex", "openclaw", "opencode", "droid", "pi", "cline"}
+ seen := make(map[string]bool, len(preferredOrder))
+ orderedInfos := make([]launch.IntegrationInfo, 0, len(infos))
+ for _, name := range preferredOrder {
+ if info, ok := byName[name]; ok {
+ orderedInfos = append(orderedInfos, info)
+ seen[name] = true
+ }
+ }
+ for _, info := range infos {
+ if info.Name == "chatgpt" || seen[info.Name] {
+ continue
+ }
+ orderedInfos = append(orderedInfos, info)
+ }
+
+ for _, info := range orderedInfos {
+ statuses = append(statuses, integrationStatus{
+ ID: info.Name,
+ Name: info.DisplayName,
+ Description: info.Description,
+ Command: "ollama launch " + info.Name,
+ })
+ }
+
+ statuses = append(statuses, integrationStatus{
+ ID: "terminal",
+ Name: "Terminal",
+ Description: "Run local models from your terminal",
+ Command: "ollama",
+ })
+
+ return json.NewEncoder(w).Encode(statuses)
+}
+
// handleError renders appropriate error responses based on request type
func (s *Server) handleError(w http.ResponseWriter, e error) {
// Preserve CORS headers for API requests
diff --git a/app/ui/ui_test.go b/app/ui/ui_test.go
index 674e17cc6..4f2709d79 100644
--- a/app/ui/ui_test.go
+++ b/app/ui/ui_test.go
@@ -18,6 +18,7 @@ import (
"github.com/ollama/ollama/api"
"github.com/ollama/ollama/app/store"
"github.com/ollama/ollama/app/updater"
+ "github.com/ollama/ollama/cmd/launch"
)
func TestHandlePostApiSettings(t *testing.T) {
@@ -119,6 +120,92 @@ func TestHandlePostApiSettings(t *testing.T) {
}
}
+func TestGetIntegrationStatuses(t *testing.T) {
+ server := &Server{
+ ClaudeDesktopInstalled: func() bool {
+ return true
+ },
+ }
+ req := httptest.NewRequest(http.MethodGet, "/api/v1/integrations", nil)
+ rr := httptest.NewRecorder()
+
+ if err := server.getIntegrationStatuses(rr, req); err != nil {
+ t.Fatalf("getIntegrationStatuses() error = %v", err)
+ }
+
+ var got []struct {
+ ID string `json:"id"`
+ Installed *bool `json:"installed"`
+ Command string `json:"command"`
+ }
+ if err := json.NewDecoder(rr.Body).Decode(&got); err != nil {
+ t.Fatalf("decode response: %v", err)
+ }
+
+ if len(got) < 5 {
+ t.Fatalf("got %d integrations, want the full registry", len(got))
+ }
+ wantPrefix := []string{"claude", "codex", "openclaw", "opencode", "droid", "pi", "cline"}
+ if runtime.GOOS == "darwin" {
+ if got[0].ID != "claude-desktop" || got[0].Installed == nil || !*got[0].Installed || got[0].Command != "" {
+ t.Fatalf("first integration = %+v, want command-free Claude Desktop connect", got[0])
+ }
+ wantPrefix = append([]string{"claude-desktop"}, wantPrefix...)
+ }
+ for i, want := range wantPrefix {
+ if got[i].ID != want {
+ t.Fatalf("integration %d = %q, want launcher menu order entry %q", i, got[i].ID, want)
+ }
+ }
+ byID := make(map[string]struct {
+ Installed *bool
+ Command string
+ }, len(got))
+ for _, item := range got {
+ byID[item.ID] = struct {
+ Installed *bool
+ Command string
+ }{item.Installed, item.Command}
+ }
+
+ if runtime.GOOS != "darwin" {
+ if _, ok := byID["claude-desktop"]; ok {
+ t.Fatal("Claude Desktop should not be exposed on Windows")
+ }
+ }
+ for name, item := range byID {
+ if name != "claude-desktop" && item.Installed != nil {
+ t.Errorf("%s should not include unused install status", name)
+ }
+ }
+ if item, ok := byID["claude"]; !ok || item.Command != "ollama launch claude" {
+ t.Fatal("Claude Code should include its launch command")
+ }
+ if _, ok := byID["chatgpt"]; ok {
+ t.Fatal("ChatGPT should be excluded from onboarding integrations")
+ }
+ wantCount := len(launch.ListIntegrationInfos()) // Terminal replaces omitted ChatGPT.
+ if runtime.GOOS == "darwin" {
+ wantCount++ // Claude Desktop is also available on macOS.
+ }
+ if len(got) != wantCount {
+ t.Fatalf("got %d integrations, want %d launcher entries", len(got), wantCount)
+ }
+ terminal := got[len(got)-1]
+ if terminal.ID != "terminal" || terminal.Installed != nil || terminal.Command != "ollama" {
+ t.Fatalf("last integration = %+v, want Terminal without install status", terminal)
+ }
+}
+
+func TestSupportsClaudeDesktopIntegration(t *testing.T) {
+ if !supportsClaudeDesktopIntegration("darwin") {
+ t.Fatal("Claude Desktop should be available on macOS")
+ }
+ if supportsClaudeDesktopIntegration("windows") {
+ t.Fatal("Claude Desktop should be hidden on Windows")
+ }
+}
+
func TestHandlePostApiCloudSetting(t *testing.T) {
tmpHome := t.TempDir()
t.Setenv("HOME", tmpHome)
diff --git a/app/webview/webview.h b/app/webview/webview.h
index 0a14f380e..0f04eead6 100644
--- a/app/webview/webview.h
+++ b/app/webview/webview.h
@@ -2535,19 +2535,9 @@ inline SIZE make_window_frame_size(HWND window, int width, int height,
return {frame_width, frame_height};
}
-inline bool is_dark_theme_enabled() {
- constexpr auto *sub_key =
- L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize";
- reg_key key(HKEY_CURRENT_USER, sub_key, 0, KEY_READ);
- if (!key.is_open()) {
- // Default is light theme
- return false;
- }
- return key.query_uint(L"AppsUseLightTheme", 1) == 0;
-}
-
inline void apply_window_theme(HWND window) {
- auto dark_theme_enabled = is_dark_theme_enabled();
+ // Ollama uses a light-only application appearance.
+ constexpr bool dark_theme_enabled = false;
// Use "immersive dark mode" on systems that support it.
// Changes the color of the window's title bar (light or dark).
diff --git a/app/wintray/eventloop.go b/app/wintray/eventloop.go
index b641723a2..15c86bd4f 100644
--- a/app/wintray/eventloop.go
+++ b/app/wintray/eventloop.go
@@ -78,9 +78,9 @@ func (t *winTray) wndProc(hWnd windows.Handle, message uint32, wParam, lParam ui
t.app.Quit()
case updateMenuID:
t.app.DoUpdate()
- case openUIMenuID:
+ case openAppsMenuID:
// UI must be initialized on this thread so don't use the callbacks
- t.app.UIRun("/")
+ t.app.UIRun("/connect")
case settingsUIMenuID:
// UI must be initialized on this thread so don't use the callbacks
t.app.UIRun("/settings")
@@ -191,11 +191,11 @@ func (t *winTray) wndProc(hWnd windows.Handle, message uint32, wParam, lParam ui
}
func focusUI(app AppCallbacks) {
- if app.UIRunning() {
+ if app.UIRunning() && app.UIOnboarding() {
app.UIShow()
return
}
- app.UIRun("/")
+ app.UIRun("/connect")
}
func (t *winTray) Quit() {
diff --git a/app/wintray/eventloop_test.go b/app/wintray/eventloop_test.go
index 365f1b995..bb2a0877b 100644
--- a/app/wintray/eventloop_test.go
+++ b/app/wintray/eventloop_test.go
@@ -5,32 +5,36 @@ package wintray
import "testing"
type lifecycleApp struct {
- running bool
- runPath string
- showCall bool
+ running bool
+ onboarding bool
+ runPath string
+ showCall bool
}
-func (a *lifecycleApp) UIRun(path string) { a.runPath = path }
-func (a *lifecycleApp) UIShow() { a.showCall = true }
-func (a *lifecycleApp) UITerminate() {}
-func (a *lifecycleApp) UIRunning() bool { return a.running }
-func (a *lifecycleApp) Quit() {}
-func (a *lifecycleApp) DoUpdate() {}
+func (a *lifecycleApp) UIRun(path string) { a.runPath = path }
+func (a *lifecycleApp) UIShow() { a.showCall = true }
+func (a *lifecycleApp) UITerminate() {}
+func (a *lifecycleApp) UIRunning() bool { return a.running }
+func (a *lifecycleApp) UIOnboarding() bool { return a.onboarding }
+func (a *lifecycleApp) Quit() {}
+func (a *lifecycleApp) DoUpdate() {}
func TestFocusUICreatesOrShowsWindow(t *testing.T) {
tests := []struct {
- name string
- running bool
- wantRun string
- wantShow bool
+ name string
+ running bool
+ onboarding bool
+ wantRun string
+ wantShow bool
}{
- {name: "creates window when tray only", wantRun: "/"},
- {name: "shows existing window", running: true, wantShow: true},
+ {name: "creates Apps window when tray only", wantRun: "/connect"},
+ {name: "routes existing window to Apps", running: true, wantRun: "/connect"},
+ {name: "preserves onboarding", running: true, onboarding: true, wantShow: true},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
- app := &lifecycleApp{running: tt.running}
+ app := &lifecycleApp{running: tt.running, onboarding: tt.onboarding}
focusUI(app)
if app.runPath != tt.wantRun {
t.Errorf("run path = %q, want %q", app.runPath, tt.wantRun)
diff --git a/app/wintray/menus.go b/app/wintray/menus.go
index 0e6ab53cc..67ea7e2f6 100644
--- a/app/wintray/menus.go
+++ b/app/wintray/menus.go
@@ -16,7 +16,7 @@ import (
const (
_ = iota
- openUIMenuID
+ openAppsMenuID
settingsUIMenuID
updateSeparatorMenuID
updateAvailableMenuID
@@ -28,10 +28,10 @@ const (
)
func (t *winTray) initMenus() error {
- if err := t.addOrUpdateMenuItem(settingsUIMenuID, 0, settingsUIMenuTitle, false); err != nil {
+ if err := t.addOrUpdateMenuItem(openAppsMenuID, 0, openAppsMenuTitle, false); err != nil {
return fmt.Errorf("unable to create menu entries %w", err)
}
- if err := t.addOrUpdateMenuItem(openUIMenuID, 0, openUIMenuTitle, false); err != nil {
+ if err := t.addOrUpdateMenuItem(settingsUIMenuID, 0, settingsUIMenuTitle, false); err != nil {
return fmt.Errorf("unable to create menu entries %w", err)
}
if err := t.addOrUpdateMenuItem(diagLogsMenuID, 0, diagLogsMenuTitle, false); err != nil {
diff --git a/app/wintray/messages.go b/app/wintray/messages.go
index 59afa1c39..18ba8c70f 100644
--- a/app/wintray/messages.go
+++ b/app/wintray/messages.go
@@ -12,6 +12,6 @@ const (
updateAvailableMenuTitle = "An update is available"
updateMenuTitle = "Restart to update"
diagLogsMenuTitle = "View logs"
- openUIMenuTitle = "Open Ollama Chat"
- settingsUIMenuTitle = "Settings..."
+ openAppsMenuTitle = "Open Ollama"
+ settingsUIMenuTitle = "Settings"
)
diff --git a/app/wintray/tray.go b/app/wintray/tray.go
index 179fbc1a4..de8f1337c 100644
--- a/app/wintray/tray.go
+++ b/app/wintray/tray.go
@@ -49,6 +49,7 @@ type AppCallbacks interface {
UIShow()
UITerminate()
UIRunning() bool
+ UIOnboarding() bool
Quit()
DoUpdate()
}
diff --git a/cmd/launch/claude_desktop.go b/cmd/launch/claude_desktop.go
index 419b594ec..d1618ac54 100644
--- a/cmd/launch/claude_desktop.go
+++ b/cmd/launch/claude_desktop.go
@@ -871,6 +871,14 @@ func ClaudeDesktopRunning() bool {
return running
}
+// OpenClaudeDesktop brings the installed Claude Desktop app to the foreground.
+func OpenClaudeDesktop() error {
+ if err := claudeDesktopSupported(); err != nil {
+ return err
+ }
+ return claudeDesktopOpenApp()
+}
+
func defaultClaudeDesktopRunning(ctx context.Context) (bool, error) {
var (
out []byte
@@ -907,7 +915,11 @@ func defaultClaudeDesktopOpenApp() error {
}
return errors.New("Claude Desktop executable was not found; open Claude Desktop manually once and re-run 'ollama launch claude-desktop --restore'")
case "darwin":
- return openClaudeDesktopDarwin()
+ path := claudeDesktopAppPath()
+ if path == "" {
+ return errors.New("Claude Desktop app was not found")
+ }
+ return openClaudeDesktopDarwin(path)
default:
return claudeDesktopSupported()
}
@@ -918,14 +930,18 @@ func defaultClaudeDesktopOpenAppPath(path string) error {
case "windows":
return exec.Command("powershell.exe", "-NoProfile", "-Command", "Start-Process -FilePath "+quotePowerShellString(path)).Run()
case "darwin":
- return openClaudeDesktopDarwin()
+ return openClaudeDesktopDarwin(path)
default:
return claudeDesktopSupported()
}
}
-func openClaudeDesktopDarwin() error {
- cmd := exec.Command("open", "-a", "Claude")
+func claudeDesktopDarwinOpenArgs(path string) []string {
+ return []string{path}
+}
+
+func openClaudeDesktopDarwin(path string) error {
+ cmd := exec.Command("/usr/bin/open", claudeDesktopDarwinOpenArgs(path)...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
return cmd.Run()
diff --git a/cmd/launch/claude_desktop_test.go b/cmd/launch/claude_desktop_test.go
index 019c6530d..6b2481821 100644
--- a/cmd/launch/claude_desktop_test.go
+++ b/cmd/launch/claude_desktop_test.go
@@ -490,6 +490,13 @@ func TestClaudeDesktopWindowsOpenDoesNotFallBackToClaudeCommand(t *testing.T) {
}
}
+func TestClaudeDesktopDarwinOpenTargetsDesktopApp(t *testing.T) {
+ path := "/Applications/Claude.app"
+ if got := claudeDesktopDarwinOpenArgs(path); len(got) != 1 || got[0] != path {
+ t.Fatalf("claudeDesktopDarwinOpenArgs(%q) = %q, want explicit app path", path, got)
+ }
+}
+
func TestClaudeDesktopConfigureIgnoresCloudAPIKey(t *testing.T) {
tmpDir := t.TempDir()
setTestHome(t, tmpDir)
@@ -976,6 +983,24 @@ func TestClaudeDesktopSetInstalledFromDesktopDoesNotOpenStoppedAppWhenDisabled(t
}
}
+func TestOpenClaudeDesktop(t *testing.T) {
+ setTestHome(t, t.TempDir())
+ withClaudeDesktopPlatform(t, "darwin")
+ openCalls := 0
+ withClaudeDesktopProcessHooks(t,
+ func() bool { return false },
+ func() error { t.Fatal("opening Claude should not quit it"); return nil },
+ func() error { openCalls++; return nil },
+ )
+
+ if err := OpenClaudeDesktop(); err != nil {
+ t.Fatalf("OpenClaudeDesktop returned error: %v", err)
+ }
+ if openCalls != 1 {
+ t.Fatalf("open calls = %d, want 1", openCalls)
+ }
+}
+
func TestClaudeDesktopRestoreForShutdownDoesNotReopenApp(t *testing.T) {
tmpDir := t.TempDir()
setTestHome(t, tmpDir)
diff --git a/cmd/launch/integrations_test.go b/cmd/launch/integrations_test.go
index a602d4b0f..8725c0e7d 100644
--- a/cmd/launch/integrations_test.go
+++ b/cmd/launch/integrations_test.go
@@ -70,8 +70,8 @@ func TestIntegrationLookup(t *testing.T) {
{"dsh", "dsh", true, "DeepSeek Harness"},
{"deepseek harness alias", "deepseek-harness", true, "DeepSeek Harness"},
{"opencode", "opencode", true, "OpenCode"},
- {"omp", "omp", true, "OMP"},
- {"pool", "pool", true, "Pool"},
+ {"omp", "omp", true, "Oh My Pi"},
+ {"pool", "pool", true, "Poolside"},
{"unknown integration", "unknown", false, ""},
{"empty string", "", false, ""},
}
diff --git a/cmd/launch/omp.go b/cmd/launch/omp.go
index 10c739f50..08cf1718c 100644
--- a/cmd/launch/omp.go
+++ b/cmd/launch/omp.go
@@ -26,7 +26,7 @@ const (
// OMP implements Runner for the OMP coding-agent integration.
type OMP struct{}
-func (o *OMP) String() string { return "OMP" }
+func (o *OMP) String() string { return "Oh My Pi" }
func (o *OMP) Paths() []string {
var paths []string
diff --git a/cmd/launch/omp_test.go b/cmd/launch/omp_test.go
index bc88cb3ef..dfbf477fb 100644
--- a/cmd/launch/omp_test.go
+++ b/cmd/launch/omp_test.go
@@ -58,8 +58,8 @@ func TestOMPIntegration(t *testing.T) {
o := &OMP{}
t.Run("String", func(t *testing.T) {
- if got := o.String(); got != "OMP" {
- t.Errorf("String() = %q, want %q", got, "OMP")
+ if got := o.String(); got != "Oh My Pi" {
+ t.Errorf("String() = %q, want %q", got, "Oh My Pi")
}
})
diff --git a/cmd/launch/poolside.go b/cmd/launch/poolside.go
index 72d4e6ee7..222e0a9ad 100644
--- a/cmd/launch/poolside.go
+++ b/cmd/launch/poolside.go
@@ -14,7 +14,7 @@ type Poolside struct{}
var poolsideGOOS = runtime.GOOS
-func (p *Poolside) String() string { return "Pool" }
+func (p *Poolside) String() string { return "Poolside" }
func poolsideUnsupportedError() error {
return fmt.Errorf("Warning: Poolside is not currently supported on Windows")