()
| 204 | * Returns an object with success status and any error message. |
| 205 | */ |
| 206 | export async function openCurrentSessionInDesktop(): Promise<{ |
| 207 | success: boolean |
| 208 | error?: string |
| 209 | deepLinkUrl?: string |
| 210 | }> { |
| 211 | const sessionId = getSessionId() |
| 212 | |
| 213 | // Check if Desktop is installed |
| 214 | const installed = await isDesktopInstalled() |
| 215 | if (!installed) { |
| 216 | return { |
| 217 | success: false, |
| 218 | error: |
| 219 | 'Claude Desktop is not installed. Install it from https://claude.ai/download', |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | // Build and open the deep link |
| 224 | const deepLinkUrl = buildDesktopDeepLink(sessionId) |
| 225 | const opened = await openDeepLink(deepLinkUrl) |
| 226 | |
| 227 | if (!opened) { |
| 228 | return { |
| 229 | success: false, |
| 230 | error: 'Failed to open Claude Desktop. Please try opening it manually.', |
| 231 | deepLinkUrl, |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | return { success: true, deepLinkUrl } |
| 236 | } |
no test coverage detected