|
|
@@ -28,7 +28,7 @@ import {
|
|
|
Show,
|
|
|
} from "solid-js"
|
|
|
import { Dynamic } from "solid-js/web"
|
|
|
-import { CommandProvider } from "@/context/command"
|
|
|
+import { CommandProvider, useCommand, type CommandOption } from "@/context/command"
|
|
|
import { CommentsProvider } from "@/context/comments"
|
|
|
import { FileProvider } from "@/context/file"
|
|
|
import { ServerSDKProvider, useServerSDK } from "@/context/server-sdk"
|
|
|
@@ -40,6 +40,7 @@ import { LayoutProvider } from "@/context/layout"
|
|
|
import { ModelsProvider } from "@/context/models"
|
|
|
import { NotificationProvider, useNotification } from "@/context/notification"
|
|
|
import { PermissionProvider } from "@/context/permission"
|
|
|
+import { usePlatform } from "@/context/platform"
|
|
|
import { PromptProvider } from "@/context/prompt"
|
|
|
import { ServerConnection, ServerProvider, serverName, useServer } from "@/context/server"
|
|
|
import { SettingsProvider, useSettings } from "@/context/settings"
|
|
|
@@ -300,12 +301,36 @@ function SharedProviders(props: ParentProps) {
|
|
|
<>
|
|
|
<BodyDesignClass />
|
|
|
<CommandProvider>
|
|
|
+ <DesktopCommands />
|
|
|
<HighlightsProvider>{props.children}</HighlightsProvider>
|
|
|
</CommandProvider>
|
|
|
</>
|
|
|
)
|
|
|
}
|
|
|
|
|
|
+function DesktopCommands() {
|
|
|
+ const command = useCommand()
|
|
|
+ const language = useLanguage()
|
|
|
+ const platform = usePlatform()
|
|
|
+
|
|
|
+ command.register("desktop", () => {
|
|
|
+ const commands: CommandOption[] = []
|
|
|
+ if (platform.platform === "desktop" && platform.exportDebugLogs) {
|
|
|
+ commands.push({
|
|
|
+ id: "logs.export",
|
|
|
+ title: "Export logs",
|
|
|
+ category: language.t("command.category.settings"),
|
|
|
+ onSelect: () => {
|
|
|
+ void platform.exportDebugLogs?.()
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return commands
|
|
|
+ })
|
|
|
+
|
|
|
+ return null
|
|
|
+}
|
|
|
+
|
|
|
// Server-scoped providers shared by the legacy shell and the top-level new shell.
|
|
|
type ServerScopedShellProps = ParentProps<{
|
|
|
directory?: () => string | undefined
|